gitnexus 1.6.13-rc.14 → 1.6.13-rc.16

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 (44) hide show
  1. package/dist/cli/analyze-config.d.ts +2 -6
  2. package/dist/cli/analyze-config.js +2 -16
  3. package/dist/core/git-ref.d.ts +22 -4
  4. package/dist/core/git-ref.js +49 -4
  5. package/dist/core/run-analyze.js +10 -4
  6. package/package.json +1 -1
  7. package/web/assets/{abnfDiagram-PAR5IXJI-CZ6gSCu8.js → abnfDiagram-PAR5IXJI-BbkO1pGM.js} +1 -1
  8. package/web/assets/{agent-BcP4Kpcj.js → agent-CJi9-qSV.js} +2 -2
  9. package/web/assets/{architectureDiagram-2PNWDENW-BAfOc3yI.js → architectureDiagram-2PNWDENW-DogGaV6A.js} +1 -1
  10. package/web/assets/{chunk-32MCUW2P-BZebPOGQ.js → chunk-32MCUW2P-Ctlz9gwz.js} +1 -1
  11. package/web/assets/{chunk-CLS4B6BI-BEuYM0E_.js → chunk-CLS4B6BI-CUaYtG_9.js} +1 -1
  12. package/web/assets/{chunk-NF366YI6-BY3yrc8a.js → chunk-NF366YI6-Qj4nm-M7.js} +1 -1
  13. package/web/assets/{chunk-SLDQ463B-ChYDDwtn.js → chunk-SLDQ463B-BV20g0Ip.js} +1 -1
  14. package/web/assets/{classDiagram-FGAMPOII-C3dR3bsh.js → classDiagram-FGAMPOII-BJ3tM2Pw.js} +1 -1
  15. package/web/assets/{classDiagram-v2-AI5RJEK4-C3dR3bsh.js → classDiagram-v2-AI5RJEK4-BJ3tM2Pw.js} +1 -1
  16. package/web/assets/{cynefinDiagram-2OOWUY4M-BuLv-rRR.js → cynefinDiagram-2OOWUY4M-tlBa8eNB.js} +1 -1
  17. package/web/assets/{dagre-MPVFI544-BC4tnLMr.js → dagre-MPVFI544-BYv3SuFs.js} +1 -1
  18. package/web/assets/{diagram-AE4NWXFW-hRNNsCQd.js → diagram-AE4NWXFW-CNU2EXJM.js} +1 -1
  19. package/web/assets/{diagram-BUJID5UG-B-X_fvQQ.js → diagram-BUJID5UG-NdiVLl-k.js} +1 -1
  20. package/web/assets/{diagram-C44CZ5NI-7m5nS6Z_.js → diagram-C44CZ5NI-Crd33kec.js} +1 -1
  21. package/web/assets/{diagram-EYOLEXXS-1Pr7B51e.js → diagram-EYOLEXXS-DSuOnVRp.js} +1 -1
  22. package/web/assets/{ebnfDiagram-FTPZ3PV6-BDSUlu10.js → ebnfDiagram-FTPZ3PV6-CZaFjKJN.js} +1 -1
  23. package/web/assets/{erDiagram-H3ERR26V-kbjZy-bt.js → erDiagram-H3ERR26V-k9RqGdZo.js} +1 -1
  24. package/web/assets/{flowDiagram-YHGXBVSY-C1dG8kZj.js → flowDiagram-YHGXBVSY-J9Z9GYtM.js} +1 -1
  25. package/web/assets/{index-CWGAaOYl.js → index-C7HdBqix.js} +31 -31
  26. package/web/assets/{infoDiagram-LV547AFH-BOWeLtfD.js → infoDiagram-LV547AFH-DIxUoHUu.js} +1 -1
  27. package/web/assets/{ishikawaDiagram-PUJQGNDS-COHpVAKM.js → ishikawaDiagram-PUJQGNDS-B17wOvKI.js} +1 -1
  28. package/web/assets/{kanban-definition-JSQERAZB-ixDeqOp6.js → kanban-definition-JSQERAZB-CkMxG6ux.js} +1 -1
  29. package/web/assets/{mindmap-definition-VBJCLQLM-CkrvZGX4.js → mindmap-definition-VBJCLQLM-D3NcUXdF.js} +1 -1
  30. package/web/assets/{node.browser-DMt6E8kY.js → node.browser-GepThmNa.js} +1 -1
  31. package/web/assets/{pegDiagram-7WILOQTJ-BtFAlmol.js → pegDiagram-7WILOQTJ-DK-8FVqJ.js} +1 -1
  32. package/web/assets/{pieDiagram-EFA7CBSB-DO5esEAA.js → pieDiagram-EFA7CBSB-B5a1nRL0.js} +1 -1
  33. package/web/assets/{railroadDiagram-5NIQVNLQ-BJXh258t.js → railroadDiagram-5NIQVNLQ-DX9znCx0.js} +1 -1
  34. package/web/assets/{requirementDiagram-SXREGOKZ-Dp46cCfz.js → requirementDiagram-SXREGOKZ-GuKNX_G7.js} +1 -1
  35. package/web/assets/{sequenceDiagram-52ZFIFDL-CYRp9pNg.js → sequenceDiagram-52ZFIFDL-BqvlsagX.js} +1 -1
  36. package/web/assets/{stateDiagram-3QAKPIVI-D_-C52kj.js → stateDiagram-3QAKPIVI-CGtuJb_I.js} +1 -1
  37. package/web/assets/{stateDiagram-v2-HN2P4RDZ-DzeIxtM9.js → stateDiagram-v2-HN2P4RDZ-B9XtRUVy.js} +1 -1
  38. package/web/assets/{swimlanes-QLVP42QD-BDgo4dIK.js → swimlanes-QLVP42QD-D6DRxdhV.js} +1 -1
  39. package/web/assets/{swimlanesDiagram-JKPDBFCN-Bn_G0zQi.js → swimlanesDiagram-JKPDBFCN-BbdS67fA.js} +1 -1
  40. package/web/assets/{timeline-definition-GS45XAXW-gtl0j-_E.js → timeline-definition-GS45XAXW-Nh9YvCo_.js} +1 -1
  41. package/web/assets/{vennDiagram-QIQU2ZRJ-D5-98YEs.js → vennDiagram-QIQU2ZRJ-ClVab1a4.js} +1 -1
  42. package/web/assets/{wardleyDiagram-U6YNM66N-IpgbUflV.js → wardleyDiagram-U6YNM66N-BRhCx1wz.js} +1 -1
  43. package/web/assets/{xychartDiagram-XJAZEDNM-CmLSNQLW.js → xychartDiagram-XJAZEDNM-uPLq3TT_.js} +1 -1
  44. package/web/index.html +1 -1
