writethevision 7.0.4 → 7.0.5
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/package.json +1 -1
- package/src/cli.js +54 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "writethevision",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.5",
|
|
4
4
|
"description": "Write The Vision (WTV): vision-driven development with the Habakkuk workflow. 10 agents + 21 skills for Claude Code, Codex CLI, and OpenCode.",
|
|
5
5
|
"author": "Christopher Hogg",
|
|
6
6
|
"license": "MIT",
|
package/src/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
writeFileSync,
|
|
15
15
|
} from 'fs';
|
|
16
16
|
import { homedir, platform } from 'os';
|
|
17
|
-
import { spawn } from 'child_process';
|
|
17
|
+
import { spawn, spawnSync } from 'child_process';
|
|
18
18
|
|
|
19
19
|
async function openInEditor(filePath) {
|
|
20
20
|
const editor = process.env.EDITOR || 'vi';
|
|
@@ -1249,15 +1249,16 @@ function habakkukStones() {
|
|
|
1249
1249
|
console.log('');
|
|
1250
1250
|
}
|
|
1251
1251
|
|
|
1252
|
-
function checkForUpdates() {
|
|
1252
|
+
async function checkForUpdates() {
|
|
1253
1253
|
const shouldCheck = process.env.WTV_NO_UPDATE_CHECK !== '1' && process.env.CODEHOGG_NO_UPDATE_CHECK !== '1';
|
|
1254
1254
|
if (!shouldCheck) return;
|
|
1255
1255
|
if (!process.stdout.isTTY) return;
|
|
1256
1256
|
|
|
1257
1257
|
try {
|
|
1258
|
+
const packageName = getPackageName();
|
|
1258
1259
|
const notifier = updateNotifier({
|
|
1259
1260
|
pkg: {
|
|
1260
|
-
name:
|
|
1261
|
+
name: packageName,
|
|
1261
1262
|
version: getVersion(),
|
|
1262
1263
|
},
|
|
1263
1264
|
updateCheckInterval: 1000 * 60 * 60 * 24 * 7,
|
|
@@ -1267,31 +1268,66 @@ function checkForUpdates() {
|
|
|
1267
1268
|
const update = notifier.update;
|
|
1268
1269
|
if (!update) return;
|
|
1269
1270
|
|
|
1271
|
+
const npmGlobalCmd = `npm install -g ${packageName}@latest`;
|
|
1272
|
+
const npxCmd = `npx -y ${packageName}@latest`;
|
|
1273
|
+
|
|
1270
1274
|
notifier.notify({
|
|
1271
1275
|
message: `Update available ${c.dim}${update.current}${c.reset} → ${c.green}${update.latest}${c.reset}
|
|
1272
|
-
Run ${c.cyan}npx writethevision update${c.reset} to get the latest version`,
|
|
1273
|
-
defer: false,
|
|
1274
|
-
boxenOpts: {
|
|
1275
|
-
padding: 1,
|
|
1276
|
-
margin: 1,
|
|
1277
|
-
align: 'center',
|
|
1278
|
-
borderColor: 'yellow',
|
|
1279
|
-
borderStyle: 'round',
|
|
1280
|
-
},
|
|
1281
|
-
});
|
|
1282
1276
|
|
|
1283
|
-
|
|
1284
|
-
|
|
1277
|
+
Update global install:
|
|
1278
|
+
${c.cyan}${npmGlobalCmd}${c.reset}
|
|
1279
|
+
|
|
1280
|
+
Or run latest once:
|
|
1281
|
+
${c.cyan}${npxCmd}${c.reset}
|
|
1282
|
+
`,
|
|
1285
1283
|
defer: false,
|
|
1286
1284
|
boxenOpts: {
|
|
1287
1285
|
padding: 1,
|
|
1288
1286
|
margin: 1,
|
|
1289
|
-
align: '
|
|
1287
|
+
align: 'left',
|
|
1290
1288
|
borderColor: 'yellow',
|
|
1291
1289
|
borderStyle: 'round',
|
|
1292
1290
|
},
|
|
1293
1291
|
});
|
|
1294
|
-
|
|
1292
|
+
|
|
1293
|
+
const shouldPrompt = process.stdin.isTTY && process.env.WTV_NO_AUTO_UPDATE !== '1' && !process.env.CI;
|
|
1294
|
+
if (!shouldPrompt) return;
|
|
1295
|
+
|
|
1296
|
+
const isDevCheckout = existsSync(join(PACKAGE_ROOT, '.git'));
|
|
1297
|
+
if (isDevCheckout) return;
|
|
1298
|
+
|
|
1299
|
+
const wantsUpdate = await confirm(`Update ${packageName} to v${update.latest} now?`, false);
|
|
1300
|
+
if (!wantsUpdate) return;
|
|
1301
|
+
|
|
1302
|
+
const argv1 = process.argv[1] || '';
|
|
1303
|
+
const userAgent = process.env.npm_config_user_agent || '';
|
|
1304
|
+
const runningViaNpx = argv1.includes('_npx') || userAgent.includes('npx/');
|
|
1305
|
+
|
|
1306
|
+
if (runningViaNpx) {
|
|
1307
|
+
console.log(`
|
|
1308
|
+
${c.yellow}${sym.warn}${c.reset} You're running via npx cache.`);
|
|
1309
|
+
console.log(` Next run: ${c.cyan}${npxCmd}${c.reset}
|
|
1310
|
+
`);
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
const npmBin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
1315
|
+
const result = spawnSync(npmBin, ['install', '-g', `${packageName}@latest`], { stdio: 'inherit' });
|
|
1316
|
+
|
|
1317
|
+
if (result.status !== 0) {
|
|
1318
|
+
console.log(`
|
|
1319
|
+
${c.red}${sym.cross}${c.reset} Update failed.`);
|
|
1320
|
+
console.log(` Try manually: ${c.cyan}${npmGlobalCmd}${c.reset}
|
|
1321
|
+
`);
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
console.log(`
|
|
1326
|
+
${c.green}${sym.check}${c.reset} Updated ${packageName} to ${update.latest}.`);
|
|
1327
|
+
console.log(` Re-run ${c.cyan}wtv${c.reset} to use the new version.
|
|
1328
|
+
`);
|
|
1329
|
+
process.exit(0);
|
|
1330
|
+
} catch {
|
|
1295
1331
|
}
|
|
1296
1332
|
}
|
|
1297
1333
|
|
|
@@ -4272,7 +4308,7 @@ export async function run(args) {
|
|
|
4272
4308
|
const scope = opts.global ? 'global' : 'project';
|
|
4273
4309
|
|
|
4274
4310
|
if (opts.command !== 'version') {
|
|
4275
|
-
checkForUpdates();
|
|
4311
|
+
await checkForUpdates();
|
|
4276
4312
|
}
|
|
4277
4313
|
|
|
4278
4314
|
switch (opts.command) {
|