gm-cc 2.0.182 → 2.0.184

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.182",
7
+ "version": "2.0.184",
8
8
  "metadata": {
9
9
  "description": "State machine agent with hooks, skills, and automated git enforcement"
10
10
  },
@@ -9,26 +9,17 @@ const fs = require('fs');
9
9
  const path = require('path');
10
10
  const { execSync } = require('child_process');
11
11
 
12
- const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT || process.env.GEMINI_PROJECT_DIR || process.env.OC_PLUGIN_ROOT || process.env.KILO_PLUGIN_ROOT || path.join(__dirname, '..');
13
12
  const projectDir = process.env.CLAUDE_PROJECT_DIR || process.env.GEMINI_PROJECT_DIR || process.env.OC_PROJECT_DIR || process.env.KILO_PROJECT_DIR;
14
13
 
15
- const COMPACT_CONTEXT = 'use gm agent | ref: TOOL_INVARIANTS | codesearch for exploration | bun x gm-exec for execution';
16
- const PLAN_MODE_BLOCK = 'DO NOT use EnterPlanMode. Use GM agent planning (PLAN→EXECUTE→EMIT→VERIFY→COMPLETE state machine) instead. Plan mode is blocked.';
17
-
18
14
  const ensureGitignore = () => {
19
15
  if (!projectDir) return;
20
16
  const gitignorePath = path.join(projectDir, '.gitignore');
21
17
  const entry = '.gm-stop-verified';
22
18
  try {
23
- let content = '';
24
- if (fs.existsSync(gitignorePath)) {
25
- content = fs.readFileSync(gitignorePath, 'utf-8');
26
- }
19
+ let content = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, 'utf-8') : '';
27
20
  if (!content.split('\n').some(line => line.trim() === entry)) {
28
- const newContent = content.endsWith('\n') || content === ''
29
- ? content + entry + '\n'
30
- : content + '\n' + entry + '\n';
31
- fs.writeFileSync(gitignorePath, newContent);
21
+ content = (content.endsWith('\n') || content === '' ? content : content + '\n') + entry + '\n';
22
+ fs.writeFileSync(gitignorePath, content);
32
23
  }
33
24
  } catch (e) {}
34
25
  };
@@ -39,14 +30,23 @@ const runThorns = () => {
39
30
  const thornsBin = fs.existsSync(localThorns) ? `node ${localThorns}` : 'bun x mcp-thorns@latest';
40
31
  try {
41
32
  const out = execSync(`${thornsBin} ${projectDir}`, {
42
- encoding: 'utf-8',
43
- stdio: ['pipe', 'pipe', 'pipe'],
44
- timeout: 15000,
45
- killSignal: 'SIGTERM'
33
+ encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 15000, killSignal: 'SIGTERM'
46
34
  });
47
35
  return `=== mcp-thorns ===\n${out.trim()}`;
48
36
  } catch (e) {
49
- if (e.killed) return '=== mcp-thorns ===\nSkipped (timeout)';
37
+ return e.killed ? '=== mcp-thorns ===\nSkipped (timeout)' : '';
38
+ }
39
+ };
40
+
41
+ const runCodeSearch = (prompt) => {
42
+ if (!prompt || !projectDir) return '';
43
+ try {
44
+ const out = execSync(`bun x codebasesearch ${JSON.stringify(prompt)}`, {
45
+ encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 10000, killSignal: 'SIGTERM',
46
+ cwd: projectDir
47
+ });
48
+ return `=== codebasesearch ===\n${out.trim()}`;
49
+ } catch (e) {
50
50
  return '';
51
51
  }
52
52
  };
