@cniska/agent-worktree 0.1.0 → 0.3.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 +49 -10
- package/bin/agent-worktree +10 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -6,23 +6,53 @@
|
|
|
6
6
|
|
|
7
7
|
agent-worktree never works out what a checkout needs: `agent-worktree install` writes the setup and teardown commands and the port count the project gives it into hooks, and agent-worktree runs those.
|
|
8
8
|
|
|
9
|
-
- `agent-worktree create <name>` makes a git worktree outside the repository, on a new branch cut from `origin`'s default branch as `origin` has it now, runs the project's setup hook in it, and prints its path.
|
|
10
|
-
- `agent-worktree remove <name>` runs the project's teardown hook, removes the worktree, and once its remote's default branch has the branch, deletes it locally and
|
|
9
|
+
- `agent-worktree create <name>` makes a git worktree outside the repository, on a new branch cut from `origin`'s default branch as `origin` has it now, runs the project's setup hook in it, and prints its path in its result.
|
|
10
|
+
- `agent-worktree remove <name>` runs the project's teardown hook, removes the worktree, and once its remote's default branch has the branch, deletes it locally and on that remote: its upstream or, with none, the branch of the same name on `origin`, other than `origin`'s default branch. When the remote branch holds a commit the branch lacks, it keeps both copies.
|
|
11
11
|
- The `cniska-worktree` Claude Code plugin sends Claude Code's own worktrees through the same commands.
|
|
12
12
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
15
|
-
agent-worktree
|
|
15
|
+
Install the `agent-worktree` command for macOS on Apple silicon or Linux on x64 through one of these channels.
|
|
16
|
+
|
|
17
|
+
With the release's installer:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
curl -fsSL https://github.com/cniska/agent-worktree/releases/latest/download/install.sh | sh
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
With Homebrew:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
brew install cniska/tap/agent-worktree
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
With npm:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install -g @cniska/agent-worktree
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
With Bun:
|
|
16
36
|
|
|
17
37
|
```bash
|
|
18
|
-
|
|
19
|
-
cd agent-worktree
|
|
20
|
-
mise trust && mise install
|
|
38
|
+
bun add -g @cniska/agent-worktree
|
|
21
39
|
```
|
|
22
40
|
|
|
23
|
-
|
|
41
|
+
The curl line installs `~/.local/bin/agent-worktree` and, when that directory is not on your `PATH`, adds it to `~/.zshrc` for zsh or to an existing `~/.bashrc` or `~/.bash_profile` for bash, and otherwise asks you to add it. Each channel updates the way it installed: `brew upgrade agent-worktree`, `npm update -g @cniska/agent-worktree`, `bun update -g @cniska/agent-worktree`, or the curl line run again.
|
|
42
|
+
|
|
43
|
+
### Updates
|
|
44
|
+
|
|
45
|
+
Once a day, an installed `agent-worktree` asks the channel it came from for the latest release, giving up after a second. While a newer one is out, every command prints one line on stderr before anything else, with its stdout and exit code unchanged:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
agent-worktree 0.3.1 is out (running 0.3.0): run brew upgrade agent-worktree; if you cannot, tell the user.
|
|
49
|
+
```
|
|
24
50
|
|
|
25
|
-
|
|
51
|
+
The line names the upgrade for the channel it was installed through. The check runs only for an install it can place: one Homebrew, npm or Bun installed, or the curl line's `~/.local/bin/agent-worktree`. It records when it last asked in `${XDG_STATE_HOME:-~/.local/state}/agent-worktree/update-check.json`. Set `AGENT_WORKTREE_NO_UPDATE_CHECK=1` to turn it off; it is also off when `CI` is set, and under the plugin's `agent-worktree hook`.
|
|
52
|
+
|
|
53
|
+
### Claude Code plugin
|
|
54
|
+
|
|
55
|
+
Install the Claude Code plugin:
|
|
26
56
|
|
|
27
57
|
```bash
|
|
28
58
|
claude plugin install cniska-worktree@cniska
|
|
@@ -42,10 +72,11 @@ Claude Code makes worktrees of its own, for EnterWorktree and for subagents, wit
|
|
|
42
72
|
| `agent-worktree create [--from <ref>] <name>` | Create the worktree, run setup, print the path |
|
|
43
73
|
| `agent-worktree remove [--force] <name>` | Run teardown, remove the worktree and settle its branch |
|
|
44
74
|
| `agent-worktree prune` | Tear down gone worktrees and remove those whose branch landed |
|
|
45
|
-
| `agent-worktree ls` |
|
|
75
|
+
| `agent-worktree ls [--full]` | Count the worktrees in each state and list them; also what `agent-worktree` alone prints |
|
|
46
76
|
| `agent-worktree path <name>` | Print the worktree's path |
|
|
77
|
+
| `agent-worktree doctor [--full]` | Report what agent-worktree, its plugin and the project need, each check with its fix |
|
|
47
78
|
|
|
48
|
-
[Commands](docs/commands.md) lists every command, where `create` cuts a branch
|
|
79
|
+
Each command prints its result, or its error, as one [TOON](https://toonformat.dev) document. [Commands](docs/commands.md) lists every command and its output, where `create` cuts a branch, how `remove` settles one and what `doctor` checks.
|
|
49
80
|
|
|
50
81
|
## Docs
|
|
51
82
|
|
|
@@ -54,3 +85,11 @@ Claude Code makes worktrees of its own, for EnterWorktree and for subagents, wit
|
|
|
54
85
|
- [Claude Code plugin](docs/plugin.md): what the plugin does and what it needs.
|
|
55
86
|
- [Development](docs/development.md): setup, checks, layout and rules, for working on this repo.
|
|
56
87
|
- [Releasing](docs/releasing.md): the release workflow, the owner's one-time setup and each release's steps.
|
|
88
|
+
|
|
89
|
+
## Related
|
|
90
|
+
|
|
91
|
+
agent-worktree works on its own in any agent workflow, and is one of the optional add-ons to [agent-skills](https://github.com/cniska/agent-skills), engineering skills for coding agents. The other add-ons:
|
|
92
|
+
|
|
93
|
+
- [agent-task](https://github.com/cniska/agent-task): task tracking for coding agents, the tasks running, in review and waiting to run
|
|
94
|
+
- [agent-record](https://github.com/cniska/agent-record): a session record for coding agents, every past session queryable and joined to its commits
|
|
95
|
+
- [agent-gates](https://github.com/cniska/agent-gates): commit gates for coding agents, git hooks and CI checks that refuse a bad commit
|
package/bin/agent-worktree
CHANGED
|
@@ -5,8 +5,13 @@ builds='darwin-arm64 linux-x64'
|
|
|
5
5
|
name=agent-worktree
|
|
6
6
|
scope=@cniska
|
|
7
7
|
|
|
8
|
+
quoted() {
|
|
9
|
+
printf '"%s"' "$(printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g')"
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
refuse() {
|
|
9
|
-
printf '%s: %s\n %s\n'
|
|
13
|
+
printf 'command: %s\nok: false\nerror:\n kind: refusal\n code: %s\n message: %s\n meta:\n resolve: %s\n' \
|
|
14
|
+
"$name" "$1" "$(quoted "$2")" "$(quoted "$3")" >&2
|
|
10
15
|
exit 1
|
|
11
16
|
}
|
|
12
17
|
|
|
@@ -34,9 +39,9 @@ target=$os-$cpu
|
|
|
34
39
|
|
|
35
40
|
case " $builds " in
|
|
36
41
|
*" $target "*) ;;
|
|
37
|
-
*) refuse \
|
|
42
|
+
*) refuse no_build_for_platform \
|
|
38
43
|
"$name ships no build for $target, only $(printf '%s' "$builds" | sed 's/ / and /g')" \
|
|
39
|
-
"build $name from source with Bun, as its
|
|
44
|
+
"build $name from source with Bun, as its docs/development.md says" ;;
|
|
40
45
|
esac
|
|
41
46
|
|
|
42
47
|
package=$scope/$name-$target
|
|
@@ -47,9 +52,9 @@ for dir in "$bin/../node_modules/$package" "$bin/../../$name-$target"; do
|
|
|
47
52
|
break
|
|
48
53
|
fi
|
|
49
54
|
done
|
|
50
|
-
[ -n "$binary" ] || refuse \
|
|
55
|
+
[ -n "$binary" ] || refuse platform_package_missing \
|
|
51
56
|
"$package is not installed beside $scope/$name" \
|
|
52
57
|
"reinstall $scope/$name with optional dependencies enabled"
|
|
53
|
-
[ -x "$binary" ] || refuse "$binary is not executable" "reinstall $scope/$name"
|
|
58
|
+
[ -x "$binary" ] || refuse binary_not_executable "$binary is not executable" "reinstall $scope/$name"
|
|
54
59
|
|
|
55
60
|
exec "$binary" "$@"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cniska/agent-worktree",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Task worktrees for coding agents: one checkout per task, set up and torn down by the project's own commands.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/cniska/agent-worktree",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"bin/agent-worktree"
|
|
26
26
|
],
|
|
27
27
|
"optionalDependencies": {
|
|
28
|
-
"@cniska/agent-worktree-darwin-arm64": "0.
|
|
29
|
-
"@cniska/agent-worktree-linux-x64": "0.
|
|
28
|
+
"@cniska/agent-worktree-darwin-arm64": "0.3.0",
|
|
29
|
+
"@cniska/agent-worktree-linux-x64": "0.3.0"
|
|
30
30
|
}
|
|
31
31
|
}
|