@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.
Files changed (110) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +256 -120
  3. package/VERSION +1 -1
  4. package/bans/README.md +5 -5
  5. package/bans/grep-ban.sh +1 -1
  6. package/bin/goblin-bans +103 -27
  7. package/bin/goblin-init +346 -211
  8. package/bin/goblin-install +281 -204
  9. package/bin/goblin-lib.sh +79 -76
  10. package/bin/goblin-map +130 -571
  11. package/bin/goblin-mcp.js +37 -16
  12. package/bin/goblin-verify +254 -998
  13. package/bin/goblin.js +4 -9
  14. package/docs/GUIDE.md +727 -181
  15. package/docs/LIMITS.md +273 -301
  16. package/docs/RECORD-NOTES.md +1 -2
  17. package/manifest/bans.tsv +9 -9
  18. package/manifest/categories.tsv +18 -0
  19. package/manifest/enforcement.tsv +12 -68
  20. package/manifest/glossary.tsv +6 -12
  21. package/manifest/library.tsv +33 -0
  22. package/package.json +1 -4
  23. package/skills/goblin-bootstrap/SKILL.md +20 -32
  24. package/skills/goblin-feature-map/SKILL.md +1 -1
  25. package/skills/goblin-verify-author/SKILL.md +2 -2
  26. package/skills/practice/SKILL.md +4 -4
  27. package/templates/AGENTS.md.tmpl +6 -6
  28. package/templates/HANDOFF.md.tmpl +1 -1
  29. package/templates/SPEC.md.tmpl +2 -2
  30. package/templates/agents-block.tmpl +1 -10
  31. package/adapters/_template/adapter.tsv +0 -16
  32. package/adapters/_template/detect.sh +0 -10
  33. package/adapters/_template/emit.sh +0 -5
  34. package/adapters/_template/verify.sh +0 -4
  35. package/adapters/claude/adapter.tsv +0 -8
  36. package/adapters/claude/detect.sh +0 -8
  37. package/adapters/claude/verify.sh +0 -47
  38. package/adapters/codex/adapter.tsv +0 -12
  39. package/adapters/codex/detect.sh +0 -9
  40. package/adapters/codex/verify.sh +0 -45
  41. package/adapters/copilot/adapter.tsv +0 -10
  42. package/adapters/copilot/detect.sh +0 -8
  43. package/adapters/copilot/verify.sh +0 -45
  44. package/adapters/cursor/adapter.tsv +0 -11
  45. package/adapters/cursor/detect.sh +0 -10
  46. package/adapters/cursor/verify.sh +0 -45
  47. package/adapters/gemini/adapter.tsv +0 -15
  48. package/adapters/gemini/detect.sh +0 -11
  49. package/adapters/gemini/verify.sh +0 -49
  50. package/adapters/hermes/adapter.tsv +0 -9
  51. package/adapters/hermes/detect.sh +0 -8
  52. package/adapters/hermes/verify.sh +0 -27
  53. package/adapters/opencode/adapter.tsv +0 -14
  54. package/adapters/opencode/detect.sh +0 -9
  55. package/adapters/opencode/verify.sh +0 -45
  56. package/automations/README.md +0 -53
  57. package/automations/bugreporter-intake.sh +0 -145
  58. package/automations/drift-audit.sh +0 -139
  59. package/automations/report.schema.tsv +0 -10
  60. package/bin/goblin +0 -144
  61. package/bin/goblin-audit +0 -143
  62. package/bin/goblin-doctor +0 -233
  63. package/bin/goblin-emit +0 -495
  64. package/bin/goblin-extras +0 -360
  65. package/bin/goblin-model +0 -105
  66. package/bin/goblin-upgrade +0 -580
  67. package/docs/ADOPTION.md +0 -173
  68. package/docs/CI.md +0 -190
  69. package/docs/CONTRACTS.md +0 -215
  70. package/docs/DESIGN.md +0 -92
  71. package/docs/ENFORCEMENT.md +0 -228
  72. package/docs/FLOWS.md +0 -164
  73. package/docs/GLOSSARY.md +0 -40
  74. package/docs/GUARDRAILS.md +0 -126
  75. package/docs/INTEGRATION.md +0 -92
  76. package/docs/LOOP.md +0 -165
  77. package/docs/RE-PLAYBOOK.md +0 -183
  78. package/docs/RISKS.md +0 -70
  79. package/docs/ROLES.md +0 -105
  80. package/extras-catalogue/catalogue.tsv +0 -42
  81. package/extras-catalogue/payload/README.md +0 -14
  82. package/extras-catalogue/payload/taste-skill/taste/REFERENCE.md +0 -3
  83. package/extras-catalogue/payload/taste-skill/taste/SKILL.md +0 -9
  84. package/manifest/classes.tsv +0 -51
  85. package/manifest/playbooks.tsv +0 -16
  86. package/presets/electron-overlay.yaml +0 -38
  87. package/presets/fleet.yaml +0 -43
  88. package/presets/game.yaml +0 -38
  89. package/presets/research.yaml +0 -41
  90. package/presets/service.yaml +0 -40
  91. package/presets/software.yaml +0 -48
  92. package/roles.yaml +0 -54
  93. package/skills/goblin-bugfix/SKILL.md +0 -26
  94. package/skills/goblin-bugreporter/SKILL.md +0 -52
  95. package/skills/goblin-drift-audit/SKILL.md +0 -43
  96. package/skills/goblin-eval/SKILL.md +0 -68
  97. package/skills/goblin-feature/SKILL.md +0 -26
  98. package/skills/goblin-investigation/SKILL.md +0 -26
  99. package/skills/goblin-judge/SKILL.md +0 -74
  100. package/skills/goblin-loop/SKILL.md +0 -88
  101. package/skills/goblin-mode/SKILL.md +0 -70
  102. package/skills/goblin-overnight/SKILL.md +0 -42
  103. package/skills/goblin-pr-gate/SKILL.md +0 -42
  104. package/skills/goblin-re-mobile/SKILL.md +0 -51
  105. package/skills/goblin-refactor/SKILL.md +0 -23
  106. package/skills/goblin-sweep/SKILL.md +0 -23
  107. package/skills/goblin-tdd-repro/SKILL.md +0 -27
  108. package/templates/audit-waiver.tsv.tmpl +0 -10
  109. package/templates/install-hooks.allowlist.tmpl +0 -9
  110. package/templates/report.yaml.tmpl +0 -16
