@ghl-ai/aw 0.1.25-beta.4 → 0.1.25-beta.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/commands/init.mjs +15 -16
- package/link.mjs +23 -17
- package/package.json +1 -1
package/commands/init.mjs
CHANGED
|
@@ -178,8 +178,15 @@ export async function initCommand(args) {
|
|
|
178
178
|
if (isExisting) {
|
|
179
179
|
if (!silent) fmt.logStep('Already initialized — syncing...');
|
|
180
180
|
|
|
181
|
-
// Pull latest
|
|
182
|
-
|
|
181
|
+
// Pull latest (parallel)
|
|
182
|
+
const cfg = config.load(GLOBAL_AW_DIR);
|
|
183
|
+
if (cfg && cfg.include.length > 0) {
|
|
184
|
+
const pullJobs = cfg.include.map(p =>
|
|
185
|
+
pullAsync({ ...args, _positional: [p], _workspaceDir: GLOBAL_AW_DIR, _skipIntegrate: true,
|
|
186
|
+
_renameNamespace: p === '[template]' ? namespace : undefined }),
|
|
187
|
+
);
|
|
188
|
+
await Promise.all(pullJobs);
|
|
189
|
+
}
|
|
183
190
|
|
|
184
191
|
// Re-link IDE dirs (idempotent)
|
|
185
192
|
linkWorkspace(HOME);
|
|
@@ -256,23 +263,15 @@ export async function initCommand(args) {
|
|
|
256
263
|
printPullSummary(pattern, actions);
|
|
257
264
|
}
|
|
258
265
|
|
|
259
|
-
// Step 3: Link IDE dirs +
|
|
260
|
-
|
|
261
|
-
s2.start('Linking IDE symlinks & generating commands...');
|
|
266
|
+
// Step 3: Link IDE dirs + setup tasks
|
|
267
|
+
fmt.logStep('Linking IDE symlinks...');
|
|
262
268
|
linkWorkspace(HOME);
|
|
263
269
|
generateCommands(HOME);
|
|
264
270
|
const instructionFiles = copyInstructions(HOME, null, namespace) || [];
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
const [, , mcpFiles, gitTemplateInstalled] = await Promise.all([
|
|
270
|
-
Promise.resolve(initAwDocs(HOME)),
|
|
271
|
-
Promise.resolve(installIdeTasks()),
|
|
272
|
-
Promise.resolve(setupMcp(HOME, namespace) || []),
|
|
273
|
-
Promise.resolve(installGitTemplate()),
|
|
274
|
-
]);
|
|
275
|
-
s3.stop('Setup complete');
|
|
271
|
+
initAwDocs(HOME);
|
|
272
|
+
const mcpFiles = setupMcp(HOME, namespace) || [];
|
|
273
|
+
const gitTemplateInstalled = installGitTemplate();
|
|
274
|
+
installIdeTasks();
|
|
276
275
|
|
|
277
276
|
// Step 4: Symlink in current directory if it's a git repo
|
|
278
277
|
if (cwd !== HOME && !existsSync(join(cwd, '.aw_registry'))) {
|
package/link.mjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { existsSync, lstatSync, mkdirSync, readdirSync, unlinkSync } from 'node:fs';
|
|
4
4
|
import { join, relative } from 'node:path';
|
|
5
5
|
import { execSync } from 'node:child_process';
|
|
6
|
+
import { homedir } from 'node:os';
|
|
6
7
|
import * as fmt from './fmt.mjs';
|
|
7
8
|
|
|
8
9
|
const IDE_DIRS = ['.claude', '.cursor', '.codex'];
|
|
@@ -66,9 +67,12 @@ function cleanIdeSymlinks(cwd) {
|
|
|
66
67
|
if (!existsSync(ideDir)) continue;
|
|
67
68
|
cleanSymlinksRecursive(ideDir);
|
|
68
69
|
}
|
|
69
|
-
// Also clean .agents/skills/
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
70
|
+
// Also clean .agents/skills/ (global only — Codex reads from ~/.agents/skills/)
|
|
71
|
+
const HOME = homedir();
|
|
72
|
+
if (cwd === HOME) {
|
|
73
|
+
const agentsSkillsDir = join(cwd, '.agents', 'skills');
|
|
74
|
+
if (existsSync(agentsSkillsDir)) cleanSymlinksRecursive(agentsSkillsDir);
|
|
75
|
+
}
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
/**
|
|
@@ -184,20 +188,22 @@ export function linkWorkspace(cwd) {
|
|
|
184
188
|
}
|
|
185
189
|
}
|
|
186
190
|
|
|
187
|
-
// Codex per-skill symlinks:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
for (const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
191
|
+
// Codex per-skill symlinks: ~/.agents/skills/<name> (global only)
|
|
192
|
+
if (cwd === homedir()) {
|
|
193
|
+
const agentsSkillsDir = join(cwd, '.agents/skills');
|
|
194
|
+
for (const ns of namespaces) {
|
|
195
|
+
for (const { typeDirPath: skillsDir, segments } of findNestedTypeDirs(join(awDir, ns), 'skills')) {
|
|
196
|
+
mkdirSync(agentsSkillsDir, { recursive: true });
|
|
197
|
+
for (const skill of listDirs(skillsDir)) {
|
|
198
|
+
const flat = [ns, ...segments, skill].join('-');
|
|
199
|
+
const linkPath = join(agentsSkillsDir, flat);
|
|
200
|
+
const targetPath = join(skillsDir, skill);
|
|
201
|
+
const relTarget = relative(agentsSkillsDir, targetPath);
|
|
202
|
+
try {
|
|
203
|
+
execSync(`ln -sfn "${relTarget}" "${linkPath}"`, { stdio: 'pipe' });
|
|
204
|
+
created++;
|
|
205
|
+
} catch { /* best effort */ }
|
|
206
|
+
}
|
|
201
207
|
}
|
|
202
208
|
}
|
|
203
209
|
}
|