ai-spector 0.8.21 → 0.8.24

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.
Files changed (56) hide show
  1. package/dist/cli.js +18 -21
  2. package/dist/cli.js.map +1 -1
  3. package/dist/core/operations/cocoindex.d.ts +11 -0
  4. package/dist/core/operations/cocoindex.d.ts.map +1 -1
  5. package/dist/core/operations/cocoindex.js +34 -4
  6. package/dist/core/operations/cocoindex.js.map +1 -1
  7. package/dist/core/operations/graph-merge.js +1 -1
  8. package/dist/core/operations/graph-merge.js.map +1 -1
  9. package/dist/core/operations/index.d.ts +9 -0
  10. package/dist/core/operations/index.d.ts.map +1 -1
  11. package/dist/core/operations/index.js +49 -1
  12. package/dist/core/operations/index.js.map +1 -1
  13. package/dist/core/visualize/html.js +1 -1
  14. package/dist/interfaces/cli/format/cocoindex.d.ts +2 -1
  15. package/dist/interfaces/cli/format/cocoindex.d.ts.map +1 -1
  16. package/dist/interfaces/cli/format/cocoindex.js +23 -0
  17. package/dist/interfaces/cli/format/cocoindex.js.map +1 -1
  18. package/dist/interfaces/cli/format/index-cmd.d.ts.map +1 -1
  19. package/dist/interfaces/cli/format/index-cmd.js +3 -2
  20. package/dist/interfaces/cli/format/index-cmd.js.map +1 -1
  21. package/dist/interfaces/cli/format/misc.d.ts +0 -2
  22. package/dist/interfaces/cli/format/misc.d.ts.map +1 -1
  23. package/dist/interfaces/cli/format/misc.js +0 -14
  24. package/dist/interfaces/cli/format/misc.js.map +1 -1
  25. package/dist/interfaces/mcp/schemas.d.ts +3 -4
  26. package/dist/interfaces/mcp/schemas.d.ts.map +1 -1
  27. package/dist/interfaces/mcp/schemas.js +4 -9
  28. package/dist/interfaces/mcp/schemas.js.map +1 -1
  29. package/dist/interfaces/mcp/server.js +11 -11
  30. package/dist/interfaces/mcp/server.js.map +1 -1
  31. package/dist/interfaces/mcp/tools/analyze.d.ts +1 -2
  32. package/dist/interfaces/mcp/tools/analyze.d.ts.map +1 -1
  33. package/dist/interfaces/mcp/tools/analyze.js +1 -7
  34. package/dist/interfaces/mcp/tools/analyze.js.map +1 -1
  35. package/dist/interfaces/mcp/tools/cocoindex.d.ts +7 -9
  36. package/dist/interfaces/mcp/tools/cocoindex.d.ts.map +1 -1
  37. package/dist/interfaces/mcp/tools/cocoindex.js +30 -1
  38. package/dist/interfaces/mcp/tools/cocoindex.js.map +1 -1
  39. package/dist/interfaces/sdk/index.d.ts +2 -2
  40. package/dist/interfaces/sdk/index.d.ts.map +1 -1
  41. package/dist/interfaces/sdk/index.js +1 -1
  42. package/dist/interfaces/sdk/index.js.map +1 -1
  43. package/package.json +1 -1
  44. package/scaffold/.ai-spector/.docflow/config/workflow.dependencies.json +3 -3
  45. package/scaffold/claude/.claude/skills/ai-spector-generate-srs/skill.md +1 -1
  46. package/scaffold/claude/.claude/skills/ai-spector-graph/skill.md +2 -2
  47. package/scaffold/claude/CLAUDE.md +13 -6
  48. package/scaffold/cocoindex/pipeline.py +27 -2
  49. package/scaffold/cocoindex/server.py +33 -5
  50. package/scaffold/cursor/WORKFLOW.md +1 -1
  51. package/scaffold/cursor/commands/_workflow.md +12 -4
  52. package/scaffold/cursor/skills/ai-spector/SKILL.md +1 -1
  53. package/scaffold/cursor/skills/ai-spector/references/graph.md +1 -1
  54. package/scaffold/cursor/skills/ai-spector-graph/references/analyze.md +9 -10
  55. package/scaffold/cursor/skills/ai-spector-graph/references/validate-graph.md +2 -2
  56. package/scaffold/cursor/skills/ai-spector-graph/references/visualize-graph.md +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"cocoindex.js","sourceRoot":"","sources":["../../../../src/interfaces/mcp/tools/cocoindex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EACrB,UAAU,GACX,MAAM,uCAAuC,CAAC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,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,KAA4C;IACpF,MAAM,UAAU,GAAG,MAAM,qBAAqB,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAE5E,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO;YACL,KAAK,EAAE,2DAA2D;YAClE,mBAAmB,EAAE,KAAK;SAC3B,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC;YACtC,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;IACrE,CAAC;AACH,CAAC"}
