@chenmk/superflow 0.1.0
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/INSTALL.en.md +106 -0
- package/INSTALL.md +664 -0
- package/LICENSE +21 -0
- package/README.md +142 -0
- package/README.zh-CN.md +117 -0
- package/assets/context-templates/business-rules.md +98 -0
- package/assets/context-templates/decisions.md +153 -0
- package/assets/context-templates/external-systems.md +166 -0
- package/assets/context-templates/incidents.md +89 -0
- package/assets/manifest.json +53 -0
- package/assets/prompts/superflow-archive.md +9 -0
- package/assets/prompts/superflow-clarify.md +10 -0
- package/assets/prompts/superflow-design.md +10 -0
- package/assets/prompts/superflow-docs.md +10 -0
- package/assets/prompts/superflow-implement.md +10 -0
- package/assets/prompts/superflow-pipeline.md +13 -0
- package/assets/prompts/superflow-verify.md +10 -0
- package/assets/rules/superflow-phase-guard.md +50 -0
- package/assets/scripts/claude-auto-backup-hook.sh +313 -0
- package/assets/scripts/codex-auto-backup-hook.sh +361 -0
- package/assets/scripts/install-sql-pre-commit.sh +44 -0
- package/assets/scripts/superflow-contract-hooks.sh +744 -0
- package/assets/scripts/superflow-delivery-check.sh +315 -0
- package/assets/scripts/superflow-dependency-update-hook.sh +161 -0
- package/assets/scripts/superflow-enforce-hook.sh +70 -0
- package/assets/scripts/superflow-hook-guard.sh +132 -0
- package/assets/scripts/superflow-integration-evidence-hook.sh +80 -0
- package/assets/scripts/superflow-sql-sync-hook.py +950 -0
- package/assets/scripts/superflow-test-report-lint.py +433 -0
- package/assets/scripts/superflow-verify-integration.sh +90 -0
- package/assets/scripts/sync-settings-json.py +52 -0
- package/assets/skills/api-doc-changelog/SKILL.md +193 -0
- package/assets/skills/openspec-apply-change/SKILL.md +156 -0
- package/assets/skills/openspec-archive-change/SKILL.md +114 -0
- package/assets/skills/openspec-explore/SKILL.md +288 -0
- package/assets/skills/openspec-propose/SKILL.md +110 -0
- package/assets/skills/superflow-archive/SKILL.md +61 -0
- package/assets/skills/superflow-clarify/SKILL.md +146 -0
- package/assets/skills/superflow-clarify/agents/openai.yaml +4 -0
- package/assets/skills/superflow-design/SKILL.md +83 -0
- package/assets/skills/superflow-design/agents/openai.yaml +4 -0
- package/assets/skills/superflow-docs/SKILL.md +316 -0
- package/assets/skills/superflow-docs/agents/openai.yaml +4 -0
- package/assets/skills/superflow-hotfix/SKILL.md +48 -0
- package/assets/skills/superflow-implement/SKILL.md +461 -0
- package/assets/skills/superflow-implement/agents/openai.yaml +4 -0
- package/assets/skills/superflow-pipeline/SKILL.md +844 -0
- package/assets/skills/superflow-pipeline/agents/openai.yaml +4 -0
- package/assets/skills/superflow-pipeline/references/api-design-template.md +431 -0
- package/assets/skills/superflow-pipeline/references/architecture-design-template.md +119 -0
- package/assets/skills/superflow-pipeline/references/batch-prompt-template.md +536 -0
- package/assets/skills/superflow-pipeline/references/batch-split-guide.md +140 -0
- package/assets/skills/superflow-pipeline/references/decision-point.md +30 -0
- package/assets/skills/superflow-pipeline/references/dirty-worktree.md +35 -0
- package/assets/skills/superflow-pipeline/references/document-templates.md +123 -0
- package/assets/skills/superflow-pipeline/references/feature-gated-workflow.md +124 -0
- package/assets/skills/superflow-pipeline/references/implementation-prompt-template.md +1056 -0
- package/assets/skills/superflow-pipeline/references/mock-strategy-guide.md +86 -0
- package/assets/skills/superflow-pipeline/references/openspec-format.md +57 -0
- package/assets/skills/superflow-pipeline/references/orchestration.md +639 -0
- package/assets/skills/superflow-pipeline/references/p0-baseline-template.md +174 -0
- package/assets/skills/superflow-pipeline/references/project-config.md +40 -0
- package/assets/skills/superflow-pipeline/references/prompt-usage-template.md +152 -0
- package/assets/skills/superflow-pipeline/references/quality-gate.md +299 -0
- package/assets/skills/superflow-pipeline/references/quality-standards.md +190 -0
- package/assets/skills/superflow-pipeline/references/reviewer-checklist.md +154 -0
- package/assets/skills/superflow-pipeline/references/sql-risk-review-checklist.md +323 -0
- package/assets/skills/superflow-pipeline/references/subagent-progress.md +90 -0
- package/assets/skills/superflow-pipeline/references/superpower-technical-design-template.md +125 -0
- package/assets/skills/superflow-pipeline/references/test-execution-template.md +220 -0
- package/assets/skills/superflow-pipeline/references/test-guide.md +30 -0
- package/assets/skills/superflow-pipeline/references/traceability-matrix.md +106 -0
- package/assets/skills/superflow-pipeline/references/validation-integrity.md +134 -0
- package/assets/skills/superflow-pipeline/scripts/superflow-archive.sh +178 -0
- package/assets/skills/superflow-pipeline/scripts/superflow-env.sh +118 -0
- package/assets/skills/superflow-pipeline/scripts/superflow-guard.sh +428 -0
- package/assets/skills/superflow-pipeline/scripts/superflow-handoff.sh +296 -0
- package/assets/skills/superflow-pipeline/scripts/superflow-state.sh +574 -0
- package/assets/skills/superflow-pipeline/scripts/superflow-status.sh +172 -0
- package/assets/skills/superflow-pipeline/scripts/superflow-yaml-validate.sh +138 -0
- package/assets/skills/superflow-table-impact-analysis/SKILL.md +77 -0
- package/assets/skills/superflow-tweak/SKILL.md +46 -0
- package/assets/skills/superflow-verify/SKILL.md +112 -0
- package/assets/skills-en/api-doc-changelog/SKILL.md +193 -0
- package/assets/skills-en/openspec-apply-change/SKILL.md +156 -0
- package/assets/skills-en/openspec-archive-change/SKILL.md +114 -0
- package/assets/skills-en/openspec-explore/SKILL.md +288 -0
- package/assets/skills-en/openspec-propose/SKILL.md +110 -0
- package/assets/skills-en/superflow-archive/SKILL.md +61 -0
- package/assets/skills-en/superflow-clarify/SKILL.md +146 -0
- package/assets/skills-en/superflow-clarify/agents/openai.yaml +4 -0
- package/assets/skills-en/superflow-design/SKILL.md +83 -0
- package/assets/skills-en/superflow-design/agents/openai.yaml +4 -0
- package/assets/skills-en/superflow-docs/SKILL.md +316 -0
- package/assets/skills-en/superflow-docs/agents/openai.yaml +4 -0
- package/assets/skills-en/superflow-hotfix/SKILL.md +48 -0
- package/assets/skills-en/superflow-implement/SKILL.md +461 -0
- package/assets/skills-en/superflow-implement/agents/openai.yaml +4 -0
- package/assets/skills-en/superflow-pipeline/SKILL.md +844 -0
- package/assets/skills-en/superflow-pipeline/agents/openai.yaml +4 -0
- package/assets/skills-en/superflow-pipeline/references/api-design-template.md +431 -0
- package/assets/skills-en/superflow-pipeline/references/architecture-design-template.md +119 -0
- package/assets/skills-en/superflow-pipeline/references/batch-prompt-template.md +536 -0
- package/assets/skills-en/superflow-pipeline/references/batch-split-guide.md +140 -0
- package/assets/skills-en/superflow-pipeline/references/decision-point.md +30 -0
- package/assets/skills-en/superflow-pipeline/references/dirty-worktree.md +35 -0
- package/assets/skills-en/superflow-pipeline/references/document-templates.md +123 -0
- package/assets/skills-en/superflow-pipeline/references/feature-gated-workflow.md +124 -0
- package/assets/skills-en/superflow-pipeline/references/implementation-prompt-template.md +1056 -0
- package/assets/skills-en/superflow-pipeline/references/mock-strategy-guide.md +86 -0
- package/assets/skills-en/superflow-pipeline/references/openspec-format.md +57 -0
- package/assets/skills-en/superflow-pipeline/references/orchestration.md +639 -0
- package/assets/skills-en/superflow-pipeline/references/p0-baseline-template.md +174 -0
- package/assets/skills-en/superflow-pipeline/references/project-config.md +40 -0
- package/assets/skills-en/superflow-pipeline/references/prompt-usage-template.md +152 -0
- package/assets/skills-en/superflow-pipeline/references/quality-gate.md +299 -0
- package/assets/skills-en/superflow-pipeline/references/quality-standards.md +190 -0
- package/assets/skills-en/superflow-pipeline/references/reviewer-checklist.md +154 -0
- package/assets/skills-en/superflow-pipeline/references/sql-risk-review-checklist.md +323 -0
- package/assets/skills-en/superflow-pipeline/references/subagent-progress.md +90 -0
- package/assets/skills-en/superflow-pipeline/references/superpower-technical-design-template.md +125 -0
- package/assets/skills-en/superflow-pipeline/references/test-execution-template.md +220 -0
- package/assets/skills-en/superflow-pipeline/references/test-guide.md +30 -0
- package/assets/skills-en/superflow-pipeline/references/traceability-matrix.md +106 -0
- package/assets/skills-en/superflow-pipeline/references/validation-integrity.md +134 -0
- package/assets/skills-en/superflow-pipeline/scripts/superflow-archive.sh +178 -0
- package/assets/skills-en/superflow-pipeline/scripts/superflow-env.sh +118 -0
- package/assets/skills-en/superflow-pipeline/scripts/superflow-guard.sh +428 -0
- package/assets/skills-en/superflow-pipeline/scripts/superflow-handoff.sh +296 -0
- package/assets/skills-en/superflow-pipeline/scripts/superflow-state.sh +574 -0
- package/assets/skills-en/superflow-pipeline/scripts/superflow-status.sh +172 -0
- package/assets/skills-en/superflow-pipeline/scripts/superflow-yaml-validate.sh +138 -0
- package/assets/skills-en/superflow-table-impact-analysis/SKILL.md +77 -0
- package/assets/skills-en/superflow-tweak/SKILL.md +46 -0
- package/assets/skills-en/superflow-verify/SKILL.md +112 -0
- package/dist/cli/index.js +186 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/archive.js +6 -0
- package/dist/commands/archive.js.map +1 -0
- package/dist/commands/clarify.js +6 -0
- package/dist/commands/clarify.js.map +1 -0
- package/dist/commands/design.js +6 -0
- package/dist/commands/design.js.map +1 -0
- package/dist/commands/docs.js +6 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/commands/doctor.js +473 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/implement.js +6 -0
- package/dist/commands/implement.js.map +1 -0
- package/dist/commands/init.js +471 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/pipeline.js +6 -0
- package/dist/commands/pipeline.js.map +1 -0
- package/dist/commands/scan.js +59 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/status.js +173 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/uninstall.js +213 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.js +187 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/verify.js +6 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/core/assets.js +27 -0
- package/dist/core/assets.js.map +1 -0
- package/dist/core/context.js +100 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/dependencies.js +146 -0
- package/dist/core/dependencies.js.map +1 -0
- package/dist/core/detect.js +71 -0
- package/dist/core/detect.js.map +1 -0
- package/dist/core/i18n.js +103 -0
- package/dist/core/i18n.js.map +1 -0
- package/dist/core/integrity.js +46 -0
- package/dist/core/integrity.js.map +1 -0
- package/dist/core/manifest.js +18 -0
- package/dist/core/manifest.js.map +1 -0
- package/dist/core/prompts.js +20 -0
- package/dist/core/prompts.js.map +1 -0
- package/dist/core/registry.js +134 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/rules.js +17 -0
- package/dist/core/rules.js.map +1 -0
- package/dist/core/scripts.js +40 -0
- package/dist/core/scripts.js.map +1 -0
- package/dist/core/skill-check.js +31 -0
- package/dist/core/skill-check.js.map +1 -0
- package/dist/core/skills.js +56 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/state.js +43 -0
- package/dist/core/state.js.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/path.js +11 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/shell.js +29 -0
- package/dist/utils/shell.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getManifestHooks, getManifestRules, getManifestScripts, getManifestSkillNames, } from './manifest.js';
|
|
2
|
+
export const ALL_SKILLS = getManifestSkillNames();
|
|
3
|
+
export const ALL_RULES = getManifestRules();
|
|
4
|
+
export const CODEX_PROMPTS = [
|
|
5
|
+
'superflow-pipeline.md',
|
|
6
|
+
'superflow-clarify.md',
|
|
7
|
+
'superflow-docs.md',
|
|
8
|
+
'superflow-design.md',
|
|
9
|
+
'superflow-implement.md',
|
|
10
|
+
'superflow-verify.md',
|
|
11
|
+
'superflow-archive.md',
|
|
12
|
+
];
|
|
13
|
+
export const LEGACY_CODEX_PROMPTS = [
|
|
14
|
+
'sdd.md',
|
|
15
|
+
'sdd-spec-pipeline.md',
|
|
16
|
+
];
|
|
17
|
+
export const COMMON_SCRIPTS = getManifestScripts('codex')
|
|
18
|
+
.filter((script) => script !== 'codex-auto-backup-hook.sh');
|
|
19
|
+
export const COMMON_HOOK_SCRIPTS = getManifestHooks('codex')
|
|
20
|
+
.filter((script) => script !== 'codex-auto-backup-hook.sh');
|
|
21
|
+
export function scriptsForAgent(agent) {
|
|
22
|
+
return getManifestScripts(agent);
|
|
23
|
+
}
|
|
24
|
+
export function hookScriptsForAgent(agent) {
|
|
25
|
+
return getManifestHooks(agent);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/core/assets.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,UAAU,GAAG,qBAAqB,EAAE,CAAC;AAClD,MAAM,CAAC,MAAM,SAAS,GAAG,gBAAgB,EAAE,CAAC;AAE5C,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,uBAAuB;IACvB,sBAAsB;IACtB,mBAAmB;IACnB,qBAAqB;IACrB,wBAAwB;IACxB,qBAAqB;IACrB,sBAAsB;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ;IACR,sBAAsB;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC,OAAO,CAAC;KACtD,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,2BAA2B,CAAC,CAAC;AAE9D,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,OAAO,CAAC;KACzD,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,2BAA2B,CAAC,CAAC;AAE9D,MAAM,UAAU,eAAe,CAAC,KAAY;IAC1C,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAY;IAC9C,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = path.dirname(__filename);
|
|
6
|
+
// dist/core/context.js → ../../assets/context-templates
|
|
7
|
+
const TEMPLATES_DIR = path.resolve(__dirname, '..', '..', 'assets', 'context-templates');
|
|
8
|
+
const CONTEXT_FILES = [
|
|
9
|
+
'business-rules.md',
|
|
10
|
+
'incidents.md',
|
|
11
|
+
'decisions.md',
|
|
12
|
+
'external-systems.md',
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* 把 4 个初始文件从 assets/context-templates/ 复制到 <cwd>/docs/sdd-context/
|
|
16
|
+
* - 已存在则跳过(保留用户已编辑的,不覆盖)
|
|
17
|
+
* - 目录不存在则创建
|
|
18
|
+
*/
|
|
19
|
+
export async function scaffoldBusinessContext(cwd) {
|
|
20
|
+
const targetDir = path.join(cwd, 'docs', 'sdd-context');
|
|
21
|
+
const copied = [];
|
|
22
|
+
const skipped = [];
|
|
23
|
+
// 确保目标目录存在
|
|
24
|
+
try {
|
|
25
|
+
await fs.mkdir(targetDir, { recursive: true });
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
throw new Error(`无法创建 ${targetDir}: ${err.message}`);
|
|
29
|
+
}
|
|
30
|
+
for (const filename of CONTEXT_FILES) {
|
|
31
|
+
const target = path.join(targetDir, filename);
|
|
32
|
+
try {
|
|
33
|
+
await fs.access(target);
|
|
34
|
+
// 文件已存在,跳过(保留用户编辑)
|
|
35
|
+
skipped.push(filename);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// 文件不存在,复制
|
|
39
|
+
const source = path.join(TEMPLATES_DIR, filename);
|
|
40
|
+
try {
|
|
41
|
+
await fs.copyFile(source, target);
|
|
42
|
+
copied.push(filename);
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
// 单个文件失败不阻塞,记录但继续
|
|
46
|
+
skipped.push(`${filename} (copy failed: ${err.message})`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return { copied, skipped };
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 检查 understand-anything 是否已扫过当前项目
|
|
54
|
+
* (understand-anything 是 Claude 技能,通过 /understand 触发,sdd-cli 无法直接调用)
|
|
55
|
+
* - 扫过:返回 ok=true, graphPath 指向 .understand-anything/knowledge-graph.json
|
|
56
|
+
* - 没扫:返回 ok=false, 提示用户在 Claude 会话中跑 /understand
|
|
57
|
+
*/
|
|
58
|
+
export async function checkUnderstandScan(cwd) {
|
|
59
|
+
const graphPath = path.join(cwd, '.understand-anything', 'knowledge-graph.json');
|
|
60
|
+
try {
|
|
61
|
+
await fs.access(graphPath);
|
|
62
|
+
return { ok: true, reason: 'already-scanned', graphPath };
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return { ok: false, reason: 'not-scanned' };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 打印软提示:引导用户去看 docs/sdd-context/,并提示可让 LLM 协助补全
|
|
70
|
+
* 末尾用换行分隔,避免紧贴下面命令输出
|
|
71
|
+
*/
|
|
72
|
+
export function printSoftPrompt(cwd, scaffolding, understand) {
|
|
73
|
+
console.log('');
|
|
74
|
+
console.log('━'.repeat(70));
|
|
75
|
+
console.log('💡 已在 docs/sdd-context/ 生成 4 个初始文件');
|
|
76
|
+
for (const f of CONTEXT_FILES) {
|
|
77
|
+
const status = scaffolding.copied.includes(f) ? '✓ 复制' :
|
|
78
|
+
scaffolding.skipped.includes(f) ? '○ 跳过(已存在)' : '✗ 失败';
|
|
79
|
+
console.log(` [${status}] ${f}`);
|
|
80
|
+
}
|
|
81
|
+
console.log('');
|
|
82
|
+
console.log('📖 建议:阅读这 4 个文件了解项目业务上下文');
|
|
83
|
+
console.log(' 如果项目结构 / 业务规则与初始版不符,直接编辑文件即可');
|
|
84
|
+
console.log(' 完善后的文档能帮 sdd 技能更精确地理解你的项目');
|
|
85
|
+
console.log('');
|
|
86
|
+
console.log('🤖 LLM 协助补全:把这 4 个文件 + 项目源码 一起发给 Claude,');
|
|
87
|
+
console.log(' 让其协助补全缺失内容');
|
|
88
|
+
if (understand.ok) {
|
|
89
|
+
console.log('');
|
|
90
|
+
console.log('🔍 understand-anything 已扫项目:' + understand.graphPath);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
console.log('');
|
|
94
|
+
console.log('⚠️ understand-anything 还没扫(可选):');
|
|
95
|
+
console.log(' 在 Claude 会话中跑 /understand(输出 .understand-anything/knowledge-graph.json)');
|
|
96
|
+
}
|
|
97
|
+
console.log('━'.repeat(70));
|
|
98
|
+
console.log('');
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAC3C,wDAAwD;AACxD,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAEzF,MAAM,aAAa,GAAG;IACpB,mBAAmB;IACnB,cAAc;IACd,cAAc;IACd,qBAAqB;CACb,CAAC;AAaX;;;;GAIG;AACH,MAAM,CAA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C;IAC5C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAE7B,IAAI,UAAU,CAAC,EAAE,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,8BAA8B,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IACrE,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,4EAA4E,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import { homedir } from 'os';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { runCommand } from '../utils/shell.js';
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
// dist/core/dependencies.js → ../../assets
|
|
9
|
+
const ASSETS_DIR = path.resolve(__dirname, '..', '..', 'assets');
|
|
10
|
+
function alreadyInstalled(output) {
|
|
11
|
+
return /already\s+(installed|exists)|is\s+already\s+installed|already\s+added/i.test(output);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 安装 openspec CLI(npm 全局)
|
|
15
|
+
* 失败阻塞 init(核心依赖)
|
|
16
|
+
*/
|
|
17
|
+
export async function installOpenspec() {
|
|
18
|
+
const result = await runCommand('npm', ['install', '-g', '@fission-ai/openspec@latest']);
|
|
19
|
+
if (result.code !== 0) {
|
|
20
|
+
return { ok: false, error: `npm install failed: ${result.stderr}` };
|
|
21
|
+
}
|
|
22
|
+
return { ok: true };
|
|
23
|
+
}
|
|
24
|
+
export function openspecInitArgs(projectPath, agents, _scope, includeProfile = true) {
|
|
25
|
+
const args = ['init', projectPath, '--tools', agents.join(',')];
|
|
26
|
+
if (includeProfile) {
|
|
27
|
+
args.push('--profile', 'custom');
|
|
28
|
+
}
|
|
29
|
+
return args;
|
|
30
|
+
}
|
|
31
|
+
export async function initializeOpenspec(projectPath, agents, scope) {
|
|
32
|
+
const args = openspecInitArgs(projectPath, agents, scope);
|
|
33
|
+
const result = await runCommand('openspec', args, {
|
|
34
|
+
cwd: projectPath,
|
|
35
|
+
timeout: 120_000,
|
|
36
|
+
});
|
|
37
|
+
if (result.code === 0)
|
|
38
|
+
return { ok: true };
|
|
39
|
+
const stderr = result.stderr || result.stdout;
|
|
40
|
+
if (stderr.includes('unknown option') && stderr.includes('--profile')) {
|
|
41
|
+
const fallback = await runCommand('openspec', openspecInitArgs(projectPath, agents, scope, false), { cwd: projectPath, timeout: 120_000 });
|
|
42
|
+
if (fallback.code === 0)
|
|
43
|
+
return { ok: true };
|
|
44
|
+
return { ok: false, error: fallback.stderr || fallback.stdout };
|
|
45
|
+
}
|
|
46
|
+
return { ok: false, error: stderr };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 安装 superpowers(claude 插件)
|
|
50
|
+
* 失败阻塞 init(核心 HOW/TDD 依赖;已装视为成功)
|
|
51
|
+
*/
|
|
52
|
+
export async function installSuperpowers() {
|
|
53
|
+
const result = await runCommand('claude', [
|
|
54
|
+
'plugin',
|
|
55
|
+
'install',
|
|
56
|
+
'superpowers@superpowers-marketplace',
|
|
57
|
+
]);
|
|
58
|
+
if (result.code !== 0) {
|
|
59
|
+
const output = `${result.stderr}\n${result.stdout}`;
|
|
60
|
+
if (alreadyInstalled(output))
|
|
61
|
+
return { ok: true };
|
|
62
|
+
return { ok: false, error: result.stderr };
|
|
63
|
+
}
|
|
64
|
+
return { ok: true };
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 安装 superpowers(Codex 插件)
|
|
68
|
+
* 失败阻塞 init(核心 HOW/TDD 依赖;已装视为成功)
|
|
69
|
+
*/
|
|
70
|
+
export async function installCodexSuperpowers() {
|
|
71
|
+
const result = await runCommand('codex', [
|
|
72
|
+
'plugin',
|
|
73
|
+
'add',
|
|
74
|
+
'superpowers@openai-curated',
|
|
75
|
+
]);
|
|
76
|
+
if (result.code !== 0) {
|
|
77
|
+
const output = `${result.stderr}\n${result.stdout}`;
|
|
78
|
+
if (alreadyInstalled(output))
|
|
79
|
+
return { ok: true };
|
|
80
|
+
return { ok: false, error: result.stderr || result.stdout };
|
|
81
|
+
}
|
|
82
|
+
return { ok: true };
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 安装 understand-anything(claude 插件)
|
|
86
|
+
*/
|
|
87
|
+
export async function installUnderstand() {
|
|
88
|
+
const result = await runCommand('claude', [
|
|
89
|
+
'plugin',
|
|
90
|
+
'install',
|
|
91
|
+
'understand-anything@understand-anything',
|
|
92
|
+
]);
|
|
93
|
+
if (result.code !== 0) {
|
|
94
|
+
return { ok: false, error: result.stderr };
|
|
95
|
+
}
|
|
96
|
+
return { ok: true };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* 安装 understand-anything(Codex / agents 技能链接)
|
|
100
|
+
*/
|
|
101
|
+
export async function installCodexUnderstand() {
|
|
102
|
+
const script = path.join(homedir(), '.understand-anything', 'repo', 'install.sh');
|
|
103
|
+
const result = await runCommand('bash', [script, 'codex']);
|
|
104
|
+
if (result.code !== 0) {
|
|
105
|
+
const fallback = await linkCodexUnderstandSkills();
|
|
106
|
+
if (fallback.ok)
|
|
107
|
+
return fallback;
|
|
108
|
+
return { ok: false, error: `${result.stderr || result.stdout}\n${fallback.error}` };
|
|
109
|
+
}
|
|
110
|
+
return { ok: true };
|
|
111
|
+
}
|
|
112
|
+
async function linkCodexUnderstandSkills() {
|
|
113
|
+
const sourceRoot = path.join(homedir(), '.understand-anything', 'repo', 'understand-anything-plugin', 'skills');
|
|
114
|
+
const targetRoot = path.join(homedir(), '.agents', 'skills');
|
|
115
|
+
try {
|
|
116
|
+
const entries = await fs.readdir(sourceRoot, { withFileTypes: true });
|
|
117
|
+
await fs.mkdir(targetRoot, { recursive: true });
|
|
118
|
+
for (const entry of entries) {
|
|
119
|
+
if (!entry.isDirectory())
|
|
120
|
+
continue;
|
|
121
|
+
const source = path.join(sourceRoot, entry.name);
|
|
122
|
+
const target = path.join(targetRoot, entry.name);
|
|
123
|
+
await fs.rm(target, { recursive: true, force: true });
|
|
124
|
+
await fs.symlink(source, target, process.platform === 'win32' ? 'junction' : 'dir');
|
|
125
|
+
}
|
|
126
|
+
return { ok: true };
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
return { ok: false, error: `understand-anything fallback failed: ${err.message}` };
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 安装 api-doc-changelog(直接复制)
|
|
134
|
+
*/
|
|
135
|
+
export async function installApiDocChangelog(skillsDir = path.join(homedir(), '.claude', 'skills')) {
|
|
136
|
+
const source = path.join(ASSETS_DIR, 'skills', 'api-doc-changelog');
|
|
137
|
+
const dest = path.join(skillsDir, 'api-doc-changelog');
|
|
138
|
+
try {
|
|
139
|
+
await fs.cp(source, dest, { recursive: true, force: true });
|
|
140
|
+
return { ok: true };
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
return { ok: false, error: err.message };
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/core/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAA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C,CAAC;QAC3D,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAG,GAAa,CAAC,OAAO,EAAE,CAAC;IACtD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { homedir } from 'os';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
export function detectOS() {
|
|
4
|
+
const platform = process.platform;
|
|
5
|
+
if (platform === 'darwin' || platform === 'linux')
|
|
6
|
+
return platform;
|
|
7
|
+
if (platform === 'win32') {
|
|
8
|
+
// Git Bash / MSYS / Cygwin 在 process.platform 都是 win32
|
|
9
|
+
// 区分要靠 SHELL 或 MSYSTEM env
|
|
10
|
+
if (process.env.MSYSTEM)
|
|
11
|
+
return 'msys';
|
|
12
|
+
if (process.env.SHELL?.includes('bash'))
|
|
13
|
+
return 'mingw';
|
|
14
|
+
return 'windows';
|
|
15
|
+
}
|
|
16
|
+
return 'unknown';
|
|
17
|
+
}
|
|
18
|
+
export function getPlatformPaths(agent, scope = 'global', projectPath = process.cwd()) {
|
|
19
|
+
const base = scope === 'global' ? homedir() : projectPath;
|
|
20
|
+
switch (agent) {
|
|
21
|
+
case 'claude':
|
|
22
|
+
return {
|
|
23
|
+
id: 'claude',
|
|
24
|
+
name: 'Claude Code',
|
|
25
|
+
skillsDir: path.join(base, '.claude', 'skills'),
|
|
26
|
+
rulesDir: path.join(base, '.claude', 'rules'),
|
|
27
|
+
scriptsDir: path.join(base, '.claude', 'scripts'),
|
|
28
|
+
promptsDir: path.join(base, '.claude', 'commands'),
|
|
29
|
+
settingsFile: path.join(base, '.claude', 'settings.json'),
|
|
30
|
+
};
|
|
31
|
+
case 'codex':
|
|
32
|
+
return {
|
|
33
|
+
id: 'codex',
|
|
34
|
+
name: 'Codex',
|
|
35
|
+
skillsDir: path.join(base, '.codex', 'skills'),
|
|
36
|
+
rulesDir: path.join(base, '.codex', 'rules'),
|
|
37
|
+
scriptsDir: path.join(base, '.codex', 'hooks'),
|
|
38
|
+
promptsDir: path.join(base, '.codex', 'prompts'),
|
|
39
|
+
settingsFile: path.join(base, '.codex', 'hooks.json'),
|
|
40
|
+
};
|
|
41
|
+
default:
|
|
42
|
+
throw new Error(`Unknown agent: ${agent}. Expected 'claude' or 'codex'.`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export function parseInstallScope(value) {
|
|
46
|
+
if (value === undefined || value === null || value === '')
|
|
47
|
+
return 'global';
|
|
48
|
+
if (value === 'global' || value === 'project')
|
|
49
|
+
return value;
|
|
50
|
+
throw new Error(`--scope must be one of: global, project`);
|
|
51
|
+
}
|
|
52
|
+
export function resolveAgents(selection) {
|
|
53
|
+
switch (selection) {
|
|
54
|
+
case 'both':
|
|
55
|
+
return ['claude', 'codex'];
|
|
56
|
+
case 'claude':
|
|
57
|
+
case 'codex':
|
|
58
|
+
return [selection];
|
|
59
|
+
default:
|
|
60
|
+
throw new Error(`Unknown agent selection: ${selection}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export function parseAgentSelection(value) {
|
|
64
|
+
if (value === undefined || value === null || value === '')
|
|
65
|
+
return 'both';
|
|
66
|
+
if (value === 'claude' || value === 'codex' || value === 'both') {
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
throw new Error(`--agent must be one of: claude, codex, both`);
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../../src/core/detect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,UAAU,QAAQ;IACtB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAClC,IAAI,QAAQ,K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AAK,KAAK,OAAO,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;QAChE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const TRANSLATIONS = {
|
|
2
|
+
en: {
|
|
3
|
+
agentPrompt: 'Select agent tools to initialize (multi-select):',
|
|
4
|
+
agentClaude: 'Claude Code',
|
|
5
|
+
agentCodex: 'Codex',
|
|
6
|
+
agentBoth: 'Install both (default)',
|
|
7
|
+
agentAnswer: 'Enter 1,2 / 2 / a:',
|
|
8
|
+
agentInvalid: 'Invalid input. Enter 1, 2, 1,2, claude, codex, or a.',
|
|
9
|
+
languagePrompt: 'Select SuperBridge Flow language:',
|
|
10
|
+
languageEnglish: 'English',
|
|
11
|
+
languageChinese: 'Chinese',
|
|
12
|
+
languageInvalid: 'Invalid input. Enter en, zh, 1, or 2.',
|
|
13
|
+
stepDetect: 'Detect platform',
|
|
14
|
+
stepDeps: 'Install dependencies and initialize OpenSpec',
|
|
15
|
+
stepSkills: 'Deploy SuperBridge Flow/OpenSpec skills',
|
|
16
|
+
stepScriptsHooks: 'Deploy scripts and register hooks',
|
|
17
|
+
stepPrompts: 'Deploy Codex prompt aliases',
|
|
18
|
+
stepRules: 'Deploy SuperBridge Flow anti-drift rules',
|
|
19
|
+
stepScan: 'Scaffold docs/sdd-context and check understand-anything',
|
|
20
|
+
summaryTitle: 'superflow init summary',
|
|
21
|
+
stateLabel: 'State',
|
|
22
|
+
initComplete: 'superflow init complete',
|
|
23
|
+
runResume: "Run 'superflow init --resume' to continue from this step.",
|
|
24
|
+
noActiveChanges: 'No active SuperBridge Flow changes.',
|
|
25
|
+
statusHeader: 'Active SuperBridge Flow changes',
|
|
26
|
+
nextDocs: 'Current phase is docs. Continue OpenSpec/SDD contract documents.',
|
|
27
|
+
nextDesign: 'Current phase is design. Continue Superpowers source-level technical design.',
|
|
28
|
+
nextImplementDone: 'Implementation tasks are complete. Run pre-verify checks.',
|
|
29
|
+
nextVerifyFailed: 'The last verify failed. Fix failures from the verification report first.',
|
|
30
|
+
nextVerify: 'Current phase is verify. Add real evidence and run verification gates.',
|
|
31
|
+
nextArchive: 'Verify passed; archive is waiting for explicit confirmation.',
|
|
32
|
+
nextUnknown: 'Current phase is unknown. Inspect .sdd/state.yaml first.',
|
|
33
|
+
riskUnknownPhase: 'phase is missing or unknown.',
|
|
34
|
+
riskTasksMissing: 'tasks.md is missing or empty.',
|
|
35
|
+
riskReviewMissing: 'full workflow has not selected review_mode.',
|
|
36
|
+
riskVerifyFailed: 'The last verify failed.',
|
|
37
|
+
riskTestReportMissing: 'verify phase is missing test-report.md.',
|
|
38
|
+
updateTitle: 'SuperBridge Flow update',
|
|
39
|
+
packageLabel: 'packages',
|
|
40
|
+
skillsLabel: 'skills',
|
|
41
|
+
rulesLabel: 'rules',
|
|
42
|
+
scriptsLabel: 'scripts',
|
|
43
|
+
hooksLabel: 'hooks',
|
|
44
|
+
},
|
|
45
|
+
zh: {
|
|
46
|
+
agentPrompt: '请选择要初始化的 agent 工具(可多选):',
|
|
47
|
+
agentClaude: 'Claude Code',
|
|
48
|
+
agentCodex: 'Codex',
|
|
49
|
+
agentBoth: '两者都安装(默认)',
|
|
50
|
+
agentAnswer: '输入序号,例如 1,2 / 2 / a:',
|
|
51
|
+
agentInvalid: '输入无效,请输入 1、2、1,2、claude、codex 或 a。',
|
|
52
|
+
languagePrompt: '请选择 SuperBridge Flow 语言:',
|
|
53
|
+
languageEnglish: '英文',
|
|
54
|
+
languageChinese: '中文',
|
|
55
|
+
languageInvalid: '输入无效,请输入 en、zh、1 或 2。',
|
|
56
|
+
stepDetect: '检测平台',
|
|
57
|
+
stepDeps: '安装第三方依赖并初始化 OpenSpec',
|
|
58
|
+
stepSkills: '部署 SuperBridge Flow/OpenSpec 技能',
|
|
59
|
+
stepScriptsHooks: '部署脚本 + 注册 hook',
|
|
60
|
+
stepPrompts: '部署 Codex prompt alias',
|
|
61
|
+
stepRules: '部署 SuperBridge Flow 防漂移规则',
|
|
62
|
+
stepScan: '脚手架 docs/sdd-context/ + understand-anything 扫描 + 软提示',
|
|
63
|
+
summaryTitle: 'superflow init summary',
|
|
64
|
+
stateLabel: 'State',
|
|
65
|
+
initComplete: 'superflow init complete',
|
|
66
|
+
runResume: "Run 'superflow init --resume' to continue from this step.",
|
|
67
|
+
noActiveChanges: 'No active SuperBridge Flow changes.',
|
|
68
|
+
statusHeader: 'Active SuperBridge Flow changes',
|
|
69
|
+
nextDocs: '当前处于 docs 阶段,继续生成或补齐 OpenSpec/SDD 合同文档。',
|
|
70
|
+
nextDesign: '当前处于 design 阶段,继续生成 Superpowers 源码级技术详设。',
|
|
71
|
+
nextImplementDone: 'implement 任务已完成,可以进入 verify 前检查。',
|
|
72
|
+
nextVerifyFailed: '最近一次 verify 失败,先修复验证报告中的失败项。',
|
|
73
|
+
nextVerify: '当前处于 verify 阶段,补齐真实验证证据并运行验收门禁。',
|
|
74
|
+
nextArchive: 'verify 已通过后进入 archive,等待明确归档确认。',
|
|
75
|
+
nextUnknown: '当前 phase 未知,先检查 .sdd/state.yaml。',
|
|
76
|
+
riskUnknownPhase: 'phase 缺失或未知。',
|
|
77
|
+
riskTasksMissing: '缺少 tasks.md 或任务清单为空。',
|
|
78
|
+
riskReviewMissing: 'full workflow 尚未选择 review_mode。',
|
|
79
|
+
riskVerifyFailed: '最近一次 verify 失败。',
|
|
80
|
+
riskTestReportMissing: 'verify 阶段缺少 test-report.md。',
|
|
81
|
+
updateTitle: 'SuperBridge Flow update',
|
|
82
|
+
packageLabel: 'packages',
|
|
83
|
+
skillsLabel: 'skills',
|
|
84
|
+
rulesLabel: 'rules',
|
|
85
|
+
scriptsLabel: 'scripts',
|
|
86
|
+
hooksLabel: 'hooks',
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
export function normalizeLanguage(value) {
|
|
90
|
+
if (typeof value !== 'string')
|
|
91
|
+
return null;
|
|
92
|
+
const normalized = value.trim().toLowerCase();
|
|
93
|
+
if (normalized === 'en' || normalized === 'english' || normalized === '1')
|
|
94
|
+
return 'en';
|
|
95
|
+
if (normalized === 'zh' || normalized === 'cn' || normalized === 'chinese' || normalized === '2') {
|
|
96
|
+
return 'zh';
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
export function t(language, key) {
|
|
101
|
+
return TRANSLATIONS[language][key];
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/core/i18n.ts"],"names":[],"mappings":"AA6CA,MAAM,YAAY,GAAqD;IACrE,EAAE,EAAE;QACF,WAAW,EAAE,kDAAkD;QAC/D,WAAW,EAAE,aAAa;QAC1B,UAAU,EAAE,OAAO;QACnB,SAAS,EAAE,wBAAwB;QACnC,WAAW,EAAE,oBAAoB;QACjC,YAAY,EAAE,sDAAsD;QACpE,cAAc,EAAE,mCAAmC;QACnD,eAAe,EAAE,SAAS;QAC1B,eAAe,EAAE,SAAS;QAC1B,eAAe,EAAE,uCAAuC;QACxD,UAAU,EAAE,iBAAiB;QAC7B,QAAQ,EAAE,8CAA8C;QACxD,UAAU,EAAE,yCAAyC;QACrD,gBAAgB,EAAE,mCAAmC;QACrD,WAAW,EAAE,6BAA6B;QAC1C,SAAS,EAAE,0CAA0C;QACrD,QAAQ,EAAE,yDAAyD;QACnE,YAAY,EAAE,wBAAwB;QACtC,UAAU,EAAE,OAAO;QACnB,YAAY,EAAE,yBAAyB;QACvC,SAAS,EAAE,2DAA2D;QACtE,eAAe,EAAE,qCAAqC;QACtD,YAAY,EAAE,iCAAiC;QAC/C,QAAQ,EAAE,kEAAkE;QAC5E,UAAU,EAAE,8EAA8E;QAC1F,iBAAiB,EAAE,2DAA2D;QAC9E,gBAAgB,EAAE,0EAA0E;QAC5F,UAAU,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sB;QACxC,iBAAiB,EAAE,iCAAiC;QACpD,gBAAgB,EAAE,iBAAiB;QACnC,qBAAqB,EAAE,6BAA6B;QACpD,WAAW,EAAE,yBAAyB;QACtC,YAAY,EAAE,UAAU;QACxB,WAAW,EAAE,QAAQ;QACrB,UAAU,EAAE,OAAO;QACnB,YAAY,EAAE,SAAS;QACvB,UAAU,EAAE,OAAO;KACpB;CACF,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IACvF,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;QACjG,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,CAAC,CAAC,QAAkB,EAAE,GAAmB;IACvD,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createHash } from 'crypto';
|
|
2
|
+
import { readdirSync, readFileSync, statSync } from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
/**
|
|
5
|
+
* 计算目录的 SHA-256 哈希。
|
|
6
|
+
* 算法:递归读取所有文件,path + sha256(file) 拼接后整体 hash。
|
|
7
|
+
* 顺序敏感于文件名(sort 排序),但忽略目录的 mtime。
|
|
8
|
+
*/
|
|
9
|
+
export function computeDirHash(dir) {
|
|
10
|
+
const files = collectFiles(dir);
|
|
11
|
+
const hash = createHash('sha256');
|
|
12
|
+
for (const file of files) {
|
|
13
|
+
const relative = path.relative(dir, file);
|
|
14
|
+
hash.update(`path:${relative}\n`);
|
|
15
|
+
hash.update(`sha256:${hashFile(file)}\n`);
|
|
16
|
+
}
|
|
17
|
+
return hash.digest('hex');
|
|
18
|
+
}
|
|
19
|
+
function collectFiles(dir) {
|
|
20
|
+
const result = [];
|
|
21
|
+
walk(dir, result);
|
|
22
|
+
return result.sort();
|
|
23
|
+
}
|
|
24
|
+
function walk(dir, result) {
|
|
25
|
+
let entries;
|
|
26
|
+
try {
|
|
27
|
+
entries = readdirSync(dir);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
throw new Error(`Cannot read directory: ${dir} (${err.message})`);
|
|
31
|
+
}
|
|
32
|
+
for (const entry of entries) {
|
|
33
|
+
const full = path.join(dir, entry);
|
|
34
|
+
const stat = statSync(full);
|
|
35
|
+
if (stat.isDirectory()) {
|
|
36
|
+
walk(full, result);
|
|
37
|
+
}
|
|
38
|
+
else if (stat.isFile()) {
|
|
39
|
+
result.push(full);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function hashFile(file) {
|
|
44
|
+
return createHash('sha256').update(readFileSync(file)).digest('hex');
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=integrity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrity.js","sourceRoot":"","sources":["../../src/core/integrity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACzD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAElC,KA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CAAC,IAAY;IACnC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import manifestJson from '../../assets/manifest.json' with { type: 'json' };
|
|
2
|
+
const manifest = manifestJson;
|
|
3
|
+
export function getManifest() {
|
|
4
|
+
return manifest;
|
|
5
|
+
}
|
|
6
|
+
export function getManifestSkillNames() {
|
|
7
|
+
return [...manifest.skills];
|
|
8
|
+
}
|
|
9
|
+
export function getManifestRules() {
|
|
10
|
+
return [...(manifest.rules ?? [])];
|
|
11
|
+
}
|
|
12
|
+
export function getManifestScripts(agent) {
|
|
13
|
+
return [...manifest.scripts, ...(manifest.agentScripts[agent] ?? [])];
|
|
14
|
+
}
|
|
15
|
+
export function getManifestHooks(agent) {
|
|
16
|
+
return [...(manifest.agentHooks[agent] ?? []), ...manifest.hooks];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/core/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,4BAA4B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAc5E,MAAM,QAAQ,GAAG,YAA2B,CAAC;AAE7C,MAAM,UAAU,WAAW;IACzB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAY;IAC7C,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAY;IAC3C,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
export async function deployPrompts(promptNames, assetsDir, promptsDir, options = {}) {
|
|
4
|
+
await fs.mkdir(promptsDir, { recursive: true });
|
|
5
|
+
for (const name of promptNames) {
|
|
6
|
+
const source = path.join(assetsDir, name);
|
|
7
|
+
const dest = path.join(promptsDir, name);
|
|
8
|
+
if (options.skipExisting) {
|
|
9
|
+
try {
|
|
10
|
+
await fs.access(dest);
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
// prompt does not exist; deploy it below.
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
await fs.cp(source, dest, { recursive: false, force: true });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/core/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,WAAqB,EACrB,SAAiB,EACjB,UAAkB,EAClB,UAAsC,EAAE;IAExC,MAAM,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhD,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACzC,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YACzB,IAAI,CAAC;gBACH,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACtB,SAAS;YACX,CAAC;YAAC,MAAM,CAAC;gBACP,0CAA0C;YAC5C,CAAC;QACH,CAAC;QACD,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC"}
|