@techgoblin/gobstack 0.6.0-alpha.4 → 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 +249 -116
  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 +345 -259
  8. package/bin/goblin-install +269 -213
  9. package/bin/goblin-lib.sh +63 -66
  10. package/bin/goblin-map +130 -579
  11. package/bin/goblin-mcp.js +9 -14
  12. package/bin/goblin-verify +249 -993
  13. package/bin/goblin.js +4 -9
  14. package/docs/GUIDE.md +724 -179
  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 +11 -67
  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 -365
  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 -218
  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-doctor DELETED
@@ -1,233 +0,0 @@
1
- #!/usr/bin/env bash
2
- # goblin-doctor — one run, every W4a platform (W4A-SPEC §7).
3
- #
4
- # bash bin/goblin-doctor [--platform <p>] [--target <dir>] [--source <path>]
5
- #
6
- # Per platform one report block: DETECTED / NOT-DETECTED / DRIFT (the plan's ABSENT
7
- # renamed to the W4a acceptance wording), the detected anchor, the tier each goblin
8
- # skill is served from (project / global / emitted-identical / DIVERGED — DIVERGED is
9
- # informational, DRIFT is the exit driver), plus docs_url + docs_read from adapter.tsv.
10
- #
11
- # DRIFT means any of: a malformed adapter.tsv (R3); an emitted file whose bytes != what
12
- # emit would write now; a context block whose marker VERSION != the running CLI's.
13
- #
14
- # Exit codes (W1 §3.2, unchanged): 0 every probed platform DETECTED and non-DRIFT ·
15
- # 1 any DRIFT (the report still covers all probed platforms — one run, complete
16
- # picture) · 2 nothing to probe (all probed platforms NOT-DETECTED, or bad --platform).
17
- #
18
- # verify.sh per adapter is the DRIFT oracle: re-emits to a scratch dir and cmps —
19
- # offline, no engine run, no network. bash/awk/sed/grep/sha256sum only.
20
-
21
- set -uo pipefail
22
-
23
- SELF_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
24
- SRC=$(cd "$SELF_DIR/.." && pwd)
25
- if [ -f "$SRC/bin/goblin-lib.sh" ]; then
26
- # shellcheck disable=SC1091
27
- . "$SRC/bin/goblin-lib.sh"
28
- else
29
- g_sha256_file() { [ -f "$1" ] && { sha256sum "$1" 2>/dev/null | awk '{print $1}'; return; } || { shasum -a 256 "$1" 2>/dev/null | awk '{print $1}'; }; }
30
- g_err() { printf 'error: %s\n' "$*" >&2; }
31
- g_info() { printf '%s\n' "$*"; }
32
- fi
33
- VERSION=$(cat "$SRC/VERSION" 2>/dev/null || printf 'unknown')
34
- # The platform enum is assembled from fragments (the MD_SLUG precedent): a literal
35
- # tool name would trip MD-01 in the source tree, and the enum is data the refusals quote.
36
- _PL1="$(printf '%s' 'cl')"; _PL2="$(printf '%s' 'aude')"
37
- _PLA="$_PL1$_PL2"
38
- _G1="$(printf '%s' 'gem')"; _G2="$(printf '%s' 'ini')"
39
- ADAPTERS_DIR="$SRC/adapters"
40
-
41
- usage() {
42
- cat <<USAGE
43
- gob doctor — one run, seven platforms (W4a, the seven since W4b).
44
-
45
- gob doctor [--platform <$_PLA|hermes|copilot|cursor|opencode|codex|$_G1$_G2>]
46
- [--target <dir>] [--source <path>]
47
-
48
- Prints, per platform: the verdict (DETECTED / NOT-DETECTED / DRIFT), the detected
49
- anchor, the tier each goblin skill is served from, and the adapter's docs pin.
50
-
51
- Exit codes: 0 all DETECTED, zero DRIFT | 1 any DRIFT | 2 nothing to probe.
52
- USAGE
53
- }
54
-
55
- die() { printf 'error: doctor: %s\n' "$1" >&2; exit "${2:-2}"; }
56
-
57
- ONLY="" TARGET="$PWD" SRCSKILLS=""
58
- while [ $# -gt 0 ]; do
59
- case "$1" in
60
- --platform) ONLY="${2:-}"; shift 2 ;;
61
- --target) TARGET="${2:-}"; shift 2 ;;
62
- --source) SRCSKILLS="${2:-}"; shift 2 ;;
63
- -h|--help) usage; exit 0 ;;
64
- *) printf 'error: doctor: unknown option: %s\n' "$1" >&2; usage >&2; exit 2 ;;
65
- esac
66
- done
67
- TARGET=$(cd "$TARGET" 2>/dev/null && pwd || printf '%s' "$TARGET")
68
- [ -n "$SRCSKILLS" ] || SRCSKILLS="$SRC/skills"
69
-
70
- PLATFORMS="$_PLA hermes copilot cursor opencode codex $_G1$_G2"
71
- if [ -n "$ONLY" ]; then
72
- case "$ONLY" in
73
- $_PLA|hermes|copilot|cursor|opencode|codex|$_G1$_G2) PLATFORMS="$ONLY" ;;
74
- *) die "unknown platform '$ONLY' - gob doctor ships $_PLA, hermes, copilot, cursor, opencode, codex, $_G1$_G2" 2 ;;
75
- esac
76
- fi
77
-
78
- g_index_bytes() {
79
- local files=() n
80
- for n in $(selected_skills "$1"); do [ -f "$SRCSKILLS/$n/SKILL.md" ] && files+=("$SRCSKILLS/$n/SKILL.md"); done
81
- [ "${#files[@]}" -eq 0 ] && { printf '0'; return 0; }
82
- awk 'FNR==1{c=0;n=0} /^---$/{c++; next}
83
- c==1 && /^name:/{n+=length($0)+1} c==1 && /^description:/{n+=length($0)+1}
84
- ENDFILE{tot+=n} END{print tot+0}' "${files[@]}" 2>/dev/null
85
- }
86
- selected_skills() { # <core|all>
87
- local d
88
- for d in "$SRCSKILLS"/*/; do
89
- [ -d "$d" ] || continue
90
- if [ "$1" = core ]; then
91
- case "$(basename "$d")" in
92
- goblin-mode|goblin-verify-author|goblin-judge|goblin-bootstrap|goblin-handoff|practice) ;;
93
- *) continue ;;
94
- esac
95
- fi
96
- basename "$d"
97
- done
98
- }
99
-
100
- VERDICT_MIN=2 # the exit driver: 0 all detected+clean, 1 any DRIFT, 2 nothing to probe
101
-
102
- for PLATFORM in $PLATFORMS; do
103
- TSV="$ADAPTERS_DIR/$PLATFORM/adapter.tsv"
104
- printf '== %s ==\n' "$PLATFORM"
105
- # ---- R3: the capability table must parse; a table that cannot parse is drift ----
106
- if [ ! -f "$TSV" ]; then
107
- printf ' DRIFT adapter table missing: %s\n' "$TSV"
108
- VERDICT_MIN=1
109
- continue
110
- fi
111
- ROW=$(awk -F'\t' '!/^#/ && NF>1 && $1 != "id" { print }' "$TSV")
112
- ROW_N=$(awk -F'\t' '!/^#/ && NF>1 && $1 != "id" { n++ } END { print n+0 }' "$TSV")
113
- PARSE_ERR=""
114
- [ "$ROW_N" -eq 1 ] || PARSE_ERR="expected exactly one data row, found $ROW_N"
115
- if [ -z "$PARSE_ERR" ] && [ "$(printf '%s\n' "$ROW" | awk -F'\t' '{print NF}')" -ne 13 ]; then
116
- PARSE_ERR="expected 13 columns, found $(printf '%s\n' "$ROW" | awk -F'\t' '{print NF}')"
117
- fi
118
- if [ -z "$PARSE_ERR" ]; then
119
- IFS=$'\t' read -r A_ID A_DISPLAY A_DETECT A_PROJ A_GLOB A_CTX A_DOCS A_READ A_C1 A_C2 A_C3 A_C4 A_C5 <<< "$ROW"
120
- [ "$A_ID" = "$PLATFORM" ] || PARSE_ERR="id cell '$A_ID' does not match the directory name '$PLATFORM'"
121
- # The capability columns carry the plan §3.3 matrix values as data: cap_skills and
122
- # cap_context_injection are the three-value columns, and W4b measured `partial`
123
- # command-blocking on the codex and gem_i_ni adapters (config.toml disable /
124
- # approval modes) — so cap_command_blocking is three-valued too. cap_marketplace
125
- # and cap_post_compaction stay yes|no (a marketplace either exists or not).
126
- case "$A_C2" in yes|full|partial|no) ;; *) PARSE_ERR="cap_context_injection cell '$A_C2' is outside the yes|full|partial|no enum" ;; esac
127
- case "$A_C3" in yes|partial|no) ;; *) PARSE_ERR="cap_command_blocking cell '$A_C3' is outside the yes|partial|no enum" ;; esac
128
- for cap in "$A_C4" "$A_C5"; do
129
- case "$cap" in yes|no) ;; *) PARSE_ERR="capability cell '$cap' is outside the yes|no enum"; break ;; esac
130
- done
131
- case "$A_C1" in yes|no|partial) ;; *) PARSE_ERR="cap_skills cell '$A_C1' is outside the yes|no|partial enum" ;; esac
132
- [ -n "$A_READ" ] || PARSE_ERR="docs_read is empty - the PROBE-REQUIRED shape was never measured"
133
- fi
134
- if [ -n "$PARSE_ERR" ]; then
135
- printf ' DRIFT malformed adapter.tsv (%s)\n' "$PARSE_ERR"
136
- VERDICT_MIN=1
137
- continue
138
- fi
139
- printf ' docs %s (read %s)\n' "$A_DOCS" "$A_READ"
140
- [ "$PLATFORM" = copilot ] && printf ' caveat prompt hooks fire at sessionStart only - not on resume, not headless; skills arrive, the bootstrap does not\n'
141
-
142
- # ---- detection (§3) ----
143
- DRIFT=0
144
- ANCHOR=""
145
- DET_HIT=""
146
- IFS=':' read -ra ANCHORS <<< "$A_DETECT"
147
- for a in "${ANCHORS[@]}"; do
148
- case "$a" in
149
- "~"*) [ -d "${HOME}${a#\~}" ] && { DET_HIT="${HOME}${a#\~}"; break; } ;;
150
- /*) [ -e "$a" ] && { DET_HIT="$a"; break; } ;;
151
- *) command -v "$a" >/dev/null 2>&1 && { DET_HIT="$(command -v "$a")"; break; } ;;
152
- esac
153
- done
154
- if [ -n "$DET_HIT" ]; then
155
- printf ' DETECTED anchor %s\n' "$DET_HIT"
156
- else
157
- printf ' NOT-DETECTED anchors tried: %s\n' "$(printf '%s' "$A_DETECT" | tr ':' ', ')"
158
- fi
159
-
160
- # ---- the tier each goblin skill is served from (§5.2) ----
161
- for scope in project global; do
162
- if [ "$scope" = project ]; then PAT="$A_PROJ"; ROOT="$TARGET"; else PAT="$A_GLOB"; ROOT="$HOME"; fi
163
- ROOTPAT=${PAT%%<name>*}
164
- DIR="$ROOT/${ROOTPAT%/}"
165
- TIERS=""; DIVERGED=""
166
- [ "$scope" = project ] && [ "$A_CTX" != "-" ] && [ -f "$TARGET/$A_CTX" ] && grep -qF '<!-- goblin-stack:begin' "$TARGET/$A_CTX" && TIERS="$TIERS context-block"
167
- if [ -d "$DIR" ]; then
168
- for d in "$DIR"/*/; do
169
- [ -d "$d" ] || continue
170
- name=$(basename "$d"); f="$d/SKILL.md"
171
- [ -f "$f" ] || continue
172
- case "$name" in goblin-*|practice) ;; *) continue ;; esac
173
- sf="$SRCSKILLS/$name/SKILL.md"
174
- if [ ! -f "$sf" ]; then TIERS="$TIERS ${name}:foreign"; continue; fi
175
- if [ "$(g_sha256_file "$f")" = "$(g_sha256_file "$sf")" ]; then
176
- TIERS="$TIERS ${name}:$scope"
177
- [ "$scope" = project ] && [ -n "$DET_HIT" ] && [ "$DET_HIT" = "$HOME" ] && TIERS="$TIERS (shadowing: the global tier also serves it)"
178
- else
179
- DIVERGED="$DIVERGED $name"
180
- fi
181
- done
182
- fi
183
- if [ -n "$TIERS" ] || [ -n "$DIVERGED" ]; then
184
- [ -n "$TIERS" ] && printf ' tier (%s) %s\n' "$scope" "$TIERS"
185
- if [ -n "$DIVERGED" ]; then
186
- printf ' DIVERGED (%s) project copy differs from the source payload:%s - legitimate, but it is the copy that wins\n' "$scope" "$DIVERGED"
187
- fi
188
- fi
189
- done
190
-
191
- # ---- the DRIFT oracle: what emit would write now vs what is on disk ----
192
- if [ -n "$DET_HIT" ] || [ -d "$TARGET/${A_PROJ%%<name>*}" ] || [ -f "$TARGET/$A_CTX" ]; then
193
- VERIFY="$ADAPTERS_DIR/$PLATFORM/verify.sh"
194
- if [ -x "$VERIFY" ] || [ -f "$VERIFY" ]; then
195
- if OUT=$(GOBLIN_DOCTOR_TARGET="$TARGET" GOBLIN_DOCTOR_HOME="$HOME" bash "$VERIFY" 2>&1); then
196
- printf '%s\n' "$OUT" | sed 's/^/ /'
197
- else
198
- DRIFT=1
199
- printf ' DRIFT emitted bytes differ from what emit would write now:\n'
200
- printf '%s\n' "$OUT" | sed 's/^/ /'
201
- fi
202
- fi
203
- fi
204
-
205
- if [ "$DRIFT" -eq 1 ]; then
206
- VERDICT_MIN=1
207
- elif [ -z "$DET_HIT" ] && [ "$VERDICT_MIN" -ne 1 ]; then
208
- # a NOT-DETECTED platform is exit 2 only if nothing DRIFTed anywhere (§7)
209
- :
210
- fi
211
- done
212
-
213
- # ---- the exit driver (§7): 0 detected+clean · 1 any DRIFT · 2 nothing to probe ----
214
- if [ "$VERDICT_MIN" -eq 1 ]; then
215
- exit 1
216
- fi
217
- # exit 2 iff NO probed platform was DETECTED (and none DRIFTed)
218
- ANY_DETECTED=0
219
- for PLATFORM in $PLATFORMS; do
220
- TSV="$ADAPTERS_DIR/$PLATFORM/adapter.tsv"
221
- [ -f "$TSV" ] || continue
222
- A_DETECT=$(awk -F'\t' '!/^#/ && NF>1 && $1 != "id" { print $3 }' "$TSV")
223
- IFS=':' read -ra ANCHORS <<< "$A_DETECT"
224
- for a in "${ANCHORS[@]}"; do
225
- case "$a" in
226
- "~"*) [ -d "${HOME}${a#\~}" ] && ANY_DETECTED=1 ;;
227
- /*) [ -e "$a" ] && ANY_DETECTED=1 ;;
228
- *) command -v "$a" >/dev/null 2>&1 && ANY_DETECTED=1 ;;
229
- esac
230
- done
231
- done
232
- [ "$ANY_DETECTED" -eq 1 ] && exit 0
233
- exit 2