@basestream/cli 0.2.0 → 0.2.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.

Potentially problematic release.


This version of @basestream/cli might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/dist/cli.mjs +69 -9
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -1011,13 +1011,8 @@ async function init() {
1011
1011
  installSkill();
1012
1012
  ensureDirs();
1013
1013
  check(`Created ~/.basestream/buffer/`);
1014
- const existing = readConfig();
1015
- if (existing?.apiKey) {
1016
- check("Already authenticated");
1017
- } else {
1018
- console.log();
1019
- await login();
1020
- }
1014
+ console.log();
1015
+ await login();
1021
1016
  console.log();
1022
1017
  console.log(
1023
1018
  ` ${c.dim("That's it. Work normally \u2014 every session is now tracked.")}`
@@ -4310,7 +4305,7 @@ function flushToBuffer(acc) {
4310
4305
  whatChanged: Array.from(acc.filesWritten).map(
4311
4306
  (f) => path5.relative(acc.cwd, f) || f
4312
4307
  ),
4313
- outcome: WorkOutcome.IN_PROGRESS,
4308
+ outcome: WorkOutcome.COMPLETED,
4314
4309
  filesTouched: acc.filesWritten.size,
4315
4310
  complexity,
4316
4311
  toolVersion: null,
@@ -4401,6 +4396,66 @@ async function hookStop() {
4401
4396
  }
4402
4397
  }
4403
4398
 
4399
+ // src/cli/commands/uninstall.ts
4400
+ init_util();
4401
+ import fs6 from "node:fs";
4402
+ import path6 from "node:path";
4403
+ import os4 from "node:os";
4404
+ var CLAUDE_SETTINGS_PATH2 = path6.join(
4405
+ os4.homedir(),
4406
+ ".claude",
4407
+ "settings.json"
4408
+ );
4409
+ var HOOK_MARKER2 = "_hook-stop";
4410
+ function removeClaudeCodeHook() {
4411
+ if (!fs6.existsSync(CLAUDE_SETTINGS_PATH2)) {
4412
+ warn("No Claude Code settings found \u2014 nothing to remove");
4413
+ return false;
4414
+ }
4415
+ let settings;
4416
+ try {
4417
+ settings = JSON.parse(fs6.readFileSync(CLAUDE_SETTINGS_PATH2, "utf-8"));
4418
+ } catch {
4419
+ warn("Could not parse ~/.claude/settings.json");
4420
+ return false;
4421
+ }
4422
+ const hooks = settings.hooks;
4423
+ if (!hooks || !Array.isArray(hooks.Stop)) {
4424
+ warn("No Basestream hook installed");
4425
+ return false;
4426
+ }
4427
+ const before = hooks.Stop.length;
4428
+ hooks.Stop = hooks.Stop.filter(
4429
+ (entry) => !entry.hooks?.some((h) => h.command?.includes(HOOK_MARKER2))
4430
+ );
4431
+ const after = hooks.Stop.length;
4432
+ if (before === after) {
4433
+ warn("No Basestream hook installed");
4434
+ return false;
4435
+ }
4436
+ if (hooks.Stop.length === 0) {
4437
+ delete hooks.Stop;
4438
+ }
4439
+ if (Object.keys(hooks).length === 0) {
4440
+ delete settings.hooks;
4441
+ }
4442
+ fs6.writeFileSync(CLAUDE_SETTINGS_PATH2, JSON.stringify(settings, null, 2));
4443
+ check("Removed tracking hook from ~/.claude/settings.json");
4444
+ return true;
4445
+ }
4446
+ async function uninstall() {
4447
+ console.log();
4448
+ removeClaudeCodeHook();
4449
+ console.log();
4450
+ console.log(
4451
+ ` ${c.dim("Basestream will no longer track new Claude Code sessions.")}`
4452
+ );
4453
+ console.log(
4454
+ ` ${c.dim("Your ~/.basestream/ buffer and credentials are preserved.")}`
4455
+ );
4456
+ console.log();
4457
+ }
4458
+
4404
4459
  // src/cli/index.ts
4405
4460
  var HELP = `
4406
4461
  basestream \u2014 AI work intelligence for teams
@@ -4413,6 +4468,7 @@ Commands:
4413
4468
  basestream login Authenticate with your Basestream account
4414
4469
  basestream status Show this week's logged sessions
4415
4470
  basestream sync Manually sync buffered entries to Basestream
4471
+ basestream uninstall Remove the Claude Code tracking hook
4416
4472
 
4417
4473
  Options:
4418
4474
  --help, -h Show this help message
@@ -4425,7 +4481,7 @@ async function main() {
4425
4481
  process.exit(0);
4426
4482
  }
4427
4483
  if (command === "--version" || command === "-v") {
4428
- console.log(true ? "0.2.0" : "dev");
4484
+ console.log(true ? "0.2.1" : "dev");
4429
4485
  process.exit(0);
4430
4486
  }
4431
4487
  switch (command || "init") {
@@ -4443,6 +4499,10 @@ async function main() {
4443
4499
  case "sync":
4444
4500
  await sync();
4445
4501
  break;
4502
+ case "uninstall":
4503
+ await uninstall();
4504
+ process.exit(0);
4505
+ break;
4446
4506
  case "_hook-stop":
4447
4507
  await hookStop();
4448
4508
  break;
package/package.json CHANGED
@@ -18,5 +18,5 @@
18
18
  "unlink:cli": "npm unlink -g @basestream/cli"
19
19
  },
20
20
  "type": "module",
21
- "version": "0.2.0"
21
+ "version": "0.2.1"
22
22
  }