musubix2 0.5.7 → 0.5.9
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/.claude/.musubix-managed +1 -1
- package/dist/assets/skills-manifest.json +1 -1
- package/dist/cli.js +320 -165
- package/dist/index.js +320 -165
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13836,108 +13836,139 @@ function fail(error) {
|
|
|
13836
13836
|
}
|
|
13837
13837
|
function sddCoreTools() {
|
|
13838
13838
|
return [
|
|
13839
|
-
tool("sdd.requirements.create", "Create an EARS requirement (Easy Approach to Requirements Syntax)", "sdd-core", [
|
|
13840
|
-
param("
|
|
13841
|
-
param("text", "string", "Requirement text"),
|
|
13839
|
+
tool("sdd.requirements.create", "Create and classify an EARS requirement (Easy Approach to Requirements Syntax)", "sdd-core", [
|
|
13840
|
+
param("text", "string", "Requirement text (EARS sentence)"),
|
|
13842
13841
|
param("id", "string", "Requirement ID", false)
|
|
13843
13842
|
], async (params) => {
|
|
13844
13843
|
try {
|
|
13845
|
-
const
|
|
13846
|
-
const
|
|
13847
|
-
|
|
13848
|
-
|
|
13849
|
-
|
|
13844
|
+
const { createEARSValidator: createEARSValidator2 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
13845
|
+
const v = createEARSValidator2();
|
|
13846
|
+
const text = params["text"];
|
|
13847
|
+
const analysis = v.analyze(text);
|
|
13848
|
+
const validation = v.validate(text);
|
|
13849
|
+
return ok({
|
|
13850
|
+
id: params["id"] ?? "REQ-XXX-001",
|
|
13851
|
+
text,
|
|
13852
|
+
pattern: analysis.pattern,
|
|
13853
|
+
confidence: analysis.confidence,
|
|
13854
|
+
valid: validation.valid,
|
|
13855
|
+
issues: validation.issues
|
|
13850
13856
|
});
|
|
13851
|
-
return ok(req ?? { pattern: params["pattern"], text: params["text"], id: params["id"] ?? "REQ-001" });
|
|
13852
13857
|
} catch {
|
|
13853
|
-
return
|
|
13858
|
+
return fail("Core package not available");
|
|
13854
13859
|
}
|
|
13855
13860
|
}),
|
|
13856
|
-
tool("sdd.requirements.validate", "Validate requirements for
|
|
13861
|
+
tool("sdd.requirements.validate", "Validate requirements (EARS pattern + issues) for a list of requirement texts", "sdd-core", [param("requirements", "array", "Array of requirement texts or {text} objects")], async (params) => {
|
|
13857
13862
|
try {
|
|
13858
|
-
const
|
|
13859
|
-
const
|
|
13860
|
-
|
|
13863
|
+
const { createEARSValidator: createEARSValidator2 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
13864
|
+
const v = createEARSValidator2();
|
|
13865
|
+
const items = params["requirements"] ?? [];
|
|
13866
|
+
const results = items.map((it) => {
|
|
13867
|
+
const text = typeof it === "string" ? it : it.text ?? "";
|
|
13868
|
+
const analysis = v.analyze(text);
|
|
13869
|
+
const validation = v.validate(text);
|
|
13870
|
+
return { text, pattern: analysis.pattern, valid: validation.valid, issues: validation.issues };
|
|
13871
|
+
});
|
|
13872
|
+
return ok({ results, allValid: results.every((r) => r.valid) });
|
|
13861
13873
|
} catch {
|
|
13862
|
-
return
|
|
13874
|
+
return fail("Core package not available");
|
|
13863
13875
|
}
|
|
13864
13876
|
}),
|
|
13865
|
-
tool("sdd.requirements.list", "
|
|
13877
|
+
tool("sdd.requirements.list", "Parse and list requirements from a Markdown requirements document", "sdd-core", [param("markdown", "string", "Requirements document contents (Markdown)")], async (params) => {
|
|
13866
13878
|
try {
|
|
13867
|
-
const
|
|
13868
|
-
const
|
|
13869
|
-
return ok(
|
|
13879
|
+
const { MarkdownEARSParser: MarkdownEARSParser2 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
13880
|
+
const parsed = new MarkdownEARSParser2().parse(params["markdown"] ?? "");
|
|
13881
|
+
return ok(parsed.map((r) => ({ id: r.id, title: r.title, pattern: r.pattern, text: r.text })));
|
|
13870
13882
|
} catch {
|
|
13871
|
-
return
|
|
13883
|
+
return fail("Core package not available");
|
|
13872
13884
|
}
|
|
13873
13885
|
}),
|
|
13874
|
-
tool("sdd.design.generate", "Generate a design document from requirements", "sdd-core", [
|
|
13875
|
-
param("requirements", "array", "Requirements to generate design from"),
|
|
13876
|
-
param("format", "string", "Output format: markdown | json", false, "markdown")
|
|
13877
|
-
], async (params) => {
|
|
13886
|
+
tool("sdd.design.generate", "Generate a design document from parsed requirements", "sdd-core", [param("requirements", "array", "Requirements as {id,title,text,pattern} objects")], async (params) => {
|
|
13878
13887
|
try {
|
|
13879
|
-
const
|
|
13880
|
-
const
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13888
|
+
const { createDesignGenerator: createDesignGenerator2 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
13889
|
+
const reqs = params["requirements"] ?? [];
|
|
13890
|
+
const mapped = reqs.map((r) => ({
|
|
13891
|
+
id: String(r["id"] ?? "REQ-XXX-001"),
|
|
13892
|
+
title: String(r["title"] ?? ""),
|
|
13893
|
+
text: String(r["text"] ?? ""),
|
|
13894
|
+
pattern: String(r["pattern"] ?? "ubiquitous")
|
|
13895
|
+
}));
|
|
13896
|
+
return ok(createDesignGenerator2().generate(mapped));
|
|
13885
13897
|
} catch {
|
|
13886
|
-
return
|
|
13898
|
+
return fail("Core package not available");
|
|
13887
13899
|
}
|
|
13888
13900
|
}),
|
|
13889
|
-
tool("sdd.design.verify", "Verify design
|
|
13890
|
-
param("design", "object", "Design document to verify"),
|
|
13891
|
-
param("requirements", "array", "Requirements to trace against")
|
|
13892
|
-
], async (params) => {
|
|
13901
|
+
tool("sdd.design.verify", "Verify a design against SOLID principles", "sdd-core", [param("requirements", "array", "Requirements the design is generated from")], async (params) => {
|
|
13893
13902
|
try {
|
|
13894
|
-
const
|
|
13895
|
-
const
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
13903
|
+
const { createDesignGenerator: createDesignGenerator2, createSOLIDValidator: createSOLIDValidator2 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
13904
|
+
const reqs = params["requirements"] ?? [];
|
|
13905
|
+
const mapped = reqs.map((r) => ({
|
|
13906
|
+
id: String(r["id"] ?? "REQ-XXX-001"),
|
|
13907
|
+
title: String(r["title"] ?? ""),
|
|
13908
|
+
text: String(r["text"] ?? ""),
|
|
13909
|
+
pattern: String(r["pattern"] ?? "ubiquitous")
|
|
13910
|
+
}));
|
|
13911
|
+
const design = createDesignGenerator2().generate(mapped);
|
|
13912
|
+
return ok(createSOLIDValidator2().validate(design));
|
|
13900
13913
|
} catch {
|
|
13901
|
-
return
|
|
13914
|
+
return fail("Core package not available");
|
|
13902
13915
|
}
|
|
13903
13916
|
}),
|
|
13904
|
-
tool("sdd.codegen.generate", "Generate code from a
|
|
13905
|
-
param("
|
|
13906
|
-
param("
|
|
13917
|
+
tool("sdd.codegen.generate", "Generate a code skeleton (class/interface/function) from a name", "sdd-core", [
|
|
13918
|
+
param("name", "string", "Symbol name to generate"),
|
|
13919
|
+
param("templateType", "string", "class | interface | function | enum | type", false, "class"),
|
|
13920
|
+
param("description", "string", "Doc description", false)
|
|
13907
13921
|
], async (params) => {
|
|
13908
13922
|
try {
|
|
13909
|
-
const
|
|
13910
|
-
const code =
|
|
13911
|
-
|
|
13912
|
-
|
|
13923
|
+
const { createCodeGenerator: createCodeGenerator2 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
13924
|
+
const code = createCodeGenerator2().generate({
|
|
13925
|
+
templateType: params["templateType"] ?? "class",
|
|
13926
|
+
name: params["name"] ?? "Generated",
|
|
13927
|
+
description: params["description"]
|
|
13913
13928
|
});
|
|
13914
|
-
return ok(code
|
|
13929
|
+
return ok(code);
|
|
13915
13930
|
} catch {
|
|
13916
|
-
return
|
|
13931
|
+
return fail("Core package not available");
|
|
13917
13932
|
}
|
|
13918
13933
|
}),
|
|
13919
|
-
tool("sdd.test.generate", "Generate
|
|
13920
|
-
param("
|
|
13921
|
-
param("
|
|
13934
|
+
tool("sdd.test.generate", "Generate a unit-test skeleton from source code", "sdd-core", [
|
|
13935
|
+
param("code", "string", "Source code to generate tests for"),
|
|
13936
|
+
param("style", "string", "Test style: unit | integration", false, "unit")
|
|
13922
13937
|
], async (params) => {
|
|
13923
13938
|
try {
|
|
13924
|
-
const
|
|
13925
|
-
const
|
|
13926
|
-
|
|
13927
|
-
framework: params["framework"] ?? "vitest"
|
|
13928
|
-
});
|
|
13929
|
-
return ok(tests ?? { files: [], framework: params["framework"] ?? "vitest" });
|
|
13939
|
+
const { createUnitTestGenerator: createUnitTestGenerator2 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
13940
|
+
const suite = createUnitTestGenerator2().generate(params["code"] ?? "", params["style"] ?? "unit");
|
|
13941
|
+
return ok(suite);
|
|
13930
13942
|
} catch {
|
|
13931
|
-
return
|
|
13943
|
+
return fail("Core package not available");
|
|
13932
13944
|
}
|
|
13933
13945
|
}),
|
|
13934
|
-
tool("sdd.trace.verify", "Verify
|
|
13946
|
+
tool("sdd.trace.verify", "Verify requirement \u2192 code coverage by scanning source references (REQ-XXX-NNN)", "sdd-core", [
|
|
13947
|
+
param("requirementIds", "array", 'Requirement IDs to check (e.g. ["REQ-AUT-001"])'),
|
|
13948
|
+
param("sources", "array", "Sources as {file, code} objects to scan for references")
|
|
13949
|
+
], async (params) => {
|
|
13935
13950
|
try {
|
|
13936
|
-
const
|
|
13937
|
-
const
|
|
13938
|
-
|
|
13951
|
+
const reqIds = [...new Set(params["requirementIds"] ?? [])];
|
|
13952
|
+
const sources = params["sources"] ?? [];
|
|
13953
|
+
const refRe = /REQ-[A-Z]{3}-\d{3}/g;
|
|
13954
|
+
const covered = /* @__PURE__ */ new Set();
|
|
13955
|
+
for (const s of sources) {
|
|
13956
|
+
for (const m of (s.code ?? "").matchAll(refRe)) {
|
|
13957
|
+
if (reqIds.includes(m[0]))
|
|
13958
|
+
covered.add(m[0]);
|
|
13959
|
+
}
|
|
13960
|
+
}
|
|
13961
|
+
const gaps = reqIds.filter((r) => !covered.has(r));
|
|
13962
|
+
const coverage = reqIds.length === 0 ? 0 : Math.round(covered.size / reqIds.length * 100);
|
|
13963
|
+
return ok({
|
|
13964
|
+
total: reqIds.length,
|
|
13965
|
+
covered: covered.size,
|
|
13966
|
+
coverage,
|
|
13967
|
+
gaps,
|
|
13968
|
+
complete: gaps.length === 0 && reqIds.length > 0
|
|
13969
|
+
});
|
|
13939
13970
|
} catch {
|
|
13940
|
-
return
|
|
13971
|
+
return fail("Trace verification failed");
|
|
13941
13972
|
}
|
|
13942
13973
|
}),
|
|
13943
13974
|
// ── Requirements Interview tools ──
|
|
@@ -14149,63 +14180,101 @@ function policyTools() {
|
|
|
14149
14180
|
})
|
|
14150
14181
|
];
|
|
14151
14182
|
}
|
|
14183
|
+
async function loadTripleStore(basePath) {
|
|
14184
|
+
const { createOntologyStore: createOntologyStore2 } = await Promise.resolve().then(() => (init_dist3(), dist_exports3));
|
|
14185
|
+
const store = createOntologyStore2();
|
|
14186
|
+
const { existsSync: existsSync12, readFileSync: readFileSync7 } = await import("node:fs");
|
|
14187
|
+
const { join: join8 } = await import("node:path");
|
|
14188
|
+
const file = join8(basePath, ".musubix", "ontology.json");
|
|
14189
|
+
try {
|
|
14190
|
+
if (existsSync12(file)) {
|
|
14191
|
+
store.addTriples(JSON.parse(readFileSync7(file, "utf-8")));
|
|
14192
|
+
}
|
|
14193
|
+
} catch {
|
|
14194
|
+
}
|
|
14195
|
+
return { store, file };
|
|
14196
|
+
}
|
|
14197
|
+
async function saveTripleStore(store, file) {
|
|
14198
|
+
const { writeFileSync: writeFileSync4, mkdirSync: mkdirSync4 } = await import("node:fs");
|
|
14199
|
+
const { dirname: dirname4 } = await import("node:path");
|
|
14200
|
+
mkdirSync4(dirname4(file), { recursive: true });
|
|
14201
|
+
writeFileSync4(file, JSON.stringify(store.getAll(), null, 2), "utf-8");
|
|
14202
|
+
}
|
|
14152
14203
|
function ontologyTools() {
|
|
14153
14204
|
return [
|
|
14154
|
-
tool("ontology.triple.add", "Add a triple (subject, predicate, object) to the ontology store", "ontology", [
|
|
14155
|
-
param("subject", "string", "Subject
|
|
14156
|
-
param("predicate", "string", "Predicate
|
|
14157
|
-
param("object", "string", "Object URI or literal")
|
|
14205
|
+
tool("ontology.triple.add", "Add a triple (subject, predicate, object) to the persisted ontology store", "ontology", [
|
|
14206
|
+
param("subject", "string", "Subject"),
|
|
14207
|
+
param("predicate", "string", "Predicate"),
|
|
14208
|
+
param("object", "string", "Object (URI or literal)"),
|
|
14209
|
+
param("basePath", "string", "Project base path", false, ".")
|
|
14158
14210
|
], async (params) => {
|
|
14159
14211
|
try {
|
|
14160
|
-
const
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14212
|
+
const { store, file } = await loadTripleStore(params["basePath"] ?? ".");
|
|
14213
|
+
store.addTriple({
|
|
14214
|
+
subject: params["subject"],
|
|
14215
|
+
predicate: params["predicate"],
|
|
14216
|
+
object: params["object"]
|
|
14217
|
+
});
|
|
14218
|
+
await saveTripleStore(store, file);
|
|
14219
|
+
return ok({ added: true, total: store.size() });
|
|
14164
14220
|
} catch {
|
|
14165
|
-
return
|
|
14221
|
+
return fail("Ontology package not available");
|
|
14166
14222
|
}
|
|
14167
14223
|
}),
|
|
14168
|
-
tool("ontology.triple.query", "Query triples by pattern
|
|
14169
|
-
param("subject", "string", "Subject pattern
|
|
14170
|
-
param("predicate", "string", "Predicate pattern
|
|
14171
|
-
param("object", "string", "Object pattern
|
|
14224
|
+
tool("ontology.triple.query", "Query triples by pattern (omit a term to wildcard it)", "ontology", [
|
|
14225
|
+
param("subject", "string", "Subject pattern", false),
|
|
14226
|
+
param("predicate", "string", "Predicate pattern", false),
|
|
14227
|
+
param("object", "string", "Object pattern", false),
|
|
14228
|
+
param("basePath", "string", "Project base path", false, ".")
|
|
14172
14229
|
], async (params) => {
|
|
14173
14230
|
try {
|
|
14174
|
-
const
|
|
14175
|
-
const
|
|
14176
|
-
|
|
14177
|
-
|
|
14231
|
+
const { store } = await loadTripleStore(params["basePath"] ?? ".");
|
|
14232
|
+
const results = store.query({
|
|
14233
|
+
subject: params["subject"],
|
|
14234
|
+
predicate: params["predicate"],
|
|
14235
|
+
object: params["object"]
|
|
14236
|
+
});
|
|
14237
|
+
return ok({ results, count: results.length });
|
|
14178
14238
|
} catch {
|
|
14179
|
-
return
|
|
14239
|
+
return fail("Ontology package not available");
|
|
14180
14240
|
}
|
|
14181
14241
|
}),
|
|
14182
|
-
tool("ontology.rules.apply", "Apply rule engine to infer new triples", "ontology", [param("
|
|
14242
|
+
tool("ontology.rules.apply", "Apply the default OWL 2 RL rule engine to infer new triples", "ontology", [param("basePath", "string", "Project base path", false, ".")], async (params) => {
|
|
14183
14243
|
try {
|
|
14184
|
-
const
|
|
14185
|
-
const
|
|
14186
|
-
const result =
|
|
14187
|
-
|
|
14244
|
+
const { createRuleEngine: createRuleEngine2 } = await Promise.resolve().then(() => (init_dist3(), dist_exports3));
|
|
14245
|
+
const { store, file } = await loadTripleStore(params["basePath"] ?? ".");
|
|
14246
|
+
const result = createRuleEngine2(true).applyRules(store);
|
|
14247
|
+
await saveTripleStore(store, file);
|
|
14248
|
+
return ok(result);
|
|
14188
14249
|
} catch {
|
|
14189
|
-
return
|
|
14250
|
+
return fail("Ontology package not available");
|
|
14190
14251
|
}
|
|
14191
14252
|
}),
|
|
14192
|
-
tool("ontology.consistency.check", "Check ontology consistency", "ontology", [], async () => {
|
|
14253
|
+
tool("ontology.consistency.check", "Check ontology consistency against the persisted store", "ontology", [param("basePath", "string", "Project base path", false, ".")], async (params) => {
|
|
14193
14254
|
try {
|
|
14194
|
-
const
|
|
14195
|
-
const
|
|
14196
|
-
|
|
14197
|
-
return ok(result ?? { consistent: true, issues: [] });
|
|
14255
|
+
const { createConsistencyValidator: createConsistencyValidator2 } = await Promise.resolve().then(() => (init_dist3(), dist_exports3));
|
|
14256
|
+
const { store } = await loadTripleStore(params["basePath"] ?? ".");
|
|
14257
|
+
return ok(createConsistencyValidator2().validate(store));
|
|
14198
14258
|
} catch {
|
|
14199
|
-
return
|
|
14259
|
+
return fail("Ontology package not available");
|
|
14200
14260
|
}
|
|
14201
14261
|
}),
|
|
14202
|
-
tool("ontology.sparql.query", "
|
|
14262
|
+
tool("ontology.sparql.query", "Pattern query over the store (basic subject/predicate/object matching)", "ontology", [
|
|
14263
|
+
param("subject", "string", "Subject pattern", false),
|
|
14264
|
+
param("predicate", "string", "Predicate pattern", false),
|
|
14265
|
+
param("object", "string", "Object pattern", false),
|
|
14266
|
+
param("basePath", "string", "Project base path", false, ".")
|
|
14267
|
+
], async (params) => {
|
|
14203
14268
|
try {
|
|
14204
|
-
const
|
|
14205
|
-
const
|
|
14206
|
-
|
|
14269
|
+
const { store } = await loadTripleStore(params["basePath"] ?? ".");
|
|
14270
|
+
const bindings = store.query({
|
|
14271
|
+
subject: params["subject"],
|
|
14272
|
+
predicate: params["predicate"],
|
|
14273
|
+
object: params["object"]
|
|
14274
|
+
});
|
|
14275
|
+
return ok({ bindings, count: bindings.length });
|
|
14207
14276
|
} catch {
|
|
14208
|
-
return
|
|
14277
|
+
return fail("Ontology package not available");
|
|
14209
14278
|
}
|
|
14210
14279
|
})
|
|
14211
14280
|
];
|
|
@@ -14217,47 +14286,78 @@ function codeAnalysisTools() {
|
|
|
14217
14286
|
param("language", "string", "Source language: typescript | javascript | python", false, "typescript")
|
|
14218
14287
|
], async (params) => {
|
|
14219
14288
|
try {
|
|
14220
|
-
const
|
|
14221
|
-
const
|
|
14222
|
-
return ok(
|
|
14289
|
+
const { createASTParser: createASTParser2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports4));
|
|
14290
|
+
const nodes = createASTParser2().parse(params["source"] ?? "", params["language"] ?? "typescript");
|
|
14291
|
+
return ok({ nodes, count: nodes.length });
|
|
14223
14292
|
} catch {
|
|
14224
|
-
return
|
|
14293
|
+
return fail("Codegraph package not available");
|
|
14225
14294
|
}
|
|
14226
14295
|
}),
|
|
14227
|
-
tool("code.graph.build", "Build a
|
|
14228
|
-
param("entryPoint", "string", "Entry point file path"),
|
|
14229
|
-
param("basePath", "string", "Project base path", false, ".")
|
|
14230
|
-
], async (params) => {
|
|
14296
|
+
tool("code.graph.build", "Build a code graph (nodes) from inline sources", "code-analysis", [param("sources", "array", "Sources as {code, language, filePath} objects")], async (params) => {
|
|
14231
14297
|
try {
|
|
14232
|
-
const
|
|
14233
|
-
const
|
|
14234
|
-
|
|
14298
|
+
const { createASTParser: createASTParser2, createGraphEngine: createGraphEngine2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports4));
|
|
14299
|
+
const parser = createASTParser2();
|
|
14300
|
+
const engine = createGraphEngine2();
|
|
14301
|
+
const sources = params["sources"] ?? [];
|
|
14302
|
+
for (const s of sources) {
|
|
14303
|
+
const lang = s.language ?? "typescript";
|
|
14304
|
+
for (const n of parser.parse(s.code ?? "", lang)) {
|
|
14305
|
+
engine.addNode({
|
|
14306
|
+
id: `${s.filePath ?? "inline"}:${n.name}`,
|
|
14307
|
+
name: n.name,
|
|
14308
|
+
kind: n.kind,
|
|
14309
|
+
filePath: s.filePath ?? "inline",
|
|
14310
|
+
language: lang,
|
|
14311
|
+
startLine: n.startLine ?? 0,
|
|
14312
|
+
endLine: n.endLine ?? 0
|
|
14313
|
+
});
|
|
14314
|
+
}
|
|
14315
|
+
}
|
|
14316
|
+
const stats = engine.getStats();
|
|
14317
|
+
return ok({ nodeCount: stats.nodeCount, edgeCount: stats.edgeCount, languages: [...stats.languages] });
|
|
14235
14318
|
} catch {
|
|
14236
|
-
return
|
|
14319
|
+
return fail("Codegraph package not available");
|
|
14237
14320
|
}
|
|
14238
14321
|
}),
|
|
14239
|
-
tool("code.graph.search", "Search code graph using GraphRAG
|
|
14322
|
+
tool("code.graph.search", "Search a code graph built from inline sources using GraphRAG", "code-analysis", [
|
|
14240
14323
|
param("query", "string", "Search query"),
|
|
14241
|
-
param("
|
|
14324
|
+
param("sources", "array", "Sources as {code, language, filePath} objects to index")
|
|
14242
14325
|
], async (params) => {
|
|
14243
14326
|
try {
|
|
14244
|
-
const
|
|
14245
|
-
const
|
|
14246
|
-
|
|
14327
|
+
const { createASTParser: createASTParser2, createGraphEngine: createGraphEngine2, GraphRAGSearch: GraphRAGSearch2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports4));
|
|
14328
|
+
const parser = createASTParser2();
|
|
14329
|
+
const engine = createGraphEngine2();
|
|
14330
|
+
const sources = params["sources"] ?? [];
|
|
14331
|
+
for (const s of sources) {
|
|
14332
|
+
const lang = s.language ?? "typescript";
|
|
14333
|
+
for (const n of parser.parse(s.code ?? "", lang)) {
|
|
14334
|
+
engine.addNode({
|
|
14335
|
+
id: `${s.filePath ?? "inline"}:${n.name}`,
|
|
14336
|
+
name: n.name,
|
|
14337
|
+
kind: n.kind,
|
|
14338
|
+
filePath: s.filePath ?? "inline",
|
|
14339
|
+
language: lang,
|
|
14340
|
+
startLine: n.startLine ?? 0,
|
|
14341
|
+
endLine: n.endLine ?? 0
|
|
14342
|
+
});
|
|
14343
|
+
}
|
|
14344
|
+
}
|
|
14345
|
+
const results = new GraphRAGSearch2(engine).globalSearch(params["query"] ?? "");
|
|
14346
|
+
return ok({ query: params["query"], results });
|
|
14247
14347
|
} catch {
|
|
14248
|
-
return
|
|
14348
|
+
return fail("Codegraph package not available");
|
|
14249
14349
|
}
|
|
14250
14350
|
}),
|
|
14251
|
-
tool("code.dfg.analyze", "
|
|
14252
|
-
param("
|
|
14253
|
-
param("
|
|
14351
|
+
tool("code.dfg.analyze", "Build a data-flow graph from structured statements and report reaching definitions", "code-analysis", [
|
|
14352
|
+
param("statements", "array", "SimpleStatement[] (type/line/variable/value/usedVariables)"),
|
|
14353
|
+
param("scope", "string", "Scope name", false, "global")
|
|
14254
14354
|
], async (params) => {
|
|
14255
14355
|
try {
|
|
14256
|
-
const
|
|
14257
|
-
const
|
|
14258
|
-
return ok(
|
|
14356
|
+
const { createDataFlowAnalyzer: createDataFlowAnalyzer2 } = await Promise.resolve().then(() => (init_dist13(), dist_exports13));
|
|
14357
|
+
const dfg = createDataFlowAnalyzer2().buildDFG(params["statements"] ?? [], params["scope"] ?? "global");
|
|
14358
|
+
return ok(dfg);
|
|
14259
14359
|
} catch {
|
|
14260
|
-
return
|
|
14360
|
+
return fail("DFG package not available");
|
|
14261
14361
|
}
|
|
14262
14362
|
})
|
|
14263
14363
|
];
|
|
@@ -14424,40 +14524,91 @@ function neuralTools() {
|
|
|
14424
14524
|
}
|
|
14425
14525
|
function synthesisTools() {
|
|
14426
14526
|
return [
|
|
14427
|
-
tool("synthesis.dsl.build", "
|
|
14428
|
-
param("
|
|
14429
|
-
param("
|
|
14527
|
+
tool("synthesis.dsl.build", "Apply a DSL transform pipeline to an input string", "synthesis", [
|
|
14528
|
+
param("input", "string", "Input string to transform"),
|
|
14529
|
+
param("ops", "array", "Ops: trim | upper | lower | reverse | capitalize | camelCase | snakeCase | replace:from:to")
|
|
14430
14530
|
], async (params) => {
|
|
14431
14531
|
try {
|
|
14432
|
-
const
|
|
14433
|
-
const
|
|
14434
|
-
|
|
14532
|
+
const { createDSLBuilder: createDSLBuilder2 } = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
|
|
14533
|
+
const builder = createDSLBuilder2();
|
|
14534
|
+
const ops = params["ops"] ?? [];
|
|
14535
|
+
for (const op of ops) {
|
|
14536
|
+
const [name, ...a] = String(op).split(":");
|
|
14537
|
+
switch (name) {
|
|
14538
|
+
case "trim":
|
|
14539
|
+
builder.trim();
|
|
14540
|
+
break;
|
|
14541
|
+
case "upper":
|
|
14542
|
+
case "toUpperCase":
|
|
14543
|
+
builder.toUpperCase();
|
|
14544
|
+
break;
|
|
14545
|
+
case "lower":
|
|
14546
|
+
case "toLowerCase":
|
|
14547
|
+
builder.toLowerCase();
|
|
14548
|
+
break;
|
|
14549
|
+
case "reverse":
|
|
14550
|
+
builder.reverse();
|
|
14551
|
+
break;
|
|
14552
|
+
case "capitalize":
|
|
14553
|
+
builder.capitalize();
|
|
14554
|
+
break;
|
|
14555
|
+
case "camelCase":
|
|
14556
|
+
case "camel":
|
|
14557
|
+
builder.camelCase();
|
|
14558
|
+
break;
|
|
14559
|
+
case "snakeCase":
|
|
14560
|
+
case "snake":
|
|
14561
|
+
builder.snakeCase();
|
|
14562
|
+
break;
|
|
14563
|
+
case "replace":
|
|
14564
|
+
builder.replace(a[0] ?? "", a[1] ?? "");
|
|
14565
|
+
break;
|
|
14566
|
+
case "prefixRemove":
|
|
14567
|
+
builder.prefixRemove(a[0] ?? "");
|
|
14568
|
+
break;
|
|
14569
|
+
case "suffixAppend":
|
|
14570
|
+
builder.suffixAppend(a[0] ?? "");
|
|
14571
|
+
break;
|
|
14572
|
+
default:
|
|
14573
|
+
return fail(`Unknown DSL op: ${name}`);
|
|
14574
|
+
}
|
|
14575
|
+
}
|
|
14576
|
+
const result = builder.execute(params["input"] ?? "");
|
|
14577
|
+
return ok({ input: params["input"], ops, result });
|
|
14435
14578
|
} catch {
|
|
14436
|
-
return
|
|
14579
|
+
return fail("Synthesis package not available");
|
|
14437
14580
|
}
|
|
14438
14581
|
}),
|
|
14439
|
-
tool("synthesis.synthesize", "Synthesize a
|
|
14440
|
-
param("examples", "array", "Input/output example pairs"),
|
|
14441
|
-
param("constraints", "object", "Synthesis constraints", false)
|
|
14442
|
-
], async (params) => {
|
|
14582
|
+
tool("synthesis.synthesize", "Synthesize a transformation rule from input/output examples", "synthesis", [param("examples", "array", "Array of {input, output} example pairs")], async (params) => {
|
|
14443
14583
|
try {
|
|
14444
|
-
const
|
|
14445
|
-
const
|
|
14446
|
-
|
|
14584
|
+
const { createSynthesisEngine: createSynthesisEngine2 } = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
|
|
14585
|
+
const examples = (params["examples"] ?? []).map((e) => ({
|
|
14586
|
+
input: e.input ?? "",
|
|
14587
|
+
output: e.output ?? ""
|
|
14588
|
+
}));
|
|
14589
|
+
const rule = createSynthesisEngine2().synthesize(examples);
|
|
14590
|
+
return ok({ rule, synthesized: rule !== null });
|
|
14447
14591
|
} catch {
|
|
14448
|
-
return
|
|
14592
|
+
return fail("Synthesis package not available");
|
|
14449
14593
|
}
|
|
14450
14594
|
}),
|
|
14451
|
-
tool("synthesis.version-space", "
|
|
14452
|
-
param("
|
|
14453
|
-
param("
|
|
14595
|
+
tool("synthesis.version-space", "Build a version space from positive/negative examples and get consistent hypotheses", "synthesis", [
|
|
14596
|
+
param("name", "string", "Version space name", false, "default"),
|
|
14597
|
+
param("positive", "array", "Positive examples", false),
|
|
14598
|
+
param("negative", "array", "Negative examples", false)
|
|
14454
14599
|
], async (params) => {
|
|
14455
14600
|
try {
|
|
14456
|
-
const
|
|
14457
|
-
const
|
|
14458
|
-
|
|
14601
|
+
const { createVersionSpaceManager: createVersionSpaceManager2 } = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
|
|
14602
|
+
const mgr = createVersionSpaceManager2();
|
|
14603
|
+
const name = params["name"] ?? "default";
|
|
14604
|
+
mgr.create(name);
|
|
14605
|
+
for (const p of params["positive"] ?? [])
|
|
14606
|
+
mgr.addPositive(name, p);
|
|
14607
|
+
for (const n of params["negative"] ?? [])
|
|
14608
|
+
mgr.addNegative(name, n);
|
|
14609
|
+
return ok({ name, hypotheses: mgr.getConsistentHypotheses(name), spaces: mgr.getSpaces().size });
|
|
14459
14610
|
} catch {
|
|
14460
|
-
return
|
|
14611
|
+
return fail("Synthesis package not available");
|
|
14461
14612
|
}
|
|
14462
14613
|
})
|
|
14463
14614
|
];
|
|
@@ -14579,37 +14730,41 @@ function decisionsTools() {
|
|
|
14579
14730
|
param("consequences", "string", "Consequences of the decision", false)
|
|
14580
14731
|
], async (params) => {
|
|
14581
14732
|
try {
|
|
14582
|
-
const
|
|
14583
|
-
const
|
|
14733
|
+
const { createDecisionManager: createDecisionManager2 } = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
|
|
14734
|
+
const mgr = createDecisionManager2(params["basePath"] ?? ".decisions");
|
|
14735
|
+
await mgr.load();
|
|
14736
|
+
const adr = await mgr.create({
|
|
14584
14737
|
title: params["title"],
|
|
14585
|
-
context: params["context"],
|
|
14586
|
-
decision: params["decision"],
|
|
14587
|
-
consequences: params["consequences"]
|
|
14738
|
+
context: params["context"] ?? "",
|
|
14739
|
+
decision: params["decision"] ?? "",
|
|
14740
|
+
consequences: params["consequences"] ?? ""
|
|
14588
14741
|
});
|
|
14589
|
-
return ok(adr
|
|
14742
|
+
return ok(adr);
|
|
14590
14743
|
} catch {
|
|
14591
|
-
return
|
|
14744
|
+
return fail("Decisions package not available");
|
|
14592
14745
|
}
|
|
14593
14746
|
}),
|
|
14594
|
-
tool("decisions.list", "List all Architecture Decision Records", "decisions", [param("basePath", "string", "ADR
|
|
14747
|
+
tool("decisions.list", "List all Architecture Decision Records", "decisions", [param("basePath", "string", "ADR base path", false, ".decisions")], async (params) => {
|
|
14595
14748
|
try {
|
|
14596
|
-
const
|
|
14597
|
-
const
|
|
14598
|
-
|
|
14749
|
+
const { createDecisionManager: createDecisionManager2 } = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
|
|
14750
|
+
const mgr = createDecisionManager2(params["basePath"] ?? ".decisions");
|
|
14751
|
+
await mgr.load();
|
|
14752
|
+
return ok(await mgr.list());
|
|
14599
14753
|
} catch {
|
|
14600
|
-
return
|
|
14754
|
+
return fail("Decisions package not available");
|
|
14601
14755
|
}
|
|
14602
14756
|
}),
|
|
14603
14757
|
tool("decisions.search", "Search Architecture Decision Records by keyword", "decisions", [
|
|
14604
14758
|
param("query", "string", "Search query"),
|
|
14605
|
-
param("basePath", "string", "ADR
|
|
14759
|
+
param("basePath", "string", "ADR base path", false, ".decisions")
|
|
14606
14760
|
], async (params) => {
|
|
14607
14761
|
try {
|
|
14608
|
-
const
|
|
14609
|
-
const
|
|
14610
|
-
|
|
14762
|
+
const { createDecisionManager: createDecisionManager2 } = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
|
|
14763
|
+
const mgr = createDecisionManager2(params["basePath"] ?? ".decisions");
|
|
14764
|
+
await mgr.load();
|
|
14765
|
+
return ok(await mgr.search(params["query"]));
|
|
14611
14766
|
} catch {
|
|
14612
|
-
return
|
|
14767
|
+
return fail("Decisions package not available");
|
|
14613
14768
|
}
|
|
14614
14769
|
})
|
|
14615
14770
|
];
|