gm-cc 2.0.5
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.
- package/.claude-plugin/marketplace.json +17 -0
- package/.editorconfig +12 -0
- package/.github/workflows/publish-npm.yml +50 -0
- package/.gitignore +13 -0
- package/.mcp.json +19 -0
- package/CLAUDE.md +11 -0
- package/CONTRIBUTING.md +26 -0
- package/LICENSE +21 -0
- package/README.md +261 -0
- package/agents/gm.md +371 -0
- package/cli.js +44 -0
- package/hooks/hooks.json +58 -0
- package/hooks/pre-tool-use-hook.js +94 -0
- package/hooks/prompt-submit-hook.js +87 -0
- package/hooks/session-start-hook.js +171 -0
- package/hooks/stop-hook-git.js +184 -0
- package/hooks/stop-hook.js +58 -0
- package/install.js +110 -0
- package/package.json +54 -0
- package/plugin.json +27 -0
- package/scripts/postinstall.js +138 -0
- package/skills/agent-browser/SKILL.md +257 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
|
|
7
|
+
const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT || process.env.GEMINI_PROJECT_DIR || process.env.OC_PLUGIN_ROOT;
|
|
8
|
+
const projectDir = process.env.CLAUDE_PROJECT_DIR || process.env.GEMINI_PROJECT_DIR || process.env.OC_PROJECT_DIR;
|
|
9
|
+
|
|
10
|
+
const ensureGitignore = () => {
|
|
11
|
+
if (!projectDir) return;
|
|
12
|
+
const gitignorePath = path.join(projectDir, '.gitignore');
|
|
13
|
+
const entry = '.gm-stop-verified';
|
|
14
|
+
try {
|
|
15
|
+
let content = '';
|
|
16
|
+
if (fs.existsSync(gitignorePath)) {
|
|
17
|
+
content = fs.readFileSync(gitignorePath, 'utf-8');
|
|
18
|
+
}
|
|
19
|
+
if (!content.split('\n').some(line => line.trim() === entry)) {
|
|
20
|
+
const newContent = content.endsWith('\n') || content === ''
|
|
21
|
+
? content + entry + '\n'
|
|
22
|
+
: content + '\n' + entry + '\n';
|
|
23
|
+
fs.writeFileSync(gitignorePath, newContent);
|
|
24
|
+
}
|
|
25
|
+
} catch (e) {
|
|
26
|
+
// Silently fail - not critical
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
ensureGitignore();
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
let outputs = [];
|
|
34
|
+
|
|
35
|
+
// 1. Read ./start.md
|
|
36
|
+
if (pluginRoot) {
|
|
37
|
+
const startMdPath = path.join(pluginRoot, '/agents/gm.md');
|
|
38
|
+
try {
|
|
39
|
+
const startMdContent = fs.readFileSync(startMdPath, 'utf-8');
|
|
40
|
+
outputs.push(startMdContent);
|
|
41
|
+
} catch (e) {
|
|
42
|
+
// File may not exist in this context
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 2. Add semantic code-search explanation
|
|
47
|
+
const codeSearchContext = `## 🔍 Semantic Code Search Now Available
|
|
48
|
+
|
|
49
|
+
Your prompts will trigger **semantic code search** - intelligent, intent-based exploration of your codebase.
|
|
50
|
+
|
|
51
|
+
### How It Works
|
|
52
|
+
Describe what you need in plain language, and the search understands your intent:
|
|
53
|
+
- "Find authentication validation" → locates auth checks, guards, permission logic
|
|
54
|
+
- "Where is database initialization?" → finds connection setup, migrations, schemas
|
|
55
|
+
- "Show error handling patterns" → discovers try/catch patterns, error boundaries
|
|
56
|
+
|
|
57
|
+
NOT syntax-based regex matching - truly semantic understanding across files.
|
|
58
|
+
|
|
59
|
+
### Example
|
|
60
|
+
Instead of regex patterns, simply describe your intent:
|
|
61
|
+
"Find where API authorization is checked"
|
|
62
|
+
|
|
63
|
+
The search will find permission validations, role checks, authentication guards - however they're implemented.
|
|
64
|
+
|
|
65
|
+
### When to Use Code Search
|
|
66
|
+
When exploring unfamiliar code, finding similar patterns, understanding integrations, or locating feature implementations across your codebase.`;
|
|
67
|
+
outputs.push(codeSearchContext);
|
|
68
|
+
|
|
69
|
+
// 3. Run mcp-thorns (bunx with npx fallback)
|
|
70
|
+
if (projectDir && fs.existsSync(projectDir)) {
|
|
71
|
+
try {
|
|
72
|
+
let thornOutput;
|
|
73
|
+
try {
|
|
74
|
+
thornOutput = execSync(`bunx mcp-thorns@latest`, {
|
|
75
|
+
encoding: 'utf-8',
|
|
76
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
77
|
+
cwd: projectDir,
|
|
78
|
+
timeout: 180000,
|
|
79
|
+
killSignal: 'SIGTERM'
|
|
80
|
+
});
|
|
81
|
+
} catch (bunErr) {
|
|
82
|
+
if (bunErr.killed && bunErr.signal === 'SIGTERM') {
|
|
83
|
+
thornOutput = '=== mcp-thorns ===\nSkipped (3min timeout)';
|
|
84
|
+
} else {
|
|
85
|
+
try {
|
|
86
|
+
thornOutput = execSync(`npx -y mcp-thorns@latest`, {
|
|
87
|
+
encoding: 'utf-8',
|
|
88
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
89
|
+
cwd: projectDir,
|
|
90
|
+
timeout: 180000,
|
|
91
|
+
killSignal: 'SIGTERM'
|
|
92
|
+
});
|
|
93
|
+
} catch (npxErr) {
|
|
94
|
+
if (npxErr.killed && npxErr.signal === 'SIGTERM') {
|
|
95
|
+
thornOutput = '=== mcp-thorns ===\nSkipped (3min timeout)';
|
|
96
|
+
} else {
|
|
97
|
+
thornOutput = `=== mcp-thorns ===\nSkipped (error: ${bunErr.message.split('\n')[0]})`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
outputs.push(`=== This is your initial insight of the repository, look at every possible aspect of this for initial opinionation and to offset the need for code exploration ===\n${thornOutput}`);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
if (e.killed && e.signal === 'SIGTERM') {
|
|
105
|
+
outputs.push(`=== mcp-thorns ===\nSkipped (3min timeout)`);
|
|
106
|
+
} else {
|
|
107
|
+
outputs.push(`=== mcp-thorns ===\nSkipped (error: ${e.message.split('\n')[0]})`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
outputs.push('Use gm as a philosophy to coordinate all plans and the gm subagent to create and execute all plans');
|
|
112
|
+
const additionalContext = outputs.join('\n\n');
|
|
113
|
+
|
|
114
|
+
const isGemini = process.env.GEMINI_PROJECT_DIR !== undefined;
|
|
115
|
+
const isOpenCode = process.env.OC_PLUGIN_ROOT !== undefined;
|
|
116
|
+
|
|
117
|
+
if (isGemini) {
|
|
118
|
+
const result = {
|
|
119
|
+
systemMessage: additionalContext
|
|
120
|
+
};
|
|
121
|
+
console.log(JSON.stringify(result, null, 2));
|
|
122
|
+
} else if (isOpenCode) {
|
|
123
|
+
const result = {
|
|
124
|
+
hookSpecificOutput: {
|
|
125
|
+
hookEventName: 'session.created',
|
|
126
|
+
additionalContext
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
console.log(JSON.stringify(result, null, 2));
|
|
130
|
+
} else {
|
|
131
|
+
const result = {
|
|
132
|
+
hookSpecificOutput: {
|
|
133
|
+
hookEventName: 'SessionStart',
|
|
134
|
+
additionalContext
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
console.log(JSON.stringify(result, null, 2));
|
|
138
|
+
}
|
|
139
|
+
} catch (error) {
|
|
140
|
+
const isGemini = process.env.GEMINI_PROJECT_DIR !== undefined;
|
|
141
|
+
const isOpenCode = process.env.OC_PLUGIN_ROOT !== undefined;
|
|
142
|
+
|
|
143
|
+
if (isGemini) {
|
|
144
|
+
console.log(JSON.stringify({
|
|
145
|
+
systemMessage: `Error executing hook: ${error.message}`
|
|
146
|
+
}, null, 2));
|
|
147
|
+
} else if (isOpenCode) {
|
|
148
|
+
console.log(JSON.stringify({
|
|
149
|
+
hookSpecificOutput: {
|
|
150
|
+
hookEventName: 'session.created',
|
|
151
|
+
additionalContext: `Error executing hook: ${error.message}`
|
|
152
|
+
}
|
|
153
|
+
}, null, 2));
|
|
154
|
+
} else {
|
|
155
|
+
console.log(JSON.stringify({
|
|
156
|
+
hookSpecificOutput: {
|
|
157
|
+
hookEventName: 'SessionStart',
|
|
158
|
+
additionalContext: `Error executing hook: ${error.message}`
|
|
159
|
+
}
|
|
160
|
+
}, null, 2));
|
|
161
|
+
}
|
|
162
|
+
process.exit(0);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const crypto = require('crypto');
|
|
7
|
+
|
|
8
|
+
const projectDir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
9
|
+
|
|
10
|
+
const getCounterPath = () => {
|
|
11
|
+
const hash = crypto.createHash('md5').update(projectDir).digest('hex');
|
|
12
|
+
return path.join('/tmp', `gm-git-block-counter-${hash}.json`);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const readCounter = () => {
|
|
16
|
+
try {
|
|
17
|
+
const counterPath = getCounterPath();
|
|
18
|
+
if (fs.existsSync(counterPath)) {
|
|
19
|
+
const data = fs.readFileSync(counterPath, 'utf-8');
|
|
20
|
+
return JSON.parse(data);
|
|
21
|
+
}
|
|
22
|
+
} catch (e) {}
|
|
23
|
+
return { count: 0, lastGitHash: null };
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const writeCounter = (data) => {
|
|
27
|
+
try {
|
|
28
|
+
const counterPath = getCounterPath();
|
|
29
|
+
fs.writeFileSync(counterPath, JSON.stringify(data, null, 2), 'utf-8');
|
|
30
|
+
} catch (e) {}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const getCurrentGitHash = () => {
|
|
34
|
+
try {
|
|
35
|
+
const hash = execSync('git rev-parse HEAD', {
|
|
36
|
+
cwd: projectDir,
|
|
37
|
+
stdio: 'pipe',
|
|
38
|
+
encoding: 'utf-8'
|
|
39
|
+
}).trim();
|
|
40
|
+
return hash;
|
|
41
|
+
} catch (e) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const resetCounterIfCommitted = (currentHash) => {
|
|
47
|
+
const counter = readCounter();
|
|
48
|
+
if (counter.lastGitHash && currentHash && counter.lastGitHash !== currentHash) {
|
|
49
|
+
counter.count = 0;
|
|
50
|
+
counter.lastGitHash = currentHash;
|
|
51
|
+
writeCounter(counter);
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const incrementCounter = (currentHash) => {
|
|
58
|
+
const counter = readCounter();
|
|
59
|
+
counter.count = (counter.count || 0) + 1;
|
|
60
|
+
counter.lastGitHash = currentHash;
|
|
61
|
+
writeCounter(counter);
|
|
62
|
+
return counter.count;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const getGitStatus = () => {
|
|
66
|
+
try {
|
|
67
|
+
execSync('git rev-parse --git-dir', {
|
|
68
|
+
cwd: projectDir,
|
|
69
|
+
stdio: 'pipe'
|
|
70
|
+
});
|
|
71
|
+
} catch (e) {
|
|
72
|
+
return { isRepo: false };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
const status = execSync('git status --porcelain', {
|
|
77
|
+
cwd: projectDir,
|
|
78
|
+
stdio: 'pipe',
|
|
79
|
+
encoding: 'utf-8'
|
|
80
|
+
}).trim();
|
|
81
|
+
|
|
82
|
+
const isDirty = status.length > 0;
|
|
83
|
+
|
|
84
|
+
let unpushedCount = 0;
|
|
85
|
+
try {
|
|
86
|
+
const unpushed = execSync('git rev-list --count @{u}..HEAD', {
|
|
87
|
+
cwd: projectDir,
|
|
88
|
+
stdio: 'pipe',
|
|
89
|
+
encoding: 'utf-8'
|
|
90
|
+
}).trim();
|
|
91
|
+
unpushedCount = parseInt(unpushed, 10) || 0;
|
|
92
|
+
} catch (e) {
|
|
93
|
+
unpushedCount = -1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let behindCount = 0;
|
|
97
|
+
try {
|
|
98
|
+
const behind = execSync('git rev-list --count HEAD..@{u}', {
|
|
99
|
+
cwd: projectDir,
|
|
100
|
+
stdio: 'pipe',
|
|
101
|
+
encoding: 'utf-8'
|
|
102
|
+
}).trim();
|
|
103
|
+
behindCount = parseInt(behind, 10) || 0;
|
|
104
|
+
} catch (e) {}
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
isRepo: true,
|
|
108
|
+
isDirty,
|
|
109
|
+
unpushedCount,
|
|
110
|
+
behindCount,
|
|
111
|
+
statusOutput: status
|
|
112
|
+
};
|
|
113
|
+
} catch (e) {
|
|
114
|
+
return { isRepo: true, isDirty: false, unpushedCount: 0, behindCount: 0 };
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const run = () => {
|
|
119
|
+
const gitStatus = getGitStatus();
|
|
120
|
+
if (!gitStatus.isRepo) return { ok: true };
|
|
121
|
+
|
|
122
|
+
const currentHash = getCurrentGitHash();
|
|
123
|
+
resetCounterIfCommitted(currentHash);
|
|
124
|
+
|
|
125
|
+
const issues = [];
|
|
126
|
+
if (gitStatus.isDirty) {
|
|
127
|
+
issues.push('Uncommitted changes exist');
|
|
128
|
+
}
|
|
129
|
+
if (gitStatus.unpushedCount > 0) {
|
|
130
|
+
issues.push(`${gitStatus.unpushedCount} commit(s) not pushed`);
|
|
131
|
+
}
|
|
132
|
+
if (gitStatus.unpushedCount === -1) {
|
|
133
|
+
issues.push('Unable to verify push status - may have unpushed commits');
|
|
134
|
+
}
|
|
135
|
+
if (gitStatus.behindCount > 0) {
|
|
136
|
+
issues.push(`${gitStatus.behindCount} upstream change(s) not pulled`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (issues.length > 0) {
|
|
140
|
+
const blockCount = incrementCounter(currentHash);
|
|
141
|
+
return {
|
|
142
|
+
ok: false,
|
|
143
|
+
reason: `Git: ${issues.join(', ')}, must push to remote`,
|
|
144
|
+
blockCount
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const counter = readCounter();
|
|
149
|
+
if (counter.count > 0) {
|
|
150
|
+
counter.count = 0;
|
|
151
|
+
writeCounter(counter);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return { ok: true };
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
try {
|
|
158
|
+
const result = run();
|
|
159
|
+
if (!result.ok) {
|
|
160
|
+
if (result.blockCount === 1) {
|
|
161
|
+
console.log(JSON.stringify({
|
|
162
|
+
decision: 'block',
|
|
163
|
+
reason: `Git: ${result.reason} [First violation - blocks this session]`
|
|
164
|
+
}, null, 2));
|
|
165
|
+
process.exit(2);
|
|
166
|
+
} else if (result.blockCount > 1) {
|
|
167
|
+
console.log(JSON.stringify({
|
|
168
|
+
decision: 'approve',
|
|
169
|
+
reason: `⚠️ Git warning (attempt #${result.blockCount}): ${result.reason} - Please commit and push your changes.`
|
|
170
|
+
}, null, 2));
|
|
171
|
+
process.exit(0);
|
|
172
|
+
}
|
|
173
|
+
} else {
|
|
174
|
+
console.log(JSON.stringify({
|
|
175
|
+
decision: 'approve'
|
|
176
|
+
}, null, 2));
|
|
177
|
+
process.exit(0);
|
|
178
|
+
}
|
|
179
|
+
} catch (e) {
|
|
180
|
+
console.log(JSON.stringify({
|
|
181
|
+
decision: 'approve'
|
|
182
|
+
}, null, 2));
|
|
183
|
+
process.exit(0);
|
|
184
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
// Always use current working directory for .prd location
|
|
7
|
+
// Explicitly resolve to ./.prd in the current folder
|
|
8
|
+
const projectDir = process.cwd();
|
|
9
|
+
const prdFile = path.resolve(projectDir, '.prd');
|
|
10
|
+
|
|
11
|
+
let aborted = false;
|
|
12
|
+
process.on('SIGTERM', () => { aborted = true; });
|
|
13
|
+
process.on('SIGINT', () => { aborted = true; });
|
|
14
|
+
|
|
15
|
+
const run = () => {
|
|
16
|
+
if (aborted) return { ok: true };
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
// Check if .prd file exists and has content
|
|
20
|
+
if (fs.existsSync(prdFile)) {
|
|
21
|
+
const prdContent = fs.readFileSync(prdFile, 'utf-8').trim();
|
|
22
|
+
if (prdContent.length > 0) {
|
|
23
|
+
// .prd has content, block stopping
|
|
24
|
+
return {
|
|
25
|
+
ok: false,
|
|
26
|
+
reason: `Work items remain in ${prdFile}. Remove completed items as they finish. Current items:\n\n${prdContent}`
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// .prd doesn't exist or is empty, allow stop
|
|
32
|
+
return { ok: true };
|
|
33
|
+
} catch (error) {
|
|
34
|
+
return { ok: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const result = run();
|
|
40
|
+
|
|
41
|
+
if (!result.ok) {
|
|
42
|
+
console.log(JSON.stringify({
|
|
43
|
+
decision: 'block',
|
|
44
|
+
reason: result.reason
|
|
45
|
+
}, null, 2));
|
|
46
|
+
process.exit(2);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
console.log(JSON.stringify({
|
|
50
|
+
decision: 'approve'
|
|
51
|
+
}, null, 2));
|
|
52
|
+
process.exit(0);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
console.log(JSON.stringify({
|
|
55
|
+
decision: 'approve'
|
|
56
|
+
}, null, 2));
|
|
57
|
+
process.exit(0);
|
|
58
|
+
}
|
package/install.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
function isInsideNodeModules() {
|
|
6
|
+
return __dirname.includes(path.sep + 'node_modules' + path.sep);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function getProjectRoot() {
|
|
10
|
+
if (!isInsideNodeModules()) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let current = __dirname;
|
|
15
|
+
while (current !== path.dirname(current)) {
|
|
16
|
+
current = path.dirname(current);
|
|
17
|
+
const parent = path.dirname(current);
|
|
18
|
+
if (path.basename(current) === 'node_modules') {
|
|
19
|
+
return parent;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function safeCopyFile(src, dst) {
|
|
26
|
+
try {
|
|
27
|
+
const content = fs.readFileSync(src, 'utf-8');
|
|
28
|
+
const dstDir = path.dirname(dst);
|
|
29
|
+
if (!fs.existsSync(dstDir)) {
|
|
30
|
+
fs.mkdirSync(dstDir, { recursive: true });
|
|
31
|
+
}
|
|
32
|
+
fs.writeFileSync(dst, content, 'utf-8');
|
|
33
|
+
return true;
|
|
34
|
+
} catch (err) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function safeCopyDirectory(src, dst) {
|
|
40
|
+
try {
|
|
41
|
+
if (!fs.existsSync(src)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
fs.mkdirSync(dst, { recursive: true });
|
|
46
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
47
|
+
|
|
48
|
+
entries.forEach(entry => {
|
|
49
|
+
const srcPath = path.join(src, entry.name);
|
|
50
|
+
const dstPath = path.join(dst, entry.name);
|
|
51
|
+
|
|
52
|
+
if (entry.isDirectory()) {
|
|
53
|
+
safeCopyDirectory(srcPath, dstPath);
|
|
54
|
+
} else if (entry.isFile()) {
|
|
55
|
+
safeCopyFile(srcPath, dstPath);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return true;
|
|
59
|
+
} catch (err) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function updateGitignore(projectRoot) {
|
|
65
|
+
try {
|
|
66
|
+
const gitignorePath = path.join(projectRoot, '.gitignore');
|
|
67
|
+
const entry = '.gm-stop-verified';
|
|
68
|
+
|
|
69
|
+
let content = '';
|
|
70
|
+
if (fs.existsSync(gitignorePath)) {
|
|
71
|
+
content = fs.readFileSync(gitignorePath, 'utf-8');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (content.includes(entry)) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (content && !content.endsWith('\n')) {
|
|
79
|
+
content += '\n';
|
|
80
|
+
}
|
|
81
|
+
content += entry + '\n';
|
|
82
|
+
|
|
83
|
+
fs.writeFileSync(gitignorePath, content, 'utf-8');
|
|
84
|
+
return true;
|
|
85
|
+
} catch (err) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function install() {
|
|
91
|
+
if (!isInsideNodeModules()) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const projectRoot = getProjectRoot();
|
|
96
|
+
if (!projectRoot) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const claudeDir = path.join(projectRoot, '.claude');
|
|
101
|
+
const sourceDir = __dirname.replace(/[\/]scripts$/, '');
|
|
102
|
+
|
|
103
|
+
safeCopyDirectory(path.join(sourceDir, 'agents'), path.join(claudeDir, 'agents'));
|
|
104
|
+
safeCopyDirectory(path.join(sourceDir, 'hooks'), path.join(claudeDir, 'hooks'));
|
|
105
|
+
safeCopyFile(path.join(sourceDir, '.mcp.json'), path.join(claudeDir, '.mcp.json'));
|
|
106
|
+
|
|
107
|
+
updateGitignore(projectRoot);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
install();
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gm-cc",
|
|
3
|
+
"version": "2.0.5",
|
|
4
|
+
"description": "Advanced Claude Code plugin with WFGY integration, MCP tools, and automated hooks",
|
|
5
|
+
"author": "AnEntrypoint",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/AnEntrypoint/gm-cc.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/AnEntrypoint/gm-cc#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/AnEntrypoint/gm-cc/issues"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=16.0.0"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"bin": {
|
|
22
|
+
"gm-cc": "./cli.js",
|
|
23
|
+
"gm-install": "./install.js"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"agents/",
|
|
27
|
+
"hooks/",
|
|
28
|
+
"scripts/",
|
|
29
|
+
"skills/",
|
|
30
|
+
".github/",
|
|
31
|
+
".mcp.json",
|
|
32
|
+
".claude-plugin/",
|
|
33
|
+
"plugin.json",
|
|
34
|
+
"cli.js",
|
|
35
|
+
"install.js",
|
|
36
|
+
"README.md",
|
|
37
|
+
"LICENSE",
|
|
38
|
+
".gitignore",
|
|
39
|
+
".editorconfig",
|
|
40
|
+
"CONTRIBUTING.md",
|
|
41
|
+
"CLAUDE.md"
|
|
42
|
+
],
|
|
43
|
+
"keywords": [
|
|
44
|
+
"claude-code",
|
|
45
|
+
"agent",
|
|
46
|
+
"state-machine",
|
|
47
|
+
"mcp",
|
|
48
|
+
"automation",
|
|
49
|
+
"gm"
|
|
50
|
+
],
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@anthropic-ai/claude-code": "*"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/plugin.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gm",
|
|
3
|
+
"version": "2.0.5",
|
|
4
|
+
"description": "Advanced Claude Code plugin with WFGY integration, MCP tools, and automated hooks",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "AnEntrypoint",
|
|
7
|
+
"url": "https://github.com/AnEntrypoint"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/AnEntrypoint/gm",
|
|
10
|
+
"hooks": "./hooks/hooks.json",
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"dev": {
|
|
13
|
+
"command": "bunx",
|
|
14
|
+
"args": [
|
|
15
|
+
"mcp-gm@latest"
|
|
16
|
+
],
|
|
17
|
+
"timeout": 360000
|
|
18
|
+
},
|
|
19
|
+
"code-search": {
|
|
20
|
+
"command": "bunx",
|
|
21
|
+
"args": [
|
|
22
|
+
"codebasesearch@latest"
|
|
23
|
+
],
|
|
24
|
+
"timeout": 360000
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|