@ghl-ai/aw 0.1.42-beta.32 → 0.1.42-beta.34
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 +19 -4
- package/fmt.mjs +27 -17
- package/package.json +1 -1
package/commands/init.mjs
CHANGED
|
@@ -18,9 +18,10 @@ import { execSync } from 'node:child_process';
|
|
|
18
18
|
import { join, dirname, sep } from 'node:path';
|
|
19
19
|
import { homedir } from 'node:os';
|
|
20
20
|
import { fileURLToPath } from 'node:url';
|
|
21
|
+
import * as p from '@clack/prompts';
|
|
21
22
|
import * as config from '../config.mjs';
|
|
22
23
|
import * as fmt from '../fmt.mjs';
|
|
23
|
-
import { chalk } from '../fmt.mjs';
|
|
24
|
+
import { chalk, setSilent } from '../fmt.mjs';
|
|
24
25
|
import { linkWorkspace } from '../link.mjs';
|
|
25
26
|
import { generateCommands, copyInstructions, initAwDocs, syncHomeHarnessInstructions } from '../integrate.mjs';
|
|
26
27
|
import { setupMcp } from '../mcp.mjs';
|
|
@@ -195,6 +196,16 @@ export async function initCommand(args) {
|
|
|
195
196
|
let user = args['--user'] || '';
|
|
196
197
|
const silent = args['--silent'] === true;
|
|
197
198
|
|
|
199
|
+
// In silent mode, suppress ALL fmt output and show a single spinner.
|
|
200
|
+
// setSilent(true) makes every fmt.* call a no-op — internal functions
|
|
201
|
+
// (hooks.mjs, mcp.mjs, integrate.mjs, ecc.mjs) are silenced automatically.
|
|
202
|
+
let silentSpinner = null;
|
|
203
|
+
if (silent) {
|
|
204
|
+
setSilent(true);
|
|
205
|
+
silentSpinner = p.spinner();
|
|
206
|
+
silentSpinner.start('Initializing...');
|
|
207
|
+
}
|
|
208
|
+
|
|
198
209
|
fmt.intro(`aw init ${chalk.dim('v' + VERSION)}`);
|
|
199
210
|
|
|
200
211
|
// ── Validate ──────────────────────────────────────────────────────────
|
|
@@ -386,6 +397,7 @@ export async function initCommand(args) {
|
|
|
386
397
|
try { writeHookManifest({ eccVersion: AW_ECC_TAG, awVersion: VERSION }); } catch { /* best effort */ }
|
|
387
398
|
|
|
388
399
|
if (silent) {
|
|
400
|
+
if (silentSpinner) { silentSpinner.stop('Done'); setSilent(false); }
|
|
389
401
|
autoUpdate(await args._updateCheck);
|
|
390
402
|
} else {
|
|
391
403
|
fmt.outro([
|
|
@@ -455,7 +467,7 @@ export async function initCommand(args) {
|
|
|
455
467
|
if (!awRegistryLstat) {
|
|
456
468
|
try {
|
|
457
469
|
symlinkSync(join(AW_HOME, REGISTRY_DIR), GLOBAL_AW_DIR);
|
|
458
|
-
fmt.logStep('
|
|
470
|
+
fmt.logStep('Registry linked');
|
|
459
471
|
} catch (e) {
|
|
460
472
|
fmt.logWarn(`Could not create symlink ~/.aw_registry/: ${e.message}`);
|
|
461
473
|
}
|
|
@@ -464,7 +476,7 @@ export async function initCommand(args) {
|
|
|
464
476
|
try {
|
|
465
477
|
rmSync(GLOBAL_AW_DIR);
|
|
466
478
|
symlinkSync(join(AW_HOME, REGISTRY_DIR), GLOBAL_AW_DIR);
|
|
467
|
-
fmt.logStep('
|
|
479
|
+
fmt.logStep('Registry linked');
|
|
468
480
|
} catch (e) {
|
|
469
481
|
fmt.logWarn(`Could not update symlink ~/.aw_registry/: ${e.message}`);
|
|
470
482
|
}
|
|
@@ -544,7 +556,10 @@ export async function initCommand(args) {
|
|
|
544
556
|
ensureTelemetryConfig();
|
|
545
557
|
|
|
546
558
|
// Offer to update if a newer version is available
|
|
547
|
-
await promptUpdate(await args._updateCheck);
|
|
559
|
+
if (!silent) await promptUpdate(await args._updateCheck);
|
|
560
|
+
|
|
561
|
+
// Stop silent spinner before outro (outro is already suppressed by setSilent)
|
|
562
|
+
if (silentSpinner) { silentSpinner.stop('Done'); setSilent(false); }
|
|
548
563
|
|
|
549
564
|
fmt.outro([
|
|
550
565
|
'⟁ Install complete',
|
package/fmt.mjs
CHANGED
|
@@ -6,6 +6,13 @@ import figlet from 'figlet';
|
|
|
6
6
|
|
|
7
7
|
export { chalk };
|
|
8
8
|
|
|
9
|
+
// ─── Silent mode ───
|
|
10
|
+
// When enabled, all log/intro/outro/note/spinner output is suppressed.
|
|
11
|
+
// Used by `aw init --silent` to show only a single "Initializing..." spinner.
|
|
12
|
+
let _silent = false;
|
|
13
|
+
export function setSilent(v) { _silent = !!v; }
|
|
14
|
+
export function isSilent() { return _silent; }
|
|
15
|
+
|
|
9
16
|
// ─── Banner ───
|
|
10
17
|
|
|
11
18
|
// Big ASCII art icons — same height as ANSI Shadow font (6 lines)
|
|
@@ -22,6 +29,7 @@ const ICON_ART = {
|
|
|
22
29
|
};
|
|
23
30
|
|
|
24
31
|
export function banner(text, opts = {}) {
|
|
32
|
+
if (_silent) return;
|
|
25
33
|
const {
|
|
26
34
|
font = 'ANSI Shadow',
|
|
27
35
|
color = chalk.hex('#FF6B35'),
|
|
@@ -65,12 +73,14 @@ export function banner(text, opts = {}) {
|
|
|
65
73
|
|
|
66
74
|
// ─── Clack wrappers ───
|
|
67
75
|
|
|
68
|
-
export const intro = (msg) => p.intro(chalk.bgHex('#FF6B35').black(` ⟁ ${msg} `));
|
|
69
|
-
export const outro = (msg) => p.outro(chalk.green(msg));
|
|
76
|
+
export const intro = (msg) => { if (!_silent) p.intro(chalk.bgHex('#FF6B35').black(` ⟁ ${msg} `)); };
|
|
77
|
+
export const outro = (msg) => { if (!_silent) p.outro(chalk.green(msg)); };
|
|
70
78
|
export const select = p.select;
|
|
71
79
|
export const isCancel = p.isCancel;
|
|
72
80
|
|
|
73
|
-
|
|
81
|
+
// Returns a real spinner when not silent, or a no-op stub when silent.
|
|
82
|
+
const _noopSpinner = { start() {}, stop() {}, message() {} };
|
|
83
|
+
export const spinner = () => _silent ? _noopSpinner : p.spinner();
|
|
74
84
|
|
|
75
85
|
export class CancelError extends Error {
|
|
76
86
|
constructor(message, { exitCode = 1 } = {}) {
|
|
@@ -93,13 +103,13 @@ export function cancelAndExit(msg) {
|
|
|
93
103
|
|
|
94
104
|
// ─── Log helpers (clack-styled) ───
|
|
95
105
|
|
|
96
|
-
export const note = (msg, title) => p.note(msg, title);
|
|
97
|
-
export const logInfo = (msg) => p.log.info(msg);
|
|
98
|
-
export const logSuccess = (msg) => p.log.success(msg);
|
|
99
|
-
export const logWarn = (msg) => p.log.warn(msg);
|
|
100
|
-
export const logError = (msg) => p.log.error(msg);
|
|
101
|
-
export const logStep = (msg) => p.log.step(msg);
|
|
102
|
-
export const logMessage = (msg) => p.log.message(msg);
|
|
106
|
+
export const note = (msg, title) => { if (!_silent) p.note(msg, title); };
|
|
107
|
+
export const logInfo = (msg) => { if (!_silent) p.log.info(msg); };
|
|
108
|
+
export const logSuccess = (msg) => { if (!_silent) p.log.success(msg); };
|
|
109
|
+
export const logWarn = (msg) => { if (!_silent) p.log.warn(msg); };
|
|
110
|
+
export const logError = (msg) => { if (!_silent) p.log.error(msg); };
|
|
111
|
+
export const logStep = (msg) => { if (!_silent) p.log.step(msg); };
|
|
112
|
+
export const logMessage = (msg) => { if (!_silent) p.log.message(msg); };
|
|
103
113
|
|
|
104
114
|
// ─── Styled text helpers ───
|
|
105
115
|
|
|
@@ -114,13 +124,13 @@ export const magenta = (s) => chalk.magenta(s);
|
|
|
114
124
|
|
|
115
125
|
// ─── Backward compat aliases (used by existing commands) ───
|
|
116
126
|
|
|
117
|
-
export function log(msg = '') { process.stderr.write(msg + '\n'); }
|
|
118
|
-
export function info(msg) { p.log.info(msg); }
|
|
119
|
-
export function success(msg) { p.log.success(msg); }
|
|
120
|
-
export function warn(msg) { p.log.warn(msg); }
|
|
121
|
-
export function error(msg) { p.log.error(msg); }
|
|
122
|
-
export function heading(msg) { p.log.step(chalk.bold(msg)); }
|
|
123
|
-
export function item(label, value) { p.log.message(`${chalk.dim(label)} ${value}`); }
|
|
127
|
+
export function log(msg = '') { if (!_silent) process.stderr.write(msg + '\n'); }
|
|
128
|
+
export function info(msg) { if (!_silent) p.log.info(msg); }
|
|
129
|
+
export function success(msg) { if (!_silent) p.log.success(msg); }
|
|
130
|
+
export function warn(msg) { if (!_silent) p.log.warn(msg); }
|
|
131
|
+
export function error(msg) { if (!_silent) p.log.error(msg); }
|
|
132
|
+
export function heading(msg) { if (!_silent) p.log.step(chalk.bold(msg)); }
|
|
133
|
+
export function item(label, value) { if (!_silent) p.log.message(`${chalk.dim(label)} ${value}`); }
|
|
124
134
|
|
|
125
135
|
// ─── Action labels ───
|
|
126
136
|
|