@opensip-cli/graph-go 0.1.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 (72) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/README.md +31 -0
  4. package/dist/__tests__/branch-coverage-2.test.d.ts +21 -0
  5. package/dist/__tests__/branch-coverage-2.test.d.ts.map +1 -0
  6. package/dist/__tests__/branch-coverage-2.test.js +187 -0
  7. package/dist/__tests__/branch-coverage-2.test.js.map +1 -0
  8. package/dist/__tests__/branch-coverage.test.d.ts +17 -0
  9. package/dist/__tests__/branch-coverage.test.d.ts.map +1 -0
  10. package/dist/__tests__/branch-coverage.test.js +136 -0
  11. package/dist/__tests__/branch-coverage.test.js.map +1 -0
  12. package/dist/__tests__/cache-key.test.d.ts +5 -0
  13. package/dist/__tests__/cache-key.test.d.ts.map +1 -0
  14. package/dist/__tests__/cache-key.test.js +45 -0
  15. package/dist/__tests__/cache-key.test.js.map +1 -0
  16. package/dist/__tests__/depends-on-emission.test.d.ts +13 -0
  17. package/dist/__tests__/depends-on-emission.test.d.ts.map +1 -0
  18. package/dist/__tests__/depends-on-emission.test.js +215 -0
  19. package/dist/__tests__/depends-on-emission.test.js.map +1 -0
  20. package/dist/__tests__/discover.test.d.ts +5 -0
  21. package/dist/__tests__/discover.test.d.ts.map +1 -0
  22. package/dist/__tests__/discover.test.js +59 -0
  23. package/dist/__tests__/discover.test.js.map +1 -0
  24. package/dist/__tests__/parse.test.d.ts +5 -0
  25. package/dist/__tests__/parse.test.d.ts.map +1 -0
  26. package/dist/__tests__/parse.test.js +59 -0
  27. package/dist/__tests__/parse.test.js.map +1 -0
  28. package/dist/__tests__/resolve.test.d.ts +18 -0
  29. package/dist/__tests__/resolve.test.d.ts.map +1 -0
  30. package/dist/__tests__/resolve.test.js +205 -0
  31. package/dist/__tests__/resolve.test.js.map +1 -0
  32. package/dist/__tests__/walk.test.d.ts +10 -0
  33. package/dist/__tests__/walk.test.d.ts.map +1 -0
  34. package/dist/__tests__/walk.test.js +163 -0
  35. package/dist/__tests__/walk.test.js.map +1 -0
  36. package/dist/body-digest.d.ts +20 -0
  37. package/dist/body-digest.d.ts.map +1 -0
  38. package/dist/body-digest.js +139 -0
  39. package/dist/body-digest.js.map +1 -0
  40. package/dist/cache-key.d.ts +17 -0
  41. package/dist/cache-key.d.ts.map +1 -0
  42. package/dist/cache-key.js +18 -0
  43. package/dist/cache-key.js.map +1 -0
  44. package/dist/discover.d.ts +24 -0
  45. package/dist/discover.d.ts.map +1 -0
  46. package/dist/discover.js +33 -0
  47. package/dist/discover.js.map +1 -0
  48. package/dist/index.d.ts +43 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.js +46 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/parse.d.ts +17 -0
  53. package/dist/parse.d.ts.map +1 -0
  54. package/dist/parse.js +14 -0
  55. package/dist/parse.js.map +1 -0
  56. package/dist/resolve.d.ts +32 -0
  57. package/dist/resolve.d.ts.map +1 -0
  58. package/dist/resolve.js +294 -0
  59. package/dist/resolve.js.map +1 -0
  60. package/dist/rule-hints.d.ts +16 -0
  61. package/dist/rule-hints.d.ts.map +1 -0
  62. package/dist/rule-hints.js +62 -0
  63. package/dist/rule-hints.js.map +1 -0
  64. package/dist/walk-metadata.d.ts +22 -0
  65. package/dist/walk-metadata.d.ts.map +1 -0
  66. package/dist/walk-metadata.js +96 -0
  67. package/dist/walk-metadata.js.map +1 -0
  68. package/dist/walk.d.ts +47 -0
  69. package/dist/walk.d.ts.map +1 -0
  70. package/dist/walk.js +278 -0
  71. package/dist/walk.js.map +1 -0
  72. package/package.json +55 -0
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @fileoverview Go-specific metadata extraction from tree-sitter nodes.
3
+ *
4
+ * Extracted from `walk.ts` to keep that module focused on the AST
5
+ * traversal. Owns the predicates / lookups that pull
6
+ * package name, receiver type, parameter list, and visibility from
7
+ * tree-sitter-go nodes — none of which depend on the walker's mutable
8
+ * state, so they are safely free-standing helpers.
9
+ */
10
+ import type { GoParsedFile } from './parse.js';
11
+ import type { FunctionOccurrence } from '@opensip-cli/graph';
12
+ import type { Node } from '@opensip-cli/tree-sitter';
13
+ export declare function extractPackageName(file: GoParsedFile): string;
14
+ export declare function extractReceiverType(node: Node): string | null;
15
+ export declare function classifyVisibility(name: string): FunctionOccurrence['visibility'];
16
+ export declare function extractParams(node: Node): readonly {
17
+ name: string;
18
+ optional: boolean;
19
+ rest: boolean;
20
+ }[];
21
+ export declare const extractClosureParams: typeof extractParams;
22
+ //# sourceMappingURL=walk-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walk-metadata.d.ts","sourceRoot":"","sources":["../src/walk-metadata.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAErD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAW7D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAc7D;AAmBD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAQjF;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,GACT,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,EAAE,CAI/D;AAGD,eAAO,MAAM,oBAAoB,sBAAgB,CAAC"}
@@ -0,0 +1,96 @@
1
+ // @fitness-ignore-file batch-operation-limits -- iterates the AST node arities of a single tree-sitter parse (bounded by source size); not a workspace-fanout loop.
2
+ /**
3
+ * @fileoverview Go-specific metadata extraction from tree-sitter nodes.
4
+ *
5
+ * Extracted from `walk.ts` to keep that module focused on the AST
6
+ * traversal. Owns the predicates / lookups that pull
7
+ * package name, receiver type, parameter list, and visibility from
8
+ * tree-sitter-go nodes — none of which depend on the walker's mutable
9
+ * state, so they are safely free-standing helpers.
10
+ */
11
+ import { childrenOf, namedChildrenOf } from '@opensip-cli/graph-adapter-common';
12
+ export function extractPackageName(file) {
13
+ for (const child of childrenOf(file.tree.rootNode)) {
14
+ if (child.type === 'package_clause') {
15
+ // package_clause: `package` keyword followed by identifier
16
+ for (const c of childrenOf(child)) {
17
+ if (c.type === 'package_identifier' || c.type === 'identifier')
18
+ return c.text;
19
+ }
20
+ }
21
+ }
22
+ /* v8 ignore next */
23
+ return 'main';
24
+ }
25
+ export function extractReceiverType(node) {
26
+ // method_declaration has a `receiver` field of type parameter_list
27
+ // containing one parameter_declaration. The declaration's `type`
28
+ // is either pointer_type (e.g. `*Foo`) or type_identifier (`Foo`).
29
+ const receiver = node.childForFieldName('receiver');
30
+ if (!receiver)
31
+ return null;
32
+ for (const param of namedChildrenOf(receiver)) {
33
+ if (param.type !== 'parameter_declaration')
34
+ continue;
35
+ const ty = param.childForFieldName('type') ?? param.namedChild(param.namedChildCount - 1);
36
+ if (!ty)
37
+ continue;
38
+ return decodeReceiverTypeNode(ty);
39
+ }
40
+ /* v8 ignore next */
41
+ return null;
42
+ }
43
+ function decodeReceiverTypeNode(node) {
44
+ if (node.type === 'pointer_type') {
45
+ // *Foo or *Foo[T] — descend through the pointer to the named type.
46
+ const inner = node.namedChild(0);
47
+ return inner ? decodeReceiverTypeNode(inner) : null;
48
+ }
49
+ if (node.type === 'type_identifier')
50
+ return node.text;
51
+ if (node.type === 'generic_type') {
52
+ // Foo[T] — the trailing name is the type. tree-sitter-go usually
53
+ // exposes the base via a named child.
54
+ const inner = node.childForFieldName('type') ?? node.namedChild(0);
55
+ return inner ? decodeReceiverTypeNode(inner) : null;
56
+ }
57
+ /* v8 ignore next */
58
+ return node.text;
59
+ }
60
+ export function classifyVisibility(name) {
61
+ // Go visibility is determined by the first character's case. The
62
+ // primary check is "is the first character an uppercase ASCII letter".
63
+ // Unicode-case rules also count per the Go spec, but ASCII covers the
64
+ // overwhelming majority of real-world Go.
65
+ const first = name.charAt(0);
66
+ if (first >= 'A' && first <= 'Z')
67
+ return 'exported';
68
+ return 'module-local';
69
+ }
70
+ export function extractParams(node) {
71
+ const params = node.childForFieldName('parameters');
72
+ if (!params)
73
+ return [];
74
+ return collectParamEntries(params);
75
+ }
76
+ // Closures share the same parameters field shape as function_declaration.
77
+ export const extractClosureParams = extractParams;
78
+ function collectParamEntries(params) {
79
+ const out = [];
80
+ for (const child of namedChildrenOf(params)) {
81
+ if (child.type !== 'parameter_declaration' && child.type !== 'variadic_parameter_declaration') {
82
+ continue;
83
+ }
84
+ const isRest = child.type === 'variadic_parameter_declaration';
85
+ // A parameter_declaration may bind multiple names to one type:
86
+ // `func f(a, b int)` produces a single declaration node with two
87
+ // `name` children. Iterate the named identifiers.
88
+ for (const inner of namedChildrenOf(child)) {
89
+ if (inner.type === 'identifier') {
90
+ out.push({ name: inner.text, optional: false, rest: isRest });
91
+ }
92
+ }
93
+ }
94
+ return out;
95
+ }
96
+ //# sourceMappingURL=walk-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walk-metadata.js","sourceRoot":"","sources":["../src/walk-metadata.ts"],"names":[],"mappings":"AAAA,oKAAoK;AACpK;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAMhF,MAAM,UAAU,kBAAkB,CAAC,IAAkB;IACnD,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnD,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;YACpC,2DAA2D;YAC3D,KAAK,MAAM,CAAC,I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jE,kDAAkD;QAClD,KAAK,MAAM,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3C,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAChC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YAChE,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
package/dist/walk.d.ts ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Go walkProject — emit FunctionOccurrences + CallSiteRecords.
3
+ *
4
+ * Identifies the callable shapes:
5
+ *
6
+ * - `function_declaration` → 'function-declaration'
7
+ * - `method_declaration` (has receiver) → 'method'
8
+ * - `enclosingClass` = receiver type name (e.g. `Foo` in
9
+ * `func (f *Foo) bar() {}`). Pointer `*Foo` and value `Foo`
10
+ * receivers both yield `Foo` — the dereference is stripped.
11
+ * - `func_literal` → 'arrow'
12
+ * - one synthetic `<module-init>` per file owning top-level non-fn
13
+ * items (`package`, `import`, `var`, `const`, `type`).
14
+ *
15
+ * Body hashing: sha256 of normalized body text. Normalization:
16
+ * 1. Strip line comments (`// …` to end-of-line).
17
+ * 2. Strip block comments (`/* … *\/`). Go does NOT support nested
18
+ * block comments, unlike Rust.
19
+ * 3. Preserve string literals: both interpreted (`"…"`) and raw
20
+ * (backtick `…`) forms. Their content is part of behavior.
21
+ * 4. Preserve rune literals (`'x'`, `'\n'`).
22
+ * 5. Collapse whitespace.
23
+ *
24
+ * Call-site records:
25
+ * - `call_expression` — every Go function/method/built-in call.
26
+ * The resolver decodes:
27
+ * - `foo(args)` — identifier target
28
+ * - `obj.Method(args)` — selector_expression's `field`
29
+ * - `pkg.Func(args)` — same selector_expression shape
30
+ * - `Type{}.method(args)` — selector_expression on composite_literal
31
+ * - 'creation' edges — for each `func_literal` nested inside a parent
32
+ * function/method/module-init, emit a creation edge so reachability
33
+ * flows through closures even when dispatch is unresolvable.
34
+ * Mirror of lang-typescript's `isInlineCallable`.
35
+ *
36
+ * Test detection:
37
+ * - File-level: filename ends with `_test.go`. Go's toolchain enforces
38
+ * this convention, so the predicate is exact.
39
+ * - No function-level detection — `func TestXxx(t *testing.T)` only
40
+ * compiles into a test when its file is `_test.go`.
41
+ */
42
+ import type { GoParsedProject } from './parse.js';
43
+ import type { WalkInput, WalkOutput } from '@opensip-cli/graph';
44
+ declare const isTestFile: (rel: string) => boolean;
45
+ export { isTestFile };
46
+ export declare function walkProject(input: WalkInput<GoParsedProject>): WalkOutput;
47
+ //# sourceMappingURL=walk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../src/walk.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAwBH,OAAO,KAAK,EAAgB,eAAe,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAIV,SAAS,EACT,UAAU,EACX,MAAM,oBAAoB,CAAC;AAO5B,QAAA,MAAQ,UAAU,0BAGhB,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,eAAe,CAAC,GAAG,UAAU,CAEzE"}
package/dist/walk.js ADDED
@@ -0,0 +1,278 @@
1
+ // @fitness-ignore-file context-mutation -- `ctx: WalkCtx` here is a function-scoped traversal accumulator (callSites array, occurrence sink, parser refs) threaded through the AST walk, NOT a shared request/execution context. `ctx.callSites.push(...)` is the intended local-accumulator append. The shared check-side `LOCAL_DECLARATION_PATTERNS` heuristic doesn't see it because `ctx` arrives as a typed parameter, not via `const ctx = …`.
2
+ /**
3
+ * Go walkProject — emit FunctionOccurrences + CallSiteRecords.
4
+ *
5
+ * Identifies the callable shapes:
6
+ *
7
+ * - `function_declaration` → 'function-declaration'
8
+ * - `method_declaration` (has receiver) → 'method'
9
+ * - `enclosingClass` = receiver type name (e.g. `Foo` in
10
+ * `func (f *Foo) bar() {}`). Pointer `*Foo` and value `Foo`
11
+ * receivers both yield `Foo` — the dereference is stripped.
12
+ * - `func_literal` → 'arrow'
13
+ * - one synthetic `<module-init>` per file owning top-level non-fn
14
+ * items (`package`, `import`, `var`, `const`, `type`).
15
+ *
16
+ * Body hashing: sha256 of normalized body text. Normalization:
17
+ * 1. Strip line comments (`// …` to end-of-line).
18
+ * 2. Strip block comments (`/* … *\/`). Go does NOT support nested
19
+ * block comments, unlike Rust.
20
+ * 3. Preserve string literals: both interpreted (`"…"`) and raw
21
+ * (backtick `…`) forms. Their content is part of behavior.
22
+ * 4. Preserve rune literals (`'x'`, `'\n'`).
23
+ * 5. Collapse whitespace.
24
+ *
25
+ * Call-site records:
26
+ * - `call_expression` — every Go function/method/built-in call.
27
+ * The resolver decodes:
28
+ * - `foo(args)` — identifier target
29
+ * - `obj.Method(args)` — selector_expression's `field`
30
+ * - `pkg.Func(args)` — same selector_expression shape
31
+ * - `Type{}.method(args)` — selector_expression on composite_literal
32
+ * - 'creation' edges — for each `func_literal` nested inside a parent
33
+ * function/method/module-init, emit a creation edge so reachability
34
+ * flows through closures even when dispatch is unresolvable.
35
+ * Mirror of lang-typescript's `isInlineCallable`.
36
+ *
37
+ * Test detection:
38
+ * - File-level: filename ends with `_test.go`. Go's toolchain enforces
39
+ * this convention, so the predicate is exact.
40
+ * - No function-level detection — `func TestXxx(t *testing.T)` only
41
+ * compiles into a test when its file is `_test.go`.
42
+ */
43
+ import { relative, sep } from 'node:path';
44
+ import { childrenOf, makeFileClassifier, namedChildrenOf, nameOf, record, runWalk, synthesizeModuleInit as buildModuleInit, } from '@opensip-cli/graph-adapter-common';
45
+ import { digestGoBody, digestSyntheticBody } from './body-digest.js';
46
+ import { classifyVisibility, extractClosureParams, extractPackageName, extractParams, extractReceiverType, } from './walk-metadata.js';
47
+ const TEST_FILE_NAME_RE = /(?:^|\/)[^/]+_test\.go$/;
48
+ const GENERATED_PATH_RE = /\bvendor\/|\.pb\.go$|_generated\.go$|\.gen\.go$|zz_generated_/;
49
+ // Go's `_test.go` name convention is exact — no path-based matcher needed.
50
+ const { isTestFile, isGeneratedFile } = makeFileClassifier({
51
+ testRe: TEST_FILE_NAME_RE,
52
+ generatedRe: GENERATED_PATH_RE,
53
+ });
54
+ export { isTestFile };
55
+ export function walkProject(input) {
56
+ return runWalk({ input, walkFile });
57
+ }
58
+ function walkFile(absPath, file, projectDirAbs, sinks) {
59
+ const { occurrences: out, callSites, dependencySites } = sinks;
60
+ const filePathProjectRel = relative(projectDirAbs, absPath).split(sep).join('/');
61
+ const inTestFile = isTestFile(filePathProjectRel);
62
+ const definedInGenerated = isGeneratedFile(filePathProjectRel);
63
+ const packageName = extractPackageName(file);
64
+ const qualifiedBase = `${packageName}/${filePathProjectRel}`.replace(/\.go$/, '');
65
+ const moduleInit = buildModuleInit({
66
+ file,
67
+ filePathProjectRel,
68
+ inTestFile,
69
+ definedInGenerated,
70
+ digestSyntheticBody,
71
+ qualifiedName: `${qualifiedBase}.<module-init>`,
72
+ });
73
+ record(out, moduleInit);
74
+ // Phase 4 (DEC-498): walk top-level imports as dependency sites. Owner
75
+ // is the file's synthesized module-init occurrence.
76
+ collectDependencySites(file, moduleInit.bodyHash, dependencySites);
77
+ const ctx = {
78
+ file,
79
+ filePathProjectRel,
80
+ packageName,
81
+ fileInTestFile: inTestFile,
82
+ definedInGenerated,
83
+ out,
84
+ callSites,
85
+ };
86
+ const initialFrame = { ownerHash: moduleInit.bodyHash };
87
+ for (const child of childrenOf(file.tree.rootNode))
88
+ visit(child, initialFrame, ctx);
89
+ }
90
+ /**
91
+ * Walk a Go file's top-level `import_declaration` nodes; emit one
92
+ * `DependencySiteRecord` per `import_spec`, regardless of whether the
93
+ * declaration is single (`import "fmt"`) or grouped (`import ( … )`).
94
+ *
95
+ * Phase 4 of opensip's substrate consolidation (DEC-498). The emitted
96
+ * `specifier` is the raw import path WITHOUT the surrounding quotes
97
+ * (e.g. `'fmt'`, `'github.com/user/repo/pkg/sub'`).
98
+ *
99
+ * Aliased imports (`alias "path"`), blank imports (`_ "path"`), and dot
100
+ * imports (`. "path"`) all emit one dep site keyed by the import path;
101
+ * the alias / blank / dot prefix doesn't change the dependency target.
102
+ *
103
+ * Out of scope at v1:
104
+ * - Conditional / nested imports inside function bodies (Go doesn't
105
+ * permit these — imports are always file-top-level).
106
+ * - `go.work`-mediated multi-module workspaces (a follow-up).
107
+ */
108
+ function collectDependencySites(file, moduleInitHash, out) {
109
+ for (const stmt of namedChildrenOf(file.tree.rootNode)) {
110
+ if (stmt.type !== 'import_declaration')
111
+ continue;
112
+ collectFromImportDeclaration(stmt, file, moduleInitHash, out);
113
+ }
114
+ }
115
+ function collectFromImportDeclaration(decl, file, moduleInitHash, out) {
116
+ for (const child of namedChildrenOf(decl)) {
117
+ if (child.type === 'import_spec') {
118
+ pushImportSpec(child, file, moduleInitHash, out);
119
+ }
120
+ else if (child.type === 'import_spec_list') {
121
+ for (const spec of namedChildrenOf(child)) {
122
+ if (spec.type === 'import_spec') {
123
+ pushImportSpec(spec, file, moduleInitHash, out);
124
+ }
125
+ }
126
+ }
127
+ }
128
+ }
129
+ function pushImportSpec(spec, file, ownerHash, out) {
130
+ // The `path` field is an interpreted_string_literal. Its `text` is the
131
+ // quoted form (`"fmt"`); strip outer quotes to get the raw specifier.
132
+ const pathNode = spec.childForFieldName('path') ?? findInterpretedString(spec);
133
+ if (!pathNode)
134
+ return;
135
+ const specifier = unquoteGoStringLiteral(pathNode.text);
136
+ if (specifier === null)
137
+ return;
138
+ out.push({
139
+ nodeRef: spec,
140
+ sourceFileRef: file,
141
+ ownerHash,
142
+ specifier,
143
+ line: spec.startPosition.row + 1,
144
+ column: spec.startPosition.column,
145
+ });
146
+ }
147
+ function findInterpretedString(node) {
148
+ /* v8 ignore start */
149
+ for (const child of namedChildrenOf(node)) {
150
+ if (child.type === 'interpreted_string_literal')
151
+ return child;
152
+ }
153
+ return null;
154
+ /* v8 ignore stop */
155
+ }
156
+ function unquoteGoStringLiteral(text) {
157
+ // Go import paths are always interpreted strings — wrapped in `"…"`
158
+ // with no escape sequences relevant to module paths. (Raw `\`…\``
159
+ // strings are NOT valid in import declarations per the Go spec.)
160
+ if (text.length < 2)
161
+ return null;
162
+ if (text.startsWith('"') && text.endsWith('"'))
163
+ return text.slice(1, -1);
164
+ /* v8 ignore next */
165
+ return null;
166
+ }
167
+ // @graph-ignore-next-line graph:cycle -- intentional recursive-descent AST visitor; the cycle is the traversal (visit re-enters via visitFunction/visitClosure)
168
+ function visit(node, frame, ctx) {
169
+ if (node.type === 'function_declaration') {
170
+ visitFunction(node, frame, ctx, null);
171
+ return;
172
+ }
173
+ if (node.type === 'method_declaration') {
174
+ const receiverType = extractReceiverType(node);
175
+ visitFunction(node, frame, ctx, receiverType);
176
+ return;
177
+ }
178
+ if (node.type === 'func_literal' && visitClosure(node, frame, ctx)) {
179
+ return;
180
+ }
181
+ if (node.type === 'call_expression') {
182
+ ctx.callSites.push({
183
+ nodeRef: node,
184
+ sourceFileRef: ctx.file,
185
+ ownerHash: frame.ownerHash,
186
+ kind: 'call',
187
+ });
188
+ }
189
+ for (const child of childrenOf(node))
190
+ visit(child, frame, ctx);
191
+ }
192
+ function visitFunction(node, frame, ctx, receiverType) {
193
+ const occ = buildFunctionOccurrence(node, ctx, receiverType);
194
+ if (!occ)
195
+ return;
196
+ record(ctx.out, occ);
197
+ const childFrame = { ownerHash: occ.bodyHash };
198
+ const body = node.childForFieldName('body');
199
+ if (body) {
200
+ for (const child of childrenOf(body))
201
+ visit(child, childFrame, ctx);
202
+ }
203
+ }
204
+ function visitClosure(node, frame, ctx) {
205
+ const occ = buildClosureOccurrence(node, ctx);
206
+ if (!occ)
207
+ return false;
208
+ record(ctx.out, occ);
209
+ if (frame.ownerHash !== occ.bodyHash) {
210
+ ctx.callSites.push({
211
+ nodeRef: node,
212
+ sourceFileRef: ctx.file,
213
+ ownerHash: frame.ownerHash,
214
+ kind: 'creation',
215
+ childHash: occ.bodyHash,
216
+ });
217
+ }
218
+ const body = node.childForFieldName('body');
219
+ if (body) {
220
+ visit(body, { ownerHash: occ.bodyHash }, ctx);
221
+ }
222
+ return true;
223
+ }
224
+ function buildFunctionOccurrence(node, ctx, receiverType) {
225
+ const name = nameOf(node) ?? '<anon-fn>';
226
+ const digest = digestGoBody(ctx.file.source.slice(node.startIndex, node.endIndex));
227
+ const kind = receiverType === null ? 'function-declaration' : 'method';
228
+ const qualifiedBase = `${ctx.packageName}/${ctx.filePathProjectRel}`.replace(/\.go$/, '');
229
+ const qualifiedName = receiverType === null
230
+ ? `${qualifiedBase}.${name}`
231
+ : `${qualifiedBase}.(${receiverType}).${name}`;
232
+ return {
233
+ bodyHash: digest.hash,
234
+ bodySize: digest.size,
235
+ simpleName: name,
236
+ qualifiedName,
237
+ filePath: ctx.filePathProjectRel,
238
+ line: node.startPosition.row + 1,
239
+ column: node.startPosition.column,
240
+ endLine: node.endPosition.row + 1,
241
+ kind,
242
+ params: extractParams(node),
243
+ returnType: null,
244
+ enclosingClass: receiverType,
245
+ decorators: [],
246
+ visibility: classifyVisibility(name),
247
+ inTestFile: ctx.fileInTestFile,
248
+ definedInGenerated: ctx.definedInGenerated,
249
+ calls: [],
250
+ };
251
+ }
252
+ function buildClosureOccurrence(node, ctx) {
253
+ const digest = digestGoBody(ctx.file.source.slice(node.startIndex, node.endIndex));
254
+ const startLine = node.startPosition.row + 1;
255
+ const startCol = node.startPosition.column;
256
+ const simpleName = `<arrow:${ctx.filePathProjectRel}:${String(startLine)}:${String(startCol)}>`;
257
+ const qualifiedBase = `${ctx.packageName}/${ctx.filePathProjectRel}`.replace(/\.go$/, '');
258
+ return {
259
+ bodyHash: digest.hash,
260
+ bodySize: digest.size,
261
+ simpleName,
262
+ qualifiedName: `${qualifiedBase}.<closure:${String(startLine)}:${String(startCol)}>`,
263
+ filePath: ctx.filePathProjectRel,
264
+ line: startLine,
265
+ column: startCol,
266
+ endLine: node.endPosition.row + 1,
267
+ kind: 'arrow',
268
+ params: extractClosureParams(node),
269
+ returnType: null,
270
+ enclosingClass: null,
271
+ decorators: [],
272
+ visibility: 'private',
273
+ inTestFile: ctx.fileInTestFile,
274
+ definedInGenerated: ctx.definedInGenerated,
275
+ calls: [],
276
+ };
277
+ }
278
+ //# sourceMappingURL=walk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walk.js","sourceRoot":"","sources":["../src/walk.ts"],"names":[],"mappings":"AAAA,sbAAsb;AACtb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,MAAM,EACN,OAAO,EACP,oBAAoB,IAAI,eAAe,GAExC,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAY5B,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AACpD,MAAM,iBAAiB,GAAG,+DAA+D,CAAC;AAE1F,2EAA2E;AAC3E,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,kBAAkB,CAAC;IACzD,MAAM,EAAE,iBAAiB;IACzB,WAAW,EAAE,iBAAiB;CAC/B,CAAC,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,MAAM,UAAU,WAAW,CAAC,KAAiC;IAC3D,OAAO,OAAO,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,QAAQ,CACf,OAAe,EACf,IAAkB,EAClB,aAAqB,EACrB,KA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AC;IAC1F,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,IAAI;QACrB,QAAQ,EAAE,MAAM,CAAC,IAAI;QACrB,UAAU;QACV,aAAa,EAAE,GAAG,aAAa,aAAa,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG;QACpF,QAAQ,EAAE,GAAG,CAAC,kBAAkB;QAChC,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC;QACjC,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,oBAAoB,CAAC,IAAI,CAAC;QAClC,UAAU,EAAE,IAAI;QAChB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,SAAS;QACrB,UAAU,EAAE,GAAG,CAAC,cAAc;QAC9B,kBAAkB,EAAE,GAAG,CAAC,kBAAkB;QAC1C,KAAK,EAAE,EAAE;KACV,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@opensip-cli/graph-go",
3
+ "version": "0.1.0",
4
+ "license": "Apache-2.0",
5
+ "description": "Go language adapter for the opensip graph engine",
6
+ "keywords": [
7
+ "opensip-cli",
8
+ "static-analysis",
9
+ "code-quality",
10
+ "call-graph",
11
+ "dependency-graph",
12
+ "go",
13
+ "golang"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/opensip-ai/opensip-cli.git",
18
+ "directory": "packages/graph/graph-go"
19
+ },
20
+ "homepage": "https://github.com/opensip-ai/opensip-cli",
21
+ "bugs": {
22
+ "url": "https://github.com/opensip-ai/opensip-cli/issues"
23
+ },
24
+ "type": "module",
25
+ "main": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": "./dist/index.js"
29
+ },
30
+ "opensipTools": {
31
+ "kind": "graph-adapter"
32
+ },
33
+ "files": [
34
+ "dist",
35
+ "LICENSE",
36
+ "NOTICE"
37
+ ],
38
+ "dependencies": {
39
+ "@opensip-cli/core": "0.1.0",
40
+ "@opensip-cli/graph-adapter-common": "0.1.0",
41
+ "@opensip-cli/graph": "0.1.0",
42
+ "@opensip-cli/lang-go": "0.1.0",
43
+ "@opensip-cli/tree-sitter": "0.1.0"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^24.13.2",
47
+ "vitest": "^4.1.8"
48
+ },
49
+ "scripts": {
50
+ "build": "tsc",
51
+ "test": "vitest run --passWithNoTests",
52
+ "typecheck": "tsc --noEmit",
53
+ "clean": "rm -rf dist"
54
+ }
55
+ }