nexarch 0.12.39 → 0.12.44

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.
@@ -50,11 +50,19 @@ function parseRelationships(args) {
50
50
  if (!from || !to || !type) {
51
51
  throw new Error(`Relationship #${index + 1} is missing required fields (from/to/type)`);
52
52
  }
53
+ const subtype = typeof v.relationshipSubtypeCode === "string" ? v.relationshipSubtypeCode
54
+ : typeof v.subtype === "string" ? v.subtype
55
+ : undefined;
56
+ const attributes = v.attributes && typeof v.attributes === "object" && !Array.isArray(v.attributes)
57
+ ? v.attributes
58
+ : undefined;
53
59
  return {
54
60
  fromEntityExternalKey: from,
55
61
  toEntityExternalKey: to,
56
62
  relationshipTypeCode: type,
57
63
  confidence: Number.isFinite(confidence) ? confidence : 1,
64
+ ...(subtype ? { relationshipSubtypeCode: subtype } : {}),
65
+ ...(attributes ? { attributes } : {}),
58
66
  };
59
67
  });
60
68
  }
@@ -113,8 +121,14 @@ export async function addRelationship(args) {
113
121
  model: "n/a",
114
122
  provider: "n/a",
115
123
  };
124
+ // score is an unverified agent assertion of policy conformance, not a fact
125
+ // the CLI can establish itself -- it never reads the applied policy
126
+ // documents or evaluates the write against them, so asserting 1 ("fully
127
+ // conformant") here was a fabricated default the caller had no way to
128
+ // override. null ("not evaluated") is the honest value, matching the
129
+ // guidance direct-MCP playbooks already give agents for the same field.
116
130
  const policyContext = policyBundleHash
117
- ? { policyBundleHash, alignmentSummary: { score: 1, violations: [], waivers: [] } }
131
+ ? { policyBundleHash, alignmentSummary: { score: null, violations: [], waivers: [] } }
118
132
  : undefined;
119
133
  let raw = await callMcpTool("nexarch_upsert_relationships", { relationships, agentContext, policyContext }, mcpOpts);
120
134
  let result = parseToolText(raw);
@@ -266,43 +266,43 @@ function writeAgentBootstrap(params) {
266
266
  `--capabilities "<comma,separated,capabilities>"`,
267
267
  `--json`,
268
268
  ].join(" \\\n ");
269
- const content = `# Nexarch Agent Bootstrap
270
-
271
- This file was written by \`nexarch init-agent\` on ${new Date().toISOString()}.
272
- It contains instructions for an AI agent to complete its Nexarch registration.
273
-
274
- ## What has already been registered
275
-
276
- The following entities are now in the architecture graph:
277
-
278
- | Entity | Name | Type |
279
- |--------|------|------|
280
- | Agent | \`${params.agentId}\` | agent |
281
- | Host | \`Host ${params.hostname}\` | tech_compute |
282
- | OS | \`${params.osPlatform} ${params.osRelease}\` | tech_operating_system |
283
- | Runtime | \`Node.js ${params.nodeVersion}\` | tech_runtime |
284
-
285
- ## Your task
286
-
287
- Run the command below, substituting your own values for the placeholders.
288
- Return ONLY the completed command (no markdown, no explanation) — it will be executed directly.
289
-
290
- \`\`\`
291
- ${identifyCmd}
292
- \`\`\`
293
-
294
- Fill in:
295
- - **provider** — your AI provider (e.g. \`anthropic\`, \`openai\`, \`google\`)
296
- - **model** — the exact model ID you are running as (e.g. \`gpt-4o\`, \`claude-sonnet-4-6\`, \`gemini-2-flash\`)
297
- - **client** — the MCP client tool you are running inside (e.g. \`claude-code\`, \`cursor\`, \`continue\`, \`codex-cli\`)
298
- - **framework** — the agent framework in use (e.g. \`openclaw\`)
299
- - **session-id** — your current session ID if available
300
- - **tool-version** — the version of the client tool (run the tool's version command and use the version number only, e.g. \`1.2.3\`)
301
- - **capabilities** — comma-separated list of your capabilities (e.g. \`code,files,bash,web\`)
302
-
303
- Omit any flag whose value you genuinely do not know rather than guessing.
304
-
305
- After running, confirm \`"ok": true\` in the JSON output. No further action is needed.
269
+ const content = `# Nexarch Agent Bootstrap
270
+
271
+ This file was written by \`nexarch init-agent\` on ${new Date().toISOString()}.
272
+ It contains instructions for an AI agent to complete its Nexarch registration.
273
+
274
+ ## What has already been registered
275
+
276
+ The following entities are now in the architecture graph:
277
+
278
+ | Entity | Name | Type |
279
+ |--------|------|------|
280
+ | Agent | \`${params.agentId}\` | agent |
281
+ | Host | \`Host ${params.hostname}\` | tech_compute |
282
+ | OS | \`${params.osPlatform} ${params.osRelease}\` | tech_operating_system |
283
+ | Runtime | \`Node.js ${params.nodeVersion}\` | tech_runtime |
284
+
285
+ ## Your task
286
+
287
+ Run the command below, substituting your own values for the placeholders.
288
+ Return ONLY the completed command (no markdown, no explanation) — it will be executed directly.
289
+
290
+ \`\`\`
291
+ ${identifyCmd}
292
+ \`\`\`
293
+
294
+ Fill in:
295
+ - **provider** — your AI provider (e.g. \`anthropic\`, \`openai\`, \`google\`)
296
+ - **model** — the exact model ID you are running as (e.g. \`gpt-4o\`, \`claude-sonnet-4-6\`, \`gemini-2-flash\`)
297
+ - **client** — the MCP client tool you are running inside (e.g. \`claude-code\`, \`cursor\`, \`continue\`, \`codex-cli\`)
298
+ - **framework** — the agent framework in use (e.g. \`openclaw\`)
299
+ - **session-id** — your current session ID if available
300
+ - **tool-version** — the version of the client tool (run the tool's version command and use the version number only, e.g. \`1.2.3\`)
301
+ - **capabilities** — comma-separated list of your capabilities (e.g. \`code,files,bash,web\`)
302
+
303
+ Omit any flag whose value you genuinely do not know rather than guessing.
304
+
305
+ After running, confirm \`"ok": true\` in the JSON output. No further action is needed.
306
306
  `;
