detect

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Detect repository stack (SDK install)

检测仓库技术栈(SDK 安装)

Before installing anything, you must understand the project. Identify what the project is built with and whether LaunchDarkly is already present.
This skill is nested under LaunchDarkly SDK Install (onboarding); the parent Step 1 is detect. Next: Generate integration plan unless the decision tree sends you elsewhere.
在安装任何内容之前,你必须先了解项目情况。明确项目的技术栈以及是否已引入LaunchDarkly。
该技能隶属于LaunchDarkly SDK 安装(入门);父步骤步骤1检测下一步:生成集成规划,除非决策树引导你前往其他环节。

1. Language and framework

1. 语言与框架

Look for the indicator files below (and related root layout), then read the relevant manifests to infer language and framework.
Look for these files to identify the stack:
FileLanguage/Framework
package.json
JavaScript/TypeScript (check for React, Next.js, Vue, Angular, Express, React Native, Electron, etc.)
requirements.txt
,
pyproject.toml
,
Pipfile
,
setup.py
Python (check for Django, Flask, FastAPI)
go.mod
Go (check for Gin, Echo, Fiber, Chi)
pom.xml
,
build.gradle
,
build.gradle.kts
Java/Kotlin (check for Spring, Quarkus, Android)
Gemfile
Ruby (check for Rails, Sinatra)
*.csproj
,
*.sln
,
*.fsproj
.NET/C# (check for ASP.NET, MAUI, Xamarin, WPF, UWP)
composer.json
PHP (check for Laravel, Symfony)
Cargo.toml
Rust (check for Actix, Axum, Rocket)
pubspec.yaml
Flutter/Dart
Package.swift
,
Podfile
,
*.xcodeproj
Swift/iOS
AndroidManifest.xml
Android (also check
build.gradle
for
com.android
)
rebar.config
,
mix.exs
Erlang/Elixir
CMakeLists.txt
,
Makefile
(with C/C++ patterns)
C/C++ (check for
#include
patterns)
*.cabal
,
stack.yaml
Haskell
*.lua
,
rockspec
Lua
manifest
,
*.brs
Roku (BrightScript)
wrangler.toml
Cloudflare Workers (edge SDK)
vercel.json
with edge functions
Vercel Edge (edge SDK)
Read the dependency file to identify the specific framework. For
package.json
, check both
dependencies
and
devDependencies
.
If you cannot identify the language or framework:
D5 -- BLOCKING: Call your structured question tool now.
  • question: "I couldn't detect the project's language or framework. Which SDK would you like to use?"
  • options: Present the available SDKs from SDK recipes as selectable options.
  • STOP. Do not write the question as text. Do not continue until the user selects an option.
查找以下标识文件(以及相关的根目录结构),然后读取对应的清单文件以推断语言和框架。
通过以下文件识别技术栈:
文件语言/框架
package.json
JavaScript/TypeScript(检查是否使用React、Next.js、Vue、Angular、Express、React Native、Electron等)
requirements.txt
,
pyproject.toml
,
Pipfile
,
setup.py
Python(检查是否使用Django、Flask、FastAPI)
go.mod
Go(检查是否使用Gin、Echo、Fiber、Chi)
pom.xml
,
build.gradle
,
build.gradle.kts
Java/Kotlin(检查是否使用Spring、Quarkus、Android)
Gemfile
Ruby(检查是否使用Rails、Sinatra)
*.csproj
,
*.sln
,
*.fsproj
.NET/C#(检查是否使用ASP.NET、MAUI、Xamarin、WPF、UWP)
composer.json
PHP(检查是否使用Laravel、Symfony)
Cargo.toml
Rust(检查是否使用Actix、Axum、Rocket)
pubspec.yaml
Flutter/Dart
Package.swift
,
Podfile
,
*.xcodeproj
Swift/iOS
AndroidManifest.xml
Android(同时检查
build.gradle
中的
com.android
标识)
rebar.config
,
mix.exs
Erlang/Elixir
CMakeLists.txt
,
Makefile
(包含C/C++模式)
C/C++(检查
#include
模式)
*.cabal
,
stack.yaml
Haskell
*.lua
,
rockspec
Lua
manifest
,
*.brs
Roku(BrightScript)
wrangler.toml
Cloudflare Workers(边缘SDK)
vercel.json
搭配边缘函数
Vercel Edge(边缘SDK)
读取依赖文件以识别具体框架。对于
package.json
,需同时检查
dependencies
devDependencies
字段。
如果无法识别语言或框架:
**D5 -- 阻塞:**立即调用结构化提问工具。
  • 问题:"我无法检测到项目的语言或框架。你希望使用哪个SDK?"
  • 选项:展示SDK 方案中的可用SDK作为可选选项。
  • 停止操作。不要将问题以文本形式写出。在用户选择选项前,请勿继续执行。

