@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,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-verify
|
|
3
|
+
description: Verifies work completeness using SIA's knowledge of area-specific requirements, past verification failures, and known gotchas. Use when about to claim work is done, before committing, or before creating PRs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Invariants
|
|
7
|
+
|
|
8
|
+
> These rules have No exceptions. A "done" claim without evidence is a FAILURE.
|
|
9
|
+
>
|
|
10
|
+
> 1. YOU MUST run a verification command and read its FULL output before claiming
|
|
11
|
+
> ANY work is done. "I'm confident it works" is NEVER sufficient.
|
|
12
|
+
> 2. If SIA surfaces area-specific verification requirements, you MUST verify
|
|
13
|
+
> EACH ONE explicitly. Running only `bun run test` is not enough if the area
|
|
14
|
+
> also requires typecheck, lint, or integration tests.
|
|
15
|
+
> 3. A claim of completion without a corresponding command output in the
|
|
16
|
+
> conversation is a FAILED verification. There is no such thing as
|
|
17
|
+
> "obviously correct."
|
|
18
|
+
|
|
19
|
+
## Red Flags — If You Think Any of These, STOP
|
|
20
|
+
|
|
21
|
+
| Thought | Why It's Wrong |
|
|
22
|
+
|---------|---------------|
|
|
23
|
+
| "The change is too small to verify" | Small changes cause the largest regressions. Verify. |
|
|
24
|
+
| "I already tested this mentally" | Mental testing catches ~30% of issues. Run the command. |
|
|
25
|
+
| "The CI will catch any problems" | CI runs after you commit. Catch it NOW. |
|
|
26
|
+
| "I ran a similar test earlier" | Earlier tests tested earlier code. This is different code. Run again. |
|
|
27
|
+
| "The tests are flaky, so a failure doesn't mean anything" | Re-run. If it fails twice, investigate. Do NOT claim success on a failing test. |
|
|
28
|
+
| "Just this once, I'll skip the SIA query" | The SIA query is how you discover area-specific requirements you don't know about. Never skip. |
|
|
29
|
+
|
|
30
|
+
# SIA-Enhanced Verification
|
|
31
|
+
|
|
32
|
+
Verify work is truly complete — queries SIA for area-specific requirements, past verification failures, and known gotchas before running checks. Evidence before assertions.
|
|
33
|
+
|
|
34
|
+
## Checklist
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
- [ ] Step 0: YOU MUST query SIA for area-specific verification requirements and known bugs. Without this, you will miss verification steps.
|
|
38
|
+
- [ ] Steps 1-5: IDENTIFY command → RUN fully → READ full output → VERIFY it confirms claim → ONLY THEN claim done. Skipping ANY step is a failed verification.
|
|
39
|
+
- [ ] Post: Capture any new verification requirements to graph. A verification that discovers new requirements but doesn't capture them leaves the next developer blind.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Workflow
|
|
43
|
+
|
|
44
|
+
### Step 0 — SIA Requirements Query (NEW)
|
|
45
|
+
|
|
46
|
+
Before running verification commands:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
sia_search({ query: "verification requirements testing <area>", node_types: ["Convention", "Decision"], limit: 10 })
|
|
50
|
+
sia_search({ query: "bugs failures <area>", node_types: ["Bug"], limit: 5 })
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Check if this area has specific verification requirements:
|
|
54
|
+
- "This module requires integration tests, not just unit tests"
|
|
55
|
+
- "Changes to the API need backwards-compatibility verification"
|
|
56
|
+
- "The auth module had a bug with edge case X — verify it's still handled"
|
|
57
|
+
|
|
58
|
+
### Step 1-5 — Standard Verification Gate (enhanced)
|
|
59
|
+
|
|
60
|
+
Follow the standard gate function:
|
|
61
|
+
1. **IDENTIFY** what command proves the claim — enhanced by SIA's knowledge of project-specific verification commands
|
|
62
|
+
2. **RUN** the full command
|
|
63
|
+
3. **READ** full output
|
|
64
|
+
4. **VERIFY** output confirms the claim
|
|
65
|
+
5. **ONLY THEN** make the claim
|
|
66
|
+
|
|
67
|
+
**Enhancement:** If SIA surfaced area-specific requirements in Step 0, verify EACH ONE explicitly. Don't just run `bun run test` — also run any area-specific checks (e.g., `bun run typecheck`, `bun run lint`, integration tests).
|
|
68
|
+
|
|
69
|
+
### Post-Verification — Capture (NEW)
|
|
70
|
+
|
|
71
|
+
If verification revealed an issue that was fixed:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
sia_note({ kind: "Convention", name: "Verification: <area> requires <specific check>", content: "<what verification is needed and why>" })
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This builds up area-specific verification knowledge over time.
|
|
78
|
+
|
|
79
|
+
## Key Principle
|
|
80
|
+
|
|
81
|
+
**Different areas need different verification.** SIA learns what each area requires and reminds you before you declare "done."
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-visualize
|
|
3
|
+
description: Generates an interactive HTML visualization of the SIA knowledge graph. Use when the user wants a static visualization file, for sharing graph views, or embedding in documentation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SIA Visualize
|
|
7
|
+
|
|
8
|
+
Generate a D3.js force-directed graph visualization of the knowledge graph.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. Run the graph visualization command:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/commands/graph.ts
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
2. This generates an HTML file at `sia-graph.html` in the project root.
|
|
19
|
+
|
|
20
|
+
3. Open the file in your browser to explore the graph interactively.
|
|
21
|
+
|
|
22
|
+
## Notes
|
|
23
|
+
|
|
24
|
+
- The visualization shows entities as nodes and edges as connections
|
|
25
|
+
- Node size reflects importance (PageRank)
|
|
26
|
+
- Node color reflects type (CodeSymbol, Decision, Convention, etc.)
|
|
27
|
+
- Hover over nodes to see details
|
|
28
|
+
- The graph is a snapshot — it does not update in real time
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sia-visualize-live
|
|
3
|
+
description: Launches an interactive browser-based knowledge graph visualizer for exploring entities, dependencies, and communities. Use when the user wants to visually explore the graph or understand module relationships.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SIA Live Visualizer
|
|
7
|
+
|
|
8
|
+
Launch an interactive knowledge graph visualization in your browser.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
**Graph explorer** (default):
|
|
13
|
+
```bash
|
|
14
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts visualize-live
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Temporal timeline:**
|
|
18
|
+
```bash
|
|
19
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts visualize-live --view timeline
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Dependency map:**
|
|
23
|
+
```bash
|
|
24
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts visualize-live --view deps
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Community clusters:**
|
|
28
|
+
```bash
|
|
29
|
+
bun run ${CLAUDE_PLUGIN_ROOT}/src/cli/index.ts visualize-live --view communities
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Starting the Visualizer
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
skills/sia-visualize-live/scripts/start-visualizer.sh --project-dir /path/to/project
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Open the URL shown in the output. The graph loads automatically.
|
|
39
|
+
|
|
40
|
+
## Stopping
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
skills/sia-visualize-live/scripts/stop-visualizer.sh $SCREEN_DIR
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Views
|
|
47
|
+
|
|
48
|
+
| View | What It Shows |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `graph` | Interactive force-directed graph — click nodes to expand, filter by type/tier |
|
|
51
|
+
| `timeline` | Temporal history — when decisions were made, bugs found, entities invalidated |
|
|
52
|
+
| `deps` | File dependency map — imports, calls, depends_on edges between modules |
|
|
53
|
+
| `communities` | Community clusters — Leiden-detected module groups with summaries |
|
|
54
|
+
|
|
55
|
+
Open the URL shown in your terminal. The visualization updates live as you push new views.
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>SIA Knowledge Graph</title>
|
|
6
|
+
<script src="https://d3js.org/d3.v7.min.js"></script>
|
|
7
|
+
<style>
|
|
8
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
9
|
+
html, body { height: 100%; overflow: hidden; }
|
|
10
|
+
|
|
11
|
+
:root {
|
|
12
|
+
--bg-primary: #f5f5f7;
|
|
13
|
+
--bg-secondary: #ffffff;
|
|
14
|
+
--bg-tertiary: #e5e5e7;
|
|
15
|
+
--border: #d1d1d6;
|
|
16
|
+
--text-primary: #1d1d1f;
|
|
17
|
+
--text-secondary: #86868b;
|
|
18
|
+
--accent: #0071e3;
|
|
19
|
+
--node-decision: #0a84ff;
|
|
20
|
+
--node-convention: #30d158;
|
|
21
|
+
--node-bug: #ff453a;
|
|
22
|
+
--node-solution: #ffd60a;
|
|
23
|
+
--node-file: #bf5af2;
|
|
24
|
+
--node-default: #86868b;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media (prefers-color-scheme: dark) {
|
|
28
|
+
:root {
|
|
29
|
+
--bg-primary: #1d1d1f;
|
|
30
|
+
--bg-secondary: #2d2d2f;
|
|
31
|
+
--bg-tertiary: #3d3d3f;
|
|
32
|
+
--border: #424245;
|
|
33
|
+
--text-primary: #f5f5f7;
|
|
34
|
+
--text-secondary: #86868b;
|
|
35
|
+
--accent: #0a84ff;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
body {
|
|
40
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
41
|
+
background: var(--bg-primary);
|
|
42
|
+
color: var(--text-primary);
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.header {
|
|
48
|
+
background: var(--bg-secondary);
|
|
49
|
+
padding: 0.5rem 1.5rem;
|
|
50
|
+
display: flex;
|
|
51
|
+
justify-content: space-between;
|
|
52
|
+
align-items: center;
|
|
53
|
+
border-bottom: 1px solid var(--border);
|
|
54
|
+
flex-shrink: 0;
|
|
55
|
+
z-index: 10;
|
|
56
|
+
}
|
|
57
|
+
.header h1 { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
|
|
58
|
+
.header .status { font-size: 0.7rem; color: #34c759; display: flex; align-items: center; gap: 0.4rem; }
|
|
59
|
+
.header .status::before { content: ''; width: 6px; height: 6px; background: #34c759; border-radius: 50%; }
|
|
60
|
+
|
|
61
|
+
.toolbar {
|
|
62
|
+
background: var(--bg-secondary);
|
|
63
|
+
padding: 0.4rem 1.5rem;
|
|
64
|
+
display: flex;
|
|
65
|
+
gap: 0.75rem;
|
|
66
|
+
align-items: center;
|
|
67
|
+
border-bottom: 1px solid var(--border);
|
|
68
|
+
flex-shrink: 0;
|
|
69
|
+
}
|
|
70
|
+
.toolbar input {
|
|
71
|
+
background: var(--bg-primary);
|
|
72
|
+
border: 1px solid var(--border);
|
|
73
|
+
border-radius: 6px;
|
|
74
|
+
padding: 0.35rem 0.75rem;
|
|
75
|
+
color: var(--text-primary);
|
|
76
|
+
font-size: 0.8rem;
|
|
77
|
+
width: 250px;
|
|
78
|
+
}
|
|
79
|
+
.toolbar button {
|
|
80
|
+
background: var(--bg-tertiary);
|
|
81
|
+
border: 1px solid var(--border);
|
|
82
|
+
border-radius: 6px;
|
|
83
|
+
padding: 0.35rem 0.75rem;
|
|
84
|
+
color: var(--text-primary);
|
|
85
|
+
font-size: 0.75rem;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
}
|
|
88
|
+
.toolbar button:hover { border-color: var(--accent); }
|
|
89
|
+
.toolbar button.active { background: var(--accent); color: white; border-color: var(--accent); }
|
|
90
|
+
|
|
91
|
+
.content { display: flex; flex: 1; overflow: hidden; }
|
|
92
|
+
|
|
93
|
+
#graph-container { flex: 1; position: relative; }
|
|
94
|
+
#graph-container svg { width: 100%; height: 100%; }
|
|
95
|
+
|
|
96
|
+
#sidebar {
|
|
97
|
+
width: 300px;
|
|
98
|
+
background: var(--bg-secondary);
|
|
99
|
+
border-left: 1px solid var(--border);
|
|
100
|
+
padding: 1rem;
|
|
101
|
+
overflow-y: auto;
|
|
102
|
+
flex-shrink: 0;
|
|
103
|
+
display: none;
|
|
104
|
+
}
|
|
105
|
+
#sidebar.visible { display: block; }
|
|
106
|
+
#sidebar h3 { font-size: 0.9rem; margin-bottom: 0.5rem; }
|
|
107
|
+
#sidebar .field { margin-bottom: 0.75rem; }
|
|
108
|
+
#sidebar .field-label { font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
|
|
109
|
+
#sidebar .field-value { font-size: 0.85rem; margin-top: 0.15rem; word-break: break-word; }
|
|
110
|
+
#sidebar .trust-tier { display: inline-block; padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.7rem; font-weight: 600; }
|
|
111
|
+
#sidebar .tier-1 { background: #30d158; color: #000; }
|
|
112
|
+
#sidebar .tier-2 { background: #0a84ff; color: #fff; }
|
|
113
|
+
#sidebar .tier-3 { background: #ffd60a; color: #000; }
|
|
114
|
+
#sidebar .tier-4 { background: #86868b; color: #fff; }
|
|
115
|
+
|
|
116
|
+
#legend {
|
|
117
|
+
position: absolute;
|
|
118
|
+
bottom: 1rem;
|
|
119
|
+
left: 1rem;
|
|
120
|
+
background: var(--bg-secondary);
|
|
121
|
+
border: 1px solid var(--border);
|
|
122
|
+
border-radius: 8px;
|
|
123
|
+
padding: 0.75rem;
|
|
124
|
+
font-size: 0.75rem;
|
|
125
|
+
z-index: 5;
|
|
126
|
+
}
|
|
127
|
+
#legend .legend-item { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
|
|
128
|
+
#legend .legend-dot { width: 10px; height: 10px; border-radius: 50%; }
|
|
129
|
+
|
|
130
|
+
.node-label { font-size: 10px; fill: var(--text-secondary); pointer-events: none; }
|
|
131
|
+
.edge-label { font-size: 8px; fill: var(--text-secondary); pointer-events: none; }
|
|
132
|
+
.link { stroke: var(--border); stroke-opacity: 0.6; }
|
|
133
|
+
.link:hover { stroke-opacity: 1; stroke-width: 2px; }
|
|
134
|
+
.node { cursor: pointer; }
|
|
135
|
+
.node:hover circle { stroke-width: 3px; }
|
|
136
|
+
.node.highlighted circle { stroke: var(--accent); stroke-width: 3px; }
|
|
137
|
+
.node.dimmed { opacity: 0.2; }
|
|
138
|
+
.link.dimmed { opacity: 0.05; }
|
|
139
|
+
</style>
|
|
140
|
+
</head>
|
|
141
|
+
<body>
|
|
142
|
+
<div class="header">
|
|
143
|
+
<h1>SIA Knowledge Graph Explorer</h1>
|
|
144
|
+
<div class="status">Connected</div>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
<div class="toolbar">
|
|
148
|
+
<input type="text" id="search" placeholder="Search entities..." />
|
|
149
|
+
<button data-filter="all" class="active">All</button>
|
|
150
|
+
<button data-filter="Decision">Decisions</button>
|
|
151
|
+
<button data-filter="Convention">Conventions</button>
|
|
152
|
+
<button data-filter="Bug">Bugs</button>
|
|
153
|
+
<button data-filter="Solution">Solutions</button>
|
|
154
|
+
<button data-filter="File">Files</button>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<div class="content">
|
|
158
|
+
<div id="graph-container">
|
|
159
|
+
<div id="legend">
|
|
160
|
+
<div class="legend-item"><div class="legend-dot" style="background: var(--node-decision)"></div> Decision</div>
|
|
161
|
+
<div class="legend-item"><div class="legend-dot" style="background: var(--node-convention)"></div> Convention</div>
|
|
162
|
+
<div class="legend-item"><div class="legend-dot" style="background: var(--node-bug)"></div> Bug</div>
|
|
163
|
+
<div class="legend-item"><div class="legend-dot" style="background: var(--node-solution)"></div> Solution</div>
|
|
164
|
+
<div class="legend-item"><div class="legend-dot" style="background: var(--node-file)"></div> File</div>
|
|
165
|
+
<div class="legend-item"><div class="legend-dot" style="background: var(--node-default)"></div> Other</div>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
<div id="sidebar">
|
|
169
|
+
<h3 id="sidebar-title">Select an entity</h3>
|
|
170
|
+
<div id="sidebar-content"></div>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
<script>
|
|
175
|
+
const graphData = /* GRAPH_DATA */;
|
|
176
|
+
|
|
177
|
+
const typeColors = {
|
|
178
|
+
Decision: getComputedStyle(document.documentElement).getPropertyValue('--node-decision').trim(),
|
|
179
|
+
Convention: getComputedStyle(document.documentElement).getPropertyValue('--node-convention').trim(),
|
|
180
|
+
Bug: getComputedStyle(document.documentElement).getPropertyValue('--node-bug').trim(),
|
|
181
|
+
Solution: getComputedStyle(document.documentElement).getPropertyValue('--node-solution').trim(),
|
|
182
|
+
File: getComputedStyle(document.documentElement).getPropertyValue('--node-file').trim(),
|
|
183
|
+
};
|
|
184
|
+
const defaultColor = getComputedStyle(document.documentElement).getPropertyValue('--node-default').trim();
|
|
185
|
+
|
|
186
|
+
function nodeColor(d) { return typeColors[d.type] || defaultColor; }
|
|
187
|
+
function nodeRadius(d) { return d.type === 'File' ? 6 : 8; }
|
|
188
|
+
|
|
189
|
+
const container = document.getElementById('graph-container');
|
|
190
|
+
const width = container.clientWidth;
|
|
191
|
+
const height = container.clientHeight;
|
|
192
|
+
|
|
193
|
+
const svg = d3.select('#graph-container')
|
|
194
|
+
.append('svg')
|
|
195
|
+
.attr('viewBox', [0, 0, width, height]);
|
|
196
|
+
|
|
197
|
+
const g = svg.append('g');
|
|
198
|
+
|
|
199
|
+
// Zoom/pan
|
|
200
|
+
const zoom = d3.zoom()
|
|
201
|
+
.scaleExtent([0.1, 10])
|
|
202
|
+
.on('zoom', (event) => g.attr('transform', event.transform));
|
|
203
|
+
svg.call(zoom);
|
|
204
|
+
|
|
205
|
+
// Build simulation
|
|
206
|
+
const nodes = (graphData.nodes || []).map(d => ({ ...d }));
|
|
207
|
+
const links = (graphData.edges || graphData.links || []).map(d => ({
|
|
208
|
+
...d,
|
|
209
|
+
source: d.source_id || d.source,
|
|
210
|
+
target: d.target_id || d.target,
|
|
211
|
+
}));
|
|
212
|
+
|
|
213
|
+
const simulation = d3.forceSimulation(nodes)
|
|
214
|
+
.force('link', d3.forceLink(links).id(d => d.id).distance(80))
|
|
215
|
+
.force('charge', d3.forceManyBody().strength(-200))
|
|
216
|
+
.force('center', d3.forceCenter(width / 2, height / 2))
|
|
217
|
+
.force('collision', d3.forceCollide().radius(d => nodeRadius(d) + 4));
|
|
218
|
+
|
|
219
|
+
// Edges
|
|
220
|
+
const link = g.append('g')
|
|
221
|
+
.selectAll('line')
|
|
222
|
+
.data(links)
|
|
223
|
+
.join('line')
|
|
224
|
+
.attr('class', 'link')
|
|
225
|
+
.attr('stroke-width', 1);
|
|
226
|
+
|
|
227
|
+
const edgeLabels = g.append('g')
|
|
228
|
+
.selectAll('text')
|
|
229
|
+
.data(links)
|
|
230
|
+
.join('text')
|
|
231
|
+
.attr('class', 'edge-label')
|
|
232
|
+
.attr('text-anchor', 'middle')
|
|
233
|
+
.text(d => d.edge_type || d.type || '');
|
|
234
|
+
|
|
235
|
+
// Nodes
|
|
236
|
+
const node = g.append('g')
|
|
237
|
+
.selectAll('g')
|
|
238
|
+
.data(nodes)
|
|
239
|
+
.join('g')
|
|
240
|
+
.attr('class', 'node')
|
|
241
|
+
.call(d3.drag()
|
|
242
|
+
.on('start', dragstarted)
|
|
243
|
+
.on('drag', dragged)
|
|
244
|
+
.on('end', dragended));
|
|
245
|
+
|
|
246
|
+
node.append('circle')
|
|
247
|
+
.attr('r', d => nodeRadius(d))
|
|
248
|
+
.attr('fill', d => nodeColor(d))
|
|
249
|
+
.attr('stroke', d => d3.color(nodeColor(d)).darker(0.5))
|
|
250
|
+
.attr('stroke-width', 1.5);
|
|
251
|
+
|
|
252
|
+
node.append('text')
|
|
253
|
+
.attr('class', 'node-label')
|
|
254
|
+
.attr('dx', d => nodeRadius(d) + 4)
|
|
255
|
+
.attr('dy', '0.35em')
|
|
256
|
+
.text(d => d.name || d.label || d.id);
|
|
257
|
+
|
|
258
|
+
// Click to show details in sidebar
|
|
259
|
+
node.on('click', (event, d) => {
|
|
260
|
+
event.stopPropagation();
|
|
261
|
+
showSidebar(d);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
svg.on('click', () => hideSidebar());
|
|
265
|
+
|
|
266
|
+
simulation.on('tick', () => {
|
|
267
|
+
link
|
|
268
|
+
.attr('x1', d => d.source.x)
|
|
269
|
+
.attr('y1', d => d.source.y)
|
|
270
|
+
.attr('x2', d => d.target.x)
|
|
271
|
+
.attr('y2', d => d.target.y);
|
|
272
|
+
|
|
273
|
+
edgeLabels
|
|
274
|
+
.attr('x', d => (d.source.x + d.target.x) / 2)
|
|
275
|
+
.attr('y', d => (d.source.y + d.target.y) / 2);
|
|
276
|
+
|
|
277
|
+
node.attr('transform', d => `translate(${d.x},${d.y})`);
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
// Drag behavior
|
|
281
|
+
function dragstarted(event, d) {
|
|
282
|
+
if (!event.active) simulation.alphaTarget(0.3).restart();
|
|
283
|
+
d.fx = d.x; d.fy = d.y;
|
|
284
|
+
}
|
|
285
|
+
function dragged(event, d) { d.fx = event.x; d.fy = event.y; }
|
|
286
|
+
function dragended(event, d) {
|
|
287
|
+
if (!event.active) simulation.alphaTarget(0);
|
|
288
|
+
d.fx = null; d.fy = null;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Search — highlights matching nodes
|
|
292
|
+
document.getElementById('search').addEventListener('input', (e) => {
|
|
293
|
+
const query = e.target.value.toLowerCase();
|
|
294
|
+
if (!query) {
|
|
295
|
+
node.classed('highlighted', false).classed('dimmed', false);
|
|
296
|
+
link.classed('dimmed', false);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const matchIds = new Set();
|
|
300
|
+
nodes.forEach(n => {
|
|
301
|
+
if ((n.name || n.label || n.id).toLowerCase().includes(query)) matchIds.add(n.id);
|
|
302
|
+
});
|
|
303
|
+
node.classed('highlighted', d => matchIds.has(d.id));
|
|
304
|
+
node.classed('dimmed', d => !matchIds.has(d.id));
|
|
305
|
+
link.classed('dimmed', d => !matchIds.has(d.source.id) && !matchIds.has(d.target.id));
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
// Filter buttons — show/dim by entity type
|
|
309
|
+
document.querySelectorAll('.toolbar button').forEach(btn => {
|
|
310
|
+
btn.addEventListener('click', () => {
|
|
311
|
+
document.querySelectorAll('.toolbar button').forEach(b => b.classList.remove('active'));
|
|
312
|
+
btn.classList.add('active');
|
|
313
|
+
const filter = btn.dataset.filter;
|
|
314
|
+
if (filter === 'all') {
|
|
315
|
+
node.classed('dimmed', false);
|
|
316
|
+
link.classed('dimmed', false);
|
|
317
|
+
} else {
|
|
318
|
+
node.classed('dimmed', d => d.type !== filter);
|
|
319
|
+
link.classed('dimmed', d => d.source.type !== filter && d.target.type !== filter);
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
// Sidebar — shows entity details using safe DOM methods
|
|
325
|
+
function showSidebar(d) {
|
|
326
|
+
const sidebar = document.getElementById('sidebar');
|
|
327
|
+
sidebar.classList.add('visible');
|
|
328
|
+
document.getElementById('sidebar-title').textContent = d.name || d.label || d.id;
|
|
329
|
+
|
|
330
|
+
const contentEl = document.getElementById('sidebar-content');
|
|
331
|
+
contentEl.textContent = ''; // Clear previous content safely
|
|
332
|
+
|
|
333
|
+
const fields = [
|
|
334
|
+
{ label: 'Type', value: d.type },
|
|
335
|
+
{ label: 'ID', value: d.id },
|
|
336
|
+
{ label: 'Content', value: d.content },
|
|
337
|
+
{ label: 'Trust Tier', value: d.trust_tier ? 'Tier ' + d.trust_tier : null },
|
|
338
|
+
{ label: 'Valid From', value: d.t_valid_from },
|
|
339
|
+
{ label: 'Valid Until', value: d.t_valid_until || 'current' },
|
|
340
|
+
{ label: 'File Path', value: d.file_path },
|
|
341
|
+
{ label: 'Community', value: d.community_id != null ? 'Community ' + d.community_id : null },
|
|
342
|
+
].filter(f => f.value != null);
|
|
343
|
+
|
|
344
|
+
fields.forEach(f => {
|
|
345
|
+
const fieldDiv = document.createElement('div');
|
|
346
|
+
fieldDiv.className = 'field';
|
|
347
|
+
|
|
348
|
+
const labelDiv = document.createElement('div');
|
|
349
|
+
labelDiv.className = 'field-label';
|
|
350
|
+
labelDiv.textContent = f.label;
|
|
351
|
+
|
|
352
|
+
const valueDiv = document.createElement('div');
|
|
353
|
+
valueDiv.className = 'field-value';
|
|
354
|
+
|
|
355
|
+
if (f.label === 'Trust Tier' && d.trust_tier) {
|
|
356
|
+
const span = document.createElement('span');
|
|
357
|
+
span.className = 'trust-tier tier-' + d.trust_tier;
|
|
358
|
+
span.textContent = f.value;
|
|
359
|
+
valueDiv.appendChild(span);
|
|
360
|
+
} else {
|
|
361
|
+
valueDiv.textContent = f.value;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
fieldDiv.appendChild(labelDiv);
|
|
365
|
+
fieldDiv.appendChild(valueDiv);
|
|
366
|
+
contentEl.appendChild(fieldDiv);
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function hideSidebar() {
|
|
371
|
+
document.getElementById('sidebar').classList.remove('visible');
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// WebSocket live reload
|
|
375
|
+
(function connectWS() {
|
|
376
|
+
const proto = location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
377
|
+
const ws = new WebSocket(proto + '//' + location.host);
|
|
378
|
+
ws.onmessage = (evt) => {
|
|
379
|
+
try {
|
|
380
|
+
const msg = JSON.parse(evt.data);
|
|
381
|
+
if (msg.type === 'reload') location.reload();
|
|
382
|
+
} catch (e) { /* ignore parse errors */ }
|
|
383
|
+
};
|
|
384
|
+
ws.onclose = () => setTimeout(connectWS, 2000);
|
|
385
|
+
ws.onerror = () => ws.close();
|
|
386
|
+
})();
|
|
387
|
+
</script>
|
|
388
|
+
</body>
|
|
389
|
+
</html>
|