@getchomp/cli 0.0.0-stage → 0.2.43

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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -2
  3. package/dist/commands/analyze.d.ts +49 -0
  4. package/dist/commands/analyze.js +280 -0
  5. package/dist/commands/connect.d.ts +12 -0
  6. package/dist/commands/connect.js +255 -0
  7. package/dist/commands/export.d.ts +29 -0
  8. package/dist/commands/export.js +356 -0
  9. package/dist/commands/health.d.ts +19 -0
  10. package/dist/commands/health.js +259 -0
  11. package/dist/commands/init.d.ts +40 -0
  12. package/dist/commands/init.js +659 -0
  13. package/dist/commands/mcp.d.ts +2 -0
  14. package/dist/commands/mcp.js +12 -0
  15. package/dist/commands/plugin.d.ts +8 -0
  16. package/dist/commands/plugin.js +198 -0
  17. package/dist/commands/ui.d.ts +20 -0
  18. package/dist/commands/ui.js +252 -0
  19. package/dist/commands/uninstall.d.ts +8 -0
  20. package/dist/commands/uninstall.js +246 -0
  21. package/dist/index.d.ts +3 -0
  22. package/dist/index.js +37 -0
  23. package/dist/ports/portHydrator.d.ts +63 -0
  24. package/dist/ports/portHydrator.js +954 -0
  25. package/dist/ports/portHydratorWorker.d.ts +22 -0
  26. package/dist/ports/portHydratorWorker.js +75 -0
  27. package/dist/server/buildStatusTracker.d.ts +45 -0
  28. package/dist/server/buildStatusTracker.js +122 -0
  29. package/dist/server/graphLayoutState.d.ts +205 -0
  30. package/dist/server/graphLayoutState.js +930 -0
  31. package/dist/server/loopbackSecurity.d.ts +18 -0
  32. package/dist/server/loopbackSecurity.js +57 -0
  33. package/dist/server/routes/authSourceRoutes.d.ts +18 -0
  34. package/dist/server/routes/authSourceRoutes.js +231 -0
  35. package/dist/server/routes/layoutRoutes.d.ts +3 -0
  36. package/dist/server/routes/layoutRoutes.js +857 -0
  37. package/dist/server/routes/pluginRoutes.d.ts +3 -0
  38. package/dist/server/routes/pluginRoutes.js +368 -0
  39. package/dist/server/routes/viewRulesRoutes.d.ts +3 -0
  40. package/dist/server/routes/viewRulesRoutes.js +173 -0
  41. package/dist/server/uiHotkeys.d.ts +26 -0
  42. package/dist/server/uiHotkeys.js +160 -0
  43. package/dist/utils/branding.d.ts +126 -0
  44. package/dist/utils/branding.js +978 -0
  45. package/dist/utils/credentials.d.ts +22 -0
  46. package/dist/utils/credentials.js +126 -0
  47. package/dist/utils/git.d.ts +95 -0
  48. package/dist/utils/git.js +780 -0
  49. package/dist/utils/masterContext.d.ts +112 -0
  50. package/dist/utils/masterContext.js +642 -0
  51. package/dist/visualizer/cloudLayoutClient.d.ts +84 -0
  52. package/dist/visualizer/cloudLayoutClient.js +1200 -0
  53. package/dist/visualizer/layoutCache.d.ts +25 -0
  54. package/dist/visualizer/layoutCache.js +406 -0
  55. package/dist/visualizer/localEngineBridge.d.ts +50 -0
  56. package/dist/visualizer/localEngineBridge.js +80 -0
  57. package/dist/visualizer/pluginPresentationApi.d.ts +111 -0
  58. package/dist/visualizer/pluginPresentationApi.js +432 -0
  59. package/dist/visualizer/rulesConfig.d.ts +11 -0
  60. package/dist/visualizer/rulesConfig.js +266 -0
  61. package/dist/visualizer/sourceAccess.d.ts +45 -0
  62. package/dist/visualizer/sourceAccess.js +204 -0
  63. package/package.json +52 -3
