@arkyn/cli 3.0.10 β 3.0.12
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/README.md +5 -1
- package/dist/bundle.js +107 -43
- package/dist/bundle.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @arkyn/cli
|
|
2
2
|
|
|
3
|
-
Command-line tool for the Arkyn ecosystem, generates and maintains an `AGENTS.md` file so AI coding assistants
|
|
3
|
+
Command-line tool for the Arkyn ecosystem, generates and maintains an `AGENTS.md` file so AI coding assistants know how to use the `@arkyn/*` packages installed in your project. `AGENTS.md` is a cross-tool convention read by Claude Code, Cursor, Copilot, and others out of the box β this CLI only ever writes to `AGENTS.md`; it does not create or modify a tool-specific file like `CLAUDE.md`.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@arkyn/cli)
|
|
6
6
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
@@ -69,6 +69,10 @@ If no `@arkyn/*` package is installed, or none of them ship an `AGENTS.md` yet,
|
|
|
69
69
|
|
|
70
70
|
Prints usage information.
|
|
71
71
|
|
|
72
|
+
### `arkyn --version` / `arkyn -v`
|
|
73
|
+
|
|
74
|
+
Prints the installed `@arkyn/cli` version (read from its own `package.json`, e.g. `3.0.11`).
|
|
75
|
+
|
|
72
76
|
## π Documentation
|
|
73
77
|
|
|
74
78
|
Full documentation: [https://docs.arkyn.dev/docs/cli/introduction](https://docs.arkyn.dev/docs/cli/introduction)
|
package/dist/bundle.js
CHANGED
|
@@ -1,32 +1,87 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync as e, readFileSync as t, writeFileSync as n } from "node:fs";
|
|
3
|
-
import {
|
|
3
|
+
import { dirname as r, join as i } from "node:path";
|
|
4
|
+
import { fileURLToPath as a } from "node:url";
|
|
4
5
|
//#region src/utils/agentsBlock.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
6
|
+
var o = "<!-- arkyn:agents:start -->", s = "<!-- arkyn:agents:end -->";
|
|
7
|
+
function c(e) {
|
|
7
8
|
return [
|
|
8
|
-
|
|
9
|
+
o,
|
|
9
10
|
"## Arkyn",
|
|
10
11
|
"",
|
|
11
12
|
"Consult each installed Arkyn package's AGENTS.md before using its components or utilities:",
|
|
12
13
|
"",
|
|
13
14
|
e.map((e) => `- [${e.name}](${e.relativePath})`).join("\n"),
|
|
14
|
-
|
|
15
|
+
s
|
|
15
16
|
].join("\n");
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function l(e, t, n) {
|
|
19
|
+
let r = e.lastIndexOf("\n", t) + 1, i = e.indexOf("\n", t + n);
|
|
20
|
+
return {
|
|
21
|
+
start: r,
|
|
22
|
+
end: i === -1 ? e.length : i + 1
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function u(e, t, n) {
|
|
26
|
+
let r = [], i = 0;
|
|
27
|
+
for (;;) {
|
|
28
|
+
let a = e.indexOf(t, i);
|
|
29
|
+
if (a === -1) return r;
|
|
30
|
+
r.push({
|
|
31
|
+
index: a,
|
|
32
|
+
tag: n
|
|
33
|
+
}), i = a + t.length;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function d(e, t) {
|
|
37
|
+
let n = [...t].sort((e, t) => e.start - t.start), r = "", i = 0;
|
|
38
|
+
for (let t of n) r += e.slice(i, t.start) + t.replacement, i = t.end;
|
|
39
|
+
return r += e.slice(i), r;
|
|
40
|
+
}
|
|
41
|
+
function f(e, t) {
|
|
18
42
|
if (!e) return `${t}\n`;
|
|
19
|
-
let n = e.
|
|
20
|
-
|
|
43
|
+
let n = [...u(e, o, "start"), ...u(e, s, "end")].sort((e, t) => e.index - t.index), r = [], i = [], a = null;
|
|
44
|
+
for (let t of n) {
|
|
45
|
+
if (t.tag === "start") {
|
|
46
|
+
a !== null && i.push(l(e, a, 27)), a = t.index;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
a === null ? i.push(l(e, t.index, 25)) : (r.push({
|
|
50
|
+
start: a,
|
|
51
|
+
end: t.index + 25
|
|
52
|
+
}), a = null);
|
|
53
|
+
}
|
|
54
|
+
if (a !== null && i.push(l(e, a, 27)), r.length === 0) {
|
|
55
|
+
let n = d(e, i.map((e) => ({
|
|
56
|
+
...e,
|
|
57
|
+
replacement: ""
|
|
58
|
+
}))).replace(/\n{3,}/g, "\n\n");
|
|
59
|
+
return n.trim() === "" ? `${t}\n` : `${n}${n.endsWith("\n") ? "\n" : "\n\n"}${t}\n`;
|
|
60
|
+
}
|
|
61
|
+
let [c, ...f] = r;
|
|
62
|
+
return d(e, [
|
|
63
|
+
{
|
|
64
|
+
...c,
|
|
65
|
+
replacement: t
|
|
66
|
+
},
|
|
67
|
+
...f.map((e) => ({
|
|
68
|
+
...e,
|
|
69
|
+
replacement: ""
|
|
70
|
+
})),
|
|
71
|
+
...i.map((e) => ({
|
|
72
|
+
...e,
|
|
73
|
+
replacement: ""
|
|
74
|
+
}))
|
|
75
|
+
]).replace(/\n{3,}/g, "\n\n");
|
|
21
76
|
}
|
|
22
77
|
//#endregion
|
|
23
78
|
//#region src/utils/resolveAgentsDocs.ts
|
|
24
|
-
var
|
|
25
|
-
function
|
|
26
|
-
return typeof e != "string" || e.length === 0 ? !1 :
|
|
79
|
+
var p = "[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?", m = RegExp(`^${p}$`), h = RegExp(`^@${p}/${p}$`);
|
|
80
|
+
function g(e) {
|
|
81
|
+
return typeof e != "string" || e.length === 0 ? !1 : m.test(e) || h.test(e);
|
|
27
82
|
}
|
|
28
|
-
function
|
|
29
|
-
return n.filter((e) =>
|
|
83
|
+
function _(t, n, r = e) {
|
|
84
|
+
return n.filter((e) => g(e) ? !0 : (console.warn(`arkyn init: skipping "${e}" β not a valid package name.`), !1)).map((e) => {
|
|
30
85
|
let n = [
|
|
31
86
|
"node_modules",
|
|
32
87
|
...e.split("/"),
|
|
@@ -35,78 +90,87 @@ function f(t, n, i = e) {
|
|
|
35
90
|
return {
|
|
36
91
|
name: e,
|
|
37
92
|
relativePath: n.join("/"),
|
|
38
|
-
absolutePath:
|
|
93
|
+
absolutePath: i(t, ...n)
|
|
39
94
|
};
|
|
40
|
-
}).filter((e) =>
|
|
95
|
+
}).filter((e) => r(e.absolutePath)).map(({ name: e, relativePath: t }) => ({
|
|
41
96
|
name: e,
|
|
42
97
|
relativePath: t
|
|
43
98
|
}));
|
|
44
99
|
}
|
|
45
100
|
//#endregion
|
|
46
101
|
//#region src/utils/findInstalledArkynPackages.ts
|
|
47
|
-
var
|
|
48
|
-
function
|
|
102
|
+
var v = "@arkyn/cli";
|
|
103
|
+
function y(e, t) {
|
|
49
104
|
for (let n of Object.keys(e ?? {})) if (n.startsWith("@arkyn/")) {
|
|
50
|
-
if (!
|
|
105
|
+
if (!g(n)) {
|
|
51
106
|
console.warn(`arkyn init: ignoring "${n}" β not a valid package name.`);
|
|
52
107
|
continue;
|
|
53
108
|
}
|
|
54
109
|
t.add(n);
|
|
55
110
|
}
|
|
56
111
|
}
|
|
57
|
-
function
|
|
112
|
+
function b(e) {
|
|
58
113
|
let t = /* @__PURE__ */ new Set();
|
|
59
|
-
return
|
|
114
|
+
return y(e.dependencies, t), y(e.devDependencies, t), t.delete(v), [...t].sort();
|
|
60
115
|
}
|
|
61
116
|
//#endregion
|
|
62
117
|
//#region src/commands/init.ts
|
|
63
|
-
function
|
|
64
|
-
let a = r
|
|
118
|
+
function x(r) {
|
|
119
|
+
let a = i(r, "package.json");
|
|
65
120
|
if (!e(a)) {
|
|
66
|
-
console.error(`No package.json found in ${
|
|
121
|
+
console.error(`No package.json found in ${r}. Run this command from your project root.`), process.exitCode = 1;
|
|
67
122
|
return;
|
|
68
123
|
}
|
|
69
|
-
let
|
|
124
|
+
let o = t(a, "utf8"), s;
|
|
70
125
|
try {
|
|
71
|
-
|
|
126
|
+
s = JSON.parse(o);
|
|
72
127
|
} catch (e) {
|
|
73
128
|
let t = e instanceof Error ? e.message : String(e);
|
|
74
129
|
console.error(`Failed to parse ${a}: ${t}`), process.exitCode = 1;
|
|
75
130
|
return;
|
|
76
131
|
}
|
|
77
|
-
let
|
|
78
|
-
if (
|
|
132
|
+
let l = b(s);
|
|
133
|
+
if (l.length === 0) {
|
|
79
134
|
console.log("No @arkyn/* packages found in dependencies or devDependencies.");
|
|
80
135
|
return;
|
|
81
136
|
}
|
|
82
|
-
let
|
|
83
|
-
if (
|
|
84
|
-
console.log(`Found ${
|
|
137
|
+
let u = _(r, l);
|
|
138
|
+
if (u.length === 0) {
|
|
139
|
+
console.log(`Found ${l.join(", ")}, but none of them ship an AGENTS.md yet.`);
|
|
85
140
|
return;
|
|
86
141
|
}
|
|
87
|
-
let
|
|
88
|
-
n(
|
|
142
|
+
let d = i(r, "AGENTS.md");
|
|
143
|
+
n(d, f(e(d) ? t(d, "utf8") : null, c(u))), console.log(`Updated AGENTS.md with docs for: ${u.map((e) => e.name).join(", ")}`);
|
|
89
144
|
}
|
|
90
145
|
//#endregion
|
|
91
146
|
//#region src/index.ts
|
|
92
|
-
var
|
|
93
|
-
function
|
|
94
|
-
let
|
|
95
|
-
|
|
96
|
-
|
|
147
|
+
var S = "Usage: arkyn <command> [flags]\n\nCommands:\n init --agents Create or update AGENTS.md in the current project, referencing\n the AGENTS.md docs shipped by installed @arkyn/* packages.\n\nFlags:\n -h, --help Show this help message\n -v, --version Show the installed @arkyn/cli version\n";
|
|
148
|
+
function C() {
|
|
149
|
+
let e = i(r(a(import.meta.url)), "..", "package.json");
|
|
150
|
+
return JSON.parse(t(e, "utf8")).version;
|
|
151
|
+
}
|
|
152
|
+
function w(e) {
|
|
153
|
+
let [t, ...n] = e;
|
|
154
|
+
if (t === "-v" || t === "--version") {
|
|
155
|
+
console.log(C());
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (!t || t === "-h" || t === "--help") {
|
|
159
|
+
console.log(S);
|
|
97
160
|
return;
|
|
98
161
|
}
|
|
99
|
-
if (
|
|
100
|
-
if (!
|
|
101
|
-
console.error("arkyn init requires the --agents flag.\n"), console.log(
|
|
162
|
+
if (t === "init") {
|
|
163
|
+
if (!n.includes("--agents")) {
|
|
164
|
+
console.error("arkyn init requires the --agents flag.\n"), console.log(S), process.exitCode = 1;
|
|
102
165
|
return;
|
|
103
166
|
}
|
|
104
|
-
|
|
167
|
+
x(process.cwd());
|
|
105
168
|
return;
|
|
106
169
|
}
|
|
107
|
-
console.error(`Unknown command: ${
|
|
170
|
+
console.error(`Unknown command: ${t}\n`), console.log(S), process.exitCode = 1;
|
|
108
171
|
}
|
|
109
|
-
|
|
172
|
+
import.meta.url === `file://${process.argv[1]}` && w(process.argv.slice(2));
|
|
110
173
|
//#endregion
|
|
174
|
+
export { S as HELP_TEXT, C as getVersion, w as runCli };
|
|
111
175
|
|
|
112
176
|
//# sourceMappingURL=bundle.js.map
|
package/dist/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","names":[],"sources":["../src/utils/agentsBlock.ts","../src/utils/resolveAgentsDocs.ts","../src/utils/findInstalledArkynPackages.ts","../src/commands/init.ts","../src/index.ts"],"sourcesContent":["import type { ArkynAgentsDoc } from \"./resolveAgentsDocs\";\n\nconst START_MARKER = \"<!-- arkyn:agents:start -->\";\nconst END_MARKER = \"<!-- arkyn:agents:end -->\";\n\nexport function buildAgentsBlock(docs: ArkynAgentsDoc[]): string {\n\tconst links = docs\n\t\t.map((doc) => `- [${doc.name}](${doc.relativePath})`)\n\t\t.join(\"\\n\");\n\n\treturn [\n\t\tSTART_MARKER,\n\t\t\"## Arkyn\",\n\t\t\"\",\n\t\t\"Consult each installed Arkyn package's AGENTS.md before using its components or utilities:\",\n\t\t\"\",\n\t\tlinks,\n\t\tEND_MARKER,\n\t].join(\"\\n\");\n}\n\nexport function mergeAgentsBlock(\n\texisting: string | null,\n\tblock: string,\n): string {\n\tif (!existing) return `${block}\\n`;\n\n\tconst start = existing.indexOf(START_MARKER);\n\tconst end = existing.indexOf(END_MARKER);\n\n\tif (start !== -1 && end !== -1) {\n\t\treturn `${existing.slice(0, start)}${block}${existing.slice(\n\t\t\tend + END_MARKER.length,\n\t\t)}`;\n\t}\n\n\tconst separator = existing.endsWith(\"\\n\") ? \"\\n\" : \"\\n\\n\";\n\treturn `${existing}${separator}${block}\\n`;\n}\n","import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport interface ArkynAgentsDoc {\n\tname: string;\n\trelativePath: string;\n}\n\n// A single \"segment\" of a package name: cannot start/end with a separator,\n// cannot be empty, and only contains characters npm allows in a package name.\nconst NAME_SEGMENT = \"[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?\";\nconst UNSCOPED_NAME_PATTERN = new RegExp(`^${NAME_SEGMENT}$`);\nconst SCOPED_NAME_PATTERN = new RegExp(`^@${NAME_SEGMENT}/${NAME_SEGMENT}$`);\n\n/**\n * Validates that a package name is safe to use when building filesystem\n * paths or Markdown content: no path traversal segments (`..`), no leading\n * `/` (absolute paths), no more than one `@scope/name` separator, and no\n * characters outside what npm allows in a real package name. This guards\n * against a malicious/malformed `package.json` steering `resolveAgentsDocs`\n * outside of `node_modules` or injecting content into `AGENTS.md`.\n */\nexport function isValidPackageName(name: string): boolean {\n\tif (typeof name !== \"string\" || name.length === 0) return false;\n\n\treturn UNSCOPED_NAME_PATTERN.test(name) || SCOPED_NAME_PATTERN.test(name);\n}\n\nexport function resolveAgentsDocs(\n\tcwd: string,\n\tpackageNames: string[],\n\texists: (absolutePath: string) => boolean = existsSync,\n): ArkynAgentsDoc[] {\n\treturn packageNames\n\t\t.filter((name) => {\n\t\t\tif (isValidPackageName(name)) return true;\n\n\t\t\tconsole.warn(\n\t\t\t\t`arkyn init: skipping \"${name}\" β not a valid package name.`,\n\t\t\t);\n\t\t\treturn false;\n\t\t})\n\t\t.map((name) => {\n\t\t\tconst parts = [\"node_modules\", ...name.split(\"/\"), \"AGENTS.md\"];\n\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\trelativePath: parts.join(\"/\"),\n\t\t\t\tabsolutePath: join(cwd, ...parts),\n\t\t\t};\n\t\t})\n\t\t.filter((doc) => exists(doc.absolutePath))\n\t\t.map(({ name, relativePath }) => ({ name, relativePath }));\n}\n","import { isValidPackageName } from \"./resolveAgentsDocs\";\n\nexport interface PackageJson {\n\tdependencies?: Record<string, string>;\n\tdevDependencies?: Record<string, string>;\n\t[key: string]: unknown;\n}\n\nconst SELF_PACKAGE = \"@arkyn/cli\";\n\nfunction collectArkynNames(\n\tdeps: Record<string, string> | undefined,\n\tnames: Set<string>,\n): void {\n\tfor (const name of Object.keys(deps ?? {})) {\n\t\tif (!name.startsWith(\"@arkyn/\")) continue;\n\n\t\tif (!isValidPackageName(name)) {\n\t\t\tconsole.warn(\n\t\t\t\t`arkyn init: ignoring \"${name}\" β not a valid package name.`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\n\t\tnames.add(name);\n\t}\n}\n\nexport function findInstalledArkynPackages(pkg: PackageJson): string[] {\n\tconst names = new Set<string>();\n\n\tcollectArkynNames(pkg.dependencies, names);\n\tcollectArkynNames(pkg.devDependencies, names);\n\n\tnames.delete(SELF_PACKAGE);\n\n\treturn [...names].sort();\n}\n","import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { buildAgentsBlock, mergeAgentsBlock } from \"../utils/agentsBlock\";\nimport {\n\tfindInstalledArkynPackages,\n\ttype PackageJson,\n} from \"../utils/findInstalledArkynPackages\";\nimport { resolveAgentsDocs } from \"../utils/resolveAgentsDocs\";\n\nexport function runInit(cwd: string): void {\n\tconst packageJsonPath = join(cwd, \"package.json\");\n\n\tif (!existsSync(packageJsonPath)) {\n\t\tconsole.error(\n\t\t\t`No package.json found in ${cwd}. Run this command from your project root.`,\n\t\t);\n\t\tprocess.exitCode = 1;\n\t\treturn;\n\t}\n\n\tconst rawPackageJson = readFileSync(packageJsonPath, \"utf8\");\n\n\tlet pkg: PackageJson;\n\ttry {\n\t\tpkg = JSON.parse(rawPackageJson) as PackageJson;\n\t} catch (error) {\n\t\tconst reason = error instanceof Error ? error.message : String(error);\n\t\tconsole.error(`Failed to parse ${packageJsonPath}: ${reason}`);\n\t\tprocess.exitCode = 1;\n\t\treturn;\n\t}\n\n\tconst packageNames = findInstalledArkynPackages(pkg);\n\n\tif (packageNames.length === 0) {\n\t\tconsole.log(\n\t\t\t\"No @arkyn/* packages found in dependencies or devDependencies.\",\n\t\t);\n\t\treturn;\n\t}\n\n\tconst docs = resolveAgentsDocs(cwd, packageNames);\n\n\tif (docs.length === 0) {\n\t\tconsole.log(\n\t\t\t`Found ${packageNames.join(\", \")}, but none of them ship an AGENTS.md yet.`,\n\t\t);\n\t\treturn;\n\t}\n\n\tconst agentsPath = join(cwd, \"AGENTS.md\");\n\tconst existing = existsSync(agentsPath)\n\t\t? readFileSync(agentsPath, \"utf8\")\n\t\t: null;\n\n\tconst block = buildAgentsBlock(docs);\n\twriteFileSync(agentsPath, mergeAgentsBlock(existing, block));\n\n\tconsole.log(\n\t\t`Updated AGENTS.md with docs for: ${docs.map((doc) => doc.name).join(\", \")}`,\n\t);\n}\n","import { runInit } from \"./commands/init\";\n\nconst HELP_TEXT = `Usage: arkyn <command> [flags]\n\nCommands:\n init --agents Create or update AGENTS.md in the current project, referencing\n the AGENTS.md docs shipped by installed @arkyn/* packages.\n\nFlags:\n -h, --help Show this help message\n`;\n\nfunction main() {\n\tconst [command, ...flags] = process.argv.slice(2);\n\n\tif (!command || command === \"-h\" || command === \"--help\") {\n\t\tconsole.log(HELP_TEXT);\n\t\treturn;\n\t}\n\n\tif (command === \"init\") {\n\t\tif (!flags.includes(\"--agents\")) {\n\t\t\tconsole.error(\"arkyn init requires the --agents flag.\\n\");\n\t\t\tconsole.log(HELP_TEXT);\n\t\t\tprocess.exitCode = 1;\n\t\t\treturn;\n\t\t}\n\n\t\trunInit(process.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EACA;CACD;CAEA,IAAM,IAAa,EAAK,GAAK,WAAW;CAQxC,AAFA,EAAc,GAAY,EALT,EAAW,CAAU,IACnC,EAAa,GAAY,MAAM,IAC/B,MAEW,EAAiB,CACsB,CAAK,CAAC,GAE3D,QAAQ,IACP,oCAAoC,EAAK,KAAK,MAAQ,EAAI,IAAI,CAAC,CAAC,KAAK,IAAI,GAC1E;AACD;;;AC3DA,IAAM,IAAY;AAUlB,SAAS,IAAO;CACf,IAAM,CAAC,GAAS,GAAG,KAAS,QAAQ,KAAK,MAAM,CAAC;CAEhD,IAAI,CAAC,KAAW,MAAY,QAAQ,MAAY,UAAU;EACzD,QAAQ,IAAI,CAAS;EACrB;CACD;CAEA,IAAI,MAAY,QAAQ;EACvB,IAAI,CAAC,EAAM,SAAS,UAAU,GAAG;GAGhC,AAFA,QAAQ,MAAM,0CAA0C,GACxD,QAAQ,IAAI,CAAS,GACrB,QAAQ,WAAW;GACnB;EACD;EAEA,EAAQ,QAAQ,IAAI,CAAC;EACrB;CACD;CAIA,AAFA,QAAQ,MAAM,oBAAoB,EAAQ,GAAG,GAC7C,QAAQ,IAAI,CAAS,GACrB,QAAQ,WAAW;AACpB;AAEA,EAAK"}
|
|
1
|
+
{"version":3,"file":"bundle.js","names":[],"sources":["../src/utils/agentsBlock.ts","../src/utils/resolveAgentsDocs.ts","../src/utils/findInstalledArkynPackages.ts","../src/commands/init.ts","../src/index.ts"],"sourcesContent":["import type { ArkynAgentsDoc } from \"./resolveAgentsDocs\";\n\nconst START_MARKER = \"<!-- arkyn:agents:start -->\";\nconst END_MARKER = \"<!-- arkyn:agents:end -->\";\n\nexport function buildAgentsBlock(docs: ArkynAgentsDoc[]): string {\n\tconst links = docs\n\t\t.map((doc) => `- [${doc.name}](${doc.relativePath})`)\n\t\t.join(\"\\n\");\n\n\treturn [\n\t\tSTART_MARKER,\n\t\t\"## Arkyn\",\n\t\t\"\",\n\t\t\"Consult each installed Arkyn package's AGENTS.md before using its components or utilities:\",\n\t\t\"\",\n\t\tlinks,\n\t\tEND_MARKER,\n\t].join(\"\\n\");\n}\n\ntype Span = { start: number; end: number };\ntype Token = { index: number; tag: \"start\" | \"end\" };\ntype Edit = { start: number; end: number; replacement: string };\n\n/** The full line containing `text[markerIndex..markerIndex+markerLength]`, newline included. */\nfunction lineSpan(\n\ttext: string,\n\tmarkerIndex: number,\n\tmarkerLength: number,\n): Span {\n\tconst start = text.lastIndexOf(\"\\n\", markerIndex) + 1;\n\tconst nextNewline = text.indexOf(\"\\n\", markerIndex + markerLength);\n\tconst end = nextNewline === -1 ? text.length : nextNewline + 1;\n\treturn { start, end };\n}\n\nfunction findAllOccurrences(\n\ttext: string,\n\tmarker: string,\n\ttag: Token[\"tag\"],\n): Token[] {\n\tconst tokens: Token[] = [];\n\tlet from = 0;\n\n\tfor (;;) {\n\t\tconst index = text.indexOf(marker, from);\n\t\tif (index === -1) return tokens;\n\t\ttokens.push({ index, tag });\n\t\tfrom = index + marker.length;\n\t}\n}\n\nfunction applyEdits(text: string, edits: Edit[]): string {\n\tconst sorted = [...edits].sort((a, b) => a.start - b.start);\n\n\tlet result = \"\";\n\tlet cursor = 0;\n\tfor (const edit of sorted) {\n\t\tresult += text.slice(cursor, edit.start) + edit.replacement;\n\t\tcursor = edit.end;\n\t}\n\tresult += text.slice(cursor);\n\n\treturn result;\n}\n\n/**\n * Merges the managed Arkyn block into `existing` AGENTS.md content.\n *\n * `existing` may contain content written by hand by the user outside the\n * markers, so this only ever touches text bounded by `START_MARKER`/\n * `END_MARKER` (or a single orphaned marker line) β it never guesses at or\n * deletes arbitrary surrounding content.\n *\n * Markers are matched with a single left-to-right pass that pairs each\n * `START_MARKER` with the next unmatched `END_MARKER`:\n * - The first well-formed `STARTβ¦END` pair found is replaced with the\n * fresh block (this is the common \"file already has a block\" case).\n * - Any *other* well-formed pair (duplicated/multiple full blocks) is\n * fully removed β everything between such a pair was written by this\n * function in a previous run, never by hand.\n * - Any marker that can't be paired (a lone `START` with no `END` after\n * it, a lone `END` with no `START` before it, or markers in the wrong\n * order) is corrupted state: only *that marker's own line* is removed,\n * never the content around it.\n * - If no well-formed pair remains after that cleanup, the fresh block is\n * appended at the end, exactly like a file that never had a block.\n */\nexport function mergeAgentsBlock(\n\texisting: string | null,\n\tblock: string,\n): string {\n\tif (!existing) return `${block}\\n`;\n\n\tconst tokens = [\n\t\t...findAllOccurrences(existing, START_MARKER, \"start\"),\n\t\t...findAllOccurrences(existing, END_MARKER, \"end\"),\n\t].sort((a, b) => a.index - b.index);\n\n\tconst validRegions: Span[] = [];\n\tconst orphanLines: Span[] = [];\n\tlet pendingStart: number | null = null;\n\n\tfor (const token of tokens) {\n\t\tif (token.tag === \"start\") {\n\t\t\tif (pendingStart !== null) {\n\t\t\t\torphanLines.push(lineSpan(existing, pendingStart, START_MARKER.length));\n\t\t\t}\n\t\t\tpendingStart = token.index;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (pendingStart !== null) {\n\t\t\tvalidRegions.push({\n\t\t\t\tstart: pendingStart,\n\t\t\t\tend: token.index + END_MARKER.length,\n\t\t\t});\n\t\t\tpendingStart = null;\n\t\t} else {\n\t\t\torphanLines.push(lineSpan(existing, token.index, END_MARKER.length));\n\t\t}\n\t}\n\tif (pendingStart !== null) {\n\t\torphanLines.push(lineSpan(existing, pendingStart, START_MARKER.length));\n\t}\n\n\tif (validRegions.length === 0) {\n\t\tconst cleaned = applyEdits(\n\t\t\texisting,\n\t\t\torphanLines.map((span) => ({ ...span, replacement: \"\" })),\n\t\t).replace(/\\n{3,}/g, \"\\n\\n\");\n\n\t\tif (cleaned.trim() === \"\") return `${block}\\n`;\n\n\t\tconst separator = cleaned.endsWith(\"\\n\") ? \"\\n\" : \"\\n\\n\";\n\t\treturn `${cleaned}${separator}${block}\\n`;\n\t}\n\n\tconst [primary, ...duplicates] = validRegions;\n\tconst edits: Edit[] = [\n\t\t{ ...primary, replacement: block },\n\t\t...duplicates.map((span) => ({ ...span, replacement: \"\" })),\n\t\t...orphanLines.map((span) => ({ ...span, replacement: \"\" })),\n\t];\n\n\treturn applyEdits(existing, edits).replace(/\\n{3,}/g, \"\\n\\n\");\n}\n","import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport interface ArkynAgentsDoc {\n\tname: string;\n\trelativePath: string;\n}\n\n// A single \"segment\" of a package name: cannot start/end with a separator,\n// cannot be empty, and only contains characters npm allows in a package name.\nconst NAME_SEGMENT = \"[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?\";\nconst UNSCOPED_NAME_PATTERN = new RegExp(`^${NAME_SEGMENT}$`);\nconst SCOPED_NAME_PATTERN = new RegExp(`^@${NAME_SEGMENT}/${NAME_SEGMENT}$`);\n\n/**\n * Validates that a package name is safe to use when building filesystem\n * paths or Markdown content: no path traversal segments (`..`), no leading\n * `/` (absolute paths), no more than one `@scope/name` separator, and no\n * characters outside what npm allows in a real package name. This guards\n * against a malicious/malformed `package.json` steering `resolveAgentsDocs`\n * outside of `node_modules` or injecting content into `AGENTS.md`.\n */\nexport function isValidPackageName(name: string): boolean {\n\tif (typeof name !== \"string\" || name.length === 0) return false;\n\n\treturn UNSCOPED_NAME_PATTERN.test(name) || SCOPED_NAME_PATTERN.test(name);\n}\n\nexport function resolveAgentsDocs(\n\tcwd: string,\n\tpackageNames: string[],\n\texists: (absolutePath: string) => boolean = existsSync,\n): ArkynAgentsDoc[] {\n\treturn packageNames\n\t\t.filter((name) => {\n\t\t\tif (isValidPackageName(name)) return true;\n\n\t\t\tconsole.warn(\n\t\t\t\t`arkyn init: skipping \"${name}\" β not a valid package name.`,\n\t\t\t);\n\t\t\treturn false;\n\t\t})\n\t\t.map((name) => {\n\t\t\tconst parts = [\"node_modules\", ...name.split(\"/\"), \"AGENTS.md\"];\n\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\trelativePath: parts.join(\"/\"),\n\t\t\t\tabsolutePath: join(cwd, ...parts),\n\t\t\t};\n\t\t})\n\t\t.filter((doc) => exists(doc.absolutePath))\n\t\t.map(({ name, relativePath }) => ({ name, relativePath }));\n}\n","import { isValidPackageName } from \"./resolveAgentsDocs\";\n\nexport interface PackageJson {\n\tdependencies?: Record<string, string>;\n\tdevDependencies?: Record<string, string>;\n\t[key: string]: unknown;\n}\n\nconst SELF_PACKAGE = \"@arkyn/cli\";\n\nfunction collectArkynNames(\n\tdeps: Record<string, string> | undefined,\n\tnames: Set<string>,\n): void {\n\tfor (const name of Object.keys(deps ?? {})) {\n\t\tif (!name.startsWith(\"@arkyn/\")) continue;\n\n\t\tif (!isValidPackageName(name)) {\n\t\t\tconsole.warn(\n\t\t\t\t`arkyn init: ignoring \"${name}\" β not a valid package name.`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\n\t\tnames.add(name);\n\t}\n}\n\nexport function findInstalledArkynPackages(pkg: PackageJson): string[] {\n\tconst names = new Set<string>();\n\n\tcollectArkynNames(pkg.dependencies, names);\n\tcollectArkynNames(pkg.devDependencies, names);\n\n\tnames.delete(SELF_PACKAGE);\n\n\treturn [...names].sort();\n}\n","import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { buildAgentsBlock, mergeAgentsBlock } from \"../utils/agentsBlock\";\nimport {\n\tfindInstalledArkynPackages,\n\ttype PackageJson,\n} from \"../utils/findInstalledArkynPackages\";\nimport { resolveAgentsDocs } from \"../utils/resolveAgentsDocs\";\n\nexport function runInit(cwd: string): void {\n\tconst packageJsonPath = join(cwd, \"package.json\");\n\n\tif (!existsSync(packageJsonPath)) {\n\t\tconsole.error(\n\t\t\t`No package.json found in ${cwd}. Run this command from your project root.`,\n\t\t);\n\t\tprocess.exitCode = 1;\n\t\treturn;\n\t}\n\n\tconst rawPackageJson = readFileSync(packageJsonPath, \"utf8\");\n\n\tlet pkg: PackageJson;\n\ttry {\n\t\tpkg = JSON.parse(rawPackageJson) as PackageJson;\n\t} catch (error) {\n\t\tconst reason = error instanceof Error ? error.message : String(error);\n\t\tconsole.error(`Failed to parse ${packageJsonPath}: ${reason}`);\n\t\tprocess.exitCode = 1;\n\t\treturn;\n\t}\n\n\tconst packageNames = findInstalledArkynPackages(pkg);\n\n\tif (packageNames.length === 0) {\n\t\tconsole.log(\n\t\t\t\"No @arkyn/* packages found in dependencies or devDependencies.\",\n\t\t);\n\t\treturn;\n\t}\n\n\tconst docs = resolveAgentsDocs(cwd, packageNames);\n\n\tif (docs.length === 0) {\n\t\tconsole.log(\n\t\t\t`Found ${packageNames.join(\", \")}, but none of them ship an AGENTS.md yet.`,\n\t\t);\n\t\treturn;\n\t}\n\n\tconst agentsPath = join(cwd, \"AGENTS.md\");\n\tconst existing = existsSync(agentsPath)\n\t\t? readFileSync(agentsPath, \"utf8\")\n\t\t: null;\n\n\tconst block = buildAgentsBlock(docs);\n\twriteFileSync(agentsPath, mergeAgentsBlock(existing, block));\n\n\tconsole.log(\n\t\t`Updated AGENTS.md with docs for: ${docs.map((doc) => doc.name).join(\", \")}`,\n\t);\n}\n","import { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { runInit } from \"./commands/init\";\n\nconst HELP_TEXT = `Usage: arkyn <command> [flags]\n\nCommands:\n init --agents Create or update AGENTS.md in the current project, referencing\n the AGENTS.md docs shipped by installed @arkyn/* packages.\n\nFlags:\n -h, --help Show this help message\n -v, --version Show the installed @arkyn/cli version\n`;\n\n/** Reads the version from this package's own package.json β never hardcoded. */\nfunction getVersion(): string {\n\tconst currentDir = dirname(fileURLToPath(import.meta.url));\n\tconst packageJsonPath = join(currentDir, \"..\", \"package.json\");\n\tconst packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\"));\n\n\treturn packageJson.version;\n}\n\nfunction runCli(argv: string[]) {\n\tconst [command, ...flags] = argv;\n\n\tif (command === \"-v\" || command === \"--version\") {\n\t\tconsole.log(getVersion());\n\t\treturn;\n\t}\n\n\tif (!command || command === \"-h\" || command === \"--help\") {\n\t\tconsole.log(HELP_TEXT);\n\t\treturn;\n\t}\n\n\tif (command === \"init\") {\n\t\tif (!flags.includes(\"--agents\")) {\n\t\t\tconsole.error(\"arkyn init requires the --agents flag.\\n\");\n\t\t\tconsole.log(HELP_TEXT);\n\t\t\tprocess.exitCode = 1;\n\t\t\treturn;\n\t\t}\n\n\t\trunInit(process.cwd());\n\t\treturn;\n\t}\n\n\tconsole.error(`Unknown command: ${command}\\n`);\n\tconsole.log(HELP_TEXT);\n\tprocess.exitCode = 1;\n}\n\n// Only auto-run when this file is the process entrypoint (the published\n// `bin`), not when it's imported by a test.\nconst isDirectlyExecuted = import.meta.url === `file://${process.argv[1]}`;\nif (isDirectlyExecuted) runCli(process.argv.slice(2));\n\nexport { getVersion, HELP_TEXT, runCli };\n"],"mappings":";;;;;AAEA,IAAM,IAAe,+BACf,IAAa;AAEnB,SAAgB,EAAiB,GAAgC;CAKhE,OAAO;EACN;EACA;EACA;EACA;EACA;EATa,EACZ,KAAK,MAAQ,MAAM,EAAI,KAAK,IAAI,EAAI,aAAa,EAAE,CAAC,CACpD,KAAK,IAQN;EACA;CACD,CAAC,CAAC,KAAK,IAAI;AACZ;AAOA,SAAS,EACR,GACA,GACA,GACO;CACP,IAAM,IAAQ,EAAK,YAAY,MAAM,CAAW,IAAI,GAC9C,IAAc,EAAK,QAAQ,MAAM,IAAc,CAAY;CAEjE,OAAO;EAAE;EAAO,KADJ,MAAgB,KAAK,EAAK,SAAS,IAAc;CACzC;AACrB;AAEA,SAAS,EACR,GACA,GACA,GACU;CACV,IAAM,IAAkB,CAAC,GACrB,IAAO;CAEX,SAAS;EACR,IAAM,IAAQ,EAAK,QAAQ,GAAQ,CAAI;EACvC,IAAI,MAAU,IAAI,OAAO;EAEzB,AADA,EAAO,KAAK;GAAE;GAAO;EAAI,CAAC,GAC1B,IAAO,IAAQ,EAAO;CACvB;AACD;AAEA,SAAS,EAAW,GAAc,GAAuB;CACxD,IAAM,IAAS,CAAC,GAAG,CAAK,CAAC,CAAC,MAAM,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