detect
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDetect 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:
| File | Language/Framework |
|---|---|
| JavaScript/TypeScript (check for React, Next.js, Vue, Angular, Express, React Native, Electron, etc.) |
| Python (check for Django, Flask, FastAPI) |
| Go (check for Gin, Echo, Fiber, Chi) |
| Java/Kotlin (check for Spring, Quarkus, Android) |
| Ruby (check for Rails, Sinatra) |
| .NET/C# (check for ASP.NET, MAUI, Xamarin, WPF, UWP) |
| PHP (check for Laravel, Symfony) |
| Rust (check for Actix, Axum, Rocket) |
| Flutter/Dart |
| Swift/iOS |
| Android (also check |
| Erlang/Elixir |
| C/C++ (check for |
| Haskell |
| Lua |
| Roku (BrightScript) |
| Cloudflare Workers (edge SDK) |
| Vercel Edge (edge SDK) |
Read the dependency file to identify the specific framework. For , check both and .
package.jsondependenciesdevDependenciesIf 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.
查找以下标识文件(以及相关的根目录结构),然后读取对应的清单文件以推断语言和框架。
通过以下文件识别技术栈:
| 文件 | 语言/框架 |
|---|---|
| JavaScript/TypeScript(检查是否使用React、Next.js、Vue、Angular、Express、React Native、Electron等) |
| Python(检查是否使用Django、Flask、FastAPI) |
| Go(检查是否使用Gin、Echo、Fiber、Chi) |
| Java/Kotlin(检查是否使用Spring、Quarkus、Android) |
| Ruby(检查是否使用Rails、Sinatra) |
| .NET/C#(检查是否使用ASP.NET、MAUI、Xamarin、WPF、UWP) |
| PHP(检查是否使用Laravel、Symfony) |
| Rust(检查是否使用Actix、Axum、Rocket) |
| Flutter/Dart |
| Swift/iOS |
| Android(同时检查 |
| Erlang/Elixir |
| C/C++(检查 |
| Haskell |
| Lua |
| Roku(BrightScript) |
| Cloudflare Workers(边缘SDK) |
| Vercel Edge(边缘SDK) |
读取依赖文件以识别具体框架。对于,需同时检查和字段。
package.jsondependenciesdevDependencies如果无法识别语言或框架:
**D5 -- 阻塞:**立即调用结构化提问工具。
- 问题:"我无法检测到项目的语言或框架。你希望使用哪个SDK?"
- 选项:展示SDK 方案中的可用SDK作为可选选项。
- 停止操作。不要将问题以文本形式写出。在用户选择选项前,请勿继续执行。
2. Package manager
2. 包管理器
Identify how the project installs dependencies:
| Indicator | Package Manager |
|---|---|
| npm |
| yarn |
| pnpm |
| bun |
| pipenv |
| poetry |
| go modules |
| bundler |
Use the detected package manager for all install commands. If multiple lock files exist, prefer the one that was most recently modified.
确定项目安装依赖的方式:
| 标识 | 包管理器 |
|---|---|
| npm |
| yarn |
| pnpm |
| bun |
| pipenv |
| poetry |
| go modules |
| bundler |
使用检测到的包管理器执行所有安装命令。如果存在多个锁文件,优先选择最近修改的那个。
3. Monorepo layout
3. 单体仓库布局
Some repositories host multiple packages or services. Look for these indicators:
| File / pattern | Tool or layout |
|---|---|
| pnpm workspaces |
| Lerna |
| Nx |
| Turborepo |
| Rush |
| 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 workspaces |
| Lerna |
| Nx |
| Turborepo |
| Rush |
| 通用单体仓库 |
当出现上述任意情况时,请勿假设仓库根目录就是集成目标:
**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.jsonfield, or look for"main",index.js,server.js,app.jssrc/index.ts - NestJS: Look for or
src/main.tssrc/main.js - Python: Look for ,
app.py,main.py,manage.py, or thewsgi.pysection[tool.poetry.scripts] - Go: Look for or
main.gocmd/*/main.go - Java: Search for or
public static void main@SpringBootApplication - Ruby: Look for ,
config.ruconfig/application.rb - React/Vue/Angular: Look for ,
src/index.tsx,src/main.tsx,src/App.tsxsrc/main.ts - Next.js: App Router -- or
app/layout.tsx(root layout). Pages Router --app/layout.jsorpages/_app.tsxpages/_app.js - React Native: Look for ,
App.tsx,App.js(withindex.js)AppRegistry.registerComponent - Electron: Check
package.json; common paths include"main"ormain.jssrc/main.ts - JavaScript (browser): Look for ,
index.html, or bundler entry insrc/index.js/webpack.config.jsvite.config.ts - Flutter: Look for
lib/main.dart - Swift/iOS: Look for ,
AppDelegate.swift, orSceneDelegate.swiftstruct@main - Android: Look for or
MainActivity.javaMainActivity.kt
找到应用启动的主文件。在单体仓库中,完成第3节 单体仓库布局后,在选定的包内应用以下模式。常见模式:
- Node.js(服务端):检查的
package.json字段,或查找"main"、index.js、server.js、app.jssrc/index.ts - NestJS:查找或
src/main.tssrc/main.js - Python:查找、
app.py、main.py、manage.py,或wsgi.py部分[tool.poetry.scripts] - Go:查找或
main.gocmd/*/main.go - Java:搜索或
public static void main@SpringBootApplication - Ruby:查找、
config.ruconfig/application.rb - React/Vue/Angular:查找、
src/index.tsx、src/main.tsx、src/App.tsxsrc/main.ts - Next.js:App Router -- 或
app/layout.tsx(根布局)。Pages Router --app/layout.js或pages/_app.tsxpages/_app.js - React Native:查找、
App.tsx、App.js(包含index.js)AppRegistry.registerComponent - Electron:检查的
package.json字段;常见路径包括"main"或main.jssrc/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.javaMainActivity.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.
| State | Meaning | Criteria |
|---|---|---|
| Clear app | A runnable application was found | Language/framework detected, a real entrypoint exists, dependency manifest is present with application dependencies |
| Unclear / weak evidence | Something is present but it does not clearly represent a runnable app | Stray or minimal |
| No app found | No recognizable application structure was detected | No 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 with no
package.jsonsection and no application source filesscripts - A lone in a directory of data files or notebooks
requirements.txt - 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:
-
Clear app → continue to section 6 (Existing LaunchDarkly SDK) and then SDK confirmation.
-
Unclear / weak evidence:
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 at the root, but it has no start script and no application source files").
package.json - 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. ) using the simplest stack you can scaffold (Node.js + Express or a static HTML page are good defaults), then continue detection from that subfolder.
launchdarkly-demo/Do not declare onboarding complete unless the app target has been confirmed and the app can actually run.
完成第1-4节后,在继续之前将工作区分为三种状态之一。该分类将决定后续流程的走向。
| 状态 | 含义 | 判定标准 |
|---|---|---|
| 明确应用 | 找到可运行的应用 | 已检测到语言/框架,存在真实入口文件,包含应用依赖的清单文件 |
| 不明确/弱证据 | 存在一些文件,但无法明确代表可运行的应用 | 零散或极简的 |
| 未找到应用 | 未检测到可识别的应用结构 | 无依赖清单文件、无入口文件、无匹配已知模式的源码文件,或工作区为空/仅包含文档 |
弱证据不得视为确认依据。弱证据示例:
- 无部分且无应用源码文件的
scriptspackage.json - 位于数据文件或笔记本目录中的孤立
requirements.txt - 包含清单文件但不代表可运行服务的配置、主题或测试用例目录
- 真实应用位于子目录但未被选中的单体仓库根目录
按状态分支:
-
明确应用 → 继续执行第6节(已有LaunchDarkly SDK),然后进行SDK确认。
-
不明确/弱证据:
**D5-UNCLEAR -- 阻塞:**立即调用结构化提问工具。
- 问题:"我找到了一些项目文件,但无法确定要集成的正确应用。你能告诉我正确的应用文件夹路径吗?"
- 上下文:简要描述已发现内容及模糊原因(例如:"根目录存在,但无启动脚本且无应用源码文件")。
package.json - 选项:
- 展示已检测到的候选文件夹作为可选选项
- "在其他位置——我会告诉你路径"
- "还没有应用——帮我创建一个演示应用"
- 停止操作。在用户确认目标前,请勿进行代码修改、安装包或生成集成规划。在用户选择选项前,请勿继续执行。
用户指明正确文件夹后,在该文件夹范围内重新执行检测步骤(第1-4节)。
- 未找到应用:
明确告知用户:"我在该工作区中未找到可运行的应用。" 然后提供两个选项:
**D5-NOAPP -- 阻塞:**立即调用结构化提问工具。
- 问题:"我在该工作区中未找到可运行的应用。你希望如何继续?"
- 选项:
- "告诉我正确的文件夹——应用在其他位置"
- "创建一个极简演示应用,以便我试用LaunchDarkly"
- 停止操作。在用户选择选项前,请勿继续执行。
如果用户选择"告诉我正确的文件夹",在用户提供的路径范围内重新执行检测。如果用户选择"创建演示应用",在新的子文件夹(例如)中创建一个极简可运行应用,使用最简单的可搭建技术栈(Node.js + Express或静态HTML页面是不错的默认选择),然后在该子文件夹中继续执行检测。
launchdarkly-demo/除非已确认应用目标且应用确实可运行,否则不得宣布入门流程完成。
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阻塞问题中处理。
完成后(正常流程):生成集成规划",