@cleocode/contracts 2026.4.100 → 2026.4.102

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 (96) hide show
  1. package/dist/brain-graph.d.ts +245 -0
  2. package/dist/brain-graph.d.ts.map +1 -0
  3. package/dist/brain-graph.js +30 -0
  4. package/dist/brain-graph.js.map +1 -0
  5. package/dist/branch-lock.d.ts +225 -0
  6. package/dist/branch-lock.d.ts.map +1 -0
  7. package/dist/branch-lock.js +43 -0
  8. package/dist/branch-lock.js.map +1 -0
  9. package/dist/exit-codes.d.ts +1 -1
  10. package/dist/exit-codes.d.ts.map +1 -1
  11. package/dist/exit-codes.js +1 -1
  12. package/dist/exit-codes.js.map +1 -1
  13. package/dist/graph.d.ts +2 -0
  14. package/dist/graph.d.ts.map +1 -1
  15. package/dist/index.d.ts +11 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +2 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/nexus-contract-ops.d.ts +186 -0
  20. package/dist/nexus-contract-ops.d.ts.map +1 -0
  21. package/dist/nexus-contract-ops.js +11 -0
  22. package/dist/nexus-contract-ops.js.map +1 -0
  23. package/dist/nexus-living-brain-ops.d.ts +314 -0
  24. package/dist/nexus-living-brain-ops.d.ts.map +1 -0
  25. package/dist/nexus-living-brain-ops.js +15 -0
  26. package/dist/nexus-living-brain-ops.js.map +1 -0
  27. package/dist/nexus-query-ops.d.ts +82 -0
  28. package/dist/nexus-query-ops.d.ts.map +1 -0
  29. package/dist/nexus-query-ops.js +11 -0
  30. package/dist/nexus-query-ops.js.map +1 -0
  31. package/dist/nexus-route-ops.d.ts +103 -0
  32. package/dist/nexus-route-ops.d.ts.map +1 -0
  33. package/dist/nexus-route-ops.js +10 -0
  34. package/dist/nexus-route-ops.js.map +1 -0
  35. package/dist/nexus-tasks-bridge-ops.d.ts +68 -0
  36. package/dist/nexus-tasks-bridge-ops.d.ts.map +1 -0
  37. package/dist/nexus-tasks-bridge-ops.js +11 -0
  38. package/dist/nexus-tasks-bridge-ops.js.map +1 -0
  39. package/dist/nexus-wiki-ops.d.ts +127 -0
  40. package/dist/nexus-wiki-ops.d.ts.map +1 -0
  41. package/dist/nexus-wiki-ops.js +12 -0
  42. package/dist/nexus-wiki-ops.js.map +1 -0
  43. package/dist/operations/admin.d.ts +1781 -0
  44. package/dist/operations/admin.d.ts.map +1 -0
  45. package/dist/operations/admin.js +27 -0
  46. package/dist/operations/admin.js.map +1 -0
  47. package/dist/operations/brain.d.ts +34 -26
  48. package/dist/operations/brain.d.ts.map +1 -1
  49. package/dist/operations/brain.js +7 -6
  50. package/dist/operations/brain.js.map +1 -1
  51. package/dist/operations/docs.d.ts +279 -0
  52. package/dist/operations/docs.d.ts.map +1 -0
  53. package/dist/operations/docs.js +31 -0
  54. package/dist/operations/docs.js.map +1 -0
  55. package/dist/operations/intelligence.d.ts +319 -0
  56. package/dist/operations/intelligence.d.ts.map +1 -0
  57. package/dist/operations/intelligence.js +24 -0
  58. package/dist/operations/intelligence.js.map +1 -0
  59. package/dist/operations/orchestrate.d.ts +113 -2
  60. package/dist/operations/orchestrate.d.ts.map +1 -1
  61. package/dist/operations/orchestrate.js +3 -2
  62. package/dist/operations/orchestrate.js.map +1 -1
  63. package/dist/operations/session.d.ts +193 -47
  64. package/dist/operations/session.d.ts.map +1 -1
  65. package/dist/operations/session.js +7 -6
  66. package/dist/operations/session.js.map +1 -1
  67. package/dist/operations/sticky.d.ts +264 -0
  68. package/dist/operations/sticky.d.ts.map +1 -0
  69. package/dist/operations/sticky.js +19 -0
  70. package/dist/operations/sticky.js.map +1 -0
  71. package/dist/operations/validate.d.ts +145 -19
  72. package/dist/operations/validate.d.ts.map +1 -1
  73. package/dist/operations/validate.js +3 -3
  74. package/dist/task-record.d.ts +19 -0
  75. package/dist/task-record.d.ts.map +1 -1
  76. package/package.json +41 -1
  77. package/src/brain-graph.ts +282 -0
  78. package/src/branch-lock.ts +254 -0
  79. package/src/exit-codes.ts +1 -1
  80. package/src/graph.ts +2 -0
  81. package/src/index.ts +128 -0
  82. package/src/nexus-contract-ops.ts +244 -0
  83. package/src/nexus-living-brain-ops.ts +345 -0
  84. package/src/nexus-query-ops.ts +100 -0
  85. package/src/nexus-route-ops.ts +134 -0
  86. package/src/nexus-tasks-bridge-ops.ts +71 -0
  87. package/src/nexus-wiki-ops.ts +133 -0
  88. package/src/operations/admin.ts +2087 -0
  89. package/src/operations/brain.ts +34 -26
  90. package/src/operations/docs.ts +322 -0
  91. package/src/operations/intelligence.ts +399 -0
  92. package/src/operations/orchestrate.ts +117 -2
  93. package/src/operations/session.ts +225 -48
  94. package/src/operations/sticky.ts +308 -0
  95. package/src/operations/validate.ts +161 -55
  96. package/src/task-record.ts +19 -0
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Nexus Wiki Index Operations - Contract Layer
3
+ *
4
+ * Defines types for generating a community-grouped wiki index
5
+ * from the nexus code graph.
6
+ *
7
+ * @task T1060
8
+ * @task T1109
9
+ * @epic T1042
10
+ */
11
+
12
+ /**
13
+ * Statistics for a single community in the wiki index.
14
+ */
15
+ export interface CommunityWikiStats {
16
+ /** Community node ID (e.g. "community:42") */
17
+ communityId: string;
18
+ /** Number of symbols in this community */
19
+ memberCount: number;
20
+ }
21
+
22
+ /**
23
+ * Result of wiki index generation.
24
+ */
25
+ export interface NexusWikiResult {
26
+ /** Whether generation succeeded */
27
+ success: boolean;
28
+ /** Output directory where files were written */
29
+ outputDir: string;
30
+ /** Number of communities processed */
31
+ communityCount: number;
32
+ /** Total number of files written (community files + overview) */
33
+ fileCount: number;
34
+ /** Stats per community */
35
+ communities: CommunityWikiStats[];
36
+ /** Error message if success is false */
37
+ error?: string;
38
+ /** IDs of communities that were skipped (incremental mode) */
39
+ skippedCommunities?: string[];
40
+ /** Whether LOOM LLM narrative was generated */
41
+ loomEnabled?: boolean;
42
+ }
43
+
44
+ /**
45
+ * Symbol metadata as it appears in the wiki index.
46
+ */
47
+ export interface WikiSymbolRow {
48
+ /** Symbol name */
49
+ name: string;
50
+ /** Symbol kind (function, class, interface, etc.) */
51
+ kind: string;
52
+ /** File path relative to project root */
53
+ filePath: string | null;
54
+ /** Number of symbols that call this symbol */
55
+ callerCount: number;
56
+ /** Number of symbols this symbol calls */
57
+ calleeCount: number;
58
+ }
59
+
60
+ /**
61
+ * Subset of SQLite-compatible parameter values accepted by `DatabaseSync.prepare()`.
62
+ * Mirrors node:sqlite's `SQLInputValue` without importing from node internals.
63
+ */
64
+ export type WikiSqlParam = null | number | bigint | string | Uint8Array;
65
+
66
+ /**
67
+ * Minimal interface for an injectable SQLite database handle.
68
+ * Used in tests to provide an isolated in-memory or temp-file database
69
+ * instead of the real nexus.db singleton.
70
+ *
71
+ * Matches the subset of `DatabaseSync` (node:sqlite) used by the wiki generator.
72
+ */
73
+ export interface WikiDbHandle {
74
+ /**
75
+ * Prepare a SQL statement and return a statement object with
76
+ * `all(...params)` and `get(...params)` accessors.
77
+ * Compatible with both `DatabaseSync.prepare()` and test mocks.
78
+ */
79
+ prepare: (sql: string) => {
80
+ all: (...params: WikiSqlParam[]) => Record<string, WikiSqlParam>[];
81
+ get: (...params: WikiSqlParam[]) => Record<string, WikiSqlParam> | undefined;
82
+ };
83
+ }
84
+
85
+ /**
86
+ * Options for generating the nexus wiki index.
87
+ */
88
+ export interface GenerateNexusWikiOptions {
89
+ /**
90
+ * Filter generation to a single community ID.
91
+ * When set, only that community's markdown file is generated.
92
+ * The overview.md is NOT generated in single-community mode.
93
+ */
94
+ communityFilter?: string;
95
+ /**
96
+ * Enable incremental mode: use `cleo nexus diff` data to skip
97
+ * communities whose symbols have not changed since the last wiki run.
98
+ *
99
+ * Reads `.cleo/wiki-state.json` for the last-run commit SHA.
100
+ * On first run (no state file), performs a full generation and writes
101
+ * the state file.
102
+ */
103
+ incremental?: boolean;
104
+ /**
105
+ * LOOM provider function for generating narrative module summaries.
106
+ * Injected by the caller (CLI or test harness). When `null`, scaffold
107
+ * mode is used (no LLM narrative).
108
+ *
109
+ * Signature: `(prompt: string) => Promise<string>`
110
+ */
111
+ loomProvider?: ((prompt: string) => Promise<string>) | null;
112
+ /**
113
+ * Project root directory (used for resolving `.cleo/wiki-state.json`
114
+ * and running git operations). Defaults to `process.cwd()`.
115
+ */
116
+ projectRoot?: string;
117
+ /**
118
+ * Injectable database handle for testing.
119
+ * When provided, this handle is used instead of the real nexus.db singleton.
120
+ * Allows unit/integration tests to use isolated in-memory SQLite databases.
121
+ */
122
+ _dbForTesting?: WikiDbHandle;
123
+ }
124
+
125
+ /**
126
+ * State file persisted to `.cleo/wiki-state.json` for incremental mode.
127
+ */
128
+ export interface WikiStateFile {
129
+ /** Git commit SHA of the last full or incremental wiki generation run. */
130
+ lastRunCommit: string;
131
+ /** List of community IDs generated in the last run. */
132
+ generatedCommunities: string[];
133
+ }