@@ -0,0 +1,112 @@
1
+ import { getGitRepoIdentity, isLinkedGitWorktree, resolveRepoName, sharesGitRepository } from "./git.js";
2
+ export { getGitRepoIdentity, isLinkedGitWorktree, resolveRepoName, sharesGitRepository };
3
+ export interface RecentChompRepo {
4
+ id: string;
5
+ name: string;
6
+ path: string;
7
+ lastConnectedAt: string;
8
+ }
9
+ export interface ChompMasterContext {
10
+ activeRepoId: string;
11
+ activeRepoPath: string;
12
+ activeRepoName: string;
13
+ masterRoot: string;
14
+ updatedAt: string;
15
+ recentRepos: RecentChompRepo[];
16
+ }
17
+ export declare function getChompMasterRoot(): string;
18
+ /**
19
+ * Resolves the canonical primary checkout for the Chomp master repository.
20
+ * If the current CLI is running inside a linked Git worktree (`git worktree add`),
21
+ * maps back to the primary checkout root when it contains `packages/cli/src/index.ts`
22
+ * so global `~/.local/bin/chomp` shims and fallback context never get hijacked by
23
+ * ephemeral worktrees.
24
+ */
25
+ export declare function getCanonicalChompMasterRoot(rawMasterRoot?: string): string;
26
+ export declare function isChompMasterMonorepo(root?: string): boolean;
27
+ /**
28
+ * Resolves a globally installed `chomp` CLI binary on `$PATH` or `~/.local/bin/chomp`,
29
+ * ignoring ephemeral `npx` / `pnpm dlx` temporary cache directories.
30
+ */
31
+ export declare function resolveGlobalChompBinary(env?: NodeJS.ProcessEnv, homeDirOverride?: string): string | null;
32
+ export declare function hasPrivateResearchLedger(): boolean;
33
+ export declare function getGlobalContextPath(): string;
34
+ export declare function getWorkspaceFallbackContextPath(): string;
35
+ export declare function resolveGitRepoRoot(inputPath: string): string;
36
+ export declare function readMasterContext(): ChompMasterContext | null;
37
+ export type ResolvedCliTargetMode = "explicit" | "local" | "tethered" | "worktree";
38
+ /**
39
+ * Resolves the target repository path for CLI commands (`chomp ui`, `chomp analyze`, `chomp health`).
40
+ *
41
+ * - When `inputPath` is explicitly passed (`.`, `./subpath`, `express`, `chomp`), resolves that explicit target
42
+ * (including short names inside `fixtures/cloned-repos/<name>`).
43
+ * - When `inputPath` is omitted (`undefined`):
44
+ * 1. Linked Git worktrees ALWAYS resolve to the current worktree (`mode: "worktree"`), never jumping
45
+ * to `main` or another worktree.
46
+ * 2. If the caller's repo shares the same underlying Git repository (`commonDir`) as the tethered repo
47
+ * (e.g. `main` vs a linked worktree of `chomp`), always prefer the caller's checkout (`mode: "local"`).
48
+ * 3. When inside the primary Chomp master repository and tethered to a *different* external repository
49
+ * (e.g. `chomp connect express`), follow the Master Tether (`[PAT-CLI-14]`, `mode: "tethered"`).
50
+ * 4. When inside any other initialized Git/Chomp repository (e.g. `~/code/my-app`), prefer that local
51
+ * repository (`[PAT-CLI-13]`, `mode: "local"`).
52
+ * 5. When outside any repository and `preferTetherWhenNoArg` is true, fall back to the active Master Tether.
53
+ */
54
+ export declare function resolveDefaultCliTarget(inputPath: string | undefined, baseDir?: string, preferTetherWhenNoArg?: boolean): {
55
+ targetPath: string;
56
+ explicit: boolean;
57
+ mode: ResolvedCliTargetMode;
58
+ };
59
+ export interface SetActiveChompTargetOptions {
60
+ /**
61
+ * When true (e.g. explicit `chomp connect`), permits writing a linked Git worktree path
62
+ * into `~/.chomp/context.json`. Passive commands (`chomp analyze`, `chomp ui`) leave this
63
+ * false so background worktree activity never hijacks global context.
64
+ */
65
+ allowWorktree?: boolean;
66
+ }
67
+ export declare function setActiveChompTarget(targetPath: string, options?: SetActiveChompTargetOptions): ChompMasterContext;
68
+ /**
69
+ * Removes an uninstalled repository from `~/.chomp/context.json` (`recentRepos`),
70
+ * switching `activeRepoPath` to the next valid recent repo (or canonical master monorepo)
71
+ * when available, or clearing `~/.chomp/context.json` cleanly in standalone NPM installs
72
+ * so ephemeral `_npx/.../node_modules` paths are never persisted as active targets.
73
+ */
74
+ export declare function clearRemovedChompTarget(removedPath: string): {
75
+ switchedTo: string | null;
76
+ cleared: boolean;
77
+ };
78
+ /**
79
+ * Resolves the `.git` directory for a repository or git worktree and adds `.chomp/`
80
+ * (and optional extra patterns) to `.git/info/exclude` so Chomp never dirties `.gitignore`
81
+ * or `git status` in external repositories.
82
+ */
83
+ export declare function ensureGitExcludeHasChomp(repoRoot: string, extraEntries?: string[]): boolean;
84
+ /**
85
+ * Discovers all cloned repos under `<masterRoot>/fixtures/cloned-repos/*` plus `recentRepos`.
86
+ */
87
+ export declare function listKnownTargetRepos(): Array<{
88
+ name: string;
89
+ path: string;
90
+ source: "active" | "recent" | "cloned-fixture" | "master";
91
+ isActive: boolean;
92
+ hasGraphDb: boolean;
93
+ }>;
94
+ /**
95
+ * Installs global `chomp` and `chomp-research` CLI shims into `~/.local/bin` (which is on PATH)
96
+ * so the user can run `chomp init`, `chomp connect`, `chomp analyze`, `chomp health`,
97
+ * and `chomp ui` from any directory on the machine without installing `@getchomp/cli` into target repos.
98
+ *
99
+ * Worktree safety: resolves linked Git worktrees back to the primary checkout so ephemeral
100
+ * worktrees never hijack `~/.local/bin/chomp` unless `CHOMP_ALLOW_WORKTREE_SHIM=1` (or
101
+ * `options.allowWorktree === true`) is explicitly passed.
102
+ */
103
+ export declare function installGlobalChompShims(binDir?: string, options?: {
104
+ allowWorktree?: boolean;
105
+ }): {
106
+ chompShimPath: string;
107
+ researchShimPath: string;
108
+ chompBin: string;
109
+ researchBin: string;
110
+ skippedWorktreeOverwrite?: boolean;
111
+ targetMasterRoot?: string;
112
+ };