@orchagent/cli 0.3.21 → 0.3.22
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/dist/commands/list.js +6 -1
- package/dist/commands/update.js +27 -7
- package/dist/lib/installed.js +3 -3
- package/package.json +1 -1
package/dist/commands/list.js
CHANGED
|
@@ -29,7 +29,8 @@ function registerListCommand(program) {
|
|
|
29
29
|
}
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
// Verify file existence without removing orphaned entries
|
|
33
|
+
const { valid: installed, orphaned } = await (0, installed_1.verifyInstalled)(false);
|
|
33
34
|
if (options.json) {
|
|
34
35
|
(0, output_1.printJson)(installed);
|
|
35
36
|
return;
|
|
@@ -65,5 +66,9 @@ function registerListCommand(program) {
|
|
|
65
66
|
process.stdout.write(`\n(${installed.length - seen.size} format duplicates hidden, use --verbose to show)\n`);
|
|
66
67
|
}
|
|
67
68
|
}
|
|
69
|
+
// Warn about orphaned entries if any exist
|
|
70
|
+
if (orphaned.length > 0) {
|
|
71
|
+
process.stdout.write(`\nWarning: ${orphaned.length} tracked installation(s) have missing files. Run 'orch list --verify' to clean up.\n`);
|
|
72
|
+
}
|
|
68
73
|
});
|
|
69
74
|
}
|
package/dist/commands/update.js
CHANGED
|
@@ -57,9 +57,10 @@ function registerUpdateCommand(program) {
|
|
|
57
57
|
let updatesAvailable = 0;
|
|
58
58
|
let updatesApplied = 0;
|
|
59
59
|
let skippedModified = 0;
|
|
60
|
+
let skippedMissing = 0;
|
|
60
61
|
for (const item of toCheck) {
|
|
61
|
-
// Check if file was modified locally
|
|
62
|
-
const
|
|
62
|
+
// Check if file was modified locally or is missing
|
|
63
|
+
const fileStatus = await (0, installed_1.checkModified)(item);
|
|
63
64
|
// Fetch latest version
|
|
64
65
|
const latest = await fetchLatestAgent(resolved, item.agent);
|
|
65
66
|
if (!latest) {
|
|
@@ -67,21 +68,33 @@ function registerUpdateCommand(program) {
|
|
|
67
68
|
continue;
|
|
68
69
|
}
|
|
69
70
|
const hasUpdate = latest.latestVersion !== item.version;
|
|
70
|
-
if (!hasUpdate && !
|
|
71
|
+
if (!hasUpdate && !fileStatus.modified && !fileStatus.missing) {
|
|
71
72
|
process.stdout.write(` ${chalk_1.default.green('✓')} ${item.agent}@${item.version} - up to date\n`);
|
|
72
73
|
continue;
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
+
// Handle missing file without --force
|
|
76
|
+
if (fileStatus.missing && !options.force) {
|
|
77
|
+
process.stdout.write(` ${chalk_1.default.yellow('!')} ${item.agent} - file missing (use --force to reinstall)\n`);
|
|
78
|
+
skippedMissing++;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
// Handle modified file without --force
|
|
82
|
+
if (fileStatus.modified && !options.force) {
|
|
75
83
|
process.stdout.write(` ${chalk_1.default.yellow('!')} ${item.agent} - local modifications (use --force to overwrite)\n`);
|
|
76
84
|
skippedModified++;
|
|
77
85
|
continue;
|
|
78
86
|
}
|
|
79
|
-
if (hasUpdate) {
|
|
80
|
-
|
|
87
|
+
if (hasUpdate || fileStatus.missing) {
|
|
88
|
+
if (hasUpdate) {
|
|
89
|
+
updatesAvailable++;
|
|
90
|
+
}
|
|
81
91
|
process.stdout.write(` ${chalk_1.default.blue('↑')} ${item.agent}@${item.version} → ${latest.latestVersion}`);
|
|
82
|
-
if (
|
|
92
|
+
if (fileStatus.modified) {
|
|
83
93
|
process.stdout.write(` ${chalk_1.default.yellow('(modified)')}`);
|
|
84
94
|
}
|
|
95
|
+
if (fileStatus.missing) {
|
|
96
|
+
process.stdout.write(` ${chalk_1.default.yellow('(reinstalling)')}`);
|
|
97
|
+
}
|
|
85
98
|
process.stdout.write('\n');
|
|
86
99
|
if (options.check) {
|
|
87
100
|
continue;
|
|
@@ -144,6 +157,9 @@ function registerUpdateCommand(program) {
|
|
|
144
157
|
if (skippedModified > 0) {
|
|
145
158
|
process.stdout.write(`${skippedModified} agent(s) have local modifications.\n`);
|
|
146
159
|
}
|
|
160
|
+
if (skippedMissing > 0) {
|
|
161
|
+
process.stdout.write(`${skippedMissing} agent(s) have missing files.\n`);
|
|
162
|
+
}
|
|
147
163
|
process.stdout.write('Run "orch update" without --check to apply updates.\n');
|
|
148
164
|
}
|
|
149
165
|
else {
|
|
@@ -151,12 +167,16 @@ function registerUpdateCommand(program) {
|
|
|
151
167
|
if (skippedModified > 0) {
|
|
152
168
|
process.stdout.write(`Skipped ${skippedModified} modified agent(s). Use --force to overwrite.\n`);
|
|
153
169
|
}
|
|
170
|
+
if (skippedMissing > 0) {
|
|
171
|
+
process.stdout.write(`Skipped ${skippedMissing} missing agent(s). Use --force to reinstall.\n`);
|
|
172
|
+
}
|
|
154
173
|
}
|
|
155
174
|
await (0, analytics_1.track)('cli_agent_update', {
|
|
156
175
|
checked: toCheck.length,
|
|
157
176
|
updatesAvailable,
|
|
158
177
|
updatesApplied,
|
|
159
178
|
skippedModified,
|
|
179
|
+
skippedMissing,
|
|
160
180
|
});
|
|
161
181
|
});
|
|
162
182
|
}
|
package/dist/lib/installed.js
CHANGED
|
@@ -72,17 +72,17 @@ async function getInstalledByFormat(format) {
|
|
|
72
72
|
return data.installed.filter(i => i.format === format);
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
-
* Check if a file has been modified since installation
|
|
75
|
+
* Check if a file has been modified since installation or is missing
|
|
76
76
|
*/
|
|
77
77
|
async function checkModified(installed) {
|
|
78
78
|
try {
|
|
79
79
|
const content = await promises_1.default.readFile(installed.path, 'utf-8');
|
|
80
80
|
const currentHash = computeHash(content);
|
|
81
|
-
return currentHash !== installed.contentHash;
|
|
81
|
+
return { modified: currentHash !== installed.contentHash, missing: false };
|
|
82
82
|
}
|
|
83
83
|
catch {
|
|
84
84
|
// File doesn't exist or can't be read
|
|
85
|
-
return true;
|
|
85
|
+
return { modified: false, missing: true };
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
/**
|