gitnexus 1.6.4-rc.100 → 1.6.4-rc.101

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.
@@ -48,6 +48,8 @@ export { buildScopeTree, canParentScope, ScopeTreeInvariantError, } from './scop
48
48
  export type { ScopeTree } from './scope-resolution/scope-tree.js';
49
49
  export { buildPositionIndex } from './scope-resolution/position-index.js';
50
50
  export type { PositionIndex } from './scope-resolution/position-index.js';
51
+ export { UNDERSTAND_QUICKLY_DISPATCH_URL, UNDERSTAND_QUICKLY_EVENT_TYPE, UNDERSTAND_QUICKLY_TOKEN_ENV, buildUqDispatchPayload, isValidOwnerRepo, parseOwnerRepoFromRemote, stripGitSuffix, } from './integrations/understand-quickly.js';
52
+ export type { UqDispatchPayload } from './integrations/understand-quickly.js';
51
53
  export { diffResolutions } from './scope-resolution/shadow/diff.js';
52
54
  export type { ShadowAgreement, ShadowCallsite, ShadowDiff, } from './scope-resolution/shadow/diff.js';
53
55
  export { aggregateDiffs } from './scope-resolution/shadow/aggregate.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,WAAW,EACX,cAAc,EACd,SAAS,EACT,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACjG,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAIrE,YA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AAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,YAAY,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAG1E,OAAO,EACL,+BAA+B,EAC/B,6BAA6B,EAC7B,4BAA4B,EAC5B,sBAAsB,EACtB,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,GACf,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAG9E,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,YAAY,EACV,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC"}
@@ -33,6 +33,8 @@ export { CLASS_KINDS, METHOD_KINDS, FIELD_KINDS } from './scope-resolution/regis
33
33
  export { makeScopeId, clearScopeIdInternPool } from './scope-resolution/scope-id.js';
34
34
  export { buildScopeTree, canParentScope, ScopeTreeInvariantError, } from './scope-resolution/scope-tree.js';
35
35
  export { buildPositionIndex } from './scope-resolution/position-index.js';
36
+ // Understand-Quickly registry integration (opt-in)
37
+ export { UNDERSTAND_QUICKLY_DISPATCH_URL, UNDERSTAND_QUICKLY_EVENT_TYPE, UNDERSTAND_QUICKLY_TOKEN_ENV, buildUqDispatchPayload, isValidOwnerRepo, parseOwnerRepoFromRemote, stripGitSuffix, } from './integrations/understand-quickly.js';
36
38
  // Shadow-mode diff + aggregation (RFC §6.3; Ring 2 SHARED #918)
37
39
  export { diffResolutions } from './scope-resolution/shadow/diff.js';
38
40
  export { aggregateDiffs } from './scope-resolution/shadow/aggregate.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,mBAAmB;AACnB,OA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,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AAMvF,uEAAuE;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAUpE,sEAAsE;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AAKvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAKrF,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AAEpF,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAEpG,OAAO,EACL,gCAAgC,EAChC,kBAAkB,GACnB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAQlG,2EAA2E;AAC3E,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAErF,OAAO,EACL,cAAc,EACd,cAAc,EACd,uBAAuB,GACxB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,mDAAmD;AACnD,OAAO,EACL,+BAA+B,EAC/B,6BAA6B,EAC7B,4BAA4B,EAC5B,sBAAsB,EACtB,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,GACf,MAAM,sCAAsC,CAAC;AAG9C,gEAAgE;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAMpE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Understand-Quickly registry integration helpers.
