cli4ai 0.9.1 → 0.9.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli4ai",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "The package manager for AI CLI tools - cli4ai.com",
5
5
  "type": "module",
6
6
  "bin": {
@@ -63,9 +63,27 @@ async function getLatestVersions(packageNames: string[]): Promise<Map<string, st
63
63
  }
64
64
 
65
65
  /**
66
- * Update a single package (async)
66
+ * Update a single package using cli4ai add -g (reinstalls to ~/.cli4ai/packages/)
67
67
  */
68
- async function updatePackageAsync(packageName: string): Promise<boolean> {
68
+ async function updateCli4aiPackage(packageName: string): Promise<boolean> {
69
+ return new Promise((resolve) => {
70
+ // Use cli4ai add -g to reinstall the package (same location as original install)
71
+ const proc = spawn('cli4ai', ['add', '-g', packageName, '-y'], {
72
+ stdio: 'pipe'
73
+ });
74
+ proc.on('close', (code) => {
75
+ resolve(code === 0);
76
+ });
77
+ proc.on('error', () => {
78
+ resolve(false);
79
+ });
80
+ });
81
+ }
82
+
83
+ /**
84
+ * Update cli4ai itself via npm
85
+ */
86
+ async function updateNpmPackage(packageName: string): Promise<boolean> {
69
87
  return new Promise((resolve) => {
70
88
  const proc = spawn('npm', ['install', '-g', `${packageName}@latest`], {
71
89
  stdio: 'pipe'
@@ -139,7 +157,7 @@ export async function updateCommand(options: UpdateOptions): Promise<void> {
139
157
 
140
158
  if (hasUpdate) {
141
159
  log(` ${CYAN}↑${RESET} cli4ai ${DIM}${current}${RESET} → ${GREEN}${latest}${RESET}`);
142
- const success = await updatePackageAsync('cli4ai');
160
+ const success = await updateNpmPackage('cli4ai');
143
161
 
144
162
  if (success) {
145
163
  log(` ${GREEN}✓${RESET} cli4ai updated\n`);
@@ -199,7 +217,8 @@ export async function updateCommand(options: UpdateOptions): Promise<void> {
199
217
 
200
218
  const updateResults: Array<(typeof toUpdate)[number] & { success: boolean }> = [];
201
219
  for (const pkg of toUpdate) {
202
- const success = await updatePackageAsync(pkg.npmName);
220
+ // Use cli4ai add -g to update packages in ~/.cli4ai/packages/
221
+ const success = await updateCli4aiPackage(pkg.name);
203
222
  updateResults.push({ ...pkg, success });
204
223
  }
205
224
 
package/src/lib/cli.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  import { Command } from 'commander';
7
7
 
8
8
  export const BRAND = 'cli4ai - cli4ai.com';
9
- export const VERSION = '0.9.1';
9
+ export const VERSION = '0.9.2';
10
10
 
11
11
  // ═══════════════════════════════════════════════════════════════════════════
12
12
  // TYPES