pi-prompt-template-model 0.7.2 → 0.7.3

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 CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.7.3] - 2026-04-14
6
+
7
+ ### Fixed
8
+ - `/chain-prompts` and chain templates now resolve plain prompt files without extension-specific frontmatter, so standard prompts like `double-check -> deslop` work in chain execution.
9
+ - Added regression coverage for plain-prompt chain resolution while keeping ordinary prompt-template command registration unchanged.
10
+
5
11
  ## [0.7.2] - 2026-04-04
6
12
 
7
13
  ### Changed
package/index.ts CHANGED
@@ -92,6 +92,7 @@ const DEFAULT_COMPARE_FINAL_APPLIER_TASK = [
92
92
 
93
93
  export default function promptModelExtension(pi: ExtensionAPI) {
94
94
  let prompts = new Map<string, PromptWithModel>();
95
+ let chainPrompts = new Map<string, PromptWithModel>();
95
96
  let previousModel: Model<any> | undefined;
96
97
  let previousThinking: ThinkingLevel | undefined;
97
98
  let pendingSkillMessage: PendingSkillMessage | undefined;
@@ -136,7 +137,9 @@ export default function promptModelExtension(pi: ExtensionAPI) {
136
137
 
137
138
  function refreshPrompts(cwd: string, ctx?: ExtensionContext) {
138
139
  const result = loadPromptsWithModel(cwd);
140
+ const chainResult = loadPromptsWithModel(cwd, true);
139
141
  prompts = result.prompts;
142
+ chainPrompts = chainResult.prompts;
140
143
 
141
144
  for (const name of prompts.keys()) {
142
145
  registerPromptCommand(name);
@@ -1057,7 +1060,7 @@ export default function promptModelExtension(pi: ExtensionAPI) {
1057
1060
 
1058
1061
  const validateChainSteps = (): boolean => {
1059
1062
  const flattened = flattenChainSteps();
1060
- const missingTemplates = flattened.filter((step) => !prompts.has(step.name));
1063
+ const missingTemplates = flattened.filter((step) => !chainPrompts.has(step.name));
1061
1064
  if (missingTemplates.length > 0) {
1062
1065
  notify(ctx, `Templates not found: ${missingTemplates.map((step) => step.name).join(", ")}`, "error");
1063
1066
  return false;
@@ -1074,7 +1077,7 @@ export default function promptModelExtension(pi: ExtensionAPI) {
1074
1077
  notify(ctx, `Step "${parallelStep.name}" in parallel() does not support per-task --with-context.`, "error");
1075
1078
  return false;
1076
1079
  }
1077
- const stepPrompt = prompts.get(parallelStep.name);
1080
+ const stepPrompt = chainPrompts.get(parallelStep.name);
1078
1081
  if (!stepPrompt) continue;
1079
1082
  if (stepPrompt.chain) {
1080
1083
  notify(ctx, `Step "${parallelStep.name}" is a chain template. Chain nesting is not supported.`, "error");
@@ -1088,7 +1091,7 @@ export default function promptModelExtension(pi: ExtensionAPI) {
1088
1091
  continue;
1089
1092
  }
1090
1093
 
1091
- const stepPrompt = prompts.get(step.name);
1094
+ const stepPrompt = chainPrompts.get(step.name);
1092
1095
  if (!stepPrompt) continue;
1093
1096
  if (stepPrompt.chain) {
1094
1097
  notify(ctx, `Step "${step.name}" is a chain template. Chain nesting is not supported.`, "error");
@@ -1147,7 +1150,7 @@ export default function promptModelExtension(pi: ExtensionAPI) {
1147
1150
  name: item.name,
1148
1151
  args: item.args,
1149
1152
  prompt: {
1150
- ...prompts.get(item.name)!,
1153
+ ...chainPrompts.get(item.name)!,
1151
1154
  ...(cwdOverride ? { cwd: cwdOverride } : {}),
1152
1155
  },
1153
1156
  })),
@@ -1156,7 +1159,7 @@ export default function promptModelExtension(pi: ExtensionAPI) {
1156
1159
  kind: "single" as const,
1157
1160
  singleStep: {
1158
1161
  prompt: {
1159
- ...prompts.get(step.name)!,
1162
+ ...chainPrompts.get(step.name)!,
1160
1163
  ...(cwdOverride ? { cwd: cwdOverride } : {}),
1161
1164
  },
1162
1165
  stepArgs: step.args,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-prompt-template-model",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "type": "module",
5
5
  "description": "Prompt template model selector extension for pi coding agent",
6
6
  "author": "Nico Bailon",
package/prompt-loader.ts CHANGED
@@ -926,6 +926,7 @@ function normalizeThinkingLevels(
926
926
  function loadPromptsWithModelFromDir(
927
927
  dir: string,
928
928
  source: PromptSource,
929
+ includePlainPrompts: boolean,
929
930
  subdir = "",
930
931
  visitedDirectories = new Set<string>(),
931
932
  ): { prompts: PromptWithModel[]; diagnostics: PromptLoaderDiagnostic[] } {
@@ -993,7 +994,7 @@ function loadPromptsWithModelFromDir(
993
994
 
994
995
  if (isDirectory) {
995
996
  const nextSubdir = subdir ? `${subdir}:${entry.name}` : entry.name;
996
- const nested = loadPromptsWithModelFromDir(fullPath, source, nextSubdir, visitedDirectories);
997
+ const nested = loadPromptsWithModelFromDir(fullPath, source, includePlainPrompts, nextSubdir, visitedDirectories);
997
998
  prompts.push(...nested.prompts);
998
999
  diagnostics.push(...nested.diagnostics);
999
1000
  continue;
@@ -1260,7 +1261,7 @@ function loadPromptsWithModelFromDir(
1260
1261
  subagent !== undefined ||
1261
1262
  safeInheritContext ||
1262
1263
  hasModelConditionalDirectives;
1263
- if (!chain && !hasModelField && !hasExtensionSpecificConfig) {
1264
+ if (!chain && !hasModelField && !hasExtensionSpecificConfig && !includePlainPrompts) {
1264
1265
  continue;
1265
1266
  }
1266
1267
 
@@ -1316,7 +1317,7 @@ function loadPromptsWithModelFromDir(
1316
1317
  return { prompts, diagnostics };
1317
1318
  }
1318
1319
 
1319
- export function loadPromptsWithModel(cwd: string): LoadPromptsWithModelResult {
1320
+ export function loadPromptsWithModel(cwd: string, includePlainPrompts = false): LoadPromptsWithModelResult {
1320
1321
  const globalDir = join(homedir(), ".pi", "agent", "prompts");
1321
1322
  const projectDir = resolve(cwd, ".pi", "prompts");
1322
1323
  const promptMap = new Map<string, PromptWithModel>();
@@ -1344,13 +1345,13 @@ export function loadPromptsWithModel(cwd: string): LoadPromptsWithModelResult {
1344
1345
  promptMap.set(prompt.name, prompt);
1345
1346
  }
1346
1347
 
1347
- const globalResult = loadPromptsWithModelFromDir(globalDir, "user");
1348
+ const globalResult = loadPromptsWithModelFromDir(globalDir, "user", includePlainPrompts);
1348
1349
  diagnostics.push(...globalResult.diagnostics);
1349
1350
  for (const prompt of globalResult.prompts) {
1350
1351
  addPrompt(prompt);
1351
1352
  }
1352
1353
 
1353
- const projectResult = loadPromptsWithModelFromDir(projectDir, "project");
1354
+ const projectResult = loadPromptsWithModelFromDir(projectDir, "project", includePlainPrompts);
1354
1355
  diagnostics.push(...projectResult.diagnostics);
1355
1356
  for (const prompt of projectResult.prompts) {
1356
1357
  addPrompt(prompt);