@hasna/prompts 0.3.0 → 0.3.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/dist/cli/index.js +2 -2
- package/dist/db/prompts.d.ts +4 -1
- package/dist/db/prompts.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -2
- package/dist/lib/search.d.ts +3 -1
- package/dist/lib/search.d.ts.map +1 -1
- package/dist/mcp/index.js +199 -25
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +164 -10
- package/dist/types/index.d.ts +49 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2595,7 +2595,7 @@ function listPrompts(filter = {}) {
|
|
|
2595
2595
|
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
2596
2596
|
}
|
|
2597
2597
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
2598
|
-
const limit = filter.limit ??
|
|
2598
|
+
const limit = filter.limit ?? 20;
|
|
2599
2599
|
const offset = filter.offset ?? 0;
|
|
2600
2600
|
const rows = db.query(`SELECT * FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
2601
2601
|
return rows.map(rowToPrompt);
|
|
@@ -3087,7 +3087,7 @@ function searchPrompts(query, filter = {}) {
|
|
|
3087
3087
|
const rows = db.query(`SELECT *, 1 as score FROM prompts
|
|
3088
3088
|
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
3089
3089
|
ORDER BY use_count DESC, updated_at DESC
|
|
3090
|
-
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ??
|
|
3090
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
3091
3091
|
return rows.map((r) => rowToSearchResult(r));
|
|
3092
3092
|
}
|
|
3093
3093
|
function findSimilar(promptId, limit = 5) {
|
package/dist/db/prompts.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { Prompt, CreatePromptInput, UpdatePromptInput, ListPromptsFilter } from "../types/index.js";
|
|
1
|
+
import type { Prompt, SlimPrompt, SaveResult, CreatePromptInput, UpdatePromptInput, ListPromptsFilter } from "../types/index.js";
|
|
2
|
+
export declare function promptToSaveResult(prompt: Prompt, created: boolean, duplicate_warning?: string | null): SaveResult;
|
|
2
3
|
export declare function createPrompt(input: CreatePromptInput): Prompt;
|
|
3
4
|
export declare function getPrompt(idOrSlug: string): Prompt | null;
|
|
4
5
|
export declare function requirePrompt(idOrSlug: string): Prompt;
|
|
5
6
|
export declare function listPrompts(filter?: ListPromptsFilter): Prompt[];
|
|
7
|
+
/** Slim version of listPrompts — no body, no full variables. Default for MCP listing. */
|
|
8
|
+
export declare function listPromptsSlim(filter?: ListPromptsFilter): SlimPrompt[];
|
|
6
9
|
export declare function updatePrompt(idOrSlug: string, input: UpdatePromptInput): Prompt;
|
|
7
10
|
export declare function deletePrompt(idOrSlug: string): void;
|
|
8
11
|
export declare function usePrompt(idOrSlug: string): Prompt;
|
package/dist/db/prompts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/db/prompts.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,MAAM,EACN,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EAGlB,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/db/prompts.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EAG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MAAM,CAKnE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,UAAQ,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAE,CA6BtI;AAED,wBAAgB,cAAc;;;;;YAOJ,MAAM;cAAQ,MAAM;cAAQ,MAAM;eAAS,MAAM;mBAAa,MAAM;;;YAGpE,MAAM;cAAQ,MAAM;cAAQ,MAAM;eAAS,MAAM;sBAAgB,MAAM;;;oBAG/D,MAAM;eAAS,MAAM;;;gBAGzB,MAAM;eAAS,MAAM;;EAGlD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export { createPrompt, getPrompt, requirePrompt, listPrompts, updatePrompt, deletePrompt, usePrompt, upsertPrompt, getPromptStats, pinPrompt, setNextPrompt } from "./db/prompts.js";
|
|
1
|
+
export { createPrompt, getPrompt, listPromptsSlim, promptToSaveResult, requirePrompt, listPrompts, updatePrompt, deletePrompt, usePrompt, upsertPrompt, getPromptStats, pinPrompt, setNextPrompt } from "./db/prompts.js";
|
|
2
2
|
export { listVersions, getVersion, restoreVersion } from "./db/versions.js";
|
|
3
3
|
export { listCollections, getCollection, ensureCollection, movePrompt } from "./db/collections.js";
|
|
4
4
|
export { registerAgent, listAgents } from "./db/agents.js";
|
|
5
5
|
export { getDatabase, getDbPath } from "./db/database.js";
|
|
6
6
|
export { createProject, getProject, listProjects, deleteProject } from "./db/projects.js";
|
|
7
|
-
export { searchPrompts, findSimilar } from "./lib/search.js";
|
|
7
|
+
export { searchPrompts, searchPromptsSlim, findSimilar } from "./lib/search.js";
|
|
8
8
|
export { extractVariables, extractVariableInfo, renderTemplate, validateVars } from "./lib/template.js";
|
|
9
9
|
export type { VariableInfo } from "./lib/template.js";
|
|
10
10
|
export { importFromJson, exportToJson } from "./lib/importer.js";
|
|
11
11
|
export { findDuplicates } from "./lib/duplicates.js";
|
|
12
12
|
export type { DuplicateMatch } from "./lib/duplicates.js";
|
|
13
13
|
export { generateSlug, uniqueSlug, generatePromptId } from "./lib/ids.js";
|
|
14
|
-
export type { Prompt, PromptVersion, Collection, Agent, Project, TemplateVariable, PromptSource, CreatePromptInput, UpdatePromptInput, ListPromptsFilter, SearchResult, RenderResult, PromptStats, } from "./types/index.js";
|
|
14
|
+
export type { Prompt, SlimPrompt, SaveResult, SlimSearchResult, PromptVersion, Collection, Agent, Project, TemplateVariable, PromptSource, CreatePromptInput, UpdatePromptInput, ListPromptsFilter, SearchResult, RenderResult, PromptStats, } from "./types/index.js";
|
|
15
15
|
export { PromptNotFoundError, VersionConflictError, DuplicateSlugError, TemplateRenderError, ProjectNotFoundError, } from "./types/index.js";
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACzN,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC3E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAClG,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGzF,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG/E,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACvG,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGrD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAGzD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAGzE,YAAY,EACV,MAAM,EACN,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,KAAK,EACL,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -439,6 +439,40 @@ class ProjectNotFoundError extends Error {
|
|
|
439
439
|
}
|
|
440
440
|
|
|
441
441
|
// src/db/prompts.ts
|
|
442
|
+
function rowToSlimPrompt(row) {
|
|
443
|
+
const variables = JSON.parse(row["variables"] || "[]");
|
|
444
|
+
return {
|
|
445
|
+
id: row["id"],
|
|
446
|
+
slug: row["slug"],
|
|
447
|
+
title: row["title"],
|
|
448
|
+
description: row["description"] ?? null,
|
|
449
|
+
collection: row["collection"],
|
|
450
|
+
tags: JSON.parse(row["tags"] || "[]"),
|
|
451
|
+
variable_names: variables.map((v) => v.name),
|
|
452
|
+
is_template: Boolean(row["is_template"]),
|
|
453
|
+
source: row["source"],
|
|
454
|
+
pinned: Boolean(row["pinned"]),
|
|
455
|
+
next_prompt: row["next_prompt"] ?? null,
|
|
456
|
+
expires_at: row["expires_at"] ?? null,
|
|
457
|
+
project_id: row["project_id"] ?? null,
|
|
458
|
+
use_count: row["use_count"],
|
|
459
|
+
last_used_at: row["last_used_at"] ?? null,
|
|
460
|
+
created_at: row["created_at"],
|
|
461
|
+
updated_at: row["updated_at"]
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
function promptToSaveResult(prompt, created, duplicate_warning) {
|
|
465
|
+
return {
|
|
466
|
+
id: prompt.id,
|
|
467
|
+
slug: prompt.slug,
|
|
468
|
+
title: prompt.title,
|
|
469
|
+
collection: prompt.collection,
|
|
470
|
+
is_template: prompt.is_template,
|
|
471
|
+
variable_names: prompt.variables.map((v) => v.name),
|
|
472
|
+
created,
|
|
473
|
+
duplicate_warning: duplicate_warning ?? null
|
|
474
|
+
};
|
|
475
|
+
}
|
|
442
476
|
function rowToPrompt(row) {
|
|
443
477
|
return {
|
|
444
478
|
id: row["id"],
|
|
@@ -533,11 +567,45 @@ function listPrompts(filter = {}) {
|
|
|
533
567
|
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
534
568
|
}
|
|
535
569
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
536
|
-
const limit = filter.limit ??
|
|
570
|
+
const limit = filter.limit ?? 20;
|
|
537
571
|
const offset = filter.offset ?? 0;
|
|
538
572
|
const rows = db.query(`SELECT * FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
539
573
|
return rows.map(rowToPrompt);
|
|
540
574
|
}
|
|
575
|
+
function listPromptsSlim(filter = {}) {
|
|
576
|
+
const db = getDatabase();
|
|
577
|
+
const conditions = [];
|
|
578
|
+
const params = [];
|
|
579
|
+
if (filter.collection) {
|
|
580
|
+
conditions.push("collection = ?");
|
|
581
|
+
params.push(filter.collection);
|
|
582
|
+
}
|
|
583
|
+
if (filter.is_template !== undefined) {
|
|
584
|
+
conditions.push("is_template = ?");
|
|
585
|
+
params.push(filter.is_template ? 1 : 0);
|
|
586
|
+
}
|
|
587
|
+
if (filter.source) {
|
|
588
|
+
conditions.push("source = ?");
|
|
589
|
+
params.push(filter.source);
|
|
590
|
+
}
|
|
591
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
592
|
+
const tagConds = filter.tags.map(() => "tags LIKE ?");
|
|
593
|
+
conditions.push(`(${tagConds.join(" OR ")})`);
|
|
594
|
+
for (const tag of filter.tags)
|
|
595
|
+
params.push(`%"${tag}"%`);
|
|
596
|
+
}
|
|
597
|
+
let orderBy = "pinned DESC, use_count DESC, updated_at DESC";
|
|
598
|
+
if (filter.project_id) {
|
|
599
|
+
conditions.push("(project_id = ? OR project_id IS NULL)");
|
|
600
|
+
params.push(filter.project_id);
|
|
601
|
+
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
602
|
+
}
|
|
603
|
+
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
604
|
+
const limit = filter.limit ?? 20;
|
|
605
|
+
const offset = filter.offset ?? 0;
|
|
606
|
+
const rows = db.query(`SELECT id, slug, name, title, description, collection, tags, variables, is_template, source, pinned, next_prompt, expires_at, project_id, use_count, last_used_at, created_at, updated_at FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
607
|
+
return rows.map(rowToSlimPrompt);
|
|
608
|
+
}
|
|
541
609
|
function updatePrompt(idOrSlug, input) {
|
|
542
610
|
const db = getDatabase();
|
|
543
611
|
const prompt = requirePrompt(idOrSlug);
|
|
@@ -751,6 +819,22 @@ function deleteProject(idOrSlug) {
|
|
|
751
819
|
db.run("DELETE FROM projects WHERE id = ?", [id]);
|
|
752
820
|
}
|
|
753
821
|
// src/lib/search.ts
|
|
822
|
+
function rowToSlimSearchResult(row, snippet) {
|
|
823
|
+
const variables = JSON.parse(row["variables"] || "[]");
|
|
824
|
+
return {
|
|
825
|
+
id: row["id"],
|
|
826
|
+
slug: row["slug"],
|
|
827
|
+
title: row["title"],
|
|
828
|
+
description: row["description"] ?? null,
|
|
829
|
+
collection: row["collection"],
|
|
830
|
+
tags: JSON.parse(row["tags"] || "[]"),
|
|
831
|
+
variable_names: variables.map((v) => v.name),
|
|
832
|
+
is_template: Boolean(row["is_template"]),
|
|
833
|
+
use_count: row["use_count"],
|
|
834
|
+
score: row["score"] ?? 1,
|
|
835
|
+
snippet
|
|
836
|
+
};
|
|
837
|
+
}
|
|
754
838
|
function rowToSearchResult(row, snippet) {
|
|
755
839
|
return {
|
|
756
840
|
prompt: {
|
|
@@ -833,9 +917,75 @@ function searchPrompts(query, filter = {}) {
|
|
|
833
917
|
const rows = db.query(`SELECT *, 1 as score FROM prompts
|
|
834
918
|
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
835
919
|
ORDER BY use_count DESC, updated_at DESC
|
|
836
|
-
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ??
|
|
920
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
837
921
|
return rows.map((r) => rowToSearchResult(r));
|
|
838
922
|
}
|
|
923
|
+
function searchPromptsSlim(query, filter = {}) {
|
|
924
|
+
const db = getDatabase();
|
|
925
|
+
if (!query.trim()) {
|
|
926
|
+
return listPromptsSlim(filter).map((p) => ({
|
|
927
|
+
id: p.id,
|
|
928
|
+
slug: p.slug,
|
|
929
|
+
title: p.title,
|
|
930
|
+
description: p.description,
|
|
931
|
+
collection: p.collection,
|
|
932
|
+
tags: p.tags,
|
|
933
|
+
variable_names: p.variable_names,
|
|
934
|
+
is_template: p.is_template,
|
|
935
|
+
use_count: p.use_count,
|
|
936
|
+
score: 1
|
|
937
|
+
}));
|
|
938
|
+
}
|
|
939
|
+
if (hasFts(db)) {
|
|
940
|
+
const ftsQuery = escapeFtsQuery(query);
|
|
941
|
+
const conditions = [];
|
|
942
|
+
const params = [];
|
|
943
|
+
if (filter.collection) {
|
|
944
|
+
conditions.push("p.collection = ?");
|
|
945
|
+
params.push(filter.collection);
|
|
946
|
+
}
|
|
947
|
+
if (filter.is_template !== undefined) {
|
|
948
|
+
conditions.push("p.is_template = ?");
|
|
949
|
+
params.push(filter.is_template ? 1 : 0);
|
|
950
|
+
}
|
|
951
|
+
if (filter.source) {
|
|
952
|
+
conditions.push("p.source = ?");
|
|
953
|
+
params.push(filter.source);
|
|
954
|
+
}
|
|
955
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
956
|
+
const tagConds = filter.tags.map(() => "p.tags LIKE ?");
|
|
957
|
+
conditions.push(`(${tagConds.join(" OR ")})`);
|
|
958
|
+
for (const tag of filter.tags)
|
|
959
|
+
params.push(`%"${tag}"%`);
|
|
960
|
+
}
|
|
961
|
+
if (filter.project_id) {
|
|
962
|
+
conditions.push("(p.project_id = ? OR p.project_id IS NULL)");
|
|
963
|
+
params.push(filter.project_id);
|
|
964
|
+
}
|
|
965
|
+
const where = conditions.length > 0 ? `AND ${conditions.join(" AND ")}` : "";
|
|
966
|
+
const limit = filter.limit ?? 10;
|
|
967
|
+
const offset = filter.offset ?? 0;
|
|
968
|
+
try {
|
|
969
|
+
const rows2 = db.query(`SELECT p.id, p.slug, p.name, p.title, p.description, p.collection, p.tags, p.variables,
|
|
970
|
+
p.is_template, p.use_count, bm25(prompts_fts) as score,
|
|
971
|
+
snippet(prompts_fts, 2, '[', ']', '...', 10) as snippet
|
|
972
|
+
FROM prompts p
|
|
973
|
+
INNER JOIN prompts_fts ON prompts_fts.rowid = p.rowid
|
|
974
|
+
WHERE prompts_fts MATCH ?
|
|
975
|
+
${where}
|
|
976
|
+
ORDER BY bm25(prompts_fts)
|
|
977
|
+
LIMIT ? OFFSET ?`).all(ftsQuery, ...params, limit, offset);
|
|
978
|
+
return rows2.map((r) => rowToSlimSearchResult(r, r["snippet"]));
|
|
979
|
+
} catch {}
|
|
980
|
+
}
|
|
981
|
+
const like = `%${query}%`;
|
|
982
|
+
const rows = db.query(`SELECT id, slug, name, title, description, collection, tags, variables, is_template, use_count, 1 as score
|
|
983
|
+
FROM prompts
|
|
984
|
+
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
985
|
+
ORDER BY use_count DESC, updated_at DESC
|
|
986
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
987
|
+
return rows.map((r) => rowToSlimSearchResult(r));
|
|
988
|
+
}
|
|
839
989
|
function findSimilar(promptId, limit = 5) {
|
|
840
990
|
const db = getDatabase();
|
|
841
991
|
const prompt = db.query("SELECT * FROM prompts WHERE id = ?").get(promptId);
|
|
@@ -895,14 +1045,17 @@ export {
|
|
|
895
1045
|
updatePrompt,
|
|
896
1046
|
uniqueSlug,
|
|
897
1047
|
setNextPrompt,
|
|
1048
|
+
searchPromptsSlim,
|
|
898
1049
|
searchPrompts,
|
|
899
1050
|
restoreVersion,
|
|
900
1051
|
requirePrompt,
|
|
901
1052
|
renderTemplate,
|
|
902
1053
|
registerAgent,
|
|
1054
|
+
promptToSaveResult,
|
|
903
1055
|
pinPrompt,
|
|
904
1056
|
movePrompt,
|
|
905
1057
|
listVersions,
|
|
1058
|
+
listPromptsSlim,
|
|
906
1059
|
listPrompts,
|
|
907
1060
|
listProjects,
|
|
908
1061
|
listCollections,
|
package/dist/lib/search.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { SearchResult, ListPromptsFilter } from "../types/index.js";
|
|
1
|
+
import type { SlimSearchResult, SearchResult, ListPromptsFilter } from "../types/index.js";
|
|
2
2
|
export declare function searchPrompts(query: string, filter?: Omit<ListPromptsFilter, "q">): SearchResult[];
|
|
3
|
+
/** Slim search — returns only metadata + snippet, no body. Default for MCP. */
|
|
4
|
+
export declare function searchPromptsSlim(query: string, filter?: Omit<ListPromptsFilter, "q">): SlimSearchResult[];
|
|
3
5
|
export declare function findSimilar(promptId: string, limit?: number): SearchResult[];
|
|
4
6
|
//# sourceMappingURL=search.d.ts.map
|
package/dist/lib/search.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/lib/search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/lib/search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AA4D1F,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAM,GACxC,YAAY,EAAE,CAwEhB;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAM,GACxC,gBAAgB,EAAE,CA2DpB;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,YAAY,EAAE,CAmCvE"}
|
package/dist/mcp/index.js
CHANGED
|
@@ -4421,6 +4421,40 @@ class ProjectNotFoundError extends Error {
|
|
|
4421
4421
|
}
|
|
4422
4422
|
|
|
4423
4423
|
// src/db/prompts.ts
|
|
4424
|
+
function rowToSlimPrompt(row) {
|
|
4425
|
+
const variables = JSON.parse(row["variables"] || "[]");
|
|
4426
|
+
return {
|
|
4427
|
+
id: row["id"],
|
|
4428
|
+
slug: row["slug"],
|
|
4429
|
+
title: row["title"],
|
|
4430
|
+
description: row["description"] ?? null,
|
|
4431
|
+
collection: row["collection"],
|
|
4432
|
+
tags: JSON.parse(row["tags"] || "[]"),
|
|
4433
|
+
variable_names: variables.map((v) => v.name),
|
|
4434
|
+
is_template: Boolean(row["is_template"]),
|
|
4435
|
+
source: row["source"],
|
|
4436
|
+
pinned: Boolean(row["pinned"]),
|
|
4437
|
+
next_prompt: row["next_prompt"] ?? null,
|
|
4438
|
+
expires_at: row["expires_at"] ?? null,
|
|
4439
|
+
project_id: row["project_id"] ?? null,
|
|
4440
|
+
use_count: row["use_count"],
|
|
4441
|
+
last_used_at: row["last_used_at"] ?? null,
|
|
4442
|
+
created_at: row["created_at"],
|
|
4443
|
+
updated_at: row["updated_at"]
|
|
4444
|
+
};
|
|
4445
|
+
}
|
|
4446
|
+
function promptToSaveResult(prompt, created, duplicate_warning) {
|
|
4447
|
+
return {
|
|
4448
|
+
id: prompt.id,
|
|
4449
|
+
slug: prompt.slug,
|
|
4450
|
+
title: prompt.title,
|
|
4451
|
+
collection: prompt.collection,
|
|
4452
|
+
is_template: prompt.is_template,
|
|
4453
|
+
variable_names: prompt.variables.map((v) => v.name),
|
|
4454
|
+
created,
|
|
4455
|
+
duplicate_warning: duplicate_warning ?? null
|
|
4456
|
+
};
|
|
4457
|
+
}
|
|
4424
4458
|
function rowToPrompt(row) {
|
|
4425
4459
|
return {
|
|
4426
4460
|
id: row["id"],
|
|
@@ -4515,11 +4549,45 @@ function listPrompts(filter = {}) {
|
|
|
4515
4549
|
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
4516
4550
|
}
|
|
4517
4551
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
4518
|
-
const limit = filter.limit ??
|
|
4552
|
+
const limit = filter.limit ?? 20;
|
|
4519
4553
|
const offset = filter.offset ?? 0;
|
|
4520
4554
|
const rows = db.query(`SELECT * FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
4521
4555
|
return rows.map(rowToPrompt);
|
|
4522
4556
|
}
|
|
4557
|
+
function listPromptsSlim(filter = {}) {
|
|
4558
|
+
const db = getDatabase();
|
|
4559
|
+
const conditions = [];
|
|
4560
|
+
const params = [];
|
|
4561
|
+
if (filter.collection) {
|
|
4562
|
+
conditions.push("collection = ?");
|
|
4563
|
+
params.push(filter.collection);
|
|
4564
|
+
}
|
|
4565
|
+
if (filter.is_template !== undefined) {
|
|
4566
|
+
conditions.push("is_template = ?");
|
|
4567
|
+
params.push(filter.is_template ? 1 : 0);
|
|
4568
|
+
}
|
|
4569
|
+
if (filter.source) {
|
|
4570
|
+
conditions.push("source = ?");
|
|
4571
|
+
params.push(filter.source);
|
|
4572
|
+
}
|
|
4573
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
4574
|
+
const tagConds = filter.tags.map(() => "tags LIKE ?");
|
|
4575
|
+
conditions.push(`(${tagConds.join(" OR ")})`);
|
|
4576
|
+
for (const tag of filter.tags)
|
|
4577
|
+
params.push(`%"${tag}"%`);
|
|
4578
|
+
}
|
|
4579
|
+
let orderBy = "pinned DESC, use_count DESC, updated_at DESC";
|
|
4580
|
+
if (filter.project_id) {
|
|
4581
|
+
conditions.push("(project_id = ? OR project_id IS NULL)");
|
|
4582
|
+
params.push(filter.project_id);
|
|
4583
|
+
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
4584
|
+
}
|
|
4585
|
+
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
4586
|
+
const limit = filter.limit ?? 20;
|
|
4587
|
+
const offset = filter.offset ?? 0;
|
|
4588
|
+
const rows = db.query(`SELECT id, slug, name, title, description, collection, tags, variables, is_template, source, pinned, next_prompt, expires_at, project_id, use_count, last_used_at, created_at, updated_at FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
4589
|
+
return rows.map(rowToSlimPrompt);
|
|
4590
|
+
}
|
|
4523
4591
|
function updatePrompt(idOrSlug, input) {
|
|
4524
4592
|
const db = getDatabase();
|
|
4525
4593
|
const prompt = requirePrompt(idOrSlug);
|
|
@@ -4749,6 +4817,22 @@ function deleteProject(idOrSlug) {
|
|
|
4749
4817
|
}
|
|
4750
4818
|
|
|
4751
4819
|
// src/lib/search.ts
|
|
4820
|
+
function rowToSlimSearchResult(row, snippet) {
|
|
4821
|
+
const variables = JSON.parse(row["variables"] || "[]");
|
|
4822
|
+
return {
|
|
4823
|
+
id: row["id"],
|
|
4824
|
+
slug: row["slug"],
|
|
4825
|
+
title: row["title"],
|
|
4826
|
+
description: row["description"] ?? null,
|
|
4827
|
+
collection: row["collection"],
|
|
4828
|
+
tags: JSON.parse(row["tags"] || "[]"),
|
|
4829
|
+
variable_names: variables.map((v) => v.name),
|
|
4830
|
+
is_template: Boolean(row["is_template"]),
|
|
4831
|
+
use_count: row["use_count"],
|
|
4832
|
+
score: row["score"] ?? 1,
|
|
4833
|
+
snippet
|
|
4834
|
+
};
|
|
4835
|
+
}
|
|
4752
4836
|
function rowToSearchResult(row, snippet) {
|
|
4753
4837
|
return {
|
|
4754
4838
|
prompt: {
|
|
@@ -4831,9 +4915,75 @@ function searchPrompts(query, filter = {}) {
|
|
|
4831
4915
|
const rows = db.query(`SELECT *, 1 as score FROM prompts
|
|
4832
4916
|
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
4833
4917
|
ORDER BY use_count DESC, updated_at DESC
|
|
4834
|
-
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ??
|
|
4918
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
4835
4919
|
return rows.map((r) => rowToSearchResult(r));
|
|
4836
4920
|
}
|
|
4921
|
+
function searchPromptsSlim(query, filter = {}) {
|
|
4922
|
+
const db = getDatabase();
|
|
4923
|
+
if (!query.trim()) {
|
|
4924
|
+
return listPromptsSlim(filter).map((p) => ({
|
|
4925
|
+
id: p.id,
|
|
4926
|
+
slug: p.slug,
|
|
4927
|
+
title: p.title,
|
|
4928
|
+
description: p.description,
|
|
4929
|
+
collection: p.collection,
|
|
4930
|
+
tags: p.tags,
|
|
4931
|
+
variable_names: p.variable_names,
|
|
4932
|
+
is_template: p.is_template,
|
|
4933
|
+
use_count: p.use_count,
|
|
4934
|
+
score: 1
|
|
4935
|
+
}));
|
|
4936
|
+
}
|
|
4937
|
+
if (hasFts(db)) {
|
|
4938
|
+
const ftsQuery = escapeFtsQuery(query);
|
|
4939
|
+
const conditions = [];
|
|
4940
|
+
const params = [];
|
|
4941
|
+
if (filter.collection) {
|
|
4942
|
+
conditions.push("p.collection = ?");
|
|
4943
|
+
params.push(filter.collection);
|
|
4944
|
+
}
|
|
4945
|
+
if (filter.is_template !== undefined) {
|
|
4946
|
+
conditions.push("p.is_template = ?");
|
|
4947
|
+
params.push(filter.is_template ? 1 : 0);
|
|
4948
|
+
}
|
|
4949
|
+
if (filter.source) {
|
|
4950
|
+
conditions.push("p.source = ?");
|
|
4951
|
+
params.push(filter.source);
|
|
4952
|
+
}
|
|
4953
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
4954
|
+
const tagConds = filter.tags.map(() => "p.tags LIKE ?");
|
|
4955
|
+
conditions.push(`(${tagConds.join(" OR ")})`);
|
|
4956
|
+
for (const tag of filter.tags)
|
|
4957
|
+
params.push(`%"${tag}"%`);
|
|
4958
|
+
}
|
|
4959
|
+
if (filter.project_id) {
|
|
4960
|
+
conditions.push("(p.project_id = ? OR p.project_id IS NULL)");
|
|
4961
|
+
params.push(filter.project_id);
|
|
4962
|
+
}
|
|
4963
|
+
const where = conditions.length > 0 ? `AND ${conditions.join(" AND ")}` : "";
|
|
4964
|
+
const limit = filter.limit ?? 10;
|
|
4965
|
+
const offset = filter.offset ?? 0;
|
|
4966
|
+
try {
|
|
4967
|
+
const rows2 = db.query(`SELECT p.id, p.slug, p.name, p.title, p.description, p.collection, p.tags, p.variables,
|
|
4968
|
+
p.is_template, p.use_count, bm25(prompts_fts) as score,
|
|
4969
|
+
snippet(prompts_fts, 2, '[', ']', '...', 10) as snippet
|
|
4970
|
+
FROM prompts p
|
|
4971
|
+
INNER JOIN prompts_fts ON prompts_fts.rowid = p.rowid
|
|
4972
|
+
WHERE prompts_fts MATCH ?
|
|
4973
|
+
${where}
|
|
4974
|
+
ORDER BY bm25(prompts_fts)
|
|
4975
|
+
LIMIT ? OFFSET ?`).all(ftsQuery, ...params, limit, offset);
|
|
4976
|
+
return rows2.map((r) => rowToSlimSearchResult(r, r["snippet"]));
|
|
4977
|
+
} catch {}
|
|
4978
|
+
}
|
|
4979
|
+
const like = `%${query}%`;
|
|
4980
|
+
const rows = db.query(`SELECT id, slug, name, title, description, collection, tags, variables, is_template, use_count, 1 as score
|
|
4981
|
+
FROM prompts
|
|
4982
|
+
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
4983
|
+
ORDER BY use_count DESC, updated_at DESC
|
|
4984
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
4985
|
+
return rows.map((r) => rowToSlimSearchResult(r));
|
|
4986
|
+
}
|
|
4837
4987
|
function findSimilar(promptId, limit = 5) {
|
|
4838
4988
|
const db = getDatabase();
|
|
4839
4989
|
const prompt = db.query("SELECT * FROM prompts WHERE id = ?").get(promptId);
|
|
@@ -5169,7 +5319,7 @@ server.registerTool("prompts_save", {
|
|
|
5169
5319
|
input.project_id = pid;
|
|
5170
5320
|
}
|
|
5171
5321
|
const { prompt, created, duplicate_warning } = upsertPrompt(input, force ?? false);
|
|
5172
|
-
return ok(
|
|
5322
|
+
return ok(promptToSaveResult(prompt, created, duplicate_warning));
|
|
5173
5323
|
} catch (e) {
|
|
5174
5324
|
return err(e instanceof Error ? e.message : String(e));
|
|
5175
5325
|
}
|
|
@@ -5184,25 +5334,44 @@ server.registerTool("prompts_get", {
|
|
|
5184
5334
|
return ok(prompt);
|
|
5185
5335
|
});
|
|
5186
5336
|
server.registerTool("prompts_list", {
|
|
5187
|
-
description: "List prompts
|
|
5337
|
+
description: "List prompts (slim by default \u2014 no body). Use prompts_use or prompts_body to get the actual body. Pass include_body:true only if you need body text for all results. summary_only:true returns just id+slug+title for maximum token savings.",
|
|
5188
5338
|
inputSchema: {
|
|
5189
5339
|
collection: exports_external.string().optional(),
|
|
5190
5340
|
tags: exports_external.array(exports_external.string()).optional(),
|
|
5191
5341
|
is_template: exports_external.boolean().optional(),
|
|
5192
5342
|
source: exports_external.enum(["manual", "ai-session", "imported"]).optional(),
|
|
5193
|
-
limit: exports_external.number().optional().default(
|
|
5343
|
+
limit: exports_external.number().optional().default(20),
|
|
5194
5344
|
offset: exports_external.number().optional().default(0),
|
|
5195
|
-
project: exports_external.string().optional().describe("Project name, slug, or ID
|
|
5345
|
+
project: exports_external.string().optional().describe("Project name, slug, or ID"),
|
|
5346
|
+
include_body: exports_external.boolean().optional().describe("Include full body text (expensive \u2014 avoid unless needed)"),
|
|
5347
|
+
summary_only: exports_external.boolean().optional().describe("Return only id+slug+title \u2014 maximum token savings")
|
|
5196
5348
|
}
|
|
5197
|
-
}, async ({ project, ...args }) => {
|
|
5349
|
+
}, async ({ project, include_body, summary_only, ...args }) => {
|
|
5350
|
+
let project_id;
|
|
5198
5351
|
if (project) {
|
|
5199
5352
|
const db = getDatabase();
|
|
5200
5353
|
const pid = resolveProject(db, project);
|
|
5201
5354
|
if (!pid)
|
|
5202
5355
|
return err(`Project not found: ${project}`);
|
|
5203
|
-
|
|
5356
|
+
project_id = pid;
|
|
5204
5357
|
}
|
|
5205
|
-
|
|
5358
|
+
const filter = { ...args, ...project_id ? { project_id } : {} };
|
|
5359
|
+
if (summary_only) {
|
|
5360
|
+
const items = listPromptsSlim(filter);
|
|
5361
|
+
return ok(items.map((p) => ({ id: p.id, slug: p.slug, title: p.title })));
|
|
5362
|
+
}
|
|
5363
|
+
if (include_body)
|
|
5364
|
+
return ok(listPrompts(filter));
|
|
5365
|
+
return ok(listPromptsSlim(filter));
|
|
5366
|
+
});
|
|
5367
|
+
server.registerTool("prompts_body", {
|
|
5368
|
+
description: "Get just the body text of a prompt without incrementing the use counter. Use prompts_use when you want to actually use a prompt (increments counter). Use this just to read/inspect the body.",
|
|
5369
|
+
inputSchema: { id: exports_external.string().describe("Prompt ID or slug") }
|
|
5370
|
+
}, async ({ id }) => {
|
|
5371
|
+
const prompt = getPrompt(id);
|
|
5372
|
+
if (!prompt)
|
|
5373
|
+
return err(`Prompt not found: ${id}`);
|
|
5374
|
+
return ok({ id: prompt.id, slug: prompt.slug, body: prompt.body, is_template: prompt.is_template, variable_names: prompt.variables.map((v) => v.name) });
|
|
5206
5375
|
});
|
|
5207
5376
|
server.registerTool("prompts_delete", {
|
|
5208
5377
|
description: "Delete a prompt by ID or slug.",
|
|
@@ -5254,7 +5423,7 @@ server.registerTool("prompts_list_templates", {
|
|
|
5254
5423
|
tags: exports_external.array(exports_external.string()).optional(),
|
|
5255
5424
|
limit: exports_external.number().optional().default(50)
|
|
5256
5425
|
}
|
|
5257
|
-
}, async (args) => ok(
|
|
5426
|
+
}, async (args) => ok(listPromptsSlim({ ...args, is_template: true })));
|
|
5258
5427
|
server.registerTool("prompts_variables", {
|
|
5259
5428
|
description: "Inspect what variables a template needs, including defaults and required status.",
|
|
5260
5429
|
inputSchema: { id: exports_external.string() }
|
|
@@ -5266,25 +5435,30 @@ server.registerTool("prompts_variables", {
|
|
|
5266
5435
|
return ok({ prompt_id: prompt.id, slug: prompt.slug, variables: vars });
|
|
5267
5436
|
});
|
|
5268
5437
|
server.registerTool("prompts_search", {
|
|
5269
|
-
description: "
|
|
5438
|
+
description: "Search prompts by text (FTS5 BM25). Returns slim results with snippet \u2014 no body. Use prompts_use/prompts_body to get the body of a result.",
|
|
5270
5439
|
inputSchema: {
|
|
5271
5440
|
q: exports_external.string().describe("Search query"),
|
|
5272
5441
|
collection: exports_external.string().optional(),
|
|
5273
5442
|
tags: exports_external.array(exports_external.string()).optional(),
|
|
5274
5443
|
is_template: exports_external.boolean().optional(),
|
|
5275
5444
|
source: exports_external.enum(["manual", "ai-session", "imported"]).optional(),
|
|
5276
|
-
limit: exports_external.number().optional().default(
|
|
5277
|
-
project: exports_external.string().optional()
|
|
5445
|
+
limit: exports_external.number().optional().default(10),
|
|
5446
|
+
project: exports_external.string().optional(),
|
|
5447
|
+
include_body: exports_external.boolean().optional().describe("Include full body in results (expensive)")
|
|
5278
5448
|
}
|
|
5279
|
-
}, async ({ q, project, ...filter }) => {
|
|
5449
|
+
}, async ({ q, project, include_body, ...filter }) => {
|
|
5450
|
+
let project_id;
|
|
5280
5451
|
if (project) {
|
|
5281
5452
|
const db = getDatabase();
|
|
5282
5453
|
const pid = resolveProject(db, project);
|
|
5283
5454
|
if (!pid)
|
|
5284
5455
|
return err(`Project not found: ${project}`);
|
|
5285
|
-
|
|
5456
|
+
project_id = pid;
|
|
5286
5457
|
}
|
|
5287
|
-
|
|
5458
|
+
const f = { ...filter, ...project_id ? { project_id } : {} };
|
|
5459
|
+
if (include_body)
|
|
5460
|
+
return ok(searchPrompts(q, f));
|
|
5461
|
+
return ok(searchPromptsSlim(q, f));
|
|
5288
5462
|
});
|
|
5289
5463
|
server.registerTool("prompts_similar", {
|
|
5290
5464
|
description: "Find prompts similar to a given prompt (by tag overlap and collection).",
|
|
@@ -5394,7 +5568,7 @@ server.registerTool("prompts_update", {
|
|
|
5394
5568
|
}, async ({ id, ...updates }) => {
|
|
5395
5569
|
try {
|
|
5396
5570
|
const prompt = updatePrompt(id, updates);
|
|
5397
|
-
return ok(prompt);
|
|
5571
|
+
return ok(promptToSaveResult(prompt, false));
|
|
5398
5572
|
} catch (e) {
|
|
5399
5573
|
return err(e instanceof Error ? e.message : String(e));
|
|
5400
5574
|
}
|
|
@@ -5461,8 +5635,8 @@ server.registerTool("prompts_save_from_session", {
|
|
|
5461
5635
|
});
|
|
5462
5636
|
if (pin)
|
|
5463
5637
|
pinPrompt(prompt.id, true);
|
|
5464
|
-
const
|
|
5465
|
-
return ok({ ...
|
|
5638
|
+
const result = promptToSaveResult(prompt, created);
|
|
5639
|
+
return ok({ ...result, pinned: pin ?? false, _tip: created ? `Saved as "${prompt.slug}". Use prompts_use("${prompt.slug}") to retrieve it.` : `Updated "${prompt.slug}".` });
|
|
5466
5640
|
} catch (e) {
|
|
5467
5641
|
return err(e instanceof Error ? e.message : String(e));
|
|
5468
5642
|
}
|
|
@@ -5475,8 +5649,8 @@ server.registerTool("prompts_unused", {
|
|
|
5475
5649
|
description: "List prompts with use_count = 0 \u2014 never used. Good for library cleanup.",
|
|
5476
5650
|
inputSchema: { collection: exports_external.string().optional(), limit: exports_external.number().optional().default(50) }
|
|
5477
5651
|
}, async ({ collection, limit }) => {
|
|
5478
|
-
const all =
|
|
5479
|
-
const unused = all.filter((p) => p.use_count === 0).slice(0, limit);
|
|
5652
|
+
const all = listPromptsSlim({ collection, limit: 1e4 });
|
|
5653
|
+
const unused = all.filter((p) => p.use_count === 0).slice(0, limit).map((p) => ({ id: p.id, slug: p.slug, title: p.title, collection: p.collection, created_at: p.created_at }));
|
|
5480
5654
|
return ok({ unused, count: unused.length });
|
|
5481
5655
|
});
|
|
5482
5656
|
server.registerTool("prompts_trending", {
|
|
@@ -5596,10 +5770,10 @@ server.registerTool("prompts_unpin", {
|
|
|
5596
5770
|
}
|
|
5597
5771
|
});
|
|
5598
5772
|
server.registerTool("prompts_recent", {
|
|
5599
|
-
description: "Get recently used prompts,
|
|
5773
|
+
description: "Get recently used prompts (slim \u2014 no body). Returns id, slug, title, tags, use_count, last_used_at.",
|
|
5600
5774
|
inputSchema: { limit: exports_external.number().optional().default(10) }
|
|
5601
5775
|
}, async ({ limit }) => {
|
|
5602
|
-
const prompts =
|
|
5776
|
+
const prompts = listPromptsSlim({ limit: 500 }).filter((p) => p.last_used_at !== null).sort((a, b) => (b.last_used_at ?? "").localeCompare(a.last_used_at ?? "")).slice(0, limit);
|
|
5603
5777
|
return ok(prompts);
|
|
5604
5778
|
});
|
|
5605
5779
|
server.registerTool("prompts_lint", {
|
|
@@ -5623,8 +5797,8 @@ server.registerTool("prompts_stale", {
|
|
|
5623
5797
|
inputSchema: { days: exports_external.number().optional().default(30).describe("Inactivity threshold in days") }
|
|
5624
5798
|
}, async ({ days }) => {
|
|
5625
5799
|
const cutoff = new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString();
|
|
5626
|
-
const all =
|
|
5627
|
-
const stale = all.filter((p) => p.last_used_at === null || p.last_used_at < cutoff).sort((a, b) => (a.last_used_at ?? "").localeCompare(b.last_used_at ?? ""));
|
|
5800
|
+
const all = listPromptsSlim({ limit: 1e4 });
|
|
5801
|
+
const stale = all.filter((p) => p.last_used_at === null || p.last_used_at < cutoff).sort((a, b) => (a.last_used_at ?? "").localeCompare(b.last_used_at ?? "")).map((p) => ({ id: p.id, slug: p.slug, title: p.title, last_used_at: p.last_used_at, use_count: p.use_count }));
|
|
5628
5802
|
return ok({ stale, count: stale.length, threshold_days: days });
|
|
5629
5803
|
});
|
|
5630
5804
|
server.registerTool("prompts_stats", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;eAsCmB,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;;AAF9C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;eAsCmB,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;;AAF9C,wBAyOC"}
|
package/dist/server/index.js
CHANGED
|
@@ -424,6 +424,40 @@ class ProjectNotFoundError extends Error {
|
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
// src/db/prompts.ts
|
|
427
|
+
function rowToSlimPrompt(row) {
|
|
428
|
+
const variables = JSON.parse(row["variables"] || "[]");
|
|
429
|
+
return {
|
|
430
|
+
id: row["id"],
|
|
431
|
+
slug: row["slug"],
|
|
432
|
+
title: row["title"],
|
|
433
|
+
description: row["description"] ?? null,
|
|
434
|
+
collection: row["collection"],
|
|
435
|
+
tags: JSON.parse(row["tags"] || "[]"),
|
|
436
|
+
variable_names: variables.map((v) => v.name),
|
|
437
|
+
is_template: Boolean(row["is_template"]),
|
|
438
|
+
source: row["source"],
|
|
439
|
+
pinned: Boolean(row["pinned"]),
|
|
440
|
+
next_prompt: row["next_prompt"] ?? null,
|
|
441
|
+
expires_at: row["expires_at"] ?? null,
|
|
442
|
+
project_id: row["project_id"] ?? null,
|
|
443
|
+
use_count: row["use_count"],
|
|
444
|
+
last_used_at: row["last_used_at"] ?? null,
|
|
445
|
+
created_at: row["created_at"],
|
|
446
|
+
updated_at: row["updated_at"]
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
function promptToSaveResult(prompt, created, duplicate_warning) {
|
|
450
|
+
return {
|
|
451
|
+
id: prompt.id,
|
|
452
|
+
slug: prompt.slug,
|
|
453
|
+
title: prompt.title,
|
|
454
|
+
collection: prompt.collection,
|
|
455
|
+
is_template: prompt.is_template,
|
|
456
|
+
variable_names: prompt.variables.map((v) => v.name),
|
|
457
|
+
created,
|
|
458
|
+
duplicate_warning: duplicate_warning ?? null
|
|
459
|
+
};
|
|
460
|
+
}
|
|
427
461
|
function rowToPrompt(row) {
|
|
428
462
|
return {
|
|
429
463
|
id: row["id"],
|
|
@@ -518,11 +552,45 @@ function listPrompts(filter = {}) {
|
|
|
518
552
|
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
519
553
|
}
|
|
520
554
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
521
|
-
const limit = filter.limit ??
|
|
555
|
+
const limit = filter.limit ?? 20;
|
|
522
556
|
const offset = filter.offset ?? 0;
|
|
523
557
|
const rows = db.query(`SELECT * FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
524
558
|
return rows.map(rowToPrompt);
|
|
525
559
|
}
|
|
560
|
+
function listPromptsSlim(filter = {}) {
|
|
561
|
+
const db = getDatabase();
|
|
562
|
+
const conditions = [];
|
|
563
|
+
const params = [];
|
|
564
|
+
if (filter.collection) {
|
|
565
|
+
conditions.push("collection = ?");
|
|
566
|
+
params.push(filter.collection);
|
|
567
|
+
}
|
|
568
|
+
if (filter.is_template !== undefined) {
|
|
569
|
+
conditions.push("is_template = ?");
|
|
570
|
+
params.push(filter.is_template ? 1 : 0);
|
|
571
|
+
}
|
|
572
|
+
if (filter.source) {
|
|
573
|
+
conditions.push("source = ?");
|
|
574
|
+
params.push(filter.source);
|
|
575
|
+
}
|
|
576
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
577
|
+
const tagConds = filter.tags.map(() => "tags LIKE ?");
|
|
578
|
+
conditions.push(`(${tagConds.join(" OR ")})`);
|
|
579
|
+
for (const tag of filter.tags)
|
|
580
|
+
params.push(`%"${tag}"%`);
|
|
581
|
+
}
|
|
582
|
+
let orderBy = "pinned DESC, use_count DESC, updated_at DESC";
|
|
583
|
+
if (filter.project_id) {
|
|
584
|
+
conditions.push("(project_id = ? OR project_id IS NULL)");
|
|
585
|
+
params.push(filter.project_id);
|
|
586
|
+
orderBy = `(CASE WHEN project_id = '${filter.project_id}' THEN 0 ELSE 1 END), pinned DESC, use_count DESC, updated_at DESC`;
|
|
587
|
+
}
|
|
588
|
+
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
589
|
+
const limit = filter.limit ?? 20;
|
|
590
|
+
const offset = filter.offset ?? 0;
|
|
591
|
+
const rows = db.query(`SELECT id, slug, name, title, description, collection, tags, variables, is_template, source, pinned, next_prompt, expires_at, project_id, use_count, last_used_at, created_at, updated_at FROM prompts ${where} ORDER BY ${orderBy} LIMIT ? OFFSET ?`).all(...params, limit, offset);
|
|
592
|
+
return rows.map(rowToSlimPrompt);
|
|
593
|
+
}
|
|
526
594
|
function updatePrompt(idOrSlug, input) {
|
|
527
595
|
const db = getDatabase();
|
|
528
596
|
const prompt = requirePrompt(idOrSlug);
|
|
@@ -698,6 +766,22 @@ function deleteProject(idOrSlug) {
|
|
|
698
766
|
}
|
|
699
767
|
|
|
700
768
|
// src/lib/search.ts
|
|
769
|
+
function rowToSlimSearchResult(row, snippet) {
|
|
770
|
+
const variables = JSON.parse(row["variables"] || "[]");
|
|
771
|
+
return {
|
|
772
|
+
id: row["id"],
|
|
773
|
+
slug: row["slug"],
|
|
774
|
+
title: row["title"],
|
|
775
|
+
description: row["description"] ?? null,
|
|
776
|
+
collection: row["collection"],
|
|
777
|
+
tags: JSON.parse(row["tags"] || "[]"),
|
|
778
|
+
variable_names: variables.map((v) => v.name),
|
|
779
|
+
is_template: Boolean(row["is_template"]),
|
|
780
|
+
use_count: row["use_count"],
|
|
781
|
+
score: row["score"] ?? 1,
|
|
782
|
+
snippet
|
|
783
|
+
};
|
|
784
|
+
}
|
|
701
785
|
function rowToSearchResult(row, snippet) {
|
|
702
786
|
return {
|
|
703
787
|
prompt: {
|
|
@@ -780,9 +864,75 @@ function searchPrompts(query, filter = {}) {
|
|
|
780
864
|
const rows = db.query(`SELECT *, 1 as score FROM prompts
|
|
781
865
|
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
782
866
|
ORDER BY use_count DESC, updated_at DESC
|
|
783
|
-
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ??
|
|
867
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
784
868
|
return rows.map((r) => rowToSearchResult(r));
|
|
785
869
|
}
|
|
870
|
+
function searchPromptsSlim(query, filter = {}) {
|
|
871
|
+
const db = getDatabase();
|
|
872
|
+
if (!query.trim()) {
|
|
873
|
+
return listPromptsSlim(filter).map((p) => ({
|
|
874
|
+
id: p.id,
|
|
875
|
+
slug: p.slug,
|
|
876
|
+
title: p.title,
|
|
877
|
+
description: p.description,
|
|
878
|
+
collection: p.collection,
|
|
879
|
+
tags: p.tags,
|
|
880
|
+
variable_names: p.variable_names,
|
|
881
|
+
is_template: p.is_template,
|
|
882
|
+
use_count: p.use_count,
|
|
883
|
+
score: 1
|
|
884
|
+
}));
|
|
885
|
+
}
|
|
886
|
+
if (hasFts(db)) {
|
|
887
|
+
const ftsQuery = escapeFtsQuery(query);
|
|
888
|
+
const conditions = [];
|
|
889
|
+
const params = [];
|
|
890
|
+
if (filter.collection) {
|
|
891
|
+
conditions.push("p.collection = ?");
|
|
892
|
+
params.push(filter.collection);
|
|
893
|
+
}
|
|
894
|
+
if (filter.is_template !== undefined) {
|
|
895
|
+
conditions.push("p.is_template = ?");
|
|
896
|
+
params.push(filter.is_template ? 1 : 0);
|
|
897
|
+
}
|
|
898
|
+
if (filter.source) {
|
|
899
|
+
conditions.push("p.source = ?");
|
|
900
|
+
params.push(filter.source);
|
|
901
|
+
}
|
|
902
|
+
if (filter.tags && filter.tags.length > 0) {
|
|
903
|
+
const tagConds = filter.tags.map(() => "p.tags LIKE ?");
|
|
904
|
+
conditions.push(`(${tagConds.join(" OR ")})`);
|
|
905
|
+
for (const tag of filter.tags)
|
|
906
|
+
params.push(`%"${tag}"%`);
|
|
907
|
+
}
|
|
908
|
+
if (filter.project_id) {
|
|
909
|
+
conditions.push("(p.project_id = ? OR p.project_id IS NULL)");
|
|
910
|
+
params.push(filter.project_id);
|
|
911
|
+
}
|
|
912
|
+
const where = conditions.length > 0 ? `AND ${conditions.join(" AND ")}` : "";
|
|
913
|
+
const limit = filter.limit ?? 10;
|
|
914
|
+
const offset = filter.offset ?? 0;
|
|
915
|
+
try {
|
|
916
|
+
const rows2 = db.query(`SELECT p.id, p.slug, p.name, p.title, p.description, p.collection, p.tags, p.variables,
|
|
917
|
+
p.is_template, p.use_count, bm25(prompts_fts) as score,
|
|
918
|
+
snippet(prompts_fts, 2, '[', ']', '...', 10) as snippet
|
|
919
|
+
FROM prompts p
|
|
920
|
+
INNER JOIN prompts_fts ON prompts_fts.rowid = p.rowid
|
|
921
|
+
WHERE prompts_fts MATCH ?
|
|
922
|
+
${where}
|
|
923
|
+
ORDER BY bm25(prompts_fts)
|
|
924
|
+
LIMIT ? OFFSET ?`).all(ftsQuery, ...params, limit, offset);
|
|
925
|
+
return rows2.map((r) => rowToSlimSearchResult(r, r["snippet"]));
|
|
926
|
+
} catch {}
|
|
927
|
+
}
|
|
928
|
+
const like = `%${query}%`;
|
|
929
|
+
const rows = db.query(`SELECT id, slug, name, title, description, collection, tags, variables, is_template, use_count, 1 as score
|
|
930
|
+
FROM prompts
|
|
931
|
+
WHERE (name LIKE ? OR slug LIKE ? OR title LIKE ? OR body LIKE ? OR description LIKE ? OR tags LIKE ?)
|
|
932
|
+
ORDER BY use_count DESC, updated_at DESC
|
|
933
|
+
LIMIT ? OFFSET ?`).all(like, like, like, like, like, like, filter.limit ?? 10, filter.offset ?? 0);
|
|
934
|
+
return rows.map((r) => rowToSlimSearchResult(r));
|
|
935
|
+
}
|
|
786
936
|
function findSimilar(promptId, limit = 5) {
|
|
787
937
|
const db = getDatabase();
|
|
788
938
|
const prompt = db.query("SELECT * FROM prompts WHERE id = ?").get(promptId);
|
|
@@ -879,8 +1029,9 @@ var server_default = {
|
|
|
879
1029
|
const tags = url.searchParams.get("tags")?.split(",") ?? undefined;
|
|
880
1030
|
const is_template = url.searchParams.has("templates") ? true : undefined;
|
|
881
1031
|
const source = url.searchParams.get("source") ?? undefined;
|
|
882
|
-
const limit = parseInt(url.searchParams.get("limit") ?? "
|
|
1032
|
+
const limit = parseInt(url.searchParams.get("limit") ?? "20");
|
|
883
1033
|
const offset = parseInt(url.searchParams.get("offset") ?? "0");
|
|
1034
|
+
const full = url.searchParams.has("full");
|
|
884
1035
|
const projectParam = url.searchParams.get("project") ?? undefined;
|
|
885
1036
|
let project_id;
|
|
886
1037
|
if (projectParam) {
|
|
@@ -889,12 +1040,13 @@ var server_default = {
|
|
|
889
1040
|
return notFound(`Project not found: ${projectParam}`);
|
|
890
1041
|
project_id = pid;
|
|
891
1042
|
}
|
|
892
|
-
|
|
1043
|
+
const filter = { collection, tags, is_template, source, limit, offset, project_id };
|
|
1044
|
+
return json(full ? listPrompts(filter) : listPromptsSlim(filter));
|
|
893
1045
|
}
|
|
894
1046
|
if (path === "/api/prompts" && method === "POST") {
|
|
895
1047
|
const body = await parseBody(req);
|
|
896
|
-
const
|
|
897
|
-
return json(
|
|
1048
|
+
const { prompt, created, duplicate_warning } = upsertPrompt(body);
|
|
1049
|
+
return json(promptToSaveResult(prompt, created, duplicate_warning), created ? 201 : 200);
|
|
898
1050
|
}
|
|
899
1051
|
const promptMatch = path.match(/^\/api\/prompts\/([^/]+)$/);
|
|
900
1052
|
if (promptMatch) {
|
|
@@ -908,7 +1060,7 @@ var server_default = {
|
|
|
908
1060
|
if (method === "PUT") {
|
|
909
1061
|
const body = await parseBody(req);
|
|
910
1062
|
const prompt = updatePrompt(id, body);
|
|
911
|
-
return json(prompt);
|
|
1063
|
+
return json(promptToSaveResult(prompt, false));
|
|
912
1064
|
}
|
|
913
1065
|
if (method === "DELETE") {
|
|
914
1066
|
deletePrompt(id);
|
|
@@ -973,10 +1125,11 @@ var server_default = {
|
|
|
973
1125
|
const tags = url.searchParams.get("tags")?.split(",") ?? undefined;
|
|
974
1126
|
const is_template = url.searchParams.has("templates") ? true : undefined;
|
|
975
1127
|
const limit = parseInt(url.searchParams.get("limit") ?? "20");
|
|
976
|
-
|
|
1128
|
+
const full = url.searchParams.has("full");
|
|
1129
|
+
return json(full ? searchPrompts(q, { collection, tags, is_template, limit }) : searchPromptsSlim(q, { collection, tags, is_template, limit }));
|
|
977
1130
|
}
|
|
978
1131
|
if (path === "/api/templates" && method === "GET") {
|
|
979
|
-
return json(
|
|
1132
|
+
return json(listPromptsSlim({ is_template: true, limit: 50 }));
|
|
980
1133
|
}
|
|
981
1134
|
if (path === "/api/collections" && method === "GET") {
|
|
982
1135
|
return json(listCollections());
|
|
@@ -1033,7 +1186,8 @@ var server_default = {
|
|
|
1033
1186
|
return notFound(`Project not found: ${projId}`);
|
|
1034
1187
|
const limit = parseInt(url.searchParams.get("limit") ?? "100");
|
|
1035
1188
|
const offset = parseInt(url.searchParams.get("offset") ?? "0");
|
|
1036
|
-
|
|
1189
|
+
const full = url.searchParams.has("full");
|
|
1190
|
+
return json(full ? listPrompts({ project_id: project.id, limit, offset }) : listPromptsSlim({ project_id: project.id, limit, offset }));
|
|
1037
1191
|
}
|
|
1038
1192
|
if (path === "/health") {
|
|
1039
1193
|
return json({ status: "ok", port: PORT });
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slim prompt — no body, no full variable details.
|
|
3
|
+
* Returned by list/search/stats/recent/stale/trending by default.
|
|
4
|
+
* Saves tokens — use prompts_use / prompts_get / prompts_body to get the actual body.
|
|
5
|
+
*/
|
|
6
|
+
export interface SlimPrompt {
|
|
7
|
+
id: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
title: string;
|
|
10
|
+
description: string | null;
|
|
11
|
+
collection: string;
|
|
12
|
+
tags: string[];
|
|
13
|
+
variable_names: string[];
|
|
14
|
+
is_template: boolean;
|
|
15
|
+
source: PromptSource;
|
|
16
|
+
pinned: boolean;
|
|
17
|
+
next_prompt: string | null;
|
|
18
|
+
expires_at: string | null;
|
|
19
|
+
project_id: string | null;
|
|
20
|
+
use_count: number;
|
|
21
|
+
last_used_at: string | null;
|
|
22
|
+
created_at: string;
|
|
23
|
+
updated_at: string;
|
|
24
|
+
}
|
|
1
25
|
export interface Prompt {
|
|
2
26
|
id: string;
|
|
3
27
|
name: string;
|
|
@@ -94,6 +118,31 @@ export interface SearchResult {
|
|
|
94
118
|
score: number;
|
|
95
119
|
snippet?: string;
|
|
96
120
|
}
|
|
121
|
+
/** Slim search result — body replaced by snippet, no full prompt */
|
|
122
|
+
export interface SlimSearchResult {
|
|
123
|
+
id: string;
|
|
124
|
+
slug: string;
|
|
125
|
+
title: string;
|
|
126
|
+
description: string | null;
|
|
127
|
+
collection: string;
|
|
128
|
+
tags: string[];
|
|
129
|
+
is_template: boolean;
|
|
130
|
+
variable_names: string[];
|
|
131
|
+
use_count: number;
|
|
132
|
+
score: number;
|
|
133
|
+
snippet?: string;
|
|
134
|
+
}
|
|
135
|
+
/** Returned by save/update to avoid echoing back the full body */
|
|
136
|
+
export interface SaveResult {
|
|
137
|
+
id: string;
|
|
138
|
+
slug: string;
|
|
139
|
+
title: string;
|
|
140
|
+
collection: string;
|
|
141
|
+
is_template: boolean;
|
|
142
|
+
variable_names: string[];
|
|
143
|
+
created: boolean;
|
|
144
|
+
duplicate_warning?: string | null;
|
|
145
|
+
}
|
|
97
146
|
export interface RenderResult {
|
|
98
147
|
rendered: string;
|
|
99
148
|
missing_vars: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;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