@rkarim08/sia 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +35 -0
- package/.claude-plugin/plugin.json +27 -0
- package/.mcp.json +13 -0
- package/CLAUDE.md +226 -0
- package/LICENSE +202 -0
- package/PLUGIN_README.md +253 -0
- package/README.md +1013 -0
- package/agents/sia-changelog-writer.md +89 -0
- package/agents/sia-code-reviewer.md +86 -0
- package/agents/sia-conflict-resolver.md +100 -0
- package/agents/sia-convention-enforcer.md +69 -0
- package/agents/sia-debug.md +106 -0
- package/agents/sia-decision-reviewer.md +101 -0
- package/agents/sia-dependency-tracker.md +80 -0
- package/agents/sia-explain.md +126 -0
- package/agents/sia-feature.md +116 -0
- package/agents/sia-knowledge-capture.md +117 -0
- package/agents/sia-lead-architecture-advisor.md +93 -0
- package/agents/sia-lead-team-health.md +107 -0
- package/agents/sia-migration.md +100 -0
- package/agents/sia-onboarding.md +115 -0
- package/agents/sia-orientation.md +99 -0
- package/agents/sia-pm-briefing.md +106 -0
- package/agents/sia-pm-risk-advisor.md +82 -0
- package/agents/sia-qa-analyst.md +116 -0
- package/agents/sia-qa-regression-map.md +94 -0
- package/agents/sia-refactor.md +115 -0
- package/agents/sia-regression.md +112 -0
- package/agents/sia-security-audit.md +125 -0
- package/agents/sia-test-advisor.md +91 -0
- package/hooks/hooks.json +98 -0
- package/migrations/bridge/001_initial.sql +34 -0
- package/migrations/episodic/001_initial.sql +35 -0
- package/migrations/meta/001_initial.sql +68 -0
- package/migrations/semantic/001_initial.sql +292 -0
- package/migrations/semantic/002_ontology.sql +89 -0
- package/migrations/semantic/003_freshness.sql +63 -0
- package/migrations/semantic/004_v5_unified_schema.sql +194 -0
- package/migrations/semantic/005_backfill_event_kinds.sql +8 -0
- package/migrations/semantic/006_tree_sitter.sql +6 -0
- package/migrations/semantic/007_branch_snapshots.sql +22 -0
- package/package.json +110 -0
- package/scripts/branch-switch.sh +13 -0
- package/scripts/build-wasm-grammars.sh +81 -0
- package/scripts/post-compact.sh +8 -0
- package/scripts/post-tool-use.sh +10 -0
- package/scripts/pre-compact.sh +8 -0
- package/scripts/session-end.sh +8 -0
- package/scripts/session-start.sh +8 -0
- package/scripts/start-mcp.ts +45 -0
- package/scripts/stop-hook.sh +8 -0
- package/scripts/user-prompt-submit.sh +8 -0
- package/scripts/viz-server.ts +152 -0
- package/skills/sia-brainstorm/SKILL.md +156 -0
- package/skills/sia-brainstorm/scripts/frame-template.html +214 -0
- package/skills/sia-brainstorm/scripts/helper.js +95 -0
- package/skills/sia-brainstorm/scripts/server.cjs +338 -0
- package/skills/sia-brainstorm/scripts/start-server.sh +153 -0
- package/skills/sia-brainstorm/scripts/stop-server.sh +55 -0
- package/skills/sia-brainstorm/spec-document-reviewer-prompt.md +49 -0
- package/skills/sia-brainstorm/visual-companion.md +286 -0
- package/skills/sia-capture/SKILL.md +64 -0
- package/skills/sia-compare/SKILL.md +33 -0
- package/skills/sia-conflicts/SKILL.md +38 -0
- package/skills/sia-debug-workflow/SKILL.md +120 -0
- package/skills/sia-debug-workflow/root-cause-tracing.md +70 -0
- package/skills/sia-debug-workflow/scripts/find-polluter.sh +64 -0
- package/skills/sia-debug-workflow/temporal-investigation.md +72 -0
- package/skills/sia-digest/SKILL.md +23 -0
- package/skills/sia-dispatch/SKILL.md +69 -0
- package/skills/sia-dispatch/agent-task-template.md +99 -0
- package/skills/sia-doctor/SKILL.md +39 -0
- package/skills/sia-execute/SKILL.md +70 -0
- package/skills/sia-execute-plan/SKILL.md +85 -0
- package/skills/sia-export-import/SKILL.md +49 -0
- package/skills/sia-export-knowledge/SKILL.md +46 -0
- package/skills/sia-finish/SKILL.md +100 -0
- package/skills/sia-finish/pr-summary-template.md +54 -0
- package/skills/sia-freshness/SKILL.md +38 -0
- package/skills/sia-history/SKILL.md +42 -0
- package/skills/sia-impact/SKILL.md +70 -0
- package/skills/sia-index/SKILL.md +54 -0
- package/skills/sia-install/SKILL.md +39 -0
- package/skills/sia-lead-compliance/SKILL.md +16 -0
- package/skills/sia-lead-drift-report/SKILL.md +16 -0
- package/skills/sia-lead-knowledge-map/SKILL.md +16 -0
- package/skills/sia-learn/SKILL.md +58 -0
- package/skills/sia-plan/SKILL.md +68 -0
- package/skills/sia-plan/plan-reviewer-prompt.md +63 -0
- package/skills/sia-playbooks/SKILL.md +29 -0
- package/skills/sia-playbooks/reference-feature.md +100 -0
- package/skills/sia-playbooks/reference-flagging.md +50 -0
- package/skills/sia-playbooks/reference-orientation.md +92 -0
- package/skills/sia-playbooks/reference-regression.md +115 -0
- package/skills/sia-playbooks/reference-review.md +64 -0
- package/skills/sia-playbooks/reference-tools.md +239 -0
- package/skills/sia-pm-decision-log/SKILL.md +28 -0
- package/skills/sia-pm-risk-dashboard/SKILL.md +24 -0
- package/skills/sia-pm-sprint-summary/SKILL.md +27 -0
- package/skills/sia-prune/SKILL.md +45 -0
- package/skills/sia-qa-coverage/SKILL.md +28 -0
- package/skills/sia-qa-flaky/SKILL.md +20 -0
- package/skills/sia-qa-report/SKILL.md +26 -0
- package/skills/sia-reindex/SKILL.md +30 -0
- package/skills/sia-review-respond/SKILL.md +88 -0
- package/skills/sia-review-respond/pushback-patterns.md +90 -0
- package/skills/sia-search/SKILL.md +47 -0
- package/skills/sia-setup/SKILL.md +82 -0
- package/skills/sia-setup/setup-checklist.md +97 -0
- package/skills/sia-stats/SKILL.md +36 -0
- package/skills/sia-status/SKILL.md +44 -0
- package/skills/sia-sync/SKILL.md +46 -0
- package/skills/sia-team/SKILL.md +64 -0
- package/skills/sia-test/SKILL.md +92 -0
- package/skills/sia-test/testing-anti-patterns.md +104 -0
- package/skills/sia-tour/SKILL.md +29 -0
- package/skills/sia-upgrade/SKILL.md +43 -0
- package/skills/sia-verify/SKILL.md +81 -0
- package/skills/sia-visualize/SKILL.md +28 -0
- package/skills/sia-visualize-live/SKILL.md +55 -0
- package/skills/sia-visualize-live/scripts/graph-template.html +389 -0
- package/skills/sia-visualize-live/scripts/start-visualizer.sh +161 -0
- package/skills/sia-visualize-live/scripts/stop-visualizer.sh +55 -0
- package/skills/sia-visualize-live/scripts/visualizer-server.cjs +264 -0
- package/skills/sia-workspace/SKILL.md +57 -0
- package/src/agent/claude-md-template-flagging.md +219 -0
- package/src/agent/claude-md-template.md +213 -0
- package/src/agent/modules/sia-feature.md +100 -0
- package/src/agent/modules/sia-flagging.md +50 -0
- package/src/agent/modules/sia-orientation.md +92 -0
- package/src/agent/modules/sia-regression.md +115 -0
- package/src/agent/modules/sia-review.md +64 -0
- package/src/agent/modules/sia-tools.md +239 -0
- package/src/ast/extractors/c-include.ts +189 -0
- package/src/ast/extractors/csharp-project.ts +260 -0
- package/src/ast/extractors/prisma-schema.ts +44 -0
- package/src/ast/extractors/project-manifest.ts +111 -0
- package/src/ast/extractors/sql-schema.ts +67 -0
- package/src/ast/extractors/tier-a.ts +423 -0
- package/src/ast/extractors/tier-b.ts +289 -0
- package/src/ast/extractors/tier-dispatch.ts +247 -0
- package/src/ast/index-worker.ts +108 -0
- package/src/ast/indexer.ts +484 -0
- package/src/ast/languages.ts +408 -0
- package/src/ast/pagerank-builder.ts +125 -0
- package/src/ast/path-utils.ts +137 -0
- package/src/ast/tree-sitter/backends/native.ts +57 -0
- package/src/ast/tree-sitter/backends/wasm.ts +39 -0
- package/src/ast/tree-sitter/call-walker.ts +44 -0
- package/src/ast/tree-sitter/edit-computer.ts +55 -0
- package/src/ast/tree-sitter/query-runner.ts +46 -0
- package/src/ast/tree-sitter/service.ts +174 -0
- package/src/ast/tree-sitter/tree-cache.ts +39 -0
- package/src/ast/tree-sitter/types.ts +79 -0
- package/src/ast/watcher.ts +322 -0
- package/src/capture/chunker.ts +169 -0
- package/src/capture/consolidate.ts +127 -0
- package/src/capture/edge-inferrer.ts +161 -0
- package/src/capture/embedder.ts +166 -0
- package/src/capture/embedding-cache.ts +73 -0
- package/src/capture/flag-processor.ts +64 -0
- package/src/capture/hook.ts +67 -0
- package/src/capture/pipeline.ts +450 -0
- package/src/capture/prompts/consolidate.ts +25 -0
- package/src/capture/prompts/edge-infer.ts +29 -0
- package/src/capture/prompts/extract-flagged.ts +36 -0
- package/src/capture/prompts/extract.ts +42 -0
- package/src/capture/tokenizer.ts +147 -0
- package/src/capture/track-a-ast.ts +93 -0
- package/src/capture/track-b-llm.ts +149 -0
- package/src/capture/types.ts +64 -0
- package/src/cli/commands/community.ts +137 -0
- package/src/cli/commands/compare.ts +123 -0
- package/src/cli/commands/conflicts.ts +41 -0
- package/src/cli/commands/digest.ts +197 -0
- package/src/cli/commands/disable-flagging.ts +34 -0
- package/src/cli/commands/doctor.ts +240 -0
- package/src/cli/commands/download-model.ts +161 -0
- package/src/cli/commands/enable-flagging.ts +34 -0
- package/src/cli/commands/export-knowledge.ts +208 -0
- package/src/cli/commands/export.ts +85 -0
- package/src/cli/commands/freshness.ts +164 -0
- package/src/cli/commands/graph.ts +51 -0
- package/src/cli/commands/history.ts +139 -0
- package/src/cli/commands/import.ts +335 -0
- package/src/cli/commands/install.ts +156 -0
- package/src/cli/commands/lead-report.ts +241 -0
- package/src/cli/commands/learn.ts +321 -0
- package/src/cli/commands/pm-report.ts +413 -0
- package/src/cli/commands/prune.ts +75 -0
- package/src/cli/commands/qa-report.ts +278 -0
- package/src/cli/commands/reindex.ts +104 -0
- package/src/cli/commands/rollback.ts +70 -0
- package/src/cli/commands/search.ts +103 -0
- package/src/cli/commands/server.ts +91 -0
- package/src/cli/commands/share.ts +33 -0
- package/src/cli/commands/stats.ts +79 -0
- package/src/cli/commands/status.ts +176 -0
- package/src/cli/commands/sync.ts +96 -0
- package/src/cli/commands/team.ts +118 -0
- package/src/cli/commands/tour.ts +157 -0
- package/src/cli/commands/visualize-live.ts +162 -0
- package/src/cli/commands/workspace.ts +117 -0
- package/src/cli/index.ts +424 -0
- package/src/cli/learn-progress.ts +87 -0
- package/src/community/detection-bridge.ts +344 -0
- package/src/community/leiden.ts +462 -0
- package/src/community/raptor.ts +210 -0
- package/src/community/scheduler.ts +74 -0
- package/src/community/summarize.ts +115 -0
- package/src/decay/archiver.ts +73 -0
- package/src/decay/bridge-orphan-cleanup.ts +212 -0
- package/src/decay/consolidation-sweep.ts +112 -0
- package/src/decay/decay.ts +116 -0
- package/src/decay/deep-validator.ts +62 -0
- package/src/decay/episodic-promoter.ts +132 -0
- package/src/decay/maintenance-scheduler.ts +326 -0
- package/src/decay/scheduler.ts +6 -0
- package/src/decay/session-sweeper.ts +79 -0
- package/src/decay/types.ts +17 -0
- package/src/freshness/confidence-decay.ts +122 -0
- package/src/freshness/cuckoo-filter.ts +176 -0
- package/src/freshness/deep-validation.ts +345 -0
- package/src/freshness/dirty-tracker.ts +237 -0
- package/src/freshness/file-watcher-layer.ts +119 -0
- package/src/freshness/firewall.ts +64 -0
- package/src/freshness/git-reconcile-layer.ts +161 -0
- package/src/freshness/inverted-index.ts +158 -0
- package/src/freshness/stale-read-layer.ts +222 -0
- package/src/graph/audit.ts +69 -0
- package/src/graph/bridge-db.ts +141 -0
- package/src/graph/communities.ts +195 -0
- package/src/graph/db-interface.ts +259 -0
- package/src/graph/edges.ts +163 -0
- package/src/graph/entities.ts +327 -0
- package/src/graph/episodic-db.ts +113 -0
- package/src/graph/flags.ts +31 -0
- package/src/graph/meta-db.ts +200 -0
- package/src/graph/semantic-db.ts +101 -0
- package/src/graph/session-resume.ts +56 -0
- package/src/graph/snapshots.ts +342 -0
- package/src/graph/staging.ts +151 -0
- package/src/graph/types.ts +128 -0
- package/src/hooks/adapters/claude-code.ts +21 -0
- package/src/hooks/adapters/cline.ts +43 -0
- package/src/hooks/adapters/cursor.ts +65 -0
- package/src/hooks/adapters/generic.ts +12 -0
- package/src/hooks/agent-detect.ts +34 -0
- package/src/hooks/claude-md-directives.ts +32 -0
- package/src/hooks/event-router.ts +182 -0
- package/src/hooks/extractors/pattern-detector.ts +111 -0
- package/src/hooks/handlers/post-compact.ts +30 -0
- package/src/hooks/handlers/post-tool-use.ts +403 -0
- package/src/hooks/handlers/pre-compact.ts +100 -0
- package/src/hooks/handlers/session-end.ts +47 -0
- package/src/hooks/handlers/session-start.ts +154 -0
- package/src/hooks/handlers/stop.ts +128 -0
- package/src/hooks/handlers/user-prompt-submit.ts +68 -0
- package/src/hooks/plugin-branch-switch.ts +68 -0
- package/src/hooks/plugin-common.ts +47 -0
- package/src/hooks/plugin-post-compact.ts +28 -0
- package/src/hooks/plugin-post-tool-use.ts +38 -0
- package/src/hooks/plugin-pre-compact.ts +37 -0
- package/src/hooks/plugin-session-end.ts +37 -0
- package/src/hooks/plugin-session-start.ts +75 -0
- package/src/hooks/plugin-stop.ts +61 -0
- package/src/hooks/plugin-user-prompt-submit.ts +47 -0
- package/src/hooks/types.ts +43 -0
- package/src/knowledge/discovery.ts +238 -0
- package/src/knowledge/external-refs.ts +98 -0
- package/src/knowledge/freshness.ts +221 -0
- package/src/knowledge/ingest.ts +330 -0
- package/src/knowledge/markdown-export.ts +229 -0
- package/src/knowledge/markdown-import.ts +359 -0
- package/src/knowledge/patterns.ts +74 -0
- package/src/knowledge/templates.ts +307 -0
- package/src/llm/ai-sdk-adapter.ts +46 -0
- package/src/llm/config.ts +88 -0
- package/src/llm/cost-tracker.ts +110 -0
- package/src/llm/prompts/extraction.ts +55 -0
- package/src/llm/prompts/summarization.ts +36 -0
- package/src/llm/prompts/validation.ts +37 -0
- package/src/llm/provider-registry.ts +68 -0
- package/src/llm/reliability.ts +179 -0
- package/src/llm/schemas.ts +52 -0
- package/src/mcp/freshness-annotator.ts +69 -0
- package/src/mcp/server.ts +949 -0
- package/src/mcp/tools/sia-ast-query.ts +225 -0
- package/src/mcp/tools/sia-at-time.ts +151 -0
- package/src/mcp/tools/sia-backlinks.ts +87 -0
- package/src/mcp/tools/sia-batch-execute.ts +169 -0
- package/src/mcp/tools/sia-by-file.ts +89 -0
- package/src/mcp/tools/sia-community.ts +113 -0
- package/src/mcp/tools/sia-doctor.ts +73 -0
- package/src/mcp/tools/sia-execute-file.ts +122 -0
- package/src/mcp/tools/sia-execute.ts +104 -0
- package/src/mcp/tools/sia-expand.ts +158 -0
- package/src/mcp/tools/sia-fetch-and-index.ts +241 -0
- package/src/mcp/tools/sia-flag.ts +65 -0
- package/src/mcp/tools/sia-index.ts +111 -0
- package/src/mcp/tools/sia-note.ts +134 -0
- package/src/mcp/tools/sia-search.ts +105 -0
- package/src/mcp/tools/sia-stats.ts +63 -0
- package/src/mcp/tools/sia-sync-status.ts +44 -0
- package/src/mcp/tools/sia-upgrade.ts +247 -0
- package/src/mcp/truncate.ts +231 -0
- package/src/native/bridge.ts +167 -0
- package/src/native/fallback-ast-diff.ts +144 -0
- package/src/native/fallback-graph.ts +325 -0
- package/src/ontology/constraints.ts +56 -0
- package/src/ontology/errors.ts +8 -0
- package/src/ontology/middleware.ts +266 -0
- package/src/retrieval/bm25-search.ts +151 -0
- package/src/retrieval/context-assembly.ts +76 -0
- package/src/retrieval/graph-traversal.ts +168 -0
- package/src/retrieval/pagerank.ts +40 -0
- package/src/retrieval/query-classifier.ts +106 -0
- package/src/retrieval/reranker.ts +156 -0
- package/src/retrieval/search.ts +236 -0
- package/src/retrieval/throttle.ts +102 -0
- package/src/retrieval/vector-search.ts +203 -0
- package/src/retrieval/workspace-search.ts +130 -0
- package/src/sandbox/context-mode.ts +285 -0
- package/src/sandbox/credential-pass.ts +55 -0
- package/src/sandbox/executor.ts +235 -0
- package/src/security/pattern-detector.ts +127 -0
- package/src/security/rule-of-two.ts +50 -0
- package/src/security/sanitize.ts +46 -0
- package/src/security/semantic-consistency.ts +93 -0
- package/src/security/staging-promoter.ts +154 -0
- package/src/shared/config.ts +302 -0
- package/src/shared/diagnostics.ts +210 -0
- package/src/shared/errors.ts +48 -0
- package/src/shared/git-utils.ts +143 -0
- package/src/shared/llm-client.ts +120 -0
- package/src/shared/logger.ts +99 -0
- package/src/shared/types.ts +79 -0
- package/src/sync/client.ts +43 -0
- package/src/sync/conflict.ts +106 -0
- package/src/sync/dedup.ts +183 -0
- package/src/sync/hlc.ts +117 -0
- package/src/sync/keychain.ts +144 -0
- package/src/sync/pull.ts +232 -0
- package/src/sync/push.ts +131 -0
- package/src/types/chokidar.d.ts +23 -0
- package/src/visualization/graph-renderer.ts +312 -0
- package/src/visualization/subgraph-extract.ts +208 -0
- package/src/visualization/views/community-clusters.ts +246 -0
- package/src/visualization/views/dependency-map.ts +189 -0
- package/src/visualization/views/graph-explorer.ts +364 -0
- package/src/visualization/views/timeline.ts +247 -0
- package/src/workspace/api-contracts.ts +226 -0
- package/src/workspace/cross-repo.ts +61 -0
- package/src/workspace/detector.ts +190 -0
- package/src/workspace/manifest.ts +141 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-search
|
|
3
|
+
description: Searches SIA's knowledge graph for project knowledge — decisions, conventions, bugs, patterns, and architecture. Use when looking up past decisions, finding conventions, or querying project history.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SIA Search
|
|
7
|
+
|
|
8
|
+
Search the project's persistent knowledge graph for relevant information.
|
|
9
|
+
|
|
10
|
+
## When To Use
|
|
11
|
+
|
|
12
|
+
Use this skill when you need to:
|
|
13
|
+
- Understand project conventions or past decisions
|
|
14
|
+
- Find known bugs or solutions
|
|
15
|
+
- Look up architecture patterns
|
|
16
|
+
- Get context about a specific file or module
|
|
17
|
+
- Recall what was discussed in previous sessions
|
|
18
|
+
|
|
19
|
+
## How To Search
|
|
20
|
+
|
|
21
|
+
Use the `sia_search` MCP tool directly. It supports these parameters:
|
|
22
|
+
|
|
23
|
+
- **query** (required): Natural language search query
|
|
24
|
+
- **task_type** (optional): One of `orientation`, `feature`, `bug-fix`, `regression`, `review` — helps tune result ranking
|
|
25
|
+
- **node_types** (optional): Filter to specific types like `["Decision", "Convention", "Bug"]`
|
|
26
|
+
- **package_path** (optional): Scope search to a specific package/module
|
|
27
|
+
- **workspace** (optional): Search across all repos in the workspace, not just the current one
|
|
28
|
+
- **paranoid** (optional): Enable extra validation on results
|
|
29
|
+
- **include_provenance** (optional): Include source provenance metadata in results
|
|
30
|
+
- **limit** (optional): Max results (default varies by query type)
|
|
31
|
+
|
|
32
|
+
### Examples
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
sia_search({ query: "authentication flow", task_type: "feature" })
|
|
36
|
+
sia_search({ query: "known bugs in payment module", node_types: ["Bug", "Solution"] })
|
|
37
|
+
sia_search({ query: "coding conventions", node_types: ["Convention"], limit: 20 })
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Related Tools
|
|
41
|
+
|
|
42
|
+
- `sia_by_file` — Look up knowledge for a specific file path
|
|
43
|
+
- `sia_expand` — Explore the neighborhood of a specific entity
|
|
44
|
+
- `sia_community` — Get high-level summaries by community/module
|
|
45
|
+
- `sia_at_time` — Query the graph at a historical point in time
|
|
46
|
+
- `sia_backlinks` — Find all entities that reference a given entity
|
|
47
|
+
- `sia_note` — Record a new Decision, Convention, Bug, Solution, or Concept
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-setup
|
|
3
|
+
description: Guides first-time SIA setup — detects the project, configures the knowledge graph, indexes code and docs, and runs a tour. Use when setting up SIA for the first time in a new project.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SIA First-Time Setup
|
|
7
|
+
|
|
8
|
+
Welcome to SIA! This wizard gets you set up in one step.
|
|
9
|
+
|
|
10
|
+
**For detailed phase guide with error recovery:** See [setup-checklist.md](setup-checklist.md)
|
|
11
|
+
|
|
12
|
+
## What This Does
|
|
13
|
+
|
|
14
|
+
1. Detects your project type, languages, and structure
|
|
15
|
+
2. Creates SIA databases and registers the repository
|
|
16
|
+
3. Indexes all source code with tree-sitter (25+ languages)
|
|
17
|
+
4. Ingests project documentation (README, ARCHITECTURE, ADRs, etc.)
|
|
18
|
+
5. Detects community structure (module clusters)
|
|
19
|
+
6. Gives you a tour of what was discovered
|
|
20
|
+
|
|
21
|
+
## Setup Process
|
|
22
|
+
|
|
23
|
+
### Step 1: Detect Project
|
|
24
|
+
|
|
25
|
+
First, let's understand your project:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Detect project type
|
|
29
|
+
ls package.json Cargo.toml go.mod pyproject.toml requirements.txt Gemfile 2>/dev/null
|
|
30
|
+
# Count source files
|
|
31
|
+
find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" -o -name "*.go" -o -name "*.rs" -o -name "*.java" -o -name "*.rb" \) -not -path "*/node_modules/*" -not -path "*/.git/*" | wc -l
|
|
32
|
+
# Check for existing docs
|
|
33
|
+
ls README.md ARCHITECTURE.md CLAUDE.md AGENTS.md docs/ 2>/dev/null
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Present findings to the user:
|
|
37
|
+
> "I detected a TypeScript project with 342 source files, a README.md, and docs/ directory. Ready to set up SIA?"
|
|
38
|
+
|
|
39
|
+
### Step 2: Configure (optional questions)
|
|
40
|
+
|
|
41
|
+
Ask only if relevant:
|
|
42
|
+
- **Team sync:** "Will multiple developers use SIA on this project? If yes, I'll set up team sync later via `/sia-team`."
|
|
43
|
+
- **Large repo warning:** If >5,000 files: "This is a large repo. The first index may take a few minutes. Want to proceed?"
|
|
44
|
+
|
|
45
|
+
### Step 3: Run Learn
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts learn --verbose
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This handles install + index + doc ingestion + community detection automatically.
|
|
52
|
+
|
|
53
|
+
### Step 4: Tour
|
|
54
|
+
|
|
55
|
+
After learning completes, run the tour:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts tour
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or invoke `/sia-tour` for an interactive walkthrough.
|
|
62
|
+
|
|
63
|
+
### Step 5: Summary
|
|
64
|
+
|
|
65
|
+
Present what SIA learned:
|
|
66
|
+
> **SIA is ready!**
|
|
67
|
+
> - 342 code entities indexed across 142 files
|
|
68
|
+
> - 45 documentation chunks from 8 docs
|
|
69
|
+
> - 5 community clusters detected
|
|
70
|
+
> - 3 external references (Notion, Jira, GitHub)
|
|
71
|
+
>
|
|
72
|
+
> Try these next:
|
|
73
|
+
> - Ask me any question — SIA tools activate automatically
|
|
74
|
+
> - `/sia-search` — search the knowledge graph
|
|
75
|
+
> - `/sia-status` — check graph health
|
|
76
|
+
> - `/sia-team` — set up team sync
|
|
77
|
+
|
|
78
|
+
## When To Use
|
|
79
|
+
|
|
80
|
+
- First time using SIA on a project
|
|
81
|
+
- After cloning a project that already has a SIA graph
|
|
82
|
+
- When you want a fresh start (`/sia-learn --force` then `/sia-setup`)
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# SIA Setup — Detailed Phase Guide
|
|
2
|
+
|
|
3
|
+
Progressive disclosure for the setup wizard. SKILL.md has the overview; this file has the details and error recovery for each phase.
|
|
4
|
+
|
|
5
|
+
## Phase 1: Project Detection
|
|
6
|
+
|
|
7
|
+
**What happens:** Detect project type, package manager, test runner, framework.
|
|
8
|
+
|
|
9
|
+
**Checks:**
|
|
10
|
+
- `package.json` → Node.js project (bun/npm/yarn/pnpm)
|
|
11
|
+
- `Cargo.toml` → Rust project
|
|
12
|
+
- `go.mod` → Go project
|
|
13
|
+
- `pyproject.toml` / `setup.py` → Python project
|
|
14
|
+
- `.git` → Git repository (required)
|
|
15
|
+
|
|
16
|
+
**Error recovery:**
|
|
17
|
+
| Error | Fix |
|
|
18
|
+
|---|---|
|
|
19
|
+
| No `.git` directory | Run `git init` first — SIA needs git for temporal tracking |
|
|
20
|
+
| No package manifest | SIA can still work — tree-sitter indexes raw source files |
|
|
21
|
+
| Multiple manifests | Ask user which is primary; index all |
|
|
22
|
+
|
|
23
|
+
## Phase 2: Database Configuration
|
|
24
|
+
|
|
25
|
+
**What happens:** Create SQLite databases for entities, edges, embeddings.
|
|
26
|
+
|
|
27
|
+
**Checks:**
|
|
28
|
+
- Write permission to `.sia/` directory
|
|
29
|
+
- SQLite available (bundled with bun/node)
|
|
30
|
+
- Sufficient disk space (estimate: ~1MB per 1000 entities)
|
|
31
|
+
|
|
32
|
+
**Error recovery:**
|
|
33
|
+
| Error | Fix |
|
|
34
|
+
|---|---|
|
|
35
|
+
| Permission denied | Check `.sia/` directory ownership; suggest `chmod` |
|
|
36
|
+
| Disk full | Warn user; suggest pruning old data or different location |
|
|
37
|
+
| Existing databases | Ask: fresh install or upgrade? Don't overwrite without consent |
|
|
38
|
+
|
|
39
|
+
## Phase 3: Code Indexing
|
|
40
|
+
|
|
41
|
+
**What happens:** Run tree-sitter AST parser on all source files.
|
|
42
|
+
|
|
43
|
+
**Checks:**
|
|
44
|
+
- Tree-sitter grammars available for detected languages
|
|
45
|
+
- File count and estimated indexing time
|
|
46
|
+
- Ignore patterns (node_modules, dist, build, .git)
|
|
47
|
+
|
|
48
|
+
**Error recovery:**
|
|
49
|
+
| Error | Fix |
|
|
50
|
+
|---|---|
|
|
51
|
+
| No grammar for language | Warn and skip — SIA works without AST, just less richly |
|
|
52
|
+
| Timeout on large repos | Suggest indexing a subdirectory first; `--include` flag |
|
|
53
|
+
| Parse errors on specific files | Log and continue — partial index is better than none |
|
|
54
|
+
|
|
55
|
+
## Phase 4: Documentation Ingestion
|
|
56
|
+
|
|
57
|
+
**What happens:** Ingest markdown docs, README, CLAUDE.md as Tier 4 entities.
|
|
58
|
+
|
|
59
|
+
**Checks:**
|
|
60
|
+
- Find all `.md` files in repo root and docs/
|
|
61
|
+
- Skip node_modules, vendor, generated docs
|
|
62
|
+
- Chunk large documents (>2000 tokens per chunk)
|
|
63
|
+
|
|
64
|
+
**Error recovery:**
|
|
65
|
+
| Error | Fix |
|
|
66
|
+
|---|---|
|
|
67
|
+
| No markdown files | Skip — not required |
|
|
68
|
+
| Very large docs (>50 files) | Index incrementally; show progress |
|
|
69
|
+
|
|
70
|
+
## Phase 5: Community Detection
|
|
71
|
+
|
|
72
|
+
**What happens:** Run Louvain community detection on the entity graph.
|
|
73
|
+
|
|
74
|
+
**Checks:**
|
|
75
|
+
- Minimum 10 entities required for meaningful communities
|
|
76
|
+
- Graph must have edges (code entities need imports/calls relationships)
|
|
77
|
+
|
|
78
|
+
**Error recovery:**
|
|
79
|
+
| Error | Fix |
|
|
80
|
+
|---|---|
|
|
81
|
+
| Too few entities | Skip community detection; re-run after more sessions |
|
|
82
|
+
| No edges | AST indexing may have failed; re-run `sia-reindex` |
|
|
83
|
+
| Single giant community | Normal for small projects; communities emerge as graph grows |
|
|
84
|
+
|
|
85
|
+
## Phase 6: Verification
|
|
86
|
+
|
|
87
|
+
**What happens:** Verify the setup is complete and show results.
|
|
88
|
+
|
|
89
|
+
**Success criteria:**
|
|
90
|
+
- [ ] Databases exist and are readable
|
|
91
|
+
- [ ] Entity count > 0
|
|
92
|
+
- [ ] At least one community detected (or explained why not)
|
|
93
|
+
- [ ] `sia_search` returns results for a basic query
|
|
94
|
+
|
|
95
|
+
**Present to user:**
|
|
96
|
+
> "SIA is ready. Your project has {N} entities across {M} communities.
|
|
97
|
+
> Try `sia search <topic>` to query the graph, or run `/sia-tour` for a guided walkthrough."
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-stats
|
|
3
|
+
description: Shows SIA knowledge graph statistics — entity counts, edges, communities, and database sizes. Use when checking graph health, monitoring growth, or diagnosing capacity issues.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SIA Stats
|
|
7
|
+
|
|
8
|
+
Display statistics about the project's knowledge graph.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
Run the stats command:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/commands/stats.ts
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or use the `sia_stats` MCP tool directly:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
sia_stats({})
|
|
22
|
+
sia_stats({ include_session: true })
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Parameters:
|
|
26
|
+
- **include_session** (optional): Include stats for the current session (entities created, flags raised)
|
|
27
|
+
|
|
28
|
+
## Output
|
|
29
|
+
|
|
30
|
+
This shows:
|
|
31
|
+
- Total entities by type (CodeSymbol, Decision, Convention, Bug, etc.)
|
|
32
|
+
- Total edges by type
|
|
33
|
+
- Community count and hierarchy depth
|
|
34
|
+
- Database file sizes
|
|
35
|
+
- Last index timestamp
|
|
36
|
+
- Session count
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-status
|
|
3
|
+
description: Shows SIA knowledge graph health — entity counts by type and tier, conflicts, and capture rate. Use for quick health checks, monitoring, or when the user asks about SIA status.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SIA Status
|
|
7
|
+
|
|
8
|
+
Display a health dashboard for the project's knowledge graph.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
Run the status command:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/commands/status.ts
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or via the CLI:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
sia status
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Output
|
|
25
|
+
|
|
26
|
+
The dashboard shows:
|
|
27
|
+
|
|
28
|
+
- **Total entities** — active (non-archived, non-invalidated) entity count
|
|
29
|
+
- **Total edges** — active relationship count
|
|
30
|
+
- **Communities** — detected community count
|
|
31
|
+
- **Conflicts** — number of unresolved conflict groups
|
|
32
|
+
- **Archived** — entities removed from active graph
|
|
33
|
+
- **Recent (24h)** — entities created in the last 24 hours (capture rate indicator)
|
|
34
|
+
- **Graph age** — days between oldest and newest entity
|
|
35
|
+
|
|
36
|
+
### By Type
|
|
37
|
+
Breakdown of entities by type (CodeEntity, Decision, Convention, Bug, Solution, etc.), sorted by count descending.
|
|
38
|
+
|
|
39
|
+
### By Trust Tier
|
|
40
|
+
Breakdown by trust tier:
|
|
41
|
+
- **Tier 1 (User-Direct)** — developer-stated facts
|
|
42
|
+
- **Tier 2 (Code-Analysis)** — deterministic AST/regex extraction
|
|
43
|
+
- **Tier 3 (LLM-Inferred)** — AI-generated hypotheses
|
|
44
|
+
- **Tier 4 (External)** — external references
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-sync
|
|
3
|
+
description: Pushes or pulls SIA knowledge to/from the team sync server. Use when sharing knowledge with teammates, syncing after a long offline period, or receiving others' captured knowledge.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SIA Manual Sync
|
|
7
|
+
|
|
8
|
+
Manually trigger a push or pull of knowledge to/from the team sync server.
|
|
9
|
+
|
|
10
|
+
Sync normally happens automatically (pull on session start, push on session end). Use this skill when you want to sync mid-session — for example, when you know a teammate just finished capturing important decisions.
|
|
11
|
+
|
|
12
|
+
## Push Local Knowledge
|
|
13
|
+
|
|
14
|
+
Push your locally captured knowledge to the team:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts sync push
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Pull Team Knowledge
|
|
21
|
+
|
|
22
|
+
Pull knowledge from teammates:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts sync pull
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Push and Pull
|
|
29
|
+
|
|
30
|
+
Do both (push first, then pull):
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts sync
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Output
|
|
37
|
+
|
|
38
|
+
The command reports what was synced:
|
|
39
|
+
```
|
|
40
|
+
Push: 5 entities, 12 edges, 0 bridge edges
|
|
41
|
+
Pull: 3 entities, 8 edges, 2 VSS refreshed
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Prerequisites
|
|
45
|
+
|
|
46
|
+
Team sync must be configured first. Run `/sia-team` to set up.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-team
|
|
3
|
+
description: Manages SIA team sync — joining servers, checking status, or leaving teams. Use when setting up team knowledge sharing, checking sync health, or managing team membership.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SIA Team Sync Management
|
|
7
|
+
|
|
8
|
+
Manage team-based knowledge graph synchronization. SIA syncs knowledge between team members via a self-hosted sqld (libSQL) server managed by your DevOps team.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
Your DevOps team must have deployed a sqld sync server. You need:
|
|
13
|
+
1. The server URL (e.g., `http://sync.internal:8080` or `https://sia-sync.yourcompany.com`)
|
|
14
|
+
2. An auth token (JWT, provided by DevOps)
|
|
15
|
+
|
|
16
|
+
## Join a Team
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts team join <server-url> <auth-token>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This will:
|
|
23
|
+
1. Store the auth token securely in the OS keychain
|
|
24
|
+
2. Configure sync with the provided server URL
|
|
25
|
+
3. Generate a unique developer ID for this machine
|
|
26
|
+
|
|
27
|
+
After joining, run `/sia-sync` to pull existing team knowledge, then sync is **automatic**:
|
|
28
|
+
- **Session start:** Pulls latest team knowledge
|
|
29
|
+
- **Session end:** Pushes your captured knowledge
|
|
30
|
+
|
|
31
|
+
## Check Status
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts team status
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or use the `sia_sync_status` MCP tool for programmatic access.
|
|
38
|
+
|
|
39
|
+
## Leave a Team
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts team leave
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Disables sync and removes the auth token. Local knowledge is preserved.
|
|
46
|
+
|
|
47
|
+
## How Sync Works
|
|
48
|
+
|
|
49
|
+
| Event | What Happens |
|
|
50
|
+
|---|---|
|
|
51
|
+
| Session start | Auto-pulls latest team knowledge via libSQL replication |
|
|
52
|
+
| Session end | Auto-pushes locally captured knowledge |
|
|
53
|
+
| `/sia-sync` | Manual push/pull on demand |
|
|
54
|
+
|
|
55
|
+
- **Ordering:** Hybrid Logical Clock (HLC) ensures causal consistency
|
|
56
|
+
- **Dedup:** 3-layer deduplication (name Jaccard, embedding cosine, optional LLM)
|
|
57
|
+
- **Conflicts:** Detected via embedding similarity, flagged for resolution
|
|
58
|
+
- **Privacy:** Only non-private entities are synced
|
|
59
|
+
|
|
60
|
+
## Troubleshooting
|
|
61
|
+
|
|
62
|
+
- **"Token not found":** Re-run join with your auth token
|
|
63
|
+
- **"Server unreachable":** Check network connectivity to the sync server URL
|
|
64
|
+
- **"Sync not configured":** Run join first
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-test
|
|
3
|
+
description: Guides test-driven development using SIA's knowledge of test conventions, known edge cases, and past failures. Use when implementing features or fixes with TDD, writing tests, or establishing test patterns.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Invariants
|
|
7
|
+
|
|
8
|
+
> These rules have NO exceptions. Violating any one means starting over.
|
|
9
|
+
>
|
|
10
|
+
> 1. YOU MUST query SIA before writing the first test. A test written without
|
|
11
|
+
> querying SIA may miss known edge cases and WILL be deleted and rewritten.
|
|
12
|
+
> 2. Every Bug entity returned by SIA for the area MUST have a corresponding
|
|
13
|
+
> regression test. No exceptions.
|
|
14
|
+
> 3. Tests MUST follow the conventions discovered in the graph. "I prefer a
|
|
15
|
+
> different style" is not a valid reason to deviate.
|
|
16
|
+
|
|
17
|
+
## Red Flags — If You Think Any of These, STOP
|
|
18
|
+
|
|
19
|
+
| Thought | Why It's Wrong |
|
|
20
|
+
|---------|---------------|
|
|
21
|
+
| "This is too simple for a SIA query" | Simple-looking areas are where regressions hide. The query takes 2 seconds; missing a known bug costs hours. |
|
|
22
|
+
| "I already know the test conventions" | The graph may contain conventions from sessions you weren't part of. Check. |
|
|
23
|
+
| "I'll query SIA after writing the tests" | By then you've already locked in assumptions. Query FIRST. |
|
|
24
|
+
| "There probably aren't any known bugs here" | You don't know what you don't know. That's why the graph exists. |
|
|
25
|
+
| "The test file already has patterns I can follow" | File patterns may be outdated. SIA knows the current conventions. |
|
|
26
|
+
|
|
27
|
+
# SIA-Enhanced Test-Driven Development
|
|
28
|
+
|
|
29
|
+
TDD informed by SIA's knowledge graph — surfaces this project's test conventions, known edge cases from past bugs, and actual interface contracts before writing the first test.
|
|
30
|
+
|
|
31
|
+
## Checklist
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
- [ ] Before RED: YOU MUST query SIA for test conventions, known bugs, and file entities. Without this, you will miss edge cases. No exceptions.
|
|
35
|
+
- [ ] RED: Write failing test following discovered conventions + known edge cases. Every Bug entity MUST have a regression test.
|
|
36
|
+
- [ ] GREEN: Minimal code to pass (YAGNI — do NOT over-implement)
|
|
37
|
+
- [ ] REFACTOR: YOU MUST query sia_expand before refactoring to verify no consumers break
|
|
38
|
+
- [ ] Capture: Note new edge cases or test conventions to graph. A test session that discovers patterns but doesn't capture them is incomplete.
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Red-Green-Refactor
|
|
42
|
+
|
|
43
|
+
### Before RED — SIA Context Query (NEW)
|
|
44
|
+
|
|
45
|
+
Before writing the first test:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
sia_search({ query: "test conventions patterns <area>", node_types: ["Convention"], limit: 10 })
|
|
49
|
+
sia_search({ query: "bugs failures edge cases <area>", node_types: ["Bug"], limit: 10 })
|
|
50
|
+
sia_by_file({ file_path: "<source_file_being_tested>" })
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
From the results:
|
|
54
|
+
- **Test conventions** → follow the same patterns (setup/teardown style, assertion library, naming)
|
|
55
|
+
- **Known bugs** → write tests that cover these edge cases
|
|
56
|
+
- **File entities** → understand the actual API surface to test against
|
|
57
|
+
|
|
58
|
+
**For common anti-patterns to avoid:** See [testing-anti-patterns.md](testing-anti-patterns.md)
|
|
59
|
+
|
|
60
|
+
### RED — Write Failing Test (enhanced)
|
|
61
|
+
|
|
62
|
+
Write the test following discovered conventions. Include edge cases from known Bug history.
|
|
63
|
+
|
|
64
|
+
### GREEN — Write Minimal Code (same as standard)
|
|
65
|
+
|
|
66
|
+
YAGNI — write the simplest code to pass.
|
|
67
|
+
|
|
68
|
+
### REFACTOR — Clean Up (enhanced)
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
sia_expand({ entity_id: "<entity_under_test>", depth: 1, edge_types: ["calls", "imports"] })
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Check what depends on the code being refactored. Ensure refactoring doesn't break consumers.
|
|
75
|
+
|
|
76
|
+
### After Cycle — Capture (NEW)
|
|
77
|
+
|
|
78
|
+
If a test revealed a new edge case or bug:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
sia_note({ kind: "Bug", name: "<edge case found>", content: "<description>" })
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
If a new test convention was established:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
sia_note({ kind: "Convention", name: "<test pattern>", content: "<how we test this type of thing>" })
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Key Principle
|
|
91
|
+
|
|
92
|
+
**Tests should match the codebase's style, not a generic template.** SIA knows how THIS project writes tests — follow that pattern.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Testing Anti-Patterns Detectable via SIA
|
|
2
|
+
|
|
3
|
+
Anti-patterns that SIA's knowledge graph can help you detect and prevent.
|
|
4
|
+
|
|
5
|
+
## Iron Laws
|
|
6
|
+
|
|
7
|
+
1. **Never test mock behavior** — test real interfaces
|
|
8
|
+
2. **Never test implementation** — test behavior
|
|
9
|
+
3. **Never ignore known edge cases** — SIA remembers them for you
|
|
10
|
+
|
|
11
|
+
## Anti-Pattern 1: Ignoring Known Bugs
|
|
12
|
+
|
|
13
|
+
**Detection:** `sia_search` returns Bug entities for the area, but no tests cover them.
|
|
14
|
+
|
|
15
|
+
**Gate function:** Before writing tests, query:
|
|
16
|
+
```
|
|
17
|
+
sia_search({ query: "bugs failures <area>", node_types: ["Bug"], limit: 10 })
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If results exist, your test suite MUST include regression tests for each.
|
|
21
|
+
|
|
22
|
+
**Violation:**
|
|
23
|
+
```typescript
|
|
24
|
+
// Bug entity exists: "Race condition in concurrent user creation"
|
|
25
|
+
// Test suite has no concurrency test
|
|
26
|
+
test("creates user", () => {
|
|
27
|
+
const user = createUser({ name: "Alice" });
|
|
28
|
+
expect(user.id).toBeDefined();
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Fix:**
|
|
33
|
+
```typescript
|
|
34
|
+
test("creates user", () => { /* ... */ });
|
|
35
|
+
|
|
36
|
+
// Regression test for known Bug entity
|
|
37
|
+
test("handles concurrent user creation without race condition", async () => {
|
|
38
|
+
const [a, b] = await Promise.all([
|
|
39
|
+
createUser({ name: "Alice" }),
|
|
40
|
+
createUser({ name: "Bob" }),
|
|
41
|
+
]);
|
|
42
|
+
expect(a.id).not.toBe(b.id);
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Anti-Pattern 2: Testing Against Stale Interfaces
|
|
47
|
+
|
|
48
|
+
**Detection:** `sia_by_file` shows the source file's entities have changed, but tests reference the old API.
|
|
49
|
+
|
|
50
|
+
**Gate function:** Before writing tests:
|
|
51
|
+
```
|
|
52
|
+
sia_by_file({ file_path: "<source_file>" })
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Compare the entity signatures against what your test expects. If the graph shows a newer interface, update your test.
|
|
56
|
+
|
|
57
|
+
## Anti-Pattern 3: Violating Test Conventions
|
|
58
|
+
|
|
59
|
+
**Detection:** `sia_search` returns Convention entities for testing patterns, but new tests don't follow them.
|
|
60
|
+
|
|
61
|
+
**Gate function:**
|
|
62
|
+
```
|
|
63
|
+
sia_search({ query: "test conventions <area>", node_types: ["Convention"], limit: 5 })
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
If conventions exist (e.g., "use factory functions, not raw constructors"), follow them. Don't invent a new pattern.
|
|
67
|
+
|
|
68
|
+
## Anti-Pattern 4: Testing Without Dependency Awareness
|
|
69
|
+
|
|
70
|
+
**Detection:** `sia_expand` shows consumers of the code under test, but tests don't cover the integration points.
|
|
71
|
+
|
|
72
|
+
**Gate function:** After refactoring:
|
|
73
|
+
```
|
|
74
|
+
sia_expand({ entity_id: "<refactored_entity>", depth: 1, edge_types: ["calls", "imports"] })
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
If N consumers depend on this code, verify at least the primary integration path is tested.
|
|
78
|
+
|
|
79
|
+
## Anti-Pattern 5: Duplicating Solved Problems
|
|
80
|
+
|
|
81
|
+
**Detection:** `sia_search` returns Solution entities that already address the test scenario.
|
|
82
|
+
|
|
83
|
+
**Gate function:** Before writing a complex test helper:
|
|
84
|
+
```
|
|
85
|
+
sia_search({ query: "test helper <pattern>", node_types: ["Solution", "Convention"], limit: 5 })
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
If a helper or pattern already exists, use it instead of creating a duplicate.
|
|
89
|
+
|
|
90
|
+
## Quick Reference
|
|
91
|
+
|
|
92
|
+
| Anti-Pattern | SIA Query | What to Check |
|
|
93
|
+
|---|---|---|
|
|
94
|
+
| Ignoring known bugs | `sia_search` for Bug entities | Each bug has a regression test |
|
|
95
|
+
| Stale interfaces | `sia_by_file` on source | Test matches current entity signatures |
|
|
96
|
+
| Convention violation | `sia_search` for Convention | Tests follow established patterns |
|
|
97
|
+
| Missing integration tests | `sia_expand` consumers | Primary integration paths covered |
|
|
98
|
+
| Duplicate helpers | `sia_search` for Solution | Existing patterns reused |
|
|
99
|
+
|
|
100
|
+
## Red Flags
|
|
101
|
+
|
|
102
|
+
- **Zero Bug entities in a heavily-modified area** → Either the area is perfect (unlikely) or bugs aren't being captured. Run `sia-capture` first.
|
|
103
|
+
- **Convention says "use X" but test uses Y** → Follow the convention. If the convention is wrong, update it — don't silently ignore it.
|
|
104
|
+
- **sia_expand shows 10+ consumers but only 1 test** → High-risk area with low coverage. Flag to developer.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-tour
|
|
3
|
+
description: Provides an interactive guided tour of the knowledge graph — architecture, decisions, conventions, and known issues. Use for onboarding, exploring what SIA knows, or getting oriented in a new project.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SIA Graph Tour
|
|
7
|
+
|
|
8
|
+
Take a guided tour of what SIA knows about your project.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts tour
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## What It Shows
|
|
17
|
+
|
|
18
|
+
1. **Architecture Overview** — major module clusters from community detection
|
|
19
|
+
2. **Key Decisions** — architectural choices and their rationale
|
|
20
|
+
3. **Coding Conventions** — patterns to follow
|
|
21
|
+
4. **Known Issues** — active bugs to be aware of
|
|
22
|
+
5. **Ingested Documentation** — docs in the knowledge graph
|
|
23
|
+
|
|
24
|
+
## When To Use
|
|
25
|
+
|
|
26
|
+
- After `/sia-setup` or `/sia-learn` — see what was discovered
|
|
27
|
+
- When onboarding to a project — get the full picture
|
|
28
|
+
- After a long break — refresh your memory of the project
|
|
29
|
+
- When a new team member joins — share what SIA knows
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-upgrade
|
|
3
|
+
description: Self-updates SIA to the latest version via npm, git, or binary strategies. Use when a new SIA version is available or when the user asks to upgrade.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SIA Upgrade
|
|
7
|
+
|
|
8
|
+
Update SIA to the latest version.
|
|
9
|
+
|
|
10
|
+
## Quick Upgrade
|
|
11
|
+
|
|
12
|
+
Use the `sia_upgrade` MCP tool:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
sia_upgrade({})
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or with options:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
sia_upgrade({
|
|
22
|
+
target_version: "0.2.0",
|
|
23
|
+
dry_run: true
|
|
24
|
+
})
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Parameters:
|
|
28
|
+
- **target_version** (optional): Specific version to upgrade to (default: latest)
|
|
29
|
+
- **dry_run** (optional): Preview what would change without applying
|
|
30
|
+
|
|
31
|
+
## Upgrade Strategies
|
|
32
|
+
|
|
33
|
+
SIA automatically selects the best upgrade strategy:
|
|
34
|
+
|
|
35
|
+
1. **npm**: If installed via npm/bun package manager
|
|
36
|
+
2. **git**: If running from a cloned repository (pulls latest)
|
|
37
|
+
3. **binary**: If a custom release URL is configured
|
|
38
|
+
|
|
39
|
+
## After Upgrading
|
|
40
|
+
|
|
41
|
+
1. Run `sia-doctor` to verify the new version is working
|
|
42
|
+
2. Database migrations run automatically on next startup
|
|
43
|
+
3. Check release notes for any breaking changes
|