@nimiplatform/nimi-coding 0.2.8 → 0.3.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.
Files changed (205) hide show
  1. package/CHANGELOG.md +8 -92
  2. package/CONTRIBUTING.md +5 -34
  3. package/README.md +47 -350
  4. package/README.zh-CN.md +33 -287
  5. package/cli/commands/start.mjs +48 -688
  6. package/cli/commands/validate-spec-audit.mjs +1 -5
  7. package/cli/constants.mjs +9 -417
  8. package/cli/help.mjs +28 -145
  9. package/cli/index.mjs +5 -33
  10. package/cli/lib/blueprint-audit.mjs +5 -12
  11. package/cli/lib/bootstrap.mjs +0 -9
  12. package/cli/lib/contracts.mjs +0 -163
  13. package/cli/lib/doctor.mjs +155 -10
  14. package/cli/lib/entrypoints.mjs +63 -167
  15. package/cli/lib/internal/contracts-loaders.mjs +0 -85
  16. package/cli/lib/internal/contracts-parse.mjs +84 -520
  17. package/cli/lib/internal/governance/ai/check-agents-freshness.mjs +13 -8
  18. package/cli/lib/internal/surface-taxonomy-validators.mjs +316 -66
  19. package/cli/lib/internal/validators-shared.mjs +0 -16
  20. package/cli/lib/internal/validators-spec-helpers.mjs +7 -140
  21. package/cli/lib/internal/validators-spec.mjs +103 -342
  22. package/cli/lib/shared.mjs +1 -42
  23. package/cli/lib/validators.mjs +0 -48
  24. package/cli/seeds/seed-policy.yaml +0 -3
  25. package/config/bootstrap.yaml +4 -4
  26. package/config/spec-generation-inputs.yaml +6 -12
  27. package/contracts/domain-admission.schema.yaml +3 -3
  28. package/contracts/migration-inventory.schema.yaml +12 -75
  29. package/contracts/negative-fixtures.yaml +19 -99
  30. package/contracts/placement-contract.schema.yaml +49 -78
  31. package/contracts/projection-edge.schema.yaml +37 -121
  32. package/contracts/shared-enums.yaml +4 -8
  33. package/contracts/spec-generation-inputs.schema.yaml +15 -112
  34. package/contracts/spec-layout.schema.yaml +32 -0
  35. package/contracts/surface-taxonomy.schema.yaml +43 -94
  36. package/contracts/table-family.schema.yaml +1 -1
  37. package/contracts/tracked-output-admission.schema.yaml +13 -66
  38. package/methodology/core.yaml +33 -25
  39. package/methodology/four-closure-policy.yaml +18 -26
  40. package/methodology/role-separation-policy.yaml +21 -27
  41. package/methodology/spec-reconstruction.yaml +17 -34
  42. package/package.json +2 -4
  43. package/spec/_meta/spec-tree-model.yaml +5 -101
  44. package/spec/product-scope.yaml +25 -57
  45. package/adapters/README.md +0 -25
  46. package/adapters/claude/README.md +0 -89
  47. package/adapters/claude/profile.yaml +0 -70
  48. package/adapters/codex/README.md +0 -53
  49. package/adapters/codex/profile.yaml +0 -78
  50. package/adapters/oh-my-codex/README.md +0 -184
  51. package/adapters/oh-my-codex/profile.yaml +0 -46
  52. package/cli/commands/admit-high-risk-decision.mjs +0 -108
  53. package/cli/commands/audit-sweep.mjs +0 -364
  54. package/cli/commands/closeout.mjs +0 -186
  55. package/cli/commands/decide-high-risk-execution.mjs +0 -124
  56. package/cli/commands/handoff.mjs +0 -123
  57. package/cli/commands/ingest-high-risk-execution.mjs +0 -95
  58. package/cli/commands/review-high-risk-execution.mjs +0 -95
  59. package/cli/commands/sweep-design.mjs +0 -295
  60. package/cli/commands/sweep.mjs +0 -22
  61. package/cli/commands/topic-formatters.mjs +0 -382
  62. package/cli/commands/topic-goal.mjs +0 -33
  63. package/cli/commands/topic-options-shared.mjs +0 -27
  64. package/cli/commands/topic-options-workflow.mjs +0 -767
  65. package/cli/commands/topic-options.mjs +0 -626
  66. package/cli/commands/topic-runner.mjs +0 -169
  67. package/cli/commands/topic.mjs +0 -795
  68. package/cli/commands/validate-acceptance.mjs +0 -5
  69. package/cli/commands/validate-execution-packet.mjs +0 -5
  70. package/cli/commands/validate-orchestration-state.mjs +0 -5
  71. package/cli/commands/validate-prompt.mjs +0 -5
  72. package/cli/commands/validate-worker-output.mjs +0 -5
  73. package/cli/lib/adapter-profiles.mjs +0 -403
  74. package/cli/lib/audit-execution.mjs +0 -52
  75. package/cli/lib/audit-sweep-runtime/admissions.mjs +0 -508
  76. package/cli/lib/audit-sweep-runtime/audit-validity.mjs +0 -356
  77. package/cli/lib/audit-sweep-runtime/chunks.mjs +0 -697
  78. package/cli/lib/audit-sweep-runtime/claude-auditor.mjs +0 -658
  79. package/cli/lib/audit-sweep-runtime/closeout.mjs +0 -144
  80. package/cli/lib/audit-sweep-runtime/codex-auditor-evidence.mjs +0 -654
  81. package/cli/lib/audit-sweep-runtime/codex-auditor.mjs +0 -527
  82. package/cli/lib/audit-sweep-runtime/common.mjs +0 -341
  83. package/cli/lib/audit-sweep-runtime/coverage-quality.mjs +0 -172
  84. package/cli/lib/audit-sweep-runtime/evidence-assignment.mjs +0 -155
  85. package/cli/lib/audit-sweep-runtime/format.mjs +0 -57
  86. package/cli/lib/audit-sweep-runtime/ingest.mjs +0 -486
  87. package/cli/lib/audit-sweep-runtime/inventory-spec-chunks.mjs +0 -425
  88. package/cli/lib/audit-sweep-runtime/inventory.mjs +0 -798
  89. package/cli/lib/audit-sweep-runtime/ledger.mjs +0 -315
  90. package/cli/lib/audit-sweep-runtime/p0p1-profile.mjs +0 -101
  91. package/cli/lib/audit-sweep-runtime/remediation.mjs +0 -349
  92. package/cli/lib/audit-sweep-runtime/rerun.mjs +0 -129
  93. package/cli/lib/audit-sweep-runtime/risk-budget.mjs +0 -300
  94. package/cli/lib/audit-sweep-runtime/status.mjs +0 -62
  95. package/cli/lib/audit-sweep-runtime/validators-ledger.mjs +0 -215
  96. package/cli/lib/audit-sweep-runtime/validators.mjs +0 -797
  97. package/cli/lib/audit-sweep.mjs +0 -19
  98. package/cli/lib/authority-convergence.mjs +0 -720
  99. package/cli/lib/closeout.mjs +0 -732
  100. package/cli/lib/codex-sdk-runner.mjs +0 -76
  101. package/cli/lib/external-execution.mjs +0 -101
  102. package/cli/lib/handoff.mjs +0 -812
  103. package/cli/lib/high-risk-admission.mjs +0 -512
  104. package/cli/lib/high-risk-decision.mjs +0 -353
  105. package/cli/lib/high-risk-ingest.mjs +0 -321
  106. package/cli/lib/high-risk-review.mjs +0 -267
  107. package/cli/lib/internal/contracts-parse-high-risk.mjs +0 -131
  108. package/cli/lib/internal/contracts-validators.mjs +0 -399
  109. package/cli/lib/internal/doctor-bootstrap-surface.mjs +0 -406
  110. package/cli/lib/internal/doctor-delegated-surface.mjs +0 -256
  111. package/cli/lib/internal/doctor-finalize.mjs +0 -383
  112. package/cli/lib/internal/doctor-format.mjs +0 -286
  113. package/cli/lib/internal/doctor-inspectors.mjs +0 -327
  114. package/cli/lib/internal/doctor-state.mjs +0 -205
  115. package/cli/lib/internal/validators-artifacts.mjs +0 -515
  116. package/cli/lib/sweep-design-runtime/common.mjs +0 -246
  117. package/cli/lib/sweep-design-runtime/engine.mjs +0 -733
  118. package/cli/lib/sweep-design-runtime/fix-topic.mjs +0 -414
  119. package/cli/lib/sweep-design-runtime/lifecycle.mjs +0 -54
  120. package/cli/lib/sweep-design-runtime/results.mjs +0 -324
  121. package/cli/lib/sweep-design.mjs +0 -8
  122. package/cli/lib/topic-artifacts.mjs +0 -186
  123. package/cli/lib/topic-authority-coverage.mjs +0 -73
  124. package/cli/lib/topic-closeout.mjs +0 -560
  125. package/cli/lib/topic-common.mjs +0 -404
  126. package/cli/lib/topic-decisions.mjs +0 -332
  127. package/cli/lib/topic-draft-packets.mjs +0 -167
  128. package/cli/lib/topic-execution.mjs +0 -533
  129. package/cli/lib/topic-goal.mjs +0 -440
  130. package/cli/lib/topic-ledger.mjs +0 -281
  131. package/cli/lib/topic-lifecycle-artifacts.mjs +0 -173
  132. package/cli/lib/topic-root-validation.mjs +0 -288
  133. package/cli/lib/topic-runner-commands.mjs +0 -174
  134. package/cli/lib/topic-runner-deferral.mjs +0 -532
  135. package/cli/lib/topic-runner-stale-gates.mjs +0 -114
  136. package/cli/lib/topic-runner-validation.mjs +0 -138
  137. package/cli/lib/topic-runner.mjs +0 -727
  138. package/cli/lib/topic-scaffold.mjs +0 -252
  139. package/cli/lib/topic-waves.mjs +0 -403
  140. package/cli/lib/topic.mjs +0 -81
  141. package/config/audit-execution-artifacts.yaml +0 -20
  142. package/config/external-execution-artifacts.yaml +0 -16
  143. package/config/host-adapter.yaml +0 -30
  144. package/config/host-profile.yaml +0 -29
  145. package/config/installer-evidence.yaml +0 -31
  146. package/config/skill-installer.yaml +0 -23
  147. package/config/skill-manifest.yaml +0 -48
  148. package/config/skills.yaml +0 -30
  149. package/contracts/acceptance.schema.yaml +0 -16
  150. package/contracts/admission-checklist.schema.yaml +0 -15
  151. package/contracts/audit-chunk.schema.yaml +0 -123
  152. package/contracts/audit-closeout.schema.yaml +0 -51
  153. package/contracts/audit-finding.schema.yaml +0 -61
  154. package/contracts/audit-ledger.schema.yaml +0 -138
  155. package/contracts/audit-plan.schema.yaml +0 -138
  156. package/contracts/audit-remediation-map.schema.yaml +0 -52
  157. package/contracts/audit-rerun.schema.yaml +0 -31
  158. package/contracts/audit-sweep-result.yaml +0 -53
  159. package/contracts/authority-convergence-audit.schema.yaml +0 -19
  160. package/contracts/closeout.schema.yaml +0 -25
  161. package/contracts/decision-review.schema.yaml +0 -16
  162. package/contracts/doc-spec-audit-result.yaml +0 -19
  163. package/contracts/execution-packet.schema.yaml +0 -49
  164. package/contracts/external-host-compatibility.yaml +0 -22
  165. package/contracts/forbidden-shortcuts.catalog.yaml +0 -23
  166. package/contracts/high-risk-admission.schema.yaml +0 -23
  167. package/contracts/high-risk-execution-result.yaml +0 -20
  168. package/contracts/orchestration-state.schema.yaml +0 -41
  169. package/contracts/overflow-continuation.schema.yaml +0 -12
  170. package/contracts/packet.schema.yaml +0 -30
  171. package/contracts/pending-note.schema.yaml +0 -17
  172. package/contracts/prompt.schema.yaml +0 -12
  173. package/contracts/remediation.schema.yaml +0 -16
  174. package/contracts/result.schema.yaml +0 -24
  175. package/contracts/spec-reconstruction-result.yaml +0 -41
  176. package/contracts/sweep-design-result.yaml +0 -349
  177. package/contracts/topic-goal.schema.yaml +0 -87
  178. package/contracts/topic-run-ledger.schema.yaml +0 -72
  179. package/contracts/topic-step-decision.schema.yaml +0 -45
  180. package/contracts/topic.schema.yaml +0 -65
  181. package/contracts/true-close.schema.yaml +0 -15
  182. package/contracts/wave.schema.yaml +0 -29
  183. package/contracts/worker-output.schema.yaml +0 -15
  184. package/contracts/workflow-consumer.schema.yaml +0 -110
  185. package/methodology/audit-sweep-p0p1-recall.yaml +0 -45
  186. package/methodology/authority-convergence-policy.yaml +0 -42
  187. package/methodology/overflow-continuation-policy.yaml +0 -14
  188. package/methodology/skill-exchange-projection.yaml +0 -114
  189. package/methodology/skill-handoff.yaml +0 -34
  190. package/methodology/skill-installer-result.yaml +0 -27
  191. package/methodology/skill-installer-summary-projection.yaml +0 -181
  192. package/methodology/skill-runtime.yaml +0 -23
  193. package/methodology/spec-target-truth-profile.yaml +0 -46
  194. package/methodology/topic-lifecycle-report.yaml +0 -144
  195. package/methodology/topic-lifecycle.yaml +0 -37
  196. package/methodology/topic-naming-ontology.yaml +0 -21
  197. package/methodology/topic-ontology.yaml +0 -38
  198. package/methodology/topic-validation-policy.yaml +0 -9
  199. package/methodology/wave-dag-policy.yaml +0 -14
  200. package/spec/_meta/command-gating-matrix.yaml +0 -143
  201. package/spec/_meta/generate-drift-migration-checklist.yaml +0 -137
  202. package/spec/_meta/governance-routing-cutover-checklist.yaml +0 -35
  203. package/spec/_meta/phase2-impacted-surface-matrix.yaml +0 -44
  204. package/spec/_meta/spec-authority-cutover-readiness.yaml +0 -102
  205. package/spec/bootstrap-state.yaml +0 -99
