@the-aico/cli 1.0.4 → 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 +24 -96
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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,7 +344,7 @@ async function removeSkill(cwd, skillFullName) {
|
|
|
349
344
|
}
|
|
350
345
|
await writeConfig(cwd, config);
|
|
351
346
|
}
|
|
352
|
-
async function addSharedSkillReference(cwd, sharedSkillFullName, employeeName, version
|
|
347
|
+
async function addSharedSkillReference(cwd, sharedSkillFullName, employeeName, version) {
|
|
353
348
|
const config = await getConfig(cwd);
|
|
354
349
|
if (!config) {
|
|
355
350
|
throw new Error("Config not found");
|
|
@@ -362,15 +357,12 @@ async function addSharedSkillReference(cwd, sharedSkillFullName, employeeName, v
|
|
|
362
357
|
if (!existing.usedBy.includes(employeeName)) {
|
|
363
358
|
existing.usedBy.push(employeeName);
|
|
364
359
|
}
|
|
365
|
-
const allPlatforms = /* @__PURE__ */ new Set([...existing.platforms, ...platforms]);
|
|
366
|
-
existing.platforms = Array.from(allPlatforms);
|
|
367
360
|
await writeConfig(cwd, config);
|
|
368
361
|
return { isNew: false };
|
|
369
362
|
}
|
|
370
363
|
config.sharedSkills[sharedSkillFullName] = {
|
|
371
364
|
version,
|
|
372
365
|
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
373
|
-
platforms,
|
|
374
366
|
usedBy: [employeeName]
|
|
375
367
|
};
|
|
376
368
|
await writeConfig(cwd, config);
|
|
@@ -1556,21 +1548,14 @@ async function addEmployee(target, config, cwd, platforms, overwrite, yes) {
|
|
|
1556
1548
|
cwd,
|
|
1557
1549
|
depFullName,
|
|
1558
1550
|
employee.name,
|
|
1559
|
-
"1.0.0"
|
|
1551
|
+
"1.0.0"
|
|
1560
1552
|
// TODO: get version from skill
|
|
1561
|
-
platforms
|
|
1562
1553
|
);
|
|
1563
1554
|
}
|
|
1564
1555
|
}
|
|
1565
1556
|
const skillNames = employee.skills.map((sk) => sk.name);
|
|
1566
1557
|
const commandNames = employee.commands.map((c) => c.name);
|
|
1567
|
-
await updateEmployees(
|
|
1568
|
-
cwd,
|
|
1569
|
-
employee.name,
|
|
1570
|
-
platforms,
|
|
1571
|
-
skillNames,
|
|
1572
|
-
commandNames
|
|
1573
|
-
);
|
|
1558
|
+
await updateEmployees(cwd, employee.name, skillNames, commandNames);
|
|
1574
1559
|
s.succeed(`Added ${employee.name} (${employee.role})`);
|
|
1575
1560
|
logger.dim(` Skills: ${employee.skills.map((sk) => sk.name).join(", ")}`);
|
|
1576
1561
|
if (employee.commands.length > 0) {
|
|
@@ -1671,7 +1656,7 @@ async function addSingleSkill(fullName, config, cwd, platforms, overwrite, prefe
|
|
|
1671
1656
|
return;
|
|
1672
1657
|
}
|
|
1673
1658
|
}
|
|
1674
|
-
await updateSkill(cwd, fullName, skill.version,
|
|
1659
|
+
await updateSkill(cwd, fullName, skill.version, "standalone");
|
|
1675
1660
|
s.succeed(`Added skill ${skill.fullName}`);
|
|
1676
1661
|
logger.dim(` Version: ${skill.version}`);
|
|
1677
1662
|
logger.dim(` Category: ${skill.category}`);
|
|
@@ -1808,26 +1793,12 @@ async function removeEmployeeItem(target, config, cwd, platformsOpt, yes, dryRun
|
|
|
1808
1793
|
const employeeName = target.name;
|
|
1809
1794
|
const installedState = config.employees[employeeName];
|
|
1810
1795
|
let platforms;
|
|
1811
|
-
if (
|
|
1812
|
-
|
|
1813
|
-
platforms = platformsOpt.filter(
|
|
1814
|
-
(p) => installedState.platforms.includes(p)
|
|
1815
|
-
);
|
|
1816
|
-
if (platforms.length === 0) {
|
|
1817
|
-
logger.warn(
|
|
1818
|
-
`Employee '${employeeName}' is not installed on specified platform(s). Skipping.`
|
|
1819
|
-
);
|
|
1820
|
-
return;
|
|
1821
|
-
}
|
|
1822
|
-
} else {
|
|
1823
|
-
platforms = installedState.platforms;
|
|
1824
|
-
}
|
|
1796
|
+
if (platformsOpt && platformsOpt.length > 0) {
|
|
1797
|
+
platforms = platformsOpt;
|
|
1825
1798
|
} else {
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
platforms = Object.keys(config.platforms);
|
|
1830
|
-
}
|
|
1799
|
+
platforms = Object.keys(config.platforms);
|
|
1800
|
+
}
|
|
1801
|
+
if (!installedState) {
|
|
1831
1802
|
logger.dim(
|
|
1832
1803
|
`Employee '${employeeName}' not in config, will attempt to remove files from: ${platforms.join(", ")}`
|
|
1833
1804
|
);
|
|
@@ -1921,26 +1892,10 @@ async function removeSkillItem(target, config, cwd, platformsOpt, yes, force, dr
|
|
|
1921
1892
|
return;
|
|
1922
1893
|
}
|
|
1923
1894
|
let platforms;
|
|
1924
|
-
if (
|
|
1925
|
-
|
|
1926
|
-
platforms = platformsOpt.filter(
|
|
1927
|
-
(p) => installedState.platforms.includes(p)
|
|
1928
|
-
);
|
|
1929
|
-
if (platforms.length === 0) {
|
|
1930
|
-
logger.warn(
|
|
1931
|
-
`Skill '${skillFullName}' is not installed on specified platform(s). Skipping.`
|
|
1932
|
-
);
|
|
1933
|
-
return;
|
|
1934
|
-
}
|
|
1935
|
-
} else {
|
|
1936
|
-
platforms = installedState.platforms;
|
|
1937
|
-
}
|
|
1895
|
+
if (platformsOpt && platformsOpt.length > 0) {
|
|
1896
|
+
platforms = platformsOpt;
|
|
1938
1897
|
} else {
|
|
1939
|
-
|
|
1940
|
-
platforms = platformsOpt;
|
|
1941
|
-
} else {
|
|
1942
|
-
platforms = [config.defaultPlatform];
|
|
1943
|
-
}
|
|
1898
|
+
platforms = Object.keys(config.platforms);
|
|
1944
1899
|
}
|
|
1945
1900
|
if (!yes && !dryRun) {
|
|
1946
1901
|
const { proceed } = await prompts4({
|
|
@@ -2050,11 +2005,8 @@ async function runList(options) {
|
|
|
2050
2005
|
logger.bold("Installed employees:");
|
|
2051
2006
|
logger.break();
|
|
2052
2007
|
for (const [name, state] of employees) {
|
|
2053
|
-
const platforms = state.platforms.join(", ");
|
|
2054
2008
|
const date = new Date(state.installedAt).toLocaleDateString();
|
|
2055
|
-
logger.log(
|
|
2056
|
-
` ${logger.highlight(name.padEnd(15))} ${platforms.padEnd(20)} ${date}`
|
|
2057
|
-
);
|
|
2009
|
+
logger.log(` ${logger.highlight(name.padEnd(15))} ${date}`);
|
|
2058
2010
|
}
|
|
2059
2011
|
} else {
|
|
2060
2012
|
logger.info("Fetching employee list...");
|
|
@@ -2087,10 +2039,8 @@ async function runList(options) {
|
|
|
2087
2039
|
logger.info("No employees installed.");
|
|
2088
2040
|
return;
|
|
2089
2041
|
}
|
|
2090
|
-
for (const [name
|
|
2091
|
-
logger.log(
|
|
2092
|
-
` ${logger.highlight(name.padEnd(15))} ${state.platforms.join(", ")}`
|
|
2093
|
-
);
|
|
2042
|
+
for (const [name] of employees) {
|
|
2043
|
+
logger.log(` ${logger.highlight(name)}`);
|
|
2094
2044
|
}
|
|
2095
2045
|
}
|
|
2096
2046
|
}
|
|
@@ -2162,16 +2112,8 @@ var CONFIG_SCHEMA = {
|
|
|
2162
2112
|
description: "Installed employees state",
|
|
2163
2113
|
additionalProperties: {
|
|
2164
2114
|
type: "object",
|
|
2165
|
-
required: ["
|
|
2115
|
+
required: ["installedAt"],
|
|
2166
2116
|
properties: {
|
|
2167
|
-
platforms: {
|
|
2168
|
-
type: "array",
|
|
2169
|
-
items: {
|
|
2170
|
-
type: "string",
|
|
2171
|
-
enum: ["claude-code", "codex"]
|
|
2172
|
-
},
|
|
2173
|
-
description: "Platforms this employee is installed on"
|
|
2174
|
-
},
|
|
2175
2117
|
installedAt: {
|
|
2176
2118
|
type: "string",
|
|
2177
2119
|
format: "date-time",
|
|
@@ -2199,7 +2141,7 @@ var CONFIG_SCHEMA = {
|
|
|
2199
2141
|
description: "Standalone installed skills",
|
|
2200
2142
|
additionalProperties: {
|
|
2201
2143
|
type: "object",
|
|
2202
|
-
required: ["version", "installedAt", "source"
|
|
2144
|
+
required: ["version", "installedAt", "source"],
|
|
2203
2145
|
properties: {
|
|
2204
2146
|
version: {
|
|
2205
2147
|
type: "string",
|
|
@@ -2214,13 +2156,6 @@ var CONFIG_SCHEMA = {
|
|
|
2214
2156
|
type: "string",
|
|
2215
2157
|
enum: ["standalone", "employee"],
|
|
2216
2158
|
description: "Installation source"
|
|
2217
|
-
},
|
|
2218
|
-
platforms: {
|
|
2219
|
-
type: "array",
|
|
2220
|
-
items: {
|
|
2221
|
-
type: "string",
|
|
2222
|
-
enum: ["claude-code", "codex"]
|
|
2223
|
-
}
|
|
2224
2159
|
}
|
|
2225
2160
|
}
|
|
2226
2161
|
}
|
|
@@ -2230,7 +2165,7 @@ var CONFIG_SCHEMA = {
|
|
|
2230
2165
|
description: "Shared skills with reference tracking",
|
|
2231
2166
|
additionalProperties: {
|
|
2232
2167
|
type: "object",
|
|
2233
|
-
required: ["version", "installedAt", "
|
|
2168
|
+
required: ["version", "installedAt", "usedBy"],
|
|
2234
2169
|
properties: {
|
|
2235
2170
|
version: {
|
|
2236
2171
|
type: "string",
|
|
@@ -2241,13 +2176,6 @@ var CONFIG_SCHEMA = {
|
|
|
2241
2176
|
format: "date-time",
|
|
2242
2177
|
description: "Installation timestamp"
|
|
2243
2178
|
},
|
|
2244
|
-
platforms: {
|
|
2245
|
-
type: "array",
|
|
2246
|
-
items: {
|
|
2247
|
-
type: "string",
|
|
2248
|
-
enum: ["claude-code", "codex"]
|
|
2249
|
-
}
|
|
2250
|
-
},
|
|
2251
2179
|
usedBy: {
|
|
2252
2180
|
type: "array",
|
|
2253
2181
|
items: { type: "string" },
|
|
@@ -2774,7 +2702,7 @@ async function diffEmployee(employeeName, cwd, config) {
|
|
|
2774
2702
|
} catch {
|
|
2775
2703
|
return null;
|
|
2776
2704
|
}
|
|
2777
|
-
const platform =
|
|
2705
|
+
const platform = config.defaultPlatform;
|
|
2778
2706
|
const adapter = adapters2[platform];
|
|
2779
2707
|
const { skillsDir, commandsDir } = resolvePlatformPaths(
|
|
2780
2708
|
cwd,
|
|
@@ -3435,7 +3363,7 @@ var check = new Command8().name("check").description("Check environment and conf
|
|
|
3435
3363
|
});
|
|
3436
3364
|
|
|
3437
3365
|
// src/index.ts
|
|
3438
|
-
var VERSION = "1.
|
|
3366
|
+
var VERSION = "1.1.0";
|
|
3439
3367
|
var globalVerbose = false;
|
|
3440
3368
|
async function main() {
|
|
3441
3369
|
const program = new Command9().name("aico").description(
|