@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.
Files changed (44) hide show
  1. package/CONCEPTS.md +36 -22
  2. package/README.md +42 -33
  3. package/package.json +1 -1
  4. package/skills/sassy-goal/SKILL.md +5 -5
  5. package/skills/sassy-goal/references/close.md +4 -4
  6. package/skills/sassy-goal/references/goal-format.md +27 -4
  7. package/skills/sassy-goal/references/next.md +2 -1
  8. package/skills/sassy-goal/references/write.md +2 -2
  9. package/skills/sassy-lfg/SKILL.md +2 -2
  10. package/skills/sassy-overview/SKILL.md +52 -0
  11. package/skills/sassy-overview/references/identify.md +82 -0
  12. package/skills/sassy-overview/scripts/identify.sh +83 -0
  13. package/skills/sassy-overview/scripts/lib.sh +334 -0
  14. package/skills/sassy-plan/SKILL.md +5 -5
  15. package/skills/sassy-plan/references/plan-format.md +34 -6
  16. package/skills/sassy-setup/SKILL.md +8 -8
  17. package/skills/sassy-setup/assets/dogfood-recipe.md +1 -1
  18. package/skills/sassy-setup/assets/lifecycle/down +29 -0
  19. package/skills/sassy-setup/assets/lifecycle/up +34 -0
  20. package/skills/sassy-setup/assets/roster +1 -0
  21. package/skills/sassy-setup/assets/sassywares-readme.md +5 -4
  22. package/skills/sassy-setup/assets/worktree/_lib.sh +52 -213
  23. package/skills/sassy-setup/assets/worktree/create +18 -33
  24. package/skills/sassy-setup/assets/worktree/list +20 -54
  25. package/skills/sassy-setup/assets/worktree/prune +13 -9
  26. package/skills/sassy-setup/assets/worktree/remove +83 -26
  27. package/skills/sassy-setup/references/branching.md +7 -3
  28. package/skills/sassy-setup/references/config.md +105 -24
  29. package/skills/sassy-setup/references/dogfood.md +11 -17
  30. package/skills/sassy-setup/references/init.md +18 -4
  31. package/skills/sassy-setup/references/workspace.md +27 -34
  32. package/skills/sassy-setup/references/worktree.md +66 -75
  33. package/skills/sassy-setup/scripts/detect.sh +112 -103
  34. package/skills/sassy-setup/scripts/hash-skill.mjs +31 -18
  35. package/skills/sassy-setup/scripts/worktree-check.mjs +89 -0
  36. package/skills/sassy-ship/SKILL.md +1 -1
  37. package/skills/sassy-work/SKILL.md +2 -2
  38. package/skills/sassy-worktree/SKILL.md +17 -21
  39. package/skills/sassy-worktree/references/create.md +3 -3
  40. package/skills/sassy-worktree/references/list.md +2 -2
  41. package/skills/sassy-worktree/references/prune.md +4 -4
  42. package/skills/sassy-worktree/references/remove.md +8 -6
  43. package/skills/sassy-setup/assets/worktree/stop +0 -65
  44. package/skills/sassy-worktree/references/preview.md +0 -17
