@jefuriiij/synthra 0.1.22 → 0.1.23
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/CHANGELOG.md +46 -0
- package/dist/cli/index.js +59 -35
- package/dist/cli/index.js.map +1 -1
- package/dist/dashboard/index.js +7 -2
- package/dist/dashboard/index.js.map +1 -1
- package/dist/server/index.js +25 -6
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -273,6 +273,9 @@ import { resolve } from "path";
|
|
|
273
273
|
// src/scanner/extract.ts
|
|
274
274
|
import { dirname as dirname2, join as join3, posix } from "path";
|
|
275
275
|
|
|
276
|
+
// src/graph/types.ts
|
|
277
|
+
var SCHEMA_VERSION = 1;
|
|
278
|
+
|
|
276
279
|
// src/scanner/hash.ts
|
|
277
280
|
import { createHash } from "crypto";
|
|
278
281
|
function fileHash(content) {
|
|
@@ -609,7 +612,7 @@ async function buildGraph(root, parsed) {
|
|
|
609
612
|
nodes,
|
|
610
613
|
edges,
|
|
611
614
|
generated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
612
|
-
schema_version:
|
|
615
|
+
schema_version: SCHEMA_VERSION
|
|
613
616
|
};
|
|
614
617
|
}
|
|
615
618
|
function buildSymbolIndex(graph) {
|
|
@@ -1143,6 +1146,7 @@ var TS_QUERY = `
|
|
|
1143
1146
|
(enum_declaration name: (identifier) @enum.name) @enum
|
|
1144
1147
|
(method_definition name: (property_identifier) @method.name) @method
|
|
1145
1148
|
(lexical_declaration (variable_declarator name: (identifier) @const-fn.name value: [(arrow_function) (function_expression)])) @const-fn
|
|
1149
|
+
(assignment_expression left: (member_expression property: (property_identifier) @member-fn.name) right: [(arrow_function) (function_expression)]) @member-fn
|
|
1146
1150
|
(import_statement source: (string) @import)
|
|
1147
1151
|
`;
|
|
1148
1152
|
var JS_QUERY = `
|
|
@@ -1150,6 +1154,7 @@ var JS_QUERY = `
|
|
|
1150
1154
|
(class_declaration name: (identifier) @class.name) @class
|
|
1151
1155
|
(method_definition name: (property_identifier) @method.name) @method
|
|
1152
1156
|
(lexical_declaration (variable_declarator name: (identifier) @const-fn.name value: [(arrow_function) (function_expression)])) @const-fn
|
|
1157
|
+
(assignment_expression left: (member_expression property: (property_identifier) @member-fn.name) right: [(arrow_function) (function_expression)]) @member-fn
|
|
1153
1158
|
(import_statement source: (string) @import)
|
|
1154
1159
|
(call_expression function: (identifier) @_require_fn arguments: (arguments . (string) @require_source))
|
|
1155
1160
|
`;
|
|
@@ -1174,7 +1179,7 @@ function shapeFromCaptures(captures) {
|
|
|
1174
1179
|
const name = captures.get(`${k}.name`);
|
|
1175
1180
|
return decl && name ? { decl, name, kind: sk } : null;
|
|
1176
1181
|
};
|
|
1177
|
-
return findDecl("function", "function") ?? findDecl("class", "class") ?? findDecl("interface", "interface") ?? findDecl("type", "type") ?? findDecl("enum", "enum") ?? findDecl("method", "method") ?? findDecl("const-fn", "function");
|
|
1182
|
+
return findDecl("function", "function") ?? findDecl("class", "class") ?? findDecl("interface", "interface") ?? findDecl("type", "type") ?? findDecl("enum", "enum") ?? findDecl("method", "method") ?? findDecl("const-fn", "function") ?? findDecl("member-fn", "function");
|
|
1178
1183
|
}
|
|
1179
1184
|
async function parseTypeScript(f, source) {
|
|
1180
1185
|
const grammar = grammarFor(f.ext);
|
|
@@ -1612,7 +1617,7 @@ import { basename as basename2 } from "path";
|
|
|
1612
1617
|
// src/hooks/claude-md.ts
|
|
1613
1618
|
import { readFile as readFile6, writeFile as writeFile2 } from "fs/promises";
|
|
1614
1619
|
import { basename, dirname as dirname4 } from "path";
|
|
1615
|
-
var POLICY_VERSION =
|
|
1620
|
+
var POLICY_VERSION = 5;
|
|
1616
1621
|
var POLICY_BEGIN = `<!-- synthra-policy v${POLICY_VERSION} BEGIN -->`;
|
|
1617
1622
|
var POLICY_END = `<!-- synthra-policy v${POLICY_VERSION} END -->`;
|
|
1618
1623
|
var ANY_BLOCK_RE = /<!--\s*synthra-policy\s+v\d+\s+BEGIN\s*-->[\s\S]*?<!--\s*synthra-policy\s+v\d+\s+END\s*-->\s*/g;
|
|
@@ -1680,6 +1685,10 @@ function policyBlock() {
|
|
|
1680
1685
|
" reads should be rare \u2014 only when you genuinely need the full file.",
|
|
1681
1686
|
"- If `graph_continue`'s `Files` list contains a `::` entry, pass it",
|
|
1682
1687
|
" verbatim to `graph_read`.",
|
|
1688
|
+
"- **Large file?** Don't read it in successive line-range chunks \u2014 call",
|
|
1689
|
+
' `graph_continue` or `graph_read("file::symbol")` to pull the one symbol',
|
|
1690
|
+
" you need. Chunked whole-file Reads are exactly the cost `graph_read`",
|
|
1691
|
+
" exists to avoid.",
|
|
1683
1692
|
"",
|
|
1684
1693
|
"### Editing a file",
|
|
1685
1694
|
"",
|
|
@@ -2234,7 +2243,7 @@ async function writeContextMd(path, ctx) {
|
|
|
2234
2243
|
// src/memory/context-store.ts
|
|
2235
2244
|
import { mkdir as mkdir5, readFile as readFile10, writeFile as writeFile5 } from "fs/promises";
|
|
2236
2245
|
import { dirname as dirname6 } from "path";
|
|
2237
|
-
var
|
|
2246
|
+
var SCHEMA_VERSION2 = 1;
|
|
2238
2247
|
async function readEntries(path) {
|
|
2239
2248
|
try {
|
|
2240
2249
|
const raw = await readFile10(path, "utf8");
|
|
@@ -2246,7 +2255,7 @@ async function readEntries(path) {
|
|
|
2246
2255
|
}
|
|
2247
2256
|
async function writeEntries(path, entries) {
|
|
2248
2257
|
await mkdir5(dirname6(path), { recursive: true });
|
|
2249
|
-
const store = { schema_version:
|
|
2258
|
+
const store = { schema_version: SCHEMA_VERSION2, entries };
|
|
2250
2259
|
await writeFile5(path, JSON.stringify(store, null, 2) + "\n", "utf8");
|
|
2251
2260
|
}
|
|
2252
2261
|
async function appendEntry(path, entry) {
|
|
@@ -3165,10 +3174,20 @@ ${fileCount} files indexed, ${symbolCount} symbols. Prefer the graph_* MCP tools
|
|
|
3165
3174
|
// src/server/http.ts
|
|
3166
3175
|
async function loadContext(paths) {
|
|
3167
3176
|
try {
|
|
3168
|
-
|
|
3177
|
+
let [graph, symbolIndex] = await Promise.all([
|
|
3169
3178
|
readGraph(paths.infoGraph),
|
|
3170
3179
|
readSymbolIndex(paths.symbolIndex)
|
|
3171
3180
|
]);
|
|
3181
|
+
if (graph.schema_version !== SCHEMA_VERSION) {
|
|
3182
|
+
log.info(
|
|
3183
|
+
`graph schema v${graph.schema_version} \u2260 current v${SCHEMA_VERSION} \u2014 rescanning\u2026`
|
|
3184
|
+
);
|
|
3185
|
+
await scanProject(paths.projectRoot, { silent: true });
|
|
3186
|
+
[graph, symbolIndex] = await Promise.all([
|
|
3187
|
+
readGraph(paths.infoGraph),
|
|
3188
|
+
readSymbolIndex(paths.symbolIndex)
|
|
3189
|
+
]);
|
|
3190
|
+
}
|
|
3172
3191
|
const activity = new ActivityStore(paths.activityLog);
|
|
3173
3192
|
return { paths, graph, symbolIndex, activity };
|
|
3174
3193
|
} catch (err2) {
|