skalpel 3.4.19 → 4.0.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.
Files changed (55) hide show
  1. package/README.md +29 -37
  2. package/auth.mjs +179 -0
  3. package/{prosumer-hooks/bootstrap.mjs → bootstrap.mjs} +14 -8
  4. package/{prosumer-hooks/incremental-ingest.mjs → incremental-ingest.mjs} +5 -10
  5. package/{prosumer-hooks/install.mjs → install.mjs} +6 -9
  6. package/login.mjs +164 -0
  7. package/package.json +17 -57
  8. package/postinstall.mjs +68 -0
  9. package/skalpel-setup.mjs +896 -0
  10. package/{prosumer-hooks/skalpel-statusline.mjs → skalpel-statusline.mjs} +1 -2
  11. package/INSTALL.md +0 -250
  12. package/LICENSE +0 -201
  13. package/design-tokens.json +0 -52
  14. package/npm-bin/colors.js +0 -125
  15. package/npm-bin/skalpel.bug-0039.test.js +0 -232
  16. package/npm-bin/skalpel.js +0 -517
  17. package/npm-bin/skalpeld.js +0 -20
  18. package/postinstall/index.js +0 -277
  19. package/postinstall/index.test.js +0 -147
  20. package/postinstall/launchd/com.skalpel.skalpeld.plist.tmpl +0 -46
  21. package/postinstall/lib/ca-install.js +0 -268
  22. package/postinstall/lib/ca-install.test.js +0 -327
  23. package/postinstall/lib/detect-prior.js +0 -62
  24. package/postinstall/lib/env-inject.js +0 -105
  25. package/postinstall/lib/integrations.js +0 -207
  26. package/postinstall/lib/launch.js +0 -38
  27. package/postinstall/lib/log.js +0 -31
  28. package/postinstall/lib/paths.js +0 -236
  29. package/postinstall/lib/prosumer-hooks.js +0 -146
  30. package/postinstall/lib/prosumer-hooks.test.js +0 -278
  31. package/postinstall/lib/rc-edit.js +0 -168
  32. package/postinstall/lib/rc-edit.test.js +0 -243
  33. package/postinstall/lib/run-tests.js +0 -59
  34. package/postinstall/lib/service-register.js +0 -248
  35. package/postinstall/lib/sign-in.js +0 -80
  36. package/postinstall/lib/template.js +0 -36
  37. package/postinstall/preinstall.js +0 -111
  38. package/postinstall/preinstall.test.js +0 -47
  39. package/postinstall/snippets/bash.sh.tmpl +0 -12
  40. package/postinstall/snippets/fish.fish.tmpl +0 -11
  41. package/postinstall/snippets/powershell.ps1.tmpl +0 -12
  42. package/postinstall/snippets/zsh.sh.tmpl +0 -13
  43. package/postinstall/systemd/skalpeld.service.tmpl +0 -34
  44. package/postinstall/uninstall.js +0 -98
  45. package/postinstall/windows/Task.xml.tmpl +0 -42
  46. package/postinstall/windows/register-task.ps1.tmpl +0 -45
  47. package/prosumer-hooks/auth.mjs +0 -93
  48. package/prosumer-hooks/bootstrap.test.mjs +0 -93
  49. package/prosumer-hooks/incremental-ingest.test.mjs +0 -320
  50. /package/{prosumer-hooks/insights.mjs → insights.mjs} +0 -0
  51. /package/{prosumer-hooks/metrics.mjs → metrics.mjs} +0 -0
  52. /package/{prosumer-hooks/skalpel-hook-session-end.mjs → skalpel-hook-session-end.mjs} +0 -0
  53. /package/{prosumer-hooks/skalpel-hook-session.mjs → skalpel-hook-session.mjs} +0 -0
  54. /package/{prosumer-hooks/skalpel-hook.mjs → skalpel-hook.mjs} +0 -0
  55. /package/{prosumer-hooks/stats.mjs → stats.mjs} +0 -0
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ // postinstall — runs on `npm install -g skalpel`. Two jobs, both fail-open (never break an install):
3
+ // 1) RETIRE the legacy Go daemon (skalpeld) if this machine has one from the old client — a stale
4
+ // crash-looping service is exactly the failure Nick hit, so we stop + disable + forget it.
5
+ // 2) Stage the read-only status line (non-intrusive). The prompt/session hooks are only wired once
6
+ // the user runs `skalpel` (login → full install), so a bare `npm i -g` never silently starts
7
+ // reading prompts.
8
+ import { spawnSync } from "node:child_process";
9
+ import { rmSync } from "node:fs";
10
+ import { homedir } from "node:os";
11
+ import { join, dirname } from "node:path";
12
+ import { fileURLToPath } from "node:url";
13
+
14
+ const DIR = dirname(fileURLToPath(import.meta.url));
15
+ const q = { stdio: "ignore" };
16
+
17
+ function retireLegacyDaemon() {
18
+ try {
19
+ if (process.platform === "darwin") {
20
+ // launchd label used by the old client
21
+ spawnSync("launchctl", ["remove", "ai.skalpel.daemon"], q);
22
+ spawnSync("launchctl", ["remove", "com.skalpel.skalpeld"], q);
23
+ for (const p of [
24
+ join(homedir(), "Library", "LaunchAgents", "ai.skalpel.daemon.plist"),
25
+ join(homedir(), "Library", "LaunchAgents", "com.skalpel.skalpeld.plist"),
26
+ ]) {
27
+ try {
28
+ rmSync(p, { force: true });
29
+ } catch {
30
+ /* not present */
31
+ }
32
+ }
33
+ } else if (process.platform === "linux") {
34
+ spawnSync("systemctl", ["--user", "stop", "skalpel-daemon.service"], q);
35
+ spawnSync("systemctl", ["--user", "disable", "skalpel-daemon.service"], q);
36
+ try {
37
+ rmSync(join(homedir(), ".config", "systemd", "user", "skalpel-daemon.service"), {
38
+ force: true,
39
+ });
40
+ } catch {
41
+ /* not present */
42
+ }
43
+ }
44
+ } catch {
45
+ /* never fail an install over daemon cleanup */
46
+ }
47
+ }
48
+
49
+ function stageStatusline() {
50
+ try {
51
+ // --statusline-only: stage the read-only indicator, do NOT wire prompt/session hooks yet.
52
+ spawnSync(process.execPath, [join(DIR, "install.mjs"), "--statusline-only"], {
53
+ stdio: "inherit",
54
+ });
55
+ } catch {
56
+ /* fail-open */
57
+ }
58
+ }
59
+
60
+ retireLegacyDaemon();
61
+ stageStatusline();
62
+
63
+ // A quiet nudge — the real onboarding (Google sign-in → build graph → insights) runs on `skalpel`.
64
+ if (process.stdout.isTTY && !process.env.CI) {
65
+ process.stdout.write(
66
+ "\n skalpel installed. Run \x1b[1mskalpel\x1b[22m to sign in and build your graph.\n\n",
67
+ );
68
+ }