musubix2 0.5.6 → 0.5.8

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.
@@ -1 +1 @@
1
- {"generator":"musubix2","version":"0.5.6","timestamp":"2026-07-09T09:46:29.695Z"}
1
+ {"generator":"musubix2","version":"0.5.8","timestamp":"2026-07-09T10:18:54.616Z"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "1.0",
3
- "generatedAt": "2026-07-09T09:46:29.725Z",
3
+ "generatedAt": "2026-07-09T10:18:54.648Z",
4
4
  "entries": [
5
5
  {
6
6
  "platform": "copilot",
package/dist/cli.js CHANGED
@@ -12124,6 +12124,19 @@ var init_transport = __esm({
12124
12124
  this.rl = null;
12125
12125
  }
12126
12126
  }
12127
+ /**
12128
+ * Resolve once the input stream closes (client disconnect / stdin EOF).
12129
+ * Used by the CLI launcher to keep the process alive for the lifetime of
12130
+ * the connection — `start()` intentionally resolves immediately so callers
12131
+ * can begin writing, so a separate wait hook is needed to block on.
12132
+ */
12133
+ async waitForClose() {
12134
+ if (!this.rl)
12135
+ return;
12136
+ await new Promise((resolve9) => {
12137
+ this.rl.once("close", () => resolve9());
12138
+ });
12139
+ }
12127
12140
  send(message) {
12128
12141
  this.output.write(JSON.stringify(message) + "\n");
12129
12142
  }
@@ -13823,108 +13836,139 @@ function fail(error) {
13823
13836
  }
13824
13837
  function sddCoreTools() {
13825
13838
  return [
13826
- tool("sdd.requirements.create", "Create an EARS requirement (Easy Approach to Requirements Syntax)", "sdd-core", [
13827
- param("pattern", "string", "EARS pattern: ubiquitous | event-driven | unwanted | state-driven | optional"),
13828
- 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)"),
13829
13841
  param("id", "string", "Requirement ID", false)
13830
13842
  ], async (params) => {
13831
13843
  try {
13832
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13833
- const req = core.createRequirement?.({
13834
- pattern: params["pattern"],
13835
- text: params["text"],
13836
- id: params["id"]
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
13837
13856
  });
13838
- return ok(req ?? { pattern: params["pattern"], text: params["text"], id: params["id"] ?? "REQ-001" });
13839
13857
  } catch {
13840
- return ok({ pattern: params["pattern"], text: params["text"], id: params["id"] ?? "REQ-001" });
13858
+ return fail("Core package not available");
13841
13859
  }
13842
13860
  }),
13843
- tool("sdd.requirements.validate", "Validate requirements for completeness and consistency", "sdd-core", [param("requirements", "array", "Array of requirement objects to validate")], async (params) => {
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) => {
13844
13862
  try {
13845
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13846
- const result = core.validateRequirements?.(params["requirements"]);
13847
- return ok(result ?? { valid: true, issues: [] });
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) });
13848
13873
  } catch {
13849
- return ok({ valid: true, issues: [] });
13874
+ return fail("Core package not available");
13850
13875
  }
13851
13876
  }),
13852
- tool("sdd.requirements.list", "List all requirements in the current project", "sdd-core", [param("basePath", "string", "Project base path", false, ".")], async (params) => {
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) => {
13853
13878
  try {
13854
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13855
- const list = core.listRequirements?.(params["basePath"] ?? ".");
13856
- return ok(list ?? []);
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 })));
13857
13882
  } catch {
13858
- return ok([]);
13883
+ return fail("Core package not available");
13859
13884
  }
13860
13885
  }),
13861
- tool("sdd.design.generate", "Generate a design document from requirements", "sdd-core", [
13862
- param("requirements", "array", "Requirements to generate design from"),
13863
- param("format", "string", "Output format: markdown | json", false, "markdown")
13864
- ], 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) => {
13865
13887
  try {
13866
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13867
- const design = core.generateDesign?.({
13868
- requirements: params["requirements"],
13869
- format: params["format"] ?? "markdown"
13870
- });
13871
- return ok(design ?? { sections: [], format: params["format"] ?? "markdown" });
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));
13872
13897
  } catch {
13873
- return ok({ sections: [], format: params["format"] ?? "markdown" });
13898
+ return fail("Core package not available");
13874
13899
  }
13875
13900
  }),
13876
- tool("sdd.design.verify", "Verify design traceability back to requirements", "sdd-core", [
13877
- param("design", "object", "Design document to verify"),
13878
- param("requirements", "array", "Requirements to trace against")
13879
- ], 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) => {
13880
13902
  try {
13881
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13882
- const result = core.verifyTraceability?.({
13883
- design: params["design"],
13884
- requirements: params["requirements"]
13885
- });
13886
- return ok(result ?? { complete: true, gaps: [] });
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));
13887
13913
  } catch {
13888
- return ok({ complete: true, gaps: [] });
13914
+ return fail("Core package not available");
13889
13915
  }
13890
13916
  }),
13891
- tool("sdd.codegen.generate", "Generate code from a design document", "sdd-core", [
13892
- param("design", "object", "Design document"),
13893
- param("language", "string", "Target language: typescript | python", false, "typescript")
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)
13894
13921
  ], async (params) => {
13895
13922
  try {
13896
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13897
- const code = core.generateCode?.({
13898
- design: params["design"],
13899
- language: params["language"] ?? "typescript"
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"]
13900
13928
  });
13901
- return ok(code ?? { files: [], language: params["language"] ?? "typescript" });
13929
+ return ok(code);
13902
13930
  } catch {
13903
- return ok({ files: [], language: params["language"] ?? "typescript" });
13931
+ return fail("Core package not available");
13904
13932
  }
13905
13933
  }),
