@the-aico/cli 1.0.3 → 1.1.0
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/index.js +44 -305
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command9 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/utils/errors.ts
|
|
7
7
|
import kleur from "kleur";
|
|
@@ -181,7 +181,6 @@ var platformPathsSchema = z.object({
|
|
|
181
181
|
commands: z.string()
|
|
182
182
|
});
|
|
183
183
|
var employeeStateSchema = z.object({
|
|
184
|
-
platforms: z.array(platformSchema),
|
|
185
184
|
installedAt: z.string(),
|
|
186
185
|
version: z.string().optional(),
|
|
187
186
|
// Track installed skills and commands for update detection
|
|
@@ -191,14 +190,12 @@ var employeeStateSchema = z.object({
|
|
|
191
190
|
var skillStateSchema = z.object({
|
|
192
191
|
version: z.string(),
|
|
193
192
|
installedAt: z.string(),
|
|
194
|
-
source: z.enum(["standalone", "employee"])
|
|
193
|
+
source: z.enum(["standalone", "employee"])
|
|
195
194
|
// standalone = single install, employee = part of employee
|
|
196
|
-
platforms: z.array(platformSchema)
|
|
197
195
|
});
|
|
198
196
|
var sharedSkillStateSchema = z.object({
|
|
199
197
|
version: z.string(),
|
|
200
198
|
installedAt: z.string(),
|
|
201
|
-
platforms: z.array(platformSchema),
|
|
202
199
|
// Track which employees depend on this shared skill
|
|
203
200
|
// When this array becomes empty, the shared skill can be removed
|
|
204
201
|
usedBy: z.array(z.string())
|
|
@@ -290,13 +287,12 @@ async function writeConfig(cwd, config) {
|
|
|
290
287
|
const configPath = getConfigPath(cwd);
|
|
291
288
|
await fs.writeJson(configPath, config, { spaces: 2 });
|
|
292
289
|
}
|
|
293
|
-
async function updateEmployees(cwd, employeeName,
|
|
290
|
+
async function updateEmployees(cwd, employeeName, skills, commands) {
|
|
294
291
|
const config = await getConfig(cwd);
|
|
295
292
|
if (!config) {
|
|
296
293
|
throw new Error("Config not found");
|
|
297
294
|
}
|
|
298
295
|
config.employees[employeeName] = {
|
|
299
|
-
platforms,
|
|
300
296
|
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
301
297
|
skills,
|
|
302
298
|
commands
|
|
@@ -323,7 +319,7 @@ function resolvePlatformPaths(cwd, config, platform) {
|
|
|
323
319
|
commandsDir: path.isAbsolute(commandsPath) ? commandsPath : path.resolve(cwd, commandsPath)
|
|
324
320
|
};
|
|
325
321
|
}
|
|
326
|
-
async function updateSkill(cwd, skillFullName, version,
|
|
322
|
+
async function updateSkill(cwd, skillFullName, version, source = "standalone") {
|
|
327
323
|
const config = await getConfig(cwd);
|
|
328
324
|
if (!config) {
|
|
329
325
|
throw new Error("Config not found");
|
|
@@ -334,8 +330,7 @@ async function updateSkill(cwd, skillFullName, version, platforms, source = "sta
|
|
|
334
330
|
config.skills[skillFullName] = {
|
|
335
331
|
version,
|
|
336
332
|
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
337
|
-
source
|
|
338
|
-
platforms
|
|
333
|
+
source
|
|
339
334
|
};
|
|
340
335
|
await writeConfig(cwd, config);
|
|
341
336
|
}
|
|
@@ -349,27 +344,7 @@ async function removeSkill(cwd, skillFullName) {
|
|
|
349
344
|
}
|
|
350
345
|
await writeConfig(cwd, config);
|
|
351
346
|
}
|
|
352
|
-
async function
|
|
353
|
-
const config = await getConfig(cwd);
|
|
354
|
-
if (!config) {
|
|
355
|
-
return [];
|
|
356
|
-
}
|
|
357
|
-
const skills = /* @__PURE__ */ new Set();
|
|
358
|
-
if (config.skills) {
|
|
359
|
-
for (const skillName of Object.keys(config.skills)) {
|
|
360
|
-
skills.add(skillName);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
for (const empState of Object.values(config.employees)) {
|
|
364
|
-
if (empState.skills) {
|
|
365
|
-
for (const skillName of empState.skills) {
|
|
366
|
-
skills.add(skillName);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
return Array.from(skills);
|
|
371
|
-
}
|
|
372
|
-
async function addSharedSkillReference(cwd, sharedSkillFullName, employeeName, version, platforms) {
|
|
347
|
+
async function addSharedSkillReference(cwd, sharedSkillFullName, employeeName, version) {
|
|
373
348
|
const config = await getConfig(cwd);
|
|
374
349
|
if (!config) {
|
|
375
350
|
throw new Error("Config not found");
|
|
@@ -382,15 +357,12 @@ async function addSharedSkillReference(cwd, sharedSkillFullName, employeeName, v
|
|
|
382
357
|
if (!existing.usedBy.includes(employeeName)) {
|
|
383
358
|
existing.usedBy.push(employeeName);
|
|
384
359
|
}
|
|
385
|
-
const allPlatforms = /* @__PURE__ */ new Set([...existing.platforms, ...platforms]);
|
|
386
|
-
existing.platforms = Array.from(allPlatforms);
|
|
387
360
|
await writeConfig(cwd, config);
|
|
388
361
|
return { isNew: false };
|
|
389
362
|
}
|
|
390
363
|
config.sharedSkills[sharedSkillFullName] = {
|
|
391
364
|
version,
|
|
392
365
|
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
393
|
-
platforms,
|
|
394
366
|
usedBy: [employeeName]
|
|
395
367
|
};
|
|
396
368
|
await writeConfig(cwd, config);
|
|
@@ -1576,21 +1548,14 @@ async function addEmployee(target, config, cwd, platforms, overwrite, yes) {
|
|
|
1576
1548
|
cwd,
|
|
1577
1549
|
depFullName,
|
|
1578
1550
|
employee.name,
|
|
1579
|
-
"1.0.0"
|
|
1551
|
+
"1.0.0"
|
|
1580
1552
|
// TODO: get version from skill
|
|
1581
|
-
platforms
|
|
1582
1553
|
);
|
|
1583
1554
|
}
|
|
1584
1555
|
}
|
|
1585
1556
|
const skillNames = employee.skills.map((sk) => sk.name);
|
|
1586
1557
|
const commandNames = employee.commands.map((c) => c.name);
|
|
1587
|
-
await updateEmployees(
|
|
1588
|
-
cwd,
|
|
1589
|
-
employee.name,
|
|
1590
|
-
platforms,
|
|
1591
|
-
skillNames,
|
|
1592
|
-
commandNames
|
|
1593
|
-
);
|
|
1558
|
+
await updateEmployees(cwd, employee.name, skillNames, commandNames);
|
|
1594
1559
|
s.succeed(`Added ${employee.name} (${employee.role})`);
|
|
1595
1560
|
logger.dim(` Skills: ${employee.skills.map((sk) => sk.name).join(", ")}`);
|
|
1596
1561
|
if (employee.commands.length > 0) {
|
|
@@ -1691,7 +1656,7 @@ async function addSingleSkill(fullName, config, cwd, platforms, overwrite, prefe
|
|
|
1691
1656
|
return;
|
|
1692
1657
|
}
|
|
1693
1658
|
}
|
|
1694
|
-
await updateSkill(cwd, fullName, skill.version,
|
|
1659
|
+
await updateSkill(cwd, fullName, skill.version, "standalone");
|
|
1695
1660
|
s.succeed(`Added skill ${skill.fullName}`);
|
|
1696
1661
|
logger.dim(` Version: ${skill.version}`);
|
|
1697
1662
|
logger.dim(` Category: ${skill.category}`);
|
|
@@ -1828,26 +1793,12 @@ async function removeEmployeeItem(target, config, cwd, platformsOpt, yes, dryRun
|
|
|
1828
1793
|
const employeeName = target.name;
|
|
1829
1794
|
const installedState = config.employees[employeeName];
|
|
1830
1795
|
let platforms;
|
|
1831
|
-
if (
|
|
1832
|
-
|
|
1833
|
-
platforms = platformsOpt.filter(
|
|
1834
|
-
(p) => installedState.platforms.includes(p)
|
|
1835
|
-
);
|
|
1836
|
-
if (platforms.length === 0) {
|
|
1837
|
-
logger.warn(
|
|
1838
|
-
`Employee '${employeeName}' is not installed on specified platform(s). Skipping.`
|
|
1839
|
-
);
|
|
1840
|
-
return;
|
|
1841
|
-
}
|
|
1842
|
-
} else {
|
|
1843
|
-
platforms = installedState.platforms;
|
|
1844
|
-
}
|
|
1796
|
+
if (platformsOpt && platformsOpt.length > 0) {
|
|
1797
|
+
platforms = platformsOpt;
|
|
1845
1798
|
} else {
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
platforms = Object.keys(config.platforms);
|
|
1850
|
-
}
|
|
1799
|
+
platforms = Object.keys(config.platforms);
|
|
1800
|
+
}
|
|
1801
|
+
if (!installedState) {
|
|
1851
1802
|
logger.dim(
|
|
1852
1803
|
`Employee '${employeeName}' not in config, will attempt to remove files from: ${platforms.join(", ")}`
|
|
1853
1804
|
);
|
|
@@ -1941,26 +1892,10 @@ async function removeSkillItem(target, config, cwd, platformsOpt, yes, force, dr
|
|
|
1941
1892
|
return;
|
|
1942
1893
|
}
|
|
1943
1894
|
let platforms;
|
|
1944
|
-
if (
|
|
1945
|
-
|
|
1946
|
-
platforms = platformsOpt.filter(
|
|
1947
|
-
(p) => installedState.platforms.includes(p)
|
|
1948
|
-
);
|
|
1949
|
-
if (platforms.length === 0) {
|
|
1950
|
-
logger.warn(
|
|
1951
|
-
`Skill '${skillFullName}' is not installed on specified platform(s). Skipping.`
|
|
1952
|
-
);
|
|
1953
|
-
return;
|
|
1954
|
-
}
|
|
1955
|
-
} else {
|
|
1956
|
-
platforms = installedState.platforms;
|
|
1957
|
-
}
|
|
1895
|
+
if (platformsOpt && platformsOpt.length > 0) {
|
|
1896
|
+
platforms = platformsOpt;
|
|
1958
1897
|
} else {
|
|
1959
|
-
|
|
1960
|
-
platforms = platformsOpt;
|
|
1961
|
-
} else {
|
|
1962
|
-
platforms = [config.defaultPlatform];
|
|
1963
|
-
}
|
|
1898
|
+
platforms = Object.keys(config.platforms);
|
|
1964
1899
|
}
|
|
1965
1900
|
if (!yes && !dryRun) {
|
|
1966
1901
|
const { proceed } = await prompts4({
|
|
@@ -2070,11 +2005,8 @@ async function runList(options) {
|
|
|
2070
2005
|
logger.bold("Installed employees:");
|
|
2071
2006
|
logger.break();
|
|
2072
2007
|
for (const [name, state] of employees) {
|
|
2073
|
-
const platforms = state.platforms.join(", ");
|
|
2074
2008
|
const date = new Date(state.installedAt).toLocaleDateString();
|
|
2075
|
-
logger.log(
|
|
2076
|
-
` ${logger.highlight(name.padEnd(15))} ${platforms.padEnd(20)} ${date}`
|
|
2077
|
-
);
|
|
2009
|
+
logger.log(` ${logger.highlight(name.padEnd(15))} ${date}`);
|
|
2078
2010
|
}
|
|
2079
2011
|
} else {
|
|
2080
2012
|
logger.info("Fetching employee list...");
|
|
@@ -2107,10 +2039,8 @@ async function runList(options) {
|
|
|
2107
2039
|
logger.info("No employees installed.");
|
|
2108
2040
|
return;
|
|
2109
2041
|
}
|
|
2110
|
-
for (const [name
|
|
2111
|
-
logger.log(
|
|
2112
|
-
` ${logger.highlight(name.padEnd(15))} ${state.platforms.join(", ")}`
|
|
2113
|
-
);
|
|
2042
|
+
for (const [name] of employees) {
|
|
2043
|
+
logger.log(` ${logger.highlight(name)}`);
|
|
2114
2044
|
}
|
|
2115
2045
|
}
|
|
2116
2046
|
}
|
|
@@ -2182,16 +2112,8 @@ var CONFIG_SCHEMA = {
|
|
|
2182
2112
|
description: "Installed employees state",
|
|
2183
2113
|
additionalProperties: {
|
|
2184
2114
|
type: "object",
|
|
2185
|
-
required: ["
|
|
2115
|
+
required: ["installedAt"],
|
|
2186
2116
|
properties: {
|
|
2187
|
-
platforms: {
|
|
2188
|
-
type: "array",
|
|
2189
|
-
items: {
|
|
2190
|
-
type: "string",
|
|
2191
|
-
enum: ["claude-code", "codex"]
|
|
2192
|
-
},
|
|
2193
|
-
description: "Platforms this employee is installed on"
|
|
2194
|
-
},
|
|
2195
2117
|
installedAt: {
|
|
2196
2118
|
type: "string",
|
|
2197
2119
|
format: "date-time",
|
|
@@ -2219,7 +2141,7 @@ var CONFIG_SCHEMA = {
|
|
|
2219
2141
|
description: "Standalone installed skills",
|
|
2220
2142
|
additionalProperties: {
|
|
2221
2143
|
type: "object",
|
|
2222
|
-
required: ["version", "installedAt", "source"
|
|
2144
|
+
required: ["version", "installedAt", "source"],
|
|
2223
2145
|
properties: {
|
|
2224
2146
|
version: {
|
|
2225
2147
|
type: "string",
|
|
@@ -2234,13 +2156,6 @@ var CONFIG_SCHEMA = {
|
|
|
2234
2156
|
type: "string",
|
|
2235
2157
|
enum: ["standalone", "employee"],
|
|
2236
2158
|
description: "Installation source"
|
|
2237
|
-
},
|
|
2238
|
-
platforms: {
|
|
2239
|
-
type: "array",
|
|
2240
|
-
items: {
|
|
2241
|
-
type: "string",
|
|
2242
|
-
enum: ["claude-code", "codex"]
|
|
2243
|
-
}
|
|
2244
2159
|
}
|
|
2245
2160
|
}
|
|
2246
2161
|
}
|
|
@@ -2250,7 +2165,7 @@ var CONFIG_SCHEMA = {
|
|
|
2250
2165
|
description: "Shared skills with reference tracking",
|
|
2251
2166
|
additionalProperties: {
|
|
2252
2167
|
type: "object",
|
|
2253
|
-
required: ["version", "installedAt", "
|
|
2168
|
+
required: ["version", "installedAt", "usedBy"],
|
|
2254
2169
|
properties: {
|
|
2255
2170
|
version: {
|
|
2256
2171
|
type: "string",
|
|
@@ -2261,13 +2176,6 @@ var CONFIG_SCHEMA = {
|
|
|
2261
2176
|
format: "date-time",
|
|
2262
2177
|
description: "Installation timestamp"
|
|
2263
2178
|
},
|
|
2264
|
-
platforms: {
|
|
2265
|
-
type: "array",
|
|
2266
|
-
items: {
|
|
2267
|
-
type: "string",
|
|
2268
|
-
enum: ["claude-code", "codex"]
|
|
2269
|
-
}
|
|
2270
|
-
},
|
|
2271
2179
|
usedBy: {
|
|
2272
2180
|
type: "array",
|
|
2273
2181
|
items: { type: "string" },
|
|
@@ -2794,7 +2702,7 @@ async function diffEmployee(employeeName, cwd, config) {
|
|
|
2794
2702
|
} catch {
|
|
2795
2703
|
return null;
|
|
2796
2704
|
}
|
|
2797
|
-
const platform =
|
|
2705
|
+
const platform = config.defaultPlatform;
|
|
2798
2706
|
const adapter = adapters2[platform];
|
|
2799
2707
|
const { skillsDir, commandsDir } = resolvePlatformPaths(
|
|
2800
2708
|
cwd,
|
|
@@ -3032,177 +2940,9 @@ var diff = new Command6().name("diff").description("Check for updates against th
|
|
|
3032
2940
|
}
|
|
3033
2941
|
});
|
|
3034
2942
|
|
|
3035
|
-
// src/commands/
|
|
2943
|
+
// src/commands/search.ts
|
|
3036
2944
|
import { Command as Command7 } from "commander";
|
|
3037
|
-
import prompts5 from "prompts";
|
|
3038
|
-
import { z as z11 } from "zod";
|
|
3039
2945
|
import kleur3 from "kleur";
|
|
3040
|
-
|
|
3041
|
-
// src/utils/version.ts
|
|
3042
|
-
function compareVersions(a, b) {
|
|
3043
|
-
const partsA = a.split(".").map(Number);
|
|
3044
|
-
const partsB = b.split(".").map(Number);
|
|
3045
|
-
for (let i = 0; i < 3; i++) {
|
|
3046
|
-
const partA = partsA[i] ?? 0;
|
|
3047
|
-
const partB = partsB[i] ?? 0;
|
|
3048
|
-
if (partA < partB) return -1;
|
|
3049
|
-
if (partA > partB) return 1;
|
|
3050
|
-
}
|
|
3051
|
-
return 0;
|
|
3052
|
-
}
|
|
3053
|
-
function hasUpdate(current, latest) {
|
|
3054
|
-
return compareVersions(current, latest) < 0;
|
|
3055
|
-
}
|
|
3056
|
-
function formatVersionChange(current, latest) {
|
|
3057
|
-
if (hasUpdate(current, latest)) {
|
|
3058
|
-
return `${current} \u2192 ${latest}`;
|
|
3059
|
-
}
|
|
3060
|
-
return `${current} (up to date)`;
|
|
3061
|
-
}
|
|
3062
|
-
|
|
3063
|
-
// src/commands/update.ts
|
|
3064
|
-
var updateOptionsSchema = z11.object({
|
|
3065
|
-
skills: z11.array(z11.string()),
|
|
3066
|
-
cwd: z11.string(),
|
|
3067
|
-
yes: z11.boolean(),
|
|
3068
|
-
dryRun: z11.boolean()
|
|
3069
|
-
});
|
|
3070
|
-
async function runUpdate(options) {
|
|
3071
|
-
const { skills, cwd, yes, dryRun } = options;
|
|
3072
|
-
const config = await getConfig(cwd);
|
|
3073
|
-
if (!config) {
|
|
3074
|
-
throw notInitializedError();
|
|
3075
|
-
}
|
|
3076
|
-
logger.info("Checking for updates...");
|
|
3077
|
-
let skillsToCheck;
|
|
3078
|
-
if (skills.length > 0) {
|
|
3079
|
-
skillsToCheck = skills.map((s2) => parseTarget(s2).fullName);
|
|
3080
|
-
} else {
|
|
3081
|
-
skillsToCheck = await getInstalledSkills(cwd);
|
|
3082
|
-
}
|
|
3083
|
-
if (skillsToCheck.length === 0) {
|
|
3084
|
-
logger.info("No skills installed.");
|
|
3085
|
-
return;
|
|
3086
|
-
}
|
|
3087
|
-
const s = spinner("Fetching latest versions...").start();
|
|
3088
|
-
const updateResults = [];
|
|
3089
|
-
for (const skillName of skillsToCheck) {
|
|
3090
|
-
try {
|
|
3091
|
-
const currentState = config.skills?.[skillName];
|
|
3092
|
-
const currentVersion = currentState?.version ?? "0.0.0";
|
|
3093
|
-
const latestSkill = await fetchSkill(skillName, config, cwd);
|
|
3094
|
-
updateResults.push({
|
|
3095
|
-
skillName,
|
|
3096
|
-
currentVersion,
|
|
3097
|
-
latestVersion: latestSkill.version,
|
|
3098
|
-
hasUpdate: hasUpdate(currentVersion, latestSkill.version)
|
|
3099
|
-
});
|
|
3100
|
-
} catch {
|
|
3101
|
-
logger.dim(` Could not check ${skillName}`);
|
|
3102
|
-
}
|
|
3103
|
-
}
|
|
3104
|
-
s.stop();
|
|
3105
|
-
const updatesAvailable = updateResults.filter((r) => r.hasUpdate);
|
|
3106
|
-
if (updatesAvailable.length === 0) {
|
|
3107
|
-
logger.success("All skills are up to date!");
|
|
3108
|
-
return;
|
|
3109
|
-
}
|
|
3110
|
-
logger.break();
|
|
3111
|
-
logger.log(formatUpdateTable(updateResults));
|
|
3112
|
-
logger.break();
|
|
3113
|
-
if (dryRun) {
|
|
3114
|
-
logger.info(`${updatesAvailable.length} update(s) available.`);
|
|
3115
|
-
return;
|
|
3116
|
-
}
|
|
3117
|
-
if (!yes) {
|
|
3118
|
-
const { confirmed } = await prompts5({
|
|
3119
|
-
type: "confirm",
|
|
3120
|
-
name: "confirmed",
|
|
3121
|
-
message: `Update ${updatesAvailable.length} skill(s)?`,
|
|
3122
|
-
initial: true
|
|
3123
|
-
});
|
|
3124
|
-
if (!confirmed) {
|
|
3125
|
-
logger.info("Cancelled.");
|
|
3126
|
-
return;
|
|
3127
|
-
}
|
|
3128
|
-
}
|
|
3129
|
-
for (const result of updatesAvailable) {
|
|
3130
|
-
const updateSpinner = spinner(`Updating ${result.skillName}...`).start();
|
|
3131
|
-
try {
|
|
3132
|
-
const latestSkill = await fetchSkill(result.skillName, config, cwd);
|
|
3133
|
-
const platform = config.defaultPlatform;
|
|
3134
|
-
await uninstallSkill(result.skillName, config, cwd, { platform });
|
|
3135
|
-
await installSkill(latestSkill, config, cwd, {
|
|
3136
|
-
platform,
|
|
3137
|
-
overwrite: true
|
|
3138
|
-
});
|
|
3139
|
-
await updateSkill(
|
|
3140
|
-
cwd,
|
|
3141
|
-
result.skillName,
|
|
3142
|
-
latestSkill.version,
|
|
3143
|
-
[platform],
|
|
3144
|
-
"standalone"
|
|
3145
|
-
);
|
|
3146
|
-
updateSpinner.succeed(
|
|
3147
|
-
`Updated ${result.skillName} (${formatVersionChange(result.currentVersion, result.latestVersion)})`
|
|
3148
|
-
);
|
|
3149
|
-
} catch (error) {
|
|
3150
|
-
updateSpinner.fail(`Failed to update ${result.skillName}`);
|
|
3151
|
-
throw error;
|
|
3152
|
-
}
|
|
3153
|
-
}
|
|
3154
|
-
logger.break();
|
|
3155
|
-
logger.success("Update complete!");
|
|
3156
|
-
}
|
|
3157
|
-
function formatUpdateTable(results) {
|
|
3158
|
-
const maxNameLen = Math.max(...results.map((r) => r.skillName.length), 20);
|
|
3159
|
-
const maxVerLen = 10;
|
|
3160
|
-
const lines = [];
|
|
3161
|
-
const header = [
|
|
3162
|
-
"Skill".padEnd(maxNameLen),
|
|
3163
|
-
"Current".padEnd(maxVerLen),
|
|
3164
|
-
"Latest".padEnd(maxVerLen),
|
|
3165
|
-
"Status"
|
|
3166
|
-
].join(" \u2502 ");
|
|
3167
|
-
const separator = [
|
|
3168
|
-
"\u2500".repeat(maxNameLen),
|
|
3169
|
-
"\u2500".repeat(maxVerLen),
|
|
3170
|
-
"\u2500".repeat(maxVerLen),
|
|
3171
|
-
"\u2500".repeat(16)
|
|
3172
|
-
].join("\u2500\u253C\u2500");
|
|
3173
|
-
lines.push("\u250C" + separator.replace(/─┼─/g, "\u2500\u252C\u2500") + "\u2510");
|
|
3174
|
-
lines.push("\u2502 " + header + " \u2502");
|
|
3175
|
-
lines.push("\u251C" + separator + "\u2524");
|
|
3176
|
-
for (const r of results) {
|
|
3177
|
-
const status = r.hasUpdate ? kleur3.yellow("update available") : kleur3.green("up to date");
|
|
3178
|
-
const row = [
|
|
3179
|
-
r.skillName.padEnd(maxNameLen),
|
|
3180
|
-
r.currentVersion.padEnd(maxVerLen),
|
|
3181
|
-
r.latestVersion.padEnd(maxVerLen),
|
|
3182
|
-
status
|
|
3183
|
-
].join(" \u2502 ");
|
|
3184
|
-
lines.push("\u2502 " + row + " \u2502");
|
|
3185
|
-
}
|
|
3186
|
-
lines.push("\u2514" + separator.replace(/─┼─/g, "\u2500\u2534\u2500") + "\u2518");
|
|
3187
|
-
return lines.join("\n");
|
|
3188
|
-
}
|
|
3189
|
-
var update = new Command7().name("update").description("Update installed skills to latest versions").argument("[skills...]", "Skill names to update (all if empty)").option("--dry-run", "Preview updates without applying", false).option("-y, --yes", "Skip confirmation", false).option("-c, --cwd <cwd>", "Working directory", process.cwd()).action(async (skills, opts) => {
|
|
3190
|
-
try {
|
|
3191
|
-
const options = updateOptionsSchema.parse({
|
|
3192
|
-
skills,
|
|
3193
|
-
cwd: opts.cwd,
|
|
3194
|
-
yes: opts.yes,
|
|
3195
|
-
dryRun: opts.dryRun
|
|
3196
|
-
});
|
|
3197
|
-
await runUpdate(options);
|
|
3198
|
-
} catch (error) {
|
|
3199
|
-
handleError(error);
|
|
3200
|
-
}
|
|
3201
|
-
});
|
|
3202
|
-
|
|
3203
|
-
// src/commands/search.ts
|
|
3204
|
-
import { Command as Command8 } from "commander";
|
|
3205
|
-
import kleur4 from "kleur";
|
|
3206
2946
|
function searchItems(query, items) {
|
|
3207
2947
|
const q = query.toLowerCase();
|
|
3208
2948
|
return items.filter((item) => {
|
|
@@ -3244,7 +2984,7 @@ function filterByType(items, type) {
|
|
|
3244
2984
|
}
|
|
3245
2985
|
function formatTable(items) {
|
|
3246
2986
|
if (items.length === 0) {
|
|
3247
|
-
return
|
|
2987
|
+
return kleur3.yellow("No results found.");
|
|
3248
2988
|
}
|
|
3249
2989
|
const nameWidth = Math.max(
|
|
3250
2990
|
"Name".length,
|
|
@@ -3277,7 +3017,7 @@ function formatTable(items) {
|
|
|
3277
3017
|
desc
|
|
3278
3018
|
].join(" \u2502 ");
|
|
3279
3019
|
});
|
|
3280
|
-
return [
|
|
3020
|
+
return [kleur3.bold(header), separator, ...rows].join("\n");
|
|
3281
3021
|
}
|
|
3282
3022
|
function formatJSON(items) {
|
|
3283
3023
|
const output = {
|
|
@@ -3294,7 +3034,7 @@ function formatJSON(items) {
|
|
|
3294
3034
|
};
|
|
3295
3035
|
return JSON.stringify(output, null, 2);
|
|
3296
3036
|
}
|
|
3297
|
-
var search = new
|
|
3037
|
+
var search = new Command7().name("search").description("Search for skills and employees").argument("<query>", "Search query").option(
|
|
3298
3038
|
"-c, --category <category>",
|
|
3299
3039
|
"Filter by category (pm, frontend, backend)"
|
|
3300
3040
|
).option("-t, --type <type>", "Filter by type (skill, employee)").option("--json", "Output as JSON").option("--limit <n>", "Limit results", "10").option("--cwd <cwd>", "Working directory", process.cwd()).action(async (query, opts) => {
|
|
@@ -3329,7 +3069,7 @@ var search = new Command8().name("search").description("Search for skills and em
|
|
|
3329
3069
|
logger.log(formatJSON(results));
|
|
3330
3070
|
} else {
|
|
3331
3071
|
logger.log(
|
|
3332
|
-
|
|
3072
|
+
kleur3.cyan(`Found ${results.length} result(s) for "${query}":`)
|
|
3333
3073
|
);
|
|
3334
3074
|
logger.break();
|
|
3335
3075
|
logger.log(formatTable(results));
|
|
@@ -3344,8 +3084,8 @@ var search = new Command8().name("search").description("Search for skills and em
|
|
|
3344
3084
|
});
|
|
3345
3085
|
|
|
3346
3086
|
// src/commands/check.ts
|
|
3347
|
-
import { Command as
|
|
3348
|
-
import
|
|
3087
|
+
import { Command as Command8 } from "commander";
|
|
3088
|
+
import kleur4 from "kleur";
|
|
3349
3089
|
import { existsSync, readdirSync, statSync } from "fs";
|
|
3350
3090
|
import { join } from "path";
|
|
3351
3091
|
function checkNodeVersion() {
|
|
@@ -3514,10 +3254,10 @@ function checkInstalled(cwd, platformConfig) {
|
|
|
3514
3254
|
}
|
|
3515
3255
|
function getSymbol(status) {
|
|
3516
3256
|
const symbols = {
|
|
3517
|
-
pass:
|
|
3518
|
-
fail:
|
|
3519
|
-
warn:
|
|
3520
|
-
skip:
|
|
3257
|
+
pass: kleur4.green("\u25CF"),
|
|
3258
|
+
fail: kleur4.red("\u2716"),
|
|
3259
|
+
warn: kleur4.yellow("\u25D0"),
|
|
3260
|
+
skip: kleur4.gray("\u25CB")
|
|
3521
3261
|
};
|
|
3522
3262
|
return symbols[status];
|
|
3523
3263
|
}
|
|
@@ -3528,14 +3268,14 @@ function formatResults(results) {
|
|
|
3528
3268
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
3529
3269
|
const extension = isLast ? " " : "\u2502 ";
|
|
3530
3270
|
const symbol = getSymbol(result.status);
|
|
3531
|
-
const message = result.message ?
|
|
3271
|
+
const message = result.message ? kleur4.dim(` (${result.message})`) : "";
|
|
3532
3272
|
lines.push(`${connector}${symbol} ${result.name}${message}`);
|
|
3533
3273
|
if (result.children) {
|
|
3534
3274
|
result.children.forEach((child, childIndex) => {
|
|
3535
3275
|
const childIsLast = childIndex === result.children.length - 1;
|
|
3536
3276
|
const childConnector = childIsLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
3537
3277
|
const childSymbol = getSymbol(child.status);
|
|
3538
|
-
const childMessage = child.message ?
|
|
3278
|
+
const childMessage = child.message ? kleur4.dim(` (${child.message})`) : "";
|
|
3539
3279
|
lines.push(
|
|
3540
3280
|
`${extension}${childConnector}${childSymbol} ${child.name}${childMessage}`
|
|
3541
3281
|
);
|
|
@@ -3544,11 +3284,11 @@ function formatResults(results) {
|
|
|
3544
3284
|
});
|
|
3545
3285
|
return lines.join("\n");
|
|
3546
3286
|
}
|
|
3547
|
-
var check = new
|
|
3287
|
+
var check = new Command8().name("check").description("Check environment and configuration").option("--json", "Output as JSON").option("--cwd <cwd>", "Working directory", process.cwd()).action(async (opts) => {
|
|
3548
3288
|
try {
|
|
3549
3289
|
const cwd = opts.cwd;
|
|
3550
3290
|
logger.break();
|
|
3551
|
-
logger.bold(
|
|
3291
|
+
logger.bold(kleur4.cyan("AICO Environment Check"));
|
|
3552
3292
|
logger.break();
|
|
3553
3293
|
const results = [];
|
|
3554
3294
|
results.push(checkNodeVersion());
|
|
@@ -3606,14 +3346,14 @@ var check = new Command9().name("check").description("Check environment and conf
|
|
|
3606
3346
|
const hasWarn = results.some((r) => r.status === "warn");
|
|
3607
3347
|
if (hasError) {
|
|
3608
3348
|
logger.log(
|
|
3609
|
-
|
|
3349
|
+
kleur4.red("\u2716 Some checks failed. Run `aico init` to fix.")
|
|
3610
3350
|
);
|
|
3611
3351
|
} else if (hasWarn) {
|
|
3612
3352
|
logger.log(
|
|
3613
|
-
|
|
3353
|
+
kleur4.yellow("\u25D0 Some checks have warnings. AICO should work.")
|
|
3614
3354
|
);
|
|
3615
3355
|
} else {
|
|
3616
|
-
logger.log(
|
|
3356
|
+
logger.log(kleur4.green("\u2713 All checks passed! AICO is ready to use."));
|
|
3617
3357
|
}
|
|
3618
3358
|
logger.break();
|
|
3619
3359
|
}
|
|
@@ -3623,10 +3363,10 @@ var check = new Command9().name("check").description("Check environment and conf
|
|
|
3623
3363
|
});
|
|
3624
3364
|
|
|
3625
3365
|
// src/index.ts
|
|
3626
|
-
var VERSION = "1.
|
|
3366
|
+
var VERSION = "1.1.0";
|
|
3627
3367
|
var globalVerbose = false;
|
|
3628
3368
|
async function main() {
|
|
3629
|
-
const program = new
|
|
3369
|
+
const program = new Command9().name("aico").description(
|
|
3630
3370
|
"AI employee management tool - Build your AI team in seconds, start working immediately"
|
|
3631
3371
|
).version(VERSION).option("-v, --verbose", "Show detailed error information").option("--proxy <url>", "Use HTTP/HTTPS proxy for requests");
|
|
3632
3372
|
program.hook("preAction", (thisCommand) => {
|
|
@@ -3636,7 +3376,6 @@ async function main() {
|
|
|
3636
3376
|
program.addCommand(init);
|
|
3637
3377
|
program.addCommand(add);
|
|
3638
3378
|
program.addCommand(remove);
|
|
3639
|
-
program.addCommand(update);
|
|
3640
3379
|
program.addCommand(list);
|
|
3641
3380
|
program.addCommand(diff);
|
|
3642
3381
|
program.addCommand(build);
|