@the-aico/cli 1.0.4 → 1.1.1

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 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, platforms, skills, commands) {
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, platforms, source = "standalone") {
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, platforms) {
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);
@@ -631,7 +623,13 @@ function parseSkillFrontmatter(content) {
631
623
  }
632
624
 
633
625
  // src/schema/employee.ts
634
- var fileTypeSchema = z4.enum(["skill", "command", "doc"]);
626
+ var fileTypeSchema = z4.enum([
627
+ "skill",
628
+ "command",
629
+ "doc",
630
+ "script",
631
+ "asset"
632
+ ]);
635
633
  var employeeFileSourceSchema = z4.object({
636
634
  path: z4.string().min(1),
637
635
  type: fileTypeSchema
@@ -1035,12 +1033,18 @@ async function installEmployeeToPlatform(employee, config, cwd, platform, _optio
1035
1033
  const skillDir = path4.join(skillsDir, skillDirName);
1036
1034
  await fs3.ensureDir(skillDir);
1037
1035
  for (const file of skill.files) {
1038
- const filePath = path4.join(skillDir, path4.basename(file.path));
1036
+ const skillPrefix = `skills/${skill.name}/`;
1037
+ const relativePath = file.path.startsWith(skillPrefix) ? file.path.substring(skillPrefix.length) : path4.basename(file.path);
1038
+ const filePath = path4.join(skillDir, relativePath);
1039
+ await fs3.ensureDir(path4.dirname(filePath));
1039
1040
  let content = file.content;
1040
- if (file.path.endsWith("SKILL.md")) {
1041
+ if (relativePath.endsWith("SKILL.md")) {
1041
1042
  content = updateSkillName(content, skillDirName);
1042
1043
  }
1043
1044
  await fs3.writeFile(filePath, content, "utf-8");
1045
+ if (file.type === "script") {
1046
+ await fs3.chmod(filePath, 493);
1047
+ }
1044
1048
  }
1045
1049
  skillsInstalled++;
1046
1050
  }
@@ -1125,11 +1129,15 @@ async function installSkill(skill, config, cwd, options) {
1125
1129
  await fs4.ensureDir(skillDir);
1126
1130
  for (const file of skill.files) {
1127
1131
  const filePath = path5.join(skillDir, file.path);
1132
+ await fs4.ensureDir(path5.dirname(filePath));
1128
1133
  let content = file.content;
1129
1134
  if (file.path === "SKILL.md" || file.path.endsWith("/SKILL.md")) {
1130
1135
  content = updateSkillFrontmatterName(content, skillDirName);
1131
1136
  }
1132
1137
  await fs4.writeFile(filePath, content, "utf-8");
1138
+ if (file.type === "script") {
1139
+ await fs4.chmod(filePath, 493);
1140
+ }
1133
1141
  }
1134
1142
  return {
1135
1143
  skill,
@@ -1556,21 +1564,14 @@ async function addEmployee(target, config, cwd, platforms, overwrite, yes) {
1556
1564
  cwd,
1557
1565
  depFullName,
1558
1566
  employee.name,
1559
- "1.0.0",
1567
+ "1.0.0"
1560
1568
  // TODO: get version from skill
1561
- platforms
1562
1569
  );
1563
1570
  }
1564
1571
  }
1565
1572
  const skillNames = employee.skills.map((sk) => sk.name);
1566
1573
  const commandNames = employee.commands.map((c) => c.name);
1567
- await updateEmployees(
1568
- cwd,
1569
- employee.name,
1570
- platforms,
1571
- skillNames,
1572
- commandNames
1573
- );
1574
+ await updateEmployees(cwd, employee.name, skillNames, commandNames);
1574
1575
  s.succeed(`Added ${employee.name} (${employee.role})`);
1575
1576
  logger.dim(` Skills: ${employee.skills.map((sk) => sk.name).join(", ")}`);
1576
1577
  if (employee.commands.length > 0) {
@@ -1671,7 +1672,7 @@ async function addSingleSkill(fullName, config, cwd, platforms, overwrite, prefe
1671
1672
  return;
1672
1673
  }
1673
1674
  }
1674
- await updateSkill(cwd, fullName, skill.version, platforms, "standalone");
1675
+ await updateSkill(cwd, fullName, skill.version, "standalone");
1675
1676
  s.succeed(`Added skill ${skill.fullName}`);
1676
1677
  logger.dim(` Version: ${skill.version}`);
1677
1678
  logger.dim(` Category: ${skill.category}`);
@@ -1808,26 +1809,12 @@ async function removeEmployeeItem(target, config, cwd, platformsOpt, yes, dryRun
1808
1809
  const employeeName = target.name;
1809
1810
  const installedState = config.employees[employeeName];
1810
1811
  let platforms;
1811
- if (installedState) {
1812
- if (platformsOpt && platformsOpt.length > 0) {
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
- }
1812
+ if (platformsOpt && platformsOpt.length > 0) {
1813
+ platforms = platformsOpt;
1825
1814
  } else {
1826
- if (platformsOpt && platformsOpt.length > 0) {
1827
- platforms = platformsOpt;
1828
- } else {
1829
- platforms = Object.keys(config.platforms);
1830
- }
1815
+ platforms = Object.keys(config.platforms);
1816
+ }
1817
+ if (!installedState) {
1831
1818
  logger.dim(
1832
1819
  `Employee '${employeeName}' not in config, will attempt to remove files from: ${platforms.join(", ")}`
1833
1820
  );
@@ -1921,26 +1908,10 @@ async function removeSkillItem(target, config, cwd, platformsOpt, yes, force, dr
1921
1908
  return;
1922
1909
  }
1923
1910
  let platforms;
1924
- if (installedState) {
1925
- if (platformsOpt && platformsOpt.length > 0) {
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
- }
1911
+ if (platformsOpt && platformsOpt.length > 0) {
1912
+ platforms = platformsOpt;
1938
1913
  } else {
1939
- if (platformsOpt && platformsOpt.length > 0) {
1940
- platforms = platformsOpt;
1941
- } else {
1942
- platforms = [config.defaultPlatform];
1943
- }
1914
+ platforms = Object.keys(config.platforms);
1944
1915
  }
1945
1916
  if (!yes && !dryRun) {
1946
1917
  const { proceed } = await prompts4({
@@ -2050,11 +2021,8 @@ async function runList(options) {
2050
2021
  logger.bold("Installed employees:");
2051
2022
  logger.break();
2052
2023
  for (const [name, state] of employees) {
2053
- const platforms = state.platforms.join(", ");
2054
2024
  const date = new Date(state.installedAt).toLocaleDateString();
2055
- logger.log(
2056
- ` ${logger.highlight(name.padEnd(15))} ${platforms.padEnd(20)} ${date}`
2057
- );
2025
+ logger.log(` ${logger.highlight(name.padEnd(15))} ${date}`);
2058
2026
  }
2059
2027
  } else {
2060
2028
  logger.info("Fetching employee list...");
@@ -2087,10 +2055,8 @@ async function runList(options) {
2087
2055
  logger.info("No employees installed.");
2088
2056
  return;
2089
2057
  }
2090
- for (const [name, state] of employees) {
2091
- logger.log(
2092
- ` ${logger.highlight(name.padEnd(15))} ${state.platforms.join(", ")}`
2093
- );
2058
+ for (const [name] of employees) {
2059
+ logger.log(` ${logger.highlight(name)}`);
2094
2060
  }
2095
2061
  }
2096
2062
  }
@@ -2162,16 +2128,8 @@ var CONFIG_SCHEMA = {
2162
2128
  description: "Installed employees state",
2163
2129
  additionalProperties: {
2164
2130
  type: "object",
2165
- required: ["platforms", "installedAt"],
2131
+ required: ["installedAt"],
2166
2132
  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
2133
  installedAt: {
2176
2134
  type: "string",
2177
2135
  format: "date-time",
@@ -2199,7 +2157,7 @@ var CONFIG_SCHEMA = {
2199
2157
  description: "Standalone installed skills",
2200
2158
  additionalProperties: {
2201
2159
  type: "object",
2202
- required: ["version", "installedAt", "source", "platforms"],
2160
+ required: ["version", "installedAt", "source"],
2203
2161
  properties: {
2204
2162
  version: {
2205
2163
  type: "string",
@@ -2214,13 +2172,6 @@ var CONFIG_SCHEMA = {
2214
2172
  type: "string",
2215
2173
  enum: ["standalone", "employee"],
2216
2174
  description: "Installation source"
2217
- },
2218
- platforms: {
2219
- type: "array",
2220
- items: {
2221
- type: "string",
2222
- enum: ["claude-code", "codex"]
2223
- }
2224
2175
  }
2225
2176
  }
2226
2177
  }
@@ -2230,7 +2181,7 @@ var CONFIG_SCHEMA = {
2230
2181
  description: "Shared skills with reference tracking",
2231
2182
  additionalProperties: {
2232
2183
  type: "object",
2233
- required: ["version", "installedAt", "platforms", "usedBy"],
2184
+ required: ["version", "installedAt", "usedBy"],
2234
2185
  properties: {
2235
2186
  version: {
2236
2187
  type: "string",
@@ -2241,13 +2192,6 @@ var CONFIG_SCHEMA = {
2241
2192
  format: "date-time",
2242
2193
  description: "Installation timestamp"
2243
2194
  },
2244
- platforms: {
2245
- type: "array",
2246
- items: {
2247
- type: "string",
2248
- enum: ["claude-code", "codex"]
2249
- }
2250
- },
2251
2195
  usedBy: {
2252
2196
  type: "array",
2253
2197
  items: { type: "string" },
@@ -2608,9 +2552,12 @@ async function runBuild(options) {
2608
2552
  skillDescription = frontmatter.description;
2609
2553
  }
2610
2554
  }
2555
+ const skillPrefix = `skills/${skill.name}/`;
2556
+ const relativePath = file.path.startsWith(skillPrefix) ? file.path.substring(skillPrefix.length) : path8.basename(file.path);
2557
+ const skillFileType = file.type === "doc" || file.type === "command" ? "reference" : file.type;
2611
2558
  skillFiles.push({
2612
- path: path8.basename(file.path),
2613
- type: file.type === "skill" ? "skill" : "reference",
2559
+ path: relativePath,
2560
+ type: skillFileType,
2614
2561
  content
2615
2562
  });
2616
2563
  } else {
@@ -2774,7 +2721,7 @@ async function diffEmployee(employeeName, cwd, config) {
2774
2721
  } catch {
2775
2722
  return null;
2776
2723
  }
2777
- const platform = installedState.platforms[0] || config.defaultPlatform;
2724
+ const platform = config.defaultPlatform;
2778
2725
  const adapter = adapters2[platform];
2779
2726
  const { skillsDir, commandsDir } = resolvePlatformPaths(
2780
2727
  cwd,
@@ -3435,7 +3382,7 @@ var check = new Command8().name("check").description("Check environment and conf
3435
3382
  });
3436
3383
 
3437
3384
  // src/index.ts
3438
- var VERSION = "1.0.0";
3385
+ var VERSION = "1.1.0";
3439
3386
  var globalVerbose = false;
3440
3387
  async function main() {
3441
3388
  const program = new Command9().name("aico").description(