lathe-cli 1.1.0 → 1.2.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 +15 -5
- package/bin/lathe +5 -5
- package/bin/lathe-init +63 -43
- package/bin/lathe-meta +1 -1
- package/bin/lathe-process +1 -1
- package/bin/lathe-target +1 -1
- package/package.json +1 -1
- package/template/develop/bin/sync.sh +68 -38
- package/template/develop/harness/hooks/commit-runs.sh +2 -2
- package/template/develop/harness/hooks/copy_transcript.sh +2 -2
- package/template/develop/harness/hooks/log.sh +3 -3
- package/template/git-hooks/post-merge +15 -8
- package/template/helper-claude/.claude/CLAUDE.md +28 -0
- package/template/helper-claude/.claude/skills/lathe-cli/SKILL.md +18 -10
- /package/template/{meta-overlay → develop/harness}/meta/CLAUDE.md +0 -0
- /package/template/{meta-overlay/meta/.claude → develop/harness/meta}/settings.json +0 -0
- /package/template/{meta-overlay/meta/.claude → develop/harness/meta}/skills/improvement-recording/SKILL.md +0 -0
- /package/template/{meta-overlay/meta/.claude → develop/harness/meta}/skills/log-reading/SKILL.md +0 -0
- /package/template/{meta-overlay → develop}/improvements/.gitkeep +0 -0
package/README.md
CHANGED
|
@@ -28,17 +28,27 @@ mkdir myapp && cd myapp
|
|
|
28
28
|
lathe init
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
これで以下ができます(v1.2 layout):
|
|
32
32
|
|
|
33
33
|
```
|
|
34
34
|
myapp/
|
|
35
35
|
├── .git/ 共有 bare repo
|
|
36
|
+
├── .claude/ project-root helper(lathe-cli skill)
|
|
37
|
+
├── CLAUDE.md helper の役割記述
|
|
36
38
|
├── main/ main worktree(あなたの app code)
|
|
37
|
-
├── develop/ develop worktree
|
|
38
|
-
|
|
39
|
+
├── develop/ develop worktree
|
|
40
|
+
│ ├── harness/ tracked、target + meta 両方の agent spec の正
|
|
41
|
+
│ │ ├── CLAUDE.md, settings.json, skills/, agents/, ... target 用
|
|
42
|
+
│ │ └── meta/ meta 用
|
|
43
|
+
│ ├── bin/sync.sh tracked(branch-aware、target or meta runtime に展開)
|
|
44
|
+
│ ├── runs/ tracked(hook auto-commit)
|
|
45
|
+
│ └── (CLAUDE.md, .claude/, hooks/, workflow/, plan_template.html — gitignored sync output)
|
|
46
|
+
└── meta/ meta worktree
|
|
47
|
+
├── harness/, bin/, runs/, improvements/ tracked(develop から inherit)
|
|
48
|
+
└── (CLAUDE.md, .claude/ — gitignored sync output、harness/meta/ から)
|
|
39
49
|
```
|
|
40
50
|
|
|
41
|
-
|
|
51
|
+
`harness/` が agent spec の唯一の正。target と meta の両方の指示書が `harness/`(target は root、meta は `harness/meta/`)に集約されているので、harness/ さえあれば同じ harness で再現可能。runtime の `.claude/` `CLAUDE.md` は gitignored で sync.sh が生成。
|
|
42
52
|
|
|
43
53
|
## 日常コマンド
|
|
44
54
|
|
|
@@ -106,7 +116,7 @@ git push origin main
|
|
|
106
116
|
## 設計の要点
|
|
107
117
|
|
|
108
118
|
- **branch / worktree でロール分離**:各 agent / role が物理的に別ディレクトリで動くので、CLAUDE.md / settings.json / hooks が混ざらない
|
|
109
|
-
- **harness は meta
|
|
119
|
+
- **harness/ は agent spec の単一の正**:target も meta も自分の設定は `harness/`(meta 用は `harness/meta/`)から sync.sh で worktree root の runtime ファイルに展開される。Claude Code 本体の `.claude/` sensitive-file guard を agent tool で突破できないため、harness/ を編集(普通の dir、guard なし)→ shell sync.sh で `.claude/` 上書き、という迂回経路
|
|
110
120
|
- **runs/ は develop で auto-commit**:target session の Stop hook が `git commit` するので、meta は `git merge develop` で読める。symlink や中央 store 不要
|
|
111
121
|
- **post-merge hook が auto-sync**:meta の harness 改善が develop に merge された瞬間に target/.claude/ が再生成される
|
|
112
122
|
|
package/bin/lathe
CHANGED
|
@@ -30,9 +30,9 @@ shared bare git repo, then drive target / meta agents over Claude Code.
|
|
|
30
30
|
|
|
31
31
|
Setup:
|
|
32
32
|
init Initialize Lathe in current (empty) directory.
|
|
33
|
-
Creates ./.git (bare), three worktrees,
|
|
34
|
-
hook
|
|
35
|
-
helper for Lathe
|
|
33
|
+
Creates ./.git (bare), three worktrees (main/develop/meta),
|
|
34
|
+
post-merge hook (auto-syncs harness on develop or meta merges),
|
|
35
|
+
and (interactively) a project-root .claude/ helper for Lathe ops.
|
|
36
36
|
|
|
37
37
|
Daily ops:
|
|
38
38
|
feature <name> Create features/<name>/ worktree on a new
|
|
@@ -45,8 +45,8 @@ Daily ops:
|
|
|
45
45
|
ls List worktrees, branches, recent runs/improvements
|
|
46
46
|
|
|
47
47
|
Agent launchers:
|
|
48
|
-
target [args] cd develop
|
|
49
|
-
meta [args] cd meta
|
|
48
|
+
target [args] cd develop, claude args (target's runtime sync'd from harness/)
|
|
49
|
+
meta [args] cd meta, claude args (meta's runtime sync'd from harness/meta/)
|
|
50
50
|
sync Re-run sync.sh in develop (only if post-merge missed)
|
|
51
51
|
|
|
52
52
|
Other:
|
package/bin/lathe-init
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# lathe init — initialize a Lathe project in the current directory.
|
|
3
3
|
#
|
|
4
|
-
# Layout produced (
|
|
4
|
+
# Layout produced (v1.2):
|
|
5
5
|
# ./
|
|
6
|
-
# ├── .git/
|
|
7
|
-
# ├──
|
|
8
|
-
# ├──
|
|
9
|
-
#
|
|
6
|
+
# ├── .git/ bare repo, shared by all worktrees
|
|
7
|
+
# ├── .claude/ project-root helper config (if chosen)
|
|
8
|
+
# ├── CLAUDE.md project-root helper brief (if chosen)
|
|
9
|
+
# ├── main/ worktree on 'main' branch — your app code
|
|
10
|
+
# ├── develop/ worktree on 'develop' — target agent's runtime
|
|
11
|
+
# └── meta/ worktree on 'meta' — meta agent's runtime
|
|
10
12
|
#
|
|
11
|
-
#
|
|
13
|
+
# develop tracks harness/ (incl. harness/meta/) as the canonical agent spec.
|
|
14
|
+
# bin/sync.sh on each side regenerates the gitignored runtime files at the
|
|
15
|
+
# worktree root (CLAUDE.md, .claude/, etc.) from harness/. meta inherits
|
|
16
|
+
# develop's harness/, so meta's spec lives at harness/meta/ on the develop
|
|
17
|
+
# branch (and propagates to meta via cut/merge).
|
|
12
18
|
|
|
13
19
|
set -euo pipefail
|
|
14
20
|
|
|
@@ -18,40 +24,36 @@ PROJECT_ROOT="$(pwd)"
|
|
|
18
24
|
PROJECT_NAME="$(basename "$PROJECT_ROOT")"
|
|
19
25
|
|
|
20
26
|
# --- Validation ---
|
|
27
|
+
err=0
|
|
21
28
|
if [ -e "$PROJECT_ROOT/.git" ]; then
|
|
22
|
-
echo "lathe init: $PROJECT_ROOT/.git already exists.
|
|
23
|
-
exit 1
|
|
29
|
+
echo "lathe init: $PROJECT_ROOT/.git already exists." >&2; err=1
|
|
24
30
|
fi
|
|
25
31
|
for d in main develop meta; do
|
|
26
32
|
if [ -e "$PROJECT_ROOT/$d" ]; then
|
|
27
|
-
echo "lathe init: $PROJECT_ROOT/$d already exists.
|
|
28
|
-
exit 1
|
|
33
|
+
echo "lathe init: $PROJECT_ROOT/$d already exists." >&2; err=1
|
|
29
34
|
fi
|
|
30
35
|
done
|
|
36
|
+
[ "$err" = 1 ] && exit 1
|
|
31
37
|
|
|
32
|
-
# Warn (not error) if cwd has any other content.
|
|
33
38
|
EXTRA="$(ls -A "$PROJECT_ROOT" 2>/dev/null | grep -vE '^(\.|\.\.)$' || true)"
|
|
34
39
|
if [ -n "$EXTRA" ]; then
|
|
35
|
-
echo "Note: $PROJECT_ROOT is not empty. Existing files will remain at the project root
|
|
36
|
-
echo " (Lathe v1 doesn't auto-migrate existing repos. Move files into main/ manually if needed.)"
|
|
40
|
+
echo "Note: $PROJECT_ROOT is not empty. Existing files will remain at the project root."
|
|
37
41
|
fi
|
|
38
42
|
|
|
39
43
|
GIT_DIR="$PROJECT_ROOT/.git"
|
|
40
44
|
|
|
41
|
-
echo "==> [1/
|
|
45
|
+
echo "==> [1/6] Initializing bare repo at $GIT_DIR ..."
|
|
42
46
|
git init --bare --quiet "$GIT_DIR"
|
|
43
47
|
|
|
44
|
-
echo "==> [2/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
48
|
+
echo "==> [2/6] Creating main worktree with initial commit (template/main)..."
|
|
49
|
+
# Bootstrap an initial commit so develop/meta have a base.
|
|
50
|
+
EMPTY_TREE="$(git --git-dir="$GIT_DIR" mktree </dev/null)"
|
|
51
|
+
INIT_COMMIT="$(printf 'lathe: empty initial\n' | git --git-dir="$GIT_DIR" commit-tree "$EMPTY_TREE")"
|
|
52
|
+
git --git-dir="$GIT_DIR" update-ref refs/heads/main "$INIT_COMMIT"
|
|
53
|
+
git --git-dir="$GIT_DIR" symbolic-ref HEAD refs/heads/main
|
|
54
|
+
git --git-dir="$GIT_DIR" worktree add --quiet "$PROJECT_ROOT/main" main
|
|
55
|
+
|
|
53
56
|
cp -R "$LATHE_HOME/template/main/." "$PROJECT_ROOT/main/"
|
|
54
|
-
# Replace placeholder in README
|
|
55
57
|
if [ -f "$PROJECT_ROOT/main/README.md" ]; then
|
|
56
58
|
sed -i.bak "s/{{project_name}}/$PROJECT_NAME/g" "$PROJECT_ROOT/main/README.md"
|
|
57
59
|
rm -f "$PROJECT_ROOT/main/README.md.bak"
|
|
@@ -59,31 +61,33 @@ fi
|
|
|
59
61
|
git -C "$PROJECT_ROOT/main" add -A
|
|
60
62
|
git -C "$PROJECT_ROOT/main" \
|
|
61
63
|
-c user.email="lathe@local" -c user.name="lathe" \
|
|
62
|
-
commit --quiet
|
|
64
|
+
commit --quiet -m "lathe: init main"
|
|
63
65
|
|
|
64
|
-
echo "==> [3/
|
|
66
|
+
echo "==> [3/6] Creating develop worktree from main (template/develop)..."
|
|
65
67
|
git --git-dir="$GIT_DIR" worktree add --quiet -b develop "$PROJECT_ROOT/develop" main
|
|
66
68
|
cp -R "$LATHE_HOME/template/develop/." "$PROJECT_ROOT/develop/"
|
|
69
|
+
# Initial sync writes gitignored runtime files to the develop worktree root.
|
|
67
70
|
"$PROJECT_ROOT/develop/bin/sync.sh"
|
|
68
|
-
mkdir -p "$PROJECT_ROOT/develop/runs" "$PROJECT_ROOT/develop/
|
|
69
|
-
touch "$PROJECT_ROOT/develop/runs/.gitkeep" "$PROJECT_ROOT/develop/
|
|
71
|
+
mkdir -p "$PROJECT_ROOT/develop/runs" "$PROJECT_ROOT/develop/plans"
|
|
72
|
+
touch "$PROJECT_ROOT/develop/runs/.gitkeep" "$PROJECT_ROOT/develop/plans/.gitkeep"
|
|
70
73
|
git -C "$PROJECT_ROOT/develop" add -A
|
|
71
74
|
git -C "$PROJECT_ROOT/develop" \
|
|
72
75
|
-c user.email="lathe@local" -c user.name="lathe" \
|
|
73
76
|
commit --quiet -m "lathe: target harness on develop"
|
|
74
77
|
|
|
75
|
-
echo "==> [4/
|
|
78
|
+
echo "==> [4/6] Creating meta worktree from develop..."
|
|
76
79
|
git --git-dir="$GIT_DIR" worktree add --quiet -b meta "$PROJECT_ROOT/meta" develop
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
echo "==> [5/6] Installing post-merge hook (auto-sync on develop merges)..."
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
# Run sync on the meta worktree so meta's runtime files (gitignored)
|
|
81
|
+
# get written from harness/meta/.
|
|
82
|
+
"$PROJECT_ROOT/meta/bin/sync.sh"
|
|
83
|
+
# No commits needed on meta branch here — it inherits develop's tracked
|
|
84
|
+
# content, and runtime files are gitignored.
|
|
85
|
+
|
|
86
|
+
echo "==> [5/6] Installing post-merge hook (auto-sync on develop/meta merges)..."
|
|
87
|
+
COMMON_HOOKS="$(git --git-dir="$GIT_DIR" rev-parse --git-common-dir)/hooks"
|
|
88
|
+
mkdir -p "$COMMON_HOOKS"
|
|
89
|
+
cp "$LATHE_HOME/template/git-hooks/post-merge" "$COMMON_HOOKS/post-merge"
|
|
90
|
+
chmod +x "$COMMON_HOOKS/post-merge"
|
|
87
91
|
|
|
88
92
|
echo "==> [6/6] Helper agent setup ..."
|
|
89
93
|
echo ""
|
|
@@ -123,13 +127,29 @@ if [ -n "$HELPER_KIND" ]; then
|
|
|
123
127
|
fi
|
|
124
128
|
fi
|
|
125
129
|
|
|
130
|
+
# If LATHE_HOME is nested inside the user repo (cloned as ./.lathe), remind
|
|
131
|
+
# about .gitignore. Canonicalize for macOS /tmp -> /private/tmp.
|
|
132
|
+
LATHE_HOME_CANON="$(cd "$LATHE_HOME" && pwd -P)"
|
|
133
|
+
PROJECT_ROOT_CANON="$(cd "$PROJECT_ROOT" && pwd -P)"
|
|
134
|
+
case "$LATHE_HOME_CANON" in
|
|
135
|
+
"$PROJECT_ROOT_CANON"/*)
|
|
136
|
+
REL="${LATHE_HOME_CANON#$PROJECT_ROOT_CANON/}"
|
|
137
|
+
cat <<EOF
|
|
138
|
+
|
|
139
|
+
NOTE: Lathe is installed at \`$REL/\`. To keep it out of git, add to .gitignore:
|
|
140
|
+
/$REL/
|
|
141
|
+
EOF
|
|
142
|
+
;;
|
|
143
|
+
esac
|
|
144
|
+
|
|
145
|
+
LATHE_BIN="$LATHE_HOME/bin/lathe"
|
|
126
146
|
cat <<EOF
|
|
127
147
|
|
|
128
148
|
Lathe initialized at $PROJECT_ROOT/
|
|
129
149
|
|
|
130
150
|
main/ your app code (or branch base)
|
|
131
|
-
develop/ target
|
|
132
|
-
meta/ meta agent
|
|
151
|
+
develop/ target agent runtime, runs/ auto-commit here
|
|
152
|
+
meta/ meta agent runtime
|
|
133
153
|
.git/ shared bare repo (don't touch)
|
|
134
154
|
EOF
|
|
135
155
|
if [ -n "$HELPER_KIND" ]; then
|
|
@@ -137,11 +157,11 @@ if [ -n "$HELPER_KIND" ]; then
|
|
|
137
157
|
fi
|
|
138
158
|
cat <<EOF
|
|
139
159
|
|
|
140
|
-
Next:
|
|
160
|
+
Next (replace 'lathe' with '$LATHE_BIN' or an alias):
|
|
141
161
|
cd $PROJECT_ROOT
|
|
142
162
|
EOF
|
|
143
163
|
if [ -n "$HELPER_KIND" ]; then
|
|
144
|
-
echo " claude
|
|
164
|
+
echo " claude # ask Lathe questions; lathe-cli skill loaded"
|
|
145
165
|
fi
|
|
146
166
|
cat <<EOF
|
|
147
167
|
lathe feature <name> # start a new feature in features/<name>/
|
package/bin/lathe-meta
CHANGED
package/bin/lathe-process
CHANGED
package/bin/lathe-target
CHANGED
package/package.json
CHANGED
|
@@ -1,50 +1,80 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Sync harness/
|
|
3
|
-
#
|
|
4
|
-
#
|
|
2
|
+
# Sync harness/ → worktree root (gitignored runtime files).
|
|
3
|
+
# Branch-aware:
|
|
4
|
+
# develop branch → sync target part (everything in harness/ except harness/meta/)
|
|
5
|
+
# meta branch → sync meta part (harness/meta/ only)
|
|
5
6
|
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
7
|
+
# Cleans stale runtime files first (rm before cp), so renames/removals on the
|
|
8
|
+
# harness side propagate.
|
|
9
|
+
#
|
|
10
|
+
# Run when:
|
|
11
|
+
# - Manually after editing harness/ (rare; usually meta does this via PR)
|
|
12
|
+
# - Automatically by the post-merge git hook on merges into develop or meta
|
|
13
|
+
# - Once at lathe init for the initial population
|
|
10
14
|
|
|
11
15
|
set -euo pipefail
|
|
12
16
|
|
|
13
17
|
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
|
14
18
|
HARNESS="$REPO/harness"
|
|
15
|
-
TARGET="$REPO/target"
|
|
16
19
|
|
|
17
20
|
if [ ! -d "$HARNESS" ]; then
|
|
18
|
-
echo "sync
|
|
21
|
+
echo "sync.sh: $HARNESS does not exist" >&2
|
|
19
22
|
exit 1
|
|
20
23
|
fi
|
|
21
24
|
|
|
22
|
-
#
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
cp -
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
cp -R "$HARNESS/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
25
|
+
# Branch detection. Detached HEAD = abort with no-op (don't mangle anything).
|
|
26
|
+
BRANCH="$(git -C "$REPO" symbolic-ref --short HEAD 2>/dev/null || true)"
|
|
27
|
+
if [ -z "$BRANCH" ]; then
|
|
28
|
+
echo "sync.sh: HEAD is detached (no branch). Skipping sync." >&2
|
|
29
|
+
exit 0
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
case "$BRANCH" in
|
|
33
|
+
develop)
|
|
34
|
+
# ---- target side: harness/* (excluding harness/meta/) → worktree root ----
|
|
35
|
+
rm -f "$REPO/CLAUDE.md" "$REPO/plan_template.html"
|
|
36
|
+
rm -rf "$REPO/.claude" "$REPO/workflow" "$REPO/hooks"
|
|
37
|
+
|
|
38
|
+
cp -f "$HARNESS/CLAUDE.md" "$REPO/CLAUDE.md"
|
|
39
|
+
cp -f "$HARNESS/plan_template.html" "$REPO/plan_template.html"
|
|
40
|
+
|
|
41
|
+
mkdir -p "$REPO/.claude/skills" "$REPO/.claude/agents"
|
|
42
|
+
cp -f "$HARNESS/settings.json" "$REPO/.claude/settings.json"
|
|
43
|
+
cp -R "$HARNESS/skills/." "$REPO/.claude/skills/"
|
|
44
|
+
cp -R "$HARNESS/agents/." "$REPO/.claude/agents/"
|
|
45
|
+
|
|
46
|
+
mkdir -p "$REPO/workflow"
|
|
47
|
+
cp -R "$HARNESS/workflow/." "$REPO/workflow/"
|
|
48
|
+
|
|
49
|
+
mkdir -p "$REPO/hooks"
|
|
50
|
+
cp -R "$HARNESS/hooks/." "$REPO/hooks/"
|
|
51
|
+
chmod +x "$REPO/hooks"/*.sh
|
|
52
|
+
|
|
53
|
+
mkdir -p "$REPO/plans"
|
|
54
|
+
echo "sync.sh: develop runtime rebuilt from harness/"
|
|
55
|
+
;;
|
|
56
|
+
|
|
57
|
+
meta)
|
|
58
|
+
# ---- meta side: harness/meta/* → worktree root ----
|
|
59
|
+
if [ ! -d "$HARNESS/meta" ]; then
|
|
60
|
+
echo "sync.sh: $HARNESS/meta does not exist (this lathe install may be older than v1.2)" >&2
|
|
61
|
+
exit 1
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
rm -f "$REPO/CLAUDE.md"
|
|
65
|
+
rm -rf "$REPO/.claude"
|
|
66
|
+
|
|
67
|
+
cp -f "$HARNESS/meta/CLAUDE.md" "$REPO/CLAUDE.md"
|
|
68
|
+
|
|
69
|
+
mkdir -p "$REPO/.claude/skills"
|
|
70
|
+
cp -f "$HARNESS/meta/settings.json" "$REPO/.claude/settings.json"
|
|
71
|
+
cp -R "$HARNESS/meta/skills/." "$REPO/.claude/skills/"
|
|
72
|
+
|
|
73
|
+
echo "sync.sh: meta runtime rebuilt from harness/meta/"
|
|
74
|
+
;;
|
|
75
|
+
|
|
76
|
+
*)
|
|
77
|
+
echo "sync.sh: branch '$BRANCH' is neither develop nor meta. Skipping." >&2
|
|
78
|
+
exit 0
|
|
79
|
+
;;
|
|
80
|
+
esac
|
|
@@ -14,9 +14,9 @@ INPUT="$(cat)"
|
|
|
14
14
|
SESSION_ID="$(printf '%s' "$INPUT" | jq -r '.session_id // empty')"
|
|
15
15
|
[ -z "$SESSION_ID" ] && exit 0
|
|
16
16
|
|
|
17
|
+
# Sync'd to <develop_wt>/hooks/, parent is the develop worktree root.
|
|
17
18
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
18
|
-
|
|
19
|
-
REPO_ROOT="$(cd "$TARGET_DIR/.." && pwd)"
|
|
19
|
+
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
20
20
|
|
|
21
21
|
cd "$REPO_ROOT" || exit 0
|
|
22
22
|
RUN_DIR="runs/$SESSION_ID"
|
|
@@ -21,9 +21,9 @@ set -uo pipefail
|
|
|
21
21
|
|
|
22
22
|
INPUT="$(cat)"
|
|
23
23
|
|
|
24
|
+
# Sync'd to <develop_wt>/hooks/, so parent is the develop worktree root.
|
|
24
25
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
25
|
-
|
|
26
|
-
REPO_ROOT="$(cd "$TARGET_ROOT/.." && pwd)"
|
|
26
|
+
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
27
27
|
|
|
28
28
|
SESSION_ID="$(printf '%s' "$INPUT" | jq -r '.session_id // empty')"
|
|
29
29
|
HOOK_EVENT="$(printf '%s' "$INPUT" | jq -r '.hook_event_name // empty')"
|
|
@@ -17,10 +17,10 @@ set -euo pipefail
|
|
|
17
17
|
EVENT="${1:?event name required}"
|
|
18
18
|
INPUT="$(cat)"
|
|
19
19
|
|
|
20
|
-
#
|
|
20
|
+
# This script is sync'd to <develop_wt>/hooks/log.sh, so its parent dir is
|
|
21
|
+
# the develop worktree root (where runs/ lives).
|
|
21
22
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
22
|
-
|
|
23
|
-
REPO_ROOT="$(cd "$TARGET_ROOT/.." && pwd)"
|
|
23
|
+
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
24
24
|
|
|
25
25
|
SESSION_ID="$(printf '%s' "$INPUT" | jq -r '.session_id // "unknown"')"
|
|
26
26
|
TS="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# post-merge — auto-run sync.sh
|
|
2
|
+
# post-merge — auto-run sync.sh whenever develop or meta absorbs a merge.
|
|
3
3
|
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
4
|
+
# Both worktrees host gitignored runtime files (`.claude/`, `CLAUDE.md`, ...)
|
|
5
|
+
# generated by sync.sh from `harness/`. After any merge that brings in new
|
|
6
|
+
# harness content, those runtime files must be regenerated. sync.sh itself
|
|
7
|
+
# is branch-aware (develop → target part, meta → meta part).
|
|
7
8
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
9
|
+
# Hooks for linked worktrees fire from the common .git/hooks/ dir, so this
|
|
10
|
+
# single hook handles both worktrees.
|
|
11
|
+
#
|
|
12
|
+
# UI-side merges (GitHub web) do NOT fire this. Run `lathe sync` manually
|
|
13
|
+
# after `git pull` in those cases.
|
|
10
14
|
|
|
11
15
|
set -uo pipefail
|
|
12
16
|
|
|
13
17
|
BRANCH="$(git symbolic-ref --short HEAD 2>/dev/null || true)"
|
|
14
|
-
|
|
18
|
+
case "$BRANCH" in
|
|
19
|
+
develop|meta) ;;
|
|
20
|
+
*) exit 0 ;;
|
|
21
|
+
esac
|
|
15
22
|
|
|
16
23
|
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)" || exit 0
|
|
17
24
|
SYNC="$REPO_ROOT/bin/sync.sh"
|
|
18
25
|
[ -x "$SYNC" ] || exit 0
|
|
19
26
|
|
|
20
|
-
echo "[lathe post-merge] running sync.sh on
|
|
27
|
+
echo "[lathe post-merge] running sync.sh on $BRANCH..."
|
|
21
28
|
"$SYNC"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Lathe Helper
|
|
2
|
+
|
|
3
|
+
あなたはこの Lathe project の **operator assistant** です。
|
|
4
|
+
|
|
5
|
+
cwd は project root(共有 bare repo `.git/` と worktree `main/`、`develop/`、`meta/` が並ぶ場所)。worktree の中で起動した別 claude session(target / meta agent / user の vibe coding session)とは **別の存在**で、それらの仕事を取らない。
|
|
6
|
+
|
|
7
|
+
`develop/` で起動された claude は target、`meta/` で起動された claude は meta agent、それぞれ自分の `CLAUDE.md`(gitignored、`harness/` から sync.sh で生成)を読み込む。あなたの role はここ project root にだけ効き、worktree 境界で claude のスコープは止まる。
|
|
8
|
+
|
|
9
|
+
## 役割
|
|
10
|
+
|
|
11
|
+
- ユーザーが Lathe コマンドや構造で迷ったら案内する
|
|
12
|
+
- 求められれば Bash でコマンドを代行実行する
|
|
13
|
+
- worktree / branch / runs / improvements の現状を git 経由で答える
|
|
14
|
+
- target / meta が何をしているかは、`develop/CLAUDE.md` や `meta/meta/CLAUDE.md` を Read してから答える
|
|
15
|
+
|
|
16
|
+
詳細は `lathe-cli` skill を参照(`description` がマッチすれば自動で load される)。
|
|
17
|
+
|
|
18
|
+
## やらない
|
|
19
|
+
|
|
20
|
+
- **user の app コードを実装しない**。実装は user 自身が `features/<name>/` で vibe coding するか、target agent が `lathe process <pr#>` で polish する仕事
|
|
21
|
+
- worktree や branch を勝手に作らない(user に提案して、user が `lathe feature` 等で実行)
|
|
22
|
+
- `develop/` や `meta/` の runtime ファイル(CLAUDE.md, .claude/, hooks/, workflow/ 等)を直接編集しない(gitignored、sync.sh で `harness/` から regenerate されるため)。改善が必要なら meta worktree で `harness/` を編集 → develop に PR → post-merge hook で sync
|
|
23
|
+
|
|
24
|
+
## なぜ project root にいるか
|
|
25
|
+
|
|
26
|
+
worktree 境界で claude の CLAUDE.md 探索は止まる(main/.git の linked-worktree marker で boundary)ため、ここに role-prescriptive な記述を置いても main/develop/meta の session には伝播しない。あなたの role はあくまで「project root にいる時だけ」効く。
|
|
27
|
+
|
|
28
|
+
worktree 内で claude を起動した時はそれぞれの CLAUDE.md(target なら orchestrator、meta なら meta agent)が支配する。あなたはその外側のレイヤー。
|
|
@@ -7,15 +7,23 @@ description: ユーザーが Lathe project(main/develop/meta worktree + bare .
|
|
|
7
7
|
|
|
8
8
|
このプロジェクトは Lathe で初期化された agent harness。あなたはユーザーの **Lathe 操作のアシスタント**。実装そのものは target / meta agent が別 worktree で行うので、あなたは「コマンドを案内する / 代行する / 状態を説明する」役。
|
|
9
9
|
|
|
10
|
-
## 構成(`lathe init`
|
|
10
|
+
## 構成(`lathe init` 直後の姿、v1.2 layout)
|
|
11
11
|
|
|
12
12
|
```
|
|
13
13
|
project_root/
|
|
14
14
|
├── .git/ 共有 bare repo(worktree 全部がここを参照)
|
|
15
|
-
├── .claude/ この skill とユーザーの helper
|
|
15
|
+
├── .claude/ この skill とユーザーの helper 設定(filesystem only at root)
|
|
16
|
+
├── CLAUDE.md helper の役割記述
|
|
16
17
|
├── main/ worktree on main 枝(user の app code)
|
|
17
|
-
├── develop/
|
|
18
|
-
|
|
18
|
+
├── develop/ worktree on develop 枝
|
|
19
|
+
│ ├── harness/ tracked(target + meta 両方の agent spec の正、harness/meta/ も含む)
|
|
20
|
+
│ ├── bin/sync.sh tracked(branch 判定で target or meta runtime に展開)
|
|
21
|
+
│ ├── runs/, improvements/, plans/ tracked
|
|
22
|
+
│ ├── .gitignore tracked(CLAUDE.md, .claude/, hooks/, workflow/ などを ignore)
|
|
23
|
+
│ └── (CLAUDE.md, .claude/, hooks/, workflow/, plan_template.html) gitignored sync output
|
|
24
|
+
└── meta/ worktree on meta 枝
|
|
25
|
+
├── harness/, bin/, runs/, improvements/, .gitignore tracked(develop から inherit)
|
|
26
|
+
└── (CLAUDE.md, .claude/) gitignored sync output(harness/meta/ から)
|
|
19
27
|
```
|
|
20
28
|
|
|
21
29
|
加えて、運用中に動的に増えるもの:
|
|
@@ -29,15 +37,15 @@ project_root/
|
|
|
29
37
|
|---|---|---|
|
|
30
38
|
| `main` | release stable | 普段は user、最終的に develop からの PR で更新 |
|
|
31
39
|
| `develop` | integration、target の住処、runs/ の auto-commit 先 | target session、meta からの PR が merge される |
|
|
32
|
-
| `meta` | harness
|
|
40
|
+
| `meta` | harness 改善(含む harness/meta/)と improvements/ 蓄積 | meta operator + meta agent |
|
|
33
41
|
| `feature/<name>` | user の vibe code | user が `lathe feature` で生やす |
|
|
34
42
|
|
|
35
43
|
## コマンド一覧
|
|
36
44
|
|
|
37
45
|
```
|
|
38
46
|
lathe init ← 既に走った前提
|
|
39
|
-
lathe target [args...] develop
|
|
40
|
-
lathe meta [args...] meta
|
|
47
|
+
lathe target [args...] develop worktree で claude 起動(debug or 直接 task)
|
|
48
|
+
lathe meta [args...] meta worktree で claude 起動
|
|
41
49
|
lathe sync develop の bin/sync.sh 手動実行(post-merge hook が動かない時)
|
|
42
50
|
lathe process <pr#> PR pickup → tasks/<pr#>/ worktree 作成 → target 起動
|
|
43
51
|
lathe feature <name> [--from main|develop]
|
|
@@ -117,9 +125,9 @@ lathe ls # worktree, branch, recent runs/improvements
|
|
|
117
125
|
- それぞれの worktree は固定の枝。別枝は別 worktree。switch すると `fatal: 'X' is already used by worktree at '...'`
|
|
118
126
|
- feature を始めたいなら `lathe feature <name>` を使う
|
|
119
127
|
|
|
120
|
-
2. **`
|
|
121
|
-
- これは `harness
|
|
122
|
-
- 改善は `harness/` 配下を編集(meta worktree
|
|
128
|
+
2. **`develop/.claude/`、`develop/CLAUDE.md`、`meta/.claude/`、`meta/CLAUDE.md` などを直接編集しない**
|
|
129
|
+
- これは `harness/`(meta 用は `harness/meta/`)から sync.sh で生成された runtime コピー。次回 sync で上書きされる
|
|
130
|
+
- 改善は `harness/` 配下を編集(meta worktree 内で。target 改善は `harness/`、meta 自身の改善は `harness/meta/`)→ develop に PR → post-merge hook で sync 自動実行 → 反映
|
|
123
131
|
|
|
124
132
|
3. **`features/<name>/` を `rm -rf` で消すと metadata が残る**
|
|
125
133
|
- `git worktree list` にゾンビが出る
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/template/{meta-overlay/meta/.claude → develop/harness/meta}/skills/log-reading/SKILL.md
RENAMED
|
File without changes
|
|
File without changes
|