@ghl-ai/aw 0.1.5 → 0.1.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/cli.mjs CHANGED
@@ -1,9 +1,13 @@
1
1
  // cli.mjs — Argument parser and command router
2
2
 
3
+ import { readFileSync } from 'node:fs';
4
+ import { join, dirname } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
3
6
  import * as fmt from './fmt.mjs';
4
7
  import { chalk } from './fmt.mjs';
5
8
 
6
- const VERSION = '0.1.0';
9
+ const __dirname = dirname(fileURLToPath(import.meta.url));
10
+ const VERSION = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8')).version;
7
11
 
8
12
  const COMMANDS = {
9
13
  init: () => import('./commands/init.mjs').then(m => m.initCommand),
@@ -121,8 +125,8 @@ function printHelp() {
121
125
  export async function run(argv) {
122
126
  const { command, args } = parseArgs(argv);
123
127
 
124
- if (args['--version']) {
125
- console.log(VERSION);
128
+ if (args['--version'] || (!command && args['-v'])) {
129
+ console.log(`aw v${VERSION}`);
126
130
  process.exit(0);
127
131
  }
128
132
 
package/commands/init.mjs CHANGED
@@ -20,6 +20,12 @@ import { linkWorkspace } from '../link.mjs';
20
20
  import { daemonCommand } from './daemon.mjs';
21
21
  import { generateCommands, copyInstructions, initAwDocs } from '../integrate.mjs';
22
22
  import { setupMcp } from '../mcp.mjs';
23
+ import { readFileSync as readFileSyncPkg } from 'node:fs';
24
+ import { dirname } from 'node:path';
25
+ import { fileURLToPath } from 'node:url';
26
+
27
+ const __dirname = dirname(fileURLToPath(import.meta.url));
28
+ const VERSION = JSON.parse(readFileSyncPkg(join(__dirname, '..', 'package.json'), 'utf8')).version;
23
29
 
24
30
  const HOME = homedir();
25
31
  const GLOBAL_AW_DIR = join(HOME, '.aw_registry');
@@ -78,7 +84,7 @@ function installAutoSync() {
78
84
  profiles.push(join(HOME, '.bashrc'));
79
85
 
80
86
  const marker = '# aw-auto-sync';
81
- const snippet = `\n${marker}\n[ -f "$HOME/.aw_registry/.sync-config.json" ] && command -v aw >/dev/null 2>&1 && aw pull --silent &\n`;
87
+ const snippet = `\n${marker}\n[ -f "$HOME/.aw_registry/.sync-config.json" ] && command -v aw >/dev/null 2>&1 && (cd "$HOME" && aw pull --silent) &\n`;
82
88
 
83
89
  const target = profiles.find(p => existsSync(p)) || join(HOME, '.zshrc');
84
90
  const current = existsSync(target) ? readFileSync(target, 'utf8') : '';
@@ -97,7 +103,7 @@ export async function initCommand(args) {
97
103
  const namespace = args['--namespace'] || null;
98
104
  let user = args['--user'] || '';
99
105
 
100
- fmt.intro('aw init');
106
+ fmt.intro(`aw init ${chalk.dim('v' + VERSION)}`);
101
107
 
102
108
  // ── Validate ──────────────────────────────────────────────────────────
103
109
 
package/commands/pull.mjs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { mkdirSync, existsSync, readdirSync } from 'node:fs';
4
4
  import { join } from 'node:path';
5
+ import { homedir } from 'node:os';
5
6
  import { execSync } from 'node:child_process';
6
7
  import * as config from '../config.mjs';
7
8
  import * as fmt from '../fmt.mjs';
@@ -19,7 +20,9 @@ import { generateCommands, copyInstructions } from '../integrate.mjs';
19
20
  export function pullCommand(args) {
20
21
  const input = args._positional?.[0] || '';
21
22
  const cwd = process.cwd();
22
- const workspaceDir = args._workspaceDir || join(cwd, '.aw_registry');
23
+ const GLOBAL_AW_DIR = join(homedir(), '.aw_registry');
24
+ const localDir = join(cwd, '.aw_registry');
25
+ const workspaceDir = args._workspaceDir || (existsSync(join(localDir, '.sync-config.json')) ? localDir : GLOBAL_AW_DIR);
23
26
  const dryRun = args['--dry-run'] === true;
24
27
  const verbose = args['-v'] === true || args['--verbose'] === true;
25
28
  const renameNamespace = args._renameNamespace || null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghl-ai/aw",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Agentic Workspace CLI — pull, push & manage agents, skills and commands from the registry",
5
5
  "type": "module",
6
6
  "bin": {