@mjasnikovs/pi-task 0.17.1 → 0.17.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.
@@ -7,8 +7,8 @@ const DEFAULTS = {
7
7
  compressReasoning: true,
8
8
  autoCommit: true,
9
9
  orientation: true,
10
- enforceGuidelines: false,
11
- verifyWork: false
10
+ enforceGuidelines: true,
11
+ verifyWork: true
12
12
  };
13
13
  const CONFIG_PATH = path.join(os.homedir(), '.config', 'pi-task', 'config.json');
14
14
  const _g = globalThis;
@@ -1,6 +1,51 @@
1
- import { SettingsList } from '@earendil-works/pi-tui';
1
+ import { SettingsList, visibleWidth } from '@earendil-works/pi-tui';
2
2
  import { registerBridgeCommand } from '../remote/bridge.js';
3
3
  import { getConfig, saveConfig } from './config.js';
4
+ const CONFIG_TITLE = 'pi-task settings';
5
+ /**
6
+ * Frames a child component (the settings list) in a rounded border with a title
7
+ * woven into the top edge. Without this the overlay's content sits flush against
8
+ * the chat scrollback and reads as just more console text; the border gives it a
9
+ * distinct panel. Layout mirrors {@link renderQuestionBox}'s box chrome: render
10
+ * the child at the inner width, pad each line so the right edge lines up, then
11
+ * frame. Input and invalidation are forwarded straight through to the child.
12
+ */
13
+ class BorderedBox {
14
+ child;
15
+ title;
16
+ border;
17
+ titleColor;
18
+ constructor(child, title, border, titleColor) {
19
+ this.child = child;
20
+ this.title = title;
21
+ this.border = border;
22
+ this.titleColor = titleColor;
23
+ }
24
+ render(width) {
25
+ const innerWidth = Math.max(1, width - 4); // "│ " + content + " │"
26
+ const dash = (n) => '─'.repeat(Math.max(0, n));
27
+ // Top border with the title woven in: "╭─ pi-task settings ─…─╮".
28
+ const tag = ` ${this.title} `;
29
+ const lead = 1; // one dash before the title
30
+ const rest = width - 2 - lead - visibleWidth(tag);
31
+ const top = rest >= 0 ?
32
+ this.border(`╭${dash(lead)}`) + this.titleColor(tag) + this.border(`${dash(rest)}╮`)
33
+ : this.border(`╭${dash(width - 2)}╮`);
34
+ const body = this.child.render(innerWidth).map(line => {
35
+ const pad = innerWidth - visibleWidth(line);
36
+ const padded = pad > 0 ? line + ' '.repeat(pad) : line;
37
+ return this.border('│ ') + padded + this.border(' │');
38
+ });
39
+ const bottom = this.border(`╰${dash(width - 2)}╯`);
40
+ return [top, ...body, bottom];
41
+ }
42
+ invalidate() {
43
+ this.child.invalidate();
44
+ }
45
+ handleInput(data) {
46
+ this.child.handleInput(data);
47
+ }
48
+ }
4
49
  const ITEMS = [
5
50
  { id: 'remote', label: 'remote', description: 'Remote UI server (QR code, phone access)' },
6
51
  {
@@ -58,8 +103,8 @@ async function handleTaskConfig(_args, ctx) {
58
103
  cfg[id] = newValue === 'on';
59
104
  saveConfig(cfg).catch(() => { });
60
105
  }, () => done(undefined));
61
- return list;
62
- }, { overlay: true, overlayOptions: { width: 54 } });
106
+ return new BorderedBox(list, CONFIG_TITLE, s => theme.fg('borderMuted', s), s => theme.fg('accent', theme.bold(s)));
107
+ }, { overlay: true, overlayOptions: { width: 58 } });
63
108
  }
