nexarch 0.5.4 → 0.5.5
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/init-agent.js +18 -10
- package/dist/commands/init-project.js +13 -2
- package/dist/commands/setup.js +12 -0
- package/dist/lib/mcp.js +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import process from "process";
|
|
|
5
5
|
import { requireCredentials } from "../lib/credentials.js";
|
|
6
6
|
import { fetchAgentRegistryOrThrow } from "../lib/agent-registry.js";
|
|
7
7
|
import { callMcpTool, mcpInitialize, mcpListTools } from "../lib/mcp.js";
|
|
8
|
-
const CLI_VERSION = "0.5.
|
|
8
|
+
const CLI_VERSION = "0.5.5";
|
|
9
9
|
const AGENT_ENTITY_TYPE = "agent";
|
|
10
10
|
const TECH_COMPONENT_ENTITY_TYPE = "technology_component";
|
|
11
11
|
function parseFlag(args, flag) {
|
|
@@ -300,6 +300,7 @@ export async function initAgent(args) {
|
|
|
300
300
|
const toolNames = new Set(tools.map((t) => t.name));
|
|
301
301
|
const required = [
|
|
302
302
|
"nexarch_get_agent_registry",
|
|
303
|
+
"nexarch_get_company_onboarding",
|
|
303
304
|
"nexarch_get_applied_policies",
|
|
304
305
|
"nexarch_get_ingest_contract",
|
|
305
306
|
"nexarch_upsert_entities",
|
|
@@ -312,25 +313,32 @@ export async function initAgent(args) {
|
|
|
312
313
|
ok: missing.length === 0,
|
|
313
314
|
detail: missing.length ? `missing: ${missing.join(", ")}` : `required tools present (${required.length})`,
|
|
314
315
|
});
|
|
315
|
-
const
|
|
316
|
-
const
|
|
317
|
-
const onboardingReady =
|
|
316
|
+
const onboardingRaw = await callMcpTool("nexarch_get_company_onboarding", {}, { companyId: selectedCompanyId });
|
|
317
|
+
const onboarding = parseToolText(onboardingRaw);
|
|
318
|
+
const onboardingReady = onboarding.isComplete === true;
|
|
318
319
|
checks.push({
|
|
319
|
-
name: "
|
|
320
|
+
name: "company.onboarding",
|
|
320
321
|
ok: onboardingReady,
|
|
321
|
-
detail:
|
|
322
|
-
? `policyBundleHash=${policies.policyBundleHash.slice(0, 12)}…`
|
|
323
|
-
: "missing policyBundleHash",
|
|
322
|
+
detail: `status=${onboarding.onboardingStatus ?? "unknown"}`,
|
|
324
323
|
});
|
|
325
324
|
if (!onboardingReady) {
|
|
326
|
-
const onboardingMessage = "Company onboarding is incomplete
|
|
325
|
+
const onboardingMessage = "Company onboarding is incomplete. Complete onboarding before running init-agent or init-project.";
|
|
327
326
|
if (asJson) {
|
|
328
|
-
process.stdout.write(`${JSON.stringify({ ok: false, error: "COMPANY_ONBOARDING_INCOMPLETE", message: onboardingMessage }, null, 2)}\n`);
|
|
327
|
+
process.stdout.write(`${JSON.stringify({ ok: false, error: "COMPANY_ONBOARDING_INCOMPLETE", message: onboardingMessage, onboardingStatus: onboarding.onboardingStatus ?? null }, null, 2)}\n`);
|
|
329
328
|
process.exitCode = 1;
|
|
330
329
|
return;
|
|
331
330
|
}
|
|
332
331
|
throw new Error(onboardingMessage);
|
|
333
332
|
}
|
|
333
|
+
const policiesRaw = await callMcpTool("nexarch_get_applied_policies", {}, { companyId: selectedCompanyId });
|
|
334
|
+
const policies = parseToolText(policiesRaw);
|
|
335
|
+
checks.push({
|
|
336
|
+
name: "governance.bootstrap",
|
|
337
|
+
ok: Boolean(policies.policyBundleHash),
|
|
338
|
+
detail: policies.policyBundleHash
|
|
339
|
+
? `policyBundleHash=${policies.policyBundleHash.slice(0, 12)}…`
|
|
340
|
+
: "missing policyBundleHash",
|
|
341
|
+
});
|
|
334
342
|
const contractRaw = await callMcpTool("nexarch_get_ingest_contract", {}, { companyId: selectedCompanyId });
|
|
335
343
|
const contract = parseToolText(contractRaw);
|
|
336
344
|
checks.push({
|
|
@@ -812,14 +812,25 @@ export async function initProject(args) {
|
|
|
812
812
|
process.stdout.write(`${JSON.stringify(output, null, 2)}\n`);
|
|
813
813
|
return;
|
|
814
814
|
}
|
|
815
|
+
const onboardingRaw = await callMcpTool("nexarch_get_company_onboarding", {}, mcpOpts);
|
|
816
|
+
const onboarding = parseToolText(onboardingRaw);
|
|
817
|
+
if (onboarding.isComplete !== true) {
|
|
818
|
+
const message = "Company onboarding is incomplete. Complete onboarding before running init-project.";
|
|
819
|
+
if (asJson) {
|
|
820
|
+
process.stdout.write(`${JSON.stringify({ ok: false, error: "COMPANY_ONBOARDING_INCOMPLETE", message, onboardingStatus: onboarding.onboardingStatus ?? null }, null, 2)}\n`);
|
|
821
|
+
process.exitCode = 1;
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
throw new Error(message);
|
|
825
|
+
}
|
|
815
826
|
// Policy bootstrap
|
|
816
827
|
const policiesRaw = await callMcpTool("nexarch_get_applied_policies", {}, mcpOpts);
|
|
817
828
|
const policies = parseToolText(policiesRaw);
|
|
818
829
|
const policyBundleHash = policies.policyBundleHash ?? null;
|
|
819
830
|
if (!policyBundleHash) {
|
|
820
|
-
const message = "
|
|
831
|
+
const message = "Policy bootstrap is missing for this company. Re-run onboarding setup before init-project.";
|
|
821
832
|
if (asJson) {
|
|
822
|
-
process.stdout.write(`${JSON.stringify({ ok: false, error: "
|
|
833
|
+
process.stdout.write(`${JSON.stringify({ ok: false, error: "POLICY_BOOTSTRAP_MISSING", message }, null, 2)}\n`);
|
|
823
834
|
process.exitCode = 1;
|
|
824
835
|
return;
|
|
825
836
|
}
|
package/dist/commands/setup.js
CHANGED
|
@@ -3,6 +3,11 @@ import { detectClientsFromRegistry, writeClientConfig, nexarchServerBlockFromReg
|
|
|
3
3
|
import { fetchAgentRegistryOrThrow } from "../lib/agent-registry.js";
|
|
4
4
|
import { initAgent } from "./init-agent.js";
|
|
5
5
|
import { login } from "./login.js";
|
|
6
|
+
import { callMcpTool } from "../lib/mcp.js";
|
|
7
|
+
function parseToolText(result) {
|
|
8
|
+
const text = result.content?.[0]?.text ?? "{}";
|
|
9
|
+
return JSON.parse(text);
|
|
10
|
+
}
|
|
6
11
|
export async function setup(args) {
|
|
7
12
|
try {
|
|
8
13
|
requireCredentials();
|
|
@@ -12,6 +17,13 @@ export async function setup(args) {
|
|
|
12
17
|
await login(args);
|
|
13
18
|
}
|
|
14
19
|
requireCredentials(); // ensure login succeeded before continuing
|
|
20
|
+
const creds = requireCredentials();
|
|
21
|
+
// Block setup until onboarding is complete for the selected company.
|
|
22
|
+
const onboardingRaw = await callMcpTool("nexarch_get_company_onboarding", {}, { companyId: creds.companyId });
|
|
23
|
+
const onboarding = parseToolText(onboardingRaw);
|
|
24
|
+
if (onboarding.isComplete !== true) {
|
|
25
|
+
throw new Error(`Company onboarding is incomplete (status=${onboarding.onboardingStatus ?? "unknown"}). Complete onboarding before running nexarch setup.`);
|
|
26
|
+
}
|
|
15
27
|
let registry;
|
|
16
28
|
try {
|
|
17
29
|
registry = await fetchAgentRegistryOrThrow();
|
package/dist/lib/mcp.js
CHANGED
|
@@ -68,7 +68,7 @@ export async function mcpInitialize(options = {}) {
|
|
|
68
68
|
return callMcpRpc("initialize", {
|
|
69
69
|
protocolVersion: "2024-11-05",
|
|
70
70
|
capabilities: {},
|
|
71
|
-
clientInfo: { name: "nexarch-cli", version: "0.5.
|
|
71
|
+
clientInfo: { name: "nexarch-cli", version: "0.5.5" },
|
|
72
72
|
}, options);
|
|
73
73
|
}
|
|
74
74
|
export async function mcpListTools(options = {}) {
|