@@ -11,8 +11,8 @@ export { runGraphQuery } from "../../core/operations/graph-query.js";
11
11
  export type { GraphQueryCliOptions } from "../../core/operations/graph-query.js";
12
12
  export { runIndex } from "../../core/operations/index.js";
13
13
  export type { IndexReport, IndexOptions } from "../../core/operations/index.js";
14
- export { runCocoindexSetup, runCocoindexSearch, runGraphQueryFuzzy, isCocoindexConfigured, } from "../../core/operations/cocoindex.js";
15
- export type { CocoindexSetupOptions, CocoindexSetupResult, CocoindexSearchOptions, CocoindexSearchResult, SearchResult as CocoindexSearchHit, FuzzyQueryOptions, FuzzyQueryResult, } from "../../core/operations/cocoindex.js";
14
+ export { runCocoindexSetup, runCocoindexSearch, runCocoindexStats, runGraphQueryFuzzy, isCocoindexConfigured, } from "../../core/operations/cocoindex.js";
15
+ export type { CocoindexSetupOptions, CocoindexSetupResult, CocoindexSearchOptions, CocoindexSearchResult, CocoindexStatsResult, SearchResult as CocoindexSearchHit, FuzzyQueryOptions, FuzzyQueryResult, } from "../../core/operations/cocoindex.js";
16
16
  export { runCommentsList, runCommentsInbox, runCommentsPlan, runCommentsShow, runCommentsResolve, } from "../../core/operations/comments.js";
17
17
  export type { CommentsListOptions, CommentsListResult, CommentsInboxOptions, CommentsPlanOptions, CommentsShowOptions, CommentsResolveOptions, } from "../../core/operations/comments.js";
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interfaces/sdk/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,YAAY,EACZ,cAAc,EACd,oBAAoB,EAAS,sDAAsD;AAGnF,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EAGpB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EAGrB,qBAAqB,EACrB,qBAAqB,EAGrB,oBAAoB,EACpB,uBAAuB,EAGvB,YAAY,EACZ,iBAAiB,EAGjB,kBAAkB,EAGlB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EAEV,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EAGrB,eAAe,EACf,WAAW,EACX,YAAY,EAGZ,YAAY,EACZ,gBAAgB,EAGhB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EAGd,cAAc,EAGd,kBAAkB,EAClB,UAAU,EAGV,YAAY,EACZ,qBAAqB,EAGrB,eAAe,EACf,gBAAgB,EAGhB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AAGnC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,i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AAC;AAGhF,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,IAAI,kBAAkB,EAClC,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,GACnB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,mCAAmC,CAAC"}
@@ -29,7 +29,7 @@ export { runGraphQuery } from "../../core/operations/graph-query.js";
29
29
  // Index
30
30
  export { runIndex } from "../../core/operations/index.js";
31
31
  // CocoIndex
32
- export { runCocoindexSetup, runCocoindexSearch, runGraphQueryFuzzy, isCocoindexConfigured, } from "../../core/operations/cocoindex.js";
32
+ export { runCocoindexSetup, runCocoindexSearch, runCocoindexStats, runGraphQueryFuzzy, isCocoindexConfigured, } from "../../core/operations/cocoindex.js";
33
33
  // Comments
34
34
  export { runCommentsList, runCommentsInbox, runCommentsPlan, runCommentsShow, runCommentsResolve, } from "../../core/operations/comments.js";
