@sassywares/skills 0.11.22 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONCEPTS.md +36 -22
- package/README.md +42 -33
- package/package.json +1 -1
- package/skills/sassy-goal/SKILL.md +5 -5
- package/skills/sassy-goal/references/close.md +4 -4
- package/skills/sassy-goal/references/goal-format.md +27 -4
- package/skills/sassy-goal/references/next.md +2 -1
- package/skills/sassy-goal/references/write.md +2 -2
- package/skills/sassy-lfg/SKILL.md +2 -2
- package/skills/sassy-overview/SKILL.md +52 -0
- package/skills/sassy-overview/references/identify.md +82 -0
- package/skills/sassy-overview/scripts/identify.sh +83 -0
- package/skills/sassy-overview/scripts/lib.sh +334 -0
- package/skills/sassy-plan/SKILL.md +5 -5
- package/skills/sassy-plan/references/plan-format.md +34 -6
- package/skills/sassy-setup/SKILL.md +8 -8
- package/skills/sassy-setup/assets/dogfood-recipe.md +1 -1
- package/skills/sassy-setup/assets/lifecycle/down +29 -0
- package/skills/sassy-setup/assets/lifecycle/up +34 -0
- package/skills/sassy-setup/assets/roster +1 -0
- package/skills/sassy-setup/assets/sassywares-readme.md +5 -4
- package/skills/sassy-setup/assets/worktree/_lib.sh +52 -213
- package/skills/sassy-setup/assets/worktree/create +18 -33
- package/skills/sassy-setup/assets/worktree/list +20 -54
- package/skills/sassy-setup/assets/worktree/prune +13 -9
- package/skills/sassy-setup/assets/worktree/remove +83 -26
- package/skills/sassy-setup/references/branching.md +7 -3
- package/skills/sassy-setup/references/config.md +105 -24
- package/skills/sassy-setup/references/dogfood.md +11 -17
- package/skills/sassy-setup/references/init.md +18 -4
- package/skills/sassy-setup/references/workspace.md +27 -34
- package/skills/sassy-setup/references/worktree.md +66 -75
- package/skills/sassy-setup/scripts/detect.sh +112 -103
- package/skills/sassy-setup/scripts/hash-skill.mjs +31 -18
- package/skills/sassy-setup/scripts/worktree-check.mjs +89 -0
- package/skills/sassy-ship/SKILL.md +1 -1
- package/skills/sassy-work/SKILL.md +2 -2
- package/skills/sassy-worktree/SKILL.md +17 -21
- package/skills/sassy-worktree/references/create.md +3 -3
- package/skills/sassy-worktree/references/list.md +2 -2
- package/skills/sassy-worktree/references/prune.md +4 -4
- package/skills/sassy-worktree/references/remove.md +8 -6
- package/skills/sassy-setup/assets/worktree/stop +0 -65
- package/skills/sassy-worktree/references/preview.md +0 -17
|
@@ -10,7 +10,7 @@ The path argument, else the working directory. `init` is the default mode; the m
|
|
|
10
10
|
|
|
11
11
|
Run `scripts/detect.sh --root <path>`. It prints a proposed config: topology (`repo`, `workspace`, `none`), the remote name, a probed base branch, and nested repos with their bases.
|
|
12
12
|
|
|
13
|
-
**A config that already exists is the proposal.** When `.sassywares/config.yaml` is found — an explicit `init` on a project that is already wired — the detector's output is only the starting point: take every value it **probes** (`git.repo`, `base_map`'s `"*"`, `repos`), and take every value it **emits as a default** from the existing file instead — the other `base_map` rungs, `hooks.*`, `worktrees.*`, `dogfood.*`, `pr.*`, `commit.branch`, `knowledge.*`, `artifacts
|
|
13
|
+
**A config that already exists is the proposal.** When `.sassywares/config.yaml` is found — an explicit `init` on a project that is already wired — the detector's output is only the starting point: take every value it **probes** (`git.repo`, `base_map`'s `"*"`, `repos`), and take every value it **emits as a default** from the existing file instead — the other `base_map` rungs, `hooks.*`, `worktrees.*`, `dogfood.*`, `pr.*`, `commit.branch`, `knowledge.*`, `artifacts.*`, and the top-level `up`/`down` pair. A default is not an answer: writing the blank slate here would retarget `"*"` away from the integration branch the project actually uses and delete its hooks. Present the result as a **diff against the file, key by key**, and ask before writing.
|
|
14
14
|
|
|
15
15
|
## 3. Ask only what detection cannot answer
|
|
16
16
|
|
|
@@ -24,8 +24,13 @@ Never re-ask what the tree already said.
|
|
|
24
24
|
- **`commit.branch`** — default `new`: the run cuts a branch before the first change and never commits on a base branch. Offer `current` for a repo that genuinely wants work committed where it stands, and say plainly that `current` lets a run commit onto its base branch and push it, with no PR (`pr.*` and `hooks.pr` are ignored; `hooks.push` runs), and that a later `sassy-ship` run in `mode:auto` will then push to that base with no gate.
|
|
25
25
|
- **`pr.*`** — default `babysit: true`, `merge: false`, `delete_branch: false`. Say plainly that `merge: true` authorizes merging every babysat PR in this project without asking.
|
|
26
26
|
- **Hooks** — offer, do not impose. Ask whether the project wants steps injected at `before_create`, `after_create`, `before_merge`, or `after_merge` (or `hooks.push` `after_push`, for `commit.branch: current` only), and under which head branch (`"*"` for all). Also offer goal hooks — `before_slice` and `after_close` under `hooks.goal`, keyed by the goal slug — as base refresh, environment preparation, and boundary announcements that never touch the goal itself and leave every base level with its remote. Entries may carry args (`<skill> <args…>`); a hook skill's args are its own vocabulary. Leave them `[]` when there is nothing to add. **Never write a hook skill yourself** — hooks are project skills, and copying one of ours into that role is the fork this mechanism exists to prevent.
|
|
27
|
-
- **Worktrees** — ask whether the project wants parallel work in this repo: a checkout per branch, each with its own derived namespace
|
|
27
|
+
- **Worktrees** — ask whether the project wants parallel work in this repo: a checkout per branch, each with its own derived namespace, so two runs never fight over one working tree. Say plainly what it costs and what it needs. `false` — the run works here, which is today's behaviour. `true` — a run may *offer* a checkout and takes one only on your yes, or outright when the run carries a `worktree:on` token, and `sassy-worktree` gains `create`, `list`, `remove`, and `prune`. It needs `commit.branch: new`: under `current` nothing ever cuts a branch, so the switch would do nothing — say so and leave it `false` rather than writing a setting that cannot fire. In `workspace` or `none` topology, say it is not available and write `false`. Read `references/worktree.md`. **Say what a checkout will need for this project** — install, `.env` derivation, a per-namespace database, a simulator, the session — and offer to create the hook with `sassy-skill`; **never write its body yourself**. With no hook, say plainly that every new checkout starts empty.
|
|
28
28
|
- **Dogfood** — ask whether the project wants agent QA: a stored procedure that proves a change works in the running product, which then lets `sassy-plan` write `Mode: Auto` QA rows instead of manual ones. Say plainly what each answer means. `false` — every QA row stays a human's, which is today's behavior. `true` — a plan may write Auto rows, but only for a recipe section that carries a `Prove it:` step, so the switch alone never makes a gate prove something. Write the answer explicitly either way; never leave it to inference. On yes, scaffold per step 4 and offer to run the first `sassy-dogfood mode:discover` before this run ends: yes means do it now (it is the only step that knows how to bring this app up), no means hand over the command and say the recipe stays a skeleton until it runs. Read `references/dogfood.md` and **never** write a command into the block or author the procedure: the recipe is the project's, and its first real content comes from a `sassy-dogfood mode:discover` run.
|
|
29
|
+
- **Lifecycle** — how this project's stack starts and stops: the top-level `up:` and `down:` keys. Probe before asking — run `bash <sassy-overview skill>/scripts/identify.sh --root <path> up down` and read its `key<TAB>value<TAB>source` lines; exit `0` means the project already declares both, exit `3` means at least one is `unknown`. Two outcomes, each an offer, never an imposition:
|
|
30
|
+
- **It answers** — a `dev`/`start`/`up`/`serve` target in a `Makefile` or `justfile`, or a compose file. When identify reports both `unknown` but an executable `dev` exists at the probed path (`bin/`, then `tool/`, then `scripts/`), that is an answer too: `up: bin/dev`. Offer each key on its own, pointing at **exactly** what was found — `up: just dev`, `down: just down`, `up: bin/dev` — naming the source identify reported or the script you found. On yes, write the keys and **write no file**: the command exists, and a copy in a downloaded script would drift from it. A key with no answer stays absent rather than becoming a guess.
|
|
31
|
+
- **It does not** — identify left the key `unknown` and nothing else declares it, so there is nothing to point at. Offer the stubs for whichever keys are still unanswered: the two files from `assets/lifecycle/`, copied to the first of `bin/`, `tool/`, `scripts/` that exists (or a new `bin/` when none does), and set `up: <dir>/up`, `down: <dir>/down`.
|
|
32
|
+
|
|
33
|
+
Declining both leaves the keys absent, which is **no lifecycle** — say it plainly and never invent a command. A file already sitting at either stub path is shown and asked about, never overwritten.
|
|
29
34
|
|
|
30
35
|
## 4. Write the config
|
|
31
36
|
|
|
@@ -33,6 +38,12 @@ Build the file from the proposal plus the answers. It is written **fully comment
|
|
|
33
38
|
|
|
34
39
|
**The dogfood scaffold, only when the answer was yes.** Create `.sassywares/dogfood/` holding `recipe.md` copied verbatim from `assets/dogfood-recipe.md`, and `.sassywares/.gitignore` with two lines — `/session/` and `/dogfood/reports/` — adding them to a `.gitignore` that already exists rather than replacing it. Never overwrite an existing recipe — show it and ask. The skeleton is deliberately incomplete: it carries the shape and the rules and fills in nothing, because `sassy-dogfood mode:discover` writes the procedure from what actually worked. Say so in the report — `enabled: true` is a permission, not a promise that a check exists.
|
|
35
40
|
|
|
41
|
+
**The lifecycle pair, when step 3 accepted one.** Write `up:` and `down:` as two top-level keys, each naming one thing: the project's own declared command (`up: just dev`), or the two stub paths. They sit at the top level, never under `worktrees:`. The shape and the contract are `references/config.md`'s Lifecycle section.
|
|
42
|
+
|
|
43
|
+
When there was no answer and the user accepted the stubs, copy `assets/lifecycle/up` and `assets/lifecycle/down` to `<dir>/up` and `<dir>/down` and make them executable; do not write a longer body. Their headers carry the contract, and both exit `78` while unimplemented — `remove` treats that as a warning and removes anyway, while any other non-zero status aborts.
|
|
44
|
+
|
|
45
|
+
**From then on they are the project's.** Setup writes the pair once; no later run edits the keys or the stub bodies, and `check` reports an absent pair as **no lifecycle** instead of proposing one. Say in the report which two values the keys name, or that the project declares no lifecycle.
|
|
46
|
+
|
|
36
47
|
## 5. Wire the skills and the agents
|
|
37
48
|
|
|
38
49
|
Both install the same way: report the scope if the pieces are present, otherwise ask once where to install, recommending user scope.
|
|
@@ -69,8 +80,10 @@ Both install the same way: report the scope if the pieces are present, otherwise
|
|
|
69
80
|
|
|
70
81
|
Two independent sets, each only when its answer was yes.
|
|
71
82
|
|
|
72
|
-
- **Worktrees, `repo` topology and `worktrees.enabled: true`.** Copy every file in `assets/worktree/` flat into `.sassywares/worktree/` and make the
|
|
73
|
-
|
|
83
|
+
- **Worktrees, `repo` topology and `worktrees.enabled: true`.** Copy every file in `assets/worktree/` flat into `.sassywares/worktree/` and make the four scripts executable. **That is the install.** They are run by path, so do not require a command runner and do not create or extend one to hold aliases: a `package.json` written into a Go, Python, or Dart project so four aliases have a home is a file the project did not ask for. When a file that already carries named commands exists (`package.json` `scripts`, `deno.json` `tasks`, `composer.json` `scripts`, a make/just target), **offer** the `worktree:<script>` aliases per `references/workspace.md`'s merge rules — append-only, proven to parse with that file's own tool, `git diff` added-lines only, restored from `HEAD` if not. Declining is a complete install. Name the scripts' path in the report either way — no version header: `--check` hashes the installed files against the copy this skill ships, not a version line. **Overwrite them without asking** when they already exist — the set is suite-owned and read-only, so a differing byte is drift for a re-run to replace, not a project edit to preserve. Read `references/worktree.md`. Do not create a worktree, and do not run a script: installing is the whole job, and the first `create` belongs to the user — a run asks, or takes one on `worktree:on`.
|
|
84
|
+
|
|
85
|
+
What a life cycle does and does not do here: `create` runs a checkout's `hooks.worktree.after_create` and **never** `up`, because provisioning has to terminate and a running stack does not; `remove` runs the configured `down:` before it deletes, after its guards pass. Nothing in the suite starts a stack — that is the project's or the user's, run from the checkout with the `WT_*` block.
|
|
86
|
+
- **Workspace, `workspace` topology only.** The snapshot plus the `branches` / `pull` / `checkout-bases` git helpers, run by path. Aliases are an offer into a command file the root already has — never a `package.json` created for them. Read `references/workspace.md` and follow it.
|
|
74
87
|
|
|
75
88
|
Then return to `SKILL.md` for steps 7–9.
|
|
76
89
|
|
|
@@ -86,3 +99,4 @@ Then return to `SKILL.md` for steps 7–9.
|
|
|
86
99
|
| Dogfood is a pointer | The block names a recipe, a reports path, a timeout, and whether Auto rows are allowed — four keys. Never a command and never a tool: a copied command duplicates the manifest and cannot express step order. |
|
|
87
100
|
| The recipe is the project's | Setup scaffolds the skeleton and stops. Authoring or "fixing" a procedure is `sassy-dogfood mode:discover`'s job, and a run may never edit the recipe to make its own failure pass. |
|
|
88
101
|
| Worktrees need `new` | `worktrees.enabled: true` with `commit.branch: current` is refused, not written: nothing cuts a branch there, so the switch could never fire. |
|
|
102
|
+
| The lifecycle is written once | `up`/`down` are initialized and then left alone: no re-run edits the keys or the stub bodies, and an absent pair is reported as **no lifecycle** rather than invented. |
|
|
@@ -27,8 +27,8 @@ lives under one directory:
|
|
|
27
27
|
`_lib.sh`'s `workspace-git-version` (or `branches --version`) the same way.
|
|
28
28
|
**Ask before overwriting any of them when they already exist** — from the first
|
|
29
29
|
install on they are the project's files, and extending them is expected.
|
|
30
|
-
- **Aliases.**
|
|
31
|
-
|
|
30
|
+
- **Aliases.** Optional, and only into a command file the project already has.
|
|
31
|
+
The scripts work by path without them. See below.
|
|
32
32
|
- **Excludes.** Write `.sassywares/workspace/.gitignore` for excluded paths
|
|
33
33
|
(vendored trees, generated dirs, `.run/`). One pattern per line, `.gitignore`
|
|
34
34
|
style. Skip it when there is nothing to exclude; the sync works without it. The
|
|
@@ -38,34 +38,38 @@ lives under one directory:
|
|
|
38
38
|
- Do **not** run the snapshot during setup. It clones and pushes; that is the
|
|
39
39
|
user's call. Offer `--dry-run` and run it only if they ask.
|
|
40
40
|
|
|
41
|
-
## Script aliases
|
|
41
|
+
## Script aliases (optional)
|
|
42
42
|
|
|
43
|
-
The scripts
|
|
44
|
-
alias per installed script:
|
|
43
|
+
The scripts are executable and tracked, so the whole contract is the path itself:
|
|
45
44
|
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"workspace:snapshot": ".sassywares/workspace/snapshot"
|
|
52
|
-
}
|
|
45
|
+
```bash
|
|
46
|
+
.sassywares/workspace/branches # branch + dirty marker per repo
|
|
47
|
+
.sassywares/workspace/pull # fetch, then ff-only per repo
|
|
48
|
+
.sassywares/workspace/checkout-bases # put each repo on its base
|
|
49
|
+
.sassywares/workspace/snapshot # commit + push the glue
|
|
53
50
|
```
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
That works in every shell, hook, and delegation brief, and it is what the setup
|
|
53
|
+
README tells the user. Aliases are an offer, not a step: if the project **already**
|
|
54
|
+
has a file at the **workspace root only** — never inside a repo — that carries
|
|
55
|
+
named commands, setup may add one entry per installed script so they are also
|
|
56
|
+
reachable from the project's own runner.
|
|
57
57
|
|
|
58
|
-
|
|
|
58
|
+
| Already at the root | Add the aliases to |
|
|
59
59
|
| --- | --- |
|
|
60
60
|
| `package.json` | its `scripts` |
|
|
61
61
|
| `deno.json` / `deno.jsonc` | its `tasks` |
|
|
62
62
|
| `composer.json` | its `scripts` |
|
|
63
|
-
| `
|
|
63
|
+
| `Makefile` / `justfile` | a `workspace:<script>` target, if the user wants one at all |
|
|
64
|
+
| `go.mod`, `pyproject.toml`, `Cargo.toml`, `Gemfile`, `pubspec.yaml`, `pom.xml`, … | **nowhere** — these name dependencies, not commands. Run the scripts by path |
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
**Never create a file to hold an alias.** Not a `package.json` in a Go, Python, or
|
|
67
|
+
Dart project, not a `Makefile` to dodge one. A manifest that exists only so five
|
|
68
|
+
aliases have a home is a file the project has to maintain and the next reader has
|
|
69
|
+
to explain, and the scripts already work without it. Skipping the aliases is a
|
|
70
|
+
complete install: say in the report that the scripts are run by path, and why.
|
|
71
|
+
|
|
72
|
+
When there is a file to wire, and the user says yes:
|
|
69
73
|
|
|
70
74
|
- **Name and value are fixed**: `workspace:<script>` → `.sassywares/workspace/<script>`.
|
|
71
75
|
No `./`, no absolute paths, no `bin/`.
|
|
@@ -74,20 +78,9 @@ one file fewer.
|
|
|
74
78
|
Never touch dependencies, `postinstall`, or `skills:*`.
|
|
75
79
|
- **Idempotent**: a matching alias is left alone, a stale value is corrected, and
|
|
76
80
|
an alias the project added itself is never removed.
|
|
77
|
-
- **
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
```json
|
|
81
|
-
{
|
|
82
|
-
"private": true,
|
|
83
|
-
"scripts": { … }
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
`private: true` keeps it unpublishable; no `name`, no `version`, no
|
|
88
|
-
dependencies. It exists so the aliases have a home. **Say that in the report** —
|
|
89
|
-
created versus already there — and skip the aliases entirely when the project
|
|
90
|
-
has removed the scripts they point at.
|
|
81
|
+
- **Prove the file still parses** with that file's own tool, and keep `git diff`
|
|
82
|
+
to added lines. An alias pointing at a script that is not installed is not
|
|
83
|
+
added at all.
|
|
91
84
|
|
|
92
85
|
## What the git helpers are for
|
|
93
86
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Worktrees
|
|
2
2
|
|
|
3
|
-
Parallel work in one repo: each run gets its own checkout
|
|
4
|
-
|
|
5
|
-
else is using.
|
|
3
|
+
Parallel work in one repo: each run gets its own checkout and its own branch,
|
|
4
|
+
without a second clone and without fighting the checkout somebody else is using.
|
|
6
5
|
|
|
7
6
|
**Repo topology only.** `git.repo: workspace` means the root is not a repo and each
|
|
8
7
|
nested repo carries its own config, so there is nothing to cut a checkout from; a
|
|
@@ -25,25 +24,46 @@ reused rather than a second one cut.
|
|
|
25
24
|
## Install
|
|
26
25
|
|
|
27
26
|
Setup copies `assets/worktree/*` flat into `.sassywares/worktree/`, makes the
|
|
28
|
-
scripts executable, and
|
|
29
|
-
|
|
30
|
-
worktree is a checkout of the repo, so every worktree carries the tooling.
|
|
27
|
+
four scripts executable, and stops. They are tracked: a worktree is a checkout of
|
|
28
|
+
the repo, so every worktree carries the tooling.
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
**No command runner is required and no manifest is created.** Every caller — the
|
|
31
|
+
suite included — runs them by path, `.sassywares/worktree/create <branch>`. Setup
|
|
32
|
+
never writes a `package.json`, a `Makefile`, or a `justfile` so that an alias has
|
|
33
|
+
somewhere to live; a Go, Python, or Dart project keeps its own tooling file and
|
|
34
|
+
nothing else.
|
|
35
|
+
|
|
36
|
+
| Script | Does | Ends with |
|
|
37
|
+
|---|---|---|
|
|
38
|
+
| `create <branch> [--from <ref>] [--env]` | cuts the branch untracked | the `WT_*` block (`--env`), the upstream it found, and the `after_create` hooks to dispatch |
|
|
39
|
+
| `list [--path <slug>]` | the table: branch, path, dirty, upstream | what it prints; a flag prints one value for scripting |
|
|
40
|
+
| `remove <slug\|branch> [--hook-ok] [--force]` | the refusals below, then deletes the checkout | a surviving branch |
|
|
41
|
+
| `prune [--yes]` | merged-or-gone, clean, fully pushed — and no `down:` or `before_remove` hook it cannot run | the removals, and why each skipped row was skipped |
|
|
42
|
+
|
|
43
|
+
`_lib.sh` is shared helpers — it reads `worktrees:` and carries the version; it is
|
|
44
|
+
sourced, never run. Every script takes `--version` (prints `worktree-version`) and
|
|
45
|
+
`--help` (its own usage). Exit codes: `0` success, `1` a refusal with the reason,
|
|
46
|
+
`2` bad usage, and `3` from `remove` when an obligation is left that a shell
|
|
47
|
+
cannot dispatch — a declared `before_remove` hook, or a `down:` that names a
|
|
48
|
+
skill — and `--hook-ok` is missing. `--hook-ok` is the caller saying the hook
|
|
49
|
+
and the `down:` skill have been dispatched, so that exit is the handshake, not an
|
|
50
|
+
error to route around.
|
|
41
51
|
|
|
42
52
|
Nothing else lives there. No state, no registry, no pid file.
|
|
43
53
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
**Aliases are a convenience, never a requirement.** When the project already has a
|
|
55
|
+
file at the root that carries named commands — `package.json` `scripts`,
|
|
56
|
+
`deno.json` `tasks`, `composer.json` `scripts`, a `Makefile` or `justfile` target —
|
|
57
|
+
setup offers to add one `worktree:<script>` entry per script, append-only, by
|
|
58
|
+
`workspace.md`'s merge rules, and declining is a complete install. It never creates
|
|
59
|
+
such a file to hold them: a path works in every shell, hook, and delegation brief
|
|
60
|
+
with no runner in between.
|
|
61
|
+
|
|
62
|
+
The installed set is suite-owned and read-only: nothing under `.sassywares/`
|
|
63
|
+
but `config.yaml` is the project's to edit. `--check` hashes the installed
|
|
64
|
+
files the way `skills-lock.json` hashes a skill folder, so a differing byte is
|
|
65
|
+
drift and the file is named. Setup overwrites the set without asking, because
|
|
66
|
+
there is no legitimate project edit to preserve.
|
|
47
67
|
|
|
48
68
|
## Where things live
|
|
49
69
|
|
|
@@ -51,7 +71,6 @@ overwriting an existing copy — from the first install it is the project's file
|
|
|
51
71
|
~/.sassywares/worktrees/
|
|
52
72
|
└── <repo>/ <- the worktree home; .repo records which checkout owns it
|
|
53
73
|
├── .repo absolute path of the main checkout
|
|
54
|
-
├── ports/ claim directories, one per claimed port
|
|
55
74
|
└── <slug>/ a checkout
|
|
56
75
|
```
|
|
57
76
|
|
|
@@ -59,6 +78,10 @@ overwriting an existing copy — from the first install it is the project's file
|
|
|
59
78
|
one path in the config that may be absolute or start with `~/` — it names
|
|
60
79
|
machine-local state, not something a teammate clones.
|
|
61
80
|
|
|
81
|
+
**An install at `worktree-version` 8 or lower also has `<worktree home>/ports/`**
|
|
82
|
+
— a folder of claim directories. Nothing reads it any more: it is inert and can be
|
|
83
|
+
deleted.
|
|
84
|
+
|
|
62
85
|
The folder is named after the repo. When another **live** clone of the same name
|
|
63
86
|
already owns it, this one takes `<repo>-<hash>` instead; a home whose recorded
|
|
64
87
|
owner no longer exists is reclaimed, so a finished project does not squat the name
|
|
@@ -94,20 +117,16 @@ work; `remove` and `prune` are the only safe exits.
|
|
|
94
117
|
|---|---|---|
|
|
95
118
|
| `WT_PATH` | `~/.sassywares/worktrees/shop/feat-catalog` | where the checkout is |
|
|
96
119
|
| `WT_BRANCH` | `feat/catalog` | the branch, as git names it |
|
|
97
|
-
| `WT_SLUG` | `feat-catalog` | the directory name
|
|
120
|
+
| `WT_SLUG` | `feat-catalog` | the directory name; the handle `list` and `remove` take |
|
|
98
121
|
| `WT_NAMESPACE` | `shop-feat-catalog` | database schema, compose project, simulator name |
|
|
99
|
-
| `WT_PORT` | `3041` | a private port — **only when `ports:` is configured** |
|
|
100
|
-
| `WT_BASE_URL` | `http://localhost:3041` | the URL on that port — same condition |
|
|
101
122
|
|
|
102
|
-
The same
|
|
103
|
-
`${WT_PORT:-5180}` that makes a recipe runnable in the main checkout too.
|
|
123
|
+
The same names expand inside a hook's brief.
|
|
104
124
|
|
|
105
125
|
**Finding a checkout.** `list` prints paths with `$HOME` shortened to `~`, which
|
|
106
126
|
reads well and does **not** paste into anything:
|
|
107
127
|
|
|
108
128
|
```bash
|
|
109
|
-
cd "$(worktree
|
|
110
|
-
worktree:list --address feat-catalog # the URL, when ports are configured
|
|
129
|
+
cd "$(.sassywares/worktree/list --path feat-catalog)" # the real absolute path
|
|
111
130
|
```
|
|
112
131
|
|
|
113
132
|
`create --env` prints `WT_PATH=` and the rest for scripts, and a slug is just the
|
|
@@ -117,30 +136,15 @@ Derived, never invented downstream: a hook that needs a database name uses
|
|
|
117
136
|
`$WT_NAMESPACE` rather than building its own, so two worktrees cannot collide by
|
|
118
137
|
accident.
|
|
119
138
|
|
|
120
|
-
**
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
and a
|
|
129
|
-
one a human opens, and the recipe's steps carry the rest (distinct ports per
|
|
130
|
-
service, derived from `$WT_PORT` or fixed by the project). Do not add a port list
|
|
131
|
-
to the config for this — it is procedure, not identity.
|
|
132
|
-
|
|
133
|
-
When a range *is* configured: the slug hashes into it, the claim is taken with an
|
|
134
|
-
atomic `mkdir`, and a collision probes forward one port at a time. A claim
|
|
135
|
-
belongs to a slug, so a restarted app returns to the same port and two slugs that
|
|
136
|
-
hash alike do not fight.
|
|
137
|
-
|
|
138
|
-
**Liveness and stopping follow the address, not the claim.** `list` probes the port
|
|
139
|
-
the checkout advertises — its claim if it has one, otherwise the port its recipe's
|
|
140
|
-
`**Preview:**` line names — and never trusts a recorded pid. `stop` kills by that
|
|
141
|
-
same address, and `remove` refuses to delete a checkout while it answers. A preview
|
|
142
|
-
that names no port at all (a simulator, a desktop window) has nothing to probe, so
|
|
143
|
-
`LIVE` reads `—` and stopping it is the project's job.
|
|
139
|
+
**Addressing a checkout is the project's own business**: how it is looked at, and
|
|
140
|
+
what brings it up, are the project's `up:` and `down:` pair — see
|
|
141
|
+
[`config.md`](config.md), Lifecycle. Two checkouts running the same app collide
|
|
142
|
+
only if that `up:` lets them.
|
|
143
|
+
|
|
144
|
+
**Liveness and stopping are the project's.** `list` reports branches, paths, dirty
|
|
145
|
+
state, and upstreams, and nothing else: the suite keeps no registry, no pid file,
|
|
146
|
+
and nothing to go stale. `remove` refuses a dirty tree, unpushed commits, or the
|
|
147
|
+
main checkout, and a configured `down:` is the project's own stop step.
|
|
144
148
|
|
|
145
149
|
## Hooks
|
|
146
150
|
|
|
@@ -165,31 +169,13 @@ declared and `--hook-ok` missing, it prints `require-hook <name>` and exits `3`.
|
|
|
165
169
|
**Never write a hook skill yourself** — the same rule as every other hook. Setup
|
|
166
170
|
records the name; the project writes the body.
|
|
167
171
|
|
|
168
|
-
## Previewing a worktree
|
|
169
|
-
|
|
170
|
-
`sassy-worktree mode:preview` brings the product up in a checkout and prints how
|
|
171
|
-
to see it, using the dogfood recipe's bring-up steps — everything up to, but not
|
|
172
|
-
including, that section's `Prove it:` step. It leaves the app running.
|
|
173
|
-
|
|
174
|
-
How to see it is the recipe's `**Preview:**` line with the namespace substituted,
|
|
175
|
-
so it is a URL, a simulator, or a window depending on the project and never a
|
|
176
|
-
guess by this tooling. `list` prints that same line in its `HOW TO SEE` column,
|
|
177
|
-
which is why the column is not called "address".
|
|
178
|
-
|
|
179
|
-
What stops a preview follows from the same split: kill it by port when there is
|
|
180
|
-
one, hand it to the project when there is not.
|
|
181
|
-
|
|
182
|
-
There is no separate preview configuration. How the app comes up is the recipe's
|
|
183
|
-
job, because it is the only place that knowledge is allowed to live.
|
|
184
|
-
|
|
185
172
|
**Sessions and third-party origins.** A worktree gets a fresh, empty
|
|
186
173
|
`.sassywares/session/`. Most providers register one callback URL, so a worktree
|
|
187
|
-
usually cannot log in on its own
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
writing down once in the recipe rather than rediscovering it.
|
|
174
|
+
usually cannot log in on its own, and the `after_create` hook is where a project
|
|
175
|
+
solves it — copying or linking the main checkout's session is the common answer.
|
|
176
|
+
A cookie is host-scoped; a `localStorage` session is origin-scoped and has to be
|
|
177
|
+
injected per origin. That difference is worth writing down once rather than
|
|
178
|
+
rediscovering it.
|
|
193
179
|
|
|
194
180
|
## Refusals
|
|
195
181
|
|
|
@@ -200,10 +186,15 @@ writing down once in the recipe rather than rediscovering it.
|
|
|
200
186
|
| It is the main checkout | the repo itself |
|
|
201
187
|
| Dirty tree | uncommitted work |
|
|
202
188
|
| Commits on no remote | nothing to recover from |
|
|
203
|
-
| Something listening on its advertised address | stop the app first |
|
|
204
189
|
| A `before_remove` hook not yet run | the project has cleanup to do |
|
|
190
|
+
| A `down:` or `before_remove` hook `prune` cannot run | it runs neither, so `--yes` sends the row to `remove` |
|
|
191
|
+
|
|
192
|
+
`prune --yes` removes nothing on a project with a `down:` configured — real or the
|
|
193
|
+
generated stub — or a `before_remove` hook: it can run neither, so every
|
|
194
|
+
otherwise-removable checkout is listed for `remove <slug>` to handle instead. That
|
|
195
|
+
is by design, not a bug.
|
|
205
196
|
|
|
206
|
-
`remove` deletes the checkout
|
|
197
|
+
`remove` deletes the checkout and nothing else. **The branch
|
|
207
198
|
survives** — git keeps it, so the work is still reachable after the worktree is
|
|
208
199
|
gone. Deleting it is the user's call, or `pr.delete_branch`'s after a merge.
|
|
209
200
|
|