agent-kitchen 0.4.0 → 0.6.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/README.md +15 -4
- package/dist/cli.js +10 -5
- package/dist/commands/doctor.d.ts +1 -8
- package/dist/commands/doctor.js +23 -6
- package/dist/commands/sync.d.ts +22 -2
- package/dist/commands/sync.js +220 -29
- package/dist/decisions.d.ts +54 -0
- package/dist/decisions.js +91 -0
- package/dist/git-finish.d.ts +53 -0
- package/dist/git-finish.js +253 -0
- package/dist/menu.d.ts +33 -0
- package/dist/menu.js +46 -0
- package/dist/piece.d.ts +6 -5
- package/dist/piece.js +6 -5
- package/dist/pieces/issue-flow.d.ts +12 -4
- package/dist/pieces/issue-flow.js +205 -26
- package/dist/pieces/skills-manager.d.ts +31 -0
- package/dist/pieces/skills-manager.js +127 -0
- package/dist/repo.d.ts +20 -0
- package/dist/repo.js +51 -0
- package/dist/skills-files.d.ts +5 -3
- package/dist/skills-files.js +15 -9
- package/dist/tools.d.ts +33 -2
- package/dist/tools.js +52 -5
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file How agent-kitchen reaches the other tools and their releases: `npx` to run them (always
|
|
3
3
|
* by their scoped name or GitHub spec, because the unscoped names on npm belong to other
|
|
4
|
-
* people), `npm view` for the latest version on npm, and `git ls-remote` for the latest
|
|
4
|
+
* people), `npm view` for the latest version on npm and a version's dependencies, and `git ls-remote` for the latest
|
|
5
5
|
* `vX.Y.Z` tag on GitHub. Everything is asynchronous so the lookups run at the same time,
|
|
6
6
|
* and each lookup runs once per process. A lookup that fails, or takes over 20 seconds,
|
|
7
7
|
* gives null: the piece is shown, not offered. git never asks for credentials here.
|
|
@@ -67,7 +67,10 @@ export function isRelease(version) {
|
|
|
67
67
|
*/
|
|
68
68
|
function run(program, args, options = {}) {
|
|
69
69
|
return new Promise((resolve) => {
|
|
70
|
-
const
|
|
70
|
+
const env = { ...process.env, ...options.env };
|
|
71
|
+
for (const name of options.unset ?? [])
|
|
72
|
+
delete env[name];
|
|
73
|
+
const child = spawn(program, args, { cwd: options.cwd, env, stdio: options.inherit === true ? "inherit" : ["ignore", "pipe", "pipe"] });
|
|
71
74
|
let out = "";
|
|
72
75
|
let err = "";
|
|
73
76
|
child.stdout?.on("data", (chunk) => (out += chunk.toString()));
|
|
@@ -108,6 +111,26 @@ export function npmLatest(name) {
|
|
|
108
111
|
return isRelease(version) ? version : null;
|
|
109
112
|
});
|
|
110
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* The dependencies a version of a package declares on npm.
|
|
116
|
+
* @param spec - The package and its version, as `name@x.y.z`.
|
|
117
|
+
* @returns Each dependency's range, or null if npm cannot tell.
|
|
118
|
+
* @example await npmDependencies("@ramon-sg/issue-flow@0.3.0") // { "@ramon-sg/github-rest": "^0.3.0" }
|
|
119
|
+
*/
|
|
120
|
+
export function npmDependencies(spec) {
|
|
121
|
+
return once(`npm-deps:${spec}`, async () => {
|
|
122
|
+
const result = await run("npm", ["view", spec, "dependencies", "--json", "--fetch-retries=0"], { timeout: LOOKUP_TIMEOUT_MS });
|
|
123
|
+
if (result.status !== 0)
|
|
124
|
+
return null;
|
|
125
|
+
try {
|
|
126
|
+
const found = JSON.parse(result.out);
|
|
127
|
+
return typeof found === "object" && found !== null && !Array.isArray(found) ? found : null;
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
111
134
|
/**
|
|
112
135
|
* The highest `vX.Y.Z` tag of a GitHub repo.
|
|
113
136
|
* @param repo - The repo, as owner/name.
|
|
@@ -162,14 +185,38 @@ export function failedOutput(output) {
|
|
|
162
185
|
return lines.slice(-FAILED_LINES).map((line) => ` ${line}\n`).join("");
|
|
163
186
|
}
|
|
164
187
|
/**
|
|
165
|
-
* Runs `npx --yes <args>` in the repo and returns what it printed
|
|
188
|
+
* Runs `npx --yes <args>` in the repo and returns what it printed.
|
|
166
189
|
* @param root - The repo.
|
|
167
190
|
* @param args - The package and its arguments.
|
|
168
191
|
* @param lookup - True to give up after the lookups' time limit, for a read that only informs.
|
|
169
|
-
* @returns Its stdout and exit code, or null if npx could not start.
|
|
192
|
+
* @returns Its stdout, stderr and exit code, or null if npx could not start.
|
|
170
193
|
* @example await captureNpx(root, ["@ramon-sg/issue-flow@0.2.0", "doctor", "--json"])
|
|
171
194
|
*/
|
|
172
195
|
export async function captureNpx(root, args, lookup = false) {
|
|
173
196
|
const result = await run("npx", ["--yes", ...args], { cwd: root, ...(lookup ? { timeout: LOOKUP_TIMEOUT_MS } : {}) });
|
|
174
|
-
return result.status === null && result.out === "" ? null : { out: result.out, status: result.status };
|
|
197
|
+
return result.status === null && result.out === "" ? null : { out: result.out, err: result.err, status: result.status };
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Runs the repo's package manager's install: quietly, or with its output on the terminal
|
|
201
|
+
* with `--verbose`.
|
|
202
|
+
* @param root - The repo.
|
|
203
|
+
* @param manager - `npm`, `pnpm`, `bun` or `yarn`.
|
|
204
|
+
* @returns Whether it worked and, if it ran quietly, what it printed.
|
|
205
|
+
* @example await runInstall(root, "pnpm")
|
|
206
|
+
*/
|
|
207
|
+
export async function runInstall(root, manager) {
|
|
208
|
+
const result = await run(manager, ["install"], { cwd: root, inherit: verbose });
|
|
209
|
+
return { ok: result.status === 0, output: `${result.out}${result.err}` };
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Runs `npx --yes <args>` in the repo without some variables of the environment, and returns
|
|
213
|
+
* what it printed.
|
|
214
|
+
* @param root - The repo.
|
|
215
|
+
* @param args - The package and its arguments.
|
|
216
|
+
* @param unset - The variables left out.
|
|
217
|
+
* @returns Its stdout, stderr and exit code.
|
|
218
|
+
* @example await captureNpxWithout(root, ["@ramon-sg/github-rest@0.3.0", "pr", "create"], ["GH_REPO"])
|
|
219
|
+
*/
|
|
220
|
+
export async function captureNpxWithout(root, args, unset) {
|
|
221
|
+
return run("npx", ["--yes", ...args], { cwd: root, unset });
|
|
175
222
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-kitchen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "One command to install, update and check a repo's agent tooling: the issue flow and its skills, the general skills, Claude cloud sessions, claude-repo-guard and the installed-versions rule in AGENTS.md.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|