@sudosandwich/limps 0.2.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/LICENSE +21 -0
- package/README.md +190 -0
- package/dist/agent-parser.d.ts +146 -0
- package/dist/agent-parser.d.ts.map +1 -0
- package/dist/agent-parser.js +448 -0
- package/dist/agent-parser.js.map +1 -0
- package/dist/config.d.ts +54 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +146 -0
- package/dist/config.js.map +1 -0
- package/dist/coordination.d.ts +102 -0
- package/dist/coordination.d.ts.map +1 -0
- package/dist/coordination.js +157 -0
- package/dist/coordination.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +256 -0
- package/dist/index.js.map +1 -0
- package/dist/indexer.d.ts +83 -0
- package/dist/indexer.d.ts.map +1 -0
- package/dist/indexer.js +467 -0
- package/dist/indexer.js.map +1 -0
- package/dist/resources/agents-status.d.ts +32 -0
- package/dist/resources/agents-status.d.ts.map +1 -0
- package/dist/resources/agents-status.js +73 -0
- package/dist/resources/agents-status.js.map +1 -0
- package/dist/resources/decisions-log.d.ts +21 -0
- package/dist/resources/decisions-log.d.ts.map +1 -0
- package/dist/resources/decisions-log.js +146 -0
- package/dist/resources/decisions-log.js.map +1 -0
- package/dist/resources/index.d.ts +10 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +74 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/plans-full.d.ts +11 -0
- package/dist/resources/plans-full.d.ts.map +1 -0
- package/dist/resources/plans-full.js +71 -0
- package/dist/resources/plans-full.js.map +1 -0
- package/dist/resources/plans-index.d.ts +30 -0
- package/dist/resources/plans-index.d.ts.map +1 -0
- package/dist/resources/plans-index.js +177 -0
- package/dist/resources/plans-index.js.map +1 -0
- package/dist/resources/plans-summary.d.ts +33 -0
- package/dist/resources/plans-summary.d.ts.map +1 -0
- package/dist/resources/plans-summary.js +238 -0
- package/dist/resources/plans-summary.js.map +1 -0
- package/dist/rlm/extractors.d.ts +39 -0
- package/dist/rlm/extractors.d.ts.map +1 -0
- package/dist/rlm/extractors.js +291 -0
- package/dist/rlm/extractors.js.map +1 -0
- package/dist/rlm/helpers-inject.d.ts +13 -0
- package/dist/rlm/helpers-inject.d.ts.map +1 -0
- package/dist/rlm/helpers-inject.js +586 -0
- package/dist/rlm/helpers-inject.js.map +1 -0
- package/dist/rlm/helpers.d.ts +124 -0
- package/dist/rlm/helpers.d.ts.map +1 -0
- package/dist/rlm/helpers.js +381 -0
- package/dist/rlm/helpers.js.map +1 -0
- package/dist/rlm/index.d.ts +12 -0
- package/dist/rlm/index.d.ts.map +1 -0
- package/dist/rlm/index.js +19 -0
- package/dist/rlm/index.js.map +1 -0
- package/dist/rlm/parallel.d.ts +45 -0
- package/dist/rlm/parallel.d.ts.map +1 -0
- package/dist/rlm/parallel.js +76 -0
- package/dist/rlm/parallel.js.map +1 -0
- package/dist/rlm/recursion.d.ts +96 -0
- package/dist/rlm/recursion.d.ts.map +1 -0
- package/dist/rlm/recursion.js +113 -0
- package/dist/rlm/recursion.js.map +1 -0
- package/dist/rlm/sampling.d.ts +100 -0
- package/dist/rlm/sampling.d.ts.map +1 -0
- package/dist/rlm/sampling.js +96 -0
- package/dist/rlm/sampling.js.map +1 -0
- package/dist/rlm/sandbox.d.ts +73 -0
- package/dist/rlm/sandbox.d.ts.map +1 -0
- package/dist/rlm/sandbox.js +160 -0
- package/dist/rlm/sandbox.js.map +1 -0
- package/dist/rlm/security.d.ts +28 -0
- package/dist/rlm/security.d.ts.map +1 -0
- package/dist/rlm/security.js +154 -0
- package/dist/rlm/security.js.map +1 -0
- package/dist/server.d.ts +21 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +107 -0
- package/dist/server.js.map +1 -0
- package/dist/task-parser.d.ts +47 -0
- package/dist/task-parser.d.ts.map +1 -0
- package/dist/task-parser.js +112 -0
- package/dist/task-parser.js.map +1 -0
- package/dist/test-setup.d.ts +6 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/test-setup.js +37 -0
- package/dist/test-setup.js.map +1 -0
- package/dist/tools/claim-task.d.ts +28 -0
- package/dist/tools/claim-task.d.ts.map +1 -0
- package/dist/tools/claim-task.js +288 -0
- package/dist/tools/claim-task.js.map +1 -0
- package/dist/tools/create-doc.d.ts +47 -0
- package/dist/tools/create-doc.d.ts.map +1 -0
- package/dist/tools/create-doc.js +137 -0
- package/dist/tools/create-doc.js.map +1 -0
- package/dist/tools/create-plan.d.ts +25 -0
- package/dist/tools/create-plan.d.ts.map +1 -0
- package/dist/tools/create-plan.js +179 -0
- package/dist/tools/create-plan.js.map +1 -0
- package/dist/tools/delete-doc.d.ts +51 -0
- package/dist/tools/delete-doc.d.ts.map +1 -0
- package/dist/tools/delete-doc.js +194 -0
- package/dist/tools/delete-doc.js.map +1 -0
- package/dist/tools/get-next-task.d.ts +49 -0
- package/dist/tools/get-next-task.d.ts.map +1 -0
- package/dist/tools/get-next-task.js +204 -0
- package/dist/tools/get-next-task.js.map +1 -0
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +122 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-docs.d.ts +53 -0
- package/dist/tools/list-docs.d.ts.map +1 -0
- package/dist/tools/list-docs.js +236 -0
- package/dist/tools/list-docs.js.map +1 -0
- package/dist/tools/open-document-in-cursor.d.ts +62 -0
- package/dist/tools/open-document-in-cursor.d.ts.map +1 -0
- package/dist/tools/open-document-in-cursor.js +211 -0
- package/dist/tools/open-document-in-cursor.js.map +1 -0
- package/dist/tools/read-doc.d.ts +44 -0
- package/dist/tools/read-doc.d.ts.map +1 -0
- package/dist/tools/read-doc.js +174 -0
- package/dist/tools/read-doc.js.map +1 -0
- package/dist/tools/release-task.d.ts +28 -0
- package/dist/tools/release-task.d.ts.map +1 -0
- package/dist/tools/release-task.js +154 -0
- package/dist/tools/release-task.js.map +1 -0
- package/dist/tools/rlm-multi-query.d.ts +110 -0
- package/dist/tools/rlm-multi-query.d.ts.map +1 -0
- package/dist/tools/rlm-multi-query.js +348 -0
- package/dist/tools/rlm-multi-query.js.map +1 -0
- package/dist/tools/rlm-query.d.ts +56 -0
- package/dist/tools/rlm-query.d.ts.map +1 -0
- package/dist/tools/rlm-query.js +228 -0
- package/dist/tools/rlm-query.js.map +1 -0
- package/dist/tools/search-docs.d.ts +34 -0
- package/dist/tools/search-docs.d.ts.map +1 -0
- package/dist/tools/search-docs.js +292 -0
- package/dist/tools/search-docs.js.map +1 -0
- package/dist/tools/update-doc.d.ts +149 -0
- package/dist/tools/update-doc.d.ts.map +1 -0
- package/dist/tools/update-doc.js +195 -0
- package/dist/tools/update-doc.js.map +1 -0
- package/dist/tools/update-task-status.d.ts +31 -0
- package/dist/tools/update-task-status.d.ts.map +1 -0
- package/dist/tools/update-task-status.js +303 -0
- package/dist/tools/update-task-status.js.map +1 -0
- package/dist/types.d.ts +50 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/backup.d.ts +76 -0
- package/dist/utils/backup.d.ts.map +1 -0
- package/dist/utils/backup.js +172 -0
- package/dist/utils/backup.js.map +1 -0
- package/dist/utils/errors.d.ts +93 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +125 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/os-paths.d.ts +45 -0
- package/dist/utils/os-paths.d.ts.map +1 -0
- package/dist/utils/os-paths.js +81 -0
- package/dist/utils/os-paths.js.map +1 -0
- package/dist/utils/paths.d.ts +71 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +165 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/watcher.d.ts +19 -0
- package/dist/watcher.d.ts.map +1 -0
- package/dist/watcher.js +109 -0
- package/dist/watcher.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { readCoordination, writeCoordination, } from '../coordination.js';
|
|
3
|
+
import { extractPlanId, parseTasksFromDocument, findTaskById } from '../task-parser.js';
|
|
4
|
+
/**
|
|
5
|
+
* Input schema for claim_task tool.
|
|
6
|
+
*/
|
|
7
|
+
export const ClaimTaskInputSchema = z.object({
|
|
8
|
+
taskId: z.string(),
|
|
9
|
+
agentId: z.string(),
|
|
10
|
+
persona: z.enum(['coder', 'reviewer', 'pm', 'customer']).optional(),
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Extract files from task metadata.
|
|
14
|
+
* For now, returns empty array. In future, this could query the database
|
|
15
|
+
* to get files associated with the task from planning documents.
|
|
16
|
+
*
|
|
17
|
+
* @param _taskId - Task identifier
|
|
18
|
+
* @param _context - Tool context
|
|
19
|
+
* @returns Array of file paths
|
|
20
|
+
*/
|
|
21
|
+
async function extractTaskFiles(_taskId, _context) {
|
|
22
|
+
// TODO: Extract files from task metadata in database
|
|
23
|
+
// For now, return empty array - files will be determined by task implementation
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Parse task ID to extract plan ID and feature number.
|
|
28
|
+
* Format: "<planId>#<featureNumber>"
|
|
29
|
+
*/
|
|
30
|
+
function parseTaskId(taskId) {
|
|
31
|
+
const match = taskId.match(/^(.+)#(\d+)$/);
|
|
32
|
+
if (!match) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
planId: match[1],
|
|
37
|
+
featureNumber: parseInt(match[2], 10),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Try to auto-create a task entry from the plan document.
|
|
42
|
+
* Returns the task state if found in the plan, null otherwise.
|
|
43
|
+
*
|
|
44
|
+
* @param taskId - Task identifier
|
|
45
|
+
* @param context - Tool context
|
|
46
|
+
* @returns Task state or null if not found
|
|
47
|
+
*/
|
|
48
|
+
async function tryAutoCreateTaskFromPlan(taskId, context) {
|
|
49
|
+
const parsed = parseTaskId(taskId);
|
|
50
|
+
if (!parsed) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const { planId } = parsed;
|
|
54
|
+
const { plansPath } = context.config;
|
|
55
|
+
// Query database for plan documents matching this plan ID
|
|
56
|
+
const plans = context.db
|
|
57
|
+
.prepare(`
|
|
58
|
+
SELECT path, content
|
|
59
|
+
FROM documents
|
|
60
|
+
WHERE path LIKE ?
|
|
61
|
+
AND path LIKE '%/plan.md'
|
|
62
|
+
`)
|
|
63
|
+
.all(`${plansPath}%${planId}%`);
|
|
64
|
+
if (plans.length === 0) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
// Find the plan document and parse tasks
|
|
68
|
+
for (const plan of plans) {
|
|
69
|
+
const extractedPlanId = extractPlanId(plan.path);
|
|
70
|
+
if (!extractedPlanId || !extractedPlanId.includes(planId)) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const tasks = parseTasksFromDocument(plan.path, plan.content, extractedPlanId);
|
|
74
|
+
const task = findTaskById(tasks, taskId);
|
|
75
|
+
if (task) {
|
|
76
|
+
// Create TaskState from parsed task
|
|
77
|
+
return {
|
|
78
|
+
status: task.status,
|
|
79
|
+
claimedBy: undefined,
|
|
80
|
+
dependencies: task.dependencies,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Check if any files are already locked by other agents.
|
|
88
|
+
*
|
|
89
|
+
* @param files - Files to check
|
|
90
|
+
* @param coordination - Coordination state
|
|
91
|
+
* @param agentId - Current agent ID
|
|
92
|
+
* @returns Error message if conflict found, null otherwise
|
|
93
|
+
*/
|
|
94
|
+
function checkFileLockConflicts(files, coordination, agentId) {
|
|
95
|
+
for (const file of files) {
|
|
96
|
+
const lockedBy = coordination.fileLocks[file];
|
|
97
|
+
if (lockedBy && lockedBy !== agentId) {
|
|
98
|
+
return `File ${file} is already locked by agent ${lockedBy}`;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Handle claim_task tool request.
|
|
105
|
+
* Marks a task as in-progress by a specific agent with file locks.
|
|
106
|
+
*
|
|
107
|
+
* @param input - Tool input
|
|
108
|
+
* @param context - Tool context
|
|
109
|
+
* @returns Tool result
|
|
110
|
+
*/
|
|
111
|
+
export async function handleClaimTask(input, context) {
|
|
112
|
+
const { taskId, agentId, persona } = input;
|
|
113
|
+
const coordinationPath = context.config.coordinationPath;
|
|
114
|
+
// Retry loop for optimistic concurrency
|
|
115
|
+
const maxRetries = 5;
|
|
116
|
+
let retries = 0;
|
|
117
|
+
while (retries < maxRetries) {
|
|
118
|
+
try {
|
|
119
|
+
// Read current coordination state
|
|
120
|
+
const coordination = await readCoordination(coordinationPath);
|
|
121
|
+
const expectedVersion = coordination.version;
|
|
122
|
+
// Check if task exists, auto-create if found in plan but not in coordination
|
|
123
|
+
let task = coordination.tasks[taskId];
|
|
124
|
+
if (!task) {
|
|
125
|
+
// Try to auto-create from plan document
|
|
126
|
+
const autoCreatedTask = await tryAutoCreateTaskFromPlan(taskId, context);
|
|
127
|
+
if (!autoCreatedTask) {
|
|
128
|
+
return {
|
|
129
|
+
content: [
|
|
130
|
+
{
|
|
131
|
+
type: 'text',
|
|
132
|
+
text: `Task ${taskId} not found in coordination state or plan documents`,
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
isError: true,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
// Add the auto-created task to coordination state
|
|
139
|
+
coordination.tasks[taskId] = autoCreatedTask;
|
|
140
|
+
task = autoCreatedTask;
|
|
141
|
+
}
|
|
142
|
+
// Check if task is already claimed by a different agent
|
|
143
|
+
if (task.status === 'WIP' && task.claimedBy && task.claimedBy !== agentId) {
|
|
144
|
+
return {
|
|
145
|
+
content: [
|
|
146
|
+
{
|
|
147
|
+
type: 'text',
|
|
148
|
+
text: `Task ${taskId} is already claimed by agent ${task.claimedBy}`,
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
isError: true,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
// If already claimed by same agent, just update heartbeat
|
|
155
|
+
if (task.status === 'WIP' && task.claimedBy === agentId) {
|
|
156
|
+
const agent = coordination.agents[agentId];
|
|
157
|
+
if (agent) {
|
|
158
|
+
// Update heartbeat
|
|
159
|
+
const updatedCoordination = {
|
|
160
|
+
...coordination,
|
|
161
|
+
version: coordination.version + 1,
|
|
162
|
+
agents: {
|
|
163
|
+
...coordination.agents,
|
|
164
|
+
[agentId]: {
|
|
165
|
+
...agent,
|
|
166
|
+
heartbeat: new Date().toISOString(),
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
await writeCoordination(coordinationPath, updatedCoordination, expectedVersion);
|
|
171
|
+
return {
|
|
172
|
+
content: [
|
|
173
|
+
{
|
|
174
|
+
type: 'text',
|
|
175
|
+
text: `Heartbeat updated for task ${taskId}`,
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// Check if task status allows claiming (must be 'GAP')
|
|
182
|
+
if (task.status !== 'GAP') {
|
|
183
|
+
return {
|
|
184
|
+
content: [
|
|
185
|
+
{
|
|
186
|
+
type: 'text',
|
|
187
|
+
text: `Task ${taskId} cannot be claimed. Current status: ${task.status}`,
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
isError: true,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
// Extract files for this task
|
|
194
|
+
const files = await extractTaskFiles(taskId, context);
|
|
195
|
+
// Check for file lock conflicts
|
|
196
|
+
const conflict = checkFileLockConflicts(files, coordination, agentId);
|
|
197
|
+
if (conflict) {
|
|
198
|
+
return {
|
|
199
|
+
content: [
|
|
200
|
+
{
|
|
201
|
+
type: 'text',
|
|
202
|
+
text: conflict,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
isError: true,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
// Create file locks
|
|
209
|
+
const fileLocks = { ...coordination.fileLocks };
|
|
210
|
+
for (const file of files) {
|
|
211
|
+
fileLocks[file] = agentId;
|
|
212
|
+
}
|
|
213
|
+
// Update coordination state
|
|
214
|
+
const updatedCoordination = {
|
|
215
|
+
...coordination,
|
|
216
|
+
version: coordination.version + 1,
|
|
217
|
+
tasks: {
|
|
218
|
+
...coordination.tasks,
|
|
219
|
+
[taskId]: {
|
|
220
|
+
...task,
|
|
221
|
+
status: 'WIP',
|
|
222
|
+
claimedBy: agentId,
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
agents: {
|
|
226
|
+
...coordination.agents,
|
|
227
|
+
[agentId]: {
|
|
228
|
+
status: 'WIP',
|
|
229
|
+
persona: persona || 'coder',
|
|
230
|
+
taskId,
|
|
231
|
+
filesLocked: files,
|
|
232
|
+
heartbeat: new Date().toISOString(),
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
fileLocks,
|
|
236
|
+
};
|
|
237
|
+
// Write with optimistic concurrency control
|
|
238
|
+
await writeCoordination(coordinationPath, updatedCoordination, expectedVersion);
|
|
239
|
+
return {
|
|
240
|
+
content: [
|
|
241
|
+
{
|
|
242
|
+
type: 'text',
|
|
243
|
+
text: `Task ${taskId} claimed successfully by agent ${agentId}`,
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
// Handle version mismatch (optimistic concurrency conflict)
|
|
250
|
+
if (error instanceof Error && error.message.includes('Version mismatch')) {
|
|
251
|
+
retries++;
|
|
252
|
+
if (retries >= maxRetries) {
|
|
253
|
+
return {
|
|
254
|
+
content: [
|
|
255
|
+
{
|
|
256
|
+
type: 'text',
|
|
257
|
+
text: `Failed to claim task after ${maxRetries} retries due to concurrent modifications`,
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
isError: true,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
// Retry with fresh state
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
// Other errors
|
|
267
|
+
return {
|
|
268
|
+
content: [
|
|
269
|
+
{
|
|
270
|
+
type: 'text',
|
|
271
|
+
text: `Error claiming task: ${error instanceof Error ? error.message : String(error)}`,
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
isError: true,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
content: [
|
|
280
|
+
{
|
|
281
|
+
type: 'text',
|
|
282
|
+
text: `Failed to claim task after ${maxRetries} retries`,
|
|
283
|
+
},
|
|
284
|
+
],
|
|
285
|
+
isError: true,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=claim-task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim-task.js","sourceRoot":"","sources":["../../src/tools/claim-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,GAGlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGxF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,IAAI,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B,SAAS;YACX,CAAC;YAED,eAAe;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,wBAAwB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACvF;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,8BAA8B,UAAU,UAAU;aACzD;SACF;QACD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* create_doc tool: Create new documents with optional template frontmatter.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { type DocType } from '../utils/paths.js';
|
|
6
|
+
import type { ToolContext, ToolResult } from '../types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Input schema for create_doc tool.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CreateDocInputSchema: z.ZodObject<{
|
|
11
|
+
path: z.ZodString;
|
|
12
|
+
content: z.ZodString;
|
|
13
|
+
template: z.ZodDefault<z.ZodEnum<["addendum", "research", "example", "none"]>>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
path: string;
|
|
16
|
+
content: string;
|
|
17
|
+
template: "none" | "research" | "addendum" | "example";
|
|
18
|
+
}, {
|
|
19
|
+
path: string;
|
|
20
|
+
content: string;
|
|
21
|
+
template?: "none" | "research" | "addendum" | "example" | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
export type CreateDocInput = z.infer<typeof CreateDocInputSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Output interface for create_doc tool.
|
|
26
|
+
*/
|
|
27
|
+
export interface CreateDocOutput {
|
|
28
|
+
path: string;
|
|
29
|
+
created: true;
|
|
30
|
+
size: number;
|
|
31
|
+
type: DocType;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Template definitions with frontmatter.
|
|
35
|
+
* {{DATE}} placeholder is replaced with current date in YYYY-MM-DD format.
|
|
36
|
+
*/
|
|
37
|
+
export declare const TEMPLATES: Record<string, string>;
|
|
38
|
+
/**
|
|
39
|
+
* Handle create_doc tool request.
|
|
40
|
+
* Creates a new file with optional template frontmatter.
|
|
41
|
+
*
|
|
42
|
+
* @param input - Tool input
|
|
43
|
+
* @param context - Tool context
|
|
44
|
+
* @returns Tool result
|
|
45
|
+
*/
|
|
46
|
+
export declare function handleCreateDoc(input: CreateDocInput, context: ToolContext): Promise<ToolResult>;
|
|
47
|
+
//# sourceMappingURL=create-doc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-doc.d.ts","sourceRoot":"","sources":["../../src/tools/create-doc.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAgC,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG/E,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAO/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqB5C,CAAC;AAmBF;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAgFrB"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* create_doc tool: Create new documents with optional template frontmatter.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { existsSync, writeFileSync, mkdirSync, statSync } from 'fs';
|
|
6
|
+
import { dirname } from 'path';
|
|
7
|
+
import { validatePath, isWritablePath } from '../utils/paths.js';
|
|
8
|
+
import { alreadyExists, restrictedPath } from '../utils/errors.js';
|
|
9
|
+
import { indexDocument } from '../indexer.js';
|
|
10
|
+
/**
|
|
11
|
+
* Input schema for create_doc tool.
|
|
12
|
+
*/
|
|
13
|
+
export const CreateDocInputSchema = z.object({
|
|
14
|
+
path: z.string().min(1).describe('Path for new file relative to repo root'),
|
|
15
|
+
content: z.string().describe('File content'),
|
|
16
|
+
template: z
|
|
17
|
+
.enum(['addendum', 'research', 'example', 'none'])
|
|
18
|
+
.default('none')
|
|
19
|
+
.describe('Template to apply (adds frontmatter)'),
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Template definitions with frontmatter.
|
|
23
|
+
* {{DATE}} placeholder is replaced with current date in YYYY-MM-DD format.
|
|
24
|
+
*/
|
|
25
|
+
export const TEMPLATES = {
|
|
26
|
+
addendum: `---
|
|
27
|
+
version: "1.0"
|
|
28
|
+
date: "{{DATE}}"
|
|
29
|
+
status: "Draft"
|
|
30
|
+
type: "addendum"
|
|
31
|
+
extends: ""
|
|
32
|
+
author: ""
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
`,
|
|
36
|
+
research: `---
|
|
37
|
+
version: "1.0"
|
|
38
|
+
date: "{{DATE}}"
|
|
39
|
+
status: "Draft"
|
|
40
|
+
type: "research"
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
`,
|
|
44
|
+
example: '',
|
|
45
|
+
none: '',
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Get repository root from config.
|
|
49
|
+
* Assumes plansPath is ../plans relative to .mcp, so dirname gives repo root.
|
|
50
|
+
*/
|
|
51
|
+
function getRepoRoot(config) {
|
|
52
|
+
return dirname(config.plansPath);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Apply template to content, replacing {{DATE}} with current date.
|
|
56
|
+
*/
|
|
57
|
+
function applyTemplate(template, content) {
|
|
58
|
+
const date = new Date().toISOString().split('T')[0];
|
|
59
|
+
const templateContent = template.replace(/\{\{DATE\}\}/g, date);
|
|
60
|
+
return templateContent + content;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Handle create_doc tool request.
|
|
64
|
+
* Creates a new file with optional template frontmatter.
|
|
65
|
+
*
|
|
66
|
+
* @param input - Tool input
|
|
67
|
+
* @param context - Tool context
|
|
68
|
+
* @returns Tool result
|
|
69
|
+
*/
|
|
70
|
+
export async function handleCreateDoc(input, context) {
|
|
71
|
+
const { path, content, template } = input;
|
|
72
|
+
const repoRoot = getRepoRoot(context.config);
|
|
73
|
+
try {
|
|
74
|
+
// Validate path (must not exist, must be writable)
|
|
75
|
+
const validated = validatePath(path, repoRoot, {
|
|
76
|
+
requireWritable: true,
|
|
77
|
+
});
|
|
78
|
+
// Check if file already exists
|
|
79
|
+
if (existsSync(validated.absolute)) {
|
|
80
|
+
throw alreadyExists(path);
|
|
81
|
+
}
|
|
82
|
+
// Check if path is writable (additional check beyond requireWritable)
|
|
83
|
+
if (!isWritablePath(validated.relative)) {
|
|
84
|
+
throw restrictedPath(path);
|
|
85
|
+
}
|
|
86
|
+
// Apply template if specified
|
|
87
|
+
let finalContent = content;
|
|
88
|
+
if (template !== 'none' && TEMPLATES[template]) {
|
|
89
|
+
finalContent = applyTemplate(TEMPLATES[template], content);
|
|
90
|
+
}
|
|
91
|
+
// Create parent directories if needed
|
|
92
|
+
const parentDir = dirname(validated.absolute);
|
|
93
|
+
if (!existsSync(parentDir)) {
|
|
94
|
+
mkdirSync(parentDir, { recursive: true });
|
|
95
|
+
}
|
|
96
|
+
// Write file
|
|
97
|
+
writeFileSync(validated.absolute, finalContent, 'utf-8');
|
|
98
|
+
// Get file size
|
|
99
|
+
const stats = statSync(validated.absolute);
|
|
100
|
+
const size = stats.size;
|
|
101
|
+
// Index the new file
|
|
102
|
+
await indexDocument(context.db, validated.absolute);
|
|
103
|
+
const output = {
|
|
104
|
+
path: validated.relative,
|
|
105
|
+
created: true,
|
|
106
|
+
size,
|
|
107
|
+
type: validated.type,
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
content: [
|
|
111
|
+
{
|
|
112
|
+
type: 'text',
|
|
113
|
+
text: JSON.stringify(output, null, 2),
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
// Re-throw DocumentError as-is
|
|
120
|
+
if (error instanceof Error && 'code' in error) {
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
// Wrap other errors
|
|
124
|
+
return {
|
|
125
|
+
content: [
|
|
126
|
+
{
|
|
127
|
+
type: 'text',
|
|
128
|
+
text: JSON.stringify({
|
|
129
|
+
error: error instanceof Error ? error.message : String(error),
|
|
130
|
+
}, null, 2),
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
isError: true,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=create-doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-doc.js","sourceRoot":"","sources":["../../src/tools/create-doc.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;A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K,CAAC,IAAI,CAAC;QAExB,qBAAqB;QACrB,MAAM,aAAa,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;QAEpD,MAAM,MAAM,GAAoB;YAC9B,IAAI,EAAE,SAAS,CAAC,QAAQ;YACxB,OAAO,EAAE,IAAI;YACb,IAAI;YACJ,IAAI,EAAE,SAAS,CAAC,IAAI;SACrB,CAAC;QAEF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;iBACtC;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,+BAA+B;QAC/B,IAAI,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC;YAC9C,MAAM,KAAK,CAAC;QACd,CAAC;QAED,oBAAoB;QACpB,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBAC9D,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolContext, ToolResult } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Input schema for create_plan tool.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CreatePlanInputSchema: z.ZodObject<{
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
description: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
name: string;
|
|
11
|
+
description?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
name: string;
|
|
14
|
+
description?: string | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Handle create_plan tool request.
|
|
18
|
+
* Creates a new planning document from template with zero-padded ordering.
|
|
19
|
+
*
|
|
20
|
+
* @param input - Tool input
|
|
21
|
+
* @param context - Tool context
|
|
22
|
+
* @returns Tool result
|
|
23
|
+
*/
|
|
24
|
+
export declare function handleCreatePlan(input: z.infer<typeof CreatePlanInputSchema>, context: ToolContext): Promise<ToolResult>;
|
|
25
|
+
//# sourceMappingURL=create-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-plan.d.ts","sourceRoot":"","sources":["../../src/tools/create-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAM3D;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;EAGhC,CAAC;AAiHH;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,EAC5C,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAgErB"}
|