nexarch 0.5.8 → 0.5.10
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 +38 -15
- package/dist/commands/setup.js +1 -0
- package/dist/lib/mcp.js +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ 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
8
|
import { buildVersionAttributes } from "../lib/version-normalization.js";
|
|
9
|
-
const CLI_VERSION = "0.5.
|
|
9
|
+
const CLI_VERSION = "0.5.10";
|
|
10
10
|
const AGENT_ENTITY_TYPE = "agent";
|
|
11
11
|
const TECH_COMPONENT_ENTITY_TYPE = "technology_component";
|
|
12
12
|
function parseFlag(args, flag) {
|
|
@@ -251,11 +251,13 @@ function injectGenericAgentConfig(registry) {
|
|
|
251
251
|
if (!template)
|
|
252
252
|
continue;
|
|
253
253
|
const filePath = join(process.cwd(), target.filePathPattern);
|
|
254
|
-
if (!existsSync(filePath))
|
|
255
|
-
continue;
|
|
256
|
-
const existing = readFileSync(filePath, "utf8");
|
|
257
254
|
const sectionBody = template.body.trim();
|
|
258
255
|
const sectionHeading = target.sectionHeading ?? "## Nexarch Agent Registration";
|
|
256
|
+
if (!existsSync(filePath)) {
|
|
257
|
+
writeFileSync(filePath, `${sectionBody}\n`, "utf8");
|
|
258
|
+
return [{ path: filePath, status: "injected" }];
|
|
259
|
+
}
|
|
260
|
+
const existing = readFileSync(filePath, "utf8");
|
|
259
261
|
if (target.insertionMode === "replace_section") {
|
|
260
262
|
const replaced = replaceInjectedSection(existing, sectionHeading, sectionBody);
|
|
261
263
|
if (replaced !== existing) {
|
|
@@ -267,7 +269,25 @@ function injectGenericAgentConfig(registry) {
|
|
|
267
269
|
writeFileSync(filePath, existing + separator + sectionBody + "\n", "utf8");
|
|
268
270
|
return [{ path: filePath, status: "injected" }];
|
|
269
271
|
}
|
|
270
|
-
|
|
272
|
+
const fallbackTemplate = templateByCode.get("nexarch_agent_registration_v1") ?? registry.instructionTemplates[0];
|
|
273
|
+
if (!fallbackTemplate)
|
|
274
|
+
return [];
|
|
275
|
+
const fallbackPath = join(process.cwd(), "AGENTS.md");
|
|
276
|
+
const sectionBody = fallbackTemplate.body.trim();
|
|
277
|
+
if (!existsSync(fallbackPath)) {
|
|
278
|
+
writeFileSync(fallbackPath, `${sectionBody}\n`, "utf8");
|
|
279
|
+
return [{ path: fallbackPath, status: "injected" }];
|
|
280
|
+
}
|
|
281
|
+
const existing = readFileSync(fallbackPath, "utf8");
|
|
282
|
+
const sectionHeading = "## Nexarch Agent Registration";
|
|
283
|
+
const replaced = replaceInjectedSection(existing, sectionHeading, sectionBody);
|
|
284
|
+
if (replaced !== existing) {
|
|
285
|
+
writeFileSync(fallbackPath, replaced, "utf8");
|
|
286
|
+
return [{ path: fallbackPath, status: "updated" }];
|
|
287
|
+
}
|
|
288
|
+
const separator = existing.endsWith("\n") ? "" : "\n";
|
|
289
|
+
writeFileSync(fallbackPath, existing + separator + sectionBody + "\n", "utf8");
|
|
290
|
+
return [{ path: fallbackPath, status: "injected" }];
|
|
271
291
|
}
|
|
272
292
|
export async function initAgent(args) {
|
|
273
293
|
const asJson = parseFlag(args, "--json");
|
|
@@ -751,6 +771,15 @@ export async function initAgent(args) {
|
|
|
751
771
|
ok: registration.ok,
|
|
752
772
|
detail: registration.detail,
|
|
753
773
|
});
|
|
774
|
+
checks.push({
|
|
775
|
+
name: "agent.instructions.injection",
|
|
776
|
+
ok: !registration.ok || agentConfigResults.length > 0,
|
|
777
|
+
detail: !registration.ok
|
|
778
|
+
? "skipped (registration failed)"
|
|
779
|
+
: agentConfigResults.length > 0
|
|
780
|
+
? `updated ${agentConfigResults.length} instruction target file(s)`
|
|
781
|
+
: "no runtime instruction target matched this repository (non-fatal; create AGENTS.md/CLAUDE.md or configure a generic target)",
|
|
782
|
+
});
|
|
754
783
|
checks.push({
|
|
755
784
|
name: "technology.components",
|
|
756
785
|
ok: techComponents.ok,
|
|
@@ -846,17 +875,11 @@ export async function initAgent(args) {
|
|
|
846
875
|
}
|
|
847
876
|
}
|
|
848
877
|
const hasInjectedAgentInstructions = agentConfigResults.some((r) => r.status === "injected" || r.status === "updated");
|
|
878
|
+
console.log("\n➡ Next step (required): complete agent identity in your coding agent");
|
|
879
|
+
console.log(" Paste this and fill in real values:");
|
|
880
|
+
console.log(`\nrun npx nexarch@latest agent identify --agent-id \"${agentId}\" --provider \"<provider>\" --model \"<model>\" --client \"<client>\" --framework \"<openclaw|n8n|m365-agent-framework|other>\" --tool-version \"<tool-version>\" --capabilities \"<capability1,capability2>\" --json\n`);
|
|
849
881
|
if (hasInjectedAgentInstructions) {
|
|
850
|
-
|
|
851
|
-
console.log("\n➡ Next step: in your coding agent, run:");
|
|
852
|
-
console.log("\nrun npx nexarch@latest init-agent\n");
|
|
853
|
-
console.log(" (Registration instructions were already written into your agent config file.)");
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
else {
|
|
857
|
-
console.log("\n➡ Next step (required): complete agent identity in your coding agent");
|
|
858
|
-
console.log(" Paste this and fill in real values:");
|
|
859
|
-
console.log(`\nrun npx nexarch@latest agent identify --agent-id \"${agentId}\" --provider \"<provider>\" --model \"<model>\" --client \"<client>\" --framework \"<openclaw|n8n|m365-agent-framework|other>\" --tool-version \"<tool-version>\" --capabilities \"<capability1,capability2>\" --json\n`);
|
|
882
|
+
console.log(" (Registration instructions were already written into your agent config file.)");
|
|
860
883
|
}
|
|
861
884
|
if (!fromSetup && appDetection.detected) {
|
|
862
885
|
console.log("\n➡ Optional next step: likely application detected in current directory.");
|
package/dist/commands/setup.js
CHANGED
|
@@ -64,4 +64,5 @@ export async function setup(args) {
|
|
|
64
64
|
initAgentArgs.push("--from-setup");
|
|
65
65
|
await initAgent(initAgentArgs);
|
|
66
66
|
console.log("\nSetup complete: MCP client config + agent registration are now in place.");
|
|
67
|
+
console.log("\n➡ Next step: in your coding agent, run:\n\nrun npx nexarch@latest init-agent");
|
|
67
68
|
}
|
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.10" },
|
|
72
72
|
}, options);
|
|
73
73
|
}
|
|
74
74
|
export async function mcpListTools(options = {}) {
|