chill-agent 1.4.0 → 1.5.0

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 (67) hide show
  1. package/.agents/rules/ponytail.md +30 -0
  2. package/.claude-plugin/marketplace.json +17 -0
  3. package/.clinerules/ponytail.md +30 -0
  4. package/.cursor/rules/ponytail.mdc +36 -0
  5. package/.grok-plugin/marketplace.json +16 -0
  6. package/.kiro/steering/ponytail.md +35 -0
  7. package/.openclaw/skills/ponytail/SKILL.md +52 -0
  8. package/.openclaw/skills/ponytail-audit/SKILL.md +103 -0
  9. package/.openclaw/skills/ponytail-debt/SKILL.md +44 -0
  10. package/.openclaw/skills/ponytail-gain/SKILL.md +52 -0
  11. package/.openclaw/skills/ponytail-help/SKILL.md +76 -0
  12. package/.openclaw/skills/ponytail-review/SKILL.md +101 -0
  13. package/.opencode/command/ponytail-audit.md +5 -0
  14. package/.opencode/command/ponytail-debt.md +5 -0
  15. package/.opencode/command/ponytail-gain.md +5 -0
  16. package/.opencode/command/ponytail-help.md +5 -0
  17. package/.opencode/command/ponytail-review.md +5 -0
  18. package/.opencode/command/ponytail.md +5 -0
  19. package/.opencode/plugins/index.js +4 -0
  20. package/.opencode/plugins/ponytail-frontmatter.cjs +63 -0
  21. package/.opencode/plugins/ponytail.mjs +206 -0
  22. package/.windsurf/rules/ponytail.md +30 -0
  23. package/AGENTS.md +19 -0
  24. package/__init__.py +228 -0
  25. package/commands/ponytail-audit.toml +2 -0
  26. package/commands/ponytail-debt.toml +2 -0
  27. package/commands/ponytail-gain.toml +2 -0
  28. package/commands/ponytail-help.toml +2 -0
  29. package/commands/ponytail-review.toml +2 -0
  30. package/commands/ponytail.toml +2 -0
  31. package/hooks/chill-statusline.ps1 +1 -1
  32. package/hooks/ponytail-activate.js +201 -0
  33. package/hooks/ponytail-instructions.js +98 -0
  34. package/hooks/ponytail-mode-tracker.js +216 -0
  35. package/hooks/ponytail-runtime.js +182 -0
  36. package/hooks/ponytail-statusline.ps1 +24 -0
  37. package/hooks/ponytail-statusline.sh +18 -0
  38. package/package.json +9 -3
  39. package/pi-extension/index.js +254 -0
  40. package/pi-extension/package.json +8 -0
  41. package/scripts/check-rule-copies.js +74 -0
  42. package/scripts/check-versions.js +77 -0
  43. package/scripts/cursor-hooks.js +145 -0
  44. package/scripts/generate-chillslop.mjs +42 -0
  45. package/scripts/generate-examples.mjs +149 -0
  46. package/scripts/generate-plugin-doors.mjs +108 -0
  47. package/scripts/sync-ponytail.mjs +65 -0
  48. package/scripts/uninstall.js +92 -0
  49. package/skills/ponytail/SKILL.md +52 -0
  50. package/skills/ponytail-audit/SKILL.md +103 -0
  51. package/skills/ponytail-debt/SKILL.md +44 -0
  52. package/skills/ponytail-gain/SKILL.md +52 -0
  53. package/skills/ponytail-help/SKILL.md +76 -0
  54. package/skills/ponytail-review/SKILL.md +101 -0
  55. package/tests/commands.test.js +94 -0
  56. package/tests/copilot-plugin.test.js +35 -0
  57. package/tests/correctness.test.js +245 -0
  58. package/tests/cursor-hooks.test.js +343 -0
  59. package/tests/gemini-extension.test.js +91 -0
  60. package/tests/grok-plugin.test.js +39 -0
  61. package/tests/hermes-plugin.test.js +403 -0
  62. package/tests/hooks.test.js +1005 -0
  63. package/tests/kimi-plugin.test.js +25 -0
  64. package/tests/loc.test.js +18 -0
  65. package/tests/openclaw-skills.test.js +26 -0
  66. package/tests/opencode-plugin.test.js +340 -0
  67. package/tests/qoder-plugin.test.js +84 -0
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: ponytail-audit
3
+ description: >
4
+ Quality audit of a whole repo: bugs, security holes, what breaks under real
5
+ load, risky code without tests, slow paths, and what to delete, merge or
6
+ split. Ranked, each finding explained in plain English. One-shot report,
7
+ changes nothing. Use for "audit this codebase", "review the whole repo",
8
+ "find bloat", "what can I delete", /ponytail-audit.
9
+ ---
10
+
11
+ Audit the whole repo like the senior developer who just inherited it and
12
+ will be paged when it breaks. Order of importance: correct, safe, holds under
13
+ load, tested, fast, lean. Lean still matters: every extra line must be read,
14
+ tested and fixed later. This is a report the user asked for, so give it in full.
15
+
16
+ ## 1. Map first
17
+
18
+ - Audit what the user names: a folder, a package, or the whole repo.
19
+ Nothing named: the whole repo.
20
+ - Read the README, the deploy and build config, the dependency list, the
21
+ entry points (main, routes, handlers, jobs, CLI commands) and the tests.
22
+ - Find the expected load: one person running a script, or many users and
23
+ processes at once. Judge scale against that, and say which load you assumed.
24
+ - Trace the main flows end to end: where data comes in, what is stored,
25
+ what goes out. Read those paths fully: input from users, money, auth,
26
+ data writes, background jobs, anything shared between processes.
27
+ - Big repo: go deep where a mistake costs the most, not file by file. Say
28
+ which parts you did not read.
29
+
30
+ ## 2. Look for
31
+
32
+ 1. **Bug:** wrong result, crash, missed edge case (empty, zero, last item,
33
+ rounding, time zones), callers that disagree with what a function returns,
34
+ the same rule applied differently in two places.
35
+ 2. **Risk:** security holes (injection, weak randomness, secrets in code,
36
+ missing checks on input from users), data loss (errors swallowed, writes
37
+ in the wrong order, no transaction).
38
+ 3. **Scale:** fine for one user, wrong for many: check-then-write races, the
39
+ same work done by every process, memory or lists that only grow, a query
40
+ per item, O(n^2) on big input, per-process state that must be shared.
41
+ 4. **Missing test:** risky logic (a branch, a parser, money, security, data
42
+ writes) with no test that fails when it breaks. One good test, not coverage.
43
+ 5. **Speed:** big slowdowns are problems. Small wins (work repeated in a hot
44
+ loop) are suggestions; some software counts every millisecond.
45
+ 6. **Lean:** code that should not exist or should be smaller.
46
+ - delete: dead code, unused options, flags and config, speculative features
47
+ - reuse: two helpers doing the same thing (keep one, name the path)
48
+ - stdlib / native: the standard library or platform already does it;
49
+ a dependency doing what a few lines or the platform can do
50
+ - yagni: interface with one implementation, factory with one product,
51
+ wrapper that only passes calls through
52
+ - merge: near-copies that must change together
53
+ - split: one function or class doing several unrelated jobs, so it is
54
+ hard to read or test. Split by job, never by line count, and never into
55
+ helpers that exist only to make a function shorter.
56
+
57
+ ## 3. Check before you report
58
+
59
+ - Every finding needs a concrete case: "this input or situation leads to this
60
+ wrong result". No case, no finding.
61
+ - Before calling code unused, grep the whole tree for it, including tests,
62
+ fixtures, config, and string or dynamic references.
63
+ - A shortcut marked with a `shortcut:` (or older `ponytail:`) comment that names its limit is a
64
+ decision, not a finding, unless the expected load already crosses it.
65
+ - Propose the smallest fix that works. Prefer fixes that delete code. Never
66
+ add layers, frameworks or config the problem does not need.
67
+ - No style taste, no "consider", no vague worries.
68
+
69
+ ## 4. Output
70
+
71
+ Very simple English: short sentences, everyday words. Explain a technical
72
+ term the first time you use it. The reader may never have seen this code.
73
+
74
+ Start with `What this repo does:` in two or three sentences, and the load
75
+ you assumed.
76
+
77
+ Then the findings in three groups, most important first, skip empty groups:
78
+ - **Must fix:** bug, security, data loss, breaks at the expected load.
79
+ - **Should fix:** risky code without a test, real slowness, duplication, a
80
+ function that mixes jobs, code that should not exist.
81
+ - **Nice to have:** small speed-ups, shorter forms.
82
+
83
+ Number findings across all groups, so the user can say "fix 2 and 5". At
84
+ most 20 findings; if you left smaller ones out, say how many.
85
+ Every finding has all four parts, each one or two short sentences:
86
+
87
+ 2. **Orders land on the wrong day** (`billing/close_day.py:L40-52`)
88
+ - **What this is:** At midnight this job closes the day and bills all orders of that day.
89
+ - **Problem:** It takes "today" from the server clock, which runs in UTC. An order placed
90
+ at 00:30 in Berlin is billed on the day before.
91
+ - **Fix:** Compute the day once in the shop's time zone:
92
+ `datetime.now(ZoneInfo("Europe/Berlin")).date()`. One line, nothing else changes.
93
+ - **If we skip it:** Late orders show the wrong date, and accounting fixes them by hand.
94
+
95
+ End with:
96
+ - `Verdict:` one line: healthy, or what to fix first.
97
+ - `Lean: -<N> lines, -<M> dependencies possible.` when lean findings exist.
98
+ - `Not checked:` the parts you did not read or could not run.
99
+
100
+ Nothing found: `What this repo does:`, then `Healthy. Nothing to fix.` and
101
+ one line on what you checked.
102
+
103
+ One-shot report, changes no code.
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: ponytail-debt
3
+ description: >
4
+ List every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report,
5
+ changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the
6
+ shortcuts", /ponytail-debt.
7
+ ---
8
+
9
+ Every deliberate ponytail shortcut is marked with a `shortcut:` comment naming
10
+ its ceiling and upgrade path (older code may say `ponytail:`). This collects them into one ledger so a deferral
11
+ can't quietly become permanent.
12
+
13
+ ## Scan
14
+
15
+ Grep the repo for comment markers, skipping `.git` and everything the
16
+ `.gitignore` files ignore (dependencies, build output, caches, in any stack):
17
+
18
+ `git grep --no-index --exclude-standard -nE '(#|//|/[*]) ?(shortcut|ponytail):'` (add other comment prefixes if your stack uses them)
19
+
20
+ If the user names their own marker word (`/ponytail-debt TODO`), grep for that word instead.
21
+
22
+ Each hit is one ledger row. The comment prefix keeps prose that merely mentions
23
+ the convention out of the ledger. Skip hits that are not a deferral, like a note
24
+ about a keyboard shortcut.
25
+
26
+ ## Output
27
+
28
+ One row per marker, grouped by file:
29
+
30
+ `<file>:<line>, <what was simplified>. ceiling: <the limit named>. upgrade: <the trigger to revisit>.`
31
+
32
+ The convention is `shortcut: <ceiling>, <upgrade path>`, so pull the ceiling
33
+ and the trigger straight from the comment. Want an owner per row too? add
34
+ `git blame -L<line>,<line>`.
35
+
36
+ Flag the rot risk: any marker comment that names no upgrade path or
37
+ trigger gets a `no-trigger` tag, those are the ones that silently rot.
38
+
39
+ End with `<N> markers, <M> with no trigger.` Nothing found: `No shortcut debt. Clean ledger.`
40
+
41
+ ## Boundaries
42
+
43
+ Reads and reports only, changes nothing. To persist it, ask and it writes the
44
+ ledger to a file (e.g. `PONYTAIL-DEBT.md`). One-shot.
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: ponytail-gain
3
+ description: >
4
+ Show ponytail's measured savings (code, cost, speed) from the benchmark.
5
+ One-shot display. Use for /ponytail-gain, "what does ponytail save",
6
+ "ponytail impact".
7
+ ---
8
+
9
+ # Ponytail Gain
10
+
11
+ Display this scoreboard when invoked. One-shot: do NOT change mode, write flag
12
+ files, or persist anything.
13
+
14
+ The figures are the published agentic benchmark of Ponytail 5: headless Claude
15
+ Code (Opus 5.5, default effort) on 39 tasks (feature tickets in a real FastAPI +
16
+ React repo, bug fixes, security and privacy cases, small apps), 5 runs each,
17
+ against the same agent without the skill. 18 of the tasks have hidden checks
18
+ for correctness and safety. Each figure is the geometric mean of the per-task
19
+ medians. They are measured, not computed from the current repo.
20
+ Source: `benchmarks/results/2026-10-07-agentic.md` and the README.
21
+
22
+ ## Scoreboard
23
+
24
+ Render plain ASCII bars. The bar length shows ponytail as a share of the
25
+ no-skill baseline; the label carries the exact figure:
26
+
27
+ ```
28
+ ponytail gain benchmark · 39 tasks × 5 runs · Opus 5.5
29
+
30
+ no-skill ████████████████████ 100%
31
+ Lines of code █████████··········· 47% ▼ 53%
32
+ Output tokens ███████████········· 55% ▼ 45%
33
+ Cost ███████████████····· 74% ▼ 26%
34
+ Time ████████████········ 59% ▼ 41%
35
+ Hidden checks passed 97% (no-skill 96%)
36
+ Tests where the logic needs one 98% (no-skill 68%)
37
+
38
+ This repo: /ponytail-debt (shortcuts you deferred)
39
+ /ponytail-audit (what's still cuttable)
40
+ ```
41
+
42
+ ## Honesty boundary
43
+
44
+ These are benchmark averages, not this repo. NEVER print a per-repo savings
45
+ number ("you saved X lines/tokens here"): the unbuilt version was never
46
+ written, so there is no real baseline to subtract from in a live repo. The
47
+ only real per-repo figures come from `/ponytail-debt` (a counted ledger), and
48
+ this card points there instead of inventing one.
49
+
50
+ ## Boundaries
51
+
52
+ One-shot display. Edits nothing, changes no mode.
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: ponytail-help
3
+ description: >
4
+ Quick reference for ponytail levels, skills and commands. One-shot display.
5
+ Use for /ponytail-help, "ponytail help", "how do I use ponytail".
6
+ ---
7
+
8
+ # Ponytail Help
9
+
10
+ Display this reference card when invoked. One-shot, do NOT change mode,
11
+ write flag files, or persist anything.
12
+
13
+ ## Levels
14
+
15
+ | Level | Trigger | What change |
16
+ |-------|---------|-------------|
17
+ | **Lite** | `/ponytail lite` | Build what was asked, name the smaller option in one line. |
18
+ | **Full** | `/ponytail` | The smallest complete change, a check where the logic needs one, and a reply that names what was skipped and any risk. Default. |
19
+ | **Ultra** | `/ponytail ultra` | Also questions the request and pushes back before building. |
20
+
21
+ Level sticks until changed or session end.
22
+
23
+ ## Skills
24
+
25
+ | Skill | Trigger | What it does |
26
+ |-------|---------|--------------|
27
+ | **ponytail** | `/ponytail` | Lazy mode itself: least new code, clear replies that name skipped work and risks. |
28
+ | **ponytail-review** | `/ponytail-review` | Quality review of a diff: bugs, security, load, missing tests, speed, what to cut. Each finding says what goes wrong and how to fix it. |
29
+ | **ponytail-audit** | `/ponytail-audit` | The same quality review for the whole repo, ranked. |
30
+ | **ponytail-debt** | `/ponytail-debt` | Harvest `shortcut:` comments into a tracked ledger. |
31
+ | **ponytail-gain** | `/ponytail-gain` | Measured-impact scoreboard: less code, less cost, more speed. |
32
+ | **ponytail-help** | `/ponytail-help` | This card. |
33
+
34
+ In Codex CLI and the IDE extension, invoke skills with `$ponytail:ponytail`,
35
+ `$ponytail:ponytail-review`, or `$ponytail:ponytail-help`. Claude Code and OpenCode use the
36
+ slash-command forms above (OpenCode ships all six as slash commands).
37
+
38
+ ## Deactivate
39
+
40
+ Say "stop ponytail" or "normal mode". Resume anytime with `/ponytail`.
41
+ `/ponytail off` also works.
42
+
43
+ ## Band (Claude Code)
44
+
45
+ `/ponytail band` hides the band above the prompt, the same command brings it back.
46
+ `/ponytail band on` and `/ponytail band off` set it directly. The level stays.
47
+ `/ponytail band import` adds your past Claude Code sessions (cost, agent time, tokens) to the board.
48
+
49
+ ## Configure Default Mode
50
+
51
+ Default mode = `full`, auto-active every session. Change it:
52
+
53
+ **Environment variable** (highest priority):
54
+ ```bash
55
+ export PONYTAIL_DEFAULT_MODE=ultra
56
+ ```
57
+
58
+ **Config file** (`~/.config/ponytail/config.json`, Windows: `%APPDATA%\ponytail\config.json`):
59
+ ```json
60
+ { "defaultMode": "lite" }
61
+ ```
62
+
63
+ Set `"off"` to disable auto-activation on session start, activate manually
64
+ with `/ponytail` when wanted.
65
+
66
+ Resolution: env var > config file > `full`.
67
+
68
+ ## Update
69
+
70
+ Enable auto-update once: open `/plugin`, go to Marketplaces, pick ponytail, Enable auto-update. Claude Code then pulls new versions at startup (run `/reload-plugins` when it prompts). Manual refresh: `/plugin marketplace update ponytail` then `/reload-plugins`.
71
+
72
+ If `/plugin` is not recognized, your Claude Code is out of date. Update it (`npm install -g @anthropic-ai/claude-code@latest`, or `brew upgrade claude-code`) and restart. Other hosts use their own update flow.
73
+
74
+ ## More
75
+
76
+ Full docs + examples: https://github.com/DietrichGebert/ponytail
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: ponytail-review
3
+ description: >
4
+ Quality review of a change: is the logic right, is it safe, does it hold
5
+ under real load, is risky code tested, is it fast enough, and is every line
6
+ needed. Reads the connected code, not only the diff. Each finding is
7
+ explained in plain English. Use for "review this", "code review", "review
8
+ the last commit", "review my PR", "is this over-engineered", /ponytail-review.
9
+ ---
10
+
11
+ Review a change like the senior developer who will be paged when it breaks.
12
+ Order of importance: correct, safe, holds under load, tested, fast, lean.
13
+ Lean still matters: every extra line must be read, tested and fixed later.
14
+ This is a report the user asked for, so give it in full.
15
+
16
+ ## 1. Understand first
17
+
18
+ - Review what the user names: uncommitted or staged changes, a branch, a PR
19
+ link, or files. Nothing named: the uncommitted changes, or the last commit
20
+ if there are none.
21
+ - Read the diff, then the code it touches: callers of every changed function,
22
+ the functions it calls, the tests, the README.
23
+ - Trace the real flow: where data comes in, what is stored, what goes out.
24
+ - A change can break code it does not touch. When a signature, return value
25
+ or behavior changes, grep every caller.
26
+ - Find the expected load in the repo (README, deploy config): one person
27
+ running a script, or many users and processes at once. Judge scale against
28
+ that, and say which load you assumed.
29
+
30
+ ## 2. Look for
31
+
32
+ 1. **Bug:** wrong result, crash, missed edge case (empty, zero, last item,
33
+ rounding, time zones), a caller broken by the change, a fix applied in one
34
+ caller while the shared function stays broken.
35
+ 2. **Risk:** security holes (injection, weak randomness, secrets, missing
36
+ checks on input from users), data loss (errors swallowed, writes in the
37
+ wrong order, no transaction).
38
+ 3. **Scale:** fine for one user, wrong for many: check-then-write races, the
39
+ same work done by every process, memory or lists that only grow, a query
40
+ per item, O(n^2) on big input, per-process state that must be shared.
41
+ 4. **Missing test:** risky new logic (a branch, a parser, money, security,
42
+ data writes, a bug fix) with no test that fails when it breaks. One good
43
+ test, not coverage.
44
+ 5. **Speed:** big slowdowns are problems. Small wins (work repeated in a hot
45
+ loop) are suggestions; some software counts every millisecond.
46
+ 6. **Lean:** code that should not exist or should be smaller.
47
+ - delete: dead code, unused options, speculative features
48
+ - reuse: the repo already has this helper (name the path)
49
+ - stdlib / native: the standard library or platform already does it; a
50
+ new dependency for a few lines
51
+ - yagni: abstraction with one implementation, config nobody sets
52
+ - merge: near-copies that must change together
53
+ - split: one function doing several unrelated jobs, so it is hard to read
54
+ or test. Split by job, never by line count, and never into helpers that
55
+ exist only to make a function shorter.
56
+
57
+ ## 3. Check before you report
58
+
59
+ - Every finding needs a concrete case: "this input or situation leads to this
60
+ wrong result". No case, no finding.
61
+ - Re-read the lines and confirm: the caller exists, the value can really be
62
+ empty, the code really is unused.
63
+ - A shortcut marked with a `shortcut:` (or older `ponytail:`) comment that names its limit is a
64
+ decision, not a finding, unless the expected load already crosses it.
65
+ - Propose the smallest fix that works. Prefer fixes that delete code. Never
66
+ add layers, frameworks or config the problem does not need.
67
+ - No style taste, no "consider", no vague worries.
68
+
69
+ ## 4. Output
70
+
71
+ Very simple English: short sentences, everyday words. Explain a technical
72
+ term the first time you use it. The reader may never have seen this code.
73
+
74
+ Start with `What this change does:` in two or three sentences.
75
+
76
+ Then the findings in three groups, skip empty groups:
77
+ - **Must fix:** bug, security, data loss, breaks at the expected load.
78
+ - **Should fix:** risky code without a test, real slowness, duplication, a
79
+ function that mixes jobs, code that should not exist.
80
+ - **Nice to have:** small speed-ups, shorter forms.
81
+
82
+ Number findings across all groups, so the user can say "fix 2 and 5".
83
+ Every finding has all four parts, each one or two short sentences:
84
+
85
+ 2. **Orders land on the wrong day** (`billing/close_day.py:L40-52`)
86
+ - **What this is:** At midnight this job closes the day and bills all orders of that day.
87
+ - **Problem:** It takes "today" from the server clock, which runs in UTC. An order placed
88
+ at 00:30 in Berlin is billed on the day before.
89
+ - **Fix:** Compute the day once in the shop's time zone:
90
+ `datetime.now(ZoneInfo("Europe/Berlin")).date()`. One line, nothing else changes.
91
+ - **If we skip it:** Late orders show the wrong date, and accounting fixes them by hand.
92
+
93
+ End with:
94
+ - `Verdict: Ship.` or `Verdict: fix 1 and 3 first.`
95
+ - `Lean: -<N> lines possible.` when lean findings exist.
96
+ - `Not checked:` one line, if something mattered and you could not check it.
97
+
98
+ Nothing found: `What this change does:`, then `Looks good. Ship.` and one line
99
+ on what you checked.
100
+
101
+ Lists findings, changes no code.
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+ // Every ponytail command the pi extension registers must also ship as a
3
+ // file-based command for the hosts that need one: Claude Code (commands/*.toml,
4
+ // which Gemini CLI reuses) and OpenCode (.opencode/command/*.md). /ponytail-help
5
+ // was advertised in the README and the help card but missing both files; this
6
+ // guards that drift -- a registered command with no adapter file fails here.
7
+
8
+ const test = require('node:test');
9
+ const assert = require('node:assert/strict');
10
+ const { spawnSync } = require('child_process');
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+
14
+ const root = path.join(__dirname, '..');
15
+
16
+ // pi-extension registers the canonical command set.
17
+ const piSource = fs.readFileSync(path.join(root, 'pi-extension', 'index.js'), 'utf8');
18
+ const commands = [...piSource.matchAll(/registerCommand\(["']([\w-]+)["']/g)].map((m) => m[1]);
19
+
20
+ test('pi registers at least the base command', () => {
21
+ assert.ok(commands.includes('ponytail'), 'expected pi to register a ponytail command');
22
+ });
23
+
24
+ test('every registered command ships a Claude commands/*.toml', () => {
25
+ for (const name of commands) {
26
+ assert.ok(
27
+ fs.existsSync(path.join(root, 'commands', `${name}.toml`)),
28
+ `missing commands/${name}.toml`,
29
+ );
30
+ }
31
+ });
32
+
33
+ test('every registered command ships an OpenCode .opencode/command/*.md', () => {
34
+ for (const name of commands) {
35
+ assert.ok(
36
+ fs.existsSync(path.join(root, '.opencode', 'command', `${name}.md`)),
37
+ `missing .opencode/command/${name}.md`,
38
+ );
39
+ }
40
+ });
41
+
42
+ // /ponytail-debt documents one grep for the whole tree, shipped in four copies.
43
+ // It missed C-style /* ponytail: */ block comments (#810), so the ledger silently
44
+ // skipped every C/Java/CSS marker. Feed each shipped expression to real grep
45
+ // rather than restating it here: a copied regex only tests the copy.
46
+ const debtCopies = [
47
+ 'skills/ponytail-debt/SKILL.md',
48
+ '.openclaw/skills/ponytail-debt/SKILL.md',
49
+ 'commands/ponytail-debt.toml',
50
+ '.opencode/command/ponytail-debt.md',
51
+ ];
52
+ const debtSamples = [
53
+ ['# ponytail: hash marker', true],
54
+ ['#ponytail: hash marker, no space', true],
55
+ ['// ponytail: slash marker', true],
56
+ ['//ponytail: slash marker, no space', true],
57
+ ['/* ponytail: block marker, closed here */', true],
58
+ ['/*ponytail: block marker, no space */', true],
59
+ ['/* ponytail: block opener, closed some lines below', true],
60
+ ['prose that merely mentions ponytail: markers stays out of the ledger', false],
61
+ ];
62
+
63
+ test('every ponytail-debt copy greps #, // and /* markers but not prose', (t) => {
64
+ const input = debtSamples.map(([line]) => line).join('\n') + '\n';
65
+ const expected = debtSamples.flatMap(([line, hit], i) => (hit ? [`${i + 1}:${line}`] : []));
66
+
67
+ for (const rel of debtCopies) {
68
+ const documented = fs.readFileSync(path.join(root, rel), 'utf8').match(/git grep [^']*-nE '([^']+)'/);
69
+ assert.ok(documented, `${rel} no longer documents a git grep ... -nE '<pattern>'`);
70
+
71
+ const result = spawnSync('grep', ['-nE', documented[1]], { input, encoding: 'utf8', timeout: 5000 });
72
+ if (result.error) {
73
+ if (result.error.code === 'ENOENT') return t.skip('grep not available on this platform');
74
+ throw result.error;
75
+ }
76
+ assert.equal(result.status, 0, `grep failed for ${rel}: ${result.stderr}`);
77
+ assert.deepEqual(result.stdout.split('\n').filter(Boolean), expected, `${rel} misses or over-matches markers`);
78
+ }
79
+ });
80
+
81
+ // The full documented command must skip .git and whatever .gitignore ignores, in any stack (#948, #1100).
82
+ test('the ponytail-debt scan skips .git and ignored dirs like node_modules, dist, build and .next', (t) => {
83
+ const cmd = fs.readFileSync(path.join(root, 'skills/ponytail-debt/SKILL.md'), 'utf8').match(/`(git grep [^`]+)`/)[1];
84
+ const dir = fs.mkdtempSync(path.join(require('os').tmpdir(), 'ponytail-debt-'));
85
+ for (const sub of ['src', '.git', 'node_modules/pkg', 'dist', 'build', '.next']) {
86
+ fs.mkdirSync(path.join(dir, sub), { recursive: true });
87
+ fs.writeFileSync(path.join(dir, sub, 'a.js'), '// ponytail: marker\n');
88
+ }
89
+ fs.writeFileSync(path.join(dir, '.gitignore'), 'node_modules/\ndist/\nbuild/\n.next/\n');
90
+ const result = spawnSync('sh', ['-c', cmd], { cwd: dir, encoding: 'utf8', timeout: 5000 });
91
+ fs.rmSync(dir, { recursive: true, force: true });
92
+ if (result.error || result.status === 127) return t.skip(`sh/git not available: ${result.error ? result.error.code : result.stderr}`);
93
+ assert.deepEqual(result.stdout.split('\n').filter(Boolean), ['src/a.js:1:// ponytail: marker']);
94
+ });
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ // Smoke test for the Copilot plugin adapter: keep command wiring minimal and
3
+ // ensure the debt command is part of the shared command surface.
4
+
5
+ const test = require('node:test');
6
+ const assert = require('node:assert/strict');
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+
10
+ const root = path.join(__dirname, '..');
11
+ const REQUIRED_COMMAND_FILES = [
12
+ 'ponytail.toml',
13
+ 'ponytail-review.toml',
14
+ 'ponytail-audit.toml',
15
+ 'ponytail-debt.toml',
16
+ 'ponytail-gain.toml',
17
+ 'ponytail-help.toml',
18
+ ];
19
+
20
+ function readJSON(relPath) {
21
+ return JSON.parse(fs.readFileSync(path.join(root, relPath), 'utf8'));
22
+ }
23
+
24
+ test('copilot plugin command directory includes ponytail-debt', () => {
25
+ const manifest = readJSON('.github/plugin/plugin.json');
26
+ assert.equal(manifest.name, 'ponytail');
27
+ assert.equal(manifest.commands, 'commands/');
28
+
29
+ for (const file of REQUIRED_COMMAND_FILES) {
30
+ assert.ok(
31
+ fs.existsSync(path.join(root, manifest.commands, file)),
32
+ `missing command file: ${manifest.commands}${file}`,
33
+ );
34
+ }
35
+ });