nexarch 0.11.2 → 0.11.4

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.
@@ -40,36 +40,29 @@ export async function checkIn(args) {
40
40
  const agentKey = agentKeyArg ?? identity.agentKey;
41
41
  if (!agentKey) {
42
42
  if (asJson) {
43
- process.stdout.write(JSON.stringify({ commands: [], draftApplications: [], reason: "no-agent-key" }) + "\n");
43
+ process.stdout.write(JSON.stringify({ commands: [], draftApplications: [], proposedApplications: [], reason: "no-agent-key" }) + "\n");
44
44
  }
45
45
  else {
46
46
  console.log("No agent key found. Pass --agent-key or run nexarch init-agent first.");
47
47
  }
48
48
  return;
49
49
  }
50
- const [raw, draftRaw] = await Promise.all([
51
- callMcpTool("nexarch_check_in", {
52
- agentRef: agentKey,
53
- agentKey,
54
- companyId: creds.companyId,
55
- }, { companyId: creds.companyId }),
56
- callMcpTool("nexarch_list_entities", {
57
- companyId: creds.companyId,
58
- entityTypeCode: "application",
59
- status: "draft",
60
- }, { companyId: creds.companyId }),
61
- ]);
50
+ const raw = await callMcpTool("nexarch_check_in", {
51
+ agentRef: agentKey,
52
+ agentKey,
53
+ companyId: creds.companyId,
54
+ }, { companyId: creds.companyId });
62
55
  const result = parseToolText(raw);
63
- const draftResult = parseToolText(draftRaw);
64
- const draftApplications = draftResult.entities ?? [];
56
+ const draftApplications = result.draftApplications ?? [];
57
+ const proposedApplications = result.proposedApplications ?? [];
65
58
  if (asJson) {
66
- process.stdout.write(JSON.stringify({ ...result, draftApplications }) + "\n");
59
+ process.stdout.write(JSON.stringify(result) + "\n");
67
60
  return;
68
61
  }
69
62
  const commands = result.commands ?? [];
70
- if (commands.length === 0 && draftApplications.length === 0) {
63
+ if (commands.length === 0 && draftApplications.length === 0 && proposedApplications.length === 0) {
71
64
  console.log("No pending application-target commands found.");
72
- console.log("No applications in draft state.");
65
+ console.log("No draft or proposed applications need attention.");
73
66
  return;
74
67
  }
75
68
  if (commands.length > 0) {
@@ -107,7 +100,7 @@ export async function checkIn(args) {
107
100
  " Ask the user if they would like to review and instantiate any of them.");
108
101
  for (const app of draftApplications) {
109
102
  const subtype = app.entitySubtypeCode ? ` [${app.entitySubtypeCode}]` : "";
110
- const key = app.externalKey ? ` (${app.externalKey})` : "";
103
+ const key = app.entityRef ? ` (${app.entityRef})` : "";
111
104
  console.log(`\n Name : ${app.name}${subtype}${key}`);
112
105
  if (app.description)
113
106
  console.log(` Desc : ${app.description}`);
@@ -118,4 +111,30 @@ export async function checkIn(args) {
118
111
  console.log(" npx nexarch proposals start --id <applicationId>");
119
112
  console.log(" npx nexarch proposals start --id <applicationId> --dir <path> --non-interactive");
120
113
  }
114
+ if (proposedApplications.length > 0) {
115
+ const count = proposedApplications.length;
116
+ console.log(`\n--- Proposed applications (${count}) ---`);
117
+ console.log(`${count === 1 ? "There is 1 application" : `There are ${count} applications`} in proposed state.` +
118
+ " Ask the user if they would like to review and realise any of them.");
119
+ for (const app of proposedApplications) {
120
+ const subtype = app.entitySubtypeCode ? ` [${app.entitySubtypeCode}]` : "";
121
+ const key = app.entityRef ? ` (${app.entityRef})` : "";
122
+ console.log(`\n Name : ${app.name}${subtype}${key}`);
123
+ if (app.description)
124
+ console.log(` Desc : ${app.description}`);
125
+ if (app.recommendationBasis)
126
+ console.log(` Basis : ${app.recommendationBasis}`);
127
+ if (typeof app.recommendedTechnologyCount === "number")
128
+ console.log(` Tech : ${app.recommendedTechnologyCount} recommended`);
129
+ if (typeof app.confirmedPolicyCount === "number")
130
+ console.log(` Policy : ${app.confirmedPolicyCount} confirmed`);
131
+ if (app.requiresPolicyReview)
132
+ console.log(` Gate : policy review required`);
133
+ console.log(` ID : ${app.id}`);
134
+ console.log(` Realise : npx nexarch proposals start --id "${app.id}"`);
135
+ }
136
+ console.log("\nTo scaffold a proposed application into a local project:");
137
+ console.log(" npx nexarch proposals start --id <applicationId>");
138
+ console.log(" npx nexarch proposals start --id <applicationId> --dir <path> --non-interactive");
139
+ }
121
140
  }
@@ -203,7 +203,7 @@ function buildReadme(proposal, template) {
203
203
 
204
204
  ${proposal.application.description ?? "Application scaffold generated from a NexArch proposal."}
205
205
 
206
- ## Starter template
206
+ ${proposal.proposal.requiresPolicyReview ? `> Policy review is required before activation. Review docs/architecture/policy-controls.md and satisfy each required control before marking this application active.\n\n` : ""}## Starter template
207
207
 
208
208
  - Template: ${template.label}
209
209
  - Runtime: ${template.runtime}
@@ -226,7 +226,7 @@ ${formatBulletList(technologies)}
226
226
 
227
227
  ${formatBulletList(policies)}
228
228
 
229
- ## Getting started
229
+ ${proposal.proposal.preScaffoldInstructions ? `## Pre-scaffold instruction\n\n${proposal.proposal.preScaffoldInstructions}\n\n` : ""}## Getting started
230
230
 
231
231
  ${template.nextSteps.map((step, index) => `${index + 1}. ${step}`).join("\n")}
232
232
  `;
@@ -234,7 +234,10 @@ ${template.nextSteps.map((step, index) => `${index + 1}. ${step}`).join("\n")}
234
234
  function buildProposalMarkdown(proposal) {
235
235
  const techLines = proposal.technologyChoices.map((tech) => `${tech.name}${tech.entitySubtypeCode ? ` (${tech.entitySubtypeCode})` : ""}${tech.description ? ` — ${tech.description}` : ""}`);
236
236
  const policyLines = proposal.policyControls.map((control) => `${control.name}${control.description ? ` — ${control.description}` : ""}`);
237
- return `# NexArch proposal context\n\n## Application\n\n- Name: ${proposal.application.name}\n- ID: ${proposal.application.id}\n- Reference: ${proposal.application.entityRef ?? "n/a"}\n- Subtype: ${proposal.application.entitySubtypeCode ?? "n/a"}\n- Description: ${proposal.application.description ?? "n/a"}\n- Recommendation basis: ${proposal.application.recommendationBasis ?? "n/a"}\n- Proposal source: ${proposal.proposal.proposalSource ?? "n/a"}\n\n${proposal.application.recommendationSummary ? `## Recommendation summary\n\n${proposal.application.recommendationSummary}\n\n` : ""}## Technology choices\n\n${formatBulletList(techLines)}\n\n## Policy controls\n\n${formatBulletList(policyLines)}\n`;
237
+ const gateLines = proposal.proposal.requiresPolicyReview
238
+ ? `- Activation gate: policy review required\n- Required policy controls: ${proposal.proposal.requiredPolicyControlIds?.length ?? 0}\n`
239
+ : "";
240
+ return `# NexArch proposal context\n\n## Application\n\n- Name: ${proposal.application.name}\n- ID: ${proposal.application.id}\n- Reference: ${proposal.application.entityRef ?? "n/a"}\n- Subtype: ${proposal.application.entitySubtypeCode ?? "n/a"}\n- Description: ${proposal.application.description ?? "n/a"}\n- Recommendation basis: ${proposal.application.recommendationBasis ?? "n/a"}\n- Proposal source: ${proposal.proposal.proposalSource ?? "n/a"}\n${gateLines}\n${proposal.application.recommendationSummary ? `## Recommendation summary\n\n${proposal.application.recommendationSummary}\n\n` : ""}${proposal.proposal.preScaffoldInstructions ? `## Pre-scaffold instruction\n\n${proposal.proposal.preScaffoldInstructions}\n\n` : ""}## Technology choices\n\n${formatBulletList(techLines)}\n\n## Policy controls\n\n${formatBulletList(policyLines)}\n`;
238
241
  }
239
242
  function buildPolicyMarkdown(proposal) {
240
243
  if (proposal.policyControls.length === 0) {
@@ -242,12 +245,17 @@ function buildPolicyMarkdown(proposal) {
242
245
  }
243
246
  return `# Policy controls\n\n${proposal.policyControls.map((control) => {
244
247
  const guidance = trimText(typeof control.controlAttributes.summary === "string" ? control.controlAttributes.summary : null);
245
- const rules = Array.isArray(control.controlAttributes.rules)
246
- ? control.controlAttributes.rules
247
- .map((rule) => trimText(typeof rule.title === "string" ? rule.title : typeof rule.code === "string" ? rule.code : null))
248
- .filter((value) => Boolean(value))
249
- : [];
250
- return `## ${control.name}\n\n${control.description ?? "No description provided."}\n\n${guidance ? `Guidance: ${guidance}\n\n` : ""}${rules.length > 0 ? `Rules\n\n${formatBulletList(rules)}\n` : ""}`;
248
+ const rules = (control.rules ?? [])
249
+ .map((rule) => {
250
+ const title = trimText(rule.title) ?? trimText(rule.ruleId) ?? trimText(rule.name) ?? "Unnamed rule";
251
+ const level = trimText(rule.requirementLevel);
252
+ const mode = trimText(rule.ruleMode);
253
+ const text = trimText(rule.ruleText);
254
+ return `${title}${level ? ` [${level}]` : ""}${mode ? ` (${mode})` : ""}${text ? ` — ${text}` : ""}`;
255
+ })
256
+ .filter((value) => Boolean(value));
257
+ const auditRules = Array.isArray(control.auditRules) ? control.auditRules.length : 0;
258
+ return `## ${control.name}\n\n${control.description ?? "No description provided."}\n\n${guidance ? `Guidance: ${guidance}\n\n` : ""}${control.policyMarkdown ? `Policy markdown\n\n${control.policyMarkdown}\n\n` : ""}${rules.length > 0 ? `Rules\n\n${formatBulletList(rules)}\n\n` : ""}${auditRules > 0 ? `Audit rules: ${auditRules}\n` : ""}`;
251
259
  }).join("\n")}`;
252
260
  }
253
261
  function buildTsConfig() {
@@ -560,6 +568,7 @@ export async function proposalsStart(args) {
560
568
  command: "proposals start",
561
569
  operatorEmail: creds.email,
562
570
  },
571
+ reviewedPolicyControlIds: proposal.proposal.requiredPolicyControlIds ?? proposal.proposal.confirmedPolicyControlIds,
563
572
  }, { companyId: creds.companyId });
564
573
  activated = parseToolText(activateRaw);
565
574
  }
package/dist/index.js CHANGED
@@ -181,16 +181,17 @@ Usage:
181
181
  --limit <1-500>
182
182
  --json
183
183
  nexarch check-in Preview pending application-target commands (no auto-claim)
184
- and report any applications currently in draft state so the
184
+ and report draft/proposed applications needing review so the
185
185
  agent can prompt the user to explore and instantiate them.
186
186
  Use command-claim to explicitly claim a specific command.
187
187
  Scope is resolved server-side from active company context.
188
188
  Options: --agent-key <key> override stored agent key
189
- --json JSON output includes draftApplications[]
189
+ --json JSON output includes draftApplications[] and proposedApplications[]
190
190
  nexarch proposals start
191
191
  Start a new application workspace from a proposed NexArch app.
192
- Lists proposed apps, lets you choose one, writes a starter
193
- project scaffold, and activates the proposal to active.
192
+ Lists proposed apps, shows policy review gates, writes a starter
193
+ project scaffold, and activates the proposal to active once
194
+ required policy controls are acknowledged.
194
195
  Options: --id <applicationId>
195
196
  --dir <path>
196
197
  --reason <text>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexarch",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "description": "Your architecture workspace for AI delivery.",
5
5
  "keywords": [
6
6
  "nexarch",