13906
- tool("sdd.test.generate", "Generate tests from a design document", "sdd-core", [
13907
- param("design", "object", "Design document"),
13908
- param("framework", "string", "Test framework: vitest | jest | pytest", false, "vitest")
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")
13909
13937
  ], async (params) => {
13910
13938
  try {
13911
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13912
- const tests = core.generateTests?.({
13913
- design: params["design"],
13914
- framework: params["framework"] ?? "vitest"
13915
- });
13916
- 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);
13917
13942
  } catch {
13918
- return ok({ files: [], framework: params["framework"] ?? "vitest" });
13943
+ return fail("Core package not available");
13919
13944
  }
13920
13945
  }),
13921
- tool("sdd.trace.verify", "Verify full traceability matrix (requirements \u2192 design \u2192 code \u2192 tests)", "sdd-core", [param("basePath", "string", "Project base path", false, ".")], async (params) => {
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) => {
13922
13950
  try {
13923
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13924
- const result = core.verifyTraceabilityMatrix?.(params["basePath"] ?? ".");
13925
- return ok(result ?? { complete: true, matrix: [], gaps: [] });
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
+ });
13926
13970
  } catch {
13927
- return ok({ complete: true, matrix: [], gaps: [] });
13971
+ return fail("Trace verification failed");
13928
13972
  }
13929
13973
  }),
13930
13974
  // ── Requirements Interview tools ──
@@ -13989,7 +14033,7 @@ function knowledgeTools() {
13989
14033
  const { createKnowledgeStore: createKnowledgeStore2 } = await Promise.resolve().then(() => (init_dist8(), dist_exports8));
13990
14034
  const store = createKnowledgeStore2(params["basePath"] ?? ".knowledge");
13991
14035
  await store.load();
13992
- const entity = store.getEntity(params["id"]);
14036
+ const entity = await store.getEntity(params["id"]);
13993
14037
  return entity ? ok(entity) : fail("Entity not found");
13994
14038
  } catch {
13995
14039
  return fail("Knowledge package not available");
@@ -14062,7 +14106,7 @@ function knowledgeTools() {
14062
14106
  const { createKnowledgeStore: createKnowledgeStore2 } = await Promise.resolve().then(() => (init_dist8(), dist_exports8));
14063
14107
  const store = createKnowledgeStore2(params["basePath"] ?? ".knowledge");
14064
14108
  await store.load();
14065
- const results = store.search(params["query"], { limit: params["limit"] ?? 10 });
14109
+ const results = await store.search(params["query"], { limit: params["limit"] ?? 10 });
14066
14110
  return ok(results);
14067
14111
  } catch {
14068
14112
  return fail("Knowledge package not available");
@@ -14077,7 +14121,7 @@ function knowledgeTools() {
14077
14121
  const { createKnowledgeStore: createKnowledgeStore2 } = await Promise.resolve().then(() => (init_dist8(), dist_exports8));
14078
14122
  const store = createKnowledgeStore2(params["basePath"] ?? ".knowledge");
14079
14123
  await store.load();
14080
- const result = store.traverse(params["startId"], { depth: params["depth"] ?? 2 });
14124
+ const result = await store.traverse(params["startId"], { depth: params["depth"] ?? 2 });
14081
14125
  return ok(result);
14082
14126
  } catch {
14083
14127
  return fail("Knowledge package not available");
@@ -14249,52 +14293,64 @@ function codeAnalysisTools() {
14249
14293
  })
14250
14294
  ];
14251
14295
  }
