opencode-diane 0.0.5

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 (80) hide show
  1. package/CHANGELOG.md +180 -0
  2. package/LICENSE +21 -0
  3. package/README.md +206 -0
  4. package/WIKI.md +1430 -0
  5. package/dist/index.d.ts +28 -0
  6. package/dist/index.js +1632 -0
  7. package/dist/ingest/adaptive.d.ts +47 -0
  8. package/dist/ingest/adaptive.js +182 -0
  9. package/dist/ingest/code-health.d.ts +58 -0
  10. package/dist/ingest/code-health.js +202 -0
  11. package/dist/ingest/code-map.d.ts +71 -0
  12. package/dist/ingest/code-map.js +670 -0
  13. package/dist/ingest/cross-refs.d.ts +59 -0
  14. package/dist/ingest/cross-refs.js +1207 -0
  15. package/dist/ingest/docs.d.ts +49 -0
  16. package/dist/ingest/docs.js +325 -0
  17. package/dist/ingest/git.d.ts +77 -0
  18. package/dist/ingest/git.js +390 -0
  19. package/dist/ingest/live-session.d.ts +101 -0
  20. package/dist/ingest/live-session.js +173 -0
  21. package/dist/ingest/project-notes.d.ts +28 -0
  22. package/dist/ingest/project-notes.js +102 -0
  23. package/dist/ingest/project.d.ts +35 -0
  24. package/dist/ingest/project.js +430 -0
  25. package/dist/ingest/session-snapshot.d.ts +63 -0
  26. package/dist/ingest/session-snapshot.js +94 -0
  27. package/dist/ingest/sessions.d.ts +29 -0
  28. package/dist/ingest/sessions.js +164 -0
  29. package/dist/ingest/tables.d.ts +52 -0
  30. package/dist/ingest/tables.js +360 -0
  31. package/dist/mining/skill-miner.d.ts +53 -0
  32. package/dist/mining/skill-miner.js +234 -0
  33. package/dist/search/bm25.d.ts +81 -0
  34. package/dist/search/bm25.js +334 -0
  35. package/dist/search/e5-embedder.d.ts +30 -0
  36. package/dist/search/e5-embedder.js +91 -0
  37. package/dist/search/embed-pass.d.ts +26 -0
  38. package/dist/search/embed-pass.js +43 -0
  39. package/dist/search/embedder.d.ts +58 -0
  40. package/dist/search/embedder.js +85 -0
  41. package/dist/search/inverted-index.d.ts +51 -0
  42. package/dist/search/inverted-index.js +139 -0
  43. package/dist/search/ppr.d.ts +44 -0
  44. package/dist/search/ppr.js +118 -0
  45. package/dist/search/tokenize.d.ts +26 -0
  46. package/dist/search/tokenize.js +98 -0
  47. package/dist/store/eviction.d.ts +16 -0
  48. package/dist/store/eviction.js +37 -0
  49. package/dist/store/repository.d.ts +222 -0
  50. package/dist/store/repository.js +420 -0
  51. package/dist/store/sqlite-store.d.ts +89 -0
  52. package/dist/store/sqlite-store.js +252 -0
  53. package/dist/store/vector-store.d.ts +66 -0
  54. package/dist/store/vector-store.js +160 -0
  55. package/dist/types.d.ts +385 -0
  56. package/dist/types.js +9 -0
  57. package/dist/utils/file-log.d.ts +87 -0
  58. package/dist/utils/file-log.js +215 -0
  59. package/dist/utils/peer-detection.d.ts +45 -0
  60. package/dist/utils/peer-detection.js +90 -0
  61. package/dist/utils/shell.d.ts +43 -0
  62. package/dist/utils/shell.js +110 -0
  63. package/dist/utils/usage-skill.d.ts +42 -0
  64. package/dist/utils/usage-skill.js +129 -0
  65. package/dist/utils/xlsx.d.ts +36 -0
  66. package/dist/utils/xlsx.js +270 -0
  67. package/grammars/tree-sitter-c.wasm +0 -0
  68. package/grammars/tree-sitter-c_sharp.wasm +0 -0
  69. package/grammars/tree-sitter-cpp.wasm +0 -0
  70. package/grammars/tree-sitter-css.wasm +0 -0
  71. package/grammars/tree-sitter-go.wasm +0 -0
  72. package/grammars/tree-sitter-html.wasm +0 -0
  73. package/grammars/tree-sitter-java.wasm +0 -0
  74. package/grammars/tree-sitter-javascript.wasm +0 -0
  75. package/grammars/tree-sitter-json.wasm +0 -0
  76. package/grammars/tree-sitter-php.wasm +0 -0
  77. package/grammars/tree-sitter-python.wasm +0 -0
  78. package/grammars/tree-sitter-rust.wasm +0 -0
  79. package/grammars/tree-sitter-typescript.wasm +0 -0
  80. package/package.json +80 -0