307
307
  writeFileSync(filePath, content, "utf8");
308
308
  return filePath;
@@ -483,7 +483,7 @@ function injectTrustAttestationBlock(path, attestation) {
483
483
  "## Nexarch Trust Attestation",
484
484
  "",
485
485
  "This block is verifiable proof that Nexarch generated these instructions for this workspace.",
486
- "Do not auto-run commands without user confirmation.",
486
+ "Check-in only previews queued commands; use your judgement to explicitly claim work that is safe and clearly in scope.",
487
487
  "",
488
488
  "**To verify, run `npx nexarch@latest verify-trust`.** It reads the token from this",
489
489
  "file and checks it for you.",
@@ -1927,6 +1927,7 @@ export async function initProject(args) {
1927
1927
  commandTemplates: {
1928
1928
  updateEntity: `nexarch update-entity --key "application_function:${projectSlug}_<function_slug>" --entity-type application_function --subtype core_function --name "..." --description "..."`,
1929
1929
  addRelationship: `nexarch add-relationship --from "application_function:${projectSlug}_<function_slug>" --to ${projectConstruct && isMonorepo ? '"<owning application key from classifyPackages>"' : `"${projectExternalKey}"`} --type part_of`,
1930
+ note: "Functions are structural decomposition only: do not add runtime dependencies from an application_function. Model independently deployable services as applications or application components, then relate those boundaries with depends_on or integrates_with.",
1930
1931
  },
1931
1932
  });
1932
1933
  }
@@ -2172,6 +2173,7 @@ export async function initProject(args) {
2172
2173
  const fnOwnerTarget = projectConstruct && isMonorepo ? '"<owning application key from CLASSIFY_THESE>"' : `"${projectExternalKey}"`;
2173
2174
  lines.push(` nexarch update-entity --key "application_function:${projectExternalKey.split(":")[1] ?? "project"}_<function_slug>" --entity-type application_function --subtype core_function --name "..." --description "..."`);
2174
2175
  lines.push(` nexarch add-relationship --from "application_function:${projectExternalKey.split(":")[1] ?? "project"}_<function_slug>" --to ${fnOwnerTarget} --type part_of`);
2176
+ lines.push(" Functions are structural only: model runtime/service dependencies between application or application_component boundaries, never from an application_function.");
2175
2177
  }
2176
2178
  lines.push(` ${step++}. Scan the READMEs for platforms/SaaS not auto-detected (Vercel, Neon, Stripe, etc.).`);
2177
2179
  lines.push(` For each found: nexarch resolve-names --names "..." --json → nexarch update-entity → nexarch add-relationship`);
