musubix2 0.5.46 → 0.5.47

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.46","timestamp":"2026-07-10T03:44:31.068Z"}
1
+ {"generator":"musubix2","version":"0.5.47","timestamp":"2026-07-10T04:30:56.610Z"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "1.0",
3
- "generatedAt": "2026-07-10T03:44:31.101Z",
3
+ "generatedAt": "2026-07-10T04:30:56.641Z",
4
4
  "entries": [
5
5
  {
6
6
  "platform": "copilot",
package/dist/cli.js CHANGED
@@ -6889,7 +6889,39 @@ var init_multi_lang_parser = __esm({
6889
6889
  }
6890
6890
  continue;
6891
6891
  }
6892
- const methodMatch = trimmed.match(/^func\s+\((\w+)\s+\*?(\w+)\)\s+(\w+)\s*\(([^)]*)\)(?:\s*(?:\(([^)]*)\)|(\S+)))?/);
6892
+ const currentBlock = tracker.getCurrentBlock();
6893
+ const currentNode = currentBlock ? blockNodeMap.get(currentBlock) : void 0;
6894
+ if (currentBlock?.type === "interface" && currentNode) {
6895
+ const ifaceMethod = trimmed.match(/^(\w+)\s*\(([^)]*)\)\s*(.*)$/);
6896
+ if (ifaceMethod) {
6897
+ const mName = ifaceMethod[1];
6898
+ const mParams = ifaceMethod[2] ? ifaceMethod[2].split(",").map((p) => p.trim()).filter(Boolean) : [];
6899
+ const mRet = ifaceMethod[3]?.replace(/\{$/, "").trim() || void 0;
6900
+ currentNode.children.push({
6901
+ type: "method",
6902
+ name: mName,
6903
+ startLine: lineNum,
6904
+ endLine: lineNum,
6905
+ children: [],
6906
+ modifiers: mName[0] === mName[0].toUpperCase() ? ["exported"] : [],
6907
+ params: mParams,
6908
+ returnType: mRet,
6909
+ parent: currentNode.name,
6910
+ language: "go"
6911
+ });
6912
+ const { closed: closed2 } = tracker.processLine(line, lineNum);
6913
+ if (closed2) {
6914
+ for (const c of closed2) {
6915
+ const n = blockNodeMap.get(c);
6916
+ if (n) {
6917
+ n.endLine = lineNum;
6918
+ }
6919
+ }
6920
+ }
6921
+ continue;
6922
+ }
6923
+ }
6924
+ const methodMatch = trimmed.match(/^func\s+\((\w+)\s+\*?(\w+)\)\s+(\w+)\s*(?:\[[^\]]*\])?\s*\(([^)]*)\)(?:\s*(?:\(([^)]*)\)|(\S+)))?/);
6893
6925
  if (methodMatch) {
6894
6926
  const receiverType = methodMatch[2];
6895
6927
  const name = methodMatch[3];
@@ -6939,7 +6971,7 @@ var init_multi_lang_parser = __esm({
6939
6971
  }
6940
6972
  continue;
6941
6973
  }
6942
- const funcMatch = trimmed.match(/^func\s+(\w+)\s*\(([^)]*)\)(?:\s*(?:\(([^)]*)\)|(\S+)))?/);
6974
+ const funcMatch = trimmed.match(/^func\s+(\w+)\s*(?:\[[^\]]*\])?\s*\(([^)]*)\)(?:\s*(?:\(([^)]*)\)|(\S+)))?/);
6943
6975
  if (funcMatch) {
6944
6976
  const name = funcMatch[1];
6945
6977
  const paramStr = funcMatch[2];
@@ -7016,6 +7048,23 @@ var init_multi_lang_parser = __esm({
7016
7048
  }
7017
7049
  }
7018
7050
  }
