@ulysses-ai/create-workspace 0.22.0-beta.0 → 0.23.0-beta.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/lib/payload.mjs +170 -2
- package/lib/payload.test.mjs +158 -3
- package/lib/upgrade.mjs +148 -6
- package/lib/upgrade.test.mjs +319 -15
- package/package.json +1 -1
- package/template/_claude/rules/forge-operations.md +27 -6
- package/template/_claude/scripts/chat-record.mjs +51 -4
- package/template/_claude/scripts/classify-update.mjs +201 -21
- package/template/_claude/scripts/cleanup-work-session.mjs +64 -3
- package/template/_claude/scripts/forges/gitlab.mjs +450 -18
- package/template/_claude/scripts/forges/interface.mjs +39 -6
- package/template/_claude/scripts/merge-mode.mjs +96 -12
- package/template/_claude/scripts/migrate-sessions.mjs +232 -24
- package/template/_claude/scripts/task-pr.mjs +52 -13
- package/template/_claude/scripts/task-worktree.mjs +79 -10
- package/template/_claude/scripts/template-baseline.mjs +33 -9
- package/template/_claude/scripts/trackers/gitlab-issues.mjs +276 -0
- package/template/_claude/scripts/trackers/interface.mjs +3 -0
- package/template/_claude/skills/complete-work/SKILL.md +7 -4
- package/template/_claude/skills/migrate-sessions/SKILL.md +20 -4
- package/template/_claude/skills/release/SKILL.md +24 -8
- package/template/_claude/skills/setup-tracker/SKILL.md +46 -12
- package/template/_claude/skills/start-work/SKILL.md +15 -2
- package/template/_claude/skills/workspace-update/SKILL.md +34 -22
|
@@ -13,15 +13,16 @@ Finalize the active work session. Handles all project repos (code changes, PRs)
|
|
|
13
13
|
|
|
14
14
|
Read the active-session pointer from `.claude/.active-session.json` in the current worktree. If it is present, this chat runs inside a session worktree: continue with this flow unchanged.
|
|
15
15
|
|
|
16
|
-
If no pointer is present, run work-model detection — this covers
|
|
16
|
+
If no pointer is present, run work-model detection — this covers lane chats, which run at the workspace root (the launcher) rather than inside a worktree, for both lifecycles:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
node "{launcher-root}/.claude/scripts/task-worktree.mjs" --root "{launcher-root}" --detect --chat "{chat}"
|
|
19
|
+
node "{launcher-root}/.claude/scripts/task-worktree.mjs" --root "{launcher-root}" --detect --chat "{chat}" [--session-id "{id}"]
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
- `{launcher-root}` is the absolute path on the `Workspace root:` line the SessionStart hook injects. If that line is absent, derive it from git: run `git rev-parse --git-common-dir` (when it prints a relative path, resolve it against the cwd) and take its parent directory. That derivation lands on the source clone `…/repos/{repo}` when run from inside a **project** task worktree — there the launcher is two levels up; from inside a `.` worktree (`.claude/worktrees/{slug}`) the parent already is the launcher.
|
|
23
|
-
- `{chat}` is the name from the `Chat record:` line the SessionStart hook injects. If that line is absent, run `node .claude/scripts/chat-record.mjs --whoami --root "{launcher-root}"` first — compaction can drop the hook line, and this recovers the name by matching the chat's session id against the records. When that too prints nothing (exit 1), omit `--chat` — detection then relies on cwd alone.
|
|
24
|
-
- `model: session` → continue with this flow (read the session tracker as below), taking `{session-name}` from the detect result's `sessionName`.
|
|
23
|
+
- `{chat}` is the name from the `Chat record:` line the SessionStart hook injects. If that line is absent, run `node .claude/scripts/chat-record.mjs --whoami --root "{launcher-root}"` first — compaction can drop the hook line, and this recovers the name by matching the chat's session id against the records. When that too prints nothing (exit 1), omit `--chat` — detection then relies on cwd and the session id alone. Detection also matches this chat's session id against each `work-sessions/*/workspace/session.md` `chatSessions` list, so a lane chat that drove an old-model session by path is findable from the launcher. Pass `--session-id` when the id is known from somewhere else; otherwise it resolves from the chat record's `sessionId`, then `$CLAUDE_CODE_SESSION_ID`, in that order.
|
|
24
|
+
- `model: session` → continue with this flow (read the session tracker as below), taking `{session-name}` from the detect result's `sessionName`. When detection ran at the launcher the result instead carries `source: "chat-sessions"` and a `sessions` list — present the entries (each `{ name, branch, workItem, status }`) and ask which to finish; `{session-name}` is the chosen entry's `name`.
|
|
25
|
+
- `model: mixed` → this chat has open tasks AND sessions its id is registered in. List both — each session as `{name} ({status}, {branch})`, each task group as `{branch}` (grouping by branch as below) — and ask which to finish. A session continues this session flow with that `{session-name}`; a task goes to **Task completion (session model v2)**.
|
|
25
26
|
- `model: task` → go to **Task completion (session model v2)**. The result's `tasks` come from the chat record; if several are open, ask the user which one to complete — group by branch, a multi-repo task is several entries sharing a branch.
|
|
26
27
|
- `model: none` → "No active work session. Nothing to complete."
|
|
27
28
|
|
|
@@ -376,6 +377,8 @@ Reached from Step 1 when detection says `model: task`. The state is the branch,
|
|
|
376
377
|
|
|
377
378
|
If several tasks are open, ask the user which one to complete — group by branch; a multi-repo task is several entries sharing a branch — and complete one branch at a time.
|
|
378
379
|
|
|
380
|
+
Notes meant for another chat are not drawer notes. The drawer is per-chat and machine-local — no other chat can read it, and this machine is its only copy — so nothing in it survives a handoff. Anything the next chat (or the operator, from another machine) needs to continue this task — decisions, gotchas, where work stopped — goes on the linked issue as a comment through the tracker adapter (`await tracker.comment("{workItem}", body)`), where every chat can read it.
|
|
381
|
+
|
|
379
382
|
0. **Pre-flight: the worktrees must be clean.** For each `{worktree}` of the chosen task, `git -C "{worktree}" status --porcelain` must be empty. If it is not, stop here — before the rebase — and ask the user to commit or discard: rebasing over uncommitted work silently invalidates it.
|
|
380
383
|
|
|
381
384
|
1. **Rebase each task worktree onto its base** — `origin/{defaultBranch}` for a `forge` repo (`git -C "{worktree}" fetch origin`, then `git -C "{worktree}" rebase "origin/{defaultBranch}"`), the local `{defaultBranch}` for a `local` repo (`git -C "{worktree}" rebase "{defaultBranch}"`; no fetch — there is no remote to fetch from). Freshness first: the PR in step 3 must describe the branch as it will merge. If conflicts arise, STOP and present them — do not auto-resolve.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: migrate-sessions
|
|
3
|
-
description: Migrate this workspace from the session lifecycle to the task lifecycle — inventory old work sessions, decide each one with the operator, finish or archive them, and switch workspace.json to the task model. Runs only inside the current workspace; never deletes anything.
|
|
3
|
+
description: Migrate this workspace from the session lifecycle to the task lifecycle — inventory old work sessions, decide each one with the operator, finish or archive them (empty orphan shells only: remove), and switch workspace.json to the task model. Runs only inside the current workspace; the script never deletes anything.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Migrate Sessions
|
|
@@ -19,12 +19,18 @@ node .claude/scripts/migrate-sessions.mjs --inventory
|
|
|
19
19
|
|
|
20
20
|
Read-only. Present the stderr table plus each session's proposal with its reasons and warnings. Say plainly that the proposals are proposals — evidence and a starting point, not decisions. Pay particular attention to the per-remote state shown per worktree (`same`, `ahead +N`, `behind -N`, `diverged +N/-M`, `not-fetched`, `unknown`) and to `unbacked` warnings: they change what Finish and Archive mean for that session. Each worktree also lists every configured remote with its exact URL — read those before any backup decision: `origin:none` means only that the remote holds no copy of this branch, never that the repo has no remote, and an `origin` that is really a third-party upstream shows its URL right there. Entries shown as `foreign` (symlinked) are never acted on — surface them for manual reconciliation.
|
|
21
21
|
|
|
22
|
+
Three more kinds of evidence change what you propose:
|
|
23
|
+
|
|
24
|
+
- **Fetch age** — every worktree line ends `fetch:…` with the age of its repo's last fetch, and anything over a day draws a `stale-fetch` warning: the commits-ahead and content counts ride on tracking refs frozen at that fetch. Tell the operator to fetch first, or re-run with `--inventory --fetch`, which fetches each touched source clone before inspecting it. A fetch is read-only with respect to the workspace's own state — it moves no local branch and touches no worktree, only refs/remotes/* and the object store — and a repo with no origin or an unreachable one is recorded as skipped or failed, never fatal.
|
|
25
|
+
- **Open chats** — `chat open?` on a session (with a `chat-open` warning) means its tracker records a chat session with no `ended:` — a chat may still be working in it. Confirm with the operator before proposing Archive.
|
|
26
|
+
- **External worktrees** — a trailing section lists worktrees the workspace's repos register outside the workspace root (a scratch checkout in tmp, a directory elsewhere). They belong to no session: nothing in this migration prunes, moves, or removes them, and you never should either — including by hand, because `git worktree prune` has no path filter and would drop their records.
|
|
27
|
+
|
|
22
28
|
## 2. Decide per session, with the operator — one at a time
|
|
23
29
|
|
|
24
30
|
For each session, lay out its evidence and ask the operator which way to go. Never infer the decision from the proposal. The options:
|
|
25
31
|
|
|
26
|
-
- **Finish** (typical for MERGEABLE) — resume
|
|
27
|
-
- **Archive** (typical for ABANDONED,
|
|
32
|
+
- **Finish** (typical for MERGEABLE, and the default offer for READY_TO_COMPLETE — a session `/complete-work` stopped partway through: tracker already stripped, worktrees still live, branch often already pushed) — resume it with `/start-work` (its walk lists sessions by their tracker, so a stripped one will not appear — name it and re-create a minimal tracker from the inventory's branch/repos before continuing), then run `/complete-work`; its own merge confirmation applies there. But if the inventory shows a **diverged** remote for that session, say so *before* the operator chooses Finish: `/complete-work`'s plain push will be rejected, and pushing the rewritten history needs `--force-with-lease` — which you run only on the operator's explicit yes naming the branch. Never force silently.
|
|
33
|
+
- **Archive** (typical for ABANDONED, an ORPHAN_SHELL that still holds files, or a MERGEABLE the operator gives up on) — take it out of the active lifecycle without destroying anything. When the inventory shows `chat open?`, confirm with the operator that the chat is really done before offering Archive — a live chat's uncommitted work would ride into the archive unseen. Three steps, in this order, each its own decision:
|
|
28
34
|
1. **Clear uncommitted work.** `--archive` refuses when any of the session's worktrees has uncommitted or untracked changes — an edited `session.md` counts — and names them, because edits buried uncommitted in an archive are invisible to every later merge or PR. Offer the operator: commit them to the session branch first (`git -C {worktree} add -A`, then `git -C {worktree} commit -m "…"` — per dirty worktree), discard them explicitly (`git -C {worktree} restore …` / `git -C {worktree} clean …`), or, on an explicit yes, re-run with `--allow-uncommitted` to archive them mid-edit. Do this before the backup: the backup tags committed tips only, so committing first brings those edits under the backup, while anything archived with `--allow-uncommitted` is NOT in it.
|
|
29
35
|
2. **Offer a backup.** Archiving keeps everything on this machine; a backup adds an off-machine copy of the session's commits, and it is what makes a later deletion safe. It covers the committed tips as they stand after step 1. Plain `--backup` creates `drain/{session}/…` tags locally and pushes nothing — for a repo whose only remote is one the operator does not own, that local tag IS the backup. Pushing is a separate, explicitly allowed step:
|
|
30
36
|
```bash
|
|
@@ -32,6 +38,10 @@ For each session, lay out its evidence and ask the operator which way to go. Nev
|
|
|
32
38
|
```
|
|
33
39
|
With no allow flag this pushes nothing and exits non-zero, listing per repo the tag and the exact URL(s) it would push to. Approve against the push URL, not the fetch URL: a remote whose push URL differs from its fetch URL shows both, and the script refuses to push there on `--remote-allow-all` — only an explicit `--remote-allow {repo}={remote}` naming it proceeds. Walk the operator through every URL and ask per repo. **Never push backup tags to a remote the operator does not own — a third-party upstream, a read-only mirror, an unfamiliar push URL; pushing `drain/*` tags there publishes the session's commits somewhere foreign.** On yes for repos they do own, re-run adding `--remote-allow {repo}={remote}` per repo (`.` is the workspace repo; `--remote-allow-all` only when every listed URL is their own) and show what was pushed. Declining is fine — the archive still keeps everything locally.
|
|
34
40
|
3. **Archive after an explicit yes naming the session:** `node .claude/scripts/migrate-sessions.mjs --archive --session {name}`. The whole session folder moves to `{sessions}/.archived/{name}--{timestamp}/` and git's worktree links are repaired to follow it — every commit, uncommitted edit, untracked or ignored file, and embedded repository comes along. If the move or the repair fails, the session is put back and the result says whether every link was verified. The session's branches stay checked out in the archived worktrees, so a new task cannot reuse those branch names until the archive is deleted. The archive refuses, touching nothing, when a directory in the folder cannot be read, when the folder holds a worktree of a repository outside this workspace, or when it holds a submodule checkout (its link cannot be repaired) — surface the reason; for a submodule the options are Finish or Keep. Relay any `warnings` (relative symlinks that pointed outside the session no longer resolve after the move).
|
|
41
|
+
- **Remove** (only an ORPHAN_SHELL the inventory marked empty — no worktree, nothing but empty directories, so there is nothing to archive). The command re-verifies emptiness itself and refuses, touching nothing, if any file or symlink has appeared since the inventory; a refusal means switch to Archive:
|
|
42
|
+
```bash
|
|
43
|
+
node -e "const fs=require('fs');const p=process.argv[1];const empty=d=>fs.readdirSync(d,{withFileTypes:true}).every(e=>e.isDirectory()&&empty(d+'/'+e.name));if(!empty(p)){console.error(p+' is not empty — left alone');process.exit(1)}fs.rmSync(p,{recursive:true});console.log('removed empty shell '+p)" work-sessions/{name}
|
|
44
|
+
```
|
|
35
45
|
- **Keep** (typical for ACTIVE, and the only sane answer for UNKNOWN) — leave it; it completes later under the session lifecycle.
|
|
36
46
|
|
|
37
47
|
Unbacked commits (present on no remote) are safe in an archive — they are only ever at risk when someone deletes one. Say so when you archive such a session, and offer the backup.
|
|
@@ -48,7 +58,13 @@ The switch procedure:
|
|
|
48
58
|
```bash
|
|
49
59
|
node .claude/scripts/migrate-sessions.mjs --enable-task-model --root .claude/worktrees/chore-enable-task-model
|
|
50
60
|
```
|
|
51
|
-
3. Land the change.
|
|
61
|
+
3. Land the change the way any task lands. A forge-hosted remote (GitHub, GitLab) means a PR/MR through `task-pr.mjs` — the launcher's default branch is protected on a real forge, so landing directly on it is not an option anyway. Commit in the worktree, write a short PR body (what changed, how it was verified) to a scratch file under `workspace-scratchpad/`, then create, ask before merging, and pull the launcher after the merge:
|
|
62
|
+
```bash
|
|
63
|
+
node .claude/scripts/task-pr.mjs --create --root . --branch chore/enable-task-model \
|
|
64
|
+
--repo . --body-file .=workspace-scratchpad/switch-pr.md --out workspace-scratchpad/switch-prs.json
|
|
65
|
+
node .claude/scripts/task-pr.mjs --merge --root . --prs workspace-scratchpad/switch-prs.json
|
|
66
|
+
```
|
|
67
|
+
Only a workspace whose repo has no remote at all (`git -C . remote -v` empty) lands locally — commit in the worktree, fast-forward the launcher's default branch, remove the worktree:
|
|
52
68
|
```bash
|
|
53
69
|
git -C .claude/worktrees/chore-enable-task-model add workspace.json
|
|
54
70
|
git -C .claude/worktrees/chore-enable-task-model commit -m "chore: switch to the task lifecycle"
|
|
@@ -23,19 +23,22 @@ Release notes come from the forge. GitHub's generated notes (merged PR titles) a
|
|
|
23
23
|
Ask which repo to release — read `repos` from `workspace.json` and default to the entry with `"primary": true`. If no version was given, ask the bump kind (patch/minor/major) after showing the merged PRs since the last tag, so the operator can judge the impact:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
git -C repos/{repo} describe --tags --abbrev=0
|
|
26
|
+
git -C repos/{repo} describe --tags --abbrev=0 # v{previous}
|
|
27
|
+
git -C repos/{repo} log -1 --format=%cI v{previous} # the previous tag's commit time
|
|
27
28
|
```
|
|
28
29
|
|
|
29
|
-
Then call the forge adapter's `prList` with a merged-after search bounded by that tag's
|
|
30
|
+
Then call the forge adapter's `prList` with `state: 'merged'`, `base:` the repo's default branch, and a merged-after search bounded by that tag's commit time — the full `%cI` timestamp (e.g. `merged:>2026-05-01T10:00:00Z`), never a bare date, which would sweep in every PR merged later the same day. `base` matters because PRs merged into other branches are not this release. If the returned list carries `truncated: true`, older PRs may sit beyond the fetched page — say so and re-query with a higher `limit` before judging the bump. Pre-v1.0 breaking changes are a minor bump.
|
|
30
31
|
|
|
31
|
-
**Step 2: Preflight the tag**
|
|
32
|
+
**Step 2: Preflight the tag and the forge**
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
Two checks before anything is pushed. First the tag: if `v{version}` already exists on origin, stop and ask — reuse it, investigate with `forge.releaseView`, or pick another version. Never force-push a tag.
|
|
34
35
|
|
|
35
36
|
```bash
|
|
36
37
|
git -C repos/{repo} ls-remote --exit-code origin refs/tags/v{version}
|
|
37
38
|
```
|
|
38
39
|
|
|
40
|
+
Second the release path. Build the repo's forge with `forgeConfigForRepo(root, '{repo}', ws)` from `.claude/scripts/merge-mode.mjs` — it picks the adapter from the repo's own origin, so a GitLab repo gets the gitlab adapter whatever `workspace.forge` says — and decide now who creates the release (Step 5): the repo's CI, or this skill. If the flow needs something the forge cannot do, stop here — past this point the tag is pushed, and a publish that cannot run is much harder to unwind.
|
|
41
|
+
|
|
39
42
|
**Step 3: Bump on a branch**
|
|
40
43
|
|
|
41
44
|
Create a task worktree for the release branch:
|
|
@@ -48,7 +51,7 @@ If the repo has a `package.json` with a `version`, set it to `{version}` (edit t
|
|
|
48
51
|
|
|
49
52
|
**Step 4: Merge**
|
|
50
53
|
|
|
51
|
-
Push the branch and open a PR through the
|
|
54
|
+
Push the branch and open a PR through the same per-repo forge (`forgeConfigForRepo` from Step 2) with head `release/v{version}`. Ask `Merge? [Y/n]`, then merge (squash, delete branch).
|
|
52
55
|
|
|
53
56
|
**Step 5: Tag and publish**
|
|
54
57
|
|
|
@@ -60,15 +63,28 @@ git -C repos/{repo} tag v{version}
|
|
|
60
63
|
git -C repos/{repo} push origin v{version}
|
|
61
64
|
```
|
|
62
65
|
|
|
63
|
-
Who creates the release depends on the repo
|
|
66
|
+
Who creates the release depends on the repo, and the CI check is per-forge:
|
|
67
|
+
|
|
68
|
+
- **GitHub**: `.github/workflows/publish.yml` that itself creates the release (it contains `gh release create`, `softprops/action-gh-release`, or `actions/create-release`) owns the release — do not call `releaseCreate`; racing it duplicates the release or fails. Instead find and watch its run with `workflowRunFind` / `workflowRunWatch` — retry the find up to 5 times with 3 s backoff (the run may not be registered the moment the tag lands); a failed run is reported to the operator, not thrown.
|
|
69
|
+
- **GitLab**: `.gitlab-ci.yml` with a `release:` keyword block (a release-cli job) owns the release the same way — do not call `releaseCreate`; find and watch the tag's pipeline with `workflowRunFind({ workflow: 'ci.yml', branch: 'v{version}' })` / `workflowRunWatch` (the workflow name is ignored — one pipeline per ref).
|
|
70
|
+
|
|
71
|
+
Either way, confirm the release exists with `forge.releaseView({ tag: 'v{version}', repo })`.
|
|
64
72
|
|
|
65
|
-
Otherwise the skill creates the release itself:
|
|
73
|
+
Otherwise the skill creates the release itself — on GitHub the forge generates the notes; on GitLab it cannot (`NOT_SUPPORTED`), so the notes come from the same query Step 1 ran:
|
|
66
74
|
|
|
67
75
|
```js
|
|
76
|
+
// GitHub
|
|
68
77
|
await forge.releaseCreate({ tag: 'v{version}', repo, generateNotes: true });
|
|
78
|
+
// GitLab — notes come from the skill, not the forge. tagTime is the %cI of
|
|
79
|
+
// v{previous}; base excludes MRs merged into other branches.
|
|
80
|
+
const merged = await forge.prList({ state: 'merged', base: '{default branch}',
|
|
81
|
+
search: `merged:>${tagTime}`, repo });
|
|
82
|
+
if (merged.truncated) warn('older MRs may be missing — raise limit and re-query');
|
|
83
|
+
await forge.releaseCreate({ tag: 'v{version}', repo, generateNotes: false,
|
|
84
|
+
notes: merged.map((p) => `- ${p.title}`).join('\n') });
|
|
69
85
|
```
|
|
70
86
|
|
|
71
|
-
If a `publish.yml` without release creation exists, still find and watch its run the same way.
|
|
87
|
+
If a `publish.yml` (or a publish job) without release creation exists, still find and watch its run the same way.
|
|
72
88
|
|
|
73
89
|
**Step 6: Tear down and report**
|
|
74
90
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: setup-tracker
|
|
3
|
-
description: Configure an issue tracker for this workspace — writes workspace.json → tracker block and initializes labels. GitHub Issues
|
|
3
|
+
description: Configure an issue tracker for this workspace — writes workspace.json → tracker block and initializes labels. GitHub Issues and GitLab Issues are the shipped backends; others can be added by dropping an adapter at .claude/scripts/trackers/{type}.mjs. Runnable during /workspace-init or standalone.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Setup Tracker
|
|
@@ -10,7 +10,7 @@ Wire this workspace up to an external issue tracker. The tracker becomes the sou
|
|
|
10
10
|
## Prerequisites
|
|
11
11
|
|
|
12
12
|
- `.claude/rules/work-item-tracking.md` should be active. If missing, warn but continue.
|
|
13
|
-
- The adapter for the chosen backend must exist at `.claude/scripts/trackers/{type}.mjs`. The template ships `github-issues.mjs`.
|
|
13
|
+
- The adapter for the chosen backend must exist at `.claude/scripts/trackers/{type}.mjs`. The template ships `github-issues.mjs` and `gitlab-issues.mjs`.
|
|
14
14
|
|
|
15
15
|
## Flow
|
|
16
16
|
|
|
@@ -20,15 +20,16 @@ Read `workspace.json` → `workspace.tracker`. If already configured: "Tracker i
|
|
|
20
20
|
|
|
21
21
|
### Step 2: Pick a backend
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Offer the backend that matches the workspace's own remote first — run `git -C {workspace-root} remote get-url origin` and suggest GitLab Issues when the host is `gitlab.com` or the workspace's configured GitLab `host`, GitHub Issues otherwise. Then ask: "Which issue tracker?"
|
|
24
24
|
1. GitHub Issues (shipped)
|
|
25
|
-
2.
|
|
26
|
-
3.
|
|
27
|
-
4.
|
|
25
|
+
2. GitLab Issues (shipped)
|
|
26
|
+
3. Linear — not yet supported
|
|
27
|
+
4. Jira — not yet supported
|
|
28
|
+
5. None — skip
|
|
28
29
|
|
|
29
|
-
For (
|
|
30
|
+
For (3) and (4): tell the user the adapter isn't shipped and exit. To add one, write a module at `.claude/scripts/trackers/{type}.mjs` that implements the contract in `.claude/scripts/trackers/interface.mjs`.
|
|
30
31
|
|
|
31
|
-
For (
|
|
32
|
+
For (5): exit — no changes.
|
|
32
33
|
|
|
33
34
|
### Step 3: GitHub Issues configuration
|
|
34
35
|
|
|
@@ -96,14 +97,47 @@ For (4): exit — no changes.
|
|
|
96
97
|
```
|
|
97
98
|
Expected: empty list (no tickets yet) or the existing ones if the repo already had issues.
|
|
98
99
|
|
|
99
|
-
### Step 4:
|
|
100
|
+
### Step 4: GitLab Issues configuration
|
|
101
|
+
|
|
102
|
+
1. **Verify `glab` auth.** Run `glab auth status`. For a self-managed instance, walk through `glab auth login --hostname {host}`. Do not proceed until authenticated.
|
|
103
|
+
|
|
104
|
+
2. **Resolve the target project.** Default to the workspace's own git remote (`git -C {workspace-root} remote get-url origin`, parsed as above). Ask: "Use `{group/sub/project}` for issues, or a different project?" Accept any nested `group/sub/project` path.
|
|
105
|
+
|
|
106
|
+
GitLab projects have issues enabled by default, so there is no equivalent of the GitHub `hasIssuesEnabled` check.
|
|
107
|
+
|
|
108
|
+
3. **Write `workspace.json`:**
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"workspace": {
|
|
112
|
+
"tracker": {
|
|
113
|
+
"type": "gitlab-issues",
|
|
114
|
+
"repo": "{group/sub/project}",
|
|
115
|
+
"host": "{host}"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
Include `"host"` only for a self-managed instance — omit it for gitlab.com. Preserve all other fields. Commit:
|
|
121
|
+
```bash
|
|
122
|
+
git add workspace.json
|
|
123
|
+
git commit -m "chore: configure gitlab-issues tracker on {group/sub/project}"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
4. **Initialize labels and (optionally) milestones** exactly as in Step 3 — the one-liners go through `createTracker`, so the same commands work against GitLab.
|
|
127
|
+
|
|
128
|
+
5. **Verify:**
|
|
129
|
+
```bash
|
|
130
|
+
glab issue list --repo {group/sub/project} --per-page 5
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Step 5: Report
|
|
100
134
|
|
|
101
135
|
```
|
|
102
136
|
Tracker configured:
|
|
103
|
-
Type: github-issues
|
|
137
|
+
Type: {github-issues | gitlab-issues}
|
|
104
138
|
Repo: {slug}
|
|
105
139
|
Labels: bug, feat, chore, P1, P2, P3
|
|
106
|
-
Milestones: {list or "(none — add via
|
|
140
|
+
Milestones: {list or "(none — add via the forge UI)"}
|
|
107
141
|
|
|
108
142
|
Next: run /start-work to pick or create an issue and begin.
|
|
109
143
|
```
|
|
@@ -113,5 +147,5 @@ Next: run /start-work to pick or create an issue and begin.
|
|
|
113
147
|
- The workspace repo is the default target — no separate `workspace-{project}` repo needed.
|
|
114
148
|
- Issues track everything across all project repos in the workspace. Cross-repo work items live in one place.
|
|
115
149
|
- One-way integration: the tracker is the source of truth. Skills read and write via the adapter; nothing else reflects tracker state locally.
|
|
116
|
-
- If
|
|
150
|
+
- If CLI auth later expires, skill flows will surface `gh`/`glab` errors — re-run `gh auth login` (or `glab auth login --hostname {host}`) and try again.
|
|
117
151
|
- Adding a new backend: write an adapter module at `.claude/scripts/trackers/{type}.mjs` implementing the interface in `interface.mjs`, then add a case in the `createTracker` switch statement.
|
|
@@ -21,7 +21,20 @@ New work as a task: one tracker issue, one branch, one worktree per repo the wor
|
|
|
21
21
|
|
|
22
22
|
If `workspace.tracker` is absent, say tracking is off and skip step 1 — but still ask for the type (`bug` / `feat` / `chore`) and a one-line description, because the type picks the branch prefix — then continue with steps 2–6. What that costs: without a tracker there is no `workItem` and no issue to close at completion — the task is still recorded on the chat record (with no work item, keyed by repo + branch), so `/complete-work` finds it from the launcher like any other task.
|
|
23
23
|
|
|
24
|
-
1. **Identify or create the tracker issue and claim it.** If the invocation's arguments already name an issue — `gh:N`, `#N`, or an issue URL — normalize it to the adapter's id (`#42` and a `.../issues/42` URL both mean `gh:42`)
|
|
24
|
+
1. **Identify or create the tracker issue and claim it.** If the invocation's arguments already name an issue — `gh:N`, `#N`, or an issue URL — normalize it to the adapter's id (`#42` and a `.../issues/42` URL both mean `gh:42`) and fetch it with `tracker.getIssue(id)`. Then check whether the issue already has a task before claiming anything — another chat may have started it (gh:188):
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
node .claude/scripts/chat-record.mjs --root . --owner "{workItem}"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Exit 1 means no chat owns a task for the issue: claim it when it is not yet assigned to you (with the same `ALREADY_ASSIGNED` handling as the fallback pick below) and skip the candidate list entirely. Exit 0 prints `{ chat, branch, repos }` — a task exists. First make sure its worktrees are there: run step 4's `--create` for each of `repos`; over an existing branch or worktree `--create` REUSES what it finds (`created: false`) — it never fails or duplicates. Then ask the operator which way to take it:
|
|
31
|
+
- **Adopt into this chat** — record the task with step 5's `--add-task`, and remove it from the old chat's record (`--remove-task --chat "{owner.chat}"` with the same selectors) only when the operator says that chat is done with it. While both chats still work the task, both records legitimately list it — the branch and worktrees are shared, not duplicated.
|
|
32
|
+
- **Leave it with the owner** — message the owning chat via SendMessage using the name `--owner` printed (the record name doubles as the session-registry name SendMessage reaches a chat by) and stop here.
|
|
33
|
+
- When `--owner` names this chat, it is a resume of your own task: reuse the worktrees as above and continue.
|
|
34
|
+
|
|
35
|
+
Notes another chat will need to continue the task never go in this chat's drawer — the drawer is per-chat and machine-local. Put them on the issue as a comment (`await tracker.comment("{workItem}", body)`), where any chat can read them.
|
|
36
|
+
|
|
37
|
+
When the invocation's arguments name no issue, list the candidates — the same adapter calls as Flow: Blank steps 3–6 (an issue picked from the list gets the same `--owner` check once its id is known):
|
|
25
38
|
|
|
26
39
|
```javascript
|
|
27
40
|
import { createTracker } from './.claude/scripts/trackers/interface.mjs';
|
|
@@ -91,7 +104,7 @@ If `workspace.tracker` is absent, say tracking is off and skip step 1 — but st
|
|
|
91
104
|
- Workspace: `work-sessions/{name}/workspace/`
|
|
92
105
|
- For each repo in `repos:` frontmatter: `work-sessions/{name}/workspace/repos/{repo}/`
|
|
93
106
|
- If any are missing, recreate from the branch
|
|
94
|
-
3. The session-start hook automatically registers each chat in the session tracker's `chatSessions` frontmatter when Claude opens in a worktree. Verify the current chat is registered —
|
|
107
|
+
3. The session-start hook automatically registers each chat in the session tracker's `chatSessions` frontmatter when Claude opens in a worktree. A lane chat resuming from the launcher is never opened there, so the hook cannot register it. Verify the current chat is registered — from either starting point — and when it is not, append an entry using the invocation shown under "Create work session" below (the helper is an importable library, not a CLI). Take the chat's UUID from this chat's record: `node .claude/scripts/chat-record.mjs --root . --read "{chat}"` prints it as `sessionId` (the `Chat record:` hook line names `{chat}`). The id matters — it is what `/complete-work` later matches this session by from the launcher.
|
|
95
108
|
|
|
96
109
|
Each `chatSessions` entry has this shape:
|
|
97
110
|
```yaml
|
|
@@ -24,49 +24,56 @@ Apply a staged template update to an initialized workspace. The CLI (`npx @ulyss
|
|
|
24
24
|
|
|
25
25
|
### Step 1: Decide where the update lands
|
|
26
26
|
|
|
27
|
-
Check the workspace repo for a remote
|
|
27
|
+
Check the workspace repo for a remote:
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
```bash
|
|
30
|
+
git remote
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
ANY remote — even one you cannot push to — routes the update through a worktree: a commit made directly on the launcher's local default branch diverges from `origin/<default>` (the push is refused on a protected default branch, and later task worktrees based on `origin/<default>` cannot fast-forward past it). Never commit or push the launcher's default branch directly.
|
|
34
|
+
|
|
35
|
+
- **A remote exists (the normal case)** — create a task worktree up front and treat it as the workspace root for Steps 2–6:
|
|
31
36
|
```bash
|
|
32
37
|
node .claude/scripts/task-worktree.mjs --root . --create --repo . --branch chore/template-update-{version}
|
|
33
38
|
```
|
|
34
|
-
The payload is untracked, so it does not appear inside the worktree — keep referencing it at the launcher's absolute path (`{launcher}/.workspace-update`). Step 7 commits, pushes, and
|
|
39
|
+
The payload is untracked, so it does not appear inside the worktree — keep referencing it at the launcher's absolute path (`{launcher}/.workspace-update`). Everything the update needs travels with the payload, including any `.template-baseline.reconstructed.json` the CLI staged for a pre-baseline workspace. Step 7 commits, pushes, and opens the PR/MR from the worktree.
|
|
40
|
+
- **No remote** — apply in place. The Step 7 commit lands on the launcher's default branch: the one sanctioned launcher commit, because a repo with no remote has nowhere else for a template update to go. The payload path is `.workspace-update/`.
|
|
35
41
|
|
|
36
42
|
In the commands below, `{payload}` is `.workspace-update` in the no-remote flow and `{launcher}/.workspace-update` in the worktree flow.
|
|
37
43
|
|
|
38
44
|
### Step 2: Classify the payload
|
|
39
45
|
|
|
40
|
-
Run the classifier — it compares every verbatim-installed payload file (`.claude/**`, `.mcp.json`, `.claudeignore
|
|
46
|
+
Run the classifier — it compares every verbatim-installed payload file (`.claude/**`, `.mcp.json`, `.claudeignore`, minus the two JSON configs that get their own list below) against the workspace and the template baseline (`.claude/.template-baseline.json`, the hashes of what the template last shipped here), and detects files the template no longer ships:
|
|
41
47
|
|
|
42
48
|
```bash
|
|
43
|
-
node {payload}/.claude/scripts/classify-update.mjs --root . --payload {payload}
|
|
49
|
+
node {payload}/.claude/scripts/classify-update.mjs --root . --payload {payload} --baseline {baseline}
|
|
44
50
|
```
|
|
45
51
|
|
|
46
|
-
It runs from the payload precisely so workspaces that don't have it installed yet can use it; once installed, `node .claude/scripts/classify-update.mjs --root .` is equivalent. Output is JSON:
|
|
52
|
+
It runs from the payload precisely so workspaces that don't have it installed yet can use it; once installed, `node .claude/scripts/classify-update.mjs --root .` is equivalent. `{baseline}` is whichever baseline the classification root has — `.claude/.template-baseline.json` when it exists there, else `{payload}/.template-baseline.reconstructed.json`, the file `--upgrade` stages for a pre-baseline workspace. Pass the flag explicitly in the worktree flow: the worktree cannot see launcher-only files, and without a baseline it classifies two-way and asks about every changed file. An explicit path is authoritative, so never point it at a file that may not exist. In the no-remote flow the flag can be omitted — the default resolves the same order itself (root baseline first, then the payload's reconstructed one, a corrupt root file counting as absent). Output is JSON:
|
|
47
53
|
|
|
48
54
|
- `new` — no installed counterpart and no baseline entry; safe to batch-apply (Step 3) behind one confirmation
|
|
49
55
|
- `identical` — installed file already equals the payload; skip silently
|
|
50
56
|
- `updated` — installed file still holds the baseline content while the payload ships something new: a pure template change the user never touched. Batched with `new` behind one confirmation
|
|
51
57
|
- `differs` — installed file matches neither the payload nor the baseline, and the template changed it since the baseline too: a local edit that meets a template change. Needs a per-file decision
|
|
58
|
+
- `config` — `.mcp.json` and `.claude/settings.json`: JSON the workspace owns jointly with the template — never compared by content, never batch-copied. Each entry carries a key-level diff (`added` keys the template ships, `workspaceOnly` keys only the workspace has, `changed` keys with different values; nested paths like `mcpServers/{server}`), element diffs for array-valued keys (`arrays`: `{ path, added, workspaceOnly }` element lists for `hooks/{event}`, `permissions/allow`/`deny`), or a `notInstalled` / `unparseable` flag. Merged key by key in Step 3.
|
|
52
59
|
- `localOnly` — installed file differs from the payload, but the payload equals the baseline: these are local edits to files the template didn't touch. Informational only — never asked about, never applied
|
|
53
60
|
- `deletedLocally` — the baseline records the file and the payload still ships it, but it is missing from the workspace (deleted locally, or declined at install time). Step 3 asks once whether to restore the list
|
|
54
61
|
- `activated` — the payload ships `rules/{name}.md.skip` while the workspace keeps `{name}.md` active: the rule was deliberately activated. Nothing to install — the active rule stays.
|
|
55
|
-
- `removed` — installed file with no counterpart in the payload. Gitignored paths, `.claude/worktrees/`, and files listed in `workspace.json` → `workspace.localFiles` (an array of `.claude/`-relative paths or globs the workspace owns) are excluded automatically, so only real template removals are listed.
|
|
62
|
+
- `removed` — installed file with no counterpart in the payload. The config files above never appear here (the template dropping one hands it to the workspace). Gitignored paths, `.claude/worktrees/`, and files listed in `workspace.json` → `workspace.localFiles` (an array of `.claude/`-relative paths or globs the workspace owns) are excluded automatically, so only real template removals are listed.
|
|
56
63
|
- `staleTests` — `*.test.mjs` files under `.claude/` the payload doesn't carry. The package never ships tests, so these came from a dev checkout and no update refreshes them (Step 3 offers removal).
|
|
57
64
|
|
|
58
65
|
Content is compared with line endings normalized (CRLF ≡ LF; binary files byte-exact), so a Windows autocrlf checkout does not read as locally modified.
|
|
59
66
|
|
|
60
|
-
If `hasBaseline` is false (
|
|
67
|
+
If `hasBaseline` is false (no workspace baseline and the payload carries no reconstructed one — current `--upgrade` stages `.template-baseline.reconstructed.json` inside the payload whenever reconstruction succeeds), tell the user: "No template baseline — this first update asks about every changed file individually; once it finishes and writes the baseline (Step 4), later updates won't." Template changes then land in `differs`. `baselineSource` names which file was used and `baselineReconstructed` flags a reconstructed one.
|
|
61
68
|
|
|
62
69
|
Templates (`*.tmpl`, which install with `{{project-name}}` substitution), `_gitignore` (merged line-by-line), and `.manifest.json` (payload metadata) are not classified — each is handled by its own sub-step in Step 3.
|
|
63
70
|
|
|
64
71
|
Report with version info from the manifest:
|
|
65
72
|
```
|
|
66
|
-
"Template update: v{fromVersion} → v{templateVersion}. {N} new files, {U} template-updated, {M} locally modified, {L} local-only edits, {D} deleted locally, {A} activated rules, {R} removed files, {K} unchanged."
|
|
73
|
+
"Template update: v{fromVersion} → v{templateVersion}. {N} new files, {U} template-updated, {M} locally modified, {C} config files to merge, {L} local-only edits, {D} deleted locally, {A} activated rules, {R} removed files, {K} unchanged."
|
|
67
74
|
```
|
|
68
75
|
|
|
69
|
-
If `new`, `updated`, `differs`, `deletedLocally`, `activated`, and `removed` are all empty, report: "Workspace is up to date (template v{templateVersion}). No changes needed." (`localOnly` files are informational and `staleTests` may still be worth offering.)
|
|
76
|
+
If `new`, `updated`, `differs`, `config` (an entry with empty `added`/`workspaceOnly`/`changed` lists and no array elements to merge counts as empty), `deletedLocally`, `activated`, and `removed` are all empty, report: "Workspace is up to date (template v{templateVersion}). No changes needed." (`localOnly` files are informational and `staleTests` may still be worth offering.)
|
|
70
77
|
|
|
71
78
|
### Step 2b: Historical .gitignore safety check
|
|
72
79
|
|
|
@@ -83,7 +90,7 @@ git ls-files | grep -E '^repos$'
|
|
|
83
90
|
```
|
|
84
91
|
If found, untrack it: `git rm --cached repos`.
|
|
85
92
|
|
|
86
|
-
Commit the fix **before** applying other template updates. This runs ahead of Step 3 because applying other updates while the bug is still present could itself trigger the destruction on workspaces that still have the old layout.
|
|
93
|
+
Commit the fix **before** applying other template updates — on the task branch in the worktree flow (Step 1), in place in the no-remote flow. This runs ahead of Step 3 because applying other updates while the bug is still present could itself trigger the destruction on workspaces that still have the old layout.
|
|
87
94
|
|
|
88
95
|
### Step 3: Selective update
|
|
89
96
|
|
|
@@ -91,6 +98,7 @@ Batch the safe cases, ask on the rest:
|
|
|
91
98
|
|
|
92
99
|
- **New and template-updated files (`new` + `updated`):** present both lists once — "Apply these {N} new and {U} template-updated files? [Y/n]" — and install them all on confirmation. No per-file prompting: `updated` means the file still holds exactly what the template last shipped here, so applying the new version loses nothing.
|
|
93
100
|
- **Locally modified (`differs`):** ask per file — "Your version of {file} differs from the template's. Show diff? [y/N]" — then apply, keep, or merge per the user's decision.
|
|
101
|
+
- **Config files (`config`):** `.mcp.json` and `.claude/settings.json` are never copied wholesale — a batch copy wipes the workspace's own MCP servers and settings. Merge each entry key by key (values from `{payload}/{path}` and the workspace's copy): add every `added` key, keep every `workspaceOnly` key untouched, and for each `changed` key ask — "Template changed `{key}` in `{path}`. Take the template's, keep yours, or inspect?" Array-valued keys merge as a union, no ask: keep the workspace's elements in place and append each `arrays` entry's `added` elements (`workspaceOnly` elements are already in place, listed for visibility). `notInstalled` — ask once: "Install {path} from the template? [Y/n]" (never install a config silently); `unparseable` means broken JSON on one side — show the file and ask, never merge blind.
|
|
94
102
|
- **Local-only edits (`localOnly`):** nothing to decide — these are your local edits to files the template hasn't changed since the last update. List them in the summary (so the edits are visible) and move on; do not ask about them.
|
|
95
103
|
- **Deleted locally (`deletedLocally`):** "These {N} files exist in the template and its baseline but not in your workspace — deleted locally (or never installed). Restore from the template? [Y/n]" — one confirmation for the whole list. Restoring installs the payload's version of each.
|
|
96
104
|
- **Removed in template (`removed`):** "Template removed {file}. Delete locally? [y/N]" — conservative default.
|
|
@@ -100,14 +108,13 @@ Batch the safe cases, ask on the rest:
|
|
|
100
108
|
|
|
101
109
|
Also handle these non-component files from the payload:
|
|
102
110
|
|
|
103
|
-
- **settings.json:** Merge payload values into existing `.claude/settings.json` — do not overwrite user customizations. Add new keys, update hook commands if hooks were migrated, preserve user-added entries.
|
|
104
111
|
- **workspace.json keys:** Compare the `workspace` object of the payload's `workspace.json.tmpl` with the installed `workspace.json`, key by key. For each key the template ships that the workspace lacks, show its template default and ask before adding. Never remove an existing key just because the template no longer ships it. `canonicalBudgetBytes` is opt-in since v0.19 — leave an existing value alone and mention it can be removed to turn the budget off.
|
|
105
112
|
- **CLAUDE.md:** If `{payload}/CLAUDE.md.tmpl` exists, merge — never regenerate from scratch:
|
|
106
113
|
```bash
|
|
107
114
|
node {payload}/.claude/scripts/classify-update.mjs --root . --payload {payload} --merge-claude-md
|
|
108
115
|
```
|
|
109
|
-
The command prints the merged CLAUDE.md: template-owned lines take the template's new versions (skill-list entries match by their `/name`), while lines the template doesn't have — the workspace's own skill entries, custom bullets, whole sections — are kept in place. Two consequences to watch in the diff: an edit made directly to a template-owned skill line is replaced by the template's new wording, and a template prose line that was reworded locally survives alongside the new template line (it may appear twice). The merge keeps the current file's line endings. Show the user the diff against the current CLAUDE.md before writing the merged result.
|
|
110
|
-
- **.gitignore:** Merge new entries from the payload's `_gitignore` into the existing `.gitignore` — do not remove user-added lines.
|
|
116
|
+
The command prints the merged CLAUDE.md: template-owned lines take the template's new versions (skill-list entries match by their `/name`), while lines the template doesn't have — the workspace's own skill entries, custom bullets, whole sections — are kept in place. Two consequences to watch in the diff: an edit made directly to a template-owned skill line is replaced by the template's new wording, and a template prose line that was reworded locally survives alongside the new template line (it may appear twice). The merge keeps the current file's line endings. Show the user the diff against the current CLAUDE.md before writing the merged result. (The two JSON configs are the `config` list's, not this block's.)
|
|
117
|
+
- **.gitignore:** Merge new entries from the payload's `_gitignore` into the existing `.gitignore` — do not remove user-added lines. An ignore pattern does not untrack already-committed files: if the workspace still tracks the per-machine catalogs the template now ignores (`git ls-files -- 'workspace-context/team-member/*/index.md'`), untrack them (`git rm -r --cached 'workspace-context/team-member/*/index.md'`), or every machine's regenerations keep dirtying pulls.
|
|
111
118
|
|
|
112
119
|
### Step 4: Update version and write the baseline
|
|
113
120
|
|
|
@@ -119,7 +126,7 @@ Then write the template baseline so the NEXT update classifies three ways instea
|
|
|
119
126
|
node {payload}/.claude/scripts/classify-update.mjs --root . --payload {payload} --write-baseline
|
|
120
127
|
```
|
|
121
128
|
|
|
122
|
-
Run it after every Step 3 decision has been made (it runs from the payload because the workspace's own copy may predate this update). It records the hash of every verbatim payload file — what the template now ships — with one deliberate exception: a file whose update was declined (the workspace still holds the old baseline content while the payload ships something new) keeps the OLD entry, so the change is offered again as `updated` next time instead of being filed away. Everything else records the payload hash: a file the user kept in their own version reads as `localOnly` (informational) until the template changes it again, and a file nobody touched never reads as a local edit. The command refuses to write an empty baseline — if it errors, the payload path is wrong; do not force it.
|
|
129
|
+
Run it after every Step 3 decision has been made (it runs from the payload because the workspace's own copy may predate this update). In the worktree flow this writes the baseline inside the worktree (`--root .`), so it is committed through the PR and reaches every clone — and it reads the same baseline the classification used (the worktree has none of its own yet, so the payload's reconstructed file supplies the old entries a declined update keeps). It records the hash of every verbatim payload file — what the template now ships — with one deliberate exception: a file whose update was declined (the workspace still holds the old baseline content while the payload ships something new) keeps the OLD entry, so the change is offered again as `updated` next time instead of being filed away. Everything else records the payload hash: a file the user kept in their own version reads as `localOnly` (informational) until the template changes it again, and a file nobody touched never reads as a local edit. The command refuses to write an empty baseline — if it errors, the payload path is wrong; do not force it.
|
|
123
130
|
|
|
124
131
|
### Step 4a: Run idempotent migrators
|
|
125
132
|
|
|
@@ -183,14 +190,19 @@ Delete the `.workspace-update/` directory at the launcher — in the worktree fl
|
|
|
183
190
|
|
|
184
191
|
### Step 7: Commit
|
|
185
192
|
|
|
186
|
-
Where the commit lands was decided in Step 1.
|
|
193
|
+
Where the commit lands was decided in Step 1 — the launcher's default branch is never pushed directly.
|
|
187
194
|
|
|
188
195
|
- **No remote:** commit in place on the launcher's default branch — the one sanctioned launcher commit:
|
|
189
196
|
```bash
|
|
190
197
|
git add -A
|
|
191
198
|
git commit -m "chore: update workspace from template v{fromVersion} to v{templateVersion}"
|
|
192
199
|
```
|
|
193
|
-
- **Remote exists:** from the task worktree created in Step 1, commit the applied update, push the branch, and open
|
|
200
|
+
- **Remote exists:** from the task worktree created in Step 1, commit the applied update, push the branch, and open the PR/MR through `node .claude/scripts/task-pr.mjs` — it drives GitHub today and GitLab once gh:185 lands; if it reports the forge unsupported, open the MR with the forge's own CLI (for GitLab, `glab mr create`) from the worktree and say so in the report. After the PR/MR merges, restore the launcher's skill copy before pulling — `--upgrade` replaced `.claude/skills/workspace-update/` in the launcher (a tracked modification) and the merged PR delivers the same content, so a dirty launcher blocks the pull. If `.claude/skills/workspace-update/SKILL.md.local-backup` sits there (a customised skill the CLI backed up), move it somewhere safe first (e.g. `workspace-scratchpad/`), then:
|
|
201
|
+
```bash
|
|
202
|
+
git -C {launcher} checkout -- .claude/skills/workspace-update
|
|
203
|
+
git -C {launcher} clean -f -- .claude/skills/workspace-update
|
|
204
|
+
```
|
|
205
|
+
Then pull the launcher and delete the payload (Step 6).
|
|
194
206
|
|
|
195
207
|
Report: "Workspace updated to v{templateVersion}. Restart Claude Code if rules or hooks changed."
|
|
196
208
|
|
|
@@ -200,11 +212,11 @@ After the update is applied, if the sessions directory (`workspace.workSessionsD
|
|
|
200
212
|
|
|
201
213
|
## Notes
|
|
202
214
|
|
|
203
|
-
- The CLI (`npx @ulysses-ai/create-workspace --upgrade`) stages the payload
|
|
204
|
-
- Never overwrites without asking — `new` and `updated` files are batched behind one confirmation; `differs` files are asked per file; `localOnly` files are never asked about (local edits to files the template didn't touch)
|
|
205
|
-
- Preserves local modifications, custom content, existing `workspace.json` keys, and deliberately activated rules
|
|
215
|
+
- The CLI (`npx @ulysses-ai/create-workspace --upgrade`) stages the payload, installs the current copy of this skill into `.claude/skills/workspace-update/` (so an outdated installed flow never processes a new payload; a locally customised SKILL.md is backed up as `SKILL.md.local-backup` first), and stages a reconstructed baseline inside the payload as `.template-baseline.reconstructed.json` when the workspace has none — the launcher itself gets no new untracked files, and Step 7 restores the launcher's skill copy before the post-merge pull
|
|
216
|
+
- Never overwrites without asking — `new` and `updated` files are batched behind one confirmation; `differs` files are asked per file; `config` files (`.mcp.json`, `.claude/settings.json`) are merged key by key (array-valued keys union-merged) and never copied wholesale; `localOnly` files are never asked about (local edits to files the template didn't touch)
|
|
217
|
+
- Preserves local modifications, custom content, the workspace's own MCP servers and settings, existing `workspace.json` keys, and deliberately activated rules
|
|
206
218
|
- The template baseline (`.claude/.template-baseline.json`) is what separates `updated`, `differs`, and `localOnly`: entries hold the payload hash of the last-shipped content (unapplied updates keep the older entry), so a deliberately kept local edit stays visible across updates while an untouched file never prompts
|
|
207
|
-
- The launcher's default branch takes a template-update commit only when the workspace has no remote; with
|
|
219
|
+
- The launcher's default branch takes a template-update commit only when the workspace repo has no remote; with ANY remote, the update lands through a task worktree, a branch, and a PR/MR — the default branch is never pushed directly
|
|
208
220
|
- Can be run multiple times safely (idempotent) — if `.workspace-update/` doesn't exist, it reports no payload and exits
|
|
209
221
|
- Initial setup is handled by `npx @ulysses-ai/create-workspace --init` + `/workspace-init` — this skill is for subsequent updates only
|
|
210
222
|
- The `.sh` to `.mjs` hook migration is a one-time transition for workspaces created before hooks moved to JavaScript
|