flow-comet 1.6.2 → 1.6.3

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.
Files changed (43) hide show
  1. package/.flow-comet/skills/flow-comet/INSTALLED_VERSION +1 -1
  2. package/.flow-comet/skills/flow-comet/SKILL.md +64 -46
  3. package/.flow-comet/skills/flow-comet/reference/KNOWN-ISSUES-template.md +1 -1
  4. package/.flow-comet/skills/flow-comet/reference/commit-discipline.md +32 -0
  5. package/.flow-comet/skills/flow-comet/reference/dirty-worktree.md +1 -1
  6. package/.flow-comet/skills/flow-comet/{GUIDANCE.md → reference/entry-detail.md} +18 -28
  7. package/.flow-comet/skills/flow-comet/reference/fix-loop.md +57 -0
  8. package/.flow-comet/skills/flow-comet/reference/platform-facts.md +58 -0
  9. package/.flow-comet/skills/flow-comet/reference/replan.md +23 -0
  10. package/.flow-comet/skills/flow-comet/scripts/comet-check.mjs +5 -4
  11. package/.flow-comet/skills/flow-comet/scripts/comet-hook-guard.mjs +260 -17
  12. package/.flow-comet/skills/flow-comet/scripts/guard-self-test.mjs +2714 -161
  13. package/.flow-comet/skills/flow-comet/scripts/route-node.mjs +51 -4
  14. package/.flow-comet/skills/flow-comet/scripts/state-schema.mjs +13 -0
  15. package/.flow-comet/skills/flow-comet/scripts/system-test.mjs +877 -10
  16. package/.flow-comet/skills/flow-comet/scripts/workflow-guard.mjs +52 -4
  17. package/.flow-comet/skills/flow-comet/scripts/workflow-handoff.mjs +111 -4
  18. package/.flow-comet/skills/flow-comet/scripts/workflow-state.mjs +108 -2
  19. package/.flow-comet/skills/flow-comet-archive/SKILL.md +10 -19
  20. package/.flow-comet/skills/flow-comet-change/SKILL.md +2 -3
  21. package/.flow-comet/skills/flow-comet-compose/SKILL.md +1 -1
  22. package/.flow-comet/skills/flow-comet-design/SKILL.md +6 -6
  23. package/.flow-comet/skills/flow-comet-execute/SKILL.md +58 -16
  24. package/.flow-comet/skills/flow-comet-integration/SKILL.md +8 -5
  25. package/.flow-comet/skills/flow-comet-open/SKILL.md +5 -1
  26. package/.flow-comet/skills/flow-comet-plan/GUIDANCE.md +1 -1
  27. package/.flow-comet/skills/flow-comet-plan/SKILL.md +8 -8
  28. package/.flow-comet/skills/flow-comet-review/SKILL.md +9 -12
  29. package/.flow-comet/skills/flow-comet-subagent-execute/SKILL.md +59 -16
  30. package/.flow-comet/skills/flow-comet-task/SKILL.md +3 -2
  31. package/.flow-comet/skills/flow-comet-ui-design/SKILL.md +3 -3
  32. package/.flow-comet/skills/flow-comet-verify/SKILL.md +8 -17
  33. package/README.md +4 -4
  34. package/package.json +1 -1
  35. package/scripts/dsh-bridge.mjs +59 -26
  36. package/scripts/prepare-env.mjs +165 -1
  37. package/.flow-comet/skills/flow-comet/reference/TEST-MATRIX.md +0 -116
  38. package/.flow-comet/skills/flow-comet/reference/composition-report.md +0 -65
  39. package/.flow-comet/skills/flow-comet/reference/dsh-platform.md +0 -184
  40. package/.flow-comet/skills/flow-comet/reference/resolved-skills.json +0 -661
  41. package/.flow-comet/skills/flow-comet/reference/skill-review.md +0 -13
  42. package/.flow-comet/skills/flow-comet/reference/subagents/script-author.md +0 -7
  43. package/.flow-comet/skills/flow-comet/reference/worktree-notes.md +0 -70