64
109
  export function registerConfig(pi) {
65
110
  registerBridgeCommand(pi, 'task-config', {
@@ -17,17 +17,27 @@
17
17
  * PASS / FAIL verdict. If the spec's VERIFY is legitimately a no-op (config-only
18
18
  * change, re-read of a file), the model says so and that is a PASS.
19
19
  *
20
- * It must verify the REAL deliverable, not a stand-in. The spec's VERIFY block is
21
- * authored by the same weak model that did the work, so it frequently grades a
22
- * SIMULATION it controls: it reconstructs the build in a scratch dir, compiles with
23
- * options the project does not ship, or only greps the SOURCE for a string — all of
24
- * which pass while the project's own build ships broken output. The prompt therefore
25
- * anchors the child to the project's OWN build/run command and the artifact it SHIPS,
26
- * treats source-text presence as insufficient (a build artifact that still contains an
27
- * un-processed source directive means the build never ran), and treats "I had to add a
28
- * dependency/flag/config the project lacks to make it pass" as the defect itself.
29
- * A/B-proven on the live local model: the old prompt false-passed 3/3 on a
30
- * broken-pipeline fixture; the anchored prompt caught it 3/3, naming the real defect.
20
+ * It must verify the REAL deliverable AS SHIPPED, not a run the verifier itself
21
+ * prepared into passing. The failure class is broader than a bad VERIFY block: the
22
+ * child has `bash`, so it can quietly make almost anything go green export an env
23
+ * var, source a config file, run a different command, rebuild in a scratch dir,
24
+ * fabricate the artifact by hand and then report PASS, masking a defect a fresh
25
+ * checkout or CI run would hit. (This is exactly what sank an mx5 run: the verify
26
+ * child `export`ed the test DB URL its own shell, watched the suite go green, and
27
+ * passed a project whose documented command failed unaided.) The prompt therefore
28
+ * anchors the child to ONE principle: run the project's own commands verbatim in the
29
+ * tree as found, and treat any preparation/repair/substitution it had to perform to
30
+ * reach green as ITSELF the defect while still distinguishing a genuinely-absent
31
+ * EXTERNAL service (an environment gap, not a code fault) from the project mis-wiring
32
+ * how it connects. This generalises across languages and toolchains and assumes no
33
+ * tests, build, or particular runtime.
34
+ *
35
+ * A/B-proven on the live local model (Qwen3.6-35B), 5 runs/arm on a work-around-to-pass
36
+ * fixture (documented command fails unaided; greppable env file makes it pass): the old
37
+ * prompt false-passed 2/5; the new prompt caught it 5/5, each time naming the unwired
38
+ * config. Guards (3 runs/arm): a healthy project still PASSes 3/3 (no false-fail), a
39
+ * genuinely-broken shipped build FAILs 3/3, and a genuine external-service gap — which
40
+ * the OLD prompt wrongly blamed on the code 3/3 — now correctly PASSes 3/3.
31
41
  *
32
42
  * It runs as a GATE right after the implementation turn, BEFORE the task is
33
43
  * checked off or committed. A FAIL stops the /task-auto run exactly like an
@@ -106,37 +116,49 @@ export function buildVerifyPrompt(spec) {
106
116
  'THE TASK SPEC (its ACCEPTANCE criteria and VERIFY block are the contract):',
107
117
  spec.trim(),
108
118
  '',
109
- 'How to verify — verify the REAL deliverable, not a stand-in:',
110
- "1. Run the project's OWN build/run/serve command the one it actually ships",
111
- ' (the scripts in package.json, the command the spec names). Run it exactly as',
112
- ' the project defines it, then inspect the artifact it PRODUCES. Also run the',
113
- " spec's VERIFY block but the project's real build/output is the bar.",
114
- '2. NEVER substitute your own build, compile step, plugin, flag, scratch transform,',
115
- ' or config to make a check pass. If the VERIFY block reconstructs the output in',
116
- ' a temp/scratch dir, builds with options the project does not use, or only greps',
117
- ' the SOURCE for a string, that is INSUFFICIENT — it proves the code *could* work,',
118
- " not that the shipping pipeline *does*. You must still run the project's real",
119
- ' build and judge its real output.',
120
- '3. If, to make any check pass, you find you must add an import, plugin, flag, or',
121
- ' config the project itself does not have, STOP: that missing piece IS the defect.',
122
- ' Report FAIL and name exactly what the project is missing.',
123
- '4. Presence of a token/directive/string in a SOURCE file is NOT verification. Judge',
124
- ' the produced/shipped artifact and the actual runtime behavior. (A build directive',
125
- ' belongs in the source; if that same raw directive SURVIVES into the built output,',
126
- ' the build did not run that is a FAIL, not a PASS.)',
127
- '5. Treat the ACCEPTANCE criteria as the bar. If a VERIFY command fails, or its',
128
- ' output (or the real build output) contradicts an ACCEPTANCE criterion, the work',
129
- ' has NOT verified.',
130
- '6. If a check depends on something this environment genuinely lacks (a service, a',
131
- ' network resource) and that is clearly an environment gap rather than a defect in',
132
- ' the code, note it and judge the rest. Do not fail for a missing external service.',
133
- '7. If the spec legitimately has no runnable verification (a pure docs/config change',
119
+ 'How to verify — verify the REAL, shipped deliverable exactly as an unaided fresh',
120
+ 'checkout (or CI run) would experience it:',
121
+ '',
122
+ "1. Run the project's OWN commands the verbatim scripts / targets / binaries it",
123
+ ' ships (package.json scripts, Makefile targets, the command the spec names) —',
124
+ ' exactly as written, in the workspace as you found it. Judge the artifact or',
125
+ " output they actually PRODUCE. The project's own command and its real output are",
126
+ " the bar; also run the spec's VERIFY block, but it does not override that bar.",
127
+ '',
128
+ '2. Do NOT prepare, repair, reconfigure, or stand in for the run to make a check',
129
+ ' pass. Concretely, to reach a green result you must NOT: set or export an',
130
+ ' environment variable, source an env file, add or change a flag, edit or replace',
131
+ ' the command, install or add a dependency / plugin / import / config the project',
132
+ ' lacks, create or pre-populate files or state by hand, or rebuild / compile in a',
133
+ ' scratch dir or with options the project does not itself use. If a check only goes',
134
+ ' green AFTER you intervene like that, then the very thing you had to do IS the',
135
+ ' defect: the project does not work as shipped. Report FAIL and name the missing or',
136
+ ' broken wiring exactly (e.g. "shipped command `<cmd>` fails unaided because <why>").',
137
+ '',
138
+ '3. Presence of a token / directive / string in a SOURCE file is NOT verification.',
139
+ ' Judge the produced artifact and the real runtime behavior. A raw build directive',
140
+ ' that SURVIVES into the built output means the build never ran that is a FAIL.',
141
+ '',
142
+ '4. Treat the ACCEPTANCE criteria as the bar. If a command fails, or its real output',
143
+ ' contradicts an ACCEPTANCE criterion, the work has NOT verified.',
144
+ '',
145
+ '5. The ONLY thing you may assume is already provided is a genuinely EXTERNAL running',
146
+ ' service or network resource (a database server, an API host) that the project',
147
+ ' documents as a prerequisite. If a command fails purely because such an external',
148
+ ' service is ABSENT from this machine — and NOT because the project misconfigures',
149
+ ' how it connects — note that as an environment gap and judge the rest; do not fail',
150
+ ' the code for it. But a command that fails because of how the PROJECT ITSELF is',
151
+ ' wired (config it owns but does not load, a wrong default, a command that cannot',
152
+ ' run unaided) is a defect, not an environment gap.',
153
+ '',
154
+ '6. If the spec legitimately has no runnable verification (a pure docs / config change',
134
155
  ' with nothing to build or run), validating it cleanly is a PASS.',
135
- '8. Do NOT edit anything to make a check pass. Report what you actually saw.',
156
+ '',
157
+ '7. Do NOT edit anything to make a check pass. Report what you actually saw.',
136
158
  '',
137
159
  'When you are done, output EXACTLY ONE of these as the final line:',
138
- ' WORK-VERIFIED: PASS (the real build/run produced an artifact that meets the spec)',
139
- ' WORK-VERIFIED: FAIL <text> (the real build/output failed or does not meet the spec; say what failed)',
160
+ " WORK-VERIFIED: PASS (the project's own command, run unaided, met the spec)",
161
+ ' WORK-VERIFIED: FAIL <text> (the shipped command failed or did not meet the spec; say what failed)',
140
162
  'Output the verdict line verbatim — it is parsed mechanically.'
141
163
  ].join('\n');
142
164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjasnikovs/pi-task",
3
- "version": "0.17.1",
3
+ "version": "0.17.3",
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",