phewsh 0.15.33 → 0.15.34
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/commands/session.js +33 -1
- package/package.json +1 -1
package/commands/session.js
CHANGED
|
@@ -383,6 +383,7 @@ async function main() {
|
|
|
383
383
|
let route = resolveRoute(config, harnesses);
|
|
384
384
|
let sessionMode = null; // INTENT_MODES id once picked
|
|
385
385
|
let awaitingOutcome = null; // decision id eligible for 1-4 labeling
|
|
386
|
+
let provisionalOutcome = null; // verdict phewsh inferred from the diff — Enter ↵ confirms it
|
|
386
387
|
let awaitingWhy = null; // { id, outcome } — next line is the reason
|
|
387
388
|
let awaitingReconcile = null; // exact proposed append, applied only after y
|
|
388
389
|
let lastTransitionReport = null; // latest native preflight -> postflight comparison
|
|
@@ -1154,6 +1155,25 @@ async function main() {
|
|
|
1154
1155
|
// anything else: drop the offer and treat it as fresh input
|
|
1155
1156
|
}
|
|
1156
1157
|
|
|
1158
|
+
// Enter ↵ confirms the provisional verdict phewsh inferred from the diff —
|
|
1159
|
+
// ambient capture so you never have to remember to run /outcomes.
|
|
1160
|
+
if (awaitingOutcome && provisionalOutcome && input.trim() === '') {
|
|
1161
|
+
const outcome = provisionalOutcome;
|
|
1162
|
+
try {
|
|
1163
|
+
labelOutcome(awaitingOutcome, outcome);
|
|
1164
|
+
console.log(` ${teal('●')} ${sage('outcome:')} ${green(outcome)} ${slate('· confirmed')}`);
|
|
1165
|
+
} catch { /* decision vanished */ }
|
|
1166
|
+
awaitingOutcome = null; provisionalOutcome = null;
|
|
1167
|
+
console.log('');
|
|
1168
|
+
rl.prompt();
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
// Typed something other than a verdict? They've moved on — drop the
|
|
1172
|
+
// provisional so a later stray Enter can't auto-confirm it.
|
|
1173
|
+
if (awaitingOutcome && provisionalOutcome && input.trim() !== '' && !/^[1-4]$/.test(input.trim())) {
|
|
1174
|
+
provisionalOutcome = null;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1157
1177
|
// A bare 1-4 right after a routed action labels its outcome
|
|
1158
1178
|
if (awaitingOutcome && /^[1-4]$/.test(input)) {
|
|
1159
1179
|
const outcome = OUTCOMES[parseInt(input, 10) - 1];
|
|
@@ -1165,6 +1185,7 @@ async function main() {
|
|
|
1165
1185
|
} catch { /* decision vanished — nothing to do */ }
|
|
1166
1186
|
const id = awaitingOutcome;
|
|
1167
1187
|
awaitingOutcome = null;
|
|
1188
|
+
provisionalOutcome = null;
|
|
1168
1189
|
// For a regret, the reason is the gold — capture one line so /recall can
|
|
1169
1190
|
// tell you *why* next time. Kept/superseded stay frictionless.
|
|
1170
1191
|
if (labeled && (outcome === 'reverted' || outcome === 'failed')) {
|
|
@@ -2460,10 +2481,21 @@ async function main() {
|
|
|
2460
2481
|
briefingHash: savedBrief.hash,
|
|
2461
2482
|
});
|
|
2462
2483
|
awaitingOutcome = decisionId;
|
|
2484
|
+
// Ambient outcome capture: infer a provisional verdict from what the
|
|
2485
|
+
// session actually did, so the human confirms with one keystroke
|
|
2486
|
+
// instead of recalling. Honest — it's a confirmed default, not a
|
|
2487
|
+
// silent label; the human can always correct it with 1-4.
|
|
2488
|
+
provisionalOutcome = (postflight.headChanged || postflight.files.length > 0) ? 'kept' : null;
|
|
2463
2489
|
console.log('');
|
|
2464
2490
|
console.log(formatObservedReport(postflight, { title: `${h.label} session ended — postflight` }));
|
|
2465
2491
|
console.log('');
|
|
2466
|
-
|
|
2492
|
+
if (provisionalOutcome) {
|
|
2493
|
+
const why = postflight.headChanged ? 'committed work is in your repo' : 'changes are in your working tree';
|
|
2494
|
+
console.log(` ${teal('●')} ${sage('Back in phewsh.')} ${sage('Looks ')}${green('kept')} ${slate('(' + why + ') — enter ↵ to confirm')}`);
|
|
2495
|
+
console.log(` ${slate('or correct it: 1 kept · 2 undid · 3 redid · 4 flopped · /reconcile · /switch <tool>')}`);
|
|
2496
|
+
} else {
|
|
2497
|
+
console.log(` ${teal('●')} ${sage('Back in phewsh.')} ${slate('No changes detected. 1 kept · 2 undid · 3 redid · 4 flopped · /reconcile · /switch <tool>')}`);
|
|
2498
|
+
}
|
|
2467
2499
|
console.log('');
|
|
2468
2500
|
rl.prompt();
|
|
2469
2501
|
return;
|