35
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/sdk/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAE9E,OAAO;AACL,kBAAkB;AAClB,YAAY,EACZ,cAAc,EACd,oBAAoB,EAAS,sDAAsD;AAEnF,mBAAmB;AACnB,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB;AAEpB,mBAAmB;AACnB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB;AAErB,wBAAwB;AACxB,qBAAqB,EACrB,qBAAqB;AAErB,wBAAwB;AACxB,oBAAoB,EACpB,uBAAuB;AAEvB,mBAAmB;AACnB,YAAY,EACZ,iBAAiB;AAEjB,SAAS;AACT,kBAAkB;AAElB,QAAQ;AACR,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAiDnC,iFAAiF;AACjF,qFAAqF;AAErF,+BAA+B;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAM9F,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAGrE,QAAQ;AACR,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG1D,YAAY;AACZ,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAW5C,WAAW;AACX,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,GACnB,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/sdk/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAE9E,OAAO;AACL,kBAAkB;AAClB,YAAY,EACZ,cAAc,EACd,oBAAoB,EAAS,sDAAsD;AAEnF,mBAAmB;AACnB,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB;AAEpB,mBAAmB;AACnB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB;AAErB,wBAAwB;AACxB,qBAAqB,EACrB,qBAAqB;AAErB,wBAAwB;AACxB,oBAAoB,EACpB,uBAAuB;AAEvB,mBAAmB;AACnB,YAAY,EACZ,iBAAiB;AAEjB,SAAS;AACT,kBAAkB;AAElB,QAAQ;AACR,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAiDnC,iFAAiF;AACjF,qFAAqF;AAErF,+BAA+B;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAM9F,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAGrE,QAAQ;AACR,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG1D,YAAY;AACZ,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAY5C,WAAW;AACX,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,GACnB,MAAM,mCAAmC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-spector",
3
- "version": "0.8.21",
3
+ "version": "0.8.24",
4
4
  "description": "Cursor-first documentation workflow: traceability graph, SRS/basic/detail design templates, and ai-spector CLI",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -42,7 +42,7 @@
42
42
  "id": "graph-file",
43
43
  "type": "pathExists",
44
44
  "path": ".ai-spector/graph/traceability.graph.json",
45
- "fail": "Missing traceability graph — run npx ai-spector analyze first."
45
+ "fail": "Missing traceability graph — run npx ai-spector index first."
46
46
  }
47
47
  ],
48
48
  "onSuccess": {
@@ -63,7 +63,7 @@
63
63
  "id": "graph-file",
64
64
  "type": "pathExists",
65
65
  "path": ".ai-spector/graph/traceability.graph.json",
66
- "fail": "Missing traceability graph — run npx ai-spector analyze and /analyze."
66
+ "fail": "Missing traceability graph — run npx ai-spector index and /analyze."
67
67
  },
