@mergeline/agent 0.4.2 → 0.5.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 CHANGED
@@ -70,13 +70,38 @@ npx @mergeline/agent init --dry-run # show what would change
70
70
  `CLAUDE.md` and leaves the rest of each file alone; running it again updates
71
71
  only that section. It writes `/pick` and `/done` only where no file of that
72
72
  name exists or where the file still carries the kit's marker line, adds its
73
- permissions to `.claude/settings.json` without removing any (plus the
74
- repository's own package manager: install and its test, lint and typecheck
75
- scripts, from the lockfile and `package.json`), and adds a `board` server to
73
+ permissions to `.claude/settings.json` (plus the repository's own package
74
+ manager: install and its test, lint and typecheck scripts, from the lockfile
75
+ and `package.json`) and removes only the broad rules an older kit wrote
76
+ (`Bash(board *)`, `Bash(git push *)` and the like), and adds a `board` server to
76
77
  `.mcp.json` that reads `${BOARD_URL}` and `${BOARD_AGENT_KEY}` from the
77
78
  environment, or else the key `login` saved: the key is never written to the
78
79
  repository.
79
80
 
81
+ What the agent may run without asking (kit 3, in `.claude/settings.json`):
82
+
83
+ - the board's MCP tools, and `board` (or `npx -y @mergeline/agent`) with
84
+ `claim`, `heartbeat`, `log`, `record-spec`, `ask`, `submit`, `release`,
85
+ `list`, `whoami`, `help`; Claude Code asks the person for `start`,
86
+ `watch`, `login`, `init` and `mcp`;
87
+ - `git fetch origin ...`, `git show`, `git rev-parse`, `git status`,
88
+ `git diff`, `git log`, `git add`, `git commit`, `git worktree add
89
+ ../.wt/...`, `git worktree list`, `git push origin agent/...` and
90
+ `git push -u origin agent/...` (one branch, nothing after it),
91
+ `git merge origin/main`;
92
+ - `gh pr create` and `gh pr view`, with the PR body as `--body` text;
93
+ - `npm test`, `npm run lint` and the project's own install, test, lint and
94
+ typecheck scripts.
95
+
96
+ Denied, whatever else allows it: `--upload-pack` (`git fetch -u`),
97
+ `--receive-pack`, `--exec`, `--output`, `--git-dir` and `--work-tree` on any
98
+ `git` command; a push to `main`, with `--force`, a refspec with `:`,
99
+ `--delete`, `-d`, `--mirror`, `--all` or `--tags`; a worktree path that
100
+ leaves `../.wt/`; `--repo` (`-R`) on `gh pr`, `--body-file` (`-F`) on
101
+ `gh pr create`; `gh pr merge`, `gh api`, `gh repo`, `curl`. An agent
102
+ stopped by a rule asks on the board (`board ask`) or releases the ticket
103
+ with what it needed, instead of waiting.
104
+
80
105
  MCP config (Claude Code `--mcp-config`, Codex, other MCP clients):
81
106
 
