@rui.branco/claude-commands-mcp 2.0.27 → 2.0.28
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/index.js +15 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -304,7 +304,7 @@ server.tool(
|
|
|
304
304
|
// Tool: save a file and push to git
|
|
305
305
|
server.tool(
|
|
306
306
|
"save_file",
|
|
307
|
-
"Save/update a file in the commands directory and push to git. Use for tracking data, skill updates, or any file that should persist.",
|
|
307
|
+
"Save/update a file in the commands directory and push to git. Use for tracking data, skill updates, or any file that should persist. Use append:true for tracking files to add content without overwriting existing data (single tool call, no need to read first).",
|
|
308
308
|
{
|
|
309
309
|
path: z
|
|
310
310
|
.string()
|
|
@@ -312,12 +312,18 @@ server.tool(
|
|
|
312
312
|
"File path relative to commands/ (e.g. 'folder/tracking/2026-02-07.md')",
|
|
313
313
|
),
|
|
314
314
|
content: z.string().describe("The file content to save"),
|
|
315
|
+
append: z
|
|
316
|
+
.boolean()
|
|
317
|
+
.optional()
|
|
318
|
+
.describe(
|
|
319
|
+
"If true, appends content to the existing file instead of overwriting. Creates the file if it doesn't exist.",
|
|
320
|
+
),
|
|
315
321
|
message: z
|
|
316
322
|
.string()
|
|
317
323
|
.optional()
|
|
318
324
|
.describe("Git commit message (auto-generated if not provided)"),
|
|
319
325
|
},
|
|
320
|
-
async ({ path, content, message }) => {
|
|
326
|
+
async ({ path, content, append, message }) => {
|
|
321
327
|
try {
|
|
322
328
|
// If path has no extension but a .md file exists, use that (matches get_skill behavior)
|
|
323
329
|
if (!extname(path)) {
|
|
@@ -331,7 +337,12 @@ server.tool(
|
|
|
331
337
|
mkdirSync(fileDir, { recursive: true });
|
|
332
338
|
}
|
|
333
339
|
|
|
334
|
-
|
|
340
|
+
if (append && existsSync(filePath)) {
|
|
341
|
+
const existing = readFileSync(filePath, "utf-8");
|
|
342
|
+
writeFileSync(filePath, existing + content, "utf-8");
|
|
343
|
+
} else {
|
|
344
|
+
writeFileSync(filePath, content, "utf-8");
|
|
345
|
+
}
|
|
335
346
|
|
|
336
347
|
const commitMsg = message || `update: ${path}`;
|
|
337
348
|
gitPush(commitMsg);
|
|
@@ -340,7 +351,7 @@ server.tool(
|
|
|
340
351
|
content: [
|
|
341
352
|
{
|
|
342
353
|
type: "text",
|
|
343
|
-
text:
|
|
354
|
+
text: `${append ? "Appended to" : "Saved and pushed"}: commands/${path}`,
|
|
344
355
|
},
|
|
345
356
|
],
|
|
346
357
|
};
|