dsh-gitnexus-plus 0.1.3 → 0.1.4

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 (56) hide show
  1. package/README-CN.md +22 -7
  2. package/README.md +41 -8
  3. package/lib/bin/graph-helper.d.ts +21 -0
  4. package/lib/bin/graph-helper.d.ts.map +1 -0
  5. package/lib/bin/graph-helper.js +71 -0
  6. package/lib/bin/graph-helper.js.map +1 -0
  7. package/lib/client.js +4081 -2370
  8. package/lib/gitnexus/analyze.d.ts +48 -8
  9. package/lib/gitnexus/analyze.d.ts.map +1 -1
  10. package/lib/gitnexus/analyze.js +345 -84
  11. package/lib/gitnexus/analyze.js.map +1 -1
  12. package/lib/gitnexus/commands.d.ts +8 -1
  13. package/lib/gitnexus/commands.d.ts.map +1 -1
  14. package/lib/gitnexus/commands.js +19 -0
  15. package/lib/gitnexus/commands.js.map +1 -1
  16. package/lib/gitnexus/delta.d.ts +144 -0
  17. package/lib/gitnexus/delta.d.ts.map +1 -0
  18. package/lib/gitnexus/delta.js +347 -0
  19. package/lib/gitnexus/delta.js.map +1 -0
  20. package/lib/gitnexus/git-activity.d.ts +13 -21
  21. package/lib/gitnexus/git-activity.d.ts.map +1 -1
  22. package/lib/gitnexus/git-activity.js +60 -26
  23. package/lib/gitnexus/git-activity.js.map +1 -1
  24. package/lib/gitnexus/graph.d.ts +126 -0
  25. package/lib/gitnexus/graph.d.ts.map +1 -0
  26. package/lib/gitnexus/graph.js +472 -0
  27. package/lib/gitnexus/graph.js.map +1 -0
  28. package/lib/gitnexus/root.d.ts +0 -3
  29. package/lib/gitnexus/root.d.ts.map +1 -1
  30. package/lib/gitnexus/root.js +64 -5
  31. package/lib/gitnexus/root.js.map +1 -1
  32. package/lib/gitnexus/search.d.ts +21 -8
  33. package/lib/gitnexus/search.d.ts.map +1 -1
  34. package/lib/gitnexus/search.js +87 -13
  35. package/lib/gitnexus/search.js.map +1 -1
  36. package/lib/index.d.ts +6 -0
  37. package/lib/index.d.ts.map +1 -1
  38. package/lib/index.js +165 -3
  39. package/lib/index.js.map +1 -1
  40. package/lib/routes/analyze.d.ts +3 -2
  41. package/lib/routes/analyze.d.ts.map +1 -1
  42. package/lib/routes/analyze.js +8 -2
  43. package/lib/routes/analyze.js.map +1 -1
  44. package/lib/routes/delta.d.ts +22 -0
  45. package/lib/routes/delta.d.ts.map +1 -0
  46. package/lib/routes/delta.js +50 -0
  47. package/lib/routes/delta.js.map +1 -0
  48. package/lib/routes/file-diff.d.ts +19 -0
  49. package/lib/routes/file-diff.d.ts.map +1 -0
  50. package/lib/routes/file-diff.js +69 -0
  51. package/lib/routes/file-diff.js.map +1 -0
  52. package/lib/routes/graph.d.ts +22 -0
  53. package/lib/routes/graph.d.ts.map +1 -0
  54. package/lib/routes/graph.js +71 -0
  55. package/lib/routes/graph.js.map +1 -0
  56. package/package.json +2 -2
@@ -21,11 +21,18 @@
21
21
  *
22
22
  * THE ONE RULE THAT MATTERS
23
23
  * -------------------------
24
- * `sandboxPolicy` is never set here, and must never be. Passing it would be this
25
- * plugin choosing its own confinement — the escalation the approval service exists to
26
- * gate, requested through a door that cannot ask. Leaving it undefined takes the
27
- * deployment's decision. A denial is then reported as a denial, not retried wider:
28
- * the same rule the subagent prompt states, for the same reason.
24
+ * This runner never **constructs** a sandbox policy and never chooses a mode. It may
25
+ * forward a policy the host resolved (`options.sandboxPolicy`), and the host may only
26
+ * fill in the workspace root — see `src/index.ts`. The reason is measured, not
27
+ * theoretical: an agentless route has no session, so `sandboxPolicy.resolve()` falls
28
+ * back to `config.workspaceRoot ?? process.cwd()` and the sandbox derives its write
29
+ * capability SID from *that* path. The repository's own grant then never applies, and
30
+ * every write inside `.gitnexus` is refused — the failure this plugin reported as
31
+ * "sandbox denies .gitnexus". Supplying the workspace root is not escalation: the mode
32
+ * still comes from the deployment, and a read-only deployment stays read-only.
33
+ *
34
+ * A denial is reported as a denial, not retried wider: the same rule the subagent
35
+ * prompt states, for the same reason.
29
36
  */
