pi-prompt-template-model-enhanced 0.12.0 → 0.13.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/CHANGELOG.md +15 -0
- package/README.md +50 -9
- package/index.ts +73 -5
- package/package.json +1 -1
- package/prompt-dry-run-tui.ts +1 -1
- package/prompt-includes.ts +169 -47
- package/prompt-loader.ts +352 -90
- package/prompt-validation.ts +128 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.13.0](https://github.com/Nabsku/pi-prompt-template-model-enhanced/compare/v0.12.0...v0.13.0) (2026-06-21)
|
|
4
|
+
|
|
5
|
+
### Prompt library
|
|
6
|
+
|
|
7
|
+
* Added `.pi/prompt-library` and `~/.pi/agent/prompt-library` roots for reusable prompt commands, chain steps, and include fragments ([b5e235b](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/b5e235b099df3a4089b196a3e482c64e545f5bbb), [4eba6b3](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/4eba6b3c98b83d50ab167e66eb26c782ade00d99)).
|
|
8
|
+
* Prompt-library commands now support validation, source summaries, dry-run/TUI labels, and includes from library-local fragments ([7dec4c8](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/7dec4c8bc2f774fa6451c842f9ee12cc875de648), [5468b16](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/5468b16e19ac1e556980f9a5416fc574be055aeb), [ceda208](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/ceda208e9f027d7a45c600bf2bcfb36d4552f55e)).
|
|
9
|
+
* Added `hidden: true` for internal prompt-library commands: hidden commands stay out of slash-command discovery and pickers, but remain addressable by exact dry-run/print lookup and chain references ([413ef55](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/413ef55ac8c3bafe61c8b1a3d560eb644e7e7d15)).
|
|
10
|
+
|
|
11
|
+
### Hardening and compatibility
|
|
12
|
+
|
|
13
|
+
* Tightened project prompt-library trust boundaries, including chain preflight approval and safer handling of project library includes ([c1198cf](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/c1198cf918045db38d2d7c8f767e1be82843f634), [40c4458](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/40c44587ff8a94e2f6d6d94f13a9c2894503d35b)).
|
|
14
|
+
* Hardened prompt-library loading around symlinks, dot-prefixed entries, invalid metadata, include-only fragments, and stale hidden command handlers ([94c8bdd](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/94c8bddcba1d16502676d34f47fccbeb3235fd05), [b62cbec](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/b62cbecbeaf25ecef66abf14c6e71bca03c40c3c), [ace7651](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/ace76519fcea80a20b217ce82e62a201ad0afa06)).
|
|
15
|
+
* Plain prompt-library fragments now stay quiet unless included, while valid thinking-only and model-conditional library commands still load normally ([c353e1e](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/c353e1e0d10377e94bae763084efd1f9ac398260), [f2e8850](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/f2e8850ea2c5be080d7c73764303f5fabdcd1c44), [8808b05](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/8808b05eeafd226adfb5a57a07c195d0550fe4e8), [dea05fc](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/dea05fc9b27755f9407976e4028f77704e27e044)).
|
|
16
|
+
* Validation source summaries now count broken, skipped, duplicate, empty-model, invalid-marker, and shadowed library commands consistently instead of misreporting them as fragments or dropping them ([354bea9](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/354bea956a13e0845167246f4ba68778db5ce6b8), [126ab9b](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/126ab9bbe2149f1c6c78967ded308f56f933a6e7), [fd028ca](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/fd028ca1ad78f329ef1d9325158d66a2541701e4), [0fc6877](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/0fc6877dca2b16385d7a95e6d01a7a3f94d2ce07), [e8a91d1](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/e8a91d14be0430894cdc3716f28754ad561edd68), [73c91c1](https://github.com/Nabsku/pi-prompt-template-model-enhanced/commit/73c91c1b2d41792528dc32c5e9798b7bb213c09e)).
|
|
17
|
+
|
|
3
18
|
## [0.12.0](https://github.com/Nabsku/pi-prompt-template-model-enhanced/compare/v0.11.2...v0.12.0) (2026-06-20)
|
|
4
19
|
|
|
5
20
|
|
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ Start a Python REPL session and help me debug: $@
|
|
|
83
83
|
|
|
84
84
|
Run `/validate-prompts` to check prompt templates before using them. It reloads the project and user prompt directories, validates frontmatter, include paths, include cycles, chain declarations, reserved command names, and skill references that can be resolved from registered or filesystem skills.
|
|
85
85
|
|
|
86
|
-
Validation also reports an include graph for prompts that declare frontmatter includes (`include` / `includes`), use inline include directives, or fail include processing. Each relevant prompt is listed with its include dependencies, including nested partial-to-partial includes.
|
|
86
|
+
Validation also reports an include graph for prompts that declare frontmatter includes (`include` / `includes`), use inline include directives, or fail include processing. Each relevant prompt is listed with its include dependencies, including nested partial-to-partial includes. The report also includes a source summary that separates project prompts, user prompts, prompt-library commands, and include-only prompt-library fragments so command-capable library entries are easy to distinguish from reusable parts.
|
|
87
87
|
|
|
88
88
|
A clean library reports success:
|
|
89
89
|
|
|
@@ -134,6 +134,8 @@ In Pi TUI mode, the commands open an interactive picker/inspector by default:
|
|
|
134
134
|
TUI behavior:
|
|
135
135
|
|
|
136
136
|
- no template name opens a searchable template picker;
|
|
137
|
+
- picker rows label prompt-library commands as `project library` or `user library`, so reusable library commands are distinct from core `.pi/prompts` templates;
|
|
138
|
+
- `hidden: true` command-capable prompts are omitted from the picker, but an exact `/print-prompt <name>` or `/dry-run-prompt <name>` still opens them;
|
|
137
139
|
- a template name opens the inspector directly;
|
|
138
140
|
- `--plain` forces the stdout/plain report even in TUI mode;
|
|
139
141
|
- unsupported templates, such as deterministic or chain templates, show the same diagnostic as the plain path;
|
|
@@ -157,6 +159,7 @@ All fields are optional. Templates that don't use any extension features (no `mo
|
|
|
157
159
|
| `includes` | — | List of shared `.md` partials to insert into the prompt. See [Prompt includes](#prompt-includes). |
|
|
158
160
|
| `include` | — | Shortcut for a single partial, equivalent to `includes: [file.md]`. See [Prompt includes](#prompt-includes). |
|
|
159
161
|
| `description` | — | Short text shown next to the command in autocomplete. |
|
|
162
|
+
| `hidden` | `false` | Hide a command-capable prompt from slash-command registration and the TUI picker while keeping it addressable by exact `/print-prompt` / `/dry-run-prompt` name and usable as an internal chain step. Visibility metadata alone does not make a plain file command-capable. |
|
|
160
163
|
| `chain` | — | Declares a reusable pipeline of templates (`step -> step`). When set, the body is ignored. See [Chain Templates](#chain-templates). |
|
|
161
164
|
| `chainContext` | — | Chain templates only. Set to `summary` so delegated steps receive a compact summary of what previous steps did. Steps with `inheritContext: true` are excluded. See [Chain context for delegated steps](#chain-context-for-delegated-steps). |
|
|
162
165
|
|
|
@@ -320,6 +323,38 @@ Compare prompts (`bestOfN`) cannot combine with `skill` or `skills` in v1 becaus
|
|
|
320
323
|
|
|
321
324
|
Prompt includes let you write the common parts of your prompts once and reuse them. Put shared Markdown in partials, then pull those partials into any prompt that needs them.
|
|
322
325
|
|
|
326
|
+
### Prompt library
|
|
327
|
+
|
|
328
|
+
`.pi/prompt-library/` is an extension-managed prompt library. Pi core does not load files from this directory. If you want a file managed only by this extension rather than Pi core, place it in `.pi/prompt-library/` instead of `.pi/prompts/`.
|
|
329
|
+
|
|
330
|
+
User prompt-library files live at `~/.pi/agent/prompt-library/` (that is the current OS user's home directory as reported by the runtime, not the repository root).
|
|
331
|
+
|
|
332
|
+
Prompt-library files can be executable extension prompt templates, chain steps, or include targets. A prompt-library file becomes an extension command only when it is command-capable under the same rules as `.pi/prompts` templates: for example, it has extension frontmatter such as `model`, `chain`, `skill`, `skills`, `include`, `includes`, or other supported extension fields. Plain Markdown fragments under `partials/` are intended to be included and should not appear as slash commands, chain steps, or dry-run targets. The `partials/` directory name is a convention, not an enforced policy: any plain, non-command-capable prompt-library Markdown file can be included, and command-capable files can live under any non-hidden directory.
|
|
333
|
+
|
|
334
|
+
Set `hidden: true` on command-capable prompt-library files that should stay internal. Hidden commands are not registered as top-level slash commands and do not appear in the dry-run picker, but they can still be opened by exact `/print-prompt <name>` / `/dry-run-prompt <name>` and referenced by chains. Project prompt-library trust approval still applies when a hidden project-library step executes through a chain.
|
|
335
|
+
|
|
336
|
+
Dot-prefixed files and directories under prompt-library roots are ignored. Symlinks are followed only when their resolved target remains inside the canonical prompt root; symlinks that escape the root are skipped.
|
|
337
|
+
|
|
338
|
+
Project prompt-library commands require extension-side per-session UI approval before execution. This approval is separate from Pi's project trust state: even trusted projects still need the extension approval for commands loaded from `.pi/prompt-library/`. Non-UI/headless contexts cannot show that prompt, so move commands that must run headlessly in trusted projects to a core prompt root such as `.pi/prompts/`; keep `.pi/prompt-library/` for UI-approved project commands and include-only fragments.
|
|
339
|
+
|
|
340
|
+
For example, a project prompt can include a standards fragment from the project prompt library:
|
|
341
|
+
|
|
342
|
+
```text
|
|
343
|
+
.pi/prompts/review.md
|
|
344
|
+
.pi/prompt-library/partials/repo-standards.md
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
```markdown
|
|
348
|
+
---
|
|
349
|
+
description: Review with shared repo standards
|
|
350
|
+
model: claude-sonnet-4-20250514
|
|
351
|
+
include: partials/repo-standards.md
|
|
352
|
+
---
|
|
353
|
+
Review this change: $@
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
With that layout, `.pi/prompts/review.md` resolves `partials/repo-standards.md` to `.pi/prompt-library/partials/repo-standards.md` when no closer match exists. Included prompt-library files insert only their Markdown body; frontmatter such as `description`, `model`, `skill`, or `skills` is not inherited by the including prompt.
|
|
357
|
+
|
|
323
358
|
### Syntax
|
|
324
359
|
|
|
325
360
|
Use `includes:` for the shared block you want at the top of a prompt:
|
|
@@ -395,21 +430,25 @@ Include paths are local `.md` files. Resolution starts next to the file that ask
|
|
|
395
430
|
|
|
396
431
|
If Pi does not find the file there, it checks these roots in order:
|
|
397
432
|
|
|
398
|
-
1.
|
|
399
|
-
2.
|
|
400
|
-
3.
|
|
401
|
-
4.
|
|
433
|
+
1. Current file directory
|
|
434
|
+
2. Current owner root
|
|
435
|
+
3. Original prompt root
|
|
436
|
+
4. Project prompt-library (project prompts only; user/global prompts do not fall back into the current project's prompt library)
|
|
437
|
+
5. User prompt-library
|
|
438
|
+
6. Global prompt-partials
|
|
439
|
+
7. Project prompt-partials
|
|
402
440
|
|
|
403
|
-
Example layout:
|
|
441
|
+
Example project layout:
|
|
404
442
|
|
|
405
443
|
```text
|
|
406
|
-
|
|
407
|
-
|
|
444
|
+
<cwd>/.pi/prompts/review.md
|
|
445
|
+
<cwd>/.pi/prompts/shared/repo-rules.md
|
|
446
|
+
<cwd>/.pi/prompt-library/partials/repo-standards.md
|
|
408
447
|
~/.pi/agent/prompt-partials/shared/review-checklist.md
|
|
409
448
|
<cwd>/.pi/prompt-partials/languages/typescript.md
|
|
410
449
|
```
|
|
411
450
|
|
|
412
|
-
With that layout,
|
|
451
|
+
With that layout, the project prompt `.pi/prompts/review.md` can include `shared/repo-rules.md`, `partials/repo-standards.md`, `shared/review-checklist.md`, and `languages/typescript.md` without absolute paths. The project-library fallback (`partials/repo-standards.md`) applies because `review.md` is a project prompt; a user prompt from `~/.pi/agent/prompts/` would not search `<cwd>/.pi/prompt-library/` for that include.
|
|
413
452
|
|
|
414
453
|
### Rules and guardrails
|
|
415
454
|
|
|
@@ -422,6 +461,8 @@ With that layout, `review.md` can include `shared/repo-rules.md`, `shared/review
|
|
|
422
461
|
- `chain:` wrapper templates cannot use frontmatter `include` or `includes` in v1. Put includes on the step templates instead.
|
|
423
462
|
- `~/...` paths are allowed only when they resolve under a Pi prompt root or prompt-partials root. Other absolute paths are rejected.
|
|
424
463
|
- Include boundary comments appear only in debug/diagnostic mode. Normal prompt content does not contain `<!-- BEGIN include ... -->` / `<!-- END include ... -->` comments.
|
|
464
|
+
- Prompt and prompt-library command names are still plain basenames. There is no source or directory namespace for slash commands; if two effective templates use the same basename, normal source precedence/duplicate handling decides which one registers.
|
|
465
|
+
- `validate-prompts` validates extension-visible prompts, command-capable prompt-library files, and include graphs. It is not a general filesystem audit; plain unreferenced fragments are ignored except when they are pulled into an include graph.
|
|
425
466
|
|
|
426
467
|
## Inline Model Conditionals
|
|
427
468
|
|
package/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { resolve as resolvePath } from "node:path";
|
|
3
3
|
import type { Model } from "@earendil-works/pi-ai";
|
|
4
|
-
import type
|
|
4
|
+
import { type ExtensionAPI, type ExtensionCommandContext, type ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
6
6
|
import {
|
|
7
7
|
extractChainContextFlag,
|
|
@@ -23,6 +23,7 @@ import { preparePromptExecution, renderPromptForResolvedModel } from "./prompt-e
|
|
|
23
23
|
import {
|
|
24
24
|
buildPromptCommandDescription,
|
|
25
25
|
expandCwdPath,
|
|
26
|
+
formatPromptSourceLabel,
|
|
26
27
|
loadPromptsWithModel,
|
|
27
28
|
type DelegationLineupSlot,
|
|
28
29
|
type PromptWithModel,
|
|
@@ -128,6 +129,7 @@ export default function promptModelExtension(pi: ExtensionAPI) {
|
|
|
128
129
|
let accumulatedSummaries: string[] = [];
|
|
129
130
|
let lastDiagnostics = "";
|
|
130
131
|
let storedCommandCtx: ExtensionCommandContext | null = null;
|
|
132
|
+
const approvedProjectPromptLibraryCwds = new Set<string>();
|
|
131
133
|
const UNLIMITED_LOOP_CAP = 999;
|
|
132
134
|
|
|
133
135
|
const toolManager = createToolManager(pi, {
|
|
@@ -148,6 +150,50 @@ export default function promptModelExtension(pi: ExtensionAPI) {
|
|
|
148
150
|
return runtimeModel ?? ctx.model;
|
|
149
151
|
}
|
|
150
152
|
|
|
153
|
+
function isProjectPromptLibraryPrompt(prompt: PromptWithModel): boolean {
|
|
154
|
+
return prompt.source === "project" && prompt.rootKind === "prompt-library";
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async function ensureProjectPromptLibraryApproved(prompt: PromptWithModel, ctx: ExtensionCommandContext): Promise<boolean> {
|
|
158
|
+
if (!isProjectPromptLibraryPrompt(prompt)) return true;
|
|
159
|
+
// Pi core trust has historically covered only core-known project resources
|
|
160
|
+
// (for example .pi/prompts), not extension-defined .pi/prompt-library
|
|
161
|
+
// commands. Keep a prompt-library-specific session approval instead of
|
|
162
|
+
// relying on ctx.isProjectTrusted(), which can be true for unrelated roots.
|
|
163
|
+
|
|
164
|
+
const cwdKey = resolvePath(ctx.cwd);
|
|
165
|
+
if (approvedProjectPromptLibraryCwds.has(cwdKey)) return true;
|
|
166
|
+
|
|
167
|
+
const message =
|
|
168
|
+
`Project prompt-library command \`${prompt.name}\` is loaded from ${prompt.filePath}. ` +
|
|
169
|
+
"Pi core project trust may not cover .pi/prompt-library in this version. Approve running project prompt-library commands for this session?";
|
|
170
|
+
|
|
171
|
+
if (!ctx.hasUI || typeof (ctx.ui as { confirm?: unknown }).confirm !== "function") {
|
|
172
|
+
notify(ctx, `${message} Run in an interactive UI session and approve it, or move trusted commands to .pi/prompts.`, "error");
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const approved = await ctx.ui.confirm("Approve project prompt-library command", message, { timeout: 30_000 });
|
|
177
|
+
if (!approved) {
|
|
178
|
+
notify(ctx, `Project prompt-library command \`${prompt.name}\` was not approved.`, "warning");
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
approvedProjectPromptLibraryCwds.add(cwdKey);
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async function ensureProjectPromptLibraryStepsApproved(promptsToCheck: PromptWithModel[], ctx: ExtensionCommandContext): Promise<boolean> {
|
|
187
|
+
const seen = new Set<string>();
|
|
188
|
+
for (const prompt of promptsToCheck) {
|
|
189
|
+
const key = prompt.filePath;
|
|
190
|
+
if (seen.has(key)) continue;
|
|
191
|
+
seen.add(key);
|
|
192
|
+
if (!(await ensureProjectPromptLibraryApproved(prompt, ctx))) return false;
|
|
193
|
+
}
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
|
|
151
197
|
pi.registerMessageRenderer<SkillLoadedDetails>("skill-loaded", renderSkillLoaded);
|
|
152
198
|
pi.registerMessageRenderer(PROMPT_TEMPLATE_SUBAGENT_MESSAGE_TYPE, renderDelegatedSubagentResult);
|
|
153
199
|
pi.registerMessageRenderer(PROMPT_TEMPLATE_DETERMINISTIC_MESSAGE_TYPE, renderDeterministicResult);
|
|
@@ -168,7 +214,8 @@ export default function promptModelExtension(pi: ExtensionAPI) {
|
|
|
168
214
|
prompts = result.prompts;
|
|
169
215
|
chainPrompts = chainResult.prompts;
|
|
170
216
|
|
|
171
|
-
for (const name of prompts
|
|
217
|
+
for (const [name, prompt] of prompts) {
|
|
218
|
+
if (prompt.hidden) continue;
|
|
172
219
|
registerPromptCommand(name);
|
|
173
220
|
}
|
|
174
221
|
|
|
@@ -227,6 +274,8 @@ export default function promptModelExtension(pi: ExtensionAPI) {
|
|
|
227
274
|
taskPreamble?: string,
|
|
228
275
|
loopContext?: string,
|
|
229
276
|
): Promise<PromptStepResult | "aborted"> {
|
|
277
|
+
if (!(await ensureProjectPromptLibraryApproved(prompt, ctx))) return "aborted";
|
|
278
|
+
|
|
230
279
|
const requestedSkills = getRequestedSkills(prompt);
|
|
231
280
|
const skillResolution = resolvePromptSkills(requestedSkills, ctx.cwd, pi.getCommands() as RuntimeSkillCommand[]);
|
|
232
281
|
if (skillResolution.kind === "error") {
|
|
@@ -682,6 +731,8 @@ export default function promptModelExtension(pi: ExtensionAPI) {
|
|
|
682
731
|
currentModel: Model<any> | undefined,
|
|
683
732
|
runtime: { cwd?: string; model?: string; subagentOverride?: SubagentOverride; fork?: boolean },
|
|
684
733
|
) {
|
|
734
|
+
if (!(await ensureProjectPromptLibraryApproved(prompt, ctx))) return;
|
|
735
|
+
|
|
685
736
|
if (runtime.subagentOverride) {
|
|
686
737
|
notify(ctx, `--subagent is not supported for compare prompts (ignored)`, "warning");
|
|
687
738
|
}
|
|
@@ -1148,7 +1199,12 @@ export default function promptModelExtension(pi: ExtensionAPI) {
|
|
|
1148
1199
|
return true;
|
|
1149
1200
|
};
|
|
1150
1201
|
|
|
1202
|
+
const resolveChainStepPrompts = (): PromptWithModel[] => flattenChainSteps()
|
|
1203
|
+
.map((step) => chainPrompts.get(step.name))
|
|
1204
|
+
.filter((prompt): prompt is PromptWithModel => prompt !== undefined);
|
|
1205
|
+
|
|
1151
1206
|
if (!validateChainSteps()) return;
|
|
1207
|
+
if (!(await ensureProjectPromptLibraryStepsApproved(resolveChainStepPrompts(), ctx))) return;
|
|
1152
1208
|
|
|
1153
1209
|
const originalModel = getCurrentModel(ctx);
|
|
1154
1210
|
const chainInheritedModel = originalModel;
|
|
@@ -1186,6 +1242,10 @@ export default function promptModelExtension(pi: ExtensionAPI) {
|
|
|
1186
1242
|
chainAborted = true;
|
|
1187
1243
|
break;
|
|
1188
1244
|
}
|
|
1245
|
+
if (!(await ensureProjectPromptLibraryStepsApproved(resolveChainStepPrompts(), ctx))) {
|
|
1246
|
+
chainAborted = true;
|
|
1247
|
+
break;
|
|
1248
|
+
}
|
|
1189
1249
|
}
|
|
1190
1250
|
|
|
1191
1251
|
const templates = steps.map((step) =>
|
|
@@ -1239,6 +1299,11 @@ export default function promptModelExtension(pi: ExtensionAPI) {
|
|
|
1239
1299
|
taskPreamble = `[Previous chain steps]\n\n${chainStepSummaries.join("\n\n")}`;
|
|
1240
1300
|
}
|
|
1241
1301
|
|
|
1302
|
+
if (!(await ensureProjectPromptLibraryStepsApproved(stepTemplate.tasks.map((task) => task.prompt), ctx))) {
|
|
1303
|
+
aborted = true;
|
|
1304
|
+
break;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1242
1307
|
let delegated;
|
|
1243
1308
|
try {
|
|
1244
1309
|
delegated = await executeSubagentPromptStep({
|
|
@@ -1444,11 +1509,12 @@ export default function promptModelExtension(pi: ExtensionAPI) {
|
|
|
1444
1509
|
for (const [name, prompt] of chainPrompts) merged.set(name, prompt);
|
|
1445
1510
|
for (const [name, prompt] of prompts) merged.set(name, prompt);
|
|
1446
1511
|
return Array.from(merged.values())
|
|
1512
|
+
.filter((prompt) => !prompt.hidden)
|
|
1447
1513
|
.sort((a, b) => a.name.localeCompare(b.name))
|
|
1448
1514
|
.map((prompt) => ({
|
|
1449
1515
|
name: prompt.name,
|
|
1450
1516
|
source: prompt.source,
|
|
1451
|
-
displaySource: prompt
|
|
1517
|
+
displaySource: formatPromptSourceLabel(prompt),
|
|
1452
1518
|
file: prompt.filePath,
|
|
1453
1519
|
description: prompt.description,
|
|
1454
1520
|
model: prompt.models[0],
|
|
@@ -1569,10 +1635,11 @@ export default function promptModelExtension(pi: ExtensionAPI) {
|
|
|
1569
1635
|
storedCommandCtx = ctx;
|
|
1570
1636
|
refreshPrompts(ctx.cwd, ctx);
|
|
1571
1637
|
const prompt = prompts.get(name);
|
|
1572
|
-
if (!prompt) {
|
|
1573
|
-
notify(ctx, `Prompt "${name}" no longer
|
|
1638
|
+
if (!prompt || prompt.hidden) {
|
|
1639
|
+
notify(ctx, `Prompt "${name}" is no longer available as a slash command`, "error");
|
|
1574
1640
|
return;
|
|
1575
1641
|
}
|
|
1642
|
+
if (!(await ensureProjectPromptLibraryApproved(prompt, ctx))) return;
|
|
1576
1643
|
|
|
1577
1644
|
const subagent = extractSubagentOverride(args);
|
|
1578
1645
|
const runtimeCwd = subagent.cwd ? expandCwdPath(subagent.cwd) : undefined;
|
|
@@ -1723,6 +1790,7 @@ export default function promptModelExtension(pi: ExtensionAPI) {
|
|
|
1723
1790
|
|
|
1724
1791
|
function resetSessionScopedState(ctx: ExtensionContext) {
|
|
1725
1792
|
storedCommandCtx = null;
|
|
1793
|
+
approvedProjectPromptLibraryCwds.clear();
|
|
1726
1794
|
pendingSkillMessage = undefined;
|
|
1727
1795
|
previousModel = undefined;
|
|
1728
1796
|
previousThinking = undefined;
|
package/package.json
CHANGED
package/prompt-dry-run-tui.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { PromptLoaderDiagnostic } from "./prompt-loader.js";
|
|
|
6
6
|
export interface PromptTemplateCatalogItem {
|
|
7
7
|
name: string;
|
|
8
8
|
source: "project" | "user" | "reserved";
|
|
9
|
-
displaySource:
|
|
9
|
+
displaySource: string;
|
|
10
10
|
file?: string;
|
|
11
11
|
description?: string;
|
|
12
12
|
model?: string;
|