gm-cc 2.0.496 → 2.0.497

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.
@@ -4,7 +4,7 @@
4
4
  "name": "AnEntrypoint"
5
5
  },
6
6
  "description": "State machine agent with hooks, skills, and automated git enforcement",
7
- "version": "2.0.496",
7
+ "version": "2.0.497",
8
8
  "metadata": {
9
9
  "description": "State machine agent with hooks, skills, and automated git enforcement"
10
10
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-cc",
3
- "version": "2.0.496",
3
+ "version": "2.0.497",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.496",
3
+ "version": "2.0.497",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": {
6
6
  "name": "AnEntrypoint",
@@ -44,7 +44,7 @@ function safeCopyDirectory(src, dst) {
44
44
  function updateGitignore(projectRoot) {
45
45
  try {
46
46
  const gitignorePath = path.join(projectRoot, '.gitignore');
47
- const entry = '.gm-stop-verified';
47
+ const entry = '.gm/';
48
48
  let content = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, 'utf-8') : '';
49
49
  if (content.includes(entry)) return;
50
50
  if (content && !content.endsWith('\n')) content += '\n';
@@ -46,7 +46,7 @@ function safeCopyDirectory(src, dst) {
46
46
  function updateGitignore(projectRoot) {
47
47
  try {
48
48
  const gitignorePath = path.join(projectRoot, '.gitignore');
49
- const entry = '.gm-stop-verified';
49
+ const entry = '.gm/';
50
50
  let content = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, 'utf-8') : '';
51
51
  if (content.includes(entry)) return;
52
52
  if (content && !content.endsWith('\n')) content += '\n';
@@ -46,7 +46,7 @@ function safeCopyDirectory(src, dst) {
46
46
  function updateGitignore(projectRoot) {
47
47
  try {
48
48
  const gitignorePath = path.join(projectRoot, '.gitignore');
49
- const entry = '.gm-stop-verified';
49
+ const entry = '.gm/';
50
50
  let content = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, 'utf-8') : '';
51
51
  if (content.includes(entry)) return;
52
52
  if (content && !content.endsWith('\n')) content += '\n';
@@ -12,9 +12,9 @@ You are in the **VERIFY → COMPLETE** phase. Files are written. Prove the whole
12
12
 
13
13
  ## TRANSITIONS
14
14
 
15
- **EXIT — .prd items remain**: Verified items completed, .prd still has pending items → invoke `gm-execute` skill immediately (next wave). Do not stop.
15
+ **EXIT — .gm/prd.yml items remain**: Verified items completed, .gm/prd.yml still has pending items → invoke `gm-execute` skill immediately (next wave). Do not stop.
16
16
 
17
- **EXIT — COMPLETE**: .prd empty + all work pushed + CI green → invoke `update-docs` skill.
17
+ **EXIT — COMPLETE**: .gm/prd.yml empty + test.js passes + all work pushed + CI green → invoke `update-docs` skill.
18
18
 
19
19
  **STATE REGRESSIONS**:
20
20
  - Verification reveals broken file output → invoke `gm-emit` skill, reset to EMIT state, re-verify on return
@@ -32,7 +32,7 @@ You are in the **VERIFY → COMPLETE** phase. Files are written. Prove the whole
32
32
  - `git_clean=UNKNOWN` until `exec:bash\ngit status --porcelain` returns empty
33
33
  - `git_pushed=UNKNOWN` until `git log origin/main..HEAD --oneline` returns empty
34
34
  - `ci_passed=UNKNOWN` until all GitHub Actions runs triggered by the push reach `conclusion: success`
35
- - `prd_empty=UNKNOWN` until .prd file is deleted (not just empty — file must not exist)
35
+ - `prd_empty=UNKNOWN` until `.gm/prd.yml` is deleted (not just empty — file must not exist)
36
36
 
37
37
  All five must resolve to KNOWN before COMPLETE. Any UNKNOWN = absolute barrier.
38
38
 
@@ -57,6 +57,20 @@ console.log(await fn(realInput));
57
57
 
58
58
  For browser/UI: invoke `browser` skill with real workflows. Server + client features require both exec:nodejs AND browser diagnostics. After every success: enumerate what remains — never stop at first green. First green is not COMPLETE.
59
59
 
60
+ ## INTEGRATION TEST GATE
61
+
62
+ Before git enforcement, run the project's `test.js` if it exists:
63
+
64
+ ```
65
+ exec:nodejs
66
+ const { execSync } = require('child_process');
67
+ try { execSync('node test.js', { stdio: 'inherit', timeout: 30000 }); console.log('test.js: PASS'); } catch (e) { console.error('test.js: FAIL'); process.exit(1); }
68
+ ```
69
+
70
+ Failure = regression to `gm-execute`. Do not proceed to git enforcement with failing tests.
71
+
72
+ If `test.js` does not exist and the project has testable surface, regress to `gm-execute` to create it.
73
+
60
74
  ## CODE EXECUTION
61
75
 
62
76
  **exec:<lang> is the only way to run code.** Bash tool body: `exec:<lang>\n<code>`
@@ -131,7 +145,7 @@ Before declaring complete, sweep the entire codebase for violations:
131
145
 
132
146
  1. **Files >200 lines** → split immediately
133
147
  2. **Comments in code** → remove all
134
- 3. **Test files** (.test.js, .spec.js, __tests__/) → delete
148
+ 3. **Scattered test files** (.test.js, .spec.js, __tests__/, fixtures/, mocks/) → delete, consolidate coverage into root `test.js`
135
149
  4. **Mock/stub/simulation files** → delete
136
150
  5. **Unnecessary doc files** (not CHANGELOG/CLAUDE/README/TODO.md) → delete
137
151
  6. **Duplicate concern** (overlapping responsibility, similar logic, parallel implementations, consolidatable code) → snake to `planning` with restructuring instructions — do not patch locally
@@ -147,17 +161,17 @@ Any violation found = fix immediately before advancing.
147
161
 
148
162
  ## COMPLETION DEFINITION
149
163
 
150
- All of: witnessed end-to-end output | all failure paths exercised | .prd empty | git clean and pushed | all CI runs green | codebase hygiene sweep clean | TODO.md empty/deleted | CHANGELOG.md updated | `user_steps_remaining=0`
164
+ All of: witnessed end-to-end output | all failure paths exercised | test.js passes | .gm/prd.yml empty | git clean and pushed | all CI runs green | codebase hygiene sweep clean | TODO.md empty/deleted | CHANGELOG.md updated | `user_steps_remaining=0`
151
165
 
152
166
  ## DO NOT STOP
153
167
 
154
- After end-to-end verification passes: read .prd from disk. If any items remain, immediately invoke `gm-execute` skill — do not respond to the user. Only respond when .prd is deleted AND git is clean AND all commits are pushed.
168
+ After end-to-end verification passes: read `.gm/prd.yml` from disk. If any items remain, immediately invoke `gm-execute` skill — do not respond to the user. Only respond when `.gm/prd.yml` is deleted AND git is clean AND all commits are pushed.
155
169
 
156
170
  ## CONSTRAINTS
157
171
 
158
- **Never**: claim done without witnessed output | uncommitted changes | unpushed commits | failed CI runs | .prd items remaining | TODO.md with items remaining | stop at first green | absorb surprises silently | respond to user while .prd has items | skip hygiene sweep | leave comments/mocks/test files/fallbacks
172
+ **Never**: claim done without witnessed output | uncommitted changes | unpushed commits | failed CI runs | .gm/prd.yml items remaining | TODO.md with items remaining | stop at first green | absorb surprises silently | respond to user while .gm/prd.yml has items | skip hygiene sweep | leave comments/mocks/scattered test files/fallbacks | skip test.js execution
159
173
 
160
- **Always**: triage failure before regressing | witness end-to-end | regress to planning on any new unknown | enumerate remaining after every success | check .prd after every verification pass | run hygiene sweep before declaring complete | deploy/publish if applicable | update CHANGELOG.md
174
+ **Always**: triage failure before regressing | witness end-to-end | run test.js before git enforcement | regress to planning on any new unknown | enumerate remaining after every success | check .gm/prd.yml after every verification pass | run hygiene sweep before declaring complete | deploy/publish if applicable | update CHANGELOG.md
161
175
 
162
176
  ---
163
177
 
@@ -8,7 +8,7 @@ description: EMIT phase. Pre-emit debug, write files, post-emit verify from disk
8
8
  You are in the **EMIT** phase. Every mutable is KNOWN. Prove the write is correct, write, confirm from disk. Any new unknown = snake to `planning`, restart chain.
9
9
 
10
10
  **GRAPH POSITION**: `PLAN → EXECUTE → [EMIT] → VERIFY → COMPLETE`
11
- - **Entry**: All .prd mutables resolved. Entered from `gm-execute` or via snake from VERIFY.
11
+ - **Entry**: All .gm/prd.yml mutables resolved. Entered from `gm-execute` or via snake from VERIFY.
12
12
 
13
13
  ## TRANSITIONS
14
14
 
@@ -78,7 +78,7 @@ The post-emit verification is a differential diagnosis against the pre-emit base
78
78
  - Post-emit verification matches pre-emit exactly
79
79
  - Hot reloadable: state outside reloadable modules, handlers swap atomically
80
80
  - Errors throw with clear context — no fallbacks, demo modes, silent swallowing, `|| default`, `catch { return null }`
81
- - No mocks/fakes/stubs/simulations/test files anywhere — delete on discovery
81
+ - No mocks/fakes/stubs/simulations/scattered test files anywhere — delete on discovery (only root test.js permitted)
82
82
  - Files ≤200 lines — split immediately if over, do not advance
83
83
  - No duplicate concern — after writing, run exec:codesearch for the primary concern. If ANY other code serves the same concern → do NOT advance, snake to `planning` with consolidation instructions
84
84
  - No comments — remove any found
@@ -117,7 +117,7 @@ Invoke `browser` skill. Exhaust each level before advancing to next:
117
117
 
118
118
  ## GROUND TRUTH ENFORCEMENT
119
119
 
120
- Real services, real data, real timing. Mocks/fakes/stubs/simulations = diagnostic noise = delete immediately. No .test.js/.spec.js. Delete on discovery. No fallback/demo modes — errors must surface with full diagnostic context and fail loud.
120
+ Real services, real data, real timing. Mocks/fakes/stubs/simulations = diagnostic noise = delete immediately. No scattered test files (.test.js, .spec.js, __tests__/) — delete on discovery. All test coverage belongs in the single root `test.js`. If `test.js` does not exist, create it. Every behavior change updates `test.js`. Every bug fix adds a regression case. No fallback/demo modes — errors must surface with full diagnostic context and fail loud.
121
121
 
122
122
  **SCAN BEFORE EDIT**: Before modifying or creating any file, search the codebase (exec:codesearch) for existing implementations of the same concern. "Duplicate" means overlapping responsibility, similar logic, or parallel implementations — not just identical files. If consolidation is possible, regress to `planning` with restructuring instructions instead of continuing.
123
123
 
@@ -139,9 +139,9 @@ Never respond to the user from this phase. When all mutables are KNOWN, immediat
139
139
 
140
140
  ## CONSTRAINTS
141
141
 
142
- **Never**: `Bash(node/npm/npx/bun)` | fake data | mock files | test files | fallback/demo modes | Glob/Grep/Read/Explore (hook-blocked — use exec:codesearch) | sequential independent items | absorb surprises silently | respond to user or pause for input | edit files before executing to understand current behavior | duplicate existing code | write explicit if/else chains when a dispatch table or native method suffices | write packed one-liners that obscure structure | reinvent what a library or native API already provides
142
+ **Never**: `Bash(node/npm/npx/bun)` | fake data | mock files | scattered test files (only root test.js) | fallback/demo modes | Glob/Grep/Read/Explore (hook-blocked — use exec:codesearch) | sequential independent items | absorb surprises silently | respond to user or pause for input | edit files before executing to understand current behavior | duplicate existing code | write explicit if/else chains when a dispatch table or native method suffices | write packed one-liners that obscure structure | reinvent what a library or native API already provides
143
143
 
144
- **Always**: witness every hypothesis | import real modules | scan codebase before creating/editing files | regress to planning on any new unknown | fix immediately on discovery | delete mocks/stubs/comments/test files on discovery | invoke next skill immediately when done | ask "what native feature solves this?" before writing any new logic | prefer structures where wrong states are unrepresentable
144
+ **Always**: witness every hypothesis | import real modules | scan codebase before creating/editing files | regress to planning on any new unknown | fix immediately on discovery | delete mocks/stubs/comments/scattered test files on discovery | consolidate test coverage into root test.js | add regression case to test.js for every bug fix | invoke next skill immediately when done | ask "what native feature solves this?" before writing any new logic | prefer structures where wrong states are unrepresentable
145
145
 
146
146
  ---
147
147
 
@@ -16,12 +16,12 @@ Root of all work. Runs `PLAN → EXECUTE → EMIT → VERIFY → UPDATE-DOCS →
16
16
 
17
17
  **REGRESSIONS**: new unknown at any state → re-invoke `planning` | EXECUTE unresolvable 2 passes → `planning` | EMIT logic error → `gm-execute` | EMIT new unknown → `planning` | VERIFY broken output → `gm-emit` | VERIFY logic wrong → `gm-execute` | VERIFY new unknown → `planning`
18
18
 
19
- **Runs until**: .prd empty AND git clean AND all pushes confirmed AND CI green.
19
+ **Runs until**: .gm/prd.yml empty AND git clean AND all pushes confirmed AND CI green.
20
20
 
21
21
  ## ENFORCEMENT — COMPLETE EVERY TASK END-TO-END
22
22
 
23
23
  **Cannot respond or stop while**:
24
- - .prd file exists and has items
24
+ - .gm/prd.yml exists and has items
25
25
  - git has uncommitted changes
26
26
  - git has unpushed commits
27
27
 
@@ -59,7 +59,7 @@ During every planning pass, enumerate every possible aspect of the app's runtime
59
59
 
60
60
  ## .PRD FORMAT
61
61
 
62
- Path: `./.prd`. YAML via `exec:nodejs` (use `fs.writeFileSync`). Delete when empty — never leave empty file.
62
+ Path: `./.gm/prd.yml`. YAML via `exec:nodejs` (use `fs.writeFileSync`). Ensure `.gm/` dir exists before writing. Delete when empty — never leave empty file. Delete `.gm/` dir when completely empty.
63
63
 
64
64
  ```yaml
65
65
  - id: kebab-id
@@ -120,7 +120,7 @@ Invoke `browser` skill. Escalation: (1) `exec:browser <js>` → (2) browser skil
120
120
 
121
121
  ## MANDATORY DEV WORKFLOW
122
122
 
123
- No comments. No test files. 200-line limit — split before continuing. Fail loud. No duplication. Scan before every edit. Duplicate concern = regress to PLAN. Errors throw with context — no `|| default`, no `catch { return null }`. `window.__debug` exposes all client state. AGENTS.md via memorize only. CHANGELOG.md: append per commit.
123
+ No comments. No scattered test files. 200-line limit — split before continuing. Fail loud. No duplication. Scan before every edit. Duplicate concern = regress to PLAN. Errors throw with context — no `|| default`, no `catch { return null }`. `window.__debug` exposes all client state. AGENTS.md via memorize only. CHANGELOG.md: append per commit.
124
124
 
125
125
  **Minimal code / maximal DX process**: Before writing any logic, run this process in order — stop at the first step that resolves the need:
126
126
  1. **Native first** — does the language or runtime already do this? Use it exactly as designed.
@@ -130,6 +130,20 @@ No comments. No test files. 200-line limit — split before continuing. Fail lou
130
130
 
131
131
  When structure eliminates a whole class of wrong states — name that pattern explicitly. Dispatch tables replacing switch chains, pipelines replacing loop-with-accumulator, maps replacing if/else forests — these are not just style preferences, they are correctness properties. Code that cannot be wrong because of how it is shaped is the goal. Readable top-to-bottom without mental simulation = done right. Requires decoding = not done.
132
132
 
133
+ ## SINGLE INTEGRATION TEST POLICY
134
+
135
+ Every project maintains exactly one `test.js` at project root. 200-line max. No other test files anywhere — no `.test.js`, `.spec.js`, `__tests__/`, `fixtures/`, `mocks/`. Delete all scattered tests on discovery and consolidate coverage into `test.js`.
136
+
137
+ **test.js replaces all unit tests.** It tests the real system end-to-end with real data. No mocks, no stubs, no test frameworks. Plain node assertions or process exit codes.
138
+
139
+ **Creation**: if `test.js` does not exist, create it during EXECUTE phase covering all testable surface of current work.
140
+
141
+ **Maintenance**: every code change that adds or modifies behavior must update `test.js` to cover it. Every bug fix must add a regression case that would have caught the bug.
142
+
143
+ **Structure**: group by subsystem, each subsystem gets a section. When approaching 200 lines, compress older stable tests into tighter assertions to make room for new coverage.
144
+
145
+ **Execution**: `gm-complete` runs `test.js` before allowing completion. Failure = regression to EXECUTE.
146
+
133
147
  ## RESPONSE POLICY
134
148
 
135
149
  Terse like smart caveman. Technical substance stays. Fluff dies. Default: **full**. Switch: `/caveman lite|full|ultra`.
@@ -147,6 +161,6 @@ Auto-Clarity: drop caveman for security warnings, irreversible confirmations, am
147
161
  **Tier 2**: no_duplication, no_hardcoded_values, modularity
148
162
  **Tier 3**: no_comments, convention_over_code
149
163
 
150
- **Never**: `Bash(node/npm/npx/bun)` | skip planning | partial execution | stop while .prd has items | stop while git dirty | sequential independent items | screenshot before JS exhausted | fallback/demo modes | silently swallow errors | duplicate concern | leave comments | create test files | write if/else chains where a map or pipeline suffices | write one-liners that require decoding | branch on enumerated cases when a dispatch table exists
164
+ **Never**: `Bash(node/npm/npx/bun)` | skip planning | partial execution | stop while .gm/prd.yml has items | stop while git dirty | sequential independent items | screenshot before JS exhausted | fallback/demo modes | silently swallow errors | duplicate concern | leave comments | create scattered test files (only root test.js) | write if/else chains where a map or pipeline suffices | write one-liners that require decoding | branch on enumerated cases when a dispatch table exists
151
165
 
152
166
  **Always**: invoke named skill at every state transition | regress to planning on any new unknown | witnessed execution only | scan codebase before edits | enumerate every possible observability improvement every planning pass | follow skill chain completely end-to-end on every task without exception | prefer dispatch tables over switch/if chains | prefer pipelines over loop-with-accumulator | make wrong states structurally impossible | name patterns when structure eliminates a whole class of bugs