@@ -55,7 +55,6 @@ const emit = (additionalContext) => {
55
55
  const isGemini = process.env.GEMINI_PROJECT_DIR !== undefined;
56
56
  const isOpenCode = process.env.OC_PROJECT_DIR !== undefined;
57
57
  const isKilo = process.env.KILO_PROJECT_DIR !== undefined;
58
-
59
58
  if (isGemini) {
60
59
  console.log(JSON.stringify({ systemMessage: additionalContext }, null, 2));
61
60
  } else if (isOpenCode || isKilo) {
@@ -66,13 +65,25 @@ const emit = (additionalContext) => {
66
65
  };
67
66
 
68
67
  try {
68
+ let prompt = '';
69
+ try {
70
+ const input = JSON.parse(fs.readFileSync('/dev/stdin', 'utf-8'));
71
+ prompt = input.prompt || input.message || input.userMessage || '';
72
+ } catch (e) {}
73
+
69
74
  ensureGitignore();
75
+
70
76
  const parts = [];
77
+ parts.push('Invoke the `gm` skill to begin. DO NOT use EnterPlanMode. DO NOT use gm subagent directly — use the `gm` skill via the Skill tool.');
78
+
79
+ const search = runCodeSearch(prompt);
80
+ if (search) parts.push(search);
81
+
71
82
  const thorns = runThorns();
72
83
  if (thorns) parts.push(thorns);
73
- parts.push('use gm agent | ' + COMPACT_CONTEXT + ' | ' + PLAN_MODE_BLOCK);
84
+
74
85
  emit(parts.join('\n\n'));
75
86
  } catch (error) {
76
- emit('use gm agent | hook error: ' + error.message);
87
+ emit('Invoke the `gm` skill to begin. Hook error: ' + error.message);
77
88
  process.exit(0);
78
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-cc",
3
- "version": "2.0.182",
3
+ "version": "2.0.184",
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.182",
3
+ "version": "2.0.184",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": {
6
6
  "name": "AnEntrypoint",
@@ -10,8 +10,10 @@ enforce: critical
10
10
  You think in state, not prose. You are the root orchestrator of all work in this system.
11
11
 
12
12
  **GRAPH POSITION**: `[ROOT ORCHESTRATOR] → coordinates PLAN → EXECUTE → EMIT → VERIFY → COMPLETE`
13
- - **Invoke**: At the start of any task or work coordination request.
13
+ - **Invoke**: The prompt-submit hook directs you here first. This is always the first skill invoked.
14
+ - **Your job**: Set up the state machine, then immediately invoke `planning` skill to build the .prd.
14
15
  - **Every state transition**: invoke the named skill explicitly. No exceptions.
16
+ - **Previous skill context does not carry forward** — each invoked skill is self-contained. The only shared state is the .prd file and witnessed execution output.
15
17
 
16
18
  ## STATE MACHINE
17
19
 
@@ -8,7 +8,8 @@ description: VERIFY and COMPLETE phase. End-to-end verification, completion defi
8
8
  You are in the **VERIFY → COMPLETE** phase. Files are written and validated. Now prove the system works end-to-end and enforce git discipline.
9
9
 
10
10
  **GRAPH POSITION**: `PLAN → EXECUTE → EMIT → [VERIFY → COMPLETE]`
11
- - **Entry**: Invoke this skill after all EMIT gate conditions passed and files written.
11
+ - **Session entry chain**: prompt-submit hook → `gm` skill `planning` `gm-execute` `gm-emit` `gm-complete` skill (here). The `gm` skill contract is active: state machine, mutable discipline, ground truth only, git enforcement.
12
+ - **Entry**: All EMIT gate conditions passed and files written to disk.
12
13
  - **Loop**: If .prd items remain after verification → invoke `gm-execute` skill for next wave.
13
14
  - **Done**: .prd empty + git clean + all pushes confirmed → COMPLETE.
14
15
 
@@ -8,7 +8,8 @@ description: EMIT phase gate validation, pre/post-emit testing, code quality enf
8
8
  You are in the **EMIT** phase. All mutables were resolved in EXECUTE. Now validate, write, and verify files.
9
9
 
10
10
  **GRAPH POSITION**: `PLAN → EXECUTE → [EMIT] → VERIFY → COMPLETE`
11
- - **Entry**: Invoke this skill when all EXECUTE mutables resolved to KNOWN via witnessed execution.
11
+ - **Session entry chain**: prompt-submit hook → `gm` skill `planning` `gm-execute` `gm-emit` skill (here). The `gm` skill contract is active: state machine, mutable discipline, ground truth only, all transitions invoke named skills.
12
+ - **Entry**: All EXECUTE mutables resolved to KNOWN via witnessed execution. .prd items are scoped and proven.
12
13
  - **Exit**: Files written, post-emit validation passes, all gate conditions true simultaneously → invoke `gm-complete` skill.
13
14
  - **Rollback**: If post-emit validation fails → fix immediately in this phase, do not advance.
14
15
 
@@ -8,7 +8,8 @@ description: EXECUTE phase methodology. Hypothesis testing, chain decomposition,
8
8
  You are in the **EXECUTE** phase. All mutables must resolve to KNOWN via witnessed execution before transitioning to EMIT.
9
9
 
10
10
  **GRAPH POSITION**: `PLAN → [EXECUTE] → EMIT → VERIFY → COMPLETE`
11
- - **Entry**: Invoke this skill when entering EXECUTE. .prd exists with all unknowns named.
11
+ - **Session entry chain**: prompt-submit hook → `gm` skill `planning` skill → `gm-execute` skill (here). The `gm` skill contract is active: state machine, mutable discipline, ground truth only, all transitions invoke named skills.
12
+ - **Entry**: .prd exists with all unknowns named. This skill owns the EXECUTE phase entirely.
12
13
  - **Exit**: Zero unresolved mutables → invoke `gm-emit` skill for gate validation and file writing.
13
14
  - **Sub-skills**: code discovery → invoke `code-search` skill | browser work → invoke `agent-browser` skill | servers/workers/daemons → invoke `process-management` skill
14
15
  - **Re-entry**: If mutables remain unresolved, re-invoke `gm-execute` skill with broader scope. Never add stages.
@@ -9,7 +9,8 @@ allowed-tools: Write
9
9
  You are in the **PLAN** phase. Build the .prd before any execution begins.
10
10
 
11
11
  **GRAPH POSITION**: `[PLAN] → EXECUTE → EMIT → VERIFY → COMPLETE`
12
- - **Entry**: Invoke this skill at START before any tool calls. No work begins until .prd exists.
12
+ - **Session entry chain**: prompt-submit hook `gm` skill `planning` skill (here). The `gm` skill contract is active: state machine, mutable discipline, all transitions invoke named skills, no fake data.
13
+ - **Entry**: No work begins until .prd exists on disk. This is the first tool-calling phase.
13
14
  - **Exit**: .prd written to disk → invoke `gm-execute` skill to begin EXECUTE phase.
14
15
 
15
16
  ## Purpose