flow-comet 1.5.1 → 1.6.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/.flow-comet/rules/flow-comet-orchestration.md +1 -2
- package/.flow-comet/skills/flow-comet/INSTALLED_VERSION +1 -1
- package/.flow-comet/skills/flow-comet/SKILL.md +21 -3
- package/.flow-comet/skills/flow-comet/reference/TEST-MATRIX.md +9 -8
- package/.flow-comet/skills/flow-comet/reference/dsh-platform.md +9 -2
- package/.flow-comet/skills/flow-comet/scripts/guard-self-test.mjs +4233 -94
- package/.flow-comet/skills/flow-comet/scripts/protocol-utils.mjs +24 -4
- package/.flow-comet/skills/flow-comet/scripts/route-node.mjs +697 -15
- package/.flow-comet/skills/flow-comet/scripts/state-schema.mjs +69 -0
- package/.flow-comet/skills/flow-comet/scripts/system-test.mjs +1656 -5
- package/.flow-comet/skills/flow-comet/scripts/task-parsing.mjs +13 -0
- package/.flow-comet/skills/flow-comet/scripts/workflow-guard.mjs +429 -276
- package/.flow-comet/skills/flow-comet/scripts/workflow-handoff.mjs +330 -13
- package/.flow-comet/skills/flow-comet/scripts/workflow-state.mjs +423 -38
- package/.flow-comet/skills/flow-comet-archive/SKILL.md +15 -0
- package/.flow-comet/skills/flow-comet-execute/SKILL.md +19 -1
- package/.flow-comet/skills/flow-comet-review/SKILL.md +21 -3
- package/.flow-comet/skills/flow-comet-subagent-execute/SKILL.md +12 -3
- package/.flow-comet/skills/flow-comet-verify/SKILL.md +19 -4
- package/README.md +6 -2
- package/package.json +1 -1
- package/scripts/dsh-bridge.mjs +2 -2
- package/scripts/prepare-env.mjs +77 -46
package/scripts/prepare-env.mjs
CHANGED
|
@@ -150,7 +150,7 @@ const PLATFORMS = {
|
|
|
150
150
|
const settings = injectSettingsHook(claudeDir);
|
|
151
151
|
const injected = !!(settings.hooks && settings.hooks.PreToolUse);
|
|
152
152
|
stats.files++;
|
|
153
|
-
console.log(`[
|
|
153
|
+
console.log(`[flow-comet] settings.local.json ${injected ? '注入完成(保留既有字段)' : '已生成'}`);
|
|
154
154
|
},
|
|
155
155
|
// rules 注入:.claude/rules/ 整树复制(自动加载 markdown 指令)
|
|
156
156
|
installRules(target, stats) {
|
|
@@ -193,13 +193,13 @@ const PLATFORMS = {
|
|
|
193
193
|
injectCodexHook(codexDir, target);
|
|
194
194
|
injectCodexConfig(codexDir);
|
|
195
195
|
stats.files += 2;
|
|
196
|
-
console.log('[
|
|
196
|
+
console.log('[flow-comet] .codex/hooks.json + config.toml 注入完成(hooks 启用,保留既有字段)');
|
|
197
197
|
},
|
|
198
198
|
// rules 注入:AGENTS.md 托管区内联(Codex 指令唯一自动加载路径;.codex/rules/ 是命令批准规则目录,不混用;
|
|
199
199
|
// 注入函数与托管区标记 codex/dsh 共用——任一平台卸载可清,另一平台重装恢复)
|
|
200
200
|
installRules(target, stats) {
|
|
201
201
|
if (injectManagedRules(target, stats)) {
|
|
202
|
-
console.log('[
|
|
202
|
+
console.log('[flow-comet] AGENTS.md 托管区注入完成(保留托管区外用户内容)');
|
|
203
203
|
}
|
|
204
204
|
},
|
|
205
205
|
// purge 清理:只清 flow-comet 技能(.agents/ 为多工具共享位置——非 flow-comet 条目保留)
|
|
@@ -263,17 +263,17 @@ const PLATFORMS = {
|
|
|
263
263
|
reportLoaderVersionTransition(loaderSrc, loaderDst);
|
|
264
264
|
fs.copyFileSync(loaderSrc, loaderDst);
|
|
265
265
|
stats.files++;
|
|
266
|
-
console.log('[
|
|
266
|
+
console.log('[flow-comet] 桥接 loader 已复制到 $DSH_HOME/plugins/dsh-flow-comet-bridge.mjs');
|
|
267
267
|
injectDshCordisPatch(dshHome, loaderDst);
|
|
268
268
|
stats.files++;
|
|
269
|
-
console.log('[
|
|
269
|
+
console.log('[flow-comet] $DSH_HOME/cordis.patch.yml 托管块注入完成(读-合并-写,保留既有块)');
|
|
270
270
|
} else {
|
|
271
271
|
// 容错:scripts/dsh-bridge.mjs 由并行任务新建——源缺失时 WARN 跳过 loader 复制
|
|
272
272
|
// **并跳过 cordis.patch.yml 托管块注入**(避免注入指向不存在文件的 file:// 引用,
|
|
273
273
|
// 导致 dsh 每次启动尝试加载不存在的插件);仍完成其余安装
|
|
274
274
|
// (AGENTS.md 托管区 / skills 复制照常)
|
|
275
275
|
console.warn(
|
|
276
|
-
'[
|
|
276
|
+
'[flow-comet] 警告: scripts/dsh-bridge.mjs 不存在——跳过 loader 复制与 cordis.patch.yml 托管块注入' +
|
|
277
277
|
'(dsh 桥接拦截暂不生效,待源文件就位后重跑 prepare-env)'
|
|
278
278
|
);
|
|
279
279
|
}
|
|
@@ -281,7 +281,7 @@ const PLATFORMS = {
|
|
|
281
281
|
// rules 注入:AGENTS.md 托管区(与 codex 共用注入函数与托管区标记——任一平台卸载可清)
|
|
282
282
|
installRules(target, stats) {
|
|
283
283
|
if (injectManagedRules(target, stats)) {
|
|
284
|
-
console.log('[
|
|
284
|
+
console.log('[flow-comet] AGENTS.md 托管区注入完成(保留托管区外用户内容)');
|
|
285
285
|
}
|
|
286
286
|
},
|
|
287
287
|
// purge 清理:项目级 .dsh/skills 下全部 flow-comet* 技能(.dsh/skills 为 dsh 技能位置——
|
|
@@ -330,7 +330,7 @@ const PLATFORMS = {
|
|
|
330
330
|
// 全局挂载语义警示:loader 位于 $DSH_HOME(所有 profile / 所有项目共享)——
|
|
331
331
|
// 任一项目 purge 都会连带移除,其它已安装 flow-comet 的项目将静默失去拦截
|
|
332
332
|
console.warn(
|
|
333
|
-
'[
|
|
333
|
+
'[flow-comet] 全局桥接 loader 被移除,其它已安装 flow-comet 的项目将停止拦截' +
|
|
334
334
|
'($DSH_HOME 全局挂载——如需恢复请重跑 prepare-env --platform dsh)'
|
|
335
335
|
);
|
|
336
336
|
}
|
|
@@ -360,7 +360,7 @@ function parseArgs(argv) {
|
|
|
360
360
|
// ——误敲或试探性执行会在当前目录铺开一套环境。`init` 词元仍可选:`fcomet --target X`
|
|
361
361
|
// 与 `fcomet init --target X` 等价(有参数即表达了意图)。
|
|
362
362
|
if (args.length === 0) {
|
|
363
|
-
console.error('[
|
|
363
|
+
console.error('[flow-comet] 未指定任何参数——裸执行不安装。');
|
|
364
364
|
printUsage((line) => console.error(line));
|
|
365
365
|
process.exit(1);
|
|
366
366
|
}
|
|
@@ -460,7 +460,7 @@ async function promptPlatformSelection(probe, traces, multiTrace) {
|
|
|
460
460
|
return promptPlatformSelectionReadline(probe, traces, multiTrace);
|
|
461
461
|
}
|
|
462
462
|
const selected = await clack.multiselect({
|
|
463
|
-
message: '[
|
|
463
|
+
message: '[flow-comet] 选择要安装的平台(方向键移动、空格勾选、回车确认)',
|
|
464
464
|
options,
|
|
465
465
|
required: true,
|
|
466
466
|
initialValues: initialValues.length > 0 ? initialValues : undefined,
|
|
@@ -487,7 +487,7 @@ async function promptPlatformSelectionReadline(probe, traces, multiTrace) {
|
|
|
487
487
|
? `(检测到目标项目已有 ${probe === 'claude-code' ? '.claude/' : probe === 'codex' ? '.codex/' : '.dsh/'} 痕迹)`
|
|
488
488
|
: '';
|
|
489
489
|
const answer = await rl.question(
|
|
490
|
-
`[
|
|
490
|
+
`[flow-comet] 选择要安装的平台(可多选)${probeNote}:\n` +
|
|
491
491
|
` 1) Claude Code (claude-code)${traceNote('claude-code', '.claude/')}\n` +
|
|
492
492
|
` 2) Codex (codex)${traceNote('codex', '.codex/')}\n` +
|
|
493
493
|
` 3) DeepSeek Harness (dsh)${traceNote('dsh', '.dsh/')}\n` +
|
|
@@ -556,7 +556,7 @@ async function resolvePlatform(target, platformArg) {
|
|
|
556
556
|
}
|
|
557
557
|
if (multiTrace) {
|
|
558
558
|
const fallbackId = probe ?? 'claude-code';
|
|
559
|
-
console.log(`[
|
|
559
|
+
console.log(`[flow-comet] 检测到目标项目同时有 .claude/、.codex/ 或 .dsh/ 中的多个痕迹——默认安装 ${PLATFORMS[fallbackId].label}。`);
|
|
560
560
|
console.log(' 如需其它平台或组合:交互终端运行,或显式 --platform dsh / claude-code,dsh / all。');
|
|
561
561
|
}
|
|
562
562
|
return [PLATFORMS[probe ?? 'claude-code']];
|
|
@@ -795,7 +795,7 @@ function migrateRuntimeFiles(target) {
|
|
|
795
795
|
for (const entry of RUNTIME_FILE_MIGRATIONS) {
|
|
796
796
|
migrateRuntimeFile(target, entry, report);
|
|
797
797
|
}
|
|
798
|
-
console.log(`[
|
|
798
|
+
console.log(`[flow-comet] 运行时文件迁移(${LEGACY_RUNTIME_DIR}/ → ${RUNTIME_DIR}/;白名单 ${RUNTIME_FILE_MIGRATIONS.length} 项):`);
|
|
799
799
|
for (const line of report.migrated) {
|
|
800
800
|
console.log(` - 已迁移: ${line}`);
|
|
801
801
|
}
|
|
@@ -825,7 +825,7 @@ function isRuntimeDirIgnoreLine(line) {
|
|
|
825
825
|
*/
|
|
826
826
|
function manageGitignore(target) {
|
|
827
827
|
if (fs.existsSync(path.join(target, RUNTIME_DIR, 'skills', 'flow-comet', 'SKILL.md'))) {
|
|
828
|
-
console.log(`[
|
|
828
|
+
console.log(`[flow-comet] .gitignore 纳管跳过: 当前目录是 flow-comet 源仓库(${RUNTIME_DIR}/ 为权威源,需保持被版本控制跟踪)`);
|
|
829
829
|
return;
|
|
830
830
|
}
|
|
831
831
|
const gitignorePath = path.join(target, '.gitignore');
|
|
@@ -843,14 +843,14 @@ function manageGitignore(target) {
|
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
845
|
if (existing.split(/\r?\n/).some(isRuntimeDirIgnoreLine)) {
|
|
846
|
-
console.log(`[
|
|
846
|
+
console.log(`[flow-comet] .gitignore 已含 ${RUNTIME_DIR}/ 条目——保持原样(幂等)`);
|
|
847
847
|
return;
|
|
848
848
|
}
|
|
849
849
|
const eol = existing.includes('\r\n') ? '\r\n' : '\n';
|
|
850
850
|
const appended = ['# flow-comet 运行时文件(不随仓库分发)', `${RUNTIME_DIR}/`].join(eol);
|
|
851
851
|
const separator = !fileExists || existing === '' || existing.endsWith('\n') ? '' : eol;
|
|
852
852
|
fs.writeFileSync(gitignorePath, existing + separator + appended + eol, 'utf8');
|
|
853
|
-
console.log(`[
|
|
853
|
+
console.log(`[flow-comet] .gitignore 追加 ${RUNTIME_DIR}/ 条目(既有内容原样保留): ${gitignorePath}`);
|
|
854
854
|
}
|
|
855
855
|
|
|
856
856
|
// ---------- settings.local.json 注入(Claude Code 平台;参考 comet installClaudeCodeHooks) ----------
|
|
@@ -965,7 +965,7 @@ function injectSettingsHook(claudeDir) {
|
|
|
965
965
|
if (existingHooks.PreToolUse !== undefined && !Array.isArray(existingHooks.PreToolUse)) {
|
|
966
966
|
// PreToolUse 非数组(手写变体):保留原值 + 警告,不注入(避免破坏用户结构)
|
|
967
967
|
console.error(
|
|
968
|
-
'[
|
|
968
|
+
'[flow-comet] 警告: settings.local.json 的 hooks.PreToolUse 不是数组(可能是手写变体)——' +
|
|
969
969
|
'为保护用户配置,未注入 comet hook。请手动添加(见 README 方案 B)。'
|
|
970
970
|
);
|
|
971
971
|
return settings;
|
|
@@ -1205,13 +1205,13 @@ function compareBridgeVersions(a, b) {
|
|
|
1205
1205
|
|
|
1206
1206
|
/**
|
|
1207
1207
|
* 覆盖前版本比对明示:从权威源 loader 与已装 loader 各提取版本戳,按数值序输出
|
|
1208
|
-
* 首次安装 / 升级 A→B / 降级 A→B / 版本一致 四类结论之一(人读、带 [
|
|
1208
|
+
* 首次安装 / 升级 A→B / 降级 A→B / 版本一致 四类结论之一(人读、带 [flow-comet] 前缀)。
|
|
1209
1209
|
* 任一侧提取失败(文件缺失/无标记行)→ 告警并跳过比对——不抛错、不中断安装;
|
|
1210
1210
|
* 覆盖动作(copyFileSync)由调用方照常执行,幂等语义不变。
|
|
1211
1211
|
*/
|
|
1212
1212
|
function reportLoaderVersionTransition(loaderSrc, loaderDst) {
|
|
1213
1213
|
if (!fs.existsSync(loaderDst)) {
|
|
1214
|
-
console.log('[
|
|
1214
|
+
console.log('[flow-comet] 桥接 loader 首次安装($DSH_HOME/plugins 无已装 loader)');
|
|
1215
1215
|
return;
|
|
1216
1216
|
}
|
|
1217
1217
|
const src = extractBridgeVersion(loaderSrc);
|
|
@@ -1220,7 +1220,7 @@ function reportLoaderVersionTransition(loaderSrc, loaderDst) {
|
|
|
1220
1220
|
const failedSide = !src.ok ? '权威源 loader' : '已装 loader';
|
|
1221
1221
|
const reason = !src.ok ? src.reason : installed.reason;
|
|
1222
1222
|
console.warn(
|
|
1223
|
-
`[
|
|
1223
|
+
`[flow-comet] 警告: ${failedSide} 版本戳提取失败(${reason})——跳过版本比对,继续覆盖安装`
|
|
1224
1224
|
);
|
|
1225
1225
|
return;
|
|
1226
1226
|
}
|
|
@@ -1228,11 +1228,11 @@ function reportLoaderVersionTransition(loaderSrc, loaderDst) {
|
|
|
1228
1228
|
const b = src.version;
|
|
1229
1229
|
const cmp = compareBridgeVersions(a, b);
|
|
1230
1230
|
if (cmp < 0) {
|
|
1231
|
-
console.log(`[
|
|
1231
|
+
console.log(`[flow-comet] 桥接 loader 升级 ${a} → ${b}`);
|
|
1232
1232
|
} else if (cmp > 0) {
|
|
1233
|
-
console.log(`[
|
|
1233
|
+
console.log(`[flow-comet] 桥接 loader 降级 ${a} → ${b}`);
|
|
1234
1234
|
} else {
|
|
1235
|
-
console.log(`[
|
|
1235
|
+
console.log(`[flow-comet] 桥接 loader 版本一致(${a})`);
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
1238
1238
|
|
|
@@ -1338,17 +1338,48 @@ function stripManagedBlock(content, startMarker, endMarker) {
|
|
|
1338
1338
|
|
|
1339
1339
|
// ---------- 版本标识(全部平台共用) ----------
|
|
1340
1340
|
|
|
1341
|
+
/**
|
|
1342
|
+
* 目录**本身**是否为 git 仓库根。判据 = `git rev-parse --show-toplevel` 指回自身。
|
|
1343
|
+
* git 从 cwd 起**向上**找仓库,故嵌套在别人仓库里的目录同样能拿到结果——必须比对。
|
|
1344
|
+
* 同时静音 stderr:git 在非仓库目录会打印 `fatal: not a git repository`,不该漏给用户。
|
|
1345
|
+
*/
|
|
1346
|
+
function isRepositoryRoot(dir) {
|
|
1347
|
+
try {
|
|
1348
|
+
const top = execFileSync('git', ['rev-parse', '--show-toplevel'], {
|
|
1349
|
+
cwd: dir, encoding: 'utf8', timeout: 30000, stdio: ['ignore', 'pipe', 'ignore'],
|
|
1350
|
+
}).trim();
|
|
1351
|
+
if (!top) return false;
|
|
1352
|
+
const normalize = (value) => {
|
|
1353
|
+
let resolved = value;
|
|
1354
|
+
try { resolved = fs.realpathSync(value); } catch { /* 取不到真实路径时用词法路径 */ }
|
|
1355
|
+
return process.platform === 'win32' ? resolved.toLowerCase() : resolved;
|
|
1356
|
+
};
|
|
1357
|
+
return normalize(top) === normalize(dir);
|
|
1358
|
+
} catch {
|
|
1359
|
+
return false; // 无 git / 非仓库:一律不采信
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1341
1363
|
/**
|
|
1342
1364
|
* 版本标识:优先从源仓库 git describe 生成(多人协作精确检测——发布版 = 精确 tag,
|
|
1343
1365
|
* 开发态 = "<tag>-<领先提交数>-g<hash>",提 issue 时维护者可据此判断包含哪些积累);
|
|
1344
1366
|
* 无 git(纯手动复制兜底)时用权威源随技能包分发的 INSTALLED_VERSION(最近发布版本)。
|
|
1367
|
+
*
|
|
1368
|
+
* **采信 git 的前提 = 本目录就是仓库根**(仓库检出形态)。包被装在别人的仓库里时
|
|
1369
|
+
* (本地安装进项目 → `<项目>/node_modules/flow-comet`),git 会向上找到**宿主仓库**,
|
|
1370
|
+
* 把宿主 tag 当成流工具版本——该值是错的,且它正是写进目标项目版本标识的那个值
|
|
1371
|
+
* (issue 报版本 / bridge-check 比对 / 套件跨值守卫会跟着全错)。故非仓库根一律回退包内文件。
|
|
1345
1372
|
*/
|
|
1346
1373
|
function resolveInstalledVersion() {
|
|
1347
1374
|
let installedVersion = '';
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1375
|
+
if (isRepositoryRoot(REPO_ROOT)) {
|
|
1376
|
+
try {
|
|
1377
|
+
const desc = execFileSync('git', ['describe', '--tags'], {
|
|
1378
|
+
cwd: REPO_ROOT, encoding: 'utf8', timeout: 30000, stdio: ['ignore', 'pipe', 'ignore'],
|
|
1379
|
+
}).trim();
|
|
1380
|
+
if (desc) installedVersion = desc.replace(/^v/, ''); // 剥 v 前缀,与 CHANGELOG 版本号一致
|
|
1381
|
+
} catch { /* 无 tag:回退权威源文件 */ }
|
|
1382
|
+
}
|
|
1352
1383
|
if (!installedVersion) {
|
|
1353
1384
|
const bundled = path.join(BUNDLE_DRAFTS, 'skills', 'flow-comet', 'INSTALLED_VERSION');
|
|
1354
1385
|
if (fs.existsSync(bundled)) installedVersion = fs.readFileSync(bundled, 'utf8').trim();
|
|
@@ -1375,9 +1406,9 @@ function gitErrorFirstLine(err) {
|
|
|
1375
1406
|
/** 手动获取指引(clone/checkout 失败或目录非上游克隆时打印——含上游 URL 与目标路径;不抛错) */
|
|
1376
1407
|
function printFlowKitManualGuide(target) {
|
|
1377
1408
|
const flowKitDir = path.join(target, 'flow-kit');
|
|
1378
|
-
console.warn(`[
|
|
1379
|
-
console.warn(`[
|
|
1380
|
-
console.warn('[
|
|
1409
|
+
console.warn(`[flow-comet] 手动获取指引: git clone ${FLOW_KIT_UPSTREAM_URL} "${flowKitDir}"`);
|
|
1410
|
+
console.warn(`[flow-comet] 然后锁定快照: git -C "${flowKitDir}" checkout --detach ${FLOW_KIT_LOCKED_COMMIT.slice(0, FLOW_KIT_SHORT_SHA_LEN)}`);
|
|
1411
|
+
console.warn('[flow-comet] 未获取 flow-kit 时技能协议引用悬空、guard 段名基准退化为内置 fallback——其余安装职责不受影响。');
|
|
1381
1412
|
}
|
|
1382
1413
|
|
|
1383
1414
|
/**
|
|
@@ -1420,10 +1451,10 @@ function ensureFlowKit(target) {
|
|
|
1420
1451
|
encoding: 'utf8',
|
|
1421
1452
|
timeout: FLOW_KIT_GIT_TIMEOUT_MS,
|
|
1422
1453
|
});
|
|
1423
|
-
console.log(`[
|
|
1454
|
+
console.log(`[flow-comet] 已获取 flow-kit(锁定 ${shortLock})`);
|
|
1424
1455
|
} catch (err) {
|
|
1425
1456
|
// 路径 4:clone/checkout 任一失败 → WARN + 手动指引,不抛错
|
|
1426
|
-
console.warn(`[
|
|
1457
|
+
console.warn(`[flow-comet] 警告: flow-kit 自动获取失败(${gitErrorFirstLine(err)})`);
|
|
1427
1458
|
printFlowKitManualGuide(target);
|
|
1428
1459
|
}
|
|
1429
1460
|
return;
|
|
@@ -1434,9 +1465,9 @@ function ensureFlowKit(target) {
|
|
|
1434
1465
|
if (originStatus !== 'match') {
|
|
1435
1466
|
// 路径 3:同名非克隆目录(或 remote 无法确认归属)→ 跳过 + 指引,绝不改动
|
|
1436
1467
|
if (originStatus === 'unreadable') {
|
|
1437
|
-
console.warn('[
|
|
1468
|
+
console.warn('[flow-comet] 警告: flow-kit 目录存在且含 .git,但 origin remote 读取失败——无法确认归属');
|
|
1438
1469
|
}
|
|
1439
|
-
console.log('[
|
|
1470
|
+
console.log('[flow-comet] 目录存在但非上游克隆,已跳过');
|
|
1440
1471
|
printFlowKitManualGuide(target);
|
|
1441
1472
|
return;
|
|
1442
1473
|
}
|
|
@@ -1447,18 +1478,18 @@ function ensureFlowKit(target) {
|
|
|
1447
1478
|
timeout: FLOW_KIT_GIT_TIMEOUT_MS,
|
|
1448
1479
|
}).trim();
|
|
1449
1480
|
const shortHead = head.slice(0, FLOW_KIT_SHORT_SHA_LEN);
|
|
1450
|
-
console.log(`[
|
|
1481
|
+
console.log(`[flow-comet] 已有 flow-kit(HEAD=${shortHead},推荐锁定点=${shortLock})`);
|
|
1451
1482
|
if (head === FLOW_KIT_LOCKED_COMMIT) {
|
|
1452
|
-
console.log('[
|
|
1483
|
+
console.log('[flow-comet] 当前 HEAD 与推荐锁定点一致。');
|
|
1453
1484
|
} else {
|
|
1454
1485
|
console.warn(
|
|
1455
|
-
`[
|
|
1486
|
+
`[flow-comet] 差异影响: 当前 HEAD 与推荐锁定点不一致——guard 段名基准与协议引用可能偏离安装器锁定内容` +
|
|
1456
1487
|
`(安装器绝不改动已有克隆;如需对齐请手动执行 git -C "${flowKitDir}" fetch 后 checkout --detach ${shortLock})`
|
|
1457
1488
|
);
|
|
1458
1489
|
}
|
|
1459
1490
|
} catch (err) {
|
|
1460
1491
|
// HEAD 只读失败同样不改动、不中断安装(保守降级为警告)
|
|
1461
|
-
console.warn(`[
|
|
1492
|
+
console.warn(`[flow-comet] 警告: flow-kit HEAD 读取失败(${gitErrorFirstLine(err)}),已跳过比对`);
|
|
1462
1493
|
}
|
|
1463
1494
|
}
|
|
1464
1495
|
|
|
@@ -1485,13 +1516,13 @@ async function main() {
|
|
|
1485
1516
|
|
|
1486
1517
|
// --purge(已在上方确认 --yes):逐平台删除生成物后重新生成
|
|
1487
1518
|
if (purge) {
|
|
1488
|
-
console.error(`[
|
|
1519
|
+
console.error(`[flow-comet] 警告: --purge 将删除 ${platformsLabel} 平台的以下生成物(不可恢复):`);
|
|
1489
1520
|
for (const platform of platforms) {
|
|
1490
1521
|
for (const entry of platform.purge(target)) {
|
|
1491
1522
|
console.error(` - ${entry}`);
|
|
1492
1523
|
}
|
|
1493
1524
|
}
|
|
1494
|
-
console.error('[
|
|
1525
|
+
console.error('[flow-comet] 已删除,开始重新生成。');
|
|
1495
1526
|
}
|
|
1496
1527
|
|
|
1497
1528
|
// flow-kit 获取链路(ADR-008 / D1~D6——平台无关,平台循环之前调用一次;
|
|
@@ -1503,7 +1534,7 @@ async function main() {
|
|
|
1503
1534
|
const stats = { dirs: 0, files: 0, skills: [] };
|
|
1504
1535
|
|
|
1505
1536
|
// 覆盖前打印将覆盖的生成物清单(默认非破坏:只覆盖生成物)
|
|
1506
|
-
console.log(`[
|
|
1537
|
+
console.log(`[flow-comet] 平台: ${platform.label} — 将覆盖以下生成物(其他内容保留):`);
|
|
1507
1538
|
console.log(` - ${skillRoot}`);
|
|
1508
1539
|
for (const line of platform.overwriteDescription(target)) {
|
|
1509
1540
|
console.log(` - ${line}`);
|
|
@@ -1530,7 +1561,7 @@ async function main() {
|
|
|
1530
1561
|
}
|
|
1531
1562
|
const replacedFiles = applyPathReplacements(skillRoot, platform.pathReplacements);
|
|
1532
1563
|
if (replacedFiles > 0) {
|
|
1533
|
-
console.log(`[
|
|
1564
|
+
console.log(`[flow-comet] 平台路径替换: ${replacedFiles} 个 .md 文件(${platform.label} 命令路径)`);
|
|
1534
1565
|
}
|
|
1535
1566
|
|
|
1536
1567
|
// 4. 版本标识(写入平台技能根,随技能包分发)
|
|
@@ -1539,11 +1570,11 @@ async function main() {
|
|
|
1539
1570
|
stats.files++;
|
|
1540
1571
|
|
|
1541
1572
|
// 摘要(逐平台)
|
|
1542
|
-
console.log(`[
|
|
1573
|
+
console.log(`[flow-comet] 已准备环境: ${target}(${platform.label})`);
|
|
1543
1574
|
console.log(
|
|
1544
|
-
`[
|
|
1575
|
+
`[flow-comet] 目录 ${stats.dirs} 个、文件 ${stats.files} 个、skills ${stats.skills.length} 个`
|
|
1545
1576
|
);
|
|
1546
|
-
console.log(`[
|
|
1577
|
+
console.log(`[flow-comet] skills: ${stats.skills.join(', ')}`);
|
|
1547
1578
|
}
|
|
1548
1579
|
|
|
1549
1580
|
// 执行顺序第三段:.gitignore 保守纳管(部署成功后执行——失败即中止,可重跑自愈)
|
|
@@ -1553,6 +1584,6 @@ async function main() {
|
|
|
1553
1584
|
try {
|
|
1554
1585
|
await main();
|
|
1555
1586
|
} catch (err) {
|
|
1556
|
-
console.error(`[
|
|
1587
|
+
console.error(`[flow-comet] 错误: ${err.message}`);
|
|
1557
1588
|
process.exit(1);
|
|
1558
1589
|
}
|