@@ -0,0 +1,59 @@
1
+ /**
2
+ * cross-refs.ts — grammar-agnostic edge discovery between files.
3
+ *
4
+ * The hard part isn't finding connections; the hard part is finding
5
+ * them with FEW false positives. Single-signal heuristics (regex
6
+ * "import" detection, free-text identifier mentions) all have
7
+ * meaningful FP rates that mislead the agent's navigation. This
8
+ * ingester uses MULTI-SIGNAL CORROBORATION:
9
+ *
10
+ * - Filesystem-grounded signals (path-resolves-to-existing-file)
11
+ * emit edges alone — the disk grounds them.
12
+ * - Lexical signals (identifier mention) only emit edges when
13
+ * corroborated by a SECOND orthogonal signal (rarity + import-
14
+ * line context, OR rarity + filename-class coupling).
15
+ *
16
+ * Four passes:
17
+ *
18
+ * 1. Definition extraction (language-keyed regex). Builds a map
19
+ * `identifier → Set<defining-file>`.
20
+ * 2. Import-path resolution. For each file, find import-like lines,
21
+ * try to resolve the named module/path to an actual file under
22
+ * the project root. Existing → edge.
23
+ * 3. Config path-strings. For .json/.yaml/.toml, walk string values
24
+ * and try to resolve them as relative file paths. Existing → edge.
25
+ * 4. Corroborated identifier mentions. Tokenise each file line by
26
+ * line; for tokens that are defined elsewhere AND rarity-gated,
27
+ * emit an edge only when *also* corroborated by either an
28
+ * import-line context or filename-class coupling.
29
+ *
30
+ * Edges with the same (source, target) pair are merged; the evidence
31
+ * list grows but only one memory is written per edge.
32
+ *
33
+ * **What this catches that code-map doesn't:** any cross-file
34
+ * connection in a language tree-sitter doesn't have a grammar for
35
+ * (Ruby, Pascal, Perl, Lua, Elixir, Erlang, Tcl, Nim, Zig, Swift,
36
+ * Kotlin, Scala, Haskell, OCaml, F#, Clojure, Pascal, VB, …), plus
37
+ * config-style cross-references in JSON/YAML/TOML files.
38
+ *
39
+ * **What it doesn't catch:** dynamic loads (`require(varName)`),
40
+ * reflection-based dispatch, anything where the connection only
41
+ * exists at runtime. Those are out of scope for any static technique.
42
+ */
43
+ import type { MemoryRepository } from "../store/repository.js";
44
+ export interface CrossRefsIngestResult {
45
+ filesWalked: number;
46
+ definitionsExtracted: number;
47
+ edgesEmitted: number;
48
+ /** Breakdown by primary evidence type — for the analyse-logs view. */
49
+ byEvidence: Record<string, number>;
50
+ }
51
+ export interface CrossRefsOptions {
52
+ /** See `UserConfig.crossRefsRarityThreshold`. Defaults to 3. */
53
+ rarityThreshold?: number;
54
+ /** See `UserConfig.crossRefsMaxFiles`. Defaults to 2000. */
55
+ maxFiles?: number;
56
+ /** See `UserConfig.crossRefsMaxEdges`. Defaults to 10 000. */
57
+ maxEdges?: number;
58
+ }
59
+ export declare function ingestCrossRefs(repo: MemoryRepository, root: string, opts?: CrossRefsOptions): Promise<CrossRefsIngestResult>;