package/bin/goblin-extras DELETED
@@ -1,360 +0,0 @@
1
- #!/usr/bin/env bash
2
- # goblin-extras — `gob extras`: the curated catalogue browser + installer (v2 W-extras).
3
- #
4
- # gob extras list [category] the catalogue, grouped by category
5
- # gob extras show <id> one row, every field, + the install hint
6
- # gob extras install <id...> [--target <dir>] [--platform <id>]
7
- # [--with-mcp-config] [--dry-run]
8
- #
9
- # The ALLOWLIST RULE (non-negotiable): only ids that exist in catalogue.tsv are ever
10
- # installed. An id the catalogue does not carry is refused by name — there is no path from
11
- # a URL or a repo name on this command to a file write. `gob init` SUGGESTS rows and never
12
- # auto-installs; a human (or the proposal the human approves) names ids explicitly, and
13
- # the curator maintains the catalogue (add a row = PR or edit catalogue.tsv).
14
- #
15
- # Verdicts: RECOMMEND rows install; MAYBE rows install (an explicit choice, never
16
- # pre-ticked at init); SKIP rows refuse — the curator's verdict is the contract.
17
- # THE LICENSE GATE (W-license, hard): verdict RECOMMEND|MAYBE alone is not enough —
18
- # a row installs only when its catalogue license_status is `verified`. Rows with an
19
- # unresolved license carry verdict LICENSE-PENDING (never pre-ticked at init) and
20
- # refuse install with `license pending verification` until the curator flips the
21
- # DATA (license_status + license_check_date), never this file.
22
- #
23
- # NO NETWORK. Skill and workflow installs copy from a VENDORED PAYLOAD the curator
24
- # maintains under extras-catalogue/payload/<id>/ (payload/README.md is the layout
25
- # contract); a row whose payload is absent is refused with the named fix, never
26
- # downloaded. MCP installs are a printed mcp.json snippet plus — with
27
- # --with-mcp-config — a merge into the target's .mcp.json that never overwrites an
28
- # existing server entry (the ask-once rule .mcp.json has always had).
29
- #
30
- # Skill destinations follow the sync_platforms pattern: --platform <adapter-id> copies
31
- # each vendored skill dir under that adapter's project skills root (read from
32
- # adapters/<id>/adapter.tsv, column skills_path_project); with no --platform the skill
33
- # lands in the repo-neutral .gob/extras/<skill-name>/ (standalone repos). Workflows copy
34
- # the payload into .gob/playbooks/<id>/.
35
- #
36
- # Exit codes: 0 ok | 1 a refusal (named path + fix) | 2 bad input.
37
- # No npm, no jq, no yq, no network. bash/awk/sed/grep only (python3 only for the
38
- # .mcp.json merge, where a hand-rolled JSON edit would corrupt files it must not).
39
-
40
- set -uo pipefail
41
-
42
- SELF_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
43
- SRC=$(cd "$SELF_DIR/.." && pwd)
44
- # shellcheck source=goblin-lib.sh
45
- . "$SELF_DIR/goblin-lib.sh"
46
-
47
- g_info() { printf '%s\n' "$*"; }
48
-
49
- usage() { sed -n '2,/^$/p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; }
50
-
51
- # ---- the catalogue source (overridable for tests) ------------------------------
52
- # The default is the shipped catalogue; GOB_EXTRAS_CATALOGUE points a test at a fixture.
53
- # Same for the payload root: a test vendors a fixture payload and aims the installer at it.
54
- CATALOGUE="${GOB_EXTRAS_CATALOGUE:-$SRC/extras-catalogue/catalogue.tsv}"
55
- PAYLOAD="${GOB_EXTRAS_PAYLOAD:-$SRC/extras-catalogue/payload}"
56
-
57
- die() { g_err "extras: $*"; exit "${2:-2}"; }
58
-
59
- # catalogue_row <id> — the whole data row (tab-separated), empty when absent.
60
- catalogue_row() {
61
- awk -F'\t' -v id="$1" 'NR>1 && $1==id { print; exit }' "$CATALOGUE"
62
- }
63
-
64
- # catalogue_field <row> <n> — the nth tab field of a row.
65
- catalogue_field() { printf '%s' "$1" | awk -F'\t' -v n="$2" '{ print $n }'; }
66
-
67
- # catalogue_ids — every id, file order.
68
- catalogue_ids() { awk -F'\t' 'NR>1 && $1!="" { print $1 }' "$CATALOGUE"; }
69
-
70
- # category_order — the categories in catalogue file order of first appearance.
71
- category_order() { awk -F'\t' 'NR>1 && !seen[$2]++ { print $2 }' "$CATALOGUE"; }
72
-
73
- # ---- adapters (the platform enum is data, never literals) ----------------------
74
- # MD-01: agent-family names are read from adapters/<id>/adapter.tsv at run time, never
75
- # written here — the same discipline the sync engine's assembled platform list keeps.
76
- adapter_ids() {
77
- for t in "$SRC"/adapters/*/adapter.tsv; do
78
- [ -f "$t" ] || continue
79
- awk -F'\t' '!/^#/ && NF>1 && $1!="id" { print $1 }' "$t"
80
- done
81
- }
82
-
83
- # adapter_skills_root <id> — the PROJECT skills root (the pattern with its
84
- # `<name>/SKILL.md` tail stripped), one dot-dir per agent family. Read at run time;
85
- # the family names live in the adapter tables, never here (the MD-01 discipline).
86
- adapter_skills_root() {
87
- local t="$SRC/adapters/$1/adapter.tsv" pat
88
- [ -f "$t" ] || return 0
89
- pat=$(awk -F'\t' '!/^#/ && NF>1 && $1!="id" { print $4 }' "$t")
90
- [ -n "$pat" ] || return 0
91
- printf '%s\n' "${pat%%<name>*}"
92
- }
93
-
94
- # ---- list ----------------------------------------------------------------------
95
- cmd_list() {
96
- local want="${1:-}"
97
- [ -f "$CATALOGUE" ] || die "catalogue not found: $CATALOGUE" 2
98
- if [ -n "$want" ]; then
99
- # An unknown category is bad input, not an empty table: a typo must not read as
100
- # "the catalogue has nothing here". Captured, not piped: under pipefail a `grep -q`
101
- # match closes the pipe early and SIGPIPE-kills the producer (pipeline 141), which
102
- # would read as "unknown category" for a category the catalogue carries.
103
- CATS=$(category_order)
104
- printf '%s\n' "$CATS" | grep -qx "$want" || die "unknown category '$want' (want one of: $(printf '%s' "$CATS" | tr '\n' ' '))" 2
105
- fi
106
- local total
107
- total=$(catalogue_ids | wc -l | tr -d ' ')
108
- g_info "gob extras — the curated catalogue ($total rows; RECOMMEND pre-ticks at init, MAYBE is visible but never pre-ticked, SKIP refuses install; LICENSE-PENDING rows refuse install until their license is verified)"
109
- g_info "install: gob extras install <id...> · one row: gob extras show <id>"
110
- local cat
111
- for cat in $(category_order); do
112
- [ -z "$want" ] || [ "$cat" = "$want" ] || continue
113
- printf '\n[%s]\n' "$cat"
114
- printf ' %-34s %-8s %-7s %-24s %-10s %-16s %s\n' "id" "kind" "stars" "license" "verdict" "lic-status" "matches"
115
- awk -F'\t' -v cat="$cat" 'NR>1 && $2==cat {
116
- printf " %-34s %-8s %-7s %-24s %-10s %-16s %s\n", $1, $3, $9, $8, $15, $18, $11
117
- }' "$CATALOGUE"
118
- done
119
- return 0
120
- }
121
-
122
- # ---- show ----------------------------------------------------------------------
123
- cmd_show() {
124
- local id="${1:-}"
125
- [ -n "$id" ] || die "show: an id is required (gob extras list)" 2
126
- [ -f "$CATALOGUE" ] || die "catalogue not found: $CATALOGUE" 2
127
- local row
128
- row=$(catalogue_row "$id")
129
- [ -n "$row" ] || die "unknown id '$id' — gob extras list names the catalogue" 2
130
- local labels=(id category kind name source_repo path_within_repo has_skill_md license
131
- stars last_push matches conflicts requires install_hint verdict
132
- reviewed_by reviewed_date license_status license_check_date)
133
- local i
134
- for i in $(seq 1 19); do
135
- printf '%-18s %s\n' "${labels[$((i-1))]}:" "$(catalogue_field "$row" "$i")"
136
- done
137
- return 0
138
- }
139
-
140
- # ---- install -------------------------------------------------------------------
141
- TARGET="" PLATFORM="" WITH_MCP=0 DRYRUN=0 IDS=()
142
- parse_install() {
143
- while [ $# -gt 0 ]; do
144
- case "$1" in
145
- --target) TARGET="${2:-}"; shift 2 ;;
146
- --platform) PLATFORM="${2:-}"; shift 2 ;;
147
- --with-mcp-config) WITH_MCP=1; shift ;;
148
- --dry-run) DRYRUN=1; shift ;;
149
- --yes) shift ;; # accepted for pipe parity; install is already explicit
150
- -h|--help) usage; exit 0 ;;
151
- -*) die "install: unknown option: $1" 2 ;;
152
- *) IDS+=("$1"); shift ;;
153
- esac
154
- done
155
- [ "${#IDS[@]}" -gt 0 ] || die "install: at least one id is required (gob extras list)" 2
156
- [ -f "$CATALOGUE" ] || die "catalogue not found: $CATALOGUE" 2
157
- TARGET="${TARGET:-$PWD}"
158
- TARGET=$(g_expand_tilde "$TARGET")
159
- [ -d "$TARGET" ] || die "--target is not a directory: $TARGET" 2
160
- TARGET=$(cd "$TARGET" && pwd)
161
- if [ -n "$PLATFORM" ]; then
162
- # Captured, not piped (see cmd_list: pipefail + grep -q closes the pipe early and
163
- # SIGPIPE-kills the producer — a valid platform id read as unknown).
164
- ADAPTERS=$(adapter_ids)
165
- printf '%s\n' "$ADAPTERS" | grep -qx "$PLATFORM" \
166
- || die "unknown --platform '$PLATFORM' (the adapters this checkout ships: $(printf '%s' "$ADAPTERS" | tr '\n' ' '))" 2
167
- fi
168
- }
169
-
170
- # resolve_one <id> — validates against the ALLOWLIST, the curator's verdicts and the
171
- # LICENSE GATE; prints the row. Every install path goes through here: no row, no
172
- # install; no verified license, no install. That is the whole allowlist rule plus the
173
- # hard gate, in one gate.
174
- resolve_one() {
175
- local id="$1" row verdict lic
176
- row=$(catalogue_row "$id")
177
- # Captured, not piped (pipefail + grep -q early-exit trap — see cmd_list).
178
- if [ -n "$row" ]; then
179
- verdict=$(catalogue_field "$row" 15)
180
- lic=$(catalogue_field "$row" 18)
181
- else
182
- die "unknown id '$id' — nothing outside catalogue.tsv is ever installed (gob extras list names the allowlist)" 2
183
- fi
184
- case "$verdict" in
185
- RECOMMEND|MAYBE|LICENSE-PENDING) ;;
186
- SKIP) die "id '$id' carries verdict SKIP — the curator declined it; it stays visible in the catalogue but refuses install" 1 ;;
187
- *) die "id '$id' carries verdict '$verdict' — not an installable verdict (RECOMMEND|MAYBE|SKIP|LICENSE-PENDING)" 2 ;;
188
- esac
189
- # THE LICENSE GATE (hard, data-driven): a row whose catalogue says its license is
190
- # not verified never installs — the verdict alone is not consulted. A curator flips
191
- # a row to installable by fixing the data (license_status=verified + a check date),
192
- # never by touching this file.
193
- case "$lic" in
194
- verified) ;;
195
- pending|proprietary-confirmed-ok|"")
196
- die "id '$id' refuses install: license pending verification — see catalogue.tsv license_check_date" 1 ;;
197
- *)
198
- die "id '$id' carries license_status '$lic' — not a known status (verified|pending|proprietary-confirmed-ok)" 2 ;;
199
- esac
200
- printf '%s\n' "$row"
201
- }
202
-
203
- # copy_tree <src> <dst> — byte-copy with the installer's ownership gate: an existing
204
- # file is left alone when identical (unchanged) and REFUSED when it differs (a file the
205
- # project wrote is never clobbered silently). Returns 0 ok, 1 on a refusal (named).
206
- COPY_REFUSALS=0
207
- copy_tree() {
208
- local src="${1%/}" dst="$2" f rel sd dd
209
- [ -d "$src" ] || die "payload missing: $src" 2
210
- while IFS= read -r f; do
211
- rel="${f#"$src"/}"
212
- dd="$dst/$rel"
213
- if [ "$DRYRUN" -eq 1 ]; then
214
- g_info "plan: ${dd#"$TARGET"/}"
215
- continue
216
- fi
217
- mkdir -p "$(dirname "$dd")" || die "cannot create $(dirname "$dd")" 1
218
- if [ -f "$dd" ]; then
219
- if [ "$(g_sha256_file "$dd")" = "$(g_sha256_file "$f")" ]; then
220
- g_info "unchanged ${dd#"$TARGET"/}"
221
- else
222
- g_err "refusing to overwrite ${dd#"$TARGET"/}: it exists with different content and goblin-stack did not install it — remove or rename it first"
223
- COPY_REFUSALS=$((COPY_REFUSALS + 1))
224
- fi
225
- continue
226
- fi
227
- cp "$f" "$dd" || die "cannot write $dd" 1
228
- g_info "wrote ${dd#"$TARGET"/}"
229
- done < <(find "$src" -type f | sort)
230
- return 0
231
- }
232
-
233
- # install_skill <row> — copy the payload's skill dirs into the platform skills root
234
- # (per sync_platforms) or .gob/extras/ (standalone).
235
- install_skill() {
236
- local row="$1" id name src_root dst_root d n=0
237
- id=$(catalogue_field "$row" 1)
238
- src_root="$PAYLOAD/$id"
239
- [ -d "$src_root" ] \
240
- || die "no vendored payload for '$id' at $src_root — extras install needs no network: vendor the accepted skill dirs there first (see extras-catalogue/payload/README.md)" 2
241
- if [ -n "$PLATFORM" ]; then
242
- dst_root="$TARGET/$(adapter_skills_root "$PLATFORM")"
243
- dst_root="${dst_root%/}/"
244
- else
245
- dst_root="$TARGET/.gob/extras"
246
- fi
247
- [ -n "$(adapter_skills_root "$PLATFORM")" ] || [ -z "$PLATFORM" ] \
248
- || die "adapter '$PLATFORM' carries no project skills path" 2
249
- for d in "$src_root"/*/; do
250
- [ -d "$d" ] || continue
251
- name=$(basename "$d")
252
- n=$((n + 1))
253
- g_info "extras: skill $name -> ${dst_root#"$TARGET"/}$name/"
254
- copy_tree "$d" "$dst_root/$name"
255
- done
256
- [ "$n" -gt 0 ] || die "payload for '$id' holds no skill dirs ($src_root/*/ with SKILL.md each) — see extras-catalogue/payload/README.md" 2
257
- return 0
258
- }
259
-
260
- # install_workflow <row> — copy the payload into .gob/playbooks/<id>/.
261
- install_workflow() {
262
- local row="$1" id src dst
263
- id=$(catalogue_field "$row" 1)
264
- src="$PAYLOAD/$id"
265
- [ -d "$src" ] \
266
- || die "no vendored payload for '$id' at $src — vendor the playbook files there first (see extras-catalogue/payload/README.md)" 2
267
- dst="$TARGET/.gob/playbooks/$id"
268
- g_info "extras: workflow $id -> ${dst#"$TARGET"/}/"
269
- copy_tree "$src" "$dst"
270
- return 0
271
- }
272
-
273
- # install_mcp <row> — print the mcp.json snippet; --with-mcp-config merges it into
274
- # the target's .mcp.json. The merge NEVER overwrites: an existing entry for the same
275
- # server name must match the generated bytes (no-op) or the merge refuses (ask-once).
276
- install_mcp() {
277
- local row="$1" id hint cmd rest first_arg
278
- id=$(catalogue_field "$row" 1)
279
- hint=$(catalogue_field "$row" 14)
280
- case "$hint" in
281
- npx\ *|npm\ exec\ *)
282
- read -r cmd rest <<< "$hint"
283
- first_arg="$rest" ;;
284
- *)
285
- if [ "$WITH_MCP" -eq 1 ]; then
286
- die "id '$id' carries install_hint '$hint' — only an 'npx <package>' hint can be merged into .mcp.json; follow the row's own hint by hand" 1
287
- fi
288
- g_info "extras: mcp $id — install per the row's own hint: $hint (no .mcp.json snippet is generated for it)"
289
- return 0 ;;
290
- esac
291
- local snippet
292
- snippet=$(python3 -c 'import json,sys; print(json.dumps({"mcpServers": {sys.argv[1]: {"command": sys.argv[2], "args": sys.argv[3].split()}}}, separators=(",",":")))' "$id" "$cmd" "$first_arg")
293
- g_info "extras: mcp $id — mcp.json snippet:"
294
- g_info " $snippet"
295
- [ "$WITH_MCP" -eq 1 ] || return 0
296
- [ "$DRYRUN" -eq 0 ] || { g_info "plan: merge $id into ${TARGET#.}/.mcp.json"; return 0; }
297
- MERGE_OUT=$(MCP_ID="$id" MCP_SNIPPET="$snippet" python3 - "$TARGET/.mcp.json" <<'PYEOF'
298
- import json, os, sys
299
- path = sys.argv[1]
300
- mcp_id = os.environ["MCP_ID"]
301
- snippet = json.loads(os.environ["MCP_SNIPPET"])
302
- server = snippet["mcpServers"][mcp_id]
303
- data = {}
304
- if os.path.exists(path):
305
- raw = open(path).read().strip()
306
- if raw:
307
- try:
308
- data = json.loads(raw)
309
- except ValueError:
310
- sys.stderr.write("extras: refusing %s: it is not valid JSON - edit it by hand\n" % path)
311
- sys.exit(1)
312
- servers = data.setdefault("mcpServers", {})
313
- if mcp_id in servers:
314
- if servers[mcp_id] == server:
315
- print("extras: unchanged %s (already carries the %s registration)" % (path, mcp_id))
316
- sys.exit(0)
317
- sys.stderr.write("extras: refusing to overwrite the existing %s entry in %s - an mcp registration you customized is the project's (ask-once)\n" % (mcp_id, path))
318
- sys.exit(1)
319
- servers[mcp_id] = server
320
- with open(path, "w") as fh:
321
- json.dump(data, fh, separators=(",", ":"))
322
- fh.write("\n")
323
- print("extras: merged %s into %s" % (mcp_id, path))
324
- PYEOF
325
- )
326
- local rc=$?
327
- [ -n "$MERGE_OUT" ] && printf '%s\n' "$MERGE_OUT"
328
- [ "$rc" -eq 0 ] || exit 1
329
- return 0
330
- }
331
-
332
- cmd_install() {
333
- parse_install "$@"
334
- [ "$DRYRUN" -eq 0 ] || g_info "extras: --dry-run (nothing is written)"
335
- local id row
336
- for id in "${IDS[@]}"; do
337
- row=$(resolve_one "$id") || exit $?
338
- case "$(catalogue_field "$row" 3)" in
339
- skill) install_skill "$row" ;;
340
- workflow) install_workflow "$row" ;;
341
- mcp) install_mcp "$row" ;;
342
- *) die "row '$id' carries unknown kind '$(catalogue_field "$row" 3)' (want skill|mcp|workflow)" 2 ;;
343
- esac
344
- done
345
- [ "$COPY_REFUSALS" -eq 0 ] || die "$COPY_REFUSALS file(s) refused (named above) — nothing overwritten" 1
346
- return 0
347
- }
348
-
349
- # ---- dispatch ------------------------------------------------------------------
350
- CMD="${1:-}"
351
- [ -n "$CMD" ] || { usage; exit 2; }
352
- shift
353
- case "$CMD" in
354
- list) cmd_list "$@" ;;
355
- show) cmd_show "$@" ;;
356
- install) cmd_install "$@" ;;
357
- -h|--help|help) usage; exit 0 ;;
358
- *) g_err "extras: unknown subcommand: $CMD"; usage >&2; exit 2 ;;
359
- esac
360
- exit 0
package/bin/goblin-model DELETED
@@ -1,105 +0,0 @@
1
- #!/usr/bin/env bash
2
- # goblin-model — resolve a ROLE to provider/model/effort, by reading one mapping file.
3
- #
4
- # Usage:
5
- # goblin-model <role> [--models <file>] [--config <AGENTS.md>] [--roles <roles.yaml>] [--json]
6
- # goblin-model --list
7
- #
8
- # A role is what the work needs (code | judgment | review-panel | synthesis | investigate).
9
- # A profile is a worker identity. This tool never invents a model: it looks the role's
10
- # default profile up in the mapping file and prints what that file says.
11
- #
12
- # The mapping file is the ONE install-time machine input. goblin-stack READS it and never
13
- # writes it. Absent on this machine -> every role resolves to `unknown`, and the model-related
14
- # checks in goblin-verify report advisory instead of failing.
15
- #
16
- # Output, one line per lane: <profile> <provider> <model> <effort>
17
-
18
- set -uo pipefail
19
-
20
- SELF_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
21
- # shellcheck source=goblin-lib.sh
22
- . "$SELF_DIR/goblin-lib.sh"
23
-
24
- ROLE=""
25
- MODELS="${GOBLIN_MODELS:-$HOME/projects/fleet-model.yaml}"
26
- CONFIG=""
27
- ROLES=""
28
- JSON=0
29
- LIST=0
30
-
31
- while [ $# -gt 0 ]; do
32
- case "$1" in
33
- --models) MODELS="${2:-}"; MODELS_EXPLICIT=1; shift 2 ;;
34
- --config) CONFIG="${2:-}"; shift 2 ;;
35
- --roles) ROLES="${2:-}"; shift 2 ;;
36
- --json) JSON=1; shift ;;
37
- --list) LIST=1; shift ;;
38
- -h|--help) sed -n '2,16p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
39
- -*) g_err "unknown option: $1"; exit 2 ;;
40
- *) ROLE="$1"; shift ;;
41
- esac
42
- done
43
-
44
- ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
45
- [ -n "$ROOT" ] || ROOT="$PWD"
46
-
47
- # Config: explicit, else the installed one, else none.
48
- if [ -z "$CONFIG" ]; then
49
- if [ -f "$ROOT/AGENTS.md" ]; then CONFIG="$ROOT/AGENTS.md"; fi
50
- fi
51
- if [ -n "$CONFIG" ] && [ -z "${MODELS_EXPLICIT:-}" ]; then
52
- m=$(g_agents_read "$CONFIG" models_file)
53
- [ -n "$m" ] && MODELS="$m"
54
- fi
55
- MODELS=$(g_expand_tilde "$MODELS")
56
-
57
- if [ -z "$ROLES" ]; then
58
- if [ -f "$ROOT/.gob/roles.yaml" ]; then ROLES="$ROOT/.gob/roles.yaml"
59
- else ROLES="$SELF_DIR/../roles.yaml"; fi
60
- fi
61
- [ -f "$ROLES" ] || { g_err "no roles file at $ROLES"; exit 2; }
62
-
63
- roles_list() {
64
- awk '/^role-/{ n = $0; sub(/^role-/, "", n); sub(/:.*/, "", n); print n }' "$ROLES"
65
- }
66
-
67
- if [ "$LIST" -eq 1 ]; then
68
- for r in $(roles_list); do
69
- printf '%-14s %s\n' "$r" "$(g_yaml_block_scalar "$ROLES" "role-$r" capability)"
70
- done
71
- exit 0
72
- fi
73
-
74
- [ -n "$ROLE" ] || { g_err "a role is required (see --list)"; exit 2; }
75
-
76
- if ! roles_list | grep -qx "$ROLE"; then
77
- g_err "unknown role '$ROLE'; known: $(roles_list | paste -sd'|' -)"
78
- exit 2
79
- fi
80
-
81
- profiles=$(g_yaml_block_scalar "$ROLES" "role-$ROLE" profiles)
82
- profiles=$(printf '%s' "$profiles" | tr -d '[]' | tr ',' ' ')
83
- [ -n "${profiles// /}" ] || { g_err "role $ROLE declares no profiles"; exit 2; }
84
-
85
- if [ ! -f "$MODELS" ]; then
86
- g_info "no model mapping configured: $MODELS is absent"
87
- for p in $profiles; do
88
- if [ "$JSON" -eq 1 ]; then printf '{"role":"%s","profile":"%s","provider":"unknown","model":"unknown","effort":"unknown"}\n' "$ROLE" "$p"
89
- else printf '%s unknown unknown unknown\n' "$p"; fi
90
- done
91
- exit 0
92
- fi
93
-
94
- for p in $profiles; do
95
- prov=$(g_models_field "$MODELS" "$p" provider)
96
- model=$(g_models_field "$MODELS" "$p" model)
97
- eff=$(g_models_field "$MODELS" "$p" effort)
98
- prov=${prov:-unknown}; model=${model:-unknown}; eff=${eff:-unknown}
99
- if [ "$JSON" -eq 1 ]; then
100
- printf '{"role":"%s","profile":"%s","provider":"%s","model":"%s","effort":"%s"}\n' "$ROLE" "$p" "$prov" "$model" "$eff"
101
- else
102
- printf '%s %s %s %s\n' "$p" "$prov" "$model" "$eff"
103
- fi
104
- done
105
- exit 0