@ghl-ai/aw 0.1.4 → 0.1.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/cli.mjs +7 -3
- package/commands/init.mjs +7 -1
- package/git.mjs +3 -2
- package/package.json +1 -1
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
|
|
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');
|
|
@@ -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(
|
|
106
|
+
fmt.intro(`aw init ${chalk.dim('v' + VERSION)}`);
|
|
101
107
|
|
|
102
108
|
// ── Validate ──────────────────────────────────────────────────────────
|
|
103
109
|
|
package/git.mjs
CHANGED
|
@@ -13,12 +13,13 @@ import { REGISTRY_BASE_BRANCH } from './constants.mjs';
|
|
|
13
13
|
export function sparseCheckout(repo, paths) {
|
|
14
14
|
const tempDir = mkdtempSync(join(tmpdir(), 'aw-'));
|
|
15
15
|
|
|
16
|
+
const repoUrl = repo.startsWith('http') ? repo : `https://github.com/${repo}.git`;
|
|
16
17
|
try {
|
|
17
|
-
execSync(`
|
|
18
|
+
execSync(`git clone --filter=blob:none --no-checkout "${repoUrl}" "${tempDir}"`, {
|
|
18
19
|
stdio: 'pipe',
|
|
19
20
|
});
|
|
20
21
|
} catch (e) {
|
|
21
|
-
throw new Error(`Failed to clone ${repo}. Check
|
|
22
|
+
throw new Error(`Failed to clone ${repo}. Check your git credentials and repo access.`);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
try {
|