14296
+ function sourceOf(params) {
14297
+ return params["code"] ?? params["source"] ?? params["target"] ?? "";
14298
+ }
14299
+ function severityOf(findings) {
14300
+ const order = ["critical", "high", "medium", "low", "info"];
14301
+ for (const s of order)
14302
+ if (findings.some((f) => f.severity === s))
14303
+ return s;
14304
+ return "none";
14305
+ }
14252
14306
  function securityTools() {
14253
14307
  return [
14254
14308
  tool("security.scan", "Run a security scan on source code", "security", [
14255
- param("target", "string", "File or directory path to scan"),
14256
- param("rules", "array", "Specific rules to apply", false)
14309
+ param("code", "string", "Source code to scan"),
14310
+ param("filePath", "string", "File path for the source (for reporting)", false, "inline")
14257
14311
  ], async (params) => {
14258
14312
  try {
14259
- const sec = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14260
- const result = sec.scan?.(params["target"], params["rules"]);
14261
- return ok(result ?? { findings: [], severity: "none" });
14313
+ const { createSecurityScanner: createSecurityScanner2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14314
+ const result = createSecurityScanner2().scan(sourceOf(params), params["filePath"] ?? "inline");
14315
+ return ok({ findings: result.findings, severity: severityOf(result.findings) });
14262
14316
  } catch {
14263
- return ok({ findings: [], severity: "none" });
14317
+ return fail("Security package not available");
14264
14318
  }
14265
14319
  }),
14266
- tool("security.secrets.detect", "Detect secrets and credentials in source code", "security", [param("target", "string", "File or directory path to scan")], async (params) => {
14320
+ tool("security.secrets.detect", "Detect secrets and credentials in source code", "security", [
14321
+ param("code", "string", "Source code to scan"),
14322
+ param("filePath", "string", "File path for the source", false, "inline")
14323
+ ], async (params) => {
14267
14324
  try {
14268
- const sec = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14269
- const result = sec.detectSecrets?.(params["target"]);
14270
- return ok(result ?? { secrets: [], count: 0 });
14325
+ const { createSecretDetector: createSecretDetector2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14326
+ const secrets = createSecretDetector2().scan(sourceOf(params), params["filePath"] ?? "inline");
14327
+ return ok({ secrets, count: secrets.length });
14271
14328
  } catch {
14272
- return ok({ secrets: [], count: 0 });
14329
+ return fail("Security package not available");
14273
14330
  }
14274
14331
  }),
14275
14332
  tool("security.taint.analyze", "Perform taint analysis to track untrusted data flow", "security", [
14276
- param("source", "string", "Source code to analyze"),
14277
- param("sources", "array", "Taint sources", false),
14278
- param("sinks", "array", "Taint sinks", false)
14333
+ param("code", "string", "Source code to analyze"),
14334
+ param("filePath", "string", "File path for the source", false, "inline")
14279
14335
  ], async (params) => {
14280
14336
  try {
14281
- const sec = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14282
- const result = sec.taintAnalysis?.(params["source"], params["sources"], params["sinks"]);
14283
- return ok(result ?? { tainted: [], paths: [] });
14337
+ const { TaintAnalyzer: TaintAnalyzer2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14338
+ const tainted = new TaintAnalyzer2().analyze(sourceOf(params), params["filePath"] ?? "inline");
14339
+ return ok({ tainted, count: tainted.length });
14284
14340
  } catch {
14285
- return ok({ tainted: [], paths: [] });
14341
+ return fail("Security package not available");
14286
14342
  }
14287
14343
  }),
14288
- tool("security.compliance.check", "Check code compliance against security standards", "security", [
14289
- param("target", "string", "File or directory path"),
14290
- param("standard", "string", "Compliance standard: owasp | cwe | sans", false, "owasp")
14344
+ tool("security.compliance.check", "Check code compliance against registered security policies", "security", [
14345
+ param("code", "string", "Source code to check"),
14346
+ param("filePath", "string", "File path for the source", false, "inline")
14291
14347
  ], async (params) => {
14292
14348
  try {
14293
- const sec = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14294
- const result = sec.complianceCheck?.(params["target"], params["standard"] ?? "owasp");
14295
- return ok(result ?? { compliant: true, issues: [] });
14349
+ const { createComplianceChecker: createComplianceChecker2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14350
+ const result = createComplianceChecker2().check(sourceOf(params), params["filePath"] ?? "inline", []);
14351
+ return ok(result);
14296
14352
  } catch {
14297
- return ok({ compliant: true, issues: [] });
14353
+ return fail("Security package not available");
14298
14354
  }
14299
14355
  })
14300
14356
  ];
@@ -14399,40 +14455,91 @@ function neuralTools() {
14399
14455
  }
14400
14456
  function synthesisTools() {
14401
14457
  return [
14402
- tool("synthesis.dsl.build", "Build a DSL transformation from specification", "synthesis", [
14403
- param("spec", "object", "DSL specification"),
14404
- param("examples", "array", "Input/output examples", false)
14458
+ tool("synthesis.dsl.build", "Apply a DSL transform pipeline to an input string", "synthesis", [
14459
+ param("input", "string", "Input string to transform"),
14460
+ param("ops", "array", "Ops: trim | upper | lower | reverse | capitalize | camelCase | snakeCase | replace:from:to")
14405
14461
  ], async (params) => {
14406
14462
  try {
14407
- const syn = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
14408
- const result = syn.buildDSL?.(params["spec"], params["examples"]);
14409
- return ok(result ?? { dsl: null, spec: params["spec"] });
14463
+ const { createDSLBuilder: createDSLBuilder2 } = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
14464
+ const builder = createDSLBuilder2();
14465
+ const ops = params["ops"] ?? [];
14466
+ for (const op of ops) {
14467
+ const [name, ...a] = String(op).split(":");
14468
+ switch (name) {
14469
+ case "trim":
14470
+ builder.trim();
14471
+ break;
14472
+ case "upper":
14473
+ case "toUpperCase":
14474
+ builder.toUpperCase();
14475
+ break;
14476
+ case "lower":
14477
+ case "toLowerCase":
14478
+ builder.toLowerCase();
14479
+ break;
14480
+ case "reverse":
14481
+ builder.reverse();
14482
+ break;
14483
+ case "capitalize":
14484
+ builder.capitalize();
14485
+ break;
14486
+ case "camelCase":
14487
+ case "camel":
14488
+ builder.camelCase();
14489
+ break;
14490
+ case "snakeCase":
14491
+ case "snake":
14492
+ builder.snakeCase();
14493
+ break;
14494
+ case "replace":
14495
+ builder.replace(a[0] ?? "", a[1] ?? "");
14496
+ break;
14497
+ case "prefixRemove":
14498
+ builder.prefixRemove(a[0] ?? "");
14499
+ break;
14500
+ case "suffixAppend":
14501
+ builder.suffixAppend(a[0] ?? "");
14502
+ break;
14503
+ default:
14504
+ return fail(`Unknown DSL op: ${name}`);
14505
+ }
14506
+ }
14507
+ const result = builder.execute(params["input"] ?? "");
14508
+ return ok({ input: params["input"], ops, result });
14410
14509
  } catch {
14411
- return ok({ dsl: null, spec: params["spec"] });
14510
+ return fail("Synthesis package not available");
14412
14511
  }
14413
14512
  }),
14414
- tool("synthesis.synthesize", "Synthesize a program from input/output examples", "synthesis", [
14415
- param("examples", "array", "Input/output example pairs"),
14416
- param("constraints", "object", "Synthesis constraints", false)
14417
- ], async (params) => {
14513
+ tool("synthesis.synthesize", "Synthesize a transformation rule from input/output examples", "synthesis", [param("examples", "array", "Array of {input, output} example pairs")], async (params) => {
14418
14514
  try {
14419
- const syn = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
14420
- const result = syn.synthesize?.(params["examples"], params["constraints"]);
14421
- return ok(result ?? { program: null, confidence: 0 });
14515
+ const { createSynthesisEngine: createSynthesisEngine2 } = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
14516
+ const examples = (params["examples"] ?? []).map((e) => ({
14517
+ input: e.input ?? "",
14518
+ output: e.output ?? ""
14519
+ }));
14520
+ const rule = createSynthesisEngine2().synthesize(examples);
14521
+ return ok({ rule, synthesized: rule !== null });
14422
14522
  } catch {
14423
- return ok({ program: null, confidence: 0 });
14523
+ return fail("Synthesis package not available");
14424
14524
  }
14425
14525
  }),
14426
- tool("synthesis.version-space", "Manage version spaces for program synthesis", "synthesis", [
14427
- param("action", "string", "Action: create | update | query"),
14428
- param("examples", "array", "Examples for version space", false)
14526
+ tool("synthesis.version-space", "Build a version space from positive/negative examples and get consistent hypotheses", "synthesis", [
14527
+ param("name", "string", "Version space name", false, "default"),
14528
+ param("positive", "array", "Positive examples", false),
14529
+ param("negative", "array", "Negative examples", false)
14429
14530
  ], async (params) => {
14430
14531
  try {
14431
- const syn = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
14432
- const result = syn.versionSpace?.(params["action"], params["examples"]);
14433
- return ok(result ?? { action: params["action"], spaces: [] });
14532
+ const { createVersionSpaceManager: createVersionSpaceManager2 } = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
14533
+ const mgr = createVersionSpaceManager2();
14534
+ const name = params["name"] ?? "default";
14535
+ mgr.create(name);
14536
+ for (const p of params["positive"] ?? [])
14537
+ mgr.addPositive(name, p);
14538
+ for (const n of params["negative"] ?? [])
14539
+ mgr.addNegative(name, n);
14540
+ return ok({ name, hypotheses: mgr.getConsistentHypotheses(name), spaces: mgr.getSpaces().size });
14434
14541
  } catch {
14435
- return ok({ action: params["action"], spaces: [] });
14542
+ return fail("Synthesis package not available");
14436
14543
  }
14437
14544
  })
14438
14545
  ];
@@ -14554,37 +14661,41 @@ function decisionsTools() {
14554
14661
  param("consequences", "string", "Consequences of the decision", false)
14555
14662
  ], async (params) => {
14556
14663
  try {
14557
- const dec = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
14558
- const adr = dec.createADR?.({
14664
+ const { createDecisionManager: createDecisionManager2 } = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
14665
+ const mgr = createDecisionManager2(params["basePath"] ?? ".decisions");
14666
+ await mgr.load();
14667
+ const adr = await mgr.create({
14559
14668
  title: params["title"],
14560
- context: params["context"],
14561
- decision: params["decision"],
14562
- consequences: params["consequences"]
14669
+ context: params["context"] ?? "",
14670
+ decision: params["decision"] ?? "",
14671
+ consequences: params["consequences"] ?? ""
14563
14672
  });
14564
- return ok(adr ?? { title: params["title"], status: "proposed" });
14673
+ return ok(adr);
14565
14674
  } catch {
14566
- return ok({ title: params["title"], status: "proposed" });
14675
+ return fail("Decisions package not available");
14567
14676
  }
14568
14677
  }),
14569
- tool("decisions.list", "List all Architecture Decision Records", "decisions", [param("basePath", "string", "ADR directory path", false, ".")], async (params) => {
14678
+ tool("decisions.list", "List all Architecture Decision Records", "decisions", [param("basePath", "string", "ADR base path", false, ".decisions")], async (params) => {
14570
14679
  try {
14571
- const dec = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
14572
- const adrs = dec.listADRs?.(params["basePath"] ?? ".");
14573
- return ok(adrs ?? []);
14680
+ const { createDecisionManager: createDecisionManager2 } = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
14681
+ const mgr = createDecisionManager2(params["basePath"] ?? ".decisions");
14682
+ await mgr.load();
14683
+ return ok(await mgr.list());
14574
14684
  } catch {
14575
- return ok([]);
14685
+ return fail("Decisions package not available");
14576
14686
  }
14577
14687
  }),
14578
14688
  tool("decisions.search", "Search Architecture Decision Records by keyword", "decisions", [
14579
14689
  param("query", "string", "Search query"),
14580
- param("basePath", "string", "ADR directory path", false, ".")
14690
+ param("basePath", "string", "ADR base path", false, ".decisions")
14581
14691
  ], async (params) => {
14582
14692
  try {
14583
- const dec = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
14584
- const results = dec.searchADRs?.(params["query"], params["basePath"] ?? ".");
14585
- return ok(results ?? []);
14693
+ const { createDecisionManager: createDecisionManager2 } = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
14694
+ const mgr = createDecisionManager2(params["basePath"] ?? ".decisions");
14695
+ await mgr.load();
14696
+ return ok(await mgr.search(params["query"]));
14586
14697
  } catch {
14587
- return ok([]);
14698
+ return fail("Decisions package not available");
14588
14699
  }
14589
14700
  })
14590
14701
  ];
@@ -15307,6 +15418,7 @@ var init_mcp_cli_launcher = __esm({
15307
15418
  } else {
15308
15419
  const transport = new StdioTransport2();
15309
15420
  await server.start(transport);
15421
+ await transport.waitForClose();
15310
15422
  }
15311
15423
  }
15312
15424
  };
package/dist/index.js CHANGED
@@ -12124,6 +12124,19 @@ var init_transport = __esm({
12124
12124
  this.rl = null;
12125
12125
  }
12126
12126
  }
12127
+ /**
12128
+ * Resolve once the input stream closes (client disconnect / stdin EOF).
12129
+ * Used by the CLI launcher to keep the process alive for the lifetime of
12130
+ * the connection — `start()` intentionally resolves immediately so callers
12131
+ * can begin writing, so a separate wait hook is needed to block on.
12132
+ */
12133
+ async waitForClose() {
12134
+ if (!this.rl)
12135
+ return;
12136
+ await new Promise((resolve9) => {
12137
+ this.rl.once("close", () => resolve9());
12138
+ });
12139
+ }
12127
12140
  send(message) {
12128
12141
  this.output.write(JSON.stringify(message) + "\n");
12129
12142
  }
@@ -13823,108 +13836,139 @@ function fail(error) {
13823
13836
  }
13824
13837
  function sddCoreTools() {
13825
13838
  return [
13826
- tool("sdd.requirements.create", "Create an EARS requirement (Easy Approach to Requirements Syntax)", "sdd-core", [
13827
- param("pattern", "string", "EARS pattern: ubiquitous | event-driven | unwanted | state-driven | optional"),
13828
- 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)"),
13829
13841
  param("id", "string", "Requirement ID", false)
13830
13842
  ], async (params) => {
13831
13843
  try {
13832
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13833
- const req = core.createRequirement?.({
13834
- pattern: params["pattern"],
13835
- text: params["text"],
13836
- id: params["id"]
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
13837
13856
  });
13838
- return ok(req ?? { pattern: params["pattern"], text: params["text"], id: params["id"] ?? "REQ-001" });
13839
13857
  } catch {
13840
- return ok({ pattern: params["pattern"], text: params["text"], id: params["id"] ?? "REQ-001" });
13858
+ return fail("Core package not available");
13841
13859
  }
13842
13860
  }),
13843
- tool("sdd.requirements.validate", "Validate requirements for completeness and consistency", "sdd-core", [param("requirements", "array", "Array of requirement objects to validate")], async (params) => {
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) => {
13844
13862
  try {
13845
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13846
- const result = core.validateRequirements?.(params["requirements"]);
13847
- return ok(result ?? { valid: true, issues: [] });
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) });
13848
13873
  } catch {
13849
- return ok({ valid: true, issues: [] });
13874
+ return fail("Core package not available");
13850
13875
  }
13851
13876
  }),
13852
- tool("sdd.requirements.list", "List all requirements in the current project", "sdd-core", [param("basePath", "string", "Project base path", false, ".")], async (params) => {
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) => {
13853
13878
  try {
13854
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13855
- const list = core.listRequirements?.(params["basePath"] ?? ".");
13856
- return ok(list ?? []);
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 })));
13857
13882
  } catch {
13858
- return ok([]);
13883
+ return fail("Core package not available");
13859
13884
  }
13860
13885
  }),
13861
- tool("sdd.design.generate", "Generate a design document from requirements", "sdd-core", [
13862
- param("requirements", "array", "Requirements to generate design from"),
13863
- param("format", "string", "Output format: markdown | json", false, "markdown")
13864
- ], 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) => {
13865
13887
  try {
13866
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13867
- const design = core.generateDesign?.({
13868
- requirements: params["requirements"],
13869
- format: params["format"] ?? "markdown"
13870
- });
13871
- return ok(design ?? { sections: [], format: params["format"] ?? "markdown" });
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));
13872
13897
  } catch {
13873
- return ok({ sections: [], format: params["format"] ?? "markdown" });
13898
+ return fail("Core package not available");
13874
13899
  }
13875
13900
  }),
13876
- tool("sdd.design.verify", "Verify design traceability back to requirements", "sdd-core", [
13877
- param("design", "object", "Design document to verify"),
13878
- param("requirements", "array", "Requirements to trace against")
13879
- ], 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) => {
13880
13902
  try {
13881
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13882
- const result = core.verifyTraceability?.({
13883
- design: params["design"],
13884
- requirements: params["requirements"]
13885
- });
13886
- return ok(result ?? { complete: true, gaps: [] });
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));
13887
13913
  } catch {
13888
- return ok({ complete: true, gaps: [] });
13914
+ return fail("Core package not available");
13889
13915
  }
13890
13916
  }),
13891
- tool("sdd.codegen.generate", "Generate code from a design document", "sdd-core", [
13892
- param("design", "object", "Design document"),
13893
- param("language", "string", "Target language: typescript | python", false, "typescript")
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)
13894
13921
  ], async (params) => {
13895
13922
  try {
13896
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13897
- const code = core.generateCode?.({
13898
- design: params["design"],
13899
- language: params["language"] ?? "typescript"
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"]
13900
13928
  });
13901
- return ok(code ?? { files: [], language: params["language"] ?? "typescript" });
13929
+ return ok(code);
13902
13930
  } catch {
13903
- return ok({ files: [], language: params["language"] ?? "typescript" });
13931
+ return fail("Core package not available");
13904
13932
  }
13905
13933
  }),
13906
- tool("sdd.test.generate", "Generate tests from a design document", "sdd-core", [
13907
- param("design", "object", "Design document"),
13908
- param("framework", "string", "Test framework: vitest | jest | pytest", false, "vitest")
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")
13909
13937
  ], async (params) => {
13910
13938
  try {
13911
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13912
- const tests = core.generateTests?.({
13913
- design: params["design"],
13914
- framework: params["framework"] ?? "vitest"
13915
- });
13916
- 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);
13917
13942
  } catch {
13918
- return ok({ files: [], framework: params["framework"] ?? "vitest" });
13943
+ return fail("Core package not available");
13919
13944
  }
13920
13945
  }),
13921
- tool("sdd.trace.verify", "Verify full traceability matrix (requirements \u2192 design \u2192 code \u2192 tests)", "sdd-core", [param("basePath", "string", "Project base path", false, ".")], async (params) => {
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) => {
13922
13950
  try {
13923
- const core = await Promise.resolve().then(() => (init_dist(), dist_exports));
13924
- const result = core.verifyTraceabilityMatrix?.(params["basePath"] ?? ".");
13925
- return ok(result ?? { complete: true, matrix: [], gaps: [] });
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
+ });
13926
13970
  } catch {
13927
- return ok({ complete: true, matrix: [], gaps: [] });
13971
+ return fail("Trace verification failed");
13928
13972
  }
13929
13973
  }),
13930
13974
  // ── Requirements Interview tools ──
@@ -13989,7 +14033,7 @@ function knowledgeTools() {
13989
14033
  const { createKnowledgeStore: createKnowledgeStore2 } = await Promise.resolve().then(() => (init_dist8(), dist_exports8));
13990
14034
  const store = createKnowledgeStore2(params["basePath"] ?? ".knowledge");
13991
14035
  await store.load();
13992
- const entity = store.getEntity(params["id"]);
14036
+ const entity = await store.getEntity(params["id"]);
13993
14037
  return entity ? ok(entity) : fail("Entity not found");
13994
14038
  } catch {
13995
14039
  return fail("Knowledge package not available");
@@ -14062,7 +14106,7 @@ function knowledgeTools() {
14062
14106
  const { createKnowledgeStore: createKnowledgeStore2 } = await Promise.resolve().then(() => (init_dist8(), dist_exports8));
14063
14107
  const store = createKnowledgeStore2(params["basePath"] ?? ".knowledge");
14064
14108
  await store.load();
14065
- const results = store.search(params["query"], { limit: params["limit"] ?? 10 });
14109
+ const results = await store.search(params["query"], { limit: params["limit"] ?? 10 });
14066
14110
  return ok(results);
14067
14111
  } catch {
14068
14112
  return fail("Knowledge package not available");
@@ -14077,7 +14121,7 @@ function knowledgeTools() {
14077
14121
  const { createKnowledgeStore: createKnowledgeStore2 } = await Promise.resolve().then(() => (init_dist8(), dist_exports8));
14078
14122
  const store = createKnowledgeStore2(params["basePath"] ?? ".knowledge");
14079
14123
  await store.load();
14080
- const result = store.traverse(params["startId"], { depth: params["depth"] ?? 2 });
14124
+ const result = await store.traverse(params["startId"], { depth: params["depth"] ?? 2 });
14081
14125
  return ok(result);
14082
14126
  } catch {
14083
14127
  return fail("Knowledge package not available");
@@ -14249,52 +14293,64 @@ function codeAnalysisTools() {
14249
14293
  })
14250
14294
  ];
14251
14295
  }
14296
+ function sourceOf(params) {
14297
+ return params["code"] ?? params["source"] ?? params["target"] ?? "";
14298
+ }
14299
+ function severityOf(findings) {
14300
+ const order = ["critical", "high", "medium", "low", "info"];
14301
+ for (const s of order)
14302
+ if (findings.some((f) => f.severity === s))
14303
+ return s;
14304
+ return "none";
14305
+ }
14252
14306
  function securityTools() {
14253
14307
  return [
14254
14308
  tool("security.scan", "Run a security scan on source code", "security", [
14255
- param("target", "string", "File or directory path to scan"),
14256
- param("rules", "array", "Specific rules to apply", false)
14309
+ param("code", "string", "Source code to scan"),
14310
+ param("filePath", "string", "File path for the source (for reporting)", false, "inline")
14257
14311
  ], async (params) => {
14258
14312
  try {
14259
- const sec = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14260
- const result = sec.scan?.(params["target"], params["rules"]);
14261
- return ok(result ?? { findings: [], severity: "none" });
14313
+ const { createSecurityScanner: createSecurityScanner2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14314
+ const result = createSecurityScanner2().scan(sourceOf(params), params["filePath"] ?? "inline");
14315
+ return ok({ findings: result.findings, severity: severityOf(result.findings) });
14262
14316
  } catch {
14263
- return ok({ findings: [], severity: "none" });
14317
+ return fail("Security package not available");
14264
14318
  }
14265
14319
  }),
14266
- tool("security.secrets.detect", "Detect secrets and credentials in source code", "security", [param("target", "string", "File or directory path to scan")], async (params) => {
14320
+ tool("security.secrets.detect", "Detect secrets and credentials in source code", "security", [
14321
+ param("code", "string", "Source code to scan"),
14322
+ param("filePath", "string", "File path for the source", false, "inline")
14323
+ ], async (params) => {
14267
14324
  try {
14268
- const sec = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14269
- const result = sec.detectSecrets?.(params["target"]);
14270
- return ok(result ?? { secrets: [], count: 0 });
14325
+ const { createSecretDetector: createSecretDetector2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14326
+ const secrets = createSecretDetector2().scan(sourceOf(params), params["filePath"] ?? "inline");
14327
+ return ok({ secrets, count: secrets.length });
14271
14328
  } catch {
14272
- return ok({ secrets: [], count: 0 });
14329
+ return fail("Security package not available");
14273
14330
  }
14274
14331
  }),
14275
14332
  tool("security.taint.analyze", "Perform taint analysis to track untrusted data flow", "security", [
14276
- param("source", "string", "Source code to analyze"),
14277
- param("sources", "array", "Taint sources", false),
14278
- param("sinks", "array", "Taint sinks", false)
14333
+ param("code", "string", "Source code to analyze"),
14334
+ param("filePath", "string", "File path for the source", false, "inline")
14279
14335
  ], async (params) => {
14280
14336
  try {
14281
- const sec = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14282
- const result = sec.taintAnalysis?.(params["source"], params["sources"], params["sinks"]);
14283
- return ok(result ?? { tainted: [], paths: [] });
14337
+ const { TaintAnalyzer: TaintAnalyzer2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14338
+ const tainted = new TaintAnalyzer2().analyze(sourceOf(params), params["filePath"] ?? "inline");
14339
+ return ok({ tainted, count: tainted.length });
14284
14340
  } catch {
14285
- return ok({ tainted: [], paths: [] });
14341
+ return fail("Security package not available");
14286
14342
  }
14287
14343
  }),
14288
- tool("security.compliance.check", "Check code compliance against security standards", "security", [
14289
- param("target", "string", "File or directory path"),
14290
- param("standard", "string", "Compliance standard: owasp | cwe | sans", false, "owasp")
14344
+ tool("security.compliance.check", "Check code compliance against registered security policies", "security", [
14345
+ param("code", "string", "Source code to check"),
14346
+ param("filePath", "string", "File path for the source", false, "inline")
14291
14347
  ], async (params) => {
14292
14348
  try {
14293
- const sec = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14294
- const result = sec.complianceCheck?.(params["target"], params["standard"] ?? "owasp");
14295
- return ok(result ?? { compliant: true, issues: [] });
14349
+ const { createComplianceChecker: createComplianceChecker2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
14350
+ const result = createComplianceChecker2().check(sourceOf(params), params["filePath"] ?? "inline", []);
14351
+ return ok(result);
14296
14352
  } catch {
14297
- return ok({ compliant: true, issues: [] });
14353
+ return fail("Security package not available");
14298
14354
  }
14299
14355
  })
14300
14356
  ];
@@ -14399,40 +14455,91 @@ function neuralTools() {
14399
14455
  }
14400
14456
  function synthesisTools() {
14401
14457
  return [
14402
- tool("synthesis.dsl.build", "Build a DSL transformation from specification", "synthesis", [
14403
- param("spec", "object", "DSL specification"),
14404
- param("examples", "array", "Input/output examples", false)
14458
+ tool("synthesis.dsl.build", "Apply a DSL transform pipeline to an input string", "synthesis", [
14459
+ param("input", "string", "Input string to transform"),
14460
+ param("ops", "array", "Ops: trim | upper | lower | reverse | capitalize | camelCase | snakeCase | replace:from:to")
14405
14461
  ], async (params) => {
14406
14462
  try {
14407
- const syn = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
14408
- const result = syn.buildDSL?.(params["spec"], params["examples"]);
14409
- return ok(result ?? { dsl: null, spec: params["spec"] });
14463
+ const { createDSLBuilder: createDSLBuilder2 } = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
14464
+ const builder = createDSLBuilder2();
14465
+ const ops = params["ops"] ?? [];
14466
+ for (const op of ops) {
14467
+ const [name, ...a] = String(op).split(":");
14468
+ switch (name) {
14469
+ case "trim":
14470
+ builder.trim();
14471
+ break;
14472
+ case "upper":
14473
+ case "toUpperCase":
14474
+ builder.toUpperCase();
14475
+ break;
14476
+ case "lower":
14477
+ case "toLowerCase":
14478
+ builder.toLowerCase();
14479
+ break;
14480
+ case "reverse":
14481
+ builder.reverse();
14482
+ break;
14483
+ case "capitalize":
14484
+ builder.capitalize();
14485
+ break;
14486
+ case "camelCase":
14487
+ case "camel":
14488
+ builder.camelCase();
14489
+ break;
14490
+ case "snakeCase":
14491
+ case "snake":
14492
+ builder.snakeCase();
14493
+ break;
14494
+ case "replace":
14495
+ builder.replace(a[0] ?? "", a[1] ?? "");
14496
+ break;
14497
+ case "prefixRemove":
14498
+ builder.prefixRemove(a[0] ?? "");
14499
+ break;
14500
+ case "suffixAppend":
14501
+ builder.suffixAppend(a[0] ?? "");
14502
+ break;
14503
+ default:
14504
+ return fail(`Unknown DSL op: ${name}`);
14505
+ }
14506
+ }
14507
+ const result = builder.execute(params["input"] ?? "");
14508
+ return ok({ input: params["input"], ops, result });
14410
14509
  } catch {
14411
- return ok({ dsl: null, spec: params["spec"] });
14510
+ return fail("Synthesis package not available");
14412
14511
  }
14413
14512
  }),
14414
- tool("synthesis.synthesize", "Synthesize a program from input/output examples", "synthesis", [
14415
- param("examples", "array", "Input/output example pairs"),
14416
- param("constraints", "object", "Synthesis constraints", false)
14417
- ], async (params) => {
14513
+ tool("synthesis.synthesize", "Synthesize a transformation rule from input/output examples", "synthesis", [param("examples", "array", "Array of {input, output} example pairs")], async (params) => {
14418
14514
  try {
14419
- const syn = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
14420
- const result = syn.synthesize?.(params["examples"], params["constraints"]);
14421
- return ok(result ?? { program: null, confidence: 0 });
14515
+ const { createSynthesisEngine: createSynthesisEngine2 } = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
14516
+ const examples = (params["examples"] ?? []).map((e) => ({
14517
+ input: e.input ?? "",
14518
+ output: e.output ?? ""
14519
+ }));
14520
+ const rule = createSynthesisEngine2().synthesize(examples);
14521
+ return ok({ rule, synthesized: rule !== null });
14422
14522
  } catch {
14423
- return ok({ program: null, confidence: 0 });
14523
+ return fail("Synthesis package not available");
14424
14524
  }
14425
14525
  }),
14426
- tool("synthesis.version-space", "Manage version spaces for program synthesis", "synthesis", [
14427
- param("action", "string", "Action: create | update | query"),
14428
- param("examples", "array", "Examples for version space", false)
14526
+ tool("synthesis.version-space", "Build a version space from positive/negative examples and get consistent hypotheses", "synthesis", [
14527
+ param("name", "string", "Version space name", false, "default"),
14528
+ param("positive", "array", "Positive examples", false),
14529
+ param("negative", "array", "Negative examples", false)
14429
14530
  ], async (params) => {
14430
14531
  try {
14431
- const syn = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
14432
- const result = syn.versionSpace?.(params["action"], params["examples"]);
14433
- return ok(result ?? { action: params["action"], spaces: [] });
14532
+ const { createVersionSpaceManager: createVersionSpaceManager2 } = await Promise.resolve().then(() => (init_dist12(), dist_exports12));
14533
+ const mgr = createVersionSpaceManager2();
14534
+ const name = params["name"] ?? "default";
14535
+ mgr.create(name);
14536
+ for (const p of params["positive"] ?? [])
14537
+ mgr.addPositive(name, p);
14538
+ for (const n of params["negative"] ?? [])
14539
+ mgr.addNegative(name, n);
14540
+ return ok({ name, hypotheses: mgr.getConsistentHypotheses(name), spaces: mgr.getSpaces().size });
14434
14541
  } catch {
14435
- return ok({ action: params["action"], spaces: [] });
14542
+ return fail("Synthesis package not available");
14436
14543
  }
14437
14544
  })
14438
14545
  ];
@@ -14554,37 +14661,41 @@ function decisionsTools() {
14554
14661
  param("consequences", "string", "Consequences of the decision", false)
14555
14662
  ], async (params) => {
14556
14663
  try {
14557
- const dec = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
14558
- const adr = dec.createADR?.({
14664
+ const { createDecisionManager: createDecisionManager2 } = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
14665
+ const mgr = createDecisionManager2(params["basePath"] ?? ".decisions");
14666
+ await mgr.load();
14667
+ const adr = await mgr.create({
14559
14668
  title: params["title"],
14560
- context: params["context"],
14561
- decision: params["decision"],
14562
- consequences: params["consequences"]
14669
+ context: params["context"] ?? "",
14670
+ decision: params["decision"] ?? "",
14671
+ consequences: params["consequences"] ?? ""
14563
14672
  });
14564
- return ok(adr ?? { title: params["title"], status: "proposed" });
14673
+ return ok(adr);
14565
14674
  } catch {
14566
- return ok({ title: params["title"], status: "proposed" });
14675
+ return fail("Decisions package not available");
14567
14676
  }
14568
14677
  }),
14569
- tool("decisions.list", "List all Architecture Decision Records", "decisions", [param("basePath", "string", "ADR directory path", false, ".")], async (params) => {
14678
+ tool("decisions.list", "List all Architecture Decision Records", "decisions", [param("basePath", "string", "ADR base path", false, ".decisions")], async (params) => {
14570
14679
  try {
14571
- const dec = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
14572
- const adrs = dec.listADRs?.(params["basePath"] ?? ".");
14573
- return ok(adrs ?? []);
14680
+ const { createDecisionManager: createDecisionManager2 } = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
14681
+ const mgr = createDecisionManager2(params["basePath"] ?? ".decisions");
14682
+ await mgr.load();
14683
+ return ok(await mgr.list());
14574
14684
  } catch {
14575
- return ok([]);
14685
+ return fail("Decisions package not available");
14576
14686
  }
14577
14687
  }),
14578
14688
  tool("decisions.search", "Search Architecture Decision Records by keyword", "decisions", [
14579
14689
  param("query", "string", "Search query"),
14580
- param("basePath", "string", "ADR directory path", false, ".")
14690
+ param("basePath", "string", "ADR base path", false, ".decisions")
14581
14691
  ], async (params) => {
14582
14692
  try {
14583
- const dec = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
14584
- const results = dec.searchADRs?.(params["query"], params["basePath"] ?? ".");
14585
- return ok(results ?? []);
14693
+ const { createDecisionManager: createDecisionManager2 } = await Promise.resolve().then(() => (init_dist9(), dist_exports9));
14694
+ const mgr = createDecisionManager2(params["basePath"] ?? ".decisions");
14695
+ await mgr.load();
14696
+ return ok(await mgr.search(params["query"]));
14586
14697
  } catch {
14587
- return ok([]);
14698
+ return fail("Decisions package not available");
14588
14699
  }
14589
14700
  })
14590
14701
  ];
@@ -15307,6 +15418,7 @@ var init_mcp_cli_launcher = __esm({
15307
15418
  } else {
15308
15419
  const transport = new StdioTransport2();
15309
15420
  await server.start(transport);
15421
+ await transport.waitForClose();
15310
15422
  }
15311
15423
  }
15312
15424
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-cli-launcher.d.ts","sourceRoot":"","sources":["../../../src/interface/cli/mcp-cli-launcher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,qBAAa,cAAc;IACnB,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBnD"}
1
+ {"version":3,"file":"mcp-cli-launcher.d.ts","sourceRoot":"","sources":["../../../src/interface/cli/mcp-cli-launcher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,qBAAa,cAAc;IACnB,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAqBnD"}
@@ -14,6 +14,10 @@ export class McpCliLauncher {
14
14
  else {
15
15
  const transport = new StdioTransport();
16
16
  await server.start(transport);
17
+ // StdioTransport.start() resolves immediately; without this the CLI's
18
+ // top-level `process.exit()` would kill the server before it handles any
19
+ // request. Block until the client disconnects (stdin EOF).
20
+ await transport.waitForClose();
17
21
  }
18
22
  }
19
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-cli-launcher.js","sourceRoot":"","sources":["../../../src/interface/cli/mcp-cli-launcher.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,cAAc;IACzB,KAAK,CAAC,KAAK,CAAC,OAAsB;QAChC,MAAM,EAAE,mBAAmB,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;QACrF,MAAM,MAAM,GAAG,mBAAmB,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAE/E,IAAI,OAAO,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC;YAChC,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;YAC1E,MAAM,OAAO,GAAG,IAAI,mBAAmB,EAAE,CAAC;YAC1C,MAAM,OAAO,CAAC,MAAM,CAAC;gBACnB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;gBAC1B,YAAY,EAAE,MAAM;gBACpB,WAAW,EAAE,WAAW;aACzB,EAAE,MAAqE,CAAC,CAAC;QAC5E,CAAC;aAAM,CAAC;YACN,MAAM,SAAS,GAAG,IAAI,cAAc,EAAE,CAAC;YACvC,MAAM,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"mcp-cli-launcher.js","sourceRoot":"","sources":["../../../src/interface/cli/mcp-cli-launcher.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,cAAc;IACzB,KAAK,CAAC,KAAK,CAAC,OAAsB;QAChC,MAAM,EAAE,mBAAmB,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;QACrF,MAAM,MAAM,GAAG,mBAAmB,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAE/E,IAAI,OAAO,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC;YAChC,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;YAC1E,MAAM,OAAO,GAAG,IAAI,mBAAmB,EAAE,CAAC;YAC1C,MAAM,OAAO,CAAC,MAAM,CAAC;gBACnB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;gBAC1B,YAAY,EAAE,MAAM;gBACpB,WAAW,EAAE,WAAW;aACzB,EAAE,MAAqE,CAAC,CAAC;QAC5E,CAAC;aAAM,CAAC;YACN,MAAM,SAAS,GAAG,IAAI,cAAc,EAAE,CAAC;YACvC,MAAM,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC9B,sEAAsE;YACtE,yEAAyE;YACzE,2DAA2D;YAC3D,MAAM,SAAS,CAAC,YAAY,EAAE,CAAC;QACjC,CAAC;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musubix2",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "description": "MUSUBIX2 — Specification Driven Development System",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",