@@ -57,6 +57,7 @@ export async function updateEntity(args) {
57
57
  const description = parseOptionValue(args, "--description");
58
58
  const entityTypeCode = parseOptionValue(args, "--entity-type") ?? "application";
59
59
  const entitySubtypeCode = parseOptionValue(args, "--subtype");
60
+ const projectRef = parseOptionValue(args, "--project-ref");
60
61
  const iconName = parseOptionValue(args, "--icon");
61
62
  const attributesJson = parseOptionValue(args, "--attributes-json");
62
63
  const attributesFile = parseOptionValue(args, "--attributes-file");
@@ -64,6 +65,10 @@ export async function updateEntity(args) {
64
65
  console.error("error: --key <externalKey> is required");
65
66
  process.exit(1);
66
67
  }
68
+ if (projectRef && !projectRef.startsWith("project:")) {
69
+ console.error("error: --project-ref must be the entity ref of a registered project (project:<slug>)");
70
+ process.exit(1);
71
+ }
67
72
  const explicitAttributes = parseAttributesInput(attributesJson, attributesFile);
68
73
  if (!name && !description && !iconName && !explicitAttributes) {
69
74
  console.error("error: provide at least one of --name, --description, --icon, --attributes-json, or --attributes-file");
@@ -78,14 +83,25 @@ export async function updateEntity(args) {
78
83
  const agentContext = {
79
84
  agentId: "nexarch-cli:update-entity",
80
85
  agentRunId: `update-entity-${Date.now()}`,
81
- repoRef: externalKey,
86
+ // A generic update targets an entity, but an application may have been
87
+ // discovered in a registered project. Supplying that project context lets
88
+ // the gateway maintain the application --sourced_from--> project edge.
89
+ // Preserve the historic target-ref fallback for updates with no project
90
+ // context and for entity types where a source project is not meaningful.
91
+ repoRef: projectRef ?? externalKey,
82
92
  observedAt: nowIso,
83
93
  source: "nexarch-cli",
84
94
  model: "n/a",
85
95
  provider: "n/a",
86
96
  };
97
+ // score is an unverified agent assertion of policy conformance, not a fact
98
+ // the CLI can establish itself -- it never reads the applied policy
99
+ // documents or evaluates the write against them, so asserting 1 ("fully
100
+ // conformant") here was a fabricated default the caller had no way to
101
+ // override. null ("not evaluated") is the honest value, matching the
102
+ // guidance direct-MCP playbooks already give agents for the same field.
87
103
  const policyContext = policyBundleHash
88
- ? { policyBundleHash, alignmentSummary: { score: 1, violations: [], waivers: [] } }
104
+ ? { policyBundleHash, alignmentSummary: { score: null, violations: [], waivers: [] } }
89
105
  : undefined;
90
106
  const entity = {
91
107
  externalKey,
package/dist/index.js CHANGED
@@ -90,7 +90,7 @@ async function main() {
90
90
  if (command === "--version" || command === "-v" || command === "version") {
91
91
  const build = cliBuild();
92
92
  if (args.includes("--json"))
93
- process.stdout.write(`${JSON.stringify(build, null, 2)}
93
+ process.stdout.write(`${JSON.stringify(build, null, 2)}
94
94
  `);
95
95
  else
96
96
  console.log(formatBuild(build));
@@ -98,226 +98,227 @@ async function main() {
98
98
  }
99
99
  const handler = commands[command ?? ""];
100
100
  if (!handler) {
101
- console.log(`
102
- nexarch — Your architecture workspace for AI delivery.
103
-
104
- Usage:
105
- nexarch login Authenticate in browser and store company-scoped credentials
106
- Option: --company <id>
107
- nexarch --version Print the version and the path this copy runs from
108
- nexarch enroll Bootstrap a headless (browserless) agent with a one-time
109
- enrollment code — no login required. Writes the resulting
110
- credential to ~/.nexarch/agent-credential.json (mode 600)
111
- rather than printing it. For a client with a known config
112
- format (e.g. hermes-agent), also writes the connection
113
- directly into that client's own env/config files; for
114
- anything else, prints instructions instead.
115
- Options: --code <code> (required, starts with nxe_)
116
- --client <code> (required, e.g. hermes-agent)
117
- --client-version <v>
118
- --host <baseUrl> (default: https://www.nexarch.ai)
119
- --out <path> write credential here instead
120
- --skip-client-config don't touch the client's own files
121
- --print-token also print the token to stdout
122
- --json
123
- nexarch logout Remove stored credentials
124
- nexarch status Check connection and show architecture summary
125
- nexarch verify-trust Verify this repo's Nexarch trust attestation. Reads the token
126
- from the instruction file, so nothing has to be copied.
127
- Options: --dir <path> (default: cwd)
128
- --json
129
- nexarch setup One-step onboarding: login (if needed) + MCP config + register agent
130
- Names the workspace it will write to and confirms it before
131
- registering anything; answer 'n' to pick a different one.
132
- Options: --company <id|code> target a workspace directly
133
- --yes accept the stored workspace without asking
134
- nexarch mcp-config Print MCP server config block for manual setup
135
- Client list is registry-managed (see 'nexarch mcp-config --client <code>')
136
- nexarch mcp-proxy Run as stdio MCP proxy (used by MCP clients)
137
- nexarch init-agent Run handshake + mandatory agent registration in graph (advanced/manual)
138
- Options: --agent-id <id> --bind-to-external-key <key>
139
- --bind-relationship-type <code> --redact-hostname
140
- --json --strict
141
- nexarch agent identify
142
- Capture richer coding-agent identity metadata
143
- Options: --agent-id <id> --provider <provider> --model <model>
144
- --client <name> [--framework <name>] [--session-id <id>]
145
- [--tool-version <v>] [--capabilities <csv>]
146
- [--notes <text>] [--json]
147
- nexarch agent-identify
148
- Alias of 'nexarch agent identify'
149
- nexarch init-project
150
- Scan a project directory, resolve detected packages/env vars/
151
- config files against the reference library, write entities and
152
- relationships to the architecture graph, and log unresolved
153
- names as reference candidates.
154
- Monorepos register a project entity plus one proposed
155
- application per deployable package (sourced_from the project).
156
- Single-package repos register the repo's one application; when
157
- similar applications exist they are listed, and the new
158
- application is created as proposed for review at activation.
159
- Terraform repositories take a different path: no dependency
160
- scan and no applications. They register a project plus the
161
- environments their root modules define, and hand over the
162
- per-root ingest-infra commands that read the actual estate.
163
- Options: --dir <path> (default: cwd)
164
- --name <name> override project name
165
- --entity-type <code> (default: application)
166
- --application-ref <entityRef> force mapping target
167
- --create-application force new application entity
168
- --auto-map-application auto-map only when high confidence
169
- --non-interactive deprecated (mapping no longer prompts)
170
- --batch-size <n> upsert batch size (default: 10)
171
- --profile include timing/profile data in JSON output
172
- --dry-run preview without writing
173
- --json
174
- nexarch update-project
175
- Re-scan a previously registered project directory, refresh
176
- entities and relationships in the graph, and diff the new scan
177
- against the current graph state to surface stale relationships
178
- and removed sub-packages for the calling agent to review.
179
- Accepts all the same options as init-project plus:
180
- --application-ref <entityRef> target project key (recommended)
181
- --auto-map-application auto-select best-match application
182
- Output includes enrichmentRequired.diff with:
183
- newRelationships — detected but not yet in graph
184
- staleRelationships — in graph but absent from manifests
185
- removedSubPackages — previously registered, no longer on disk
186
- --json
187
- nexarch update-entity
188
- Update the name and/or description of an existing graph entity.
189
- Use this after init-project to enrich the entity with meaningful
190
- content from the project README or docs.
191
- Options: --key <externalKey> (required)
192
- --name <name>
193
- --description <text>
194
- --entity-type <code> (default: application)
195
- --subtype <code>
196
- --icon <lucide-name> (convenience; sets attributes.application_icon)
197
- --attributes-json '<json object>'
198
- --attributes-file <path.json>
199
- --json
200
- nexarch add-relationship
201
- Add relationships between existing graph entities (single or batch).
202
- Single options: --from <externalKey>
203
- --to <externalKey>
204
- --type <code> (e.g. part_of, depends_on)
205
- Batch options: --relationships-json '<json array>'
206
- --relationships-file <path.json>
207
- --json
208
- nexarch register-alias
209
- Register a company-scoped alias for an entity so future
210
- scans resolve it instead of logging it as a candidate.
211
- Use after enriching internal monorepo packages.
212
- Options: --alias <value> (required, e.g. @scope/name)
213
- --key <externalKey> (required)
214
- --name <name> (required)
215
- --entity-type <code> (required)
216
- --subtype <code>
217
- --description <text>
218
- --json
219
- nexarch resolve-names
220
- Look up one or more raw names (package names, platform
221
- names) against the global reference library and return
222
- their canonical external keys. Useful for gap-check
223
- results before calling add-relationship.
224
- Options: --names <csv> (required, e.g. "vercel,neon")
225
- --json
226
- nexarch list-entities
227
- List entities from the workspace graph.
228
- Options: --type <entityTypeCode>
229
- --status <status>
230
- --query <text>
231
- --limit <1-500>
232
- --json
233
- nexarch list-relationships
234
- List relationships from the workspace graph.
235
- Options: --type <relationshipTypeCode>
236
- --status <status>
237
- --from <fromExternalKey>
238
- --to <toExternalKey>
239
- --limit <1-500>
240
- --json
241
- nexarch register-runtime
242
- Register or refresh runtime + optional application context
243
- without performing check-in.
244
- Options: --application-ref <entityRef>
245
- --client <name>
246
- --version <semver>
247
- --json
248
- nexarch check-in Preview pending application-target commands (no auto-claim)
249
- and report draft/proposed applications needing review so the
250
- agent can prompt the user to explore and instantiate them.
251
- Use command-claim to explicitly claim a specific command.
252
- Scope is resolved server-side from active company context.
253
- Options: --agent-key <key> override stored agent key
254
- --application-ref <entityRef> narrow preview scope
255
- --json JSON output includes draftApplications[] and proposedApplications[]
256
- nexarch proposals start
257
- Start a new application workspace from a proposed NexArch app.
258
- Lists proposed apps, shows policy review gates, writes a starter
259
- project scaffold, and activates the proposal to active once
260
- required policy controls are acknowledged.
261
- Options: --id <applicationId>
262
- --dir <path>
263
- --reason <text>
264
- --repo <url>
265
- --skip-activate
266
- --activate
267
- --force
268
- --non-interactive
269
- --json
270
- nexarch command-claim
271
- Explicitly claim a pending command by ID.
272
- Options: --id <commandId> (required)
273
- --agent-key <key> override stored agent key
274
- --application-ref <entityRef> required for application-target commands
275
- --json
276
- nexarch command-done
277
- Mark a claimed command as completed.
278
- Options: --id <commandId> (required)
279
- --summary <text> short summary of what was done
280
- --summary-file <path.md|txt>
281
- --json
282
- nexarch command-fail
283
- Mark a claimed command as failed.
284
- Options: --id <commandId> (required)
285
- --error <message> (required)
286
- --json
287
- nexarch policy-controls
288
- Fetch policy controls/rules assigned to an entity (for policy audits).
289
- Options: --entity <externalKey> (required, e.g. application:bad-driving)
290
- --json
291
- nexarch policy-audit-template
292
- Generate a findings JSON template from policy controls/rules for an entity.
293
- Options: --entity <externalKey> (required)
294
- --control-id <uuid> (repeatable; optional filter)
295
- --default-result <pass|partial|fail> (default: fail)
296
- --output <path.json>
297
- --json
298
- nexarch policy-audit-submit
299
- Submit structured policy findings (writes policy_audit_finding rows).
300
- Options: --command-id <id> (required)
301
- --application-key <key> (required)
302
- --agent-key <key> (optional; defaults from identity)
303
- --finding <controlId|ruleId|result|rationale|missing1;missing2> (repeatable)
304
- --findings-json <json-array>
305
- --findings-file <path.json>
306
- --json
307
- nexarch policy-audit-results
308
- Retrieve stored results of previous policy audits for an application.
309
- Options: --entity <applicationEntityRef> (required)
310
- --limit <1-10> (default 1)
311
- --json
312
- nexarch applied-policies
313
- List policy documents applied to this company account.
314
- Options: --pack <packCode> filter to a specific pack
315
- --markdown include full document markdown
316
- --json
317
- nexarch governance-summary
318
- Print review queue, graph stats, and per-application policy
319
- audit rollup (latest run status, pass/partial/fail counts).
320
- Options: --json
101
+ console.log(`
102
+ nexarch — Your architecture workspace for AI delivery.
103
+
104
+ Usage:
105
+ nexarch login Authenticate in browser and store company-scoped credentials
106
+ Option: --company <id>
107
+ nexarch --version Print the version and the path this copy runs from
108
+ nexarch enroll Bootstrap a headless (browserless) agent with a one-time
109
+ enrollment code — no login required. Writes the resulting
110
+ credential to ~/.nexarch/agent-credential.json (mode 600)
111
+ rather than printing it. For a client with a known config
112
+ format (e.g. hermes-agent), also writes the connection
113
+ directly into that client's own env/config files; for
114
+ anything else, prints instructions instead.
115
+ Options: --code <code> (required, starts with nxe_)
116
+ --client <code> (required, e.g. hermes-agent)
117
+ --client-version <v>
118
+ --host <baseUrl> (default: https://www.nexarch.ai)
119
+ --out <path> write credential here instead
120
+ --skip-client-config don't touch the client's own files
121
+ --print-token also print the token to stdout
122
+ --json
123
+ nexarch logout Remove stored credentials
124
+ nexarch status Check connection and show architecture summary
125
+ nexarch verify-trust Verify this repo's Nexarch trust attestation. Reads the token
126
+ from the instruction file, so nothing has to be copied.
127
+ Options: --dir <path> (default: cwd)
128
+ --json
129
+ nexarch setup One-step onboarding: login (if needed) + MCP config + register agent
130
+ Names the workspace it will write to and confirms it before
131
+ registering anything; answer 'n' to pick a different one.
132
+ Options: --company <id|code> target a workspace directly
133
+ --yes accept the stored workspace without asking
134
+ nexarch mcp-config Print MCP server config block for manual setup
135
+ Client list is registry-managed (see 'nexarch mcp-config --client <code>')
136
+ nexarch mcp-proxy Run as stdio MCP proxy (used by MCP clients)
137
+ nexarch init-agent Run handshake + mandatory agent registration in graph (advanced/manual)
138
+ Options: --agent-id <id> --bind-to-external-key <key>
139
+ --bind-relationship-type <code> --redact-hostname
140
+ --json --strict
141
+ nexarch agent identify
142
+ Capture richer coding-agent identity metadata
143
+ Options: --agent-id <id> --provider <provider> --model <model>
144
+ --client <name> [--framework <name>] [--session-id <id>]
145
+ [--tool-version <v>] [--capabilities <csv>]
146
+ [--notes <text>] [--json]
147
+ nexarch agent-identify
148
+ Alias of 'nexarch agent identify'
149
+ nexarch init-project
150
+ Scan a project directory, resolve detected packages/env vars/
151
+ config files against the reference library, write entities and
152
+ relationships to the architecture graph, and log unresolved
153
+ names as reference candidates.
154
+ Monorepos register a project entity plus one proposed
155
+ application per deployable package (sourced_from the project).
156
+ Single-package repos register the repo's one application; when
157
+ similar applications exist they are listed, and the new
158
+ application is created as proposed for review at activation.
159
+ Terraform repositories take a different path: no dependency
160
+ scan and no applications. They register a project plus the
161
+ environments their root modules define, and hand over the
162
+ per-root ingest-infra commands that read the actual estate.
163
+ Options: --dir <path> (default: cwd)
164
+ --name <name> override project name
165
+ --entity-type <code> (default: application)
166
+ --application-ref <entityRef> force mapping target
167
+ --create-application force new application entity
168
+ --auto-map-application auto-map only when high confidence
169
+ --non-interactive deprecated (mapping no longer prompts)
170
+ --batch-size <n> upsert batch size (default: 10)
171
+ --profile include timing/profile data in JSON output
172
+ --dry-run preview without writing
173
+ --json
174
+ nexarch update-project
175
+ Re-scan a previously registered project directory, refresh
176
+ entities and relationships in the graph, and diff the new scan
177
+ against the current graph state to surface stale relationships
178
+ and removed sub-packages for the calling agent to review.
179
+ Accepts all the same options as init-project plus:
180
+ --application-ref <entityRef> target project key (recommended)
181
+ --auto-map-application auto-select best-match application
182
+ Output includes enrichmentRequired.diff with:
183
+ newRelationships — detected but not yet in graph
184
+ staleRelationships — in graph but absent from manifests
185
+ removedSubPackages — previously registered, no longer on disk
186
+ --json
187
+ nexarch update-entity
188
+ Update the name and/or description of an existing graph entity.
189
+ Use this after init-project to enrich the entity with meaningful
190
+ content from the project README or docs.
191
+ Options: --key <externalKey> (required)
192
+ --name <name>
193
+ --description <text>
194
+ --entity-type <code> (default: application)
195
+ --subtype <code>
196
+ --project-ref <project:ref> link an application to its registered source project
197
+ --icon <lucide-name> (convenience; sets attributes.application_icon)
198
+ --attributes-json '<json object>'
199
+ --attributes-file <path.json>
200
+ --json
201
+ nexarch add-relationship
202
+ Add relationships between existing graph entities (single or batch).
203
+ Single options: --from <externalKey>
204
+ --to <externalKey>
205
+ --type <code> (e.g. part_of, depends_on)
206
+ Batch options: --relationships-json '<json array>'
207
+ --relationships-file <path.json>
208
+ --json
209
+ nexarch register-alias
210
+ Register a company-scoped alias for an entity so future
211
+ scans resolve it instead of logging it as a candidate.
212
+ Use after enriching internal monorepo packages.
213
+ Options: --alias <value> (required, e.g. @scope/name)
214
+ --key <externalKey> (required)
215
+ --name <name> (required)
216
+ --entity-type <code> (required)
217
+ --subtype <code>
218
+ --description <text>
219
+ --json
220
+ nexarch resolve-names
221
+ Look up one or more raw names (package names, platform
222
+ names) against the global reference library and return
223
+ their canonical external keys. Useful for gap-check
224
+ results before calling add-relationship.
225
+ Options: --names <csv> (required, e.g. "vercel,neon")
226
+ --json
227
+ nexarch list-entities
228
+ List entities from the workspace graph.
229
+ Options: --type <entityTypeCode>
230
+ --status <status>
231
+ --query <text>
232
+ --limit <1-500>
233
+ --json
234
+ nexarch list-relationships
235
+ List relationships from the workspace graph.
236
+ Options: --type <relationshipTypeCode>
237
+ --status <status>
238
+ --from <fromExternalKey>
239
+ --to <toExternalKey>
240
+ --limit <1-500>
241
+ --json
242
+ nexarch register-runtime
243
+ Register or refresh runtime + optional application context
244
+ without performing check-in.
245
+ Options: --application-ref <entityRef>
246
+ --client <name>
247
+ --version <semver>
248
+ --json
249
+ nexarch check-in Preview pending application-target commands (no auto-claim)
250
+ and report draft/proposed applications needing review so the
251
+ agent can prompt the user to explore and instantiate them.
252
+ Use command-claim to explicitly claim a specific command.
253
+ Scope is resolved server-side from active company context.
254
+ Options: --agent-key <key> override stored agent key
255
+ --application-ref <entityRef> narrow preview scope
256
+ --json JSON output includes draftApplications[] and proposedApplications[]
257
+ nexarch proposals start
258
+ Start a new application workspace from a proposed NexArch app.
259
+ Lists proposed apps, shows policy review gates, writes a starter
260
+ project scaffold, and activates the proposal to active once
261
+ required policy controls are acknowledged.
262
+ Options: --id <applicationId>
263
+ --dir <path>
264
+ --reason <text>
265
+ --repo <url>
266
+ --skip-activate
267
+ --activate
268
+ --force
269
+ --non-interactive
270
+ --json
271
+ nexarch command-claim
272
+ Explicitly claim a pending command by ID.
273
+ Options: --id <commandId> (required)
274
+ --agent-key <key> override stored agent key
275
+ --application-ref <entityRef> required for application-target commands
276
+ --json
277
+ nexarch command-done
278
+ Mark a claimed command as completed.
279
+ Options: --id <commandId> (required)
280
+ --summary <text> short summary of what was done
281
+ --summary-file <path.md|txt>
282
+ --json
283
+ nexarch command-fail
284
+ Mark a claimed command as failed.
285
+ Options: --id <commandId> (required)
286
+ --error <message> (required)
287
+ --json
288
+ nexarch policy-controls
289
+ Fetch policy controls/rules assigned to an entity (for policy audits).
290
+ Options: --entity <externalKey> (required, e.g. application:bad-driving)
291
+ --json
292
+ nexarch policy-audit-template
293
+ Generate a findings JSON template from policy controls/rules for an entity.
294
+ Options: --entity <externalKey> (required)
295
+ --control-id <uuid> (repeatable; optional filter)
296
+ --default-result <pass|partial|fail> (default: fail)
297
+ --output <path.json>
298
+ --json
299
+ nexarch policy-audit-submit
300
+ Submit structured policy findings (writes policy_audit_finding rows).
301
+ Options: --command-id <id> (required)
302
+ --application-key <key> (required)
303
+ --agent-key <key> (optional; defaults from identity)
304
+ --finding <controlId|ruleId|result|rationale|missing1;missing2> (repeatable)
305
+ --findings-json <json-array>
306
+ --findings-file <path.json>
307
+ --json
308
+ nexarch policy-audit-results
309
+ Retrieve stored results of previous policy audits for an application.
310
+ Options: --entity <applicationEntityRef> (required)
311
+ --limit <1-10> (default 1)
312
+ --json
313
+ nexarch applied-policies
314
+ List policy documents applied to this company account.
315
+ Options: --pack <packCode> filter to a specific pack
316
+ --markdown include full document markdown
317
+ --json
318
+ nexarch governance-summary
319
+ Print review queue, graph stats, and per-application policy
320
+ audit rollup (latest run status, pass/partial/fail counts).
321
+ Options: --json
321
322
  `);
322
323
  if (updateCheck)
323
324
  await printUpdateNoticeIfReady(updateCheck);
@@ -30,8 +30,18 @@ repository; the graph knows all of them.
30
30
 
31
31
  - \`nexarch_upsert_entities\` for what you created; \`nexarch_upsert_relationships\`
32
32
  to wire dependencies (\`part_of\`, \`depends_on\`, \`runs_on\`).
33
+ - An \`application_function\` describes what its owning application does: link it
34
+ **only** with \`application_function -> part_of -> application\`. Do not model
35
+ service or runtime dependencies from a function. Use an \`application\` or
36
+ \`application_component\` boundary, then link that boundary with
37
+ \`depends_on\` or \`integrates_with\` as the evidence supports.
33
38
  - New applications arrive as **proposed** and wait for a human to activate them
34
39
  in the workspace — say so in your summary rather than calling them registered.
40
+ - Every new \`application\` needs an icon in the same upsert. Call
41
+ \`nexarch_search_icons\` with a concrete description, then set
42
+ \`attributes.application_icon\` to \`{ provider: "lucide", name: "<returned-name>" }\`.
43
+ If no specific icon fits, use \`app-window\`; do not leave an application
44
+ without an icon.
35
45
  - Unsure whether something belongs in the graph? \`nexarch_emit_observations\`
36
46
  is non-blocking and carries no schema commitment.
37
47
 
@@ -141,10 +151,13 @@ you're about to do the three steps below in the same turn — a claimed
141
151
  command that's never executed or closed out sits there looking done while
142
152
  blocking that queue slot, which is worse than never having claimed it.
143
153
 
144
- 1. Only claim a specific command with \`nexarch_claim_command_by_id\` when the
145
- human explicitly wants it worked — check-in surfacing a command is not
146
- itself permission to claim it, and neither is check-in itself: claiming
147
- is a separate, deliberate call you make because you're about to act.
154
+ 1. Assess each command using your judgement: scope, evidence, permissions,
155
+ reversibility, and risk. Check-in is only a preview and must never claim
156
+ work automatically. Explicitly claim a specific command with
157
+ \`nexarch_claim_command_by_id\` when it is safe, clearly in scope, and you
158
+ can execute and close it in this session. Ask the human when the requested
159
+ work is ambiguous, consequential, destructive, external, or beyond your
160
+ authority.
148
161
  2. **Execute \`command.resolved_playbook_text\` from the claim response** —
149
162
  that field is the actual task. \`command.instructions\` is a different
150
163
  field and is almost always \`null\`; don't mistake its emptiness for "no
package/package.json CHANGED
@@ -1,39 +1,39 @@
1
- {
2
- "name": "nexarch",
3
- "version": "0.12.39",
4
- "description": "Your architecture workspace for AI delivery.",
5
- "keywords": [
6
- "nexarch",
7
- "mcp",
8
- "architecture",
9
- "ai"
10
- ],
11
- "license": "MIT",
12
- "author": "Nexarch <hello@nexarch.ai>",
13
- "homepage": "https://nexarch.ai",
14
- "engines": {
15
- "node": ">=18"
16
- },
17
- "type": "module",
18
- "bin": {
19
- "nexarch": "dist/index.js"
20
- },
21
- "files": [
22
- "dist"
23
- ],
24
- "scripts": {
25
- "build": "tsc",
26
- "prepublishOnly": "tsc",
27
- "dev": "tsx src/index.ts",
28
- "typecheck": "tsc --noEmit",
29
- "test": "tsx scripts/test-mcp-proxy-response.ts"
30
- },
31
- "devDependencies": {
32
- "@types/node": "^22",
33
- "tsx": "^4",
34
- "typescript": "^5"
35
- },
36
- "dependencies": {
37
- "yaml": "^2.9.0"
38
- }
39
- }
1
+ {
2
+ "name": "nexarch",
3
+ "version": "0.12.44",
4
+ "description": "Your architecture workspace for AI delivery.",
5
+ "keywords": [
6
+ "nexarch",
7
+ "mcp",
8
+ "architecture",
9
+ "ai"
10
+ ],
11
+ "license": "MIT",
12
+ "author": "Nexarch <hello@nexarch.ai>",
13
+ "homepage": "https://nexarch.ai",
14
+ "engines": {
15
+ "node": ">=18"
16
+ },
17
+ "type": "module",
18
+ "bin": {
19
+ "nexarch": "dist/index.js"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "scripts": {
25
+ "build": "tsc",
26
+ "prepublishOnly": "tsc",
27
+ "dev": "tsx src/index.ts",
28
+ "typecheck": "tsc --noEmit",
29
+ "test": "tsx scripts/test-mcp-proxy-response.ts"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^22",
33
+ "tsx": "^4",
34
+ "typescript": "^5"
35
+ },
36
+ "dependencies": {
37
+ "yaml": "^2.9.0"
38
+ }
39
+ }