2. Package manager

2. 包管理器

Identify how the project installs dependencies:
IndicatorPackage Manager
package-lock.json
npm
yarn.lock
yarn
pnpm-lock.yaml
pnpm
bun.lockb
bun
Pipfile.lock
pipenv
poetry.lock
poetry
go.sum
go modules
Gemfile.lock
bundler
Use the detected package manager for all install commands. If multiple lock files exist, prefer the one that was most recently modified.
确定项目安装依赖的方式:
标识包管理器
package-lock.json
npm
yarn.lock
yarn
pnpm-lock.yaml
pnpm
bun.lockb
bun
Pipfile.lock
pipenv
poetry.lock
poetry
go.sum
go modules
Gemfile.lock
bundler
使用检测到的包管理器执行所有安装命令。如果存在多个锁文件,优先选择最近修改的那个。

3. Monorepo layout

3. 单体仓库布局

Some repositories host multiple packages or services. Look for these indicators:
File / patternTool or layout
pnpm-workspace.yaml
pnpm workspaces
lerna.json
Lerna
nx.json
Nx
turbo.json
Turborepo
rush.json
Rush
packages/
directory with multiple
package.json
files
Generic monorepo
When any of these apply, do not assume the repo root is the integration target:
D5 -- BLOCKING: Call your structured question tool now.
  • question: "This is a monorepo. Which package, app, or service should I integrate LaunchDarkly into?"
  • options: List the discovered packages/apps as selectable options.
  • STOP. Do not write the question as text. Do not continue until the user selects an option.
Then run the rest of this detect step -- language, package manager, entrypoint, and SDK search -- in that target directory (and its subtree), not only at the root.
部分仓库包含多个包或服务。查找以下标识:
文件/模式工具或布局
pnpm-workspace.yaml
pnpm workspaces
lerna.json
Lerna
nx.json
Nx
turbo.json
Turborepo
rush.json
Rush
packages/
目录下包含多个
package.json
文件
通用单体仓库
当出现上述任意情况时,请勿假设仓库根目录就是集成目标
**D5 -- 阻塞:**立即调用结构化提问工具。
  • 问题:"这是一个单体仓库。我应该将LaunchDarkly集成到哪个包、应用或服务中?"
  • 选项:列出已发现的包/应用作为可选选项。
  • 停止操作。不要将问题以文本形式写出。在用户选择选项前,请勿继续执行。
然后在该目标目录(及其子目录)中重新执行本检测步骤的剩余部分——语言、包管理器、入口文件和SDK搜索,而不仅仅在根目录执行。

4. Application entrypoint

4. 应用入口文件

