agent-kitchen 0.3.0 → 0.3.1

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 CHANGED
@@ -24,7 +24,7 @@ Al arrancar revisa si npm tiene una versión más nueva de sí mismo. Si la hay,
24
24
  |---|---|---|---|---|---|
25
25
  | `issue-flow` | Flujo de issues ([`@ramon-sg/issue-flow`](https://github.com/ramon-sg/issue-flow)): rama, worktree y PR en draft por issue, y sus 5 skills | `package.json` | npm | `issue-flow init` | `issue-flow upgrade` en la versión nueva, y sus skills a la misma tag |
26
26
  | `claude-cloud` | Sesiones en la nube ([`@ramon-sg/claude-cloud`](https://github.com/ramon-sg/claude-cloud)): herramientas, Docker y el clone completo | `.claude/cloud.json` | npm | `claude-cloud init` | Cambia la versión que fija `.claude/cloud.json` |
27
- | `claude-repo-guard` | Barandas ([`claude-repo-guard`](https://github.com/ramon-sg/claude-repo-guard)): modo auto con sandbox, escribe solo en su worktree | `.claude/repo-guard.manifest.json` | Tags `vX.Y.Z` de GitHub | `install` en esa tag | `install` en la tag nueva |
27
+ | `claude-repo-guard` | Barandas ([`claude-repo-guard`](https://github.com/ramon-sg/claude-repo-guard)): modo auto con sandbox, escribe solo en su worktree | `.claude/repo-guard.manifest.json` | Tags `vX.Y.Z` de GitHub | `apply` en esa tag (`install` antes de 0.5.0) | `apply` en la tag nueva |
28
28
  | `skills` | Skills con [`skills-manager`](https://github.com/ramon-sg/skills-manager): las del flujo y las de [`agent-skills`](https://github.com/ramon-sg/agent-skills) (planes, auditoría de código y de tests) | `.agents/skills.lock.json` | Tags del catálogo | `skills-manager init --select` con las elegidas | `skills-manager update` |
29
29
 
30
30
  Si npm o GitHub no responden, la pieza se muestra pero no se ofrece actualizarla. Si un paso falla, los demás siguen y el comando dice cómo reintentarlo.
@@ -7,6 +7,11 @@
7
7
  * macOS `weakerNetworkIsolation` lets `gh` work inside the sandbox (the guard's own default
8
8
  * is false, so false counts as missing; the step can be unticked). When the flow is
9
9
  * installed in the same run, the guard gets those options in that run too.
10
+ *
11
+ * Its command that installs or updates is `apply` since 0.5.0 and `install` before, so the
12
+ * command follows the version being run. If it fails, its own output is shown; the hint about
13
+ * Claude's sandbox is added only when that output is a permission error, which is how the
14
+ * sandbox's block on `.claude/settings.json` shows up.
10
15
  */
11
16
  import { type Check, type PieceStatus } from "../piece.js";
12
17
  /** The piece's name, as `--skip` takes it. */
@@ -24,6 +29,21 @@ export declare const WEAKER_NETWORK = "weakerNetworkIsolation";
24
29
  * @example guardSpec("0.2.0") // "github:ramon-sg/claude-repo-guard#v0.2.0"
25
30
  */
26
31
  export declare function guardSpec(version: string | null): string;
32
+ /**
33
+ * The guard's command that installs or updates, at a version.
34
+ * @param version - The version, or null for the default branch.
35
+ * @returns `apply` from 0.5.0 on and on the default branch, `install` before.
36
+ * @example guardCommand("0.4.1") // "install"
37
+ */
38
+ export declare function guardCommand(version: string | null): string;
39
+ /**
40
+ * What to say when the guard did not install.
41
+ * @param version - The version it ran.
42
+ * @param output - What it printed.
43
+ * @returns One line: the command to run by hand, and the sandbox hint only if the output is a permission error.
44
+ * @example guardFailure("0.5.1", "Error: EPERM: operation not permitted") // "…sandbox…"
45
+ */
46
+ export declare function guardFailure(version: string | null, output: string): string;
27
47
  /**
28
48
  * The guard's options with what the flow needs added; what the repo set stays.
29
49
  * @param root - The repo.
@@ -7,6 +7,11 @@
7
7
  * macOS `weakerNetworkIsolation` lets `gh` work inside the sandbox (the guard's own default
8
8
  * is false, so false counts as missing; the step can be unticked). When the flow is
9
9
  * installed in the same run, the guard gets those options in that run too.
10
+ *
11
+ * Its command that installs or updates is `apply` since 0.5.0 and `install` before, so the
12
+ * command follows the version being run. If it fails, its own output is shown; the hint about
13
+ * Claude's sandbox is added only when that output is a permission error, which is how the
14
+ * sandbox's block on `.claude/settings.json` shows up.
10
15
  */
11
16
  import { FLOW_CONFIG } from "../piece.js";
12
17
  import { readJson, writeJson } from "../repo.js";
@@ -32,6 +37,32 @@ export const WEAKER_NETWORK = "weakerNetworkIsolation";
32
37
  export function guardSpec(version) {
33
38
  return version === null ? `github:${REPO}` : `github:${REPO}#v${version}`;
34
39
  }
40
+ /** The first version whose install command is `apply`. */
41
+ const APPLY_SINCE = "0.5.0";
42
+ /** What a write blocked by a sandbox or by the file's permissions prints. */
43
+ const PERMISSION_ERROR = /\b(EPERM|EACCES|EROFS)\b|operation not permitted|permission denied|read-only file system/i;
44
+ /**
45
+ * The guard's command that installs or updates, at a version.
46
+ * @param version - The version, or null for the default branch.
47
+ * @returns `apply` from 0.5.0 on and on the default branch, `install` before.
48
+ * @example guardCommand("0.4.1") // "install"
49
+ */
50
+ export function guardCommand(version) {
51
+ return version === null || compareVersions(version, APPLY_SINCE) >= 0 ? "apply" : "install";
52
+ }
53
+ /**
54
+ * What to say when the guard did not install.
55
+ * @param version - The version it ran.
56
+ * @param output - What it printed.
57
+ * @returns One line: the command to run by hand, and the sandbox hint only if the output is a permission error.
58
+ * @example guardFailure("0.5.1", "Error: EPERM: operation not permitted") // "…sandbox…"
59
+ */
60
+ export function guardFailure(version, output) {
61
+ const command = `npx ${guardSpec(version)} ${guardCommand(version)}`;
62
+ if (PERMISSION_ERROR.test(output))
63
+ return `claude-repo-guard no se instaló: no tuvo permiso para escribir en el repo. Si corres agent-kitchen dentro de una sesión de Claude, su sandbox bloquea .claude/settings.json; corre '${command}' desde tu terminal.`;
64
+ return `claude-repo-guard no se instaló; su error está abajo. Para reintentar a mano: '${command}'.`;
65
+ }
35
66
  /**
36
67
  * The guard's options with what the flow needs added; what the repo set stays.
37
68
  * @param root - The repo.
@@ -71,10 +102,10 @@ async function install(context, version) {
71
102
  writeJson(context.root, CONFIG, options);
72
103
  for (const change of changes)
73
104
  context.note(change);
74
- const run = await runNpx(context.root, [guardSpec(version), "install", "--yes"]);
105
+ const run = await runNpx(context.root, [guardSpec(version), guardCommand(version), "--yes"]);
75
106
  if (run.ok)
76
107
  return true;
77
- context.fail(`claude-repo-guard no se instaló; corre 'npx ${guardSpec(version)} install' desde tu terminal (dentro de una sesión de Claude su sandbox bloquea .claude/settings.json).`, run.output);
108
+ context.fail(guardFailure(version, run.output), run.output);
78
109
  return false;
79
110
  }
80
111
  /**
package/package.json CHANGED
@@ -1,13 +1,22 @@
1
1
  {
2
2
  "name": "agent-kitchen",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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 and claude-repo-guard.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "bin": { "agent-kitchen": "dist/cli.js" },
8
- "files": ["dist"],
9
- "engines": { "node": ">=20" },
10
- "publishConfig": { "access": "public", "provenance": true },
7
+ "bin": {
8
+ "agent-kitchen": "dist/cli.js"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "engines": {
14
+ "node": ">=20"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "provenance": true
19
+ },
11
20
  "repository": {
12
21
  "type": "git",
13
22
  "url": "git+https://github.com/ramon-sg/agent-kitchen.git"
@@ -17,6 +26,11 @@
17
26
  "test": "tsc && node --test test/*.test.mjs",
18
27
  "prepublishOnly": "npm test"
19
28
  },
20
- "dependencies": { "@clack/prompts": "1.8.1" },
21
- "devDependencies": { "@types/node": "^24.0.0", "typescript": "^5.9.3" }
29
+ "dependencies": {
30
+ "@clack/prompts": "1.8.1"
31
+ },
32
+ "devDependencies": {
33
+ "@types/node": "^24.0.0",
34
+ "typescript": "^5.9.3"
35
+ }
22
36
  }