worclaude 1.2.5 → 1.2.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worclaude",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "description": "CLI tool that scaffolds a comprehensive Claude Code workflow into any project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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,19 @@ export async function statusCommand() {
28
29
  display.sectionHeader('WORCLAUDE STATUS');
29
30
 
30
31
  // Version
31
- display.barLine(
32
- `${'Version'.padEnd(11)}${display.green(`v${meta.version}`)} ${display.dimColor('(up to date)')}`
33
- );
32
+ const cliVersion = await getPackageVersion();
33
+ const latestVersion = getLatestNpmVersion();
34
+
35
+ let versionSuffix = '';
36
+ if (meta.version !== cliVersion) {
37
+ versionSuffix = ` ${display.yellow(`(upgrade available: v${cliVersion})`)}`;
38
+ } else if (latestVersion && latestVersion !== cliVersion) {
39
+ versionSuffix = ` ${display.yellow(`(CLI update available: v${latestVersion})`)}`;
40
+ } else if (latestVersion) {
41
+ versionSuffix = ` ${display.dimColor('(up to date)')}`;
42
+ }
43
+
44
+ display.barLine(`${'Version'.padEnd(11)}${display.green(`v${meta.version}`)}${versionSuffix}`);
34
45
 
35
46
  // Project info
36
47
  const projectTypes = meta.projectTypes || [];
@@ -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
- async function getLatestNpmVersion() {
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' });
@@ -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('1.0.0')
16
+ .version(getPackageVersionSync())
16
17
  .description('Scaffold a comprehensive Claude Code workflow into any project');
17
18
 
18
19
  program.showSuggestionAfterError(true);
@@ -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
+ }