@ghl-ai/aw 0.1.25-beta.12 → 0.1.25-beta.14
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/integrate.mjs +28 -62
- package/package.json +1 -1
package/integrate.mjs
CHANGED
|
@@ -5,23 +5,9 @@ import { join } from 'node:path';
|
|
|
5
5
|
import * as fmt from './fmt.mjs';
|
|
6
6
|
import * as config from './config.mjs';
|
|
7
7
|
|
|
8
|
-
// AW CLI commands to generate
|
|
9
|
-
const AW_COMMANDS = [
|
|
10
|
-
{ name: 'pull', description: 'Pull agents & skills from registry', hint: '<path>' },
|
|
11
|
-
{ name: 'push', description: 'Push local changes to registry', hint: '<path>' },
|
|
12
|
-
{ name: 'status', description: 'Show workspace sync status', hint: '' },
|
|
13
|
-
{ name: 'drop', description: 'Stop syncing a path', hint: '<path>' },
|
|
14
|
-
{ name: 'search', description: 'Search local and remote registry', hint: '<query>' },
|
|
15
|
-
{ name: 'nuke', description: 'Remove entire .aw_registry/', hint: '' },
|
|
16
|
-
];
|
|
17
|
-
|
|
18
8
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* link.mjs symlinks everything from commands/ → .claude/commands/aw/ for discovery.
|
|
22
|
-
*
|
|
23
|
-
* A .generated-manifest.json tracks which files were generated so they can be
|
|
24
|
-
* cleaned on rebuild without needing filename prefixes.
|
|
9
|
+
* Count hand-written commands already present in the registry.
|
|
10
|
+
* No CLI stub generation — all commands come from the registry itself.
|
|
25
11
|
*/
|
|
26
12
|
export function generateCommands(cwd) {
|
|
27
13
|
const awDir = join(cwd, '.aw_registry');
|
|
@@ -30,56 +16,15 @@ export function generateCommands(cwd) {
|
|
|
30
16
|
const oldGenDir = join(awDir, '.generated-commands');
|
|
31
17
|
if (existsSync(oldGenDir)) rmSync(oldGenDir, { recursive: true, force: true });
|
|
32
18
|
|
|
19
|
+
// Count hand-written commands across all namespaces for reporting
|
|
33
20
|
let count = 0;
|
|
34
21
|
const namespaces = getTeamNamespaces(awDir);
|
|
35
|
-
|
|
36
22
|
for (const ns of namespaces) {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
for (const cmd of AW_COMMANDS) {
|
|
42
|
-
const fileName = `${cmd.name}.md`;
|
|
43
|
-
// Skip if a hand-written command with same name exists
|
|
44
|
-
if (existsSync(join(commandsDir, fileName))) continue;
|
|
45
|
-
|
|
46
|
-
const content = [
|
|
47
|
-
'---',
|
|
48
|
-
`name: aw:${cmd.name}`,
|
|
49
|
-
`description: ${cmd.description}`,
|
|
50
|
-
cmd.hint ? `argument-hint: "${cmd.hint}"` : null,
|
|
51
|
-
'---',
|
|
52
|
-
'',
|
|
53
|
-
'Run the following command:',
|
|
54
|
-
'',
|
|
55
|
-
'```',
|
|
56
|
-
`node bin/aw ${cmd.name} $ARGUMENTS`,
|
|
57
|
-
'```',
|
|
58
|
-
'',
|
|
59
|
-
].filter(v => v !== null).join('\n');
|
|
60
|
-
|
|
61
|
-
writeFileSync(join(commandsDir, fileName), content);
|
|
62
|
-
count++;
|
|
23
|
+
const nsDir = join(awDir, ns);
|
|
24
|
+
if (existsSync(nsDir)) {
|
|
25
|
+
const cmdFiles = findFiles(nsDir, 'commands');
|
|
26
|
+
count += cmdFiles.length;
|
|
63
27
|
}
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Codex skills — .agents/skills/<name>/SKILL.md
|
|
68
|
-
const agentsSkillsDir = join(cwd, '.agents/skills');
|
|
69
|
-
mkdirSync(agentsSkillsDir, { recursive: true });
|
|
70
|
-
for (const cmd of AW_COMMANDS) {
|
|
71
|
-
const skillDir = join(agentsSkillsDir, cmd.name);
|
|
72
|
-
mkdirSync(skillDir, { recursive: true });
|
|
73
|
-
const content = [
|
|
74
|
-
'---',
|
|
75
|
-
`name: ${cmd.name}`,
|
|
76
|
-
`description: ${cmd.description}`,
|
|
77
|
-
'---',
|
|
78
|
-
'',
|
|
79
|
-
`Run: \`node bin/aw ${cmd.name}\` followed by the user's arguments.`,
|
|
80
|
-
'',
|
|
81
|
-
].join('\n');
|
|
82
|
-
writeFileSync(join(skillDir, 'SKILL.md'), content);
|
|
83
28
|
}
|
|
84
29
|
|
|
85
30
|
if (count > 0) {
|
|
@@ -89,6 +34,27 @@ export function generateCommands(cwd) {
|
|
|
89
34
|
return count;
|
|
90
35
|
}
|
|
91
36
|
|
|
37
|
+
function findFiles(dir, typeName) {
|
|
38
|
+
const results = [];
|
|
39
|
+
function walk(d) {
|
|
40
|
+
for (const entry of readdirSync(d, { withFileTypes: true })) {
|
|
41
|
+
if (entry.name.startsWith('.')) continue;
|
|
42
|
+
const full = join(d, entry.name);
|
|
43
|
+
if (entry.isDirectory()) {
|
|
44
|
+
if (entry.name === typeName) {
|
|
45
|
+
for (const f of readdirSync(full)) {
|
|
46
|
+
if (f.endsWith('.md')) results.push(join(full, f));
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
walk(full);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
walk(dir);
|
|
55
|
+
return results;
|
|
56
|
+
}
|
|
57
|
+
|
|
92
58
|
/**
|
|
93
59
|
* Copy CLAUDE.md and AGENTS.md to project root.
|
|
94
60
|
*/
|