82
107
  ```json
package/dist/init.js CHANGED
@@ -7,7 +7,8 @@
7
7
  // - Command and prompt files are written only when missing or when they carry
8
8
  // the kit's marker line; a file of the same name that the kit did not write
9
9
  // is skipped with a note.
10
- // - .claude/settings.json gets the kit's permissions added to its lists;
10
+ // - .claude/settings.json gets the kit's permissions added to its lists
11
+ // (and loses the broad allow rules of kits 1 and 2, RETIRED_ALLOW);
11
12
  // .mcp.json gets a `board` server unless it already has one. The agent key
12
13
  // is never written: .mcp.json refers to ${BOARD_URL} and ${BOARD_AGENT_KEY}.
13
14
  // The permissions also allow the repository's own package manager (from its
@@ -43,7 +44,7 @@ export const PACKAGE_VERSION = PACKAGE.version;
43
44
  * which wrote no version. The board says when a claim's kit is older than it
44
45
  * expects (KIT_MIN in pocketbase/pb_hooks/board_lib.js).
45
46
  */
46
- export const KIT_VERSION = 2;
47
+ export const KIT_VERSION = 3;
47
48
  const START = `<!-- mergeline:start (kit ${KIT_VERSION}; managed by \`board init\`; edit outside these markers) -->`;
48
49
  /** Markers are found by these prefixes, so an edited marker line or an older kit's still counts. */
49
50
  const START_PREFIX = "<!-- mergeline:start";
@@ -57,6 +58,18 @@ const COMMANDS = {
57
58
  pick: "Take the next ticket from the board and work on it",
58
59
  done: "Finish the current ticket: test, push, open a PR, submit for review",
59
60
  };
61
+ /**
62
+ * Allow rules an older kit wrote that kit 3 narrows (security audit run 1):
63
+ * init takes them out of settings.json, since adding the narrow rules next to
64
+ * them would change nothing.
65
+ */
66
+ const RETIRED_ALLOW = [
67
+ "Bash(board *)",
68
+ ...[PACKAGE_NAME, "@frontender-ua/agent", "@agent-board/agent"].map((p) => `Bash(npx -y ${p} *)`),
69
+ "Bash(git fetch *)",
70
+ "Bash(git worktree *)",
71
+ "Bash(git push *)",
72
+ ];
60
73
  /** Scripts the agent runs before a PR (done.md), when the project has them. */
61
74
  const CHECK_SCRIPTS = ["test", "lint", "typecheck", "check"];
62
75
  /**
@@ -232,7 +245,9 @@ export function init(opts) {
232
245
  json(join(opts.dir, ".claude", "settings.json"), (data) => {
233
246
  data.permissions ??= {};
234
247
  for (const [list, entries] of Object.entries(ours)) {
235
- const have = Array.isArray(data.permissions[list]) ? data.permissions[list] : [];
248
+ let have = Array.isArray(data.permissions[list]) ? data.permissions[list] : [];
249
+ if (list === "allow")
250
+ have = have.filter((e) => !RETIRED_ALLOW.includes(e));
236
251
  data.permissions[list] = [...have, ...entries.filter((e) => !have.includes(e))];
237
252
  }
238
253
  });
@@ -5,19 +5,68 @@
5
5
  ],
6
6
  "allow": [
7
7
  "mcp__board__*",
8
- "Bash(board *)",
9
- "Bash(npx -y {{package}} *)",
10
- "Bash(git fetch *)",
8
+ "Bash(board claim)",
9
+ "Bash(board claim *)",
10
+ "Bash(board heartbeat)",
11
+ "Bash(board heartbeat *)",
12
+ "Bash(board log)",
13
+ "Bash(board log *)",
14
+ "Bash(board record-spec)",
15
+ "Bash(board record-spec *)",
16
+ "Bash(board ask)",
17
+ "Bash(board ask *)",
18
+ "Bash(board submit)",
19
+ "Bash(board submit *)",
20
+ "Bash(board release)",
21
+ "Bash(board release *)",
22
+ "Bash(board list)",
23
+ "Bash(board list *)",
24
+ "Bash(board whoami)",
25
+ "Bash(board whoami *)",
26
+ "Bash(board help)",
27
+ "Bash(board help *)",
28
+ "Bash(npx -y {{package}} claim)",
29
+ "Bash(npx -y {{package}} claim *)",
30
+ "Bash(npx -y {{package}} heartbeat)",
31
+ "Bash(npx -y {{package}} heartbeat *)",
32
+ "Bash(npx -y {{package}} log)",
33
+ "Bash(npx -y {{package}} log *)",
34
+ "Bash(npx -y {{package}} record-spec)",
35
+ "Bash(npx -y {{package}} record-spec *)",
36
+ "Bash(npx -y {{package}} ask)",
37
+ "Bash(npx -y {{package}} ask *)",
38
+ "Bash(npx -y {{package}} submit)",
39
+ "Bash(npx -y {{package}} submit *)",
40
+ "Bash(npx -y {{package}} release)",
41
+ "Bash(npx -y {{package}} release *)",
42
+ "Bash(npx -y {{package}} list)",
43
+ "Bash(npx -y {{package}} list *)",
44
+ "Bash(npx -y {{package}} whoami)",
45
+ "Bash(npx -y {{package}} whoami *)",
46
+ "Bash(npx -y {{package}} help)",
47
+ "Bash(npx -y {{package}} help *)",
48
+ "Bash(git fetch origin)",
49
+ "Bash(git fetch origin *)",
11
50
  "Bash(git show *)",
12
51
  "Bash(git rev-parse *)",
13
- "Bash(git worktree *)",
52
+ "Bash(git status)",
14
53
  "Bash(git status *)",
54
+ "Bash(git diff)",
15
55
  "Bash(git diff *)",
56
+ "Bash(git log)",
16
57
  "Bash(git log *)",
17
58
  "Bash(git add *)",
18
59
  "Bash(git commit *)",
19
- "Bash(git push *)",
60
+ "Bash(git worktree add ../.wt/*)",
61
+ "Bash(git worktree list)",
62
+ "Bash(git push origin agent/*)",
63
+ "Bash(git push -u origin agent/*)",
64
+ "Bash(git merge origin/main)",
65
+ "Bash(git merge --no-edit origin/main)",
66
+ "Bash(git merge origin/main --no-edit)",
67
+ "Bash(gh pr create)",
20
68
  "Bash(gh pr create *)",
69
+ "Bash(gh pr view)",
21
70
  "Bash(gh pr view *)",
22
71
  "Bash(npm test)",
23
72
  "Bash(npm run lint)"
@@ -27,13 +76,39 @@
27
76
  "Bash(gh pr merge *)",
28
77
  "Bash(gh api *)",
29
78
  "Bash(gh repo *)",
79
+ "Bash(git *--upload-pack*)",
80
+ "Bash(git *--receive-pack*)",
81
+ "Bash(git *--exec*)",
82
+ "Bash(git *--output*)",
83
+ "Bash(git *--git-dir*)",
84
+ "Bash(git *--work-tree*)",
85
+ "Bash(git fetch -u*)",
86
+ "Bash(git fetch * -u*)",
30
87
  "Bash(git push origin main*)",
31
88
  "Bash(git push -u origin main*)",
32
89
  "Bash(git push origin HEAD:main*)",
33
90
  "Bash(git push --force*)",
34
91
  "Bash(git push -f *)",
35
92
  "Bash(git push * --force*)",
36
- "Bash(git push * -f*)"
93
+ "Bash(git push * -f*)",
94
+ "Bash(git push *:*)",
95
+ "Bash(git push origin agent/* *)",
96
+ "Bash(git push -u origin agent/* *)",
97
+ "Bash(git push * --delete*)",
98
+ "Bash(git push * -d*)",
99
+ "Bash(git push * --mirror*)",
100
+ "Bash(git push * --all*)",
101
+ "Bash(git push * --tags*)",
102
+ "Bash(git worktree add ../.wt/*..*)",
103
+ "Bash(gh pr create *--repo*)",
104
+ "Bash(gh pr create * -R*)",
105
+ "Bash(gh pr create -R*)",
106
+ "Bash(gh pr view *--repo*)",
107
+ "Bash(gh pr view * -R*)",
108
+ "Bash(gh pr view -R*)",
109
+ "Bash(gh pr create *--body-file*)",
110
+ "Bash(gh pr create * -F*)",
111
+ "Bash(gh pr create -F*)"
37
112
  ]
38
113
  }
39
114
  }
package/kit/rules.md CHANGED
@@ -25,6 +25,9 @@ the done instructions: `/pick` and `/done` in Claude Code,
25
25
  - Call `heartbeat` after every meaningful step. If a board tool says to claim
26
26
  again, stop and claim. If it says another session holds the ticket, stop
27
27
  at once: no commit, no push, no PR.
28
+ - If something in your environment stops you (a command you need is
29
+ denied, a tool is missing), do not wait: say what and why with
30
+ `ask_human` (`board ask`), or `release` the ticket with that note.
28
31
  - If a board tool says the board is paused, stop and tell the human: it
29
32
  wakes when a person opens it. Do not retry in a loop.
30
33
  - If `claim` answers with `kit_outdated`, tell the human what it says once
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mergeline/agent",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "The agent's side of a Mergeline board: an MCP server and the `board` CLI. Works with any agent tool that runs MCP servers or shell commands.",
5
5
  "license": "MIT",
6
6
  "author": "frontender-ua",