30
37
  import { type ToolchainOptions } from './toolchain.js';
31
38
  /** Where a run got to. `unavailable` is decided before anything is spawned. */
@@ -41,8 +48,16 @@ export interface AnalyzeStatus {
41
48
  state: AnalyzeState;
42
49
  /** Whether this run was a full rebuild (`--force`). */
43
50
  force: boolean;
51
+ /**
52
+ * Whether this run repaired the search indexes (`--repair-fts`) instead of
53
+ * re-analysing. Mutually exclusive with `force`: they ask for opposite things, and
54
+ * the route never sets both.
55
+ */
56
+ repairFts: boolean;
44
57
  /** The command as run, so a failure can be reproduced by hand. */
45
58
  command: string;
59
+ /** How many times the command was spawned. 2 means the transient-lock retry ran. */
60
+ attempts: number;
46
61
  startedAt: number;
47
62
  finishedAt: number | null;
48
63
  exitCode: number | null;
@@ -64,6 +79,12 @@ export interface ShellRequestLike {
64
79
  onExpiry?: 'kill' | 'none';
65
80
  stdoutMaxBytes?: number;
66
81
  signal?: AbortSignal;
82
+ /**
83
+ * A policy the host resolved for this call. The runner forwards it unchanged and
84
+ * never builds one; see the module comment for why the workspace root has to travel
85
+ * with the call at all.
86
+ */
87
+ sandboxPolicy?: unknown;
67
88
  }
68
89
  export interface ShellResultLike {
69
90
  exitCode?: number | null;
@@ -116,22 +137,39 @@ export interface AnalyzeRunnerOptions {
116
137
  * measured to fail with `spawn EPERM` on an index without FTS (the extension tries
117
138
  * to install out-of-process), while a static `true` forces a full rebuild on one
118
139
  * that has it.
140
+ *
141
+ * Ignored when `repairFts` is requested: that run exists to build the FTS indexes,
142
+ * so skipping them would make it a no-op with a success exit code.
119
143
  */
120
144
  skipFts?: boolean;
121
145
  /** Override the redirect of the global registry write. */
122
146
  gitnexusHome?: string | null;
147
+ /**
148
+ * Wait before the single transient-lock retry. Short in tests, long enough in
149
+ * production for a scanner that briefly holds `.gitnexus` to let go.
150
+ */
151
+ retryDelayMs?: number;
152
+ /**
153
+ * The sandbox policy for one repository, resolved by the host.
154
+ *
155
+ * Optional: a deployment without a `sandboxPolicy` service passes nothing, and the
156
+ * shell keeps its own default. The runner does not inspect or alter the value.
157
+ */
158
+ sandboxPolicy?: (repoPath: string) => unknown;
123
159
  now?: () => number;
124
160
  }
125
161
  export interface AnalyzeRunner {
126
162
  /**
127
163
  * Begin a run, or report the one already in flight for this repository.
128
164
  *
129
- * `force` selects a full rebuild. It is a request, not a second run: two analyze
130
- * processes on one store contend, so a force request while an incremental run is
131
- * in flight returns that run.
165
+ * `force` selects a full rebuild and `repairFts` selects an FTS-only repair. They are
166
+ * requests, not additional runs: two analyze processes on one store contend, so a
167
+ * request while a run is in flight returns that run — and `repairFts` wins over
168
+ * `force` when a caller passes both, because repairing is the smaller claim.
132
169
  */
133
170
  start(repoPath: string, options?: {
134
171
  force?: boolean;
172
+ repairFts?: boolean;
135
173
  }): AnalyzeStatus;
136
174
  status(repoPath: string): AnalyzeStatus | null;
137
175
  cancel(repoPath: string): boolean;
@@ -165,6 +203,8 @@ export declare function analyzeCommandLine(cliPath: string, repoPath: string, op
165
203
  viaNode?: boolean;
166
204
  /** Full rebuild. This is the destructive escape hatch; the button must say so. */
167
205
  force?: boolean;
206
+ /** Repair the search (FTS) indexes only. Never combined with `skipFts`. */
207
+ repairFts?: boolean;
168
208
  /** Must match `maintenanceCommands`; see the note on the runner option. */
169
209
  skipFts?: boolean;
170
210
  gitnexusHome?: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/gitnexus/analyze.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAExE,+EAA+E;AAC/E,MAAM,MAAM,YAAY;AACtB,oEAAoE;AAClE,aAAa,GACb,SAAS,GACT,MAAM;AACR,2CAA2C;GACzC,QAAQ,GACR,WAAW,GACX,WAAW;AACb,kEAAkE;GAChE,QAAQ,CAAC;AAEb,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,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