@@ -1,144 +0,0 @@
1
- import {
2
- appendRunEvent,
3
- auditCloseoutRef,
4
- ensureIsoTimestamp,
5
- inputError,
6
- loadFindings,
7
- loadLatestLedger,
8
- loadYamlRef,
9
- remediationMapRef,
10
- safeSweepId,
11
- writeYamlRef,
12
- } from "./common.mjs";
13
- import {
14
- COVERAGE_SCOPE_LABEL,
15
- FILE_INVENTORY_SCOPE_LABEL,
16
- deriveCoverageCloseoutPosture,
17
- deriveCoverageStatus,
18
- withFullScopeWarning,
19
- } from "./coverage-quality.mjs";
20
- import { validateAuditSweepArtifacts } from "./validators.mjs";
21
-
22
- export async function buildAuditSweepCloseoutImport(projectRoot, options) {
23
- const sweepId = safeSweepId(options.sweepId);
24
- if (!sweepId) {
25
- return inputError("nimicoding sweep audit refused: --sweep-id is required.\n");
26
- }
27
- const timestampError = ensureIsoTimestamp(options.verifiedAt);
28
- if (timestampError) {
29
- return timestampError;
30
- }
31
-
32
- const ledgerResult = await loadLatestLedger(projectRoot, sweepId);
33
- if (!ledgerResult.ok) {
34
- return inputError(ledgerResult.error);
35
- }
36
- const ledger = ledgerResult.ledger;
37
- const preflightValidation = await validateAuditSweepArtifacts(projectRoot, { sweepId, scope: "remediation" });
38
- if (!preflightValidation.ok) {
39
- const failed = preflightValidation.checks.find((entry) => !entry.ok);
40
- return inputError(`nimicoding sweep audit refused: sweep audit closeout preflight failed: ${failed?.reason ?? "artifact validation failed"}.\n`);
41
- }
42
- if (ledger.status === "blocked") {
43
- return inputError("nimicoding sweep audit refused: blocked ledger cannot produce completed closeout summary.\n");
44
- }
45
- if (ledger.status === "blocked_evidence_incomplete" || ledger.status === "partial_authority_only") {
46
- return inputError("nimicoding sweep audit refused: incomplete spec authority/evidence coverage cannot produce completed closeout summary.\n");
47
- }
48
- if (ledger.coverage.active_chunks > 0) {
49
- return inputError("nimicoding sweep audit refused: closeout summary requires no active chunks.\n");
50
- }
51
-
52
- const mapRef = remediationMapRef(sweepId, ledger.snapshot_id);
53
- const remediationMap = await loadYamlRef(projectRoot, mapRef);
54
- const { store } = await loadFindings(projectRoot, sweepId);
55
- const openFindingIds = store.findings.filter((finding) => finding.disposition === "open").map((finding) => finding.id);
56
- const mappedFindingIds = new Set(Array.isArray(remediationMap?.waves)
57
- ? remediationMap.waves.flatMap((wave) => Array.isArray(wave.finding_ids) ? wave.finding_ids : [])
58
- : []);
59
- const unmappedOpenFindings = openFindingIds.filter((findingId) => !mappedFindingIds.has(findingId));
60
- if (openFindingIds.length > 0 && (!remediationMap || unmappedOpenFindings.length > 0)) {
61
- return inputError("nimicoding sweep audit refused: open findings require remediation map coverage before closeout summary.\n");
62
- }
63
- const closedWithoutResolutionEvidence = store.findings
64
- .filter((finding) => finding.disposition !== "open")
65
- .filter((finding) => !finding.resolution?.evidence_ref || !finding.resolution?.rerun);
66
- if (closedWithoutResolutionEvidence.length > 0) {
67
- return inputError("nimicoding sweep audit refused: closed findings require resolution and rerun evidence before closeout summary.\n");
68
- }
69
-
70
- const coverageStatus = deriveCoverageStatus(ledger.status);
71
- const coverageQuality = coverageStatus === "full"
72
- ? withFullScopeWarning(ledger.coverage_quality)
73
- : ledger.coverage_quality ?? null;
74
- const closeoutPosture = deriveCoverageCloseoutPosture({
75
- coverageStatus,
76
- openFindingCount: openFindingIds.length,
77
- });
78
- const auditValidity = ledger.audit_validity ?? null;
79
- const finalCloseoutPosture = auditValidity?.posture === "invalid"
80
- ? "audit_invalid_no_finding_evidence"
81
- : closeoutPosture;
82
- const auditCloseoutRefValue = auditCloseoutRef(sweepId, ledger.snapshot_id);
83
- const auditCloseout = {
84
- version: 1,
85
- kind: "audit-closeout",
86
- sweep_id: sweepId,
87
- ledger_ref: ledgerResult.ledgerRef,
88
- remediation_map_ref: mapRef,
89
- audit_closeout_ref: auditCloseoutRefValue,
90
- coverage_status: coverageStatus,
91
- coverage_scope: ledger.coverage.authority_coverage ? COVERAGE_SCOPE_LABEL : FILE_INVENTORY_SCOPE_LABEL,
92
- ...(coverageQuality ? { coverage_quality: coverageQuality } : {}),
93
- ...(auditValidity ? { audit_validity: auditValidity } : {}),
94
- finding_posture: ledger.finding_posture,
95
- closeout_posture: finalCloseoutPosture,
96
- verified_at: options.verifiedAt,
97
- };
98
- await writeYamlRef(projectRoot, auditCloseoutRefValue, auditCloseout);
99
- const summary = {
100
- plan_ref: ledger.plan_ref,
101
- chunk_refs: ledger.chunk_refs,
102
- ledger_ref: ledgerResult.ledgerRef,
103
- report_ref: ledger.report_ref,
104
- remediation_map_ref: mapRef,
105
- audit_closeout_ref: auditCloseoutRefValue,
106
- evidence_refs: ledger.evidence_refs,
107
- finding_count: ledger.finding_count,
108
- unresolved_finding_count: ledger.unresolved_finding_count,
109
- status: ledger.status,
110
- coverage_scope: ledger.coverage.authority_coverage ? COVERAGE_SCOPE_LABEL : FILE_INVENTORY_SCOPE_LABEL,
111
- ...(coverageQuality ? { coverage_quality: coverageQuality } : {}),
112
- ...(auditValidity ? { audit_validity: auditValidity } : {}),
113
- summary: ledger.coverage.authority_coverage
114
- ? `Audit sweep ${sweepId} has authority coverage ${ledger.coverage.authority_coverage.audited_files}/${ledger.coverage.authority_coverage.total_files}, evidence coverage ${ledger.coverage.evidence_coverage.audited_files}/${ledger.coverage.evidence_coverage.total_files}, ${ledger.finding_count} findings, and ${ledger.unresolved_finding_count} open findings.`
115
- : `Audit sweep ${sweepId} has ${ledger.coverage.audited_files}/${ledger.coverage.included_files} included files audited, ${ledger.finding_count} findings, and ${ledger.unresolved_finding_count} open findings.`,
116
- verified_at: options.verifiedAt,
117
- };
118
- const runRef = await appendRunEvent(projectRoot, sweepId, {
119
- event_type: "closeout_summary_projected",
120
- ledger_ref: ledgerResult.ledgerRef,
121
- remediation_map_ref: mapRef,
122
- audit_closeout_ref: auditCloseoutRefValue,
123
- closeout_posture: finalCloseoutPosture,
124
- });
125
- const closeoutValidation = await validateAuditSweepArtifacts(projectRoot, { sweepId, scope: "closeout" });
126
- if (!closeoutValidation.ok) {
127
- const failed = closeoutValidation.checks.find((entry) => !entry.ok);
128
- return inputError(`nimicoding sweep audit refused: sweep audit closeout validation failed: ${failed?.reason ?? "artifact validation failed"}.\n`);
129
- }
130
-
131
- return {
132
- ok: true,
133
- exitCode: 0,
134
- projectRoot,
135
- skill: { id: "audit_sweep" },
136
- outcome: "completed",
137
- verifiedAt: options.verifiedAt,
138
- localOnly: true,
139
- runLedgerRef: runRef,
140
- auditCloseoutRef: auditCloseoutRefValue,
141
- auditCloseout,
142
- summary,
143
- };
144
- }