@agimon-ai/doompi-prompt 0.0.1-alpha.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 +118 -0
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/adapters/hubApi.cjs +2 -0
- package/dist/adapters/hubApi.cjs.map +1 -0
- package/dist/adapters/hubApi.d.cts +13 -0
- package/dist/adapters/hubApi.d.cts.map +1 -0
- package/dist/adapters/hubApi.d.mts +13 -0
- package/dist/adapters/hubApi.d.mts.map +1 -0
- package/dist/adapters/hubApi.mjs +2 -0
- package/dist/adapters/hubApi.mjs.map +1 -0
- package/dist/adapters/node/promptStore.cjs +2 -0
- package/dist/adapters/node/promptStore.cjs.map +1 -0
- package/dist/adapters/node/promptStore.d.cts +12 -0
- package/dist/adapters/node/promptStore.d.cts.map +1 -0
- package/dist/adapters/node/promptStore.d.mts +12 -0
- package/dist/adapters/node/promptStore.d.mts.map +1 -0
- package/dist/adapters/node/promptStore.mjs +2 -0
- package/dist/adapters/node/promptStore.mjs.map +1 -0
- package/dist/adapters/pi/extension.cjs +2 -0
- package/dist/adapters/pi/extension.cjs.map +1 -0
- package/dist/adapters/pi/extension.d.cts +19 -0
- package/dist/adapters/pi/extension.d.cts.map +1 -0
- package/dist/adapters/pi/extension.d.mts +19 -0
- package/dist/adapters/pi/extension.d.mts.map +1 -0
- package/dist/adapters/pi/extension.mjs +2 -0
- package/dist/adapters/pi/extension.mjs.map +1 -0
- package/dist/adapters/pi/inputCapture.cjs +2 -0
- package/dist/adapters/pi/inputCapture.cjs.map +1 -0
- package/dist/adapters/pi/inputCapture.mjs +2 -0
- package/dist/adapters/pi/inputCapture.mjs.map +1 -0
- package/dist/adapters/pi/leader.cjs +2 -0
- package/dist/adapters/pi/leader.cjs.map +1 -0
- package/dist/adapters/pi/leader.mjs +2 -0
- package/dist/adapters/pi/leader.mjs.map +1 -0
- package/dist/adapters/pi/promptConstants.cjs +2 -0
- package/dist/adapters/pi/promptConstants.cjs.map +1 -0
- package/dist/adapters/pi/promptConstants.mjs +2 -0
- package/dist/adapters/pi/promptConstants.mjs.map +1 -0
- package/dist/commands/promptSaveCommand.cjs +2 -0
- package/dist/commands/promptSaveCommand.cjs.map +1 -0
- package/dist/commands/promptSaveCommand.mjs +2 -0
- package/dist/commands/promptSaveCommand.mjs.map +1 -0
- package/dist/commands/promptsCommand.cjs +2 -0
- package/dist/commands/promptsCommand.cjs.map +1 -0
- package/dist/commands/promptsCommand.mjs +2 -0
- package/dist/commands/promptsCommand.mjs.map +1 -0
- package/dist/container/index.cjs +2 -0
- package/dist/container/index.cjs.map +1 -0
- package/dist/container/index.d.cts +7 -0
- package/dist/container/index.d.cts.map +1 -0
- package/dist/container/index.d.mts +7 -0
- package/dist/container/index.d.mts.map +1 -0
- package/dist/container/index.mjs +2 -0
- package/dist/container/index.mjs.map +1 -0
- package/dist/extensions/pi.cjs +1 -0
- package/dist/extensions/pi.d.cts +2 -0
- package/dist/extensions/pi.d.mts +2 -0
- package/dist/extensions/pi.mjs +1 -0
- package/dist/hubApi.cjs +1 -0
- package/dist/hubApi.d.cts +2 -0
- package/dist/hubApi.d.mts +2 -0
- package/dist/hubApi.mjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +1 -0
- package/dist/services/promptItems.cjs +2 -0
- package/dist/services/promptItems.cjs.map +1 -0
- package/dist/services/promptItems.mjs +2 -0
- package/dist/services/promptItems.mjs.map +1 -0
- package/dist/services/recentPrompts.cjs +2 -0
- package/dist/services/recentPrompts.cjs.map +1 -0
- package/dist/services/recentPrompts.d.cts +20 -0
- package/dist/services/recentPrompts.d.cts.map +1 -0
- package/dist/services/recentPrompts.d.mts +20 -0
- package/dist/services/recentPrompts.d.mts.map +1 -0
- package/dist/services/recentPrompts.mjs +2 -0
- package/dist/services/recentPrompts.mjs.map +1 -0
- package/dist/services/savedPromptDocument.cjs +11 -0
- package/dist/services/savedPromptDocument.cjs.map +1 -0
- package/dist/services/savedPromptDocument.d.cts +21 -0
- package/dist/services/savedPromptDocument.d.cts.map +1 -0
- package/dist/services/savedPromptDocument.d.mts +21 -0
- package/dist/services/savedPromptDocument.d.mts.map +1 -0
- package/dist/services/savedPromptDocument.mjs +11 -0
- package/dist/services/savedPromptDocument.mjs.map +1 -0
- package/dist/types/prompt.d.cts +54 -0
- package/dist/types/prompt.d.cts.map +1 -0
- package/dist/types/prompt.d.mts +54 -0
- package/dist/types/prompt.d.mts.map +1 -0
- package/dist/types/webPrompts.cjs +2 -0
- package/dist/types/webPrompts.cjs.map +1 -0
- package/dist/types/webPrompts.mjs +2 -0
- package/dist/types/webPrompts.mjs.map +1 -0
- package/llms.txt +11 -0
- package/package.json +124 -0
- package/src/exports/webClient.ts +2 -0
- package/src/prompts/doompi-use-prompt/SKILL.md +17 -0
- package/src/types/webPrompts.ts +61 -0
- package/src/web/PromptEditor.tsx +57 -0
- package/src/web/PromptPickerList.tsx +108 -0
- package/src/web/PromptsActivitySection.tsx +69 -0
- package/src/web/PromptsDialog.tsx +111 -0
- package/src/web/index.ts +32 -0
- package/src/web/promptsActions.ts +72 -0
- package/src/web/promptsApi.ts +88 -0
- package/src/web/tsconfig.json +22 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createNodeSavedPromptStore as e}from"../adapters/node/promptStore.mjs";import{createRecentPrompts as t}from"../services/recentPrompts.mjs";function n(n={}){return{store:n.store??e(),recent:n.recent??t()}}export{n as createPromptContainer};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/container/index.ts"],"sourcesContent":["import { createNodeSavedPromptStore } from '../adapters/node/promptStore.ts';\nimport { createRecentPrompts } from '../services/recentPrompts.ts';\nimport type { PromptExtensionDependencies } from '../types/prompt.ts';\n\n/** Plain factory construction, with per-dependency overrides for tests. */\nexport function createPromptContainer(\n overrides: Partial<PromptExtensionDependencies> = {},\n): PromptExtensionDependencies {\n return {\n store: overrides.store ?? createNodeSavedPromptStore(),\n recent: overrides.recent ?? createRecentPrompts(),\n };\n}\n"],"mappings":"kJAKA,SAAgB,EACd,EAAkD,CAAC,EACtB,CAC7B,MAAO,CACL,MAAO,EAAU,OAAS,EAA2B,EACrD,OAAQ,EAAU,QAAU,EAAoB,CAClD,CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../adapters/pi/extension.cjs");exports.activatePromptExtension=e.activatePromptExtension,exports.default=e.activatePromptExtension;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{activatePromptExtension as e}from"../adapters/pi/extension.mjs";export{e as activatePromptExtension,e as default};
|
package/dist/hubApi.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./adapters/hubApi.cjs");exports.api=e.api,exports.createPromptHubApi=e.createPromptHubApi;
|
package/dist/hubApi.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{api as e,createPromptHubApi as t}from"./adapters/hubApi.mjs";export{e as api,t as createPromptHubApi};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./services/savedPromptDocument.cjs"),t=require("./adapters/node/promptStore.cjs"),n=require("./services/recentPrompts.cjs"),r=require("./container/index.cjs"),i=require("./adapters/pi/extension.cjs");exports.PROMPT_NAME_RULE=e.PROMPT_NAME_RULE,exports.RECENT_PROMPT_LIMIT=n.RECENT_PROMPT_LIMIT,exports.activatePromptExtension=i.activatePromptExtension,exports.buildPromptDocument=e.buildPromptDocument,exports.createNodeSavedPromptStore=t.createNodeSavedPromptStore,exports.createPromptContainer=r.createPromptContainer,exports.createRecentPrompts=n.createRecentPrompts,exports.describePrompt=e.describePrompt,exports.hasArgumentTokens=e.hasArgumentTokens,exports.installPromptRuntime=i.installPromptRuntime,exports.isValidPromptName=e.isValidPromptName,exports.parsePromptDocument=e.parsePromptDocument,exports.resolvePromptsDirectory=t.resolvePromptsDirectory;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PromptExtensionDependencies, RecentPrompts, SavedPrompt, SavedPromptStore, SavedPromptWrite } from "./types/prompt.cjs";
|
|
2
|
+
import { activatePromptExtension, installPromptRuntime } from "./adapters/pi/extension.cjs";
|
|
3
|
+
import { createNodeSavedPromptStore, resolvePromptsDirectory } from "./adapters/node/promptStore.cjs";
|
|
4
|
+
import { createPromptContainer } from "./container/index.cjs";
|
|
5
|
+
import { RECENT_PROMPT_LIMIT, createRecentPrompts } from "./services/recentPrompts.cjs";
|
|
6
|
+
import { PROMPT_NAME_RULE, buildPromptDocument, describePrompt, hasArgumentTokens, isValidPromptName, parsePromptDocument } from "./services/savedPromptDocument.cjs";
|
|
7
|
+
export { PROMPT_NAME_RULE, type PromptExtensionDependencies, RECENT_PROMPT_LIMIT, type RecentPrompts, type SavedPrompt, type SavedPromptStore, type SavedPromptWrite, activatePromptExtension, buildPromptDocument, createNodeSavedPromptStore, createPromptContainer, createRecentPrompts, describePrompt, hasArgumentTokens, installPromptRuntime, isValidPromptName, parsePromptDocument, resolvePromptsDirectory };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PromptExtensionDependencies, RecentPrompts, SavedPrompt, SavedPromptStore, SavedPromptWrite } from "./types/prompt.mjs";
|
|
2
|
+
import { activatePromptExtension, installPromptRuntime } from "./adapters/pi/extension.mjs";
|
|
3
|
+
import { createNodeSavedPromptStore, resolvePromptsDirectory } from "./adapters/node/promptStore.mjs";
|
|
4
|
+
import { createPromptContainer } from "./container/index.mjs";
|
|
5
|
+
import { RECENT_PROMPT_LIMIT, createRecentPrompts } from "./services/recentPrompts.mjs";
|
|
6
|
+
import { PROMPT_NAME_RULE, buildPromptDocument, describePrompt, hasArgumentTokens, isValidPromptName, parsePromptDocument } from "./services/savedPromptDocument.mjs";
|
|
7
|
+
export { PROMPT_NAME_RULE, type PromptExtensionDependencies, RECENT_PROMPT_LIMIT, type RecentPrompts, type SavedPrompt, type SavedPromptStore, type SavedPromptWrite, activatePromptExtension, buildPromptDocument, createNodeSavedPromptStore, createPromptContainer, createRecentPrompts, describePrompt, hasArgumentTokens, installPromptRuntime, isValidPromptName, parsePromptDocument, resolvePromptsDirectory };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{PROMPT_NAME_RULE as e,buildPromptDocument as t,describePrompt as n,hasArgumentTokens as r,isValidPromptName as i,parsePromptDocument as a}from"./services/savedPromptDocument.mjs";import{createNodeSavedPromptStore as o,resolvePromptsDirectory as s}from"./adapters/node/promptStore.mjs";import{RECENT_PROMPT_LIMIT as c,createRecentPrompts as l}from"./services/recentPrompts.mjs";import{createPromptContainer as u}from"./container/index.mjs";import{activatePromptExtension as d,installPromptRuntime as f}from"./adapters/pi/extension.mjs";export{e as PROMPT_NAME_RULE,c as RECENT_PROMPT_LIMIT,d as activatePromptExtension,t as buildPromptDocument,o as createNodeSavedPromptStore,u as createPromptContainer,l as createRecentPrompts,n as describePrompt,r as hasArgumentTokens,f as installPromptRuntime,i as isValidPromptName,a as parsePromptDocument,s as resolvePromptsDirectory};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./savedPromptDocument.cjs"),t=`recent:`,n=`saved:`;function r(r,i){let a=[];for(let[n,i]of r.entries())a.push({value:`${t}${String(n)}`,label:e.describePrompt(i)||i,description:`staged this session`});for(let t of i)a.push({value:`${n}${t.name}`,label:`/${t.name}`,description:t.description||e.describePrompt(t.text)});return a}function i(e){if(e.startsWith(t))return{kind:`recent`,key:e.slice(7)};if(e.startsWith(n))return{kind:`saved`,key:e.slice(6)}}function a(e,t,n){let r=i(e);if(r){if(r.kind===`recent`){let e=Number.parseInt(r.key,10);return Number.isInteger(e)?t[e]:void 0}return n.find(e=>e.name===r.key)?.text}}function o(e,t){return e.trim()?`${e.replace(/\s+$/u,``)}\n${t}`:t}exports.parsePromptSelection=i,exports.promptItems=r,exports.resolvePromptSelection=a,exports.stagedEditorText=o;
|
|
2
|
+
//# sourceMappingURL=promptItems.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptItems.cjs","names":["describePrompt"],"sources":["../../src/services/promptItems.ts"],"sourcesContent":["import type { SelectItem } from '@earendil-works/pi-tui';\nimport type { SavedPrompt } from '../types/prompt.ts';\nimport { describePrompt } from './savedPromptDocument.ts';\n\n/**\n * Picker rows for staged and saved prompts.\n *\n * DESIGN PATTERNS:\n * - Values are opaque routing keys, never the prompt text: a value carries the\n * section and the index or name, and the caller resolves it back to text.\n * Prompt bodies are multi-line, and a list value has to stay one token.\n * - Section headings are plain disabled-looking rows rather than a new picker\n * feature, so the shared MatrixPicker stays untouched.\n *\n * AVOID:\n * - Putting the prompt body in the label: the list renders one line per row.\n */\n\nconst RECENT_VALUE_PREFIX = 'recent:';\nconst SAVED_VALUE_PREFIX = 'saved:';\n\nexport interface PromptSelection {\n kind: 'recent' | 'saved';\n key: string;\n}\n\nexport function promptItems(recent: readonly string[], saved: readonly SavedPrompt[]): SelectItem[] {\n const items: SelectItem[] = [];\n for (const [index, text] of recent.entries()) {\n items.push({\n value: `${RECENT_VALUE_PREFIX}${String(index)}`,\n label: describePrompt(text) || text,\n description: 'staged this session',\n });\n }\n for (const prompt of saved) {\n items.push({\n value: `${SAVED_VALUE_PREFIX}${prompt.name}`,\n label: `/${prompt.name}`,\n description: prompt.description || describePrompt(prompt.text),\n });\n }\n return items;\n}\n\n/** Reads a picker value back into the entry it points at. */\nexport function parsePromptSelection(value: string): PromptSelection | undefined {\n if (value.startsWith(RECENT_VALUE_PREFIX)) {\n return { kind: 'recent', key: value.slice(RECENT_VALUE_PREFIX.length) };\n }\n if (value.startsWith(SAVED_VALUE_PREFIX)) {\n return { kind: 'saved', key: value.slice(SAVED_VALUE_PREFIX.length) };\n }\n return undefined;\n}\n\n/** The text a selected row stages, or undefined when the row went stale. */\nexport function resolvePromptSelection(\n value: string,\n recent: readonly string[],\n saved: readonly SavedPrompt[],\n): string | undefined {\n const selection = parsePromptSelection(value);\n if (!selection) return undefined;\n if (selection.kind === 'recent') {\n const index = Number.parseInt(selection.key, 10);\n return Number.isInteger(index) ? recent[index] : undefined;\n }\n return saved.find((prompt) => prompt.name === selection.key)?.text;\n}\n\n/** Appends to a draft instead of discarding it, since staging is additive. */\nexport function stagedEditorText(draft: string, chosen: string): string {\n return draft.trim() ? `${draft.replace(/\\s+$/u, '')}\\n${chosen}` : chosen;\n}\n"],"mappings":"6CAkBM,EAAsB,UACtB,EAAqB,SAO3B,SAAgB,EAAY,EAA2B,EAA6C,CAClG,IAAM,EAAsB,CAAC,EAC7B,IAAK,GAAM,CAAC,EAAO,KAAS,EAAO,QAAQ,EACzC,EAAM,KAAK,CACT,MAAO,GAAG,IAAsB,OAAO,CAAK,IAC5C,MAAOA,EAAAA,eAAe,CAAI,GAAK,EAC/B,YAAa,qBACf,CAAC,EAEH,IAAK,IAAM,KAAU,EACnB,EAAM,KAAK,CACT,MAAO,GAAG,IAAqB,EAAO,OACtC,MAAO,IAAI,EAAO,OAClB,YAAa,EAAO,aAAeA,EAAAA,eAAe,EAAO,IAAI,CAC/D,CAAC,EAEH,OAAO,CACT,CAGA,SAAgB,EAAqB,EAA4C,CAC/E,GAAI,EAAM,WAAW,CAAmB,EACtC,MAAO,CAAE,KAAM,SAAU,IAAK,EAAM,MAAM,CAA0B,CAAE,EAExE,GAAI,EAAM,WAAW,CAAkB,EACrC,MAAO,CAAE,KAAM,QAAS,IAAK,EAAM,MAAM,CAAyB,CAAE,CAGxE,CAGA,SAAgB,EACd,EACA,EACA,EACoB,CACpB,IAAM,EAAY,EAAqB,CAAK,EACvC,KACL,IAAI,EAAU,OAAS,SAAU,CAC/B,IAAM,EAAQ,OAAO,SAAS,EAAU,IAAK,EAAE,EAC/C,OAAO,OAAO,UAAU,CAAK,EAAI,EAAO,GAAS,IAAA,EACnD,CACA,OAAO,EAAM,KAAM,GAAW,EAAO,OAAS,EAAU,GAAG,CAAC,EAAE,IAD9D,CAEF,CAGA,SAAgB,EAAiB,EAAe,EAAwB,CACtE,OAAO,EAAM,KAAK,EAAI,GAAG,EAAM,QAAQ,QAAS,EAAE,EAAE,IAAI,IAAW,CACrE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{describePrompt as e}from"./savedPromptDocument.mjs";const t=`recent:`,n=`saved:`;function r(r,i){let a=[];for(let[n,i]of r.entries())a.push({value:`${t}${String(n)}`,label:e(i)||i,description:`staged this session`});for(let t of i)a.push({value:`${n}${t.name}`,label:`/${t.name}`,description:t.description||e(t.text)});return a}function i(e){if(e.startsWith(t))return{kind:`recent`,key:e.slice(7)};if(e.startsWith(n))return{kind:`saved`,key:e.slice(6)}}function a(e,t,n){let r=i(e);if(r){if(r.kind===`recent`){let e=Number.parseInt(r.key,10);return Number.isInteger(e)?t[e]:void 0}return n.find(e=>e.name===r.key)?.text}}function o(e,t){return e.trim()?`${e.replace(/\s+$/u,``)}\n${t}`:t}export{i as parsePromptSelection,r as promptItems,a as resolvePromptSelection,o as stagedEditorText};
|
|
2
|
+
//# sourceMappingURL=promptItems.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptItems.mjs","names":[],"sources":["../../src/services/promptItems.ts"],"sourcesContent":["import type { SelectItem } from '@earendil-works/pi-tui';\nimport type { SavedPrompt } from '../types/prompt.ts';\nimport { describePrompt } from './savedPromptDocument.ts';\n\n/**\n * Picker rows for staged and saved prompts.\n *\n * DESIGN PATTERNS:\n * - Values are opaque routing keys, never the prompt text: a value carries the\n * section and the index or name, and the caller resolves it back to text.\n * Prompt bodies are multi-line, and a list value has to stay one token.\n * - Section headings are plain disabled-looking rows rather than a new picker\n * feature, so the shared MatrixPicker stays untouched.\n *\n * AVOID:\n * - Putting the prompt body in the label: the list renders one line per row.\n */\n\nconst RECENT_VALUE_PREFIX = 'recent:';\nconst SAVED_VALUE_PREFIX = 'saved:';\n\nexport interface PromptSelection {\n kind: 'recent' | 'saved';\n key: string;\n}\n\nexport function promptItems(recent: readonly string[], saved: readonly SavedPrompt[]): SelectItem[] {\n const items: SelectItem[] = [];\n for (const [index, text] of recent.entries()) {\n items.push({\n value: `${RECENT_VALUE_PREFIX}${String(index)}`,\n label: describePrompt(text) || text,\n description: 'staged this session',\n });\n }\n for (const prompt of saved) {\n items.push({\n value: `${SAVED_VALUE_PREFIX}${prompt.name}`,\n label: `/${prompt.name}`,\n description: prompt.description || describePrompt(prompt.text),\n });\n }\n return items;\n}\n\n/** Reads a picker value back into the entry it points at. */\nexport function parsePromptSelection(value: string): PromptSelection | undefined {\n if (value.startsWith(RECENT_VALUE_PREFIX)) {\n return { kind: 'recent', key: value.slice(RECENT_VALUE_PREFIX.length) };\n }\n if (value.startsWith(SAVED_VALUE_PREFIX)) {\n return { kind: 'saved', key: value.slice(SAVED_VALUE_PREFIX.length) };\n }\n return undefined;\n}\n\n/** The text a selected row stages, or undefined when the row went stale. */\nexport function resolvePromptSelection(\n value: string,\n recent: readonly string[],\n saved: readonly SavedPrompt[],\n): string | undefined {\n const selection = parsePromptSelection(value);\n if (!selection) return undefined;\n if (selection.kind === 'recent') {\n const index = Number.parseInt(selection.key, 10);\n return Number.isInteger(index) ? recent[index] : undefined;\n }\n return saved.find((prompt) => prompt.name === selection.key)?.text;\n}\n\n/** Appends to a draft instead of discarding it, since staging is additive. */\nexport function stagedEditorText(draft: string, chosen: string): string {\n return draft.trim() ? `${draft.replace(/\\s+$/u, '')}\\n${chosen}` : chosen;\n}\n"],"mappings":"2DAkBA,MAAM,EAAsB,UACtB,EAAqB,SAO3B,SAAgB,EAAY,EAA2B,EAA6C,CAClG,IAAM,EAAsB,CAAC,EAC7B,IAAK,GAAM,CAAC,EAAO,KAAS,EAAO,QAAQ,EACzC,EAAM,KAAK,CACT,MAAO,GAAG,IAAsB,OAAO,CAAK,IAC5C,MAAO,EAAe,CAAI,GAAK,EAC/B,YAAa,qBACf,CAAC,EAEH,IAAK,IAAM,KAAU,EACnB,EAAM,KAAK,CACT,MAAO,GAAG,IAAqB,EAAO,OACtC,MAAO,IAAI,EAAO,OAClB,YAAa,EAAO,aAAe,EAAe,EAAO,IAAI,CAC/D,CAAC,EAEH,OAAO,CACT,CAGA,SAAgB,EAAqB,EAA4C,CAC/E,GAAI,EAAM,WAAW,CAAmB,EACtC,MAAO,CAAE,KAAM,SAAU,IAAK,EAAM,MAAM,CAA0B,CAAE,EAExE,GAAI,EAAM,WAAW,CAAkB,EACrC,MAAO,CAAE,KAAM,QAAS,IAAK,EAAM,MAAM,CAAyB,CAAE,CAGxE,CAGA,SAAgB,EACd,EACA,EACA,EACoB,CACpB,IAAM,EAAY,EAAqB,CAAK,EACvC,KACL,IAAI,EAAU,OAAS,SAAU,CAC/B,IAAM,EAAQ,OAAO,SAAS,EAAU,IAAK,EAAE,EAC/C,OAAO,OAAO,UAAU,CAAK,EAAI,EAAO,GAAS,IAAA,EACnD,CACA,OAAO,EAAM,KAAM,GAAW,EAAO,OAAS,EAAU,GAAG,CAAC,EAAE,IAD9D,CAEF,CAGA,SAAgB,EAAiB,EAAe,EAAwB,CACtE,OAAO,EAAM,KAAK,EAAI,GAAG,EAAM,QAAQ,QAAS,EAAE,EAAE,IAAI,IAAW,CACrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recentPrompts.cjs","names":[],"sources":["../../src/services/recentPrompts.ts"],"sourcesContent":["import type { RecentPrompts } from '../types/prompt.ts';\n\n/**\n * The staged prompt ring.\n *\n * DESIGN PATTERNS:\n * - Session-scoped and in memory. Nothing here touches the filesystem, so a\n * prompt the user never explicitly saved is never written anywhere.\n * - Mirrors pi-tui's own history rules (trim, drop empty, skip a consecutive\n * duplicate) so the picker and arrow up/down agree on what counts as an entry.\n *\n * AVOID:\n * - Growing the ring: three entries is the contract, not a default.\n */\n\n/** How many prompts stay staged for quick reuse. */\nexport const RECENT_PROMPT_LIMIT = 3;\n\nexport function createRecentPrompts(limit: number = RECENT_PROMPT_LIMIT): RecentPrompts {\n let entries: string[] = [];\n\n return {\n push(text: string): void {\n const trimmed = text.trim();\n if (!trimmed) return;\n if (entries[0] === trimmed) return;\n entries = [trimmed, ...entries].slice(0, limit);\n },\n list(): readonly string[] {\n return entries;\n },\n };\n}\n"],"mappings":"AAkBA,SAAgB,EAAoB,EAAA,EAAoD,CACtF,IAAI,EAAoB,CAAC,EAEzB,MAAO,CACL,KAAK,EAAoB,CACvB,IAAM,EAAU,EAAK,KAAK,EACrB,GACD,EAAQ,KAAO,IACnB,EAAU,CAAC,EAAS,GAAG,CAAO,CAAC,CAAC,MAAM,EAAG,CAAK,EAChD,EACA,MAA0B,CACxB,OAAO,CACT,CACF,CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RecentPrompts } from "../types/prompt.cjs";
|
|
2
|
+
//#region src/services/recentPrompts.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The staged prompt ring.
|
|
5
|
+
*
|
|
6
|
+
* DESIGN PATTERNS:
|
|
7
|
+
* - Session-scoped and in memory. Nothing here touches the filesystem, so a
|
|
8
|
+
* prompt the user never explicitly saved is never written anywhere.
|
|
9
|
+
* - Mirrors pi-tui's own history rules (trim, drop empty, skip a consecutive
|
|
10
|
+
* duplicate) so the picker and arrow up/down agree on what counts as an entry.
|
|
11
|
+
*
|
|
12
|
+
* AVOID:
|
|
13
|
+
* - Growing the ring: three entries is the contract, not a default.
|
|
14
|
+
*/
|
|
15
|
+
/** How many prompts stay staged for quick reuse. */
|
|
16
|
+
declare const RECENT_PROMPT_LIMIT = 3;
|
|
17
|
+
declare function createRecentPrompts(limit?: number): RecentPrompts;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { RECENT_PROMPT_LIMIT, createRecentPrompts };
|
|
20
|
+
//# sourceMappingURL=recentPrompts.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recentPrompts.d.cts","names":[],"sources":["../../src/services/recentPrompts.ts"],"mappings":";;;;;;;;;;;;;;;cAgBa;iBAEG,oBAAoB,iBAAsC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RecentPrompts } from "../types/prompt.mjs";
|
|
2
|
+
//#region src/services/recentPrompts.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The staged prompt ring.
|
|
5
|
+
*
|
|
6
|
+
* DESIGN PATTERNS:
|
|
7
|
+
* - Session-scoped and in memory. Nothing here touches the filesystem, so a
|
|
8
|
+
* prompt the user never explicitly saved is never written anywhere.
|
|
9
|
+
* - Mirrors pi-tui's own history rules (trim, drop empty, skip a consecutive
|
|
10
|
+
* duplicate) so the picker and arrow up/down agree on what counts as an entry.
|
|
11
|
+
*
|
|
12
|
+
* AVOID:
|
|
13
|
+
* - Growing the ring: three entries is the contract, not a default.
|
|
14
|
+
*/
|
|
15
|
+
/** How many prompts stay staged for quick reuse. */
|
|
16
|
+
declare const RECENT_PROMPT_LIMIT = 3;
|
|
17
|
+
declare function createRecentPrompts(limit?: number): RecentPrompts;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { RECENT_PROMPT_LIMIT, createRecentPrompts };
|
|
20
|
+
//# sourceMappingURL=recentPrompts.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recentPrompts.d.mts","names":[],"sources":["../../src/services/recentPrompts.ts"],"mappings":";;;;;;;;;;;;;;;cAgBa;iBAEG,oBAAoB,iBAAsC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recentPrompts.mjs","names":[],"sources":["../../src/services/recentPrompts.ts"],"sourcesContent":["import type { RecentPrompts } from '../types/prompt.ts';\n\n/**\n * The staged prompt ring.\n *\n * DESIGN PATTERNS:\n * - Session-scoped and in memory. Nothing here touches the filesystem, so a\n * prompt the user never explicitly saved is never written anywhere.\n * - Mirrors pi-tui's own history rules (trim, drop empty, skip a consecutive\n * duplicate) so the picker and arrow up/down agree on what counts as an entry.\n *\n * AVOID:\n * - Growing the ring: three entries is the contract, not a default.\n */\n\n/** How many prompts stay staged for quick reuse. */\nexport const RECENT_PROMPT_LIMIT = 3;\n\nexport function createRecentPrompts(limit: number = RECENT_PROMPT_LIMIT): RecentPrompts {\n let entries: string[] = [];\n\n return {\n push(text: string): void {\n const trimmed = text.trim();\n if (!trimmed) return;\n if (entries[0] === trimmed) return;\n entries = [trimmed, ...entries].slice(0, limit);\n },\n list(): readonly string[] {\n return entries;\n },\n };\n}\n"],"mappings":"AAgBA,MAAa,EAAsB,EAEnC,SAAgB,EAAoB,EAAA,EAAoD,CACtF,IAAI,EAAoB,CAAC,EAEzB,MAAO,CACL,KAAK,EAAoB,CACvB,IAAM,EAAU,EAAK,KAAK,EACrB,GACD,EAAQ,KAAO,IACnB,EAAU,CAAC,EAAS,GAAG,CAAO,CAAC,CAAC,MAAM,EAAG,CAAK,EAChD,EACA,MAA0B,CACxB,OAAO,CACT,CACF,CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const e=/^[a-z0-9][a-z0-9-]*$/u,t=/\$(?:\d|@|\{|ARGUMENTS)/u;function n(t){return t.length<=64&&e.test(t)}function r(e){return t.test(e)}function i(e){let t=e.split(`
|
|
2
|
+
`).map(e=>e.trim()).find(e=>e.length>0);return t?t.length<=80?t:`${t.slice(0,79).trimEnd()}…`:``}function a(e){return`"${e.replaceAll(/\s+/gu,` `).trim().replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"`}function o(e){let t=e.trim();return!t.startsWith(`"`)||!t.endsWith(`"`)||t.length<2?t:t.slice(1,-1).replaceAll(`\\"`,`"`).replaceAll(`\\\\`,`\\`)}function s(e){let t=e.text.endsWith(`
|
|
3
|
+
`)?e.text:`${e.text}\n`,n=e.description.trim();return n?[`---`,`description: ${a(n)}`,`---`,t].join(`
|
|
4
|
+
`):t}function c(e,t){let n=t.replaceAll(`\r
|
|
5
|
+
`,`
|
|
6
|
+
`);if(!n.startsWith(`---
|
|
7
|
+
`))return{name:e,description:i(n),text:n.trim()};let r=n.indexOf(`
|
|
8
|
+
---
|
|
9
|
+
`,3);if(r===-1)return{name:e,description:i(n),text:n.trim()};let a=n.slice(4,r),s=n.slice(r+3+2).trim(),c=a.split(`
|
|
10
|
+
`).find(e=>e.trimStart().startsWith(`description:`));return{name:e,description:c?o(c.trimStart().slice(12)):i(s),text:s}}exports.PROMPT_NAME_RULE=`lowercase letters, digits and dashes, starting with a letter or digit`,exports.buildPromptDocument=s,exports.describePrompt=i,exports.hasArgumentTokens=r,exports.isValidPromptName=n,exports.parsePromptDocument=c;
|
|
11
|
+
//# sourceMappingURL=savedPromptDocument.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"savedPromptDocument.cjs","names":[],"sources":["../../src/services/savedPromptDocument.ts"],"sourcesContent":["import type { SavedPrompt } from '../types/prompt.ts';\n\n/**\n * The saved prompt document format.\n *\n * DESIGN PATTERNS:\n * - A saved prompt is an ordinary Pi prompt template: YAML frontmatter with a\n * description, then the prompt body verbatim. Reusing that format is why\n * `/<name>` works on the next start without this package registering anything.\n * - Pure string handling. The store owns paths and the filesystem.\n *\n * AVOID:\n * - A richer frontmatter surface. Anything this package invents here stops\n * being a plain template that Pi can already read.\n */\n\nconst FRONTMATTER_FENCE = '---';\nconst DESCRIPTION_KEY = 'description:';\n/** Keeps the picker's second column to one readable line. */\nconst DESCRIPTION_LIMIT = 80;\n/** Filename and slash command in one, so the name has to be safe as both. */\nconst NAME_PATTERN = /^[a-z0-9][a-z0-9-]*$/u;\nconst NAME_LIMIT = 64;\n/** Tokens Pi's template engine substitutes when the prompt is invoked. */\nconst ARGUMENT_TOKEN_PATTERN = /\\$(?:\\d|@|\\{|ARGUMENTS)/u;\n\n/** The pattern a saved prompt name must match, for user-facing messages. */\nexport const PROMPT_NAME_RULE = 'lowercase letters, digits and dashes, starting with a letter or digit';\n\nexport function isValidPromptName(name: string): boolean {\n return name.length <= NAME_LIMIT && NAME_PATTERN.test(name);\n}\n\n/** Whether Pi would substitute argument tokens into this text on invocation. */\nexport function hasArgumentTokens(text: string): boolean {\n return ARGUMENT_TOKEN_PATTERN.test(text);\n}\n\n/** The first non-empty line, shortened for the picker's description column. */\nexport function describePrompt(text: string): string {\n const firstLine = text\n .split('\\n')\n .map((line) => line.trim())\n .find((line) => line.length > 0);\n if (!firstLine) return '';\n if (firstLine.length <= DESCRIPTION_LIMIT) return firstLine;\n return `${firstLine.slice(0, DESCRIPTION_LIMIT - 1).trimEnd()}…`;\n}\n\n/** Quotes the description so a colon or a quote cannot break the frontmatter. */\nfunction quoteDescription(description: string): string {\n const flattened = description.replaceAll(/\\s+/gu, ' ').trim();\n const escaped = flattened.replaceAll('\\\\', '\\\\\\\\').replaceAll('\"', '\\\\\"');\n return `\"${escaped}\"`;\n}\n\nfunction unquoteDescription(value: string): string {\n const trimmed = value.trim();\n if (!trimmed.startsWith('\"') || !trimmed.endsWith('\"') || trimmed.length < 2) return trimmed;\n return trimmed.slice(1, -1).replaceAll('\\\\\"', '\"').replaceAll('\\\\\\\\', '\\\\');\n}\n\nexport function buildPromptDocument(prompt: Pick<SavedPrompt, 'description' | 'text'>): string {\n const body = prompt.text.endsWith('\\n') ? prompt.text : `${prompt.text}\\n`;\n const description = prompt.description.trim();\n if (!description) return body;\n return [FRONTMATTER_FENCE, `description: ${quoteDescription(description)}`, FRONTMATTER_FENCE, body].join('\\n');\n}\n\n/**\n * Splits a template back into its description and body.\n *\n * A document without frontmatter, or with frontmatter this package did not\n * write, is still a usable prompt: the whole file becomes the body and the\n * description falls back to the first line.\n */\nexport function parsePromptDocument(name: string, content: string): SavedPrompt {\n const normalized = content.replaceAll('\\r\\n', '\\n');\n if (!normalized.startsWith(`${FRONTMATTER_FENCE}\\n`)) {\n return { name, description: describePrompt(normalized), text: normalized.trim() };\n }\n\n const closing = normalized.indexOf(`\\n${FRONTMATTER_FENCE}\\n`, FRONTMATTER_FENCE.length);\n if (closing === -1) {\n return { name, description: describePrompt(normalized), text: normalized.trim() };\n }\n\n const frontmatter = normalized.slice(FRONTMATTER_FENCE.length + 1, closing);\n const body = normalized.slice(closing + FRONTMATTER_FENCE.length + 2).trim();\n const descriptionLine = frontmatter.split('\\n').find((line) => line.trimStart().startsWith(DESCRIPTION_KEY));\n const description = descriptionLine\n ? unquoteDescription(descriptionLine.trimStart().slice(DESCRIPTION_KEY.length))\n : describePrompt(body);\n\n return { name, description, text: body };\n}\n"],"mappings":"AAgBA,MAKM,EAAe,wBAGf,EAAyB,2BAK/B,SAAgB,EAAkB,EAAuB,CACvD,OAAO,EAAK,QAAU,IAAc,EAAa,KAAK,CAAI,CAC5D,CAGA,SAAgB,EAAkB,EAAuB,CACvD,OAAO,EAAuB,KAAK,CAAI,CACzC,CAGA,SAAgB,EAAe,EAAsB,CACnD,IAAM,EAAY,EACf,MAAM;CAAI,CAAC,CACX,IAAK,GAAS,EAAK,KAAK,CAAC,CAAC,CAC1B,KAAM,GAAS,EAAK,OAAS,CAAC,EAGjC,OAFK,EACD,EAAU,QAAU,GAA0B,EAC3C,GAAG,EAAU,MAAM,EAAG,EAAqB,CAAC,CAAC,QAAQ,EAAE,GAFvC,EAGzB,CAGA,SAAS,EAAiB,EAA6B,CAGrD,MAAO,IAFW,EAAY,WAAW,QAAS,GAAG,CAAC,CAAC,KAC/B,CAAC,CAAC,WAAW,KAAM,MAAM,CAAC,CAAC,WAAW,IAAK,KAClD,EAAE,EACrB,CAEA,SAAS,EAAmB,EAAuB,CACjD,IAAM,EAAU,EAAM,KAAK,EAE3B,MADI,CAAC,EAAQ,WAAW,GAAG,GAAK,CAAC,EAAQ,SAAS,GAAG,GAAK,EAAQ,OAAS,EAAU,EAC9E,EAAQ,MAAM,EAAG,EAAE,CAAC,CAAC,WAAW,MAAO,GAAG,CAAC,CAAC,WAAW,OAAQ,IAAI,CAC5E,CAEA,SAAgB,EAAoB,EAA2D,CAC7F,IAAM,EAAO,EAAO,KAAK,SAAS;CAAI,EAAI,EAAO,KAAO,GAAG,EAAO,KAAK,IACjE,EAAc,EAAO,YAAY,KAAK,EAE5C,OADK,EACE,CAAC,MAAmB,gBAAgB,EAAiB,CAAW,IAAK,MAAmB,CAAI,CAAC,CAAC,KAAK;CAAI,EADrF,CAE3B,CASA,SAAgB,EAAoB,EAAc,EAA8B,CAC9E,IAAM,EAAa,EAAQ,WAAW;EAAQ;CAAI,EAClD,GAAI,CAAC,EAAW,WAAW;CAAwB,EACjD,MAAO,CAAE,OAAM,YAAa,EAAe,CAAU,EAAG,KAAM,EAAW,KAAK,CAAE,EAGlF,IAAM,EAAU,EAAW,QAAQ;;EAA4B,CAAwB,EACvF,GAAI,IAAY,GACd,MAAO,CAAE,OAAM,YAAa,EAAe,CAAU,EAAG,KAAM,EAAW,KAAK,CAAE,EAGlF,IAAM,EAAc,EAAW,MAAM,EAA8B,CAAO,EACpE,EAAO,EAAW,MAAM,EAAU,EAA2B,CAAC,CAAC,CAAC,KAAK,EACrE,EAAkB,EAAY,MAAM;CAAI,CAAC,CAAC,KAAM,GAAS,EAAK,UAAU,CAAC,CAAC,WAAW,cAAe,CAAC,EAK3G,MAAO,CAAE,OAAM,YAJK,EAChB,EAAmB,EAAgB,UAAU,CAAC,CAAC,MAAM,EAAsB,CAAC,EAC5E,EAAe,CAAI,EAEK,KAAM,CAAK,CACzC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SavedPrompt } from "../types/prompt.cjs";
|
|
2
|
+
//#region src/services/savedPromptDocument.d.ts
|
|
3
|
+
/** The pattern a saved prompt name must match, for user-facing messages. */
|
|
4
|
+
declare const PROMPT_NAME_RULE = "lowercase letters, digits and dashes, starting with a letter or digit";
|
|
5
|
+
declare function isValidPromptName(name: string): boolean;
|
|
6
|
+
/** Whether Pi would substitute argument tokens into this text on invocation. */
|
|
7
|
+
declare function hasArgumentTokens(text: string): boolean;
|
|
8
|
+
/** The first non-empty line, shortened for the picker's description column. */
|
|
9
|
+
declare function describePrompt(text: string): string;
|
|
10
|
+
declare function buildPromptDocument(prompt: Pick<SavedPrompt, 'description' | 'text'>): string;
|
|
11
|
+
/**
|
|
12
|
+
* Splits a template back into its description and body.
|
|
13
|
+
*
|
|
14
|
+
* A document without frontmatter, or with frontmatter this package did not
|
|
15
|
+
* write, is still a usable prompt: the whole file becomes the body and the
|
|
16
|
+
* description falls back to the first line.
|
|
17
|
+
*/
|
|
18
|
+
declare function parsePromptDocument(name: string, content: string): SavedPrompt;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { PROMPT_NAME_RULE, buildPromptDocument, describePrompt, hasArgumentTokens, isValidPromptName, parsePromptDocument };
|
|
21
|
+
//# sourceMappingURL=savedPromptDocument.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"savedPromptDocument.d.cts","names":[],"sources":["../../src/services/savedPromptDocument.ts"],"mappings":";;;cA2Ba;iBAEG,kBAAkB;;iBAKlB,kBAAkB;;iBAKlB,eAAe;iBAuBf,oBAAoB,QAAQ,KAAK;;;;;;;;iBAcjC,oBAAoB,cAAc,kBAAkB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SavedPrompt } from "../types/prompt.mjs";
|
|
2
|
+
//#region src/services/savedPromptDocument.d.ts
|
|
3
|
+
/** The pattern a saved prompt name must match, for user-facing messages. */
|
|
4
|
+
declare const PROMPT_NAME_RULE = "lowercase letters, digits and dashes, starting with a letter or digit";
|
|
5
|
+
declare function isValidPromptName(name: string): boolean;
|
|
6
|
+
/** Whether Pi would substitute argument tokens into this text on invocation. */
|
|
7
|
+
declare function hasArgumentTokens(text: string): boolean;
|
|
8
|
+
/** The first non-empty line, shortened for the picker's description column. */
|
|
9
|
+
declare function describePrompt(text: string): string;
|
|
10
|
+
declare function buildPromptDocument(prompt: Pick<SavedPrompt, 'description' | 'text'>): string;
|
|
11
|
+
/**
|
|
12
|
+
* Splits a template back into its description and body.
|
|
13
|
+
*
|
|
14
|
+
* A document without frontmatter, or with frontmatter this package did not
|
|
15
|
+
* write, is still a usable prompt: the whole file becomes the body and the
|
|
16
|
+
* description falls back to the first line.
|
|
17
|
+
*/
|
|
18
|
+
declare function parsePromptDocument(name: string, content: string): SavedPrompt;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { PROMPT_NAME_RULE, buildPromptDocument, describePrompt, hasArgumentTokens, isValidPromptName, parsePromptDocument };
|
|
21
|
+
//# sourceMappingURL=savedPromptDocument.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"savedPromptDocument.d.mts","names":[],"sources":["../../src/services/savedPromptDocument.ts"],"mappings":";;;cA2Ba;iBAEG,kBAAkB;;iBAKlB,kBAAkB;;iBAKlB,eAAe;iBAuBf,oBAAoB,QAAQ,KAAK;;;;;;;;iBAcjC,oBAAoB,cAAc,kBAAkB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const e=/^[a-z0-9][a-z0-9-]*$/u,t=/\$(?:\d|@|\{|ARGUMENTS)/u,n=`lowercase letters, digits and dashes, starting with a letter or digit`;function r(t){return t.length<=64&&e.test(t)}function i(e){return t.test(e)}function a(e){let t=e.split(`
|
|
2
|
+
`).map(e=>e.trim()).find(e=>e.length>0);return t?t.length<=80?t:`${t.slice(0,79).trimEnd()}…`:``}function o(e){return`"${e.replaceAll(/\s+/gu,` `).trim().replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"`}function s(e){let t=e.trim();return!t.startsWith(`"`)||!t.endsWith(`"`)||t.length<2?t:t.slice(1,-1).replaceAll(`\\"`,`"`).replaceAll(`\\\\`,`\\`)}function c(e){let t=e.text.endsWith(`
|
|
3
|
+
`)?e.text:`${e.text}\n`,n=e.description.trim();return n?[`---`,`description: ${o(n)}`,`---`,t].join(`
|
|
4
|
+
`):t}function l(e,t){let n=t.replaceAll(`\r
|
|
5
|
+
`,`
|
|
6
|
+
`);if(!n.startsWith(`---
|
|
7
|
+
`))return{name:e,description:a(n),text:n.trim()};let r=n.indexOf(`
|
|
8
|
+
---
|
|
9
|
+
`,3);if(r===-1)return{name:e,description:a(n),text:n.trim()};let i=n.slice(4,r),o=n.slice(r+3+2).trim(),c=i.split(`
|
|
10
|
+
`).find(e=>e.trimStart().startsWith(`description:`));return{name:e,description:c?s(c.trimStart().slice(12)):a(o),text:o}}export{n as PROMPT_NAME_RULE,c as buildPromptDocument,a as describePrompt,i as hasArgumentTokens,r as isValidPromptName,l as parsePromptDocument};
|
|
11
|
+
//# sourceMappingURL=savedPromptDocument.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"savedPromptDocument.mjs","names":[],"sources":["../../src/services/savedPromptDocument.ts"],"sourcesContent":["import type { SavedPrompt } from '../types/prompt.ts';\n\n/**\n * The saved prompt document format.\n *\n * DESIGN PATTERNS:\n * - A saved prompt is an ordinary Pi prompt template: YAML frontmatter with a\n * description, then the prompt body verbatim. Reusing that format is why\n * `/<name>` works on the next start without this package registering anything.\n * - Pure string handling. The store owns paths and the filesystem.\n *\n * AVOID:\n * - A richer frontmatter surface. Anything this package invents here stops\n * being a plain template that Pi can already read.\n */\n\nconst FRONTMATTER_FENCE = '---';\nconst DESCRIPTION_KEY = 'description:';\n/** Keeps the picker's second column to one readable line. */\nconst DESCRIPTION_LIMIT = 80;\n/** Filename and slash command in one, so the name has to be safe as both. */\nconst NAME_PATTERN = /^[a-z0-9][a-z0-9-]*$/u;\nconst NAME_LIMIT = 64;\n/** Tokens Pi's template engine substitutes when the prompt is invoked. */\nconst ARGUMENT_TOKEN_PATTERN = /\\$(?:\\d|@|\\{|ARGUMENTS)/u;\n\n/** The pattern a saved prompt name must match, for user-facing messages. */\nexport const PROMPT_NAME_RULE = 'lowercase letters, digits and dashes, starting with a letter or digit';\n\nexport function isValidPromptName(name: string): boolean {\n return name.length <= NAME_LIMIT && NAME_PATTERN.test(name);\n}\n\n/** Whether Pi would substitute argument tokens into this text on invocation. */\nexport function hasArgumentTokens(text: string): boolean {\n return ARGUMENT_TOKEN_PATTERN.test(text);\n}\n\n/** The first non-empty line, shortened for the picker's description column. */\nexport function describePrompt(text: string): string {\n const firstLine = text\n .split('\\n')\n .map((line) => line.trim())\n .find((line) => line.length > 0);\n if (!firstLine) return '';\n if (firstLine.length <= DESCRIPTION_LIMIT) return firstLine;\n return `${firstLine.slice(0, DESCRIPTION_LIMIT - 1).trimEnd()}…`;\n}\n\n/** Quotes the description so a colon or a quote cannot break the frontmatter. */\nfunction quoteDescription(description: string): string {\n const flattened = description.replaceAll(/\\s+/gu, ' ').trim();\n const escaped = flattened.replaceAll('\\\\', '\\\\\\\\').replaceAll('\"', '\\\\\"');\n return `\"${escaped}\"`;\n}\n\nfunction unquoteDescription(value: string): string {\n const trimmed = value.trim();\n if (!trimmed.startsWith('\"') || !trimmed.endsWith('\"') || trimmed.length < 2) return trimmed;\n return trimmed.slice(1, -1).replaceAll('\\\\\"', '\"').replaceAll('\\\\\\\\', '\\\\');\n}\n\nexport function buildPromptDocument(prompt: Pick<SavedPrompt, 'description' | 'text'>): string {\n const body = prompt.text.endsWith('\\n') ? prompt.text : `${prompt.text}\\n`;\n const description = prompt.description.trim();\n if (!description) return body;\n return [FRONTMATTER_FENCE, `description: ${quoteDescription(description)}`, FRONTMATTER_FENCE, body].join('\\n');\n}\n\n/**\n * Splits a template back into its description and body.\n *\n * A document without frontmatter, or with frontmatter this package did not\n * write, is still a usable prompt: the whole file becomes the body and the\n * description falls back to the first line.\n */\nexport function parsePromptDocument(name: string, content: string): SavedPrompt {\n const normalized = content.replaceAll('\\r\\n', '\\n');\n if (!normalized.startsWith(`${FRONTMATTER_FENCE}\\n`)) {\n return { name, description: describePrompt(normalized), text: normalized.trim() };\n }\n\n const closing = normalized.indexOf(`\\n${FRONTMATTER_FENCE}\\n`, FRONTMATTER_FENCE.length);\n if (closing === -1) {\n return { name, description: describePrompt(normalized), text: normalized.trim() };\n }\n\n const frontmatter = normalized.slice(FRONTMATTER_FENCE.length + 1, closing);\n const body = normalized.slice(closing + FRONTMATTER_FENCE.length + 2).trim();\n const descriptionLine = frontmatter.split('\\n').find((line) => line.trimStart().startsWith(DESCRIPTION_KEY));\n const description = descriptionLine\n ? unquoteDescription(descriptionLine.trimStart().slice(DESCRIPTION_KEY.length))\n : describePrompt(body);\n\n return { name, description, text: body };\n}\n"],"mappings":"AAgBA,MAKM,EAAe,wBAGf,EAAyB,2BAGlB,EAAmB,wEAEhC,SAAgB,EAAkB,EAAuB,CACvD,OAAO,EAAK,QAAU,IAAc,EAAa,KAAK,CAAI,CAC5D,CAGA,SAAgB,EAAkB,EAAuB,CACvD,OAAO,EAAuB,KAAK,CAAI,CACzC,CAGA,SAAgB,EAAe,EAAsB,CACnD,IAAM,EAAY,EACf,MAAM;CAAI,CAAC,CACX,IAAK,GAAS,EAAK,KAAK,CAAC,CAAC,CAC1B,KAAM,GAAS,EAAK,OAAS,CAAC,EAGjC,OAFK,EACD,EAAU,QAAU,GAA0B,EAC3C,GAAG,EAAU,MAAM,EAAG,EAAqB,CAAC,CAAC,QAAQ,EAAE,GAFvC,EAGzB,CAGA,SAAS,EAAiB,EAA6B,CAGrD,MAAO,IAFW,EAAY,WAAW,QAAS,GAAG,CAAC,CAAC,KAC/B,CAAC,CAAC,WAAW,KAAM,MAAM,CAAC,CAAC,WAAW,IAAK,KAClD,EAAE,EACrB,CAEA,SAAS,EAAmB,EAAuB,CACjD,IAAM,EAAU,EAAM,KAAK,EAE3B,MADI,CAAC,EAAQ,WAAW,GAAG,GAAK,CAAC,EAAQ,SAAS,GAAG,GAAK,EAAQ,OAAS,EAAU,EAC9E,EAAQ,MAAM,EAAG,EAAE,CAAC,CAAC,WAAW,MAAO,GAAG,CAAC,CAAC,WAAW,OAAQ,IAAI,CAC5E,CAEA,SAAgB,EAAoB,EAA2D,CAC7F,IAAM,EAAO,EAAO,KAAK,SAAS;CAAI,EAAI,EAAO,KAAO,GAAG,EAAO,KAAK,IACjE,EAAc,EAAO,YAAY,KAAK,EAE5C,OADK,EACE,CAAC,MAAmB,gBAAgB,EAAiB,CAAW,IAAK,MAAmB,CAAI,CAAC,CAAC,KAAK;CAAI,EADrF,CAE3B,CASA,SAAgB,EAAoB,EAAc,EAA8B,CAC9E,IAAM,EAAa,EAAQ,WAAW;EAAQ;CAAI,EAClD,GAAI,CAAC,EAAW,WAAW;CAAwB,EACjD,MAAO,CAAE,OAAM,YAAa,EAAe,CAAU,EAAG,KAAM,EAAW,KAAK,CAAE,EAGlF,IAAM,EAAU,EAAW,QAAQ;;EAA4B,CAAwB,EACvF,GAAI,IAAY,GACd,MAAO,CAAE,OAAM,YAAa,EAAe,CAAU,EAAG,KAAM,EAAW,KAAK,CAAE,EAGlF,IAAM,EAAc,EAAW,MAAM,EAA8B,CAAO,EACpE,EAAO,EAAW,MAAM,EAAU,EAA2B,CAAC,CAAC,CAAC,KAAK,EACrE,EAAkB,EAAY,MAAM;CAAI,CAAC,CAAC,KAAM,GAAS,EAAK,UAAU,CAAC,CAAC,WAAW,cAAe,CAAC,EAK3G,MAAO,CAAE,OAAM,YAJK,EAChB,EAAmB,EAAgB,UAAU,CAAC,CAAC,MAAM,EAAsB,CAAC,EAC5E,EAAe,CAAI,EAEK,KAAM,CAAK,CACzC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/types/prompt.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Ports and domain contracts for the prompt library.
|
|
4
|
+
*
|
|
5
|
+
* DESIGN PATTERNS:
|
|
6
|
+
* - The store port is named in this package's vocabulary; the filesystem
|
|
7
|
+
* implementation lives in src/adapters/node and imports the port from here.
|
|
8
|
+
* - Staged prompts are session-scoped and never reach a port: the ring is pure
|
|
9
|
+
* in-memory state, so nothing here describes persistence for them.
|
|
10
|
+
*
|
|
11
|
+
* AVOID:
|
|
12
|
+
* - Declaring a port beside its implementation, which would force services to
|
|
13
|
+
* depend on the filesystem.
|
|
14
|
+
*/
|
|
15
|
+
/** A prompt saved as a Pi prompt template on disk. */
|
|
16
|
+
interface SavedPrompt {
|
|
17
|
+
/** Template name without the `.md` suffix, which is also its slash command. */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Frontmatter description, empty when the document declares none. */
|
|
20
|
+
description: string;
|
|
21
|
+
/** Prompt body, verbatim. */
|
|
22
|
+
text: string;
|
|
23
|
+
}
|
|
24
|
+
/** Where a saved prompt landed, so a command can tell the user. */
|
|
25
|
+
interface SavedPromptWrite {
|
|
26
|
+
name: string;
|
|
27
|
+
path: string;
|
|
28
|
+
}
|
|
29
|
+
/** Reads and writes the Pi prompt templates this package owns. */
|
|
30
|
+
interface SavedPromptStore {
|
|
31
|
+
/** Every readable template in the prompts directory, sorted by name. */
|
|
32
|
+
list(): Promise<readonly SavedPrompt[]>;
|
|
33
|
+
/** Whether a template file already exists under that name. */
|
|
34
|
+
has(name: string): Promise<boolean>;
|
|
35
|
+
/** Writes the template, replacing any existing file with the same name. */
|
|
36
|
+
save(prompt: SavedPrompt): Promise<SavedPromptWrite>;
|
|
37
|
+
/** Deletes the template, answering false when there was none to delete. */
|
|
38
|
+
remove(name: string): Promise<boolean>;
|
|
39
|
+
}
|
|
40
|
+
/** The session-scoped ring of prompts the user submitted. */
|
|
41
|
+
interface RecentPrompts {
|
|
42
|
+
/** Records a submitted prompt as the newest entry. */
|
|
43
|
+
push(text: string): void;
|
|
44
|
+
/** Staged prompts, newest first. */
|
|
45
|
+
list(): readonly string[];
|
|
46
|
+
}
|
|
47
|
+
/** Everything the extension needs, constructed in src/container. */
|
|
48
|
+
interface PromptExtensionDependencies {
|
|
49
|
+
store: SavedPromptStore;
|
|
50
|
+
recent: RecentPrompts;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { PromptExtensionDependencies, RecentPrompts, SavedPrompt, SavedPromptStore, SavedPromptWrite };
|
|
54
|
+
//# sourceMappingURL=prompt.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.cts","names":[],"sources":["../../src/types/prompt.ts"],"mappings":";;;;;;;;;;;;;;;UAeiB;;EAEf;;EAEA;;EAEA;;;UAIe;EACf;EACA;;;UAIe;;EAEf,QAAQ,iBAAiB;;EAEzB,IAAI,eAAe;;EAEnB,KAAK,QAAQ,cAAc,QAAQ;;EAEnC,OAAO,eAAe;;;UAIP;;EAEf,KAAK;;EAEL;;;UAIe;EACf,OAAO;EACP,QAAQ"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/types/prompt.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Ports and domain contracts for the prompt library.
|
|
4
|
+
*
|
|
5
|
+
* DESIGN PATTERNS:
|
|
6
|
+
* - The store port is named in this package's vocabulary; the filesystem
|
|
7
|
+
* implementation lives in src/adapters/node and imports the port from here.
|
|
8
|
+
* - Staged prompts are session-scoped and never reach a port: the ring is pure
|
|
9
|
+
* in-memory state, so nothing here describes persistence for them.
|
|
10
|
+
*
|
|
11
|
+
* AVOID:
|
|
12
|
+
* - Declaring a port beside its implementation, which would force services to
|
|
13
|
+
* depend on the filesystem.
|
|
14
|
+
*/
|
|
15
|
+
/** A prompt saved as a Pi prompt template on disk. */
|
|
16
|
+
interface SavedPrompt {
|
|
17
|
+
/** Template name without the `.md` suffix, which is also its slash command. */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Frontmatter description, empty when the document declares none. */
|
|
20
|
+
description: string;
|
|
21
|
+
/** Prompt body, verbatim. */
|
|
22
|
+
text: string;
|
|
23
|
+
}
|
|
24
|
+
/** Where a saved prompt landed, so a command can tell the user. */
|
|
25
|
+
interface SavedPromptWrite {
|
|
26
|
+
name: string;
|
|
27
|
+
path: string;
|
|
28
|
+
}
|
|
29
|
+
/** Reads and writes the Pi prompt templates this package owns. */
|
|
30
|
+
interface SavedPromptStore {
|
|
31
|
+
/** Every readable template in the prompts directory, sorted by name. */
|
|
32
|
+
list(): Promise<readonly SavedPrompt[]>;
|
|
33
|
+
/** Whether a template file already exists under that name. */
|
|
34
|
+
has(name: string): Promise<boolean>;
|
|
35
|
+
/** Writes the template, replacing any existing file with the same name. */
|
|
36
|
+
save(prompt: SavedPrompt): Promise<SavedPromptWrite>;
|
|
37
|
+
/** Deletes the template, answering false when there was none to delete. */
|
|
38
|
+
remove(name: string): Promise<boolean>;
|
|
39
|
+
}
|
|
40
|
+
/** The session-scoped ring of prompts the user submitted. */
|
|
41
|
+
interface RecentPrompts {
|
|
42
|
+
/** Records a submitted prompt as the newest entry. */
|
|
43
|
+
push(text: string): void;
|
|
44
|
+
/** Staged prompts, newest first. */
|
|
45
|
+
list(): readonly string[];
|
|
46
|
+
}
|
|
47
|
+
/** Everything the extension needs, constructed in src/container. */
|
|
48
|
+
interface PromptExtensionDependencies {
|
|
49
|
+
store: SavedPromptStore;
|
|
50
|
+
recent: RecentPrompts;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { PromptExtensionDependencies, RecentPrompts, SavedPrompt, SavedPromptStore, SavedPromptWrite };
|
|
54
|
+
//# sourceMappingURL=prompt.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.mts","names":[],"sources":["../../src/types/prompt.ts"],"mappings":";;;;;;;;;;;;;;;UAeiB;;EAEf;;EAEA;;EAEA;;;UAIe;EACf;EACA;;;UAIe;;EAEf,QAAQ,iBAAiB;;EAEzB,IAAI,eAAe;;EAEnB,KAAK,QAAQ,cAAc,QAAQ;;EAEnC,OAAO,eAAe;;;UAIP;;EAEf,KAAK;;EAEL;;;UAIe;EACf,OAAO;EACP,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webPrompts.cjs","names":[],"sources":["../../src/types/webPrompts.ts"],"sourcesContent":["/**\n * The vocabulary this package's HTTP API and its cockpit plugin share.\n *\n * DESIGN PATTERNS:\n * - Wire JSON only, no node types, so the browser bundle can carry this module.\n * - Route paths and URL building live here, so a page never assembles a URL of\n * its own and the two halves cannot drift.\n * - Saved prompts are machine-wide, so no route names a session.\n *\n * AVOID:\n * - Importing anything from src/services or src/adapters here.\n */\n\n/** Where a host mounts this package's API; the segment after /api/plugin/. */\nexport const API_BASE_PATH = 'prompts';\n\n/** The collection, relative to the API's own mount. */\nexport const PROMPTS_PATH = '/prompts';\n\n/** One saved prompt, relative to the API's own mount. */\nexport function promptPath(name: string): string {\n return `${PROMPTS_PATH}/${encodeURIComponent(name)}`;\n}\n\n/** The absolute URL a page fetches for the collection. */\nexport function promptsUrl(): string {\n return `/api/plugin/${API_BASE_PATH}${PROMPTS_PATH}`;\n}\n\n/** The absolute URL a page fetches for one saved prompt. */\nexport function promptUrl(name: string): string {\n return `/api/plugin/${API_BASE_PATH}${promptPath(name)}`;\n}\n\n/** One saved prompt, as the cockpit shows it. */\nexport interface SavedPromptView {\n name: string;\n description: string;\n text: string;\n}\n\n/** What the collection route answers with. */\nexport interface SavedPromptListResponse {\n prompts: readonly SavedPromptView[];\n}\n\n/** What a write route answers with. */\nexport interface SavedPromptWriteResponse {\n prompt: SavedPromptView;\n /** True when the write replaced a template that already existed. */\n replaced: boolean;\n}\n\n/** What every route answers with when it refuses. */\nexport interface PromptErrorResponse {\n error: string;\n}\n\nexport function isPromptErrorResponse(value: unknown): value is PromptErrorResponse {\n return typeof value === 'object' && value !== null && typeof (value as PromptErrorResponse).error === 'string';\n}\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webPrompts.mjs","names":[],"sources":["../../src/types/webPrompts.ts"],"sourcesContent":["/**\n * The vocabulary this package's HTTP API and its cockpit plugin share.\n *\n * DESIGN PATTERNS:\n * - Wire JSON only, no node types, so the browser bundle can carry this module.\n * - Route paths and URL building live here, so a page never assembles a URL of\n * its own and the two halves cannot drift.\n * - Saved prompts are machine-wide, so no route names a session.\n *\n * AVOID:\n * - Importing anything from src/services or src/adapters here.\n */\n\n/** Where a host mounts this package's API; the segment after /api/plugin/. */\nexport const API_BASE_PATH = 'prompts';\n\n/** The collection, relative to the API's own mount. */\nexport const PROMPTS_PATH = '/prompts';\n\n/** One saved prompt, relative to the API's own mount. */\nexport function promptPath(name: string): string {\n return `${PROMPTS_PATH}/${encodeURIComponent(name)}`;\n}\n\n/** The absolute URL a page fetches for the collection. */\nexport function promptsUrl(): string {\n return `/api/plugin/${API_BASE_PATH}${PROMPTS_PATH}`;\n}\n\n/** The absolute URL a page fetches for one saved prompt. */\nexport function promptUrl(name: string): string {\n return `/api/plugin/${API_BASE_PATH}${promptPath(name)}`;\n}\n\n/** One saved prompt, as the cockpit shows it. */\nexport interface SavedPromptView {\n name: string;\n description: string;\n text: string;\n}\n\n/** What the collection route answers with. */\nexport interface SavedPromptListResponse {\n prompts: readonly SavedPromptView[];\n}\n\n/** What a write route answers with. */\nexport interface SavedPromptWriteResponse {\n prompt: SavedPromptView;\n /** True when the write replaced a template that already existed. */\n replaced: boolean;\n}\n\n/** What every route answers with when it refuses. */\nexport interface PromptErrorResponse {\n error: string;\n}\n\nexport function isPromptErrorResponse(value: unknown): value is PromptErrorResponse {\n return typeof value === 'object' && value !== null && typeof (value as PromptErrorResponse).error === 'string';\n}\n"],"mappings":"AAcA,MAAa,EAAgB,UAGhB,EAAe"}
|
package/llms.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @agimon-ai/doompi-prompt
|
|
2
|
+
|
|
3
|
+
Package-owned guidance for Staged recent prompts and saved prompt templates for DoomPi
|
|
4
|
+
|
|
5
|
+
## How to use
|
|
6
|
+
|
|
7
|
+
- [Use Prompt](./src/prompts/doompi-use-prompt/SKILL.md): Run the package command and follow its package-specific usage guidance.
|
|
8
|
+
|
|
9
|
+
## Resources
|
|
10
|
+
|
|
11
|
+
- [Package README](./README.md): Installation, development commands, Pi entrypoint, and extension-specific usage.
|
package/package.json
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agimon-ai/doompi-prompt",
|
|
3
|
+
"version": "0.0.1-alpha.0",
|
|
4
|
+
"description": "Staged recent prompts and saved prompt templates for DoomPi",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"coding-agent",
|
|
8
|
+
"developer-tools",
|
|
9
|
+
"doompi",
|
|
10
|
+
"pi-coding-agent",
|
|
11
|
+
"pi-extension",
|
|
12
|
+
"pi-package",
|
|
13
|
+
"prompt-library",
|
|
14
|
+
"typescript"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://agimon.ai",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/AgiFlow/doompi/issues"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "Vuong Ngo",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/AgiFlow/doompi.git",
|
|
25
|
+
"directory": "packages/default/doompi-prompt"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"src/web",
|
|
30
|
+
"src/exports/webClient.ts",
|
|
31
|
+
"src/types/webPrompts.ts",
|
|
32
|
+
"src/prompts",
|
|
33
|
+
"llms.txt",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE",
|
|
36
|
+
"package.json"
|
|
37
|
+
],
|
|
38
|
+
"type": "module",
|
|
39
|
+
"main": "./dist/index.cjs",
|
|
40
|
+
"types": "./dist/index.d.mts",
|
|
41
|
+
"jsnext:main": "./dist/index.mjs",
|
|
42
|
+
"exports": {
|
|
43
|
+
".": {
|
|
44
|
+
"types": "./dist/index.d.mts",
|
|
45
|
+
"import": "./dist/index.mjs",
|
|
46
|
+
"require": "./dist/index.cjs"
|
|
47
|
+
},
|
|
48
|
+
"./extensions/pi": {
|
|
49
|
+
"types": "./dist/extensions/pi.d.mts",
|
|
50
|
+
"import": "./dist/extensions/pi.mjs",
|
|
51
|
+
"require": "./dist/extensions/pi.cjs"
|
|
52
|
+
},
|
|
53
|
+
"./hub-api": {
|
|
54
|
+
"types": "./dist/hubApi.d.mts",
|
|
55
|
+
"import": "./dist/hubApi.mjs",
|
|
56
|
+
"require": "./dist/hubApi.cjs"
|
|
57
|
+
},
|
|
58
|
+
"./package.json": "./package.json"
|
|
59
|
+
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@deepseek-ai/cordis": "4.0.1",
|
|
65
|
+
"hono": "4.13.5",
|
|
66
|
+
"@agimon-ai/doompi-ui": "0.0.1-alpha.50",
|
|
67
|
+
"@agimon-ai/doompi-web-components": "0.0.1-alpha.10",
|
|
68
|
+
"@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.49",
|
|
69
|
+
"@agimon-ai/doompi-web-contracts": "0.0.1-alpha.13",
|
|
70
|
+
"@agimon-ai/doompi-web-security": "0.0.1-alpha.11"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@earendil-works/pi-coding-agent": "0.84.4",
|
|
74
|
+
"@earendil-works/pi-tui": "0.84.4",
|
|
75
|
+
"@types/node": "26.2.0",
|
|
76
|
+
"@types/react": "19.2.18",
|
|
77
|
+
"@types/react-dom": "19.2.3",
|
|
78
|
+
"@vitest/coverage-v8": "4.1.11",
|
|
79
|
+
"react": "19.2.8",
|
|
80
|
+
"react-dom": "19.2.8",
|
|
81
|
+
"tsdown": "0.22.14",
|
|
82
|
+
"typescript": "7.0.2",
|
|
83
|
+
"vitest": "4.1.11",
|
|
84
|
+
"@agimon-ai/vibe-lint-plugin-doom-extension": "0.0.1-alpha.47"
|
|
85
|
+
},
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"@earendil-works/pi-coding-agent": "0.84.4",
|
|
88
|
+
"@earendil-works/pi-tui": "0.84.4"
|
|
89
|
+
},
|
|
90
|
+
"peerDependenciesMeta": {
|
|
91
|
+
"@earendil-works/pi-coding-agent": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"@earendil-works/pi-tui": {
|
|
95
|
+
"optional": true
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"engines": {
|
|
99
|
+
"node": ">=22.19.0"
|
|
100
|
+
},
|
|
101
|
+
"doompiApi": {
|
|
102
|
+
"basePath": "prompts",
|
|
103
|
+
"hub": {
|
|
104
|
+
"entry": "./src/exports/hubApi.ts",
|
|
105
|
+
"dist": "./dist/hubApi.mjs"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"doompiWeb": {
|
|
109
|
+
"pluginId": "prompts",
|
|
110
|
+
"client": "./src/exports/webClient.ts"
|
|
111
|
+
},
|
|
112
|
+
"pi": {
|
|
113
|
+
"extensions": [
|
|
114
|
+
"./dist/extensions/pi.mjs"
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
"scripts": {
|
|
118
|
+
"build": "tsdown",
|
|
119
|
+
"test": "vitest --run",
|
|
120
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p src/web/tsconfig.json",
|
|
121
|
+
"lint": "oxlint . && oxfmt . --check",
|
|
122
|
+
"fixcode": "oxlint . --fix && oxfmt ."
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: doompi-use-prompt
|
|
3
|
+
description: 'Use @agimon-ai/doompi-prompt: Staged recent prompts and saved prompt templates for DoomPi'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Use Prompt
|
|
7
|
+
|
|
8
|
+
Read the package [README](../../../README.md) for its exact installation, command, configuration, and behavior.
|
|
9
|
+
|
|
10
|
+
## Guidance
|
|
11
|
+
|
|
12
|
+
- `/prompts`, or `SPC e p`, opens a filterable picker over the last three prompts of this session and every saved prompt, then stages the chosen one in the editor rather than sending it.
|
|
13
|
+
- `/prompt-save <name>` saves the current draft, or the newest staged prompt when the draft is empty, as `~/.pi/agent/prompts/<name>.md`. Names are lowercase letters, digits and dashes.
|
|
14
|
+
- A saved prompt is an ordinary Pi prompt template, so it is also `/<name>` from the next start, with `$1` and `$@` argument substitution. Text containing those tokens is substituted on invocation; the save command says so when it sees them.
|
|
15
|
+
- Staged prompts live in memory for the session only. Nothing reaches disk until the user saves a prompt explicitly.
|
|
16
|
+
- Arrow up and down are Pi's own in-session history and are not modified by this package.
|
|
17
|
+
- Do not require DoomPi Help for runtime activation. Help only makes this package guidance discoverable while the minor mode is active.
|