lathe-cli 1.0.0 → 1.1.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 +16 -1
- package/bin/lathe +25 -9
- package/bin/lathe-feature +72 -0
- package/bin/lathe-feature-done +88 -0
- package/bin/lathe-init +57 -8
- package/bin/lathe-ls +33 -0
- package/package.json +1 -1
- package/template/helper-claude/.claude/settings.json +5 -0
- package/template/helper-claude/.claude/skills/lathe-cli/SKILL.md +155 -0
package/README.md
CHANGED
|
@@ -43,15 +43,30 @@ myapp/
|
|
|
43
43
|
## 日常コマンド
|
|
44
44
|
|
|
45
45
|
```sh
|
|
46
|
+
lathe feature <name> [--from main|develop]
|
|
47
|
+
# features/<name>/ worktree + feature/<name> 枝
|
|
48
|
+
lathe feature-done <name> # 安全に worktree + branch + remote を一掃
|
|
49
|
+
lathe ls # worktree / branch / 最近の runs / improvements
|
|
50
|
+
lathe process <pr#> # PR pickup → tasks/<pr#>/ worktree → target 起動
|
|
46
51
|
lathe target [args...] # cd develop/target && claude args
|
|
47
52
|
lathe meta [args...] # cd meta/meta && claude args
|
|
48
53
|
lathe sync # develop/bin/sync.sh 手動実行
|
|
49
|
-
lathe process <pr#> # PR pickup → tasks/<pr#>/ worktree 作成 → target 起動
|
|
50
54
|
lathe help # ヘルプ
|
|
51
55
|
```
|
|
52
56
|
|
|
53
57
|
どの worktree や project root で実行しても、git の共通 dir から自動で正しい場所に移動します。
|
|
54
58
|
|
|
59
|
+
## helper agent(project root の `.claude/`)
|
|
60
|
+
|
|
61
|
+
`lathe init` 中に「helper agent を Claude Code か Codex か」を対話で聞かれます(デフォルト: Claude Code)。選んだ template が project root の `.claude/` に配置され、`lathe-cli` skill が入ります。
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
cd <project_root>
|
|
65
|
+
claude # Lathe 操作の質問はここで聞ける
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
helper は **Lathe 操作のアシスタント**で、target/meta のような実装エージェントではありません。`lathe feature` や PR 処理のフローに迷ったら相談する相手として常駐します。
|
|
69
|
+
|
|
55
70
|
## 標準ワークフロー
|
|
56
71
|
|
|
57
72
|
```sh
|
package/bin/lathe
CHANGED
|
@@ -25,15 +25,31 @@ case "$CMD" in
|
|
|
25
25
|
cat <<EOF
|
|
26
26
|
lathe — agent harness CLI
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
Initialize a project with main / develop / meta worktrees backed by a
|
|
29
|
+
shared bare git repo, then drive target / meta agents over Claude Code.
|
|
30
|
+
|
|
31
|
+
Setup:
|
|
32
|
+
init Initialize Lathe in current (empty) directory.
|
|
33
|
+
Creates ./.git (bare), three worktrees, post-merge
|
|
34
|
+
hook, and (interactively) a project-root .claude/
|
|
35
|
+
helper for Lathe operations.
|
|
36
|
+
|
|
37
|
+
Daily ops:
|
|
38
|
+
feature <name> Create features/<name>/ worktree on a new
|
|
39
|
+
feature/<name> branch (default base: main; --from develop)
|
|
40
|
+
feature-done <name>
|
|
41
|
+
Tear down a feature: worktree + branch (+ remote if any).
|
|
42
|
+
Refuses if uncommitted/unpushed unless --force.
|
|
43
|
+
process <pr#> Pick up a GitHub PR for target processing
|
|
44
|
+
(creates ./tasks/<pr#>/ worktree, launches target)
|
|
45
|
+
ls List worktrees, branches, recent runs/improvements
|
|
46
|
+
|
|
47
|
+
Agent launchers:
|
|
48
|
+
target [args] cd develop/target, claude args
|
|
49
|
+
meta [args] cd meta/meta, claude args
|
|
50
|
+
sync Re-run sync.sh in develop (only if post-merge missed)
|
|
51
|
+
|
|
52
|
+
Other:
|
|
37
53
|
help This message
|
|
38
54
|
|
|
39
55
|
LATHE_HOME=$LATHE_HOME
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# lathe feature <name> [--from main|develop]
|
|
3
|
+
# Create a feature worktree at ./features/<name> on a new branch
|
|
4
|
+
# feature/<name>, branched from main (default) or develop.
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
: "${LATHE_HOME:?must be set by lathe dispatcher}"
|
|
8
|
+
source "$LATHE_HOME/bin/_lathe-lib.sh"
|
|
9
|
+
|
|
10
|
+
NAME=""
|
|
11
|
+
FROM="main"
|
|
12
|
+
while [ $# -gt 0 ]; do
|
|
13
|
+
case "$1" in
|
|
14
|
+
--from)
|
|
15
|
+
FROM="$2"; shift 2 ;;
|
|
16
|
+
--from=*)
|
|
17
|
+
FROM="${1#--from=}"; shift ;;
|
|
18
|
+
-*)
|
|
19
|
+
echo "lathe feature: unknown flag $1" >&2; exit 1 ;;
|
|
20
|
+
*)
|
|
21
|
+
if [ -z "$NAME" ]; then NAME="$1"; else
|
|
22
|
+
echo "lathe feature: extra argument $1" >&2; exit 1
|
|
23
|
+
fi
|
|
24
|
+
shift ;;
|
|
25
|
+
esac
|
|
26
|
+
done
|
|
27
|
+
|
|
28
|
+
if [ -z "$NAME" ]; then
|
|
29
|
+
echo "Usage: lathe feature <name> [--from main|develop]" >&2
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
PROJECT_ROOT="$(lathe_project_root)" || {
|
|
34
|
+
echo "lathe feature: not inside a Lathe project" >&2
|
|
35
|
+
exit 1
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
GIT_DIR="$PROJECT_ROOT/.git"
|
|
39
|
+
BRANCH="feature/$NAME"
|
|
40
|
+
WT="$PROJECT_ROOT/features/$NAME"
|
|
41
|
+
|
|
42
|
+
# Sanity: base branch exists
|
|
43
|
+
if ! git --git-dir="$GIT_DIR" rev-parse --verify "$FROM" >/dev/null 2>&1; then
|
|
44
|
+
echo "lathe feature: base branch '$FROM' does not exist" >&2
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# Sanity: feature branch / worktree don't already exist
|
|
49
|
+
if git --git-dir="$GIT_DIR" rev-parse --verify "$BRANCH" >/dev/null 2>&1; then
|
|
50
|
+
echo "lathe feature: branch '$BRANCH' already exists" >&2
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
if [ -e "$WT" ]; then
|
|
54
|
+
echo "lathe feature: $WT already exists" >&2
|
|
55
|
+
exit 1
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
mkdir -p "$PROJECT_ROOT/features"
|
|
59
|
+
git --git-dir="$GIT_DIR" worktree add --quiet -b "$BRANCH" "$WT" "$FROM"
|
|
60
|
+
|
|
61
|
+
cat <<EOF
|
|
62
|
+
Created feature worktree:
|
|
63
|
+
|
|
64
|
+
branch: $BRANCH (from $FROM)
|
|
65
|
+
path: $WT
|
|
66
|
+
|
|
67
|
+
Next:
|
|
68
|
+
cd $WT
|
|
69
|
+
# vibe code, commit, push
|
|
70
|
+
git push -u origin $BRANCH
|
|
71
|
+
gh pr create --base develop --title "..." --body "..."
|
|
72
|
+
EOF
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# lathe feature-done <name> [--keep-branch] [--keep-remote] [--force]
|
|
3
|
+
# Tear down a feature worktree safely:
|
|
4
|
+
# 1. refuse if uncommitted changes exist (unless --force)
|
|
5
|
+
# 2. refuse if local has commits not pushed to upstream (unless --force)
|
|
6
|
+
# 3. git worktree remove features/<name>
|
|
7
|
+
# 4. (unless --keep-branch) git branch -D feature/<name>
|
|
8
|
+
# 5. (unless --keep-remote) git push origin :feature/<name>
|
|
9
|
+
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
: "${LATHE_HOME:?must be set by lathe dispatcher}"
|
|
12
|
+
source "$LATHE_HOME/bin/_lathe-lib.sh"
|
|
13
|
+
|
|
14
|
+
NAME=""
|
|
15
|
+
KEEP_BRANCH=0
|
|
16
|
+
KEEP_REMOTE=0
|
|
17
|
+
FORCE=0
|
|
18
|
+
while [ $# -gt 0 ]; do
|
|
19
|
+
case "$1" in
|
|
20
|
+
--keep-branch) KEEP_BRANCH=1; shift ;;
|
|
21
|
+
--keep-remote) KEEP_REMOTE=1; shift ;;
|
|
22
|
+
--force) FORCE=1; shift ;;
|
|
23
|
+
-*) echo "lathe feature-done: unknown flag $1" >&2; exit 1 ;;
|
|
24
|
+
*)
|
|
25
|
+
if [ -z "$NAME" ]; then NAME="$1"; else
|
|
26
|
+
echo "lathe feature-done: extra argument $1" >&2; exit 1
|
|
27
|
+
fi
|
|
28
|
+
shift ;;
|
|
29
|
+
esac
|
|
30
|
+
done
|
|
31
|
+
|
|
32
|
+
if [ -z "$NAME" ]; then
|
|
33
|
+
echo "Usage: lathe feature-done <name> [--keep-branch] [--keep-remote] [--force]" >&2
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
PROJECT_ROOT="$(lathe_project_root)" || {
|
|
38
|
+
echo "lathe feature-done: not inside a Lathe project" >&2
|
|
39
|
+
exit 1
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
GIT_DIR="$PROJECT_ROOT/.git"
|
|
43
|
+
BRANCH="feature/$NAME"
|
|
44
|
+
WT="$PROJECT_ROOT/features/$NAME"
|
|
45
|
+
|
|
46
|
+
if [ ! -d "$WT" ]; then
|
|
47
|
+
echo "lathe feature-done: $WT does not exist" >&2
|
|
48
|
+
exit 1
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
# 1. uncommitted changes?
|
|
52
|
+
if [ -n "$(git -C "$WT" status --porcelain 2>/dev/null)" ]; then
|
|
53
|
+
if [ "$FORCE" = 0 ]; then
|
|
54
|
+
echo "lathe feature-done: uncommitted changes in $WT. Commit or use --force." >&2
|
|
55
|
+
exit 1
|
|
56
|
+
fi
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# 2. unpushed commits?
|
|
60
|
+
if [ "$FORCE" = 0 ]; then
|
|
61
|
+
upstream="$(git -C "$WT" rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || true)"
|
|
62
|
+
if [ -n "$upstream" ]; then
|
|
63
|
+
ahead="$(git -C "$WT" rev-list --count "$upstream..HEAD" 2>/dev/null || echo 0)"
|
|
64
|
+
if [ "$ahead" -gt 0 ]; then
|
|
65
|
+
echo "lathe feature-done: $ahead local commit(s) ahead of $upstream. Push or use --force." >&2
|
|
66
|
+
exit 1
|
|
67
|
+
fi
|
|
68
|
+
fi
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
echo "==> Removing worktree $WT ..."
|
|
72
|
+
git --git-dir="$GIT_DIR" worktree remove "$WT"
|
|
73
|
+
|
|
74
|
+
if [ "$KEEP_BRANCH" = 0 ]; then
|
|
75
|
+
echo "==> Deleting local branch $BRANCH ..."
|
|
76
|
+
git --git-dir="$GIT_DIR" branch -D "$BRANCH" 2>&1 || true
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
if [ "$KEEP_REMOTE" = 0 ]; then
|
|
80
|
+
if git --git-dir="$GIT_DIR" remote get-url origin >/dev/null 2>&1; then
|
|
81
|
+
if git --git-dir="$GIT_DIR" ls-remote --exit-code --heads origin "$BRANCH" >/dev/null 2>&1; then
|
|
82
|
+
echo "==> Deleting remote branch origin/$BRANCH ..."
|
|
83
|
+
git --git-dir="$GIT_DIR" push origin --delete "$BRANCH" 2>&1 || true
|
|
84
|
+
fi
|
|
85
|
+
fi
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
echo "Done."
|
package/bin/lathe-init
CHANGED
|
@@ -80,22 +80,71 @@ git -C "$PROJECT_ROOT/meta" \
|
|
|
80
80
|
-c user.email="lathe@local" -c user.name="lathe" \
|
|
81
81
|
commit --quiet -m "lathe: meta agent on meta"
|
|
82
82
|
|
|
83
|
-
echo "==> [5/
|
|
83
|
+
echo "==> [5/6] Installing post-merge hook (auto-sync on develop merges)..."
|
|
84
84
|
mkdir -p "$GIT_DIR/hooks"
|
|
85
85
|
cp "$LATHE_HOME/template/git-hooks/post-merge" "$GIT_DIR/hooks/post-merge"
|
|
86
86
|
chmod +x "$GIT_DIR/hooks/post-merge"
|
|
87
87
|
|
|
88
|
+
echo "==> [6/6] Helper agent setup ..."
|
|
89
|
+
echo ""
|
|
90
|
+
echo "Which CLI agent will you use as the project-root helper?"
|
|
91
|
+
echo "(Helper sits at the project root and assists with Lathe commands. Doesn't"
|
|
92
|
+
echo " participate in implementation — that's target/meta's job.)"
|
|
93
|
+
echo ""
|
|
94
|
+
echo " 1) Claude Code (recommended)"
|
|
95
|
+
echo " 2) Codex CLI (WIP — falls back to Claude Code template for now)"
|
|
96
|
+
echo " 3) skip (no helper config)"
|
|
97
|
+
echo ""
|
|
98
|
+
HELPER_CHOICE=""
|
|
99
|
+
if [ -t 0 ]; then
|
|
100
|
+
printf "Choice [1]: "
|
|
101
|
+
read -r HELPER_CHOICE
|
|
102
|
+
fi
|
|
103
|
+
case "${HELPER_CHOICE:-1}" in
|
|
104
|
+
1|"") HELPER_KIND="claude" ;;
|
|
105
|
+
2)
|
|
106
|
+
echo "(Codex helper template not yet implemented; using Claude Code template)"
|
|
107
|
+
HELPER_KIND="claude"
|
|
108
|
+
;;
|
|
109
|
+
3) HELPER_KIND="" ;;
|
|
110
|
+
*)
|
|
111
|
+
echo "(unrecognized choice; using Claude Code template)"
|
|
112
|
+
HELPER_KIND="claude"
|
|
113
|
+
;;
|
|
114
|
+
esac
|
|
115
|
+
|
|
116
|
+
if [ -n "$HELPER_KIND" ]; then
|
|
117
|
+
HELPER_SRC="$LATHE_HOME/template/helper-${HELPER_KIND}"
|
|
118
|
+
if [ -d "$HELPER_SRC" ]; then
|
|
119
|
+
cp -R "$HELPER_SRC/." "$PROJECT_ROOT/"
|
|
120
|
+
echo "Helper config installed at $PROJECT_ROOT/.claude/"
|
|
121
|
+
else
|
|
122
|
+
echo "Warning: $HELPER_SRC not found, skipping helper install"
|
|
123
|
+
fi
|
|
124
|
+
fi
|
|
125
|
+
|
|
88
126
|
cat <<EOF
|
|
89
127
|
|
|
90
128
|
Lathe initialized at $PROJECT_ROOT/
|
|
91
129
|
|
|
92
|
-
main/
|
|
93
|
-
develop/
|
|
94
|
-
meta/
|
|
95
|
-
.git/
|
|
130
|
+
main/ your app code (or branch base)
|
|
131
|
+
develop/ target harness, runs/ auto-commit here
|
|
132
|
+
meta/ meta agent + improvements/
|
|
133
|
+
.git/ shared bare repo (don't touch)
|
|
134
|
+
EOF
|
|
135
|
+
if [ -n "$HELPER_KIND" ]; then
|
|
136
|
+
echo " .claude/ project-root helper (skill: lathe-cli)"
|
|
137
|
+
fi
|
|
138
|
+
cat <<EOF
|
|
96
139
|
|
|
97
140
|
Next:
|
|
98
|
-
cd $PROJECT_ROOT
|
|
99
|
-
|
|
100
|
-
|
|
141
|
+
cd $PROJECT_ROOT
|
|
142
|
+
EOF
|
|
143
|
+
if [ -n "$HELPER_KIND" ]; then
|
|
144
|
+
echo " claude # ask Lathe questions; the lathe-cli skill is loaded"
|
|
145
|
+
fi
|
|
146
|
+
cat <<EOF
|
|
147
|
+
lathe feature <name> # start a new feature in features/<name>/
|
|
148
|
+
lathe process <pr#> # have target process a PR
|
|
149
|
+
lathe ls # list worktrees, branches, recent runs
|
|
101
150
|
EOF
|
package/bin/lathe-ls
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# lathe ls — list worktrees, branches, runs, improvements at a glance.
|
|
3
|
+
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
: "${LATHE_HOME:?must be set by lathe dispatcher}"
|
|
6
|
+
source "$LATHE_HOME/bin/_lathe-lib.sh"
|
|
7
|
+
|
|
8
|
+
PROJECT_ROOT="$(lathe_project_root)" || {
|
|
9
|
+
echo "lathe ls: not inside a Lathe project" >&2
|
|
10
|
+
exit 1
|
|
11
|
+
}
|
|
12
|
+
GIT_DIR="$PROJECT_ROOT/.git"
|
|
13
|
+
|
|
14
|
+
echo "=== worktrees ==="
|
|
15
|
+
git --git-dir="$GIT_DIR" worktree list
|
|
16
|
+
|
|
17
|
+
echo ""
|
|
18
|
+
echo "=== branches ==="
|
|
19
|
+
git --git-dir="$GIT_DIR" branch -a
|
|
20
|
+
|
|
21
|
+
DEVELOP_WT="$(lathe_wt_for_branch develop 2>/dev/null || true)"
|
|
22
|
+
if [ -n "$DEVELOP_WT" ] && [ -d "$DEVELOP_WT/runs" ]; then
|
|
23
|
+
echo ""
|
|
24
|
+
echo "=== recent runs (develop/runs/) ==="
|
|
25
|
+
ls -1t "$DEVELOP_WT/runs/" 2>/dev/null | grep -v gitkeep | head -10 || echo "(none)"
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
META_WT="$(lathe_wt_for_branch meta 2>/dev/null || true)"
|
|
29
|
+
if [ -n "$META_WT" ] && [ -d "$META_WT/improvements" ]; then
|
|
30
|
+
echo ""
|
|
31
|
+
echo "=== recent improvements (meta/improvements/) ==="
|
|
32
|
+
ls -1t "$META_WT/improvements/" 2>/dev/null | grep -v gitkeep | head -10 || echo "(none)"
|
|
33
|
+
fi
|
package/package.json
CHANGED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lathe-cli
|
|
3
|
+
description: ユーザーが Lathe project(main/develop/meta worktree + bare .git の構成)の操作で詰まったときに参照する。コマンド一覧、branch / worktree モデル、典型操作(feature 作成・PR 処理・harness 改善・cleanup)、トラブル時の復旧手順を扱う。"lathe", "feature branch", "worktree", "develop", "meta", "PR を処理" 等の言葉が出たら起動する。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Lathe CLI 操作リファレンス
|
|
7
|
+
|
|
8
|
+
このプロジェクトは Lathe で初期化された agent harness。あなたはユーザーの **Lathe 操作のアシスタント**。実装そのものは target / meta agent が別 worktree で行うので、あなたは「コマンドを案内する / 代行する / 状態を説明する」役。
|
|
9
|
+
|
|
10
|
+
## 構成(`lathe init` 直後の姿)
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
project_root/
|
|
14
|
+
├── .git/ 共有 bare repo(worktree 全部がここを参照)
|
|
15
|
+
├── .claude/ この skill とユーザーの helper 設定
|
|
16
|
+
├── main/ worktree on main 枝(user の app code)
|
|
17
|
+
├── develop/ worktree on develop 枝(target が住む。harness/ + 生成された target/.claude/)
|
|
18
|
+
└── meta/ worktree on meta 枝(meta agent + improvements/)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
加えて、運用中に動的に増えるもの:
|
|
22
|
+
|
|
23
|
+
- `features/<name>/` — `lathe feature <name>` で作る、user の vibe coding 用 worktree
|
|
24
|
+
- `tasks/<pr#>/` — `lathe process <pr#>` で作る、target が PR を polish する用 worktree
|
|
25
|
+
|
|
26
|
+
## branch モデル
|
|
27
|
+
|
|
28
|
+
| branch | 役割 | 誰が触る |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| `main` | release stable | 普段は user、最終的に develop からの PR で更新 |
|
|
31
|
+
| `develop` | integration、target の住処、runs/ の auto-commit 先 | target session、meta からの PR が merge される |
|
|
32
|
+
| `meta` | harness 改善 + improvements/ 蓄積 | meta operator + meta agent |
|
|
33
|
+
| `feature/<name>` | user の vibe code | user が `lathe feature` で生やす |
|
|
34
|
+
|
|
35
|
+
## コマンド一覧
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
lathe init ← 既に走った前提
|
|
39
|
+
lathe target [args...] develop/target で claude 起動(debug or 直接 task)
|
|
40
|
+
lathe meta [args...] meta/meta で claude 起動
|
|
41
|
+
lathe sync develop の bin/sync.sh 手動実行(post-merge hook が動かない時)
|
|
42
|
+
lathe process <pr#> PR pickup → tasks/<pr#>/ worktree 作成 → target 起動
|
|
43
|
+
lathe feature <name> [--from main|develop]
|
|
44
|
+
features/<name>/ worktree 作成、新 feature/<name> 枝
|
|
45
|
+
lathe feature-done <name> [--keep-branch] [--keep-remote] [--force]
|
|
46
|
+
feature 終了処理(worktree 削除、branch 削除、remote push :branch)
|
|
47
|
+
lathe ls worktree / branch / runs / improvements を一覧
|
|
48
|
+
lathe help help
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 典型操作
|
|
52
|
+
|
|
53
|
+
### 新 feature を始める
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
cd project_root
|
|
57
|
+
lathe feature <name> # features/<name>/ ができる
|
|
58
|
+
cd features/<name>
|
|
59
|
+
# vibe code(claude を別 session で立ち上げて自由に)
|
|
60
|
+
git add . && git commit -m "WIP: vibe ..."
|
|
61
|
+
git push -u origin feature/<name>
|
|
62
|
+
gh pr create --base develop --title "..." --body "..."
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### PR を target に処理させる
|
|
66
|
+
|
|
67
|
+
PR が立ったら(overseer 役):
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
cd project_root
|
|
71
|
+
lathe process <pr#> # tasks/<pr#>/ worktree が新規作成、target が起動
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
claude TUI が立ち上がるので、表示された prompt:「Read .lathe-task.md from the added directory and process it.」を貼る。
|
|
75
|
+
|
|
76
|
+
orchestrator が plan HTML を起こして承認待ちで止まる。承認したら coder/reviewer に dispatch、PR branch に commit/push されて PR が更新される。
|
|
77
|
+
|
|
78
|
+
### feature を終わらせる
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
cd project_root
|
|
82
|
+
gh pr merge <pr#> # GitHub 側で merge
|
|
83
|
+
lathe feature-done <name> # local worktree + branch + remote branch を一掃
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### meta で harness を改善する
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
cd project_root/meta
|
|
90
|
+
git fetch && git merge --no-edit develop # 最新 runs/ を取り込み
|
|
91
|
+
lathe meta # meta agent 起動
|
|
92
|
+
# meta が runs/ 観察 → harness/ 編集 → improvements/<id>/ 記録 → commit
|
|
93
|
+
git push -u origin meta
|
|
94
|
+
gh pr create --base develop --head meta --title "harness: ..."
|
|
95
|
+
gh pr merge <meta pr#>
|
|
96
|
+
# → develop 側 post-merge hook が sync.sh 自動実行 → target/.claude/ 更新
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### release(develop → main)
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
cd project_root/main
|
|
103
|
+
git pull
|
|
104
|
+
git merge develop
|
|
105
|
+
git push origin main
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 全体俯瞰
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
lathe ls # worktree, branch, recent runs/improvements
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## やってはいけない / 詰まりやすい点
|
|
115
|
+
|
|
116
|
+
1. **`main/`, `develop/`, `meta/` の中で `git checkout` で別 branch に切り替えない**
|
|
117
|
+
- それぞれの worktree は固定の枝。別枝は別 worktree。switch すると `fatal: 'X' is already used by worktree at '...'`
|
|
118
|
+
- feature を始めたいなら `lathe feature <name>` を使う
|
|
119
|
+
|
|
120
|
+
2. **`target/.claude/`、`target/CLAUDE.md` などを直接編集しない**
|
|
121
|
+
- これは `harness/` から sync.sh で生成されたコピー。次回 sync で上書きされる
|
|
122
|
+
- 改善は `harness/` 配下を編集(meta worktree 内で)→ develop に PR → post-merge で反映
|
|
123
|
+
|
|
124
|
+
3. **`features/<name>/` を `rm -rf` で消すと metadata が残る**
|
|
125
|
+
- `git worktree list` にゾンビが出る
|
|
126
|
+
- 正しい手順:`lathe feature-done <name>`(または `git --git-dir=.git worktree remove features/<name>`)
|
|
127
|
+
|
|
128
|
+
4. **branch だけ消そうとして `git branch -D feature/X` でエラー**
|
|
129
|
+
- その branch を worktree が checkout 中だから。先に worktree を消す
|
|
130
|
+
- `lathe feature-done` は両方やる
|
|
131
|
+
|
|
132
|
+
5. **post-merge hook は local merge のみ発火**
|
|
133
|
+
- GitHub UI で merge した場合は hook 走らない。`cd develop && git pull && lathe sync` で手動
|
|
134
|
+
|
|
135
|
+
6. **runs/ の auto-commit は local のみ(remote push しない)**
|
|
136
|
+
- 別 machine の meta から見たいなら、`cd develop && git push origin develop` を手動 or 自動化要
|
|
137
|
+
|
|
138
|
+
## トラブルシュート
|
|
139
|
+
|
|
140
|
+
| 症状 | 対処 |
|
|
141
|
+
|---|---|
|
|
142
|
+
| `lathe target` が "develop worktree not found" | `git --git-dir=.git worktree list` で確認、抜けてたら `git worktree add` で復活 |
|
|
143
|
+
| `git worktree list` にゾンビ entry | `git --git-dir=.git worktree prune` |
|
|
144
|
+
| `git branch -D` で "checked out at" エラー | 該当 worktree を先に remove |
|
|
145
|
+
| post-merge hook が走らない | `.git/hooks/post-merge` の存在・実行ビット確認、無ければ template から copy |
|
|
146
|
+
| PR にコードが上がらない | task worktree から `git push` 忘れ、target session 内で確認 |
|
|
147
|
+
|
|
148
|
+
## あなたの責任範囲
|
|
149
|
+
|
|
150
|
+
- ユーザーが Lathe 操作で迷ったら **このコマンド使え** と案内
|
|
151
|
+
- 求められれば Bash で代行実行
|
|
152
|
+
- 構造(worktree / branch / 状態)の質問には git 直接叩いて答える
|
|
153
|
+
- target / meta が何をしているかの質問には、各 worktree の CLAUDE.md(develop の harness/CLAUDE.md、meta の meta/CLAUDE.md)を Read してから答える
|
|
154
|
+
|
|
155
|
+
実装そのもの(user の app コードを書くなど)は **しない**。それは feature worktree で user 自身か、target agent の仕事。
|