@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-lib.sh CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
  # goblin-lib.sh — shared helpers for goblin-stack.
3
3
  #
4
- # Sourced by bin/goblin-install, bin/goblin-verify and bin/goblin-model.
4
+ # Sourced by bin/goblin-install and bin/goblin-verify.
5
5
  # Dependencies: bash 4+, git, awk, sed, grep, sha256sum (or shasum).
6
6
  # No npm, no jq, no yq, no network.
7
7
  #
@@ -16,7 +16,7 @@
16
16
  # - name: typecheck four-space-indented second member of a list entry
17
17
  # cmd: npx tsc --noEmit
18
18
 
19
- GOBLIN_LIB_VERSION="0.6.0-alpha.3"
19
+ GOBLIN_LIB_VERSION="0.6.0-beta.1"
20
20
 
21
21
  # ---------------------------------------------------------------- output -----
22
22
  # g_trunc <width> <text> — fold a long detail to one line at <width> columns, keeping the
@@ -31,6 +31,9 @@ g_trunc() {
31
31
  # <indent> (the cannot-see footer shape). Byte-safe: awk length on bytes approximates
32
32
  # columns for ASCII prose, which is all this text is.
33
33
  g_fold() {
34
+ # QA fix (v2-qa issue 9): the rest-assignment used to inline substr() as sub()'s third
35
+ # parameter — not a changeable lvalue, a hard error on gawk 5.2+ (the helper had never
36
+ # been exercised until the remedy fold called it). A temp variable is portable awk.
34
37
  awk -v w="$1" -v ind="$2" '
35
38
  {
36
39
  line = $0
@@ -39,10 +42,9 @@ g_fold() {
39
42
  while (cut > 1 && substr(line, cut, 1) != " ") cut--
40
43
  if (cut <= 1) cut = w
41
44
  print substr(line, 1, cut)
42
- sub(/^[ ]+/, "", substr(line, cut + 1))
43
- line = substr(line, cut + 1)
44
- sub(/^[ ]+/, "", line)
45
- line = ind line
45
+ rest = substr(line, cut + 1)
46
+ sub(/^[ ]+/, "", rest)
47
+ line = ind rest
46
48
  }
47
49
  print line
48
50
  }'
@@ -60,7 +62,7 @@ g_pass() {
60
62
  }
61
63
  # FAIL keeps its row line whole in every mode, and the matrix's remedy column rides under it.
62
64
  # The remedy is the TSV's own cell (IN-01/IN-02/GT-03/CM-01 carry prose there; the pre-remedy
63
- # rows carry `—`, which prints nothing) — the JG-02 judge-lane `remedy:` line, brought to every
65
+ # rows carry `—`, which prints nothing) — a `remedy:` line, brought to every
64
66
  # row that names one, so the fix a failure needs is printed where the failure is read. A missing
65
67
  # column (a manifest written before the column existed) is no remedy, not an error: empty is the
66
68
  # same as `—`.
@@ -71,12 +73,16 @@ g_fail() {
71
73
  case "$rem" in
72
74
  —*) return 0 ;; # an em-dash cell: history and blindness, never a remedy
73
75
  esac
74
- # Whole in verbose/--only mode (the mode that reads, not scans), width-folded otherwise —
75
- # the same contract the row printers keep.
76
- if [ "${GOB_VERIFY_VERBOSE:-0}" -eq 1 ]; then
77
- [ -n "$rem" ] && printf 'remedy: %s\n' "$rem"
78
- else
79
- [ -n "$rem" ] && printf 'remedy: %s\n' "$(g_trunc "${GOB_REPORT_COLS:-100}" "$rem")"
76
+ # QA fix (v2-qa issue 9): a remedy is an instruction, not a detail line — truncating it
77
+ # with a ~ cut the command the operator had to type (measured: 'git -c user.ema~').
78
+ # The remedy is now WORD-FOLDED to continuation lines at the report width in every
79
+ # mode (whole text either way); --verbose keeps the single-line form it always had.
80
+ if [ -n "$rem" ]; then
81
+ if [ "${GOB_VERIFY_VERBOSE:-0}" -eq 1 ]; then
82
+ printf 'remedy: %s\n' "$rem"
83
+ else
84
+ printf 'remedy: %s\n' "$rem" | g_fold "${GOB_REPORT_COLS:-100}" " "
85
+ fi
80
86
  fi
81
87
  }
82
88
  g_remedy() {
@@ -264,16 +270,15 @@ g_part_disabled() {
264
270
  g_yaml_disabled "$1" | grep -qx "$2"
265
271
  }
266
272
 
267
- # ------------------------------------------------------------- class data ----
268
273
  # ------------------------------------------------------------- agents.md -----
269
274
  # v2 config engine: the project config lives in AGENTS.md FRONTMATTER, delimited by
270
- # fixed markers. There is no goblin.yaml. One file is the single source of truth:
275
+ # fixed markers. There is no separate config file. One file is the single source of truth:
271
276
  #
272
277
  # <!-- gob:begin (gobstack config) -->
273
- # class: software
274
- # branch: main
278
+ # harness_dir: checks
279
+ # source_root: src
275
280
  # ratchet.ceiling: 160 # one nested level = a dotted key
276
- # bans: [BN-01, BN-02] # a list is a one-line JSON-ish array
281
+ # bans_disabled: [BN-02] # a list is a one-line JSON-ish array (the ban OFF-switch)
277
282
  # gate_commit_cmd: git rev-parse --verify --quiet HEAD
278
283
  # <!-- gob:end -->
279
284
  #
@@ -427,41 +432,6 @@ g_agents_write() {
427
432
  rm -f "$tmp" "$tmp.out"; return 1
428
433
  }
429
434
 
430
- # g_class_canon <spelling> -> the canonical class NAME
431
- # software | service | game | research | fleet
432
- # The taxonomy is five domain-named classes. The letters A-E and the older taught domain names
433
- # (app, agent, desktop) stay as READ-TIME aliases so every existing installed.json / goblin.yaml
434
- # - which record a letter or an old name - keeps verifying with no rewrite. `desktop` / `F` / `f`
435
- # resolve to `software`: F was merged into A (their classes.tsv need columns are identical), and
436
- # what made a desktop shell different is the `electron:` opt-in + ban list, config keys the repo
437
- # already carries. Unknown spelling -> empty output; the caller refuses with the enum.
438
- g_class_canon() {
439
- case "$1" in
440
- software|A|a|app) printf 'software' ;;
441
- service|B|b) printf 'service' ;;
442
- game|C|c) printf 'game' ;;
443
- research|D|d) printf 'research' ;;
444
- fleet|E|e|agent) printf 'fleet' ;;
445
- desktop|F|f) printf 'software' ;;
446
- *) return 1 ;;
447
- esac
448
- }
449
-
450
- # g_class_is_electron_alias <spelling> -> 0 when the spelling is the merged desktop/F spelling.
451
- # `--class desktop` (or F/f) must mean the OLD desktop install, not a silently weaker software
452
- # one: the installer auto-sets electron: true so the alias behaves as F did.
453
- g_class_is_electron_alias() {
454
- case "$1" in desktop|F|f) return 0 ;; *) return 1 ;; esac
455
- }
456
-
457
- # g_class_need <classes.tsv> <class> <part> -> R | O | -
458
- g_class_need() {
459
- awk -F'\t' -v c="$2" -v p="$3" '
460
- NR > 1 && $1 == c && $2 == p { print $3; found = 1; exit }
461
- END { if (!found) print "-" }
462
- ' "$1"
463
- }
464
-
465
435
  # ---------------------------------------------------------------- json -------