Find the main file where the application starts. In a monorepo, apply the patterns below within the chosen package after section 3 Monorepo layout. Common patterns:
  • Node.js (server): Check
    package.json
    "main"
    field, or look for
    index.js
    ,
    server.js
    ,
    app.js
    ,
    src/index.ts
  • NestJS: Look for
    src/main.ts
    or
    src/main.js
  • Python: Look for
    app.py
    ,
    main.py
    ,
    manage.py
    ,
    wsgi.py
    , or the
    [tool.poetry.scripts]
    section
  • Go: Look for
    main.go
    or
    cmd/*/main.go
  • Java: Search for
    public static void main
    or
    @SpringBootApplication
  • Ruby: Look for
    config.ru
    ,
    config/application.rb
  • React/Vue/Angular: Look for
    src/index.tsx
    ,
    src/main.tsx
    ,
    src/App.tsx
    ,
    src/main.ts
  • Next.js: App Router --
    app/layout.tsx
    or
    app/layout.js
    (root layout). Pages Router --
    pages/_app.tsx
    or
    pages/_app.js
  • React Native: Look for
    App.tsx
    ,
    App.js
    ,
    index.js
    (with
    AppRegistry.registerComponent
    )
  • Electron: Check
    package.json
    "main"
    ; common paths include
    main.js
    or
    src/main.ts
  • JavaScript (browser): Look for
    index.html
    ,
    src/index.js
    , or bundler entry in
    webpack.config.js
    /
    vite.config.ts
  • Flutter: Look for
    lib/main.dart
  • Swift/iOS: Look for
    AppDelegate.swift
    ,
    SceneDelegate.swift
    , or
    @main
    struct
  • Android: Look for
    MainActivity.java
    or
    MainActivity.kt
找到应用启动的主文件。在单体仓库中,完成第3节 单体仓库布局后,在选定的包内应用以下模式。常见模式:
  • Node.js(服务端):检查
    package.json
    "main"
    字段,或查找
    index.js
    server.js
    app.js
    src/index.ts
  • NestJS:查找
    src/main.ts
    src/main.js
  • Python:查找
    app.py
    main.py
    manage.py
    wsgi.py
    ,或
    [tool.poetry.scripts]
    部分
  • Go:查找
    main.go
    cmd/*/main.go
  • Java:搜索
    public static void main
    @SpringBootApplication
  • Ruby:查找
    config.ru
    config/application.rb
  • React/Vue/Angular:查找
    src/index.tsx
    src/main.tsx
    src/App.tsx
    src/main.ts
  • Next.js:App Router --
    app/layout.tsx
    app/layout.js
    (根布局)。Pages Router --
    pages/_app.tsx
    pages/_app.js
  • React Native:查找
    App.tsx
    App.js
    index.js
    (包含
    AppRegistry.registerComponent
  • Electron:检查
    package.json
    "main"
    字段;常见路径包括
    main.js
    src/main.ts
  • JavaScript(浏览器端):查找
    index.html
    src/index.js
    ,或
    webpack.config.js
    /
    vite.config.ts
    中的打包入口配置
  • Flutter:查找
    lib/main.dart
  • Swift/iOS:查找
    AppDelegate.swift
    SceneDelegate.swift
    ,或带有
    @main
    的结构体
  • Android:查找
    MainActivity.java
    MainActivity.kt

5a. Classify workspace confidence

5a. 工作区置信度分类

After sections 1-4, classify the workspace into one of three states before continuing. This classification determines how the rest of the flow proceeds.
StateMeaningCriteria
Clear appA runnable application was foundLanguage/framework detected, a real entrypoint exists, dependency manifest is present with application dependencies
Unclear / weak evidenceSomething is present but it does not clearly represent a runnable appStray or minimal
package.json
(e.g. only devDependencies, no scripts), isolated config/manifest files, theme or config-only folders, token/fixture JSON, lockfiles without corresponding source, or multiple conflicting indicators with no dominant app structure
No app foundNo recognizable application structure was detectedNo dependency manifests, no entrypoints, no source files matching known patterns, or the workspace is empty / contains only documentation
Weak evidence must not be treated as confirmation. Examples of weak evidence:
  • A
    package.json
    with no
    scripts
    section and no application source files
  • A lone
    requirements.txt
    in a directory of data files or notebooks
  • Config, theme, or fixture directories with manifests that do not represent a runnable service
  • Monorepo roots where the real apps live in subdirectories but none was selected
Branching by state:
D5-UNCLEAR -- BLOCKING: Call your structured question tool now.
  • question: "I found some project files, but I'm not confident I've identified the right application to integrate. Can you point me to the correct app folder?"
  • context: Briefly describe what you found and why it's ambiguous (e.g., "There's a
    package.json
    at the root, but it has no start script and no application source files").
  • options:
    • Present any candidate folders you detected as selectable options
    • "It's somewhere else -- I'll tell you the path"
    • "There is no app yet -- help me create a demo"
  • STOP. Do not make code changes, install packages, or generate an integration plan until the user confirms the target. Do not continue until the user selects an option.
After the user points to the correct folder, re-run detection (sections 1-4) scoped to that folder.
  • No app found:
Tell the user clearly: "I didn't find a runnable application in this workspace." Then offer two paths:
D5-NOAPP -- BLOCKING: Call your structured question tool now.
  • question: "I didn't find a runnable application in this workspace. How would you like to proceed?"
  • options:
    • "Point me to the right folder -- the app is somewhere else"
    • "Create a minimal demo app so I can try LaunchDarkly"
  • STOP. Do not continue until the user selects an option.
If the user chooses "point me to the right folder," re-run detection scoped to the path they provide. If they choose "create a demo app," create a minimal runnable app in a new subfolder (e.g.
launchdarkly-demo/
) using the simplest stack you can scaffold (Node.js + Express or a static HTML page are good defaults), then continue detection from that subfolder.
Do not declare onboarding complete unless the app target has been confirmed and the app can actually run.
完成第1-4节后,在继续之前将工作区分为三种状态之一。该分类将决定后续流程的走向。
状态含义判定标准
明确应用找到可运行的应用已检测到语言/框架,存在真实入口文件,包含应用依赖的清单文件
不明确/弱证据存在一些文件,但无法明确代表可运行的应用零散或极简的
package.json
(例如仅包含devDependencies,无scripts)、孤立的配置/清单文件、仅包含主题或配置的文件夹、令牌/测试用例JSON文件、无对应源码的锁文件,或存在多个冲突标识且无主导应用结构
未找到应用未检测到可识别的应用结构无依赖清单文件、无入口文件、无匹配已知模式的源码文件,或工作区为空/仅包含文档
弱证据不得视为确认依据。弱证据示例:
  • scripts
    部分且无应用源码文件的
    package.json
  • 位于数据文件或笔记本目录中的孤立
    requirements.txt
  • 包含清单文件但不代表可运行服务的配置、主题或测试用例目录
  • 真实应用位于子目录但未被选中的单体仓库根目录
按状态分支:
**D5-UNCLEAR -- 阻塞:**立即调用结构化提问工具。
  • 问题:"我找到了一些项目文件,但无法确定要集成的正确应用。你能告诉我正确的应用文件夹路径吗?"
  • 上下文:简要描述已发现内容及模糊原因(例如:"根目录存在
    package.json
    ,但无启动脚本且无应用源码文件")。
  • 选项:
    • 展示已检测到的候选文件夹作为可选选项
    • "在其他位置——我会告诉你路径"
    • "还没有应用——帮我创建一个演示应用"
  • 停止操作。在用户确认目标前,请勿进行代码修改、安装包或生成集成规划。在用户选择选项前,请勿继续执行。
用户指明正确文件夹后,在该文件夹范围内重新执行检测步骤(第1-4节)。
  • 未找到应用:
明确告知用户:"我在该工作区中未找到可运行的应用。" 然后提供两个选项:
**D5-NOAPP -- 阻塞:**立即调用结构化提问工具。
  • 问题:"我在该工作区中未找到可运行的应用。你希望如何继续?"
  • 选项:
    • "告诉我正确的文件夹——应用在其他位置"
    • "创建一个极简演示应用,以便我试用LaunchDarkly"
  • 停止操作。在用户选择选项前,请勿继续执行。
如果用户选择"告诉我正确的文件夹",在用户提供的路径范围内重新执行检测。如果用户选择"创建演示应用",在新的子文件夹(例如
launchdarkly-demo/
)中创建一个极简可运行应用,使用最简单的可搭建技术栈(Node.js + Express或静态HTML页面是不错的默认选择),然后在该子文件夹中继续执行检测。
除非已确认应用目标且应用确实可运行,否则不得宣布入门流程完成

6. Existing LaunchDarkly SDK

6. 已有LaunchDarkly SDK

Search the codebase for existing LaunchDarkly usage:
Search for: launchdarkly, ldclient, ld-client, LDClient, @launchdarkly, launchdarkly-
Check:
  • Is the SDK already in the dependency file?
  • Is there initialization code?
  • Is it properly configured or partially set up?
  • Are there already feature flag evaluations?
在代码库中搜索已有的LaunchDarkly使用痕迹:
Search for: launchdarkly, ldclient, ld-client, LDClient, @launchdarkly, launchdarkly-
检查:
  • SDK是否已在依赖文件中?
  • 是否存在初始化代码?
  • 是否已正确配置或部分设置?
  • 是否已存在功能旗标评估代码?

SDK confirmation

SDK确认

After detecting the stack, confirm the SDK choice with the user:
  • If one SDK is clearly the right fit: Present your recommendation and get confirmation:
D5 -- BLOCKING: Call your structured question tool now.
  • question: "Based on what I found, I recommend the [SDK name] SDK. Does that look right?"
  • options:
    • "Yes, proceed with that SDK" -> continue to plan
    • "No, I want a different one" -> let user specify
  • STOP. Do not write the question as text. Do not continue until the user selects an option.
  • If multiple SDKs could apply (e.g., a Next.js project with both server and client components):
    • If the user already asked for both (e.g. "frontend and backend," "server + browser," "API and SPA"): Treat that as a dual-SDK scope. Proceed to Generate integration plan with both SDKs in scope -- do not plan or implement only one and assume the other is "covered."
    • If scope is unclear:
D5 -- BLOCKING: Call your structured question tool now.
  • question: "This project has both server-side and client-side surfaces. Which do you want to integrate?"
  • options:
    • "Server-side only"
    • "Client-side only"
    • "Both server-side and client-side"
  • STOP. Do not write the question as text. Do not continue until the user selects an option.
If they choose both, the plan must include two concrete integrations (see plan: Dual SDK integrations).
  • If you cannot determine the right SDK: Present the available options from the SDK recipes as selectable options in your question tool and use the same blocking pattern above.
完成技术栈检测后,与用户确认SDK选择:
  • 如果有一个SDK明显是最佳选择:展示你的推荐并获取确认:
**D5 -- 阻塞:**立即调用结构化提问工具。
  • 问题:"根据我的检测结果,我推荐使用[SDK名称] SDK。这个选择合适吗?"
  • 选项:
    • "是的,使用该SDK继续" → 进入规划环节
    • "不,我想使用其他SDK" → 让用户指定
  • 停止操作。不要将问题以文本形式写出。在用户选择选项前,请勿继续执行。
  • 如果多个SDK适用(例如,同时包含服务端和客户端组件的Next.js项目):
    • 如果用户已明确要求同时集成两者(例如"前端和后端"、"服务端+浏览器"、"API和SPA"):将其视为双SDK范围。继续执行生成集成规划,需将两个SDK都纳入范围——请勿仅规划或实现其中一个并假设另一个已"覆盖"。
    • 如果范围不明确
**D5 -- 阻塞:**立即调用结构化提问工具。
  • 问题:"该项目同时包含服务端和客户端层面。你希望集成哪一部分?"
  • 选项:
    • "仅服务端"
    • "仅客户端"
    • "服务端和客户端都集成"
  • 停止操作。不要将问题以文本形式写出。在用户选择选项前,请勿继续执行。
如果用户选择两者都集成,规划必须包含两个具体集成方案(参见规划:双SDK集成)。
  • 如果无法确定合适的SDK:在提问工具中展示SDK 方案中的可用选项,并使用上述阻塞模式。

Decision tree

决策树

After detection and confirmation:
  • No app found or unclear --> Already handled by D5-NOAPP / D5-UNCLEAR in section 5a. Do not proceed to plan until the user confirms a real app target.
  • SDK already installed and initialized --> Skip to Create first feature flag (parent Step 6)
  • SDK installed but not initialized --> Skip to Apply code changes (just add init code)
  • SDK not present --> Continue to Generate integration plan
  • Multiple targets detected (e.g., frontend + backend) --> If the user wants both SDKs (confirmed via D5 above), continue to Generate integration plan with dual-SDK scope (two packages, two entrypoints). If they want one surface only, plan for that single SDK.
  • Language not detected --> Already handled by the D5 blocking question in section 1.

Upon completion (normal path): Generate integration plan
完成检测和确认后:
  • 未找到应用或不明确 --> 已在第5a节的D5-NOAPP / D5-UNCLEAR中处理。在用户确认真实应用目标前,请勿进入规划环节。
  • SDK已安装并初始化 --> 跳转到创建第一个功能旗标(父步骤6)
  • SDK已安装但未初始化 --> 跳转到应用代码变更(仅添加初始化代码)
  • SDK未安装 --> 继续执行生成集成规划
  • 检测到多个目标(例如前端+后端) --> 如果用户希望同时集成两个SDK(通过上述D5确认),继续执行生成集成规划,采用双SDK范围(两个包、两个入口文件)。如果用户仅希望集成一个层面,则针对该单个SDK进行规划。
  • 未检测到语言 --> 已在第1节的D5阻塞问题中处理。

完成后(正常流程):生成集成规划",