@agenthead/cli 0.0.0-stage → 0.2.0
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/LICENSE +201 -0
- package/README.md +12 -2
- package/THIRD_PARTY_NOTICES.md +471 -0
- package/bin/agenthead.js +5 -0
- package/dist/agents-command.d.ts +2 -0
- package/dist/agents-command.js +12 -0
- package/dist/agents-command.js.map +1 -0
- package/dist/claude-code-skill.d.ts +6 -0
- package/dist/claude-code-skill.js +88 -0
- package/dist/claude-code-skill.js.map +1 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.js +199 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands.d.ts +9 -0
- package/dist/commands.js +298 -0
- package/dist/commands.js.map +1 -0
- package/dist/context.d.ts +48 -0
- package/dist/context.js +37 -0
- package/dist/context.js.map +1 -0
- package/dist/doctor-command.d.ts +66 -0
- package/dist/doctor-command.js +323 -0
- package/dist/doctor-command.js.map +1 -0
- package/dist/doctor-probes.d.ts +44 -0
- package/dist/doctor-probes.js +176 -0
- package/dist/doctor-probes.js.map +1 -0
- package/dist/doctor-process.d.ts +7 -0
- package/dist/doctor-process.js +149 -0
- package/dist/doctor-process.js.map +1 -0
- package/dist/graph-command.d.ts +4 -0
- package/dist/graph-command.js +88 -0
- package/dist/graph-command.js.map +1 -0
- package/dist/hook-command.d.ts +2 -0
- package/dist/hook-command.js +256 -0
- package/dist/hook-command.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/ledger-command.d.ts +2 -0
- package/dist/ledger-command.js +269 -0
- package/dist/ledger-command.js.map +1 -0
- package/dist/ledger.d.ts +19 -0
- package/dist/ledger.js +47 -0
- package/dist/ledger.js.map +1 -0
- package/dist/memory-command.d.ts +4 -0
- package/dist/memory-command.js +231 -0
- package/dist/memory-command.js.map +1 -0
- package/dist/pack-adapter.d.ts +14 -0
- package/dist/pack-adapter.js +39 -0
- package/dist/pack-adapter.js.map +1 -0
- package/dist/parallel-command.d.ts +2 -0
- package/dist/parallel-command.js +129 -0
- package/dist/parallel-command.js.map +1 -0
- package/dist/route-command.d.ts +2 -0
- package/dist/route-command.js +54 -0
- package/dist/route-command.js.map +1 -0
- package/dist/run-command.d.ts +6 -0
- package/dist/run-command.js +91 -0
- package/dist/run-command.js.map +1 -0
- package/dist/security-command.d.ts +2 -0
- package/dist/security-command.js +203 -0
- package/dist/security-command.js.map +1 -0
- package/dist/security-confirmation.d.ts +2 -0
- package/dist/security-confirmation.js +53 -0
- package/dist/security-confirmation.js.map +1 -0
- package/dist/setup-auto-command.d.ts +6 -0
- package/dist/setup-auto-command.js +113 -0
- package/dist/setup-auto-command.js.map +1 -0
- package/dist/setup-command.d.ts +25 -0
- package/dist/setup-command.js +398 -0
- package/dist/setup-command.js.map +1 -0
- package/dist/setup-guidance-hashes.d.ts +6 -0
- package/dist/setup-guidance-hashes.js +45 -0
- package/dist/setup-guidance-hashes.js.map +1 -0
- package/dist/setup-instructions.d.ts +5 -0
- package/dist/setup-instructions.js +76 -0
- package/dist/setup-instructions.js.map +1 -0
- package/dist/setup-toml.d.ts +4 -0
- package/dist/setup-toml.js +302 -0
- package/dist/setup-toml.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +55 -4
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Cumulative hashes of shipped guidance, including the current version.
|
|
2
|
+
// Historical skills include predecessor paths and merges; existing hashes are never dropped.
|
|
3
|
+
// Regenerate from a full checkout: node scripts/generate-setup-guidance-hashes.mjs
|
|
4
|
+
export const currentSkillHash = "1ba654ed67891267530f918671a97e9432308d06b486d51276f3bee8aeec04ea";
|
|
5
|
+
export const previousGuidanceHashes = {
|
|
6
|
+
skill: [
|
|
7
|
+
"0a24ecd49da850cd74dfbb2ffec5a492379a465ac73866026949f2081d796dde",
|
|
8
|
+
"1ba654ed67891267530f918671a97e9432308d06b486d51276f3bee8aeec04ea",
|
|
9
|
+
"320376c05a5ea2b2bf47b99854e19a1d3b34b41c420a0e512701369a0da5628c",
|
|
10
|
+
"475604071b236fee43c6712a949695fc4bb1e4550abf457597ab81dbed47b00f",
|
|
11
|
+
"8e85d0347d4c387f084d44d5666821306cf1faca7ec41aa3f93cdf2d7fd9f716",
|
|
12
|
+
"9cceb9a22a9dfb41397b9e7782b23c5741a4dbad7b382fc8c32cb454ad463eeb",
|
|
13
|
+
"a7225a24de6255985ac20128a64383260bec75d75056e564c0886bb38c6d5151",
|
|
14
|
+
"b6856d9cdbff303fcad59de9c2031dc0b045cb892be76853563debf6a5c7c16c",
|
|
15
|
+
"ef769c22eba0d3a648c488c2212a970ee801687a475142e8166299a595099acd",
|
|
16
|
+
"f87fb80d2c9b2767e46d692f97d8b788d8a1301ef1cacc6e41f575998fe2b1d4",
|
|
17
|
+
],
|
|
18
|
+
agentsSnippet: [
|
|
19
|
+
"0de9ce1e5c8f130b9ee7b3324a61c30e449a53b89f4ad1e437b2d26fdb86d495",
|
|
20
|
+
"376647300b122d4907aab57524308cfb43e67f20d265f5e8b28f78896fa5491e",
|
|
21
|
+
"3b61aa3ef45097651801dc72dbc9e5a426348560441ec813255da295f89e4c82",
|
|
22
|
+
"415f8d475dc1d54c85e78a4ab77c4d4644a9036e051b4890e7e7c04c7769e7d1",
|
|
23
|
+
"4519462406174411eefb9fb50a9942400ec531d73c9736957413143364c81400",
|
|
24
|
+
"5db5e34bb0fee5bb56638f80e04c412e2efef1932e6aa8bd78441905168c50e2",
|
|
25
|
+
"8bbbdd4c877669b2cd29de0ff9129c75f57bea8d099bd431374fa6fd768499de",
|
|
26
|
+
"8bf11f71ef9c8f36c35b19dc55fbf56a9aedb9e04b4f15046a6aaad583513eb6",
|
|
27
|
+
"d7588a13f97bc041e30c8d8ac1bfc969d394675b396e866fafd0813760df0b49",
|
|
28
|
+
"e4082725337ac4cb20759c784b7ab22167e775296a6083867d14192acee74aec",
|
|
29
|
+
"ef705e0523a3a1fe21611e041027108c7410dbe11a181ca0f735816a9ea9ec7b",
|
|
30
|
+
],
|
|
31
|
+
cursorRule: [
|
|
32
|
+
"02219418e259163b480b813cc27d44a351ac8db3dfddf953253941ede56416bf",
|
|
33
|
+
"363511c6183c7f43c9958ac047ef0eff46047875e347247b13513c40ffda4859",
|
|
34
|
+
"532f6378cc18eba2e3bd4b549102b8cf055a7a723102420571e64b9a73abe592",
|
|
35
|
+
"5f00658b6afc7858f22ba41a53fc921af162e365e010eaf2025d816618143f22",
|
|
36
|
+
"65e02550b2f93f77f4a0c3a0c723db77fabf7e99b1b650638d4e461e168ff286",
|
|
37
|
+
"80011032475bf2fa514231a37e63a645b42ab23d22c5b6a591ccf0a1c5988d46",
|
|
38
|
+
"818029f539af8e97e2dac1b8287324819787ccf19fb59d318ba8f4c6aae8bfe9",
|
|
39
|
+
"af2805cc243ad8868dbe93032f448ef18677a065fa58edfbee9e502706227692",
|
|
40
|
+
"bad06cc69219c2dee085e5e0d632252bca5532c5234427cee2f39720481baacb",
|
|
41
|
+
"ca07a8d12f462311fd0ac538e602297bd1372b3868fe734407f9fa1145afe96a",
|
|
42
|
+
"cd553bc97a776696922b1bb66fce1cd34e1825009b787ea51b88b44e1ab71d48",
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=setup-guidance-hashes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-guidance-hashes.js","sourceRoot":"","sources":["../src/setup-guidance-hashes.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,6FAA6F;AAC7F,mFAAmF;AACnF,MAAM,CAAC,MAAM,gBAAgB,GAC3B,kEAAkE,CAAC;AAErE,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,KAAK,EAAE;QACL,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;KACnE;IACD,aAAa,EAAE;QACb,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;KACnE;IACD,UAAU,EAAE;QACV,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;QAClE,kEAAkE;KACnE;CACF,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Decision } from "./setup-command.js";
|
|
2
|
+
export declare const agentsSnippet: string;
|
|
3
|
+
export declare const cursorRule: string;
|
|
4
|
+
/** Only the marked, unedited block is ours; everything around it stays verbatim. */
|
|
5
|
+
export declare function editAgents(before: string | undefined, remove: boolean): Decision | undefined;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { skill } from "./claude-code-skill.js";
|
|
3
|
+
import { CommandError } from "./context.js";
|
|
4
|
+
import { previousGuidanceHashes } from "./setup-guidance-hashes.js";
|
|
5
|
+
// Keep guidance aligned with the Claude Code skill, without client-specific
|
|
6
|
+
// tool prefixes or hooks that these clients do not install.
|
|
7
|
+
const guidance = skill
|
|
8
|
+
.slice(skill.indexOf("# AgentHead\n"))
|
|
9
|
+
.replace("Its tools are `mcp__agenthead__<tool>`.", "Use the tools from the MCP server named `agenthead`.")
|
|
10
|
+
.replace(" With the\n AgentHead hooks installed, complete Bash output is stored for you; output that\n Claude Code cut short is not.", " Store command output explicitly; this integration installs no hooks.")
|
|
11
|
+
.replace(" When the\n AgentHead stop hook names a task, record your change and checks under that id.", "");
|
|
12
|
+
const start = "<!-- agenthead:start -->";
|
|
13
|
+
const end = "<!-- agenthead:end -->";
|
|
14
|
+
export const agentsSnippet = `${start}\n${guidance}${end}\n`;
|
|
15
|
+
export const cursorRule = `---\ndescription: Use AgentHead for project context, code navigation, memory and verification\nalwaysApply: true\n---\n\n${guidance}`;
|
|
16
|
+
/** Only the marked, unedited block is ours; everything around it stays verbatim. */
|
|
17
|
+
export function editAgents(before, remove) {
|
|
18
|
+
if (before === undefined)
|
|
19
|
+
return remove
|
|
20
|
+
? undefined
|
|
21
|
+
: { write: agentsSnippet, created: agentsSnippet };
|
|
22
|
+
const starts = [...before.matchAll(/<!-- agenthead:start -->/g)];
|
|
23
|
+
const ends = [...before.matchAll(/<!-- agenthead:end -->/g)];
|
|
24
|
+
if (starts.length === 0 && ends.length === 0) {
|
|
25
|
+
return remove
|
|
26
|
+
? { leave: "unchanged" }
|
|
27
|
+
: {
|
|
28
|
+
write: before + (before.length ? "\n" : "") + agentsSnippet,
|
|
29
|
+
created: agentsSnippet,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const from = starts[0]?.index;
|
|
33
|
+
const to = ends[0]?.index;
|
|
34
|
+
if (starts.length !== 1 ||
|
|
35
|
+
ends.length !== 1 ||
|
|
36
|
+
from === undefined ||
|
|
37
|
+
to === undefined ||
|
|
38
|
+
from >= to ||
|
|
39
|
+
(from > 0 && before[from - 1] !== "\n") ||
|
|
40
|
+
(before[to + end.length] !== "\n" && to + end.length !== before.length)) {
|
|
41
|
+
throw new CommandError("AGENTS.md has ambiguous AgentHead markers; nothing was changed");
|
|
42
|
+
}
|
|
43
|
+
const block = before.slice(from, to + end.length + 1);
|
|
44
|
+
if (block !== agentsSnippet &&
|
|
45
|
+
!previousGuidanceHashes.agentsSnippet.includes(createHash("sha256").update(block).digest("hex"))) {
|
|
46
|
+
return {
|
|
47
|
+
leave: "kept",
|
|
48
|
+
note: remove
|
|
49
|
+
? "its AgentHead block has local changes; delete the block manually to remove it"
|
|
50
|
+
: "its AgentHead block has local changes; delete the block and run again to replace it",
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (!remove) {
|
|
54
|
+
return block === agentsSnippet
|
|
55
|
+
? { leave: "unchanged" }
|
|
56
|
+
: {
|
|
57
|
+
write: before.slice(0, from) +
|
|
58
|
+
agentsSnippet +
|
|
59
|
+
before.slice(to + end.length + 1),
|
|
60
|
+
created: agentsSnippet,
|
|
61
|
+
upgraded: true,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// The extra separator belongs to the appended block, including when the
|
|
65
|
+
// original document did not end in a newline.
|
|
66
|
+
const prefix = before.slice(0, from > 0 ? from - 1 : from);
|
|
67
|
+
const suffix = before.slice(to + end.length + 1);
|
|
68
|
+
// Notes may have been added directly after the block. Do not join them
|
|
69
|
+
// onto the last line of the user's original instructions.
|
|
70
|
+
const separator = prefix && suffix && !prefix.endsWith("\n") && !suffix.startsWith("\n")
|
|
71
|
+
? "\n"
|
|
72
|
+
: "";
|
|
73
|
+
const after = prefix + separator + suffix;
|
|
74
|
+
return { write: after || undefined, created: block };
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=setup-instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-instructions.js","sourceRoot":"","sources":["../src/setup-instructions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,4EAA4E;AAC5E,4DAA4D;AAC5D,MAAM,QAAQ,GAAG,KAAK;KACnB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;KACrC,OAAO,CACN,yCAAyC,EACzC,sDAAsD,CACvD;KACA,OAAO,CACN,8HAA8H,EAC9H,uEAAuE,CACxE;KACA,OAAO,CACN,6FAA6F,EAC7F,EA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CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACjD,uEAAuE;IACvE,0DAA0D;IAC1D,MAAM,SAAS,GACb,MAAM,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;QACpE,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IAC1C,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Decision } from "./setup-command.js";
|
|
2
|
+
/** Use the same conservative parser as setup, without planning any writes. */
|
|
3
|
+
export declare function codexServer(text: string): Record<string, unknown> | undefined;
|
|
4
|
+
export declare function codexConfig(before: string | undefined, root: string, remove: boolean, force?: boolean): Decision | undefined;
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { isDeepStrictEqual } from "node:util";
|
|
2
|
+
import { CommandError } from "./context.js";
|
|
3
|
+
const file = ".codex/config.toml";
|
|
4
|
+
const target = ["mcp_servers", "agenthead"];
|
|
5
|
+
/** Use the same conservative parser as setup, without planning any writes. */
|
|
6
|
+
export function codexServer(text) {
|
|
7
|
+
const parsed = tables(text.match(/[^\n]*\n|[^\n]+$/g) ?? []);
|
|
8
|
+
const entry = parsed.get(JSON.stringify(target));
|
|
9
|
+
if (!entry)
|
|
10
|
+
return undefined;
|
|
11
|
+
const server = Object.fromEntries([...entry.values].map(([key, value]) => [key, value.value]));
|
|
12
|
+
const env = parsed.get(JSON.stringify([...target, "env"]));
|
|
13
|
+
if (env)
|
|
14
|
+
server.env = Object.fromEntries([...env.values].map(([key, value]) => [key, value.value]));
|
|
15
|
+
return server;
|
|
16
|
+
}
|
|
17
|
+
function refuse(line) {
|
|
18
|
+
// Never include source text: a config may hold credentials.
|
|
19
|
+
throw new CommandError(`${file}: unsupported, ambiguous or malformed TOML${line === undefined ? "" : ` at line ${line + 1}`}; nothing was changed`);
|
|
20
|
+
}
|
|
21
|
+
/** A deliberately small, single-line TOML reader, not a general TOML parser.
|
|
22
|
+
* Accept strings, booleans, decimal numbers and arrays; refuse multiline
|
|
23
|
+
* values, inline tables, dotted assignments and array tables. Decode quoted
|
|
24
|
+
* keys so aliases cannot hide duplicate tables or collide with AgentHead.
|
|
25
|
+
*/
|
|
26
|
+
class Line {
|
|
27
|
+
text;
|
|
28
|
+
line;
|
|
29
|
+
at = 0;
|
|
30
|
+
constructor(text, line) {
|
|
31
|
+
this.text = text;
|
|
32
|
+
this.line = line;
|
|
33
|
+
}
|
|
34
|
+
fail() {
|
|
35
|
+
return refuse(this.line);
|
|
36
|
+
}
|
|
37
|
+
space() {
|
|
38
|
+
while (/[ \t]/.test(this.text[this.at] ?? "!"))
|
|
39
|
+
this.at++;
|
|
40
|
+
}
|
|
41
|
+
take(token) {
|
|
42
|
+
this.space();
|
|
43
|
+
if (!this.text.startsWith(token, this.at))
|
|
44
|
+
this.fail();
|
|
45
|
+
this.at += token.length;
|
|
46
|
+
}
|
|
47
|
+
string() {
|
|
48
|
+
const quote = this.text[this.at++];
|
|
49
|
+
let value = "";
|
|
50
|
+
while (this.at < this.text.length) {
|
|
51
|
+
const char = this.text[this.at++];
|
|
52
|
+
if (char === quote)
|
|
53
|
+
return value;
|
|
54
|
+
if (char !== "\\" || quote === "'") {
|
|
55
|
+
value += char;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const escaped = this.text[this.at++];
|
|
59
|
+
const simple = {
|
|
60
|
+
b: "\b",
|
|
61
|
+
t: "\t",
|
|
62
|
+
n: "\n",
|
|
63
|
+
f: "\f",
|
|
64
|
+
r: "\r",
|
|
65
|
+
'"': '"',
|
|
66
|
+
"\\": "\\",
|
|
67
|
+
};
|
|
68
|
+
if (Object.hasOwn(simple, escaped)) {
|
|
69
|
+
value += simple[escaped];
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
const count = escaped === "u" ? 4 : escaped === "U" ? 8 : 0;
|
|
73
|
+
const hex = this.text.slice(this.at, this.at + count);
|
|
74
|
+
if (!count || hex.length !== count || !/^[\da-f]+$/i.test(hex))
|
|
75
|
+
this.fail();
|
|
76
|
+
const point = Number.parseInt(hex, 16);
|
|
77
|
+
if (point > 0x10ffff || (point >= 0xd800 && point <= 0xdfff))
|
|
78
|
+
this.fail();
|
|
79
|
+
value += String.fromCodePoint(point);
|
|
80
|
+
this.at += count;
|
|
81
|
+
}
|
|
82
|
+
return this.fail();
|
|
83
|
+
}
|
|
84
|
+
key() {
|
|
85
|
+
this.space();
|
|
86
|
+
if (this.text[this.at] === '"' || this.text[this.at] === "'")
|
|
87
|
+
return this.string();
|
|
88
|
+
const match = /^[A-Za-z0-9_-]+/.exec(this.text.slice(this.at));
|
|
89
|
+
if (!match)
|
|
90
|
+
return this.fail();
|
|
91
|
+
this.at += match[0].length;
|
|
92
|
+
return match[0];
|
|
93
|
+
}
|
|
94
|
+
value(depth = 0) {
|
|
95
|
+
if (depth > 32)
|
|
96
|
+
return this.fail();
|
|
97
|
+
this.space();
|
|
98
|
+
const char = this.text[this.at];
|
|
99
|
+
if (char === '"' || char === "'")
|
|
100
|
+
return this.string();
|
|
101
|
+
if (char === "[") {
|
|
102
|
+
this.at++;
|
|
103
|
+
const values = [];
|
|
104
|
+
this.space();
|
|
105
|
+
if (this.text[this.at] === "]") {
|
|
106
|
+
this.at++;
|
|
107
|
+
return values;
|
|
108
|
+
}
|
|
109
|
+
while (true) {
|
|
110
|
+
values.push(this.value(depth + 1));
|
|
111
|
+
this.space();
|
|
112
|
+
if (this.text[this.at] === "]") {
|
|
113
|
+
this.at++;
|
|
114
|
+
return values;
|
|
115
|
+
}
|
|
116
|
+
this.take(",");
|
|
117
|
+
this.space();
|
|
118
|
+
if (this.text[this.at] === "]") {
|
|
119
|
+
this.at++;
|
|
120
|
+
return values;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const token = /^[^\s,#\]]+/.exec(this.text.slice(this.at))?.[0];
|
|
125
|
+
if (!token)
|
|
126
|
+
return this.fail();
|
|
127
|
+
this.at += token.length;
|
|
128
|
+
if (token === "true" || token === "false")
|
|
129
|
+
return token === "true";
|
|
130
|
+
const integer = "(?:0|[1-9](?:_?[0-9])*)";
|
|
131
|
+
const digits = "[0-9](?:_?[0-9])*";
|
|
132
|
+
if (!new RegExp(`^[+-]?${integer}(?:\\.${digits})?(?:[eE][+-]?${digits})?$`).test(token))
|
|
133
|
+
return this.fail();
|
|
134
|
+
const number = Number(token.replaceAll("_", ""));
|
|
135
|
+
if (!Number.isFinite(number))
|
|
136
|
+
return this.fail();
|
|
137
|
+
return number;
|
|
138
|
+
}
|
|
139
|
+
done() {
|
|
140
|
+
this.space();
|
|
141
|
+
if (this.at !== this.text.length && this.text[this.at] !== "#")
|
|
142
|
+
this.fail();
|
|
143
|
+
}
|
|
144
|
+
read() {
|
|
145
|
+
for (let i = 0; i < this.text.length; i++) {
|
|
146
|
+
const code = this.text.charCodeAt(i);
|
|
147
|
+
if ((code < 0x20 && code !== 0x09) || code === 0x7f)
|
|
148
|
+
this.fail();
|
|
149
|
+
}
|
|
150
|
+
this.space();
|
|
151
|
+
if (this.at === this.text.length || this.text[this.at] === "#")
|
|
152
|
+
return undefined;
|
|
153
|
+
if (this.text[this.at] === "[") {
|
|
154
|
+
this.at++;
|
|
155
|
+
const path = [this.key()];
|
|
156
|
+
this.space();
|
|
157
|
+
while (this.text[this.at] === ".") {
|
|
158
|
+
this.at++;
|
|
159
|
+
path.push(this.key());
|
|
160
|
+
this.space();
|
|
161
|
+
}
|
|
162
|
+
this.take("]");
|
|
163
|
+
this.done();
|
|
164
|
+
return { table: path };
|
|
165
|
+
}
|
|
166
|
+
const key = this.key();
|
|
167
|
+
this.take("=");
|
|
168
|
+
const value = this.value();
|
|
169
|
+
this.done();
|
|
170
|
+
return { key, value };
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function tables(lines) {
|
|
174
|
+
const id = (path) => JSON.stringify(path);
|
|
175
|
+
const result = new Map();
|
|
176
|
+
const nodes = new Map();
|
|
177
|
+
let current = { path: [], line: -1, values: new Map() };
|
|
178
|
+
for (const [line, text] of lines.entries()) {
|
|
179
|
+
const entry = new Line(text.replace(/\r?\n$/, ""), line).read();
|
|
180
|
+
if (!entry)
|
|
181
|
+
continue;
|
|
182
|
+
if ("table" in entry) {
|
|
183
|
+
const path = entry.table;
|
|
184
|
+
for (let length = 1; length < path.length; length++) {
|
|
185
|
+
const parent = id(path.slice(0, length));
|
|
186
|
+
if (nodes.get(parent) === "value")
|
|
187
|
+
refuse(line);
|
|
188
|
+
if (!nodes.has(parent))
|
|
189
|
+
nodes.set(parent, "implicit");
|
|
190
|
+
}
|
|
191
|
+
const key = id(path);
|
|
192
|
+
if (nodes.has(key) && nodes.get(key) !== "implicit")
|
|
193
|
+
refuse(line);
|
|
194
|
+
nodes.set(key, "table");
|
|
195
|
+
current = { path, line, values: new Map() };
|
|
196
|
+
result.set(key, current);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
const key = id([...current.path, entry.key]);
|
|
200
|
+
if (nodes.has(key))
|
|
201
|
+
refuse(line);
|
|
202
|
+
nodes.set(key, "value");
|
|
203
|
+
current.values.set(entry.key, { value: entry.value, line });
|
|
204
|
+
// These would define the namespace as a scalar, rather than a table.
|
|
205
|
+
if ((current.path.length === 0 && entry.key === "mcp_servers") ||
|
|
206
|
+
(isDeepStrictEqual(current.path, ["mcp_servers"]) &&
|
|
207
|
+
entry.key === "agenthead"))
|
|
208
|
+
refuse(line);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return result;
|
|
212
|
+
}
|
|
213
|
+
// JSON's string escaping is a subset of TOML basic-string escaping, except
|
|
214
|
+
// astral characters are written literally and no slash escape is produced.
|
|
215
|
+
export function codexConfig(before, root, remove, force = false) {
|
|
216
|
+
if (remove && before === undefined)
|
|
217
|
+
return undefined;
|
|
218
|
+
const created = `[mcp_servers.agenthead]\ncommand = "agenthead-mcp"\nargs = [${JSON.stringify(root)}]\n`;
|
|
219
|
+
const lines = before?.match(/[^\n]*\n|[^\n]+$/g) ?? [];
|
|
220
|
+
const parsed = tables(lines);
|
|
221
|
+
const existing = parsed.get(JSON.stringify(target));
|
|
222
|
+
const children = [...parsed.values()].filter((table) => table.path.length > 2 &&
|
|
223
|
+
isDeepStrictEqual(table.path.slice(0, 2), target));
|
|
224
|
+
if (!existing) {
|
|
225
|
+
// A child table implicitly defines AgentHead too: never append over it.
|
|
226
|
+
if (children.length > 0)
|
|
227
|
+
refuse();
|
|
228
|
+
return remove
|
|
229
|
+
? { leave: "unchanged" }
|
|
230
|
+
: {
|
|
231
|
+
write: (before ?? "") + (before?.length ? "\n" : "") + created,
|
|
232
|
+
created,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
const command = existing.values.get("command")?.value;
|
|
236
|
+
const args = existing.values.get("args")?.value;
|
|
237
|
+
const mentions = (v) => typeof v === "string" && v.includes("agenthead-mcp");
|
|
238
|
+
const runsAgentHead = mentions(command) || (Array.isArray(args) && args.some(mentions));
|
|
239
|
+
const matchesRoot = isDeepStrictEqual(args, [root]);
|
|
240
|
+
if (runsAgentHead && !matchesRoot && !force) {
|
|
241
|
+
const directory = Array.isArray(args) && args.length === 1 && typeof args[0] === "string"
|
|
242
|
+
? args[0]
|
|
243
|
+
: "unknown: args are not a single directory";
|
|
244
|
+
return {
|
|
245
|
+
leave: "kept",
|
|
246
|
+
note: `points at another directory (${directory}); ` +
|
|
247
|
+
"risk: Codex may read or write another project's .agenthead/ store; " +
|
|
248
|
+
(remove
|
|
249
|
+
? "run agenthead setup codex --remove --force to remove it"
|
|
250
|
+
: "run agenthead setup codex --force to rewrite it for this project"),
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
if (!remove) {
|
|
254
|
+
if (!runsAgentHead) {
|
|
255
|
+
throw new CommandError(`${file} already has a agenthead server that does not run agenthead-mcp; nothing was changed`);
|
|
256
|
+
}
|
|
257
|
+
if (!matchesRoot && force) {
|
|
258
|
+
// Replace the launch command and args together (including wrappers such
|
|
259
|
+
// as npx), retaining other settings, child tables and unrelated bytes.
|
|
260
|
+
const dropped = new Set(["command", "args"].map((key) => existing.values.get(key)?.line));
|
|
261
|
+
const newline = lines[existing.line].endsWith("\r\n") ? "\r\n" : "\n";
|
|
262
|
+
const after = lines
|
|
263
|
+
.flatMap((line, index) => index === existing.line
|
|
264
|
+
? [
|
|
265
|
+
line.endsWith("\n") ? line : line + newline,
|
|
266
|
+
`command = "agenthead-mcp"${newline}args = [${JSON.stringify(root)}]${newline}`,
|
|
267
|
+
]
|
|
268
|
+
: dropped.has(index)
|
|
269
|
+
? []
|
|
270
|
+
: [line])
|
|
271
|
+
.join("");
|
|
272
|
+
return { write: after, created };
|
|
273
|
+
}
|
|
274
|
+
return { leave: "unchanged" };
|
|
275
|
+
}
|
|
276
|
+
if (!(force && runsAgentHead) &&
|
|
277
|
+
(children.length > 0 ||
|
|
278
|
+
existing.values.size !== 2 ||
|
|
279
|
+
command !== "agenthead-mcp" ||
|
|
280
|
+
!matchesRoot)) {
|
|
281
|
+
return {
|
|
282
|
+
leave: "kept",
|
|
283
|
+
note: "its agenthead server is not the one setup writes",
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
// Restore the exact prefix when removing the block we appended, even if
|
|
287
|
+
// that prefix had no final newline. Otherwise preserve every comment.
|
|
288
|
+
if (before === created || before?.endsWith("\n" + created)) {
|
|
289
|
+
return {
|
|
290
|
+
write: before.slice(0, -created.length - (before === created ? 0 : 1)) ||
|
|
291
|
+
undefined,
|
|
292
|
+
created,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
const dropped = new Set([existing, ...children].flatMap((table) => [
|
|
296
|
+
table.line,
|
|
297
|
+
...[...table.values.values()].map((v) => v.line),
|
|
298
|
+
]));
|
|
299
|
+
const after = lines.filter((_, line) => !dropped.has(line)).join("");
|
|
300
|
+
return { write: after.trim() ? after : undefined, created };
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=setup-toml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-toml.js","sourceRoot":"","sources":["../src/setup-toml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAS5C,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;AAE5C,8EAA8E;AAC9E,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IACjD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,MAAM,GAA4B,MAAM,CAAC,WAAW,CACxD,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAC5D,CAAC;IACF,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,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M,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;KACjD,CAAC,CACH,CAAC;IACF,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const version: string;
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,CAAC,MAAM,OAAO,GAClB,IAAI,CAAC,KAAK,CACR,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAEpE,CAAC,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agenthead/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"agenthead": "bin/agenthead.js"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"bin",
|
|
18
|
+
"dist",
|
|
19
|
+
"THIRD_PARTY_NOTICES.md",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@agenthead/conductor": "0.2.0",
|
|
25
|
+
"@agenthead/core": "0.2.0",
|
|
26
|
+
"@agenthead/graph": "0.2.0",
|
|
27
|
+
"@types/node": "^22.20.7",
|
|
28
|
+
"@agenthead/security": "0.2.0"
|
|
29
|
+
},
|
|
30
|
+
"license": "Apache-2.0",
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": "^22.0.0 || ^24.0.0 || ^26.0.0"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"prepack": "tsc -b --force && node ../../scripts/prepare-package.mjs"
|
|
36
|
+
},
|
|
37
|
+
"description": "Command-line tools for AgentHead context, code navigation, setup, diagnostics and security.",
|
|
38
|
+
"keywords": [
|
|
39
|
+
"agenthead",
|
|
40
|
+
"cli",
|
|
41
|
+
"context",
|
|
42
|
+
"coding-agents",
|
|
43
|
+
"mcp",
|
|
44
|
+
"security"
|
|
45
|
+
],
|
|
46
|
+
"author": "Harsh Singh",
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/singhharsh1708/agenthead.git",
|
|
53
|
+
"directory": "packages/cli"
|
|
54
|
+
},
|
|
55
|
+
"homepage": "https://singhharsh1708.github.io/agenthead/",
|
|
56
|
+
"bugs": "https://github.com/singhharsh1708/agenthead/issues"
|
|
57
|
+
}
|