nexarch 0.9.14 → 0.9.16
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.
|
@@ -1515,12 +1515,66 @@ export async function initProject(args) {
|
|
|
1515
1515
|
}
|
|
1516
1516
|
// Build the structured enrichment payload for JSON output.
|
|
1517
1517
|
function buildEnrichmentPayload() {
|
|
1518
|
+
const projectSlug = projectExternalKey.split(":")[1] ?? "project";
|
|
1519
|
+
// Build the pendingSteps array — mirrors the THEN_RUN section in buildEnrichmentDirective
|
|
1520
|
+
// so agents using --json receive the same mandatory instructions as text-mode agents.
|
|
1521
|
+
const pendingSteps = [];
|
|
1522
|
+
let stepNum = 1;
|
|
1523
|
+
pendingSteps.push({
|
|
1524
|
+
step: stepNum++,
|
|
1525
|
+
action: "enrich_entity",
|
|
1526
|
+
instruction: `Enrich the project entity with a meaningful name, description, subtype, and icon.`,
|
|
1527
|
+
command: `nexarch update-entity --key "${projectExternalKey}" --entity-type "${entityTypeOverride}"${entityTypeOverride === "application" ? ' --subtype "<subtype>" --icon "<lucide-icon>"' : ""} --name "..." --description "..."`,
|
|
1528
|
+
...(entityTypeOverride === "application"
|
|
1529
|
+
? { notes: ["Valid subtypes: app_custom_built app_saas app_mobile app_cli app_integration_service app_data_pipeline", "Choose app_custom_built as the default if none of the others clearly apply."] }
|
|
1530
|
+
: {}),
|
|
1531
|
+
});
|
|
1532
|
+
if (subPackages.length > 0) {
|
|
1533
|
+
pendingSteps.push({
|
|
1534
|
+
step: stepNum++,
|
|
1535
|
+
action: "classify_sub_packages",
|
|
1536
|
+
instruction: `Update each sub-package in classifyPackages with a confirmed entity type, subtype, name, and description.`,
|
|
1537
|
+
command: `nexarch update-entity --key "<subPackageExternalKey>" --entity-type "<entityType>" --subtype "<subtype>" --name "..." --description "..."`,
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
if (entityTypeOverride === "application") {
|
|
1541
|
+
pendingSteps.push({
|
|
1542
|
+
step: stepNum++,
|
|
1543
|
+
action: "discover_subsystems",
|
|
1544
|
+
instruction: `Review the codebase to identify functional subsystems. Examine the code structure, named modules, route layout, and any architecture documentation. Only register subsystems clearly evidenced by the codebase — do not invent them.`,
|
|
1545
|
+
commandTemplates: {
|
|
1546
|
+
updateEntity: `nexarch update-entity --key "application_component:${projectSlug}-<subsystem-slug>" --entity-type application_component --subtype app_comp_subsystem --name "..." --description "..."`,
|
|
1547
|
+
addRelationship: `nexarch add-relationship --from "application_component:${projectSlug}-<subsystem-slug>" --to "${projectExternalKey}" --type part_of`,
|
|
1548
|
+
},
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
pendingSteps.push({
|
|
1552
|
+
step: stepNum++,
|
|
1553
|
+
action: "scan_for_undetected_platforms",
|
|
1554
|
+
instruction: `Scan READMEs and docs for platforms or SaaS services not auto-detected (e.g. Vercel, Neon, Stripe). For each found: resolve → update-entity → add-relationship.`,
|
|
1555
|
+
commandTemplates: {
|
|
1556
|
+
resolve: `nexarch resolve-names --names "..." --json`,
|
|
1557
|
+
updateEntity: `nexarch update-entity --key "<canonicalExternalRef>" --entity-type "<entityType>" --name "..."`,
|
|
1558
|
+
addRelationship: `nexarch add-relationship --from "${projectExternalKey}" --to "<canonicalExternalRef>" --type depends_on`,
|
|
1559
|
+
},
|
|
1560
|
+
});
|
|
1561
|
+
pendingSteps.push({
|
|
1562
|
+
step: stepNum++,
|
|
1563
|
+
action: "register_decision_records",
|
|
1564
|
+
instruction: `Look for ADRs (docs/adr/, decisions/, ADR-*.md) and register each as a decision_record entity.`,
|
|
1565
|
+
commandTemplates: {
|
|
1566
|
+
updateEntity: `nexarch update-entity --key "decision_record:${projectSlug}-<adr-slug>" --entity-type decision_record --subtype decision_architecture --name "..." --attributes-json '{"decision":{"summary":"...","detail":"..."}}'`,
|
|
1567
|
+
addRelationship: `nexarch add-relationship --from "decision_record:${projectSlug}-<adr-slug>" --to "${projectExternalKey}" --type decides`,
|
|
1568
|
+
},
|
|
1569
|
+
});
|
|
1518
1570
|
return {
|
|
1519
1571
|
status: "enrichment_required",
|
|
1572
|
+
note: "IMPORTANT: Execute ALL pendingSteps before reporting the project as registered. Do not pause or ask for confirmation between steps.",
|
|
1520
1573
|
projectEntity: {
|
|
1521
1574
|
externalKey: projectExternalKey,
|
|
1522
1575
|
entityType: entityTypeOverride,
|
|
1523
1576
|
},
|
|
1577
|
+
pendingSteps,
|
|
1524
1578
|
readFiles: readmeHints,
|
|
1525
1579
|
classifyPackages: subPackages.map((sp) => {
|
|
1526
1580
|
const resolvedDeps = sp.depSpecs
|
|
@@ -1631,9 +1685,9 @@ export async function initProject(args) {
|
|
|
1631
1685
|
lines.push(` ${step++}. Update each sub-package listed under CLASSIFY_THESE above.`);
|
|
1632
1686
|
}
|
|
1633
1687
|
if (entityTypeOverride === "application") {
|
|
1634
|
-
lines.push(` ${step++}.
|
|
1635
|
-
lines.push(`
|
|
1636
|
-
lines.push(` Only register subsystems
|
|
1688
|
+
lines.push(` ${step++}. Review the codebase to identify functional subsystems.`);
|
|
1689
|
+
lines.push(` Examine the code structure, named modules, route layout, and any architecture documentation.`);
|
|
1690
|
+
lines.push(` Only register subsystems clearly evidenced by the codebase — do not invent them.`);
|
|
1637
1691
|
lines.push(` For each one found:`);
|
|
1638
1692
|
lines.push(` nexarch update-entity --key "application_component:${projectExternalKey.split(":")[1] ?? "project"}-<subsystem-slug>" --entity-type application_component --subtype app_comp_subsystem --name "..." --description "..."`);
|
|
1639
1693
|
lines.push(` nexarch add-relationship --from "application_component:${projectExternalKey.split(":")[1] ?? "project"}-<subsystem-slug>" --to "${projectExternalKey}" --type part_of`);
|
|
@@ -1705,6 +1759,9 @@ export async function initProject(args) {
|
|
|
1705
1759
|
if (asJson) {
|
|
1706
1760
|
logProgress("complete", `ok=${output.ok}`);
|
|
1707
1761
|
process.stdout.write(`${JSON.stringify(output, null, 2)}\n`);
|
|
1762
|
+
// Also write the human-readable directive to stderr so it surfaces in agent terminals
|
|
1763
|
+
// regardless of whether the agent parses enrichmentRequired.pendingSteps from the JSON.
|
|
1764
|
+
process.stderr.write(`\n${buildEnrichmentDirective()}\n`);
|
|
1708
1765
|
if (!output.ok)
|
|
1709
1766
|
process.exitCode = 1;
|
|
1710
1767
|
return;
|