@mergeline/agent 0.4.2 → 0.5.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
@@ -70,13 +70,45 @@ 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 4, 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` (inside the working tree), `git log`, `git add`,
89
+ `git commit -m ...` (also `-am`, `-a -m`: the message on the command
90
+ line, never from a file), `git worktree add
91
+ ../.wt/...`, `git worktree list`, `git push origin agent/...` and
92
+ `git push -u origin agent/...` (one branch, nothing after it),
93
+ `git merge origin/main`;
94
+ - `gh pr create` and `gh pr view`, with the PR body as `--body` text;
95
+ - `npm test`, `npm run lint` and the project's own install, test, lint and
96
+ typecheck scripts.
97
+
98
+ Denied, whatever else allows it: `--upload-pack` (`git fetch -u`, and
99
+ any prefix from `--upl`, since git takes an unambiguous prefix of a long
100
+ option),
101
+ `--receive-pack`, `--exec`, `--output`, `--git-dir`, `--work-tree` and
102
+ `--pathspec-from-file` (from `--pathspec-fr`) on any `git` command;
103
+ `git diff` with `--no-index`, an argument starting with `/`, `~` or `$`
104
+ (bare or quoted), or `../`; a push to `main`, with `--force`, a refspec
105
+ with `:`,
106
+ `--delete`, `-d`, `--mirror`, `--all` or `--tags`; a worktree path that
107
+ leaves `../.wt/`; `--repo` (`-R`) on `gh pr`, `--body-file` (`-F`) on
108
+ `gh pr create`; `gh pr merge`, `gh api`, `gh repo`, `curl`. An agent
109
+ stopped by a rule asks on the board (`board ask`) or releases the ticket
110
+ with what it needed, instead of waiting.
111
+
80
112
  MCP config (Claude Code `--mcp-config`, Codex, other MCP clients):
81
113
 
82
114
  ```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 = 4;
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,20 @@ 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
+ * and `git commit *` (kits 2 and 3) that kit 4 narrows to `-m` (R9.6.1):
64
+ * init takes them out of settings.json, since adding the narrow rules next to
65
+ * them would change nothing.
66
+ */
67
+ const RETIRED_ALLOW = [
68
+ "Bash(board *)",
69
+ ...[PACKAGE_NAME, "@frontender-ua/agent", "@agent-board/agent"].map((p) => `Bash(npx -y ${p} *)`),
70
+ "Bash(git fetch *)",
71
+ "Bash(git worktree *)",
72
+ "Bash(git push *)",
73
+ "Bash(git commit *)",
74
+ ];
60
75
  /** Scripts the agent runs before a PR (done.md), when the project has them. */
61
76
  const CHECK_SCRIPTS = ["test", "lint", "typecheck", "check"];
