@joseph0926/plan-loop 1.0.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.ko.md +245 -0
- package/README.md +124 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +96 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +237 -0
- package/dist/index.js.map +1 -0
- package/dist/setup/claude.d.ts +17 -0
- package/dist/setup/claude.d.ts.map +1 -0
- package/dist/setup/claude.js +114 -0
- package/dist/setup/claude.js.map +1 -0
- package/dist/setup/codex.d.ts +14 -0
- package/dist/setup/codex.d.ts.map +1 -0
- package/dist/setup/codex.js +62 -0
- package/dist/setup/codex.js.map +1 -0
- package/dist/state.d.ts +49 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +154 -0
- package/dist/state.js.map +1 -0
- package/dist/tools.d.ts +91 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +284 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +99 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +53 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Plan Loop MCP Server
|
|
4
|
+
* Claude-Code와 Codex 간의 비동기 협업을 위한 MCP 서버
|
|
5
|
+
*/
|
|
6
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
7
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
8
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
9
|
+
import * as tools from './tools.js';
|
|
10
|
+
// Create server instance
|
|
11
|
+
const server = new Server({
|
|
12
|
+
name: 'plan-loop-mcp',
|
|
13
|
+
version: '1.0.0',
|
|
14
|
+
}, {
|
|
15
|
+
capabilities: {
|
|
16
|
+
tools: {},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
// Tool definitions
|
|
20
|
+
const TOOL_DEFINITIONS = [
|
|
21
|
+
{
|
|
22
|
+
name: 'pl_start',
|
|
23
|
+
description: 'Start a new plan loop session',
|
|
24
|
+
inputSchema: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
goal: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: 'The goal of this planning session',
|
|
30
|
+
},
|
|
31
|
+
maxIterations: {
|
|
32
|
+
type: 'number',
|
|
33
|
+
description: 'Maximum feedback iterations (default: 5)',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
required: ['goal'],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'pl_submit',
|
|
41
|
+
description: 'Submit a plan for review. Allowed states: drafting, pending_revision',
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: 'object',
|
|
44
|
+
properties: {
|
|
45
|
+
session_id: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
description: 'Session ID',
|
|
48
|
+
},
|
|
49
|
+
plan: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
description: 'The plan content',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
required: ['session_id', 'plan'],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'pl_get_plan',
|
|
59
|
+
description: 'Get the latest plan from a session',
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: 'object',
|
|
62
|
+
properties: {
|
|
63
|
+
session_id: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
description: 'Session ID',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
required: ['session_id'],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'pl_feedback',
|
|
73
|
+
description: 'Submit feedback for the latest plan. Allowed states: pending_review',
|
|
74
|
+
inputSchema: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties: {
|
|
77
|
+
session_id: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
description: 'Session ID',
|
|
80
|
+
},
|
|
81
|
+
rating: {
|
|
82
|
+
type: 'string',
|
|
83
|
+
enum: ['🔴', '🟡', '🟢'],
|
|
84
|
+
description: 'Feedback rating: 🔴 (major revision), 🟡 (minor revision), 🟢 (approved)',
|
|
85
|
+
},
|
|
86
|
+
content: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
description: 'Feedback content',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
required: ['session_id', 'rating', 'content'],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'pl_get_feedback',
|
|
96
|
+
description: 'Get the latest feedback for a session',
|
|
97
|
+
inputSchema: {
|
|
98
|
+
type: 'object',
|
|
99
|
+
properties: {
|
|
100
|
+
session_id: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
description: 'Session ID',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
required: ['session_id'],
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'pl_status',
|
|
110
|
+
description: 'Get the full status of a session',
|
|
111
|
+
inputSchema: {
|
|
112
|
+
type: 'object',
|
|
113
|
+
properties: {
|
|
114
|
+
session_id: {
|
|
115
|
+
type: 'string',
|
|
116
|
+
description: 'Session ID',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
required: ['session_id'],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'pl_list',
|
|
124
|
+
description: 'List all plan loop sessions. Supports filtering by status and sorting.',
|
|
125
|
+
inputSchema: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
properties: {
|
|
128
|
+
status: {
|
|
129
|
+
oneOf: [
|
|
130
|
+
{ type: 'string', enum: ['drafting', 'pending_review', 'pending_revision', 'approved', 'exhausted'] },
|
|
131
|
+
{ type: 'array', items: { type: 'string', enum: ['drafting', 'pending_review', 'pending_revision', 'approved', 'exhausted'] } },
|
|
132
|
+
],
|
|
133
|
+
description: 'Filter by status (single value or array)',
|
|
134
|
+
},
|
|
135
|
+
sort: {
|
|
136
|
+
type: 'string',
|
|
137
|
+
enum: ['createdAt', 'updatedAt'],
|
|
138
|
+
description: 'Sort field (default: updatedAt)',
|
|
139
|
+
},
|
|
140
|
+
order: {
|
|
141
|
+
type: 'string',
|
|
142
|
+
enum: ['asc', 'desc'],
|
|
143
|
+
description: 'Sort order (default: desc)',
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: 'pl_force_approve',
|
|
150
|
+
description: 'Force approve an exhausted session. Allowed states: exhausted',
|
|
151
|
+
inputSchema: {
|
|
152
|
+
type: 'object',
|
|
153
|
+
properties: {
|
|
154
|
+
session_id: {
|
|
155
|
+
type: 'string',
|
|
156
|
+
description: 'Session ID',
|
|
157
|
+
},
|
|
158
|
+
reason: {
|
|
159
|
+
type: 'string',
|
|
160
|
+
description: 'Reason for force approval',
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
required: ['session_id', 'reason'],
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: 'pl_delete',
|
|
168
|
+
description: 'Delete a session. By default only approved/exhausted sessions can be deleted. Use force=true to delete active sessions.',
|
|
169
|
+
inputSchema: {
|
|
170
|
+
type: 'object',
|
|
171
|
+
properties: {
|
|
172
|
+
session_id: {
|
|
173
|
+
type: 'string',
|
|
174
|
+
description: 'Session ID',
|
|
175
|
+
},
|
|
176
|
+
force: {
|
|
177
|
+
type: 'boolean',
|
|
178
|
+
description: 'Force delete even if session is active (default: false)',
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
required: ['session_id'],
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
// Handle list tools request
|
|
186
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
187
|
+
return {
|
|
188
|
+
tools: TOOL_DEFINITIONS,
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
// Handle tool calls
|
|
192
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
193
|
+
const { name, arguments: args } = request.params;
|
|
194
|
+
console.error(`[plan-loop] Tool called: ${name}`);
|
|
195
|
+
// 전역 입력 가드: 객체가 아니면 빈 객체로 대체
|
|
196
|
+
// 비객체 인자는 각 도구 함수 내 검증에서 "필수 필드 누락" 에러로 처리됨
|
|
197
|
+
const input = typeof args === 'object' && args !== null && !Array.isArray(args)
|
|
198
|
+
? args
|
|
199
|
+
: {};
|
|
200
|
+
switch (name) {
|
|
201
|
+
case 'pl_start':
|
|
202
|
+
return tools.plStart(input);
|
|
203
|
+
case 'pl_submit':
|
|
204
|
+
return tools.plSubmit(input);
|
|
205
|
+
case 'pl_get_plan':
|
|
206
|
+
return tools.plGetPlan(input);
|
|
207
|
+
case 'pl_feedback':
|
|
208
|
+
return tools.plFeedback(input);
|
|
209
|
+
case 'pl_get_feedback':
|
|
210
|
+
return tools.plGetFeedback(input);
|
|
211
|
+
case 'pl_status':
|
|
212
|
+
return tools.plStatus(input);
|
|
213
|
+
case 'pl_list':
|
|
214
|
+
return tools.plList(input);
|
|
215
|
+
case 'pl_force_approve':
|
|
216
|
+
return tools.plForceApprove(input);
|
|
217
|
+
case 'pl_delete':
|
|
218
|
+
return tools.plDelete(input);
|
|
219
|
+
default:
|
|
220
|
+
return {
|
|
221
|
+
isError: true,
|
|
222
|
+
content: [{ type: 'text', text: `Unknown tool: ${name}` }],
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
// Start server
|
|
227
|
+
async function main() {
|
|
228
|
+
console.error('[plan-loop] Starting MCP server...');
|
|
229
|
+
const transport = new StdioServerTransport();
|
|
230
|
+
await server.connect(transport);
|
|
231
|
+
console.error('[plan-loop] MCP server connected');
|
|
232
|
+
}
|
|
233
|
+
main().catch((err) => {
|
|
234
|
+
console.error('[plan-loop] Fatal error:', err);
|
|
235
|
+
process.exit(1);
|
|
236
|
+
});
|
|
237
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAEpC,yBAAyB;AACzB,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;IACE,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,OAAO;CACjB,EACD;IACE,YAAY,EAAE;QACZ,KAAK,EAAE,EAAE;KACV;CACF,CACF,CAAC;AAEF,mBAAmB;AACnB,MAAM,gBAAgB,GAAG;IACvB;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,+BAA+B;QAC5C,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,mCAAmC;iBACjD;gBACD,aAAa,EAAE;oBACb,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,0CAA0C;iBACxD;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF;IACD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,sEAAsE;QACnF,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,UA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
+
export interface SetupOptions {
|
|
6
|
+
scope: 'project' | 'user';
|
|
7
|
+
}
|
|
8
|
+
export interface SetupResult {
|
|
9
|
+
success: boolean;
|
|
10
|
+
message: string;
|
|
11
|
+
filePath?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Setup Claude Code MCP configuration
|
|
15
|
+
*/
|
|
16
|
+
export declare function setupClaude(options: SetupOptions): Promise<SetupResult>;
|
|
17
|
+
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/setup/claude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAOD;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAa7E"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code MCP Setup
|
|
3
|
+
* Configures .mcp.json (project) or ~/.claude.json (user)
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
import * as os from 'os';
|
|
8
|
+
const MCP_CONFIG = {
|
|
9
|
+
command: 'npx',
|
|
10
|
+
args: ['-y', '@joseph0926/plan-loop'],
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Setup Claude Code MCP configuration
|
|
14
|
+
*/
|
|
15
|
+
export async function setupClaude(options) {
|
|
16
|
+
const { scope } = options;
|
|
17
|
+
try {
|
|
18
|
+
if (scope === 'project') {
|
|
19
|
+
return await setupProjectScope();
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return await setupUserScope();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
27
|
+
return { success: false, message: `Failed to setup Claude: ${message}` };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Setup project-scoped .mcp.json in current directory
|
|
32
|
+
*/
|
|
33
|
+
async function setupProjectScope() {
|
|
34
|
+
const filePath = path.join(process.cwd(), '.mcp.json');
|
|
35
|
+
let config = {};
|
|
36
|
+
// Read existing config if exists
|
|
37
|
+
if (fs.existsSync(filePath)) {
|
|
38
|
+
try {
|
|
39
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
40
|
+
config = JSON.parse(content);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// Invalid JSON, start fresh
|
|
44
|
+
config = {};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Ensure mcpServers object exists
|
|
48
|
+
if (!config.mcpServers || typeof config.mcpServers !== 'object') {
|
|
49
|
+
config.mcpServers = {};
|
|
50
|
+
}
|
|
51
|
+
const mcpServers = config.mcpServers;
|
|
52
|
+
// Check if plan-loop already exists
|
|
53
|
+
if (mcpServers['plan-loop']) {
|
|
54
|
+
// Update existing configuration
|
|
55
|
+
mcpServers['plan-loop'] = MCP_CONFIG;
|
|
56
|
+
fs.writeFileSync(filePath, JSON.stringify(config, null, 2) + '\n');
|
|
57
|
+
return {
|
|
58
|
+
success: true,
|
|
59
|
+
message: `Updated plan-loop in ${filePath}`,
|
|
60
|
+
filePath,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
// Add new configuration
|
|
64
|
+
mcpServers['plan-loop'] = MCP_CONFIG;
|
|
65
|
+
fs.writeFileSync(filePath, JSON.stringify(config, null, 2) + '\n');
|
|
66
|
+
return {
|
|
67
|
+
success: true,
|
|
68
|
+
message: `Added plan-loop to ${filePath}`,
|
|
69
|
+
filePath,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Setup user-scoped ~/.claude.json
|
|
74
|
+
*/
|
|
75
|
+
async function setupUserScope() {
|
|
76
|
+
const filePath = path.join(os.homedir(), '.claude.json');
|
|
77
|
+
let config = {};
|
|
78
|
+
// Read existing config if exists
|
|
79
|
+
if (fs.existsSync(filePath)) {
|
|
80
|
+
try {
|
|
81
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
82
|
+
config = JSON.parse(content);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// Invalid JSON, start fresh but warn
|
|
86
|
+
console.log(' ⚠️ Warning: Existing ~/.claude.json was invalid, creating new file');
|
|
87
|
+
config = {};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Ensure mcpServers object exists
|
|
91
|
+
if (!config.mcpServers || typeof config.mcpServers !== 'object') {
|
|
92
|
+
config.mcpServers = {};
|
|
93
|
+
}
|
|
94
|
+
const mcpServers = config.mcpServers;
|
|
95
|
+
// Check if plan-loop already exists
|
|
96
|
+
if (mcpServers['plan-loop']) {
|
|
97
|
+
mcpServers['plan-loop'] = MCP_CONFIG;
|
|
98
|
+
fs.writeFileSync(filePath, JSON.stringify(config, null, 2) + '\n');
|
|
99
|
+
return {
|
|
100
|
+
success: true,
|
|
101
|
+
message: `Updated plan-loop in ${filePath}`,
|
|
102
|
+
filePath,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
// Add new configuration
|
|
106
|
+
mcpServers['plan-loop'] = MCP_CONFIG;
|
|
107
|
+
fs.writeFileSync(filePath, JSON.stringify(config, null, 2) + '\n');
|
|
108
|
+
return {
|
|
109
|
+
success: true,
|
|
110
|
+
message: `Added plan-loop to ${filePath}`,
|
|
111
|
+
filePath,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=claude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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|
|
2
|
+
* Codex MCP Setup
|
|
3
|
+
* Configures ~/.codex/config.toml
|
|
4
|
+
*/
|
|
5
|
+
export interface SetupResult {
|
|
6
|
+
success: boolean;
|
|
7
|
+
message: string;
|
|
8
|
+
filePath?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Setup Codex MCP configuration in ~/.codex/config.toml
|
|
12
|
+
*/
|
|
13
|
+
export declare function setupCodex(): Promise<SetupResult>;
|
|
14
|
+
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/setup/codex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAOD;;GAEG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC,CAmDvD"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex MCP Setup
|
|
3
|
+
* Configures ~/.codex/config.toml
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
import * as os from 'os';
|
|
8
|
+
import TOML from '@iarna/toml';
|
|
9
|
+
const MCP_CONFIG = {
|
|
10
|
+
command: 'npx',
|
|
11
|
+
args: ['-y', '@joseph0926/plan-loop'],
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Setup Codex MCP configuration in ~/.codex/config.toml
|
|
15
|
+
*/
|
|
16
|
+
export async function setupCodex() {
|
|
17
|
+
try {
|
|
18
|
+
const codexDir = path.join(os.homedir(), '.codex');
|
|
19
|
+
const filePath = path.join(codexDir, 'config.toml');
|
|
20
|
+
// Ensure ~/.codex directory exists
|
|
21
|
+
if (!fs.existsSync(codexDir)) {
|
|
22
|
+
fs.mkdirSync(codexDir, { recursive: true });
|
|
23
|
+
}
|
|
24
|
+
let config = {};
|
|
25
|
+
// Read existing config if exists
|
|
26
|
+
if (fs.existsSync(filePath)) {
|
|
27
|
+
try {
|
|
28
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
29
|
+
config = TOML.parse(content);
|
|
30
|
+
console.log(' ⚠️ Note: TOML comments may be lost during update');
|
|
31
|
+
}
|
|
32
|
+
catch (parseError) {
|
|
33
|
+
// Invalid TOML, start fresh but warn
|
|
34
|
+
console.log(' ⚠️ Warning: Existing config.toml was invalid, creating new file');
|
|
35
|
+
config = {};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Ensure mcp_servers object exists
|
|
39
|
+
if (!config.mcp_servers || typeof config.mcp_servers !== 'object') {
|
|
40
|
+
config.mcp_servers = {};
|
|
41
|
+
}
|
|
42
|
+
const mcpServers = config.mcp_servers;
|
|
43
|
+
// Check if plan-loop already exists
|
|
44
|
+
const existed = !!mcpServers['plan-loop'];
|
|
45
|
+
mcpServers['plan-loop'] = MCP_CONFIG;
|
|
46
|
+
// Write back to file
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
+
const tomlContent = TOML.stringify(config);
|
|
49
|
+
fs.writeFileSync(filePath, tomlContent);
|
|
50
|
+
const action = existed ? 'Updated' : 'Added';
|
|
51
|
+
return {
|
|
52
|
+
success: true,
|
|
53
|
+
message: `${action} plan-loop in ${filePath}`,
|
|
54
|
+
filePath,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
59
|
+
return { success: false, message: `Failed to setup Codex: ${message}` };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=codex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/setup/codex.ts"],"names":[],"mappings":"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CAAC,MAAM,CAAC,WAAW,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;YAClE,MAAM,CAAC,WAAW,GAAG,EAAE,CAAC;QAC1B,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,CAAC,WAAsC,CAAC;QAEjE,oCAAoC;QACpC,MAAM,OAAO,GAAG,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC1C,UAAU,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC;QAErC,qBAAqB;QACrB,8DAA8D;QAC9D,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,MAAa,CAAC,CAAC;QAClD,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAExC,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;QAC7C,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,GAAG,MAAM,iBAAiB,QAAQ,EAAE;YAC7C,QAAQ;SACT,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,0BAA0B,OAAO,EAAE,EAAE,CAAC;IAC1E,CAAC;AACH,CAAC"}
|
package/dist/state.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan Loop MCP - State Management
|
|
3
|
+
* Atomic write (temp → rename) for safe concurrent access
|
|
4
|
+
*/
|
|
5
|
+
import type { Session, SessionStatus } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Save session with atomic write
|
|
8
|
+
*/
|
|
9
|
+
export declare function save(session: Session): void;
|
|
10
|
+
/**
|
|
11
|
+
* Load session by ID
|
|
12
|
+
* Returns null if not found or corrupted
|
|
13
|
+
*/
|
|
14
|
+
export declare function load(id: string): Session | null;
|
|
15
|
+
export interface ListOptions {
|
|
16
|
+
status?: SessionStatus | SessionStatus[];
|
|
17
|
+
sort?: 'createdAt' | 'updatedAt';
|
|
18
|
+
order?: 'asc' | 'desc';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* List all sessions (summary only)
|
|
22
|
+
* goal is truncated to 30 characters (UTF-16 units) + "..." if exceeded
|
|
23
|
+
* Supports filtering by status and sorting
|
|
24
|
+
*/
|
|
25
|
+
export declare function list(options?: ListOptions): {
|
|
26
|
+
id: string;
|
|
27
|
+
goal: string;
|
|
28
|
+
status: SessionStatus;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
updatedAt: string;
|
|
31
|
+
}[];
|
|
32
|
+
/**
|
|
33
|
+
* Create a new session
|
|
34
|
+
*/
|
|
35
|
+
export declare function create(goal: string, maxIterations?: number): Session;
|
|
36
|
+
/**
|
|
37
|
+
* Get latest plan from session
|
|
38
|
+
*/
|
|
39
|
+
export declare function getLatestPlan(session: Session): import("./types.js").Plan | null;
|
|
40
|
+
/**
|
|
41
|
+
* Get latest feedback from session
|
|
42
|
+
*/
|
|
43
|
+
export declare function getLatestFeedback(session: Session): import("./types.js").Feedback | null;
|
|
44
|
+
/**
|
|
45
|
+
* Delete session by ID
|
|
46
|
+
* Returns true if deleted, false if not found
|
|
47
|
+
*/
|
|
48
|
+
export declare function remove(id: string): boolean;
|
|
49
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAezD;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAS3C;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAa/C;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,aAAa,GAAG,aAAa,EAAE,CAAC;IACzC,IAAI,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC;IACjC,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,aAAa,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EAAE,CAkD3I;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,SAAI,GAAG,OAAO,CAkB/D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,oCAK7C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,wCAKjD;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAc1C"}
|