@rpamis/comet 0.4.0-beta.11 → 0.4.0-beta.12

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 (192) hide show
  1. package/README.md +1 -1
  2. package/assets/manifest.json +1 -1
  3. package/assets/skills/comet/SKILL.md +8 -4
  4. package/assets/skills/comet/reference/classic-layout.md +2 -2
  5. package/assets/skills/comet/rules/comet-workflow-guard.en.md +4 -3
  6. package/assets/skills/comet/rules/comet-workflow-guard.md +4 -3
  7. package/assets/skills/comet/scripts/comet-entry-runtime.mjs +144 -144
  8. package/assets/skills/comet/scripts/comet-hook-router.mjs +174 -156
  9. package/assets/skills/comet/scripts/comet-runtime.mjs +161 -183
  10. package/assets/skills/comet-native/SKILL.md +19 -21
  11. package/assets/skills/comet-native/reference/artifacts.md +0 -7
  12. package/assets/skills/comet-native/reference/clarification.md +1 -1
  13. package/assets/skills/comet-native/reference/commands.md +64 -64
  14. package/assets/skills/comet-native/reference/recovery.md +9 -1
  15. package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +2315 -5157
  16. package/assets/skills-zh/comet/SKILL.md +8 -4
  17. package/assets/skills-zh/comet/reference/classic-layout.md +2 -2
  18. package/assets/skills-zh/comet-native/SKILL.md +19 -21
  19. package/assets/skills-zh/comet-native/reference/artifacts.md +0 -7
  20. package/assets/skills-zh/comet-native/reference/clarification.md +1 -1
  21. package/assets/skills-zh/comet-native/reference/commands.md +64 -64
  22. package/assets/skills-zh/comet-native/reference/recovery.md +9 -1
  23. package/dist/app/commands/classic.js +2 -2
  24. package/dist/app/commands/classic.js.map +1 -1
  25. package/dist/app/commands/dashboard.d.ts.map +1 -1
  26. package/dist/app/commands/dashboard.js +2 -1
  27. package/dist/app/commands/dashboard.js.map +1 -1
  28. package/dist/app/commands/doctor.d.ts.map +1 -1
  29. package/dist/app/commands/doctor.js +9 -3
  30. package/dist/app/commands/doctor.js.map +1 -1
  31. package/dist/config/repository-layout.json +1 -4
  32. package/dist/domains/comet-classic/classic-root-command.d.ts +4 -1
  33. package/dist/domains/comet-classic/classic-root-command.d.ts.map +1 -1
  34. package/dist/domains/comet-classic/classic-root-command.js +159 -49
  35. package/dist/domains/comet-classic/classic-root-command.js.map +1 -1
  36. package/dist/domains/comet-classic/classic-root-move.d.ts +0 -1
  37. package/dist/domains/comet-classic/classic-root-move.d.ts.map +1 -1
  38. package/dist/domains/comet-classic/classic-root-move.js +24 -121
  39. package/dist/domains/comet-classic/classic-root-move.js.map +1 -1
  40. package/dist/domains/comet-entry/current-selection-repair.js +1 -1
  41. package/dist/domains/comet-entry/current-selection-repair.js.map +1 -1
  42. package/dist/domains/comet-entry/hook-router.d.ts +12 -2
  43. package/dist/domains/comet-entry/hook-router.d.ts.map +1 -1
  44. package/dist/domains/comet-entry/hook-router.js +40 -14
  45. package/dist/domains/comet-entry/hook-router.js.map +1 -1
  46. package/dist/domains/comet-native/native-acceptance.d.ts +1 -2
  47. package/dist/domains/comet-native/native-acceptance.d.ts.map +1 -1
  48. package/dist/domains/comet-native/native-acceptance.js +5 -29
  49. package/dist/domains/comet-native/native-acceptance.js.map +1 -1
  50. package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
  51. package/dist/domains/comet-native/native-cli.js +5 -448
  52. package/dist/domains/comet-native/native-cli.js.map +1 -1
  53. package/dist/domains/comet-native/native-continuation.d.ts.map +1 -1
  54. package/dist/domains/comet-native/native-continuation.js +18 -5
  55. package/dist/domains/comet-native/native-continuation.js.map +1 -1
  56. package/dist/domains/comet-native/native-evidence-retention.d.ts.map +1 -1
  57. package/dist/domains/comet-native/native-evidence-retention.js +5 -21
  58. package/dist/domains/comet-native/native-evidence-retention.js.map +1 -1
  59. package/dist/domains/comet-native/native-evidence-storage.d.ts +2 -8
  60. package/dist/domains/comet-native/native-evidence-storage.d.ts.map +1 -1
  61. package/dist/domains/comet-native/native-evidence-storage.js +2 -23
  62. package/dist/domains/comet-native/native-evidence-storage.js.map +1 -1
  63. package/dist/domains/comet-native/native-findings.d.ts.map +1 -1
  64. package/dist/domains/comet-native/native-findings.js +6 -4
  65. package/dist/domains/comet-native/native-findings.js.map +1 -1
  66. package/dist/domains/comet-native/native-repair-integration.d.ts +1 -3
  67. package/dist/domains/comet-native/native-repair-integration.d.ts.map +1 -1
  68. package/dist/domains/comet-native/native-repair-integration.js +12 -15
  69. package/dist/domains/comet-native/native-repair-integration.js.map +1 -1
  70. package/dist/domains/comet-native/native-repair-runtime.d.ts +0 -1
  71. package/dist/domains/comet-native/native-repair-runtime.d.ts.map +1 -1
  72. package/dist/domains/comet-native/native-repair-runtime.js +3 -10
  73. package/dist/domains/comet-native/native-repair-runtime.js.map +1 -1
  74. package/dist/domains/comet-native/native-repair-stagnation.d.ts +1 -9
  75. package/dist/domains/comet-native/native-repair-stagnation.d.ts.map +1 -1
  76. package/dist/domains/comet-native/native-repair-stagnation.js +4 -14
  77. package/dist/domains/comet-native/native-repair-stagnation.js.map +1 -1
  78. package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
  79. package/dist/domains/comet-native/native-snapshot.js +0 -40
  80. package/dist/domains/comet-native/native-snapshot.js.map +1 -1
  81. package/dist/domains/comet-native/native-transition-evidence.d.ts.map +1 -1
  82. package/dist/domains/comet-native/native-transition-evidence.js +0 -10
  83. package/dist/domains/comet-native/native-transition-evidence.js.map +1 -1
  84. package/dist/domains/comet-native/native-transitions.d.ts.map +1 -1
  85. package/dist/domains/comet-native/native-transitions.js +3 -31
  86. package/dist/domains/comet-native/native-transitions.js.map +1 -1
  87. package/dist/domains/comet-native/native-types.d.ts +0 -6
  88. package/dist/domains/comet-native/native-types.d.ts.map +1 -1
  89. package/dist/domains/comet-native/native-verification-evidence.d.ts +2 -48
  90. package/dist/domains/comet-native/native-verification-evidence.d.ts.map +1 -1
  91. package/dist/domains/comet-native/native-verification-evidence.js +13 -301
  92. package/dist/domains/comet-native/native-verification-evidence.js.map +1 -1
  93. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts +2 -138
  94. package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
  95. package/dist/domains/comet-native/native-verification-receipt-runtime.js +103 -769
  96. package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
  97. package/dist/domains/comet-native/native-verification-receipt.d.ts +3 -89
  98. package/dist/domains/comet-native/native-verification-receipt.d.ts.map +1 -1
  99. package/dist/domains/comet-native/native-verification-receipt.js +19 -350
  100. package/dist/domains/comet-native/native-verification-receipt.js.map +1 -1
  101. package/dist/domains/comet-native/native-verification-runtime.d.ts +1 -4
  102. package/dist/domains/comet-native/native-verification-runtime.d.ts.map +1 -1
  103. package/dist/domains/comet-native/native-verification-runtime.js +14 -209
  104. package/dist/domains/comet-native/native-verification-runtime.js.map +1 -1
  105. package/dist/domains/dashboard/web/assets/{arc-BXWNV2Qv.js → arc-BXDAG6Qx.js} +1 -1
  106. package/dist/domains/dashboard/web/assets/{architectureDiagram-3BPJPVTR-CjVHPivo.js → architectureDiagram-3BPJPVTR-R2JyCv0i.js} +1 -1
  107. package/dist/domains/dashboard/web/assets/{blockDiagram-GPEHLZMM-P2PGImSM.js → blockDiagram-GPEHLZMM-STNPWdDl.js} +1 -1
  108. package/dist/domains/dashboard/web/assets/{c4Diagram-AAUBKEIU-fTj6Xhs1.js → c4Diagram-AAUBKEIU-Bh-rUIcJ.js} +1 -1
  109. package/dist/domains/dashboard/web/assets/channel-XR_5gd6D.js +1 -0
  110. package/dist/domains/dashboard/web/assets/{chunk-2J33WTMH-BjFDZ5yo.js → chunk-2J33WTMH-BRhFNAFH.js} +1 -1
  111. package/dist/domains/dashboard/web/assets/{chunk-4BX2VUAB-BAUkbZdT.js → chunk-4BX2VUAB-CwA3zkFS.js} +1 -1
  112. package/dist/domains/dashboard/web/assets/{chunk-55IACEB6-DBmuiYme.js → chunk-55IACEB6-C1tqAl_E.js} +1 -1
  113. package/dist/domains/dashboard/web/assets/{chunk-727SXJPM-Do9ufCgY.js → chunk-727SXJPM-DDefBoUS.js} +1 -1
  114. package/dist/domains/dashboard/web/assets/{chunk-AQP2D5EJ-qRQWlB5d.js → chunk-AQP2D5EJ-Dq-0Yi9D.js} +1 -1
  115. package/dist/domains/dashboard/web/assets/{chunk-FMBD7UC4-BzDzeJ4_.js → chunk-FMBD7UC4-DC-MVNgk.js} +1 -1
  116. package/dist/domains/dashboard/web/assets/{chunk-ND2GUHAM-OQcAmIvL.js → chunk-ND2GUHAM-BLWZ8zWd.js} +1 -1
  117. package/dist/domains/dashboard/web/assets/{chunk-QZHKN3VN-BiRfH4d2.js → chunk-QZHKN3VN-DaK5rvZu.js} +1 -1
  118. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-CG_TnucZ.js +1 -0
  119. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-CG_TnucZ.js +1 -0
  120. package/dist/domains/dashboard/web/assets/{cose-bilkent-S5V4N54A-CZk37fGn.js → cose-bilkent-S5V4N54A-DCPgAyMU.js} +1 -1
  121. package/dist/domains/dashboard/web/assets/{cynefin-VYW2F7L2-B3F-qRTJ.js → cynefin-VYW2F7L2-CBaY4KFj.js} +1 -1
  122. package/dist/domains/dashboard/web/assets/{dagre-BM42HDAG-D5BQ0eqN.js → dagre-BM42HDAG-CLKQ6BQM.js} +1 -1
  123. package/dist/domains/dashboard/web/assets/{diagram-2AECGRRQ-33mXstha.js → diagram-2AECGRRQ-DCup336F.js} +1 -1
  124. package/dist/domains/dashboard/web/assets/{diagram-5GNKFQAL-BWHCMFvD.js → diagram-5GNKFQAL-DgpDOFTE.js} +1 -1
  125. package/dist/domains/dashboard/web/assets/{diagram-KO2AKTUF-DrPGimEt.js → diagram-KO2AKTUF-BZcengGf.js} +1 -1
  126. package/dist/domains/dashboard/web/assets/{diagram-LMA3HP47-BBlsg7jG.js → diagram-LMA3HP47-DSECilBo.js} +1 -1
  127. package/dist/domains/dashboard/web/assets/{diagram-OG6HWLK6-CsaFSpHi.js → diagram-OG6HWLK6-3FuzANXW.js} +1 -1
  128. package/dist/domains/dashboard/web/assets/{erDiagram-TEJ5UH35-CoB0mzhk.js → erDiagram-TEJ5UH35-BBrwULhs.js} +1 -1
  129. package/dist/domains/dashboard/web/assets/{flowDiagram-I6XJVG4X-lT53XfSE.js → flowDiagram-I6XJVG4X-DiNn0Yzp.js} +1 -1
  130. package/dist/domains/dashboard/web/assets/{ganttDiagram-6RSMTGT7-D1SQ56fl.js → ganttDiagram-6RSMTGT7-DcvbTHnu.js} +1 -1
  131. package/dist/domains/dashboard/web/assets/{gitGraphDiagram-PVQCEYII-D4oDMS5x.js → gitGraphDiagram-PVQCEYII-CgCY3MJo.js} +1 -1
  132. package/dist/domains/dashboard/web/assets/index-BR3wUr2k.css +1 -0
  133. package/dist/domains/dashboard/web/assets/{index-Msce_H_q.js → index-CovQUq5W.js} +4 -4
  134. package/dist/domains/dashboard/web/assets/{infoDiagram-5YYISTIA-BeICn98s.js → infoDiagram-5YYISTIA-hzBGAEue.js} +1 -1
  135. package/dist/domains/dashboard/web/assets/{ishikawaDiagram-YF4QCWOH-Dkspu33d.js → ishikawaDiagram-YF4QCWOH-DCPPspol.js} +1 -1
  136. package/dist/domains/dashboard/web/assets/{journeyDiagram-JHISSGLW-C-EM1sZl.js → journeyDiagram-JHISSGLW-C_v8b1Os.js} +1 -1
  137. package/dist/domains/dashboard/web/assets/{kanban-definition-UN3LZRKU-BTbB0IO2.js → kanban-definition-UN3LZRKU-CgpE9lG7.js} +1 -1
  138. package/dist/domains/dashboard/web/assets/{linear-Cp0UrqDr.js → linear-jSddcREx.js} +1 -1
  139. package/dist/domains/dashboard/web/assets/{mermaid.core-CucmqsLW.js → mermaid.core-5Ibr28Ig.js} +4 -4
  140. package/dist/domains/dashboard/web/assets/{mindmap-definition-RKZ34NQL-CjEshF1X.js → mindmap-definition-RKZ34NQL-XPCohX0x.js} +1 -1
  141. package/dist/domains/dashboard/web/assets/{pieDiagram-4H26LBE5-DrwFnX1b.js → pieDiagram-4H26LBE5-DvhxgQWl.js} +1 -1
  142. package/dist/domains/dashboard/web/assets/{quadrantDiagram-W4KKPZXB-CjG6pBR2.js → quadrantDiagram-W4KKPZXB-CCUxdF-S.js} +1 -1
  143. package/dist/domains/dashboard/web/assets/{requirementDiagram-4Y6WPE33-BpUQVqCV.js → requirementDiagram-4Y6WPE33-FS3TCmdX.js} +1 -1
  144. package/dist/domains/dashboard/web/assets/{sankeyDiagram-5OEKKPKP-BeGkEvzR.js → sankeyDiagram-5OEKKPKP-r129rscN.js} +1 -1
  145. package/dist/domains/dashboard/web/assets/{sequenceDiagram-3UESZ5HK-sSTU3MCO.js → sequenceDiagram-3UESZ5HK--DCY0bvU.js} +1 -1
  146. package/dist/domains/dashboard/web/assets/{stateDiagram-AJRCARHV-CcFBc6qh.js → stateDiagram-AJRCARHV-yHkUByrT.js} +1 -1
  147. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-XHzDdqcm.js +1 -0
  148. package/dist/domains/dashboard/web/assets/{timeline-definition-PNZ67QCA-DCN7NjEs.js → timeline-definition-PNZ67QCA-NlqCuFuo.js} +1 -1
  149. package/dist/domains/dashboard/web/assets/{vennDiagram-CIIHVFJN-DZAN1_rr.js → vennDiagram-CIIHVFJN-B4W_d1Nq.js} +1 -1
  150. package/dist/domains/dashboard/web/assets/{wardleyDiagram-YWT4CUSO-FfkJfr4C.js → wardleyDiagram-YWT4CUSO-Bex-_jWd.js} +1 -1
  151. package/dist/domains/dashboard/web/assets/{xychartDiagram-2RQKCTM6-CD8B-EmR.js → xychartDiagram-2RQKCTM6-CmxeVM2Z.js} +1 -1
  152. package/dist/domains/dashboard/web/index.html +2 -2
  153. package/eval/local/tasks/comet-native-workflow/instruction.md +4 -16
  154. package/eval/local/tasks/comet-native-workflow/validation/test_native_workflow.py +21 -231
  155. package/eval/local/tests/conftest.py +0 -193
  156. package/eval/local/tests/scaffold/test_native_wave_evaluations.py +0 -148
  157. package/eval/local/tests/scaffold/test_tasks.py +1 -8
  158. package/eval/local/tests/scaffold/test_utils.py +4 -7
  159. package/eval/scaffold/shell/docker.sh +2 -95
  160. package/package.json +1 -1
  161. package/dist/domains/comet-native/native-controller-trust.d.ts +0 -21
  162. package/dist/domains/comet-native/native-controller-trust.d.ts.map +0 -1
  163. package/dist/domains/comet-native/native-controller-trust.js +0 -140
  164. package/dist/domains/comet-native/native-controller-trust.js.map +0 -1
  165. package/dist/domains/comet-native/native-independent-review.d.ts +0 -28
  166. package/dist/domains/comet-native/native-independent-review.d.ts.map +0 -1
  167. package/dist/domains/comet-native/native-independent-review.js +0 -134
  168. package/dist/domains/comet-native/native-independent-review.js.map +0 -1
  169. package/dist/domains/comet-native/native-review-contract.d.ts +0 -6
  170. package/dist/domains/comet-native/native-review-contract.d.ts.map +0 -1
  171. package/dist/domains/comet-native/native-review-contract.js +0 -6
  172. package/dist/domains/comet-native/native-review-contract.js.map +0 -1
  173. package/dist/domains/comet-native/native-review-identity.d.ts +0 -50
  174. package/dist/domains/comet-native/native-review-identity.d.ts.map +0 -1
  175. package/dist/domains/comet-native/native-review-identity.js +0 -209
  176. package/dist/domains/comet-native/native-review-identity.js.map +0 -1
  177. package/dist/domains/comet-native/native-review-signer.d.ts +0 -24
  178. package/dist/domains/comet-native/native-review-signer.d.ts.map +0 -1
  179. package/dist/domains/comet-native/native-review-signer.js +0 -125
  180. package/dist/domains/comet-native/native-review-signer.js.map +0 -1
  181. package/dist/domains/comet-native/native-review-trust.d.ts +0 -35
  182. package/dist/domains/comet-native/native-review-trust.d.ts.map +0 -1
  183. package/dist/domains/comet-native/native-review-trust.js +0 -176
  184. package/dist/domains/comet-native/native-review-trust.js.map +0 -1
  185. package/dist/domains/dashboard/web/assets/channel--JtnhJr8.js +0 -1
  186. package/dist/domains/dashboard/web/assets/classDiagram-4FO5ZUOK-BRGmx8Iz.js +0 -1
  187. package/dist/domains/dashboard/web/assets/classDiagram-v2-Q7XG4LA2-BRGmx8Iz.js +0 -1
  188. package/dist/domains/dashboard/web/assets/index-D-AGxvI4.css +0 -1
  189. package/dist/domains/dashboard/web/assets/stateDiagram-v2-BHNVJYJU-D5zZYi4x.js +0 -1
  190. package/eval/local/tasks/comet-native-workflow/environment/.include-trusted-native-review-fixture +0 -1
  191. package/eval/scaffold/shell/native-review-signer-daemon.mjs +0 -144
  192. package/eval/scaffold/shell/native-review-verifier-daemon.mjs +0 -178
