promptlike-mcp 0.6.0 → 0.7.1
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/CHANGELOG.md +20 -0
- package/README.md +7 -6
- package/dist/lib/api-client.js +18 -0
- package/dist/lib/folder.js +32 -0
- package/dist/lib/writeTools.js +123 -3
- package/dist/server.js +52 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.1 — 2026-11-01
|
|
4
|
+
|
|
5
|
+
- **`fill_variables` no longer ignores a wrong name silently.** Names you pass that the prompt does not have come back in
|
|
6
|
+
`unknown_variables`, with a `warning` that lists the names it does have. The filled text is unchanged.
|
|
7
|
+
- **`update_prompt` says why a tag failed.** `tags_failed_reason` carries the reason and the message includes it. On a rate
|
|
8
|
+
limit it stops trying the remaining tags, reports them all as failed and returns `retry_after` in seconds.
|
|
9
|
+
- Registry description: "No delete tool" instead of "Add-only saves" (`move_prompt` moves, and nothing is deleted). The
|
|
10
|
+
add-only rule for tags is unchanged: `update_prompt` never removes a tag (`ple untag` in the CLI does).
|
|
11
|
+
|
|
12
|
+
## 0.7.0 — 2026-10-31
|
|
13
|
+
|
|
14
|
+
- **New tool: `move_prompt`** (the ninth). Moves ONE prompt to another repo (`to_project`) and/or folder (`folder`; `""` =
|
|
15
|
+
the repo root). `name` must be the exact title or the id: a move never guesses. Versions, deployment labels, stars,
|
|
16
|
+
usage and the `/p/` link stay with the prompt; its tags are matched by name in the target repo. A target repo that
|
|
17
|
+
already has a prompt with that title, or a move that changes who can see the prompt (public repo to private repo or
|
|
18
|
+
back), is refused with nothing moved; for the second case the answer tells the agent to ask the user and call again with
|
|
19
|
+
`confirm_visibility: true`. Moving to where the prompt already is changes nothing (`status: "unchanged"`). Nothing is deleted.
|
|
20
|
+
- **Folders.** `save_prompt` takes an optional `folder` (`reviews/backend`, up to 3 levels, 64 characters each). `list_prompts`
|
|
21
|
+
(and `search_prompts`) now return each prompt's `repo` and `folder`; `list_prompts` can filter by `project` and `folder`.
|
|
22
|
+
|
|
3
23
|
## 0.6.0 — 2026-10-30
|
|
4
24
|
|
|
5
25
|
- **`update_prompt` can now change a prompt's description and tags** (before, only its text). New optional
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# promptlike-mcp
|
|
2
2
|
|
|
3
|
-
MCP (Model Context Protocol) server for [PromptLikeEngineer](https://promptlikeengineer.com) — gives AI agents your prompt library: read it, fill it, get suggestions from it, and save good prompts back to it (
|
|
3
|
+
MCP (Model Context Protocol) server for [PromptLikeEngineer](https://promptlikeengineer.com) — gives AI agents your prompt library: read it, fill it, get suggestions from it, and save good prompts back to it (a new prompt or a new version, never a delete).
|
|
4
4
|
|
|
5
5
|
Your prompts stay where you saved them; your agent pulls them by name at the moment it needs them. No copy-paste, no stale duplicates in system prompts.
|
|
6
6
|
|
|
@@ -46,18 +46,19 @@ Every prompt is also a resource, `promptlike://<repo>/<prompt>` (`text/markdown`
|
|
|
46
46
|
|
|
47
47
|
| Tool | What it does |
|
|
48
48
|
|---|---|
|
|
49
|
-
| `list_prompts` | List your prompts (optional `tag`
|
|
49
|
+
| `list_prompts` | List your prompts (optional `tag`, `project` and `folder` filters). Includes each prompt's repo, folder and `{{variable}}` names. Paged: `limit` + `page`; the reply carries the real `total`, `total_pages` and `has_more`. |
|
|
50
50
|
| `search_prompts` | Search by title/description. Same paging as `list_prompts`. |
|
|
51
51
|
| `get_prompt` | Full content by name/id/short-id, optional `version` pin or deployment `label` (e.g. `production`). `via: "suggestion"` when fetching a suggested prompt. |
|
|
52
|
-
| `fill_variables` | Fetch + substitute `{{variables}}` (and `{{#if var}}…{{/if}}` blocks; optional `version`/`label`), returns ready-to-use text (unfilled ones reported in `missing_variables`). |
|
|
52
|
+
| `fill_variables` | Fetch + substitute `{{variables}}` (and `{{#if var}}…{{/if}}` blocks; optional `version`/`label`), returns ready-to-use text (unfilled ones reported in `missing_variables`, names the prompt does not have in `unknown_variables`). |
|
|
53
53
|
| `suggest_prompts` | Up to 3 prompts from your own library that fit a task (call once at the start of a non-trivial task). |
|
|
54
|
-
| `save_prompt` | **Write.** New prompt: `title`, `content`, optional `description`, `project` (repo; default: your most recent repo you can edit), `tags`. |
|
|
55
|
-
| `
|
|
54
|
+
| `save_prompt` | **Write.** New prompt: `title`, `content`, optional `description`, `project` (repo; default: your most recent repo you can edit), `folder` (e.g. `reviews/backend`), `tags`. |
|
|
55
|
+
| `move_prompt` | **Write.** Move ONE prompt to another repo (`to_project`) and/or folder (`folder`; `""` = repo root); exact title or id. Versions, labels, stars, usage and the `/p/` link stay; tags are matched by name in the target repo. Refused, nothing moved, when the target has a prompt with that title or when the move changes who can see the prompt (public/private repo): the agent asks the user, then repeats with `confirm_visibility: true`. Deletes nothing. |
|
|
56
|
+
| `update_prompt` | **Write.** Change an existing prompt (exact title or id). Pass any of: full new `content` → a **new version** (`changelog`, `bump` `patch`/`minor`/`major` go with it); `description` → overwrites the description; `tags` → adds these tags (none is ever removed; remove one in the web app or with `ple untag`). A field you leave out is not touched; `description` overwrites. |
|
|
56
57
|
| `submit_feedback` | Tell the maker that a tool is missing, broken, confusing or answered wrong, or that a saved prompt did not work: `message` (one short factual sentence), optional `type` (`bug`/`missing`/`idea`/`prompt`), `prompt` (title or id, never its text), `email`. Works without a session. Not a write to your library. |
|
|
57
58
|
|
|
58
59
|
### How writes behave
|
|
59
60
|
|
|
60
|
-
- **
|
|
61
|
+
- **Nothing is deleted.** There is no delete tool; `update_prompt` keeps every earlier version (roll back on the web or with `ple rollback`) and `move_prompt` changes where a prompt lives, not its versions. No prompt and no version is ever deleted.
|
|
61
62
|
- **`update_prompt` touches only what you pass.** A field that is left out is not changed; a field that is passed overwrites (`description: ""` clears it). `content` is the only part that makes a **version**; the description and the tags are not part of a version, so changing only them opens none — and because the description is not versioned, the answer carries `previous_description` so an overwrite can be put back. **Tags are add-only:** `tags` adds the ones the prompt lacks; tags already on it, and tags you do not list, stay — `tags: []` changes nothing, and this server never sends a DELETE (remove a tag in the web app). Passing values that already match changes nothing; passing none of `content`, `description`, `tags` is an error.
|
|
62
63
|
- **Safe to retry.** Same title + content → "already saved"; content, description and tags equal to what the prompt has → "unchanged", no new version. A title that exists with different content is reported instead of duplicated.
|
|
63
64
|
- **Your account, your limits.** Writes use your `ple login` session and the same plan limits as the web; hitting one returns a plain message with the upgrade link and saves nothing. Viewer access to a shared repo cannot write.
|
package/dist/lib/api-client.js
CHANGED
|
@@ -30,6 +30,7 @@ exports.createPrompt = createPrompt;
|
|
|
30
30
|
exports.savePromptVersion = savePromptVersion;
|
|
31
31
|
exports.addPromptTag = addPromptTag;
|
|
32
32
|
exports.updatePromptDescription = updatePromptDescription;
|
|
33
|
+
exports.movePrompt = movePrompt;
|
|
33
34
|
exports.suggestPrompts = suggestPrompts;
|
|
34
35
|
const constants_1 = require("./constants");
|
|
35
36
|
const config_1 = require("./config");
|
|
@@ -313,6 +314,7 @@ async function listPromptsPage(params = {}) {
|
|
|
313
314
|
limit: params.limit,
|
|
314
315
|
page: params.page,
|
|
315
316
|
projectId: params.projectId,
|
|
317
|
+
folder: params.folder,
|
|
316
318
|
},
|
|
317
319
|
});
|
|
318
320
|
return { prompts: res.prompts ?? [], totalPages: res.totalPages ?? 1 };
|
|
@@ -406,6 +408,7 @@ async function createPrompt(input) {
|
|
|
406
408
|
contextText: input.content,
|
|
407
409
|
changelog: input.changelog ?? 'Saved from an agent via MCP',
|
|
408
410
|
source: 'mcp',
|
|
411
|
+
...(input.folder ? { folder: input.folder } : {}),
|
|
409
412
|
},
|
|
410
413
|
});
|
|
411
414
|
}
|
|
@@ -436,6 +439,21 @@ async function addPromptTag(promptId, tagName) {
|
|
|
436
439
|
async function updatePromptDescription(promptId, description) {
|
|
437
440
|
await apiFetch(`/api/prompts/${promptId}`, { method: 'PATCH', body: { description } });
|
|
438
441
|
}
|
|
442
|
+
/**
|
|
443
|
+
* Move a prompt to another repo and/or folder (versions, labels, stars, usage and the /p/ link stay with it).
|
|
444
|
+
* `folder` omitted: kept in the same repo, root in another; `''` = root. A move that changes who can see the
|
|
445
|
+
* prompt answers 409 VISIBILITY_CONFIRM_REQUIRED until `confirmVisibility` is true. Errors carry the server `code`.
|
|
446
|
+
*/
|
|
447
|
+
async function movePrompt(promptId, input) {
|
|
448
|
+
return apiFetch(`/api/prompts/${promptId}/move`, {
|
|
449
|
+
method: 'POST',
|
|
450
|
+
body: {
|
|
451
|
+
project_id: input.projectId,
|
|
452
|
+
...(input.folder !== undefined ? { folder: input.folder } : {}),
|
|
453
|
+
...(input.confirmVisibility ? { confirm_visibility: true } : {}),
|
|
454
|
+
},
|
|
455
|
+
});
|
|
456
|
+
}
|
|
439
457
|
/** Best matches for a task from the user's OWN library (server-side full text). */
|
|
440
458
|
async function suggestPrompts(task, limit = 3) {
|
|
441
459
|
const res = await apiFetch('/api/prompts/suggest', {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FOLDER_SEGMENT_MAX = exports.FOLDER_MAX_DEPTH = void 0;
|
|
4
|
+
exports.normalizeFolder = normalizeFolder;
|
|
5
|
+
/**
|
|
6
|
+
* A folder path inside a repo: `a/b`, at most 3 levels, 64 characters per level, empty = the repo root.
|
|
7
|
+
* The same rule as the database (prompts_folder_format) and the web API (src/lib/prompt-folder.ts); a test keeps the copies identical.
|
|
8
|
+
*/
|
|
9
|
+
exports.FOLDER_MAX_DEPTH = 3;
|
|
10
|
+
exports.FOLDER_SEGMENT_MAX = 64;
|
|
11
|
+
// A level neither starts nor ends with a space and has no '/' or control character.
|
|
12
|
+
const SEGMENT = /^[^/\s\p{Cc}](?:[^/\p{Cc}]{0,62}[^/\s\p{Cc}])?$/u;
|
|
13
|
+
/** Trims spaces and slashes; null when empty (root). `{ error }` when invalid. */
|
|
14
|
+
function normalizeFolder(input) {
|
|
15
|
+
if (input === null || input === undefined)
|
|
16
|
+
return { value: null };
|
|
17
|
+
if (typeof input !== 'string')
|
|
18
|
+
return { error: 'folder must be text like "a/b"' };
|
|
19
|
+
const cleaned = input.trim().replace(/^\/+|\/+$/g, '').trim();
|
|
20
|
+
if (cleaned === '')
|
|
21
|
+
return { value: null };
|
|
22
|
+
const parts = cleaned.split('/');
|
|
23
|
+
if (parts.length > exports.FOLDER_MAX_DEPTH)
|
|
24
|
+
return { error: `A folder path has at most ${exports.FOLDER_MAX_DEPTH} levels (a/b/c).` };
|
|
25
|
+
for (const part of parts) {
|
|
26
|
+
if (part.length > exports.FOLDER_SEGMENT_MAX)
|
|
27
|
+
return { error: `Each folder name is at most ${exports.FOLDER_SEGMENT_MAX} characters.` };
|
|
28
|
+
if (!SEGMENT.test(part))
|
|
29
|
+
return { error: 'Folder names cannot be empty, start or end with a space, or contain control characters.' };
|
|
30
|
+
}
|
|
31
|
+
return { value: parts.join('/') };
|
|
32
|
+
}
|
package/dist/lib/writeTools.js
CHANGED
|
@@ -19,8 +19,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.describeWriteError = describeWriteError;
|
|
20
20
|
exports.savePromptFlow = savePromptFlow;
|
|
21
21
|
exports.updatePromptFlow = updatePromptFlow;
|
|
22
|
+
exports.movePromptFlow = movePromptFlow;
|
|
22
23
|
const api_client_1 = require("./api-client");
|
|
23
24
|
const constants_1 = require("./constants");
|
|
25
|
+
const folder_1 = require("./folder");
|
|
24
26
|
const promptText_1 = require("./promptText");
|
|
25
27
|
const resolver_1 = require("./resolver");
|
|
26
28
|
const writeGuard_1 = require("./writeGuard");
|
|
@@ -56,6 +58,9 @@ async function savePromptFlow(args) {
|
|
|
56
58
|
if (!checked.ok)
|
|
57
59
|
return { ok: false, message: checked.error };
|
|
58
60
|
const input = checked.value;
|
|
61
|
+
const folder = (0, folder_1.normalizeFolder)(args.folder);
|
|
62
|
+
if ('error' in folder)
|
|
63
|
+
return { ok: false, message: folder.error };
|
|
59
64
|
try {
|
|
60
65
|
const project = await pickProject(args.project);
|
|
61
66
|
if (typeof project === 'string')
|
|
@@ -72,7 +77,11 @@ async function savePromptFlow(args) {
|
|
|
72
77
|
id: identical.id,
|
|
73
78
|
title: identical.title,
|
|
74
79
|
repo: project.name,
|
|
80
|
+
...(identical.folder ? { folder: identical.folder } : {}),
|
|
75
81
|
version: identical.current_version?.version_number ?? null,
|
|
82
|
+
...(folder.value && folder.value !== (identical.folder ?? null)
|
|
83
|
+
? { folder_note: `It sits in ${identical.folder ? `folder '${identical.folder}'` : 'the repo root'}; save_prompt does not move it. Call move_prompt to change its folder.` }
|
|
84
|
+
: {}),
|
|
76
85
|
},
|
|
77
86
|
};
|
|
78
87
|
}
|
|
@@ -89,6 +98,7 @@ async function savePromptFlow(args) {
|
|
|
89
98
|
title: input.title,
|
|
90
99
|
content: input.content,
|
|
91
100
|
description: input.description,
|
|
101
|
+
folder: folder.value ?? undefined,
|
|
92
102
|
});
|
|
93
103
|
const tagged = [];
|
|
94
104
|
const tagsFailed = [];
|
|
@@ -106,6 +116,7 @@ async function savePromptFlow(args) {
|
|
|
106
116
|
id: saved.promptId,
|
|
107
117
|
title: input.title,
|
|
108
118
|
repo: project.name,
|
|
119
|
+
...(folder.value ? { folder: folder.value } : {}),
|
|
109
120
|
version: saved.versionNumber ?? 1,
|
|
110
121
|
tags: tagged,
|
|
111
122
|
};
|
|
@@ -210,13 +221,25 @@ async function updatePromptFlow(args) {
|
|
|
210
221
|
const toAdd = tags.filter((t) => !haveNames.has(t.toLowerCase()));
|
|
211
222
|
const added = [];
|
|
212
223
|
const tagsFailed = [];
|
|
213
|
-
|
|
224
|
+
let tagError;
|
|
225
|
+
let retryAfter;
|
|
226
|
+
for (const [i, tag] of toAdd.entries()) {
|
|
214
227
|
try {
|
|
215
228
|
await (0, api_client_1.addPromptTag)(prompt.id, tag);
|
|
216
229
|
added.push(tag);
|
|
217
230
|
}
|
|
218
|
-
catch {
|
|
231
|
+
catch (err) {
|
|
219
232
|
tagsFailed.push(tag);
|
|
233
|
+
tagError ?? (tagError = err instanceof Error ? err.message : String(err));
|
|
234
|
+
// Hız sınırı: kalan etiketleri denemek yalnız sınırı uzatır; hepsi başarısız sayılır, süre ajana söylenir.
|
|
235
|
+
const limited = /^Rate limited\b/.test(tagError);
|
|
236
|
+
if (limited) {
|
|
237
|
+
tagsFailed.push(...toAdd.slice(i + 1));
|
|
238
|
+
const m = /Retry in (\d+)s/.exec(tagError);
|
|
239
|
+
if (m)
|
|
240
|
+
retryAfter = Number(m[1]);
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
220
243
|
}
|
|
221
244
|
}
|
|
222
245
|
metaChanged = metaChanged || added.length > 0;
|
|
@@ -225,7 +248,11 @@ async function updatePromptFlow(args) {
|
|
|
225
248
|
payload.tags_added = added;
|
|
226
249
|
if (tagsFailed.length > 0) {
|
|
227
250
|
payload.tags_failed = tagsFailed;
|
|
228
|
-
|
|
251
|
+
if (tagError)
|
|
252
|
+
payload.tags_failed_reason = tagError;
|
|
253
|
+
if (retryAfter !== undefined)
|
|
254
|
+
payload.retry_after = retryAfter;
|
|
255
|
+
failures.push(`tags: could not add ${tagsFailed.join(', ')}${tagError ? ` (${tagError})` : ''}`);
|
|
229
256
|
}
|
|
230
257
|
const wanted = new Set(tags.map((t) => t.toLowerCase()));
|
|
231
258
|
if (have.some((t) => !wanted.has(t.name.toLowerCase()))) {
|
|
@@ -257,3 +284,96 @@ async function updatePromptFlow(args) {
|
|
|
257
284
|
return { ok: false, message: describeWriteError(err) };
|
|
258
285
|
}
|
|
259
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* move_prompt. Moves ONE prompt to another repo and/or folder; versions, labels, stars, usage and the /p/ link stay.
|
|
289
|
+
* Like update_prompt it needs an exact title or id (a fuzzy match could move the wrong prompt). A move that changes
|
|
290
|
+
* who can see the prompt is refused until the caller passes `confirm_visibility: true` — the agent has to ask the user.
|
|
291
|
+
* Moving to where the prompt already is changes nothing (`status: "unchanged"`). Nothing is deleted.
|
|
292
|
+
*/
|
|
293
|
+
async function movePromptFlow(args) {
|
|
294
|
+
if (args.to_project === undefined && args.folder === undefined) {
|
|
295
|
+
return { ok: false, message: 'Give `to_project` (another repo), `folder` (a folder in the same repo), or both.' };
|
|
296
|
+
}
|
|
297
|
+
if (args.to_project !== undefined && args.to_project.trim() === '') {
|
|
298
|
+
return { ok: false, message: '`to_project` is empty. Give a repo name, slug or id.' };
|
|
299
|
+
}
|
|
300
|
+
const folder = args.folder === undefined ? undefined : (0, folder_1.normalizeFolder)(args.folder);
|
|
301
|
+
if (folder && 'error' in folder)
|
|
302
|
+
return { ok: false, message: folder.error };
|
|
303
|
+
try {
|
|
304
|
+
const sourceProjectId = args.project ? await (0, resolver_1.resolveProjectId)(args.project) : undefined;
|
|
305
|
+
const found = await (0, resolver_1.resolvePromptByName)(args.name, { projectId: sourceProjectId });
|
|
306
|
+
if (found.status === 'ambiguous') {
|
|
307
|
+
return {
|
|
308
|
+
ok: false,
|
|
309
|
+
message: `'${args.name}' matched several prompts. Call again with the exact title, an id, or the 'project' arg.`,
|
|
310
|
+
payload: { candidates: found.candidates },
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
if (found.status === 'not_found')
|
|
314
|
+
return { ok: false, message: `No prompt matched '${args.name}'.` };
|
|
315
|
+
const prompt = found.prompt;
|
|
316
|
+
if (!isExactReference(args.name, prompt)) {
|
|
317
|
+
return {
|
|
318
|
+
ok: false,
|
|
319
|
+
message: `'${args.name}' is not an exact title or id. Did you mean '${prompt.title}' (${prompt.id})? ` +
|
|
320
|
+
'Call again with the exact title or id — moves never guess.',
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
let target;
|
|
324
|
+
if (args.to_project !== undefined) {
|
|
325
|
+
const picked = await pickProject(args.to_project);
|
|
326
|
+
if (typeof picked === 'string')
|
|
327
|
+
return { ok: false, message: picked };
|
|
328
|
+
target = picked;
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
if (!prompt.project_id)
|
|
332
|
+
return { ok: false, message: 'The prompt did not say which repo it is in; pass `to_project`.' };
|
|
333
|
+
target = { id: prompt.project_id, name: prompt.project_name ?? 'this repo' };
|
|
334
|
+
}
|
|
335
|
+
const moved = await (0, api_client_1.movePrompt)(prompt.id, {
|
|
336
|
+
projectId: target.id,
|
|
337
|
+
...(folder ? { folder: folder.value ?? '' } : {}),
|
|
338
|
+
confirmVisibility: args.confirm_visibility === true,
|
|
339
|
+
}).catch((err) => err);
|
|
340
|
+
if (moved instanceof api_client_1.ApiError) {
|
|
341
|
+
if (moved.code === 'NOTHING_TO_MOVE') {
|
|
342
|
+
return {
|
|
343
|
+
ok: true,
|
|
344
|
+
payload: { status: 'unchanged', message: 'The prompt is already there — nothing changed.', id: prompt.id, title: prompt.title, repo: target.name },
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
if (moved.code === 'VISIBILITY_CONFIRM_REQUIRED') {
|
|
348
|
+
return {
|
|
349
|
+
ok: false,
|
|
350
|
+
message: `${moved.message} Nothing was moved. Ask the user; if they agree, call move_prompt again with confirm_visibility: true.`,
|
|
351
|
+
payload: { status: 'confirm_required', id: prompt.id },
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
if (moved.code === 'DUPLICATE_TITLE') {
|
|
355
|
+
return { ok: false, message: `${moved.message} Nothing was moved.`, payload: { status: 'duplicate_title', id: prompt.id } };
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (moved instanceof Error)
|
|
359
|
+
return { ok: false, message: describeWriteError(moved) };
|
|
360
|
+
const result = moved;
|
|
361
|
+
return {
|
|
362
|
+
ok: true,
|
|
363
|
+
payload: {
|
|
364
|
+
status: 'moved',
|
|
365
|
+
id: prompt.id,
|
|
366
|
+
title: prompt.title,
|
|
367
|
+
repo: target.name,
|
|
368
|
+
...(result.moved_between_repos && prompt.project_name ? { previous_repo: prompt.project_name } : {}),
|
|
369
|
+
folder: result.folder,
|
|
370
|
+
previous_folder: result.previous_folder,
|
|
371
|
+
tags_moved: result.tags_moved,
|
|
372
|
+
note: 'Versions, labels, stars, usage and the /p/ link stayed with the prompt.',
|
|
373
|
+
},
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
catch (err) {
|
|
377
|
+
return { ok: false, message: describeWriteError(err) };
|
|
378
|
+
}
|
|
379
|
+
}
|
package/dist/server.js
CHANGED
|
@@ -28,6 +28,7 @@ const api_client_1 = require("./lib/api-client");
|
|
|
28
28
|
const resolver_1 = require("./lib/resolver");
|
|
29
29
|
const promptVariables_1 = require("./lib/promptVariables");
|
|
30
30
|
const promptText_1 = require("./lib/promptText");
|
|
31
|
+
const folder_1 = require("./lib/folder");
|
|
31
32
|
const mcpPrompts_1 = require("./lib/mcpPrompts");
|
|
32
33
|
const resources_1 = require("./lib/resources");
|
|
33
34
|
const writeTools_1 = require("./lib/writeTools");
|
|
@@ -78,6 +79,8 @@ function summarize(p) {
|
|
|
78
79
|
id: p.id,
|
|
79
80
|
title: p.title,
|
|
80
81
|
description: p.description ?? null,
|
|
82
|
+
repo: p.project_name ?? null,
|
|
83
|
+
folder: p.folder ?? null,
|
|
81
84
|
updated_at: p.updated_at,
|
|
82
85
|
variables: (0, promptVariables_1.extractVariables)((0, promptText_1.versionText)(p.current_version)),
|
|
83
86
|
};
|
|
@@ -369,16 +372,28 @@ function createServer(options = {}) {
|
|
|
369
372
|
server.registerTool('list_prompts', {
|
|
370
373
|
title: 'List prompts',
|
|
371
374
|
description: "List the user's saved prompts from their PromptLikeEngineer library. " +
|
|
372
|
-
'Optionally filter by tag
|
|
375
|
+
'Optionally filter by tag, repo (`project`) or `folder`. Returns id, title, description, repo, folder, updated_at and ' +
|
|
373
376
|
'the {{variable}} names each prompt expects. Paged: `total` is the full count, ' +
|
|
374
377
|
'and when `has_more` is true call again with `page` + 1.',
|
|
375
378
|
inputSchema: {
|
|
376
379
|
tag: zod_1.z.string().optional().describe('Filter by tag name'),
|
|
380
|
+
project: zod_1.z.string().min(1).optional().describe('Only prompts of this repo (name, slug or id)'),
|
|
381
|
+
folder: zod_1.z.string().min(1).optional().describe('Only prompts in this folder and the folders under it, e.g. reviews or reviews/backend'),
|
|
377
382
|
limit: zod_1.z.number().int().min(1).max(100).optional().describe('Results per page (default 50)'),
|
|
378
383
|
page: zod_1.z.number().int().min(1).optional().describe('Page number, 1-based (default 1)'),
|
|
379
384
|
},
|
|
380
385
|
annotations: READ_ONLY,
|
|
381
|
-
}, async ({ tag, limit, page }) => guarded(async () =>
|
|
386
|
+
}, async ({ tag, project, folder, limit, page }) => guarded(async () => {
|
|
387
|
+
let normalized;
|
|
388
|
+
if (folder !== undefined) {
|
|
389
|
+
const parsed = (0, folder_1.normalizeFolder)(folder);
|
|
390
|
+
if ('error' in parsed)
|
|
391
|
+
return fail(parsed.error);
|
|
392
|
+
normalized = parsed.value ?? undefined;
|
|
393
|
+
}
|
|
394
|
+
const projectId = project ? await (0, resolver_1.resolveProjectId)(project) : undefined;
|
|
395
|
+
return ok(await fetchPromptPage({ tag, projectId, folder: normalized, limit: limit ?? 50, page: page ?? 1 }));
|
|
396
|
+
}));
|
|
382
397
|
server.registerTool('search_prompts', {
|
|
383
398
|
title: 'Search prompts',
|
|
384
399
|
description: "Search the user's prompt library by title and description. " +
|
|
@@ -432,8 +447,9 @@ function createServer(options = {}) {
|
|
|
432
447
|
server.registerTool('fill_variables', {
|
|
433
448
|
title: 'Fill prompt variables',
|
|
434
449
|
description: 'Fetch a prompt and substitute its {{variable}} placeholders with the given ' +
|
|
435
|
-
'values, returning ready-to-use text.
|
|
436
|
-
'
|
|
450
|
+
'values, returning ready-to-use text. Empty or unset ones stay as {{name}} in the ' +
|
|
451
|
+
'output (missing_variables); names you passed that the prompt does not have are ' +
|
|
452
|
+
'ignored and listed in unknown_variables, so check it before relying on the text.',
|
|
437
453
|
inputSchema: {
|
|
438
454
|
name: zod_1.z.string().min(1).describe('Prompt title, id, or unique title fragment'),
|
|
439
455
|
variables: zod_1.z.record(zod_1.z.string()).describe('Variable name → value map'),
|
|
@@ -455,12 +471,19 @@ function createServer(options = {}) {
|
|
|
455
471
|
const raw = (0, promptText_1.versionText)(picked);
|
|
456
472
|
const filled = (0, promptVariables_1.fillVariables)(raw, variables);
|
|
457
473
|
const missing = (0, promptVariables_1.extractVariables)(filled);
|
|
474
|
+
// Yanlış adla doldurup "doldurdum" denmesin: prompt'ta olmayan adlar sessizce yok sayılmaz.
|
|
475
|
+
const known = new Set((0, promptVariables_1.extractVariables)(raw));
|
|
476
|
+
const unknown = Object.keys(variables).filter((k) => !known.has(k));
|
|
458
477
|
(0, api_client_1.recordPromptUse)(prompt.id, useOptions(server, 'mcp_tool', { version: picked.version_number }));
|
|
459
478
|
return ok({
|
|
460
479
|
id: prompt.id,
|
|
461
480
|
title: prompt.title,
|
|
462
481
|
version: picked.version_number ?? null,
|
|
463
482
|
missing_variables: missing,
|
|
483
|
+
unknown_variables: unknown,
|
|
484
|
+
...(unknown.length > 0
|
|
485
|
+
? { warning: `Not in this prompt, so ignored: ${unknown.join(', ')}. Its variables: ${[...known].join(', ') || 'none'}.` }
|
|
486
|
+
: {}),
|
|
464
487
|
content: filled,
|
|
465
488
|
});
|
|
466
489
|
}));
|
|
@@ -502,6 +525,7 @@ function createServer(options = {}) {
|
|
|
502
525
|
content: zod_1.z.string().min(1).max(writeGuard_1.MAX_CONTENT).describe('The prompt text; use {{variable}} placeholders'),
|
|
503
526
|
description: zod_1.z.string().max(writeGuard_1.MAX_DESCRIPTION).optional().describe('One-line description'),
|
|
504
527
|
project: zod_1.z.string().min(1).optional().describe('Repo name, slug, or id (default: most recently updated repo you can write to)'),
|
|
528
|
+
folder: zod_1.z.string().max(200).optional().describe('Folder inside the repo, e.g. reviews/backend (up to 3 levels, 64 characters each). Omit for the repo root'),
|
|
505
529
|
tags: zod_1.z.array(zod_1.z.string().min(1).max(writeGuard_1.MAX_TAG_LENGTH)).max(writeGuard_1.MAX_TAGS).optional().describe('Tag names'),
|
|
506
530
|
},
|
|
507
531
|
annotations: WRITE,
|
|
@@ -555,6 +579,30 @@ function createServer(options = {}) {
|
|
|
555
579
|
afterWrite(server, catalog);
|
|
556
580
|
return fromOutcome(outcome);
|
|
557
581
|
}));
|
|
582
|
+
server.registerTool('move_prompt', {
|
|
583
|
+
title: 'Move a prompt to another repo or folder',
|
|
584
|
+
description: 'Move ONE prompt to another repo and/or folder. `name` must be the exact title or the id. Its versions, ' +
|
|
585
|
+
'deployment labels, stars, usage and its /p/ short link stay with it; tags are matched by name in the target ' +
|
|
586
|
+
'repo (created if missing). `to_project` = target repo (omit to stay in the same repo; then pass `folder`). ' +
|
|
587
|
+
'`folder` = target folder like reviews/backend (omit: kept in the same repo, repo root in another; "" = the repo root). ' +
|
|
588
|
+
'Refused, with nothing moved, when the target repo already has a prompt with that title, or when the move changes ' +
|
|
589
|
+
'who can see the prompt (public <-> private repo): ask the user, and only if they agree call again with ' +
|
|
590
|
+
'confirm_visibility: true. Moving to where it already is changes nothing. Needs editor or owner on both repos. ' +
|
|
591
|
+
'This tool never deletes a prompt, a version or a tag.',
|
|
592
|
+
inputSchema: {
|
|
593
|
+
name: zod_1.z.string().min(1).describe('Exact prompt title, or its id / short id'),
|
|
594
|
+
to_project: zod_1.z.string().min(1).optional().describe('Target repo name, slug or id (omit to stay in the same repo)'),
|
|
595
|
+
folder: zod_1.z.string().max(200).optional().describe('Target folder, e.g. reviews/backend; "" for the repo root; omit to keep it (same repo) or use the root (another repo)'),
|
|
596
|
+
project: zod_1.z.string().min(1).optional().describe('Repo name, slug, or id to find the prompt in when titles collide'),
|
|
597
|
+
confirm_visibility: zod_1.z.boolean().optional().describe('true only after the user agreed to a move that changes who can see the prompt'),
|
|
598
|
+
},
|
|
599
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
600
|
+
}, async (args) => guarded(async () => {
|
|
601
|
+
const outcome = await (0, writeTools_1.movePromptFlow)(args);
|
|
602
|
+
if (outcome.ok && outcome.payload.status === 'moved')
|
|
603
|
+
afterWrite(server, catalog);
|
|
604
|
+
return fromOutcome(outcome);
|
|
605
|
+
}));
|
|
558
606
|
server.registerTool('submit_feedback', {
|
|
559
607
|
title: 'Send feedback to the PromptLikeEngineer maker',
|
|
560
608
|
description: 'Call this when a PromptLikeEngineer tool is missing, broken, confusing or returned a wrong result, ' +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "promptlike-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"mcpName": "io.github.zeynepaslierhan/promptlike-mcp",
|
|
5
5
|
"description": "MCP server for PromptLikeEngineer - your prompt library as MCP tools, slash-command prompts and @-resources: list, search, get, fill {{variables}}, suggest, and save new prompts/versions (add-only).",
|
|
6
6
|
"bin": {
|