skiller 0.9.7 → 0.9.9

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.
@@ -5,6 +5,9 @@ const handlers_1 = require("./handlers");
5
5
  const index_1 = require("../agents/index");
6
6
  function skillsArgsBuilder(y) {
7
7
  return y
8
+ .parserConfiguration({
9
+ 'unknown-options-as-args': true,
10
+ })
8
11
  .option('project-root', {
9
12
  type: 'string',
10
13
  description: 'Project root directory',
@@ -123,12 +126,24 @@ async function run() {
123
126
  description: 'Enable/disable skills support (experimental, default: enabled)',
124
127
  });
125
128
  }, handlers_1.applyHandler)
126
- .command('add [args..]', 'Run the local skills CLI add command', skillsArgsBuilder, handlers_1.addHandler)
127
- .command('remove [args..]', 'Run the local skills CLI remove command', skillsArgsBuilder, handlers_1.removeHandler)
129
+ .command('add [args..]', 'Run the local skills CLI add command', (y) => skillsArgsBuilder(y)
130
+ .option('verbose', {
131
+ type: 'boolean',
132
+ description: 'Enable verbose logging for the follow-up apply step',
133
+ default: false,
134
+ })
135
+ .alias('verbose', 'v'), handlers_1.addHandler)
136
+ .command('remove [args..]', 'Run the local skills CLI remove command', (y) => skillsArgsBuilder(y)
137
+ .option('verbose', {
138
+ type: 'boolean',
139
+ description: 'Enable verbose logging for the follow-up apply step',
140
+ default: false,
141
+ })
142
+ .alias('verbose', 'v'), handlers_1.removeHandler)
128
143
  .command('list [args..]', 'Run the local skills CLI list command', skillsArgsBuilder, handlers_1.listHandler)
129
144
  .command('find [args..]', 'Run the local skills CLI find command', skillsArgsBuilder, handlers_1.findHandler)
130
145
  .command('check [args..]', 'Run the local skills CLI check command', skillsArgsBuilder, handlers_1.checkHandler)
