@ghl-ai/aw 0.1.62-beta.0 → 0.1.62-beta.1
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/c4/templates/scripts/aw-c4-bootstrap.sh +14 -2
- package/commands/c4.mjs +18 -11
- package/package.json +1 -1
|
@@ -111,6 +111,18 @@ AW_PACKAGE="${AW_PACKAGE:-@ghl-ai/aw@latest}"
|
|
|
111
111
|
echo "[aw-c4-bootstrap] installing ${AW_PACKAGE}"
|
|
112
112
|
npm install -g "${AW_PACKAGE}"
|
|
113
113
|
|
|
114
|
+
# --dry-run and --diagnose are read-only modes; skip post-c4 verification
|
|
115
|
+
# so we don't mutate $HOME or contact the registry unexpectedly.
|
|
116
|
+
is_readonly_mode=false
|
|
117
|
+
for arg in "$@"; do
|
|
118
|
+
case "$arg" in --dry-run|--diagnose) is_readonly_mode=true ;; esac
|
|
119
|
+
done
|
|
120
|
+
|
|
121
|
+
if "$is_readonly_mode"; then
|
|
122
|
+
echo "[aw-c4-bootstrap] running: aw c4 $*"
|
|
123
|
+
exec aw c4 "$@"
|
|
124
|
+
fi
|
|
125
|
+
|
|
114
126
|
echo "[aw-c4-bootstrap] running: aw c4 $*"
|
|
115
127
|
aw c4 "$@"
|
|
116
128
|
aw_c4_exit=$?
|
|
@@ -130,12 +142,12 @@ verify_registry_commands() {
|
|
|
130
142
|
fi
|
|
131
143
|
|
|
132
144
|
local cmd_count
|
|
133
|
-
cmd_count=$(find "$aw_cmd_dir" -name '*.md' -path '*/commands/*' 2>/dev/null | wc -l | tr -d ' ')
|
|
145
|
+
cmd_count=$(find "$aw_cmd_dir" -name '*.md' -path '*/commands/*' ! -path '*/evals/*' 2>/dev/null | wc -l | tr -d ' ')
|
|
134
146
|
if [ "${cmd_count:-0}" -lt 20 ]; then
|
|
135
147
|
echo "[aw-c4-bootstrap] only ${cmd_count} registry commands found — running aw pull"
|
|
136
148
|
aw pull 2>&1 | tail -5 || true
|
|
137
149
|
local new_count
|
|
138
|
-
new_count=$(find "$aw_cmd_dir" -name '*.md' -path '*/commands/*' 2>/dev/null | wc -l | tr -d ' ')
|
|
150
|
+
new_count=$(find "$aw_cmd_dir" -name '*.md' -path '*/commands/*' ! -path '*/evals/*' 2>/dev/null | wc -l | tr -d ' ')
|
|
139
151
|
echo "[aw-c4-bootstrap] registry commands: ${cmd_count} → ${new_count}"
|
|
140
152
|
else
|
|
141
153
|
echo "[aw-c4-bootstrap] registry: ${cmd_count} commands OK"
|
package/commands/c4.mjs
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import { spawnSync as nodeSpawnSync } from 'node:child_process';
|
|
27
|
-
import { existsSync as fsExistsSync, readdirSync } from 'node:fs';
|
|
27
|
+
import { existsSync as fsExistsSync, readdirSync, statSync } from 'node:fs';
|
|
28
28
|
import { join } from 'node:path';
|
|
29
29
|
import * as c4Default from '../c4/index.mjs';
|
|
30
30
|
import { isMcpEnabled } from '../mcp.mjs';
|
|
@@ -101,6 +101,15 @@ function safeReaddirSync(dir) {
|
|
|
101
101
|
try { return readdirSync(dir); } catch { return []; }
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
function safeListNamespaceDirs(dir) {
|
|
105
|
+
try {
|
|
106
|
+
return readdirSync(dir).filter((entry) => {
|
|
107
|
+
if (entry.startsWith('.')) return false;
|
|
108
|
+
try { return statSync(join(dir, entry)).isDirectory(); } catch { return false; }
|
|
109
|
+
});
|
|
110
|
+
} catch { return []; }
|
|
111
|
+
}
|
|
112
|
+
|
|
104
113
|
async function safeAsync(label, fn, writer) {
|
|
105
114
|
try {
|
|
106
115
|
return { ok: true, value: await fn() };
|
|
@@ -396,17 +405,15 @@ export async function c4Command(rawArgs, overrides = {}) {
|
|
|
396
405
|
return exit(1);
|
|
397
406
|
}
|
|
398
407
|
|
|
399
|
-
// Step 9a — verify registry has
|
|
400
|
-
//
|
|
401
|
-
//
|
|
402
|
-
//
|
|
403
|
-
//
|
|
408
|
+
// Step 9a — verify registry has namespace directories. `aw init --silent`
|
|
409
|
+
// can exit 0 but fail to fetch (fetchAndMerge swallows the error in silent
|
|
410
|
+
// mode). Metadata-only artifacts (AW-PROTOCOL.md) pass a simple non-empty
|
|
411
|
+
// check, so we specifically look for directories (namespaces like
|
|
412
|
+
// "platform") to confirm the registry content was actually pulled.
|
|
404
413
|
{
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
if (registryEntries.length === 0) {
|
|
409
|
-
writer.stderr('[aw-c4] registry empty after init — retrying with aw pull\n');
|
|
414
|
+
const registryNamespaces = safeListNamespaceDirs(awRegistry);
|
|
415
|
+
if (registryNamespaces.length === 0) {
|
|
416
|
+
writer.stderr('[aw-c4] registry has no namespace directories after init — retrying with aw pull\n');
|
|
410
417
|
const pullRes = spawnSync('aw', ['pull'], { stdio: 'pipe' });
|
|
411
418
|
if (pullRes && pullRes.status !== 0) {
|
|
412
419
|
writer.stderr('[aw-c4] aw pull also failed; commands may be incomplete\n');
|