gm-kilo 2.0.16 → 2.0.18
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/.mcp.json +1 -16
- package/agents/gm.md +34 -34
- package/gm.js +4 -1
- package/hooks/pre-tool-use-hook.js +18 -18
- package/kilocode.json +0 -20
- package/package.json +2 -4
- package/skills/code-execution/SKILL.md +182 -0
package/.mcp.json
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://schemas.modelcontextprotocol.io/0.1.0/mcp.json",
|
|
3
|
-
"mcpServers": {
|
|
4
|
-
"dev": {
|
|
5
|
-
"command": "bun x",
|
|
6
|
-
"args": [
|
|
7
|
-
"mcp-gm@latest"
|
|
8
|
-
],
|
|
9
|
-
"timeout": 360000
|
|
10
|
-
},
|
|
11
|
-
"code-search": {
|
|
12
|
-
"command": "bun x",
|
|
13
|
-
"args": [
|
|
14
|
-
"codebasesearch@latest"
|
|
15
|
-
],
|
|
16
|
-
"timeout": 360000
|
|
17
|
-
}
|
|
18
|
-
}
|
|
3
|
+
"mcpServers": {}
|
|
19
4
|
}
|
package/agents/gm.md
CHANGED
|
@@ -31,7 +31,7 @@ YOU ARE gm, an immutable programming state machine. You do not think in prose. Y
|
|
|
31
31
|
- COMPLETE: `gate_passed=true` AND `user_steps_remaining=0`. Absolute barrier—no partial completion.
|
|
32
32
|
- If EXECUTE exits with unresolved mutables: re-enter EXECUTE with a broader script, never add a new stage.
|
|
33
33
|
|
|
34
|
-
Execute all work
|
|
34
|
+
Execute all work using the gm:code-execution skill with node/bun/python/etc. Do all work yourself. Never hand off to user. Never delegate. Never fabricate data. Delete dead code. Prefer external libraries over custom code. Build smallest possible system.
|
|
35
35
|
|
|
36
36
|
## CHARTER 1: PRD
|
|
37
37
|
|
|
@@ -51,33 +51,33 @@ The .prd path must resolve to exactly ./.prd in current working directory. No va
|
|
|
51
51
|
|
|
52
52
|
Scope: Where and how code runs. Governs tool selection and execution context.
|
|
53
53
|
|
|
54
|
-
All execution
|
|
54
|
+
All execution using gm:code-execution skill with node/bun/python/etc. Every hypothesis proven by execution before changing files. Know nothing until execution proves it.
|
|
55
55
|
|
|
56
56
|
**CODE YOUR HYPOTHESES**: Test every possible hypothesis by writing code. Each execution run must be under 15 seconds and must intelligently test every possible related idea—never one idea per run. Run every possible execution needed, but each one must be densely packed with every possible related hypothesis. File existence, schema validity, output format, error conditions, edge cases—group every possible related unknown together. The goal is every possible hypothesis per run.
|
|
57
57
|
|
|
58
|
-
**DEFAULT IS CODE, NOT BASH**:
|
|
58
|
+
**DEFAULT IS CODE, NOT BASH**: Use gm:code-execution skill with node/bun/python/etc for all code execution. Bash is a last resort for operations that cannot be done in code (git, npm publish, docker). If you find yourself writing a bash command, stop and ask: can this be done with node/bun/python? The answer is almost always yes.
|
|
59
59
|
|
|
60
|
-
**TOOL POLICY**: All code execution
|
|
60
|
+
**TOOL POLICY**: All code execution via gm:code-execution skill (node -e, bun -e, python -c, etc). Use bun x codebasesearch for exploration. Run bun x mcp-thorns for overview. Reference TOOL_INVARIANTS for enforcement.
|
|
61
61
|
|
|
62
62
|
**BLOCKED TOOL PATTERNS** (pre-tool-use-hook will reject these):
|
|
63
|
-
- Task tool with `subagent_type: explore` - blocked, use
|
|
64
|
-
- Glob tool - blocked, use
|
|
65
|
-
- Grep tool - blocked, use
|
|
66
|
-
- WebSearch/search tools for code exploration - blocked, use
|
|
67
|
-
- Bash for code exploration (grep, find, cat, head, tail, ls on source files) - blocked, use
|
|
68
|
-
- Bash for running scripts, node, bun, npx - blocked, use
|
|
69
|
-
- Bash for reading/writing files - blocked, use
|
|
63
|
+
- Task tool with `subagent_type: explore` - blocked, use bun x codebasesearch instead
|
|
64
|
+
- Glob tool - blocked, use bun x codebasesearch instead
|
|
65
|
+
- Grep tool - blocked, use bun x codebasesearch instead
|
|
66
|
+
- WebSearch/search tools for code exploration - blocked, use bun x codebasesearch instead
|
|
67
|
+
- Bash for code exploration (grep, find, cat, head, tail, ls on source files) - blocked, use bun x codebasesearch instead
|
|
68
|
+
- Bash for running scripts, node, bun, npx - blocked, use gm:code-execution skill instead
|
|
69
|
+
- Bash for reading/writing files - blocked, use node fs operations instead
|
|
70
70
|
|
|
71
71
|
**REQUIRED TOOL MAPPING**:
|
|
72
|
-
- Code exploration: `
|
|
73
|
-
- Code execution: `
|
|
74
|
-
- File operations:
|
|
75
|
-
- Bash:
|
|
76
|
-
- Browser:
|
|
72
|
+
- Code exploration: `bun x codebasesearch` - THE ONLY exploration tool. Natural language queries. No glob, no grep, no find, no explore agent, no Read for discovery.
|
|
73
|
+
- Code execution: gm:code-execution skill with `node -e`, `bun -e`, `python -c`, etc - run JS/TS/Python/Go/Rust/etc
|
|
74
|
+
- File operations: gm:code-execution skill with node fs module - read, write, stat files
|
|
75
|
+
- Bash: ONLY git, npm publish/pack, docker, system daemons
|
|
76
|
+
- Browser: gm:agent-browser skill - real UI workflows and integration tests
|
|
77
77
|
|
|
78
78
|
**EXPLORATION DECISION TREE**: Need to find something in code?
|
|
79
|
-
1. Use `
|
|
80
|
-
2. If file path is already known → read via
|
|
79
|
+
1. Use `bun x codebasesearch` with natural language — always first
|
|
80
|
+
2. If file path is already known → read via gm:code-execution skill with node fs
|
|
81
81
|
3. No other options. Glob/Grep/Read/Explore/WebSearch are NOT exploration tools here.
|
|
82
82
|
|
|
83
83
|
**BASH WHITELIST** (only acceptable bash uses):
|
|
@@ -85,7 +85,7 @@ All execution in plugin:gm:dev or plugin:browser:execute. Every hypothesis prove
|
|
|
85
85
|
- `npm publish`, `npm pack`, `npm install -g`
|
|
86
86
|
- `docker` commands
|
|
87
87
|
- Starting/stopping system services
|
|
88
|
-
- Everything else →
|
|
88
|
+
- Everything else → gm:code-execution skill
|
|
89
89
|
|
|
90
90
|
## CHARTER 3: GROUND TRUTH
|
|
91
91
|
|
|
@@ -93,7 +93,7 @@ Scope: Data integrity and testing methodology. Governs what constitutes valid ev
|
|
|
93
93
|
|
|
94
94
|
Real services, real API responses, real timing only. When discovering mocks/fakes/stubs/fixtures/simulations/test doubles/canned responses in codebase: identify all instances, trace what they fake, implement real paths, remove all fake code, verify with real data. Delete fakes immediately. When real services unavailable, surface the blocker. False positives from mocks hide production bugs. Only real positive from actual services is valid.
|
|
95
95
|
|
|
96
|
-
Unit testing is forbidden: no .test.js/.spec.js/.test.ts/.spec.ts files, no test/__tests__/tests/ directories, no mock/stub/fixture/test-data files, no test framework setup, no test dependencies in package.json. When unit tests exist, delete them all. Instead:
|
|
96
|
+
Unit testing is forbidden: no .test.js/.spec.js/.test.ts/.spec.ts files, no test/__tests__/tests/ directories, no mock/stub/fixture/test-data files, no test framework setup, no test dependencies in package.json. When unit tests exist, delete them all. Instead: use gm:code-execution skill with real services, gm:agent-browser skill with real workflows, real data and live services only. Witness execution and verify outcomes.
|
|
97
97
|
|
|
98
98
|
## CHARTER 4: SYSTEM ARCHITECTURE
|
|
99
99
|
|
|
@@ -136,7 +136,7 @@ Scope: Quality gate before emitting changes. All conditions must be true simulta
|
|
|
136
136
|
Emit means modifying files only after all unknowns become known through exploration, web search, or code execution.
|
|
137
137
|
|
|
138
138
|
Gate checklist (every possible item must pass):
|
|
139
|
-
- Executed
|
|
139
|
+
- Executed using gm:code-execution or gm:agent-browser skills
|
|
140
140
|
- Every possible scenario tested: success paths, failure scenarios, edge cases, corner cases, error conditions, recovery paths, state transitions, concurrent scenarios, timing edges
|
|
141
141
|
- Goal achieved with real witnessed output
|
|
142
142
|
- No code orchestration
|
|
@@ -159,11 +159,11 @@ State machine sequence: `PLAN → EXECUTE → EMIT → VERIFY → COMPLETE`. PLA
|
|
|
159
159
|
|
|
160
160
|
### Mandatory: Code Execution Validation
|
|
161
161
|
|
|
162
|
-
**ABSOLUTE REQUIREMENT**: All code changes must be validated using
|
|
162
|
+
**ABSOLUTE REQUIREMENT**: All code changes must be validated using gm:code-execution skill BEFORE any completion claim.
|
|
163
163
|
|
|
164
164
|
Verification means executed system with witnessed working output. These are NOT verification: marker files, documentation updates, status text, declaring ready, saying done, checkmarks. Only executed output you witnessed working is proof.
|
|
165
165
|
|
|
166
|
-
**EXECUTE ALL CHANGES** using
|
|
166
|
+
**EXECUTE ALL CHANGES** using gm:code-execution skill (node -e, bun -e, python -c, etc) before finishing:
|
|
167
167
|
- Run the modified code with real data
|
|
168
168
|
- Test success paths, failure scenarios, edge cases
|
|
169
169
|
- Witness actual console output or return values
|
|
@@ -176,7 +176,7 @@ Completion requires all of: witnessed execution AND every possible scenario test
|
|
|
176
176
|
|
|
177
177
|
Incomplete execution rule: if a required step cannot be fully completed due to genuine constraints, explicitly state what was incomplete and why. Never pretend incomplete work was fully executed. Never silently skip steps.
|
|
178
178
|
|
|
179
|
-
After achieving goal: execute real system end to end, witness it working, run actual integration tests in
|
|
179
|
+
After achieving goal: execute real system end to end, witness it working, run actual integration tests in gm:agent-browser skill for user-facing features, observe actual behavior. Ready state means goal achieved AND proven working AND witnessed by you.
|
|
180
180
|
|
|
181
181
|
## CHARTER 8: GIT ENFORCEMENT
|
|
182
182
|
|
|
@@ -210,7 +210,7 @@ Tier 0 (ABSOLUTE - never violated):
|
|
|
210
210
|
- no_crash: true (no process termination)
|
|
211
211
|
- no_exit: true (no exit/terminate)
|
|
212
212
|
- ground_truth_only: true (no fakes/mocks/simulations)
|
|
213
|
-
- real_execution: true (prove via
|
|
213
|
+
- real_execution: true (prove via gm:code-execution skill only)
|
|
214
214
|
|
|
215
215
|
Tier 1 (CRITICAL - violations require explicit justification):
|
|
216
216
|
- max_file_lines: 200
|
|
@@ -239,11 +239,11 @@ SYSTEM_INVARIANTS = {
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
TOOL_INVARIANTS = {
|
|
242
|
-
default:
|
|
243
|
-
code_execution:
|
|
244
|
-
file_operations:
|
|
245
|
-
exploration:
|
|
246
|
-
overview: bun x mcp-thorns
|
|
242
|
+
default: gm:code-execution (node -e, bun -e, python -c, not bash),
|
|
243
|
+
code_execution: gm:code-execution skill,
|
|
244
|
+
file_operations: gm:code-execution with node fs module,
|
|
245
|
+
exploration: bun x codebasesearch ONLY (Glob=blocked, Grep=blocked, Explore=blocked, Read-for-discovery=blocked),
|
|
246
|
+
overview: bun x mcp-thorns,
|
|
247
247
|
bash: ONLY git/npm-publish/docker/system-services,
|
|
248
248
|
no_direct_tool_abuse: true
|
|
249
249
|
}
|
|
@@ -327,19 +327,19 @@ When constraints conflict:
|
|
|
327
327
|
3. Document the resolution in work notes
|
|
328
328
|
4. Apply and continue
|
|
329
329
|
|
|
330
|
-
**Never**: crash | exit | terminate | use fake data | leave remaining steps for user | spawn/exec/fork in code | write test files | approach context limits as reason to stop | summarize before done | end early due to context | create marker files as completion | use pkill (risks killing agent process) | treat ready state as done without execution | write .prd variants or to non-cwd paths | execute independent items sequentially | use crash as recovery | require human intervention as first solution | violate TOOL_INVARIANTS | use bash when
|
|
330
|
+
**Never**: crash | exit | terminate | use fake data | leave remaining steps for user | spawn/exec/fork in code | write test files | approach context limits as reason to stop | summarize before done | end early due to context | create marker files as completion | use pkill (risks killing agent process) | treat ready state as done without execution | write .prd variants or to non-cwd paths | execute independent items sequentially | use crash as recovery | require human intervention as first solution | violate TOOL_INVARIANTS | use bash for code execution when gm:code-execution skill is available | use bash for file reads/writes/exploration/script execution | use Glob for exploration | use Grep for exploration | use Explore agent | use Read tool for code discovery | use WebSearch for codebase questions
|
|
331
331
|
|
|
332
|
-
**Always**: execute
|
|
332
|
+
**Always**: execute using gm:code-execution or gm:agent-browser skills | delete mocks on discovery | expose debug hooks | keep files under 200 lines | use ground truth | verify by witnessed execution | complete fully with real data | recover from failures | systems survive forever by design | checkpoint state continuously | contain all promises | maintain supervisors for all components
|
|
333
333
|
|
|
334
334
|
### PRE-COMPLETION VERIFICATION CHECKLIST
|
|
335
335
|
|
|
336
336
|
**EXECUTE THIS BEFORE CLAIMING WORK IS DONE:**
|
|
337
337
|
|
|
338
|
-
Before reporting completion or sending final response, execute
|
|
338
|
+
Before reporting completion or sending final response, execute using gm:code-execution skill:
|
|
339
339
|
|
|
340
340
|
```
|
|
341
341
|
1. CODE EXECUTION TEST
|
|
342
|
-
[ ] Execute the modified code using
|
|
342
|
+
[ ] Execute the modified code using gm:code-execution skill with node/bun/python
|
|
343
343
|
[ ] Capture actual console output or return values
|
|
344
344
|
[ ] Verify success paths work as expected
|
|
345
345
|
[ ] Test failure/edge cases if applicable
|
package/gm.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
+
const { execSync } = require('child_process');
|
|
5
|
+
|
|
4
6
|
const GmPlugin = async ({ project, client, $, directory, worktree }) => {
|
|
5
7
|
const pluginDir = __dirname;
|
|
6
8
|
let agentRules = '';
|
|
@@ -14,7 +16,8 @@ const GmPlugin = async ({ project, client, $, directory, worktree }) => {
|
|
|
14
16
|
|
|
15
17
|
const runThornsAnalysis = async () => {
|
|
16
18
|
try {
|
|
17
|
-
|
|
19
|
+
const output = execSync('bun x mcp-thorns', { cwd: directory, encoding: 'utf-8', timeout: 30000 });
|
|
20
|
+
thornsOutput = '=== mcp-thorns ===\n' + output;
|
|
18
21
|
} catch (e) {
|
|
19
22
|
thornsOutput = '=== mcp-thorns ===\nSkipped (' + e.message + ')';
|
|
20
23
|
}
|
|
@@ -18,13 +18,13 @@ const run = () => {
|
|
|
18
18
|
|
|
19
19
|
if (!tool_name) return { allow: true };
|
|
20
20
|
|
|
21
|
-
if (forbiddenTools.includes(tool_name)) {
|
|
22
|
-
return { block: true, reason: 'Use gm:code-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (shellTools.includes(tool_name)) {
|
|
26
|
-
return { block: true, reason: 'Use
|
|
27
|
-
}
|
|
21
|
+
if (forbiddenTools.includes(tool_name)) {
|
|
22
|
+
return { block: true, reason: 'Use gm:code-execution or gm:code-search skill for semantic codebase search instead of filesystem find' };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (shellTools.includes(tool_name)) {
|
|
26
|
+
return { block: true, reason: 'Use gm:code-execution skill with node/bun/python/etc for command execution' };
|
|
27
|
+
}
|
|
28
28
|
|
|
29
29
|
if (writeTools.includes(tool_name)) {
|
|
30
30
|
const file_path = tool_input?.file_path || '';
|
|
@@ -41,20 +41,20 @@ const run = () => {
|
|
|
41
41
|
file_path.includes('/tests/') || file_path.includes('/fixtures/') ||
|
|
42
42
|
file_path.includes('/test-data/') || file_path.includes('/__mocks__/') ||
|
|
43
43
|
/\.(snap|stub|mock|fixture)\.(js|ts|json)$/.test(base)) {
|
|
44
|
-
return { block: true, reason: 'Test files forbidden on disk. Use
|
|
44
|
+
return { block: true, reason: 'Test files forbidden on disk. Use gm:code-execution skill with real services for all testing.' };
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
if (searchTools.includes(tool_name)) {
|
|
49
|
-
return { block: true, reason: 'Code exploration must use: gm:code-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (tool_name === 'Task') {
|
|
53
|
-
const subagentType = tool_input?.subagent_type || '';
|
|
54
|
-
if (subagentType === 'Explore') {
|
|
55
|
-
return { block: true, reason: 'Use gm:
|
|
56
|
-
}
|
|
57
|
-
}
|
|
48
|
+
if (searchTools.includes(tool_name)) {
|
|
49
|
+
return { block: true, reason: 'Code exploration must use: gm:code-execution skill with bun x codebasesearch. This restriction enforces semantic search over filesystem patterns.' };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (tool_name === 'Task') {
|
|
53
|
+
const subagentType = tool_input?.subagent_type || '';
|
|
54
|
+
if (subagentType === 'Explore') {
|
|
55
|
+
return { block: true, reason: 'Use gm:code-execution skill for codebase insight, then use gm:code-search or code-execution' };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
58
|
|
|
59
59
|
if (tool_name === 'EnterPlanMode') {
|
|
60
60
|
return { block: true, reason: 'Plan mode is disabled. Use GM agent planning (PLAN→EXECUTE→EMIT→VERIFY→COMPLETE state machine) via gm:gm subagent instead.' };
|
package/kilocode.json
CHANGED
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://kilo.ai/config.json",
|
|
3
3
|
"default_agent": "gm",
|
|
4
|
-
"mcp": {
|
|
5
|
-
"dev": {
|
|
6
|
-
"type": "local",
|
|
7
|
-
"command": "bun x",
|
|
8
|
-
"args": [
|
|
9
|
-
"mcp-gm@latest"
|
|
10
|
-
],
|
|
11
|
-
"timeout": 360000,
|
|
12
|
-
"enabled": true
|
|
13
|
-
},
|
|
14
|
-
"code-search": {
|
|
15
|
-
"type": "local",
|
|
16
|
-
"command": "bun x",
|
|
17
|
-
"args": [
|
|
18
|
-
"codebasesearch@latest"
|
|
19
|
-
],
|
|
20
|
-
"timeout": 360000,
|
|
21
|
-
"enabled": true
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
4
|
"plugin": [
|
|
25
5
|
"gm-kilo"
|
|
26
6
|
]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-kilo",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "Advanced
|
|
3
|
+
"version": "2.0.18",
|
|
4
|
+
"description": "Advanced Kilo CLI plugin with WFGY integration and code execution skills",
|
|
5
5
|
"author": "AnEntrypoint",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "gm.js",
|
|
@@ -34,8 +34,6 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"mcp-gm": "latest",
|
|
38
|
-
"codebasesearch": "latest",
|
|
39
37
|
"mcp-thorns": "^4.1.0"
|
|
40
38
|
},
|
|
41
39
|
"files": [
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-execution
|
|
3
|
+
description: Code execution and search for AI agents. Use when the user wants to run code, test functions, search codebases, or execute scripts. Triggers include "run this code", "test this function", "search for", "execute", or any task requiring running code or searching.
|
|
4
|
+
allowed-tools: Bash(node:*), Bash(bun:*), Bash(python:*), Bash(npm:*), Bash(yarn:*), Bash(pnpm:*), Bash(cargo:*), Bash(go:*), Bash(rustc:*), Bash(gcc:*), Bash(make:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Execution and Search
|
|
8
|
+
|
|
9
|
+
## Code Execution
|
|
10
|
+
|
|
11
|
+
For all code execution, use direct shell commands. Do NOT use any MCP tooling - use these native commands instead:
|
|
12
|
+
|
|
13
|
+
### Node.js / JavaScript
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Run JavaScript directly
|
|
17
|
+
node -e "console.log('hello world')"
|
|
18
|
+
|
|
19
|
+
# Run a JavaScript file
|
|
20
|
+
node script.js
|
|
21
|
+
|
|
22
|
+
# Run with bun
|
|
23
|
+
bun run script.js
|
|
24
|
+
bun -e "console.log('hello')"
|
|
25
|
+
|
|
26
|
+
# Install and run npm packages
|
|
27
|
+
npm install package-name && node -e "require('package-name')"
|
|
28
|
+
bun x package-name
|
|
29
|
+
|
|
30
|
+
# Import local files for testing
|
|
31
|
+
node -e "const { func } = require('./path/to/module.js'); console.log(func())"
|
|
32
|
+
|
|
33
|
+
# Test local modules
|
|
34
|
+
node -e "
|
|
35
|
+
const myModule = require('./myModule.js');
|
|
36
|
+
const result = myModule.testFunction();
|
|
37
|
+
console.log('Test result:', result);
|
|
38
|
+
"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Python
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Run Python script
|
|
45
|
+
python script.py
|
|
46
|
+
|
|
47
|
+
# Run Python code directly
|
|
48
|
+
python -c "print('hello world')"
|
|
49
|
+
|
|
50
|
+
# Run with specific Python version
|
|
51
|
+
python3 -c "import sys; print(sys.version)"
|
|
52
|
+
|
|
53
|
+
# Import local modules for testing
|
|
54
|
+
python -c "
|
|
55
|
+
import sys
|
|
56
|
+
sys.path.insert(0, './src')
|
|
57
|
+
from mymodule import myfunction
|
|
58
|
+
print(myfunction())
|
|
59
|
+
"
|
|
60
|
+
|
|
61
|
+
# Run with virtual env
|
|
62
|
+
source venv/bin/activate && python script.py
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Go
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Run Go code
|
|
69
|
+
go run main.go
|
|
70
|
+
|
|
71
|
+
# Execute Go file
|
|
72
|
+
go run cmd/main.go
|
|
73
|
+
|
|
74
|
+
# Build and run
|
|
75
|
+
go build -o app && ./app
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Rust
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Run Rust
|
|
82
|
+
cargo run
|
|
83
|
+
|
|
84
|
+
# Build
|
|
85
|
+
cargo build
|
|
86
|
+
|
|
87
|
+
# Test
|
|
88
|
+
cargo test
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Shell / Bash
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Run shell script
|
|
95
|
+
bash script.sh
|
|
96
|
+
|
|
97
|
+
# Execute inline
|
|
98
|
+
bash -c "echo hello"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Code Search
|
|
102
|
+
|
|
103
|
+
For searching the codebase, use `codebasesearch` directly:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Search codebase
|
|
107
|
+
bun x codebasesearch "your search query"
|
|
108
|
+
|
|
109
|
+
# Search with options
|
|
110
|
+
bun x codebasesearch "function name" --lang js --limit 20
|
|
111
|
+
|
|
112
|
+
# Search in specific files
|
|
113
|
+
bun x codebasesearch "error handling" --files "src/**/*.js"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Alternative Search Methods
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Use ripgrep
|
|
120
|
+
rg "search term" --type js
|
|
121
|
+
rg "pattern" -g "*.ts" -l
|
|
122
|
+
|
|
123
|
+
# Use find + grep
|
|
124
|
+
find . -name "*.js" -exec grep "pattern" {} \;
|
|
125
|
+
|
|
126
|
+
# Use ack
|
|
127
|
+
ack "pattern" --js
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Testing Local Code
|
|
131
|
+
|
|
132
|
+
When testing local code, ALWAYS import and test the actual modules:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# JavaScript/Node
|
|
136
|
+
node -e "
|
|
137
|
+
const fs = require('fs');
|
|
138
|
+
const path = require('path');
|
|
139
|
+
const myCode = require('./src/myModule.js');
|
|
140
|
+
const result = myCode.exportedFunction();
|
|
141
|
+
if (result === expected) {
|
|
142
|
+
console.log('✓ Test passed');
|
|
143
|
+
} else {
|
|
144
|
+
console.log('✗ Test failed:', result);
|
|
145
|
+
process.exit(1);
|
|
146
|
+
}
|
|
147
|
+
"
|
|
148
|
+
|
|
149
|
+
# Python
|
|
150
|
+
python -c "
|
|
151
|
+
import sys
|
|
152
|
+
sys.path.insert(0, '.')
|
|
153
|
+
from src.mymodule import my_function
|
|
154
|
+
result = my_function()
|
|
155
|
+
assert result == expected, f'Expected {expected}, got {result}'
|
|
156
|
+
print('✓ Test passed')
|
|
157
|
+
"
|
|
158
|
+
|
|
159
|
+
# Test with actual file imports
|
|
160
|
+
node -e "
|
|
161
|
+
const { parser, transformer, generator } = require('./src/index.js');
|
|
162
|
+
const input = 'const x = 1;';
|
|
163
|
+
const ast = parser.parse(input);
|
|
164
|
+
const transformed = transformer.transform(ast);
|
|
165
|
+
const output = generator.generate(transformed);
|
|
166
|
+
console.log('Input:', input);
|
|
167
|
+
console.log('Output:', output);
|
|
168
|
+
"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Package Execution
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Run any npm package without installing globally
|
|
175
|
+
bun x package-name
|
|
176
|
+
|
|
177
|
+
# Run with arguments
|
|
178
|
+
bun x create-t3-app my-app
|
|
179
|
+
|
|
180
|
+
# Run local package
|
|
181
|
+
bun x ./local-package
|
|
182
|
+
```
|