nexarch 0.9.14 → 0.9.17
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_functions",
|
|
1544
|
+
instruction: `Review the codebase to identify discrete application functions (what the application does). Examine named modules, route layout, service boundaries, and any architecture documentation. Register functions as application_function entities with subtype core_function (primary business function), supporting_function (auxiliary/enablement), integration_function (external connectivity), or data_function (data processing). Only register functions clearly evidenced by the codebase — do not invent them.`,
|
|
1545
|
+
commandTemplates: {
|
|
1546
|
+
updateEntity: `nexarch update-entity --key "application_function:${projectSlug}-<function-slug>" --entity-type application_function --subtype core_function --name "..." --description "..."`,
|
|
1547
|
+
addRelationship: `nexarch add-relationship --from "application_function:${projectSlug}-<function-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,12 +1685,14 @@ 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(`
|
|
1688
|
+
lines.push(` ${step++}. Review the codebase to identify discrete application functions (what the application does).`);
|
|
1689
|
+
lines.push(` Examine named modules, route layout, service boundaries, and any architecture documentation.`);
|
|
1690
|
+
lines.push(` Use subtype core_function (primary business function), supporting_function (auxiliary/enablement),`);
|
|
1691
|
+
lines.push(` integration_function (external connectivity), or data_function (data processing).`);
|
|
1692
|
+
lines.push(` Only register functions clearly evidenced by the codebase — do not invent them.`);
|
|
1637
1693
|
lines.push(` For each one found:`);
|
|
1638
|
-
lines.push(` nexarch update-entity --key "
|
|
1639
|
-
lines.push(` nexarch add-relationship --from "
|
|
1694
|
+
lines.push(` nexarch update-entity --key "application_function:${projectExternalKey.split(":")[1] ?? "project"}-<function-slug>" --entity-type application_function --subtype core_function --name "..." --description "..."`);
|
|
1695
|
+
lines.push(` nexarch add-relationship --from "application_function:${projectExternalKey.split(":")[1] ?? "project"}-<function-slug>" --to "${projectExternalKey}" --type part_of`);
|
|
1640
1696
|
}
|
|
1641
1697
|
lines.push(` ${step++}. Scan the READMEs for platforms/SaaS not auto-detected (Vercel, Neon, Stripe, etc.).`);
|
|
1642
1698
|
lines.push(` For each found: nexarch resolve-names --names "..." --json → nexarch update-entity → nexarch add-relationship`);
|
|
@@ -1705,6 +1761,9 @@ export async function initProject(args) {
|
|
|
1705
1761
|
if (asJson) {
|
|
1706
1762
|
logProgress("complete", `ok=${output.ok}`);
|
|
1707
1763
|
process.stdout.write(`${JSON.stringify(output, null, 2)}\n`);
|
|
1764
|
+
// Also write the human-readable directive to stderr so it surfaces in agent terminals
|
|
1765
|
+
// regardless of whether the agent parses enrichmentRequired.pendingSteps from the JSON.
|
|
1766
|
+
process.stderr.write(`\n${buildEnrichmentDirective()}\n`);
|
|
1708
1767
|
if (!output.ok)
|
|
1709
1768
|
process.exitCode = 1;
|
|
1710
1769
|
return;
|