@@ -0,0 +1,82 @@
1
+ # Identify
2
+
3
+ `scripts/identify.sh` inspects a project's files and prints one line per key. It is the whole of `mode:identify`: run it, read its lines, branch on its exit code.
4
+
5
+ ```bash
6
+ bash <sassy-overview skill>/scripts/identify.sh [--root DIR] [--key KEY]... [KEY]...
7
+ ```
8
+
9
+ `--root` defaults to the current directory. Positional keys and `--key KEY` are the same thing; both may be mixed. With no keys it prints every key in table order. `scripts/lib.sh` holds the table and is sourced by `identify.sh` — never invoked directly.
10
+
11
+ ## The contract
12
+
13
+ Exactly three tab-separated columns, one line per key, no header, no blank lines:
14
+
15
+ ```
16
+ key<TAB>value<TAB>source
17
+ ```
18
+
19
+ - `key` — one of the nine names below.
20
+ - `value` — what the project declares, or `unknown`.
21
+ - `source` — the file the value came from, relative to `--root`, or `-` when there is none (`unknown`, and `wired: no`). The one exception: a `.sassywares/config.yaml` belonging to a directory above `--root` has no relative path, so `wired` names it absolutely.
22
+
23
+ Exit codes decide what a caller may do:
24
+
25
+ | Code | Meaning | Caller's move |
26
+ |---|---|---|
27
+ | `0` | answered | use the values |
28
+ | `3` | a requested key is `unknown` | say the fact is unknown and stop; never substitute a command |
29
+ | `2` | usage error (bad key name, bad option, missing directory) | fix the invocation |
30
+
31
+ The default run is an **inventory**: it prints every key and exits `0` even when some are unknown, because an inventory is not a question. Naming keys makes it a question — any requested key that is `unknown` makes the run exit `3`, after printing all requested lines. Requested keys print in the order they were named.
32
+
33
+ Everything is file inspection: no network, no executing the project's tooling (not even `make -n`), no writes. A wrong answer is possible only where the files are ambiguous; a fabricated one is not.
34
+
35
+ ## The keys
36
+
37
+ | Key | It means | `unknown` when |
38
+ |---|---|---|
39
+ | `stack` | the project's language ecosystem | no stack manifest in the table |
40
+ | `runner` | the tool that runs the project's commands | no task runner and no stack manifest |
41
+ | `install` | how dependencies are installed | nothing declared |
42
+ | `up` | how the app starts | no declared start target and no compose file |
43
+ | `down` | how the app stops | no declared stop target and no compose file |
44
+ | `test` | how the test suite runs | nothing declares one (a language default counts only where it is unambiguous) |
45
+ | `compose` | the compose file in use | no compose file |
46
+ | `env` | the env file in use | no env file |
47
+ | `wired` | the suite is set up here | never — the answer is `yes` or `no` |
48
+
49
+ `up` and `down` are the only keys a project might reasonably have and not declare, and this script reads only what a file declares: a `Makefile`/`justfile` target or a compose file. A project that states them in `.sassywares/config.yaml` (`up:`/`down:`, which `sassy-setup` initializes and the worktree mechanics read) is answering through the config — this script still reports `unknown` for them, because it never reads the suite's own config for a stack fact, and the config is the authority once it names one.
50
+
51
+ `wired` is the one key that always has an answer: `yes` with the nearest `.sassywares/config.yaml` as its source, otherwise `no` with `-`. The search walks up from `--root` the same way `sassy-setup`'s `detect.sh` resolves a config, so a repo nested inside a folder that owns one is `wired: yes`; the source is then that config's absolute path, since it sits outside the root.
52
+
53
+ ## The manifest table
54
+
55
+ The first stack manifest in this order wins, so a repo with several gets one stack and one set of ecosystem commands. A `Makefile`/`justfile` then overrides `runner` and any command it declares (just outranks make), and a compose file takes `up`/`down` only where nothing else declared them.
56
+
57
+ | Stack | Manifest | `runner` | `install` | `test` |
58
+ |---|---|---|---|---|
59
+ | `go` | `go.mod` | `go` | `go mod download` | `go test ./...` |
60
+ | `node` | `package.json` | `bun`/`pnpm`/`yarn`/`npm`, from its lockfile then `packageManager` | `<pm> install` | `<pm> test`, when `scripts.test` exists |
61
+ | `deno` | `deno.json`, `deno.jsonc` | `deno task` when it declares `tasks`, else `deno` | — | `deno task test`, when declared |
62
+ | `python` | `pyproject.toml`, `requirements.txt`, `setup.py` | `poetry`/`uv` from their lockfile, else `pip` | `poetry install`, `uv sync`, `pip install -r requirements.txt`, or `pip install -e .` | — |
63
+ | `dart` | `pubspec.yaml` | `flutter` when the SDK is declared, else `dart` | `flutter pub get` / `dart pub get` | `flutter test` / `dart test` |
64
+ | `rust` | `Cargo.toml` | `cargo` | `cargo fetch` | `cargo test` |
65
+ | `php` | `composer.json` | `composer` | `composer install` | `composer test`, when `scripts.test` exists |
66
+ | `ruby` | `Gemfile` | `bundle` | `bundle install` | — |
67
+ | — | `Makefile` | `make` | — | `make test`, when declared |
68
+ | — | `justfile` | `just` | — | `just test`, when declared |
69
+ | — | `compose.yaml`, `compose.yml`, `docker-compose.yml`, `docker-compose.yaml` | `docker` (last resort) | — | — |
70
+
71
+ `up` and `down` are declared, never inferred from a language: a `dev`/`start`/`up`/`serve` target in a `Makefile` or `justfile` (or a task of that name in a `deno.json`/`deno.jsonc` `tasks` object), then a compose file (`docker compose up` / `docker compose down`). A node `scripts.dev` is deliberately not read — it says how a tool starts, not how the project comes up. A target is recognized by its declaration line; nothing is executed to prove it exists. A Deno manifest declares no dependency-install step (imports are resolved by the runtime), so its `install` is `unknown` rather than an invented `deno install`.
72
+
73
+ `env` is the first of `.env`, `.env.local`, `.env.example`, `.env.sample`. Its value is the path, never the contents.
74
+
75
+ Adding a row to this table means adding a fixture to `tests/sassy-overview-identify.sh` in the same change that asserts the row's real value — not `unknown`. A row without a fixture is a guess with a source column.
76
+
77
+ ## Consuming a value
78
+
79
+ - **Print the source with the value.** A caller that says `test: go test ./... (go.mod)` can be checked; one that says `test: go test` cannot.
80
+ - **Treat `3` as information.** If `up` was requested and is `unknown`, the project has not said how it starts. Report that. Do not invent `npm run dev`, do not write a `Makefile` so an answer exists, and do not fall back to a sibling key.
81
+ - **Ask for what you need.** Requesting one key is cheaper to read and gives a sharper exit code than parsing the full inventory.
82
+ - **Never cache it.** It is a file read; rerun it after the project's files change rather than trusting a remembered answer.
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env bash
2
+ # identify.sh — what is this project, and how does it run?
3
+ #
4
+ # One tab-separated line per key: `key<TAB>value<TAB>source`, where source is
5
+ # the file the value came from, or `-` when there is no source (an `unknown`
6
+ # value, or `wired: no`). Read-only: it inspects files, never the network, and
7
+ # never runs the project's tooling — not even `make -n` — and writes nothing.
8
+ #
9
+ # Usage:
10
+ # identify.sh [--root DIR] every key, in table order
11
+ # identify.sh [--root DIR] [--key KEY]... [KEY]...
12
+ # only the keys named, in the order
13
+ # they were named (`--key` and a
14
+ # bare positional are the same)
15
+ # identify.sh --help
16
+ #
17
+ # Exit: 0 answered; 3 a requested key is unknown; 2 usage error. The default
18
+ # run is an inventory and exits 0 even when keys are unknown — a request is a
19
+ # question, and only a question can go unanswered.
20
+ set -euo pipefail
21
+
22
+ SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
23
+ # shellcheck source=skills/sassy-overview/scripts/lib.sh
24
+ . "$SELF_DIR/lib.sh"
25
+
26
+ KEYS="$ID_KEYS"
27
+ USAGE="usage: identify.sh [--root DIR] [--key KEY]... [KEY]...
28
+ identify.sh --help
29
+
30
+ Prints one line per key: key<TAB>value<TAB>source. Read-only.
31
+
32
+ Keys: $KEYS
33
+ Exit: 0 answered, 3 a requested key is unknown, 2 usage error."
34
+
35
+ die_usage() {
36
+ printf 'identify: %s\n%s\n' "$*" "$USAGE" >&2
37
+ exit 2
38
+ }
39
+
40
+ ROOT="$(pwd -P)"
41
+ want=()
42
+
43
+ while (( $# )); do
44
+ case "$1" in
45
+ --root) (( $# >= 2 )) || die_usage "missing DIR after --root"; ROOT="$2"; shift 2 ;;
46
+ --root=*) ROOT="${1#*=}"; shift ;;
47
+ --key) (( $# >= 2 )) || die_usage "missing KEY after --key"; want[${#want[@]}]="$2"; shift 2 ;;
48
+ --key=*) want[${#want[@]}]="${1#*=}"; shift ;;
49
+ --help|-h)
50
+ printf '%s\n' "$USAGE"
51
+ exit 0 ;;
52
+ -*) die_usage "unknown option '$1'" ;;
53
+ *) want[${#want[@]}]="$1"; shift ;;
54
+ esac
55
+ done
56
+
57
+ [ -d "$ROOT" ] || die_usage "not a directory: $ROOT"
58
+ ID_ROOT="$(cd "$ROOT" && pwd -P)"
59
+
60
+ id_known() {
61
+ case " $KEYS " in *" $1 "*) return 0 ;; esac
62
+ return 1
63
+ }
64
+
65
+ for k in ${want[@]+"${want[@]}"}; do
66
+ id_known "$k" || die_usage "unknown key '$k'"
67
+ done
68
+
69
+ id_scan
70
+
71
+ # An inventory prints every key and always exits 0; a request prints the keys it
72
+ # named, in that order, and exits 3 when one of them has no answer.
73
+ if (( ${#want[@]} )); then keys="${want[*]}"; else keys="$KEYS"; fi
74
+ missing=0
75
+ for k in $keys; do
76
+ v="$(id_value "$k")"
77
+ s="$(id_source "$k")"
78
+ printf '%s\t%s\t%s\n' "$k" "$v" "$s"
79
+ if [ "$v" = unknown ] && (( ${#want[@]} )); then missing=1; fi
80
+ done
81
+
82
+ (( missing == 0 )) || exit 3
83
+ exit 0
@@ -0,0 +1,334 @@
1
+ #!/usr/bin/env bash
2
+ # Helpers for sassy-overview's identify.sh.
3
+ #
4
+ # Read-only file inspection and nothing else: no network, no executing the
5
+ # project's tooling (not even `make -n`), no writes. Every helper answers from a
6
+ # file's bytes or not at all — "unknown" is the honest answer, never a guess.
7
+ #
8
+ # Sourced by identify.sh, never run directly. It is a query, so it is invoked by
9
+ # path from the skill directory and is never installed into a project's
10
+ # `.sassywares/`.
11
+
12
+ # The key list, in table order, defined once: id_scan initialises every key from
13
+ # it and identify.sh validates and prints from it.
14
+ ID_KEYS="stack runner install up down test compose env wired"
15
+
16
+ # One value and one source per key, as plain variables: bash 3.2 has no
17
+ # associative arrays, and this runs on a stock macOS shell.
18
+ id_v() { printf -v "ID_V_$1" '%s' "$2"; }
19
+ id_s() { printf -v "ID_S_$1" '%s' "${2:--}"; }
20
+ id_set() { id_v "$1" "$2"; id_s "$1" "${3:--}"; }
21
+ id_unknown() { id_set "$1" unknown; }
22
+ id_value() { local n="ID_V_$1"; printf '%s' "${!n}"; }
23
+ id_source() { local n="ID_S_$1"; printf '%s' "${!n}"; }
24
+
25
+ # The first candidate that exists under ID_ROOT, printed relative to it.
26
+ id_first_file() {
27
+ local f
28
+ for f in "$@"; do
29
+ [ -f "$ID_ROOT/$f" ] && { printf '%s' "$f"; return 0; }
30
+ done
31
+ return 1
32
+ }
33
+
34
+ # The nearest `.sassywares/config.yaml`, walking up from ID_ROOT the way
35
+ # `sassy-setup`'s detect.sh resolves it. Printed relative to ID_ROOT when it is
36
+ # there, and as an absolute path when it belongs to a parent directory.
37
+ id_config() {
38
+ local probe="$ID_ROOT"
39
+ while :; do
40
+ if [ -f "$probe/.sassywares/config.yaml" ]; then
41
+ if [ "$probe" = "$ID_ROOT" ]; then
42
+ printf '%s' .sassywares/config.yaml
43
+ else
44
+ printf '%s' "$probe/.sassywares/config.yaml"
45
+ fi
46
+ return 0
47
+ fi
48
+ [ "$probe" = / ] && return 1
49
+ probe="$(dirname "$probe")"
50
+ done
51
+ }
52
+
53
+ # The node package manager, from its lockfile and then the manifest's
54
+ # `packageManager` field. Sets ID_PM and ID_PM_SRC.
55
+ id_node_pm() {
56
+ local pair
57
+ for pair in "bun.lockb:bun" "bun.lock:bun" "pnpm-lock.yaml:pnpm" "yarn.lock:yarn"; do
58
+ if [ -f "$ID_ROOT/${pair%%:*}" ]; then
59
+ ID_PM="${pair#*:}"; ID_PM_SRC="${pair%%:*}"; return 0
60
+ fi
61
+ done
62
+ # An unreadable or missing manifest leaves the value empty rather than killing
63
+ # the run: identify's own exit codes are 0, 3 and 2, never a shell's 1.
64
+ ID_PM="$(sed -n 's/.*"packageManager"[[:space:]]*:[[:space:]]*"\([a-z]*\)@.*/\1/p' "$ID_ROOT/package.json" 2>/dev/null | head -n 1)" || ID_PM=""
65
+ [ -n "$ID_PM" ] || ID_PM="npm"
66
+ ID_PM_SRC="package.json"
67
+ }
68
+
69
+ # One named entry from a JSON object such as package.json's `scripts` or
70
+ # deno.json's `tasks`. Prints its command, and nothing when the object or the
71
+ # name is absent. The block-opening brace is found on the same line, so both a
72
+ # pretty-printed and a single-line object are read.
73
+ id_json_block_script() { # <file> <block> <name>
74
+ awk -v block="$2" -v want="$3" '
75
+ function emit(line, i, rest, out, j, c) {
76
+ i = index(line, "\"" want "\"")
77
+ if (!i) return
78
+ rest = substr(line, i + length(want) + 2)
79
+ if (!match(rest, /^[ \t]*:[ \t]*"/)) return
80
+ rest = substr(rest, RLENGTH + 1)
81
+ out = ""
82
+ for (j = 1; j <= length(rest); j++) {
83
+ c = substr(rest, j, 1)
84
+ if (c == "\\") { out = out c substr(rest, j + 1, 1); j++; continue }
85
+ if (c == "\"") break
86
+ out = out c
87
+ }
88
+ if (out != "") found = out
89
+ }
90
+ # Where the `scripts` block closes on this text, or 0 when it does not. The
91
+ # block-opening brace is already behind us, so the first unmatched `}` ends
92
+ # it — which is what keeps a neighbouring object'"'"'s `test` out of reach.
93
+ # A brace inside a string is data, not structure: without quote and escape
94
+ # state a command like `echo }hi` closes the block early and hides every
95
+ # task after it. JSON strings do not span lines, so both reset per line.
96
+ function block_end(text, i, c, depth, q, esc) {
97
+ depth = 0; q = 0; esc = 0
98
+ for (i = 1; i <= length(text); i++) {
99
+ c = substr(text, i, 1)
100
+ if (q) {
101
+ if (esc) { esc = 0; continue }
102
+ if (c == "\\") { esc = 1; continue }
103
+ if (c == "\"") q = 0
104
+ continue
105
+ }
106
+ if (c == "\"") { q = 1; continue }
107
+ if (c == "{") depth++
108
+ else if (c == "}") { if (depth == 0) return i; depth-- }
109
+ }
110
+ return 0
111
+ }
112
+ {
113
+ if (!inb) {
114
+ i = index($0, "\"" block "\"")
115
+ if (i) {
116
+ rest = substr($0, i + length(block) + 2)
117
+ if (match(rest, /^[ \t]*:[ \t]*\{/)) {
118
+ inb = 1
119
+ rest = substr(rest, RLENGTH + 1)
120
+ cut = block_end(rest)
121
+ if (cut) { emit(substr(rest, 1, cut - 1)); inb = 0 }
122
+ else emit(rest)
123
+ }
124
+ }
125
+ next
126
+ }
127
+ cut = block_end($0)
128
+ if (cut) { emit(substr($0, 1, cut - 1)); inb = 0 }
129
+ else emit($0)
130
+ }
131
+ END { if (found != "") print found }
132
+ ' "$1" 2>/dev/null
133
+ }
134
+
135
+ # A package.json `scripts` entry, through the shared JSON block reader above.
136
+ id_pkg_script() { # <package.json> <script name>
137
+ id_json_block_script "$1" scripts "$2"
138
+ }
139
+
140
+ # Whether a JSON object declares a block at all — an empty `"tasks": {}` is a
141
+ # declared block, so this cannot be answered by looking for an entry in it.
142
+ id_json_has_block() { # <file> <block>
143
+ awk -v block="$2" '
144
+ {
145
+ i = index($0, "\"" block "\"")
146
+ if (!i) next
147
+ rest = substr($0, i + length(block) + 2)
148
+ # Set the flag and keep reading: exiting here closes the pipe on the
149
+ # producer, and under `set -o pipefail` its SIGPIPE (141) reports a
150
+ # declared block as absent. Let END decide, after the input is drained.
151
+ if (match(rest, /^[ \t]*:[ \t]*\{/)) found = 1
152
+ }
153
+ END { exit(found ? 0 : 1) }
154
+ ' "$1" 2>/dev/null
155
+ }
156
+
157
+ # A JSONC manifest with its comments removed, one line at a time. A character
158
+ # scanner, not a regex: `//` and `/* */` are dropped only outside a string, so a
159
+ # `"https://..."` value and an escaped quote stay intact. Commented-out JSON is
160
+ # not a declaration, and this is what makes that true for `.jsonc`.
161
+ id_strip_jsonc() { # <file>
162
+ awk '
163
+ {
164
+ line = $0; n = length(line); out = ""; i = 1
165
+ while (i <= n) {
166
+ c = substr(line, i, 1)
167
+ if (in_block) {
168
+ if (c == "*" && substr(line, i + 1, 1) == "/") { in_block = 0; i += 2; continue }
169
+ i++; continue
170
+ }
171
+ if (in_str) {
172
+ out = out c
173
+ if (c == "\\") { out = out substr(line, i + 1, 1); i += 2; continue }
174
+ if (c == "\"") in_str = 0
175
+ i++; continue
176
+ }
177
+ if (c == "\"") { in_str = 1; out = out c; i++; continue }
178
+ if (c == "/" && substr(line, i + 1, 1) == "/") break
179
+ if (c == "/" && substr(line, i + 1, 1) == "*") { in_block = 1; i += 2; continue }
180
+ out = out c; i++
181
+ }
182
+ print out
183
+ }
184
+ ' "$1" 2>/dev/null
185
+ }
186
+
187
+ # A declaration line, not an assignment: `dev:` is a target, `dev:=1` is not.
188
+ id_make_target() { # <Makefile> <target>
189
+ grep -qE "^$2[[:space:]]*:([^=]|$)" "$1" 2>/dev/null
190
+ }
191
+
192
+ # A recipe (`dev:` or `dev arg="x":`) or an alias — never an assignment
193
+ # (`dev := "x"`), which no runner would accept as a task.
194
+ id_just_recipe() { # <justfile> <recipe>
195
+ grep -qE "^@?$2([[:space:]]+[^:]*)?[[:space:]]*:([^=]|$)" "$1" 2>/dev/null
196
+ }
197
+
198
+ # A deno.json/deno.jsonc block, with its comments stripped first. Node and PHP
199
+ # manifests never come through here: package.json is strict JSON, and their
200
+ # answers must stay byte-identical.
201
+ id_deno_has_block() { # <deno.json|deno.jsonc> <block>
202
+ id_strip_jsonc "$1" | id_json_has_block - "$2"
203
+ }
204
+
205
+ # A declared deno.json `tasks` entry — an absent block, a commented-out one, or
206
+ # an absent name declares nothing.
207
+ id_deno_task() { # <deno.json|deno.jsonc> <task>
208
+ [ -n "$(id_strip_jsonc "$1" | id_json_block_script - tasks "$2")" ]
209
+ }
210
+
211
+ id_has_flutter() { # <pubspec.yaml>
212
+ grep -qE '^[[:space:]]*flutter:' "$1" 2>/dev/null
213
+ }
214
+
215
+ # The first candidate the predicate recognizes, as `<runner> <candidate>`.
216
+ id_task() { # <runner> <file> <predicate> <candidate>...
217
+ local runner="$1" file="$2" pred="$3" c
218
+ shift 3
219
+ for c in "$@"; do
220
+ if "$pred" "$ID_ROOT/$file" "$c"; then printf '%s %s' "$runner" "$c"; return 0; fi
221
+ done
222
+ return 1
223
+ }
224
+
225
+ # Walk the manifest table once and fill every key. Order is the table order in
226
+ # references/identify.md: the first stack manifest found wins, and a declared
227
+ # task runner (just, then make) outranks the ecosystem's own commands.
228
+ id_scan() {
229
+ local py deno makefile justfile compose rc envfile
230
+
231
+ for k in $ID_KEYS; do id_unknown "$k"; done
232
+ id_set wired no "-"
233
+
234
+ # --- stack and its ecosystem commands -----------------------------------
235
+ if [ -f "$ID_ROOT/go.mod" ]; then
236
+ id_set stack go go.mod
237
+ id_set runner go go.mod
238
+ id_set install "go mod download" go.mod
239
+ id_set test "go test ./..." go.mod
240
+ elif [ -f "$ID_ROOT/package.json" ]; then
241
+ id_node_pm
242
+ id_set stack node package.json
243
+ id_set runner "$ID_PM" "$ID_PM_SRC"
244
+ id_set install "$ID_PM install" "$ID_PM_SRC"
245
+ rc="$(id_pkg_script "$ID_ROOT/package.json" test || true)"
246
+ if [ -n "$rc" ]; then id_set test "$ID_PM test" package.json; fi
247
+ elif deno="$(id_first_file deno.json deno.jsonc)"; then
248
+ # The manifest has no dependency-install step of its own — imports are
249
+ # resolved by the runtime — so `install` stays unknown rather than invented.
250
+ id_set stack deno "$deno"
251
+ if id_deno_has_block "$ID_ROOT/$deno" tasks; then
252
+ id_set runner "deno task" "$deno"
253
+ if rc="$(id_task 'deno task' "$deno" id_deno_task dev start up serve)"; then id_set up "$rc" "$deno"; fi
254
+ if rc="$(id_task 'deno task' "$deno" id_deno_task down stop)"; then id_set down "$rc" "$deno"; fi
255
+ if id_deno_task "$ID_ROOT/$deno" test; then id_set test "deno task test" "$deno"; fi
256
+ else
257
+ id_set runner deno "$deno"
258
+ fi
259
+ elif py="$(id_first_file pyproject.toml requirements.txt setup.py)"; then
260
+ id_set stack python "$py"
261
+ if [ -f "$ID_ROOT/poetry.lock" ]; then
262
+ id_set runner poetry poetry.lock
263
+ id_set install "poetry install" poetry.lock
264
+ elif [ -f "$ID_ROOT/uv.lock" ]; then
265
+ id_set runner uv uv.lock
266
+ id_set install "uv sync" uv.lock
267
+ else
268
+ id_set runner pip "$py"
269
+ if [ "$py" = "requirements.txt" ]; then
270
+ id_set install "pip install -r requirements.txt" requirements.txt
271
+ else
272
+ id_set install "pip install -e ." "$py"
273
+ fi
274
+ fi
275
+ elif [ -f "$ID_ROOT/pubspec.yaml" ]; then
276
+ id_set stack dart pubspec.yaml
277
+ if id_has_flutter "$ID_ROOT/pubspec.yaml"; then
278
+ id_set runner flutter pubspec.yaml
279
+ id_set install "flutter pub get" pubspec.yaml
280
+ id_set test "flutter test" pubspec.yaml
281
+ else
282
+ id_set runner dart pubspec.yaml
283
+ id_set install "dart pub get" pubspec.yaml
284
+ id_set test "dart test" pubspec.yaml
285
+ fi
286
+ elif [ -f "$ID_ROOT/Cargo.toml" ]; then
287
+ id_set stack rust Cargo.toml
288
+ id_set runner cargo Cargo.toml
289
+ id_set install "cargo fetch" Cargo.toml
290
+ id_set test "cargo test" Cargo.toml
291
+ elif [ -f "$ID_ROOT/composer.json" ]; then
292
+ id_set stack php composer.json
293
+ id_set runner composer composer.json
294
+ id_set install "composer install" composer.json
295
+ rc="$(id_pkg_script "$ID_ROOT/composer.json" test || true)"
296
+ if [ -n "$rc" ]; then id_set test "composer test" composer.json; fi
297
+ elif [ -f "$ID_ROOT/Gemfile" ]; then
298
+ id_set stack ruby Gemfile
299
+ id_set runner bundle Gemfile
300
+ id_set install "bundle install" Gemfile
301
+ fi
302
+
303
+ # --- declared task runners: make, then just (just wins on a clash) ------
304
+ if makefile="$(id_first_file Makefile makefile GNUmakefile)"; then
305
+ id_set runner make "$makefile"
306
+ if rc="$(id_task make "$makefile" id_make_target dev start up serve)"; then id_set up "$rc" "$makefile"; fi
307
+ if rc="$(id_task make "$makefile" id_make_target down stop)"; then id_set down "$rc" "$makefile"; fi
308
+ if id_make_target "$ID_ROOT/$makefile" test; then id_set test "make test" "$makefile"; fi
309
+ fi
310
+ if justfile="$(id_first_file justfile Justfile .justfile)"; then
311
+ id_set runner just "$justfile"
312
+ if rc="$(id_task just "$justfile" id_just_recipe dev start up serve)"; then id_set up "$rc" "$justfile"; fi
313
+ if rc="$(id_task just "$justfile" id_just_recipe down stop)"; then id_set down "$rc" "$justfile"; fi
314
+ if id_just_recipe "$ID_ROOT/$justfile" test; then id_set test "just test" "$justfile"; fi
315
+ fi
316
+
317
+ # --- docker compose: the last word on up/down, and a runner of last resort
318
+ if compose="$(id_first_file compose.yaml compose.yml docker-compose.yml docker-compose.yaml)"; then
319
+ id_set compose "$compose" "$compose"
320
+ if [ "$(id_value up)" = unknown ]; then id_set up "docker compose up" "$compose"; fi
321
+ if [ "$(id_value down)" = unknown ]; then id_set down "docker compose down" "$compose"; fi
322
+ if [ "$(id_value runner)" = unknown ]; then id_set runner docker "$compose"; fi
323
+ fi
324
+
325
+ # --- environment files ---------------------------------------------------
326
+ if envfile="$(id_first_file .env .env.local .env.example .env.sample)"; then
327
+ id_set env "$envfile" "$envfile"
328
+ fi
329
+
330
+ # --- wired for the suite -------------------------------------------------
331
+ if rc="$(id_config)"; then
332
+ id_set wired yes "$rc"
333
+ fi
334
+ }
@@ -42,7 +42,7 @@ argument-hint: "[feature description, requirements, or idea to scope] [out:<plan
42
42
 
43
43
  ## Caller-set output
44
44
 
45
- A caller that owns where the plan goes — `sassy-goal` planning a slice, for one — passes `out:<path>`. Grill exactly as usual, then read `references/plan-format.md`, write the plan to exactly that path, skip the picker entirely, and return the path to the caller. Do not offer `sassy-work` or `sassy-lfg`; the caller hands those over. Anything the caller passes as settled enters the ledger as settled, with its provenance, and is never re-asked.
45
+ A caller that owns where the plan goes — `sassy-goal` planning a slice, for one — passes `out:<path>`. Grill exactly as usual, then read `references/plan-format.md`, write the plan to exactly that path, skip the picker entirely, and return the path to the caller. The caller owns the name and the frontmatter's `type`, `goal`, and `slice` keys; the path it passes wins over every naming rule in the format. Do not offer `sassy-work` or `sassy-lfg`; the caller hands those over. Anything the caller passes as settled enters the ledger as settled, with its provenance, and is never re-asked.
46
46
 
47
47
  ## The picker
48
48
 
@@ -50,7 +50,7 @@ Only when the read-back is confirmed with zero open items — and no `out:` was
50
50
 
51
51
  ```text
52
52
  Settled. Pick one:
53
- 1. Write the plan — <artifacts.plans>/<slug>.md
53
+ 1. Write the plan — <artifacts.plans>/<type>-<slug>.md
54
54
  2. Start working via sassy-work
55
55
  3. Implement and ship it via sassy-lfg
56
56
  ```
@@ -59,7 +59,7 @@ The user must pick explicitly. There is no default and no auto-selection. If no
59
59
 
60
60
  ### Option 1 — Write the plan
61
61
 
62
- Read `references/plan-format.md` and write the plan, including the per-phase QA tables that format defines, with each row's `Mode` decided the way that format says. Then report the absolute path and offer the remaining two options, now run on the plan file:
62
+ Read `references/plan-format.md` and write the plan — its frontmatter and the per-phase QA tables that format defines — with each row's `Mode` decided the way that format says. Then report the absolute path and offer the remaining two options, now run on the plan file:
63
63
 
64
64
  ```text
65
65
  Plan written to <absolute path>. Pick one, or stop here:
@@ -83,7 +83,7 @@ The plan document carries QA tables per `references/plan-format.md`. Those rows
83
83
 
84
84
  A row is `Auto` only when the project's `dogfood.enabled` is `true` **and** the row names a recipe section with a `Prove it:` step; otherwise it is `Manual`. That reference owns the list of checks that stay human — subjective, physical, irreversible, unobservable, unprovable — and on doubt the row is `Manual`. Never invent a section, a command, or a check to make a row look automatable: a false `Auto` pass is unrecoverable.
85
85
 
86
- The in-context brief has no QA table, so its gate is code approval alone. Omit QA tables only when the user explicitly asks to skip QA in plain language.
86
+ The in-context brief has no QA table, so its gate is code approval alone. Omit QA tables only when the user explicitly asks to skip QA in plain language, and set `qa: off` in the plan's frontmatter when you write one.
87
87
 
88
88
  ## Review tier
89
89
 
@@ -91,6 +91,6 @@ Every phase also carries a `**Review:**` line — `logic`, `surface`, or `none`
91
91
 
92
92
  ## Resume
93
93
 
94
- If the user points at an existing sassy plan, update phases and tables in place. If they point at a raw plan from elsewhere, reshape it into this format without discarding its settled decisions — but grill whatever it leaves open or merely asserts. An existing plan is already the document.
94
+ If the user points at an existing sassy plan, update phases, tables, and `updated` in place (`created` never changes). If they point at a raw plan from elsewhere, reshape it into this format without discarding its settled decisions — but grill whatever it leaves open or merely asserts. An existing plan is already the document.
95
95
 
96
96
  Decisions already settled earlier in the conversation, or passed in by a caller as settled, carry forward per `references/interview.md`; never re-ask them.
@@ -2,6 +2,30 @@
2
2
 
3
3
  Read this before writing the plan file.
4
4
 
5
+ ## The file name
6
+
7
+ The filename is the plan's identity: `<artifacts.plans>/<type>-<slug>.md` for a standalone plan, whose `<type>-` prefix matches the frontmatter `type`; a goal slice is `<NN>-<slice-slug>.md`, and its slug carries no type.
8
+
9
+ - **`type`** is one of `feat fix chore refactor docs test perf ci build` — the Conventional Commit type the work will ship as — and a standalone plan's filename prefix must equal the frontmatter `type`.
10
+ - **`slug`** is lowercase ASCII kebab, 2–3 words (ceiling 5), naming the thing that changes, never the activity: `worktree-cut`, not `cutting-the-worktree-half`.
11
+ - **No date, no `-plan` suffix, no phase numbers.** The date is frontmatter, because a filename must survive a revision, and a rename breaks every reference to it (`sassy-work <plan>`, hook briefs, `goal.md`'s Plan links).
12
+ - **Never overwrite another plan.** Two concurrent plans on the same object take a qualifier (`-phase-two`), never a timestamp.
13
+ - **A caller passing `out:<path>` owns the name.** Slice plans stay `NN-<slice-slug>.md`, and the caller's path wins over every rule here.
14
+
15
+ ## The frontmatter
16
+
17
+ Keys, in this order: `type`, `created`, and `updated` are required; `qa` is optional.
18
+
19
+ - **`type`** — matches the filename prefix and names the commit type the work will ship as. For a standalone plan the prefix must equal it; for a slice plan it equals the parent `goal.md`'s `type`, which the caller passes.
20
+ - **`created`** — `YYYY-MM-DD`, the day the plan was first written; never changes.
21
+ - **`updated`** — `YYYY-MM-DD`; a revision sets it to today in the same edit, and every executor that writes a phase status or a QA row result bumps it too.
22
+
23
+ **`qa`** is a gate switch, not a record of mode. Write `qa: off` only when the user asked for a plan with no QA gates at all, which also means no QA tables anywhere in the file; omit the key otherwise, and the QA gate is on. Never write `on`, `auto`, or `manual`. A check's mode lives only in the row `Mode` column, where rows freely mix `Auto` and `Manual`.
24
+
25
+ Slice plans add `goal` (relative path to the parent `goal.md`) and `slice` (the slice ID, e.g. `S1`).
26
+
27
+ The H1 title stays: frontmatter does not render on GitHub, so the heading is what a reader sees.
28
+
5
29
  ## No open questions
6
30
 
7
31
  The plan has no open-questions section. Every branch the interview found is a decision, a deferred item, or an assumption — copy the ledger as it stood at the confirmed read-back. If you find an open branch while writing, stop and ask it before the file lands.
@@ -48,16 +72,18 @@ On doubt, `Manual`. A false `Auto` pass is unrecoverable; a `Manual` row is mere
48
72
 
49
73
  QA is a completion gate, not a separate track: a phase turns `Done` only when the code is approved and every QA row for that phase passes. `Manual` rows belong to the user, and the agent records what it hears. `Auto` rows are settled by a `sassy-dogfood` run and its report, never by an opinion.
50
74
 
51
- The user may ask in plain language to omit QA tables for this plan, in which case omit the tables and the `**QA:**` line entirely.
75
+ The user may ask in plain language for a plan with no QA gates, in which case omit every `#### QA — P<NN>` subsection and set `qa: off` in the frontmatter. An executor runs a QA gate unless that key says `off`.
52
76
 
53
77
  ## Plan file format
54
78
 
55
79
  ```markdown
56
- # <Plan title>
80
+ ---
81
+ type: feat
82
+ created: YYYY-MM-DD
83
+ updated: YYYY-MM-DD
84
+ ---
57
85
 
58
- **QA:** auto
59
-
60
- (`auto` when at least one row in the plan is `Auto`, `manual` when none is. It is the source of truth for executors, so it never disagrees with the tables.)
86
+ # <Plan title>
61
87
 
62
88
  ## Intent
63
89
  One short paragraph: what we are building and why.
@@ -124,4 +150,6 @@ Omit empty layers. Do not put the next goal's work here. The `**Review:**` line
124
150
  …
125
151
  ```
126
152
 
127
- Every phase has at least one QA row. Status values there are `Pending` | `Done` | `Blocked`: a `Manual` row is `Done` once the user ran that check and confirmed it passed, an `Auto` row is `Done` once a dogfood run passed and its run id is in `Notes`, `Blocked` carries a note saying what failed, and anything unreported stays `Pending`. The `**QA:**` line near the title is the source of truth for executors.
153
+ `qa: off` is added to the frontmatter only for a gate-free plan.
154
+
155
+ Every phase has at least one QA row. Status values there are `Pending` | `Done` | `Blocked`: a `Manual` row is `Done` once the user ran that check and confirmed it passed, an `Auto` row is `Done` once a dogfood run passed and its run id is in `Notes`, `Blocked` carries a note saying what failed, and anything unreported stays `Pending`. The frontmatter's `qa: off` is the only thing that removes the gate for executors; its absence leaves the gate on.