@monoes/monograph 1.2.1 → 1.2.2
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.
- package/.monomind/loops/mastermind-review-1782162423447.json +16 -0
- package/dist/src/cli/skill-gen.js +3 -0
- package/dist/src/cli/skill-gen.js.map +1 -1
- package/dist/src/graph/node-search.d.ts.map +1 -1
- package/dist/src/graph/node-search.js.map +1 -1
- package/dist/src/graph/pagerank.d.ts.map +1 -1
- package/dist/src/graph/pagerank.js.map +1 -1
- package/dist/src/graph/subgraph.d.ts.map +1 -1
- package/dist/src/graph/subgraph.js.map +1 -1
- package/dist/src/pipeline/orchestrator.d.ts +2 -0
- package/dist/src/wiki/wiki-generator.d.ts.map +1 -1
- package/dist/src/wiki/wiki-generator.js +5 -1
- package/dist/src/wiki/wiki-generator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/cli/skill-gen.ts +3 -0
- package/src/graph/node-search.ts +3 -2
- package/src/graph/pagerank.ts +3 -2
- package/src/graph/subgraph.ts +2 -1
- package/src/wiki/wiki-generator.ts +5 -1
package/package.json
CHANGED
package/src/cli/skill-gen.ts
CHANGED
|
@@ -245,6 +245,9 @@ function renderSkillMarkdown(
|
|
|
245
245
|
lines.push('---');
|
|
246
246
|
lines.push(`name: ${toKebabName(label)}`);
|
|
247
247
|
lines.push(`description: "Skill for the ${label} community. ${members.length} symbols."`);
|
|
248
|
+
lines.push(`type: Code Community`);
|
|
249
|
+
lines.push(`tags: [monograph, code-community]`);
|
|
250
|
+
lines.push(`timestamp: ${new Date().toISOString()}`);
|
|
248
251
|
lines.push('---');
|
|
249
252
|
lines.push('');
|
|
250
253
|
|
package/src/graph/node-search.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Database from 'better-sqlite3';
|
|
1
2
|
import type { MonographNode, NodeLabel } from '../types.js';
|
|
2
3
|
import type { MonographDb } from '../storage/db.js';
|
|
3
4
|
|
|
@@ -55,13 +56,13 @@ function rowToNode(r: {
|
|
|
55
56
|
// so the same query shape reuses the compiled statement across calls.
|
|
56
57
|
|
|
57
58
|
// WeakMap ensures the cache is garbage-collected when the DB object is released.
|
|
58
|
-
const stmtCache = new WeakMap<object, Map<string,
|
|
59
|
+
const stmtCache = new WeakMap<object, Map<string, Database.Statement>>();
|
|
59
60
|
|
|
60
61
|
function getCachedStmt(
|
|
61
62
|
db: MonographDb,
|
|
62
63
|
key: string,
|
|
63
64
|
buildSql: () => string,
|
|
64
|
-
):
|
|
65
|
+
): Database.Statement {
|
|
65
66
|
let dbCache = stmtCache.get(db);
|
|
66
67
|
if (!dbCache) {
|
|
67
68
|
dbCache = new Map();
|
package/src/graph/pagerank.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Database from 'better-sqlite3';
|
|
1
2
|
import type { MonographDb } from '../storage/db.js';
|
|
2
3
|
|
|
3
4
|
export interface PageRankOptions {
|
|
@@ -13,8 +14,8 @@ export interface PageRankOptions {
|
|
|
13
14
|
// Per-DB statement cache — avoids recompiling SQL on every pageRank() call.
|
|
14
15
|
// ---------------------------------------------------------------------------
|
|
15
16
|
interface StmtCache {
|
|
16
|
-
selectNodes:
|
|
17
|
-
selectEdges:
|
|
17
|
+
selectNodes: Database.Statement;
|
|
18
|
+
selectEdges: Database.Statement;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
const _stmtCache = new Map<string, StmtCache>();
|
package/src/graph/subgraph.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Database from 'better-sqlite3';
|
|
1
2
|
import type { MonographNode, MonographEdge } from '../types.js';
|
|
2
3
|
import type { MonographDb } from '../storage/db.js';
|
|
3
4
|
|
|
@@ -66,7 +67,7 @@ export function extractInducedSubgraph(db: MonographDb, nodeIds: string[]): Indu
|
|
|
66
67
|
const stmts = getStmtCaches(db);
|
|
67
68
|
|
|
68
69
|
// Chunk helper — caches prepared statements by chunk size to avoid re-prepare per call.
|
|
69
|
-
function queryChunked<T>(ids: string[], chunkSize: number, stmtCache: Map<number,
|
|
70
|
+
function queryChunked<T>(ids: string[], chunkSize: number, stmtCache: Map<number, Database.Statement>, sql: (ph: string) => string): T[] {
|
|
70
71
|
const results: T[] = [];
|
|
71
72
|
for (let i = 0; i < ids.length; i += chunkSize) {
|
|
72
73
|
const chunk = ids.slice(i, i + chunkSize);
|
|
@@ -160,7 +160,11 @@ export async function generateWikiPage(
|
|
|
160
160
|
content = (block?.type === 'text') ? block.text : '';
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
// 7. Persist to DB
|
|
163
|
+
// 7. Persist to DB — prepend OKF frontmatter if not already present
|
|
164
|
+
if (!content.startsWith('---')) {
|
|
165
|
+
const safeLabel = label.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
166
|
+
content = `---\ntype: Code Community Wiki\ntitle: "${safeLabel}"\ntags: [monograph, wiki]\ntimestamp: ${new Date().toISOString()}\n---\n\n${content}`;
|
|
167
|
+
}
|
|
164
168
|
upsertWikiPage(db, communityIdStr, content);
|
|
165
169
|
|
|
166
170
|
return content;
|