7051
+ const typeByName = /* @__PURE__ */ new Map();
7052
+ for (const n of nodes) {
7053
+ if (n.type === "struct" || n.type === "interface") {
7054
+ typeByName.set(n.name, n);
7055
+ }
7056
+ }
7057
+ for (let idx = nodes.length - 1; idx >= 0; idx--) {
7058
+ const n = nodes[idx];
7059
+ if (n.type !== "method" || !n.parent) {
7060
+ continue;
7061
+ }
7062
+ const owner = typeByName.get(n.parent);
7063
+ if (owner && owner !== n && !owner.children.includes(n)) {
7064
+ owner.children.push(n);
7065
+ nodes.splice(idx, 1);
7066
+ }
7067
+ }
7019
7068
  return { language: "go", nodes, imports, exports, errors };
7020
7069
  }
7021
7070
  };
@@ -13740,13 +13789,23 @@ var init_dist14 = __esm({
13740
13789
  for (const token of tokens) {
13741
13790
  tf.set(token, (tf.get(token) ?? 0) + 1);
13742
13791
  }
13792
+ const fitted = this.idfScores.size > 0;
13743
13793
  for (const [term, count] of tf) {
13794
+ const known = this.idfScores.get(term);
13795
+ if (known === void 0 && fitted) {
13796
+ continue;
13797
+ }
13744
13798
  const termFreq = count / tokens.length;
13745
- const idf = this.idfScores.get(term) ?? Math.log(this.documentCount + 1);
13799
+ const idf = known ?? 1;
13746
13800
  const tfidf = termFreq * idf;
13747
- const bucket = this._hash(term) % this.dimensions;
13748
- const sign = this._signHash(term) ? 1 : -1;
13749
- vec[bucket] += sign * tfidf;
13801
+ const vocabIdx = this.vocabulary.get(term);
13802
+ if (fitted && vocabIdx !== void 0) {
13803
+ vec[vocabIdx % this.dimensions] += tfidf;
13804
+ } else {
13805
+ const bucket = this._hash(term) % this.dimensions;
13806
+ const sign = this._signHash(term) ? 1 : -1;
13807
+ vec[bucket] += sign * tfidf;
13808
+ }
13750
13809
  }
13751
13810
  return vec;
13752
13811
  }
package/dist/index.js CHANGED
@@ -6889,7 +6889,39 @@ var init_multi_lang_parser = __esm({
6889
6889
  }
6890
6890
  continue;
6891
6891
  }
6892
- const methodMatch = trimmed.match(/^func\s+\((\w+)\s+\*?(\w+)\)\s+(\w+)\s*\(([^)]*)\)(?:\s*(?:\(([^)]*)\)|(\S+)))?/);
6892
+ const currentBlock = tracker.getCurrentBlock();
6893
+ const currentNode = currentBlock ? blockNodeMap.get(currentBlock) : void 0;
6894
+ if (currentBlock?.type === "interface" && currentNode) {
6895
+ const ifaceMethod = trimmed.match(/^(\w+)\s*\(([^)]*)\)\s*(.*)$/);
6896
+ if (ifaceMethod) {
6897
+ const mName = ifaceMethod[1];
6898
+ const mParams = ifaceMethod[2] ? ifaceMethod[2].split(",").map((p) => p.trim()).filter(Boolean) : [];
6899
+ const mRet = ifaceMethod[3]?.replace(/\{$/, "").trim() || void 0;
6900
+ currentNode.children.push({
6901
+ type: "method",
6902
+ name: mName,
6903
+ startLine: lineNum,
6904
+ endLine: lineNum,
6905
+ children: [],
6906
+ modifiers: mName[0] === mName[0].toUpperCase() ? ["exported"] : [],
6907
+ params: mParams,
6908
+ returnType: mRet,
6909
+ parent: currentNode.name,
6910
+ language: "go"
6911
+ });
6912
+ const { closed: closed2 } = tracker.processLine(line, lineNum);
6913
+ if (closed2) {
6914
+ for (const c of closed2) {
6915
+ const n = blockNodeMap.get(c);
6916
+ if (n) {
6917
+ n.endLine = lineNum;
6918
+ }
6919
+ }
6920
+ }
6921
+ continue;
6922
+ }
6923
+ }
6924
+ const methodMatch = trimmed.match(/^func\s+\((\w+)\s+\*?(\w+)\)\s+(\w+)\s*(?:\[[^\]]*\])?\s*\(([^)]*)\)(?:\s*(?:\(([^)]*)\)|(\S+)))?/);
6893
6925
  if (methodMatch) {
6894
6926
  const receiverType = methodMatch[2];
6895
6927
  const name = methodMatch[3];
@@ -6939,7 +6971,7 @@ var init_multi_lang_parser = __esm({
6939
6971
  }
6940
6972
  continue;
6941
6973
  }
6942
- const funcMatch = trimmed.match(/^func\s+(\w+)\s*\(([^)]*)\)(?:\s*(?:\(([^)]*)\)|(\S+)))?/);
6974
+ const funcMatch = trimmed.match(/^func\s+(\w+)\s*(?:\[[^\]]*\])?\s*\(([^)]*)\)(?:\s*(?:\(([^)]*)\)|(\S+)))?/);
6943
6975
  if (funcMatch) {
6944
6976
  const name = funcMatch[1];
6945
6977
  const paramStr = funcMatch[2];
@@ -7016,6 +7048,23 @@ var init_multi_lang_parser = __esm({
7016
7048
  }
7017
7049
  }
7018
7050
  }
