@mc1global/opencode-jarvis 0.1.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/LICENSE +10 -0
- package/README.md +171 -0
- package/dist/application/context-memory/dtos.d.ts +100 -0
- package/dist/application/context-memory/dtos.d.ts.map +1 -0
- package/dist/application/context-memory/dtos.js +11 -0
- package/dist/application/context-memory/dtos.js.map +1 -0
- package/dist/application/context-memory/note-use-cases.d.ts +22 -0
- package/dist/application/context-memory/note-use-cases.d.ts.map +1 -0
- package/dist/application/context-memory/note-use-cases.js +76 -0
- package/dist/application/context-memory/note-use-cases.js.map +1 -0
- package/dist/application/context-memory/session-use-cases.d.ts +23 -0
- package/dist/application/context-memory/session-use-cases.d.ts.map +1 -0
- package/dist/application/context-memory/session-use-cases.js +63 -0
- package/dist/application/context-memory/session-use-cases.js.map +1 -0
- package/dist/application/context-memory/todo-use-cases.d.ts +25 -0
- package/dist/application/context-memory/todo-use-cases.d.ts.map +1 -0
- package/dist/application/context-memory/todo-use-cases.js +100 -0
- package/dist/application/context-memory/todo-use-cases.js.map +1 -0
- package/dist/application/domain-map/dtos.d.ts +58 -0
- package/dist/application/domain-map/dtos.d.ts.map +1 -0
- package/dist/application/domain-map/dtos.js +11 -0
- package/dist/application/domain-map/dtos.js.map +1 -0
- package/dist/application/domain-map/use-cases.d.ts +64 -0
- package/dist/application/domain-map/use-cases.d.ts.map +1 -0
- package/dist/application/domain-map/use-cases.js +217 -0
- package/dist/application/domain-map/use-cases.js.map +1 -0
- package/dist/application/environment/dtos.d.ts +74 -0
- package/dist/application/environment/dtos.d.ts.map +1 -0
- package/dist/application/environment/dtos.js +10 -0
- package/dist/application/environment/dtos.js.map +1 -0
- package/dist/application/environment/use-cases.d.ts +29 -0
- package/dist/application/environment/use-cases.d.ts.map +1 -0
- package/dist/application/environment/use-cases.js +232 -0
- package/dist/application/environment/use-cases.js.map +1 -0
- package/dist/application/governance/validation-use-cases.d.ts +45 -0
- package/dist/application/governance/validation-use-cases.d.ts.map +1 -0
- package/dist/application/governance/validation-use-cases.js +51 -0
- package/dist/application/governance/validation-use-cases.js.map +1 -0
- package/dist/application/kanban/board-use-cases.d.ts +45 -0
- package/dist/application/kanban/board-use-cases.d.ts.map +1 -0
- package/dist/application/kanban/board-use-cases.js +124 -0
- package/dist/application/kanban/board-use-cases.js.map +1 -0
- package/dist/application/kanban/card-use-cases.d.ts +32 -0
- package/dist/application/kanban/card-use-cases.d.ts.map +1 -0
- package/dist/application/kanban/card-use-cases.js +204 -0
- package/dist/application/kanban/card-use-cases.js.map +1 -0
- package/dist/application/kanban/dtos.d.ts +165 -0
- package/dist/application/kanban/dtos.d.ts.map +1 -0
- package/dist/application/kanban/dtos.js +11 -0
- package/dist/application/kanban/dtos.js.map +1 -0
- package/dist/application/kanban/sprint-use-cases.d.ts +34 -0
- package/dist/application/kanban/sprint-use-cases.d.ts.map +1 -0
- package/dist/application/kanban/sprint-use-cases.js +243 -0
- package/dist/application/kanban/sprint-use-cases.js.map +1 -0
- package/dist/application/rag/dtos.d.ts +113 -0
- package/dist/application/rag/dtos.d.ts.map +1 -0
- package/dist/application/rag/dtos.js +11 -0
- package/dist/application/rag/dtos.js.map +1 -0
- package/dist/application/rag/oracle-use-cases.d.ts +30 -0
- package/dist/application/rag/oracle-use-cases.d.ts.map +1 -0
- package/dist/application/rag/oracle-use-cases.js +91 -0
- package/dist/application/rag/oracle-use-cases.js.map +1 -0
- package/dist/application/rag/use-cases.d.ts +34 -0
- package/dist/application/rag/use-cases.d.ts.map +1 -0
- package/dist/application/rag/use-cases.js +234 -0
- package/dist/application/rag/use-cases.js.map +1 -0
- package/dist/application/token-metrics/dtos.d.ts +126 -0
- package/dist/application/token-metrics/dtos.d.ts.map +1 -0
- package/dist/application/token-metrics/dtos.js +11 -0
- package/dist/application/token-metrics/dtos.js.map +1 -0
- package/dist/application/token-metrics/tracking-use-cases.d.ts +33 -0
- package/dist/application/token-metrics/tracking-use-cases.d.ts.map +1 -0
- package/dist/application/token-metrics/tracking-use-cases.js +220 -0
- package/dist/application/token-metrics/tracking-use-cases.js.map +1 -0
- package/dist/application/vault/dtos.d.ts +91 -0
- package/dist/application/vault/dtos.d.ts.map +1 -0
- package/dist/application/vault/dtos.js +11 -0
- package/dist/application/vault/dtos.js.map +1 -0
- package/dist/application/vault/use-cases.d.ts +30 -0
- package/dist/application/vault/use-cases.d.ts.map +1 -0
- package/dist/application/vault/use-cases.js +307 -0
- package/dist/application/vault/use-cases.js.map +1 -0
- package/dist/application/vault/vault-manager.d.ts +47 -0
- package/dist/application/vault/vault-manager.d.ts.map +1 -0
- package/dist/application/vault/vault-manager.js +272 -0
- package/dist/application/vault/vault-manager.js.map +1 -0
- package/dist/application/workspace-registry/dtos.d.ts +91 -0
- package/dist/application/workspace-registry/dtos.d.ts.map +1 -0
- package/dist/application/workspace-registry/dtos.js +11 -0
- package/dist/application/workspace-registry/dtos.js.map +1 -0
- package/dist/application/workspace-registry/use-cases.d.ts +29 -0
- package/dist/application/workspace-registry/use-cases.d.ts.map +1 -0
- package/dist/application/workspace-registry/use-cases.js +249 -0
- package/dist/application/workspace-registry/use-cases.js.map +1 -0
- package/dist/domain/context-memory/entities.d.ts +123 -0
- package/dist/domain/context-memory/entities.d.ts.map +1 -0
- package/dist/domain/context-memory/entities.js +229 -0
- package/dist/domain/context-memory/entities.js.map +1 -0
- package/dist/domain/context-memory/repositories.d.ts +46 -0
- package/dist/domain/context-memory/repositories.d.ts.map +1 -0
- package/dist/domain/context-memory/repositories.js +2 -0
- package/dist/domain/context-memory/repositories.js.map +1 -0
- package/dist/domain/context-memory/services.d.ts +62 -0
- package/dist/domain/context-memory/services.d.ts.map +1 -0
- package/dist/domain/context-memory/services.js +162 -0
- package/dist/domain/context-memory/services.js.map +1 -0
- package/dist/domain/context-memory/value-objects.d.ts +65 -0
- package/dist/domain/context-memory/value-objects.d.ts.map +1 -0
- package/dist/domain/context-memory/value-objects.js +105 -0
- package/dist/domain/context-memory/value-objects.js.map +1 -0
- package/dist/domain/domain-map/repositories.d.ts +126 -0
- package/dist/domain/domain-map/repositories.d.ts.map +1 -0
- package/dist/domain/domain-map/repositories.js +2 -0
- package/dist/domain/domain-map/repositories.js.map +1 -0
- package/dist/domain/domain-map/services.d.ts +108 -0
- package/dist/domain/domain-map/services.d.ts.map +1 -0
- package/dist/domain/domain-map/services.js +335 -0
- package/dist/domain/domain-map/services.js.map +1 -0
- package/dist/domain/domain-map/value-objects.d.ts +186 -0
- package/dist/domain/domain-map/value-objects.d.ts.map +1 -0
- package/dist/domain/domain-map/value-objects.js +215 -0
- package/dist/domain/domain-map/value-objects.js.map +1 -0
- package/dist/domain/environment/entities.d.ts +93 -0
- package/dist/domain/environment/entities.d.ts.map +1 -0
- package/dist/domain/environment/entities.js +207 -0
- package/dist/domain/environment/entities.js.map +1 -0
- package/dist/domain/environment/renderers.d.ts +30 -0
- package/dist/domain/environment/renderers.d.ts.map +1 -0
- package/dist/domain/environment/renderers.js +139 -0
- package/dist/domain/environment/renderers.js.map +1 -0
- package/dist/domain/environment/repositories.d.ts +73 -0
- package/dist/domain/environment/repositories.d.ts.map +1 -0
- package/dist/domain/environment/repositories.js +16 -0
- package/dist/domain/environment/repositories.js.map +1 -0
- package/dist/domain/environment/services.d.ts +62 -0
- package/dist/domain/environment/services.d.ts.map +1 -0
- package/dist/domain/environment/services.js +282 -0
- package/dist/domain/environment/services.js.map +1 -0
- package/dist/domain/environment/value-objects.d.ts +127 -0
- package/dist/domain/environment/value-objects.d.ts.map +1 -0
- package/dist/domain/environment/value-objects.js +179 -0
- package/dist/domain/environment/value-objects.js.map +1 -0
- package/dist/domain/governance/policies.d.ts +42 -0
- package/dist/domain/governance/policies.d.ts.map +1 -0
- package/dist/domain/governance/policies.js +304 -0
- package/dist/domain/governance/policies.js.map +1 -0
- package/dist/domain/governance/services.d.ts +38 -0
- package/dist/domain/governance/services.d.ts.map +1 -0
- package/dist/domain/governance/services.js +42 -0
- package/dist/domain/governance/services.js.map +1 -0
- package/dist/domain/kanban/entities.d.ts +105 -0
- package/dist/domain/kanban/entities.d.ts.map +1 -0
- package/dist/domain/kanban/entities.js +211 -0
- package/dist/domain/kanban/entities.js.map +1 -0
- package/dist/domain/kanban/grooming.d.ts +40 -0
- package/dist/domain/kanban/grooming.d.ts.map +1 -0
- package/dist/domain/kanban/grooming.js +50 -0
- package/dist/domain/kanban/grooming.js.map +1 -0
- package/dist/domain/kanban/repositories.d.ts +41 -0
- package/dist/domain/kanban/repositories.d.ts.map +1 -0
- package/dist/domain/kanban/repositories.js +2 -0
- package/dist/domain/kanban/repositories.js.map +1 -0
- package/dist/domain/kanban/services.d.ts +49 -0
- package/dist/domain/kanban/services.d.ts.map +1 -0
- package/dist/domain/kanban/services.js +154 -0
- package/dist/domain/kanban/services.js.map +1 -0
- package/dist/domain/kanban/sprint.d.ts +103 -0
- package/dist/domain/kanban/sprint.d.ts.map +1 -0
- package/dist/domain/kanban/sprint.js +192 -0
- package/dist/domain/kanban/sprint.js.map +1 -0
- package/dist/domain/kanban/value-objects.d.ts +91 -0
- package/dist/domain/kanban/value-objects.d.ts.map +1 -0
- package/dist/domain/kanban/value-objects.js +167 -0
- package/dist/domain/kanban/value-objects.js.map +1 -0
- package/dist/domain/rag/repositories.d.ts +152 -0
- package/dist/domain/rag/repositories.d.ts.map +1 -0
- package/dist/domain/rag/repositories.js +2 -0
- package/dist/domain/rag/repositories.js.map +1 -0
- package/dist/domain/rag/services.d.ts +57 -0
- package/dist/domain/rag/services.d.ts.map +1 -0
- package/dist/domain/rag/services.js +224 -0
- package/dist/domain/rag/services.js.map +1 -0
- package/dist/domain/rag/value-objects.d.ts +118 -0
- package/dist/domain/rag/value-objects.d.ts.map +1 -0
- package/dist/domain/rag/value-objects.js +114 -0
- package/dist/domain/rag/value-objects.js.map +1 -0
- package/dist/domain/shared/value-objects.d.ts +56 -0
- package/dist/domain/shared/value-objects.d.ts.map +1 -0
- package/dist/domain/shared/value-objects.js +89 -0
- package/dist/domain/shared/value-objects.js.map +1 -0
- package/dist/domain/token-metrics/entities.d.ts +90 -0
- package/dist/domain/token-metrics/entities.d.ts.map +1 -0
- package/dist/domain/token-metrics/entities.js +115 -0
- package/dist/domain/token-metrics/entities.js.map +1 -0
- package/dist/domain/token-metrics/repositories.d.ts +93 -0
- package/dist/domain/token-metrics/repositories.d.ts.map +1 -0
- package/dist/domain/token-metrics/repositories.js +2 -0
- package/dist/domain/token-metrics/repositories.js.map +1 -0
- package/dist/domain/token-metrics/value-objects.d.ts +81 -0
- package/dist/domain/token-metrics/value-objects.d.ts.map +1 -0
- package/dist/domain/token-metrics/value-objects.js +144 -0
- package/dist/domain/token-metrics/value-objects.js.map +1 -0
- package/dist/domain/vault/canvas.d.ts +70 -0
- package/dist/domain/vault/canvas.d.ts.map +1 -0
- package/dist/domain/vault/canvas.js +70 -0
- package/dist/domain/vault/canvas.js.map +1 -0
- package/dist/domain/vault/document.d.ts +71 -0
- package/dist/domain/vault/document.d.ts.map +1 -0
- package/dist/domain/vault/document.js +244 -0
- package/dist/domain/vault/document.js.map +1 -0
- package/dist/domain/vault/repositories.d.ts +35 -0
- package/dist/domain/vault/repositories.d.ts.map +1 -0
- package/dist/domain/vault/repositories.js +2 -0
- package/dist/domain/vault/repositories.js.map +1 -0
- package/dist/domain/vault/section.d.ts +33 -0
- package/dist/domain/vault/section.d.ts.map +1 -0
- package/dist/domain/vault/section.js +39 -0
- package/dist/domain/vault/section.js.map +1 -0
- package/dist/domain/vault/services.d.ts +48 -0
- package/dist/domain/vault/services.d.ts.map +1 -0
- package/dist/domain/vault/services.js +249 -0
- package/dist/domain/vault/services.js.map +1 -0
- package/dist/domain/vault/table.d.ts +58 -0
- package/dist/domain/vault/table.d.ts.map +1 -0
- package/dist/domain/vault/table.js +204 -0
- package/dist/domain/vault/table.js.map +1 -0
- package/dist/domain/vault/timeline.d.ts +53 -0
- package/dist/domain/vault/timeline.d.ts.map +1 -0
- package/dist/domain/vault/timeline.js +214 -0
- package/dist/domain/vault/timeline.js.map +1 -0
- package/dist/domain/vault/value-objects.d.ts +45 -0
- package/dist/domain/vault/value-objects.d.ts.map +1 -0
- package/dist/domain/vault/value-objects.js +89 -0
- package/dist/domain/vault/value-objects.js.map +1 -0
- package/dist/domain/workspace-registry/entities.d.ts +57 -0
- package/dist/domain/workspace-registry/entities.d.ts.map +1 -0
- package/dist/domain/workspace-registry/entities.js +148 -0
- package/dist/domain/workspace-registry/entities.js.map +1 -0
- package/dist/domain/workspace-registry/repositories.d.ts +57 -0
- package/dist/domain/workspace-registry/repositories.d.ts.map +1 -0
- package/dist/domain/workspace-registry/repositories.js +12 -0
- package/dist/domain/workspace-registry/repositories.js.map +1 -0
- package/dist/domain/workspace-registry/services.d.ts +56 -0
- package/dist/domain/workspace-registry/services.d.ts.map +1 -0
- package/dist/domain/workspace-registry/services.js +283 -0
- package/dist/domain/workspace-registry/services.js.map +1 -0
- package/dist/domain/workspace-registry/value-objects.d.ts +113 -0
- package/dist/domain/workspace-registry/value-objects.d.ts.map +1 -0
- package/dist/domain/workspace-registry/value-objects.js +235 -0
- package/dist/domain/workspace-registry/value-objects.js.map +1 -0
- package/dist/hooks/context-compacting.d.ts +35 -0
- package/dist/hooks/context-compacting.d.ts.map +1 -0
- package/dist/hooks/context-compacting.js +48 -0
- package/dist/hooks/context-compacting.js.map +1 -0
- package/dist/hooks/event-handlers.d.ts +39 -0
- package/dist/hooks/event-handlers.d.ts.map +1 -0
- package/dist/hooks/event-handlers.js +75 -0
- package/dist/hooks/event-handlers.js.map +1 -0
- package/dist/hooks/guardrails.d.ts +33 -0
- package/dist/hooks/guardrails.d.ts.map +1 -0
- package/dist/hooks/guardrails.js +22 -0
- package/dist/hooks/guardrails.js.map +1 -0
- package/dist/hooks/shell-env.d.ts +28 -0
- package/dist/hooks/shell-env.d.ts.map +1 -0
- package/dist/hooks/shell-env.js +17 -0
- package/dist/hooks/shell-env.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +349 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/context-memory/note-repository.d.ts +26 -0
- package/dist/infrastructure/context-memory/note-repository.d.ts.map +1 -0
- package/dist/infrastructure/context-memory/note-repository.js +87 -0
- package/dist/infrastructure/context-memory/note-repository.js.map +1 -0
- package/dist/infrastructure/context-memory/search-repository.d.ts +20 -0
- package/dist/infrastructure/context-memory/search-repository.d.ts.map +1 -0
- package/dist/infrastructure/context-memory/search-repository.js +44 -0
- package/dist/infrastructure/context-memory/search-repository.js.map +1 -0
- package/dist/infrastructure/context-memory/session-repository.d.ts +26 -0
- package/dist/infrastructure/context-memory/session-repository.d.ts.map +1 -0
- package/dist/infrastructure/context-memory/session-repository.js +79 -0
- package/dist/infrastructure/context-memory/session-repository.js.map +1 -0
- package/dist/infrastructure/context-memory/todo-repository.d.ts +26 -0
- package/dist/infrastructure/context-memory/todo-repository.d.ts.map +1 -0
- package/dist/infrastructure/context-memory/todo-repository.js +105 -0
- package/dist/infrastructure/context-memory/todo-repository.js.map +1 -0
- package/dist/infrastructure/database/sqlite-adapter.d.ts +60 -0
- package/dist/infrastructure/database/sqlite-adapter.d.ts.map +1 -0
- package/dist/infrastructure/database/sqlite-adapter.js +93 -0
- package/dist/infrastructure/database/sqlite-adapter.js.map +1 -0
- package/dist/infrastructure/domain-map/llm-analyzer.d.ts +60 -0
- package/dist/infrastructure/domain-map/llm-analyzer.d.ts.map +1 -0
- package/dist/infrastructure/domain-map/llm-analyzer.js +249 -0
- package/dist/infrastructure/domain-map/llm-analyzer.js.map +1 -0
- package/dist/infrastructure/domain-map/lsp-adapter.d.ts +61 -0
- package/dist/infrastructure/domain-map/lsp-adapter.d.ts.map +1 -0
- package/dist/infrastructure/domain-map/lsp-adapter.js +210 -0
- package/dist/infrastructure/domain-map/lsp-adapter.js.map +1 -0
- package/dist/infrastructure/domain-map/lsp-configs.d.ts +53 -0
- package/dist/infrastructure/domain-map/lsp-configs.d.ts.map +1 -0
- package/dist/infrastructure/domain-map/lsp-configs.js +274 -0
- package/dist/infrastructure/domain-map/lsp-configs.js.map +1 -0
- package/dist/infrastructure/domain-map/lsp-json-rpc.d.ts +132 -0
- package/dist/infrastructure/domain-map/lsp-json-rpc.d.ts.map +1 -0
- package/dist/infrastructure/domain-map/lsp-json-rpc.js +320 -0
- package/dist/infrastructure/domain-map/lsp-json-rpc.js.map +1 -0
- package/dist/infrastructure/domain-map/project-scanner.d.ts +43 -0
- package/dist/infrastructure/domain-map/project-scanner.d.ts.map +1 -0
- package/dist/infrastructure/domain-map/project-scanner.js +193 -0
- package/dist/infrastructure/domain-map/project-scanner.js.map +1 -0
- package/dist/infrastructure/environment/environment-repository.d.ts +33 -0
- package/dist/infrastructure/environment/environment-repository.d.ts.map +1 -0
- package/dist/infrastructure/environment/environment-repository.js +161 -0
- package/dist/infrastructure/environment/environment-repository.js.map +1 -0
- package/dist/infrastructure/environment/scanner-adapter.d.ts +23 -0
- package/dist/infrastructure/environment/scanner-adapter.d.ts.map +1 -0
- package/dist/infrastructure/environment/scanner-adapter.js +102 -0
- package/dist/infrastructure/environment/scanner-adapter.js.map +1 -0
- package/dist/infrastructure/kanban/card-repository.d.ts +41 -0
- package/dist/infrastructure/kanban/card-repository.d.ts.map +1 -0
- package/dist/infrastructure/kanban/card-repository.js +185 -0
- package/dist/infrastructure/kanban/card-repository.js.map +1 -0
- package/dist/infrastructure/kanban/sprint-repository.d.ts +40 -0
- package/dist/infrastructure/kanban/sprint-repository.d.ts.map +1 -0
- package/dist/infrastructure/kanban/sprint-repository.js +186 -0
- package/dist/infrastructure/kanban/sprint-repository.js.map +1 -0
- package/dist/infrastructure/rag/file-discovery.d.ts +19 -0
- package/dist/infrastructure/rag/file-discovery.d.ts.map +1 -0
- package/dist/infrastructure/rag/file-discovery.js +201 -0
- package/dist/infrastructure/rag/file-discovery.js.map +1 -0
- package/dist/infrastructure/rag/ollama-embeddings.d.ts +18 -0
- package/dist/infrastructure/rag/ollama-embeddings.d.ts.map +1 -0
- package/dist/infrastructure/rag/ollama-embeddings.js +54 -0
- package/dist/infrastructure/rag/ollama-embeddings.js.map +1 -0
- package/dist/infrastructure/rag/text-splitter.d.ts +19 -0
- package/dist/infrastructure/rag/text-splitter.d.ts.map +1 -0
- package/dist/infrastructure/rag/text-splitter.js +38 -0
- package/dist/infrastructure/rag/text-splitter.js.map +1 -0
- package/dist/infrastructure/rag/vectra-adapter.d.ts +38 -0
- package/dist/infrastructure/rag/vectra-adapter.d.ts.map +1 -0
- package/dist/infrastructure/rag/vectra-adapter.js +275 -0
- package/dist/infrastructure/rag/vectra-adapter.js.map +1 -0
- package/dist/infrastructure/token-metrics/token-metrics-repository.d.ts +29 -0
- package/dist/infrastructure/token-metrics/token-metrics-repository.d.ts.map +1 -0
- package/dist/infrastructure/token-metrics/token-metrics-repository.js +254 -0
- package/dist/infrastructure/token-metrics/token-metrics-repository.js.map +1 -0
- package/dist/infrastructure/vault/markdown-parser.d.ts +35 -0
- package/dist/infrastructure/vault/markdown-parser.d.ts.map +1 -0
- package/dist/infrastructure/vault/markdown-parser.js +145 -0
- package/dist/infrastructure/vault/markdown-parser.js.map +1 -0
- package/dist/infrastructure/vault/vault-fs-adapter.d.ts +17 -0
- package/dist/infrastructure/vault/vault-fs-adapter.d.ts.map +1 -0
- package/dist/infrastructure/vault/vault-fs-adapter.js +105 -0
- package/dist/infrastructure/vault/vault-fs-adapter.js.map +1 -0
- package/dist/infrastructure/workspace-registry/dependency-repository.d.ts +27 -0
- package/dist/infrastructure/workspace-registry/dependency-repository.d.ts.map +1 -0
- package/dist/infrastructure/workspace-registry/dependency-repository.js +89 -0
- package/dist/infrastructure/workspace-registry/dependency-repository.js.map +1 -0
- package/dist/infrastructure/workspace-registry/workspace-repository.d.ts +28 -0
- package/dist/infrastructure/workspace-registry/workspace-repository.d.ts.map +1 -0
- package/dist/infrastructure/workspace-registry/workspace-repository.js +108 -0
- package/dist/infrastructure/workspace-registry/workspace-repository.js.map +1 -0
- package/dist/tools/agent-tools.d.ts +14 -0
- package/dist/tools/agent-tools.d.ts.map +1 -0
- package/dist/tools/agent-tools.js +238 -0
- package/dist/tools/agent-tools.js.map +1 -0
- package/dist/tools/context-memory-tools.d.ts +16 -0
- package/dist/tools/context-memory-tools.d.ts.map +1 -0
- package/dist/tools/context-memory-tools.js +242 -0
- package/dist/tools/context-memory-tools.js.map +1 -0
- package/dist/tools/data-tools.d.ts +3 -0
- package/dist/tools/data-tools.d.ts.map +1 -0
- package/dist/tools/data-tools.js +383 -0
- package/dist/tools/data-tools.js.map +1 -0
- package/dist/tools/domain-map-tools.d.ts +41 -0
- package/dist/tools/domain-map-tools.d.ts.map +1 -0
- package/dist/tools/domain-map-tools.js +134 -0
- package/dist/tools/domain-map-tools.js.map +1 -0
- package/dist/tools/environment-tools.d.ts +85 -0
- package/dist/tools/environment-tools.d.ts.map +1 -0
- package/dist/tools/environment-tools.js +223 -0
- package/dist/tools/environment-tools.js.map +1 -0
- package/dist/tools/governance-tools.d.ts +7 -0
- package/dist/tools/governance-tools.d.ts.map +1 -0
- package/dist/tools/governance-tools.js +73 -0
- package/dist/tools/governance-tools.js.map +1 -0
- package/dist/tools/kanban-board-tools.d.ts +11 -0
- package/dist/tools/kanban-board-tools.d.ts.map +1 -0
- package/dist/tools/kanban-board-tools.js +354 -0
- package/dist/tools/kanban-board-tools.js.map +1 -0
- package/dist/tools/kanban-card-tools.d.ts +11 -0
- package/dist/tools/kanban-card-tools.d.ts.map +1 -0
- package/dist/tools/kanban-card-tools.js +407 -0
- package/dist/tools/kanban-card-tools.js.map +1 -0
- package/dist/tools/rag-tools.d.ts +10 -0
- package/dist/tools/rag-tools.d.ts.map +1 -0
- package/dist/tools/rag-tools.js +279 -0
- package/dist/tools/rag-tools.js.map +1 -0
- package/dist/tools/token-metrics-tools.d.ts +98 -0
- package/dist/tools/token-metrics-tools.d.ts.map +1 -0
- package/dist/tools/token-metrics-tools.js +287 -0
- package/dist/tools/token-metrics-tools.js.map +1 -0
- package/dist/tools/vault-manage-tool.d.ts +7 -0
- package/dist/tools/vault-manage-tool.d.ts.map +1 -0
- package/dist/tools/vault-manage-tool.js +193 -0
- package/dist/tools/vault-manage-tool.js.map +1 -0
- package/dist/tools/vault-tools.d.ts +7 -0
- package/dist/tools/vault-tools.d.ts.map +1 -0
- package/dist/tools/vault-tools.js +348 -0
- package/dist/tools/vault-tools.js.map +1 -0
- package/dist/tools/workspace-registry-tools.d.ts +93 -0
- package/dist/tools/workspace-registry-tools.d.ts.map +1 -0
- package/dist/tools/workspace-registry-tools.js +217 -0
- package/dist/tools/workspace-registry-tools.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain Map Infrastructure — JSON-RPC Transport for LSP
|
|
3
|
+
*
|
|
4
|
+
* Implements the JSON-RPC 2.0 protocol over stdio for communicating
|
|
5
|
+
* with Language Server Protocol servers. Uses Content-Length framing
|
|
6
|
+
* as specified by the LSP base protocol.
|
|
7
|
+
*
|
|
8
|
+
* Architecture:
|
|
9
|
+
* - LspStdioTransport: Spawns process, handles Content-Length framing
|
|
10
|
+
* - GenericLspClient: High-level request/response with timeouts
|
|
11
|
+
* - Pure functions: encodeJsonRpcMessage, parseJsonRpcMessages (testable)
|
|
12
|
+
*
|
|
13
|
+
* SOLID: SRP — JSON-RPC transport only
|
|
14
|
+
* DDD: Infrastructure adapter for external process communication
|
|
15
|
+
*/
|
|
16
|
+
import { spawn } from "node:child_process";
|
|
17
|
+
import { EventEmitter } from "node:events";
|
|
18
|
+
// ── Content-Length Framing (Pure Functions) ────────────────────────────
|
|
19
|
+
/**
|
|
20
|
+
* Encode a JSON-RPC message with Content-Length header.
|
|
21
|
+
* LSP base protocol: "Content-Length: N\r\n\r\n{json}"
|
|
22
|
+
*
|
|
23
|
+
* @param message - The JSON-RPC message object
|
|
24
|
+
* @returns Buffer ready to write to stdin
|
|
25
|
+
*/
|
|
26
|
+
export function encodeJsonRpcMessage(message) {
|
|
27
|
+
const json = JSON.stringify(message);
|
|
28
|
+
const contentBytes = Buffer.from(json, "utf-8");
|
|
29
|
+
const header = `Content-Length: ${contentBytes.length}\r\n\r\n`;
|
|
30
|
+
return Buffer.concat([Buffer.from(header, "ascii"), contentBytes]);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parse complete JSON-RPC messages from a buffer.
|
|
34
|
+
* Handles the Content-Length framing protocol.
|
|
35
|
+
* Returns parsed messages and any remaining incomplete buffer.
|
|
36
|
+
*
|
|
37
|
+
* @param buffer - Accumulated data from stdout
|
|
38
|
+
* @returns Object with parsed messages and remaining buffer
|
|
39
|
+
*/
|
|
40
|
+
export function parseJsonRpcMessages(buffer) {
|
|
41
|
+
const messages = [];
|
|
42
|
+
let offset = 0;
|
|
43
|
+
while (offset < buffer.length) {
|
|
44
|
+
// Look for the header/body separator
|
|
45
|
+
const headerEnd = findHeaderEnd(buffer, offset);
|
|
46
|
+
if (headerEnd === -1) {
|
|
47
|
+
break; // Incomplete header
|
|
48
|
+
}
|
|
49
|
+
// Parse Content-Length from header
|
|
50
|
+
const headerStr = buffer.subarray(offset, headerEnd).toString("ascii");
|
|
51
|
+
const contentLength = parseContentLength(headerStr);
|
|
52
|
+
if (contentLength === -1) {
|
|
53
|
+
// Malformed header — skip to next potential header
|
|
54
|
+
offset = headerEnd + 4; // Skip past \r\n\r\n
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
// Check if we have the complete body
|
|
58
|
+
const bodyStart = headerEnd + 4; // After \r\n\r\n
|
|
59
|
+
const bodyEnd = bodyStart + contentLength;
|
|
60
|
+
if (bodyEnd > buffer.length) {
|
|
61
|
+
break; // Incomplete body
|
|
62
|
+
}
|
|
63
|
+
// Parse the JSON body
|
|
64
|
+
const bodyStr = buffer.subarray(bodyStart, bodyEnd).toString("utf-8");
|
|
65
|
+
try {
|
|
66
|
+
const message = JSON.parse(bodyStr);
|
|
67
|
+
messages.push(message);
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Malformed JSON — skip this message
|
|
71
|
+
}
|
|
72
|
+
offset = bodyEnd;
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
messages,
|
|
76
|
+
remaining: buffer.subarray(offset),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Find the end of the HTTP-style header (position of first \r\n\r\n).
|
|
81
|
+
* Returns the index of the first \r in \r\n\r\n, or -1 if not found.
|
|
82
|
+
*/
|
|
83
|
+
function findHeaderEnd(buffer, startOffset) {
|
|
84
|
+
for (let i = startOffset; i < buffer.length - 3; i++) {
|
|
85
|
+
if (buffer[i] === 0x0d && // \r
|
|
86
|
+
buffer[i + 1] === 0x0a && // \n
|
|
87
|
+
buffer[i + 2] === 0x0d && // \r
|
|
88
|
+
buffer[i + 3] === 0x0a // \n
|
|
89
|
+
) {
|
|
90
|
+
return i;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return -1;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Parse Content-Length value from a header string.
|
|
97
|
+
* @returns The content length, or -1 if not found/invalid
|
|
98
|
+
*/
|
|
99
|
+
export function parseContentLength(header) {
|
|
100
|
+
const match = header.match(/Content-Length:\s*(\d+)/i);
|
|
101
|
+
if (match === null) {
|
|
102
|
+
return -1;
|
|
103
|
+
}
|
|
104
|
+
const length = parseInt(match[1], 10);
|
|
105
|
+
return isNaN(length) ? -1 : length;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Low-level transport that spawns an LSP server process and
|
|
109
|
+
* communicates via Content-Length framed JSON-RPC over stdio.
|
|
110
|
+
*/
|
|
111
|
+
export class LspStdioTransport extends EventEmitter {
|
|
112
|
+
process = null;
|
|
113
|
+
buffer = Buffer.alloc(0);
|
|
114
|
+
/**
|
|
115
|
+
* Spawn the LSP server process.
|
|
116
|
+
* @param command - Server command (e.g., "typescript-language-server")
|
|
117
|
+
* @param args - Command arguments (e.g., ["--stdio"])
|
|
118
|
+
*/
|
|
119
|
+
spawn(command, args) {
|
|
120
|
+
if (this.process !== null) {
|
|
121
|
+
throw new Error("LspStdioTransport: process already spawned");
|
|
122
|
+
}
|
|
123
|
+
this.process = spawn(command, [...args], {
|
|
124
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
125
|
+
env: process.env,
|
|
126
|
+
});
|
|
127
|
+
this.process.stdout.on("data", (chunk) => {
|
|
128
|
+
this.buffer = Buffer.concat([this.buffer, chunk]);
|
|
129
|
+
this.drainBuffer();
|
|
130
|
+
});
|
|
131
|
+
this.process.stderr.on("data", (_chunk) => {
|
|
132
|
+
// LSP servers often write diagnostics to stderr — ignore
|
|
133
|
+
});
|
|
134
|
+
this.process.on("error", (err) => {
|
|
135
|
+
this.emit("error", err);
|
|
136
|
+
});
|
|
137
|
+
this.process.on("close", (code) => {
|
|
138
|
+
this.process = null;
|
|
139
|
+
this.emit("close", code);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/** Write a JSON-RPC message to the server's stdin. */
|
|
143
|
+
send(message) {
|
|
144
|
+
if (this.process === null || this.process.stdin === null) {
|
|
145
|
+
throw new Error("LspStdioTransport: no process running");
|
|
146
|
+
}
|
|
147
|
+
const encoded = encodeJsonRpcMessage(message);
|
|
148
|
+
this.process.stdin.write(encoded);
|
|
149
|
+
}
|
|
150
|
+
/** Kill the server process. */
|
|
151
|
+
kill() {
|
|
152
|
+
if (this.process !== null) {
|
|
153
|
+
this.process.kill("SIGTERM");
|
|
154
|
+
this.process = null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/** Whether the process is currently running. */
|
|
158
|
+
get isRunning() {
|
|
159
|
+
return this.process !== null;
|
|
160
|
+
}
|
|
161
|
+
/** Drain the buffer, parsing complete messages and emitting them. */
|
|
162
|
+
drainBuffer() {
|
|
163
|
+
const { messages, remaining } = parseJsonRpcMessages(this.buffer);
|
|
164
|
+
this.buffer = Buffer.from(remaining);
|
|
165
|
+
for (const msg of messages) {
|
|
166
|
+
this.emit("message", msg);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** Default request timeout in milliseconds. */
|
|
171
|
+
const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
|
|
172
|
+
/**
|
|
173
|
+
* High-level LSP client built on LspStdioTransport.
|
|
174
|
+
* Provides request/response correlation, timeouts, and lifecycle management.
|
|
175
|
+
*/
|
|
176
|
+
export class GenericLspClient {
|
|
177
|
+
transport;
|
|
178
|
+
pending = new Map();
|
|
179
|
+
nextId = 1;
|
|
180
|
+
timeoutMs;
|
|
181
|
+
initialized = false;
|
|
182
|
+
constructor(timeoutMs = DEFAULT_REQUEST_TIMEOUT_MS) {
|
|
183
|
+
this.transport = new LspStdioTransport();
|
|
184
|
+
this.timeoutMs = timeoutMs;
|
|
185
|
+
this.transport.on("message", (msg) => this.handleMessage(msg));
|
|
186
|
+
this.transport.on("close", () => {
|
|
187
|
+
// Reject all pending requests on process exit
|
|
188
|
+
for (const [id, pending] of this.pending) {
|
|
189
|
+
clearTimeout(pending.timer);
|
|
190
|
+
pending.reject(new Error(`LSP server exited with pending request ${id}`));
|
|
191
|
+
}
|
|
192
|
+
this.pending.clear();
|
|
193
|
+
});
|
|
194
|
+
this.transport.on("error", (err) => {
|
|
195
|
+
// Reject all pending requests on process error
|
|
196
|
+
for (const [id, pending] of this.pending) {
|
|
197
|
+
clearTimeout(pending.timer);
|
|
198
|
+
pending.reject(new Error(`LSP server error: ${err.message} (request ${id})`));
|
|
199
|
+
}
|
|
200
|
+
this.pending.clear();
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Spawn the LSP server and perform the initialize handshake.
|
|
205
|
+
* @param command - Server command
|
|
206
|
+
* @param args - Command arguments
|
|
207
|
+
* @param rootUri - Project root URI (file:// scheme)
|
|
208
|
+
* @param initializationOptions - Server-specific init options
|
|
209
|
+
*/
|
|
210
|
+
async start(command, args, rootUri, initializationOptions) {
|
|
211
|
+
this.transport.spawn(command, args);
|
|
212
|
+
const result = await this.sendRequest("initialize", {
|
|
213
|
+
processId: process.pid,
|
|
214
|
+
rootUri,
|
|
215
|
+
capabilities: {
|
|
216
|
+
textDocument: {
|
|
217
|
+
documentSymbol: { hierarchicalDocumentSymbolSupport: true },
|
|
218
|
+
references: {},
|
|
219
|
+
callHierarchy: {},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
initializationOptions,
|
|
223
|
+
});
|
|
224
|
+
// Send initialized notification (required by LSP protocol)
|
|
225
|
+
this.sendNotification("initialized", {});
|
|
226
|
+
this.initialized = true;
|
|
227
|
+
return result;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Gracefully shut down the LSP server.
|
|
231
|
+
* Sends shutdown request, then exit notification, then kills process.
|
|
232
|
+
*/
|
|
233
|
+
async shutdown() {
|
|
234
|
+
if (!this.transport.isRunning) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
try {
|
|
238
|
+
if (this.initialized) {
|
|
239
|
+
await this.sendRequest("shutdown", null);
|
|
240
|
+
this.sendNotification("exit", undefined);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
// Server may already be dead — that's fine
|
|
245
|
+
}
|
|
246
|
+
finally {
|
|
247
|
+
this.transport.kill();
|
|
248
|
+
this.initialized = false;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Send a JSON-RPC request and await the response.
|
|
253
|
+
* @param method - LSP method (e.g., "textDocument/documentSymbol")
|
|
254
|
+
* @param params - Method parameters
|
|
255
|
+
* @returns The result from the response
|
|
256
|
+
* @throws Error on timeout, server error, or process death
|
|
257
|
+
*/
|
|
258
|
+
sendRequest(method, params) {
|
|
259
|
+
const id = this.nextId++;
|
|
260
|
+
return new Promise((resolve, reject) => {
|
|
261
|
+
const timer = setTimeout(() => {
|
|
262
|
+
this.pending.delete(id);
|
|
263
|
+
reject(new Error(`LSP request "${method}" timed out after ${this.timeoutMs}ms`));
|
|
264
|
+
}, this.timeoutMs);
|
|
265
|
+
this.pending.set(id, { resolve, reject, timer });
|
|
266
|
+
const request = {
|
|
267
|
+
jsonrpc: "2.0",
|
|
268
|
+
id,
|
|
269
|
+
method,
|
|
270
|
+
params,
|
|
271
|
+
};
|
|
272
|
+
try {
|
|
273
|
+
this.transport.send(request);
|
|
274
|
+
}
|
|
275
|
+
catch (err) {
|
|
276
|
+
clearTimeout(timer);
|
|
277
|
+
this.pending.delete(id);
|
|
278
|
+
reject(err);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Send a JSON-RPC notification (no response expected).
|
|
284
|
+
* @param method - LSP method
|
|
285
|
+
* @param params - Method parameters
|
|
286
|
+
*/
|
|
287
|
+
sendNotification(method, params) {
|
|
288
|
+
const notification = {
|
|
289
|
+
jsonrpc: "2.0",
|
|
290
|
+
method,
|
|
291
|
+
params,
|
|
292
|
+
};
|
|
293
|
+
this.transport.send(notification);
|
|
294
|
+
}
|
|
295
|
+
/** Whether the client is connected and initialized. */
|
|
296
|
+
get isConnected() {
|
|
297
|
+
return this.transport.isRunning && this.initialized;
|
|
298
|
+
}
|
|
299
|
+
/** Handle an incoming JSON-RPC message from the server. */
|
|
300
|
+
handleMessage(msg) {
|
|
301
|
+
// Check if this is a response (has 'id' and either 'result' or 'error')
|
|
302
|
+
if ("id" in msg && typeof msg.id === "number") {
|
|
303
|
+
const pending = this.pending.get(msg.id);
|
|
304
|
+
if (pending === undefined) {
|
|
305
|
+
return; // Unknown response id — ignore
|
|
306
|
+
}
|
|
307
|
+
clearTimeout(pending.timer);
|
|
308
|
+
this.pending.delete(msg.id);
|
|
309
|
+
if ("error" in msg && msg.error !== undefined) {
|
|
310
|
+
const errMsg = msg.error;
|
|
311
|
+
pending.reject(new Error(`LSP error ${errMsg.code}: ${errMsg.message}`));
|
|
312
|
+
}
|
|
313
|
+
else if ("result" in msg) {
|
|
314
|
+
pending.resolve(msg.result);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
// Notifications from server (e.g., diagnostics) are ignored
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=lsp-json-rpc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-json-rpc.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-map/lsp-json-rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA+C3C,0EAA0E;AAE1E;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAuB;IAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,mBAAmB,YAAY,CAAC,MAAM,UAAU,CAAC;IAChE,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IAIjD,MAAM,QAAQ,GAAqB,EAAE,CAAC;IACtC,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,OAAO,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,qCAAqC;QACrC,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChD,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;YACrB,MAAM,CAAC,oBAAoB;QAC7B,CAAC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GAAG,EAAE,CAAC;gBAC3B,OAAO,CAAC,OAAO,CAAE,GAA8B,CAAC,MAAM,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QACD,4DAA4D;IAC9D,CAAC;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ProjectScannerPort } from "../../domain/domain-map/repositories.js";
|
|
2
|
+
import type { AnalysisConfig, LanguageId, ProjectScanResult, ScannedFile } from "../../domain/domain-map/value-objects.js";
|
|
3
|
+
/**
|
|
4
|
+
* Filesystem-based project scanner.
|
|
5
|
+
* Recursively walks the directory tree, filters by language and extension,
|
|
6
|
+
* and computes structural indicators for mode detection.
|
|
7
|
+
*/
|
|
8
|
+
export declare class FileProjectScanner implements ProjectScannerPort {
|
|
9
|
+
scanProject(directory: string, config: AnalysisConfig): Promise<ProjectScanResult>;
|
|
10
|
+
readFile(absolutePath: string): Promise<string | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Recursively walk a directory, collecting source files.
|
|
13
|
+
* Respects skip directories, skip extensions, and maxFiles limit.
|
|
14
|
+
*/
|
|
15
|
+
private walkDirectory;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Compute language distribution from scanned files.
|
|
19
|
+
* Returns a map of language → file count.
|
|
20
|
+
*/
|
|
21
|
+
export declare function computeLanguageDistribution(files: readonly ScannedFile[]): ReadonlyMap<string, number>;
|
|
22
|
+
/**
|
|
23
|
+
* Detect the primary language from language distribution.
|
|
24
|
+
* Returns the language with the most files.
|
|
25
|
+
*/
|
|
26
|
+
export declare function detectPrimaryLanguage(distribution: ReadonlyMap<string, number>): LanguageId;
|
|
27
|
+
/**
|
|
28
|
+
* Detect if the project has DDD directory structure.
|
|
29
|
+
* Checks if at least 2 of the greenfield indicator directories are present.
|
|
30
|
+
*/
|
|
31
|
+
export declare function detectDddStructure(files: readonly ScannedFile[]): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Detect if the project follows SOLID patterns.
|
|
34
|
+
* Heuristic: most files are under maxFileLines, indicating small focused files.
|
|
35
|
+
* Requires at least 80% of files to be within the line limit.
|
|
36
|
+
*/
|
|
37
|
+
export declare function detectSolidPatterns(files: readonly ScannedFile[], config: AnalysisConfig): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Compute the ratio of files exceeding the legacy threshold.
|
|
40
|
+
* Used for mode detection: high ratio → legacy mode.
|
|
41
|
+
*/
|
|
42
|
+
export declare function computeLargeFileRatio(files: readonly ScannedFile[], config: AnalysisConfig): number;
|
|
43
|
+
//# sourceMappingURL=project-scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-scanner.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-map/project-scanner.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,WAAW,EACZ,MAAM,0CAA0C,CAAC;AAUlD;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,kBAAkB;IACrD,WAAW,CACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,iBAAiB,CAAC;IAsBvB,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAQ5D;;;OAGG;YACW,aAAa;CA8D5B;AAID;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,SAAS,WAAW,EAAE,GAC5B,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAO7B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACxC,UAAU,CAYZ;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,OAAO,CAqBzE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,MAAM,EAAE,cAAc,GACrB,OAAO,CAST;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,MAAM,EAAE,cAAc,GACrB,MAAM,CASR"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain Map Infrastructure — Project Scanner
|
|
3
|
+
*
|
|
4
|
+
* Implements ProjectScannerPort using Node.js fs operations.
|
|
5
|
+
* Scans a project directory to discover source files, compute line counts,
|
|
6
|
+
* detect language distribution, and identify DDD/SOLID structure indicators.
|
|
7
|
+
*
|
|
8
|
+
* Used as the first step in both Path A (greenfield) and Path B (legacy).
|
|
9
|
+
*
|
|
10
|
+
* SOLID: SRP — project directory scanning only
|
|
11
|
+
* SOLID: DIP — implements domain ProjectScannerPort interface
|
|
12
|
+
* DDD: Infrastructure adapter for filesystem operations
|
|
13
|
+
*/
|
|
14
|
+
import { readdir, readFile, stat } from "node:fs/promises";
|
|
15
|
+
import { join, extname, relative } from "node:path";
|
|
16
|
+
import { LANGUAGE_EXTENSIONS, SCAN_SKIP_DIRECTORIES, SCAN_SKIP_EXTENSIONS, } from "../../domain/domain-map/value-objects.js";
|
|
17
|
+
import { GREENFIELD_INDICATORS } from "../../domain/domain-map/services.js";
|
|
18
|
+
// ── Project Scanner Implementation ────────────────────────────────────
|
|
19
|
+
/**
|
|
20
|
+
* Filesystem-based project scanner.
|
|
21
|
+
* Recursively walks the directory tree, filters by language and extension,
|
|
22
|
+
* and computes structural indicators for mode detection.
|
|
23
|
+
*/
|
|
24
|
+
export class FileProjectScanner {
|
|
25
|
+
async scanProject(directory, config) {
|
|
26
|
+
const files = [];
|
|
27
|
+
await this.walkDirectory(directory, directory, files, config.maxFiles);
|
|
28
|
+
const languageDistribution = computeLanguageDistribution(files);
|
|
29
|
+
const primaryLanguage = detectPrimaryLanguage(languageDistribution);
|
|
30
|
+
const hasDddStructure = detectDddStructure(files);
|
|
31
|
+
const hasSolidPatterns = detectSolidPatterns(files, config);
|
|
32
|
+
const largeFileRatio = computeLargeFileRatio(files, config);
|
|
33
|
+
return {
|
|
34
|
+
rootDir: directory,
|
|
35
|
+
files,
|
|
36
|
+
primaryLanguage,
|
|
37
|
+
languageDistribution,
|
|
38
|
+
hasDddStructure,
|
|
39
|
+
hasSolidPatterns,
|
|
40
|
+
largeFileRatio,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
async readFile(absolutePath) {
|
|
44
|
+
try {
|
|
45
|
+
return await readFile(absolutePath, "utf-8");
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Recursively walk a directory, collecting source files.
|
|
53
|
+
* Respects skip directories, skip extensions, and maxFiles limit.
|
|
54
|
+
*/
|
|
55
|
+
async walkDirectory(rootDir, currentDir, files, maxFiles) {
|
|
56
|
+
if (files.length >= maxFiles) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
let entries;
|
|
60
|
+
try {
|
|
61
|
+
entries = await readdir(currentDir, { withFileTypes: true });
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return; // Permission denied or other fs error
|
|
65
|
+
}
|
|
66
|
+
for (const entry of entries) {
|
|
67
|
+
if (files.length >= maxFiles) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const fullPath = join(currentDir, entry.name);
|
|
71
|
+
if (entry.isDirectory()) {
|
|
72
|
+
if (SCAN_SKIP_DIRECTORIES.has(entry.name)) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
await this.walkDirectory(rootDir, fullPath, files, maxFiles);
|
|
76
|
+
}
|
|
77
|
+
else if (entry.isFile()) {
|
|
78
|
+
const ext = extname(entry.name).toLowerCase();
|
|
79
|
+
// Skip binary/non-source extensions
|
|
80
|
+
if (SCAN_SKIP_EXTENSIONS.has(ext)) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
// Only include files with known language extensions
|
|
84
|
+
const language = LANGUAGE_EXTENSIONS.get(ext);
|
|
85
|
+
if (language === undefined) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const fileStat = await safeStatFile(fullPath);
|
|
89
|
+
if (fileStat === null) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const content = await this.readFile(fullPath);
|
|
93
|
+
const lineCount = content !== null ? content.split("\n").length : 0;
|
|
94
|
+
files.push({
|
|
95
|
+
absolutePath: fullPath,
|
|
96
|
+
relativePath: relative(rootDir, fullPath),
|
|
97
|
+
extension: ext,
|
|
98
|
+
language,
|
|
99
|
+
lineCount,
|
|
100
|
+
sizeBytes: fileStat.size,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// ── Helper Functions (Pure, Exported for Testing) ─────────────────────
|
|
107
|
+
/**
|
|
108
|
+
* Compute language distribution from scanned files.
|
|
109
|
+
* Returns a map of language → file count.
|
|
110
|
+
*/
|
|
111
|
+
export function computeLanguageDistribution(files) {
|
|
112
|
+
const dist = new Map();
|
|
113
|
+
for (const file of files) {
|
|
114
|
+
const count = dist.get(file.language) ?? 0;
|
|
115
|
+
dist.set(file.language, count + 1);
|
|
116
|
+
}
|
|
117
|
+
return dist;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Detect the primary language from language distribution.
|
|
121
|
+
* Returns the language with the most files.
|
|
122
|
+
*/
|
|
123
|
+
export function detectPrimaryLanguage(distribution) {
|
|
124
|
+
let maxCount = 0;
|
|
125
|
+
let primary = "typescript"; // default fallback
|
|
126
|
+
for (const [lang, count] of distribution) {
|
|
127
|
+
if (count > maxCount) {
|
|
128
|
+
maxCount = count;
|
|
129
|
+
primary = lang;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return primary;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Detect if the project has DDD directory structure.
|
|
136
|
+
* Checks if at least 2 of the greenfield indicator directories are present.
|
|
137
|
+
*/
|
|
138
|
+
export function detectDddStructure(files) {
|
|
139
|
+
const dirNames = new Set();
|
|
140
|
+
for (const file of files) {
|
|
141
|
+
const parts = file.relativePath
|
|
142
|
+
.replace(/\\/g, "/")
|
|
143
|
+
.toLowerCase()
|
|
144
|
+
.split("/");
|
|
145
|
+
for (const part of parts) {
|
|
146
|
+
dirNames.add(part);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
let matchCount = 0;
|
|
150
|
+
for (const indicator of GREENFIELD_INDICATORS) {
|
|
151
|
+
if (dirNames.has(indicator)) {
|
|
152
|
+
matchCount++;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// At least 2 DDD indicators present
|
|
156
|
+
return matchCount >= 2;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Detect if the project follows SOLID patterns.
|
|
160
|
+
* Heuristic: most files are under maxFileLines, indicating small focused files.
|
|
161
|
+
* Requires at least 80% of files to be within the line limit.
|
|
162
|
+
*/
|
|
163
|
+
export function detectSolidPatterns(files, config) {
|
|
164
|
+
if (files.length === 0) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
const smallFiles = files.filter((f) => f.lineCount <= config.maxFileLines);
|
|
168
|
+
const ratio = smallFiles.length / files.length;
|
|
169
|
+
return ratio >= 0.8;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Compute the ratio of files exceeding the legacy threshold.
|
|
173
|
+
* Used for mode detection: high ratio → legacy mode.
|
|
174
|
+
*/
|
|
175
|
+
export function computeLargeFileRatio(files, config) {
|
|
176
|
+
if (files.length === 0) {
|
|
177
|
+
return 0;
|
|
178
|
+
}
|
|
179
|
+
const largeFiles = files.filter((f) => f.lineCount > config.legacyThresholdLines);
|
|
180
|
+
return largeFiles.length / files.length;
|
|
181
|
+
}
|
|
182
|
+
// ── Private Helpers ───────────────────────────────────────────────────
|
|
183
|
+
/** Safely stat a file, returning null on error. */
|
|
184
|
+
async function safeStatFile(filePath) {
|
|
185
|
+
try {
|
|
186
|
+
const s = await stat(filePath);
|
|
187
|
+
return { size: s.size };
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=project-scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-scanner.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-map/project-scanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AASpD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,yEAAyE;AAEzE;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAC7B,KAAK,CAAC,WAAW,CACf,SAAiB,EACjB,MAAsB;QAEtB,MAAM,KAAK,GAAkB,EAAE,CAAC;QAEhC,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEvE,MAAM,oBAAoB,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAC;QAChE,MAAM,eAAe,GAAG,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;QACpE,MAAM,eAAe,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAClD,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,CA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AAU,mBAAmB,CACjC,KAA6B,EAC7B,MAAsB;IAEtB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC;IAC3E,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAE/C,OAAO,KAAK,IAAI,GAAG,CAAC;AACtB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAA6B,EAC7B,MAAsB;IAEtB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAC7B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,MAAM,CAAC,oBAAoB,CACjD,CAAC;IACF,OAAO,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;AAC1C,CAAC;AAED,yEAAyE;AAEzE,mDAAmD;AACnD,KAAK,UAAU,YAAY,CACzB,QAAgB;IAEhB,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/B,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite Environment Repository
|
|
3
|
+
*
|
|
4
|
+
* Implements EnvironmentRepository from the domain layer.
|
|
5
|
+
* Operates on the per-project database ({project}/.jarvis/jarvis.db).
|
|
6
|
+
*
|
|
7
|
+
* SOLID: SRP - persistence for Environment aggregate only
|
|
8
|
+
* SOLID: DIP - implements domain interface
|
|
9
|
+
*/
|
|
10
|
+
import type { SqliteAdapter } from "../database/sqlite-adapter.js";
|
|
11
|
+
import type { EnvironmentRepository } from "../../domain/environment/repositories.js";
|
|
12
|
+
import { Environment } from "../../domain/environment/entities.js";
|
|
13
|
+
import { EnvironmentId, EnvironmentName } from "../../domain/environment/value-objects.js";
|
|
14
|
+
import type { EnvironmentStatus } from "../../domain/environment/value-objects.js";
|
|
15
|
+
import { WorkspaceId } from "../../domain/shared/value-objects.js";
|
|
16
|
+
export declare class SqliteEnvironmentRepository implements EnvironmentRepository {
|
|
17
|
+
private readonly db;
|
|
18
|
+
private readonly workspaceId;
|
|
19
|
+
constructor(db: SqliteAdapter, workspaceId: WorkspaceId);
|
|
20
|
+
save(environment: Environment): Promise<void>;
|
|
21
|
+
findById(id: EnvironmentId): Promise<Environment | null>;
|
|
22
|
+
findByName(name: EnvironmentName): Promise<Environment | null>;
|
|
23
|
+
findByWorkspace(workspaceId: WorkspaceId): Promise<readonly Environment[]>;
|
|
24
|
+
findByStatus(workspaceId: WorkspaceId, status: EnvironmentStatus): Promise<readonly Environment[]>;
|
|
25
|
+
findByCard(cardId: string): Promise<readonly Environment[]>;
|
|
26
|
+
findActive(workspaceId: WorkspaceId): Promise<readonly Environment[]>;
|
|
27
|
+
delete(id: EnvironmentId): Promise<void>;
|
|
28
|
+
exists(id: EnvironmentId): Promise<boolean>;
|
|
29
|
+
existsByName(name: EnvironmentName): Promise<boolean>;
|
|
30
|
+
nextSequence(workspaceId: WorkspaceId): Promise<number>;
|
|
31
|
+
private toEntity;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=environment-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-repository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/environment/environment-repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,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