@nimiplatform/nimi-coding 0.2.8 → 0.3.1
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/CHANGELOG.md +10 -90
- package/CONTRIBUTING.md +5 -34
- package/README.md +47 -350
- package/README.zh-CN.md +33 -287
- package/cli/commands/start.mjs +48 -688
- package/cli/commands/validate-spec-audit.mjs +1 -5
- package/cli/commands/validate-spec-governance.mjs +20 -0
- package/cli/constants.mjs +9 -417
- package/cli/help.mjs +28 -145
- package/cli/index.mjs +5 -33
- package/cli/lib/blueprint-audit.mjs +5 -12
- package/cli/lib/bootstrap.mjs +0 -9
- package/cli/lib/contracts.mjs +0 -163
- package/cli/lib/doctor.mjs +155 -10
- package/cli/lib/entrypoints.mjs +63 -167
- package/cli/lib/internal/contracts-loaders.mjs +0 -85
- package/cli/lib/internal/contracts-parse.mjs +84 -520
- package/cli/lib/internal/governance/ai/check-agents-freshness.mjs +13 -8
- package/cli/lib/internal/surface-taxonomy-validators.mjs +316 -66
- package/cli/lib/internal/validators-shared.mjs +0 -16
- package/cli/lib/internal/validators-spec-helpers.mjs +7 -140
- package/cli/lib/internal/validators-spec.mjs +103 -342
- package/cli/lib/shared.mjs +1 -42
- package/cli/lib/validators.mjs +0 -48
- package/cli/seeds/seed-policy.yaml +0 -3
- package/config/bootstrap.yaml +4 -4
- package/config/spec-generation-inputs.yaml +6 -12
- package/contracts/domain-admission.schema.yaml +3 -3
- package/contracts/migration-inventory.schema.yaml +12 -75
- package/contracts/negative-fixtures.yaml +19 -99
- package/contracts/placement-contract.schema.yaml +49 -78
- package/contracts/projection-edge.schema.yaml +37 -121
- package/contracts/shared-enums.yaml +4 -8
- package/contracts/spec-generation-inputs.schema.yaml +15 -112
- package/contracts/spec-layout.schema.yaml +32 -0
- package/contracts/surface-taxonomy.schema.yaml +43 -94
- package/contracts/table-family.schema.yaml +1 -1
- package/contracts/tracked-output-admission.schema.yaml +13 -66
- package/methodology/core.yaml +33 -25
- package/methodology/four-closure-policy.yaml +18 -26
- package/methodology/role-separation-policy.yaml +21 -27
- package/methodology/spec-reconstruction.yaml +17 -34
- package/package.json +2 -4
- package/spec/_meta/spec-tree-model.yaml +5 -101
- package/spec/product-scope.yaml +25 -57
- package/adapters/README.md +0 -25
- package/adapters/claude/README.md +0 -89
- package/adapters/claude/profile.yaml +0 -70
- package/adapters/codex/README.md +0 -53
- package/adapters/codex/profile.yaml +0 -78
- package/adapters/oh-my-codex/README.md +0 -184
- package/adapters/oh-my-codex/profile.yaml +0 -46
- package/cli/commands/admit-high-risk-decision.mjs +0 -108
- package/cli/commands/audit-sweep.mjs +0 -364
- package/cli/commands/closeout.mjs +0 -186
- package/cli/commands/decide-high-risk-execution.mjs +0 -124
- package/cli/commands/handoff.mjs +0 -123
- package/cli/commands/ingest-high-risk-execution.mjs +0 -95
- package/cli/commands/review-high-risk-execution.mjs +0 -95
- package/cli/commands/sweep-design.mjs +0 -295
- package/cli/commands/sweep.mjs +0 -22
- package/cli/commands/topic-formatters.mjs +0 -382
- package/cli/commands/topic-goal.mjs +0 -33
- package/cli/commands/topic-options-shared.mjs +0 -27
- package/cli/commands/topic-options-workflow.mjs +0 -767
- package/cli/commands/topic-options.mjs +0 -626
- package/cli/commands/topic-runner.mjs +0 -169
- package/cli/commands/topic.mjs +0 -795
- package/cli/commands/validate-acceptance.mjs +0 -5
- package/cli/commands/validate-execution-packet.mjs +0 -5
- package/cli/commands/validate-orchestration-state.mjs +0 -5
- package/cli/commands/validate-prompt.mjs +0 -5
- package/cli/commands/validate-worker-output.mjs +0 -5
- package/cli/lib/adapter-profiles.mjs +0 -403
- package/cli/lib/audit-execution.mjs +0 -52
- package/cli/lib/audit-sweep-runtime/admissions.mjs +0 -508
- package/cli/lib/audit-sweep-runtime/audit-validity.mjs +0 -356
- package/cli/lib/audit-sweep-runtime/chunks.mjs +0 -697
- package/cli/lib/audit-sweep-runtime/claude-auditor.mjs +0 -658
- package/cli/lib/audit-sweep-runtime/closeout.mjs +0 -144
- package/cli/lib/audit-sweep-runtime/codex-auditor-evidence.mjs +0 -654
- package/cli/lib/audit-sweep-runtime/codex-auditor.mjs +0 -527
- package/cli/lib/audit-sweep-runtime/common.mjs +0 -341
- package/cli/lib/audit-sweep-runtime/coverage-quality.mjs +0 -172
- package/cli/lib/audit-sweep-runtime/evidence-assignment.mjs +0 -155
- package/cli/lib/audit-sweep-runtime/format.mjs +0 -57
- package/cli/lib/audit-sweep-runtime/ingest.mjs +0 -486
- package/cli/lib/audit-sweep-runtime/inventory-spec-chunks.mjs +0 -425
- package/cli/lib/audit-sweep-runtime/inventory.mjs +0 -798
- package/cli/lib/audit-sweep-runtime/ledger.mjs +0 -315
- package/cli/lib/audit-sweep-runtime/p0p1-profile.mjs +0 -101
- package/cli/lib/audit-sweep-runtime/remediation.mjs +0 -349
- package/cli/lib/audit-sweep-runtime/rerun.mjs +0 -129
- package/cli/lib/audit-sweep-runtime/risk-budget.mjs +0 -300
- package/cli/lib/audit-sweep-runtime/status.mjs +0 -62
- package/cli/lib/audit-sweep-runtime/validators-ledger.mjs +0 -215
- package/cli/lib/audit-sweep-runtime/validators.mjs +0 -797
- package/cli/lib/audit-sweep.mjs +0 -19
- package/cli/lib/authority-convergence.mjs +0 -720
- package/cli/lib/closeout.mjs +0 -732
- package/cli/lib/codex-sdk-runner.mjs +0 -76
- package/cli/lib/external-execution.mjs +0 -101
- package/cli/lib/handoff.mjs +0 -812
- package/cli/lib/high-risk-admission.mjs +0 -512
- package/cli/lib/high-risk-decision.mjs +0 -353
- package/cli/lib/high-risk-ingest.mjs +0 -321
- package/cli/lib/high-risk-review.mjs +0 -267
- package/cli/lib/internal/contracts-parse-high-risk.mjs +0 -131
- package/cli/lib/internal/contracts-validators.mjs +0 -399
- package/cli/lib/internal/doctor-bootstrap-surface.mjs +0 -406
- package/cli/lib/internal/doctor-delegated-surface.mjs +0 -256
- package/cli/lib/internal/doctor-finalize.mjs +0 -383
- package/cli/lib/internal/doctor-format.mjs +0 -286
- package/cli/lib/internal/doctor-inspectors.mjs +0 -327
- package/cli/lib/internal/doctor-state.mjs +0 -205
- package/cli/lib/internal/validators-artifacts.mjs +0 -515
- package/cli/lib/sweep-design-runtime/common.mjs +0 -246
- package/cli/lib/sweep-design-runtime/engine.mjs +0 -733
- package/cli/lib/sweep-design-runtime/fix-topic.mjs +0 -414
- package/cli/lib/sweep-design-runtime/lifecycle.mjs +0 -54
- package/cli/lib/sweep-design-runtime/results.mjs +0 -324
- package/cli/lib/sweep-design.mjs +0 -8
- package/cli/lib/topic-artifacts.mjs +0 -186
- package/cli/lib/topic-authority-coverage.mjs +0 -73
- package/cli/lib/topic-closeout.mjs +0 -560
- package/cli/lib/topic-common.mjs +0 -404
- package/cli/lib/topic-decisions.mjs +0 -332
- package/cli/lib/topic-draft-packets.mjs +0 -167
- package/cli/lib/topic-execution.mjs +0 -533
- package/cli/lib/topic-goal.mjs +0 -440
- package/cli/lib/topic-ledger.mjs +0 -281
- package/cli/lib/topic-lifecycle-artifacts.mjs +0 -173
- package/cli/lib/topic-root-validation.mjs +0 -288
- package/cli/lib/topic-runner-commands.mjs +0 -174
- package/cli/lib/topic-runner-deferral.mjs +0 -532
- package/cli/lib/topic-runner-stale-gates.mjs +0 -114
- package/cli/lib/topic-runner-validation.mjs +0 -138
- package/cli/lib/topic-runner.mjs +0 -727
- package/cli/lib/topic-scaffold.mjs +0 -252
- package/cli/lib/topic-waves.mjs +0 -403
- package/cli/lib/topic.mjs +0 -81
- package/config/audit-execution-artifacts.yaml +0 -20
- package/config/external-execution-artifacts.yaml +0 -16
- package/config/host-adapter.yaml +0 -30
- package/config/host-profile.yaml +0 -29
- package/config/installer-evidence.yaml +0 -31
- package/config/skill-installer.yaml +0 -23
- package/config/skill-manifest.yaml +0 -48
- package/config/skills.yaml +0 -30
- package/contracts/acceptance.schema.yaml +0 -16
- package/contracts/admission-checklist.schema.yaml +0 -15
- package/contracts/audit-chunk.schema.yaml +0 -123
- package/contracts/audit-closeout.schema.yaml +0 -51
- package/contracts/audit-finding.schema.yaml +0 -61
- package/contracts/audit-ledger.schema.yaml +0 -138
- package/contracts/audit-plan.schema.yaml +0 -138
- package/contracts/audit-remediation-map.schema.yaml +0 -52
- package/contracts/audit-rerun.schema.yaml +0 -31
- package/contracts/audit-sweep-result.yaml +0 -53
- package/contracts/authority-convergence-audit.schema.yaml +0 -19
- package/contracts/closeout.schema.yaml +0 -25
- package/contracts/decision-review.schema.yaml +0 -16
- package/contracts/doc-spec-audit-result.yaml +0 -19
- package/contracts/execution-packet.schema.yaml +0 -49
- package/contracts/external-host-compatibility.yaml +0 -22
- package/contracts/forbidden-shortcuts.catalog.yaml +0 -23
- package/contracts/high-risk-admission.schema.yaml +0 -23
- package/contracts/high-risk-execution-result.yaml +0 -20
- package/contracts/orchestration-state.schema.yaml +0 -41
- package/contracts/overflow-continuation.schema.yaml +0 -12
- package/contracts/packet.schema.yaml +0 -30
- package/contracts/pending-note.schema.yaml +0 -17
- package/contracts/prompt.schema.yaml +0 -12
- package/contracts/remediation.schema.yaml +0 -16
- package/contracts/result.schema.yaml +0 -24
- package/contracts/spec-reconstruction-result.yaml +0 -41
- package/contracts/sweep-design-result.yaml +0 -349
- package/contracts/topic-goal.schema.yaml +0 -87
- package/contracts/topic-run-ledger.schema.yaml +0 -72
- package/contracts/topic-step-decision.schema.yaml +0 -45
- package/contracts/topic.schema.yaml +0 -65
- package/contracts/true-close.schema.yaml +0 -15
- package/contracts/wave.schema.yaml +0 -29
- package/contracts/worker-output.schema.yaml +0 -15
- package/contracts/workflow-consumer.schema.yaml +0 -110
- package/methodology/audit-sweep-p0p1-recall.yaml +0 -45
- package/methodology/authority-convergence-policy.yaml +0 -42
- package/methodology/overflow-continuation-policy.yaml +0 -14
- package/methodology/skill-exchange-projection.yaml +0 -114
- package/methodology/skill-handoff.yaml +0 -34
- package/methodology/skill-installer-result.yaml +0 -27
- package/methodology/skill-installer-summary-projection.yaml +0 -181
- package/methodology/skill-runtime.yaml +0 -23
- package/methodology/spec-target-truth-profile.yaml +0 -46
- package/methodology/topic-lifecycle-report.yaml +0 -144
- package/methodology/topic-lifecycle.yaml +0 -37
- package/methodology/topic-naming-ontology.yaml +0 -21
- package/methodology/topic-ontology.yaml +0 -38
- package/methodology/topic-validation-policy.yaml +0 -9
- package/methodology/wave-dag-policy.yaml +0 -14
- package/spec/_meta/command-gating-matrix.yaml +0 -143
- package/spec/_meta/generate-drift-migration-checklist.yaml +0 -137
- package/spec/_meta/governance-routing-cutover-checklist.yaml +0 -35
- package/spec/_meta/phase2-impacted-surface-matrix.yaml +0 -44
- package/spec/_meta/spec-authority-cutover-readiness.yaml +0 -102
- package/spec/bootstrap-state.yaml +0 -99
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
|
|
5
|
-
import YAML from "yaml";
|
|
6
|
-
|
|
7
|
-
import { pathExists } from "../fs-helpers.mjs";
|
|
8
|
-
import { isPlainObject } from "../value-helpers.mjs";
|
|
9
|
-
|
|
10
|
-
export const DESIGN_ROOT = ".nimi/local/sweep-design";
|
|
11
|
-
export const DESIGN_STATES = new Set([
|
|
12
|
-
"raw",
|
|
13
|
-
"confirmed",
|
|
14
|
-
"duplicate",
|
|
15
|
-
"superseded",
|
|
16
|
-
"false_positive",
|
|
17
|
-
"needs_more_audit",
|
|
18
|
-
"needs_user_decision",
|
|
19
|
-
"needs_authority_alignment",
|
|
20
|
-
"needs_design",
|
|
21
|
-
"ready_for_implementation_wave",
|
|
22
|
-
"blocked",
|
|
23
|
-
]);
|
|
24
|
-
export const TERMINAL_STATES = new Set(["duplicate", "superseded", "false_positive"]);
|
|
25
|
-
export const TRANSIENT_STATES = new Set(["raw", "confirmed", "needs_design"]);
|
|
26
|
-
export const FINAL_OUTCOME_STATES = new Set([
|
|
27
|
-
"duplicate",
|
|
28
|
-
"superseded",
|
|
29
|
-
"false_positive",
|
|
30
|
-
"needs_more_audit",
|
|
31
|
-
"needs_user_decision",
|
|
32
|
-
"needs_authority_alignment",
|
|
33
|
-
"ready_for_implementation_wave",
|
|
34
|
-
"blocked",
|
|
35
|
-
]);
|
|
36
|
-
export const AUDITOR_FAMILIES = new Set([
|
|
37
|
-
"anthropic_claude",
|
|
38
|
-
"openai_gpt",
|
|
39
|
-
"openai_codex",
|
|
40
|
-
"google_gemini",
|
|
41
|
-
"xai_grok",
|
|
42
|
-
"meta_llama",
|
|
43
|
-
"mistral",
|
|
44
|
-
"other",
|
|
45
|
-
]);
|
|
46
|
-
export const AUDITOR_MODES = new Set(["focused", "all", "degraded"]);
|
|
47
|
-
export const AUDITOR_RESULT_ORIGINS = new Set(["llm_session", "external_llm_session", "synthetic_trial"]);
|
|
48
|
-
export const LLM_AUDITOR_RESULT_ORIGINS = new Set(["llm_session", "external_llm_session"]);
|
|
49
|
-
export const PRIOR_DESIGN_STATE_MARKERS = new Set([
|
|
50
|
-
"empty",
|
|
51
|
-
"present",
|
|
52
|
-
"partial",
|
|
53
|
-
"superseded_by_later_audit",
|
|
54
|
-
"evidence_gap",
|
|
55
|
-
]);
|
|
56
|
-
export const REVISION_TYPES = new Set([
|
|
57
|
-
"finding_state_revision",
|
|
58
|
-
"duplicate_judgement",
|
|
59
|
-
"superseded_judgement",
|
|
60
|
-
"cluster_create",
|
|
61
|
-
"cluster_merge",
|
|
62
|
-
"cluster_split",
|
|
63
|
-
"cluster_retire",
|
|
64
|
-
"cluster_reopen",
|
|
65
|
-
"finding_move",
|
|
66
|
-
"wave_create",
|
|
67
|
-
"wave_merge",
|
|
68
|
-
"wave_split",
|
|
69
|
-
"wave_retract",
|
|
70
|
-
"wave_demote",
|
|
71
|
-
"wave_block",
|
|
72
|
-
"wave_implementation_ready",
|
|
73
|
-
"wave_dependency_rewrite",
|
|
74
|
-
"wave_validation_or_closeout_strengthening",
|
|
75
|
-
"decision_packet_create",
|
|
76
|
-
"extra_audit_request_create",
|
|
77
|
-
"extra_audit_request_close",
|
|
78
|
-
"human_decision_request_create",
|
|
79
|
-
"human_decision_request_resolve",
|
|
80
|
-
"final_state_projection_update",
|
|
81
|
-
"user_decision_queue_rewrite",
|
|
82
|
-
]);
|
|
83
|
-
|
|
84
|
-
export function toPosix(filePath) {
|
|
85
|
-
return filePath.split(path.sep).join(path.posix.sep);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function relPath(projectRoot, absolutePath) {
|
|
89
|
-
return toPosix(path.relative(projectRoot, absolutePath));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function safeDesignId(value) {
|
|
93
|
-
if (typeof value !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9._-]{2,140}$/.test(value)) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
return value;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export function deriveRunId(sweepId) {
|
|
100
|
-
return `sweep-design-${String(sweepId).replace(/[^a-zA-Z0-9._-]+/g, "-")}`;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export function designRef(runId, ...parts) {
|
|
104
|
-
return path.posix.join(DESIGN_ROOT, runId, ...parts);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export function artifactPath(projectRoot, ref) {
|
|
108
|
-
return path.join(projectRoot, ...ref.split("/"));
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export function inputError(error) {
|
|
112
|
-
return { ok: false, inputError: true, exitCode: 2, error };
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export async function loadYamlPath(filePath) {
|
|
116
|
-
try {
|
|
117
|
-
const text = await readFile(filePath, "utf8");
|
|
118
|
-
return YAML.parse(text);
|
|
119
|
-
} catch {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export function sha256Text(text) {
|
|
125
|
-
return createHash("sha256").update(text).digest("hex");
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export function stableStringify(value) {
|
|
129
|
-
if (Array.isArray(value)) {
|
|
130
|
-
return `[${value.map((item) => stableStringify(item)).join(",")}]`;
|
|
131
|
-
}
|
|
132
|
-
if (value && typeof value === "object") {
|
|
133
|
-
return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${stableStringify(value[key])}`).join(",")}}`;
|
|
134
|
-
}
|
|
135
|
-
return JSON.stringify(value);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export function sha256Object(value) {
|
|
139
|
-
return sha256Text(stableStringify(value));
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export async function loadYamlRef(projectRoot, ref) {
|
|
143
|
-
return loadYamlPath(artifactPath(projectRoot, ref));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export async function writeYamlRef(projectRoot, ref, value) {
|
|
147
|
-
const destination = artifactPath(projectRoot, ref);
|
|
148
|
-
await mkdir(path.dirname(destination), { recursive: true });
|
|
149
|
-
await writeFile(destination, YAML.stringify(value, { aliasDuplicateObjects: false }), "utf8");
|
|
150
|
-
return ref;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export async function assertDesignArtifact(projectRoot, ref, kind, label) {
|
|
154
|
-
const value = await loadYamlRef(projectRoot, ref);
|
|
155
|
-
if (!isPlainObject(value) || value.kind !== kind) {
|
|
156
|
-
return inputError(`nimicoding sweep design refused: ${label} is missing or malformed.\n`);
|
|
157
|
-
}
|
|
158
|
-
return { ok: true, value, ref };
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export function auditFindingsRef(sweepId) {
|
|
162
|
-
return `.nimi/local/audit/evidence/${sweepId}/findings.yaml`;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export async function loadAuditFindings(projectRoot, sweepId) {
|
|
166
|
-
const ref = auditFindingsRef(sweepId);
|
|
167
|
-
const sourcePath = artifactPath(projectRoot, ref);
|
|
168
|
-
const info = await pathExists(sourcePath);
|
|
169
|
-
if (!info || !info.isFile()) {
|
|
170
|
-
return inputError(`nimicoding sweep design refused: audit findings not found for ${sweepId}.\n`);
|
|
171
|
-
}
|
|
172
|
-
const sourceText = await readFile(sourcePath, "utf8");
|
|
173
|
-
const store = YAML.parse(sourceText);
|
|
174
|
-
if (!isPlainObject(store) || store.kind !== "audit-findings" || store.sweep_id !== sweepId || !Array.isArray(store.findings)) {
|
|
175
|
-
return inputError(`nimicoding sweep design refused: audit findings are malformed for ${sweepId}.\n`);
|
|
176
|
-
}
|
|
177
|
-
return { ok: true, ref, store, sourceSha256: sha256Text(sourceText) };
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export function findingOwnerDomain(finding) {
|
|
181
|
-
if (typeof finding.owner_domain === "string" && finding.owner_domain.length > 0) {
|
|
182
|
-
return finding.owner_domain;
|
|
183
|
-
}
|
|
184
|
-
const file = finding.location?.file;
|
|
185
|
-
if (typeof file === "string" && file.includes("/")) {
|
|
186
|
-
return file.split("/")[0];
|
|
187
|
-
}
|
|
188
|
-
return "root";
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export function findingAuthorityRef(finding) {
|
|
192
|
-
return finding.root_cause?.authority_ref ?? finding.authority_ref ?? null;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export function findingRepairTarget(finding) {
|
|
196
|
-
return finding.root_cause?.repair_target ?? finding.location?.file ?? null;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export function findingCodeRefs(finding) {
|
|
200
|
-
return [
|
|
201
|
-
finding.location?.file,
|
|
202
|
-
...(Array.isArray(finding.implementation_refs) ? finding.implementation_refs : []),
|
|
203
|
-
].filter((value, index, array) => typeof value === "string" && value.length > 0 && array.indexOf(value) === index);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export function normalizeFindingForDesign(finding, sourceFindingsRef) {
|
|
207
|
-
return {
|
|
208
|
-
finding_id: finding.id,
|
|
209
|
-
source_audit_sweep_id: finding.sweep_id,
|
|
210
|
-
source_chunk_id: finding.chunk_id ?? null,
|
|
211
|
-
source_finding_ref: `${sourceFindingsRef}#${finding.id}`,
|
|
212
|
-
fingerprint: finding.fingerprint ?? null,
|
|
213
|
-
severity: finding.severity ?? null,
|
|
214
|
-
category: finding.category ?? null,
|
|
215
|
-
actionability: finding.actionability ?? null,
|
|
216
|
-
confidence: finding.confidence ?? null,
|
|
217
|
-
title: finding.title ?? null,
|
|
218
|
-
owner_domain: findingOwnerDomain(finding),
|
|
219
|
-
authority_ref: findingAuthorityRef(finding),
|
|
220
|
-
evidence_refs: Array.isArray(finding.implementation_refs) ? finding.implementation_refs : [],
|
|
221
|
-
repair_target: findingRepairTarget(finding),
|
|
222
|
-
location: finding.location ?? null,
|
|
223
|
-
root_cause_key: finding.root_cause?.key ?? null,
|
|
224
|
-
contract_seam: finding.root_cause?.contract_seam ?? null,
|
|
225
|
-
impact: finding.impact ?? null,
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
export function requireRunId(options) {
|
|
230
|
-
const runId = safeDesignId(options.runId);
|
|
231
|
-
if (!runId) {
|
|
232
|
-
return inputError("nimicoding sweep design refused: --run-id is required.\n");
|
|
233
|
-
}
|
|
234
|
-
return { ok: true, runId };
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export function nowIso() {
|
|
238
|
-
return new Date().toISOString();
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export function slug(value) {
|
|
242
|
-
return String(value ?? "item")
|
|
243
|
-
.toLowerCase()
|
|
244
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
245
|
-
.replace(/^-+|-+$/g, "") || "item";
|
|
246
|
-
}
|