7051
+ const typeByName = /* @__PURE__ */ new Map();
7052
+ for (const n of nodes) {
7053
+ if (n.type === "struct" || n.type === "interface") {
7054
+ typeByName.set(n.name, n);
7055
+ }
7056
+ }
7057
+ for (let idx = nodes.length - 1; idx >= 0; idx--) {
7058
+ const n = nodes[idx];
7059
+ if (n.type !== "method" || !n.parent) {
7060
+ continue;
7061
+ }
7062
+ const owner = typeByName.get(n.parent);
7063
+ if (owner && owner !== n && !owner.children.includes(n)) {
7064
+ owner.children.push(n);
7065
+ nodes.splice(idx, 1);
7066
+ }
7067
+ }
7019
7068
  return { language: "go", nodes, imports, exports, errors };
7020
7069
  }
7021
7070
  };
@@ -13740,13 +13789,23 @@ var init_dist14 = __esm({
13740
13789
  for (const token of tokens) {
13741
13790
  tf.set(token, (tf.get(token) ?? 0) + 1);
13742
13791
  }
13792
+ const fitted = this.idfScores.size > 0;
13743
13793
  for (const [term, count] of tf) {
13794
+ const known = this.idfScores.get(term);
13795
+ if (known === void 0 && fitted) {
13796
+ continue;
13797
+ }
13744
13798
  const termFreq = count / tokens.length;
13745
- const idf = this.idfScores.get(term) ?? Math.log(this.documentCount + 1);
13799
+ const idf = known ?? 1;
13746
13800
  const tfidf = termFreq * idf;
13747
- const bucket = this._hash(term) % this.dimensions;
13748
- const sign = this._signHash(term) ? 1 : -1;
13749
- vec[bucket] += sign * tfidf;
13801
+ const vocabIdx = this.vocabulary.get(term);
13802
+ if (fitted && vocabIdx !== void 0) {
13803
+ vec[vocabIdx % this.dimensions] += tfidf;
13804
+ } else {
13805
+ const bucket = this._hash(term) % this.dimensions;
13806
+ const sign = this._signHash(term) ? 1 : -1;
13807
+ vec[bucket] += sign * tfidf;
13808
+ }
13750
13809
  }
13751
13810
  return vec;
13752
13811
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musubix2",
3
- "version": "0.5.46",
3
+ "version": "0.5.47",
4
4
  "description": "MUSUBIX2 — Specification Driven Development System",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",