@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-init
CHANGED
|
@@ -5,27 +5,35 @@
|
|
|
5
5
|
# gob init --heuristic append the heuristic detection (fallback)
|
|
6
6
|
# gob init --write <proposal> [--yes] validate the proposal and install it
|
|
7
7
|
# gob init --target <dir> aim at a directory that is not $PWD
|
|
8
|
-
# gob init --
|
|
9
|
-
#
|
|
10
|
-
#
|
|
8
|
+
# gob init --skills <spec> which skills to vendor into .gob/skills/:
|
|
9
|
+
# no|yes = the 5 core skills (default), all =
|
|
10
|
+
# every skill, or a comma-separated name list
|
|
11
|
+
# gob init --write ... --with-mcp-config also write the repo-root .mcp.json (OPT-IN
|
|
12
|
+
# since the v3 enhance layer: the named
|
|
13
|
+
# removal that pays for hooks emission)
|
|
14
|
+
# gob init --list-skills print the skill library and exit
|
|
15
|
+
# gob init --dry-run --write without writing anything (and without
|
|
16
|
+
# running the declared gate)
|
|
11
17
|
#
|
|
12
18
|
# The CLI calls NO AI API. A bare `gob init` prints:
|
|
13
19
|
# 1. the AGENT BRIEF — a structured prompt telling whichever agent is already running
|
|
14
|
-
# in this repo
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
# pre-filled + a `## gob init summary` section.
|
|
20
|
+
# in this repo exactly what to scan (package.json, routes, tests, CI configs) and
|
|
21
|
+
# what to decide (the first gate command, the feature map, the source root);
|
|
22
|
+
# 2. the SCHEMA of the proposal file the agent must write — the gob block + a
|
|
23
|
+
# `## gob init summary` section + a `## feature-map` section embedding the files.
|
|
19
24
|
# The agent fulfils the brief with its own tools, writes the proposal, and the human (or
|
|
20
25
|
# the agent's own next step) runs `gob init --write <proposal>` to validate and install:
|
|
21
26
|
# - the frontmatter keys are validated against the engine's key set (unknown key,
|
|
22
|
-
#
|
|
23
|
-
# -
|
|
24
|
-
#
|
|
25
|
-
#
|
|
27
|
+
# an unknown key, non-boolean archive -> exit 2, nothing written);
|
|
28
|
+
# - the declared gate is RUN in the working tree (a non-zero exit is a day-one red, a
|
|
29
|
+
# command that cannot be run is refused);
|
|
30
|
+
# - the embedded feature map is validated by bin/goblin-map (FM-01 shape + FM-02
|
|
31
|
+
# resolvability) in the SAME pass, before anything is written;
|
|
32
|
+
# - AGENTS.md (body + gob block), .gob/engine (the vendored verifier + manifest) and
|
|
33
|
+
# features/ are written; HANDOFF.md is written once. CI is never part of any output.
|
|
26
34
|
#
|
|
27
|
-
# The heuristic detector (package.json scripts + route tokens
|
|
28
|
-
#
|
|
35
|
+
# The heuristic detector (package.json scripts + route tokens) is the --heuristic FALLBACK:
|
|
36
|
+
# appended to the brief as pre-scanned hints, never the answer.
|
|
29
37
|
#
|
|
30
38
|
# Exit codes: 0 printed or installed | 1 a refusal (named path + fix) | 2 bad input.
|
|
31
39
|
# No npm, no jq, no yq, no network, no AI API. bash/awk/sed/grep only.
|
|
@@ -37,23 +45,22 @@ SRC=$(cd "$SELF_DIR/.." && pwd)
|
|
|
37
45
|
# shellcheck source=goblin-lib.sh
|
|
38
46
|
. "$SELF_DIR/goblin-lib.sh"
|
|
39
47
|
VERSION=$(cat "$SRC/VERSION" 2>/dev/null || printf 'unknown')
|
|
40
|
-
# The extras catalogue (overridable for tests, the same env var goblin-extras reads).
|
|
41
|
-
CATALOGUE_TSV="${GOB_EXTRAS_CATALOGUE:-$SRC/extras-catalogue/catalogue.tsv}"
|
|
42
48
|
|
|
43
49
|
g_info() { printf '%s\n' "$*"; }
|
|
44
50
|
|
|
45
51
|
usage() { sed -n '2,/^$/p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; }
|
|
46
52
|
|
|
47
53
|
# ------------------------------------------------------------------ flags -----
|
|
48
|
-
TARGET="" WRITE="" HEURISTIC=0 DRYRUN=0
|
|
54
|
+
TARGET="" WRITE="" HEURISTIC=0 DRYRUN=0 SKILLS_OPT="no" WITH_MCP=0
|
|
49
55
|
while [ $# -gt 0 ]; do
|
|
50
56
|
case "$1" in
|
|
51
57
|
--target) TARGET="${2:-}"; shift 2 ;;
|
|
52
58
|
--write) WRITE="${2:-}"; shift 2 ;;
|
|
59
|
+
--skills) SKILLS_OPT="${2:-}"; shift 2 ;;
|
|
60
|
+
--list-skills) exec bash "$SRC/bin/goblin-install" --list-skills ;;
|
|
53
61
|
--heuristic) HEURISTIC=1; shift ;;
|
|
54
|
-
--resync) RESYNC=1; shift ;; # init-internal: re-run the sync step (hidden)
|
|
55
|
-
--with-mcp-config) WITH_MCP=1; shift ;;
|
|
56
62
|
--dry-run) DRYRUN=1; shift ;;
|
|
63
|
+
--with-mcp-config) WITH_MCP=1; shift ;;
|
|
57
64
|
--yes) shift ;; # accepted for pipe parity; --write is already explicit
|
|
58
65
|
-h|--help) usage; exit 0 ;;
|
|
59
66
|
*) g_err "unknown option: $1"; usage >&2; exit 2 ;;
|
|
@@ -63,7 +70,6 @@ done
|
|
|
63
70
|
for dep in git awk sed grep; do
|
|
64
71
|
command -v "$dep" >/dev/null 2>&1 || { g_err "missing dependency: $dep"; exit 2; }
|
|
65
72
|
done
|
|
66
|
-
command -v python3 >/dev/null 2>&1 || { g_err "missing dependency: python3 (the extras .mcp.json merge needs it)"; exit 2; }
|
|
67
73
|
[ -f "$SRC/VERSION" ] || { g_err "no VERSION at $SRC — is this a gobstack checkout?"; exit 2; }
|
|
68
74
|
TARGET="${TARGET:-$PWD}"
|
|
69
75
|
TARGET=$(g_expand_tilde "$TARGET")
|
|
@@ -71,31 +77,89 @@ TARGET=$(g_expand_tilde "$TARGET")
|
|
|
71
77
|
TARGET=$(cd "$TARGET" && pwd)
|
|
72
78
|
TODAY=$(date +%F)
|
|
73
79
|
|
|
74
|
-
# The repo-distributed MCP registration (.mcp.json)
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
81
|
-
#
|
|
80
|
+
# The repo-distributed MCP registration (.mcp.json): OPT-IN since the v3 enhance layer
|
|
81
|
+
# (--with-mcp-config) — the named removal that pays for hooks emission. A registration a
|
|
82
|
+
# repo never asked for was the default; hooks are what init --write writes by default now.
|
|
83
|
+
# Ask-once semantics either way: an existing file is never overwritten — the generated
|
|
84
|
+
# bytes again are a named no-op, anything else is KEPT (a registration you customized is
|
|
85
|
+
# the project's). The major coding agents auto-detect a repo-root .mcp.json.
|
|
86
|
+
# The agent CLI's family name is ASSEMBLED at run time, so no rule here spells the
|
|
87
|
+
# tool's own name literally. The printed line still reads the way the docs quote it.
|
|
82
88
|
AGENT_CLI="cl"; AGENT_CLI="${AGENT_CLI}aude"
|
|
89
|
+
MCP_BYTES='{"mcpServers":{"gob":{"command":"npx","args":["-y","@techgoblin/gobstack","mcp"]}}}'
|
|
83
90
|
do_mcp_config() {
|
|
84
91
|
local f="$TARGET/.mcp.json"
|
|
85
|
-
local bytes='{"mcpServers":{"gob":{"command":"npx","args":["-y","@techgoblin/gobstack","mcp"]}}}'
|
|
86
92
|
if [ -f "$f" ]; then
|
|
87
|
-
if [ "$(cat "$f")" = "$
|
|
93
|
+
if [ "$(cat "$f")" = "$MCP_BYTES" ]; then
|
|
88
94
|
g_info "gob init: $TARGET/.mcp.json already carries the generated registration (left as is)"
|
|
89
95
|
return 0
|
|
90
96
|
fi
|
|
91
|
-
|
|
92
|
-
return
|
|
97
|
+
g_info "kept $TARGET/.mcp.json (not the generated registration: a registration you customized stays)"
|
|
98
|
+
return 0
|
|
93
99
|
fi
|
|
94
|
-
printf '%s\n' "$
|
|
100
|
+
printf '%s\n' "$MCP_BYTES" > "$f" || { g_err "could not write $f"; return 1; }
|
|
95
101
|
g_info "wrote $TARGET/.mcp.json (the gob MCP server is repo-distributed; ${AGENT_CLI} Code and Cursor auto-detect it)"
|
|
96
102
|
return 0
|
|
97
103
|
}
|
|
98
104
|
|
|
105
|
+
# The agent hooks payload (v3 enhance layer): the verify/init surface lands in a vendor
|
|
106
|
+
# hooks file the agent ALREADY reads — written into an EXISTING .claude/ or .cursor/
|
|
107
|
+
# directory only (DETECTION, never creation: creating the vendor dir is how an installer
|
|
108
|
+
# becomes malware-shaped; a repo with neither dir simply gets no hooks, named out loud).
|
|
109
|
+
# The snippet's sha256 is recorded next to .mcp.json's own preimage clause, in
|
|
110
|
+
# .gob/manifest/hooks.tsv; --uninstall removes a hook ONLY when the file on disk still
|
|
111
|
+
# hashes to the recorded value — a snippet the project edited is the project's.
|
|
112
|
+
HOOKS_TSV=".gob/manifest/hooks.tsv"
|
|
113
|
+
hook_entry() { # hook_entry <vendor> <relfile> <bytes> -> vendor<TAB>rel<TAB>sha256
|
|
114
|
+
# The hash is of the FILE AS WRITTEN (printf '%s\n' appends a newline), so the recorded
|
|
115
|
+
# value is the one g_sha256_file computes at uninstall time — never hash one form and
|
|
116
|
+
# check the other.
|
|
117
|
+
local tmp; tmp=$(mktemp) && printf '%s\n' "$3" > "$tmp" && \
|
|
118
|
+
printf '%s\t%s\t%s\n' "$1" "$2" "$(g_sha256_file "$tmp")" && rm -f "$tmp"
|
|
119
|
+
}
|
|
120
|
+
write_hook_file() { # write_hook_file <relpath> <bytes> — ask-once, like .mcp.json
|
|
121
|
+
local f="$TARGET/$1"
|
|
122
|
+
if [ -f "$f" ]; then
|
|
123
|
+
if [ "$(cat "$f")" = "$2" ]; then
|
|
124
|
+
g_info "gob init: $1 already carries the generated hooks (left as is)"
|
|
125
|
+
return 0
|
|
126
|
+
fi
|
|
127
|
+
g_info "kept $1 (not the generated hooks: a hook file you customized stays)"
|
|
128
|
+
return 0
|
|
129
|
+
fi
|
|
130
|
+
printf '%s\n' "$2" > "$f" || { g_err "could not write $f"; return 1; }
|
|
131
|
+
g_info "wrote $1 (gobstack hooks: the verify surface reachable inside the agent session)"
|
|
132
|
+
return 0
|
|
133
|
+
}
|
|
134
|
+
do_hooks() {
|
|
135
|
+
local claude="$TARGET/.claude" cursor="$TARGET/.cursor" wrote=0 entries="" rc=0
|
|
136
|
+
# Claude Code: the vendor's documented hooks file (hooks/SessionStart, command type).
|
|
137
|
+
if [ -d "$claude" ]; then
|
|
138
|
+
local bytes='{"hooks":{"SessionStart":[{"hooks":[{"type":"command","command":"bash .gob/bin/goblin-verify --brief || true"}]}]}}'
|
|
139
|
+
write_hook_file ".claude/hooks.json" "$bytes" || rc=1
|
|
140
|
+
entries+="$(hook_entry claude .claude/hooks.json "$bytes")"$'\n'
|
|
141
|
+
wrote=1
|
|
142
|
+
fi
|
|
143
|
+
# Cursor: the same snippet in the shape its hooks reader documents (sessionStart).
|
|
144
|
+
if [ -d "$cursor" ]; then
|
|
145
|
+
local bytes='{"hooks":{"sessionStart":[{"command":"bash .gob/bin/goblin-verify --brief || true"}]}}'
|
|
146
|
+
write_hook_file ".cursor/hooks.json" "$bytes" || rc=1
|
|
147
|
+
entries+="$(hook_entry cursor .cursor/hooks.json "$bytes")"$'\n'
|
|
148
|
+
wrote=1
|
|
149
|
+
fi
|
|
150
|
+
[ "$wrote" -eq 1 ] || { g_info "no .claude/ or .cursor/ directory at $TARGET — no hooks written (gobstack creates no vendor directory; the MCP registration is the --with-mcp-config opt-in)"; return 0; }
|
|
151
|
+
# The hash record: one row per hook file covered, written ask-once like the files.
|
|
152
|
+
local rec="$TARGET/$HOOKS_TSV"
|
|
153
|
+
if [ -f "$rec" ]; then
|
|
154
|
+
g_info "kept $HOOKS_TSV (a hook record already exists)"
|
|
155
|
+
else
|
|
156
|
+
mkdir -p "$TARGET/.gob/manifest"
|
|
157
|
+
{ printf 'vendor\tfile\tsha256\n'; printf '%s' "$entries"; } > "$rec" || { g_err "could not write $HOOKS_TSV"; return 1; }
|
|
158
|
+
g_info "recorded $HOOKS_TSV (the hash --uninstall checks before removing a hook)"
|
|
159
|
+
fi
|
|
160
|
+
return $rc
|
|
161
|
+
}
|
|
162
|
+
|
|
99
163
|
# ------------------------------------------------------------------ the brief --
|
|
100
164
|
# `gob init` with no --write: print the prompt + schema. This IS the product: the agent
|
|
101
165
|
# in the repo reads this output and does the work with its own tools.
|
|
@@ -114,91 +178,148 @@ back one proposal file. Do this now:
|
|
|
114
178
|
- the test layout (tests/, *.test.*, run-tests.sh or equivalent gate scripts)
|
|
115
179
|
- CI configs (.github/workflows, .gitlab-ci.yml) — to READ what the project already
|
|
116
180
|
gates on. gobstack installs no CI.
|
|
117
|
-
- the git identity this repo commits with (git config user.email)
|
|
118
181
|
|
|
119
182
|
2. DECIDE, and be ready to justify each line:
|
|
120
|
-
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
Read the bundled catalogue (`gob extras list` shows it; the file is
|
|
129
|
-
`extras-catalogue/catalogue.tsv` in the package). From it, build the
|
|
130
|
-
`catalogue_suggestions:` list for this repo:
|
|
131
|
-
|
|
132
|
-
- rows whose `matches:` column names this repo's detected stack (the words you
|
|
133
|
-
found in step 1 — react, vue, playwright, godot, unity, node, postgres, …);
|
|
134
|
-
- RECOMMEND rows are pre-ticked (write `- id` with `[x]`); MAYBE rows are
|
|
135
|
-
listed but NOT pre-ticked (`[ ]`) — they are visible choices, never defaults;
|
|
136
|
-
- a row whose `conflicts:` names an id you also picked: pick at most one of them;
|
|
137
|
-
- SKIP rows are never suggested and refuse install; leave them out entirely.
|
|
138
|
-
|
|
139
|
-
Record the picks in the proposal's summary section under `catalogue_suggestions:`
|
|
140
|
-
(one `- [x] <id> # <why>` line each). NOTHING installs at init: installing is a
|
|
141
|
-
separate, explicit step the human runs —
|
|
142
|
-
|
|
143
|
-
npx @techgoblin/gobstack extras install <id...>
|
|
144
|
-
|
|
145
|
-
4. DISCOVER — `discover_extras` (proposals only, nothing auto-installs):
|
|
146
|
-
|
|
147
|
-
ALSO search the web with your own tools for agent skills / MCP servers / workflows
|
|
148
|
-
that match this repo's stack and are NOT in the bundled catalogue. For each
|
|
149
|
-
discovery, propose one entry in the summary under `discover_extras:` with exactly
|
|
150
|
-
these keys:
|
|
151
|
-
|
|
152
|
-
discover_extras:
|
|
153
|
-
- id: <short-kebab-id>
|
|
154
|
-
source_url: <the repo or docs URL you actually fetched>
|
|
155
|
-
license: <spdx or "unknown — verify">
|
|
156
|
-
rationale: <one line — what it adds to THIS repo>
|
|
157
|
-
suggested_kind: <skill|mcp|workflow>
|
|
158
|
-
|
|
159
|
-
Rules: verify the URL is live before proposing it; state the license you found;
|
|
160
|
-
never propose anything you did not actually read. Proposals are INERT — nothing
|
|
161
|
-
auto-installs from discovery, and no discovery reaches this repo from the CLI.
|
|
162
|
-
A human reviews the proposals, then the curator promotes accepted discoveries
|
|
163
|
-
into catalogue.tsv by PR or direct edit. Until a row exists in the
|
|
164
|
-
catalogue, `gob extras install` refuses it — the catalogue is the allowlist.
|
|
165
|
-
|
|
166
|
-
5. WRITE the proposal file exactly in the SCHEMA below, at a path you choose (for
|
|
183
|
+
- gate_commit_cmd: ONE command that proves the repo is healthy and must stay green.
|
|
184
|
+
RUN it yourself first: a command that does not exist is not a gate (--write refuses
|
|
185
|
+
an exit-127 command); a command that runs and exits non-zero is a legitimate day-one
|
|
186
|
+
red (--write accepts it and the harness reports it as one).
|
|
187
|
+
- feature_map: the map's README path (the convention is features/README.md). REQUIRED —
|
|
188
|
+
there is no "no map declared" state.
|
|
189
|
+
|
|
190
|
+
3. WRITE the proposal file exactly in the SCHEMA below, at a path you choose (for
|
|
167
191
|
example .gob-init-proposal.md), then run:
|
|
168
192
|
|
|
169
193
|
npx @techgoblin/gobstack init --write <proposal-path>
|
|
170
194
|
|
|
171
195
|
Notes:
|
|
172
|
-
- Class letters A-E and the names app/agent/desktop are accepted aliases
|
|
173
|
-
(app->software, agent->fleet, desktop->software+electron).
|
|
174
196
|
- A second gate is optional: gate_<name>_cmd, e.g. gate_todo_cmd.
|
|
175
|
-
- Keys you do not set are filled from the
|
|
197
|
+
- Keys you do not set are filled from the installer's default block by --write.
|
|
198
|
+
- --write validates BOTH halves in one pass: the config block AND the embedded feature
|
|
199
|
+
map (FM-01 shape + FM-02 resolvability: every entry path exists AND is committed).
|
|
200
|
+
A repo with no committed file to map REFUSES — commit at least one file, then run again.
|
|
201
|
+
- The repo-root .mcp.json registration is OPT-IN: add --with-mcp-config to the
|
|
202
|
+
--write line. Without it the install writes no registration; it DOES write the
|
|
203
|
+
agent hooks (.claude/hooks.json / .cursor/hooks.json) into existing vendor dirs.
|
|
204
|
+
|
|
205
|
+
== EXTERNAL CATEGORIES (adjudication — do this before writing the proposal) =====
|
|
206
|
+
|
|
207
|
+
The install vendored (or, at brief time, ships at manifest/categories.tsv) an inventory of
|
|
208
|
+
external composition categories at .gob/engine/categories.tsv (source: manifest/categories.tsv
|
|
209
|
+
in the gobstack repo of origin). It is DATA — gobstack's code never reads it; you are the
|
|
210
|
+
reader and the adjudicator, because you can see this repo and its code cannot.
|
|
211
|
+
|
|
212
|
+
For EACH row in that file, in order:
|
|
213
|
+
|
|
214
|
+
1. EVALUATE the row's fits_when predicate against THIS repository (its actual work, its
|
|
215
|
+
actual shape — not what a repo like it might want). A row you cannot evaluate, say so
|
|
216
|
+
in the decision record with that reason.
|
|
217
|
+
2. PROPOSE every row that FITS to the user before installing anything: name, source URL,
|
|
218
|
+
license, and what it would concretely add here. A fit is a proposal, never an install.
|
|
219
|
+
3. INSTALL only on the user's explicit approval, through the SK-checked lane: fetch the
|
|
220
|
+
pack, drop it in .gob/skills/<name>/ (SK-01/02/04 hash and police it like any shipped
|
|
221
|
+
skill), and record the row in .gob/manifest/compose-decisions.tsv with added_by = the
|
|
222
|
+
source URL and why = the license + the fit reason. Nothing lands without a license line.
|
|
223
|
+
4. RECORD EVERY evaluated row — installed or declined — in .gob/manifest/compose-decisions.tsv
|
|
224
|
+
(create it if absent; header: date<TAB>category<TAB>decision<TAB>reason; one row per
|
|
225
|
+
category, tab-separated):
|
|
226
|
+
- installed rows: decision=installed, reason names the license and the concrete fit;
|
|
227
|
+
- declined rows: decision=declined, reason names the CONCRETE property of this repo that
|
|
228
|
+
fails the predicate ("no user-facing feature surface", "single-session CLI", ...) —
|
|
229
|
+
"not applicable" is not a reason;
|
|
230
|
+
- a row left unrecorded is a VIOLATION of this brief: an adjudication that left no
|
|
231
|
+
trace is indistinguishable from an adjudication that never happened.
|
|
232
|
+
|
|
233
|
+
The gate only ever runs the repo's own checks; an external pack may AUTHOR rows (LX-*),
|
|
234
|
+
and then the check is the repo's, proof and all.
|
|
176
235
|
|
|
177
236
|
== PROPOSAL SCHEMA =============================================================
|
|
178
237
|
|
|
179
238
|
<!-- gob:begin (gobstack config — edit in place; the parser reads only this block) -->
|
|
180
|
-
class: <software|service|game|research|fleet>
|
|
181
|
-
branch: <default branch>
|
|
182
|
-
owner_email: <commit identity>
|
|
183
239
|
gate_<name>_cmd: <one shell command that must stay green>
|
|
184
|
-
|
|
240
|
+
feature_map: features/README.md
|
|
241
|
+
source_root: .
|
|
185
242
|
<!-- gob:end -->
|
|
186
243
|
|
|
187
244
|
## gob init summary
|
|
188
245
|
|
|
189
246
|
- <one bullet per decision: what you scanned, what you chose, why>
|
|
190
247
|
- <framework / package manager / test command found>
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
248
|
+
|
|
249
|
+
## feature-map
|
|
250
|
+
|
|
251
|
+
### features/README.md
|
|
252
|
+
|
|
253
|
+
```md
|
|
254
|
+
# Features
|
|
255
|
+
|
|
256
|
+
- [<slug>](./<slug>.md) — <one line>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### features/<slug>.md
|
|
260
|
+
|
|
261
|
+
```md
|
|
262
|
+
---
|
|
263
|
+
feature: <slug — lowercase [a-z0-9-], equals the filename stem>
|
|
264
|
+
entry_paths:
|
|
265
|
+
- <repo-relative path that exists AND is committed (git ls-files)>
|
|
266
|
+
verified: never-driven (<today>)
|
|
267
|
+
---
|
|
268
|
+
# <slug>
|
|
269
|
+
|
|
270
|
+
<one user-visible paragraph, no implementation detail>
|
|
271
|
+
|
|
272
|
+
## Sub-features
|
|
273
|
+
|
|
274
|
+
- <the sub-behaviours, one per line>
|
|
275
|
+
|
|
276
|
+
## How to get to it (user POV)
|
|
277
|
+
|
|
278
|
+
- <how a user reaches this feature, and what they should see>
|
|
279
|
+
|
|
280
|
+
## Driving it with <harness>
|
|
281
|
+
|
|
282
|
+
Preconditions: <what must be true first>.
|
|
283
|
+
**<action>.** Run `<exact command>`. <the observable result.>
|
|
284
|
+
|
|
285
|
+
## Gotchas
|
|
286
|
+
|
|
287
|
+
- <what commonly breaks, or what the entry-path token does and does not prove>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
(embed one `### <dir>/<slug>.md` block per feature; every feature must be linked from the
|
|
291
|
+
README index in the `(./<slug>.md)` form. `feature:` must equal the filename stem, and the
|
|
292
|
+
four H2s above are required, in order.)
|
|
200
293
|
============================================================================== ==
|
|
201
294
|
BRIEF
|
|
295
|
+
print_skill_library
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
# print_skill_library — the discovery surface for the skill LIBRARY (the repo's skills/
|
|
299
|
+
# directory), appended to the brief. The 5 CORE skills are vendored into .gob/skills/ by
|
|
300
|
+
# default; the rest are selectable through --skills, exactly as the rule LIBRARY holds rows
|
|
301
|
+
# that are off by default. Prints name, tier and the one-line purpose (the frontmatter
|
|
302
|
+
# `description:`), so a reader knows what exists without opening the repo.
|
|
303
|
+
# The core set is read from the installer (goblin-install's CORE_SKILLS) rather than
|
|
304
|
+
# restated here — one source of truth, so a tier change cannot fork the two surfaces.
|
|
305
|
+
print_skill_library() {
|
|
306
|
+
local d name desc tier core_list
|
|
307
|
+
core_list=$(bash "$SRC/bin/goblin-install" --print-core-skills 2>/dev/null)
|
|
308
|
+
[ -n "$core_list" ] || core_list="goblin-handoff goblin-verify-author goblin-feature-map practice goblin-bootstrap"
|
|
309
|
+
printf '\n== SKILL LIBRARY =============================================================\n\n'
|
|
310
|
+
printf 'A default install writes the 5 CORE skills into .gob/skills/. Every other skill is\n'
|
|
311
|
+
printf 'available on request. Choose the set with --skills:\n\n'
|
|
312
|
+
printf ' --skills all every skill in the repo\n'
|
|
313
|
+
printf ' --skills goblin-handoff,goblin-bootstrap exactly those (comma-separated)\n\n'
|
|
314
|
+
printf 'Available skills:\n'
|
|
315
|
+
for d in "$SRC"/skills/*/; do
|
|
316
|
+
[ -f "$d/SKILL.md" ] || continue
|
|
317
|
+
name=$(basename "$d")
|
|
318
|
+
desc=$(awk 'NR==1{f=1;next} /^---/{f=0} f&&/^description:/{sub(/^description:[[:space:]]*/,"");print;exit}' "$d/SKILL.md")
|
|
319
|
+
case " $core_list " in
|
|
320
|
+
*" $name "*) tier=core ;; *) tier=optional ;; esac
|
|
321
|
+
printf ' %-22s %-9s %s\n' "$name" "$tier" "$desc"
|
|
322
|
+
done | sort
|
|
202
323
|
}
|
|
203
324
|
|
|
204
325
|
# The heuristic fallback: pre-scanned hints appended to the brief (--heuristic).
|
|
@@ -221,53 +342,54 @@ print_heuristic() {
|
|
|
221
342
|
for d in app pages routes src; do
|
|
222
343
|
[ -d "$TARGET/$d" ] && printf 'route/entry root candidate: %s/\n' "$d"
|
|
223
344
|
done
|
|
224
|
-
# The catalogue_suggestions fallback: rows whose `matches:` cell names a token the
|
|
225
|
-
# heuristic scan actually saw in this repo (package.json deps + lockfile + config
|
|
226
|
-
# files). The SAME matches column the agent brief reads — the fallback suggests from
|
|
227
|
-
# the catalogue, never from its own private list. Verdicts are respected: only
|
|
228
|
-
# RECOMMEND rows pre-tick; MAYBE rows print unticked; SKIP rows never appear.
|
|
229
|
-
if [ -f "$CATALOGUE_TSV" ]; then
|
|
230
|
-
local scan
|
|
231
|
-
scan=$(cat "$TARGET/package.json" "$TARGET"/*.lock "$TARGET"/pnpm-lock.yaml \
|
|
232
|
-
"$TARGET"/vue.config.* "$TARGET"/nuxt.config.* "$TARGET"/godot/project.godot \
|
|
233
|
-
"$TARGET"/unity/ProjectSettings/ProjectVersion.txt 2>/dev/null | tr 'A-Z' 'a-z')
|
|
234
|
-
if [ -n "$scan" ]; then
|
|
235
|
-
local ticked="" maybe=""
|
|
236
|
-
while IFS=$'\t' read -r cid ccat ckind cname crepo cpath chmd clic cstars cpush \
|
|
237
|
-
cmatches cconf creq chint cverdict cby cdate; do
|
|
238
|
-
[ -n "$cid" ] || continue
|
|
239
|
-
case "$cverdict" in RECOMMEND|MAYBE) ;; *) continue ;; esac
|
|
240
|
-
local hit=0 tok
|
|
241
|
-
for tok in $cmatches; do
|
|
242
|
-
case "$scan" in *"$tok"*) hit=1; break ;; esac
|
|
243
|
-
done
|
|
244
|
-
[ "$hit" -eq 1 ] || continue
|
|
245
|
-
case "$cverdict" in
|
|
246
|
-
RECOMMEND) ticked="$ticked - [x] $cid # matches this repo ($cmatches)"$'\n' ;;
|
|
247
|
-
MAYBE) maybe="$maybe - [ ] $cid # matches, verdict MAYBE (not pre-ticked)"$'\n' ;;
|
|
248
|
-
esac
|
|
249
|
-
done < "$CATALOGUE_TSV"
|
|
250
|
-
if [ -n "$ticked$maybe" ]; then
|
|
251
|
-
printf 'catalogue_suggestions (heuristic — verify the matches before trusting):\n'
|
|
252
|
-
printf '%s' "$ticked"
|
|
253
|
-
printf '%s' "$maybe"
|
|
254
|
-
printf 'install later with: gob extras install <id...> (init itself installs nothing)\n'
|
|
255
|
-
fi
|
|
256
|
-
fi
|
|
257
|
-
fi
|
|
258
345
|
if [ "$got" -eq 0 ] && [ ! -d "$TARGET/src" ]; then
|
|
259
346
|
printf 'no package.json, no src/ — the scan above is empty; say so in the summary\n'
|
|
260
347
|
fi
|
|
261
348
|
printf '\n'
|
|
262
349
|
}
|
|
263
350
|
|
|
351
|
+
# ------------------------------------------------------------------ the map -----
|
|
352
|
+
# Extract the proposal's `## feature-map` section. Each `### <path>` heading is followed
|
|
353
|
+
# by a fenced code block whose body is the file at <path> (repo-relative). Writes into
|
|
354
|
+
# <stage-dir>/<path> and prints the number of `### ` blocks found. This is the ONLY reader
|
|
355
|
+
# of the map half of the proposal; the SHAPE is then validated by bin/goblin-map (the same
|
|
356
|
+
# code path `gob map --write` used), never re-implemented here.
|
|
357
|
+
extract_feature_map() { # <proposal> <stage-dir> -> block count on stdout
|
|
358
|
+
local prop="$1" stage="$2" p
|
|
359
|
+
# awk cannot mkdir: create every declared path's parent directory first.
|
|
360
|
+
while IFS= read -r p; do
|
|
361
|
+
[ -n "$p" ] || continue
|
|
362
|
+
mkdir -p "$stage/$(dirname "$p")" || return 1
|
|
363
|
+
done < <(awk '
|
|
364
|
+
/^```/ { fence = !fence; next }
|
|
365
|
+
!inmap { if (!fence && $0 ~ /^##[[:space:]]+[Ff]eature-map[[:space:]]*$/) inmap=1; next }
|
|
366
|
+
!fence {
|
|
367
|
+
if ($0 ~ /^##[[:space:]]/) { inmap=0; next }
|
|
368
|
+
if ($0 ~ /^###[[:space:]]+/) { p=$0; sub(/^###[[:space:]]+/,"",p); sub(/[[:space:]]+$/,"",p); print p }
|
|
369
|
+
}
|
|
370
|
+
' "$prop")
|
|
371
|
+
# then write the fenced-block bodies. Fence-aware: a feature file's own `## ` H2s and any
|
|
372
|
+
# `### ` inside its fenced body are CONTENT, never the section's structure.
|
|
373
|
+
awk -v stage="$stage" '
|
|
374
|
+
function flush() { if (out != "") { close(out); out="" } }
|
|
375
|
+
/^```/ { fence = !fence; next }
|
|
376
|
+
!inmap { if (!fence && $0 ~ /^##[[:space:]]+[Ff]eature-map[[:space:]]*$/) inmap=1; next }
|
|
377
|
+
!fence {
|
|
378
|
+
if ($0 ~ /^##[[:space:]]/) { inmap=0; flush(); next }
|
|
379
|
+
if ($0 ~ /^###[[:space:]]+/) {
|
|
380
|
+
flush(); p=$0; sub(/^###[[:space:]]+/,"",p); sub(/[[:space:]]+$/,"",p)
|
|
381
|
+
out = stage "/" p; n++; next
|
|
382
|
+
}
|
|
383
|
+
next
|
|
384
|
+
}
|
|
385
|
+
{ if (out != "") print >> out }
|
|
386
|
+
END { print n+0 }
|
|
387
|
+
' "$prop"
|
|
388
|
+
}
|
|
389
|
+
|
|
264
390
|
if [ -z "$WRITE" ]; then
|
|
265
|
-
if [ "$WITH_MCP" -eq 1 ]; then
|
|
266
|
-
do_mcp_config || exit 1
|
|
267
|
-
fi
|
|
268
391
|
print_brief
|
|
269
392
|
[ "$HEURISTIC" -eq 1 ] && print_heuristic
|
|
270
|
-
printf 'register the verify tool for your agent: %s mcp add gob -- npx -y @techgoblin/gobstack mcp (or run gob init --with-mcp-config)\n' "$AGENT_CLI"
|
|
271
393
|
g_info "== end of brief — the agent writes the proposal; gob init --write installs it =="
|
|
272
394
|
exit 0
|
|
273
395
|
fi
|
|
@@ -280,17 +402,16 @@ BLOCK_KEYS=$(g_agents_keys "$PROP")
|
|
|
280
402
|
|
|
281
403
|
# Unknown keys are refused: the proposal is machine-read, and a typo'd key would
|
|
282
404
|
# otherwise be silently ignored forever (fail closed, like --only does).
|
|
283
|
-
KNOWN_KEYS="
|
|
405
|
+
KNOWN_KEYS="practice practice_sha256 archive
|
|
284
406
|
max_dirty advisory_ceiling security.gitignore_family security.build_output
|
|
285
|
-
security.audit_cmd security.audit_max_age_days security.waiver_max_age_days
|
|
286
407
|
security.write_routes perf.metric perf.cmd perf.baseline_commit perf.baseline_value
|
|
287
408
|
perf.measured perf.host_gate harness_dir scaffold_checks feature_map source_root
|
|
288
|
-
verify_doctor reference_manifest quarantine_root
|
|
289
|
-
ratchet.name ratchet.cmd ratchet.ceiling runtime_data
|
|
409
|
+
verify_doctor reference_manifest quarantine_root
|
|
410
|
+
ratchet.name ratchet.cmd ratchet.ceiling runtime_data bans_disabled bans_exempt layers
|
|
290
411
|
replay.env replay.cmd replay.commit disabled engine_dir"
|
|
291
412
|
BAD_KEYS=""
|
|
292
413
|
# Token-by-token, not a whole-string case: KNOWN_KEYS is a multi-line word list and a
|
|
293
|
-
# `case` pattern cannot span the newlines
|
|
414
|
+
# `case` pattern cannot span the newlines.
|
|
294
415
|
while IFS= read -r k; do
|
|
295
416
|
[ -n "$k" ] || continue
|
|
296
417
|
case "$k" in gate_*_cmd) continue ;; esac
|
|
@@ -302,67 +423,95 @@ while IFS= read -r k; do
|
|
|
302
423
|
done <<< "$BLOCK_KEYS"
|
|
303
424
|
[ -z "$BAD_KEYS" ] || { g_err "$PROP names unknown key(s):$BAD_KEYS — fix or drop them"; exit 2; }
|
|
304
425
|
|
|
305
|
-
CLASS_RAW=$(g_agents_read "$PROP" class)
|
|
306
|
-
CLASS=$(g_class_canon "$CLASS_RAW") \
|
|
307
|
-
|| { g_err "unknown class '$CLASS_RAW' in $PROP (expected software|service|game|research|fleet, or A-E / app / agent / desktop)"; exit 2; }
|
|
308
|
-
ELECTRON=0
|
|
309
|
-
g_class_is_electron_alias "$CLASS_RAW" && ELECTRON=1
|
|
310
|
-
[ "$(g_agents_read "$PROP" electron)" = "true" ] && ELECTRON=1
|
|
311
|
-
|
|
312
426
|
GATE_NAME=$(g_agents_gates "$PROP" | head -n 1 | awk -F'\t' '{print $1}')
|
|
313
427
|
GATE_CMD=$(g_agents_gates "$PROP" | head -n 1 | awk -F'\t' '{print $2}')
|
|
314
428
|
[ -n "$GATE_CMD" ] || { g_err "$PROP declares no gate — the brief requires at least one gate_<name>_cmd"; exit 2; }
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
[ -n "$
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
#
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
#
|
|
327
|
-
|
|
429
|
+
|
|
430
|
+
# feature_map is REQUIRED (DECISION, 2026-10-09): the map is mandatory, so there is no
|
|
431
|
+
# "no map declared" state. A proposal without it, or with it empty, refuses here.
|
|
432
|
+
FEATURE_MAP=$(g_agents_read "$PROP" feature_map)
|
|
433
|
+
[ -n "$FEATURE_MAP" ] || { g_err "$PROP declares no feature_map — add 'feature_map: features/README.md' to the gob block and a '## feature-map' section (the brief's SCHEMA); the map is mandatory"; exit 2; }
|
|
434
|
+
|
|
435
|
+
# The map's directory, relative to the repo root. feature_map names the README (the value
|
|
436
|
+
# verify reads); the map lives in a directory of its own, never the repo root.
|
|
437
|
+
MAPDIR_REL=$(dirname "$FEATURE_MAP")
|
|
438
|
+
[ "$MAPDIR_REL" != "." ] || { g_err "feature_map must name a directory of its own (e.g. features/README.md), not the repo root"; exit 2; }
|
|
439
|
+
|
|
440
|
+
# Empty repo: no committed file to map. The map's entry paths are committed files, so a repo
|
|
441
|
+
# with nothing committed cannot carry a resolvable map. Refuse with the named remedy — no
|
|
442
|
+
# bootstrap feature is invented (a feature with no resolvable entry path is an assertion,
|
|
443
|
+
# not a count).
|
|
444
|
+
if [ -z "$( cd "$TARGET" && git ls-files 2>/dev/null | head -n 1 )" ]; then
|
|
445
|
+
g_err "the target has no committed file to map — commit at least one file, then run again"; exit 2
|
|
446
|
+
fi
|
|
447
|
+
|
|
448
|
+
# Validate BOTH halves in ONE pass, before anything is written. The map the proposal embeds
|
|
449
|
+
# is extracted to a staging dir and handed to bin/goblin-map (the SAME validator `gob map
|
|
450
|
+
# --write` used): the FM-01 shape plus FM-02 resolvability (exists AND tracked) against the
|
|
451
|
+
# target. Nothing is written unless it validates.
|
|
452
|
+
STAGE=$(mktemp -d "${TMPDIR:-/tmp}/goblin-init.map.XXXXXX") || { g_err "mktemp failed"; exit 2; }
|
|
453
|
+
trap 'rm -rf "$STAGE"' EXIT
|
|
454
|
+
BLOCKS=$(extract_feature_map "$PROP" "$STAGE") || { g_err "could not read the proposal's feature-map section"; exit 2; }
|
|
455
|
+
[ "${BLOCKS:-0}" -ge 1 ] || { g_err "$PROP carries no feature-map blocks — the SCHEMA needs a '### $MAPDIR_REL/README.md' block and one '### $MAPDIR_REL/<slug>.md' per feature"; exit 2; }
|
|
456
|
+
[ -d "$STAGE/$MAPDIR_REL" ] || { g_err "the proposal's feature-map blocks are not under '$MAPDIR_REL' (the directory of the declared feature_map: $FEATURE_MAP)"; exit 2; }
|
|
457
|
+
if ! MAP_OUT=$(bash "$SRC/bin/goblin-map" --validate "$STAGE/$MAPDIR_REL" --root "$TARGET" 2>&1); then
|
|
458
|
+
printf '%s\n' "$MAP_OUT" >&2
|
|
459
|
+
g_err "the proposal's feature map failed validation (FM-01/FM-02) — fix the file(s) named above; nothing was written"
|
|
460
|
+
exit 2
|
|
461
|
+
fi
|
|
328
462
|
|
|
329
463
|
if [ "$DRYRUN" -eq 1 ]; then
|
|
330
|
-
g_info "gob init --write --dry-run: validated OK (
|
|
331
|
-
g_info "
|
|
332
|
-
g_info "
|
|
333
|
-
g_info " would write: AGENTS.md (body + gob block), .gob/engine/, HANDOFF.md"
|
|
464
|
+
g_info "gob init --write --dry-run: validated OK (1+ gate, feature map '$FEATURE_MAP')"
|
|
465
|
+
g_info " would write: AGENTS.md (body + gob block), .gob/engine/, HANDOFF.md, $MAPDIR_REL/"
|
|
466
|
+
g_info " the declared gate was NOT run (--dry-run)"
|
|
334
467
|
exit 0
|
|
335
468
|
fi
|
|
336
469
|
|
|
470
|
+
# ------------------------------------------------------------------- the gate ---
|
|
471
|
+
# The gate is RUN, not guessed (DECISION, 2026-10-09). Execute the declared first gate in the
|
|
472
|
+
# working tree before installing, and report the measured exit code and the command's first
|
|
473
|
+
# output line. A non-zero exit is ACCEPTED — a legitimate day-one red that GT-02 re-runs from
|
|
474
|
+
# the installed config. A command that CANNOT be run at all (exit 127) is not a gate: refuse.
|
|
475
|
+
GATE_RAW=$( cd "$TARGET" && bash -c "$GATE_CMD" 2>&1 ); GATE_RC=$?
|
|
476
|
+
if [ "$GATE_RC" -eq 127 ]; then
|
|
477
|
+
g_err "gate_${GATE_NAME}_cmd is not a runnable command (exit 127): $GATE_CMD — name a command that exists, or author one at checks/gate.sh"
|
|
478
|
+
exit 2
|
|
479
|
+
fi
|
|
480
|
+
GATE_LINE=$(printf '%s\n' "$GATE_RAW" | sed '/^[[:space:]]*$/d' | head -n 1)
|
|
481
|
+
g_info "gob init [gate] $GATE_CMD"
|
|
482
|
+
g_info " measured exit code: $GATE_RC"
|
|
483
|
+
if [ -n "$GATE_LINE" ]; then g_info " first output line: $GATE_LINE"; fi
|
|
484
|
+
|
|
337
485
|
# ------------------------------------------------------------------- install ---
|
|
338
486
|
# One engine call writes the vendored payload (.gob/), AGENTS.md body + gob block and
|
|
339
487
|
# HANDOFF.md. Its refusal contract applies verbatim: an existing HANDOFF.md is never
|
|
340
488
|
# overwritten; an edited AGENTS.md body is kept (put_once) and only the block is rewritten.
|
|
341
|
-
INSTALL_ARGS=(--target "$TARGET" --
|
|
489
|
+
INSTALL_ARGS=(--target "$TARGET" --skills "$SKILLS_OPT" --yes)
|
|
342
490
|
# The first gate is the proposal's own: its name AND command. The name rides along so the
|
|
343
491
|
# HANDOFF template renders the declared name — HP-03 anchors on declared gate names, and a
|
|
344
492
|
# HANDOFF that names a gate the config does not declare is the day-one red (GT-04/HP-03
|
|
345
493
|
# anchoring). GATE_NAME comes from the same key the reader parses (gate_<name>_cmd).
|
|
346
494
|
GATE_NAME=$(g_agents_gates "$PROP" | head -n 1 | awk -F'\t' '{print $1}')
|
|
347
495
|
INSTALL_ARGS+=(--gate "$GATE_CMD" "$GATE_NAME")
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
496
|
+
printf 'gob init [run] goblin-install --target %s\n' "$TARGET"
|
|
497
|
+
# The engine is told to DEFER the next-steps block: this front-door command prints the ONE list
|
|
498
|
+
# itself, at the very end (g_next_block). Without this the user saw two `next:` lists.
|
|
499
|
+
GOB_NEXT_DEFER=1 bash "$SRC/bin/goblin-install" "${INSTALL_ARGS[@]}"
|
|
351
500
|
RC=$?
|
|
352
501
|
[ "$RC" -eq 0 ] || { g_err "install failed (exit $RC) — the refusals above name the path and the fix"; exit "$RC"; }
|
|
353
502
|
|
|
354
503
|
CONFIG="$TARGET/AGENTS.md"
|
|
355
504
|
[ -f "$CONFIG" ] || { g_err "install wrote no AGENTS.md at $TARGET"; exit 1; }
|
|
356
505
|
|
|
357
|
-
# The proposal MERGES over the
|
|
506
|
+
# The proposal MERGES over the defaults the installer rendered: the proposal's keys
|
|
358
507
|
# win, every default key the proposal did not set stays (a proposal carrying only the
|
|
359
508
|
# brief's required keys must not blank archive/ratchet/replay — the schema is a minimum,
|
|
360
509
|
# not the whole block). Proposal keys the config did not have are appended.
|
|
361
|
-
# EXCEPT the gate keys: the proposal's first gate REPLACES the
|
|
362
|
-
# (the default names a
|
|
510
|
+
# EXCEPT the gate keys: the proposal's first gate REPLACES the installer's default gate_<name>_cmd
|
|
511
|
+
# (the default names a taxonomy gate the project never declared), and every OTHER
|
|
363
512
|
# default gate_* key is dropped — a gate the config declares must be one the proposal chose,
|
|
364
|
-
# never a leftover default naming a gate the HANDOFF does not render. The second
|
|
365
|
-
# (
|
|
513
|
+
# never a leftover default naming a gate the HANDOFF does not render. The second default gate
|
|
514
|
+
# (the todo_ceiling) is opt-IN: the proposal may declare it itself.
|
|
366
515
|
{
|
|
367
516
|
first_gate=1
|
|
368
517
|
while IFS= read -r k; do
|
|
@@ -376,8 +525,8 @@ CONFIG="$TARGET/AGENTS.md"
|
|
|
376
525
|
esac
|
|
377
526
|
# An ABSENT key prints "key<TAB><TAB>", which renders as "key:: key:" - a key that
|
|
378
527
|
# reads back as its own name twice and fails IN-02/PF-01/FM-01 on a fresh install.
|
|
379
|
-
# A proposal line with an empty value carries no merge information (the
|
|
380
|
-
# default
|
|
528
|
+
# A proposal line with an empty value carries no merge information (the installer
|
|
529
|
+
# default already covers it): drop it here.
|
|
381
530
|
k_val=$(g_agents_read "$PROP" "$k")
|
|
382
531
|
[ -n "$k_val" ] && printf '%s\t%s\n' "$k" "$k_val"
|
|
383
532
|
done <<< "$BLOCK_KEYS"
|
|
@@ -392,47 +541,33 @@ CONFIG="$TARGET/AGENTS.md"
|
|
|
392
541
|
# Fail closed: the declared gate must read back through the engine's own reader.
|
|
393
542
|
GOT_GATE=$(g_agents_gates "$CONFIG" | head -n 1 | awk -F'\t' '{print $2}')
|
|
394
543
|
[ "$GOT_GATE" = "$GATE_CMD" ] || { g_err "the first gate did not land in $CONFIG (reader sees '$GOT_GATE', wanted '$GATE_CMD')"; exit 1; }
|
|
395
|
-
[ "$(g_agents_read "$CONFIG"
|
|
396
|
-
|
|
397
|
-
#
|
|
398
|
-
#
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
#
|
|
407
|
-
# The
|
|
408
|
-
# allowlist itself — one code path, one set of refusals (unknown id, SKIP verdict,
|
|
409
|
-
# missing payload). init --write never copies an extra by its own hand: the catalogue
|
|
410
|
-
# is the allowlist, and the CLI is the only installer. A refusal fails the whole
|
|
411
|
-
# --write (the human re-ticks).
|
|
412
|
-
#
|
|
413
|
-
# ORDER MATTERS: --with-mcp-config writes the gob registration FIRST, then the mcp-kind
|
|
414
|
-
# extras merge INTO it — the other order would leave .mcp.json carrying only the extra
|
|
415
|
-
# and do_mcp_config would refuse it (the generated-bytes ask-once check). Extras mcp
|
|
416
|
-
# merges are themselves ask-once: an entry you customized is never overwritten.
|
|
544
|
+
[ "$(g_agents_read "$CONFIG" feature_map)" = "$FEATURE_MAP" ] || { g_err "feature_map did not land in $CONFIG (reader sees '$(g_agents_read "$CONFIG" feature_map)', wanted '$FEATURE_MAP')"; exit 1; }
|
|
545
|
+
|
|
546
|
+
# --------------------------------------------------------------- feature map ----
|
|
547
|
+
# Materialise the map the proposal embedded (validated above, before anything was written).
|
|
548
|
+
mkdir -p "$TARGET/$MAPDIR_REL" || { g_err "could not create $TARGET/$MAPDIR_REL"; exit 1; }
|
|
549
|
+
cp -R "$STAGE/$MAPDIR_REL/." "$TARGET/$MAPDIR_REL/" 2>/dev/null \
|
|
550
|
+
|| { g_err "could not write the feature map into $TARGET/$MAPDIR_REL"; exit 1; }
|
|
551
|
+
[ -f "$TARGET/$FEATURE_MAP" ] || { g_err "the feature map did not land at $TARGET/$FEATURE_MAP"; exit 1; }
|
|
552
|
+
|
|
553
|
+
# ------------------------------------------------------- mcp config + hooks ----
|
|
554
|
+
# The user runs NO gob command after install. The MCP registration is now OPT-IN
|
|
555
|
+
# (--with-mcp-config): the named removal that pays for hooks emission (proposal §3).
|
|
556
|
+
# The hooks payload runs by default, into existing vendor directories only.
|
|
417
557
|
if [ "$WITH_MCP" -eq 1 ]; then
|
|
418
558
|
do_mcp_config || exit 1
|
|
419
559
|
fi
|
|
420
|
-
|
|
421
|
-
for xid in $EXTRAS_SEL; do
|
|
422
|
-
printf 'gob init [run] extras install %s\n' "$xid"
|
|
423
|
-
bash "$SRC/bin/goblin-extras" install "$xid" --target "$TARGET" || {
|
|
424
|
-
RC=$?; g_err "extras install $xid failed (exit $RC) — fix the proposal's catalogue_suggestions and re-run"; exit "$RC"; }
|
|
425
|
-
done
|
|
426
|
-
fi
|
|
560
|
+
do_hooks || exit 1
|
|
427
561
|
|
|
428
562
|
# --------------------------------------------------------------------- done ----
|
|
429
563
|
printf '\n'
|
|
430
|
-
printf 'gob init: installed —
|
|
564
|
+
printf 'gob init: installed — feature map %s\n' "$FEATURE_MAP"
|
|
431
565
|
printf ' harness: %s/.gob/bin/goblin-verify\n' "$TARGET"
|
|
432
|
-
|
|
433
|
-
printf '
|
|
434
|
-
|
|
435
|
-
printf '
|
|
436
|
-
|
|
437
|
-
|
|
566
|
+
if [ "$WITH_MCP" -eq 0 ]; then
|
|
567
|
+
printf ' no .mcp.json written — the MCP registration is opt-in: re-run with --with-mcp-config\n'
|
|
568
|
+
fi
|
|
569
|
+
printf '\n'
|
|
570
|
+
# The ONE ordered next-steps list (the engine deferred its own copy). The gate is the one this
|
|
571
|
+
# command declared and MEASURED above, so the list does not tell the user to replace it.
|
|
572
|
+
g_next_block "$TARGET" "$SKILLS_OPT" "$GATE_NAME: $GATE_CMD"
|
|
438
573
|
exit 0
|