sdd-flow-kit 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/adapters/index.js
CHANGED
|
@@ -25,6 +25,11 @@ function createManualAdapter(name, displayName, bins) {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
async function runClaudeFlow(args) {
|
|
28
|
+
// 默认关闭“二次调用 claude”自动执行,避免在 AI 会话内递归触发导致静默挂起。
|
|
29
|
+
// 仅在显式开启时执行:SDD_FLOW_KIT_ENABLE_CLAUDE_AUTORUN=1
|
|
30
|
+
if (node_process_1.default.env.SDD_FLOW_KIT_ENABLE_CLAUDE_AUTORUN !== "1") {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
28
33
|
const hasClaude = hasCommand("claude");
|
|
29
34
|
if (!hasClaude)
|
|
30
35
|
return false;
|
package/dist/postinstall.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const node_path_1 = __importDefault(require("node:path"));
|
|
7
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
7
8
|
const node_process_1 = __importDefault(require("node:process"));
|
|
8
9
|
const setupProject_1 = require("./steps/setupProject");
|
|
9
10
|
const ALLOWED_PROJECTS = ["OMS", "ADI", "欢盟", "AD Tools"];
|
|
@@ -14,6 +15,41 @@ function resolveProjectKindFromEnv() {
|
|
|
14
15
|
}
|
|
15
16
|
return "OMS";
|
|
16
17
|
}
|
|
18
|
+
async function inferProjectKind(projectRoot) {
|
|
19
|
+
const fromEnv = (node_process_1.default.env.SDD_FLOW_KIT_PROJECT ?? "").trim();
|
|
20
|
+
if (ALLOWED_PROJECTS.includes(fromEnv)) {
|
|
21
|
+
return fromEnv;
|
|
22
|
+
}
|
|
23
|
+
const base = node_path_1.default.basename(projectRoot).toLowerCase();
|
|
24
|
+
const hit = (s) => base.includes(s);
|
|
25
|
+
if (hit("adi") || hit("adinsight"))
|
|
26
|
+
return "ADI";
|
|
27
|
+
if (hit("oms") || hit("operation"))
|
|
28
|
+
return "OMS";
|
|
29
|
+
if (hit("huan-union") || hit("hm"))
|
|
30
|
+
return "欢盟";
|
|
31
|
+
if (hit("ad-tools") || hit("adtools") || hit("tools"))
|
|
32
|
+
return "AD Tools";
|
|
33
|
+
// 尝试读取项目 package.json 的 name 做二次推断
|
|
34
|
+
try {
|
|
35
|
+
const pkgText = await promises_1.default.readFile(node_path_1.default.join(projectRoot, "package.json"), "utf8");
|
|
36
|
+
const pkg = JSON.parse(pkgText);
|
|
37
|
+
const name = (pkg.name ?? "").toLowerCase();
|
|
38
|
+
const has = (s) => name.includes(s);
|
|
39
|
+
if (has("adi") || has("adinsight"))
|
|
40
|
+
return "ADI";
|
|
41
|
+
if (has("oms") || has("operation"))
|
|
42
|
+
return "OMS";
|
|
43
|
+
if (has("huan-union") || has("hm"))
|
|
44
|
+
return "欢盟";
|
|
45
|
+
if (has("ad-tools") || has("adtools") || has("tools"))
|
|
46
|
+
return "AD Tools";
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// ignore and fallback
|
|
50
|
+
}
|
|
51
|
+
return "OMS";
|
|
52
|
+
}
|
|
17
53
|
async function main() {
|
|
18
54
|
// npm/pnpm 安装依赖时,INIT_CWD 指向用户项目根目录。
|
|
19
55
|
const initCwd = node_process_1.default.env.INIT_CWD ? node_path_1.default.resolve(node_process_1.default.env.INIT_CWD) : null;
|
|
@@ -23,11 +59,11 @@ async function main() {
|
|
|
23
59
|
if (projectRoot === pkgDir)
|
|
24
60
|
return;
|
|
25
61
|
const isInteractive = Boolean(node_process_1.default.stdin.isTTY && node_process_1.default.stdout.isTTY);
|
|
26
|
-
const projectKind =
|
|
62
|
+
const projectKind = await inferProjectKind(projectRoot);
|
|
27
63
|
// eslint-disable-next-line no-console
|
|
28
64
|
console.log(`[sdd-flow-kit] postinstall bootstrap at: ${projectRoot}`);
|
|
29
65
|
// eslint-disable-next-line no-console
|
|
30
|
-
console.log(`[sdd-flow-kit] interactive=${isInteractive},
|
|
66
|
+
console.log(`[sdd-flow-kit] interactive=${isInteractive}, inferredProject=${projectKind}`);
|
|
31
67
|
await (0, setupProject_1.setupProject)({
|
|
32
68
|
projectRoot,
|
|
33
69
|
agent: "claude-code",
|
package/package.json
CHANGED
|
@@ -13,6 +13,9 @@ except ImportError:
|
|
|
13
13
|
print("❌ 请先安装 playwright: pip install playwright && playwright install chromium")
|
|
14
14
|
sys.exit(1)
|
|
15
15
|
|
|
16
|
+
DEFAULT_CONFLUENCE_USERNAME = "lixinxin"
|
|
17
|
+
DEFAULT_CONFLUENCE_PASSWORD = "Xin@147258"
|
|
18
|
+
|
|
16
19
|
|
|
17
20
|
def env(name: str, default: str | None = None) -> str:
|
|
18
21
|
v = os.environ.get(name, default)
|
|
@@ -54,7 +57,11 @@ def version_slug(prefix: str, version: str) -> str:
|
|
|
54
57
|
|
|
55
58
|
|
|
56
59
|
def search_keywords(prefix: str, version: str) -> list[str]:
|
|
57
|
-
|
|
60
|
+
# 搜索时强制带 V,并增加不带前缀的 V 兜底项:
|
|
61
|
+
# 1) ADI-V2.3.3
|
|
62
|
+
# 2) ADI_V2.3.3
|
|
63
|
+
# 3) V2.3.3
|
|
64
|
+
return [f"{prefix}-V{version}", f"{prefix}_V{version}", f"V{version}"]
|
|
58
65
|
|
|
59
66
|
|
|
60
67
|
def sanitize_filename(name: str) -> str:
|
|
@@ -184,8 +191,16 @@ def main():
|
|
|
184
191
|
|
|
185
192
|
base_url = env("CONFLUENCE_BASE_URL", "https://confluence.huan.tv") or "https://confluence.huan.tv"
|
|
186
193
|
search_url = env("CONFLUENCE_SEARCH_URL") or f"{base_url.rstrip('/')}/dosearchsite.action?includeArchivedSpaces=false"
|
|
187
|
-
username =
|
|
188
|
-
|
|
194
|
+
username = (
|
|
195
|
+
env("CONFLUENCE_USERNAME")
|
|
196
|
+
or env("CONFLUENCE_USER")
|
|
197
|
+
or DEFAULT_CONFLUENCE_USERNAME
|
|
198
|
+
)
|
|
199
|
+
password = (
|
|
200
|
+
env("CONFLUENCE_PASSWORD")
|
|
201
|
+
or env("CONFLUENCE_PASS")
|
|
202
|
+
or DEFAULT_CONFLUENCE_PASSWORD
|
|
203
|
+
)
|
|
189
204
|
prefix = os.environ.get("DOC_PRODUCT_PREFIX", "{{DOC_PRODUCT_PREFIX}}").strip() or "{{DOC_PRODUCT_PREFIX}}"
|
|
190
205
|
version = normalize_version(sys.argv[1])
|
|
191
206
|
keywords = search_keywords(prefix, version)
|
|
@@ -21,12 +21,12 @@ description: |
|
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
23
|
cd docs/{{SKILL_DIR}}
|
|
24
|
-
export CONFLUENCE_USERNAME="<你的账号>"
|
|
25
|
-
export CONFLUENCE_PASSWORD="<你的密码>"
|
|
26
24
|
export DOC_PRODUCT_PREFIX="{{PRODUCT_PREFIX}}"
|
|
27
25
|
python3 confluence-doc.py <版本号>
|
|
28
26
|
```
|
|
29
27
|
|
|
28
|
+
说明:脚本内置默认账号密码(`lixinxin` / `Xin@147258`),可直接执行;如需覆盖,再设置 `CONFLUENCE_USERNAME` / `CONFLUENCE_PASSWORD`。
|
|
29
|
+
|
|
30
30
|
版本号支持多种写法:
|
|
31
31
|
|
|
32
32
|
```bash
|
|
@@ -36,6 +36,12 @@ python3 confluence-doc.py {{PRODUCT_PREFIX}}-V1.2.3
|
|
|
36
36
|
python3 confluence-doc.py {{PRODUCT_PREFIX}}_V1.2.3
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
脚本搜索顺序(强制带 `V`):
|
|
40
|
+
|
|
41
|
+
1. `{{PRODUCT_PREFIX}}-V<版本>`
|
|
42
|
+
2. `{{PRODUCT_PREFIX}}_V<版本>`
|
|
43
|
+
3. `V<版本>`(兜底)
|
|
44
|
+
|
|
39
45
|
## 输出结构
|
|
40
46
|
|
|
41
47
|
```
|
|
@@ -50,7 +56,7 @@ python3 confluence-doc.py {{PRODUCT_PREFIX}}_V1.2.3
|
|
|
50
56
|
|
|
51
57
|
- 依赖 Playwright:`pip install playwright && playwright install chromium`
|
|
52
58
|
- 脚本:`docs/{{SKILL_DIR}}/confluence-doc.py`
|
|
53
|
-
-
|
|
59
|
+
- 脚本已内置默认账号密码;如需使用其他账号可用环境变量覆盖
|
|
54
60
|
- 默认 Confluence 地址为 `https://confluence.huan.tv`(可用 `CONFLUENCE_BASE_URL` 覆盖)
|
|
55
61
|
- 脚本会自动尝试读取仓库根目录的 `.env.pre` / `.env` / `.env.local` / `.env.development` / `.env.test`(若其中存在 `CONFLUENCE_*` 配置可直接复用)
|
|
56
62
|
|