@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-bans CHANGED
@@ -9,8 +9,21 @@
9
9
  # 0 the tree is clean
10
10
  # 1 the ban is violated - the exit code alone decides; stdout, when any, names the lines
11
11
  # 2 the check could not run (FAIL CLOSED - a missing tool is never a silent pass)
12
- # A ban the config's `bans:` list does not name is SKIPPED with that reason; a ban whose
13
- # globs match no file is SKIPPED with that reason. A missing or empty ban table is exit 2.
12
+ # A ban RUNS when its `applies_when` cell selects it. A ban named in the DISABLE
13
+ # list `bans_disabled:` (default empty) is SKIPPED with that reason, naming the key. A ban whose
14
+ # `applies_when` does not select it is NOT APPLICABLE: it is reported as a SKIP with that reason,
15
+ # never silently green (a ban that does not apply must be visible as such). A missing or empty ban
16
+ # table is exit 2.
17
+ #
18
+ # `applies_when` has TWO forms (a ban is applicable only when the repo actually HAS the stack it
19
+ # polices — a false green is the one failure this product must never produce):
20
+ # * a GLOB list (`**/*.ts **/*.tsx`): the ban applies when at least one REAL file in the repo
21
+ # matches any glob (the harness's own .gob/.hermes dirs are not source and are excluded);
22
+ # * a PREDICATE (`dep:<pkg>[,<pkg>...]`, e.g. `dep:electron`): the ban applies only when the
23
+ # repo's package.json names EVERY listed package under `dependencies` or `devDependencies`.
24
+ # With no package.json, or without the package, the ban reports itself NOT APPLICABLE. This is
25
+ # what stops the four electron bans from running (and vacuously passing) on a repo that has no
26
+ # electron at all: the shipped checks/*.mjs is the HARNESS's own file, not the repo's stack.
14
27
  #
15
28
  # A narrow, explicit exception (Dune rule 5) reaches the probe through its environment, so it can
16
29
  # change the VERDICT and not only the printed detail: GOBLIN_BANS_ID (the ban) and
@@ -28,7 +41,7 @@
28
41
 
29
42
  set -uo pipefail
30
43
 
31
- GOBLIN_BANS_VERSION="0.6.0-alpha.3"
44
+ GOBLIN_BANS_VERSION="0.6.0-beta.1"
32
45
  SELF_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
33
46
  # shellcheck source=goblin-lib.sh
34
47
  . "$SELF_DIR/goblin-lib.sh"
@@ -82,22 +95,17 @@ if [ "$LIST" -eq 1 ]; then
82
95
  exit 0
83
96
  fi
84
97
 
85
- # ---- the config: which bans this project turns on, and its narrow exceptions --
86
- ENABLED=""
98
+ # ---- the config: which bans this project turns OFF, and its narrow exceptions --
99
+ # A ban's selection is its `applies_when` glob, and nothing else (below). The ONLY config knob
100
+ # is an explicit DISABLE list, `bans_disabled:` (default empty): a ban named there is skipped
101
+ # with that reason. There is no allow-list — a ban is on whenever a real file matches its glob.
102
+ DISABLED=""
87
103
  if [ -f "$CONFIG" ]; then
88
- ENABLED=$(g_agents_list "$CONFIG" bans | tr '\n' ' ')
89
- # The electron opt-in (software class): `electron: true` turns the electron ban set ON even
90
- # when a hand-edited bans: list omits it — the declaration is the contract, and the engine
91
- # (not the LLM) is what makes a listed ban non-skippable. A repo without the key is unaffected.
92
- if [ "$(g_agents_read "$CONFIG" electron)" = "true" ]; then
93
- for e in BN-06 BN-07 BN-08 BN-09; do
94
- case " $ENABLED " in *" $e "*) ;; *) ENABLED="$ENABLED $e" ;; esac
95
- done
96
- fi
104
+ DISABLED=$(g_agents_list "$CONFIG" bans_disabled | tr '\n' ' ')
97
105
  fi
