@techgoblin/gobstack 0.6.0-alpha.3 → 0.6.0-beta.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/CHANGELOG.md +45 -0
- package/README.md +256 -120
- package/VERSION +1 -1
- package/bans/README.md +5 -5
- package/bans/grep-ban.sh +1 -1
- package/bin/goblin-bans +103 -27
- package/bin/goblin-init +346 -211
- package/bin/goblin-install +281 -204
- package/bin/goblin-lib.sh +79 -76
- package/bin/goblin-map +130 -571
- package/bin/goblin-mcp.js +37 -16
- package/bin/goblin-verify +254 -998
- package/bin/goblin.js +4 -9
- package/docs/GUIDE.md +727 -181
- package/docs/LIMITS.md +273 -301
- package/docs/RECORD-NOTES.md +1 -2
- package/manifest/bans.tsv +9 -9
- package/manifest/categories.tsv +18 -0
- package/manifest/enforcement.tsv +12 -68
- package/manifest/glossary.tsv +6 -12
- package/manifest/library.tsv +33 -0
- package/package.json +1 -4
- package/skills/goblin-bootstrap/SKILL.md +20 -32
- package/skills/goblin-feature-map/SKILL.md +1 -1
- package/skills/goblin-verify-author/SKILL.md +2 -2
- package/skills/practice/SKILL.md +4 -4
- package/templates/AGENTS.md.tmpl +6 -6
- package/templates/HANDOFF.md.tmpl +1 -1
- package/templates/SPEC.md.tmpl +2 -2
- package/templates/agents-block.tmpl +1 -10
- package/adapters/_template/adapter.tsv +0 -16
- package/adapters/_template/detect.sh +0 -10
- package/adapters/_template/emit.sh +0 -5
- package/adapters/_template/verify.sh +0 -4
- package/adapters/claude/adapter.tsv +0 -8
- package/adapters/claude/detect.sh +0 -8
- package/adapters/claude/verify.sh +0 -47
- package/adapters/codex/adapter.tsv +0 -12
- package/adapters/codex/detect.sh +0 -9
- package/adapters/codex/verify.sh +0 -45
- package/adapters/copilot/adapter.tsv +0 -10
- package/adapters/copilot/detect.sh +0 -8
- package/adapters/copilot/verify.sh +0 -45
- package/adapters/cursor/adapter.tsv +0 -11
- package/adapters/cursor/detect.sh +0 -10
- package/adapters/cursor/verify.sh +0 -45
- package/adapters/gemini/adapter.tsv +0 -15
- package/adapters/gemini/detect.sh +0 -11
- package/adapters/gemini/verify.sh +0 -49
- package/adapters/hermes/adapter.tsv +0 -9
- package/adapters/hermes/detect.sh +0 -8
- package/adapters/hermes/verify.sh +0 -27
- package/adapters/opencode/adapter.tsv +0 -14
- package/adapters/opencode/detect.sh +0 -9
- package/adapters/opencode/verify.sh +0 -45
- package/automations/README.md +0 -53
- package/automations/bugreporter-intake.sh +0 -145
- package/automations/drift-audit.sh +0 -139
- package/automations/report.schema.tsv +0 -10
- package/bin/goblin +0 -144
- package/bin/goblin-audit +0 -143
- package/bin/goblin-doctor +0 -233
- package/bin/goblin-emit +0 -495
- package/bin/goblin-extras +0 -360
- package/bin/goblin-model +0 -105
- package/bin/goblin-upgrade +0 -580
- package/docs/ADOPTION.md +0 -173
- package/docs/CI.md +0 -190
- package/docs/CONTRACTS.md +0 -215
- package/docs/DESIGN.md +0 -92
- package/docs/ENFORCEMENT.md +0 -228
- package/docs/FLOWS.md +0 -164
- package/docs/GLOSSARY.md +0 -40
- package/docs/GUARDRAILS.md +0 -126
- package/docs/INTEGRATION.md +0 -92
- package/docs/LOOP.md +0 -165
- package/docs/RE-PLAYBOOK.md +0 -183
- package/docs/RISKS.md +0 -70
- package/docs/ROLES.md +0 -105
- package/extras-catalogue/catalogue.tsv +0 -42
- package/extras-catalogue/payload/README.md +0 -14
- package/extras-catalogue/payload/taste-skill/taste/REFERENCE.md +0 -3
- package/extras-catalogue/payload/taste-skill/taste/SKILL.md +0 -9
- package/manifest/classes.tsv +0 -51
- package/manifest/playbooks.tsv +0 -16
- package/presets/electron-overlay.yaml +0 -38
- package/presets/fleet.yaml +0 -43
- package/presets/game.yaml +0 -38
- package/presets/research.yaml +0 -41
- package/presets/service.yaml +0 -40
- package/presets/software.yaml +0 -48
- package/roles.yaml +0 -54
- package/skills/goblin-bugfix/SKILL.md +0 -26
- package/skills/goblin-bugreporter/SKILL.md +0 -52
- package/skills/goblin-drift-audit/SKILL.md +0 -43
- package/skills/goblin-eval/SKILL.md +0 -68
- package/skills/goblin-feature/SKILL.md +0 -26
- package/skills/goblin-investigation/SKILL.md +0 -26
- package/skills/goblin-judge/SKILL.md +0 -74
- package/skills/goblin-loop/SKILL.md +0 -88
- package/skills/goblin-mode/SKILL.md +0 -70
- package/skills/goblin-overnight/SKILL.md +0 -42
- package/skills/goblin-pr-gate/SKILL.md +0 -42
- package/skills/goblin-re-mobile/SKILL.md +0 -51
- package/skills/goblin-refactor/SKILL.md +0 -23
- package/skills/goblin-sweep/SKILL.md +0 -23
- package/skills/goblin-tdd-repro/SKILL.md +0 -27
- package/templates/audit-waiver.tsv.tmpl +0 -10
- package/templates/install-hooks.allowlist.tmpl +0 -9
- package/templates/report.yaml.tmpl +0 -16
package/bin/goblin-install
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# goblin-install — drop the harness into a target repo, idempotently.
|
|
3
3
|
#
|
|
4
|
-
# Usage:
|
|
4
|
+
# Usage: bash bin/goblin-install --target <dir> [options] # checkout-only; `gob init --write` is the user surface
|
|
5
5
|
# --target <dir> required; the repo root to install into
|
|
6
|
-
# --
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
# --
|
|
10
|
-
# the app_bundle_bytes ratchet, BN-06..09 bans, the host-gate declaration
|
|
11
|
-
# --models <path> model mapping file (default: $GOBLIN_MODELS -> ~/projects/fleet-model.yaml)
|
|
12
|
-
# --practice <path> the referenced standard (default: $GOBLIN_PRACTICE -> ~/projects/PROJECT-PRACTICE.md); a named path that is absent is reported, never silently dropped
|
|
13
|
-
# --parts <list> comma list to install; default = every part the class requires
|
|
6
|
+
# --practice <path> the referenced standard (default: $GOBLIN_PRACTICE; unset = empty
|
|
7
|
+
# practice: pin — a named path that is absent is reported, never
|
|
8
|
+
# silently dropped)
|
|
9
|
+
# --parts <list> comma list to install (default = the whole default part set)
|
|
14
10
|
# --archive mark the project archive: verify requires no HANDOFF and no gates
|
|
15
|
-
# --skills
|
|
16
|
-
#
|
|
11
|
+
# --skills <spec> which skills to vendor into .gob/skills/ (default: the 5 core
|
|
12
|
+
# skills). <spec> is `no`/`yes` (the core tier), `all` (every skill
|
|
13
|
+
# in the repo's skills/), or a comma-separated list of skill names
|
|
14
|
+
# (`goblin-handoff,goblin-bootstrap`) — an unknown name is refused, never
|
|
15
|
+
# silently skipped. `yes` additionally installs the full set under
|
|
16
|
+
# .hermes/skills/ (the Hermes project tier).
|
|
17
|
+
# --list-skills print the skill library (name, tier, one-line purpose) and exit
|
|
17
18
|
# --dry-run print the plan; write nothing
|
|
18
19
|
# --upgrade re-install at the current version; report created/updated/unchanged/skipped
|
|
19
20
|
# --opt-out <part> record the part in disabled: so its required checks are skipped
|
|
20
21
|
# --uninstall remove exactly the files in installed.json
|
|
21
22
|
# --re-pin re-record practice_sha256: for an edited standard; nothing else changes
|
|
22
|
-
# (the CI lane was REMOVED from the product in v2: no .github/workflows payload, the
|
|
23
|
-
# explicit no opts the part out (recorded in disabled: so CL-01
|
|
24
|
-
# reports the opt-out, never a silent absence); an explicit yes is
|
|
25
|
-
# refused for a class that forbids the part.
|
|
26
23
|
# --force allow overwriting a file goblin-stack did not create
|
|
27
24
|
# --yes non-interactive; take the defaults above
|
|
28
25
|
#
|
|
@@ -31,16 +28,42 @@
|
|
|
31
28
|
|
|
32
29
|
set -uo pipefail
|
|
33
30
|
|
|
34
|
-
GOBLIN_INSTALL_VERSION="0.6.0-
|
|
31
|
+
GOBLIN_INSTALL_VERSION="0.6.0-beta.1"
|
|
35
32
|
SELF_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
36
33
|
SRC=$(cd "$SELF_DIR/.." && pwd)
|
|
37
34
|
# shellcheck source=goblin-lib.sh
|
|
38
35
|
. "$SELF_DIR/goblin-lib.sh"
|
|
39
36
|
|
|
37
|
+
# The skill LIBRARY: the repo's skills/ directory. The 5 CORE skills are the ones whose rows
|
|
38
|
+
# (SK-01/02/04) ride every install and are vendored by default; every other skill is available
|
|
39
|
+
# on request (`--skills all`, or a name list). This is the same shape the rule LIBRARY uses:
|
|
40
|
+
# a default set on, the rest held back and selectable, discoverable from the CLI (--list-skills).
|
|
41
|
+
# v3 enhance-layer (proposal §2): the 12+1 commodity/dormant skills were cut to the attic/
|
|
42
|
+
# branch; the payload ships only gate-coupled skills.
|
|
43
|
+
CORE_SKILLS="goblin-handoff goblin-verify-author goblin-feature-map practice goblin-bootstrap"
|
|
44
|
+
# skill_list — name<TAB>one-line-purpose for every skill in $SRC/skills/, sorted. The purpose is
|
|
45
|
+
# the first line of the SKILL.md frontmatter `description:` (the same field SK-01 requires).
|
|
46
|
+
skill_list() {
|
|
47
|
+
local d name desc
|
|
48
|
+
for d in "$SRC"/skills/*/; do
|
|
49
|
+
[ -f "$d/SKILL.md" ] || continue
|
|
50
|
+
name=$(basename "$d")
|
|
51
|
+
desc=$(awk 'NR==1{f=1;next} /^---/{f=0} f&&/^description:/{sub(/^description:[[:space:]]*/,"");print;exit}' "$d/SKILL.md")
|
|
52
|
+
printf '%s\t%s\n' "$name" "$desc"
|
|
53
|
+
done | sort
|
|
54
|
+
}
|
|
55
|
+
skill_names() { skill_list | cut -f1; }
|
|
56
|
+
# skill_tier <name> — core | optional
|
|
57
|
+
skill_tier() { case " $CORE_SKILLS " in *" $1 "*) printf 'core' ;; *) printf 'optional' ;; esac; }
|
|
58
|
+
|
|
40
59
|
TARGET=""
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
60
|
+
# QA fix (v2-qa issue 4): the old default was $HOME/projects/PROJECT-PRACTICE.md - the
|
|
61
|
+
# MAINTAINER's home layout baked into every rendered config on every machine, including a
|
|
62
|
+
# fresh contributor's (their rendered AGENTS.md pointed at a file that does not exist on
|
|
63
|
+
# their machine). The neutral default is EMPTY: the practice pin stays empty (verify
|
|
64
|
+
# treats that as the legitimate no-standard state). A machine that HAS a standard exports
|
|
65
|
+
# GOBLIN_PRACTICE (or passes --practice) and gets the same rendering as before.
|
|
66
|
+
PRACTICE="${GOBLIN_PRACTICE:-}"
|
|
44
67
|
# W5-3: `--practice <path>` naming a file that is not there used to be IGNORED IN SILENCE -
|
|
45
68
|
# exit 0, `practice: ~`, `practice_sha256: ~`, and not one line about it in the install log.
|
|
46
69
|
# The empty pin is a legitimate state (a repo may reference no standard, and the default path is
|
|
@@ -59,6 +82,7 @@ SKILLS="no"
|
|
|
59
82
|
# "whatever the record says" (the migration contract below); a NAMED --skills no is an
|
|
60
83
|
# explicit opt-out and is honoured verbatim.
|
|
61
84
|
SKILLS_NAMED=0
|
|
85
|
+
LIST_SKILLS=0
|
|
62
86
|
DRY_RUN=0
|
|
63
87
|
UPGRADE=0
|
|
64
88
|
UNINSTALL=0
|
|
@@ -67,10 +91,6 @@ FORCE=0
|
|
|
67
91
|
OPT_OUT=""
|
|
68
92
|
GATE_NAME_ARG="" # parsed by --gate <cmd> [name] below; reset before the loop
|
|
69
93
|
# CI_GATE_OPT is gone with the CI lane (v2): no flag, no workflow file, no ci_gate field.
|
|
70
|
-
# The electron opt-in (the merged desktop/F class): renders presets/electron-overlay.yaml over
|
|
71
|
-
# the software preset. Auto-set when --class resolves via the desktop/F/f alias, so the alias
|
|
72
|
-
# behaves as the old class F did rather than silently installing weaker software.
|
|
73
|
-
ELECTRON=0
|
|
74
94
|
|
|
75
95
|
usage() {
|
|
76
96
|
# The header comment runs from line 2 to the first blank line, so adding an option cannot
|
|
@@ -82,13 +102,12 @@ usage() {
|
|
|
82
102
|
while [ $# -gt 0 ]; do
|
|
83
103
|
case "$1" in
|
|
84
104
|
--target) TARGET="${2:-}"; shift 2 ;;
|
|
85
|
-
--class) CLASS="${2:-}"; shift 2 ;;
|
|
86
|
-
--models) MODELS="${2:-}"; shift 2 ;;
|
|
87
105
|
--practice) PRACTICE="${2:-}"; PRACTICE_ARG="$PRACTICE"; shift 2 ;;
|
|
88
106
|
--parts) PARTS="${2:-}"; shift 2 ;;
|
|
89
107
|
--archive) ARCHIVE="true"; shift ;;
|
|
90
|
-
--electron) ELECTRON=1; shift ;;
|
|
91
108
|
--skills) SKILLS="${2:-}"; SKILLS_NAMED=1; shift 2 ;;
|
|
109
|
+
--list-skills) LIST_SKILLS=1; shift ;;
|
|
110
|
+
--print-core-skills) printf '%s\n' "$CORE_SKILLS"; exit 0 ;;
|
|
92
111
|
--dry-run) DRY_RUN=1; shift ;;
|
|
93
112
|
--upgrade) UPGRADE=1; shift ;;
|
|
94
113
|
--uninstall) UNINSTALL=1; shift ;;
|
|
@@ -105,6 +124,19 @@ done
|
|
|
105
124
|
for dep in git awk sed grep; do
|
|
106
125
|
command -v "$dep" >/dev/null 2>&1 || { g_err "missing dependency: $dep"; exit 2; }
|
|
107
126
|
done
|
|
127
|
+
|
|
128
|
+
# --list-skills: print the library and exit. This is the discovery surface BEFORE choosing — the
|
|
129
|
+
# same role `gob verify --library` plays for the rule rows. It needs no --target and writes nothing.
|
|
130
|
+
if [ "$LIST_SKILLS" -eq 1 ]; then
|
|
131
|
+
printf 'the skill library (%s/skills/):\n' "$SRC"
|
|
132
|
+
printf ' %-22s %-9s %s\n' NAME TIER PURPOSE
|
|
133
|
+
while IFS=$'\t' read -r n p; do
|
|
134
|
+
printf ' %-22s %-9s %s\n' "$n" "$(skill_tier "$n")" "$p"
|
|
135
|
+
done < <(skill_list)
|
|
136
|
+
printf '\ndefault install: the 5 core skills. choose with --skills all | <name>[,<name>...]\n'
|
|
137
|
+
exit 0
|
|
138
|
+
fi
|
|
139
|
+
|
|
108
140
|
[ -n "$TARGET" ] || { g_err "--target is required"; exit 2; }
|
|
109
141
|
TARGET=$(g_expand_tilde "$TARGET")
|
|
110
142
|
[ -d "$TARGET" ] || { g_err "--target is not a directory: $TARGET"; exit 2; }
|
|
@@ -112,7 +144,6 @@ TARGET=$(cd "$TARGET" && pwd)
|
|
|
112
144
|
[ -f "$SRC/VERSION" ] || { g_err "no VERSION at $SRC — is this a goblin-stack checkout?"; exit 2; }
|
|
113
145
|
|
|
114
146
|
VERSION=$(head -n 1 "$SRC/VERSION")
|
|
115
|
-
CLASSES_TSV="$SRC/manifest/classes.tsv"
|
|
116
147
|
INSTALLED="$TARGET/.gob/installed.json"
|
|
117
148
|
CONFIG="$TARGET/AGENTS.md"
|
|
118
149
|
STAMP=$(date +%F)
|
|
@@ -159,9 +190,10 @@ if [ "$UNINSTALL" -eq 1 ]; then
|
|
|
159
190
|
[ "$DRY_RUN" -eq 1 ] || rm -f "$TARGET/$f"
|
|
160
191
|
g_info "removed $f (runtime state)"
|
|
161
192
|
done
|
|
162
|
-
# The repo-distributed MCP registration (init --with-mcp-config): removed ONLY
|
|
163
|
-
# still carries the generated bytes — the preimage pattern, the same clause the
|
|
164
|
-
# records below get. A hand-tuned or team-customized .mcp.json is the project's
|
|
193
|
+
# The repo-distributed MCP registration (init --write --with-mcp-config): removed ONLY
|
|
194
|
+
# when it still carries the generated bytes — the preimage pattern, the same clause the
|
|
195
|
+
# decision records below get. A hand-tuned or team-customized .mcp.json is the project's
|
|
196
|
+
# and stays.
|
|
165
197
|
if [ -f "$TARGET/.mcp.json" ]; then
|
|
166
198
|
if [ "$(cat "$TARGET/.mcp.json" 2>/dev/null)" = '{"mcpServers":{"gob":{"command":"npx","args":["-y","@techgoblin/gobstack","mcp"]}}}' ]; then
|
|
167
199
|
[ "$DRY_RUN" -eq 1 ] || rm -f "$TARGET/.mcp.json"
|
|
@@ -170,6 +202,27 @@ if [ "$UNINSTALL" -eq 1 ]; then
|
|
|
170
202
|
g_info "kept .mcp.json (not the generated bytes: a registration you customized stays)"
|
|
171
203
|
fi
|
|
172
204
|
fi
|
|
205
|
+
# The agent hooks (init --write, v3 enhance layer): removed ONLY when the file on disk
|
|
206
|
+
# still hashes to the value .gob/manifest/hooks.tsv recorded at write time. A snippet the
|
|
207
|
+
# project edited is the project's and stays, named in the output — the same
|
|
208
|
+
# removed-vs-kept fork the decision records get. The record itself goes last (it is
|
|
209
|
+
# goblin-stack's own file, and an uninstall that left it would be residue).
|
|
210
|
+
if [ -f "$TARGET/.gob/manifest/hooks.tsv" ]; then
|
|
211
|
+
while IFS=$'\t' read -r vendor rel sha; do
|
|
212
|
+
[ -n "$rel" ] || continue
|
|
213
|
+
[ -f "$TARGET/$rel" ] || continue
|
|
214
|
+
if [ "$(g_sha256_file "$TARGET/$rel")" = "$sha" ]; then
|
|
215
|
+
[ "$DRY_RUN" -eq 1 ] || rm -f "$TARGET/$rel"
|
|
216
|
+
g_info "removed $rel (the recorded $vendor hook, byte-identical)"
|
|
217
|
+
n=$((n + 1))
|
|
218
|
+
d="$rel"; while [ "${d%/*}" != "$d" ]; do d="${d%/*}"; PARENTS="$PARENTS$d"$'\n'; done
|
|
219
|
+
else
|
|
220
|
+
g_info "kept $rel (not the recorded bytes: a hook you customized stays)"
|
|
221
|
+
fi
|
|
222
|
+
done < "$TARGET/.gob/manifest/hooks.tsv"
|
|
223
|
+
[ "$DRY_RUN" -eq 1 ] || rm -f "$TARGET/.gob/manifest/hooks.tsv"
|
|
224
|
+
g_info "removed .gob/manifest/hooks.tsv (the hook record)"
|
|
225
|
+
fi
|
|
173
226
|
# The three decision records (audit waivers, boundary waivers, the install-hook allowlist) are
|
|
174
227
|
# put_once files. An UNEDITED one is still goblin-stack's template and goes; an EDITED one is
|
|
175
228
|
# the project's decision and stays, named in the summary. Deleting a decision silently would be
|
|
@@ -178,7 +231,7 @@ if [ "$UNINSTALL" -eq 1 ]; then
|
|
|
178
231
|
while IFS=$'\t' read -r p h; do
|
|
179
232
|
[ -n "$p" ] || continue
|
|
180
233
|
case "$p" in
|
|
181
|
-
.gob/
|
|
234
|
+
.gob/boundary-waivers) ;;
|
|
182
235
|
*) continue ;;
|
|
183
236
|
esac
|
|
184
237
|
[ -e "$TARGET/$p" ] || continue
|
|
@@ -219,7 +272,16 @@ if [ "$UNINSTALL" -eq 1 ]; then
|
|
|
219
272
|
printf '%s' "$PARENTS"
|
|
220
273
|
printf '.goblin\n.gob/bin\n.gob/manifest\n.gob/bans\n.hermes\n.hermes/skills\n'
|
|
221
274
|
} | awk 'NF' | awk -F/ '{print NF " " $0}' | sort -rn | cut -d' ' -f2- | awk '!seen[$0]++')
|
|
222
|
-
g_info "removed $n file(s) and $nd empty director(y|ies). Left in place: HANDOFF.md, AGENTS.md,
|
|
275
|
+
g_info "removed $n file(s) and $nd empty director(y|ies). Left in place: HANDOFF.md, AGENTS.md, the .gitignore block${KEPT:+, and the decision record(s) you edited:$KEPT}."
|
|
276
|
+
# QA fix (v2-qa issue 10): honesty about what the uninstall leaves UNTOUCHED. Two
|
|
277
|
+
# by-design residues a reader could otherwise read as a clean sweep:
|
|
278
|
+
# - the .gitignore block the install appended stays (removing it could eat a
|
|
279
|
+
# line the project added inside the block; the preimage is untracked text),
|
|
280
|
+
# - prose in kept files (HANDOFF.md, AGENTS.md body) may still name
|
|
281
|
+
# now-deleted paths (.gob/bin/goblin-verify, checks/) — those references are
|
|
282
|
+
# dead after this command.
|
|
283
|
+
g_info " note: the .gitignore ignore-rules block stays (by design: it may carry lines the project added; remove it by hand if you want it gone)"
|
|
284
|
+
g_info " note: prose that names .gob/ paths (HANDOFF.md, AGENTS.md body) now points at removed files — those references are dead"
|
|
223
285
|
exit 0
|
|
224
286
|
fi
|
|
225
287
|
|
|
@@ -230,7 +292,7 @@ fi
|
|
|
230
292
|
# intended has to be explicit, printed and deliberate. This mode rewrites exactly one line and
|
|
231
293
|
# reports the old and new hash. It is unreachable from --upgrade and from goblin-verify, by
|
|
232
294
|
# design: an automatic re-pin would be the silent edit the pin exists to catch.
|
|
233
|
-
# See docs/
|
|
295
|
+
# See docs/GUIDE.md, "An edited standard is not a dead end".
|
|
234
296
|
# The write's own failure output is captured (not discarded) so the fail-closed branch below can
|
|
235
297
|
# name it: a g_agents_write that could not land used to vanish into >/dev/null and the pipe still
|
|
236
298
|
# exited 0 (the sed inside writes via mktemp+mv, and only the mv reports).
|
|
@@ -283,125 +345,151 @@ if [ "$RE_PIN" -eq 1 ]; then
|
|
|
283
345
|
exit 0
|
|
284
346
|
fi
|
|
285
347
|
|
|
286
|
-
[ -n "$CLASS" ] || { g_err "--class is required (software|service|game|research|fleet, or A-E / app / agent / desktop)"; exit 2; }
|
|
287
|
-
# Resolve every accepted spelling to the canonical class NAME before anything reads it. The
|
|
288
|
-
# letters A-E and the old names app/agent/desktop are read-time aliases; desktop/F/f also sets
|
|
289
|
-
# the electron opt-in so the merged class behaves as the old class F did.
|
|
290
|
-
g_class_is_electron_alias "$CLASS" && ELECTRON=1
|
|
291
|
-
CLASS_RAW="$CLASS"
|
|
292
|
-
CLASS=$(g_class_canon "$CLASS") \
|
|
293
|
-
|| { g_err "--class must be software|service|game|research|fleet (or A-E / app / agent / desktop), got '$CLASS_RAW'"; exit 2; }
|
|
294
|
-
case "$SKILLS" in yes|no) ;; *) g_err "--skills must be yes or no"; exit 2 ;; esac
|
|
295
|
-
|
|
296
348
|
# W6 migration safety: on a --upgrade (or any re-install) of a repo whose record shows skills
|
|
297
349
|
# were installed, an OMITTED --skills flag must READ that state, not silently strip it. The
|
|
298
350
|
# idempotence contract (created/updated/unchanged) holds only if the effective skills choice
|
|
299
351
|
# for a flag-less re-install is `the record's choice`, so previously-installed skills survive
|
|
300
352
|
# every upgrade unchanged. An EXPLICIT --skills no is honoured verbatim (the switch stays
|
|
301
|
-
# real), and --uninstall still removes exactly what the record lists.
|
|
353
|
+
# real), and --uninstall still removes exactly what the record lists. The record's value may be
|
|
354
|
+
# yes, no, all, or a name list — a flag-less re-install reads whichever it was, so a chosen set
|
|
355
|
+
# is stable through every re-install.
|
|
302
356
|
if [ -f "$INSTALLED" ] && [ "$SKILLS_NAMED" -eq 0 ]; then
|
|
303
357
|
PREV_SKILLS=$(g_installed_scalar_options "$INSTALLED" skills)
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
PRESET="$SRC/presets/$CLASS.yaml"
|
|
311
|
-
[ -f "$PRESET" ] || { g_err "no preset for class $CLASS ($PRESET)"; exit 2; }
|
|
312
|
-
|
|
313
|
-
# The electron overlay (the merged desktop/F class): every key it declares — including an empty
|
|
314
|
-
# one like sec_write_routes: "" — wins over the class preset; an absent key falls through. This
|
|
315
|
-
# is config, not a second code path: the same preset() reader, one layer up.
|
|
316
|
-
OVERLAY=""
|
|
317
|
-
if [ "$ELECTRON" -eq 1 ]; then
|
|
318
|
-
OVERLAY="$SRC/presets/electron-overlay.yaml"
|
|
319
|
-
[ -f "$OVERLAY" ] || { g_err "no electron overlay at $OVERLAY"; exit 2; }
|
|
358
|
+
case "$PREV_SKILLS" in
|
|
359
|
+
""|no) ;;
|
|
360
|
+
*) SKILLS="$PREV_SKILLS"
|
|
361
|
+
g_info "skills: this repo's install record has agent skills installed - they are kept (remove them with an explicit --skills no, or --uninstall)" ;;
|
|
362
|
+
esac
|
|
320
363
|
fi
|
|
321
|
-
overlay_has() { [ -n "$OVERLAY" ] && grep -qE "^$1:" "$OVERLAY"; }
|
|
322
364
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
365
|
+
# --skills spec, validated AFTER the migration read so a recorded choice is accepted too:
|
|
366
|
+
# yes|no the 5-skill core tier (yes also installs the full set under .hermes/skills/)
|
|
367
|
+
# all every skill in the repo's skills/
|
|
368
|
+
# a,b,c exactly those names
|
|
369
|
+
# A name that does not exist is REFUSED — with the available set named — never silently skipped.
|
|
370
|
+
# The check runs before anything is planned or written, so a refused selection leaves no partial
|
|
371
|
+
# install (the fail-closed shape the honesty gate uses for rows).
|
|
372
|
+
case "$SKILLS" in
|
|
373
|
+
yes|no|all) ;;
|
|
374
|
+
"")
|
|
375
|
+
g_err "--skills needs a value: yes, no, all, or a comma-separated skill name list (run --list-skills)"; exit 2 ;;
|
|
376
|
+
*)
|
|
377
|
+
BAD_NAMES=""
|
|
378
|
+
for _n in $(printf '%s' "$SKILLS" | tr ',' ' '); do
|
|
379
|
+
[ -n "$_n" ] || continue
|
|
380
|
+
[ -d "$SRC/skills/$_n" ] || BAD_NAMES="$BAD_NAMES $_n"
|
|
381
|
+
done
|
|
382
|
+
if [ -n "$BAD_NAMES" ]; then
|
|
383
|
+
g_err "unknown --skills name(s):$BAD_NAMES"
|
|
384
|
+
g_err " available: $(skill_names | paste -sd, -)"
|
|
385
|
+
g_err " or use --skills all (every skill) / --skills no (the 5 core skills)"
|
|
386
|
+
exit 2
|
|
387
|
+
fi ;;
|
|
388
|
+
esac
|
|
389
|
+
|
|
390
|
+
# The default config block: ONE built-in set of values (the old software preset). There is no
|
|
391
|
+
# class and no preset file: a class only ever selected which bans ran, and the ban table now
|
|
392
|
+
# self-selects per row via applies_when, so the installer needs no taxonomy to render a block.
|
|
393
|
+
# --- default key/values (key<TAB>value) ---
|
|
394
|
+
default_tsv() {
|
|
395
|
+
cat <<'XEOF'
|
|
396
|
+
harness_dir checks
|
|
397
|
+
scaffold_checks yes
|
|
398
|
+
gate_name commit
|
|
399
|
+
gate_cmd git rev-parse --verify --quiet HEAD
|
|
400
|
+
gate2_name todo_ceiling
|
|
401
|
+
gate2_cmd test "$(grep -rniE '\b(TODO|FIXME)\b' --include='*.ts' --include='*.tsx' --include='*.js' --include='*.jsx' --include='*.mjs' . 2>/dev/null | wc -l)" -le 160
|
|
402
|
+
ratchet_name client_js_bytes
|
|
403
|
+
ratchet_cmd find .next/static dist/assets dist -type f -name '*.js' -exec cat {} + 2>/dev/null | wc -c
|
|
404
|
+
ratchet_ceiling measure
|
|
405
|
+
replay_env GOBLIN_PRE_COMMIT
|
|
406
|
+
replay_cmd node checks/{name}.mjs
|
|
407
|
+
runtime_data .gob/state.json
|
|
408
|
+
advisory_ceiling 10
|
|
409
|
+
sec_gitignore_family yes
|
|
410
|
+
sec_build_output .next/static dist/assets dist
|
|
411
|
+
sec_write_routes app src/app
|
|
412
|
+
perf_metric client_js_bytes
|
|
413
|
+
perf_cmd find .next/static dist/assets dist -type f -name '*.js' -exec cat {} + 2>/dev/null | wc -c
|
|
414
|
+
perf_baseline_commit
|
|
415
|
+
perf_baseline_value 0
|
|
416
|
+
perf_measured
|
|
417
|
+
perf_host_gate
|
|
418
|
+
bans_disabled
|
|
419
|
+
XEOF
|
|
327
420
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
421
|
+
default_() { default_tsv | awk -F'\t' -v OFS='\t' -v k="$1" '$1==k { $1=""; sub(/^\t/,""); print; exit }'; }
|
|
422
|
+
|
|
423
|
+
HARNESS_DIR=$(default_ harness_dir); [ -n "$HARNESS_DIR" ] || HARNESS_DIR=checks
|
|
424
|
+
SCAFFOLD=$(default_ scaffold_checks); [ -n "$SCAFFOLD" ] || SCAFFOLD=no
|
|
425
|
+
GATE_NAME=$(default_ gate_name)
|
|
426
|
+
# (GATE1/GATE2 render names are set in render_config; the default keys are unchanged.)
|
|
427
|
+
GATE_CMD=$(default_ gate_cmd)
|
|
428
|
+
# `--gate <cmd>` (gob init --write): the proposal's first gate REPLACES the default.
|
|
335
429
|
# `--gate <cmd> <name>` (optional 2nd word): the proposal may also name the gate — the
|
|
336
430
|
# HANDOFF template renders THAT name, so HP-03 (anchored on the DECLARED names) sees the
|
|
337
|
-
# gate line a fresh HANDOFF carries even when the name is not the
|
|
431
|
+
# gate line a fresh HANDOFF carries even when the name is not the default.
|
|
338
432
|
case "${GATE_NAME_ARG:-}" in "") ;; *) GATE_NAME="$GATE_NAME_ARG" ;; esac
|
|
339
433
|
[ -n "${GOB_GATE:-}" ] && GATE_CMD="$GOB_GATE"
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
434
|
+
# Whether the gate was DECLARED by the caller (gob init --write passes --gate, having MEASURED
|
|
435
|
+
# it) or is the installer's generic default. The next-steps advice depends on it: a declared gate
|
|
436
|
+
# is already real and owes no edit, while the default gate does. GATE_LABEL is non-empty only for
|
|
437
|
+
# a declared gate and rides into g_next_block.
|
|
438
|
+
GATE_LABEL=""
|
|
439
|
+
[ -n "${GOB_GATE:-}" ] && GATE_LABEL="$GATE_NAME: $GATE_CMD"
|
|
440
|
+
RAT_NAME=$(default_ ratchet_name)
|
|
441
|
+
RAT_CMD=$(default_ ratchet_cmd)
|
|
442
|
+
RAT_CEIL=$(default_ ratchet_ceiling)
|
|
443
|
+
REPLAY_ENV=$(default_ replay_env)
|
|
444
|
+
REPLAY_CMD=$(default_ replay_cmd)
|
|
445
|
+
RUNTIME_DATA=$(default_ runtime_data)
|
|
446
|
+
ADV_CEILING=$(default_ advisory_ceiling); [ -n "$ADV_CEILING" ] || ADV_CEILING=10
|
|
447
|
+
# The optional second gate (the TODO ceiling); blank it to render one gate only.
|
|
448
|
+
GATE2_NAME=$(default_ gate2_name)
|
|
449
|
+
GATE2_CMD=$(default_ gate2_cmd)
|
|
353
450
|
# The security surface (SC-01..SC-09) and the perf baseline (PF-01).
|
|
354
|
-
SEC_GITIGNORE_FAMILY=$(
|
|
355
|
-
SEC_BUILD_OUTPUT=$(
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
#
|
|
369
|
-
# BN-05 SKIPs with that reason until the project declares a from/to pair.
|
|
451
|
+
SEC_GITIGNORE_FAMILY=$(default_ sec_gitignore_family); [ -n "$SEC_GITIGNORE_FAMILY" ] || SEC_GITIGNORE_FAMILY=no
|
|
452
|
+
SEC_BUILD_OUTPUT=$(default_ sec_build_output)
|
|
453
|
+
SEC_WRITE_ROUTES=$(default_ sec_write_routes)
|
|
454
|
+
PERF_METRIC=$(default_ perf_metric)
|
|
455
|
+
PERF_CMD=$(default_ perf_cmd)
|
|
456
|
+
PERF_BASELINE_COMMIT=$(default_ perf_baseline_commit)
|
|
457
|
+
PERF_BASELINE_VALUE=$(default_ perf_baseline_value); [ -n "$PERF_BASELINE_VALUE" ] || PERF_BASELINE_VALUE=0
|
|
458
|
+
PERF_MEASURED=$(default_ perf_measured)
|
|
459
|
+
PERF_HOST_GATE=$(default_ perf_host_gate)
|
|
460
|
+
# The ban selection is the GLOB (a ban runs when a real file matches its applies_when cell);
|
|
461
|
+
# the only config knob is an explicit DISABLE list, rendered empty by default. A ban outside
|
|
462
|
+
# any of this is on automatically.
|
|
463
|
+
BANS_DISABLED=$(default_ bans_disabled)
|
|
464
|
+
# `layers:` is a block list the project declares; the default ships none, so it renders empty
|
|
465
|
+
# and BN-05 SKIPs with that reason until the project declares a from/to pair.
|
|
370
466
|
LAYERS_BLOCK=""
|
|
371
467
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
#
|
|
468
|
+
# Every part is on by default (there is no class turning parts off). The CORE procedure
|
|
469
|
+
# tier is vendored on EVERY install (.gob/skills/), so the product never disables its own
|
|
470
|
+
# skill rows (SK-01/02/04) — a fresh repo's harness runs them instead of skipping. An
|
|
471
|
+
# explicit --opt-out is the only thing that records a part in disabled:.
|
|
375
472
|
DISABLED=""
|
|
376
|
-
for p in handoff spec gate replay ratchet pr-gate review-panel playbooks tokens; do
|
|
377
|
-
[ "$(need "$p")" = "-" ] && DISABLED="$DISABLED$p,"
|
|
378
|
-
done
|
|
379
|
-
[ "$SKILLS" = "no" ] && DISABLED="$DISABLED""playbooks,"
|
|
380
473
|
if [ -n "$OPT_OUT" ]; then DISABLED="$DISABLED$OPT_OUT,"; fi
|
|
381
474
|
DISABLED=$(printf '%s' "$DISABLED" | tr ',' '\n' | grep -v '^$' | sort -u | paste -sd, -)
|
|
382
|
-
# The automation producers ride the `playbooks` part (they are the shipped automation files, and
|
|
383
|
-
# --skills no disables that part), so they are written under exactly the condition that makes
|
|
384
|
-
# AU-01..AU-04 and SK-04 honour an opt-out.
|
|
385
|
-
PLAYBOOKS_ON=1
|
|
386
|
-
case ",$DISABLED," in *,playbooks,*) PLAYBOOKS_ON=0 ;; esac
|
|
387
|
-
# parts the class forbids are never installed
|
|
388
|
-
for p in spec replay ratchet pr-gate; do
|
|
389
|
-
[ "$(need "$p")" = "-" ] && SCAFFOLD=no
|
|
390
|
-
done
|
|
391
475
|
|
|
392
|
-
|
|
476
|
+
# FIX 3: a *-SPEC.md and reviews/ are policed by LIBRARY rows (SP-01..03, PG-01..03, off by
|
|
477
|
+
# default), so a default install ships NEITHER: an artefact nothing checks on this repo is a false
|
|
478
|
+
# promise ("the installer scaffolds rows that are off by default"). They come back only on an
|
|
479
|
+
# explicit opt-in, `--parts spec` / `--parts reviews` — the same surface a repo turns the library
|
|
480
|
+
# rows on through — because "create them when the row is enabled" is not knowable at install time
|
|
481
|
+
# (enablement is a POST-install edit of .gob/manifest/enforcement.local.tsv). The installed file
|
|
482
|
+
# set therefore matches what the ENABLED (default) rows actually need.
|
|
483
|
+
WANT_SPEC=0
|
|
393
484
|
WANT_REVIEWS=0
|
|
394
|
-
case "
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
#
|
|
485
|
+
case ",${PARTS}," in *,spec,*) WANT_SPEC=1 ;; esac
|
|
486
|
+
case ",${PARTS}," in *,reviews,*) WANT_REVIEWS=1 ;; esac
|
|
487
|
+
WANT_RATCHET=1
|
|
488
|
+
# The CI lane is GONE (v2 product decision): no .github/workflows file is written and no flag
|
|
489
|
+
# configures it.
|
|
398
490
|
WANT_CI_GATE=0
|
|
399
491
|
[ "$ARCHIVE" = "true" ] && { WANT_SPEC=0; WANT_REVIEWS=0; SCAFFOLD=no; }
|
|
400
492
|
|
|
401
|
-
OWNER_EMAIL=$( cd "$TARGET" && git config user.email 2>/dev/null )
|
|
402
|
-
[ -n "$OWNER_EMAIL" ] || OWNER_EMAIL="you@example.com"
|
|
403
|
-
BRANCH=$( cd "$TARGET" && git rev-parse --abbrev-ref HEAD 2>/dev/null )
|
|
404
|
-
case "$BRANCH" in ""|HEAD) BRANCH=main ;; esac
|
|
405
493
|
HEAD_SHORT=$( cd "$TARGET" && git rev-parse --short HEAD 2>/dev/null )
|
|
406
494
|
[ -n "$HEAD_SHORT" ] || HEAD_SHORT="0000000"
|
|
407
495
|
|
|
@@ -426,9 +514,6 @@ if [ "$RAT_CEIL" = "measure" ]; then
|
|
|
426
514
|
case "$RAT_CEIL" in ''|*[!0-9]*) RAT_CEIL=0 ;; esac
|
|
427
515
|
fi
|
|
428
516
|
[ "$WANT_RATCHET" -eq 0 ] && { RAT_NAME=""; RAT_CMD=""; RAT_CEIL=0; }
|
|
429
|
-
# A part the class turns off must not be declared either: leaving replay.env/replay.cmd in the
|
|
430
|
-
# config made CL-01's "class forbids this part" branch fire on the installer's own output (D10).
|
|
431
|
-
[ "$(need replay)" = "-" ] && { REPLAY_ENV=""; REPLAY_CMD=""; }
|
|
432
517
|
|
|
433
518
|
# parts selected with --parts
|
|
434
519
|
part_wanted() {
|
|
@@ -449,7 +534,7 @@ REFUSED_PATHS=""
|
|
|
449
534
|
PREV_OWNED=""
|
|
450
535
|
# Files a PREVIOUS run installed (the hash-checked 'files' map). A path that exists on disk
|
|
451
536
|
# but is NOT in this map was not created by goblin-stack, so it is refused rather than
|
|
452
|
-
# clobbered - the contract in docs/
|
|
537
|
+
# clobbered - the contract in docs/GUIDE.md. --force is the only way past it.
|
|
453
538
|
PREV_FILES=""
|
|
454
539
|
if [ -f "$INSTALLED" ]; then
|
|
455
540
|
PREV_OWNED=$(g_json_object "$INSTALLED" owned | cut -f1)
|
|
@@ -547,28 +632,20 @@ put_once() {
|
|
|
547
632
|
# ------------------------------------------------------- generated content ---
|
|
548
633
|
render_config() {
|
|
549
634
|
local gates runtime
|
|
550
|
-
# v2 gate shape: one flat key per gate (gate_<name>_cmd:).
|
|
551
|
-
# gate (
|
|
552
|
-
#
|
|
635
|
+
# v2 gate shape: one flat key per gate (gate_<name>_cmd:). The default declares a second
|
|
636
|
+
# gate (the TODO ceiling, G4 D2); with none, the gate name renders empty and the key line
|
|
637
|
+
# is dropped below.
|
|
553
638
|
GATE1_NAME="$GATE_NAME"; GATE1_CMD="$GATE_CMD"
|
|
554
639
|
GATE2_RENDER_NAME="$GATE2_NAME"; GATE2_RENDER_CMD="$GATE2_CMD"
|
|
555
640
|
runtime="$RUNTIME_DATA"
|
|
556
641
|
render "$SRC/templates/agents-block.tmpl" \
|
|
557
|
-
CLASS "$CLASS" \
|
|
558
|
-
ELECTRON "$( [ "$ELECTRON" -eq 1 ] && printf 'true' || printf 'false' )" \
|
|
559
|
-
BRANCH "$BRANCH" \
|
|
560
|
-
MODELS_FILE "$MODELS" \
|
|
561
642
|
PRACTICE "$PRACTICE" \
|
|
562
643
|
PRACTICE_SHA "$PRACTICE_SHA" \
|
|
563
|
-
OWNER_EMAIL "$OWNER_EMAIL" \
|
|
564
644
|
ARCHIVE "$ARCHIVE" \
|
|
565
645
|
MAX_DIRTY "0" \
|
|
566
646
|
ADVISORY_CEILING "$ADV_CEILING" \
|
|
567
647
|
SEC_GITIGNORE_FAMILY "$SEC_GITIGNORE_FAMILY" \
|
|
568
648
|
SEC_BUILD_OUTPUT "$SEC_BUILD_OUTPUT" \
|
|
569
|
-
SEC_AUDIT_CMD "$SEC_AUDIT_CMD" \
|
|
570
|
-
SEC_AUDIT_MAX_AGE "$SEC_AUDIT_MAX_AGE" \
|
|
571
|
-
SEC_WAIVER_MAX_AGE "$SEC_WAIVER_MAX_AGE" \
|
|
572
649
|
SEC_WRITE_ROUTES "$SEC_WRITE_ROUTES" \
|
|
573
650
|
PERF_METRIC "$PERF_METRIC" \
|
|
574
651
|
PERF_CMD "$PERF_CMD" \
|
|
@@ -583,7 +660,6 @@ render_config() {
|
|
|
583
660
|
VERIFY_DOCTOR "" \
|
|
584
661
|
REFERENCE_MANIFEST "" \
|
|
585
662
|
QUARANTINE_ROOT "" \
|
|
586
|
-
LOOP_MAX_TURNS "$LOOP_MAX_TURNS" \
|
|
587
663
|
GATE1_NAME "$GATE1_NAME" \
|
|
588
664
|
GATE1_CMD "$GATE1_CMD" \
|
|
589
665
|
GATE2_NAME "$GATE2_RENDER_NAME" \
|
|
@@ -592,7 +668,7 @@ render_config() {
|
|
|
592
668
|
RATCHET_CMD "$RAT_CMD" \
|
|
593
669
|
RATCHET_CEILING "$RAT_CEIL" \
|
|
594
670
|
RUNTIME_DATA "$runtime" \
|
|
595
|
-
|
|
671
|
+
BANS_DISABLED "$BANS_DISABLED" \
|
|
596
672
|
BANS_EXEMPT "" \
|
|
597
673
|
LAYERS "$LAYERS_BLOCK" \
|
|
598
674
|
REPLAY_ENV "$REPLAY_ENV" \
|
|
@@ -639,14 +715,16 @@ fi
|
|
|
639
715
|
|
|
640
716
|
put ".gob/bin/goblin-verify" "$SRC/bin/goblin-verify"
|
|
641
717
|
put ".gob/bin/goblin-lib.sh" "$SRC/bin/goblin-lib.sh"
|
|
642
|
-
# The audit record is produced by a DELIBERATE, separate command - SC-07 reads the record and
|
|
643
|
-
# never the network (RISKS.md K4: no network at verify time).
|
|
644
|
-
put ".gob/bin/goblin-audit" "$SRC/bin/goblin-audit"
|
|
645
|
-
put ".gob/roles.yaml" "$SRC/roles.yaml"
|
|
646
718
|
put ".gob/manifest/enforcement.tsv" "$SRC/manifest/enforcement.tsv"
|
|
647
|
-
|
|
648
|
-
|
|
719
|
+
# The library (batch 2b-ii): the off-by-default rows, held next to the matrix so `gob verify
|
|
720
|
+
# --library` can list them and the summary can count them. Data, not a check: it ships whole
|
|
721
|
+
# or not at all with the manifest it is the complement of.
|
|
722
|
+
put ".gob/manifest/library.tsv" "$SRC/manifest/library.tsv"
|
|
649
723
|
put ".gob/manifest/glossary.tsv" "$SRC/manifest/glossary.tsv"
|
|
724
|
+
# The external-categories inventory (v3 §4.1): data-only, vendored and hash-pinned like
|
|
725
|
+
# every other manifest file. No gobstack code reads it — the reader is the agent following
|
|
726
|
+
# the init brief; the pin just makes the target's copy tamper-evident.
|
|
727
|
+
put ".gob/engine/categories.tsv" "$SRC/manifest/categories.tsv"
|
|
650
728
|
# The ban list (G5): the table, the engine, and the two probes. A ban with no mechanism is a
|
|
651
729
|
# wish, so the table and the engine install together or not at all.
|
|
652
730
|
put ".gob/manifest/bans.tsv" "$SRC/manifest/bans.tsv"
|
|
@@ -657,7 +735,7 @@ put ".gob/bans/layer-check.sh" "$SRC/bans/layer-check.sh"
|
|
|
657
735
|
# The AGENTS.md frontmatter: the body prose is rendered once (put_once), then the marker
|
|
658
736
|
# block is written into it through g_agents_write — the same path every later rewrite takes,
|
|
659
737
|
# so the block is never a second copy of the file and the body is never machine-owned.
|
|
660
|
-
render "$SRC/templates/AGENTS.md.tmpl"
|
|
738
|
+
render "$SRC/templates/AGENTS.md.tmpl" DATE "$STAMP" > "$TMP/agents-body"
|
|
661
739
|
put_once "AGENTS.md" "$TMP/agents-body"
|
|
662
740
|
if [ "$DRY_RUN" -eq 0 ] && [ -f "$CONFIG" ]; then
|
|
663
741
|
# The install-once contract for the project's own answers: on a RE-install (the previous
|
|
@@ -679,74 +757,83 @@ if [ "$DRY_RUN" -eq 0 ] && [ -f "$CONFIG" ]; then
|
|
|
679
757
|
g_agents_write "$CONFIG" < "$TMP/agents-block" >/dev/null \
|
|
680
758
|
|| { g_err "could not write the gob block into $CONFIG"; exit 1; }
|
|
681
759
|
fi
|
|
682
|
-
# The security lane's
|
|
683
|
-
#
|
|
684
|
-
[ -f "$SRC/templates/audit-waiver.tsv.tmpl" ] && put_once ".gob/audit-waiver.tsv" "$SRC/templates/audit-waiver.tsv.tmpl"
|
|
760
|
+
# The security lane's decision record is created once, then YOURS: it is an answer to a question
|
|
761
|
+
# only the project can answer (G4 B3).
|
|
685
762
|
[ -f "$SRC/templates/boundary-waivers.tmpl" ] && put_once ".gob/boundary-waivers" "$SRC/templates/boundary-waivers.tmpl"
|
|
686
|
-
[ -f "$SRC/templates/install-hooks.allowlist.tmpl" ] && put_once ".gob/install-hooks.allowlist" "$SRC/templates/install-hooks.allowlist.tmpl"
|
|
687
763
|
|
|
688
|
-
|
|
764
|
+
# the Hermes project tier (opt-in): --skills yes installs the FULL set under .hermes/skills/.
|
|
765
|
+
if [ "$SKILLS" = "yes" ] && part_wanted skills; then
|
|
689
766
|
for d in "$SRC"/skills/*/; do
|
|
690
|
-
[ -
|
|
767
|
+
[ -f "$d/SKILL.md" ] || continue
|
|
691
768
|
name=$(basename "$d")
|
|
692
769
|
put ".hermes/skills/$name/SKILL.md" "$d/SKILL.md"
|
|
693
770
|
done
|
|
694
771
|
fi
|
|
695
772
|
|
|
696
|
-
#
|
|
697
|
-
#
|
|
698
|
-
#
|
|
699
|
-
#
|
|
700
|
-
|
|
773
|
+
# The vendored procedure tier under .gob/skills/ — the SELECTED set (this mirrors the rule
|
|
774
|
+
# library: a default set on, the rest held back and selectable). Default (yes|no): the 5 core
|
|
775
|
+
# skills whose rows (SK-01/02/04) ride every install, so a default install never disables its
|
|
776
|
+
# own rows. `all`: every skill in the repo. A name list: exactly those (validated above). put:
|
|
777
|
+
# hash-checked, so IN-02/SK-02 see them like any other payload file, and installed.json covers
|
|
778
|
+
# EXACTLY this set — no more, no fewer.
|
|
779
|
+
VENDOR_SKILLS="$CORE_SKILLS"
|
|
780
|
+
case "$SKILLS" in
|
|
781
|
+
all) VENDOR_SKILLS=$(skill_names | tr '\n' ' ') ;;
|
|
782
|
+
yes|no) VENDOR_SKILLS="$CORE_SKILLS" ;;
|
|
783
|
+
*) VENDOR_SKILLS=$(printf '%s' "$SKILLS" | tr ',' ' ') ;;
|
|
784
|
+
esac
|
|
785
|
+
for name in $VENDOR_SKILLS; do
|
|
786
|
+
[ -f "$SRC/skills/$name/SKILL.md" ] || continue
|
|
787
|
+
put ".gob/skills/$name/SKILL.md" "$SRC/skills/$name/SKILL.md"
|
|
788
|
+
done
|
|
789
|
+
|
|
790
|
+
# no more, no fewer: remove any RECORDED skill file the new selection no longer covers, so
|
|
791
|
+
# installed.json (and SK-02) covers exactly the vendored set. Both cases read the previous
|
|
792
|
+
# record, so exactly what was installed is what goes:
|
|
793
|
+
# * .hermes/skills/* goes when the Hermes tier is no longer selected (SKILLS != yes);
|
|
794
|
+
# * .gob/skills/<name>/* goes when <name> left the vendored set (e.g. all -> no shrinks 5 -> 5).
|
|
795
|
+
# Empty directories left behind are pruned (deepest first).
|
|
796
|
+
if [ -n "$PREV_FILES" ]; then
|
|
701
797
|
while IFS= read -r rel; do
|
|
702
|
-
case "$rel" in
|
|
798
|
+
case "$rel" in
|
|
799
|
+
.hermes/skills/*) [ "$SKILLS" = "yes" ] && continue ;;
|
|
800
|
+
.gob/skills/*)
|
|
801
|
+
sname=${rel#.gob/skills/}; sname=${sname%%/*}
|
|
802
|
+
case " $VENDOR_SKILLS " in *" $sname "*) continue ;; esac ;;
|
|
803
|
+
*) continue ;;
|
|
804
|
+
esac
|
|
703
805
|
dst="$TARGET/$rel"
|
|
704
|
-
[ -f "$dst" ] ||
|
|
806
|
+
[ -f "$dst" ] || continue
|
|
705
807
|
if [ "$DRY_RUN" -eq 1 ]; then
|
|
706
|
-
g_info "plan: remove $rel (
|
|
808
|
+
g_info "plan: remove $rel (no longer selected)"
|
|
707
809
|
else
|
|
708
810
|
rm -f "$dst"
|
|
709
|
-
g_info "removed $rel (
|
|
811
|
+
g_info "removed $rel (no longer selected)"
|
|
710
812
|
fi
|
|
711
813
|
done <<EOF
|
|
712
814
|
$PREV_FILES
|
|
713
815
|
EOF
|
|
714
|
-
# the emptied .hermes/skills/*/<name> and .hermes/ directories go too (deepest first)
|
|
715
816
|
if [ "$DRY_RUN" -eq 0 ]; then
|
|
716
|
-
find "$TARGET/.hermes" -depth -type d -exec rmdir {} + 2>/dev/null
|
|
717
|
-
fi
|
|
718
|
-
fi
|
|
719
|
-
|
|
720
|
-
# The automation producers. They land in the target so the target is self-contained and
|
|
721
|
-
# IN-02/SK-02 hash them like every other installed file; the cron copy step then reads from
|
|
722
|
-
# here (see the "next:" block and automations/README.md).
|
|
723
|
-
if [ "$PLAYBOOKS_ON" -eq 1 ] && part_wanted playbooks; then
|
|
724
|
-
for f in "$SRC"/automations/drift-audit.sh "$SRC"/automations/bugreporter-intake.sh \
|
|
725
|
-
"$SRC"/automations/README.md "$SRC"/automations/report.schema.tsv; do
|
|
726
|
-
[ -f "$f" ] || continue
|
|
727
|
-
put ".gob/automations/$(basename "$f")" "$f"
|
|
728
|
-
done
|
|
729
|
-
if [ -f "$SRC/templates/report.yaml.tmpl" ]; then
|
|
730
|
-
put ".gob/automations/report.yaml.tmpl" "$SRC/templates/report.yaml.tmpl"
|
|
817
|
+
find "$TARGET/.hermes" "$TARGET/.gob/skills" -depth -type d -exec rmdir {} + 2>/dev/null
|
|
731
818
|
fi
|
|
732
819
|
fi
|
|
733
820
|
|
|
734
821
|
if [ "$WANT_SPEC" -eq 1 ] && part_wanted spec; then
|
|
735
|
-
render "$SRC/templates/SPEC.md.tmpl"
|
|
822
|
+
render "$SRC/templates/SPEC.md.tmpl" DATE "$STAMP" > "$TMP/spec"
|
|
736
823
|
put_once "ROUND-000-SPEC.md" "$TMP/spec"
|
|
737
824
|
fi
|
|
738
825
|
if [ "$ARCHIVE" != "true" ] && part_wanted handoff; then
|
|
739
826
|
# The HANDOFF names the gate the way GT-02 runs it: by the command's own name key
|
|
740
827
|
# (gate_<name>_cmd), so HP-03 anchors on a declared name even when --gate replaced the
|
|
741
|
-
#
|
|
742
|
-
#
|
|
743
|
-
#
|
|
828
|
+
# default command. GATE2_LINE renders the second gate (if any) the same way — a Gates
|
|
829
|
+
# section that names only gate 1 while AGENTS.md declares two is the HP-03 day-one
|
|
830
|
+
# anchoring red. With no second gate an empty line is rendered.
|
|
744
831
|
if [ -n "$GATE2_NAME" ]; then
|
|
745
832
|
GATE2_LINE="- \`$GATE2_NAME\` = 0 · measured $STAMP"
|
|
746
833
|
else
|
|
747
834
|
GATE2_LINE=""
|
|
748
835
|
fi
|
|
749
|
-
render "$SRC/templates/HANDOFF.md.tmpl"
|
|
836
|
+
render "$SRC/templates/HANDOFF.md.tmpl" DATE "$STAMP" HEAD "$HEAD_SHORT" GATE_NAME "$GATE_NAME" GATE_CMD "$GATE_CMD" GATE2_LINE "$GATE2_LINE" > "$TMP/handoff"
|
|
750
837
|
put_once "HANDOFF.md" "$TMP/handoff"
|
|
751
838
|
fi
|
|
752
839
|
|
|
@@ -795,7 +882,6 @@ fi
|
|
|
795
882
|
printf '{\n'
|
|
796
883
|
printf ' "version": "%s",\n' "$VERSION"
|
|
797
884
|
printf ' "source_sha": "%s",\n' "$( cd "$SRC" && git rev-parse HEAD 2>/dev/null || echo unknown )"
|
|
798
|
-
printf ' "class": "%s",\n' "$CLASS"
|
|
799
885
|
printf ' "installed_at": "%s",\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
800
886
|
printf ' "options": {"skills": "%s", "archive": %s, "parts": "%s"},\n' "$SKILLS" "$ARCHIVE" "${PARTS:-all}"
|
|
801
887
|
printf ' "files": {\n'
|
|
@@ -845,29 +931,20 @@ if [ "$DRY_RUN" -eq 0 ]; then
|
|
|
845
931
|
g_info "recorded opt-out: $OPT_OUT"
|
|
846
932
|
fi
|
|
847
933
|
g_info ""
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
g_info " 4. hermes skills trust $TARGET # one-time, so the project-tier skills load"
|
|
854
|
-
else
|
|
855
|
-
g_info " 4. agent skills are opt-in: gob emit --platform <p> # run gob doctor for the platform list"
|
|
934
|
+
# ONE ordered next-steps list, shared with `gob init` (g_next_block, bin/goblin-lib.sh), and
|
|
935
|
+
# every line true of the artefact. When `gob init --write` ran this install it defers the block
|
|
936
|
+
# (GOB_NEXT_DEFER) and prints the same list itself at the end, so a user never sees two lists.
|
|
937
|
+
if [ "${GOB_NEXT_DEFER:-0}" != "1" ]; then
|
|
938
|
+
g_next_block "$TARGET" "$SKILLS" "$GATE_LABEL"
|
|
856
939
|
fi
|
|
857
940
|
g_info ""
|
|
858
|
-
g_info "automations (optional; neither writes outside this repo, and A-02 has no agent in it):"
|
|
859
|
-
g_info " bash $TARGET/.gob/automations/drift-audit.sh --dry-run # read the record first"
|
|
860
|
-
g_info " cp $TARGET/.gob/automations/drift-audit.sh ~/.hermes/scripts/"
|
|
861
|
-
g_info " hermes cron create \"0 9 * * 1\" --name \"Drift audit - weekly\" --no-agent \\"
|
|
862
|
-
g_info " --script drift-audit.sh --deliver <channel>"
|
|
863
|
-
g_info " P13/P14 in docs/FLOWS.md; the whole model in automations/README.md"
|
|
864
941
|
else
|
|
865
942
|
g_info "dry-run: created $CREATED · updated $UPDATED · unchanged $UNCHANGED · skipped $SKIPPED"
|
|
866
943
|
fi
|
|
867
944
|
|
|
868
945
|
if [ -n "$REFUSED_PATHS" ]; then
|
|
869
|
-
g_info "refused to overwrite:$REFUSED_PATHS (kept - reconcile it: docs/
|
|
870
|
-
# Documented contract (docs/
|
|
946
|
+
g_info "refused to overwrite:$REFUSED_PATHS (kept - reconcile it: docs/GUIDE.md; --force would destroy it)"
|
|
947
|
+
# Documented contract (docs/GUIDE.md, this file's header): exit 1 is "a refusal, with
|
|
871
948
|
# the path and the fix". A wrapper has to be able to detect it (D2).
|
|
872
949
|
exit 1
|
|
873
950
|
fi
|