@@ -27,6 +27,8 @@
27
27
  * documented precedence). Conflicting *aliases at the same level* (e.g. both
28
28
  * `defaultBranch` and `branch`) are rejected.
29
29
  */
30
+ import { sanitizeDetectedBranch } from '../core/git-ref.js';
31
+ export { sanitizeDetectedBranch };
30
32
  import type { AnalyzeOptions } from './analyze-options.js';
31
33
  export declare const GITNEXUS_RC_FILENAME = ".gitnexusrc";
32
34
  /** Final fallback when no branch is configured or detectable. */
@@ -45,12 +47,6 @@ export declare class GitNexusRcError extends Error {
45
47
  * `core/git-ref.ts`; this wrapper keeps the CLI / `.gitnexusrc` error type.
46
48
  */
47
49
  export declare function validateBranchName(value: string, source: string): string;
48
- /**
49
- * Best-effort validation for an auto-detected branch (from git). Never throws —
50
- * returns `undefined` for anything unusable so the resolver falls back to the
51
- * next precedence tier.
52
- */
53
- export declare function sanitizeDetectedBranch(value: string | null | undefined): string | undefined;
54
50
  /**
55
51
  * Locate, read, parse, validate, and normalize `.gitnexusrc` at `repoRoot`.
56
52
  *
@@ -30,7 +30,8 @@
30
30
  import fs from 'node:fs';
31
31
  import path from 'node:path';
32
32
  import { readRepoControlFile } from '../config/repo-control-file.js';
33
- import { InvalidBranchError, validateBranchName as validateBranchNameCore, } from '../core/git-ref.js';
33
+ import { InvalidBranchError, sanitizeDetectedBranch, validateBranchName as validateBranchNameCore, } from '../core/git-ref.js';
34
+ export { sanitizeDetectedBranch };
34
35
  export const GITNEXUS_RC_FILENAME = '.gitnexusrc';
35
36
  /** Final fallback when no branch is configured or detectable. */
36
37
  export const DEFAULT_BRANCH_FALLBACK = 'main';
@@ -139,21 +140,6 @@ export function validateBranchName(value, source) {
139
140
  throw err;
140
141
  }
141
142
  }
