nexarch 0.9.7 → 0.9.8
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/dist/commands/init-agent.js +33 -0
- package/package.json +1 -1
|
@@ -444,6 +444,32 @@ function injectTrustAttestationUnavailableBlock(path, reason) {
|
|
|
444
444
|
}
|
|
445
445
|
writeFileSync(path, replaced !== existing ? replaced : `${existing}${existing.endsWith("\n") ? "" : "\n"}${managed}\n`, "utf8");
|
|
446
446
|
}
|
|
447
|
+
function injectInitProjectReportingContract(path) {
|
|
448
|
+
const section = [
|
|
449
|
+
"## Nexarch Init-Project Reporting Contract",
|
|
450
|
+
"",
|
|
451
|
+
"When you run `npx nexarch@latest init-project`, treat it as skeleton registration only.",
|
|
452
|
+
"Do not claim full completion until enrichment commands are actually executed.",
|
|
453
|
+
"",
|
|
454
|
+
"Required final status fields in your reply after init-project:",
|
|
455
|
+
'- `registration_status`: `"skeleton_only"` or `"enriched"`',
|
|
456
|
+
'- `enrichment_completed`: `true` or `false`',
|
|
457
|
+
"",
|
|
458
|
+
"Hard rule:",
|
|
459
|
+
'- If `enrichment_completed=false`, you MUST include: `Enrichment pending: run update-entity/enrichment steps.`',
|
|
460
|
+
'- If `enrichment_completed=false`, NEVER say: "fully registered", "fully done", or equivalent.',
|
|
461
|
+
"",
|
|
462
|
+
"You may set `registration_status=\"enriched\"` only after executing enrichment actions (e.g. update-entity for project/sub-packages, aliases, and any chosen gap wiring).",
|
|
463
|
+
"",
|
|
464
|
+
].join("\n");
|
|
465
|
+
const existing = existsSync(path) ? readFileSync(path, "utf8") : "";
|
|
466
|
+
const managed = wrapManagedSection("init-project-reporting-contract", section.trim());
|
|
467
|
+
let replaced = replaceManagedSection(existing, "init-project-reporting-contract", section.trim());
|
|
468
|
+
if (replaced === existing) {
|
|
469
|
+
replaced = replaceInjectedSection(existing, "## Nexarch Init-Project Reporting Contract", managed);
|
|
470
|
+
}
|
|
471
|
+
writeFileSync(path, replaced !== existing ? replaced : `${existing}${existing.endsWith("\n") ? "" : "\n"}${managed}\n`, "utf8");
|
|
472
|
+
}
|
|
447
473
|
function injectGenericAgentConfig(registry) {
|
|
448
474
|
const templateByCode = new Map(registry.instructionTemplates.map((t) => [t.code, t]));
|
|
449
475
|
const genericTargets = [...registry.instructionTargets]
|
|
@@ -1114,6 +1140,7 @@ export async function initAgent(args) {
|
|
|
1114
1140
|
else {
|
|
1115
1141
|
injectTrustAttestationUnavailableBlock(r.path, trustAttestation.reason ?? "unknown");
|
|
1116
1142
|
}
|
|
1143
|
+
injectInitProjectReportingContract(r.path);
|
|
1117
1144
|
}
|
|
1118
1145
|
catch {
|
|
1119
1146
|
// non-fatal
|
|
@@ -1222,6 +1249,12 @@ export async function initAgent(args) {
|
|
|
1222
1249
|
consentPrompt: "I detected a likely project in this directory. Do you want me to run init-project now?",
|
|
1223
1250
|
actionIfApproved: "run_init_project",
|
|
1224
1251
|
command: "npx nexarch@latest init-project --dir . --json",
|
|
1252
|
+
reportingContract: {
|
|
1253
|
+
requiredFields: ["registration_status", "enrichment_completed"],
|
|
1254
|
+
allowedRegistrationStatus: ["skeleton_only", "enriched"],
|
|
1255
|
+
forbiddenWhenEnrichmentPending: ["fully registered", "fully done"],
|
|
1256
|
+
mandatoryLineWhenEnrichmentPending: "Enrichment pending: run update-entity/enrichment steps.",
|
|
1257
|
+
},
|
|
1225
1258
|
}
|
|
1226
1259
|
: {
|
|
1227
1260
|
detected: false,
|