@sassywares/skills 0.17.2 → 0.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -6
- package/package.json +1 -1
- package/skills/sassy-babysit/SKILL.md +2 -2
- package/skills/sassy-dogfood/SKILL.md +11 -8
- package/skills/sassy-dogfood/references/check.md +5 -3
- package/skills/sassy-dogfood/references/discover.md +23 -12
- package/skills/sassy-dogfood/references/run.md +91 -17
- package/skills/sassy-setup/SKILL.md +5 -5
- package/skills/sassy-setup/assets/dogfood-recipe.md +19 -5
- package/skills/sassy-setup/references/anchors.md +1 -1
- package/skills/sassy-setup/references/branching.md +1 -1
- package/skills/sassy-setup/references/check.md +1 -1
- package/skills/sassy-setup/references/config.md +66 -14
- package/skills/sassy-setup/references/dogfood.md +181 -40
- package/skills/sassy-setup/references/harness.md +1 -1
- package/skills/sassy-setup/references/init.md +6 -4
- package/skills/sassy-setup/references/plan-resolution.md +1 -1
- package/skills/sassy-setup/references/scaffold-header.md +9 -2
- package/skills/sassy-setup/references/workspace.md +63 -1
- package/skills/sassy-setup/references/worktree.md +1 -1
- package/skills/sassy-setup/scripts/detect.sh +1 -1
- package/skills/sassy-setup/scripts/hash-skill.mjs +1 -1
- package/skills/sassy-setup/scripts/lib/agents-md.sh +13 -2
- package/skills/sassy-setup/scripts/lib/branch.sh +1 -1
- package/skills/sassy-setup/scripts/lib/check.sh +291 -24
- package/skills/sassy-setup/scripts/lib/common.sh +1 -1
- package/skills/sassy-setup/scripts/lib/proposal.sh +29 -2
- package/skills/sassy-setup/scripts/lib/sync.sh +1 -1
- package/skills/sassy-setup/scripts/lib/worktree.sh +1 -1
- package/skills/sassy-setup/scripts/lib/yaml.sh +77 -3
- package/skills/sassy-setup/scripts/lockcheck.mjs +1 -1
- package/skills/sassy-setup/scripts/worktree-check.mjs +1 -1
- package/skills/sassy-ship/SKILL.md +4 -4
- package/skills/sassy-ship/references/brief.md +1 -1
- package/skills/sassy-ship/references/plan.md +1 -1
- package/skills/sassy-ship/references/slice.md +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
suite: sassy-skills
|
|
3
3
|
artifact: reference
|
|
4
|
-
generated_by: sassy-setup@0.17.
|
|
4
|
+
generated_by: sassy-setup@0.17.3
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Workspace install
|
|
@@ -67,6 +67,68 @@ and asked about. Where it goes is the one place a workspace differs:
|
|
|
67
67
|
own file: setup leaves it uncommitted, says so in the report, and never sweeps it
|
|
68
68
|
into a sync.
|
|
69
69
|
|
|
70
|
+
## Dogfood: one recipe per repo
|
|
71
|
+
|
|
72
|
+
The dogfood block is a workspace's, like every other key: it lives in the one
|
|
73
|
+
`.sassywares/config.yaml` at the root. What changes is the recipe, because a
|
|
74
|
+
procedure is written against a product and a workspace holds several.
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
dogfood:
|
|
78
|
+
enabled: true
|
|
79
|
+
recipes:
|
|
80
|
+
web: docs/dogfood/web.md # the browser flow
|
|
81
|
+
api: docs/dogfood/api.md # the request flow
|
|
82
|
+
infra: false # deliberately not dogfooded
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- **One file per repo, at the root's `docs/dogfood/<repo>.md`.** Not inside the
|
|
86
|
+
repo: the root is where the config, the plans, and the glossary already are,
|
|
87
|
+
and a recipe per repo inside each repo is a second document set with its own
|
|
88
|
+
review story. The name is the repo folder, so `<repo>` is the key in `repos:`
|
|
89
|
+
and the map needs no second inventory.
|
|
90
|
+
- **Keyed by `repos:`.** `web` above is the folder, so a key naming no repo is a
|
|
91
|
+
hard error: it points at a procedure nothing can run. A repo with no entry is
|
|
92
|
+
one `--check` note naming it and the check still exits 0 — most repos in a
|
|
93
|
+
workspace are never dogfooded, and demanding a file per repo would make every
|
|
94
|
+
repo a chore.
|
|
95
|
+
- **`false` records the decision.** A repo that is deliberately off says so,
|
|
96
|
+
which is why it is not the same as an omission: deleting the entry erases the
|
|
97
|
+
only record that the question was asked. `false` prints
|
|
98
|
+
`dogfood.recipes.<repo>: false (deliberately not dogfooded)` and is never drift.
|
|
99
|
+
- **Never a `recipe:` alongside it.** One combined recipe is the shape this
|
|
100
|
+
replaces, and an agent dogfooding one repo must not read every other repo's
|
|
101
|
+
prerequisites. `--check` reports a workspace `recipe:` as drift while
|
|
102
|
+
`dogfood.enabled: true` — a note, exit 0, while it is `false` — naming each
|
|
103
|
+
repo's `docs/dogfood/<repo>.md`, the `recipes:` map to write, and the `recipe:`
|
|
104
|
+
line to replace. It prints no command: the suite never moves, copies, or
|
|
105
|
+
deletes the project's file, and the combined file stays until the reader says
|
|
106
|
+
every section is distributed.
|
|
107
|
+
- **A pre-P1 file gets the split too.** A workspace still holding
|
|
108
|
+
`.sassywares/dogfood/recipe.md` with no `recipe:` key is stopped the same way —
|
|
109
|
+
drift while `enabled` is `true`, a note while it is `false` — naming that file,
|
|
110
|
+
each repo's `docs/dogfood/<repo>.md`, and the `recipes:` map. The single-file
|
|
111
|
+
move a repo topology is told is wrong here: it would restore one combined
|
|
112
|
+
recipe. Once the `recipes:` map is written the leftover file is a **note, not a
|
|
113
|
+
stop**, whatever `enabled` says: the split is under way, so keep it until every
|
|
114
|
+
section is distributed and delete it yourself. The reader decides which
|
|
115
|
+
sections belong to which repo, and no command copies or deletes the old file.
|
|
116
|
+
- **Never a per-repo config.** A nested repo does not get its own
|
|
117
|
+
`.sassywares/config.yaml`; the root's map is the only place the dogfood keys
|
|
118
|
+
live, and the run passes the repo it is proving.
|
|
119
|
+
|
|
120
|
+
**What a run writes.** One directory per repo it ran, at
|
|
121
|
+
`reports/<repo>/<run-id>/` under `dogfood.reports` — never a workspace-level
|
|
122
|
+
report and never a merged summary, so which repo a run belonged to is readable
|
|
123
|
+
from the path. `dogfood.keep` caps each `reports/<repo>/` bucket by itself;
|
|
124
|
+
`--check` reports an over-quota bucket per repo and never a repo that is not
|
|
125
|
+
dogfooded. What a run covers, and the rollup it prints, are `sassy-dogfood`'s
|
|
126
|
+
`references/run.md` §1 and §7.
|
|
127
|
+
|
|
128
|
+
`--sync --write` keeps the map as written: every entry the check accepts is
|
|
129
|
+
carried through byte for byte, including `false`, so a valid map is never
|
|
130
|
+
replaced by the commented example the template carries.
|
|
131
|
+
|
|
70
132
|
## Script aliases (optional)
|
|
71
133
|
|
|
72
134
|
The scripts are executable and tracked, so the whole contract is the path itself:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# generated_by: sassy-setup@0.17.
|
|
1
|
+
# generated_by: sassy-setup@0.17.3
|
|
2
2
|
# lib/agents-md.sh — the AGENTS.md routing block and the template merge.
|
|
3
3
|
# Sourced by detect.sh. Never sets shell options; reads the paths it set. The
|
|
4
4
|
# merge starts from emit_proposal (lib/proposal.sh) from inside a function body,
|
|
@@ -243,12 +243,23 @@ leaf_ok() { # PATH VALUE — PATH joined with US, value comment- and quote-strip
|
|
|
243
243
|
[[ "$TOPOLOGY" != "repo" ]] ;;
|
|
244
244
|
commit.branch)
|
|
245
245
|
[[ "$v" == "current" || "$v" == "new" ]] ;;
|
|
246
|
-
dogfood.timeout)
|
|
246
|
+
dogfood.timeout|dogfood.keep)
|
|
247
247
|
[[ "$v" =~ ^[1-9][0-9]*$ ]] ;;
|
|
248
248
|
dogfood.recipe|dogfood.reports)
|
|
249
249
|
case "$v" in ""|/*|~*|.|./) return 1 ;; esac
|
|
250
250
|
escapes_root "$v" && return 1
|
|
251
251
|
return 0 ;;
|
|
252
|
+
dogfood.recipes.*)
|
|
253
|
+
# Workspace only, like repos: a repo config keeps the single `recipe:`.
|
|
254
|
+
# A value is a path inside the project or `false`; the repo-key membership
|
|
255
|
+
# rule is context, not value, so the sync keeps a key only --check judges.
|
|
256
|
+
[[ "$TOPOLOGY" != "repo" ]] || return 1
|
|
257
|
+
case "$v" in
|
|
258
|
+
false) return 0 ;;
|
|
259
|
+
""|true|yes|no|on|off|/*|~*|.|./) return 1 ;;
|
|
260
|
+
esac
|
|
261
|
+
escapes_root "$v" && return 1
|
|
262
|
+
return 0 ;;
|
|
252
263
|
worktrees.dir)
|
|
253
264
|
[[ -n "$v" ]] ;;
|
|
254
265
|
worktrees.create|worktrees.remove)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# generated_by: sassy-setup@0.17.
|
|
1
|
+
# generated_by: sassy-setup@0.17.3
|
|
2
2
|
# lib/branch.sh — the --branch mode: resolve commit.branch into the one
|
|
3
3
|
# decision the entry skills make before they start.
|
|
4
4
|
# Sourced by detect.sh. Never sets shell options; reads the paths it set.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# generated_by: sassy-setup@0.17.
|
|
1
|
+
# generated_by: sassy-setup@0.17.3
|
|
2
2
|
# lib/check.sh — the --check mode: validate the config against the tree.
|
|
3
3
|
# Sourced by detect.sh. Never sets shell options; reads the paths it set.
|
|
4
4
|
|
|
@@ -7,6 +7,39 @@ mode_check() {
|
|
|
7
7
|
note() { printf '%s\n' "$*"; }
|
|
8
8
|
bad() { printf ' drift: %s\n' "$*"; drift=1; }
|
|
9
9
|
|
|
10
|
+
# A run directory is named YYYYMMDD-HHMMSS: fixed-width, so a lexical sort is
|
|
11
|
+
# chronological. Older runs may carry a legacy `-<label>` suffix; its first 15
|
|
12
|
+
# characters are still the clock id, so the same sort holds and it counts as one
|
|
13
|
+
# run. A new run never writes a label. The reports root holds runs directly
|
|
14
|
+
# (reports/<run-id>); once a workspace run files per repo (reports/<repo>/<run-id>)
|
|
15
|
+
# the level below the root is a bucket, told apart from a run by its name alone.
|
|
16
|
+
# Counting per bucket is the rule either way, so the nesting is a new writer, not
|
|
17
|
+
# a new count.
|
|
18
|
+
is_run_id() {
|
|
19
|
+
local n="$1"
|
|
20
|
+
[[ "$n" =~ ^[0-9]{8}-[0-9]{6}(-[A-Za-z0-9][A-Za-z0-9._-]*)?$ ]]
|
|
21
|
+
}
|
|
22
|
+
dogfood_run_counts() { # <reports-root> -> "<bucket>\t<count>", one per bucket
|
|
23
|
+
local root="$1" d c n cn
|
|
24
|
+
[[ -d "$root" ]] || return 0
|
|
25
|
+
# A `*/` glob only matches directories, and an unmatched one stays literal
|
|
26
|
+
# and fails is_run_id, so neither loop needs a guard of its own.
|
|
27
|
+
for d in "$root"/*/; do
|
|
28
|
+
n="$(basename "$d")"
|
|
29
|
+
if is_run_id "$n"; then
|
|
30
|
+
# `.` is the flat root bucket: a leading empty field would be swallowed
|
|
31
|
+
# by `read`'s IFS whitespace handling, and a sentinel keeps the two
|
|
32
|
+
# layouts on one code path.
|
|
33
|
+
printf '.\t%s\n' "$n"
|
|
34
|
+
else
|
|
35
|
+
for c in "$d"*/; do
|
|
36
|
+
cn="$(basename "$c")"
|
|
37
|
+
is_run_id "$cn" && printf '%s\t%s\n' "$n" "$cn"
|
|
38
|
+
done
|
|
39
|
+
fi
|
|
40
|
+
done | awk -F'\t' '{seen[$1]++} END {for (b in seen) printf "%s\t%d\n", b, seen[b]}' | sort
|
|
41
|
+
}
|
|
42
|
+
|
|
10
43
|
# A node checker prints `<drift|note>\t<message>` lines and exits 0; the caller
|
|
11
44
|
# owns the verdict, so its exit status is a finding too. Silencing a crash into
|
|
12
45
|
# zero output would read as "nothing to report", which is the one thing a
|
|
@@ -76,7 +109,8 @@ mode_check() {
|
|
|
76
109
|
repos.*) ;;
|
|
77
110
|
commit.branch) ;;
|
|
78
111
|
pr.babysit|pr.merge|pr.delete_branch) ;;
|
|
79
|
-
dogfood.enabled|dogfood.recipe|dogfood.reports|dogfood.timeout) ;;
|
|
112
|
+
dogfood.enabled|dogfood.recipe|dogfood.reports|dogfood.timeout|dogfood.keep) ;;
|
|
113
|
+
dogfood.recipes|dogfood.recipes.*) ;; # the map's shape is checked below
|
|
80
114
|
worktrees.enabled|worktrees.dir) ;;
|
|
81
115
|
worktrees.create|worktrees.remove)
|
|
82
116
|
# A single path, no arguments: the script is the lifecycle, so a command
|
|
@@ -155,9 +189,7 @@ mode_check() {
|
|
|
155
189
|
while IFS= read -r rname; do
|
|
156
190
|
[[ -n "$rname" ]] || continue
|
|
157
191
|
bad "repos.$rname is workspace-only — git.repo is '${configured_repo:-unset}'"
|
|
158
|
-
done < <(
|
|
159
|
-
| awk -F'\t' -v us="$US" '{n=split($1,a,us); if (n>=2 && a[1]=="repos") print a[2]}' \
|
|
160
|
-
| sort -u)
|
|
192
|
+
done < <(repo_names | sort -u)
|
|
161
193
|
fi
|
|
162
194
|
|
|
163
195
|
if [[ "$TOPOLOGY" == "workspace" ]]; then
|
|
@@ -513,16 +545,135 @@ mode_check() {
|
|
|
513
545
|
# procedure and its `Prove it:` step is the verdict. Everything below is
|
|
514
546
|
# structural. A check run never runs the product — a validator that boots an
|
|
515
547
|
# app is a validator nobody runs.
|
|
548
|
+
# The recipe is the project's own document, so it lives in docs/ with the other
|
|
549
|
+
# documents the project edits; .sassywares/ is suite-owned state and never holds
|
|
550
|
+
# project-editable content.
|
|
551
|
+
dg_recipe_default="docs/dogfood.md"
|
|
552
|
+
dg_recipe_legacy=".sassywares/dogfood/recipe.md"
|
|
516
553
|
dg_enabled="$(block_value dogfood enabled || true)"
|
|
517
554
|
dg_recipe="$(block_value dogfood recipe || true)"
|
|
518
|
-
# The
|
|
519
|
-
|
|
520
|
-
#
|
|
521
|
-
|
|
522
|
-
|
|
555
|
+
# The repos a workspace inventories — the key set `dogfood.recipes` is keyed by.
|
|
556
|
+
dg_repo_set=" $(repo_names | tr '\n' ' ')"
|
|
557
|
+
# Whether the workspace has already declared the per-repo map. Read here, before
|
|
558
|
+
# any path check, because a leftover legacy file is judged by it: once the map is
|
|
559
|
+
# written the split is user-directed and under way, which is D18's own
|
|
560
|
+
# intermediate state, not a migration that has not started.
|
|
561
|
+
dg_map_declared=0
|
|
562
|
+
if yaml_flat "$CONFIG" 2>/dev/null | grep -q "^dogfood${US}recipes${US}"; then
|
|
563
|
+
dg_map_declared=1
|
|
564
|
+
fi
|
|
565
|
+
|
|
566
|
+
# The shape tail both path checks share: relative to the config, never the
|
|
567
|
+
# root itself, never outside the project. One line on stdout, or nothing.
|
|
568
|
+
dg_path_tail() { # <label> <value>
|
|
569
|
+
local label="$1" v="$2"
|
|
570
|
+
case "$v" in
|
|
571
|
+
/*|~*) printf "%s '%s' is not relative to the config\n" "$label" "$v"; return 0 ;;
|
|
572
|
+
.|./) printf '%s is the project root itself\n' "$label"; return 0 ;;
|
|
573
|
+
esac
|
|
574
|
+
escapes_root "$v" && printf "%s '%s' walks outside the project\n" "$label" "$v"
|
|
575
|
+
return 0
|
|
576
|
+
}
|
|
577
|
+
# A recipe file that exists: its structural lint, its secret-shaped scan, and
|
|
578
|
+
# the path note. The map's values and the single recipe differ only by label.
|
|
579
|
+
dg_recipe_file() { # <path> <label>
|
|
580
|
+
local path="$1" label="$2" msg line0
|
|
581
|
+
while IFS= read -r msg; do
|
|
582
|
+
[[ -n "$msg" ]] || continue
|
|
583
|
+
bad "$label $msg"
|
|
584
|
+
done < <(recipe_lint "$ROOT/$path")
|
|
585
|
+
while IFS= read -r line0; do
|
|
586
|
+
[[ -n "$line0" ]] || continue
|
|
587
|
+
bad "$label has a secret-shaped string at line $line0 — env var names only, never a value"
|
|
588
|
+
done < <(grep -nE 'sk-[A-Za-z0-9_-]{16,}|ghp_[A-Za-z0-9]{20,}|AKIA[0-9A-Z]{16}|xox[baprs]-[A-Za-z0-9-]{10,}' "$ROOT/$path" 2>/dev/null | cut -d: -f1)
|
|
589
|
+
note " $label: $path"
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
# The map a workspace must write, built once from repos: so both the combined
|
|
593
|
+
# `recipe:` stop and the pre-P1 legacy-file stop name the same files.
|
|
594
|
+
dg_split_map=""
|
|
595
|
+
dg_split_repos=""
|
|
596
|
+
if [[ "$configured_repo" == "workspace" ]]; then
|
|
597
|
+
for r in $dg_repo_set; do
|
|
598
|
+
dg_split_map="$dg_split_map${dg_split_map:+, }$r: docs/dogfood/$r.md"
|
|
599
|
+
dg_split_repos="$dg_split_repos${dg_split_repos:+, }$r"
|
|
600
|
+
done
|
|
601
|
+
if [[ -z "$dg_split_map" ]]; then
|
|
602
|
+
dg_split_map="<repo>: docs/dogfood/<repo>.md"
|
|
603
|
+
dg_split_repos="<repo>"
|
|
604
|
+
fi
|
|
605
|
+
fi
|
|
606
|
+
dg_split=0
|
|
607
|
+
if [[ "$configured_repo" == "workspace" && -n "$dg_recipe" ]]; then
|
|
608
|
+
# D14/D18: a workspace declares one recipe per repo, keyed by `repos:`, so an
|
|
609
|
+
# agent dogfooding one repo never has to read every other repo's procedure.
|
|
610
|
+
# One combined recipe is the shape the rule replaces, and it is a stop rather
|
|
611
|
+
# than a working fallback — that fallback is how a combined recipe sat in a
|
|
612
|
+
# workspace for a week. The project owns the file, so the finding names the
|
|
613
|
+
# split and the map to write, in prose: a printed `cp` can target its own
|
|
614
|
+
# source (`recipe: docs/dogfood/fe.md`) or overwrite a file the user already
|
|
615
|
+
# finished, and an `rm` would delete a project-owned document. The suite
|
|
616
|
+
# never moves or deletes it.
|
|
617
|
+
dg_split="dogfood.recipe is '$dg_recipe', one combined procedure — a workspace declares one recipe per repo, at docs/dogfood/<repo>.md, as a 'recipes:' map under dogfood: keyed by repos:. Dogfooding is stopped until it is split: create one file per repo ($dg_split_repos) under docs/dogfood/ and carry over only that repo's sections; '$dg_recipe' stays where it is until you decide every section is distributed, and no command here copies or deletes it. Then replace 'recipe: $dg_recipe' with 'recipes:' in .sassywares/config.yaml — $dg_split_map"
|
|
618
|
+
if [[ "$dg_enabled" == "true" ]]; then
|
|
619
|
+
bad "$dg_split"
|
|
620
|
+
else
|
|
621
|
+
note " $dg_split"
|
|
622
|
+
fi
|
|
623
|
+
# The single-recipe path below is a repo-topology form: nothing else here
|
|
624
|
+
# lints the combined file or claims the per-repo map is missing — the split
|
|
625
|
+
# already says what to write, and nine "no entry for" notes under it would
|
|
626
|
+
# bury the one finding that matters.
|
|
627
|
+
dg_recipe=""
|
|
628
|
+
dg_split=1
|
|
629
|
+
elif [[ "$dg_recipe" == "$dg_recipe_legacy" ]] || { [[ -z "$dg_recipe" ]] && [[ -f "$ROOT/$dg_recipe_legacy" ]]; }; then
|
|
630
|
+
# A recipe still at the old path is a migration, and the project owns the file:
|
|
631
|
+
# the suite never moves it. In a repo topology the finding is the exact move; in
|
|
632
|
+
# a workspace that move would put the combined procedure at the single-repo path,
|
|
633
|
+
# which is the shape P4 replaces — so the workspace form names the per-repo split
|
|
634
|
+
# and prints no command at all, because nothing here copies or deletes a
|
|
635
|
+
# project-owned document. With dogfood on it is a hard stop — a run would keep
|
|
636
|
+
# reading a file the rule no longer calls the recipe, and a planner would write
|
|
637
|
+
# Auto rows against it — while a disabled block is only told, because nothing
|
|
638
|
+
# reads the file and refusing a project that never dogfoods would fail its own
|
|
639
|
+
# close-out selfcheck.
|
|
640
|
+
if [[ "$configured_repo" == "workspace" ]]; then
|
|
641
|
+
dg_legacy_split="the recipe is a project document now, and a workspace keeps one recipe per repo at docs/dogfood/<repo>.md, declared as a 'recipes:' map under dogfood: keyed by repos:. Dogfooding is stopped until it is split: create one file per repo ($dg_split_repos) under docs/dogfood/ and carry over only that repo's sections — you decide which sections belong to which repo; '$dg_recipe_legacy' stays where it is until you decide every section is distributed, and no command here copies or deletes it. Then write 'recipes:' in .sassywares/config.yaml — $dg_split_map"
|
|
642
|
+
# Two states, never one: with no map yet this is the migration stop, but with
|
|
643
|
+
# `recipes:` already written the split is under way and a leftover file is the
|
|
644
|
+
# same note the default path gets — a stop here could only be cleared by
|
|
645
|
+
# deleting a project-owned file the message tells the reader to keep, so a
|
|
646
|
+
# close-out would be impossible mid-migration.
|
|
647
|
+
if (( dg_map_declared )); then
|
|
648
|
+
note " dogfood.recipe is still '$dg_recipe_legacy' beside the 'recipes:' map — the split may not be finished. Keep it until every section is distributed, then delete it yourself: it is no longer the recipe, and nothing here reads or deletes it."
|
|
649
|
+
elif [[ "$dg_enabled" == "true" ]]; then
|
|
650
|
+
bad "dogfood.recipe is still '$dg_recipe_legacy' — $dg_legacy_split"
|
|
651
|
+
else
|
|
652
|
+
note " dogfood.recipe is at the old path '$dg_recipe_legacy' — $dg_legacy_split. dogfood.enabled is false, so nothing reads it; it is split before dogfood is turned on."
|
|
653
|
+
fi
|
|
654
|
+
# Like the combined-recipe stop above: the split already says what to write,
|
|
655
|
+
# so the per-repo missing-entry notes stay out of its way.
|
|
656
|
+
dg_split=1
|
|
657
|
+
else
|
|
658
|
+
dg_move="mkdir -p docs && git mv $dg_recipe_legacy $dg_recipe_default"
|
|
659
|
+
if [[ "$dg_enabled" == "true" ]]; then
|
|
660
|
+
bad "dogfood.recipe is still '$dg_recipe_legacy' — the recipe is a project document now, at '$dg_recipe_default'. Dogfooding is stopped until it moves: $dg_move, then set 'recipe: $dg_recipe_default' under dogfood: in .sassywares/config.yaml"
|
|
661
|
+
else
|
|
662
|
+
note " dogfood.recipe is at the old path '$dg_recipe_legacy' — the recipe lives at '$dg_recipe_default' now. dogfood.enabled is false, so nothing reads it; it moves before dogfood is turned on: $dg_move, then set 'recipe: $dg_recipe_default' under dogfood: in .sassywares/config.yaml"
|
|
663
|
+
fi
|
|
664
|
+
fi
|
|
665
|
+
# The old file is not the recipe any more, so nothing below lints it or claims
|
|
666
|
+
# the configured path is a missing recipe: there is exactly one thing to do.
|
|
667
|
+
dg_recipe=""
|
|
668
|
+
elif [[ "$configured_repo" != "workspace" && -z "$dg_recipe" ]] && { [[ "$dg_enabled" == "true" ]] || [[ -f "$ROOT/$dg_recipe_default" ]]; }; then
|
|
669
|
+
# The default path applies even when the key is absent: the scripts use it, so
|
|
670
|
+
# --check must lint what they will actually read. Only for a project that has
|
|
671
|
+
# dogfood on, or a recipe already sitting at the default, to avoid noise.
|
|
672
|
+
dg_recipe="$dg_recipe_default"
|
|
523
673
|
fi
|
|
524
674
|
dg_reports="$(block_value dogfood reports || true)"
|
|
525
675
|
dg_timeout="$(block_value dogfood timeout || true)"
|
|
676
|
+
dg_keep_raw="$(block_value dogfood keep || true)"
|
|
526
677
|
case "$dg_enabled" in
|
|
527
678
|
"") ;;
|
|
528
679
|
true|false) note " dogfood.enabled: $dg_enabled" ;;
|
|
@@ -534,12 +685,99 @@ mode_check() {
|
|
|
534
685
|
*) dpath="$dg_reports" ;;
|
|
535
686
|
esac
|
|
536
687
|
[[ -n "$dpath" ]] || continue
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
.|./) bad "dogfood.$dkey is the project root itself" ;;
|
|
540
|
-
*) escapes_root "$dpath" && bad "dogfood.$dkey '$dpath' walks outside the project" ;;
|
|
541
|
-
esac
|
|
688
|
+
dg_tail="$(dg_path_tail "dogfood.$dkey" "$dpath")"
|
|
689
|
+
[[ -n "$dg_tail" ]] && bad "$dg_tail"
|
|
542
690
|
done
|
|
691
|
+
# One recipe per repo, in one map at the root: never a per-repo config, and
|
|
692
|
+
# never a second place the dogfood keys live. A value is a path inside the
|
|
693
|
+
# project (the same shape recipe and reports are held to) or `false`, which
|
|
694
|
+
# records a repo that is deliberately not dogfooded — turning a repo off by
|
|
695
|
+
# deleting its entry would erase the only record of what dogfooding it means.
|
|
696
|
+
# A key outside `repos:` is a hard error (it names no repo), while a repo
|
|
697
|
+
# absent from the map is only named: most repos in a workspace are never
|
|
698
|
+
# dogfooded, and that is a decision, not drift.
|
|
699
|
+
dg_recipes_root="$(yflat "dogfood${US}recipes" 2>/dev/null || true)"
|
|
700
|
+
dg_recipes_declared=0
|
|
701
|
+
dg_mapped=" "
|
|
702
|
+
# The repos a green run can prune: those whose entry is a procedure.
|
|
703
|
+
dg_live=" "
|
|
704
|
+
if [[ "$configured_repo" != "workspace" ]]; then
|
|
705
|
+
# The map is workspace-only. In a repo config it is a dead block, and a
|
|
706
|
+
# reader would trust it over the single `recipe:` that actually applies.
|
|
707
|
+
if [[ -n "$dg_recipes_root" ]] || yaml_flat "$CONFIG" | grep -q "^dogfood${US}recipes${US}"; then
|
|
708
|
+
bad "dogfood.recipes is workspace-only — git.repo is '${configured_repo:-unset}', so a repo declares one 'recipe:'"
|
|
709
|
+
fi
|
|
710
|
+
elif [[ -n "$dg_recipes_root" ]]; then
|
|
711
|
+
bad "dogfood.recipes '$dg_recipes_root' is one value — write a map keyed by repo: recipes: with '<repo>: docs/dogfood/<repo>.md' per repo, or '<repo>: false' for a repo that is deliberately not dogfooded"
|
|
712
|
+
else
|
|
713
|
+
while IFS=$'\t' read -r rpath rval; do
|
|
714
|
+
[[ -n "$rpath" ]] || continue
|
|
715
|
+
dg_recipes_declared=1
|
|
716
|
+
rkey="${rpath#dogfood${US}recipes${US}}"
|
|
717
|
+
# Mapped is recorded before the value is judged: a block or a malformed
|
|
718
|
+
# value still names the repo, so the one mistake is one finding and the
|
|
719
|
+
# missing-entry note does not tell the reader to add what they just wrote.
|
|
720
|
+
dg_mapped="$dg_mapped${rkey%%$US*} "
|
|
721
|
+
# Recorded before the value is fully judged, like `mapped`: a malformed path
|
|
722
|
+
# is drift on its own line, and silence here would hide an over-quota bucket
|
|
723
|
+
# behind a finding about the same entry.
|
|
724
|
+
case "$rval" in
|
|
725
|
+
false|true|yes|no|on|off|"") ;;
|
|
726
|
+
*) dg_live="$dg_live${rkey%%$US*} " ;;
|
|
727
|
+
esac
|
|
728
|
+
if [[ "$rkey" == *"$US"* ]]; then
|
|
729
|
+
bad "dogfood.recipes.${rkey//$US/.} is a nested block — each repo maps to one file: '${rkey%%$US*}: docs/dogfood/${rkey%%$US*}.md', or false"
|
|
730
|
+
continue
|
|
731
|
+
fi
|
|
732
|
+
case "$dg_repo_set" in
|
|
733
|
+
*" $rkey "*) ;;
|
|
734
|
+
*) bad "dogfood.recipes.$rkey is not a repo — repos: does not list '$rkey', and the map is keyed by the repo folder"; continue ;;
|
|
735
|
+
esac
|
|
736
|
+
# Shape first, and independently of `enabled`: an absolute path, a list,
|
|
737
|
+
# or an empty value is malformed whether dogfood runs or not. Only a
|
|
738
|
+
# missing file is a state a disabled block may leave for the first run.
|
|
739
|
+
case "$rval" in
|
|
740
|
+
false) note " dogfood.recipes.$rkey: false (deliberately not dogfooded)" ;;
|
|
741
|
+
true|yes|no|on|off) bad "dogfood.recipes.$rkey '$rval' must be a path or false, never on/off" ;;
|
|
742
|
+
"") bad "dogfood.recipes.$rkey '$rval' must be a path or false, never empty — a repo maps to docs/dogfood/$rkey.md, or false when it is deliberately not dogfooded" ;;
|
|
743
|
+
\[* ) bad "dogfood.recipes.$rkey '$rval' must be a path or false, never a list — a repo maps to one file: docs/dogfood/$rkey.md" ;;
|
|
744
|
+
/*|~*|.|./)
|
|
745
|
+
bad "$(dg_path_tail "dogfood.recipes.$rkey" "$rval")" ;;
|
|
746
|
+
*) if escapes_root "$rval"; then
|
|
747
|
+
bad "$(dg_path_tail "dogfood.recipes.$rkey" "$rval")"
|
|
748
|
+
elif [[ "$rval" != "docs/dogfood/$rkey.md" ]]; then
|
|
749
|
+
bad "dogfood.recipes.$rkey '$rval' is not this repo's recipe — a workspace keeps each repo's procedure at 'docs/dogfood/$rkey.md'; move it there and set '$rkey: docs/dogfood/$rkey.md'"
|
|
750
|
+
elif [[ ! -f "$ROOT/$rval" ]]; then
|
|
751
|
+
if [[ "$dg_enabled" == "true" ]]; then
|
|
752
|
+
bad "dogfood.recipes.$rkey '$rval' does not exist — run sassy-dogfood mode:discover"
|
|
753
|
+
else
|
|
754
|
+
note " dogfood.recipes.$rkey: $rval (written by the first sassy-dogfood run)"
|
|
755
|
+
fi
|
|
756
|
+
else
|
|
757
|
+
dg_recipe_file "$rval" "dogfood.recipes.$rkey"
|
|
758
|
+
fi ;;
|
|
759
|
+
esac
|
|
760
|
+
done < <(yaml_flat "$CONFIG" \
|
|
761
|
+
| awk -F'\t' -v us="$US" '{n=split($1,a,us); if (n>=3 && a[1]=="dogfood" && a[2]=="recipes") print $1 "\t" $2}')
|
|
762
|
+
|
|
763
|
+
# A repo with no recipe needs none — most are never dogfooded — so an
|
|
764
|
+
# omission is a note, never drift. `false` is the entry that says the
|
|
765
|
+
# decision was made, which is why a repo that carries one is not named.
|
|
766
|
+
if (( dg_recipes_declared )) || [[ "$dg_split" -eq 0 && "$dg_enabled" == "true" ]]; then
|
|
767
|
+
for rname in $dg_repo_set; do
|
|
768
|
+
case "$dg_mapped" in *" $rname "*) continue ;; esac
|
|
769
|
+
note " dogfood.recipes has no entry for '$rname' — it is not dogfooded; add '$rname: docs/dogfood/$rname.md' under recipes:, or '$rname: false' if that is deliberate"
|
|
770
|
+
done
|
|
771
|
+
fi
|
|
772
|
+
fi
|
|
773
|
+
|
|
774
|
+
# A half-migrated workspace: the map exists but the combined file the split
|
|
775
|
+
# replaces is still on disk, so the split may not have finished. One note and
|
|
776
|
+
# the reader decides — the check never deletes a project-owned document.
|
|
777
|
+
if [[ "$configured_repo" == "workspace" ]] && (( dg_recipes_declared )) && [[ -f "$ROOT/$dg_recipe_default" ]]; then
|
|
778
|
+
note " docs/dogfood.md still exists beside the 'recipes:' map — the split may not be finished; keep it until every section is distributed, then delete it yourself"
|
|
779
|
+
fi
|
|
780
|
+
|
|
543
781
|
if [[ -n "$dg_timeout" ]]; then
|
|
544
782
|
case "$dg_timeout" in
|
|
545
783
|
*[!0-9]*) bad "dogfood.timeout '$dg_timeout' is not a positive integer" ;;
|
|
@@ -547,6 +785,43 @@ mode_check() {
|
|
|
547
785
|
*) note " dogfood.timeout: ${dg_timeout}s" ;;
|
|
548
786
|
esac
|
|
549
787
|
fi
|
|
788
|
+
# Retention is a cap on run history, so zero is not a value: a run would prune
|
|
789
|
+
# every report it just wrote, including the one on disk. One predicate, shared
|
|
790
|
+
# with the sync's leaf_ok, because `*[!0-9]*` would accept `010` and `(( ))`
|
|
791
|
+
# would then read it as octal.
|
|
792
|
+
dg_keep="${dg_keep_raw:-10}"
|
|
793
|
+
dg_keep_ok=1
|
|
794
|
+
if [[ "$dg_keep" =~ ^[1-9][0-9]*$ ]]; then
|
|
795
|
+
[[ -z "$dg_keep_raw" ]] || note " dogfood.keep: $dg_keep runs"
|
|
796
|
+
else
|
|
797
|
+
bad "dogfood.keep '$dg_keep' is not an integer >= 1"
|
|
798
|
+
dg_keep_ok=0
|
|
799
|
+
fi
|
|
800
|
+
|
|
801
|
+
# Run history is not config drift: an over-quota reports directory is a note and
|
|
802
|
+
# the check still exits 0. Failing it would let a week of runs block a close-out,
|
|
803
|
+
# and the next green run is what prunes — this check only listens and reports.
|
|
804
|
+
if (( dg_keep_ok )); then
|
|
805
|
+
while IFS=$'\t' read -r dg_bucket dg_count; do
|
|
806
|
+
[[ -n "$dg_count" ]] || continue
|
|
807
|
+
(( dg_count > dg_keep )) || continue
|
|
808
|
+
# A bucket under a repo this workspace does not dogfood is frozen history:
|
|
809
|
+
# no run will ever prune it, so counting it would be one permanent note on
|
|
810
|
+
# every check. The prune there is the user's, by hand.
|
|
811
|
+
#
|
|
812
|
+
# `.` is the flat-root sentinel, so it and an empty bucket name the root
|
|
813
|
+
# reports path, not a repo below it — and in a workspace that legacy flat
|
|
814
|
+
# bucket is a half-migrated layout to move into `reports/<repo>/`, not a
|
|
815
|
+
# bucket any run maintains, so it stays loud instead of being skipped with
|
|
816
|
+
# a repo that is not dogfooded.
|
|
817
|
+
dg_suffix=""
|
|
818
|
+
[[ -z "$dg_bucket" || "$dg_bucket" == "." ]] || dg_suffix="/$dg_bucket"
|
|
819
|
+
if [[ "$configured_repo" == "workspace" && -n "$dg_suffix" ]]; then
|
|
820
|
+
case "$dg_live" in *" $dg_bucket "*) ;; *) continue ;; esac
|
|
821
|
+
fi
|
|
822
|
+
note " dogfood.reports${dg_suffix} holds $dg_count runs — more than dogfood.keep ($dg_keep); a completed green run prunes the oldest, or prune by hand"
|
|
823
|
+
done < <(dogfood_run_counts "$ROOT/${dg_reports:-.sassywares/dogfood/reports}")
|
|
824
|
+
fi
|
|
550
825
|
|
|
551
826
|
# Reports are logs and screenshots. A project that drops the ignore line
|
|
552
827
|
# commits them, and nobody notices until the history is heavy. Probed with a
|
|
@@ -580,15 +855,7 @@ mode_check() {
|
|
|
580
855
|
note " dogfood.recipe: $dg_recipe (written by the first sassy-dogfood run)"
|
|
581
856
|
fi
|
|
582
857
|
else
|
|
583
|
-
|
|
584
|
-
[[ -n "$msg" ]] || continue
|
|
585
|
-
bad "dogfood.recipe $msg"
|
|
586
|
-
done < <(recipe_lint "$ROOT/$dg_recipe")
|
|
587
|
-
while IFS= read -r line0; do
|
|
588
|
-
[[ -n "$line0" ]] || continue
|
|
589
|
-
bad "dogfood.recipe has a secret-shaped string at line $line0 — env var names only, never a value"
|
|
590
|
-
done < <(grep -nE 'sk-[A-Za-z0-9_-]{16,}|ghp_[A-Za-z0-9]{20,}|AKIA[0-9A-Z]{16}|xox[baprs]-[A-Za-z0-9-]{10,}' "$ROOT/$dg_recipe" 2>/dev/null | cut -d: -f1)
|
|
591
|
-
note " dogfood.recipe: $dg_recipe"
|
|
858
|
+
dg_recipe_file "$dg_recipe" dogfood.recipe
|
|
592
859
|
fi
|
|
593
860
|
fi
|
|
594
861
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# generated_by: sassy-setup@0.17.
|
|
1
|
+
# generated_by: sassy-setup@0.17.3
|
|
2
2
|
# lib/common.sh — topology and config helpers, the suite roster predicate, and
|
|
3
3
|
# the functions that resolve the paths the proposal and the check read.
|
|
4
4
|
# Sourced by detect.sh. Never sets shell options; ROOT, CONFIG, and START are
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# generated_by: sassy-setup@0.17.
|
|
1
|
+
# generated_by: sassy-setup@0.17.3
|
|
2
2
|
# lib/proposal.sh — the proposed config, printed by the default mode and merged
|
|
3
3
|
# onto by --check and --sync.
|
|
4
4
|
# Sourced by detect.sh. Never sets shell options; reads the paths it set.
|
|
@@ -215,7 +215,34 @@ cat <<'EOF'
|
|
|
215
215
|
dogfood:
|
|
216
216
|
EOF
|
|
217
217
|
kv enabled false 42 '# true = plan writes Auto QA rows; false = all Manual'
|
|
218
|
-
|
|
218
|
+
if [[ "$TOPOLOGY" == "workspace" ]]; then
|
|
219
|
+
# A workspace declares one recipe per repo, keyed by `repos:` — the single
|
|
220
|
+
# `recipe:` key is a repo-topology form and is drift here. The map is shown as
|
|
221
|
+
# a commented example rather than a guessed entry: a path nobody wrote would
|
|
222
|
+
# be a note today and drift the moment dogfood is turned on.
|
|
223
|
+
printf ' # recipes: # workspace only: one recipe per repo; false = deliberately not dogfooded\n'
|
|
224
|
+
# Propose the keys `--check` validates: `repos:` when the config has one, and
|
|
225
|
+
# the disk only when it does not (a fresh setup). A key from a folder the
|
|
226
|
+
# config never lists would be drift the moment it is uncommented.
|
|
227
|
+
dg_any=0
|
|
228
|
+
if [[ -n "$CONFIG" && -f "$CONFIG" ]] && [[ -n "$(repo_names)" ]]; then
|
|
229
|
+
while IFS= read -r name; do
|
|
230
|
+
[[ -n "$name" ]] || continue
|
|
231
|
+
printf ' # %s: docs/dogfood/%s.md\n' "$name" "$name"
|
|
232
|
+
dg_any=1
|
|
233
|
+
done < <(repo_names)
|
|
234
|
+
else
|
|
235
|
+
while IFS= read -r name; do
|
|
236
|
+
[[ -n "$name" ]] || continue
|
|
237
|
+
printf ' # %s: docs/dogfood/%s.md\n' "$name" "$name"
|
|
238
|
+
dg_any=1
|
|
239
|
+
done < <(nested_repos)
|
|
240
|
+
fi
|
|
241
|
+
(( dg_any )) || printf ' # <repo>: docs/dogfood/<repo>.md\n'
|
|
242
|
+
else
|
|
243
|
+
kv recipe docs/dogfood.md 42 '# the procedure; sassy-dogfood writes it'
|
|
244
|
+
fi
|
|
219
245
|
kv reports .sassywares/dogfood/reports 42 '# run output; must stay gitignored'
|
|
220
246
|
kv timeout 900 42 '# seconds for the whole procedure'
|
|
247
|
+
kv keep 10 42 '# runs kept per repo; a green run prunes the oldest'
|
|
221
248
|
}
|