@@ -343,6 +343,8 @@ function analyzeDependencyGraph(blocks) {
343
343
  // process.exit / 入参改写),findParallelWriteConflicts 只负责读文件、解析、族①②与去重键的组织。
344
344
  // 路径解析 / 归一(parsePaths / normalizeTaskPath)为本模块单份实现,族①②③共用;依赖文本解析
345
345
  // 复用本模块 taskDependencyEligibility(依赖解析单一权威——不再另起第二份正则)。
346
+ // 路径**重叠判定**(含 glob 语义 · 见 DESIGN 的路径重叠判定决策)同样是本模块单份实现:具名纯函数 collectPathOverlaps,
347
+ // 族①②③一律经它比较——任一族内联第二份比较逻辑即违规(L-067 / AC-5 单源判据)。
346
348
  // 开标签属性解析与 workflow-state 路由共享 taskOpeningAttrs(属性序无关;不读块内文本)。
347
349
  // 2026-09-28 PR 审查采纳:由 workflow-guard.mjs 抽到本模块——plan 出口与 replan 重校消费同一实现,
348
350
  // 两侧各自决定强判(BLOCK)/弱判(WARN),判定本身只此一处(L-067 单一判据)。
@@ -398,6 +400,50 @@ function parsePaths(matchText) {
398
400
  .filter((p) => p !== null && p !== '');
399
401
  }
400
402
 
403
+ // 元字符判定:glob 魔法 = `*` / `?` / `[` 三类——与 workflow-handoff.mjs 的字面路径资格判定
404
+ // (literalRelativePosixPath 的 /[*?[]/)同口径;「什么算 glob」不另立第三套定义。
405
+ const GLOB_MAGIC_CHAR = /[*?[]/;
406
+
407
+ // 路径重叠判定(族①②③共用的唯一具名纯函数 · 见 DESIGN 的重叠判定与判据单源决策 · AC-5):入参为两组**已归一**路径
408
+ // 声明(normalizeTaskPath 产物,分隔符统一 `/`),返回重叠描述串数组(直接进冲突消息的 files 字段)
409
+ // 或空数组(不重叠);无 fs / console / process.exit,不改任何入参。
410
+ // 三形态:
411
+ // ① 两侧均无元字符 ⇒ 既有字面相等语义(逐字等价:相等报该路径本身——消费方消息零变化);
412
+ // ② 单侧含元字符 ⇒ 用该侧模式匹配另一侧字面路径:**段数必须相等**(`*` 不跨 `/`,`**` 亦非递归)、
413
+ // 段内 `*` 匹配段内任意字符(`[^/]*`)、其余字符字面锚定(正则元字符转义);段内无 `*` 即不命中;
414
+ // ③ 双侧均含 glob ⇒ **保守视为重叠**(宁可误拦不可漏检——漏检正是本判据要修的缺陷);无共同字面
415
+ // 路径可报,故报两侧声明。
416
+ // ②的语义**对齐基准** = workflow-handoff.mjs 的 matchWriteFilePattern(:94):该函数未导出、所在模块
417
+ // 又是 CLI 顶层脚本(import 即执行 main),物理不可复用;故在本模块内按同一形态实现并在此锚定基准
418
+ // 位置——基准若变,此处必须同步(漂移可见;不互指「同源」了事,L-067 修法子句)。零第三方 glob 库
419
+ // (ADR-007):复用本模块既有 escapeRegExp(转义集与基准内联转义一致)。
420
+ function collectPathOverlaps(leftPaths, rightPaths) {
421
+ const overlaps = [];
422
+ for (const left of leftPaths) {
423
+ for (const right of rightPaths) {
424
+ if (left === right) { overlaps.push(left); continue; } // ① 逐字相等(含两侧同 glob)
425
+ const leftGlob = GLOB_MAGIC_CHAR.test(left);
426
+ const rightGlob = GLOB_MAGIC_CHAR.test(right);
427
+ if (!leftGlob && !rightGlob) continue; // ① 两侧字面且不等 ⇒ 不重叠
428
+ if (leftGlob && rightGlob) { // ③ 双侧 glob:保守判重叠
429
+ overlaps.push(left + ' ∩ ' + right);
430
+ continue;
431
+ }
432
+ const patternSegments = (leftGlob ? left : right).split('/'); // ② 单侧 glob:模式 × 字面
433
+ const literalSegments = (leftGlob ? right : left).split('/');
434
+ if (patternSegments.length !== literalSegments.length) continue;
435
+ const matched = patternSegments.every((seg, index) => {
436
+ if (seg === literalSegments[index]) return true;
437
+ if (!seg.includes('*')) return false;
438
+ return new RegExp('^' + seg.split('*').map(escapeRegExp).join('[^/]*') + '$')
439
+ .test(literalSegments[index]);
440
+ });
441
+ if (matched) overlaps.push(left + ' ∩ ' + right);
442
+ }
443
+ }
444
+ return overlaps;
445
+ }
446
+
401
447
  // 第三族(同文件跨任务且无依赖路径)计算——同模块具名纯函数:输入任务块 / 依赖图 / 既有族去重键,
402
448
  // 输出冲突对数组({ a, b, files });无 fs / console / process.exit,不改任何入参。
403
449
  // taskContent 与 allBlocks 须同源(taskContent = 产出 allBlocks 的 TASK.md 文本)——修复任务族
@@ -423,7 +469,7 @@ function collectCrossTaskConflicts({ taskContent = '', allBlocks = [], depsById
423
469
  for (let i = 0; i < participants.length; i++) {
424
470
  for (let j = i + 1; j < participants.length; j++) {
425
471
  if (excludedPairKeys.has(taskPairKey(participants[i].id, participants[j].id))) continue;
426
- const overlap = [...participants[i].writes].filter((f) => participants[j].writes.has(f));
472
+ const overlap = collectPathOverlaps(participants[i].writes, participants[j].writes);
427
473
  if (overlap.length === 0) continue;
428
474
  if (reachableFrom(participants[i].id).has(participants[j].id)
429
475
  || reachableFrom(participants[j].id).has(participants[i].id)) continue;
@@ -470,14 +516,14 @@ async function findParallelWriteConflicts(changeDir) {
470
516
  const readWarnings = [];
471
517
  for (let i = 0; i < perTask.length; i++) {
472
518
  for (let j = i + 1; j < perTask.length; j++) {
473
- const overlap = [...perTask[i].writes].filter((f) => perTask[j].writes.has(f));
519
+ const overlap = collectPathOverlaps(perTask[i].writes, perTask[j].writes);
474
520
  if (overlap.length) writeConflicts.push({ a: perTask[i].id, b: perTask[j].id, files: overlap });
475
521
  // 读写弱判触发面:仅无显式 depends_on 关联的并行对(有显式关联=依赖已声明,跳过)
476
522
  const associated = perTask[i].deps.has(perTask[j].id) || perTask[j].deps.has(perTask[i].id);
477
523
  if (associated) continue;
478
- const readOverlap = [...perTask[i].reads].filter((f) => perTask[j].writes.has(f));
524
+ const readOverlap = collectPathOverlaps(perTask[i].reads, perTask[j].writes);
479
525
  if (readOverlap.length) readWarnings.push({ a: perTask[i].id, b: perTask[j].id, files: readOverlap });
480
- const readOverlap2 = [...perTask[j].reads].filter((f) => perTask[i].writes.has(f));
526
+ const readOverlap2 = collectPathOverlaps(perTask[j].reads, perTask[i].writes);
481
527
  if (readOverlap2.length) readWarnings.push({ a: perTask[j].id, b: perTask[i].id, files: readOverlap2 });
482
528
  }
483
529
  }
@@ -1331,6 +1377,7 @@ export {
1331
1377
  FIX_SECTION_TITLE_FALLBACK,
1332
1378
  analyzeDependencyGraph,
1333
1379
  findParallelWriteConflicts,
1380
+ collectPathOverlaps,
1334
1381
  normalizeHeading,
1335
1382
  classifyFixReturnCause,
1336
1383
  resolveFixRollbackDecision,
@@ -221,3 +221,16 @@ export function setFixRoundsFor(state, value) {
221
221
  }
222
222
  state.fixRoundsByChange[state.activeChange] = value;
223
223
  }
224
+
225
+ // ---------- 撤回留痕判据(单一来源:workflow-handoff.mjs 与 workflow-guard.mjs 共用) ----------
226
+ // 「已撤回」= request 记录上**同时**存在非空 withdrawnAt(时间戳;新写入走 time-utils 的 nowTimestamp
227
+ // ——本地时间 + 显式偏移,判据只要求非空字符串,故历史 Z 形态同样被接受)与非空 withdrawnBy(来源),
228
+ // 缺一不算撤回——只写其中一个字段的手改形态不构成撤回证据,守卫照旧按在飞委托处理(fail-closed:
229
+ // 判据不得只看单一字段,否则「带时间戳与来源」的留痕要求形同虚设)。
230
+ // 撤回是**终态**:记录不删除(历史留痕),只在原记录上加法式落两个字段。
231
+ export function handoffRequestWithdrawn(record) {
232
+ if (!record || typeof record !== 'object' || Array.isArray(record)) return false;
233
+ const at = record.withdrawnAt;
234
+ const by = record.withdrawnBy;
235
+ return typeof at === 'string' && at.trim() !== '' && typeof by === 'string' && by.trim() !== '';
236
+ }