@mjasnikovs/pi-task 0.14.7 → 0.14.8

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.
@@ -29,6 +29,19 @@ import { getParentContextWindow, resolveContextUsage } from './context-usage.js'
29
29
  const MAX_CLARIFY_QUESTIONS = 8;
30
30
  // Matches pi's @-file completion token (a path after @, until whitespace).
31
31
  const MENTION_RE = /(?:^|\s)@([^\s]+)/g;
32
+ // Trailing punctuation a user naturally types AFTER an @-mention when it sits in
33
+ // prose — "Implement @design.md, reuse…" or "see @spec.md." — which the greedy
34
+ // [^\s]+ above would otherwise swallow into the path. Left unstripped, the
35
+ // resulting "design.md," resolves to no file, expansion is silently skipped, and
36
+ // the planner reasons over a one-line "Implement @design.md" with NO spec inline
37
+ // → it fabricates generic questions/tasks the spec never called for (validated:
38
+ // a stray comma turned a 32KB design into a contentless prompt). None of these
39
+ // chars are legitimate trailing characters of a referenced doc path.
40
+ const MENTION_TRAILING_PUNCT = /[.,;:!?)\]}>"']+$/;
41
+ /** The cleaned path token of an @-mention: greedy match minus trailing prose punctuation. */
42
+ function mentionPath(token) {
43
+ return token.replace(MENTION_TRAILING_PUNCT, '');
44
+ }
32
45
  /**
33
46
  * Expand any @file references in the feature text by appending each referenced
34
47
  * file's contents, so the planning children (clarify, decompose) always see the
@@ -42,8 +55,8 @@ export async function expandFeatureMentions(cwd, feature) {
42
55
  const seen = new Set();
43
56
  const blocks = [];
44
57
  for (const m of feature.matchAll(MENTION_RE)) {
45
- const rel = m[1];
46
- if (seen.has(rel))
58
+ const rel = mentionPath(m[1]);
59
+ if (rel === '' || seen.has(rel))
47
60
  continue;
48
61
  seen.add(rel);
49
62
  try {
@@ -68,8 +81,8 @@ export async function readableMentions(cwd, feature) {
68
81
  const out = [];
69
82
  const seen = new Set();
70
83
  for (const m of feature.matchAll(MENTION_RE)) {
71
- const rel = m[1];
72
- if (seen.has(rel))
84
+ const rel = mentionPath(m[1]);
85
+ if (rel === '' || seen.has(rel))
73
86
  continue;
74
87
  seen.add(rel);
75
88
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjasnikovs/pi-task",
3
- "version": "0.14.7",
3
+ "version": "0.14.8",
4
4
  "description": "Deterministic spec-orchestration for local models, with a bundled real-time remote web view and web/docs/fetch/worker subagent tools.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",