466
436
  # installed.json is emitted by goblin-install in a fixed, line-oriented shape so it can
467
437
  # be read without a JSON library. g_json_object <installed.json> <object-name> -> "key<TAB>value".
@@ -539,8 +509,8 @@ g_self_test() {
539
509
  local tmp rc=0
540
510
  tmp=$(mktemp -d 2>/dev/null || mktemp -d -t goblin) || { g_err "mktemp failed"; return 2; }
541
511
  cat > "$tmp/g.yaml" <<'YAML'
542
- class: B
543
- branch: master
512
+ flavour: B
513
+ revision: master
544
514
  archive: false
545
515
  disabled: [spec, tokens]
546
516
  gates:
@@ -550,13 +520,13 @@ ratchet:
550
520
  name: hex
551
521
  ceiling: 160
552
522
  runtime_data:
553
- - .goblin/state.json
523
+ - .gob/state.json
554
524
  YAML
555
525
 
556
526
  local got
557
- got=$(g_yaml_scalar "$tmp/g.yaml" class)
527
+ got=$(g_yaml_scalar "$tmp/g.yaml" flavour)
558
528
  [ "$got" = "B" ] || { g_err "scalar: expected B, got '$got'"; rc=1; }
559
- got=$(g_yaml_scalar "$tmp/g.yaml" branch)
529
+ got=$(g_yaml_scalar "$tmp/g.yaml" revision)
560
530
  [ "$got" = "master" ] || { g_err "scalar: expected master, got '$got'"; rc=1; }
561
531
  got=$(g_yaml_scalar "$tmp/g.yaml" nosuchkey)
562
532
  [ -z "$got" ] || { g_err "scalar: absent key should be empty, got '$got'"; rc=1; }
@@ -580,7 +550,7 @@ YAML
580
550
  got=$(g_yaml_gate_names "$tmp/g2.yaml" | tr '\n' ',')
581
551
  [ "$got" = "typecheck,reindented," ] || { g_err "gate-names: got '$got'"; rc=1; }
582
552
  got=$(g_yaml_list "$tmp/g.yaml" runtime_data | tr '\n' ',')
583
- [ "$got" = ".goblin/state.json," ] || { g_err "list: got '$got'"; rc=1; }
553
+ [ "$got" = ".gob/state.json," ] || { g_err "list: got '$got'"; rc=1; }
584
554
  got=$(g_yaml_disabled "$tmp/g.yaml" | tr '\n' ',')
585
555
  [ "$got" = "spec,tokens," ] || { g_err "disabled: got '$got'"; rc=1; }
586
556
 
@@ -591,10 +561,9 @@ YAML
591
561
  House rules the agent reads. The block below is machine-read.
592
562
 
593
563
  <!-- gob:begin (gobstack config — edit in place; the parser reads only this block) -->
594
- class: software
595
- branch: main
564
+ flavour: software
565
+ revision: main
596
566
  archive: false
597
- owner_email: team@example.com
598
567
  disabled: [spec, tokens]
599
568
  ratchet.name: hex
600
569
  ratchet.ceiling: 160
@@ -602,11 +571,11 @@ gate_typecheck_cmd: npx tsc --noEmit
602
571
  gate_commit_cmd: git rev-parse --verify --quiet HEAD
603
572
  <!-- gob:end -->
604
573
 
605
- Body prose continues here. A line like `class: decoy` outside the block must stay
574
+ Body prose continues here. A line like `flavour: decoy` outside the block must stay
606
575
  invisible to the parser.
607
576
  EOF
608
- printf 'class: decoy\n' >> "$tmp/AGENTS.md"
609
- got=$(g_agents_read "$tmp/AGENTS.md" class)
577
+ printf 'flavour: decoy\n' >> "$tmp/AGENTS.md"
578
+ got=$(g_agents_read "$tmp/AGENTS.md" flavour)
610
579
  [ "$got" = "software" ] || { g_err "agents scalar: expected software, got '$got'"; rc=1; }
611
580
  got=$(g_agents_read "$tmp/AGENTS.md" nosuchkey)
612
581
  [ -z "$got" ] || { g_err "agents scalar: absent key should be empty, got '$got'"; rc=1; }
@@ -623,35 +592,35 @@ commit:git rev-parse --verify --quiet HEAD" ] \
623
592
  got=$(g_agents_list "$tmp/AGENTS.md" disabled | tr '\n' ',')
624
593
  [ "$got" = "spec,tokens," ] || { g_err "agents list: got '$got'"; rc=1; }
625
594
  got=$(g_agents_keys "$tmp/AGENTS.md" | head -n 1)
626
- [ "$got" = "class" ] || { g_err "agents keys: got '$got'"; rc=1; }
595
+ [ "$got" = "flavour" ] || { g_err "agents keys: got '$got'"; rc=1; }
627
596
  # g_agents_write: stdin IS the whole new block (key<TAB>value lines); it rewrites
628
597
  # ONLY the block and preserves the body. Idempotent on a second identical write.
629
598
  {
630
- printf '%s\tsoftware\n' class
631
- printf '%s\tmain\n' branch
599
+ printf '%s\tsoftware\n' flavour
600
+ printf '%s\tmain\n' revision
632
601
  printf '%s\t42\n' max_dirty
633
602
  } | g_agents_write "$tmp/AGENTS.md" >/dev/null
634
603
  grep -q '^max_dirty: 42$' "$tmp/AGENTS.md" || { g_err "agents write: the new key is absent"; rc=1; }
635
604
  grep -qF 'Body prose continues here' "$tmp/AGENTS.md" \
636
605
  || { g_err "agents write: the body was not preserved"; rc=1; }
637
- grep -qF 'class: decoy' "$tmp/AGENTS.md" \
606
+ grep -qF 'flavour: decoy' "$tmp/AGENTS.md" \
638
607
  || { g_err "agents write: the body below the block was not preserved"; rc=1; }
639
- W1=$(g_agents_read "$tmp/AGENTS.md" class)
608
+ W1=$(g_agents_read "$tmp/AGENTS.md" flavour)
640
609
  [ "$W1" = "software" ] || { g_err "agents write: the block was destroyed ($W1)"; rc=1; }
641
610
  {
642
- printf '%s\tsoftware\n' class
643
- printf '%s\tmain\n' branch
611
+ printf '%s\tsoftware\n' flavour
612
+ printf '%s\tmain\n' revision
644
613
  printf '%s\t42\n' max_dirty
645
614
  } | g_agents_write "$tmp/AGENTS.md" > "$tmp/w2"
646
615
  grep -q unchanged "$tmp/w2" || { g_err "agents write: the second identical write is not a no-op"; rc=1; }
647
616
  # A fresh file: the block is created, and a body-less write stays parseable.
648
- printf '%s\ttrue\n' "electron" | g_agents_write "$tmp/fresh.md" >/dev/null
649
- [ "$(g_agents_read "$tmp/fresh.md" electron)" = "true" ] \
617
+ printf '%s\ttrue\n' "toggle" | g_agents_write "$tmp/fresh.md" >/dev/null
618
+ [ "$(g_agents_read "$tmp/fresh.md" toggle)" = "true" ] \
650
619
  || { g_err "agents write: a fresh file was not created parseable"; rc=1; }
651
620
  # A body-only file: the block is inserted before the first line.
652
621
  printf 'the body\n' > "$tmp/bodyonly.md"
653
- printf '%s\tmain\n' "branch" | g_agents_write "$tmp/bodyonly.md" >/dev/null
654
- [ "$(g_agents_read "$tmp/bodyonly.md" branch)" = "main" ] \
622
+ printf '%s\tmain\n' "revision" | g_agents_write "$tmp/bodyonly.md" >/dev/null
623
+ [ "$(g_agents_read "$tmp/bodyonly.md" revision)" = "main" ] \
655
624
  && grep -qx 'the body' "$tmp/bodyonly.md" \
656
625
  || { g_err "agents write: insertion into a body-only file failed"; rc=1; }
657
626
 
@@ -664,6 +633,40 @@ commit:git rev-parse --verify --quiet HEAD" ] \
664
633
  return "$rc"
665
634
  }