3
+ *
4
+ * Pure, runtime-agnostic logic for opting in to publishing a GitNexus
5
+ * index to the [`looptech-ai/understand-quickly`](https://github.com/looptech-ai/understand-quickly)
6
+ * registry. Lives in `gitnexus-shared` so both the Node CLI and any
7
+ * future browser-side surface can construct identical dispatch payloads.
8
+ *
9
+ * Network I/O lives in the CLI command (`gitnexus/src/cli/publish.ts`)
10
+ * to keep this module free of Node-only imports — see the comment at
11
+ * the top of `gitnexus-shared/src/graph/types.ts`.
12
+ *
13
+ * The protocol contract (single dispatch event, no graph upload) is
14
+ * documented at:
15
+ * https://github.com/looptech-ai/understand-quickly/blob/main/docs/integrations/protocol.md
16
+ */
17
+ /**
18
+ * URL of the registry repo's repository_dispatch endpoint. Hardcoded
19
+ * because the registry is the canonical home for this integration —
20
+ * users who want a private registry can fork and patch.
21
+ */
22
+ export declare const UNDERSTAND_QUICKLY_DISPATCH_URL = "https://api.github.com/repos/looptech-ai/understand-quickly/dispatches";
23
+ /**
24
+ * Event type the registry's sync workflow listens for.
25
+ * See `looptech-ai/understand-quickly/.github/workflows/sync.yml`.
26
+ */
27
+ export declare const UNDERSTAND_QUICKLY_EVENT_TYPE = "sync-entry";
28
+ /** Environment variable that gates the dispatch. */
29
+ export declare const UNDERSTAND_QUICKLY_TOKEN_ENV = "UNDERSTAND_QUICKLY_TOKEN";
30
+ export interface UqDispatchPayload {
31
+ event_type: typeof UNDERSTAND_QUICKLY_EVENT_TYPE;
32
+ client_payload: {
33
+ /** `<owner>/<repo>` shape — must match the registered entry. */
34
+ id: string;
35
+ };
36
+ }
37
+ /**
38
+ * Build the JSON body for the `repository_dispatch` ping. Pure — no
39
+ * env reads, no network. Validates that `id` looks like `owner/repo`
40
+ * (one slash, no whitespace, both halves non-empty) so a misconfigured
41
+ * caller fails loudly before the round-trip.
42
+ */
43
+ export declare function buildUqDispatchPayload(id: string): UqDispatchPayload;
44
+ /**
45
+ * `owner/repo` validation. Conservative on purpose: GitHub's actual
46
+ * naming rules are looser, but we want to catch local paths
47
+ * (`/Users/...`), bare slugs (`my-repo`), and accidental whitespace.
48
+ *
49
+ * Matches GitHub's published slug rules:
50
+ * owner: starts with alnum, then alnum/hyphen only, must end with
51
+ * alnum (no trailing hyphen — GitHub rejects this at account
52
+ * creation, so a `my-org-/repo` input would otherwise pass us
53
+ * and 422 from GitHub). No underscore, no dot. Length cap 39.
54
+ * repo: any of alnum/dot/hyphen/underscore. Length cap 100.
55
+ */
56
+ export declare function isValidOwnerRepo(id: string): boolean;
57
+ /**
58
+ * Strip a single trailing `.git` (case-insensitive) and any trailing
59
+ * slashes from a URL-ish string. Bounded linear: each character is
60
+ * visited at most twice, no backtracking.
61
+ *
62
+ * Replaces `s.replace(/\.git\/*$/i, '').replace(/\/+$/, '')` which
63
+ * CodeQL's polynomial-regex check (codeql/js/polynomial-redos) flags as
64
+ * a worst-case O(n²) on adversarial input like "////.../x".
65
+ */
66
+ export declare function stripGitSuffix(input: string): string;
67
+ /**
68
+ * Parse `owner/repo` out of a git remote URL. Mirrors the heuristic in
69
+ * `gitnexus/src/storage/git.ts:parseRepoNameFromUrl` but keeps both
70
+ * halves so we can build a registry id. Returns `null` on shapes we
71
+ * don't recognise.
72
+ *
73
+ * Examples:
74
+ * git@github.com:looptech-ai/understand-quickly.git
75
+ * https://github.com/looptech-ai/understand-quickly
76
+ * ssh://git@github.com/looptech-ai/understand-quickly.git
77
+ */
78
+ export declare function parseOwnerRepoFromRemote(url: string | null | undefined): string | null;
79
+ //# sourceMappingURL=understand-quickly.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"understand-quickly.d.ts","sourceRoot":"","sources":["../../src/integrations/understand-quickly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,2EAC8B,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,6BAA6B,eAAe,CAAC;AAE1D,oDAAoD;AACpD,eAAO,MAAM,4BAA4B,6BAA6B,CAAC;AAEvE,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,OAAO,6BAA6B,CAAC;IACjD,cAAc,EAAE;QACd,gEAAgE;QAChE,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,CAYpE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAsCtF"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Understand-Quickly registry integration helpers.
3
+ *
4
+ * Pure, runtime-agnostic logic for opting in to publishing a GitNexus
5
+ * index to the [`looptech-ai/understand-quickly`](https://github.com/looptech-ai/understand-quickly)
6
+ * registry. Lives in `gitnexus-shared` so both the Node CLI and any
7
+ * future browser-side surface can construct identical dispatch payloads.
8
+ *
9
+ * Network I/O lives in the CLI command (`gitnexus/src/cli/publish.ts`)
10
+ * to keep this module free of Node-only imports — see the comment at
11
+ * the top of `gitnexus-shared/src/graph/types.ts`.
12
+ *
13
+ * The protocol contract (single dispatch event, no graph upload) is
14
+ * documented at:
15
+ * https://github.com/looptech-ai/understand-quickly/blob/main/docs/integrations/protocol.md
16
+ */
17
+ /**
18
+ * URL of the registry repo's repository_dispatch endpoint. Hardcoded
19
+ * because the registry is the canonical home for this integration —
20
+ * users who want a private registry can fork and patch.
21
+ */
22
+ export const UNDERSTAND_QUICKLY_DISPATCH_URL = 'https://api.github.com/repos/looptech-ai/understand-quickly/dispatches';
23
+ /**
24
+ * Event type the registry's sync workflow listens for.
25
+ * See `looptech-ai/understand-quickly/.github/workflows/sync.yml`.
26
+ */
27
+ export const UNDERSTAND_QUICKLY_EVENT_TYPE = 'sync-entry';
28
+ /** Environment variable that gates the dispatch. */
29
+ export const UNDERSTAND_QUICKLY_TOKEN_ENV = 'UNDERSTAND_QUICKLY_TOKEN';
30
+ /**
31
+ * Build the JSON body for the `repository_dispatch` ping. Pure — no
32
+ * env reads, no network. Validates that `id` looks like `owner/repo`
33
+ * (one slash, no whitespace, both halves non-empty) so a misconfigured
34
+ * caller fails loudly before the round-trip.
35
+ */
36
+ export function buildUqDispatchPayload(id) {
37
+ if (!isValidOwnerRepo(id)) {
38
+ throw new Error(`[understand-quickly] expected id of the form "owner/repo", got "${id}". ` +
39
+ `The registry uses this string to look up your entry in registry.json — ` +
40
+ `it must match the GitHub owner/repo of the source code, not a local path.`);
41
+ }
42
+ return {
43
+ event_type: UNDERSTAND_QUICKLY_EVENT_TYPE,
44
+ client_payload: { id },
45
+ };
46
+ }
47
+ /**
48
+ * `owner/repo` validation. Conservative on purpose: GitHub's actual
49
+ * naming rules are looser, but we want to catch local paths
50
+ * (`/Users/...`), bare slugs (`my-repo`), and accidental whitespace.
51
+ *
52
+ * Matches GitHub's published slug rules:
53
+ * owner: starts with alnum, then alnum/hyphen only, must end with
54
+ * alnum (no trailing hyphen — GitHub rejects this at account
55
+ * creation, so a `my-org-/repo` input would otherwise pass us
56
+ * and 422 from GitHub). No underscore, no dot. Length cap 39.
57
+ * repo: any of alnum/dot/hyphen/underscore. Length cap 100.
58
+ */
59
+ export function isValidOwnerRepo(id) {
60
+ return /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?\/[A-Za-z0-9._-]{1,100}$/.test(id);
61
+ }
62
+ /**
63
+ * Strip a single trailing `.git` (case-insensitive) and any trailing
64
+ * slashes from a URL-ish string. Bounded linear: each character is
65
+ * visited at most twice, no backtracking.
66
+ *
67
+ * Replaces `s.replace(/\.git\/*$/i, '').replace(/\/+$/, '')` which
68
+ * CodeQL's polynomial-regex check (codeql/js/polynomial-redos) flags as
69
+ * a worst-case O(n²) on adversarial input like "////.../x".
70
+ */
71
+ export function stripGitSuffix(input) {
72
+ let end = input.length;
73
+ // Trim trailing '/'.
74
+ while (end > 0 && input.charCodeAt(end - 1) === 0x2f)
75
+ end--;
76
+ // Drop one trailing '.git' (case-insensitive).
77
+ if (end >= 4) {
78
+ const tail = input.slice(end - 4, end).toLowerCase();
79
+ if (tail === '.git')
80
+ end -= 4;
81
+ }
82
+ // Trim trailing '/' that may have sat between '.git' and the rest.
83
+ while (end > 0 && input.charCodeAt(end - 1) === 0x2f)
84
+ end--;
85
+ return input.slice(0, end);
86
+ }
87
+ /**
88
+ * Parse `owner/repo` out of a git remote URL. Mirrors the heuristic in
89
+ * `gitnexus/src/storage/git.ts:parseRepoNameFromUrl` but keeps both
90
+ * halves so we can build a registry id. Returns `null` on shapes we
91
+ * don't recognise.
92
+ *
93
+ * Examples:
94
+ * git@github.com:looptech-ai/understand-quickly.git
95
+ * https://github.com/looptech-ai/understand-quickly
96
+ * ssh://git@github.com/looptech-ai/understand-quickly.git
97
+ */
98
+ export function parseOwnerRepoFromRemote(url) {
99
+ if (!url)
100
+ return null;
101
+ const trimmed = url.trim();
102
+ if (!trimmed)
103
+ return null;
104
+ // Strip a trailing `.git` (case-insensitive) and any trailing slashes
105
+ // so https://h/o/r and https://h/o/r.git collapse to the same id.
106
+ // Bounded-linear helper avoids the polynomial-regex CodeQL alert.
107
+ const stripped = stripGitSuffix(trimmed);
108
+ // SCP-form SSH (`git@host:owner/repo`). Capture host so we can reject
109
+ // non-GitHub remotes — a GitLab origin like
110
+ // `https://gitlab.example.com/group/sub/project.git` would otherwise
111
+ // silently dispatch the wrong id (LOW 9).
112
+ const ssh = stripped.match(/^[^@]+@([^:]+):([^/]+)\/([^/]+)$/);
113
+ if (ssh) {
114
+ const host = ssh[1].toLowerCase();
115
+ if (host !== 'github.com' && host !== 'www.github.com')
116
+ return null;
117
+ return `${ssh[2]}/${ssh[3]}`;
118
+ }
119
+ // URL forms (https://, ssh://, git://, file://) — last two path segments.
120
+ const url2 = stripped.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/([^/]+)\/(.+)$/);
121
+ if (url2) {
122
+ // Strip optional `userinfo@` (e.g. `ssh://git@github.com/...`).
123
+ const authority = url2[1];
124
+ const atIdx = authority.lastIndexOf('@');
125
+ const hostAndPort = atIdx >= 0 ? authority.slice(atIdx + 1) : authority;
126
+ // Strip `:port` suffix if present.
127
+ const colonIdx = hostAndPort.indexOf(':');
128
+ const host = (colonIdx >= 0 ? hostAndPort.slice(0, colonIdx) : hostAndPort).toLowerCase();
129
+ if (host !== 'github.com' && host !== 'www.github.com')
130
+ return null;
131
+ const segments = url2[2].split('/').filter(Boolean);
132
+ if (segments.length >= 2) {
133
+ const [owner, repo] = segments.slice(-2);
134
+ return `${owner}/${repo}`;
135
+ }
136
+ }
137
+ return null;
138
+ }
139
+ //# sourceMappingURL=understand-quickly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"understand-quickly.js","sourceRoot":"","sources":["../../src/integrations/understand-quickly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAC1C,wEAAwE,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,YAAY,CAAC;AAE1D,oDAAoD;AACpD,MAAM,CAAC,MAAM,4BAA4B,GAAG,0BAA0B,CAAC;AAUvE;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,EAAU;IAC/C,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,mEAAmE,EAAE,KAAK;YACxE,yEAAyE;YACzE,2EAA2E,CAC9E,CAAC;IACJ,CAAC;IACD,OAAO;QACL,UAAU,EAAE,6BAA6B;QACzC,cAAc,EAAE,EAAE,EAAE,EAAE;KACvB,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAU;IACzC,OAAO,wEAAwE,CAAC,IAAI,CA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,IAAI,IAAI,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/dist/cli/index.js CHANGED
@@ -106,6 +106,15 @@ program
106
106
  .command('augment <pattern>')
107
107
  .description('Augment a search pattern with knowledge graph context (used by hooks)')
108
108
  .action(createLazyAction(() => import('./augment.js'), 'augmentCommand'));
109
+ program
110
+ .command('publish [path]')
111
+ .description('Notify the understand-quickly registry that this repo has a fresh GitNexus index. ' +
112
+ 'Opt-in: requires UNDERSTAND_QUICKLY_TOKEN (fine-grained PAT with ' +
113
+ '`Repository dispatches: write` on looptech-ai/understand-quickly). ' +
114
+ 'No-op without the token. See https://github.com/looptech-ai/understand-quickly.')
115
+ .option('--id <owner/repo>', 'Override the registry id (defaults to the origin remote)')
116
+ .option('--skip-git', 'Treat cwd as the repo root and skip parent git-root discovery')
117
+ .action(createLazyAction(() => import('./publish.js'), 'publishCommand'));
109
118
  // ─── Direct Tool Commands (no MCP overhead) ────────────────────────
110
119
  // These invoke LocalBackend directly for use in eval, scripts, and CI.
111
120
  program
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `gitnexus publish` — opt-in ping to the understand-quickly registry.
3
+ *
4
+ * Fires a single `repository_dispatch` event at
5
+ * `looptech-ai/understand-quickly` so the registry knows to refresh its
6
+ * entry for the current repo. Does NOT upload anything: per the
7
+ * understand-quickly protocol, the registry pulls the graph from a
8
+ * raw-GitHub URL the user controls.
9
+ *
10
+ * https://github.com/looptech-ai/understand-quickly/blob/main/docs/integrations/protocol.md
11
+ *
12
+ * Defaults:
13
+ * - Without `UNDERSTAND_QUICKLY_TOKEN` in the env, this is a no-op
14
+ * (prints one informational line, exit 0). Same shape as the
15
+ * `--publish` patterns in sibling tools.
16
+ * - With the token, fires the dispatch and reports the response code.
17
+ *
18
+ * The `id` is derived from the repo's `origin` remote unless the caller
19
+ * passes `--id <owner/repo>` explicitly. We deliberately do NOT auto-add
20
+ * the repo to the registry — registration is one-time and uses the
21
+ * `npx @understand-quickly/cli add` path documented in the protocol.
22
+ */
23
+ export interface PublishOptions {
24
+ /** Override the auto-derived `owner/repo` id. */
25
+ id?: string;
26
+ /** Treat the cwd as the repo root (skip git-root walk). */
27
+ skipGit?: boolean;
28
+ }
29
+ export declare const publishCommand: (inputPath?: string, options?: PublishOptions) => Promise<void>;
@@ -0,0 +1,174 @@
1
+ /**
2
+ * `gitnexus publish` — opt-in ping to the understand-quickly registry.
3
+ *
4
+ * Fires a single `repository_dispatch` event at
5
+ * `looptech-ai/understand-quickly` so the registry knows to refresh its
6
+ * entry for the current repo. Does NOT upload anything: per the
7
+ * understand-quickly protocol, the registry pulls the graph from a
8
+ * raw-GitHub URL the user controls.
9
+ *
10
+ * https://github.com/looptech-ai/understand-quickly/blob/main/docs/integrations/protocol.md
11
+ *
12
+ * Defaults:
13
+ * - Without `UNDERSTAND_QUICKLY_TOKEN` in the env, this is a no-op
14
+ * (prints one informational line, exit 0). Same shape as the
15
+ * `--publish` patterns in sibling tools.
16
+ * - With the token, fires the dispatch and reports the response code.
17
+ *
18
+ * The `id` is derived from the repo's `origin` remote unless the caller
19
+ * passes `--id <owner/repo>` explicitly. We deliberately do NOT auto-add
20
+ * the repo to the registry — registration is one-time and uses the
21
+ * `npx @understand-quickly/cli add` path documented in the protocol.
22
+ */
23
+ import path from 'path';
24
+ import { UNDERSTAND_QUICKLY_DISPATCH_URL, UNDERSTAND_QUICKLY_TOKEN_ENV, buildUqDispatchPayload, isValidOwnerRepo, parseOwnerRepoFromRemote, } from '../_shared/index.js';
25
+ import { getGitRoot, getRemoteOriginUrl, getCurrentCommit } from '../storage/git.js';
26
+ import { hasIndex } from '../storage/repo-manager.js';
27
+ import { cliInfo, cliError } from './cli-message.js';
28
+ const REGISTER_HINT = 'Register your repo once with: npx @understand-quickly/cli add\n' +
29
+ 'Or use the wizard: https://looptech-ai.github.io/understand-quickly/add.html';
30
+ /**
31
+ * Hard cap on the dispatch fetch to keep CI publish steps from stalling
32
+ * for the OS TCP timeout (~2 min) when api.github.com is unreachable.
33
+ * Matches the pattern used in `src/core/embeddings/http-client.ts`.
34
+ */
35
+ const DISPATCH_TIMEOUT_MS = 15_000;
36
+ export const publishCommand = async (inputPath, options = {}) => {
37
+ // ── 0. Token gate FIRST — guarantees true no-op without the token. ──
38
+ // The README, CLI --help, and PR body all promise "exit 0 without
39
+ // UNDERSTAND_QUICKLY_TOKEN". Doing the index/repo-root checks before
40
+ // the token gate would make those promises false for users who haven't
41
+ // run `gitnexus analyze` yet but want to verify the command is wired.
42
+ const token = process.env[UNDERSTAND_QUICKLY_TOKEN_ENV];
43
+ if (!token) {
44
+ cliInfo(`[understand-quickly] ${UNDERSTAND_QUICKLY_TOKEN_ENV} is not set — skipping dispatch.\n` +
45
+ `Set it to a fine-grained PAT with "Repository dispatches: write" on ` +
46
+ `looptech-ai/understand-quickly to enable instant resync.\n` +
47
+ `(Without the token, the registry's nightly sync still picks up your entry.)`, { skipped: 'no-token' });
48
+ return;
49
+ }
50
+ // ── 1. Resolve the repo root (same precedence as `analyze`) ──────────
51
+ let repoPath;
52
+ if (inputPath) {
53
+ repoPath = path.resolve(inputPath);
54
+ }
55
+ else if (options.skipGit) {
56
+ repoPath = path.resolve(process.cwd());
57
+ }
58
+ else {
59
+ const gitRoot = getGitRoot(process.cwd());
60
+ if (!gitRoot) {
61
+ cliError('[understand-quickly] not inside a git repository.\n' +
62
+ 'Run from a repo, or pass --skip-git to publish from the current directory.');
63
+ process.exitCode = 1;
64
+ return;
65
+ }
66
+ repoPath = gitRoot;
67
+ }
68
+ // ── 2. Confirm a GitNexus index exists ───────────────────────────────
69
+ // Publishing without an index is almost always a mistake — the
70
+ // registry's nightly sync would fetch a stale or missing graph file
71
+ // and mark the entry `missing`. Refuse loudly with a fix-it hint.
72
+ if (!(await hasIndex(repoPath))) {
73
+ cliError(`[understand-quickly] no GitNexus index found at ${repoPath}/.gitnexus.\n` +
74
+ 'Run `gitnexus analyze` first, then re-run `gitnexus publish`.');
75
+ process.exitCode = 1;
76
+ return;
77
+ }
78
+ // ── 3. Derive the registry id ─────────────────────────────────────────
79
+ const id = options.id ?? parseOwnerRepoFromRemote(getRemoteOriginUrl(repoPath) ?? undefined) ?? null;
80
+ if (!id || !isValidOwnerRepo(id)) {
81
+ cliError(`[understand-quickly] could not derive a registry id from this repo.\n` +
82
+ `Pass --id <owner/repo> explicitly (e.g. --id looptech-ai/${path.basename(repoPath)}).\n` +
83
+ REGISTER_HINT);
84
+ process.exitCode = 1;
85
+ return;
86
+ }
87
+ // ── 4. Fire the dispatch ─────────────────────────────────────────────
88
+ const payload = buildUqDispatchPayload(id);
89
+ let response;
90
+ try {
91
+ response = await fetch(UNDERSTAND_QUICKLY_DISPATCH_URL, {
92
+ method: 'POST',
93
+ headers: {
94
+ Accept: 'application/vnd.github+json',
95
+ Authorization: `Bearer ${token}`,
96
+ 'X-GitHub-Api-Version': '2022-11-28',
97
+ 'Content-Type': 'application/json',
98
+ 'User-Agent': 'gitnexus-cli',
99
+ },
100
+ body: JSON.stringify(payload),
101
+ signal: AbortSignal.timeout(DISPATCH_TIMEOUT_MS),
102
+ });
103
+ }
104
+ catch (err) {
105
+ // `AbortSignal.timeout()` throws a `DOMException` with `name ===
106
+ // 'TimeoutError'` on Node 18.14+ (and on browsers/Bun). It is NOT
107
+ // a plain `AbortError`. Match the pattern used in
108
+ // gitnexus/src/core/embeddings/http-client.ts so the user sees the
109
+ // targeted "timed out" message instead of a generic "operation
110
+ // was aborted".
111
+ const isTimeout = err instanceof DOMException && err.name === 'TimeoutError';
112
+ if (isTimeout) {
113
+ cliError(`[understand-quickly] dispatch timed out after ${DISPATCH_TIMEOUT_MS}ms. ` +
114
+ `Check network access to api.github.com and retry.`, { id });
115
+ }
116
+ else {
117
+ const msg = err instanceof Error ? err.message : String(err);
118
+ cliError(`[understand-quickly] dispatch network error: ${msg}`, { id });
119
+ }
120
+ process.exitCode = 1;
121
+ return;
122
+ }
123
+ // GitHub returns 204 on success. Distinct branches for 401/403/404/422
124
+ // so users debug without checking the docs.
125
+ if (response.status === 204) {
126
+ await response.body?.cancel().catch(() => { });
127
+ // `getCurrentCommit` is only meaningful in the success path — moving
128
+ // it inside this branch removes a wasted child-process spawn on every
129
+ // error response (LOW 7).
130
+ const commit = getCurrentCommit(repoPath);
131
+ cliInfo(`[understand-quickly] dispatched sync-entry for ${id}` +
132
+ (commit ? ` @ ${commit.slice(0, 7)}` : '') +
133
+ '.\n' +
134
+ `Note: a 204 only confirms GitHub accepted the dispatch. Whether the ` +
135
+ `registry workflow finds an entry for "${id}" is logged at ` +
136
+ `https://github.com/looptech-ai/understand-quickly/actions/workflows/sync.yml`, { id, commit, status: response.status });
137
+ return;
138
+ }
139
+ if (response.status === 401) {
140
+ cliError(`[understand-quickly] dispatch returned 401 — the ${UNDERSTAND_QUICKLY_TOKEN_ENV} value is invalid or expired.\n` +
141
+ `Regenerate a fine-grained PAT at https://github.com/settings/personal-access-tokens ` +
142
+ `with Repository access scoped to looptech-ai/understand-quickly and the ` +
143
+ `"Repository dispatches: write" permission, then retry.`, { id, status: response.status });
144
+ process.exitCode = 1;
145
+ return;
146
+ }
147
+ if (response.status === 403) {
148
+ cliError(`[understand-quickly] dispatch returned 403 — the token authenticated but ` +
149
+ `lacks the "Repository dispatches: write" permission on ` +
150
+ `looptech-ai/understand-quickly. Edit the PAT scopes and retry.`, { id, status: response.status });
151
+ process.exitCode = 1;
152
+ return;
153
+ }
154
+ if (response.status === 404) {
155
+ cliError(`[understand-quickly] dispatch returned 404 — the token cannot reach ` +
156
+ `looptech-ai/understand-quickly. Verify the PAT has Repository access to ` +
157
+ `that exact repo (not just your own org).`, { id, status: response.status });
158
+ process.exitCode = 1;
159
+ return;
160
+ }
161
+ if (response.status === 422) {
162
+ // Malformed event_type / client_payload — a code bug in this CLI,
163
+ // not a user mistake. Surface so we get bug reports.
164
+ const body422 = await response.text().catch(() => '');
165
+ cliError(`[understand-quickly] dispatch returned 422 (this is a CLI bug; please report).\n` +
166
+ `Body: ${body422 || '(empty)'}`, { id, status: response.status });
167
+ process.exitCode = 1;
168
+ return;
169
+ }
170
+ // 5xx and anything else → bubble the body so the user has something to act on.
171
+ const body = await response.text().catch(() => '');
172
+ cliError(`[understand-quickly] dispatch failed with HTTP ${response.status}: ${body || '(empty body)'}`, { id, status: response.status });
173
+ process.exitCode = 1;
174
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexus",
3
- "version": "1.6.4-rc.100",
3
+ "version": "1.6.4-rc.101",
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",