open-classify 0.9.2 → 0.9.3

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.
@@ -160,6 +160,8 @@ function parseUninstallFlags(args) {
160
160
  yes: false,
161
161
  dryRun: false,
162
162
  force: false,
163
+ keepPackage: false,
164
+ packageManager: null,
163
165
  classifierDir: "classifiers",
164
166
  };
165
167
 
@@ -168,6 +170,9 @@ function parseUninstallFlags(args) {
168
170
  if (arg === "--yes" || arg === "-y") flags.yes = true;
169
171
  else if (arg === "--dry-run") flags.dryRun = true;
170
172
  else if (arg === "--force") flags.force = true;
173
+ else if (arg === "--keep-package") flags.keepPackage = true;
174
+ else if (arg === "--package-manager" && args[i + 1]) flags.packageManager = args[++i];
175
+ else if (arg.startsWith("--package-manager=")) flags.packageManager = arg.split("=")[1];
171
176
  else if (arg === "--classifier-dir" && args[i + 1]) flags.classifierDir = args[++i];
172
177
  else if (arg.startsWith("--classifier-dir=")) flags.classifierDir = arg.split("=")[1];
173
178
  }
@@ -182,9 +187,10 @@ Commands:
182
187
  init [options] Scaffold open-classify.config.json and classifiers/ in the
183
188
  current directory. Re-run safe: existing files are skipped.
184
189
 
185
- uninstall Remove open-classify scaffold files from the current
186
- directory. Use --force to remove the whole classifiers/
187
- directory, including active/custom classifiers.
190
+ uninstall Remove the open-classify scaffold and uninstall the
191
+ package. Use --force to also delete active/custom
192
+ classifiers, --keep-package to leave the npm dependency
193
+ in place.
188
194
 
189
195
  doctor Check that the install, config, Ollama, and classifiers are
190
196
  all working. Exits non-zero on failure.
@@ -205,6 +211,8 @@ Options for init:
205
211
  Options for uninstall:
206
212
  --dry-run Preview what would be removed; don't delete anything
207
213
  --force Remove the whole classifiers/ directory
214
+ --keep-package Don't run the package manager uninstall step
215
+ --package-manager <m> npm | pnpm | yarn | bun (default: auto-detect)
208
216
  --classifier-dir <p> Directory for classifiers (default: ./classifiers)
209
217
  --yes, -y Accept all prompts (CI mode)
210
218
 
@@ -546,12 +554,21 @@ function showDiffs(conflicts, cwd, classifierDir, config = DEFAULT_CONFIG) {
546
554
  // uninstall
547
555
  // ---------------------------------------------------------------------------
548
556
 
549
- async function runUninstall({ cwd, yes, dryRun, force, classifierDir }) {
557
+ async function runUninstall({ cwd, yes, dryRun, force, keepPackage, packageManager, classifierDir }) {
550
558
  const resolvedClassifierDir = resolve(cwd, classifierDir);
551
559
  const plan = planUninstall(cwd, { classifierDir: resolvedClassifierDir, force });
552
560
 
553
- if (plan.toRemove.length === 0) {
554
- process.stdout.write("Nothing to remove — no open-classify scaffold found.\n");
561
+ const pkgPath = join(cwd, "package.json");
562
+ let pkg = null;
563
+ if (existsSync(pkgPath)) {
564
+ try { pkg = JSON.parse(readFileSync(pkgPath, "utf8")); } catch { pkg = null; }
565
+ }
566
+ const packageInstalled = pkg !== null && isOpenClassifyDep(pkg);
567
+ const willRemovePackage = !keepPackage && packageInstalled;
568
+ const pm = packageManager || detectPackageManager(cwd);
569
+
570
+ if (plan.toRemove.length === 0 && !willRemovePackage) {
571
+ process.stdout.write("Nothing to remove — no open-classify scaffold or dependency found.\n");
555
572
  if (plan.toSkip.length > 0) {
556
573
  process.stdout.write("\nSkipped active/custom classifier dirs:\n");
557
574
  for (const p of plan.toSkip) process.stdout.write(` ${p}\n`);
@@ -560,8 +577,11 @@ async function runUninstall({ cwd, yes, dryRun, force, classifierDir }) {
560
577
  return;
561
578
  }
562
579
 
563
- process.stdout.write(`\nThe following open-classify scaffold will be removed from ${cwd}:\n\n`);
580
+ process.stdout.write(`\nThe following will be removed from ${cwd}:\n\n`);
564
581
  for (const p of plan.toRemove) process.stdout.write(` ${p}\n`);
582
+ if (willRemovePackage) {
583
+ process.stdout.write(` open-classify (via ${pm} uninstall)\n`);
584
+ }
565
585
 
566
586
  if (plan.toSkip.length > 0) {
567
587
  process.stdout.write("\nSkipped active/custom classifier dirs:\n");
@@ -569,6 +589,10 @@ async function runUninstall({ cwd, yes, dryRun, force, classifierDir }) {
569
589
  process.stdout.write("\nUse --force to remove the whole classifiers/ directory.\n");
570
590
  }
571
591
 
592
+ if (keepPackage && packageInstalled) {
593
+ process.stdout.write("\nKeeping the open-classify package (--keep-package).\n");
594
+ }
595
+
572
596
  if (dryRun) {
573
597
  process.stdout.write("\n(dry run — nothing removed)\n");
574
598
  return;
@@ -584,8 +608,19 @@ async function runUninstall({ cwd, yes, dryRun, force, classifierDir }) {
584
608
 
585
609
  process.stdout.write("\n");
586
610
  for (const action of plan.actions) action();
587
- process.stdout.write("\n✓ removed open-classify scaffold\n");
588
- process.stdout.write("To remove the package dependency too, run: npm uninstall open-classify\n");
611
+ if (plan.toRemove.length > 0) {
612
+ process.stdout.write("\n✓ removed open-classify scaffold\n");
613
+ }
614
+
615
+ if (willRemovePackage) {
616
+ process.stdout.write(`\n Running: ${pm} uninstall open-classify\n\n`);
617
+ const result = spawnSync(pm, ["uninstall", "open-classify"], { cwd, stdio: "inherit" });
618
+ if (result.status !== 0) {
619
+ process.stderr.write(`\n✖ Package uninstall failed. Run manually: ${pm} uninstall open-classify\n`);
620
+ process.exit(1);
621
+ }
622
+ process.stdout.write("\n✓ removed open-classify package\n");
623
+ }
589
624
  }
590
625
 
591
626
  function planUninstall(cwd, { classifierDir, force }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-classify",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Manifest-driven classifier runtime for routing user messages to downstream AI models",
5
5
  "license": "MIT",
6
6
  "author": "Taylor Bayouth",