@techgoblin/gobstack 0.6.0-alpha.4 → 0.6.0-beta.2
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 +59 -0
- package/README.md +249 -116
- 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 +345 -259
- package/bin/goblin-install +269 -213
- package/bin/goblin-lib.sh +63 -66
- package/bin/goblin-map +130 -579
- package/bin/goblin-mcp.js +9 -14
- package/bin/goblin-verify +411 -993
- package/bin/goblin.js +4 -9
- package/docs/CURATION-2026-11-07-gobigrams.md +223 -0
- package/docs/GUIDE.md +727 -179
- package/docs/LIMITS.md +297 -301
- package/docs/RECORD-NOTES.md +1 -2
- package/manifest/bans.tsv +9 -9
- package/manifest/categories.tsv +18 -0
- package/manifest/enforcement.tsv +14 -67
- 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-handoff/SKILL.md +5 -0
- package/skills/goblin-verify-author/SKILL.md +14 -2
- package/skills/practice/SKILL.md +4 -4
- package/templates/AGENTS.md.tmpl +6 -6
- package/templates/HANDOFF.md.tmpl +8 -6
- 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 -365
- 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 -218
- 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-extras
DELETED
|
@@ -1,365 +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() { local msg="$1"; shift; g_err "extras: $msg"; exit "${1:-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
|
-
# QA fix (v2-qa issue 9): the display path must carry exactly one separator between
|
|
254
|
-
# $dst_root and $name — the old single format printed `.gob/extras` + `taste` as
|
|
255
|
-
# `.gob/extrastaste/` (files landed in the right place, only the LOG lied). The
|
|
256
|
-
# platform branch normalizes $dst_root to end in /, the standalone branch does not,
|
|
257
|
-
# so the trailing slashes are stripped at print time and one / is always inserted.
|
|
258
|
-
printf 'extras: skill %s -> %s/%s/\n' "$name" "${dst_root%/}" "$name"
|
|
259
|
-
copy_tree "$d" "$dst_root/$name"
|
|
260
|
-
done
|
|
261
|
-
[ "$n" -gt 0 ] || die "payload for '$id' holds no skill dirs ($src_root/*/ with SKILL.md each) — see extras-catalogue/payload/README.md" 2
|
|
262
|
-
return 0
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
# install_workflow <row> — copy the payload into .gob/playbooks/<id>/.
|
|
266
|
-
install_workflow() {
|
|
267
|
-
local row="$1" id src dst
|
|
268
|
-
id=$(catalogue_field "$row" 1)
|
|
269
|
-
src="$PAYLOAD/$id"
|
|
270
|
-
[ -d "$src" ] \
|
|
271
|
-
|| die "no vendored payload for '$id' at $src — vendor the playbook files there first (see extras-catalogue/payload/README.md)" 2
|
|
272
|
-
dst="$TARGET/.gob/playbooks/$id"
|
|
273
|
-
g_info "extras: workflow $id -> ${dst#"$TARGET"/}/"
|
|
274
|
-
copy_tree "$src" "$dst"
|
|
275
|
-
return 0
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
# install_mcp <row> — print the mcp.json snippet; --with-mcp-config merges it into
|
|
279
|
-
# the target's .mcp.json. The merge NEVER overwrites: an existing entry for the same
|
|
280
|
-
# server name must match the generated bytes (no-op) or the merge refuses (ask-once).
|
|
281
|
-
install_mcp() {
|
|
282
|
-
local row="$1" id hint cmd rest first_arg
|
|
283
|
-
id=$(catalogue_field "$row" 1)
|
|
284
|
-
hint=$(catalogue_field "$row" 14)
|
|
285
|
-
case "$hint" in
|
|
286
|
-
npx\ *|npm\ exec\ *)
|
|
287
|
-
read -r cmd rest <<< "$hint"
|
|
288
|
-
first_arg="$rest" ;;
|
|
289
|
-
*)
|
|
290
|
-
if [ "$WITH_MCP" -eq 1 ]; then
|
|
291
|
-
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
|
|
292
|
-
fi
|
|
293
|
-
g_info "extras: mcp $id — install per the row's own hint: $hint (no .mcp.json snippet is generated for it)"
|
|
294
|
-
return 0 ;;
|
|
295
|
-
esac
|
|
296
|
-
local snippet
|
|
297
|
-
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")
|
|
298
|
-
g_info "extras: mcp $id — mcp.json snippet:"
|
|
299
|
-
g_info " $snippet"
|
|
300
|
-
[ "$WITH_MCP" -eq 1 ] || return 0
|
|
301
|
-
[ "$DRYRUN" -eq 0 ] || { g_info "plan: merge $id into ${TARGET#.}/.mcp.json"; return 0; }
|
|
302
|
-
MERGE_OUT=$(MCP_ID="$id" MCP_SNIPPET="$snippet" python3 - "$TARGET/.mcp.json" <<'PYEOF'
|
|
303
|
-
import json, os, sys
|
|
304
|
-
path = sys.argv[1]
|
|
305
|
-
mcp_id = os.environ["MCP_ID"]
|
|
306
|
-
snippet = json.loads(os.environ["MCP_SNIPPET"])
|
|
307
|
-
server = snippet["mcpServers"][mcp_id]
|
|
308
|
-
data = {}
|
|
309
|
-
if os.path.exists(path):
|
|
310
|
-
raw = open(path).read().strip()
|
|
311
|
-
if raw:
|
|
312
|
-
try:
|
|
313
|
-
data = json.loads(raw)
|
|
314
|
-
except ValueError:
|
|
315
|
-
sys.stderr.write("extras: refusing %s: it is not valid JSON - edit it by hand\n" % path)
|
|
316
|
-
sys.exit(1)
|
|
317
|
-
servers = data.setdefault("mcpServers", {})
|
|
318
|
-
if mcp_id in servers:
|
|
319
|
-
if servers[mcp_id] == server:
|
|
320
|
-
print("extras: unchanged %s (already carries the %s registration)" % (path, mcp_id))
|
|
321
|
-
sys.exit(0)
|
|
322
|
-
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))
|
|
323
|
-
sys.exit(1)
|
|
324
|
-
servers[mcp_id] = server
|
|
325
|
-
with open(path, "w") as fh:
|
|
326
|
-
json.dump(data, fh, separators=(",", ":"))
|
|
327
|
-
fh.write("\n")
|
|
328
|
-
print("extras: merged %s into %s" % (mcp_id, path))
|
|
329
|
-
PYEOF
|
|
330
|
-
)
|
|
331
|
-
local rc=$?
|
|
332
|
-
[ -n "$MERGE_OUT" ] && printf '%s\n' "$MERGE_OUT"
|
|
333
|
-
[ "$rc" -eq 0 ] || exit 1
|
|
334
|
-
return 0
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
cmd_install() {
|
|
338
|
-
parse_install "$@"
|
|
339
|
-
[ "$DRYRUN" -eq 0 ] || g_info "extras: --dry-run (nothing is written)"
|
|
340
|
-
local id row
|
|
341
|
-
for id in "${IDS[@]}"; do
|
|
342
|
-
row=$(resolve_one "$id") || exit $?
|
|
343
|
-
case "$(catalogue_field "$row" 3)" in
|
|
344
|
-
skill) install_skill "$row" ;;
|
|
345
|
-
workflow) install_workflow "$row" ;;
|
|
346
|
-
mcp) install_mcp "$row" ;;
|
|
347
|
-
*) die "row '$id' carries unknown kind '$(catalogue_field "$row" 3)' (want skill|mcp|workflow)" 2 ;;
|
|
348
|
-
esac
|
|
349
|
-
done
|
|
350
|
-
[ "$COPY_REFUSALS" -eq 0 ] || die "$COPY_REFUSALS file(s) refused (named above) — nothing overwritten" 1
|
|
351
|
-
return 0
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
# ---- dispatch ------------------------------------------------------------------
|
|
355
|
-
CMD="${1:-}"
|
|
356
|
-
[ -n "$CMD" ] || { usage; exit 2; }
|
|
357
|
-
shift
|
|
358
|
-
case "$CMD" in
|
|
359
|
-
list) cmd_list "$@" ;;
|
|
360
|
-
show) cmd_show "$@" ;;
|
|
361
|
-
install) cmd_install "$@" ;;
|
|
362
|
-
-h|--help|help) usage; exit 0 ;;
|
|
363
|
-
*) g_err "extras: unknown subcommand: $CMD"; usage >&2; exit 2 ;;
|
|
364
|
-
esac
|
|
365
|
-
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
|