@mjasnikovs/pi-task 0.14.9 → 0.14.10
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.
|
@@ -17,6 +17,7 @@ import { writeTaskFile, readTaskFile, updateTaskFrontMatter, taskFilePath, tasks
|
|
|
17
17
|
import { gitCommitAll } from './auto-commit.js';
|
|
18
18
|
import { runGuidelineEnforcement, classifyEnforceChildFailure } from './enforce-guidelines.js';
|
|
19
19
|
import { runWorker } from '../workers/pi-worker-core.js';
|
|
20
|
+
import { findPhantomImports, rewritePhantomSpecifiers } from '../workers/phantom-imports.js';
|
|
20
21
|
import { runPhaseChild, prependHint, formatLoopHint, USER_CANCELLED } from './child-runner.js';
|
|
21
22
|
import { SessionUI, registerBridgeCommand } from '../remote/bridge.js';
|
|
22
23
|
import { pushNotify } from '../remote/push.js';
|
|
@@ -42,6 +43,19 @@ const MENTION_TRAILING_PUNCT = /[.,;:!?)\]}>"']+$/;
|
|
|
42
43
|
function mentionPath(token) {
|
|
43
44
|
return token.replace(MENTION_TRAILING_PUNCT, '');
|
|
44
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Fire-and-forget debug line for the PLAN phase (clarify/decompose), which runs
|
|
48
|
+
* before any task file — hence any per-task `TASK_XXXX-debug.log` — exists. Writes
|
|
49
|
+
* to `.pi-tasks/plan-debug.log`; the `*-debug.log` suffix keeps it grep-compatible
|
|
50
|
+
* with the per-task logs. Never throws (mkdir + append are best-effort).
|
|
51
|
+
*/
|
|
52
|
+
function logPlanDebug(cwd, msg) {
|
|
53
|
+
const line = `${new Date().toISOString()} ${msg}\n`;
|
|
54
|
+
const dir = tasksDir(cwd);
|
|
55
|
+
fsp.mkdir(dir, { recursive: true })
|
|
56
|
+
.then(() => fsp.appendFile(path.join(dir, 'plan-debug.log'), line))
|
|
57
|
+
.catch(() => { });
|
|
58
|
+
}
|
|
45
59
|
/**
|
|
46
60
|
* Expand any @file references in the feature text by appending each referenced
|
|
47
61
|
* file's contents, so the planning children (clarify, decompose) always see the
|
|
@@ -180,7 +194,22 @@ export async function planAuto(ctx, cwd, feature, deps) {
|
|
|
180
194
|
const ui = new SessionUI(ctx);
|
|
181
195
|
// Inline any @file spec the user referenced so clarify/decompose reason over
|
|
182
196
|
// the real content, not a one-line "Implement @file" that reads as trivial.
|
|
183
|
-
const
|
|
197
|
+
const rawFeatureForModel = await expandFeatureMentions(cwd, feature);
|
|
198
|
+
// Strike phantom runtime specifiers (`bun:sql`) out of the inlined spec BEFORE
|
|
199
|
+
// clarify/decompose ever see it. Layer A only rewrites the per-task `refined`
|
|
200
|
+
// text — which is DOWNSTREAM of here: clarify is the first phase and runs on
|
|
201
|
+
// this raw inline, so the doc's affirmative `bun:sql` is parroted straight into
|
|
202
|
+
// the very first clarifying question ("instantly bun:sql is back"). Apply the
|
|
203
|
+
// same deterministic, no-LLM strike at the single point that feeds both planning
|
|
204
|
+
// children. Silent + no-op when nothing is flagged or the runtime's types aren't
|
|
205
|
+
// installed.
|
|
206
|
+
const planPhantoms = findPhantomImports(rawFeatureForModel, cwd);
|
|
207
|
+
const featureForModel = planPhantoms.length === 0 ?
|
|
208
|
+
rawFeatureForModel
|
|
209
|
+
: rewritePhantomSpecifiers(rawFeatureForModel, planPhantoms);
|
|
210
|
+
if (planPhantoms.length > 0) {
|
|
211
|
+
logPlanDebug(cwd, `phantom specifiers rewritten in plan spec: ${planPhantoms.map(x => x.spec).join(', ')}`);
|
|
212
|
+
}
|
|
184
213
|
const answers = [];
|
|
185
214
|
// Plain text of every question already shown, for the duplicate backstop.
|
|
186
215
|
const askedQuestions = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mjasnikovs/pi-task",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.10",
|
|
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",
|