62
77
  /**
@@ -232,7 +247,9 @@ export function init(opts) {
232
247
  json(join(opts.dir, ".claude", "settings.json"), (data) => {
233
248
  data.permissions ??= {};
234
249
  for (const [list, entries] of Object.entries(ours)) {
235
- const have = Array.isArray(data.permissions[list]) ? data.permissions[list] : [];
250
+ let have = Array.isArray(data.permissions[list]) ? data.permissions[list] : [];
251
+ if (list === "allow")
252
+ have = have.filter((e) => !RETIRED_ALLOW.includes(e));
236
253
  data.permissions[list] = [...have, ...entries.filter((e) => !have.includes(e))];
237
254
  }
238
255
  });
@@ -5,19 +5,70 @@
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
- "Bash(git commit *)",
19
- "Bash(git push *)",
59
+ "Bash(git commit -m *)",
60
+ "Bash(git commit -am *)",
61
+ "Bash(git commit -a -m *)",
62
+ "Bash(git worktree add ../.wt/*)",
63
+ "Bash(git worktree list)",
64
+ "Bash(git push origin agent/*)",
65
+ "Bash(git push -u origin agent/*)",
66
+ "Bash(git merge origin/main)",
67
+ "Bash(git merge --no-edit origin/main)",
68
+ "Bash(git merge origin/main --no-edit)",
69
+ "Bash(gh pr create)",
20
70
  "Bash(gh pr create *)",
71
+ "Bash(gh pr view)",
21
72
  "Bash(gh pr view *)",
22
73
  "Bash(npm test)",
23
74
  "Bash(npm run lint)"
@@ -27,13 +78,60 @@
27
78
  "Bash(gh pr merge *)",
28
79
  "Bash(gh api *)",
29
80
  "Bash(gh repo *)",
81
+ "Bash(git *--upl*)",
82
+ "Bash(git *--receive-pack*)",
83
+ "Bash(git *--exec*)",
84
+ "Bash(git *--output*)",
85
+ "Bash(git *--git-dir*)",
86
+ "Bash(git *--work-tree*)",
87
+ "Bash(git *--pathspec-fr*)",
88
+ "Bash(git diff *--no-index*)",
89
+ "Bash(git diff *../*)",
90
+ "Bash(git diff /*)",
91
+ "Bash(git diff * /*)",
92
+ "Bash(git diff ~*)",
93
+ "Bash(git diff * ~*)",
94
+ "Bash(git diff $*)",
95
+ "Bash(git diff * $*)",
96
+ "Bash(git diff '/*)",
97
+ "Bash(git diff * '/*)",
98
+ "Bash(git diff '~*)",
99
+ "Bash(git diff * '~*)",
100
+ "Bash(git diff '$*)",
101
+ "Bash(git diff * '$*)",
102
+ "Bash(git diff \"/*)",
103
+ "Bash(git diff * \"/*)",
104
+ "Bash(git diff \"~*)",
105
+ "Bash(git diff * \"~*)",
106
+ "Bash(git diff \"$*)",
107
+ "Bash(git diff * \"$*)",
108
+ "Bash(git fetch -u*)",
109
+ "Bash(git fetch * -u*)",
30
110
  "Bash(git push origin main*)",
31
111
  "Bash(git push -u origin main*)",
32
112
  "Bash(git push origin HEAD:main*)",
33
113
  "Bash(git push --force*)",
34
114
  "Bash(git push -f *)",
35
115
  "Bash(git push * --force*)",
36
- "Bash(git push * -f*)"
116
+ "Bash(git push * -f*)",
117
+ "Bash(git push *:*)",
118
+ "Bash(git push origin agent/* *)",
119
+ "Bash(git push -u origin agent/* *)",
120
+ "Bash(git push * --delete*)",
121
+ "Bash(git push * -d*)",
122
+ "Bash(git push * --mirror*)",
123
+ "Bash(git push * --all*)",
124
+ "Bash(git push * --tags*)",
125
+ "Bash(git worktree add ../.wt/*..*)",
126
+ "Bash(gh pr create *--repo*)",
127
+ "Bash(gh pr create * -R*)",
128
+ "Bash(gh pr create -R*)",
129
+ "Bash(gh pr view *--repo*)",
130
+ "Bash(gh pr view * -R*)",
131
+ "Bash(gh pr view -R*)",
132
+ "Bash(gh pr create *--body-file*)",
133
+ "Bash(gh pr create * -F*)",
134
+ "Bash(gh pr create -F*)"
37
135
  ]
38
136
  }
39
137
  }
package/kit/done.md CHANGED
@@ -9,7 +9,8 @@ the `board` command of the same name (`submit_for_review` is `board submit`).
9
9
  2. Call `heartbeat` before you push. If it says another session holds the
10
10
  ticket, stop at once: do not commit, push or open a PR. If it says to
11
11
  claim again, stop and claim.
12
- 3. Commit with a clear message and push the branch:
12
+ 3. Commit with a clear message given on the command line,
13
+ `git commit -m "<message>"` (or `-am`), and push the branch:
13
14
  `git push -u origin <branch>`.
14
15
  4. Open a PR against `main` with `gh pr create`. Title: the ticket title.
15
16
  The body names the ticket id, the spec path and the spec commit
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.1",
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",