nexarch 0.1.12 → 0.1.13
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 +34 -23
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { join } from "path";
|
|
|
4
4
|
import process from "process";
|
|
5
5
|
import { requireCredentials } from "../lib/credentials.js";
|
|
6
6
|
import { callMcpTool, mcpInitialize, mcpListTools } from "../lib/mcp.js";
|
|
7
|
-
const CLI_VERSION = "0.1.
|
|
7
|
+
const CLI_VERSION = "0.1.13";
|
|
8
8
|
const AGENT_ENTITY_TYPE = "agent";
|
|
9
9
|
const TECH_COMPONENT_ENTITY_TYPE = "technology_component";
|
|
10
10
|
function parseFlag(args, flag) {
|
|
@@ -93,14 +93,14 @@ function writeAgentBootstrap(params) {
|
|
|
93
93
|
mkdirSync(dir, { recursive: true });
|
|
94
94
|
const filePath = join(dir, "agent-bootstrap.md");
|
|
95
95
|
const identifyCmd = [
|
|
96
|
-
`nexarch agent identify`,
|
|
96
|
+
`npx nexarch agent identify`,
|
|
97
97
|
`--agent-id "${params.agentId}"`,
|
|
98
98
|
`--provider "<anthropic|openai|google|other>"`,
|
|
99
99
|
`--model "<model-id e.g. claude-sonnet-4-6>"`,
|
|
100
100
|
`--client "<claude-code|cursor|copilot|other>"`,
|
|
101
101
|
`--framework "<openclaw|n8n|m365-agent-framework|other>"`,
|
|
102
102
|
`--session-id "<your current session id if known, otherwise omit>"`,
|
|
103
|
-
`--tool-version "<
|
|
103
|
+
`--tool-version "<run claude --version to get this, e.g. 1.2.3>"`,
|
|
104
104
|
`--capabilities "<comma,separated,capabilities>"`,
|
|
105
105
|
`--json`,
|
|
106
106
|
].join(" \\\n ");
|
|
@@ -135,7 +135,7 @@ Fill in:
|
|
|
135
135
|
- **client** — the tool you are running inside (e.g. \`claude-code\`)
|
|
136
136
|
- **framework** — the agent framework in use (e.g. \`openclaw\`)
|
|
137
137
|
- **session-id** — your current session ID if available
|
|
138
|
-
- **tool-version** —
|
|
138
|
+
- **tool-version** — the version of the client tool you are running inside; run \`claude --version\` (or equivalent) to get it and use the version number only (e.g. \`1.2.3\`)
|
|
139
139
|
- **capabilities** — comma-separated list of your capabilities (e.g. \`code,files,bash,web\`)
|
|
140
140
|
|
|
141
141
|
Omit any flag whose value you genuinely do not know rather than guessing.
|
|
@@ -149,21 +149,30 @@ const CLAUDE_MD_SECTION_MARKER = "## Nexarch Agent Registration";
|
|
|
149
149
|
const CLAUDE_MD_SECTION = `
|
|
150
150
|
## Nexarch Agent Registration
|
|
151
151
|
|
|
152
|
-
When a human has run \`nexarch login\` and \`nexarch init-agent\`, they will tell you to run \`nexarch agent prompt\`. Do so, read the output, and follow the instructions — it contains a pre-filled \`nexarch agent identify\` command for you to complete with your own provider, model, client, and capability values, then execute. Confirm \`"ok": true\` in the JSON output.
|
|
152
|
+
When a human has run \`nexarch login\` and \`nexarch init-agent\`, they will tell you to run \`npx nexarch agent prompt\`. Do so, read the output, and follow the instructions — it contains a pre-filled \`npx nexarch agent identify\` command for you to complete with your own provider, model, client, and capability values, then execute. Confirm \`"ok": true\` in the JSON output.
|
|
153
153
|
`;
|
|
154
|
-
function
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
154
|
+
function injectAgentConfigs() {
|
|
155
|
+
const candidateNames = [
|
|
156
|
+
"CLAUDE.md", "claude.md", "Claude.md", // Claude Code
|
|
157
|
+
"AGENTS.md", "agents.md", // OpenAI Codex CLI
|
|
158
|
+
".github/copilot-instructions.md", // GitHub Copilot
|
|
159
|
+
".cursorrules", // Cursor (legacy)
|
|
160
|
+
];
|
|
161
|
+
const results = [];
|
|
162
|
+
for (const name of candidateNames) {
|
|
163
|
+
const filePath = join(process.cwd(), name);
|
|
164
|
+
if (!existsSync(filePath))
|
|
165
|
+
continue;
|
|
166
|
+
const existing = readFileSync(filePath, "utf8");
|
|
167
|
+
if (existing.includes(CLAUDE_MD_SECTION_MARKER)) {
|
|
168
|
+
results.push({ path: filePath, status: "already_present" });
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
const separator = existing.endsWith("\n") ? "" : "\n";
|
|
172
|
+
writeFileSync(filePath, existing + separator + CLAUDE_MD_SECTION, "utf8");
|
|
173
|
+
results.push({ path: filePath, status: "injected" });
|
|
163
174
|
}
|
|
164
|
-
|
|
165
|
-
writeFileSync(filePath, existing + separator + CLAUDE_MD_SECTION, "utf8");
|
|
166
|
-
return { path: filePath, status: "injected" };
|
|
175
|
+
return results;
|
|
167
176
|
}
|
|
168
177
|
export async function initAgent(args) {
|
|
169
178
|
const asJson = parseFlag(args, "--json");
|
|
@@ -561,7 +570,7 @@ export async function initAgent(args) {
|
|
|
561
570
|
}
|
|
562
571
|
}
|
|
563
572
|
let bootstrapFilePath = null;
|
|
564
|
-
let
|
|
573
|
+
let agentConfigResults = [];
|
|
565
574
|
if (registration.ok) {
|
|
566
575
|
try {
|
|
567
576
|
bootstrapFilePath = writeAgentBootstrap({
|
|
@@ -577,7 +586,7 @@ export async function initAgent(args) {
|
|
|
577
586
|
// non-fatal
|
|
578
587
|
}
|
|
579
588
|
try {
|
|
580
|
-
|
|
589
|
+
agentConfigResults = injectAgentConfigs();
|
|
581
590
|
}
|
|
582
591
|
catch {
|
|
583
592
|
// non-fatal
|
|
@@ -642,7 +651,7 @@ export async function initAgent(args) {
|
|
|
642
651
|
},
|
|
643
652
|
companyId: creds.companyId,
|
|
644
653
|
bootstrapFile: bootstrapFilePath,
|
|
645
|
-
|
|
654
|
+
agentConfigs: agentConfigResults,
|
|
646
655
|
};
|
|
647
656
|
process.stdout.write(`${JSON.stringify(output, null, 2)}\n`);
|
|
648
657
|
if (strict && !allPassed)
|
|
@@ -667,10 +676,12 @@ export async function initAgent(args) {
|
|
|
667
676
|
if (bootstrapFilePath) {
|
|
668
677
|
console.log(`\n📋 Bootstrap instructions written to: ${bootstrapFilePath}`);
|
|
669
678
|
}
|
|
670
|
-
|
|
671
|
-
|
|
679
|
+
for (const r of agentConfigResults) {
|
|
680
|
+
if (r.status === "injected") {
|
|
681
|
+
console.log(`📝 Nexarch registration instructions added to: ${r.path}`);
|
|
682
|
+
}
|
|
672
683
|
}
|
|
673
|
-
console.log("\n Tell Claude: \"run nexarch agent prompt and follow the instructions\"");
|
|
684
|
+
console.log("\n Tell Claude: \"run npx nexarch agent prompt and follow the instructions\"");
|
|
674
685
|
}
|
|
675
686
|
else {
|
|
676
687
|
console.log("⚠ Handshake/registration completed with issues.");
|
package/dist/index.js
CHANGED
|
@@ -60,7 +60,7 @@ Usage:
|
|
|
60
60
|
nexarch agent prompt
|
|
61
61
|
Print bootstrap instructions for a Claude Code agent to complete
|
|
62
62
|
its registration (written by init-agent). Tell Claude:
|
|
63
|
-
"run nexarch agent prompt and follow the instructions"
|
|
63
|
+
"run npx nexarch agent prompt and follow the instructions"
|
|
64
64
|
nexarch agent identify
|
|
65
65
|
Capture richer coding-agent identity metadata
|
|
66
66
|
Options: --agent-id <id> --provider <provider> --model <model>
|