131
- .command('install [args..]', 'Run the local skills CLI install command, then skiller apply', (y) => skillsArgsBuilder(y)
146
+ .command('install [args..]', 'Restore lock-backed skills with the local skills CLI experimental_install command, then skiller apply', (y) => skillsArgsBuilder(y)
132
147
  .option('verbose', {
133
148
  type: 'boolean',
134
149
  description: 'Enable verbose logging for the follow-up apply step',
@@ -57,8 +57,10 @@ const ConfigLoader_1 = require("../core/ConfigLoader");
57
57
  const ClaudePluginMigration_1 = require("../core/ClaudePluginMigration");
58
58
  const RulesToSkillsMigration_1 = require("../core/RulesToSkillsMigration");
59
59
  const agents_1 = require("../agents");
60
+ const agents_2 = require("../agents");
60
61
  const skills_cli_1 = require("./skills-cli");
61
62
  const project_paths_1 = require("../core/project-paths");
63
+ const SkillOwnership_1 = require("../core/SkillOwnership");
62
64
  const readline = __importStar(require("readline/promises"));
63
65
  async function executeSkillsWrapper(projectRoot, args) {
64
66
  try {
@@ -76,6 +78,73 @@ async function applyAfterSkillsLifecycleStep(projectRoot, verbose) {
76
78
  verbose,
77
79
  });
78
80
  }
81
+ function normalizeRequestedSkillNames(args) {
82
+ if (!args || args.length === 0)
83
+ return [];
84
+ const names = new Set();
85
+ for (const arg of args) {
86
+ if (!arg || arg.startsWith('-') || arg.includes('/'))
87
+ continue;
88
+ const normalized = path.basename(arg, '.mdc').trim().replace(/:/g, '-');
89
+ if (normalized.length > 0) {
90
+ names.add(normalized);
91
+ }
92
+ }
93
+ return [...names].sort((a, b) => a.localeCompare(b));
94
+ }
95
+ async function scrubRequestedSkillsLockEntries(projectRoot, args) {
96
+ const requestedNames = new Set(normalizeRequestedSkillNames(args));
97
+ if (requestedNames.size === 0)
98
+ return [];
99
+ const skillsLockPath = path.join(projectRoot, 'skills-lock.json');
100
+ const raw = await readJsonObject(skillsLockPath);
101
+ if (!raw)
102
+ return [];
103
+ const skills = raw.skills;
104
+ if (!skills || typeof skills !== 'object')
105
+ return [];
106
+ const nextSkills = {};
107
+ const removedKeys = [];
108
+ for (const [key, value] of Object.entries(skills)) {
109
+ if (requestedNames.has(key.replace(/:/g, '-'))) {
110
+ removedKeys.push(key);
111
+ continue;
112
+ }
113
+ nextSkills[key] = value;
114
+ }
115
+ if (removedKeys.length === 0)
116
+ return [];
117
+ raw.skills = nextSkills;
118
+ await fs.writeFile(skillsLockPath, JSON.stringify(raw, null, 2) + '\n');
119
+ return removedKeys.sort((a, b) => a.localeCompare(b));
120
+ }
121
+ async function pruneRequestedUnmanagedSkillOutputs(projectRoot, args) {
122
+ const requestedNames = normalizeRequestedSkillNames(args);
123
+ if (requestedNames.length === 0)
124
+ return [];
125
+ const ownership = await (0, SkillOwnership_1.resolveSkillOwnership)(projectRoot);
126
+ const removableNames = requestedNames.filter((name) => !ownership.upstreamOwned.has(name) && !ownership.localOwned.has(name));
127
+ if (removableNames.length === 0)
128
+ return [];
129
+ const skillDirs = new Set([(0, SkillOwnership_1.getCanonicalSkillsDir)(projectRoot)]);
130
+ for (const agent of agents_2.allAgents) {
131
+ if (!agent.supportsNativeSkills?.() || !agent.getSkillsPath)
132
+ continue;
133
+ const skillsPath = agent.getSkillsPath(projectRoot);
134
+ if (skillsPath) {
135
+ skillDirs.add(skillsPath);
136
+ }
137
+ }
138
+ for (const skillName of removableNames) {
139
+ for (const skillsDir of skillDirs) {
140
+ await fs.rm(path.join(skillsDir, skillName), {
141
+ force: true,
142
+ recursive: true,
143
+ });
144
+ }
145
+ }
146
+ return removableNames;
147
+ }
79
148
  function buildClaudePluginMigrationArgs(source) {
80
149
  return ['add', source, '--agent', 'universal', '--skill', '*', '-y'];
81
150
  }
@@ -565,10 +634,11 @@ async function addHandler(argv) {
565
634
  'add',
566
635
  ...(argv.args ?? []),
567
636
  ]);
637
+ await applyAfterSkillsLifecycleStep(argv['project-root'], argv.verbose ?? false);
568
638
  }
569
639
  async function installHandler(argv) {
570
640
  await executeSkillsWrapper(argv['project-root'], [
571
- 'install',
641
+ 'experimental_install',
572
642
  ...(argv.args ?? []),
573
643
  ]);
574
644
  await applyAfterSkillsLifecycleStep(argv['project-root'], argv.verbose ?? false);
@@ -578,6 +648,9 @@ async function removeHandler(argv) {
578
648
  'remove',
579
649
  ...(argv.args ?? []),
580
650
  ]);
651
+ await scrubRequestedSkillsLockEntries(argv['project-root'], argv.args ?? []);
652
+ await pruneRequestedUnmanagedSkillOutputs(argv['project-root'], argv.args ?? []);
653
+ await applyAfterSkillsLifecycleStep(argv['project-root'], argv.verbose ?? false);
581
654
  }
582
655
  async function listHandler(argv) {
583
656
  await executeSkillsWrapper(argv['project-root'], [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skiller",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "Skiller — apply the same rules to all coding agents",
5
5
  "main": "dist/lib.js",
6
6
  "publishConfig": {