@ghl-ai/aw 0.1.11 → 0.1.12
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/pull.mjs +25 -26
- package/package.json +1 -1
package/commands/pull.mjs
CHANGED
|
@@ -28,28 +28,27 @@ export function pullCommand(args) {
|
|
|
28
28
|
const silent = args['--silent'] === true || args._silent === true;
|
|
29
29
|
const renameNamespace = args._renameNamespace || null;
|
|
30
30
|
|
|
31
|
-
// Silent mode: suppress all output and exit cleanly on errors
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
31
|
+
// Silent mode: wrap fmt to suppress all output and exit cleanly on errors
|
|
32
|
+
const log = {
|
|
33
|
+
cancel: silent ? () => { process.exit(0); } : fmt.cancel,
|
|
34
|
+
logInfo: silent ? () => {} : fmt.logInfo,
|
|
35
|
+
logSuccess: silent ? () => {} : fmt.logSuccess,
|
|
36
|
+
logStep: silent ? () => {} : fmt.logStep,
|
|
37
|
+
logWarn: silent ? () => {} : fmt.logWarn,
|
|
38
|
+
logMessage: silent ? () => {} : fmt.logMessage,
|
|
39
|
+
note: silent ? () => {} : fmt.note,
|
|
40
|
+
outro: silent ? () => {} : fmt.outro,
|
|
41
|
+
spinner: silent ? () => ({ start: () => {}, stop: () => {} }) : fmt.spinner,
|
|
42
|
+
};
|
|
44
43
|
|
|
45
44
|
// No args = re-pull everything in sync config
|
|
46
45
|
if (!input) {
|
|
47
46
|
const cfg = config.load(workspaceDir);
|
|
48
|
-
if (!cfg)
|
|
47
|
+
if (!cfg) log.cancel('No .sync-config.json found. Run: aw init');
|
|
49
48
|
if (cfg.include.length === 0) {
|
|
50
|
-
|
|
49
|
+
log.cancel('Nothing to pull. Add paths first:\n\n aw pull <path>');
|
|
51
50
|
}
|
|
52
|
-
|
|
51
|
+
log.logInfo(`Pulling ${chalk.cyan(cfg.include.length)} synced path${cfg.include.length > 1 ? 's' : ''}...`);
|
|
53
52
|
for (const p of cfg.include) {
|
|
54
53
|
pullCommand({ ...args, _positional: [p], _skipIntegrate: true });
|
|
55
54
|
}
|
|
@@ -65,7 +64,7 @@ export function pullCommand(args) {
|
|
|
65
64
|
let pattern = resolved.registryPath;
|
|
66
65
|
|
|
67
66
|
if (!pattern) {
|
|
68
|
-
|
|
67
|
+
log.cancel(`Could not resolve "${input}" to a registry path`);
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
// Ensure workspace exists
|
|
@@ -76,11 +75,11 @@ export function pullCommand(args) {
|
|
|
76
75
|
// Load config
|
|
77
76
|
const cfg = config.load(workspaceDir);
|
|
78
77
|
if (!cfg) {
|
|
79
|
-
|
|
78
|
+
log.cancel('No .sync-config.json found. Run: aw init');
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
// Fetch from registry
|
|
83
|
-
const s =
|
|
82
|
+
const s = log.spinner();
|
|
84
83
|
s.start('Fetching from registry...');
|
|
85
84
|
|
|
86
85
|
const sparsePaths = includeToSparsePaths([pattern]);
|
|
@@ -89,7 +88,7 @@ export function pullCommand(args) {
|
|
|
89
88
|
tempDir = sparseCheckout(cfg.repo, sparsePaths);
|
|
90
89
|
} catch (e) {
|
|
91
90
|
s.stop(chalk.red('Fetch failed'));
|
|
92
|
-
|
|
91
|
+
log.cancel(e.message);
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
try {
|
|
@@ -104,8 +103,8 @@ export function pullCommand(args) {
|
|
|
104
103
|
|
|
105
104
|
if (registryDirs.length === 0) {
|
|
106
105
|
s.stop(chalk.red('Not found'));
|
|
107
|
-
if (
|
|
108
|
-
|
|
106
|
+
if (silent) return;
|
|
107
|
+
log.cancel(`Nothing found in registry for ${chalk.cyan(pattern)}`);
|
|
109
108
|
}
|
|
110
109
|
|
|
111
110
|
// Rename namespace if requested (e.g., [template] → dev)
|
|
@@ -132,8 +131,8 @@ export function pullCommand(args) {
|
|
|
132
131
|
if (!hasMatch) {
|
|
133
132
|
s.stop(chalk.red('Not found'));
|
|
134
133
|
cleanup(tempDir);
|
|
135
|
-
if (
|
|
136
|
-
|
|
134
|
+
if (silent) return;
|
|
135
|
+
log.cancel(`Nothing found in registry for ${chalk.cyan(pattern)}\n\n Check the pattern exists in the registry repo.`);
|
|
137
136
|
}
|
|
138
137
|
|
|
139
138
|
const fetched = registryDirs.map(d => chalk.cyan(d.name)).join(', ');
|
|
@@ -142,7 +141,7 @@ export function pullCommand(args) {
|
|
|
142
141
|
// Add to config if not already there
|
|
143
142
|
if (!cfg.include.includes(pattern)) {
|
|
144
143
|
config.addPattern(workspaceDir, pattern);
|
|
145
|
-
|
|
144
|
+
log.logSuccess(`Added ${chalk.cyan(pattern)} to config`);
|
|
146
145
|
}
|
|
147
146
|
|
|
148
147
|
// Compute plan
|
|
@@ -156,7 +155,7 @@ export function pullCommand(args) {
|
|
|
156
155
|
}
|
|
157
156
|
|
|
158
157
|
// Apply
|
|
159
|
-
const s2 =
|
|
158
|
+
const s2 = log.spinner();
|
|
160
159
|
s2.start('Applying changes...');
|
|
161
160
|
const conflictCount = applyActions(actions);
|
|
162
161
|
updateManifest(workspaceDir, actions, cfg.namespace);
|