666
635
 
636
+ # g_next_block <target> <skills yes|no> [<declared-gate label>]
637
+ # THE one ordered next-steps list a completed install prints. `gob init --write` runs the engine
638
+ # (goblin-install), which calls this; init then calls it again for its own tail — so a user sees
639
+ # ONE list, never the two the front-door engine and the installer each used to print. Every line
640
+ # is true of the artefact the user now has:
641
+ # * the install is uncommitted (the record is written last and git is the user's to run);
642
+ # * verify re-runs the gate the config declares (GT-02);
643
+ # * when a gate LABEL is given the gate is the one the user declared and `gob init --write`
644
+ # MEASURED before writing it, so no edit is owed — the advice is only "edit the default gate"
645
+ # on a bare `goblin-install`, whose shipped gate is a generic default;
646
+ # * the seven-skill CORE tier ships under .gob/skills/ on EVERY install, so the agent-skill
647
+ # switch is about the .hermes/ project tier, not about whether any skill is present.
648
+ g_next_block() {
649
+ local target="$1" skills="$2" gate="${3:-}" gline
650
+ if [ -n "$gate" ]; then
651
+ gline="the gate is the one you declared and gob init measured ($gate); edit AGENTS.md's gate_ keys when it changes"
652
+ else
653
+ gline="edit AGENTS.md: replace the default gate with your real commands"
654
+ fi
655
+ printf 'next:\n'
656
+ printf ' 1. cd %s && git add -A && git commit # the install is uncommitted by design\n' "$target"
657
+ printf ' 2. .gob/bin/goblin-verify # re-runs the gate the config declares; green on a fresh repo\n'
658
+ printf ' 3. %s\n' "$gline"
659
+ if [ "$skills" = "yes" ]; then
660
+ printf ' 4. hermes skills trust %s # one-time, so the .hermes/ project tier loads\n' "$target"
661
+ elif [ "$skills" = "no" ]; then
662
+ printf ' 4. the core goblin tier ships under .gob/skills/ by default; the .hermes/ project tier is opt-in: re-run with --skills yes\n'
663
+ elif [ "$skills" = "all" ]; then
664
+ printf ' 4. all skills vendored under .gob/skills/; the .hermes/ project tier is opt-in: re-run with --skills yes\n'
665
+ else
666
+ printf ' 4. vendored under .gob/skills/: %s; the .hermes/ project tier is opt-in: re-run with --skills yes\n' "$skills"
667
+ fi
668
+ }
669
+
667
670
  # Allow `bash bin/goblin-lib.sh --self-test` and `source bin/goblin-lib.sh`.
668
671
  if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
669
672
  case "${1:-}" in