68
68
  {
69
69
  "id": "graph-merged",
@@ -82,7 +82,7 @@
82
82
  "onBlock": {
83
83
  "doFirst": [
84
84
  "Add or update files in docs/data-source/",
85
- "Run npx ai-spector analyze",
85
+ "Run npx ai-spector index",
86
86
  "Run /analyze (merge into graph)",
87
87
  "Run /validate-graph"
88
88
  ]
@@ -12,7 +12,7 @@ description: "Generates SRS documents from the knowledge graph using DAG waves.
12
12
  ## Prerequisites
13
13
 
14
14
  - `npx ai-spector graph validate` passes
15
- - Data source analyzed (`npx ai-spector analyze`)
15
+ - Data source analyzed (`npx ai-spector index`)
16
16
 
17
17
  > **Scope:** This skill is for the **builtin SRS template** only. If a custom pack is active,
18
18
  > use `ai-spector-generate-<packname>` instead (installed when the pack was activated).
@@ -22,7 +22,7 @@ Use **MCP tools** when `ai-spector` server is configured. CLI is fallback only.
22
22
  ### Analyze (ingest data-source)
23
23
 
24
24
  ```
25
- analyze({}) # MCP — prepare graph scaffold
25
+ index({}) # MCP — prepare graph scaffold
26
26
  # agent extracts entities → writes knowledge.json
27
27
  knowledge_validate({}) # MCP — validate before merge
28
28
  knowledge_status({}) # MCP — confirm entity counts
@@ -30,7 +30,7 @@ graph_merge({ fromKnowledge: true }) # MCP — commit to graph
30
30
  graph_validate({}) # MCP — verify result
31
31
  ```
32
32
 
33
- CLI fallback: `npx ai-spector analyze` → `npx ai-spector graph merge --from-knowledge` → `npx ai-spector graph validate`
33
+ CLI fallback: `npx ai-spector index` → `npx ai-spector graph merge --from-knowledge` → `npx ai-spector graph validate`
34
34
 
35
35
  ### Index (refresh after doc edits)
36
36
 
@@ -17,7 +17,7 @@ When the `ai-spector` MCP server is available, **call the MCP tool** instead of
17
17
  | Validate graph | `graph_validate({})` | `npx ai-spector graph validate` |
18
18
  | Impact analysis | `graph_impact({ originId, change })` | `npx ai-spector graph impact …` |
19
19
  | Walk graph from node | `graph_query({ id })` | `npx ai-spector graph query <id> --json` |
20
- | **Analyze data-source** | *(CLI onlyno MCP tool)* | `npx ai-spector analyze` |
20
+ | **Analyze data-source** | *(agent stepread `docs/data-source/`, write `analysis/knowledge.json`, then `index({})`)* | — |
21
21
 
22
22
  ### 2. Refresh index before any staleness check
23
23
 
@@ -59,7 +59,7 @@ Skip impact/index only when the user explicitly says it was a typo-only fix with
59
59
 
60
60
  | Need | MCP (preferred) | CLI fallback |
61
61
  |------|-----------------|--------------|
62
- | Prepare graph scaffold | `analyze({})` | `npx ai-spector analyze` |
62
+ | Prepare graph scaffold | `index({})` | `npx ai-spector index` |
63
63
  | Check knowledge.json before merge | `knowledge_status({})` · `knowledge_validate({})` | *(no CLI)* |
64
64
  | Merge knowledge → graph | `graph_merge({ fromKnowledge: true })` | `npx ai-spector graph merge --from-knowledge` |
65
65
  | Find what needs regeneration | `graph_impact({ git: true, change: "content_change" })` | `npx ai-spector graph impact --git --json` |
@@ -97,7 +97,6 @@ Skip impact/index only when the user explicitly says it was a typo-only fix with
97
97
 
98
98
  | Tool | Purpose |
99
99
  |------|---------|
100
- | `analyze({})` | Prepare graph scaffold from templates |
101
100
  | `knowledge_status({})` | Check knowledge.json entity counts |
102
101
  | `knowledge_validate({})` | Validate knowledge.json schema |
103
102
  | `graph_merge({ fromKnowledge: true })` | Merge knowledge.json into graph |
@@ -105,7 +104,7 @@ Skip impact/index only when the user explicitly says it was a typo-only fix with
105
104
  | `graph_report({})` | Graph layer health audit |
106
105
  | `graph_impact({ git: true, change: "…" })` | Impact of current git diff |
107
106
  | `graph_query({ seedId: "…" })` | Walk graph from a node |
108
- | `index({})` | Refresh graph + translation queue |
107
+ | `index({})` | Full index pipeline: graph structure, knowledge merge, SRS/basic-design body extract, doc indexes, translation queue. Report includes `sources` + `nextAction` |
109
108
  | `index({ cocoindexSync: true })` | Refresh graph + translation queue + embeddings |
110
109
  | `lang_queue({})` | Translation queue status |
111
110
  | `cocoindex_status({})` | CocoIndex readiness check |
@@ -116,7 +115,6 @@ Skip impact/index only when the user explicitly says it was a typo-only fix with
116
115
  ### CLI (fallback / MCP-unavailable or no tool equivalent)
117
116
 
118
117
  ```bash
119
- npx ai-spector analyze # ingest data-source, build graph (no MCP equivalent)
120
118
  npx ai-spector index # fallback for index({})
121
119
  npx ai-spector graph validate # fallback for graph_validate({})
122
120
  npx ai-spector graph impact --git --json # fallback for graph_impact({ git: true })
@@ -136,8 +134,17 @@ On MCP tool or CLI failure: show the output, offer fix / workaround / pause. Do
136
134
 
137
135
  ## Pipeline order
138
136
 
137
+ The entry point is **index**. Run `index({})` and follow the report's `sources` / `nextAction`:
138
+
139
139
  ```
140
- analyze → validate graph → generate SRS → index
140
+ index
141
+ → data-source files present, knowledge not extracted?
142
+ analyze (agent: read docs/data-source/, write analysis/knowledge.json) → index again
143
+ → SRS exists? indexed by the same run
144
+ → basic design exists? indexed by the same run
145
+ → no SRS yet? STOP — report analysis done; wait for user to ask "generate SRS"
146
+
147
+ generate SRS → index → validate graph
141
148
  → generate basic design → index
142
149
  → generate detail design
143
150
  → prototype setup → generate HTML screens
@@ -24,7 +24,15 @@ async def _search(query: str, limit: int, threshold: float) -> list[dict]:
24
24
  query_vec = await embedder.embed(query)
25
25
  conn = await lancedb.connect_async(LANCEDB_URI)
26
26
  table = await conn.open_table(TABLE_NAME)
27
- results = await (await table.search(query_vec, vector_column_name="embedding")).limit(limit).to_list()
27
+ # Cosine distance so that score = 1 - distance is a real similarity in
28
+ # [0, 1]. The LanceDB default (L2) makes 1 - distance meaningless and
29
+ # silently filters out every result.
30
+ results = await (
31
+ (await table.search(query_vec, vector_column_name="embedding"))
32
+ .distance_type("cosine")
33
+ .limit(limit)
34
+ .to_list()
35
+ )
28
36
  return [
29
37
  {
30
38
  "docPath": r["filename"],
@@ -40,6 +48,19 @@ async def _search(query: str, limit: int, threshold: float) -> list[dict]:
40
48
  return []
41
49
 
42
50
 
51
+ async def _stats() -> dict:
52
+ from cocoindex.connectors import lancedb
53
+ try:
54
+ conn = await lancedb.connect_async(LANCEDB_URI)
55
+ table = await conn.open_table(TABLE_NAME)
56
+ chunk_count = await table.count_rows()
57
+ rows = await table.query().select(["filename"]).limit(1_000_000).to_list()
58
+ files = sorted({r["filename"] for r in rows})
59
+ return {"chunkCount": chunk_count, "fileCount": len(files), "files": files}
60
+ except Exception as e:
61
+ return {"error": str(e), "chunkCount": 0, "fileCount": 0, "files": []}
62
+
63
+
43
64
  if __name__ == "__main__":
44
65
  cmd = sys.argv[1] if len(sys.argv) > 1 else ""
45
66
 
@@ -55,11 +76,14 @@ if __name__ == "__main__":
55
76
  parser.add_argument(
56
77
  "--threshold",
57
78
  type=float,
58
- default=float(os.getenv("COCOINDEX_SIMILARITY_THRESHOLD", "0.75")),
79
+ default=float(os.getenv("COCOINDEX_SIMILARITY_THRESHOLD", "0.35")),
59
80
  )
60
81
  args = parser.parse_args(sys.argv[2:])
61
82
  print(json.dumps(asyncio.run(_search(args.query, args.limit, args.threshold))))
62
83
 
84
+ elif cmd == "stats":
85
+ print(json.dumps(asyncio.run(_stats())))
86
+
63
87
  elif cmd == "update":
64
88
  app.update_blocking(report_to_stdout=True)
65
89
 
@@ -68,3 +92,4 @@ if __name__ == "__main__":
68
92
  print(" python pipeline.py mcp Run MCP server")
69
93
  print(" python pipeline.py update Build / refresh index")
70
94
  print(" python pipeline.py search --query X Semantic search")
95
+ print(" python pipeline.py stats Embedding store stats (JSON)")
@@ -1,8 +1,9 @@
1
1
  """
2
2
  MCP server for ai-spector CocoIndex.
3
3
 
4
- Exposes two tools:
4
+ Exposes three tools:
5
5
  docs_search — semantic search over indexed project docs
6
+ docs_stats — chunk/file counts and embedded file paths (diagnostics)
6
7
  docs_update — rebuild the index from current project docs
7
8
 
8
9
  Embedder and LanceDB connection are kept warm for the lifetime of the server
@@ -61,7 +62,7 @@ async def docs_search(
61
62
  query: str,
62
63
  ctx: Context,
63
64
  limit: int = 5,
64
- threshold: float = 0.75,
65
+ threshold: float = 0.35,
65
66
  ) -> list[SearchResult]:
66
67
  """
67
68
  Semantic search over project docs by meaning, not keywords.
@@ -73,7 +74,7 @@ async def docs_search(
73
74
  Args:
74
75
  query: Natural-language description of the concept to search for.
75
76
  limit: Maximum number of results to return (default 5).
76
- threshold: Minimum similarity score 0–1 to include a result (default 0.75).
77
+ threshold: Minimum cosine similarity 0–1 to include a result (default 0.35).
77
78
 
78
79
  Returns:
79
80
  List of matching doc chunks with docPath, heading, excerpt, and score.
@@ -85,9 +86,14 @@ async def docs_search(
85
86
  query_vec = await state.embedder.embed(query)
86
87
 
87
88
  table = await state.db.open_table(TABLE_NAME)
89
+ # Cosine distance so that score = 1 - distance is a real similarity in
90
+ # [0, 1]; the LanceDB default (L2) silently filters out every result.
88
91
  raw = await (
89
- await table.search(query_vec, vector_column_name="embedding")
90
- ).limit(limit).to_list()
92
+ (await table.search(query_vec, vector_column_name="embedding"))
93
+ .distance_type("cosine")
94
+ .limit(limit)
95
+ .to_list()
96
+ )
91
97
 
92
98
  except Exception as exc:
93
99
  raise ToolError(f"Search failed: {exc}") from exc
@@ -107,6 +113,28 @@ async def docs_search(
107
113
  return results
108
114
 
109
115
 
116
+ @mcp.tool()
117
+ async def docs_stats(ctx: Context) -> dict:
118
+ """
119
+ Inspect the embedding store: chunk count, file count, and embedded file paths.
120
+
121
+ Use this to verify which files are actually embedded when docs_search returns
122
+ fewer results than expected.
123
+
124
+ Returns:
125
+ Dict with chunkCount, fileCount, and files (embedded file paths).
126
+ """
127
+ state: ServerState = ctx.request_context.lifespan_context
128
+ try:
129
+ table = await state.db.open_table(TABLE_NAME)
130
+ chunk_count = await table.count_rows()
131
+ rows = await table.query().select(["filename"]).limit(1_000_000).to_list()
132
+ files = sorted({r["filename"] for r in rows})
133
+ except Exception as exc:
134
+ raise ToolError(f"Stats failed: {exc}") from exc
135
+ return {"chunkCount": chunk_count, "fileCount": len(files), "files": files}
136
+
137
+
110
138
  @mcp.tool()
111
139
  def docs_update(ctx: Context) -> str:
112
140
  """
@@ -24,7 +24,7 @@ Then: add files under `docs/data-source/`, enable **all** skills under `.cursor/
24
24
  | You want to… | Say (examples) | Skill | Agent runs (MCP preferred) |
25
25
  |--------------|----------------|-------|---------------------------|
26
26
  | **Setup project** | “setup ai-spector”, “initialize project”, “get started” | `ai-spector-setup` | `setup --check` → `setup -y` → enable skills checklist |
27
- | Ingest sources | “analyze my data source”, “build the knowledge graph” | `ai-spector-graph` | `analyze({})` → agent extracts → `knowledge_validate` → `graph_merge` → `graph_validate` |
27
+ | Ingest sources | “analyze my data source”, “build the knowledge graph” | `ai-spector-graph` | `index({})` → agent extracts → `knowledge_validate` → `graph_merge` → `graph_validate` |
28
28
  | Check graph health | “validate the graph”, “graph errors”, “graph report” | `ai-spector-graph` | `graph_validate({})` · `graph_report({})` |
29
29
  | Refresh after edits | “re-index”, “sync the graph” | `ai-spector-graph` | `index({ cocoindexSync: true })` (or `index({})` if no CocoIndex) |
30
30
  | Write SRS | “generate SRS”, “write use cases” | `ai-spector-generate-srs` | DAG waves → docs/srs → `graph_merge` → `index({ cocoindexSync: true })` |
@@ -19,11 +19,19 @@ Skills auto-route for natural language; **slash commands stay the source of trut
19
19
 
20
20
  | Step | You run | Agent runs (CLI) |
21
21
  |------|---------|------------------|
22
- | 1 | **`/analyze`** | `npx ai-spector analyze` → read markdown from `docs/data-source/` `graph merge --from-knowledge` `graph validate` optional `graph visualize --open` |
22
+ | 1 | **`/index`** | `npx ai-spector index` → the report's **Source detection** + **Next** line decide what happens (see decision tree below) |
23
23
  | 2 | **`/validate-graph`** | `npx ai-spector graph validate` |
24
24
  | 3 | **`/generate-srs`** [paths or request] — all, listed files, or described scope (**confirm** if described) → waves → merge (see `generate-srs.md`) |
25
25
  | 4 | **`/summary srs`** (optional) | Doc summaries under `.ai-spector/index/` (fallback browse; graph is primary) |
26
- | — | **`/index`** | After manual edits or **`/generate-srs`**: `npx ai-spector index` (structure + knowledge merge + **SRS body extract** + doc indexes) |
26
+
27
+ ### `/index` decision tree
28
+
29
+ Run `npx ai-spector index`, then follow the report:
30
+
31
+ 1. `docs/data-source/` has files but no extracted knowledge → **analyze**: read the data-source markdown, write `analysis/knowledge.json`, re-run `npx ai-spector index`.
32
+ 2. SRS docs exist → already indexed by the same run (SRS body extract + doc index).
33
+ 3. Basic-design docs exist → already indexed by the same run.
34
+ 4. **No SRS generated yet → STOP after the analyze step.** Tell the user the analysis is done and the next step is `/generate-srs`. Do not generate anything unasked.
27
35
  | 5 | **`/generate-basic-design`** [paths or request] — same targeting + waves as SRS (`generate-basic-design.md`) |
28
36
  | 6 | **`/generate-detail-design`** | same `graph query` pattern |
29
37
  | 7 | **`/generate-prototype`** [--theme name] | `npx ai-spector prototype setup --theme …` → agent writes `prototype/src/*.html` → `prototype manifest` → `prototype validate --strict` |
@@ -38,10 +46,10 @@ Skills auto-route for natural language; **slash commands stay the source of trut
38
46
  ```text
39
47
  npx ai-spector init ← only CLI step you run yourself
40
48
  docs/data-source/ ← add files
41
- /analyze
49
+ /index ← detects data source → analyzes → stops (no SRS yet)
42
50
  /validate-graph
43
51
  /generate-srs
44
- /index
52
+ /index ← now also indexes SRS (and basic design once generated)
45
53
  ```
46
54
 
47
55
  ## If something fails
@@ -18,7 +18,7 @@ When the `ai-spector` MCP server is enabled (`.cursor/mcp.json` or `.mcp.json` l
18
18
 
19
19
  | Operation | MCP tool | CLI fallback |
20
20
  |-----------|----------|--------------|
21
- | Prepare graph scaffold | `analyze({})` | `npx ai-spector analyze` |
21
+ | Prepare graph scaffold | `index({})` | `npx ai-spector index` |
22
22
  | Check knowledge.json entity counts | `knowledge_status({})` | *(no CLI equivalent)* |
23
23
  | Validate knowledge.json schema | `knowledge_validate({})` | *(no CLI equivalent)* |
24
24
  | Merge knowledge → graph | `graph_merge({ fromKnowledge: true })` | `npx ai-spector graph merge --from-knowledge` |
@@ -14,7 +14,7 @@ Run from project root: always `npx ai-spector …` (see [project-conventions.md]
14
14
  ## Commands (quick)
15
15
 
16
16
  ```bash
17
- npx ai-spector analyze
17
+ npx ai-spector index
18
18
  npx ai-spector graph merge --from-knowledge
19
19
  npx ai-spector graph validate
20
20
  npx ai-spector graph visualize [--open]
@@ -14,7 +14,7 @@ All steps have MCP equivalents. Use MCP when the `ai-spector` server is configur
14
14
  1. **`npx ai-spector init`** was run once (project scaffold exists).
15
15
  2. `docs/data-source/` has at least one real input file.
16
16
 
17
- **On success, suggest:** visualize graph (optional) → validate graph → generate SRS.
17
+ **On success:** if no SRS documents exist yet (`index` report shows `srs: —`), **stop here** — report that analysis is done and suggest `/generate-srs`. Otherwise suggest: visualize graph (optional) → validate graph.
18
18
 
19
19
  ## Required Behavior
20
20
 
@@ -22,12 +22,12 @@ All steps have MCP equivalents. Use MCP when the `ai-spector` server is configur
22
22
 
23
23
  **MCP (preferred):**
24
24
  ```
25
- analyze({})
25
+ index({})
26
26
  ```
27
27
 
28
28
  **CLI fallback:**
29
29
  ```bash
30
- npx ai-spector analyze
30
+ npx ai-spector index
31
31
  ```
32
32
 
33
33
  Creates section/document nodes from templates. Do not ask the user to run this separately.
@@ -54,18 +54,18 @@ Creates section/document nodes from templates. Do not ask the user to run this s
54
54
 
55
55
  ### B. Commit to graph
56
56
 
57
+ Re-run index — it merges `knowledge.json` into the graph and validates in one pass:
58
+
57
59
  **MCP (preferred when ai-spector server is configured):**
58
60
 
59
61
  ```
60
- graph_merge({ fromKnowledge: true })
61
- graph_validate({})
62
+ index({})
62
63
  ```
63
64
 
64
65
  **CLI fallback:**
65
66
 
66
67
  ```bash
67
- npx ai-spector graph merge --from-knowledge
68
- npx ai-spector graph validate
68
+ npx ai-spector index
69
69
  ```
70
70
 
71
71
  Optional for the user:
@@ -88,12 +88,11 @@ Update `state.json`: `analysis.lastRunAt`, `analysis.dataSource`, scope hash. Me
88
88
 
89
89
  | Step | MCP (preferred) | CLI fallback |
90
90
  |------|-----------------|--------------|
91
- | 0 prepare | `analyze({})` | `npx ai-spector analyze` |
91
+ | 0 prepare | `index({})` | `npx ai-spector index` |
92
92
  | A extraction | Agent writes `knowledge.json` | Agent writes `knowledge.json` |
93
93
  | A verify | `knowledge_status({})` → check `ready: true` | *(no CLI)* |
94
94
  | A validate | `knowledge_validate({})` → check `valid: true` | *(no CLI)* |
95
- | B merge | `graph_merge({ fromKnowledge: true })` | `npx ai-spector graph merge --from-knowledge` |
96
- | B validate | `graph_validate({})` | `npx ai-spector graph validate` |
95
+ | B index (merge + validate) | `index({})` | `npx ai-spector index` |
97
96
 
98
97
  If any step fails, **pause** and use [cli-failures.md](../../ai-spector/references/cli-failures.md). Do not skip to generate SRS without user choice.
99
98
 
@@ -30,7 +30,7 @@ npx ai-spector graph validate
30
30
  Follow [cli-failures.md](../../ai-spector/references/cli-failures.md). Typical fixes:
31
31
 
32
32
  - `DOMAIN-ANCHORED` → domain node missing `listedIn` / `describedIn` → re-run `/analyze` or fix one node and `graph merge` again.
33
- - `SECTION-TREE` → structure edge wrong → re-run `npx ai-spector analyze` (agent), not manual graph surgery at scale.
34
- - `REGISTRY-COMPLETE` → re-run `/analyze` step 0 (`npx ai-spector analyze`).
33
+ - `SECTION-TREE` → structure edge wrong → re-run `npx ai-spector index` (agent), not manual graph surgery at scale.
34
+ - `REGISTRY-COMPLETE` → re-run `/analyze` step 0 (`npx ai-spector index`).
35
35
 
36
36
  After fix, user re-runs **`/validate-graph`**.
@@ -18,7 +18,7 @@ Agent runs from project root. Default: `.ai-spector/views/graph-knowledge.html`
18
18
 
19
19
  Use [cli-failures.md](../../ai-spector/references/cli-failures.md). Common fixes:
20
20
 
21
- - Missing graph → run **`/analyze`** first (step 0 `npx ai-spector analyze`).
21
+ - Missing graph → run **`/analyze`** first (step 0 `npx ai-spector index`).
22
22
  - `command not found` → `npm install ai-spector`; use `npx ai-spector graph visualize --open`.
23
23
 
24
24
  Do not tell the user to inspect raw JSON instead of fixing the CLI — offer to fix cwd/install, then re-run **`/visualize-graph`**.