@trishchuk/codex-mcp-tool 1.0.6 → 1.3.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.
- package/README.md +92 -16
- package/dist/constants.d.ts +64 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +85 -31
- package/dist/constants.js.map +1 -1
- package/dist/index.js +28 -26
- package/dist/index.js.map +1 -1
- package/dist/tools/apply-diff.tool.d.ts +3 -0
- package/dist/tools/apply-diff.tool.d.ts.map +1 -0
- package/dist/tools/apply-diff.tool.js +52 -0
- package/dist/tools/apply-diff.tool.js.map +1 -0
- package/dist/tools/ask-codex.tool.d.ts.map +1 -1
- package/dist/tools/ask-codex.tool.js +171 -33
- package/dist/tools/ask-codex.tool.js.map +1 -1
- package/dist/tools/batch-codex.tool.d.ts +3 -0
- package/dist/tools/batch-codex.tool.d.ts.map +1 -0
- package/dist/tools/batch-codex.tool.js +134 -0
- package/dist/tools/batch-codex.tool.js.map +1 -0
- package/dist/tools/brainstorm.tool.d.ts.map +1 -1
- package/dist/tools/brainstorm.tool.js +62 -29
- package/dist/tools/brainstorm.tool.js.map +1 -1
- package/dist/tools/exec-codex.tool.d.ts +3 -0
- package/dist/tools/exec-codex.tool.d.ts.map +1 -0
- package/dist/tools/exec-codex.tool.js +46 -0
- package/dist/tools/exec-codex.tool.js.map +1 -0
- package/dist/tools/fetch-chunk.tool.d.ts.map +1 -1
- package/dist/tools/fetch-chunk.tool.js +12 -8
- package/dist/tools/fetch-chunk.tool.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/registry.d.ts +3 -3
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +9 -5
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/review-codex.tool.d.ts +3 -0
- package/dist/tools/review-codex.tool.d.ts.map +1 -0
- package/dist/tools/review-codex.tool.js +91 -0
- package/dist/tools/review-codex.tool.js.map +1 -0
- package/dist/tools/simple-tools.d.ts +1 -0
- package/dist/tools/simple-tools.d.ts.map +1 -1
- package/dist/tools/simple-tools.js +42 -11
- package/dist/tools/simple-tools.js.map +1 -1
- package/dist/tools/test-tool.example.d.ts.map +1 -1
- package/dist/tools/test-tool.example.js +12 -10
- package/dist/tools/test-tool.example.js.map +1 -1
- package/dist/tools/timeout-test.tool.js +5 -5
- package/dist/tools/timeout-test.tool.js.map +1 -1
- package/dist/utils/changeModeChunker.d.ts.map +1 -1
- package/dist/utils/changeModeChunker.js +10 -6
- package/dist/utils/changeModeChunker.js.map +1 -1
- package/dist/utils/changeModeParser.d.ts.map +1 -1
- package/dist/utils/changeModeParser.js.map +1 -1
- package/dist/utils/changeModeRunner.d.ts.map +1 -1
- package/dist/utils/changeModeRunner.js +17 -11
- package/dist/utils/changeModeRunner.js.map +1 -1
- package/dist/utils/changeModeTranslator.d.ts.map +1 -1
- package/dist/utils/changeModeTranslator.js +5 -2
- package/dist/utils/changeModeTranslator.js.map +1 -1
- package/dist/utils/chunkCache.d.ts.map +1 -1
- package/dist/utils/chunkCache.js +6 -4
- package/dist/utils/chunkCache.js.map +1 -1
- package/dist/utils/codexCommandBuilder.d.ts +80 -0
- package/dist/utils/codexCommandBuilder.d.ts.map +1 -0
- package/dist/utils/codexCommandBuilder.js +259 -0
- package/dist/utils/codexCommandBuilder.js.map +1 -0
- package/dist/utils/codexExecutor.d.ts +19 -0
- package/dist/utils/codexExecutor.d.ts.map +1 -1
- package/dist/utils/codexExecutor.js +49 -57
- package/dist/utils/codexExecutor.js.map +1 -1
- package/dist/utils/commandExecutor.d.ts.map +1 -1
- package/dist/utils/commandExecutor.js +25 -17
- package/dist/utils/commandExecutor.js.map +1 -1
- package/dist/utils/fibonacci.d.ts +2 -0
- package/dist/utils/fibonacci.d.ts.map +1 -0
- package/dist/utils/fibonacci.js +17 -0
- package/dist/utils/fibonacci.js.map +1 -0
- package/dist/utils/gitHelper.d.ts +20 -0
- package/dist/utils/gitHelper.d.ts.map +1 -0
- package/dist/utils/gitHelper.js +66 -0
- package/dist/utils/gitHelper.js.map +1 -0
- package/dist/utils/logger.d.ts +2 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +21 -15
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/modelDetection.d.ts +45 -0
- package/dist/utils/modelDetection.d.ts.map +1 -0
- package/dist/utils/modelDetection.js +148 -0
- package/dist/utils/modelDetection.js.map +1 -0
- package/dist/utils/outputParser.d.ts +26 -0
- package/dist/utils/outputParser.d.ts.map +1 -0
- package/dist/utils/outputParser.js +174 -0
- package/dist/utils/outputParser.js.map +1 -0
- package/dist/utils/reviewParser.d.ts +28 -0
- package/dist/utils/reviewParser.d.ts.map +1 -0
- package/dist/utils/reviewParser.js +87 -0
- package/dist/utils/reviewParser.js.map +1 -0
- package/dist/utils/versionDetection.d.ts +108 -0
- package/dist/utils/versionDetection.d.ts.map +1 -0
- package/dist/utils/versionDetection.js +160 -0
- package/dist/utils/versionDetection.js.map +1 -0
- package/dist/utils/workingDirResolver.d.ts +52 -0
- package/dist/utils/workingDirResolver.d.ts.map +1 -0
- package/dist/utils/workingDirResolver.js +217 -0
- package/dist/utils/workingDirResolver.js.map +1 -0
- package/package.json +8 -3
|
@@ -20,8 +20,10 @@ ${existingContext ? `Background: ${existingContext}` : ''}
|
|
|
20
20
|
## Requirements
|
|
21
21
|
Generate ${ideaCount} actionable ideas. Keep descriptions concise (2-3 sentences max).
|
|
22
22
|
|
|
23
|
-
${includeAnalysis
|
|
24
|
-
|
|
23
|
+
${includeAnalysis
|
|
24
|
+
? `## Analysis
|
|
25
|
+
Rate each: Feasibility (1-5), Impact (1-5), Innovation (1-5)`
|
|
26
|
+
: ''}
|
|
25
27
|
|
|
26
28
|
## Format
|
|
27
29
|
### Idea [N]: [Name]
|
|
@@ -36,19 +38,19 @@ Begin:`;
|
|
|
36
38
|
*/
|
|
37
39
|
function getMethodologyInstructions(methodology, domain) {
|
|
38
40
|
const methodologies = {
|
|
39
|
-
|
|
41
|
+
divergent: `**Divergent Thinking Approach:**
|
|
40
42
|
- Generate maximum quantity of ideas without self-censoring
|
|
41
43
|
- Build on wild or seemingly impractical ideas
|
|
42
44
|
- Combine unrelated concepts for unexpected solutions
|
|
43
45
|
- Use "Yes, and..." thinking to expand each concept
|
|
44
46
|
- Postpone evaluation until all ideas are generated`,
|
|
45
|
-
|
|
47
|
+
convergent: `**Convergent Thinking Approach:**
|
|
46
48
|
- Focus on refining and improving existing concepts
|
|
47
49
|
- Synthesize related ideas into stronger solutions
|
|
48
50
|
- Apply critical evaluation criteria
|
|
49
51
|
- Prioritize based on feasibility and impact
|
|
50
52
|
- Develop implementation pathways for top ideas`,
|
|
51
|
-
|
|
53
|
+
scamper: `**SCAMPER Creative Triggers:**
|
|
52
54
|
- **Substitute:** What can be substituted or replaced?
|
|
53
55
|
- **Combine:** What can be combined or merged?
|
|
54
56
|
- **Adapt:** What can be adapted from other domains?
|
|
@@ -62,47 +64,74 @@ function getMethodologyInstructions(methodology, domain) {
|
|
|
62
64
|
- **Ideate:** Generate user-focused solutions
|
|
63
65
|
- **Consider Journey:** Think through complete user experience
|
|
64
66
|
- **Prototype Mindset:** Focus on testable, iterative concepts`,
|
|
65
|
-
|
|
67
|
+
lateral: `**Lateral Thinking Approach:**
|
|
66
68
|
- Make unexpected connections between unrelated fields
|
|
67
69
|
- Challenge fundamental assumptions
|
|
68
70
|
- Use random word association to trigger new directions
|
|
69
71
|
- Apply metaphors and analogies from other domains
|
|
70
72
|
- Reverse conventional thinking patterns`,
|
|
71
|
-
|
|
72
|
-
${domain ? `Given the ${domain} domain, I'll apply the most effective combination of:` :
|
|
73
|
+
auto: `**AI-Optimized Approach:**
|
|
74
|
+
${domain ? `Given the ${domain} domain, I'll apply the most effective combination of:` : "I'll intelligently combine multiple methodologies:"}
|
|
73
75
|
- Divergent exploration with domain-specific knowledge
|
|
74
76
|
- SCAMPER triggers and lateral thinking
|
|
75
|
-
- Human-centered perspective for practical value
|
|
77
|
+
- Human-centered perspective for practical value`,
|
|
76
78
|
};
|
|
77
79
|
return methodologies[methodology] || methodologies['auto'];
|
|
78
80
|
}
|
|
79
81
|
const brainstormArgsSchema = z.object({
|
|
80
|
-
prompt: z.string().min(1).describe(
|
|
81
|
-
model: z
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
prompt: z.string().min(1).describe('Brainstorming challenge or question'),
|
|
83
|
+
model: z
|
|
84
|
+
.string()
|
|
85
|
+
.optional()
|
|
86
|
+
.describe('Model: gpt-5-codex (default), gpt-5, o3, o4-mini, codex-1, codex-mini-latest, gpt-4.1'),
|
|
87
|
+
approvalPolicy: z
|
|
88
|
+
.enum(['never', 'on-request', 'on-failure', 'untrusted'])
|
|
89
|
+
.optional()
|
|
90
|
+
.describe('Approval: never, on-request, on-failure, untrusted'),
|
|
91
|
+
sandboxMode: z
|
|
92
|
+
.enum(['read-only', 'workspace-write', 'danger-full-access'])
|
|
93
|
+
.optional()
|
|
94
|
+
.describe('Access: read-only, workspace-write, danger-full-access'),
|
|
95
|
+
fullAuto: z.boolean().optional().describe('Full automation mode'),
|
|
96
|
+
yolo: z.boolean().optional().describe('⚠️ Bypass all safety (dangerous)'),
|
|
97
|
+
cd: z.string().optional().describe('Working directory'),
|
|
98
|
+
methodology: z
|
|
99
|
+
.enum(['divergent', 'convergent', 'scamper', 'design-thinking', 'lateral', 'auto'])
|
|
100
|
+
.default('auto')
|
|
101
|
+
.describe('Framework: divergent, convergent, scamper, design-thinking, lateral, auto (default)'),
|
|
102
|
+
domain: z
|
|
103
|
+
.string()
|
|
104
|
+
.optional()
|
|
105
|
+
.describe('Domain: software, business, creative, research, product, marketing, etc.'),
|
|
106
|
+
constraints: z.string().optional().describe('Limitations: budget, time, technical, legal, etc.'),
|
|
107
|
+
existingContext: z.string().optional().describe('Background info or previous attempts'),
|
|
108
|
+
ideaCount: z
|
|
109
|
+
.number()
|
|
110
|
+
.int()
|
|
111
|
+
.positive()
|
|
112
|
+
.default(12)
|
|
113
|
+
.describe('Number of ideas (default: 12, range: 5-30)'),
|
|
114
|
+
includeAnalysis: z.boolean().default(true).describe('Include feasibility/impact analysis'),
|
|
115
|
+
search: z
|
|
116
|
+
.boolean()
|
|
117
|
+
.optional()
|
|
118
|
+
.describe('Enable web search for research (activates web_search_request feature)'),
|
|
119
|
+
oss: z.boolean().optional().describe('Use local Ollama server'),
|
|
120
|
+
enableFeatures: z.array(z.string()).optional().describe('Enable feature flags'),
|
|
121
|
+
disableFeatures: z.array(z.string()).optional().describe('Disable feature flags'),
|
|
93
122
|
});
|
|
94
123
|
export const brainstormTool = {
|
|
95
|
-
name:
|
|
96
|
-
description:
|
|
124
|
+
name: 'brainstorm',
|
|
125
|
+
description: 'Generate creative ideas using structured frameworks with domain context and feasibility analysis.',
|
|
97
126
|
zodSchema: brainstormArgsSchema,
|
|
98
127
|
prompt: {
|
|
99
|
-
description:
|
|
128
|
+
description: 'Create structured brainstorming with chosen methodology and analysis',
|
|
100
129
|
},
|
|
101
130
|
category: 'utility',
|
|
102
131
|
execute: async (args, onProgress) => {
|
|
103
|
-
const { prompt, model, approvalPolicy, sandboxMode, fullAuto, yolo, cd, methodology = 'auto', domain, constraints, existingContext, ideaCount = 12, includeAnalysis = true } = args;
|
|
132
|
+
const { prompt, model, approvalPolicy, sandboxMode, fullAuto, yolo, cd, methodology = 'auto', domain, constraints, existingContext, ideaCount = 12, includeAnalysis = true, search, oss, enableFeatures, disableFeatures, } = args;
|
|
104
133
|
if (!prompt?.trim()) {
|
|
105
|
-
throw new Error(
|
|
134
|
+
throw new Error('You must provide a valid brainstorming challenge or question to explore');
|
|
106
135
|
}
|
|
107
136
|
let enhancedPrompt = buildBrainstormPrompt({
|
|
108
137
|
prompt: prompt.trim(),
|
|
@@ -111,7 +140,7 @@ export const brainstormTool = {
|
|
|
111
140
|
constraints: constraints,
|
|
112
141
|
existingContext: existingContext,
|
|
113
142
|
ideaCount: ideaCount,
|
|
114
|
-
includeAnalysis: includeAnalysis
|
|
143
|
+
includeAnalysis: includeAnalysis,
|
|
115
144
|
});
|
|
116
145
|
Logger.debug(`Brainstorm: Using methodology '${methodology}' for domain '${domain || 'general'}'`);
|
|
117
146
|
// Report progress to user
|
|
@@ -124,7 +153,11 @@ export const brainstormTool = {
|
|
|
124
153
|
sandboxMode: sandboxMode,
|
|
125
154
|
yolo: Boolean(yolo),
|
|
126
155
|
cd: cd,
|
|
156
|
+
search: search,
|
|
157
|
+
oss: oss,
|
|
158
|
+
enableFeatures: enableFeatures,
|
|
159
|
+
disableFeatures: disableFeatures,
|
|
127
160
|
}, onProgress);
|
|
128
|
-
}
|
|
161
|
+
},
|
|
129
162
|
};
|
|
130
163
|
//# sourceMappingURL=brainstorm.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brainstorm.tool.js","sourceRoot":"","sources":["../../src/tools/brainstorm.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,SAAS,qBAAqB,CAAC,MAQ9B;IACC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"brainstorm.tool.js","sourceRoot":"","sources":["../../src/tools/brainstorm.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAA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;QAET,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;QAC7F,CAAC;QAED,IAAI,cAAc,GAAG,qBAAqB,CAAC;YACzC,MAAM,EAAE,MAAM,CAAC,IAAI,EAAY;YAC/B,WAAW,EAAE,WAAqB;YAClC,MAAM,EAAE,MAA4B;YACpC,WAAW,EAAE,WAAiC;YAC9C,eAAe,EAAE,eAAqC;YACtD,SAAS,EAAE,SAAmB;YAC9B,eAAe,EAAE,eAA0B;SAC5C,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CACV,kCAAkC,WAAW,iBAAiB,MAAM,IAAI,SAAS,GAAG,CACrF,CAAC;QAEF,0BAA0B;QAC1B,UAAU,EAAE,CAAC,cAAc,SAAS,cAAc,WAAW,iBAAiB,CAAC,CAAC;QAEhF,uCAAuC;QACvC,OAAO,MAAM,eAAe,CAC1B,cAAc,EACd;YACE,KAAK,EAAE,KAA2B;YAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC;YAC3B,cAAc,EAAE,cAAqB;YACrC,WAAW,EAAE,WAAkB;YAC/B,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC;YACnB,EAAE,EAAE,EAAwB;YAC5B,MAAM,EAAE,MAAiB;YACzB,GAAG,EAAE,GAAc;YACnB,cAAc,EAAE,cAA0B;YAC1C,eAAe,EAAE,eAA2B;SAC7C,EACD,UAAU,CACX,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-codex.tool.d.ts","sourceRoot":"","sources":["../../src/tools/exec-codex.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAkB5C,eAAO,MAAM,aAAa,EAAE,WAwC3B,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { executeCodex } from '../utils/codexExecutor.js';
|
|
3
|
+
import { formatCodexResponseForMCP } from '../utils/outputParser.js';
|
|
4
|
+
import { ERROR_MESSAGES, STATUS_MESSAGES, MODELS, SANDBOX_MODES } from '../constants.js';
|
|
5
|
+
const execCodexArgsSchema = z.object({
|
|
6
|
+
prompt: z.string().min(1).describe("Command or instruction for non-interactive Codex execution"),
|
|
7
|
+
model: z.string().optional().describe(`Model to use: ${Object.values(MODELS).join(', ')}`),
|
|
8
|
+
sandbox: z.string().optional().describe(`Sandbox mode: ${Object.values(SANDBOX_MODES).join(', ')}`),
|
|
9
|
+
timeout: z.number().optional().describe("Maximum execution time in milliseconds (optional)"),
|
|
10
|
+
workingDir: z.string().optional().describe("Working directory for execution"),
|
|
11
|
+
});
|
|
12
|
+
export const execCodexTool = {
|
|
13
|
+
name: "exec-codex",
|
|
14
|
+
description: "Non-interactive Codex execution for automation and scripting",
|
|
15
|
+
zodSchema: execCodexArgsSchema,
|
|
16
|
+
prompt: {
|
|
17
|
+
description: "Execute Codex commands non-interactively for automation workflows",
|
|
18
|
+
},
|
|
19
|
+
category: 'codex',
|
|
20
|
+
execute: async (args, onProgress) => {
|
|
21
|
+
const { prompt, model, sandbox, timeout, workingDir } = args;
|
|
22
|
+
if (!prompt?.trim()) {
|
|
23
|
+
throw new Error(ERROR_MESSAGES.NO_PROMPT_PROVIDED);
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
if (onProgress) {
|
|
27
|
+
onProgress(`${STATUS_MESSAGES.PROCESSING_START} (non-interactive mode)`);
|
|
28
|
+
}
|
|
29
|
+
const result = await executeCodex(prompt, {
|
|
30
|
+
model: model,
|
|
31
|
+
sandboxMode: sandbox, // Allow string to SandboxMode conversion
|
|
32
|
+
timeout: timeout,
|
|
33
|
+
workingDir: workingDir,
|
|
34
|
+
cd: workingDir,
|
|
35
|
+
useExec: true
|
|
36
|
+
}, onProgress);
|
|
37
|
+
// Format for non-interactive use (more concise)
|
|
38
|
+
return formatCodexResponseForMCP(result, false, false);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
42
|
+
throw new Error(`Exec-Codex failed: ${errorMessage}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=exec-codex.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-codex.tool.js","sourceRoot":"","sources":["../../src/tools/exec-codex.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EACL,cAAc,EACd,eAAe,EACf,MAAM,EACN,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4DAA4D,CAAC;IAChG,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iBAAiB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1F,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iBAAiB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IACnG,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;IAC5F,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ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ACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-chunk.tool.d.ts","sourceRoot":"","sources":["../../src/tools/fetch-chunk.tool.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"fetch-chunk.tool.d.ts","sourceRoot":"","sources":["../../src/tools/fetch-chunk.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAa5C,eAAO,MAAM,cAAc,EAAE,WAwE5B,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { getChunks } from '../utils/chunkCache.js';
|
|
3
|
-
import { formatChangeModeResponse, summarizeChangeModeEdits } from '../utils/changeModeTranslator.js';
|
|
3
|
+
import { formatChangeModeResponse, summarizeChangeModeEdits, } from '../utils/changeModeTranslator.js';
|
|
4
4
|
import { Logger } from '../utils/logger.js';
|
|
5
5
|
const inputSchema = z.object({
|
|
6
|
-
cacheKey: z.string().describe(
|
|
7
|
-
chunkIndex: z.number().min(1).describe(
|
|
6
|
+
cacheKey: z.string().describe('The cache key provided in the initial changeMode response'),
|
|
7
|
+
chunkIndex: z.number().min(1).describe('Which chunk to retrieve (1-based index)'),
|
|
8
8
|
});
|
|
9
9
|
export const fetchChunkTool = {
|
|
10
10
|
name: 'fetch-chunk',
|
|
@@ -16,9 +16,9 @@ export const fetchChunkTool = {
|
|
|
16
16
|
{
|
|
17
17
|
name: 'prompt',
|
|
18
18
|
description: 'fetch-chunk cacheKey=<key> chunkIndex=<number>',
|
|
19
|
-
required: true
|
|
20
|
-
}
|
|
21
|
-
]
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
22
|
},
|
|
23
23
|
category: 'utility',
|
|
24
24
|
execute: async (args, onProgress) => {
|
|
@@ -49,7 +49,11 @@ Please use a valid chunk index.`;
|
|
|
49
49
|
// Get the requested chunk
|
|
50
50
|
const chunk = chunks[chunkIndex - 1];
|
|
51
51
|
// Format the response
|
|
52
|
-
let result = formatChangeModeResponse(chunk.edits, {
|
|
52
|
+
let result = formatChangeModeResponse(chunk.edits, {
|
|
53
|
+
current: chunkIndex,
|
|
54
|
+
total: chunks.length,
|
|
55
|
+
cacheKey,
|
|
56
|
+
});
|
|
53
57
|
// Add summary for first chunk
|
|
54
58
|
if (chunkIndex === 1 && chunks.length > 1) {
|
|
55
59
|
const allEdits = chunks.flatMap(c => c.edits);
|
|
@@ -57,6 +61,6 @@ Please use a valid chunk index.`;
|
|
|
57
61
|
}
|
|
58
62
|
Logger.debug(`Returning chunk ${chunkIndex} of ${chunks.length} with ${chunk.edits.length} edits`);
|
|
59
63
|
return result;
|
|
60
|
-
}
|
|
64
|
+
},
|
|
61
65
|
};
|
|
62
66
|
//# sourceMappingURL=fetch-chunk.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-chunk.tool.js","sourceRoot":"","sources":["../../src/tools/fetch-chunk.tool.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"fetch-chunk.tool.js","sourceRoot":"","sources":["../../src/tools/fetch-chunk.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2DAA2D,CAAC;IAC1F,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAAC;CAClF,CAAC,CAAC;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,GAAG,CAAC,EAAE,CAAC;YAC1C,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YAC9C,MAAM,GAAG,wBAAwB,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC;QACtE,CAAC;QAED,MAAM,CAAC,KAAK,CACV,mBAAmB,UAAU,OAAO,MAAM,CAAC,MAAM,SAAS,KAAK,CAAC,KAAK,CAAC,MAAM,QAAQ,CACrF,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAsBA,cAAc,eAAe,CAAC"}
|
package/dist/tools/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// Tool Registry Index - Registers all tools
|
|
2
2
|
import { toolRegistry } from './registry.js';
|
|
3
3
|
import { askCodexTool } from './ask-codex.tool.js';
|
|
4
|
-
import {
|
|
4
|
+
import { batchCodexTool } from './batch-codex.tool.js';
|
|
5
|
+
import { reviewCodexTool } from './review-codex.tool.js';
|
|
6
|
+
import { pingTool, helpTool, versionTool } from './simple-tools.js';
|
|
5
7
|
import { brainstormTool } from './brainstorm.tool.js';
|
|
6
8
|
import { fetchChunkTool } from './fetch-chunk.tool.js';
|
|
7
9
|
import { timeoutTestTool } from './timeout-test.tool.js';
|
|
8
|
-
toolRegistry.push(askCodexTool, pingTool, helpTool, brainstormTool, fetchChunkTool, timeoutTestTool);
|
|
10
|
+
toolRegistry.push(askCodexTool, batchCodexTool, reviewCodexTool, pingTool, helpTool, versionTool, brainstormTool, fetchChunkTool, timeoutTestTool);
|
|
9
11
|
export * from './registry.js';
|
|
10
12
|
//# sourceMappingURL=index.js.map
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,YAAY,CAAC,IAAI,CACf,YAAY,EACZ,cAAc,EACd,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,CAChB,CAAC;AAEF,cAAc,eAAe,CAAC"}
|
package/dist/tools/registry.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Tool, Prompt } from
|
|
2
|
-
import { ToolArguments } from
|
|
3
|
-
import { ZodTypeAny } from
|
|
1
|
+
import { Tool, Prompt } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { ToolArguments } from '../constants.js';
|
|
3
|
+
import { ZodTypeAny } from 'zod';
|
|
4
4
|
export interface UnifiedTool {
|
|
5
5
|
name: string;
|
|
6
6
|
description: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAY,MAAM,KAAK,CAAC;AAG3C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,UAAU,CAAC;IAEtB,MAAM,CAAC,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,KAAK,CAAC;YAChB,IAAI,EAAE,MAAM,CAAC;YACb,WAAW,EAAE,MAAM,CAAC;YACpB,QAAQ,EAAE,OAAO,CAAC;SACnB,CAAC,CAAC;KACJ,CAAC;IAEF,OAAO,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5F,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;CAC3C;AAED,eAAO,MAAM,YAAY,EAAE,WAAW,EAAO,CAAC;AAE9C,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,kBAAkB,IAAI,IAAI,EAAE,CAiB3C;AAkBD,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAS/C;AAED,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,aAAa,EACnB,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,GACvC,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAsBpF"}
|
package/dist/tools/registry.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { ZodError } from
|
|
2
|
-
import { zodToJsonSchema } from
|
|
1
|
+
import { ZodError } from 'zod';
|
|
2
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
3
3
|
export const toolRegistry = [];
|
|
4
4
|
export function toolExists(toolName) {
|
|
5
5
|
return toolRegistry.some(t => t.name === toolName);
|
|
6
6
|
}
|
|
7
7
|
export function getToolDefinitions() {
|
|
8
|
+
// get Tool definitions from registry
|
|
8
9
|
return toolRegistry.map(tool => {
|
|
9
10
|
const raw = zodToJsonSchema(tool.zodSchema, tool.name);
|
|
10
11
|
const def = raw.definitions?.[tool.name] ?? raw;
|
|
11
12
|
const inputSchema = {
|
|
12
|
-
type:
|
|
13
|
+
type: 'object',
|
|
13
14
|
properties: def.properties || {},
|
|
14
15
|
required: def.required || [],
|
|
15
16
|
};
|
|
@@ -27,10 +28,11 @@ function extractPromptArguments(zodSchema) {
|
|
|
27
28
|
return Object.entries(properties).map(([name, prop]) => ({
|
|
28
29
|
name,
|
|
29
30
|
description: prop.description || `${name} parameter`,
|
|
30
|
-
required: required.includes(name)
|
|
31
|
+
required: required.includes(name),
|
|
31
32
|
}));
|
|
32
33
|
}
|
|
33
34
|
export function getPromptDefinitions() {
|
|
35
|
+
// Helper to get MCP Prompt definitions from registry
|
|
34
36
|
return toolRegistry
|
|
35
37
|
.filter(tool => tool.prompt)
|
|
36
38
|
.map(tool => ({
|
|
@@ -50,7 +52,9 @@ export async function executeTool(toolName, args, onProgress) {
|
|
|
50
52
|
}
|
|
51
53
|
catch (error) {
|
|
52
54
|
if (error instanceof ZodError) {
|
|
53
|
-
const issues = error.issues
|
|
55
|
+
const issues = error.issues
|
|
56
|
+
.map(issue => `${issue.path.join('.')}: ${issue.message}`)
|
|
57
|
+
.join(', ');
|
|
54
58
|
throw new Error(`Invalid arguments for ${toolName}: ${issues}`);
|
|
55
59
|
}
|
|
56
60
|
throw error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAoBrD,MAAM,CAAC,MAAM,YAAY,GAAkB,EAAE,CAAC;AAE9C,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,qCAAqC;IACrC,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAC7B,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAQ,CAAC;QAC9D,MAAM,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;QAChD,MAAM,WAAW,GAAwB;YACvC,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,GAAG,CAAC,UAAU,IAAI,EAAE;YAChC,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE;SAC7B,CAAC;QAEF,OAAO;YACL,IAAI,EAAE,IAA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AAK,QAAQ,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;YACjF,IAAI,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,EAAE,CAAC;gBACxC,YAAY,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;YAChC,CAAC;iBAAM,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;gBACtC,YAAY,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,KAAK,GAAG,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,QAAQ,QAAQ,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-codex.tool.d.ts","sourceRoot":"","sources":["../../src/tools/review-codex.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAkB5C,eAAO,MAAM,eAAe,EAAE,WAwF7B,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { executeCommandDetailed } from '../utils/commandExecutor.js';
|
|
3
|
+
import { parseReviewOutput, formatReviewFindings } from '../utils/reviewParser.js';
|
|
4
|
+
import { MODELS } from '../constants.js';
|
|
5
|
+
import { Logger } from '../utils/logger.js';
|
|
6
|
+
const reviewCodexArgsSchema = z.object({
|
|
7
|
+
prompt: z
|
|
8
|
+
.string()
|
|
9
|
+
.default('/review')
|
|
10
|
+
.describe('Review command or additional context. Default: /review'),
|
|
11
|
+
model: z
|
|
12
|
+
.string()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe(`Model: ${Object.values(MODELS).join(', ')}. Default: uses Codex's default`),
|
|
15
|
+
timeout: z.number().optional().describe('Maximum execution time in milliseconds'),
|
|
16
|
+
});
|
|
17
|
+
export const reviewCodexTool = {
|
|
18
|
+
name: 'review-changes',
|
|
19
|
+
description: "Run Codex's native /review command to analyze current git changes",
|
|
20
|
+
zodSchema: reviewCodexArgsSchema,
|
|
21
|
+
prompt: {
|
|
22
|
+
description: "Execute Codex's built-in code review on current changes",
|
|
23
|
+
},
|
|
24
|
+
category: 'codex',
|
|
25
|
+
execute: async (args, onProgress) => {
|
|
26
|
+
const { prompt, model, timeout } = args;
|
|
27
|
+
try {
|
|
28
|
+
// Step 1: Prepare the review command
|
|
29
|
+
if (onProgress) {
|
|
30
|
+
onProgress('🔍 Launching Codex native review...');
|
|
31
|
+
}
|
|
32
|
+
// Build command arguments for Codex CLI
|
|
33
|
+
const codexArgs = ['exec'];
|
|
34
|
+
// Add model if specified
|
|
35
|
+
if (model) {
|
|
36
|
+
codexArgs.push('-m', model);
|
|
37
|
+
}
|
|
38
|
+
// The review command - either /review or custom prompt
|
|
39
|
+
const reviewPrompt = prompt?.startsWith('/') ? prompt : `/review ${prompt || ''}`.trim();
|
|
40
|
+
codexArgs.push(reviewPrompt);
|
|
41
|
+
if (onProgress) {
|
|
42
|
+
onProgress(`Executing: codex ${codexArgs.join(' ')}`);
|
|
43
|
+
}
|
|
44
|
+
// Step 2: Execute Codex with the review command
|
|
45
|
+
const result = await executeCommandDetailed('codex', codexArgs, {
|
|
46
|
+
timeoutMs: timeout || 180000, // 3 minutes default for review
|
|
47
|
+
});
|
|
48
|
+
if (!result.ok) {
|
|
49
|
+
throw new Error(result.stderr || 'Codex review command failed');
|
|
50
|
+
}
|
|
51
|
+
const response = result.stdout;
|
|
52
|
+
// Step 3: Parse and format the review output
|
|
53
|
+
if (onProgress) {
|
|
54
|
+
onProgress('📝 Processing review results...');
|
|
55
|
+
}
|
|
56
|
+
// Try to parse structured output
|
|
57
|
+
const reviewOutput = parseReviewOutput(response);
|
|
58
|
+
if (reviewOutput) {
|
|
59
|
+
// Format the structured review
|
|
60
|
+
const formattedReview = formatReviewFindings(reviewOutput);
|
|
61
|
+
// Add summary statistics
|
|
62
|
+
const stats = [
|
|
63
|
+
`📊 **Review Statistics:**`,
|
|
64
|
+
`- Issues found: ${reviewOutput.findings.length}`,
|
|
65
|
+
`- High priority issues: ${reviewOutput.findings.filter(f => f.priority === 0 || f.priority === 1).length}`,
|
|
66
|
+
];
|
|
67
|
+
return `${formattedReview}\n\n${stats.join('\n')}`;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// Return Codex's raw output if not in JSON format
|
|
71
|
+
// Codex might return formatted text directly
|
|
72
|
+
return `## Codex Review Results\n\n${response}`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
77
|
+
Logger.error('Review failed:', error);
|
|
78
|
+
if (errorMessage.includes('command not found')) {
|
|
79
|
+
return '❌ **Error**: Codex CLI not found. Install with: npm install -g @openai/codex';
|
|
80
|
+
}
|
|
81
|
+
if (errorMessage.includes('authentication') || errorMessage.includes('unauthorized')) {
|
|
82
|
+
return '❌ **Authentication Failed**: Run "codex login" first';
|
|
83
|
+
}
|
|
84
|
+
if (errorMessage.includes('slash command')) {
|
|
85
|
+
return "❌ **Error**: Review command not available. Make sure you're using the latest Codex version.";
|
|
86
|
+
}
|
|
87
|
+
return `❌ **Review Failed**: ${errorMessage}\n\nTip: Try running "codex exec /review" directly to test.`;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=review-codex.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-codex.tool.js","sourceRoot":"","sources":["../../src/tools/review-codex.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAA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AE;iBAC5G,CAAC;gBAEF,OAAO,GAAG,eAAe,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACrD,CAAC;iBAAM,CAAC;gBACN,kDAAkD;gBAClD,6CAA6C;gBAC7C,OAAO,8BAA8B,QAAQ,EAAE,CAAC;YAClD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5E,MAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;YAEtC,IAAI,YAAY,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;gBAC/C,OAAO,8EAA8E,CAAC;YACxF,CAAC;YAED,IAAI,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBACrF,OAAO,sDAAsD,CAAC;YAChE,CAAC;YAED,IAAI,YAAY,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;gBAC3C,OAAO,6FAA6F,CAAC;YACvG,CAAC;YAED,OAAO,wBAAwB,YAAY,6DAA6D,CAAC;QAC3G,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-tools.d.ts","sourceRoot":"","sources":["../../src/tools/simple-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAO5C,eAAO,MAAM,QAAQ,EAAE,WAatB,CAAC;AAIF,eAAO,MAAM,QAAQ,EAAE,WAWtB,CAAC"}
|
|
1
|
+
{"version":3,"file":"simple-tools.d.ts","sourceRoot":"","sources":["../../src/tools/simple-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAO5C,eAAO,MAAM,QAAQ,EAAE,WAatB,CAAC;AAIF,eAAO,MAAM,QAAQ,EAAE,WAWtB,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,WA6BzB,CAAC"}
|
|
@@ -1,33 +1,64 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { executeCommand } from '../utils/commandExecutor.js';
|
|
3
3
|
const pingArgsSchema = z.object({
|
|
4
|
-
prompt: z.string().default('').describe(
|
|
4
|
+
prompt: z.string().default('').describe('Message to echo '),
|
|
5
5
|
});
|
|
6
6
|
export const pingTool = {
|
|
7
|
-
name:
|
|
8
|
-
description:
|
|
7
|
+
name: 'ping',
|
|
8
|
+
description: 'Echo',
|
|
9
9
|
zodSchema: pingArgsSchema,
|
|
10
10
|
prompt: {
|
|
11
|
-
description:
|
|
11
|
+
description: 'Echo test message with structured response.',
|
|
12
12
|
},
|
|
13
13
|
category: 'simple',
|
|
14
14
|
execute: async (args, onProgress) => {
|
|
15
|
-
const message = args.prompt || args.message ||
|
|
15
|
+
const message = args.prompt || args.message || 'Pong!';
|
|
16
16
|
// Return message directly to avoid cross-platform issues with echo command
|
|
17
17
|
return message;
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
19
|
};
|
|
20
20
|
const helpArgsSchema = z.object({});
|
|
21
21
|
export const helpTool = {
|
|
22
|
-
name:
|
|
23
|
-
description:
|
|
22
|
+
name: 'Help',
|
|
23
|
+
description: 'receive help information',
|
|
24
24
|
zodSchema: helpArgsSchema,
|
|
25
25
|
prompt: {
|
|
26
|
-
description:
|
|
26
|
+
description: 'receive help information',
|
|
27
|
+
},
|
|
28
|
+
category: 'simple',
|
|
29
|
+
execute: async (args, onProgress) => {
|
|
30
|
+
return executeCommand('codex', ['--help'], onProgress);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
const versionArgsSchema = z.object({});
|
|
34
|
+
export const versionTool = {
|
|
35
|
+
name: 'version',
|
|
36
|
+
description: 'Display version and system information',
|
|
37
|
+
zodSchema: versionArgsSchema,
|
|
38
|
+
prompt: {
|
|
39
|
+
description: 'Get version information for Codex CLI and MCP server',
|
|
27
40
|
},
|
|
28
41
|
category: 'simple',
|
|
29
42
|
execute: async (args, onProgress) => {
|
|
30
|
-
|
|
31
|
-
|
|
43
|
+
try {
|
|
44
|
+
const codexVersion = await executeCommand('codex', ['--version'], onProgress);
|
|
45
|
+
const nodeVersion = process.version;
|
|
46
|
+
const platform = process.platform;
|
|
47
|
+
return `**System Information:**
|
|
48
|
+
- Codex CLI: ${codexVersion.trim()}
|
|
49
|
+
- Node.js: ${nodeVersion}
|
|
50
|
+
- Platform: ${platform}
|
|
51
|
+
- MCP Server: @trishchuk/codex-mcp-tool v1.0.6`;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
return `**System Information:**
|
|
55
|
+
- Codex CLI: Not installed or not accessible
|
|
56
|
+
- Node.js: ${process.version}
|
|
57
|
+
- Platform: ${process.platform}
|
|
58
|
+
- MCP Server: @trishchuk/codex-mcp-tool v1.0.6
|
|
59
|
+
|
|
60
|
+
*Note: Install Codex CLI with: npm install -g @openai/codex*`;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
32
63
|
};
|
|
33
64
|
//# sourceMappingURL=simple-tools.js.map
|