@@ -8096,6 +8096,9 @@ async function readWorkflowProjectConfigSnapshot(projectRoot, options = {}) {
8096
8096
  identity: projectConfigIdentity(bytes)
8097
8097
  };
8098
8098
  }
8099
+ async function readWorkflowProjectConfig(projectRoot) {
8100
+ return (await readWorkflowProjectConfigDocument(projectRoot))?.config ?? null;
8101
+ }
8099
8102
  var WORKFLOW_PROJECT_CONFIG_PATH;
8100
8103
  var init_project_config_reader = __esm({
8101
8104
  "domains/workflow-contract/project-config-reader.ts"() {
@@ -15886,12 +15889,12 @@ var classicResumeProbeCommand = async (args, options) => withClassicCommandConte
15886
15889
 
15887
15890
  // domains/comet-classic/classic-root-move.ts
15888
15891
  init_file_identity();
15889
- import { createHash as createHash9, randomUUID as randomUUID8 } from "crypto";
15890
- import { promises as fs21 } from "fs";
15891
- import path30 from "path";
15892
15892
  init_project_config();
15893
15893
  init_project_config_reader();
15894
15894
  init_protected_project_path();
15895
+ import { createHash as createHash9, randomUUID as randomUUID8 } from "crypto";
15896
+ import { promises as fs21 } from "fs";
15897
+ import path30 from "path";
15895
15898
  var JOURNAL_RELATIVE_PATH = ".comet/classic-root-move.json";
15896
15899
  var STAGING_PLAN_IDENTITY = ".comet/transactions/classic-root-move/<transaction-id>/openspec";
15897
15900
  var HISTORICAL_POINTERS_PRESERVED = [
@@ -15903,14 +15906,13 @@ var HISTORICAL_POINTERS_PRESERVED = [
15903
15906
  ];
15904
15907
  var APPLY_PRECONDITIONS = [
15905
15908
  "approved plan ID still matches layout, source identity and manifest, target identity, and configuration",
15906
- "no active, archive, or recovery blockers",
15909
+ "no pending root-move recovery transaction",
15907
15910
  "target remains absent or the bound empty directory",
15908
15911
  "source, target, staging, transaction, and config paths remain protected"
15909
15912
  ];
15910
15913
  var MAX_FILES = 5e4;
15911
15914
  var MAX_TOTAL_BYTES = 512 * 1024 * 1024;
15912
15915
  var MAX_JOURNAL_BYTES = 16 * 1024 * 1024;
15913
- var MAX_PENDING_ACTION_BYTES = 1024 * 1024;
15914
15916
  var HASH_PATTERN = /^[a-f0-9]{64}$/u;
15915
15917
  var UUID_PATTERN2 = /^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u;
15916
15918
  var journalClaimBrand = /* @__PURE__ */ Symbol("ClassicRootMoveJournalClaim");
@@ -15977,18 +15979,6 @@ async function protectedDirectoryExists(projectRoot, directory, label) {
15977
15979
  throw error;
15978
15980
  }
15979
15981
  }
15980
- async function protectedFileExists(projectRoot, file, label) {
15981
- try {
15982
- return (await inspectProtectedProjectPath(projectRoot, projectRelative2(projectRoot, file), {
15983
- label,
15984
- expected: "file"
15985
- })).exists;
15986
- } catch (error) {
15987
- const code = error.code;
15988
- if (code === "ENOENT" || code === "ENOTDIR") return false;
15989
- throw error;
15990
- }
15991
- }
15992
15982
  async function ensureRootMoveDirectory(projectRoot, directory, label, testHooks) {
15993
15983
  const root = path30.resolve(projectRoot);
15994
15984
  const target = path30.resolve(directory);
@@ -16317,6 +16307,12 @@ function manifestHash(manifest) {
16317
16307
  })
16318
16308
  ).digest("hex");
16319
16309
  }
16310
+ function compareManifestPath(left, right) {
16311
+ return left < right ? -1 : left > right ? 1 : 0;
16312
+ }
16313
+ function manifestPathsAreSorted(values, compare) {
16314
+ return values.every((entry2, index) => index === 0 || compare(values[index - 1], entry2) <= 0);
16315
+ }
16320
16316
  function planIdFor(plan) {
16321
16317
  return createHash9("sha256").update(
16322
16318
  JSON.stringify({
@@ -16478,7 +16474,7 @@ async function scanTree(projectRoot, root, testHooks) {
16478
16474
  `tree:${relativeDirectory || projectRelative2(projectRoot, root)}`,
16479
16475
  testHooks
16480
16476
  );
16481
- for (const entry2 of entries.sort((left, right) => left.name.localeCompare(right.name))) {
16477
+ for (const entry2 of entries.sort((left, right) => compareManifestPath(left.name, right.name))) {
16482
16478
  const absolute = path30.join(directory, entry2.name);
16483
16479
  const relative = relativeDirectory ? `${relativeDirectory}/${entry2.name}` : entry2.name;
16484
16480
  const stat = await fs21.lstat(absolute, { bigint: true });
@@ -16517,8 +16513,8 @@ async function scanTree(projectRoot, root, testHooks) {
16517
16513
  }
16518
16514
  }
16519
16515
  await visit(root, "");
16520
- directories.sort((left, right) => left.localeCompare(right));
16521
- files.sort((left, right) => left.path.localeCompare(right.path));
16516
+ directories.sort(compareManifestPath);
16517
+ files.sort((left, right) => compareManifestPath(left.path, right.path));
16522
16518
  const normalized2 = { directories, files, totalBytes };
16523
16519
  return { ...normalized2, hash: manifestHash(normalized2) };
16524
16520
  }
@@ -16556,99 +16552,6 @@ async function inspectInitialTarget(projectRoot, target, testHooks) {
16556
16552
  throw error;
16557
16553
  }
16558
16554
  }
16559
- async function activeChangeBlockers(projectRoot, source, testHooks) {
16560
- const changesDir = path30.join(source, "changes");
16561
- let entries;
16562
- try {
16563
- entries = await readProtectedDirectory(projectRoot, changesDir, "active-changes", testHooks);
16564
- } catch (error) {
16565
- if (error.code === "ENOENT") return [];
16566
- throw error;
16567
- }
16568
- return entries.filter((entry2) => entry2.name !== "archive").map((entry2) => `active or unmanaged OpenSpec change: ${entry2.name}`).sort();
16569
- }
16570
- async function archiveAndRecoveryBlockers(projectRoot, source, testHooks) {
16571
- const archiveRoot = path30.join(source, "changes", "archive");
16572
- if (!await protectedDirectoryExists(projectRoot, archiveRoot, "archive-root")) return [];
16573
- const blockers = [];
16574
- for (const entry2 of await readProtectedDirectory(
16575
- projectRoot,
16576
- archiveRoot,
16577
- "archive-root",
16578
- testHooks
16579
- )) {
16580
- if (!entry2.isDirectory()) continue;
16581
- const changeDir = path30.join(archiveRoot, entry2.name);
16582
- const pending = path30.join(archiveRoot, entry2.name, ".comet", "pending-action.json");
16583
- const changeChain = await captureProtectedDirectoryChain(
16584
- projectRoot,
16585
- changeDir,
16586
- `archived change ${entry2.name}`
16587
- );
16588
- await testHooks?.afterDirectoryInspect?.(`archived-change:${entry2.name}`);
16589
- await validateProtectedDirectoryChain(changeChain, `archived change ${entry2.name}`);
16590
- await testHooks?.beforeArchivedPendingRead?.(entry2.name);
16591
- let pendingSource = null;
16592
- try {
16593
- pendingSource = (await readRootMoveFile(
16594
- projectRoot,
16595
- pending,
16596
- MAX_PENDING_ACTION_BYTES,
16597
- `Archived pending action ${entry2.name}`
16598
- )).toString("utf8").trim();
16599
- } catch (error) {
16600
- const code = error.code;
16601
- if (code !== "ENOENT" && code !== "ENOTDIR") throw error;
16602
- }
16603
- if (pendingSource !== null) {
16604
- if (pendingSource && pendingSource !== "null" && pendingSource !== "{}") {
16605
- blockers.push(`archived change ${entry2.name} has a pending archive action`);
16606
- }
16607
- }
16608
- try {
16609
- await validateProtectedDirectoryChain(changeChain, `archived change ${entry2.name}`);
16610
- const [projection, legacy] = await Promise.all([
16611
- readClassicState(changeDir, { migrate: false }),
16612
- readLegacyState(changeDir)
16613
- ]);
16614
- await validateProtectedDirectoryChain(changeChain, `archived change ${entry2.name}`);
16615
- if (!legacy.archived) {
16616
- blockers.push(`archived change ${entry2.name} has archived: false`);
16617
- }
16618
- if (projection.run) {
16619
- if (projection.run.pending !== null || await protectedFileExists(
16620
- projectRoot,
16621
- path30.join(changeDir, projection.run.pendingRef),
16622
- `Archived recovery pending file ${entry2.name}`
16623
- )) {
16624
- blockers.push(`archived change ${entry2.name} has pending Classic recovery`);
16625
- }
16626
- if (projection.run.status !== "completed") {
16627
- blockers.push(
16628
- `archived change ${entry2.name} has incomplete Run status: ${projection.run.status}`
16629
- );
16630
- } else {
16631
- const checkpoint = await readCheckpoint(changeDir, projection.run.checkpointRef);
16632
- if (!checkpoint || checkpoint.runId !== projection.run.runId) {
16633
- blockers.push(`archived change ${entry2.name} has no completed checkpoint`);
16634
- }
16635
- }
16636
- }
16637
- } catch (error) {
16638
- blockers.push(
16639
- `archived change ${entry2.name} has invalid recovery state: ${error instanceof Error ? error.message : String(error)}`
16640
- );
16641
- }
16642
- }
16643
- return blockers.sort();
16644
- }
16645
- async function classicSelectionBlockers(projectRoot) {
16646
- const selection = await readCometCurrentSelection(projectRoot);
16647
- if (selection.status === "selected" && selection.selection.workflow === "classic") {
16648
- return [`current Classic selection: ${selection.selection.change}`];
16649
- }
16650
- return [];
16651
- }
16652
16555
  async function validatedLegacyConfig(projectRoot) {
16653
16556
  await assertClassicWorkflowEnabled(projectRoot);
16654
16557
  if (await readClassicArtifactLayout(projectRoot) !== "legacy") {
@@ -16685,17 +16588,6 @@ async function preflight2(projectRoot, options = {}) {
16685
16588
  docs.openSpecRoot,
16686
16589
  options.testHooks
16687
16590
  );
16688
- const activeBlockers = await activeChangeBlockers(
16689
- projectRoot,
16690
- legacy.openSpecRoot,
16691
- options.testHooks
16692
- );
16693
- const archiveBlockers = await archiveAndRecoveryBlockers(
16694
- projectRoot,
16695
- legacy.openSpecRoot,
16696
- options.testHooks
16697
- );
16698
- const selectionBlockers = await classicSelectionBlockers(projectRoot);
16699
16591
  const configSnapshot = await projectConfigSnapshot(projectRoot);
16700
16592
  await options.testHooks?.afterConfigSnapshot?.();
16701
16593
  const configHash = configSnapshot.identity.sha256;
@@ -16726,12 +16618,12 @@ async function preflight2(projectRoot, options = {}) {
16726
16618
  fileSummary: manifest.files.map((file) => ({ ...file })),
16727
16619
  configChange: { from: "legacy", to: "docs" },
16728
16620
  conflicts: targetInspection.conflicts,
16729
- blockers: [...activeBlockers, ...archiveBlockers, ...selectionBlockers],
16621
+ blockers: [],
16730
16622
  pendingRecovery: null,
16731
16623
  historicalPointersPreserved: [...HISTORICAL_POINTERS_PRESERVED],
16732
16624
  applyPreconditions: [...APPLY_PRECONDITIONS],
16733
16625
  allowedRecoveryStrategies: [],
16734
- readyToApply: targetInspection.conflicts.length === 0 && activeBlockers.length === 0 && archiveBlockers.length === 0 && selectionBlockers.length === 0
16626
+ readyToApply: targetInspection.conflicts.length === 0
16735
16627
  }
16736
16628
  };
16737
16629
  }
@@ -16843,7 +16735,10 @@ function parseManifest(value) {
16843
16735
  return { path: filePath, size: file.size, hash: file.hash };
16844
16736
  });
16845
16737
  if (files.length > MAX_FILES) throw invalidJournal(`manifest exceeds ${MAX_FILES} files`);
16846
- if (directories.some((entry2, index) => index > 0 && directories[index - 1] >= entry2) || files.some((entry2, index) => index > 0 && files[index - 1].path >= entry2.path)) {
16738
+ const filePaths = files.map((file) => file.path);
16739
+ const duplicatePaths = new Set(directories).size !== directories.length || new Set(filePaths).size !== filePaths.length;
16740
+ const pathsUseSupportedOrder = manifestPathsAreSorted(directories, compareManifestPath) && manifestPathsAreSorted(filePaths, compareManifestPath) || manifestPathsAreSorted(directories, (left, right) => left.localeCompare(right)) && manifestPathsAreSorted(filePaths, (left, right) => left.localeCompare(right));
16741
+ if (duplicatePaths || !pathsUseSupportedOrder) {
16847
16742
  throw invalidJournal("manifest paths must be unique and sorted");
16848
16743
  }
16849
16744
  const totalBytes = files.reduce((total, file) => total + file.size, 0);
@@ -17679,12 +17574,6 @@ async function planClassicRootMove(startPath, options = {}) {
17679
17574
  return (await preflight2(projectRoot, options)).plan;
17680
17575
  }
17681
17576
  async function applyClassicRootMove(startPath, options = {}) {
17682
- const approvedPlanId = options.planId;
17683
- if (!approvedPlanId || !HASH_PATTERN.test(approvedPlanId)) {
17684
- throw new Error(
17685
- "Classic root move apply requires the exact dry-run plan ID: --apply --plan <id>"
17686
- );
17687
- }
17688
17577
  const projectRoot = await discoverClassicProject(startPath);
17689
17578
  const existing = await readJournal(projectRoot, options.testHooks);
17690
17579
  if (existing) {
@@ -17693,6 +17582,10 @@ async function applyClassicRootMove(startPath, options = {}) {
17693
17582
  );
17694
17583
  }
17695
17584
  const initial = await preflight2(projectRoot);
17585
+ const approvedPlanId = options.planId ?? initial.plan.planId;
17586
+ if (!HASH_PATTERN.test(approvedPlanId)) {
17587
+ throw new Error("Classic root move apply received an invalid internal plan ID");
17588
+ }
17696
17589
  const id = randomUUID8();
17697
17590
  await assertRootMovePreflightBoundaries(projectRoot, id);
17698
17591
  const lockedJournal = {
@@ -17795,78 +17688,163 @@ async function inspectClassicRootMove(projectRoot, options = {}) {
17795
17688
  }
17796
17689
 
17797
17690
  // domains/comet-classic/classic-root-command.ts
17798
- function usage3() {
17691
+ init_project_config_reader();
17692
+ function usage3(language = "en") {
17799
17693
  return {
17800
17694
  exitCode: 64,
17801
- stderr: "Usage: comet classic root show | comet classic root move docs --dry-run | comet classic root move docs --apply --plan <id>"
17695
+ stderr: language === "zh-CN" ? "用法:comet classic root show | comet classic root move docs --dry-run | comet classic root move docs --apply" : "Usage: comet classic root show | comet classic root move docs --dry-run | comet classic root move docs --apply"
17696
+ };
17697
+ }
17698
+ function rootMoveLanguage(config) {
17699
+ return config?.classic?.language === "en" ? "en" : "zh-CN";
17700
+ }
17701
+ function formatClassicRootMoveError(error, language) {
17702
+ const message = error instanceof Error ? error.message : String(error);
17703
+ if (language === "en") return message;
17704
+ if (message === "invalid Classic root move journal: manifest paths must be unique and sorted") {
17705
+ return "Classic 根目录迁移失败:迁移记录中的清单路径必须唯一且按顺序排列";
17706
+ }
17707
+ if (message.startsWith("invalid Classic root move journal:")) {
17708
+ return "Classic 根目录迁移失败:迁移记录格式或内容无效,请运行 comet doctor 检查恢复状态";
17709
+ }
17710
+ return "Classic 根目录迁移失败:迁移过程中发生错误,请运行 comet doctor 检查迁移状态";
17711
+ }
17712
+ function formatClassicRootMoveReport(plan, mode, language = "en") {
17713
+ const zh = language === "zh-CN";
17714
+ const list = (values) => values.length > 0 ? values.join("; ") : zh ? "无" : "none";
17715
+ const localizedReason = (value) => {
17716
+ if (!zh) return value;
17717
+ const pending = /^pending Classic root move: (.+) at (.+)$/u.exec(value);
17718
+ if (pending) return `存在待恢复的 Classic 根目录迁移:${pending[1]},阶段 ${pending[2]}`;
17719
+ return {
17720
+ "Classic docs target is not empty": "docs 目标目录非空",
17721
+ "the locked apply preflight was not approved for execution": "已锁定的迁移预检尚未获准执行",
17722
+ "Classic legacy root changed after migration preflight": "迁移预检后 legacy 根目录发生变化",
17723
+ "Classic docs target changed after migration preflight": "迁移预检后 docs 目标目录发生变化",
17724
+ "Classic staging changed after migration preflight": "迁移预检后暂存目录发生变化",
17725
+ "Classic quarantine contains unknown or changed content": "隔离目录包含未知或已变化的内容",
17726
+ "project config does not match the expected post-switch config hash": "项目配置与切换后的预期配置哈希不一致",
17727
+ "the configured migration trees are incomplete": "已切换配置对应的迁移目录不完整",
17728
+ "project config changed after migration preflight": "迁移预检后项目配置发生变化",
17729
+ "the migration trees are not recoverable": "迁移目录当前无法安全恢复"
17730
+ }[value] ?? "迁移状态存在无法识别的冲突,请运行 comet doctor 检查恢复状态";
17802
17731
  };
17732
+ const reasonLines = (label, values) => values.length === 0 ? [`${label}: ${zh ? "无" : "none"}`] : [`${label}:`, ...values.map((value) => `- ${localizedReason(value)}`)];
17733
+ const targetState = zh ? { missing: "缺失", empty: "空目录", "non-empty": "非空目录" }[plan.targetInitialState] : plan.targetInitialState;
17734
+ const historicalPointers = zh ? "handoff 哈希;运行状态;检查点;轨迹;已归档证据与产物指针" : plan.historicalPointersPreserved.join("; ");
17735
+ const applyPreconditions = zh ? "内部迁移身份仍与布局、源目录、清单、目标目录和配置一致;不存在待恢复的根迁移事务;目标仍然缺失或为已绑定的空目录;所有迁移路径仍受保护" : plan.applyPreconditions.join("; ");
17736
+ const recoveryStrategies = zh ? plan.allowedRecoveryStrategies.map((strategy) => strategy === "continue" ? "继续" : "回滚") : plan.allowedRecoveryStrategies;
17737
+ const lines = [
17738
+ mode === "dry-run" ? zh ? "Classic 根目录迁移现状" : "Classic root move status" : zh ? "Classic 根目录迁移完成" : "Classic root move complete",
17739
+ ...mode === "dry-run" ? [
17740
+ zh ? "说明:仅查看现状,未修改任何文件。" : "Note: Inspection only; no files were changed."
17741
+ ] : [],
17742
+ `${zh ? "源目录" : "source"}: ${plan.source}`,
17743
+ `${zh ? "目标目录" : "target"}: ${plan.target}`,
17744
+ `${zh ? "暂存目录" : "staging"}: ${plan.staging}`,
17745
+ `${zh ? "当前布局" : "artifact layout"}: ${plan.artifactLayout}`,
17746
+ `${zh ? "源目录身份" : "source identity"}: ${JSON.stringify(plan.sourceIdentity)}`,
17747
+ `${zh ? "目标初始身份" : "target initial identity"}: ${plan.targetInitialIdentity ? JSON.stringify(plan.targetInitialIdentity) : zh ? "缺失" : "missing"}`,
17748
+ `${zh ? "文件数" : "files"}: ${plan.fileCount}`,
17749
+ `${zh ? "目录数" : "directories"}: ${plan.directoryCount}`,
17750
+ `${zh ? "总字节数" : "bytes"}: ${plan.totalBytes}`,
17751
+ `${zh ? "清单哈希" : "manifest"}: ${plan.manifestHash}`,
17752
+ ...plan.fileSummary.map(
17753
+ (file) => `${zh ? "文件" : "file"}: ${file.path} ${file.size} ${file.hash}`
17754
+ ),
17755
+ `${zh ? "配置变更" : "config change"}: ${plan.configChange.from} -> ${plan.configChange.to}`,
17756
+ `${zh ? "配置路径" : "config path"}: ${plan.configPath}`,
17757
+ `${zh ? "配置哈希" : "config"}: ${plan.configHash}`,
17758
+ `${zh ? "原配置哈希" : "original config"}: ${plan.originalConfigHash}`,
17759
+ `${zh ? "预期配置哈希" : "expected config"}: ${plan.expectedConfigHash}`,
17760
+ `${zh ? "目标初始状态" : "target initial state"}: ${targetState}`,
17761
+ ...reasonLines(zh ? "冲突" : "conflicts", plan.conflicts),
17762
+ ...reasonLines(zh ? "阻塞项" : "blockers", plan.blockers),
17763
+ `${zh ? "待恢复事务" : "pending recovery"}: ${plan.pendingRecovery ? `${plan.pendingRecovery.id} ${zh ? "位于阶段" : "at"} ${plan.pendingRecovery.stage}` : zh ? "无" : "none"}`,
17764
+ `${zh ? "保留历史指针" : "historical pointers preserved"}: ${historicalPointers}`,
17765
+ `${zh ? "执行前提" : "apply preconditions"}: ${applyPreconditions}`,
17766
+ `${zh ? "允许的恢复策略" : "allowed recovery strategies"}: ${list(recoveryStrategies)}`,
17767
+ `${zh ? "可执行迁移" : "ready to apply"}: ${plan.readyToApply ? zh ? "是" : "yes" : zh ? "否" : "no"}`
17768
+ ];
17769
+ if (mode === "dry-run") {
17770
+ lines.push(
17771
+ plan.readyToApply ? zh ? "下一步:运行 comet classic root move docs --apply 执行迁移。" : "Next: run comet classic root move docs --apply to apply the migration." : zh ? "下一步:请先解决上述冲突或阻塞项。" : "Next: resolve the conflicts or blockers above before applying."
17772
+ );
17773
+ } else {
17774
+ lines.push(zh ? "结果:迁移已完成。" : "Result: Migration completed.");
17775
+ }
17776
+ return `${lines.join("\n")}
17777
+ `;
17803
17778
  }
17804
- function formatClassicRootMoveReport(plan, mode) {
17805
- const list = (values) => values.length > 0 ? values.join("; ") : "none";
17779
+ function formatAlreadyMigratedReport(layout, mode, language) {
17780
+ const root = classicProjectRelative(layout.projectRoot, layout.openSpecRoot);
17781
+ if (language === "zh-CN") {
17782
+ return [
17783
+ mode === "dry-run" ? "Classic 根目录迁移现状" : "Classic 根目录迁移完成",
17784
+ `当前布局: ${layout.artifactLayout}`,
17785
+ `Classic 根目录: ${root}`,
17786
+ mode === "dry-run" ? "说明:项目已经使用 docs/openspec,仅查看现状,未修改任何文件。" : "结果:项目已经使用 docs/openspec,无需重复迁移,未修改任何文件。"
17787
+ ].join("\n") + "\n";
17788
+ }
17806
17789
  return [
17807
- `Classic root move ${mode}`,
17808
- `source: ${plan.source}`,
17809
- `target: ${plan.target}`,
17810
- `staging: ${plan.staging}`,
17811
- `artifact layout: ${plan.artifactLayout}`,
17812
- `source identity: ${JSON.stringify(plan.sourceIdentity)}`,
17813
- `target initial identity: ${plan.targetInitialIdentity ? JSON.stringify(plan.targetInitialIdentity) : "missing"}`,
17814
- `files: ${plan.fileCount}`,
17815
- `directories: ${plan.directoryCount}`,
17816
- `bytes: ${plan.totalBytes}`,
17817
- `manifest: ${plan.manifestHash}`,
17818
- ...plan.fileSummary.map((file) => `file: ${file.path} ${file.size} ${file.hash}`),
17819
- `config change: ${plan.configChange.from} -> ${plan.configChange.to}`,
17820
- `config path: ${plan.configPath}`,
17821
- `config: ${plan.configHash}`,
17822
- `original config: ${plan.originalConfigHash}`,
17823
- `expected config: ${plan.expectedConfigHash}`,
17824
- `plan: ${plan.planId}`,
17825
- `target initial state: ${plan.targetInitialState}`,
17826
- `conflicts: ${list(plan.conflicts)}`,
17827
- `blockers: ${list(plan.blockers)}`,
17828
- `pending recovery: ${plan.pendingRecovery ? `${plan.pendingRecovery.id} at ${plan.pendingRecovery.stage}` : "none"}`,
17829
- `historical pointers preserved: ${plan.historicalPointersPreserved.join("; ")}`,
17830
- `apply preconditions: ${plan.applyPreconditions.join("; ")}`,
17831
- `allowed recovery strategies: ${list(plan.allowedRecoveryStrategies)}`,
17832
- `ready to apply: ${plan.readyToApply ? "yes" : "no"}`
17790
+ mode === "dry-run" ? "Classic root move status" : "Classic root move complete",
17791
+ `current layout: ${layout.artifactLayout}`,
17792
+ `Classic root: ${root}`,
17793
+ mode === "dry-run" ? "Note: The project already uses docs/openspec. Inspection only; no files were changed." : "Result: The project already uses docs/openspec. No migration was needed and no files were changed."
17833
17794
  ].join("\n") + "\n";
17834
17795
  }
17835
17796
  var classicRootCommand = async (args) => {
17836
- const [action, target, mode, planFlag, planId, ...extra] = args;
17797
+ const [action, target, mode, ...extra] = args;
17837
17798
  if (action === "show" && target === void 0) {
17838
- const projectRoot = await discoverClassicProject(process.cwd());
17839
- const layout = await assertClassicLayoutReadable(projectRoot);
17799
+ const projectRoot2 = await discoverClassicProject(process.cwd());
17800
+ const layout2 = await assertClassicLayoutReadable(projectRoot2);
17840
17801
  return {
17841
17802
  exitCode: 0,
17842
17803
  stdout: JSON.stringify({
17843
17804
  schema: "comet.classic-layout.v1",
17844
- artifactLayout: layout.artifactLayout,
17845
- openSpecRoot: classicProjectRelative(projectRoot, layout.openSpecRoot),
17846
- changesRoot: classicProjectRelative(projectRoot, layout.changesDir),
17847
- archiveRoot: classicProjectRelative(projectRoot, layout.archiveDir),
17848
- specsRoot: classicProjectRelative(projectRoot, layout.specsDir),
17849
- superpowersRoot: classicProjectRelative(projectRoot, layout.superpowersRoot)
17805
+ artifactLayout: layout2.artifactLayout,
17806
+ openSpecRoot: classicProjectRelative(projectRoot2, layout2.openSpecRoot),
17807
+ changesRoot: classicProjectRelative(projectRoot2, layout2.changesDir),
17808
+ archiveRoot: classicProjectRelative(projectRoot2, layout2.archiveDir),
17809
+ specsRoot: classicProjectRelative(projectRoot2, layout2.specsDir),
17810
+ superpowersRoot: classicProjectRelative(projectRoot2, layout2.superpowersRoot)
17850
17811
  }) + "\n"
17851
17812
  };
17852
17813
  }
17853
17814
  if (action !== "move" || target !== "docs") return usage3();
17854
- if (mode === "--dry-run") {
17855
- if (planFlag !== void 0) return usage3();
17856
- const plan2 = await planClassicRootMove(process.cwd());
17815
+ const projectRoot = await discoverClassicProject(process.cwd());
17816
+ const config = await readWorkflowProjectConfig(projectRoot);
17817
+ const language = rootMoveLanguage(config);
17818
+ if (mode !== "--dry-run" && mode !== "--apply" || extra.length > 0) {
17819
+ return usage3(language);
17820
+ }
17821
+ const layout = await assertClassicLayoutReadable(projectRoot);
17822
+ const reportMode = mode === "--dry-run" ? "dry-run" : "complete";
17823
+ if (layout.artifactLayout === "docs") {
17857
17824
  return {
17858
17825
  exitCode: 0,
17859
- stdout: formatClassicRootMoveReport(plan2, "dry-run")
17826
+ stdout: formatAlreadyMigratedReport(layout, reportMode, language)
17860
17827
  };
17861
17828
  }
17862
- if (mode !== "--apply" || planFlag !== "--plan" || !planId || !/^[a-f0-9]{64}$/u.test(planId) || extra.length > 0) {
17863
- return usage3();
17829
+ try {
17830
+ if (mode === "--dry-run") {
17831
+ const plan2 = await planClassicRootMove(projectRoot);
17832
+ return {
17833
+ exitCode: 0,
17834
+ stdout: formatClassicRootMoveReport(plan2, "dry-run", language)
17835
+ };
17836
+ }
17837
+ const plan = await applyClassicRootMove(projectRoot);
17838
+ return {
17839
+ exitCode: 0,
17840
+ stdout: formatClassicRootMoveReport(plan, "complete", language)
17841
+ };
17842
+ } catch (error) {
17843
+ return {
17844
+ exitCode: 70,
17845
+ stderr: formatClassicRootMoveError(error, language)
17846
+ };
17864
17847
  }
17865
- const plan = await applyClassicRootMove(process.cwd(), { planId });
17866
- return {
17867
- exitCode: 0,
17868
- stdout: formatClassicRootMoveReport(plan, "complete")
17869
- };
17870
17848
  };
17871
17849
 
17872
17850
  // domains/comet-classic/classic-state-command.ts
@@ -7,15 +7,6 @@ description: Use when the user explicitly invokes /comet-native, asks to start o
7
7
 
8
8
  Native stores requirements, complete target specifications, state, and evidence. You understand, implement, and verify; the Runtime owns state, boundaries, and recovery.
9
9
 
10
- ## Progressive loading
11
-
12
- Start with this file only. Read one reference when the corresponding task appears:
13
-
14
- - If Shape contains unresolved user-visible behavior, read the [clarification reference](reference/clarification.md).
15
- - If you need advanced options, receipts, partial scope, or an external-role handoff command, read the [command reference](reference/commands.md).
16
- - If you need to edit the brief, specifications, or verification report, read the [artifact reference](reference/artifacts.md).
17
- - If interruption, stale evidence, a repair stop, conflict, lock, or migration occurs, read the [recovery reference](reference/recovery.md).
18
-
19
10
  ## Core rules
20
11
 
21
12
  Read these values from `.comet/config.yaml`:
@@ -28,15 +19,12 @@ Config, selection, change state, and formal artifacts on disk take precedence ov
28
19
 
29
20
  The Native main workflow does not depend on any external Skill.
30
21
 
31
- Do not receive signing private keys or impersonate an external approval role. When an external action is missing, follow the Runtime continuation, wait, and hand off the required command.
32
-
33
22
  ## Start or resume
34
23
 
35
24
  1. Run `comet native status` to identify the current change and phase.
36
25
  2. Run `comet native show <change-name>` for the target. In Verify, Archive, or Build after a failure, also run `status <change-name> --details`.
37
26
  3. When more acceptance items are needed, follow `acceptancePage.nextCursor`. If findings are truncated, handle the returned findings and then read details again.
38
27
  4. After confirming the target, run `comet native select <change-name>`.
39
- 5. Read only the formal artifacts, implementation, tests, and project rules needed by the current phase.
40
28
 
41
29
  If multiple reasonable candidates remain, ask the user to select one. Create a change only after confirming that no matching active change exists:
42
30
 
@@ -47,11 +35,20 @@ comet native new <change-name> \
47
35
 
48
36
  Use only the Native artifact root selected by project configuration.
49
37
 
38
+ ## On-demand loading
39
+
40
+ After confirming the current change and phase, read one corresponding reference on demand:
41
+
42
+ - When entering Shape, you must first read and execute the [clarification reference](reference/clarification.md). Do not skip it because “the requirements look clear.” Do not modify project implementation or advance to Build until shared understanding is confirmed.
43
+ - If you need advanced options, receipts, or partial-scope commands, read the [command reference](reference/commands.md).
44
+ - If you need to edit the brief, specifications, or verification report, read the [artifact reference](reference/artifacts.md).
45
+ - If interruption, stale evidence, a repair stop, conflict, lock, or migration occurs, read the [recovery reference](reference/recovery.md).
46
+
50
47
  ## Shape
51
48
 
52
49
  First investigate facts available from the repository, tools, and runtime environment. Ask the user only when different choices would materially change user-visible results and the existing requirements do not resolve the choice reliably. You own implementation choices.
53
50
 
54
- When behavior is unresolved, read the clarification reference and follow `clarification_mode`. After every user answer, immediately update Decisions, the brief, and the complete target specifications in the same change. Keep unresolved items `[blocking]`; do not modify project implementation or advance while a blocker remains.
51
+ Follow the clarification reference according to `clarification_mode`. Even when the initial assessment finds no unresolved behavior, complete its information classification and silent-assumption check. After every user answer, immediately update Decisions, the brief, and the complete target specifications in the same change. Keep unresolved items `[blocking]`; do not modify project implementation or advance while a blocker remains.
55
52
 
56
53
  After all user decisions are resolved, check again for silent assumptions. Give the user a shared-understanding summary covering the goal, scope, key decisions, acceptance criteria, and non-goals. Only after explicit confirmation may you remove the final blocker and advance:
57
54
 
@@ -65,14 +62,15 @@ If the brief or specifications change confirmed behavior, obtain confirmation ag
65
62
 
66
63
  Implement the simplest reliable solution that satisfies the brief and complete target specifications. Work may proceed in batches. Long tasks may use a checkpoint for recovery context, but a checkpoint is not completion evidence.
67
64
 
68
- When requirements change, update the formal artifacts first. If a new user decision appears, return to the Shape clarification and confirmation boundary.
65
+ When requirements change, update the formal artifacts first. If a new user decision appears, stay in Build but repeat the Shape clarification and confirmation boundary: save a `[blocking]` item, pause implementation, and ask the user. After confirmation, update Decisions, the brief, and the complete target specifications, then remove the blocker. When leaving Build, run the command returned by the Runtime and pass `--confirmed`.
69
66
 
70
67
  After the candidate implementation is complete, review it against the complete specifications and every acceptance item for omissions, then advance with real project artifacts:
71
68
 
72
69
  ```text
73
70
  comet native next <change-name> \
74
71
  --summary <summary> \
75
- --artifact <project-path>
72
+ --artifact <project-path> \
73
+ [--confirmed]
76
74
  ```
77
75
 
78
76
  If no code changed or the Runtime cannot prove complete scope, read the command reference. Never describe unknown or incomplete scope as complete.
@@ -87,17 +85,17 @@ After entering Build, converge through this loop:
87
85
  4. Run real validation and submit the Verify result.
88
86
  5. `fail` returns to Build and repeats from step 1 without running Archive; only `pass` enters Archive.
89
87
 
90
- The loop ends only at `done`, `await-user`, `blocked`, or an explicit caller stop point. One Agent turn, one checkpoint, or the Agent saying “complete” is not a terminal state. The Agent finds and repairs gaps; the Runtime decides whether completion has been proven.
88
+ `blocked` pauses the normal Build → Verify loop and enters a recovery branch. After handling the findings, resume from step 1 according to the new continuation. End the current work only at `done`, `await-user`, or an explicit caller stop point. One Agent turn, one checkpoint, one `blocked` result, or the Agent saying “complete” is not a terminal state. The Agent finds and repairs gaps; the Runtime decides whether completion has been proven.
91
89
 
92
90
  ## Verify
93
91
 
94
92
  Run real validation based on the acceptance items, complete target specifications, and change risk. Record actual results in `verification.md` and the acceptance evidence. A check that did not run or failed cannot be reported as passed.
95
93
 
96
- Use acceptance IDs and receipts returned by the Runtime. Read the artifact and command references when you need to generate the evidence block, record an automated or manual receipt, request a waiver, or hand off independent review. The current Agent does not perform external signing.
94
+ Use acceptance IDs and receipts returned by the Runtime. Read the artifact and command references when you need to generate the evidence block or record an automated or manual receipt.
97
95
 
98
- Submit `pass` only when the Runtime accepts the complete, fresh acceptance matrix, required checks, and independent review. Reverify after relevant implementation, specification, report, or evidence changes.
96
+ Submit `pass` only when the Runtime accepts the complete, fresh acceptance matrix and required checks. Reverify after relevant implementation, specification, report, or evidence changes.
99
97
 
100
- `fail` returns to Build. Fix the failed or missing acceptance items and failed checks reported by the Runtime before verifying again; another `next` call is not itself a repair. When the Runtime reaches its repeated-gap stop condition or the `native.max_verify_failures` budget, stop and wait for a user decision.
98
+ `fail` returns to Build. Fix the failed or missing acceptance items and failed checks reported by the Runtime before verifying again; another `next` call is not itself a repair. For `repair-stagnation-stop`, follow the recovery reference to form a new hypothesis and use the Runtime-provided override. Wait for the user only when the continuation requires `repair-continuation-decision`.
101
99
 
102
100
  An intermediate Verify failure never runs Archive or triggers archive confirmation. Continue Build → Verify until pass, a Runtime block, or a required user decision.
103
101
 
@@ -121,8 +119,8 @@ Do not reuse an old preflight. If facts drift or a canonical conflict or unfinis
121
119
  Shape, Build, and Verify transitions return `next: auto | manual` together with `continuation.disposition: continue | await-user | blocked | done`, required inputs, and the next action. Archive does not advance through `next`; a successful archive returns `done`. After every transition, act on that Runtime continuation:
122
120
 
123
121
  - `continue`: reread the phase and currently required artifacts, then continue;
124
- - `await-user`: wait for input that genuinely belongs to the user or an external role;
125
- - `blocked`: handle the findings and read the recovery reference when needed;
122
+ - `await-user`: wait for a decision or missing input that genuinely requires the user;
123
+ - `blocked`: pause the normal loop, handle the findings, and read the recovery reference when needed; then resume according to the new continuation rather than ending the task because it was `blocked`;
126
124
  - `done`: the change is complete.
127
125
 
128
126
  `next: auto` means only that the current transition succeeded; later work has not run automatically. If the caller explicitly requests a stop after a transition, update the formal artifacts, run the one allowed transition, make no tool calls after the transition succeeds, then output the agreed marker and end the turn, even when the continuation is `continue`.
@@ -124,18 +124,11 @@ Place the command output unchanged under `# Acceptance evidence`. The basic inpu
124
124
  "status": "failed",
125
125
  "evidence_refs": [],
126
126
  "skipped_reason": "actual failure or incomplete reason"
127
- },
128
- {
129
- "acceptance_id": "acceptance-<sha256>",
130
- "status": "waived",
131
- "evidence_refs": [],
132
- "waiver_ref": "runtime/evidence/waivers/<sha256>.json"
133
127
  }
134
128
  ]
135
129
  ```
136
130
 
137
131
  - `passed` references a currently valid typed receipt.
138
132
  - `failed` states the actual failure or skipped reason.
139
- - `waived` references the waiver returned by an external signer.
140
133
 
141
134
  Do not hand-format the machine block, reuse an evidence ref from another change, or report failed, skipped, or blocked results as passed.
@@ -1,6 +1,6 @@
1
1
  # Native Clarification Reference
2
2
 
3
- Read this file only when Shape contains unresolved user-visible behavior.
3
+ You must read this file after entering Shape. Do not modify project implementation or advance to Build until problem classification, the silent-assumption check, and shared-understanding confirmation are complete.
4
4
 
5
5
  ## Whether to ask
6
6