98
- enabled() {
99
- [ -z "$ENABLED" ] && return 1
100
- for e in $ENABLED; do [ "$e" = "$1" ] && return 0; done
106
+ disabled() {
107
+ [ -z "$DISABLED" ] && return 1
108
+ for e in $DISABLED; do [ "$e" = "$1" ] && return 0; done
101
109
  return 1
102
110
  }
103
111
 
@@ -122,25 +130,93 @@ only_selected() {
122
130
  return 1
123
131
  }
124
132
 
133
+ # package_dep <pkg> -> 0 when $ROOT/package.json names <pkg> under `dependencies` or
134
+ # `devDependencies`. No jq/node: an awk state machine tracks brace depth inside those two objects
135
+ # (and only those two — `peerDependencies`/`optionalDependencies` do not count) and looks for the
136
+ # quoted key. A missing package.json, or a package named elsewhere (a script, a comment), is a
137
+ # NON-match — the ban's stack is absent.
138
+ package_dep() {
139
+ local pkg="$1" f="$ROOT/package.json"
140
+ [ -f "$f" ] || return 1
141
+ awk -v pkg="$pkg" '
142
+ {
143
+ line = $0
144
+ if (inobj) {
145
+ if (index(line, "\"" pkg "\"")) found = 1
146
+ n = length(line)
147
+ for (i = 1; i <= n; i++) { c = substr(line, i, 1); if (c == "{") d++; else if (c == "}") d-- }
148
+ if (d <= 0) inobj = 0
149
+ next
150
+ }
151
+ if (line ~ /"(dev)?[Dd]ependencies"[[:space:]]*:[[:space:]]*\{/) {
152
+ inobj = 1; d = 0
153
+ n = length(line)
154
+ for (i = 1; i <= n; i++) { c = substr(line, i, 1); if (c == "{") d++; else if (c == "}") d-- }
155
+ if (index(line, "\"" pkg "\"")) found = 1
156
+ if (d <= 0) inobj = 0
157
+ }
158
+ }
159
+ END { exit !found }
160
+ ' "$f"
161
+ }
162
+
163
+ # applies <applies_when> -> 0 when the ban applies. On a 1, sets APPLIES_WHY to the reason the ban
164
+ # is NOT APPLICABLE (a ban that does not apply must say so, never sit silently green). Two forms:
165
+ # * dep:<pkg>[,<pkg>...] — the repo's package.json names every listed package (dependencies or
166
+ # devDependencies). The electron bans use this so they never run on a repo with no electron,
167
+ # where the harness's own shipped checks/*.mjs would otherwise match a glob and pass vacuously.
168
+ # * a GLOB list — at least one REAL file in the repo matches any glob (globstar; the harness's
169
+ # own .gob/.hermes dirs are excluded so a ban cannot claim applicability from the payload
170
+ # goblin-stack itself wrote).
171
+ applies() {
172
+ local cell="$1" g
173
+ APPLIES_WHY=""
174
+ case "$cell" in
175
+ dep:*)
176
+ local pkgs="${cell#dep:}" miss="" p
177
+ for p in $(printf '%s' "$pkgs" | tr ',' ' '); do
178
+ package_dep "$p" || miss="$miss $p"
179
+ done
180
+ [ -z "$miss" ] && return 0
181
+ if [ ! -f "$ROOT/package.json" ]; then
182
+ APPLIES_WHY="not applicable: no package.json, so nothing declares $pkgs"
183
+ else
184
+ APPLIES_WHY="not applicable: package.json does not name${miss} in dependencies or devDependencies"
185
+ fi
186
+ return 1 ;;
187
+ esac
188
+ for g in $cell; do
189
+ ( cd "$ROOT" 2>/dev/null || exit 1
190
+ shopt -s globstar nullglob dotglob
191
+ for f in $g; do
192
+ case "$f" in .git/*|.gob/*|.hermes/*|*/node_modules/*) continue ;; esac
193
+ [ -e "$f" ] && exit 0
194
+ done
195
+ exit 1 ) && return 0
196
+ done
197
+ APPLIES_WHY="not applicable: no file matches applies_when: $cell"
198
+ return 1
199
+ }
200
+
125
201
  # ---- run ---------------------------------------------------------------------
126
202
  PASS=0; FAIL=0; SKIP=0; SEL=0
127
- while IFS=$'\t' read -r id ban globs detect replacement escape reviewer source; do
203
+ while IFS=$'\t' read -r id ban globs detect replacement escape reviewer source applies_when; do
128
204
  [ "$id" = "id" ] && continue
129
205
  [ -n "$id" ] || continue
130
206
  only_selected "$id" || continue
131
207
  SEL=$((SEL + 1))
132
208
 
133
- if ! enabled "$id"; then
134
- SKIP=$((SKIP + 1)); g_skip "$id" "$ban (not enabled in bans: - add $id to the bans: array in AGENTS.md to turn it on)"
209
+ # The DISABLE list is the only config knob (default empty). A ban named there is skipped with
210
+ # the key named; otherwise the glob alone decides whether it applies.
211
+ if disabled "$id"; then
212
+ SKIP=$((SKIP + 1)); g_skip "$id" "$ban (disabled in bans_disabled: - remove $id from the bans_disabled: list in AGENTS.md to turn it on)"
135
213
  continue
136
214
  fi
137
- # A ban whose globs match no file is a SKIP with a reason, not a pass and not a fail.
138
- have_glob=0
139
- for g in $globs; do
140
- [ -e "$ROOT/$g" ] && have_glob=1
141
- done
142
- if [ "$have_glob" -eq 0 ]; then
143
- SKIP=$((SKIP + 1)); g_skip "$id" "$ban (no matching files: $globs)"
215
+ # applies_when self-selects the ban: a ban whose cell does not select it is reported
216
+ # NOT APPLICABLE (a SKIP with that reason), never silently green. applies() sets APPLIES_WHY
217
+ # to the reason (glob form: no matching file; predicate form: package.json does not name the dep).
218
+ if ! applies "$applies_when"; then
219
+ SKIP=$((SKIP + 1)); g_skip "$id" "$ban ($APPLIES_WHY)"
144
220
  continue
145
221
  fi
146
222