worclaude 1.2.5 → 1.2.6
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/commands/status.js +13 -4
- package/src/commands/upgrade.js +2 -9
- package/src/core/config.js +6 -1
- package/src/index.js +2 -1
- package/src/utils/npm.js +16 -0
package/package.json
CHANGED
package/src/commands/status.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { readWorkflowMeta, workflowMetaExists } from '../core/config.js';
|
|
2
|
+
import { readWorkflowMeta, workflowMetaExists, getPackageVersion } from '../core/config.js';
|
|
3
3
|
import { hashFile } from '../utils/hash.js';
|
|
4
4
|
import { fileExists, readFile, listFilesRecursive } from '../utils/file.js';
|
|
5
|
+
import { getLatestNpmVersion } from '../utils/npm.js';
|
|
5
6
|
import { TECH_STACKS } from '../data/agents.js';
|
|
6
7
|
import * as display from '../utils/display.js';
|
|
7
8
|
|
|
@@ -28,9 +29,17 @@ export async function statusCommand() {
|
|
|
28
29
|
display.sectionHeader('WORCLAUDE STATUS');
|
|
29
30
|
|
|
30
31
|
// Version
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const cliVersion = await getPackageVersion();
|
|
33
|
+
const latestVersion = getLatestNpmVersion();
|
|
34
|
+
|
|
35
|
+
let versionSuffix = '';
|
|
36
|
+
if (latestVersion && latestVersion !== cliVersion) {
|
|
37
|
+
versionSuffix = ` ${display.yellow(`(update available: v${latestVersion})`)}`;
|
|
38
|
+
} else if (latestVersion) {
|
|
39
|
+
versionSuffix = ` ${display.dimColor('(up to date)')}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
display.barLine(`${'Version'.padEnd(11)}${display.green(`v${meta.version}`)}${versionSuffix}`);
|
|
34
43
|
|
|
35
44
|
// Project info
|
|
36
45
|
const projectTypes = meta.projectTypes || [];
|
package/src/commands/upgrade.js
CHANGED
|
@@ -14,17 +14,10 @@ import { buildSettingsJson, mergeSettingsPermissionsAndHooks } from '../core/mer
|
|
|
14
14
|
import { readTemplate } from '../core/scaffolder.js';
|
|
15
15
|
import { hashFile } from '../utils/hash.js';
|
|
16
16
|
import { writeFile, fileExists, listFilesRecursive } from '../utils/file.js';
|
|
17
|
+
import { getLatestNpmVersion } from '../utils/npm.js';
|
|
17
18
|
import * as display from '../utils/display.js';
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
return execSync('npm view worclaude version', { encoding: 'utf-8' }).trim();
|
|
22
|
-
} catch {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async function selfUpdate(latestVersion) {
|
|
20
|
+
function selfUpdate(latestVersion) {
|
|
28
21
|
const spinner = ora(`Updating worclaude to v${latestVersion}...`).start();
|
|
29
22
|
try {
|
|
30
23
|
execSync('npm install -g worclaude@latest', { encoding: 'utf-8', stdio: 'pipe' });
|
package/src/core/config.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
2
3
|
import { fileURLToPath } from 'node:url';
|
|
3
4
|
import { readFile, writeFile, fileExists } from '../utils/file.js';
|
|
4
5
|
|
|
5
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const pkgPath = path.resolve(__dirname, '..', '..', 'package.json');
|
|
8
|
+
|
|
9
|
+
export function getPackageVersionSync() {
|
|
10
|
+
return JSON.parse(readFileSync(pkgPath, 'utf-8')).version;
|
|
11
|
+
}
|
|
6
12
|
|
|
7
13
|
export async function getPackageVersion() {
|
|
8
|
-
const pkgPath = path.resolve(__dirname, '..', '..', 'package.json');
|
|
9
14
|
const content = await readFile(pkgPath);
|
|
10
15
|
return JSON.parse(content).version;
|
|
11
16
|
}
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { Command } from 'commander';
|
|
4
|
+
import { getPackageVersionSync } from './core/config.js';
|
|
4
5
|
import { initCommand } from './commands/init.js';
|
|
5
6
|
import { upgradeCommand } from './commands/upgrade.js';
|
|
6
7
|
import { statusCommand } from './commands/status.js';
|
|
@@ -12,7 +13,7 @@ const program = new Command();
|
|
|
12
13
|
|
|
13
14
|
program
|
|
14
15
|
.name('worclaude')
|
|
15
|
-
.version(
|
|
16
|
+
.version(getPackageVersionSync())
|
|
16
17
|
.description('Scaffold a comprehensive Claude Code workflow into any project');
|
|
17
18
|
|
|
18
19
|
program.showSuggestionAfterError(true);
|
package/src/utils/npm.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fetch the latest published version of worclaude from the npm registry.
|
|
5
|
+
* Returns null if offline or if the command fails.
|
|
6
|
+
*/
|
|
7
|
+
export function getLatestNpmVersion() {
|
|
8
|
+
try {
|
|
9
|
+
return execSync('npm view worclaude version', {
|
|
10
|
+
encoding: 'utf-8',
|
|
11
|
+
timeout: 5000,
|
|
12
|
+
}).trim();
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|