phewsh 0.15.73 → 0.15.74

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.
@@ -81,6 +81,26 @@ function assembleRaw(answers) {
81
81
  return answers.map((a) => `${a.title} (${a.directive}): ${a.answer}`).join('\n');
82
82
  }
83
83
 
84
+ // No-AI spec from the user's own words: the first answer line becomes the
85
+ // goal (node label stripped), the raw text survives verbatim in pps.intent.raw,
86
+ // and the first task points back at the AI compile.
87
+ function fallbackSpec(raw) {
88
+ const first = String(raw).split('\n').find(l => l.trim()) || "Capture this project's intent";
89
+ const goal = first.replace(/^[A-Za-z]+ \([^)]*\):\s*/, '').trim().slice(0, 200);
90
+ return {
91
+ goal,
92
+ success_criteria: [],
93
+ constraints: [],
94
+ inputs: [],
95
+ outputs: [],
96
+ tasks: [
97
+ { text: 'Re-run `phewsh clarify --update` to compile this spec with AI', type: 'copy' },
98
+ { text: 'Refine the vision — complete vision.md', type: 'do' },
99
+ { text: 'Define Phase 1 — what is the smallest thing to ship?', type: 'do' },
100
+ ],
101
+ };
102
+ }
103
+
84
104
  function buildClarifySystemPrompt(existing) {
85
105
  const isRefine = !!(existing?.intent?.goal);
86
106
  return `You are a project compiler. Your job is to extract clean, structured intent from messy human input.
@@ -264,8 +284,12 @@ async function main() {
264
284
  ? await callClarifyViaHarness(harnessId, raw, existing)
265
285
  : await callClarifyAPI(config.apiKey, raw, existing);
266
286
  } catch (err) {
267
- console.error('\n Clarify failed:', err.message, '\n');
268
- process.exit(1);
287
+ // A failed compile must NEVER eat the user's answers. They just walked
288
+ // the compass — write a plain no-AI spec from what they typed, and let
289
+ // `clarify --update` enrich it when a route works again.
290
+ console.log(`\n AI compile unavailable (${err.message}).`);
291
+ console.log(' Saving your answers as a plain spec instead — nothing you typed is lost.');
292
+ extracted = fallbackSpec(raw);
269
293
  }
270
294
 
271
295
  const entity = getProjectName();
@@ -333,4 +357,4 @@ if (require.main === module) {
333
357
  });
334
358
  }
335
359
 
336
- module.exports = { run: main, GUIDE_NODES, INTENT_NODES, assembleRaw, askGuided, extractJson };
360
+ module.exports = { run: main, GUIDE_NODES, INTENT_NODES, assembleRaw, askGuided, extractJson, fallbackSpec };
@@ -6,7 +6,12 @@ const { createPPS, writeGuardedViews } = require('../lib/pps');
6
6
 
7
7
  const os = require('os');
8
8
  const configFile = require('../lib/config-file');
9
- const args = process.argv.slice(3);
9
+ // Flags may arrive as `phewsh intent --init` / `phewsh init --init` (flag at
10
+ // argv[3]) or as a direct `node intent.js --init` (flag at argv[2]) — the
11
+ // session used the direct form and every flag was silently missed, so /init
12
+ // printed help instead of initializing. Accept both shapes.
13
+ const rawArgs = process.argv.slice(2);
14
+ const args = (rawArgs[0] === 'intent' || rawArgs[0] === 'init') ? rawArgs.slice(1) : rawArgs;
10
15
  const INTENT_DIR = path.join(process.cwd(), '.intent');
11
16
  const CONFIG_PATH = path.join(os.homedir(), '.phewsh', 'config.json');
12
17
  const WEB_URL = 'https://phewsh.com/intent';
@@ -1329,8 +1329,8 @@ async function main() {
1329
1329
  if (choice.kind === 'init') {
1330
1330
  bootstrapChoices = null;
1331
1331
  try {
1332
- const { execSync } = require('child_process');
1333
- execSync('node ' + path.join(__dirname, 'intent.js') + ' --init', { stdio: 'inherit' });
1332
+ const { execFileSync } = require('child_process');
1333
+ execFileSync(process.execPath, [path.join(__dirname, '..', 'bin', 'phewsh.js'), 'intent', '--init'], { stdio: 'inherit' });
1334
1334
  intentFiles = loadIntentContext();
1335
1335
  systemPrompt = buildSystemPrompt(intentFiles);
1336
1336
  if (intentFiles.length > 0) {
@@ -1916,8 +1916,8 @@ async function main() {
1916
1916
  console.log(` ${sage('Use /reload to refresh context')}\n`);
1917
1917
  } else {
1918
1918
  try {
1919
- const { execSync } = require('child_process');
1920
- execSync('node ' + path.join(__dirname, 'intent.js') + ' --init', { stdio: 'inherit' });
1919
+ const { execFileSync } = require('child_process');
1920
+ execFileSync(process.execPath, [path.join(__dirname, '..', 'bin', 'phewsh.js'), 'intent', '--init'], { stdio: 'inherit' });
1921
1921
  intentFiles = loadIntentContext();
1922
1922
  systemPrompt = buildSystemPrompt(intentFiles);
1923
1923
  if (intentFiles.length > 0) {
package/lib/packs.js CHANGED
@@ -54,11 +54,11 @@ const PACKS = {
54
54
  },
55
55
  'loop-library': {
56
56
  kind: 'linked',
57
- title: 'Loop Library',
58
- desc: 'Copy-ready agent loops with checks and stopping conditions. Good Work-layer inspiration; phewsh links to it without becoming a scheduler or runner.',
59
- source: 'github.com/Forward-Future/loop-library · signals.forwardfuture.ai/loop-library',
57
+ title: 'Loop Library / Loopy',
58
+ desc: 'Forward Future\'s practical agent-loop library and Loopy skill, with checks and stopping conditions. Good Work-layer inspiration; phewsh links to it without becoming a scheduler or runner.',
59
+ source: 'signals.forwardfuture.com/loop-library · github.com/Forward-Future/loop-library',
60
60
  license: 'MIT',
61
- install: 'npx skills add Forward-Future/loop-library --skill loop-library -g # install through upstream skills tooling',
61
+ install: 'npx skills add Forward-Future/loop-library --skill loopy -g # install Loopy through upstream skills tooling',
62
62
  },
63
63
  'matt-skills': {
64
64
  kind: 'linked',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phewsh",
3
- "version": "0.15.73",
3
+ "version": "0.15.74",
4
4
  "description": "Turn intent into action. Structure your thinking, execute your next step.",
5
5
  "bin": {
6
6
  "phewsh": "bin/phewsh.js"