nexarch 0.12.36 → 0.12.41
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/add-relationship.js +15 -1
- package/dist/commands/agent-identify.js +2 -1
- package/dist/commands/init-agent.js +2 -1
- package/dist/commands/update-entity.js +18 -2
- package/dist/index.js +222 -221
- package/dist/lib/mcp.js +22 -5
- package/package.json +39 -39
|
@@ -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:
|
|
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);
|
|
@@ -4,6 +4,7 @@ import { homedir } from "os";
|
|
|
4
4
|
import { join } from "path";
|
|
5
5
|
import { requireCredentials } from "../lib/credentials.js";
|
|
6
6
|
import { callMcpTool, mcpInitialize, mcpListTools } from "../lib/mcp.js";
|
|
7
|
+
import { cliVersion } from "../lib/version.js";
|
|
7
8
|
function parseFlag(args, flag) {
|
|
8
9
|
return args.includes(flag);
|
|
9
10
|
}
|
|
@@ -60,7 +61,7 @@ export async function agentIdentify(args) {
|
|
|
60
61
|
const client = parseOptionValue(args, "--client");
|
|
61
62
|
const sessionId = parseOptionValue(args, "--session-id");
|
|
62
63
|
const framework = parseOptionValue(args, "--framework");
|
|
63
|
-
const toolVersion = parseOptionValue(args, "--tool-version");
|
|
64
|
+
const toolVersion = parseOptionValue(args, "--tool-version") ?? cliVersion();
|
|
64
65
|
const capabilities = parseCsv(parseOptionValue(args, "--capabilities"));
|
|
65
66
|
const notes = parseOptionValue(args, "--notes");
|
|
66
67
|
if (!provider || !model || !client) {
|
|
@@ -8,6 +8,7 @@ import { requireCredentials } from "../lib/credentials.js";
|
|
|
8
8
|
import { fetchAgentRegistryOrThrow } from "../lib/agent-registry.js";
|
|
9
9
|
import { callMcpTool, mcpInitialize, mcpListTools } from "../lib/mcp.js";
|
|
10
10
|
import { buildVersionAttributes } from "../lib/version-normalization.js";
|
|
11
|
+
import { cliVersion } from "../lib/version.js";
|
|
11
12
|
import { requestTrustAttestation, TRUST_ATTESTATION_SCOPE } from "../lib/trust.js";
|
|
12
13
|
const CLI_VERSION = (() => {
|
|
13
14
|
try {
|
|
@@ -684,7 +685,7 @@ export async function initAgent(args) {
|
|
|
684
685
|
const clientArg = parseOptionValue(args, "--client");
|
|
685
686
|
const frameworkArg = parseOptionValue(args, "--framework");
|
|
686
687
|
const sessionIdArg = parseOptionValue(args, "--session-id");
|
|
687
|
-
const toolVersionArg = parseOptionValue(args, "--tool-version");
|
|
688
|
+
const toolVersionArg = parseOptionValue(args, "--tool-version") ?? cliVersion();
|
|
688
689
|
const capabilitiesArg = parseCsv(parseOptionValue(args, "--capabilities"));
|
|
689
690
|
const notesArg = parseOptionValue(args, "--notes");
|
|
690
691
|
const agentId = explicitAgentId ?? getDefaultAgentId();
|
|
@@ -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
|
-
|
|
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:
|
|
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
|
-
--
|
|
197
|
-
--
|
|
198
|
-
--attributes-
|
|
199
|
-
--json
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
--
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
--
|
|
215
|
-
--
|
|
216
|
-
--
|
|
217
|
-
--
|
|
218
|
-
--
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
--
|
|
231
|
-
--
|
|
232
|
-
--
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
--
|
|
238
|
-
--
|
|
239
|
-
--
|
|
240
|
-
--
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
--
|
|
247
|
-
--
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
--
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
--
|
|
264
|
-
--
|
|
265
|
-
--
|
|
266
|
-
--activate
|
|
267
|
-
--
|
|
268
|
-
--
|
|
269
|
-
--
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
--
|
|
275
|
-
--
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
--summary
|
|
281
|
-
--
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
--
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
--
|
|
296
|
-
--
|
|
297
|
-
--json
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
--
|
|
303
|
-
--
|
|
304
|
-
--
|
|
305
|
-
--findings-
|
|
306
|
-
--json
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
--
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
--
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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);
|
package/dist/lib/mcp.js
CHANGED
|
@@ -51,12 +51,29 @@ async function requestOnce(method, params, options) {
|
|
|
51
51
|
const raw = Buffer.concat(chunks).toString("utf-8");
|
|
52
52
|
const json = JSON.parse(raw);
|
|
53
53
|
if (json.error) {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
typeof json.error.data.detail === "string"
|
|
58
|
-
? json.error.data.detail
|
|
54
|
+
const errData = json.error.data;
|
|
55
|
+
const explicitDetail = errData && typeof errData === "object" && "detail" in errData && typeof errData.detail === "string"
|
|
56
|
+
? errData.detail
|
|
59
57
|
: null;
|
|
58
|
+
// INVALID_TOOL_ARGUMENTS carries Zod detail — without this,
|
|
59
|
+
// every schema violation surfaced as the bare, undiagnosable
|
|
60
|
+
// "Invalid tool arguments" and nothing else, e.g. a missing
|
|
61
|
+
// required entity field on a create looked identical to an
|
|
62
|
+
// unrelated request shape mistake. Prefer `issues` (full dotted
|
|
63
|
+
// path per error, e.g. "entities.0.name: Required") over the
|
|
64
|
+
// older `fieldErrors` shape, which collapses a nested path down
|
|
65
|
+
// to just its top-level key and loses which field/index failed.
|
|
66
|
+
const zodDetail = !explicitDetail && errData && typeof errData === "object" && "issues" in errData
|
|
67
|
+
? errData.issues
|
|
68
|
+
.map(({ path, message }) => (path ? `${path}: ${message}` : message))
|
|
69
|
+
.join("; ") || null
|
|
70
|
+
: !explicitDetail && errData && typeof errData === "object" && "fieldErrors" in errData
|
|
71
|
+
? Object.entries(errData.fieldErrors)
|
|
72
|
+
.filter(([, messages]) => Array.isArray(messages) && messages.length > 0)
|
|
73
|
+
.map(([field, messages]) => `${field}: ${messages.join(", ")}`)
|
|
74
|
+
.join("; ") || null
|
|
75
|
+
: null;
|
|
76
|
+
const detail = explicitDetail ?? zodDetail;
|
|
60
77
|
reject(new Error(detail ? `${json.error.message} (${detail})` : json.error.message));
|
|
61
78
|
}
|
|
62
79
|
else if (json.result !== undefined) {
|
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "nexarch",
|
|
3
|
-
"version": "0.12.
|
|
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.41",
|
|
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
|
+
}
|