@timmeck/brain 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/BRAIN_PLAN.md +3324 -0
- package/LICENSE +21 -0
- package/README.md +188 -0
- package/dist/brain.d.ts +11 -0
- package/dist/brain.js +166 -0
- package/dist/brain.js.map +1 -0
- package/dist/cli/commands/dashboard.d.ts +2 -0
- package/dist/cli/commands/dashboard.js +457 -0
- package/dist/cli/commands/dashboard.js.map +1 -0
- package/dist/cli/commands/export.d.ts +2 -0
- package/dist/cli/commands/export.js +25 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/import.d.ts +2 -0
- package/dist/cli/commands/import.js +173 -0
- package/dist/cli/commands/import.js.map +1 -0
- package/dist/cli/commands/insights.d.ts +2 -0
- package/dist/cli/commands/insights.js +32 -0
- package/dist/cli/commands/insights.js.map +1 -0
- package/dist/cli/commands/modules.d.ts +2 -0
- package/dist/cli/commands/modules.js +29 -0
- package/dist/cli/commands/modules.js.map +1 -0
- package/dist/cli/commands/network.d.ts +2 -0
- package/dist/cli/commands/network.js +56 -0
- package/dist/cli/commands/network.js.map +1 -0
- package/dist/cli/commands/query.d.ts +2 -0
- package/dist/cli/commands/query.js +40 -0
- package/dist/cli/commands/query.js.map +1 -0
- package/dist/cli/commands/start.d.ts +2 -0
- package/dist/cli/commands/start.js +56 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/status.d.ts +2 -0
- package/dist/cli/commands/status.js +60 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/stop.d.ts +2 -0
- package/dist/cli/commands/stop.js +34 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/ipc-helper.d.ts +2 -0
- package/dist/cli/ipc-helper.js +25 -0
- package/dist/cli/ipc-helper.js.map +1 -0
- package/dist/code/analyzer.d.ts +12 -0
- package/dist/code/analyzer.js +58 -0
- package/dist/code/analyzer.js.map +1 -0
- package/dist/code/fingerprint.d.ts +2 -0
- package/dist/code/fingerprint.js +84 -0
- package/dist/code/fingerprint.js.map +1 -0
- package/dist/code/matcher.d.ts +9 -0
- package/dist/code/matcher.js +37 -0
- package/dist/code/matcher.js.map +1 -0
- package/dist/code/parsers/generic.d.ts +7 -0
- package/dist/code/parsers/generic.js +22 -0
- package/dist/code/parsers/generic.js.map +1 -0
- package/dist/code/parsers/python.d.ts +7 -0
- package/dist/code/parsers/python.js +45 -0
- package/dist/code/parsers/python.js.map +1 -0
- package/dist/code/parsers/typescript.d.ts +7 -0
- package/dist/code/parsers/typescript.js +58 -0
- package/dist/code/parsers/typescript.js.map +1 -0
- package/dist/code/registry.d.ts +22 -0
- package/dist/code/registry.js +31 -0
- package/dist/code/registry.js.map +1 -0
- package/dist/code/scorer.d.ts +15 -0
- package/dist/code/scorer.js +103 -0
- package/dist/code/scorer.js.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +110 -0
- package/dist/config.js.map +1 -0
- package/dist/db/connection.d.ts +2 -0
- package/dist/db/connection.js +19 -0
- package/dist/db/connection.js.map +1 -0
- package/dist/db/migrations/001_core_schema.d.ts +2 -0
- package/dist/db/migrations/001_core_schema.js +119 -0
- package/dist/db/migrations/001_core_schema.js.map +1 -0
- package/dist/db/migrations/002_learning_schema.d.ts +2 -0
- package/dist/db/migrations/002_learning_schema.js +37 -0
- package/dist/db/migrations/002_learning_schema.js.map +1 -0
- package/dist/db/migrations/003_code_schema.d.ts +2 -0
- package/dist/db/migrations/003_code_schema.js +52 -0
- package/dist/db/migrations/003_code_schema.js.map +1 -0
- package/dist/db/migrations/004_synapses_schema.d.ts +2 -0
- package/dist/db/migrations/004_synapses_schema.js +56 -0
- package/dist/db/migrations/004_synapses_schema.js.map +1 -0
- package/dist/db/migrations/005_fts_indexes.d.ts +2 -0
- package/dist/db/migrations/005_fts_indexes.js +77 -0
- package/dist/db/migrations/005_fts_indexes.js.map +1 -0
- package/dist/db/migrations/006_synapses_phase3.d.ts +2 -0
- package/dist/db/migrations/006_synapses_phase3.js +14 -0
- package/dist/db/migrations/006_synapses_phase3.js.map +1 -0
- package/dist/db/migrations/index.d.ts +2 -0
- package/dist/db/migrations/index.js +49 -0
- package/dist/db/migrations/index.js.map +1 -0
- package/dist/db/repositories/antipattern.repository.d.ts +26 -0
- package/dist/db/repositories/antipattern.repository.js +44 -0
- package/dist/db/repositories/antipattern.repository.js.map +1 -0
- package/dist/db/repositories/code-module.repository.d.ts +19 -0
- package/dist/db/repositories/code-module.repository.js +64 -0
- package/dist/db/repositories/code-module.repository.js.map +1 -0
- package/dist/db/repositories/error.repository.d.ts +20 -0
- package/dist/db/repositories/error.repository.js +134 -0
- package/dist/db/repositories/error.repository.js.map +1 -0
- package/dist/db/repositories/insight.repository.d.ts +18 -0
- package/dist/db/repositories/insight.repository.js +57 -0
- package/dist/db/repositories/insight.repository.js.map +1 -0
- package/dist/db/repositories/notification.repository.d.ts +24 -0
- package/dist/db/repositories/notification.repository.js +40 -0
- package/dist/db/repositories/notification.repository.js.map +1 -0
- package/dist/db/repositories/project.repository.d.ts +25 -0
- package/dist/db/repositories/project.repository.js +72 -0
- package/dist/db/repositories/project.repository.js.map +1 -0
- package/dist/db/repositories/rule.repository.d.ts +31 -0
- package/dist/db/repositories/rule.repository.js +81 -0
- package/dist/db/repositories/rule.repository.js.map +1 -0
- package/dist/db/repositories/solution.repository.d.ts +27 -0
- package/dist/db/repositories/solution.repository.js +132 -0
- package/dist/db/repositories/solution.repository.js.map +1 -0
- package/dist/db/repositories/synapse.repository.d.ts +25 -0
- package/dist/db/repositories/synapse.repository.js +115 -0
- package/dist/db/repositories/synapse.repository.js.map +1 -0
- package/dist/db/repositories/terminal.repository.d.ts +27 -0
- package/dist/db/repositories/terminal.repository.js +78 -0
- package/dist/db/repositories/terminal.repository.js.map +1 -0
- package/dist/hooks/post-tool-use.d.ts +2 -0
- package/dist/hooks/post-tool-use.js +77 -0
- package/dist/hooks/post-tool-use.js.map +1 -0
- package/dist/hooks/post-write.d.ts +2 -0
- package/dist/hooks/post-write.js +102 -0
- package/dist/hooks/post-write.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/ipc/client.d.ts +16 -0
- package/dist/ipc/client.js +101 -0
- package/dist/ipc/client.js.map +1 -0
- package/dist/ipc/protocol.d.ts +8 -0
- package/dist/ipc/protocol.js +29 -0
- package/dist/ipc/protocol.js.map +1 -0
- package/dist/ipc/router.d.ts +28 -0
- package/dist/ipc/router.js +70 -0
- package/dist/ipc/router.js.map +1 -0
- package/dist/ipc/server.d.ts +14 -0
- package/dist/ipc/server.js +98 -0
- package/dist/ipc/server.js.map +1 -0
- package/dist/learning/confidence-scorer.d.ts +13 -0
- package/dist/learning/confidence-scorer.js +35 -0
- package/dist/learning/confidence-scorer.js.map +1 -0
- package/dist/learning/decay.d.ts +13 -0
- package/dist/learning/decay.js +37 -0
- package/dist/learning/decay.js.map +1 -0
- package/dist/learning/learning-engine.d.ts +30 -0
- package/dist/learning/learning-engine.js +121 -0
- package/dist/learning/learning-engine.js.map +1 -0
- package/dist/learning/pattern-extractor.d.ts +16 -0
- package/dist/learning/pattern-extractor.js +61 -0
- package/dist/learning/pattern-extractor.js.map +1 -0
- package/dist/learning/rule-generator.d.ts +18 -0
- package/dist/learning/rule-generator.js +50 -0
- package/dist/learning/rule-generator.js.map +1 -0
- package/dist/matching/error-matcher.d.ts +13 -0
- package/dist/matching/error-matcher.js +84 -0
- package/dist/matching/error-matcher.js.map +1 -0
- package/dist/matching/fingerprint.d.ts +3 -0
- package/dist/matching/fingerprint.js +23 -0
- package/dist/matching/fingerprint.js.map +1 -0
- package/dist/matching/similarity.d.ts +3 -0
- package/dist/matching/similarity.js +53 -0
- package/dist/matching/similarity.js.map +1 -0
- package/dist/matching/tfidf.d.ts +15 -0
- package/dist/matching/tfidf.js +68 -0
- package/dist/matching/tfidf.js.map +1 -0
- package/dist/matching/tokenizer.d.ts +4 -0
- package/dist/matching/tokenizer.js +36 -0
- package/dist/matching/tokenizer.js.map +1 -0
- package/dist/mcp/auto-detect.d.ts +1 -0
- package/dist/mcp/auto-detect.js +81 -0
- package/dist/mcp/auto-detect.js.map +1 -0
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.js +68 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +3 -0
- package/dist/mcp/tools.js +201 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/parsing/error-parser.d.ts +3 -0
- package/dist/parsing/error-parser.js +26 -0
- package/dist/parsing/error-parser.js.map +1 -0
- package/dist/parsing/parsers/compiler.d.ts +2 -0
- package/dist/parsing/parsers/compiler.js +83 -0
- package/dist/parsing/parsers/compiler.js.map +1 -0
- package/dist/parsing/parsers/generic.d.ts +2 -0
- package/dist/parsing/parsers/generic.js +23 -0
- package/dist/parsing/parsers/generic.js.map +1 -0
- package/dist/parsing/parsers/go.d.ts +2 -0
- package/dist/parsing/parsers/go.js +85 -0
- package/dist/parsing/parsers/go.js.map +1 -0
- package/dist/parsing/parsers/node.d.ts +2 -0
- package/dist/parsing/parsers/node.js +61 -0
- package/dist/parsing/parsers/node.js.map +1 -0
- package/dist/parsing/parsers/python.d.ts +2 -0
- package/dist/parsing/parsers/python.js +50 -0
- package/dist/parsing/parsers/python.js.map +1 -0
- package/dist/parsing/parsers/rust.d.ts +2 -0
- package/dist/parsing/parsers/rust.js +43 -0
- package/dist/parsing/parsers/rust.js.map +1 -0
- package/dist/parsing/parsers/shell.d.ts +2 -0
- package/dist/parsing/parsers/shell.js +36 -0
- package/dist/parsing/parsers/shell.js.map +1 -0
- package/dist/parsing/types.d.ts +28 -0
- package/dist/parsing/types.js +21 -0
- package/dist/parsing/types.js.map +1 -0
- package/dist/research/gap-analyzer.d.ts +23 -0
- package/dist/research/gap-analyzer.js +119 -0
- package/dist/research/gap-analyzer.js.map +1 -0
- package/dist/research/insight-generator.d.ts +23 -0
- package/dist/research/insight-generator.js +107 -0
- package/dist/research/insight-generator.js.map +1 -0
- package/dist/research/research-engine.d.ts +31 -0
- package/dist/research/research-engine.js +97 -0
- package/dist/research/research-engine.js.map +1 -0
- package/dist/research/synergy-detector.d.ts +24 -0
- package/dist/research/synergy-detector.js +109 -0
- package/dist/research/synergy-detector.js.map +1 -0
- package/dist/research/template-extractor.d.ts +18 -0
- package/dist/research/template-extractor.js +116 -0
- package/dist/research/template-extractor.js.map +1 -0
- package/dist/research/trend-analyzer.d.ts +20 -0
- package/dist/research/trend-analyzer.js +111 -0
- package/dist/research/trend-analyzer.js.map +1 -0
- package/dist/services/analytics.service.d.ts +52 -0
- package/dist/services/analytics.service.js +59 -0
- package/dist/services/analytics.service.js.map +1 -0
- package/dist/services/code.service.d.ts +39 -0
- package/dist/services/code.service.js +98 -0
- package/dist/services/code.service.js.map +1 -0
- package/dist/services/error.service.d.ts +35 -0
- package/dist/services/error.service.js +118 -0
- package/dist/services/error.service.js.map +1 -0
- package/dist/services/notification.service.d.ts +17 -0
- package/dist/services/notification.service.js +29 -0
- package/dist/services/notification.service.js.map +1 -0
- package/dist/services/prevention.service.d.ts +35 -0
- package/dist/services/prevention.service.js +82 -0
- package/dist/services/prevention.service.js.map +1 -0
- package/dist/services/research.service.d.ts +35 -0
- package/dist/services/research.service.js +60 -0
- package/dist/services/research.service.js.map +1 -0
- package/dist/services/solution.service.d.ts +30 -0
- package/dist/services/solution.service.js +73 -0
- package/dist/services/solution.service.js.map +1 -0
- package/dist/services/synapse.service.d.ts +30 -0
- package/dist/services/synapse.service.js +25 -0
- package/dist/services/synapse.service.js.map +1 -0
- package/dist/services/terminal.service.d.ts +20 -0
- package/dist/services/terminal.service.js +66 -0
- package/dist/services/terminal.service.js.map +1 -0
- package/dist/synapses/activation.d.ts +13 -0
- package/dist/synapses/activation.js +50 -0
- package/dist/synapses/activation.js.map +1 -0
- package/dist/synapses/decay.d.ts +11 -0
- package/dist/synapses/decay.js +27 -0
- package/dist/synapses/decay.js.map +1 -0
- package/dist/synapses/hebbian.d.ts +13 -0
- package/dist/synapses/hebbian.js +36 -0
- package/dist/synapses/hebbian.js.map +1 -0
- package/dist/synapses/pathfinder.d.ts +14 -0
- package/dist/synapses/pathfinder.js +50 -0
- package/dist/synapses/pathfinder.js.map +1 -0
- package/dist/synapses/synapse-manager.d.ts +30 -0
- package/dist/synapses/synapse-manager.js +72 -0
- package/dist/synapses/synapse-manager.js.map +1 -0
- package/dist/types/code.types.d.ts +47 -0
- package/dist/types/code.types.js +2 -0
- package/dist/types/code.types.js.map +1 -0
- package/dist/types/config.types.d.ts +70 -0
- package/dist/types/config.types.js +2 -0
- package/dist/types/config.types.js.map +1 -0
- package/dist/types/error.types.d.ts +60 -0
- package/dist/types/error.types.js +2 -0
- package/dist/types/error.types.js.map +1 -0
- package/dist/types/ipc.types.d.ts +11 -0
- package/dist/types/ipc.types.js +2 -0
- package/dist/types/ipc.types.js.map +1 -0
- package/dist/types/mcp.types.d.ts +46 -0
- package/dist/types/mcp.types.js +2 -0
- package/dist/types/mcp.types.js.map +1 -0
- package/dist/types/research.types.d.ts +25 -0
- package/dist/types/research.types.js +2 -0
- package/dist/types/research.types.js.map +1 -0
- package/dist/types/solution.types.d.ts +28 -0
- package/dist/types/solution.types.js +2 -0
- package/dist/types/solution.types.js.map +1 -0
- package/dist/types/synapse.types.d.ts +37 -0
- package/dist/types/synapse.types.js +2 -0
- package/dist/types/synapse.types.js.map +1 -0
- package/dist/utils/events.d.ts +59 -0
- package/dist/utils/events.js +23 -0
- package/dist/utils/events.js.map +1 -0
- package/dist/utils/hash.d.ts +1 -0
- package/dist/utils/hash.js +5 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/logger.js +39 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/paths.d.ts +3 -0
- package/dist/utils/paths.js +18 -0
- package/dist/utils/paths.js.map +1 -0
- package/package.json +43 -0
- package/src/brain.ts +220 -0
- package/src/cli/commands/dashboard.ts +495 -0
- package/src/cli/commands/export.ts +27 -0
- package/src/cli/commands/import.ts +190 -0
- package/src/cli/commands/insights.ts +33 -0
- package/src/cli/commands/modules.ts +30 -0
- package/src/cli/commands/network.ts +61 -0
- package/src/cli/commands/query.ts +43 -0
- package/src/cli/commands/start.ts +59 -0
- package/src/cli/commands/status.ts +69 -0
- package/src/cli/commands/stop.ts +33 -0
- package/src/cli/ipc-helper.ts +21 -0
- package/src/code/analyzer.ts +77 -0
- package/src/code/fingerprint.ts +87 -0
- package/src/code/matcher.ts +64 -0
- package/src/code/parsers/generic.ts +29 -0
- package/src/code/parsers/python.ts +54 -0
- package/src/code/parsers/typescript.ts +65 -0
- package/src/code/registry.ts +60 -0
- package/src/code/scorer.ts +108 -0
- package/src/config.ts +111 -0
- package/src/db/connection.ts +22 -0
- package/src/db/migrations/001_core_schema.ts +120 -0
- package/src/db/migrations/002_learning_schema.ts +38 -0
- package/src/db/migrations/003_code_schema.ts +53 -0
- package/src/db/migrations/004_synapses_schema.ts +57 -0
- package/src/db/migrations/005_fts_indexes.ts +78 -0
- package/src/db/migrations/006_synapses_phase3.ts +17 -0
- package/src/db/migrations/index.ts +64 -0
- package/src/db/repositories/antipattern.repository.ts +66 -0
- package/src/db/repositories/code-module.repository.ts +80 -0
- package/src/db/repositories/error.repository.ts +149 -0
- package/src/db/repositories/insight.repository.ts +78 -0
- package/src/db/repositories/notification.repository.ts +66 -0
- package/src/db/repositories/project.repository.ts +93 -0
- package/src/db/repositories/rule.repository.ts +108 -0
- package/src/db/repositories/solution.repository.ts +154 -0
- package/src/db/repositories/synapse.repository.ts +153 -0
- package/src/db/repositories/terminal.repository.ts +101 -0
- package/src/hooks/post-tool-use.ts +90 -0
- package/src/hooks/post-write.ts +117 -0
- package/src/index.ts +53 -0
- package/src/ipc/client.ts +118 -0
- package/src/ipc/protocol.ts +35 -0
- package/src/ipc/router.ts +106 -0
- package/src/ipc/server.ts +110 -0
- package/src/learning/confidence-scorer.ts +47 -0
- package/src/learning/decay.ts +46 -0
- package/src/learning/learning-engine.ts +162 -0
- package/src/learning/pattern-extractor.ts +90 -0
- package/src/learning/rule-generator.ts +74 -0
- package/src/main.rs:10:5 +0 -0
- package/src/matching/error-matcher.ts +115 -0
- package/src/matching/fingerprint.ts +29 -0
- package/src/matching/similarity.ts +61 -0
- package/src/matching/tfidf.ts +74 -0
- package/src/matching/tokenizer.ts +41 -0
- package/src/mcp/auto-detect.ts +93 -0
- package/src/mcp/server.ts +73 -0
- package/src/mcp/tools.ts +290 -0
- package/src/parsing/error-parser.ts +28 -0
- package/src/parsing/parsers/compiler.ts +93 -0
- package/src/parsing/parsers/generic.ts +28 -0
- package/src/parsing/parsers/go.ts +97 -0
- package/src/parsing/parsers/node.ts +69 -0
- package/src/parsing/parsers/python.ts +62 -0
- package/src/parsing/parsers/rust.ts +50 -0
- package/src/parsing/parsers/shell.ts +42 -0
- package/src/parsing/types.ts +47 -0
- package/src/research/gap-analyzer.ts +135 -0
- package/src/research/insight-generator.ts +123 -0
- package/src/research/research-engine.ts +116 -0
- package/src/research/synergy-detector.ts +126 -0
- package/src/research/template-extractor.ts +130 -0
- package/src/research/trend-analyzer.ts +127 -0
- package/src/services/analytics.service.ts +87 -0
- package/src/services/code.service.ts +140 -0
- package/src/services/error.service.ts +164 -0
- package/src/services/notification.service.ts +41 -0
- package/src/services/prevention.service.ts +119 -0
- package/src/services/research.service.ts +93 -0
- package/src/services/solution.service.ts +116 -0
- package/src/services/synapse.service.ts +59 -0
- package/src/services/terminal.service.ts +81 -0
- package/src/synapses/activation.ts +80 -0
- package/src/synapses/decay.ts +38 -0
- package/src/synapses/hebbian.ts +69 -0
- package/src/synapses/pathfinder.ts +81 -0
- package/src/synapses/synapse-manager.ts +109 -0
- package/src/types/code.types.ts +52 -0
- package/src/types/config.types.ts +79 -0
- package/src/types/error.types.ts +67 -0
- package/src/types/ipc.types.ts +8 -0
- package/src/types/mcp.types.ts +53 -0
- package/src/types/research.types.ts +28 -0
- package/src/types/solution.types.ts +30 -0
- package/src/types/synapse.types.ts +49 -0
- package/src/utils/events.ts +45 -0
- package/src/utils/hash.ts +5 -0
- package/src/utils/logger.ts +48 -0
- package/src/utils/paths.ts +19 -0
- package/tests/fixtures/code-modules/modules.ts +83 -0
- package/tests/fixtures/errors/go.ts +9 -0
- package/tests/fixtures/errors/node.ts +24 -0
- package/tests/fixtures/errors/python.ts +21 -0
- package/tests/fixtures/errors/rust.ts +25 -0
- package/tests/fixtures/errors/shell.ts +15 -0
- package/tests/fixtures/solutions/solutions.ts +27 -0
- package/tests/helpers/setup-db.ts +52 -0
- package/tests/integration/code-flow.test.ts +86 -0
- package/tests/integration/error-flow.test.ts +83 -0
- package/tests/integration/ipc-flow.test.ts +166 -0
- package/tests/integration/learning-cycle.test.ts +82 -0
- package/tests/integration/synapse-flow.test.ts +117 -0
- package/tests/unit/code/analyzer.test.ts +58 -0
- package/tests/unit/code/fingerprint.test.ts +51 -0
- package/tests/unit/code/scorer.test.ts +55 -0
- package/tests/unit/learning/confidence-scorer.test.ts +60 -0
- package/tests/unit/learning/decay.test.ts +45 -0
- package/tests/unit/learning/pattern-extractor.test.ts +50 -0
- package/tests/unit/matching/error-matcher.test.ts +69 -0
- package/tests/unit/matching/fingerprint.test.ts +47 -0
- package/tests/unit/matching/similarity.test.ts +65 -0
- package/tests/unit/matching/tfidf.test.ts +71 -0
- package/tests/unit/matching/tokenizer.test.ts +83 -0
- package/tests/unit/parsing/parsers.test.ts +113 -0
- package/tests/unit/research/gap-analyzer.test.ts +45 -0
- package/tests/unit/research/trend-analyzer.test.ts +45 -0
- package/tests/unit/synapses/activation.test.ts +80 -0
- package/tests/unit/synapses/decay.test.ts +27 -0
- package/tests/unit/synapses/hebbian.test.ts +96 -0
- package/tests/unit/synapses/pathfinder.test.ts +72 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
const GCC_RE = /^(.+?):(\d+):(\d+): (error|warning|fatal error): (.+)/m;
|
|
3
|
+
const JAVAC_RE = /^(.+\.java):(\d+): error: (.+)/m;
|
|
4
|
+
const GENERIC_COMPILER_RE = /^(.+?):(\d+)(?::(\d+))?: (?:error|fatal): (.+)/m;
|
|
5
|
+
export const compilerParser = {
|
|
6
|
+
name: 'compiler',
|
|
7
|
+
priority: 7,
|
|
8
|
+
canParse(input) {
|
|
9
|
+
return (GCC_RE.test(input) ||
|
|
10
|
+
JAVAC_RE.test(input) ||
|
|
11
|
+
/compilation failed|fatal error:/.test(input));
|
|
12
|
+
},
|
|
13
|
+
parse(input) {
|
|
14
|
+
let gccMatch = GCC_RE.exec(input);
|
|
15
|
+
if (gccMatch) {
|
|
16
|
+
const filePath = gccMatch[1];
|
|
17
|
+
const frame = {
|
|
18
|
+
function_name: null,
|
|
19
|
+
file_path: filePath,
|
|
20
|
+
line_number: parseInt(gccMatch[2], 10),
|
|
21
|
+
column_number: parseInt(gccMatch[3], 10),
|
|
22
|
+
normalized: `<compiler>@${path.basename(filePath)}`,
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
errorType: gccMatch[4] === 'warning' ? 'CompilerWarning' : 'CompilerError',
|
|
26
|
+
message: gccMatch[5],
|
|
27
|
+
stackTrace: input,
|
|
28
|
+
frames: [frame],
|
|
29
|
+
sourceFile: filePath,
|
|
30
|
+
sourceLine: frame.line_number,
|
|
31
|
+
language: detectLanguage(filePath),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const javacMatch = JAVAC_RE.exec(input);
|
|
35
|
+
if (javacMatch) {
|
|
36
|
+
const filePath = javacMatch[1];
|
|
37
|
+
return {
|
|
38
|
+
errorType: 'CompilerError',
|
|
39
|
+
message: javacMatch[3],
|
|
40
|
+
stackTrace: input,
|
|
41
|
+
frames: [{
|
|
42
|
+
function_name: null,
|
|
43
|
+
file_path: filePath,
|
|
44
|
+
line_number: parseInt(javacMatch[2], 10),
|
|
45
|
+
column_number: null,
|
|
46
|
+
normalized: `<compiler>@${path.basename(filePath)}`,
|
|
47
|
+
}],
|
|
48
|
+
sourceFile: filePath,
|
|
49
|
+
sourceLine: parseInt(javacMatch[2], 10),
|
|
50
|
+
language: 'java',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const genericMatch = GENERIC_COMPILER_RE.exec(input);
|
|
54
|
+
if (genericMatch) {
|
|
55
|
+
const filePath = genericMatch[1];
|
|
56
|
+
return {
|
|
57
|
+
errorType: 'CompilerError',
|
|
58
|
+
message: genericMatch[4],
|
|
59
|
+
stackTrace: input,
|
|
60
|
+
frames: [{
|
|
61
|
+
function_name: null,
|
|
62
|
+
file_path: filePath,
|
|
63
|
+
line_number: parseInt(genericMatch[2], 10),
|
|
64
|
+
column_number: genericMatch[3] ? parseInt(genericMatch[3], 10) : null,
|
|
65
|
+
normalized: `<compiler>@${path.basename(filePath)}`,
|
|
66
|
+
}],
|
|
67
|
+
sourceFile: filePath,
|
|
68
|
+
sourceLine: parseInt(genericMatch[2], 10),
|
|
69
|
+
language: detectLanguage(filePath),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
function detectLanguage(filePath) {
|
|
76
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
77
|
+
const map = {
|
|
78
|
+
'.c': 'c', '.h': 'c', '.cpp': 'cpp', '.cc': 'cpp', '.cxx': 'cpp',
|
|
79
|
+
'.java': 'java', '.rs': 'rust', '.go': 'go', '.swift': 'swift',
|
|
80
|
+
};
|
|
81
|
+
return map[ext] ?? 'unknown';
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.js","sourceRoot":"","sources":["../../../src/parsing/parsers/compiler.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,MAAM,GAAG,wDAAwD,CAAC;AAC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CAAC,QAAQ,CAAC,EAAE;qBACpD,CAAC;gBACF,UAAU,EAAE,QAAQ;gBACpB,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC;gBAC1C,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC;aACnC,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;AAEF,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;IACjD,MAAM,GAAG,GAA2B;QAClC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK;QAChE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO;KAC/D,CAAC;IACF,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const ERROR_LINE_RE = /(?:error|Error|ERROR)[\s:]+(.+)/;
|
|
2
|
+
export const genericParser = {
|
|
3
|
+
name: 'generic',
|
|
4
|
+
priority: 0,
|
|
5
|
+
canParse(_input) {
|
|
6
|
+
return true;
|
|
7
|
+
},
|
|
8
|
+
parse(input) {
|
|
9
|
+
const match = ERROR_LINE_RE.exec(input);
|
|
10
|
+
const firstLine = input.trim().split('\n')[0] ?? input;
|
|
11
|
+
const message = match ? match[1] : firstLine;
|
|
12
|
+
return {
|
|
13
|
+
errorType: 'UnknownError',
|
|
14
|
+
message: message.trim(),
|
|
15
|
+
stackTrace: null,
|
|
16
|
+
frames: [],
|
|
17
|
+
sourceFile: null,
|
|
18
|
+
sourceLine: null,
|
|
19
|
+
language: null,
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=generic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../../../src/parsing/parsers/generic.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,iCAAiC,CAAC;AAExD,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,CAAC;IAEX,QAAQ,CAAC,MAAc;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,KAAa;QACjB,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;QACvD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAE9C,OAAO;YACL,SAAS,EAAE,cAAc;YACzB,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE;YACvB,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,EAAE;YACV,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,IAAI;SACf,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
const GO_FILE_ERROR_RE = /^\.?\/?(.+\.go):(\d+):(\d+): (.+)/m;
|
|
3
|
+
const GO_PANIC_RE = /^panic: (.+)/m;
|
|
4
|
+
const GO_GOROUTINE_RE = /^goroutine \d+ \[.+\]:/m;
|
|
5
|
+
const GO_STACK_RE = /^\t(.+\.go):(\d+)/gm;
|
|
6
|
+
const GO_FUNC_RE = /^(.+)\(.*\)$/gm;
|
|
7
|
+
export const goParser = {
|
|
8
|
+
name: 'go',
|
|
9
|
+
priority: 10,
|
|
10
|
+
canParse(input) {
|
|
11
|
+
return (GO_FILE_ERROR_RE.test(input) ||
|
|
12
|
+
GO_PANIC_RE.test(input) ||
|
|
13
|
+
/^fatal error:/.test(input));
|
|
14
|
+
},
|
|
15
|
+
parse(input) {
|
|
16
|
+
const panicMatch = GO_PANIC_RE.exec(input);
|
|
17
|
+
if (panicMatch) {
|
|
18
|
+
return parsePanic(input, panicMatch[1]);
|
|
19
|
+
}
|
|
20
|
+
const fileMatch = GO_FILE_ERROR_RE.exec(input);
|
|
21
|
+
if (fileMatch) {
|
|
22
|
+
return {
|
|
23
|
+
errorType: 'CompilerError',
|
|
24
|
+
message: fileMatch[4],
|
|
25
|
+
stackTrace: input,
|
|
26
|
+
frames: [{
|
|
27
|
+
function_name: null,
|
|
28
|
+
file_path: fileMatch[1],
|
|
29
|
+
line_number: parseInt(fileMatch[2], 10),
|
|
30
|
+
column_number: parseInt(fileMatch[3], 10),
|
|
31
|
+
normalized: `<compiler>@${path.basename(fileMatch[1])}`,
|
|
32
|
+
}],
|
|
33
|
+
sourceFile: fileMatch[1],
|
|
34
|
+
sourceLine: parseInt(fileMatch[2], 10),
|
|
35
|
+
language: 'go',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const fatalMatch = /^fatal error: (.+)/m.exec(input);
|
|
39
|
+
if (fatalMatch) {
|
|
40
|
+
return {
|
|
41
|
+
errorType: 'FatalError',
|
|
42
|
+
message: fatalMatch[1],
|
|
43
|
+
stackTrace: input,
|
|
44
|
+
frames: [],
|
|
45
|
+
sourceFile: null,
|
|
46
|
+
sourceLine: null,
|
|
47
|
+
language: 'go',
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
function parsePanic(input, message) {
|
|
54
|
+
const frames = [];
|
|
55
|
+
const lines = input.split('\n');
|
|
56
|
+
let i = 0;
|
|
57
|
+
while (i < lines.length) {
|
|
58
|
+
if (lines[i].startsWith('\t')) {
|
|
59
|
+
const stackMatch = /^\t(.+\.go):(\d+)/.exec(lines[i]);
|
|
60
|
+
if (stackMatch) {
|
|
61
|
+
const funcLine = i > 0 ? lines[i - 1].trim() : null;
|
|
62
|
+
const funcName = funcLine?.replace(/\(.*\)$/, '') ?? null;
|
|
63
|
+
frames.push({
|
|
64
|
+
function_name: funcName,
|
|
65
|
+
file_path: stackMatch[1],
|
|
66
|
+
line_number: parseInt(stackMatch[2], 10),
|
|
67
|
+
column_number: null,
|
|
68
|
+
normalized: `${funcName || '<anon>'}@${path.basename(stackMatch[1])}`,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
i++;
|
|
73
|
+
}
|
|
74
|
+
const topFrame = frames[0];
|
|
75
|
+
return {
|
|
76
|
+
errorType: 'PanicError',
|
|
77
|
+
message,
|
|
78
|
+
stackTrace: input,
|
|
79
|
+
frames,
|
|
80
|
+
sourceFile: topFrame?.file_path ?? null,
|
|
81
|
+
sourceLine: topFrame?.line_number ?? null,
|
|
82
|
+
language: 'go',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=go.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go.js","sourceRoot":"","sources":["../../../src/parsing/parsers/go.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,gBAAgB,GAAG,oCAAoC,CAAC;AAC9D,MAAM,WAAW,GAAG,eAAe,CAAC;AACpC,MAAM,eAAe,GAAG,yBAAyB,CAAC;AAClD,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAC1C,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAEpC,MAAM,CAAC,MAAM,QAAQ,GAAgB;IACnC,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,EAAE;IAEZ,QAAQ,CAAC,KAAa;QACpB,OAAO,CACL,gBAAgB,CAAC,IAAI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;IACN,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC3B,OAAO;QACL,SAAS,EAAE,YAAY;QACvB,OAAO;QACP,UAAU,EAAE,KAAK;QACjB,MAAM;QACN,UAAU,EAAE,QAAQ,EAAE,SAAS,IAAI,IAAI;QACvC,UAAU,EAAE,QAAQ,EAAE,WAAW,IAAI,IAAI;QACzC,QAAQ,EAAE,IAAI;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
const V8_STACK_RE = /at (?:(.+?) )?\((.+?):(\d+):(\d+)\)/;
|
|
3
|
+
const V8_STACK_BARE_RE = /at (.+?):(\d+):(\d+)/;
|
|
4
|
+
const ERROR_TYPE_RE = /^(\w+(?:Error|Exception|Warning)?): (.+)$/m;
|
|
5
|
+
function parseFrames(input) {
|
|
6
|
+
const frames = [];
|
|
7
|
+
for (const line of input.split('\n')) {
|
|
8
|
+
const trimmed = line.trim();
|
|
9
|
+
let match = V8_STACK_RE.exec(trimmed);
|
|
10
|
+
if (match) {
|
|
11
|
+
frames.push({
|
|
12
|
+
function_name: match[1] || null,
|
|
13
|
+
file_path: match[2],
|
|
14
|
+
line_number: parseInt(match[3], 10),
|
|
15
|
+
column_number: parseInt(match[4], 10),
|
|
16
|
+
normalized: `${match[1] || '<anon>'}@${path.basename(match[2])}`,
|
|
17
|
+
});
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
match = V8_STACK_BARE_RE.exec(trimmed);
|
|
21
|
+
if (match) {
|
|
22
|
+
frames.push({
|
|
23
|
+
function_name: null,
|
|
24
|
+
file_path: match[1],
|
|
25
|
+
line_number: parseInt(match[2], 10),
|
|
26
|
+
column_number: parseInt(match[3], 10),
|
|
27
|
+
normalized: `<anon>@${path.basename(match[1])}`,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return frames;
|
|
32
|
+
}
|
|
33
|
+
export const nodeParser = {
|
|
34
|
+
name: 'node',
|
|
35
|
+
priority: 10,
|
|
36
|
+
canParse(input) {
|
|
37
|
+
return (/at .+ \(.+:\d+:\d+\)/.test(input) ||
|
|
38
|
+
/at .+:\d+:\d+/.test(input) ||
|
|
39
|
+
/^\w*Error:/.test(input) ||
|
|
40
|
+
/^\w*TypeError:/.test(input));
|
|
41
|
+
},
|
|
42
|
+
parse(input) {
|
|
43
|
+
const typeMatch = ERROR_TYPE_RE.exec(input);
|
|
44
|
+
if (!typeMatch)
|
|
45
|
+
return null;
|
|
46
|
+
const errorType = typeMatch[1];
|
|
47
|
+
const message = typeMatch[2];
|
|
48
|
+
const frames = parseFrames(input);
|
|
49
|
+
const topFrame = frames[0];
|
|
50
|
+
return {
|
|
51
|
+
errorType,
|
|
52
|
+
message,
|
|
53
|
+
stackTrace: input,
|
|
54
|
+
frames,
|
|
55
|
+
sourceFile: topFrame?.file_path ?? null,
|
|
56
|
+
sourceLine: topFrame?.line_number ?? null,
|
|
57
|
+
language: 'javascript',
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/parsing/parsers/node.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,WAAW,GAAG,qCAAqC,CAAC;AAC1D,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAChD,MAAM,aAAa,GAAG,4CAA4C,CAAC;AAEnE,SAAS,WAAW,CAAC,KAAa;IAChC,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,KAAK,GAAG,WAAW,CAAC,IAAI,CA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AAC,KAAK,CAAC;YACxB,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAC7B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,KAAa;QACjB,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAE5B,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAE,CAAC;QAChC,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;QAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAE3B,OAAO;YACL,SAAS;YACT,OAAO;YACP,UAAU,EAAE,KAAK;YACjB,MAAM;YACN,UAAU,EAAE,QAAQ,EAAE,SAAS,IAAI,IAAI;YACvC,UAAU,EAAE,QAAQ,EAAE,WAAW,IAAI,IAAI;YACzC,QAAQ,EAAE,YAAY;SACvB,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
const FRAME_RE = /File "(.+?)", line (\d+)(?:, in (.+))?/g;
|
|
3
|
+
const ERROR_LINE_RE = /^(\w+(?:Error|Exception|Warning)?): (.+)$/m;
|
|
4
|
+
export const pythonParser = {
|
|
5
|
+
name: 'python',
|
|
6
|
+
priority: 10,
|
|
7
|
+
canParse(input) {
|
|
8
|
+
return (/Traceback \(most recent call last\)/.test(input) ||
|
|
9
|
+
/File ".+", line \d+/.test(input));
|
|
10
|
+
},
|
|
11
|
+
parse(input) {
|
|
12
|
+
const frames = [];
|
|
13
|
+
let match;
|
|
14
|
+
const frameRe = new RegExp(FRAME_RE.source, 'g');
|
|
15
|
+
while ((match = frameRe.exec(input)) !== null) {
|
|
16
|
+
frames.push({
|
|
17
|
+
function_name: match[3] || null,
|
|
18
|
+
file_path: match[1],
|
|
19
|
+
line_number: parseInt(match[2], 10),
|
|
20
|
+
column_number: null,
|
|
21
|
+
normalized: `${match[3] || '<module>'}@${path.basename(match[1])}`,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const lines = input.trim().split('\n');
|
|
25
|
+
let errorType = 'PythonError';
|
|
26
|
+
let message = '';
|
|
27
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
28
|
+
const errMatch = ERROR_LINE_RE.exec(lines[i]);
|
|
29
|
+
if (errMatch) {
|
|
30
|
+
errorType = errMatch[1];
|
|
31
|
+
message = errMatch[2];
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (!message && lines.length > 0) {
|
|
36
|
+
message = lines[lines.length - 1];
|
|
37
|
+
}
|
|
38
|
+
const topFrame = frames[frames.length - 1];
|
|
39
|
+
return {
|
|
40
|
+
errorType,
|
|
41
|
+
message,
|
|
42
|
+
stackTrace: input,
|
|
43
|
+
frames,
|
|
44
|
+
sourceFile: topFrame?.file_path ?? null,
|
|
45
|
+
sourceLine: topFrame?.line_number ?? null,
|
|
46
|
+
language: 'python',
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=python.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.js","sourceRoot":"","sources":["../../../src/parsing/parsers/python.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,QAAQ,GAAG,yCAAyC,CAAC;AAC3D,MAAM,aAAa,GAAG,4CAA4C,CAAC;AAEnE,MAAM,CAAC,MAAM,YAAY,GAAgB;IACvC,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,EAAE;IAEZ,QAAQ,CAAC,KAAa;QACpB,OAAO,CACL,qCAAqC,CAAC,IAAI,CAAC,KAAK,CAAC;YACjD,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,CAClC,CAAC;IACJ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AAM,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC;QACrC,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAE3C,OAAO;YACL,SAAS;YACT,OAAO;YACP,UAAU,EAAE,KAAK;YACjB,MAAM;YACN,UAAU,EAAE,QAAQ,EAAE,SAAS,IAAI,IAAI;YACvC,UAAU,EAAE,QAAQ,EAAE,WAAW,IAAI,IAAI;YACzC,QAAQ,EAAE,QAAQ;SACnB,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
const RUST_ERROR_RE = /error(?:\[E(\d+)\])?: (.+)/;
|
|
3
|
+
const RUST_LOCATION_RE = /^\s*--> (.+):(\d+):(\d+)/m;
|
|
4
|
+
const RUST_NOTE_RE = /^\s*= note: (.+)/gm;
|
|
5
|
+
export const rustParser = {
|
|
6
|
+
name: 'rust',
|
|
7
|
+
priority: 10,
|
|
8
|
+
canParse(input) {
|
|
9
|
+
return /error\[E\d+\]:/.test(input) || /^error:/.test(input);
|
|
10
|
+
},
|
|
11
|
+
parse(input) {
|
|
12
|
+
const errMatch = RUST_ERROR_RE.exec(input);
|
|
13
|
+
if (!errMatch)
|
|
14
|
+
return null;
|
|
15
|
+
const message = errMatch[2].trim();
|
|
16
|
+
const errorType = errMatch[1] ? `E${errMatch[1]}` : 'CompilerError';
|
|
17
|
+
const frames = [];
|
|
18
|
+
let sourceFile = null;
|
|
19
|
+
let sourceLine = null;
|
|
20
|
+
const locMatch = RUST_LOCATION_RE.exec(input);
|
|
21
|
+
if (locMatch) {
|
|
22
|
+
sourceFile = locMatch[1];
|
|
23
|
+
sourceLine = parseInt(locMatch[2], 10);
|
|
24
|
+
frames.push({
|
|
25
|
+
function_name: null,
|
|
26
|
+
file_path: locMatch[1],
|
|
27
|
+
line_number: parseInt(locMatch[2], 10),
|
|
28
|
+
column_number: parseInt(locMatch[3], 10),
|
|
29
|
+
normalized: `<compiler>@${path.basename(locMatch[1])}`,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
errorType,
|
|
34
|
+
message,
|
|
35
|
+
stackTrace: input,
|
|
36
|
+
frames,
|
|
37
|
+
sourceFile,
|
|
38
|
+
sourceLine,
|
|
39
|
+
language: 'rust',
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=rust.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rust.js","sourceRoot":"","sources":["../../../src/parsing/parsers/rust.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,aAAa,GAAG,4BAA4B,CAAC;AACnD,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AACrD,MAAM,YAAY,GAAG,oBAAoB,CAAC;AAE1C,MAAM,CAAC,MAAM,UAAU,GAAgB;IACrC,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,EAAE;IAEZ,QAAQ,CAAC,KAAa;QACpB,OAAO,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,KAAa;QACjB,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC;QAE3B,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC;QACpC,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC;QAEpE,MAAM,MAAM,GAAiB,EAAE,CAAC;QAChC,IAAI,UAAU,GAAkB,IAAI,CAAC;QACrC,IAAI,UAAU,GAAkB,IAAI,CAAC;QAErC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,QAAQ,EAAE,CAAC;YACb,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC;YAC1B,UAAU,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC;gBACV,aAAa,EAAE,IAAI;gBACnB,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAE;gBACvB,WAAW,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC;gBACvC,aAAa,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAE,EAAE,EAAE,CAAC;gBACzC,UAAU,EAAE,cAAc,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAE,CAAC,EAAE;aACxD,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,SAAS;YACT,OAAO;YACP,UAAU,EAAE,KAAK;YACjB,MAAM;YACN,UAAU;YACV,UAAU;YACV,QAAQ,EAAE,MAAM;SACjB,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const ERROR_MAP = [
|
|
2
|
+
{ pattern: /command not found/i, type: 'CommandNotFound' },
|
|
3
|
+
{ pattern: /Permission denied|EACCES/i, type: 'PermissionError' },
|
|
4
|
+
{ pattern: /No such file or directory|ENOENT/i, type: 'FileNotFound' },
|
|
5
|
+
{ pattern: /ECONNREFUSED/i, type: 'ConnectionRefused' },
|
|
6
|
+
{ pattern: /EADDRINUSE/i, type: 'AddressInUse' },
|
|
7
|
+
{ pattern: /ETIMEDOUT|ESOCKETTIMEDOUT/i, type: 'Timeout' },
|
|
8
|
+
{ pattern: /ENOMEM/i, type: 'OutOfMemory' },
|
|
9
|
+
];
|
|
10
|
+
export const shellParser = {
|
|
11
|
+
name: 'shell',
|
|
12
|
+
priority: 5,
|
|
13
|
+
canParse(input) {
|
|
14
|
+
return ERROR_MAP.some(e => e.pattern.test(input));
|
|
15
|
+
},
|
|
16
|
+
parse(input) {
|
|
17
|
+
let errorType = 'ShellError';
|
|
18
|
+
for (const entry of ERROR_MAP) {
|
|
19
|
+
if (entry.pattern.test(input)) {
|
|
20
|
+
errorType = entry.type;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const firstLine = input.trim().split('\n')[0] ?? input;
|
|
25
|
+
return {
|
|
26
|
+
errorType,
|
|
27
|
+
message: firstLine,
|
|
28
|
+
stackTrace: null,
|
|
29
|
+
frames: [],
|
|
30
|
+
sourceFile: null,
|
|
31
|
+
sourceLine: null,
|
|
32
|
+
language: 'shell',
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../src/parsing/parsers/shell.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAA6C;IAC1D,EAAE,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,iBAAiB,EAAE;IAC1D,EAAE,OAAO,EAAE,2BAA2B,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACjE,EAAE,OAAO,EAAE,mCAAmC,EAAE,IAAI,EAAE,cAAc,EAAE;IACtE,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,mBAAmB,EAAE;IACvD,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE;IAChD,EAAE,OAAO,EAAE,4BAA4B,EAAE,IAAI,EAAE,SAAS,EAAE;IAC1D,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE;CAC5C,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,IAAI,EAAE,OAAO;IACb,QAAQ,EAAE,CAAC;IAEX,QAAQ,CAAC,KAAa;QACpB,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,KAAa;QACjB,IAAI,SAAS,GAAG,YAAY,CAAC;QAC7B,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE,CAAC;YAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9B,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC;gBACvB,MAAM;YACR,CAAC;QACH,CAAC;QAED,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;QAEvD,OAAO;YACL,SAAS;YACT,OAAO,EAAE,SAAS;YAClB,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,EAAE;YACV,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,OAAO;SAClB,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface StackFrame {
|
|
2
|
+
function_name: string | null;
|
|
3
|
+
file_path: string | null;
|
|
4
|
+
line_number: number | null;
|
|
5
|
+
column_number: number | null;
|
|
6
|
+
normalized: string | null;
|
|
7
|
+
}
|
|
8
|
+
export interface ParsedError {
|
|
9
|
+
errorType: string;
|
|
10
|
+
message: string;
|
|
11
|
+
stackTrace: string | null;
|
|
12
|
+
frames: StackFrame[];
|
|
13
|
+
sourceFile: string | null;
|
|
14
|
+
sourceLine: number | null;
|
|
15
|
+
language: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface ErrorParser {
|
|
18
|
+
name: string;
|
|
19
|
+
priority: number;
|
|
20
|
+
canParse(input: string): boolean;
|
|
21
|
+
parse(input: string): ParsedError | null;
|
|
22
|
+
}
|
|
23
|
+
export declare class ErrorParserRegistry {
|
|
24
|
+
private parsers;
|
|
25
|
+
register(parser: ErrorParser): void;
|
|
26
|
+
parse(input: string): ParsedError | null;
|
|
27
|
+
getRegistered(): string[];
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class ErrorParserRegistry {
|
|
2
|
+
parsers = [];
|
|
3
|
+
register(parser) {
|
|
4
|
+
this.parsers.push(parser);
|
|
5
|
+
this.parsers.sort((a, b) => b.priority - a.priority);
|
|
6
|
+
}
|
|
7
|
+
parse(input) {
|
|
8
|
+
for (const parser of this.parsers) {
|
|
9
|
+
if (parser.canParse(input)) {
|
|
10
|
+
const result = parser.parse(input);
|
|
11
|
+
if (result)
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
getRegistered() {
|
|
18
|
+
return this.parsers.map(p => p.name);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/parsing/types.ts"],"names":[],"mappings":"AAyBA,MAAM,OAAO,mBAAmB;IACtB,OAAO,GAAkB,EAAE,CAAC;IAEpC,QAAQ,CAAC,MAAmB;QAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,KAAa;QACjB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACnC,IAAI,MAAM;oBAAE,OAAO,MAAM,CAAC;YAC5B,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ResearchConfig } from '../types/config.types.js';
|
|
2
|
+
import type { ErrorRepository } from '../db/repositories/error.repository.js';
|
|
3
|
+
import type { SolutionRepository } from '../db/repositories/solution.repository.js';
|
|
4
|
+
import type { SynapseRepository } from '../db/repositories/synapse.repository.js';
|
|
5
|
+
import type { ProjectRepository } from '../db/repositories/project.repository.js';
|
|
6
|
+
import type { InsightRepository } from '../db/repositories/insight.repository.js';
|
|
7
|
+
/**
|
|
8
|
+
* Identifies gaps: unresolved recurring errors, missing solutions, isolated synapse nodes.
|
|
9
|
+
*/
|
|
10
|
+
export declare class GapAnalyzer {
|
|
11
|
+
private errorRepo;
|
|
12
|
+
private solutionRepo;
|
|
13
|
+
private synapseRepo;
|
|
14
|
+
private projectRepo;
|
|
15
|
+
private insightRepo;
|
|
16
|
+
private config;
|
|
17
|
+
private logger;
|
|
18
|
+
constructor(errorRepo: ErrorRepository, solutionRepo: SolutionRepository, synapseRepo: SynapseRepository, projectRepo: ProjectRepository, insightRepo: InsightRepository, config: ResearchConfig);
|
|
19
|
+
analyze(): number;
|
|
20
|
+
private findUnresolvedRecurring;
|
|
21
|
+
private findFailedSolutions;
|
|
22
|
+
private findIsolatedNodes;
|
|
23
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { getLogger } from '../utils/logger.js';
|
|
2
|
+
/**
|
|
3
|
+
* Identifies gaps: unresolved recurring errors, missing solutions, isolated synapse nodes.
|
|
4
|
+
*/
|
|
5
|
+
export class GapAnalyzer {
|
|
6
|
+
errorRepo;
|
|
7
|
+
solutionRepo;
|
|
8
|
+
synapseRepo;
|
|
9
|
+
projectRepo;
|
|
10
|
+
insightRepo;
|
|
11
|
+
config;
|
|
12
|
+
logger = getLogger();
|
|
13
|
+
constructor(errorRepo, solutionRepo, synapseRepo, projectRepo, insightRepo, config) {
|
|
14
|
+
this.errorRepo = errorRepo;
|
|
15
|
+
this.solutionRepo = solutionRepo;
|
|
16
|
+
this.synapseRepo = synapseRepo;
|
|
17
|
+
this.projectRepo = projectRepo;
|
|
18
|
+
this.insightRepo = insightRepo;
|
|
19
|
+
this.config = config;
|
|
20
|
+
}
|
|
21
|
+
analyze() {
|
|
22
|
+
let insightsCreated = 0;
|
|
23
|
+
insightsCreated += this.findUnresolvedRecurring();
|
|
24
|
+
insightsCreated += this.findFailedSolutions();
|
|
25
|
+
insightsCreated += this.findIsolatedNodes();
|
|
26
|
+
this.logger.info(`Gap analysis complete: ${insightsCreated} insights`);
|
|
27
|
+
return insightsCreated;
|
|
28
|
+
}
|
|
29
|
+
findUnresolvedRecurring() {
|
|
30
|
+
const unresolved = this.errorRepo.findUnresolved();
|
|
31
|
+
const recurring = unresolved.filter(e => e.occurrence_count >= this.config.gapMinOccurrences);
|
|
32
|
+
let count = 0;
|
|
33
|
+
const expiresAt = new Date(Date.now() + this.config.insightExpiryDays * 86400000).toISOString();
|
|
34
|
+
for (const error of recurring) {
|
|
35
|
+
const solutions = this.solutionRepo.findForError(error.id);
|
|
36
|
+
if (solutions.length === 0) {
|
|
37
|
+
this.insightRepo.create({
|
|
38
|
+
type: 'warning',
|
|
39
|
+
title: `Unresolved recurring error: ${error.type}`,
|
|
40
|
+
description: `"${error.message.substring(0, 80)}..." has occurred ${error.occurrence_count} times with no solution.`,
|
|
41
|
+
evidence: JSON.stringify({ errorId: error.id, occurrences: error.occurrence_count, type: error.type }),
|
|
42
|
+
priority: Math.min(95, 40 + error.occurrence_count * 5),
|
|
43
|
+
project_id: error.project_id,
|
|
44
|
+
active: 1,
|
|
45
|
+
expires_at: expiresAt,
|
|
46
|
+
});
|
|
47
|
+
count++;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return count;
|
|
51
|
+
}
|
|
52
|
+
findFailedSolutions() {
|
|
53
|
+
const projects = this.projectRepo.getAll();
|
|
54
|
+
let count = 0;
|
|
55
|
+
const expiresAt = new Date(Date.now() + this.config.insightExpiryDays * 86400000).toISOString();
|
|
56
|
+
for (const project of projects) {
|
|
57
|
+
const errors = this.errorRepo.findUnresolved(project.id);
|
|
58
|
+
for (const error of errors) {
|
|
59
|
+
if (error.occurrence_count < this.config.gapMinOccurrences)
|
|
60
|
+
continue;
|
|
61
|
+
const solutions = this.solutionRepo.findForError(error.id);
|
|
62
|
+
if (solutions.length < 2)
|
|
63
|
+
continue;
|
|
64
|
+
const allFailed = solutions.every(s => {
|
|
65
|
+
const rate = this.solutionRepo.successRate(s.id);
|
|
66
|
+
return rate < 0.3;
|
|
67
|
+
});
|
|
68
|
+
if (allFailed) {
|
|
69
|
+
this.insightRepo.create({
|
|
70
|
+
type: 'warning',
|
|
71
|
+
title: `All solutions failing for: ${error.type}`,
|
|
72
|
+
description: `${solutions.length} solutions tried for "${error.message.substring(0, 60)}..." but all have <30% success rate.`,
|
|
73
|
+
evidence: JSON.stringify({
|
|
74
|
+
errorId: error.id,
|
|
75
|
+
solutionCount: solutions.length,
|
|
76
|
+
solutionIds: solutions.map(s => s.id),
|
|
77
|
+
}),
|
|
78
|
+
priority: Math.min(90, 50 + solutions.length * 10),
|
|
79
|
+
project_id: project.id,
|
|
80
|
+
active: 1,
|
|
81
|
+
expires_at: expiresAt,
|
|
82
|
+
});
|
|
83
|
+
count++;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return count;
|
|
88
|
+
}
|
|
89
|
+
findIsolatedNodes() {
|
|
90
|
+
const projects = this.projectRepo.getAll();
|
|
91
|
+
let count = 0;
|
|
92
|
+
const expiresAt = new Date(Date.now() + this.config.insightExpiryDays * 86400000).toISOString();
|
|
93
|
+
for (const project of projects) {
|
|
94
|
+
const errors = this.errorRepo.findByProject(project.id);
|
|
95
|
+
let projectIsolated = 0;
|
|
96
|
+
for (const error of errors) {
|
|
97
|
+
const connections = this.synapseRepo.findConnected('error', error.id);
|
|
98
|
+
if (connections.length === 0) {
|
|
99
|
+
projectIsolated++;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (projectIsolated > 5) {
|
|
103
|
+
this.insightRepo.create({
|
|
104
|
+
type: 'optimization',
|
|
105
|
+
title: `${projectIsolated} errors without connections in ${project.name}`,
|
|
106
|
+
description: `These errors have no synapses to solutions, modules, or other errors. Brain cannot contextualize them.`,
|
|
107
|
+
evidence: JSON.stringify({ projectId: project.id, isolatedCount: projectIsolated }),
|
|
108
|
+
priority: 25,
|
|
109
|
+
project_id: project.id,
|
|
110
|
+
active: 1,
|
|
111
|
+
expires_at: expiresAt,
|
|
112
|
+
});
|
|
113
|
+
count++;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return count;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=gap-analyzer.js.map
|