142
- /**
143
- * Best-effort validation for an auto-detected branch (from git). Never throws —
144
- * returns `undefined` for anything unusable so the resolver falls back to the
145
- * next precedence tier.
146
- */
147
- export function sanitizeDetectedBranch(value) {
148
- if (!value)
149
- return undefined;
150
- try {
151
- return validateBranchName(value, 'detected branch');
152
- }
153
- catch {
154
- return undefined;
155
- }
156
- }
157
143
  const normalizeValue = (kind, value, key) => {
158
144
  const source = `${GITNEXUS_RC_FILENAME} "${key}"`;
159
145
  switch (kind) {
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Git ref-name validation used by both the CLI and the HTTP analyze route.
3
3
  *
4
- * Lives in `core/` so `server/api.ts` does not import `cli/analyze-config`
5
- * (that import closed a cli → server → cli cycle: `cli/serve.ts` already
6
- * imports `createServer`). The CLI keeps a thin wrapper that rethrows
7
- * {@link InvalidBranchError} as `GitNexusRcError`.
4
+ * Lives in `core/` so `server/api.ts` and `run-analyze.ts` do not import
5
+ * `cli/analyze-config` (that import closed a cli → server → cli cycle:
6
+ * `cli/serve.ts` already imports `createServer`). The CLI keeps a thin
7
+ * wrapper that rethrows {@link InvalidBranchError} as `GitNexusRcError`.
8
8
  */
9
9
  /**
10
10
  * Thrown when a user-supplied branch name fails {@link validateBranchName}.
@@ -20,3 +20,21 @@ export declare class InvalidBranchError extends Error {
20
20
  * branches use (`feature/foo-bar`, `release/1.2`, `develop`).
21
21
  */
22
22
  export declare function validateBranchName(value: string, source: string): string;
23
+ /**
24
+ * Best-effort validation for an auto-detected branch (from git). Returns the
25
+ * trimmed name, or `undefined` for anything unusable so callers fall back to
26
+ * the next precedence tier or leave the index unlabeled. Swallows
27
+ * {@link InvalidBranchError} only; unexpected errors are rethrown.
28
+ */
29
+ export declare function sanitizeDetectedBranch(value: string | null | undefined): string | undefined;
30
+ /**
31
+ * Render a rejected checkout name for `onLog`. Hidden / bidi / control code
32
+ * points become `\uXXXX` so a git-legal U+202E name cannot reverse the
33
+ * warning in a terminal. C1 controls (U+0080–U+009F, including NEL U+0085)
34
+ * and remaining Unicode whitespace (`/\s/` — NBSP, U+2028/U+2029, ideographic
35
+ * space, etc.) are not all in {@link isHiddenOrControl}; escape them the same
36
+ * way so the ASCII escape survives `stripControlCharacters` and the warning
37
+ * stays one line. ASCII `"` is escaped; other characters (including backticks)
38
+ * stay visible.
39
+ */
40
+ export declare function formatRejectedBranchForLog(value: string): string;
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Git ref-name validation used by both the CLI and the HTTP analyze route.
3
3
  *
4
- * Lives in `core/` so `server/api.ts` does not import `cli/analyze-config`
5
- * (that import closed a cli → server → cli cycle: `cli/serve.ts` already
6
- * imports `createServer`). The CLI keeps a thin wrapper that rethrows
7
- * {@link InvalidBranchError} as `GitNexusRcError`.
4
+ * Lives in `core/` so `server/api.ts` and `run-analyze.ts` do not import
5
+ * `cli/analyze-config` (that import closed a cli → server → cli cycle:
6
+ * `cli/serve.ts` already imports `createServer`). The CLI keeps a thin
7
+ * wrapper that rethrows {@link InvalidBranchError} as `GitNexusRcError`.
8
8
  */
9
9
  /** Git refs longer than this are almost certainly a mistake / injection attempt. */
10
10
  const BRANCH_MAX_LENGTH = 255;
@@ -112,3 +112,48 @@ export function validateBranchName(value, source) {
112
112
  }
113
113
  return trimmed;
114
114
  }
115
+ /**
116
+ * Best-effort validation for an auto-detected branch (from git). Returns the
117
+ * trimmed name, or `undefined` for anything unusable so callers fall back to
118
+ * the next precedence tier or leave the index unlabeled. Swallows
119
+ * {@link InvalidBranchError} only; unexpected errors are rethrown.
120
+ */
121
+ export function sanitizeDetectedBranch(value) {
122
+ if (!value)
123
+ return undefined;
124
+ try {
125
+ return validateBranchName(value, 'detected branch');
126
+ }
127
+ catch (err) {
128
+ if (err instanceof InvalidBranchError)
129
+ return undefined;
130
+ throw err;
131
+ }
132
+ }
133
+ /**
134
+ * Render a rejected checkout name for `onLog`. Hidden / bidi / control code
135
+ * points become `\uXXXX` so a git-legal U+202E name cannot reverse the
136
+ * warning in a terminal. C1 controls (U+0080–U+009F, including NEL U+0085)
137
+ * and remaining Unicode whitespace (`/\s/` — NBSP, U+2028/U+2029, ideographic
138
+ * space, etc.) are not all in {@link isHiddenOrControl}; escape them the same
139
+ * way so the ASCII escape survives `stripControlCharacters` and the warning
140
+ * stays one line. ASCII `"` is escaped; other characters (including backticks)
141
+ * stay visible.
142
+ */
143
+ export function formatRejectedBranchForLog(value) {
144
+ const shouldEscapeRejectedBranchChar = (cp, ch) => isHiddenOrControl(cp) || (cp >= 0x80 && cp <= 0x9f) || /\s/.test(ch);
145
+ let out = '';
146
+ for (const ch of value) {
147
+ const cp = ch.codePointAt(0);
148
+ if (cp !== undefined && shouldEscapeRejectedBranchChar(cp, ch)) {
149
+ out += `\\u${cp.toString(16).padStart(4, '0')}`;
150
+ continue;
151
+ }
152
+ if (ch === '"') {
153
+ out += '\\"';
154
+ continue;
155
+ }
156
+ out += ch;
157
+ }
158
+ return out;
159
+ }
@@ -61,7 +61,7 @@ import { isGitNexusManagedPath } from '../storage/gitnexus-managed-paths.js';
61
61
  import { getMaxFileSizeBytes } from './ingestion/utils/max-file-size.js';
62
62
  import { cacheRowCount, discardScopedEmbeddingSpills, disposeEmbeddingSpill, withEmbeddingSpillScope, emptyCachedEmbeddingsSnapshot, EmbeddingSpillReader, materializeCachedEmbeddings, normalizeCachedEmbeddings, snapshotEmbeddingDims, } from './embeddings/embedding-restore-spill.js';
63
63
  import { generateAIContextFiles } from '../cli/ai-context.js';
64
- import { sanitizeDetectedBranch } from '../cli/analyze-config.js';
64
+ import { formatRejectedBranchForLog, sanitizeDetectedBranch } from './git-ref.js';
65
65
  import { EMBEDDING_TABLE_NAME, EMBEDDING_DIMS, STALE_HASH_SENTINEL, SCHEMA_FINGERPRINT, schemaFingerprintMismatch, isSchemaFingerprintShaped, embeddingDimsMismatch, } from './lbug/schema.js';
66
66
  import { isSpringBeanCandidateSourceFile } from './ingestion/frameworks/spring/bean-catalog.js';
67
67
  import { isSpringBeanFactoryDeclaration } from './ingestion/frameworks/spring/bean-factories.js';
@@ -544,9 +544,11 @@ async function resolveWriteTarget(repoPath, options) {
544
544
  // validated (#2106 R1): a git ref the branch-name rules forbid becomes `null`
545
545
  // → the flat slot, matching that a later `--branch <that-ref>` query would
546
546
  // also be rejected. A normal ref round-trips index-time/query-time labels.
547
- const checkedOutBranch = repoHasGit
548
- ? (sanitizeDetectedBranch(getCurrentBranch(repoPath)) ?? null)
549
- : null;
547
+ // Keep the raw rejected name so `runFullAnalysis` can warn once after the
548
+ // lock settles. Detached / non-git / empty detect stay `null` here and silent.
549
+ const rawDetectedBranch = repoHasGit ? getCurrentBranch(repoPath) : null;
550
+ const checkedOutBranch = sanitizeDetectedBranch(rawDetectedBranch) ?? null;
551
+ const rejectedDetectedBranch = rawDetectedBranch != null && checkedOutBranch === null ? rawDetectedBranch : null;
550
552
  // Analyze indexes the working tree, not an arbitrary ref. An explicit
551
553
  // `--branch X` while a DIFFERENT branch Y is checked out would write Y's
552
554
  // content into X's slot, corrupting X (#2106). Refuse the mismatch. Detached
@@ -565,6 +567,7 @@ async function resolveWriteTarget(repoPath, options) {
565
567
  repoHasGit,
566
568
  currentCommit,
567
569
  checkedOutBranch,
570
+ rejectedDetectedBranch,
568
571
  branchLabel,
569
572
  placement,
570
573
  lbugPath,
@@ -655,6 +658,9 @@ export async function runFullAnalysis(repoPath, options, callbacks, runnerIdenti
655
658
  log('Index write target still moving after repeated re-acquire; proceeding on this lock.');
656
659
  }
657
660
  }
661
+ if (writeTarget.rejectedDetectedBranch) {
662
+ log(`Warning: checkout "${formatRejectedBranchForLog(writeTarget.rejectedDetectedBranch)}" is not a usable index label; continuing.`);
663
+ }
658
664
  return await runFullAnalysisInner(repoPath, options, callbacks, writeTarget, contentRetention, runnerIdentityAtBootstrap);
659
665
  }
660
666
  finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexus",
3
- "version": "1.6.13-rc.14",
3
+ "version": "1.6.13-rc.16",
4
4
  "description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
5
5
  "author": "Abhigyan Patwari",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",
@@ -1 +1 @@
1
- import{t as e}from"./chunk-AQ6EADP3-CZhslHi-.js";import{q as t}from"./chunk-H7VHZCWX-DeYY8PhK.js";import"./chunk-QJSWEUOL-Z1JC3KaI.js";import"./index-CWGAaOYl.js";import{n,r,t as i}from"./chunk-SLDQ463B-ChYDDwtn.js";import{t as a}from"./chunk-JQRUD6KW-Dbva2Z17.js";import{M as o,b as s}from"./chunk-ZUNWM646-DK-0GkFY.js";var c=s().RailroadAbnf.parser.LangiumParser,l=e(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=e(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=e(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=e(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=e(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=e(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=e(e=>{a(e,r),e.title&&r.setTitle(e.title),e.rules.map(e=>r.addRule(m(e)))},`populateDb`),g={parser:{parse:e(e=>{r.clear(),t.debug(`[ABNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new o(n);let i=n.value;t.debug(`[ABNF Parser] Parsed rules:`,i.rules.length),h(i),t.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:r}},db:r,renderer:n,styles:i};export{g as diagram};
1
+ import{t as e}from"./chunk-AQ6EADP3-CZhslHi-.js";import{q as t}from"./chunk-H7VHZCWX-DeYY8PhK.js";import"./chunk-QJSWEUOL-Z1JC3KaI.js";import"./index-C7HdBqix.js";import{n,r,t as i}from"./chunk-SLDQ463B-BV20g0Ip.js";import{t as a}from"./chunk-JQRUD6KW-Dbva2Z17.js";import{M as o,b as s}from"./chunk-ZUNWM646-DK-0GkFY.js";var c=s().RailroadAbnf.parser.LangiumParser,l=e(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=e(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=e(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=e(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=e(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=e(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=e(e=>{a(e,r),e.title&&r.setTitle(e.title),e.rules.map(e=>r.addRule(m(e)))},`populateDb`),g={parser:{parse:e(e=>{r.clear(),t.debug(`[ABNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new o(n);let i=n.value;t.debug(`[ABNF Parser] Parsed rules:`,i.rules.length),h(i),t.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:r}},db:r,renderer:n,styles:i};export{g as diagram};