agentsys 5.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/.agnix.toml +49 -0
- package/.claude-plugin/marketplace.json +110 -0
- package/.claude-plugin/plugin.json +20 -0
- package/AGENTS.md +260 -0
- package/CHANGELOG.md +190 -0
- package/LICENSE +21 -0
- package/README.md +916 -0
- package/SECURITY.md +45 -0
- package/adapters/README.md +258 -0
- package/adapters/codex/README.md +273 -0
- package/adapters/codex/install.sh +260 -0
- package/adapters/codex/skills/agnix/SKILL.md +138 -0
- package/adapters/codex/skills/audit-project/SKILL.md +334 -0
- package/adapters/codex/skills/audit-project-agents/SKILL.md +459 -0
- package/adapters/codex/skills/audit-project-github/SKILL.md +146 -0
- package/adapters/codex/skills/consult/SKILL.md +245 -0
- package/adapters/codex/skills/delivery-approval/SKILL.md +339 -0
- package/adapters/codex/skills/deslop/SKILL.md +167 -0
- package/adapters/codex/skills/drift-detect/SKILL.md +268 -0
- package/adapters/codex/skills/enhance/SKILL.md +177 -0
- package/adapters/codex/skills/learn/SKILL.md +188 -0
- package/adapters/codex/skills/next-task/SKILL.md +546 -0
- package/adapters/codex/skills/perf/SKILL.md +469 -0
- package/adapters/codex/skills/repo-map/SKILL.md +132 -0
- package/adapters/codex/skills/ship/SKILL.md +491 -0
- package/adapters/codex/skills/ship-ci-review-loop/SKILL.md +473 -0
- package/adapters/codex/skills/ship-deployment/SKILL.md +336 -0
- package/adapters/codex/skills/ship-error-handling/SKILL.md +260 -0
- package/adapters/codex/skills/sync-docs/SKILL.md +186 -0
- package/adapters/opencode/README.md +302 -0
- package/adapters/opencode/agents/agent-enhancer.md +65 -0
- package/adapters/opencode/agents/agnix-agent.md +56 -0
- package/adapters/opencode/agents/ci-fixer.md +104 -0
- package/adapters/opencode/agents/ci-monitor.md +127 -0
- package/adapters/opencode/agents/claudemd-enhancer.md +66 -0
- package/adapters/opencode/agents/consult-agent.md +124 -0
- package/adapters/opencode/agents/cross-file-enhancer.md +54 -0
- package/adapters/opencode/agents/delivery-validator.md +115 -0
- package/adapters/opencode/agents/deslop-agent.md +88 -0
- package/adapters/opencode/agents/docs-enhancer.md +65 -0
- package/adapters/opencode/agents/exploration-agent.md +143 -0
- package/adapters/opencode/agents/hooks-enhancer.md +66 -0
- package/adapters/opencode/agents/implementation-agent.md +206 -0
- package/adapters/opencode/agents/learn-agent.md +279 -0
- package/adapters/opencode/agents/map-validator.md +65 -0
- package/adapters/opencode/agents/perf-analyzer.md +40 -0
- package/adapters/opencode/agents/perf-code-paths.md +12 -0
- package/adapters/opencode/agents/perf-investigation-logger.md +44 -0
- package/adapters/opencode/agents/perf-orchestrator.md +147 -0
- package/adapters/opencode/agents/perf-theory-gatherer.md +18 -0
- package/adapters/opencode/agents/perf-theory-tester.md +43 -0
- package/adapters/opencode/agents/plan-synthesizer.md +229 -0
- package/adapters/opencode/agents/planning-agent.md +235 -0
- package/adapters/opencode/agents/plugin-enhancer.md +64 -0
- package/adapters/opencode/agents/prompt-enhancer.md +58 -0
- package/adapters/opencode/agents/simple-fixer.md +107 -0
- package/adapters/opencode/agents/skills-enhancer.md +66 -0
- package/adapters/opencode/agents/sync-docs-agent.md +153 -0
- package/adapters/opencode/agents/task-discoverer.md +80 -0
- package/adapters/opencode/agents/test-coverage-checker.md +144 -0
- package/adapters/opencode/agents/worktree-manager.md +209 -0
- package/adapters/opencode/commands/agnix.md +106 -0
- package/adapters/opencode/commands/audit-project-agents.md +125 -0
- package/adapters/opencode/commands/audit-project-github.md +145 -0
- package/adapters/opencode/commands/audit-project.md +268 -0
- package/adapters/opencode/commands/consult.md +252 -0
- package/adapters/opencode/commands/delivery-approval.md +212 -0
- package/adapters/opencode/commands/deslop.md +132 -0
- package/adapters/opencode/commands/drift-detect.md +173 -0
- package/adapters/opencode/commands/enhance.md +183 -0
- package/adapters/opencode/commands/learn.md +116 -0
- package/adapters/opencode/commands/next-task.md +393 -0
- package/adapters/opencode/commands/perf.md +49 -0
- package/adapters/opencode/commands/repo-map.md +69 -0
- package/adapters/opencode/commands/ship-ci-review-loop.md +334 -0
- package/adapters/opencode/commands/ship-deployment.md +336 -0
- package/adapters/opencode/commands/ship-error-handling.md +248 -0
- package/adapters/opencode/commands/ship.md +371 -0
- package/adapters/opencode/commands/sync-docs.md +108 -0
- package/adapters/opencode/install.sh +322 -0
- package/adapters/opencode/skills/agnix/SKILL.md +139 -0
- package/adapters/opencode/skills/consult/SKILL.md +292 -0
- package/adapters/opencode/skills/deslop/SKILL.md +169 -0
- package/adapters/opencode/skills/discover-tasks/SKILL.md +102 -0
- package/adapters/opencode/skills/drift-analysis/SKILL.md +279 -0
- package/adapters/opencode/skills/enhance-agent-prompts/SKILL.md +279 -0
- package/adapters/opencode/skills/enhance-claude-memory/SKILL.md +390 -0
- package/adapters/opencode/skills/enhance-cross-file/SKILL.md +112 -0
- package/adapters/opencode/skills/enhance-docs/SKILL.md +288 -0
- package/adapters/opencode/skills/enhance-hooks/SKILL.md +557 -0
- package/adapters/opencode/skills/enhance-orchestrator/SKILL.md +114 -0
- package/adapters/opencode/skills/enhance-plugins/SKILL.md +314 -0
- package/adapters/opencode/skills/enhance-prompts/SKILL.md +341 -0
- package/adapters/opencode/skills/enhance-skills/SKILL.md +443 -0
- package/adapters/opencode/skills/learn/SKILL.md +352 -0
- package/adapters/opencode/skills/orchestrate-review/SKILL.md +95 -0
- package/adapters/opencode/skills/perf-analyzer/SKILL.md +38 -0
- package/adapters/opencode/skills/perf-baseline-manager/SKILL.md +31 -0
- package/adapters/opencode/skills/perf-benchmarker/SKILL.md +49 -0
- package/adapters/opencode/skills/perf-code-paths/SKILL.md +33 -0
- package/adapters/opencode/skills/perf-investigation-logger/SKILL.md +42 -0
- package/adapters/opencode/skills/perf-profiler/SKILL.md +39 -0
- package/adapters/opencode/skills/perf-theory-gatherer/SKILL.md +36 -0
- package/adapters/opencode/skills/perf-theory-tester/SKILL.md +37 -0
- package/adapters/opencode/skills/repo-mapping/SKILL.md +86 -0
- package/adapters/opencode/skills/sync-docs/SKILL.md +246 -0
- package/adapters/opencode/skills/validate-delivery/SKILL.md +112 -0
- package/adapters/opencode-plugin/index.ts +346 -0
- package/adapters/opencode-plugin/package.json +21 -0
- package/agent-knowledge/AGENTS.md +62 -0
- package/agent-knowledge/ai-cli-advanced-integration-patterns.md +670 -0
- package/agent-knowledge/ai-cli-non-interactive-programmatic-usage.md +1394 -0
- package/agent-knowledge/resources/ai-cli-non-interactive-programmatic-usage-sources.json +500 -0
- package/bin/cli.js +719 -0
- package/bin/dev-cli.js +587 -0
- package/lib/adapter-transforms.js +278 -0
- package/lib/collectors/codebase.js +392 -0
- package/lib/collectors/docs-patterns.js +713 -0
- package/lib/collectors/documentation.js +219 -0
- package/lib/collectors/github.js +266 -0
- package/lib/collectors/index.js +126 -0
- package/lib/config/index.js +14 -0
- package/lib/cross-platform/index.js +539 -0
- package/lib/discovery/index.js +352 -0
- package/lib/drift-detect/collectors.js +37 -0
- package/lib/enhance/agent-analyzer.js +421 -0
- package/lib/enhance/agent-patterns.js +571 -0
- package/lib/enhance/auto-suppression.js +622 -0
- package/lib/enhance/benchmark.js +417 -0
- package/lib/enhance/cross-file-analyzer.js +930 -0
- package/lib/enhance/cross-file-patterns.js +370 -0
- package/lib/enhance/docs-analyzer.js +325 -0
- package/lib/enhance/docs-patterns.js +671 -0
- package/lib/enhance/fixer.js +721 -0
- package/lib/enhance/hook-analyzer.js +135 -0
- package/lib/enhance/hook-patterns.js +40 -0
- package/lib/enhance/index.js +127 -0
- package/lib/enhance/plugin-analyzer.js +402 -0
- package/lib/enhance/plugin-patterns.js +326 -0
- package/lib/enhance/projectmemory-analyzer.js +551 -0
- package/lib/enhance/projectmemory-patterns.js +617 -0
- package/lib/enhance/prompt-analyzer.js +457 -0
- package/lib/enhance/prompt-patterns.js +1484 -0
- package/lib/enhance/reporter.js +1348 -0
- package/lib/enhance/security-patterns.js +284 -0
- package/lib/enhance/skill-analyzer.js +182 -0
- package/lib/enhance/skill-patterns.js +147 -0
- package/lib/enhance/suppression.js +352 -0
- package/lib/enhance/tool-patterns.js +373 -0
- package/lib/index.js +270 -0
- package/lib/package.json +25 -0
- package/lib/patterns/cli-enhancers.js +611 -0
- package/lib/patterns/pipeline.js +948 -0
- package/lib/patterns/review-patterns.js +558 -0
- package/lib/patterns/slop-analyzers.js +2305 -0
- package/lib/patterns/slop-patterns.js +1187 -0
- package/lib/perf/analyzer/index.js +22 -0
- package/lib/perf/argument-parser.js +105 -0
- package/lib/perf/baseline-comparator.js +50 -0
- package/lib/perf/baseline-store.js +127 -0
- package/lib/perf/benchmark-runner.js +399 -0
- package/lib/perf/breaking-point-finder.js +52 -0
- package/lib/perf/breaking-point-runner.js +60 -0
- package/lib/perf/checkpoint.js +123 -0
- package/lib/perf/code-paths.js +86 -0
- package/lib/perf/consolidation.js +37 -0
- package/lib/perf/constraint-runner.js +71 -0
- package/lib/perf/experiment-runner.js +32 -0
- package/lib/perf/index.js +41 -0
- package/lib/perf/investigation-state.js +875 -0
- package/lib/perf/optimization-runner.js +79 -0
- package/lib/perf/profilers/go.js +22 -0
- package/lib/perf/profilers/index.js +46 -0
- package/lib/perf/profilers/java.js +23 -0
- package/lib/perf/profilers/node.js +27 -0
- package/lib/perf/profilers/python.js +23 -0
- package/lib/perf/profilers/rust.js +23 -0
- package/lib/perf/profiling-runner.js +56 -0
- package/lib/perf/schemas.js +140 -0
- package/lib/platform/detect-platform.js +413 -0
- package/lib/platform/detection-configs.js +93 -0
- package/lib/platform/state-dir.js +132 -0
- package/lib/platform/verify-tools.js +182 -0
- package/lib/repo-map/cache.js +152 -0
- package/lib/repo-map/index.js +222 -0
- package/lib/repo-map/installer.js +212 -0
- package/lib/repo-map/queries/go.js +27 -0
- package/lib/repo-map/queries/index.js +100 -0
- package/lib/repo-map/queries/java.js +38 -0
- package/lib/repo-map/queries/javascript.js +55 -0
- package/lib/repo-map/queries/python.js +24 -0
- package/lib/repo-map/queries/rust.js +73 -0
- package/lib/repo-map/queries/typescript.js +38 -0
- package/lib/repo-map/runner.js +1165 -0
- package/lib/repo-map/updater.js +474 -0
- package/lib/repo-map/usage-analyzer.js +407 -0
- package/lib/schemas/plugin-manifest.schema.json +57 -0
- package/lib/schemas/validator.js +247 -0
- package/lib/sources/custom-handler.js +199 -0
- package/lib/sources/policy-questions.js +246 -0
- package/lib/sources/source-cache.js +165 -0
- package/lib/state/workflow-state.js +575 -0
- package/lib/types/agent-frontmatter.d.ts +134 -0
- package/lib/types/command-frontmatter.d.ts +107 -0
- package/lib/types/hook-frontmatter.d.ts +115 -0
- package/lib/types/index.d.ts +84 -0
- package/lib/types/plugin-manifest.d.ts +102 -0
- package/lib/types/skill-frontmatter.d.ts +89 -0
- package/lib/utils/atomic-write.js +94 -0
- package/lib/utils/cache-manager.js +159 -0
- package/lib/utils/context-optimizer.js +300 -0
- package/lib/utils/deprecation.js +37 -0
- package/lib/utils/shell-escape.js +88 -0
- package/meta/skills/maintain-cross-platform/SKILL.md +1022 -0
- package/package.json +92 -0
- package/plugins/agnix/.claude-plugin/plugin.json +22 -0
- package/plugins/agnix/agents/agnix-agent.md +56 -0
- package/plugins/agnix/commands/agnix.md +139 -0
- package/plugins/agnix/skills/agnix/SKILL.md +138 -0
- package/plugins/audit-project/.claude-plugin/plugin.json +20 -0
- package/plugins/audit-project/commands/audit-project-agents.md +458 -0
- package/plugins/audit-project/commands/audit-project-github.md +144 -0
- package/plugins/audit-project/commands/audit-project.md +336 -0
- package/plugins/audit-project/lib/adapter-transforms.js +278 -0
- package/plugins/audit-project/lib/collectors/codebase.js +392 -0
- package/plugins/audit-project/lib/collectors/docs-patterns.js +713 -0
- package/plugins/audit-project/lib/collectors/documentation.js +219 -0
- package/plugins/audit-project/lib/collectors/github.js +266 -0
- package/plugins/audit-project/lib/collectors/index.js +126 -0
- package/plugins/audit-project/lib/config/index.js +14 -0
- package/plugins/audit-project/lib/cross-platform/index.js +539 -0
- package/plugins/audit-project/lib/discovery/index.js +352 -0
- package/plugins/audit-project/lib/drift-detect/collectors.js +37 -0
- package/plugins/audit-project/lib/enhance/agent-analyzer.js +421 -0
- package/plugins/audit-project/lib/enhance/agent-patterns.js +571 -0
- package/plugins/audit-project/lib/enhance/auto-suppression.js +622 -0
- package/plugins/audit-project/lib/enhance/benchmark.js +417 -0
- package/plugins/audit-project/lib/enhance/cross-file-analyzer.js +930 -0
- package/plugins/audit-project/lib/enhance/cross-file-patterns.js +370 -0
- package/plugins/audit-project/lib/enhance/docs-analyzer.js +325 -0
- package/plugins/audit-project/lib/enhance/docs-patterns.js +671 -0
- package/plugins/audit-project/lib/enhance/fixer.js +721 -0
- package/plugins/audit-project/lib/enhance/hook-analyzer.js +135 -0
- package/plugins/audit-project/lib/enhance/hook-patterns.js +40 -0
- package/plugins/audit-project/lib/enhance/index.js +127 -0
- package/plugins/audit-project/lib/enhance/plugin-analyzer.js +402 -0
- package/plugins/audit-project/lib/enhance/plugin-patterns.js +326 -0
- package/plugins/audit-project/lib/enhance/projectmemory-analyzer.js +551 -0
- package/plugins/audit-project/lib/enhance/projectmemory-patterns.js +617 -0
- package/plugins/audit-project/lib/enhance/prompt-analyzer.js +457 -0
- package/plugins/audit-project/lib/enhance/prompt-patterns.js +1484 -0
- package/plugins/audit-project/lib/enhance/reporter.js +1348 -0
- package/plugins/audit-project/lib/enhance/security-patterns.js +284 -0
- package/plugins/audit-project/lib/enhance/skill-analyzer.js +182 -0
- package/plugins/audit-project/lib/enhance/skill-patterns.js +147 -0
- package/plugins/audit-project/lib/enhance/suppression.js +352 -0
- package/plugins/audit-project/lib/enhance/tool-patterns.js +373 -0
- package/plugins/audit-project/lib/index.js +270 -0
- package/plugins/audit-project/lib/patterns/cli-enhancers.js +611 -0
- package/plugins/audit-project/lib/patterns/pipeline.js +948 -0
- package/plugins/audit-project/lib/patterns/review-patterns.js +558 -0
- package/plugins/audit-project/lib/patterns/slop-analyzers.js +2305 -0
- package/plugins/audit-project/lib/patterns/slop-patterns.js +1187 -0
- package/plugins/audit-project/lib/perf/analyzer/index.js +22 -0
- package/plugins/audit-project/lib/perf/argument-parser.js +105 -0
- package/plugins/audit-project/lib/perf/baseline-comparator.js +50 -0
- package/plugins/audit-project/lib/perf/baseline-store.js +127 -0
- package/plugins/audit-project/lib/perf/benchmark-runner.js +399 -0
- package/plugins/audit-project/lib/perf/breaking-point-finder.js +52 -0
- package/plugins/audit-project/lib/perf/breaking-point-runner.js +60 -0
- package/plugins/audit-project/lib/perf/checkpoint.js +123 -0
- package/plugins/audit-project/lib/perf/code-paths.js +86 -0
- package/plugins/audit-project/lib/perf/consolidation.js +37 -0
- package/plugins/audit-project/lib/perf/constraint-runner.js +71 -0
- package/plugins/audit-project/lib/perf/experiment-runner.js +32 -0
- package/plugins/audit-project/lib/perf/index.js +41 -0
- package/plugins/audit-project/lib/perf/investigation-state.js +875 -0
- package/plugins/audit-project/lib/perf/optimization-runner.js +79 -0
- package/plugins/audit-project/lib/perf/profilers/go.js +22 -0
- package/plugins/audit-project/lib/perf/profilers/index.js +46 -0
- package/plugins/audit-project/lib/perf/profilers/java.js +23 -0
- package/plugins/audit-project/lib/perf/profilers/node.js +27 -0
- package/plugins/audit-project/lib/perf/profilers/python.js +23 -0
- package/plugins/audit-project/lib/perf/profilers/rust.js +23 -0
- package/plugins/audit-project/lib/perf/profiling-runner.js +56 -0
- package/plugins/audit-project/lib/perf/schemas.js +140 -0
- package/plugins/audit-project/lib/platform/detect-platform.js +413 -0
- package/plugins/audit-project/lib/platform/detection-configs.js +93 -0
- package/plugins/audit-project/lib/platform/state-dir.js +132 -0
- package/plugins/audit-project/lib/platform/verify-tools.js +182 -0
- package/plugins/audit-project/lib/repo-map/cache.js +152 -0
- package/plugins/audit-project/lib/repo-map/index.js +222 -0
- package/plugins/audit-project/lib/repo-map/installer.js +212 -0
- package/plugins/audit-project/lib/repo-map/queries/go.js +27 -0
- package/plugins/audit-project/lib/repo-map/queries/index.js +100 -0
- package/plugins/audit-project/lib/repo-map/queries/java.js +38 -0
- package/plugins/audit-project/lib/repo-map/queries/javascript.js +55 -0
- package/plugins/audit-project/lib/repo-map/queries/python.js +24 -0
- package/plugins/audit-project/lib/repo-map/queries/rust.js +73 -0
- package/plugins/audit-project/lib/repo-map/queries/typescript.js +38 -0
- package/plugins/audit-project/lib/repo-map/runner.js +1165 -0
- package/plugins/audit-project/lib/repo-map/updater.js +474 -0
- package/plugins/audit-project/lib/repo-map/usage-analyzer.js +407 -0
- package/plugins/audit-project/lib/schemas/plugin-manifest.schema.json +57 -0
- package/plugins/audit-project/lib/schemas/validator.js +247 -0
- package/plugins/audit-project/lib/sources/custom-handler.js +199 -0
- package/plugins/audit-project/lib/sources/policy-questions.js +246 -0
- package/plugins/audit-project/lib/sources/source-cache.js +165 -0
- package/plugins/audit-project/lib/state/workflow-state.js +575 -0
- package/plugins/audit-project/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/audit-project/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/audit-project/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/audit-project/lib/types/index.d.ts +84 -0
- package/plugins/audit-project/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/audit-project/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/audit-project/lib/utils/atomic-write.js +94 -0
- package/plugins/audit-project/lib/utils/cache-manager.js +159 -0
- package/plugins/audit-project/lib/utils/context-optimizer.js +300 -0
- package/plugins/audit-project/lib/utils/deprecation.js +37 -0
- package/plugins/audit-project/lib/utils/shell-escape.js +88 -0
- package/plugins/consult/.claude-plugin/plugin.json +24 -0
- package/plugins/consult/agents/consult-agent.md +129 -0
- package/plugins/consult/commands/consult.md +248 -0
- package/plugins/consult/skills/consult/SKILL.md +285 -0
- package/plugins/deslop/.claude-plugin/plugin.json +20 -0
- package/plugins/deslop/agents/deslop-agent.md +88 -0
- package/plugins/deslop/commands/deslop.md +168 -0
- package/plugins/deslop/lib/adapter-transforms.js +278 -0
- package/plugins/deslop/lib/collectors/codebase.js +392 -0
- package/plugins/deslop/lib/collectors/docs-patterns.js +713 -0
- package/plugins/deslop/lib/collectors/documentation.js +219 -0
- package/plugins/deslop/lib/collectors/github.js +266 -0
- package/plugins/deslop/lib/collectors/index.js +126 -0
- package/plugins/deslop/lib/config/index.js +14 -0
- package/plugins/deslop/lib/cross-platform/index.js +539 -0
- package/plugins/deslop/lib/discovery/index.js +352 -0
- package/plugins/deslop/lib/drift-detect/collectors.js +37 -0
- package/plugins/deslop/lib/enhance/agent-analyzer.js +421 -0
- package/plugins/deslop/lib/enhance/agent-patterns.js +571 -0
- package/plugins/deslop/lib/enhance/auto-suppression.js +622 -0
- package/plugins/deslop/lib/enhance/benchmark.js +417 -0
- package/plugins/deslop/lib/enhance/cross-file-analyzer.js +930 -0
- package/plugins/deslop/lib/enhance/cross-file-patterns.js +370 -0
- package/plugins/deslop/lib/enhance/docs-analyzer.js +325 -0
- package/plugins/deslop/lib/enhance/docs-patterns.js +671 -0
- package/plugins/deslop/lib/enhance/fixer.js +721 -0
- package/plugins/deslop/lib/enhance/hook-analyzer.js +135 -0
- package/plugins/deslop/lib/enhance/hook-patterns.js +40 -0
- package/plugins/deslop/lib/enhance/index.js +127 -0
- package/plugins/deslop/lib/enhance/plugin-analyzer.js +402 -0
- package/plugins/deslop/lib/enhance/plugin-patterns.js +326 -0
- package/plugins/deslop/lib/enhance/projectmemory-analyzer.js +551 -0
- package/plugins/deslop/lib/enhance/projectmemory-patterns.js +617 -0
- package/plugins/deslop/lib/enhance/prompt-analyzer.js +457 -0
- package/plugins/deslop/lib/enhance/prompt-patterns.js +1484 -0
- package/plugins/deslop/lib/enhance/reporter.js +1348 -0
- package/plugins/deslop/lib/enhance/security-patterns.js +284 -0
- package/plugins/deslop/lib/enhance/skill-analyzer.js +182 -0
- package/plugins/deslop/lib/enhance/skill-patterns.js +147 -0
- package/plugins/deslop/lib/enhance/suppression.js +352 -0
- package/plugins/deslop/lib/enhance/tool-patterns.js +373 -0
- package/plugins/deslop/lib/index.js +270 -0
- package/plugins/deslop/lib/patterns/cli-enhancers.js +611 -0
- package/plugins/deslop/lib/patterns/pipeline.js +948 -0
- package/plugins/deslop/lib/patterns/review-patterns.js +558 -0
- package/plugins/deslop/lib/patterns/slop-analyzers.js +2305 -0
- package/plugins/deslop/lib/patterns/slop-patterns.js +1187 -0
- package/plugins/deslop/lib/perf/analyzer/index.js +22 -0
- package/plugins/deslop/lib/perf/argument-parser.js +105 -0
- package/plugins/deslop/lib/perf/baseline-comparator.js +50 -0
- package/plugins/deslop/lib/perf/baseline-store.js +127 -0
- package/plugins/deslop/lib/perf/benchmark-runner.js +399 -0
- package/plugins/deslop/lib/perf/breaking-point-finder.js +52 -0
- package/plugins/deslop/lib/perf/breaking-point-runner.js +60 -0
- package/plugins/deslop/lib/perf/checkpoint.js +123 -0
- package/plugins/deslop/lib/perf/code-paths.js +86 -0
- package/plugins/deslop/lib/perf/consolidation.js +37 -0
- package/plugins/deslop/lib/perf/constraint-runner.js +71 -0
- package/plugins/deslop/lib/perf/experiment-runner.js +32 -0
- package/plugins/deslop/lib/perf/index.js +41 -0
- package/plugins/deslop/lib/perf/investigation-state.js +875 -0
- package/plugins/deslop/lib/perf/optimization-runner.js +79 -0
- package/plugins/deslop/lib/perf/profilers/go.js +22 -0
- package/plugins/deslop/lib/perf/profilers/index.js +46 -0
- package/plugins/deslop/lib/perf/profilers/java.js +23 -0
- package/plugins/deslop/lib/perf/profilers/node.js +27 -0
- package/plugins/deslop/lib/perf/profilers/python.js +23 -0
- package/plugins/deslop/lib/perf/profilers/rust.js +23 -0
- package/plugins/deslop/lib/perf/profiling-runner.js +56 -0
- package/plugins/deslop/lib/perf/schemas.js +140 -0
- package/plugins/deslop/lib/platform/detect-platform.js +413 -0
- package/plugins/deslop/lib/platform/detection-configs.js +93 -0
- package/plugins/deslop/lib/platform/state-dir.js +132 -0
- package/plugins/deslop/lib/platform/verify-tools.js +182 -0
- package/plugins/deslop/lib/repo-map/cache.js +152 -0
- package/plugins/deslop/lib/repo-map/index.js +222 -0
- package/plugins/deslop/lib/repo-map/installer.js +212 -0
- package/plugins/deslop/lib/repo-map/queries/go.js +27 -0
- package/plugins/deslop/lib/repo-map/queries/index.js +100 -0
- package/plugins/deslop/lib/repo-map/queries/java.js +38 -0
- package/plugins/deslop/lib/repo-map/queries/javascript.js +55 -0
- package/plugins/deslop/lib/repo-map/queries/python.js +24 -0
- package/plugins/deslop/lib/repo-map/queries/rust.js +73 -0
- package/plugins/deslop/lib/repo-map/queries/typescript.js +38 -0
- package/plugins/deslop/lib/repo-map/runner.js +1165 -0
- package/plugins/deslop/lib/repo-map/updater.js +474 -0
- package/plugins/deslop/lib/repo-map/usage-analyzer.js +407 -0
- package/plugins/deslop/lib/schemas/plugin-manifest.schema.json +57 -0
- package/plugins/deslop/lib/schemas/validator.js +247 -0
- package/plugins/deslop/lib/sources/custom-handler.js +199 -0
- package/plugins/deslop/lib/sources/policy-questions.js +246 -0
- package/plugins/deslop/lib/sources/source-cache.js +165 -0
- package/plugins/deslop/lib/state/workflow-state.js +575 -0
- package/plugins/deslop/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/deslop/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/deslop/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/deslop/lib/types/index.d.ts +84 -0
- package/plugins/deslop/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/deslop/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/deslop/lib/utils/atomic-write.js +94 -0
- package/plugins/deslop/lib/utils/cache-manager.js +159 -0
- package/plugins/deslop/lib/utils/context-optimizer.js +300 -0
- package/plugins/deslop/lib/utils/deprecation.js +37 -0
- package/plugins/deslop/lib/utils/shell-escape.js +88 -0
- package/plugins/deslop/references/slop-categories.md +122 -0
- package/plugins/deslop/scripts/detect.js +134 -0
- package/plugins/deslop/skills/deslop/SKILL.md +204 -0
- package/plugins/drift-detect/.claude-plugin/plugin.json +23 -0
- package/plugins/drift-detect/agents/plan-synthesizer.md +225 -0
- package/plugins/drift-detect/commands/drift-detect.md +269 -0
- package/plugins/drift-detect/lib/adapter-transforms.js +278 -0
- package/plugins/drift-detect/lib/collectors/codebase.js +392 -0
- package/plugins/drift-detect/lib/collectors/docs-patterns.js +713 -0
- package/plugins/drift-detect/lib/collectors/documentation.js +219 -0
- package/plugins/drift-detect/lib/collectors/github.js +266 -0
- package/plugins/drift-detect/lib/collectors/index.js +126 -0
- package/plugins/drift-detect/lib/config/index.js +14 -0
- package/plugins/drift-detect/lib/cross-platform/index.js +539 -0
- package/plugins/drift-detect/lib/discovery/index.js +352 -0
- package/plugins/drift-detect/lib/drift-detect/collectors.js +37 -0
- package/plugins/drift-detect/lib/enhance/agent-analyzer.js +421 -0
- package/plugins/drift-detect/lib/enhance/agent-patterns.js +571 -0
- package/plugins/drift-detect/lib/enhance/auto-suppression.js +622 -0
- package/plugins/drift-detect/lib/enhance/benchmark.js +417 -0
- package/plugins/drift-detect/lib/enhance/cross-file-analyzer.js +930 -0
- package/plugins/drift-detect/lib/enhance/cross-file-patterns.js +370 -0
- package/plugins/drift-detect/lib/enhance/docs-analyzer.js +325 -0
- package/plugins/drift-detect/lib/enhance/docs-patterns.js +671 -0
- package/plugins/drift-detect/lib/enhance/fixer.js +721 -0
- package/plugins/drift-detect/lib/enhance/hook-analyzer.js +135 -0
- package/plugins/drift-detect/lib/enhance/hook-patterns.js +40 -0
- package/plugins/drift-detect/lib/enhance/index.js +127 -0
- package/plugins/drift-detect/lib/enhance/plugin-analyzer.js +402 -0
- package/plugins/drift-detect/lib/enhance/plugin-patterns.js +326 -0
- package/plugins/drift-detect/lib/enhance/projectmemory-analyzer.js +551 -0
- package/plugins/drift-detect/lib/enhance/projectmemory-patterns.js +617 -0
- package/plugins/drift-detect/lib/enhance/prompt-analyzer.js +457 -0
- package/plugins/drift-detect/lib/enhance/prompt-patterns.js +1484 -0
- package/plugins/drift-detect/lib/enhance/reporter.js +1348 -0
- package/plugins/drift-detect/lib/enhance/security-patterns.js +284 -0
- package/plugins/drift-detect/lib/enhance/skill-analyzer.js +182 -0
- package/plugins/drift-detect/lib/enhance/skill-patterns.js +147 -0
- package/plugins/drift-detect/lib/enhance/suppression.js +352 -0
- package/plugins/drift-detect/lib/enhance/tool-patterns.js +373 -0
- package/plugins/drift-detect/lib/index.js +270 -0
- package/plugins/drift-detect/lib/patterns/cli-enhancers.js +611 -0
- package/plugins/drift-detect/lib/patterns/pipeline.js +948 -0
- package/plugins/drift-detect/lib/patterns/review-patterns.js +558 -0
- package/plugins/drift-detect/lib/patterns/slop-analyzers.js +2305 -0
- package/plugins/drift-detect/lib/patterns/slop-patterns.js +1187 -0
- package/plugins/drift-detect/lib/perf/analyzer/index.js +22 -0
- package/plugins/drift-detect/lib/perf/argument-parser.js +105 -0
- package/plugins/drift-detect/lib/perf/baseline-comparator.js +50 -0
- package/plugins/drift-detect/lib/perf/baseline-store.js +127 -0
- package/plugins/drift-detect/lib/perf/benchmark-runner.js +399 -0
- package/plugins/drift-detect/lib/perf/breaking-point-finder.js +52 -0
- package/plugins/drift-detect/lib/perf/breaking-point-runner.js +60 -0
- package/plugins/drift-detect/lib/perf/checkpoint.js +123 -0
- package/plugins/drift-detect/lib/perf/code-paths.js +86 -0
- package/plugins/drift-detect/lib/perf/consolidation.js +37 -0
- package/plugins/drift-detect/lib/perf/constraint-runner.js +71 -0
- package/plugins/drift-detect/lib/perf/experiment-runner.js +32 -0
- package/plugins/drift-detect/lib/perf/index.js +41 -0
- package/plugins/drift-detect/lib/perf/investigation-state.js +875 -0
- package/plugins/drift-detect/lib/perf/optimization-runner.js +79 -0
- package/plugins/drift-detect/lib/perf/profilers/go.js +22 -0
- package/plugins/drift-detect/lib/perf/profilers/index.js +46 -0
- package/plugins/drift-detect/lib/perf/profilers/java.js +23 -0
- package/plugins/drift-detect/lib/perf/profilers/node.js +27 -0
- package/plugins/drift-detect/lib/perf/profilers/python.js +23 -0
- package/plugins/drift-detect/lib/perf/profilers/rust.js +23 -0
- package/plugins/drift-detect/lib/perf/profiling-runner.js +56 -0
- package/plugins/drift-detect/lib/perf/schemas.js +140 -0
- package/plugins/drift-detect/lib/platform/detect-platform.js +413 -0
- package/plugins/drift-detect/lib/platform/detection-configs.js +93 -0
- package/plugins/drift-detect/lib/platform/state-dir.js +132 -0
- package/plugins/drift-detect/lib/platform/verify-tools.js +182 -0
- package/plugins/drift-detect/lib/repo-map/cache.js +152 -0
- package/plugins/drift-detect/lib/repo-map/index.js +222 -0
- package/plugins/drift-detect/lib/repo-map/installer.js +212 -0
- package/plugins/drift-detect/lib/repo-map/queries/go.js +27 -0
- package/plugins/drift-detect/lib/repo-map/queries/index.js +100 -0
- package/plugins/drift-detect/lib/repo-map/queries/java.js +38 -0
- package/plugins/drift-detect/lib/repo-map/queries/javascript.js +55 -0
- package/plugins/drift-detect/lib/repo-map/queries/python.js +24 -0
- package/plugins/drift-detect/lib/repo-map/queries/rust.js +73 -0
- package/plugins/drift-detect/lib/repo-map/queries/typescript.js +38 -0
- package/plugins/drift-detect/lib/repo-map/runner.js +1165 -0
- package/plugins/drift-detect/lib/repo-map/updater.js +474 -0
- package/plugins/drift-detect/lib/repo-map/usage-analyzer.js +407 -0
- package/plugins/drift-detect/lib/schemas/plugin-manifest.schema.json +57 -0
- package/plugins/drift-detect/lib/schemas/validator.js +247 -0
- package/plugins/drift-detect/lib/sources/custom-handler.js +199 -0
- package/plugins/drift-detect/lib/sources/policy-questions.js +246 -0
- package/plugins/drift-detect/lib/sources/source-cache.js +165 -0
- package/plugins/drift-detect/lib/state/workflow-state.js +575 -0
- package/plugins/drift-detect/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/drift-detect/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/drift-detect/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/drift-detect/lib/types/index.d.ts +84 -0
- package/plugins/drift-detect/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/drift-detect/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/drift-detect/lib/utils/atomic-write.js +94 -0
- package/plugins/drift-detect/lib/utils/cache-manager.js +159 -0
- package/plugins/drift-detect/lib/utils/context-optimizer.js +300 -0
- package/plugins/drift-detect/lib/utils/deprecation.js +37 -0
- package/plugins/drift-detect/lib/utils/shell-escape.js +88 -0
- package/plugins/drift-detect/skills/drift-analysis/SKILL.md +324 -0
- package/plugins/enhance/.claude-plugin/plugin.json +20 -0
- package/plugins/enhance/agents/agent-enhancer.md +64 -0
- package/plugins/enhance/agents/claudemd-enhancer.md +65 -0
- package/plugins/enhance/agents/cross-file-enhancer.md +54 -0
- package/plugins/enhance/agents/docs-enhancer.md +64 -0
- package/plugins/enhance/agents/hooks-enhancer.md +64 -0
- package/plugins/enhance/agents/plugin-enhancer.md +63 -0
- package/plugins/enhance/agents/prompt-enhancer.md +58 -0
- package/plugins/enhance/agents/skills-enhancer.md +64 -0
- package/plugins/enhance/commands/enhance.md +178 -0
- package/plugins/enhance/lib/adapter-transforms.js +278 -0
- package/plugins/enhance/lib/collectors/codebase.js +392 -0
- package/plugins/enhance/lib/collectors/docs-patterns.js +713 -0
- package/plugins/enhance/lib/collectors/documentation.js +219 -0
- package/plugins/enhance/lib/collectors/github.js +266 -0
- package/plugins/enhance/lib/collectors/index.js +126 -0
- package/plugins/enhance/lib/config/index.js +14 -0
- package/plugins/enhance/lib/cross-platform/index.js +539 -0
- package/plugins/enhance/lib/discovery/index.js +352 -0
- package/plugins/enhance/lib/drift-detect/collectors.js +37 -0
- package/plugins/enhance/lib/enhance/agent-analyzer.js +421 -0
- package/plugins/enhance/lib/enhance/agent-patterns.js +571 -0
- package/plugins/enhance/lib/enhance/auto-suppression.js +622 -0
- package/plugins/enhance/lib/enhance/benchmark.js +417 -0
- package/plugins/enhance/lib/enhance/cross-file-analyzer.js +930 -0
- package/plugins/enhance/lib/enhance/cross-file-patterns.js +370 -0
- package/plugins/enhance/lib/enhance/docs-analyzer.js +325 -0
- package/plugins/enhance/lib/enhance/docs-patterns.js +671 -0
- package/plugins/enhance/lib/enhance/fixer.js +721 -0
- package/plugins/enhance/lib/enhance/hook-analyzer.js +135 -0
- package/plugins/enhance/lib/enhance/hook-patterns.js +40 -0
- package/plugins/enhance/lib/enhance/index.js +127 -0
- package/plugins/enhance/lib/enhance/plugin-analyzer.js +402 -0
- package/plugins/enhance/lib/enhance/plugin-patterns.js +326 -0
- package/plugins/enhance/lib/enhance/projectmemory-analyzer.js +551 -0
- package/plugins/enhance/lib/enhance/projectmemory-patterns.js +617 -0
- package/plugins/enhance/lib/enhance/prompt-analyzer.js +457 -0
- package/plugins/enhance/lib/enhance/prompt-patterns.js +1484 -0
- package/plugins/enhance/lib/enhance/reporter.js +1348 -0
- package/plugins/enhance/lib/enhance/security-patterns.js +284 -0
- package/plugins/enhance/lib/enhance/skill-analyzer.js +182 -0
- package/plugins/enhance/lib/enhance/skill-patterns.js +147 -0
- package/plugins/enhance/lib/enhance/suppression.js +352 -0
- package/plugins/enhance/lib/enhance/tool-patterns.js +373 -0
- package/plugins/enhance/lib/index.js +270 -0
- package/plugins/enhance/lib/patterns/cli-enhancers.js +611 -0
- package/plugins/enhance/lib/patterns/pipeline.js +948 -0
- package/plugins/enhance/lib/patterns/review-patterns.js +558 -0
- package/plugins/enhance/lib/patterns/slop-analyzers.js +2305 -0
- package/plugins/enhance/lib/patterns/slop-patterns.js +1187 -0
- package/plugins/enhance/lib/perf/analyzer/index.js +22 -0
- package/plugins/enhance/lib/perf/argument-parser.js +105 -0
- package/plugins/enhance/lib/perf/baseline-comparator.js +50 -0
- package/plugins/enhance/lib/perf/baseline-store.js +127 -0
- package/plugins/enhance/lib/perf/benchmark-runner.js +399 -0
- package/plugins/enhance/lib/perf/breaking-point-finder.js +52 -0
- package/plugins/enhance/lib/perf/breaking-point-runner.js +60 -0
- package/plugins/enhance/lib/perf/checkpoint.js +123 -0
- package/plugins/enhance/lib/perf/code-paths.js +86 -0
- package/plugins/enhance/lib/perf/consolidation.js +37 -0
- package/plugins/enhance/lib/perf/constraint-runner.js +71 -0
- package/plugins/enhance/lib/perf/experiment-runner.js +32 -0
- package/plugins/enhance/lib/perf/index.js +41 -0
- package/plugins/enhance/lib/perf/investigation-state.js +875 -0
- package/plugins/enhance/lib/perf/optimization-runner.js +79 -0
- package/plugins/enhance/lib/perf/profilers/go.js +22 -0
- package/plugins/enhance/lib/perf/profilers/index.js +46 -0
- package/plugins/enhance/lib/perf/profilers/java.js +23 -0
- package/plugins/enhance/lib/perf/profilers/node.js +27 -0
- package/plugins/enhance/lib/perf/profilers/python.js +23 -0
- package/plugins/enhance/lib/perf/profilers/rust.js +23 -0
- package/plugins/enhance/lib/perf/profiling-runner.js +56 -0
- package/plugins/enhance/lib/perf/schemas.js +140 -0
- package/plugins/enhance/lib/platform/detect-platform.js +413 -0
- package/plugins/enhance/lib/platform/detection-configs.js +93 -0
- package/plugins/enhance/lib/platform/state-dir.js +132 -0
- package/plugins/enhance/lib/platform/verify-tools.js +182 -0
- package/plugins/enhance/lib/repo-map/cache.js +152 -0
- package/plugins/enhance/lib/repo-map/index.js +222 -0
- package/plugins/enhance/lib/repo-map/installer.js +212 -0
- package/plugins/enhance/lib/repo-map/queries/go.js +27 -0
- package/plugins/enhance/lib/repo-map/queries/index.js +100 -0
- package/plugins/enhance/lib/repo-map/queries/java.js +38 -0
- package/plugins/enhance/lib/repo-map/queries/javascript.js +55 -0
- package/plugins/enhance/lib/repo-map/queries/python.js +24 -0
- package/plugins/enhance/lib/repo-map/queries/rust.js +73 -0
- package/plugins/enhance/lib/repo-map/queries/typescript.js +38 -0
- package/plugins/enhance/lib/repo-map/runner.js +1165 -0
- package/plugins/enhance/lib/repo-map/updater.js +474 -0
- package/plugins/enhance/lib/repo-map/usage-analyzer.js +407 -0
- package/plugins/enhance/lib/schemas/plugin-manifest.schema.json +57 -0
- package/plugins/enhance/lib/schemas/validator.js +247 -0
- package/plugins/enhance/lib/sources/custom-handler.js +199 -0
- package/plugins/enhance/lib/sources/policy-questions.js +246 -0
- package/plugins/enhance/lib/sources/source-cache.js +165 -0
- package/plugins/enhance/lib/state/workflow-state.js +575 -0
- package/plugins/enhance/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/enhance/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/enhance/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/enhance/lib/types/index.d.ts +84 -0
- package/plugins/enhance/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/enhance/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/enhance/lib/utils/atomic-write.js +94 -0
- package/plugins/enhance/lib/utils/cache-manager.js +159 -0
- package/plugins/enhance/lib/utils/context-optimizer.js +300 -0
- package/plugins/enhance/lib/utils/deprecation.js +37 -0
- package/plugins/enhance/lib/utils/shell-escape.js +88 -0
- package/plugins/enhance/skills/enhance-agent-prompts/SKILL.md +277 -0
- package/plugins/enhance/skills/enhance-claude-memory/SKILL.md +387 -0
- package/plugins/enhance/skills/enhance-cross-file/SKILL.md +110 -0
- package/plugins/enhance/skills/enhance-docs/SKILL.md +298 -0
- package/plugins/enhance/skills/enhance-hooks/SKILL.md +554 -0
- package/plugins/enhance/skills/enhance-orchestrator/SKILL.md +255 -0
- package/plugins/enhance/skills/enhance-plugins/SKILL.md +319 -0
- package/plugins/enhance/skills/enhance-prompts/SKILL.md +340 -0
- package/plugins/enhance/skills/enhance-skills/SKILL.md +436 -0
- package/plugins/learn/.claude-plugin/plugin.json +21 -0
- package/plugins/learn/agents/learn-agent.md +331 -0
- package/plugins/learn/commands/learn.md +190 -0
- package/plugins/learn/lib/adapter-transforms.js +278 -0
- package/plugins/learn/lib/collectors/codebase.js +392 -0
- package/plugins/learn/lib/collectors/docs-patterns.js +713 -0
- package/plugins/learn/lib/collectors/documentation.js +219 -0
- package/plugins/learn/lib/collectors/github.js +266 -0
- package/plugins/learn/lib/collectors/index.js +126 -0
- package/plugins/learn/lib/config/index.js +14 -0
- package/plugins/learn/lib/cross-platform/index.js +539 -0
- package/plugins/learn/lib/discovery/index.js +352 -0
- package/plugins/learn/lib/drift-detect/collectors.js +37 -0
- package/plugins/learn/lib/enhance/agent-analyzer.js +421 -0
- package/plugins/learn/lib/enhance/agent-patterns.js +571 -0
- package/plugins/learn/lib/enhance/auto-suppression.js +622 -0
- package/plugins/learn/lib/enhance/benchmark.js +417 -0
- package/plugins/learn/lib/enhance/cross-file-analyzer.js +930 -0
- package/plugins/learn/lib/enhance/cross-file-patterns.js +370 -0
- package/plugins/learn/lib/enhance/docs-analyzer.js +325 -0
- package/plugins/learn/lib/enhance/docs-patterns.js +671 -0
- package/plugins/learn/lib/enhance/fixer.js +721 -0
- package/plugins/learn/lib/enhance/hook-analyzer.js +135 -0
- package/plugins/learn/lib/enhance/hook-patterns.js +40 -0
- package/plugins/learn/lib/enhance/index.js +127 -0
- package/plugins/learn/lib/enhance/plugin-analyzer.js +402 -0
- package/plugins/learn/lib/enhance/plugin-patterns.js +326 -0
- package/plugins/learn/lib/enhance/projectmemory-analyzer.js +551 -0
- package/plugins/learn/lib/enhance/projectmemory-patterns.js +617 -0
- package/plugins/learn/lib/enhance/prompt-analyzer.js +457 -0
- package/plugins/learn/lib/enhance/prompt-patterns.js +1484 -0
- package/plugins/learn/lib/enhance/reporter.js +1348 -0
- package/plugins/learn/lib/enhance/security-patterns.js +284 -0
- package/plugins/learn/lib/enhance/skill-analyzer.js +182 -0
- package/plugins/learn/lib/enhance/skill-patterns.js +147 -0
- package/plugins/learn/lib/enhance/suppression.js +352 -0
- package/plugins/learn/lib/enhance/tool-patterns.js +373 -0
- package/plugins/learn/lib/index.js +270 -0
- package/plugins/learn/lib/patterns/cli-enhancers.js +611 -0
- package/plugins/learn/lib/patterns/pipeline.js +948 -0
- package/plugins/learn/lib/patterns/review-patterns.js +558 -0
- package/plugins/learn/lib/patterns/slop-analyzers.js +2305 -0
- package/plugins/learn/lib/patterns/slop-patterns.js +1187 -0
- package/plugins/learn/lib/perf/analyzer/index.js +22 -0
- package/plugins/learn/lib/perf/argument-parser.js +105 -0
- package/plugins/learn/lib/perf/baseline-comparator.js +50 -0
- package/plugins/learn/lib/perf/baseline-store.js +127 -0
- package/plugins/learn/lib/perf/benchmark-runner.js +399 -0
- package/plugins/learn/lib/perf/breaking-point-finder.js +52 -0
- package/plugins/learn/lib/perf/breaking-point-runner.js +60 -0
- package/plugins/learn/lib/perf/checkpoint.js +123 -0
- package/plugins/learn/lib/perf/code-paths.js +86 -0
- package/plugins/learn/lib/perf/consolidation.js +37 -0
- package/plugins/learn/lib/perf/constraint-runner.js +71 -0
- package/plugins/learn/lib/perf/experiment-runner.js +32 -0
- package/plugins/learn/lib/perf/index.js +41 -0
- package/plugins/learn/lib/perf/investigation-state.js +875 -0
- package/plugins/learn/lib/perf/optimization-runner.js +79 -0
- package/plugins/learn/lib/perf/profilers/go.js +22 -0
- package/plugins/learn/lib/perf/profilers/index.js +46 -0
- package/plugins/learn/lib/perf/profilers/java.js +23 -0
- package/plugins/learn/lib/perf/profilers/node.js +27 -0
- package/plugins/learn/lib/perf/profilers/python.js +23 -0
- package/plugins/learn/lib/perf/profilers/rust.js +23 -0
- package/plugins/learn/lib/perf/profiling-runner.js +56 -0
- package/plugins/learn/lib/perf/schemas.js +140 -0
- package/plugins/learn/lib/platform/detect-platform.js +413 -0
- package/plugins/learn/lib/platform/detection-configs.js +93 -0
- package/plugins/learn/lib/platform/state-dir.js +132 -0
- package/plugins/learn/lib/platform/verify-tools.js +182 -0
- package/plugins/learn/lib/repo-map/cache.js +152 -0
- package/plugins/learn/lib/repo-map/index.js +222 -0
- package/plugins/learn/lib/repo-map/installer.js +212 -0
- package/plugins/learn/lib/repo-map/queries/go.js +27 -0
- package/plugins/learn/lib/repo-map/queries/index.js +100 -0
- package/plugins/learn/lib/repo-map/queries/java.js +38 -0
- package/plugins/learn/lib/repo-map/queries/javascript.js +55 -0
- package/plugins/learn/lib/repo-map/queries/python.js +24 -0
- package/plugins/learn/lib/repo-map/queries/rust.js +73 -0
- package/plugins/learn/lib/repo-map/queries/typescript.js +38 -0
- package/plugins/learn/lib/repo-map/runner.js +1165 -0
- package/plugins/learn/lib/repo-map/updater.js +474 -0
- package/plugins/learn/lib/repo-map/usage-analyzer.js +407 -0
- package/plugins/learn/lib/schemas/plugin-manifest.schema.json +57 -0
- package/plugins/learn/lib/schemas/validator.js +247 -0
- package/plugins/learn/lib/sources/custom-handler.js +199 -0
- package/plugins/learn/lib/sources/policy-questions.js +246 -0
- package/plugins/learn/lib/sources/source-cache.js +165 -0
- package/plugins/learn/lib/state/workflow-state.js +575 -0
- package/plugins/learn/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/learn/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/learn/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/learn/lib/types/index.d.ts +84 -0
- package/plugins/learn/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/learn/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/learn/lib/utils/atomic-write.js +94 -0
- package/plugins/learn/lib/utils/cache-manager.js +159 -0
- package/plugins/learn/lib/utils/context-optimizer.js +300 -0
- package/plugins/learn/lib/utils/deprecation.js +37 -0
- package/plugins/learn/lib/utils/shell-escape.js +88 -0
- package/plugins/learn/skills/learn/SKILL.md +349 -0
- package/plugins/next-task/.claude-plugin/plugin.json +24 -0
- package/plugins/next-task/agents/ci-fixer.md +259 -0
- package/plugins/next-task/agents/ci-monitor.md +342 -0
- package/plugins/next-task/agents/delivery-validator.md +115 -0
- package/plugins/next-task/agents/exploration-agent.md +316 -0
- package/plugins/next-task/agents/implementation-agent.md +465 -0
- package/plugins/next-task/agents/planning-agent.md +377 -0
- package/plugins/next-task/agents/simple-fixer.md +139 -0
- package/plugins/next-task/agents/task-discoverer.md +89 -0
- package/plugins/next-task/agents/test-coverage-checker.md +451 -0
- package/plugins/next-task/agents/worktree-manager.md +257 -0
- package/plugins/next-task/commands/delivery-approval.md +341 -0
- package/plugins/next-task/commands/next-task.md +547 -0
- package/plugins/next-task/hooks/hooks.json +14 -0
- package/plugins/next-task/lib/adapter-transforms.js +278 -0
- package/plugins/next-task/lib/collectors/codebase.js +392 -0
- package/plugins/next-task/lib/collectors/docs-patterns.js +713 -0
- package/plugins/next-task/lib/collectors/documentation.js +219 -0
- package/plugins/next-task/lib/collectors/github.js +266 -0
- package/plugins/next-task/lib/collectors/index.js +126 -0
- package/plugins/next-task/lib/config/index.js +14 -0
- package/plugins/next-task/lib/cross-platform/index.js +539 -0
- package/plugins/next-task/lib/discovery/index.js +352 -0
- package/plugins/next-task/lib/drift-detect/collectors.js +37 -0
- package/plugins/next-task/lib/enhance/agent-analyzer.js +421 -0
- package/plugins/next-task/lib/enhance/agent-patterns.js +571 -0
- package/plugins/next-task/lib/enhance/auto-suppression.js +622 -0
- package/plugins/next-task/lib/enhance/benchmark.js +417 -0
- package/plugins/next-task/lib/enhance/cross-file-analyzer.js +930 -0
- package/plugins/next-task/lib/enhance/cross-file-patterns.js +370 -0
- package/plugins/next-task/lib/enhance/docs-analyzer.js +325 -0
- package/plugins/next-task/lib/enhance/docs-patterns.js +671 -0
- package/plugins/next-task/lib/enhance/fixer.js +721 -0
- package/plugins/next-task/lib/enhance/hook-analyzer.js +135 -0
- package/plugins/next-task/lib/enhance/hook-patterns.js +40 -0
- package/plugins/next-task/lib/enhance/index.js +127 -0
- package/plugins/next-task/lib/enhance/plugin-analyzer.js +402 -0
- package/plugins/next-task/lib/enhance/plugin-patterns.js +326 -0
- package/plugins/next-task/lib/enhance/projectmemory-analyzer.js +551 -0
- package/plugins/next-task/lib/enhance/projectmemory-patterns.js +617 -0
- package/plugins/next-task/lib/enhance/prompt-analyzer.js +457 -0
- package/plugins/next-task/lib/enhance/prompt-patterns.js +1484 -0
- package/plugins/next-task/lib/enhance/reporter.js +1348 -0
- package/plugins/next-task/lib/enhance/security-patterns.js +284 -0
- package/plugins/next-task/lib/enhance/skill-analyzer.js +182 -0
- package/plugins/next-task/lib/enhance/skill-patterns.js +147 -0
- package/plugins/next-task/lib/enhance/suppression.js +352 -0
- package/plugins/next-task/lib/enhance/tool-patterns.js +373 -0
- package/plugins/next-task/lib/index.js +270 -0
- package/plugins/next-task/lib/patterns/cli-enhancers.js +611 -0
- package/plugins/next-task/lib/patterns/pipeline.js +948 -0
- package/plugins/next-task/lib/patterns/review-patterns.js +558 -0
- package/plugins/next-task/lib/patterns/slop-analyzers.js +2305 -0
- package/plugins/next-task/lib/patterns/slop-patterns.js +1187 -0
- package/plugins/next-task/lib/perf/analyzer/index.js +22 -0
- package/plugins/next-task/lib/perf/argument-parser.js +105 -0
- package/plugins/next-task/lib/perf/baseline-comparator.js +50 -0
- package/plugins/next-task/lib/perf/baseline-store.js +127 -0
- package/plugins/next-task/lib/perf/benchmark-runner.js +399 -0
- package/plugins/next-task/lib/perf/breaking-point-finder.js +52 -0
- package/plugins/next-task/lib/perf/breaking-point-runner.js +60 -0
- package/plugins/next-task/lib/perf/checkpoint.js +123 -0
- package/plugins/next-task/lib/perf/code-paths.js +86 -0
- package/plugins/next-task/lib/perf/consolidation.js +37 -0
- package/plugins/next-task/lib/perf/constraint-runner.js +71 -0
- package/plugins/next-task/lib/perf/experiment-runner.js +32 -0
- package/plugins/next-task/lib/perf/index.js +41 -0
- package/plugins/next-task/lib/perf/investigation-state.js +875 -0
- package/plugins/next-task/lib/perf/optimization-runner.js +79 -0
- package/plugins/next-task/lib/perf/profilers/go.js +22 -0
- package/plugins/next-task/lib/perf/profilers/index.js +46 -0
- package/plugins/next-task/lib/perf/profilers/java.js +23 -0
- package/plugins/next-task/lib/perf/profilers/node.js +27 -0
- package/plugins/next-task/lib/perf/profilers/python.js +23 -0
- package/plugins/next-task/lib/perf/profilers/rust.js +23 -0
- package/plugins/next-task/lib/perf/profiling-runner.js +56 -0
- package/plugins/next-task/lib/perf/schemas.js +140 -0
- package/plugins/next-task/lib/platform/detect-platform.js +413 -0
- package/plugins/next-task/lib/platform/detection-configs.js +93 -0
- package/plugins/next-task/lib/platform/state-dir.js +132 -0
- package/plugins/next-task/lib/platform/verify-tools.js +182 -0
- package/plugins/next-task/lib/repo-map/cache.js +152 -0
- package/plugins/next-task/lib/repo-map/index.js +222 -0
- package/plugins/next-task/lib/repo-map/installer.js +212 -0
- package/plugins/next-task/lib/repo-map/queries/go.js +27 -0
- package/plugins/next-task/lib/repo-map/queries/index.js +100 -0
- package/plugins/next-task/lib/repo-map/queries/java.js +38 -0
- package/plugins/next-task/lib/repo-map/queries/javascript.js +55 -0
- package/plugins/next-task/lib/repo-map/queries/python.js +24 -0
- package/plugins/next-task/lib/repo-map/queries/rust.js +73 -0
- package/plugins/next-task/lib/repo-map/queries/typescript.js +38 -0
- package/plugins/next-task/lib/repo-map/runner.js +1165 -0
- package/plugins/next-task/lib/repo-map/updater.js +474 -0
- package/plugins/next-task/lib/repo-map/usage-analyzer.js +407 -0
- package/plugins/next-task/lib/schemas/plugin-manifest.schema.json +57 -0
- package/plugins/next-task/lib/schemas/validator.js +247 -0
- package/plugins/next-task/lib/sources/custom-handler.js +199 -0
- package/plugins/next-task/lib/sources/policy-questions.js +246 -0
- package/plugins/next-task/lib/sources/source-cache.js +165 -0
- package/plugins/next-task/lib/state/workflow-state.js +575 -0
- package/plugins/next-task/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/next-task/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/next-task/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/next-task/lib/types/index.d.ts +84 -0
- package/plugins/next-task/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/next-task/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/next-task/lib/utils/atomic-write.js +94 -0
- package/plugins/next-task/lib/utils/cache-manager.js +159 -0
- package/plugins/next-task/lib/utils/context-optimizer.js +300 -0
- package/plugins/next-task/lib/utils/deprecation.js +37 -0
- package/plugins/next-task/lib/utils/shell-escape.js +88 -0
- package/plugins/next-task/skills/discover-tasks/SKILL.md +191 -0
- package/plugins/next-task/skills/orchestrate-review/SKILL.md +239 -0
- package/plugins/next-task/skills/validate-delivery/SKILL.md +186 -0
- package/plugins/perf/.claude-plugin/plugin.json +20 -0
- package/plugins/perf/agents/perf-analyzer.md +43 -0
- package/plugins/perf/agents/perf-code-paths.md +16 -0
- package/plugins/perf/agents/perf-investigation-logger.md +47 -0
- package/plugins/perf/agents/perf-orchestrator.md +344 -0
- package/plugins/perf/agents/perf-theory-gatherer.md +25 -0
- package/plugins/perf/agents/perf-theory-tester.md +58 -0
- package/plugins/perf/commands/perf.md +470 -0
- package/plugins/perf/hooks/checkpoint.md +35 -0
- package/plugins/perf/hooks/constraint-tester.md +40 -0
- package/plugins/perf/lib/adapter-transforms.js +278 -0
- package/plugins/perf/lib/collectors/codebase.js +392 -0
- package/plugins/perf/lib/collectors/docs-patterns.js +713 -0
- package/plugins/perf/lib/collectors/documentation.js +219 -0
- package/plugins/perf/lib/collectors/github.js +266 -0
- package/plugins/perf/lib/collectors/index.js +126 -0
- package/plugins/perf/lib/config/index.js +14 -0
- package/plugins/perf/lib/cross-platform/index.js +539 -0
- package/plugins/perf/lib/discovery/index.js +352 -0
- package/plugins/perf/lib/drift-detect/collectors.js +37 -0
- package/plugins/perf/lib/enhance/agent-analyzer.js +421 -0
- package/plugins/perf/lib/enhance/agent-patterns.js +571 -0
- package/plugins/perf/lib/enhance/auto-suppression.js +622 -0
- package/plugins/perf/lib/enhance/benchmark.js +417 -0
- package/plugins/perf/lib/enhance/cross-file-analyzer.js +930 -0
- package/plugins/perf/lib/enhance/cross-file-patterns.js +370 -0
- package/plugins/perf/lib/enhance/docs-analyzer.js +325 -0
- package/plugins/perf/lib/enhance/docs-patterns.js +671 -0
- package/plugins/perf/lib/enhance/fixer.js +721 -0
- package/plugins/perf/lib/enhance/hook-analyzer.js +135 -0
- package/plugins/perf/lib/enhance/hook-patterns.js +40 -0
- package/plugins/perf/lib/enhance/index.js +127 -0
- package/plugins/perf/lib/enhance/plugin-analyzer.js +402 -0
- package/plugins/perf/lib/enhance/plugin-patterns.js +326 -0
- package/plugins/perf/lib/enhance/projectmemory-analyzer.js +551 -0
- package/plugins/perf/lib/enhance/projectmemory-patterns.js +617 -0
- package/plugins/perf/lib/enhance/prompt-analyzer.js +457 -0
- package/plugins/perf/lib/enhance/prompt-patterns.js +1484 -0
- package/plugins/perf/lib/enhance/reporter.js +1348 -0
- package/plugins/perf/lib/enhance/security-patterns.js +284 -0
- package/plugins/perf/lib/enhance/skill-analyzer.js +182 -0
- package/plugins/perf/lib/enhance/skill-patterns.js +147 -0
- package/plugins/perf/lib/enhance/suppression.js +352 -0
- package/plugins/perf/lib/enhance/tool-patterns.js +373 -0
- package/plugins/perf/lib/index.js +270 -0
- package/plugins/perf/lib/patterns/cli-enhancers.js +611 -0
- package/plugins/perf/lib/patterns/pipeline.js +948 -0
- package/plugins/perf/lib/patterns/review-patterns.js +558 -0
- package/plugins/perf/lib/patterns/slop-analyzers.js +2305 -0
- package/plugins/perf/lib/patterns/slop-patterns.js +1187 -0
- package/plugins/perf/lib/perf/analyzer/index.js +22 -0
- package/plugins/perf/lib/perf/argument-parser.js +105 -0
- package/plugins/perf/lib/perf/baseline-comparator.js +50 -0
- package/plugins/perf/lib/perf/baseline-store.js +127 -0
- package/plugins/perf/lib/perf/benchmark-runner.js +399 -0
- package/plugins/perf/lib/perf/breaking-point-finder.js +52 -0
- package/plugins/perf/lib/perf/breaking-point-runner.js +60 -0
- package/plugins/perf/lib/perf/checkpoint.js +123 -0
- package/plugins/perf/lib/perf/code-paths.js +86 -0
- package/plugins/perf/lib/perf/consolidation.js +37 -0
- package/plugins/perf/lib/perf/constraint-runner.js +71 -0
- package/plugins/perf/lib/perf/experiment-runner.js +32 -0
- package/plugins/perf/lib/perf/index.js +41 -0
- package/plugins/perf/lib/perf/investigation-state.js +875 -0
- package/plugins/perf/lib/perf/optimization-runner.js +79 -0
- package/plugins/perf/lib/perf/profilers/go.js +22 -0
- package/plugins/perf/lib/perf/profilers/index.js +46 -0
- package/plugins/perf/lib/perf/profilers/java.js +23 -0
- package/plugins/perf/lib/perf/profilers/node.js +27 -0
- package/plugins/perf/lib/perf/profilers/python.js +23 -0
- package/plugins/perf/lib/perf/profilers/rust.js +23 -0
- package/plugins/perf/lib/perf/profiling-runner.js +56 -0
- package/plugins/perf/lib/perf/schemas.js +140 -0
- package/plugins/perf/lib/platform/detect-platform.js +413 -0
- package/plugins/perf/lib/platform/detection-configs.js +93 -0
- package/plugins/perf/lib/platform/state-dir.js +132 -0
- package/plugins/perf/lib/platform/verify-tools.js +182 -0
- package/plugins/perf/lib/repo-map/cache.js +152 -0
- package/plugins/perf/lib/repo-map/index.js +222 -0
- package/plugins/perf/lib/repo-map/installer.js +212 -0
- package/plugins/perf/lib/repo-map/queries/go.js +27 -0
- package/plugins/perf/lib/repo-map/queries/index.js +100 -0
- package/plugins/perf/lib/repo-map/queries/java.js +38 -0
- package/plugins/perf/lib/repo-map/queries/javascript.js +55 -0
- package/plugins/perf/lib/repo-map/queries/python.js +24 -0
- package/plugins/perf/lib/repo-map/queries/rust.js +73 -0
- package/plugins/perf/lib/repo-map/queries/typescript.js +38 -0
- package/plugins/perf/lib/repo-map/runner.js +1165 -0
- package/plugins/perf/lib/repo-map/updater.js +474 -0
- package/plugins/perf/lib/repo-map/usage-analyzer.js +407 -0
- package/plugins/perf/lib/schemas/plugin-manifest.schema.json +57 -0
- package/plugins/perf/lib/schemas/validator.js +247 -0
- package/plugins/perf/lib/sources/custom-handler.js +199 -0
- package/plugins/perf/lib/sources/policy-questions.js +246 -0
- package/plugins/perf/lib/sources/source-cache.js +165 -0
- package/plugins/perf/lib/state/workflow-state.js +575 -0
- package/plugins/perf/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/perf/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/perf/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/perf/lib/types/index.d.ts +84 -0
- package/plugins/perf/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/perf/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/perf/lib/utils/atomic-write.js +94 -0
- package/plugins/perf/lib/utils/cache-manager.js +159 -0
- package/plugins/perf/lib/utils/context-optimizer.js +300 -0
- package/plugins/perf/lib/utils/deprecation.js +37 -0
- package/plugins/perf/lib/utils/shell-escape.js +88 -0
- package/plugins/perf/skills/perf-analyzer/SKILL.md +37 -0
- package/plugins/perf/skills/perf-baseline-manager/SKILL.md +30 -0
- package/plugins/perf/skills/perf-benchmarker/SKILL.md +52 -0
- package/plugins/perf/skills/perf-code-paths/SKILL.md +32 -0
- package/plugins/perf/skills/perf-investigation-logger/SKILL.md +41 -0
- package/plugins/perf/skills/perf-profiler/SKILL.md +42 -0
- package/plugins/perf/skills/perf-theory-gatherer/SKILL.md +35 -0
- package/plugins/perf/skills/perf-theory-tester/SKILL.md +36 -0
- package/plugins/repo-map/.claude-plugin/plugin.json +22 -0
- package/plugins/repo-map/agents/map-validator.md +60 -0
- package/plugins/repo-map/commands/repo-map.md +133 -0
- package/plugins/repo-map/lib/adapter-transforms.js +278 -0
- package/plugins/repo-map/lib/collectors/codebase.js +392 -0
- package/plugins/repo-map/lib/collectors/docs-patterns.js +713 -0
- package/plugins/repo-map/lib/collectors/documentation.js +219 -0
- package/plugins/repo-map/lib/collectors/github.js +266 -0
- package/plugins/repo-map/lib/collectors/index.js +126 -0
- package/plugins/repo-map/lib/config/index.js +14 -0
- package/plugins/repo-map/lib/cross-platform/index.js +539 -0
- package/plugins/repo-map/lib/discovery/index.js +352 -0
- package/plugins/repo-map/lib/drift-detect/collectors.js +37 -0
- package/plugins/repo-map/lib/enhance/agent-analyzer.js +421 -0
- package/plugins/repo-map/lib/enhance/agent-patterns.js +571 -0
- package/plugins/repo-map/lib/enhance/auto-suppression.js +622 -0
- package/plugins/repo-map/lib/enhance/benchmark.js +417 -0
- package/plugins/repo-map/lib/enhance/cross-file-analyzer.js +930 -0
- package/plugins/repo-map/lib/enhance/cross-file-patterns.js +370 -0
- package/plugins/repo-map/lib/enhance/docs-analyzer.js +325 -0
- package/plugins/repo-map/lib/enhance/docs-patterns.js +671 -0
- package/plugins/repo-map/lib/enhance/fixer.js +721 -0
- package/plugins/repo-map/lib/enhance/hook-analyzer.js +135 -0
- package/plugins/repo-map/lib/enhance/hook-patterns.js +40 -0
- package/plugins/repo-map/lib/enhance/index.js +127 -0
- package/plugins/repo-map/lib/enhance/plugin-analyzer.js +402 -0
- package/plugins/repo-map/lib/enhance/plugin-patterns.js +326 -0
- package/plugins/repo-map/lib/enhance/projectmemory-analyzer.js +551 -0
- package/plugins/repo-map/lib/enhance/projectmemory-patterns.js +617 -0
- package/plugins/repo-map/lib/enhance/prompt-analyzer.js +457 -0
- package/plugins/repo-map/lib/enhance/prompt-patterns.js +1484 -0
- package/plugins/repo-map/lib/enhance/reporter.js +1348 -0
- package/plugins/repo-map/lib/enhance/security-patterns.js +284 -0
- package/plugins/repo-map/lib/enhance/skill-analyzer.js +182 -0
- package/plugins/repo-map/lib/enhance/skill-patterns.js +147 -0
- package/plugins/repo-map/lib/enhance/suppression.js +352 -0
- package/plugins/repo-map/lib/enhance/tool-patterns.js +373 -0
- package/plugins/repo-map/lib/index.js +270 -0
- package/plugins/repo-map/lib/patterns/cli-enhancers.js +611 -0
- package/plugins/repo-map/lib/patterns/pipeline.js +948 -0
- package/plugins/repo-map/lib/patterns/review-patterns.js +558 -0
- package/plugins/repo-map/lib/patterns/slop-analyzers.js +2305 -0
- package/plugins/repo-map/lib/patterns/slop-patterns.js +1187 -0
- package/plugins/repo-map/lib/perf/analyzer/index.js +22 -0
- package/plugins/repo-map/lib/perf/argument-parser.js +105 -0
- package/plugins/repo-map/lib/perf/baseline-comparator.js +50 -0
- package/plugins/repo-map/lib/perf/baseline-store.js +127 -0
- package/plugins/repo-map/lib/perf/benchmark-runner.js +399 -0
- package/plugins/repo-map/lib/perf/breaking-point-finder.js +52 -0
- package/plugins/repo-map/lib/perf/breaking-point-runner.js +60 -0
- package/plugins/repo-map/lib/perf/checkpoint.js +123 -0
- package/plugins/repo-map/lib/perf/code-paths.js +86 -0
- package/plugins/repo-map/lib/perf/consolidation.js +37 -0
- package/plugins/repo-map/lib/perf/constraint-runner.js +71 -0
- package/plugins/repo-map/lib/perf/experiment-runner.js +32 -0
- package/plugins/repo-map/lib/perf/index.js +41 -0
- package/plugins/repo-map/lib/perf/investigation-state.js +875 -0
- package/plugins/repo-map/lib/perf/optimization-runner.js +79 -0
- package/plugins/repo-map/lib/perf/profilers/go.js +22 -0
- package/plugins/repo-map/lib/perf/profilers/index.js +46 -0
- package/plugins/repo-map/lib/perf/profilers/java.js +23 -0
- package/plugins/repo-map/lib/perf/profilers/node.js +27 -0
- package/plugins/repo-map/lib/perf/profilers/python.js +23 -0
- package/plugins/repo-map/lib/perf/profilers/rust.js +23 -0
- package/plugins/repo-map/lib/perf/profiling-runner.js +56 -0
- package/plugins/repo-map/lib/perf/schemas.js +140 -0
- package/plugins/repo-map/lib/platform/detect-platform.js +413 -0
- package/plugins/repo-map/lib/platform/detection-configs.js +93 -0
- package/plugins/repo-map/lib/platform/state-dir.js +132 -0
- package/plugins/repo-map/lib/platform/verify-tools.js +182 -0
- package/plugins/repo-map/lib/repo-map/cache.js +152 -0
- package/plugins/repo-map/lib/repo-map/index.js +222 -0
- package/plugins/repo-map/lib/repo-map/installer.js +212 -0
- package/plugins/repo-map/lib/repo-map/queries/go.js +27 -0
- package/plugins/repo-map/lib/repo-map/queries/index.js +100 -0
- package/plugins/repo-map/lib/repo-map/queries/java.js +38 -0
- package/plugins/repo-map/lib/repo-map/queries/javascript.js +55 -0
- package/plugins/repo-map/lib/repo-map/queries/python.js +24 -0
- package/plugins/repo-map/lib/repo-map/queries/rust.js +73 -0
- package/plugins/repo-map/lib/repo-map/queries/typescript.js +38 -0
- package/plugins/repo-map/lib/repo-map/runner.js +1165 -0
- package/plugins/repo-map/lib/repo-map/updater.js +474 -0
- package/plugins/repo-map/lib/repo-map/usage-analyzer.js +407 -0
- package/plugins/repo-map/lib/schemas/plugin-manifest.schema.json +57 -0
- package/plugins/repo-map/lib/schemas/validator.js +247 -0
- package/plugins/repo-map/lib/sources/custom-handler.js +199 -0
- package/plugins/repo-map/lib/sources/policy-questions.js +246 -0
- package/plugins/repo-map/lib/sources/source-cache.js +165 -0
- package/plugins/repo-map/lib/state/workflow-state.js +575 -0
- package/plugins/repo-map/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/repo-map/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/repo-map/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/repo-map/lib/types/index.d.ts +84 -0
- package/plugins/repo-map/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/repo-map/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/repo-map/lib/utils/atomic-write.js +94 -0
- package/plugins/repo-map/lib/utils/cache-manager.js +159 -0
- package/plugins/repo-map/lib/utils/context-optimizer.js +300 -0
- package/plugins/repo-map/lib/utils/deprecation.js +37 -0
- package/plugins/repo-map/lib/utils/shell-escape.js +88 -0
- package/plugins/repo-map/skills/repo-mapping/SKILL.md +83 -0
- package/plugins/ship/.claude-plugin/plugin.json +21 -0
- package/plugins/ship/commands/ship-ci-review-loop.md +472 -0
- package/plugins/ship/commands/ship-deployment.md +335 -0
- package/plugins/ship/commands/ship-error-handling.md +258 -0
- package/plugins/ship/commands/ship.md +492 -0
- package/plugins/ship/lib/adapter-transforms.js +278 -0
- package/plugins/ship/lib/collectors/codebase.js +392 -0
- package/plugins/ship/lib/collectors/docs-patterns.js +713 -0
- package/plugins/ship/lib/collectors/documentation.js +219 -0
- package/plugins/ship/lib/collectors/github.js +266 -0
- package/plugins/ship/lib/collectors/index.js +126 -0
- package/plugins/ship/lib/config/index.js +14 -0
- package/plugins/ship/lib/cross-platform/index.js +539 -0
- package/plugins/ship/lib/discovery/index.js +352 -0
- package/plugins/ship/lib/drift-detect/collectors.js +37 -0
- package/plugins/ship/lib/enhance/agent-analyzer.js +421 -0
- package/plugins/ship/lib/enhance/agent-patterns.js +571 -0
- package/plugins/ship/lib/enhance/auto-suppression.js +622 -0
- package/plugins/ship/lib/enhance/benchmark.js +417 -0
- package/plugins/ship/lib/enhance/cross-file-analyzer.js +930 -0
- package/plugins/ship/lib/enhance/cross-file-patterns.js +370 -0
- package/plugins/ship/lib/enhance/docs-analyzer.js +325 -0
- package/plugins/ship/lib/enhance/docs-patterns.js +671 -0
- package/plugins/ship/lib/enhance/fixer.js +721 -0
- package/plugins/ship/lib/enhance/hook-analyzer.js +135 -0
- package/plugins/ship/lib/enhance/hook-patterns.js +40 -0
- package/plugins/ship/lib/enhance/index.js +127 -0
- package/plugins/ship/lib/enhance/plugin-analyzer.js +402 -0
- package/plugins/ship/lib/enhance/plugin-patterns.js +326 -0
- package/plugins/ship/lib/enhance/projectmemory-analyzer.js +551 -0
- package/plugins/ship/lib/enhance/projectmemory-patterns.js +617 -0
- package/plugins/ship/lib/enhance/prompt-analyzer.js +457 -0
- package/plugins/ship/lib/enhance/prompt-patterns.js +1484 -0
- package/plugins/ship/lib/enhance/reporter.js +1348 -0
- package/plugins/ship/lib/enhance/security-patterns.js +284 -0
- package/plugins/ship/lib/enhance/skill-analyzer.js +182 -0
- package/plugins/ship/lib/enhance/skill-patterns.js +147 -0
- package/plugins/ship/lib/enhance/suppression.js +352 -0
- package/plugins/ship/lib/enhance/tool-patterns.js +373 -0
- package/plugins/ship/lib/index.js +270 -0
- package/plugins/ship/lib/patterns/cli-enhancers.js +611 -0
- package/plugins/ship/lib/patterns/pipeline.js +948 -0
- package/plugins/ship/lib/patterns/review-patterns.js +558 -0
- package/plugins/ship/lib/patterns/slop-analyzers.js +2305 -0
- package/plugins/ship/lib/patterns/slop-patterns.js +1187 -0
- package/plugins/ship/lib/perf/analyzer/index.js +22 -0
- package/plugins/ship/lib/perf/argument-parser.js +105 -0
- package/plugins/ship/lib/perf/baseline-comparator.js +50 -0
- package/plugins/ship/lib/perf/baseline-store.js +127 -0
- package/plugins/ship/lib/perf/benchmark-runner.js +399 -0
- package/plugins/ship/lib/perf/breaking-point-finder.js +52 -0
- package/plugins/ship/lib/perf/breaking-point-runner.js +60 -0
- package/plugins/ship/lib/perf/checkpoint.js +123 -0
- package/plugins/ship/lib/perf/code-paths.js +86 -0
- package/plugins/ship/lib/perf/consolidation.js +37 -0
- package/plugins/ship/lib/perf/constraint-runner.js +71 -0
- package/plugins/ship/lib/perf/experiment-runner.js +32 -0
- package/plugins/ship/lib/perf/index.js +41 -0
- package/plugins/ship/lib/perf/investigation-state.js +875 -0
- package/plugins/ship/lib/perf/optimization-runner.js +79 -0
- package/plugins/ship/lib/perf/profilers/go.js +22 -0
- package/plugins/ship/lib/perf/profilers/index.js +46 -0
- package/plugins/ship/lib/perf/profilers/java.js +23 -0
- package/plugins/ship/lib/perf/profilers/node.js +27 -0
- package/plugins/ship/lib/perf/profilers/python.js +23 -0
- package/plugins/ship/lib/perf/profilers/rust.js +23 -0
- package/plugins/ship/lib/perf/profiling-runner.js +56 -0
- package/plugins/ship/lib/perf/schemas.js +140 -0
- package/plugins/ship/lib/platform/detect-platform.js +413 -0
- package/plugins/ship/lib/platform/detection-configs.js +93 -0
- package/plugins/ship/lib/platform/state-dir.js +132 -0
- package/plugins/ship/lib/platform/verify-tools.js +182 -0
- package/plugins/ship/lib/repo-map/cache.js +152 -0
- package/plugins/ship/lib/repo-map/index.js +222 -0
- package/plugins/ship/lib/repo-map/installer.js +212 -0
- package/plugins/ship/lib/repo-map/queries/go.js +27 -0
- package/plugins/ship/lib/repo-map/queries/index.js +100 -0
- package/plugins/ship/lib/repo-map/queries/java.js +38 -0
- package/plugins/ship/lib/repo-map/queries/javascript.js +55 -0
- package/plugins/ship/lib/repo-map/queries/python.js +24 -0
- package/plugins/ship/lib/repo-map/queries/rust.js +73 -0
- package/plugins/ship/lib/repo-map/queries/typescript.js +38 -0
- package/plugins/ship/lib/repo-map/runner.js +1165 -0
- package/plugins/ship/lib/repo-map/updater.js +474 -0
- package/plugins/ship/lib/repo-map/usage-analyzer.js +407 -0
- package/plugins/ship/lib/schemas/plugin-manifest.schema.json +57 -0
- package/plugins/ship/lib/schemas/validator.js +247 -0
- package/plugins/ship/lib/sources/custom-handler.js +199 -0
- package/plugins/ship/lib/sources/policy-questions.js +246 -0
- package/plugins/ship/lib/sources/source-cache.js +165 -0
- package/plugins/ship/lib/state/workflow-state.js +575 -0
- package/plugins/ship/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/ship/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/ship/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/ship/lib/types/index.d.ts +84 -0
- package/plugins/ship/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/ship/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/ship/lib/utils/atomic-write.js +94 -0
- package/plugins/ship/lib/utils/cache-manager.js +159 -0
- package/plugins/ship/lib/utils/context-optimizer.js +300 -0
- package/plugins/ship/lib/utils/deprecation.js +37 -0
- package/plugins/ship/lib/utils/shell-escape.js +88 -0
- package/plugins/sync-docs/.claude-plugin/plugin.json +20 -0
- package/plugins/sync-docs/agents/sync-docs-agent.md +154 -0
- package/plugins/sync-docs/commands/sync-docs.md +186 -0
- package/plugins/sync-docs/lib/adapter-transforms.js +278 -0
- package/plugins/sync-docs/lib/collectors/codebase.js +392 -0
- package/plugins/sync-docs/lib/collectors/docs-patterns.js +713 -0
- package/plugins/sync-docs/lib/collectors/documentation.js +219 -0
- package/plugins/sync-docs/lib/collectors/github.js +266 -0
- package/plugins/sync-docs/lib/collectors/index.js +126 -0
- package/plugins/sync-docs/lib/config/index.js +14 -0
- package/plugins/sync-docs/lib/cross-platform/index.js +539 -0
- package/plugins/sync-docs/lib/discovery/index.js +352 -0
- package/plugins/sync-docs/lib/drift-detect/collectors.js +37 -0
- package/plugins/sync-docs/lib/enhance/agent-analyzer.js +421 -0
- package/plugins/sync-docs/lib/enhance/agent-patterns.js +571 -0
- package/plugins/sync-docs/lib/enhance/auto-suppression.js +622 -0
- package/plugins/sync-docs/lib/enhance/benchmark.js +417 -0
- package/plugins/sync-docs/lib/enhance/cross-file-analyzer.js +930 -0
- package/plugins/sync-docs/lib/enhance/cross-file-patterns.js +370 -0
- package/plugins/sync-docs/lib/enhance/docs-analyzer.js +325 -0
- package/plugins/sync-docs/lib/enhance/docs-patterns.js +671 -0
- package/plugins/sync-docs/lib/enhance/fixer.js +721 -0
- package/plugins/sync-docs/lib/enhance/hook-analyzer.js +135 -0
- package/plugins/sync-docs/lib/enhance/hook-patterns.js +40 -0
- package/plugins/sync-docs/lib/enhance/index.js +127 -0
- package/plugins/sync-docs/lib/enhance/plugin-analyzer.js +402 -0
- package/plugins/sync-docs/lib/enhance/plugin-patterns.js +326 -0
- package/plugins/sync-docs/lib/enhance/projectmemory-analyzer.js +551 -0
- package/plugins/sync-docs/lib/enhance/projectmemory-patterns.js +617 -0
- package/plugins/sync-docs/lib/enhance/prompt-analyzer.js +457 -0
- package/plugins/sync-docs/lib/enhance/prompt-patterns.js +1484 -0
- package/plugins/sync-docs/lib/enhance/reporter.js +1348 -0
- package/plugins/sync-docs/lib/enhance/security-patterns.js +284 -0
- package/plugins/sync-docs/lib/enhance/skill-analyzer.js +182 -0
- package/plugins/sync-docs/lib/enhance/skill-patterns.js +147 -0
- package/plugins/sync-docs/lib/enhance/suppression.js +352 -0
- package/plugins/sync-docs/lib/enhance/tool-patterns.js +373 -0
- package/plugins/sync-docs/lib/index.js +270 -0
- package/plugins/sync-docs/lib/patterns/cli-enhancers.js +611 -0
- package/plugins/sync-docs/lib/patterns/pipeline.js +948 -0
- package/plugins/sync-docs/lib/patterns/review-patterns.js +558 -0
- package/plugins/sync-docs/lib/patterns/slop-analyzers.js +2305 -0
- package/plugins/sync-docs/lib/patterns/slop-patterns.js +1187 -0
- package/plugins/sync-docs/lib/perf/analyzer/index.js +22 -0
- package/plugins/sync-docs/lib/perf/argument-parser.js +105 -0
- package/plugins/sync-docs/lib/perf/baseline-comparator.js +50 -0
- package/plugins/sync-docs/lib/perf/baseline-store.js +127 -0
- package/plugins/sync-docs/lib/perf/benchmark-runner.js +399 -0
- package/plugins/sync-docs/lib/perf/breaking-point-finder.js +52 -0
- package/plugins/sync-docs/lib/perf/breaking-point-runner.js +60 -0
- package/plugins/sync-docs/lib/perf/checkpoint.js +123 -0
- package/plugins/sync-docs/lib/perf/code-paths.js +86 -0
- package/plugins/sync-docs/lib/perf/consolidation.js +37 -0
- package/plugins/sync-docs/lib/perf/constraint-runner.js +71 -0
- package/plugins/sync-docs/lib/perf/experiment-runner.js +32 -0
- package/plugins/sync-docs/lib/perf/index.js +41 -0
- package/plugins/sync-docs/lib/perf/investigation-state.js +875 -0
- package/plugins/sync-docs/lib/perf/optimization-runner.js +79 -0
- package/plugins/sync-docs/lib/perf/profilers/go.js +22 -0
- package/plugins/sync-docs/lib/perf/profilers/index.js +46 -0
- package/plugins/sync-docs/lib/perf/profilers/java.js +23 -0
- package/plugins/sync-docs/lib/perf/profilers/node.js +27 -0
- package/plugins/sync-docs/lib/perf/profilers/python.js +23 -0
- package/plugins/sync-docs/lib/perf/profilers/rust.js +23 -0
- package/plugins/sync-docs/lib/perf/profiling-runner.js +56 -0
- package/plugins/sync-docs/lib/perf/schemas.js +140 -0
- package/plugins/sync-docs/lib/platform/detect-platform.js +413 -0
- package/plugins/sync-docs/lib/platform/detection-configs.js +93 -0
- package/plugins/sync-docs/lib/platform/state-dir.js +132 -0
- package/plugins/sync-docs/lib/platform/verify-tools.js +182 -0
- package/plugins/sync-docs/lib/repo-map/cache.js +152 -0
- package/plugins/sync-docs/lib/repo-map/index.js +222 -0
- package/plugins/sync-docs/lib/repo-map/installer.js +212 -0
- package/plugins/sync-docs/lib/repo-map/queries/go.js +27 -0
- package/plugins/sync-docs/lib/repo-map/queries/index.js +100 -0
- package/plugins/sync-docs/lib/repo-map/queries/java.js +38 -0
- package/plugins/sync-docs/lib/repo-map/queries/javascript.js +55 -0
- package/plugins/sync-docs/lib/repo-map/queries/python.js +24 -0
- package/plugins/sync-docs/lib/repo-map/queries/rust.js +73 -0
- package/plugins/sync-docs/lib/repo-map/queries/typescript.js +38 -0
- package/plugins/sync-docs/lib/repo-map/runner.js +1165 -0
- package/plugins/sync-docs/lib/repo-map/updater.js +474 -0
- package/plugins/sync-docs/lib/repo-map/usage-analyzer.js +407 -0
- package/plugins/sync-docs/lib/schemas/plugin-manifest.schema.json +57 -0
- package/plugins/sync-docs/lib/schemas/validator.js +247 -0
- package/plugins/sync-docs/lib/sources/custom-handler.js +199 -0
- package/plugins/sync-docs/lib/sources/policy-questions.js +246 -0
- package/plugins/sync-docs/lib/sources/source-cache.js +165 -0
- package/plugins/sync-docs/lib/state/workflow-state.js +575 -0
- package/plugins/sync-docs/lib/types/agent-frontmatter.d.ts +134 -0
- package/plugins/sync-docs/lib/types/command-frontmatter.d.ts +107 -0
- package/plugins/sync-docs/lib/types/hook-frontmatter.d.ts +115 -0
- package/plugins/sync-docs/lib/types/index.d.ts +84 -0
- package/plugins/sync-docs/lib/types/plugin-manifest.d.ts +102 -0
- package/plugins/sync-docs/lib/types/skill-frontmatter.d.ts +89 -0
- package/plugins/sync-docs/lib/utils/atomic-write.js +94 -0
- package/plugins/sync-docs/lib/utils/cache-manager.js +159 -0
- package/plugins/sync-docs/lib/utils/context-optimizer.js +300 -0
- package/plugins/sync-docs/lib/utils/deprecation.js +37 -0
- package/plugins/sync-docs/lib/utils/shell-escape.js +88 -0
- package/plugins/sync-docs/skills/sync-docs/SKILL.md +351 -0
- package/scripts/bump-version.js +92 -0
- package/scripts/check-hardcoded-paths.js +199 -0
- package/scripts/dev-install.js +493 -0
- package/scripts/expand-templates.js +269 -0
- package/scripts/gen-adapters.js +323 -0
- package/scripts/generate-docs.js +558 -0
- package/scripts/generate-plugin-list.js +20 -0
- package/scripts/migrate-opencode.js +307 -0
- package/scripts/perf/repo-map-create.js +46 -0
- package/scripts/plugins.txt +12 -0
- package/scripts/preflight.js +1263 -0
- package/scripts/scaffold.js +490 -0
- package/scripts/setup-hooks.js +169 -0
- package/scripts/stamp-version.js +175 -0
- package/scripts/test-transform.js +85 -0
- package/scripts/validate-agent-skill-compliance.js +284 -0
- package/scripts/validate-counts.js +457 -0
- package/scripts/validate-cross-platform-docs.js +550 -0
- package/scripts/validate-opencode-install.js +182 -0
- package/site/assets/css/main.css +1525 -0
- package/site/assets/css/tokens.css +493 -0
- package/site/assets/favicon.svg +23 -0
- package/site/assets/js/main.js +801 -0
- package/site/assets/logo.png +0 -0
- package/site/assets/og-image.html +163 -0
- package/site/content.json +453 -0
- package/site/index.html +698 -0
- package/site/ux-spec.md +683 -0
- package/site/version.json +5 -0
- package/templates/agent-snippets/enhance-integration-points.md +6 -0
- package/templates/agent-snippets/enhance-skill-delegation.md +18 -0
- package/templates/agent-snippets/model-choice.md +6 -0
|
@@ -0,0 +1,1165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ast-grep execution and result parsing
|
|
3
|
+
*
|
|
4
|
+
* @module lib/repo-map/runner
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const { execFileSync, spawnSync } = require('child_process');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const fsPromises = require('fs').promises;
|
|
13
|
+
const crypto = require('crypto');
|
|
14
|
+
|
|
15
|
+
const installer = require('./installer');
|
|
16
|
+
const queries = require('./queries');
|
|
17
|
+
const slopAnalyzers = require('../patterns/slop-analyzers');
|
|
18
|
+
|
|
19
|
+
// Language file extensions mapping
|
|
20
|
+
const LANGUAGE_EXTENSIONS = {
|
|
21
|
+
javascript: ['.js', '.jsx', '.mjs', '.cjs'],
|
|
22
|
+
typescript: ['.ts', '.tsx', '.mts', '.cts'],
|
|
23
|
+
python: ['.py', '.pyw'],
|
|
24
|
+
rust: ['.rs'],
|
|
25
|
+
go: ['.go'],
|
|
26
|
+
java: ['.java']
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// Directories to exclude from scanning (extend base list)
|
|
30
|
+
const EXCLUDE_DIRS = Array.from(new Set([
|
|
31
|
+
...slopAnalyzers.EXCLUDE_DIRS,
|
|
32
|
+
'.claude', '.opencode', '.codex', '.venv', 'venv', 'env'
|
|
33
|
+
]));
|
|
34
|
+
|
|
35
|
+
const AST_GREP_BATCH_SIZE = 100;
|
|
36
|
+
const LANGUAGE_EXTENSION_SCAN_LIMIT = 500;
|
|
37
|
+
const FILE_READ_BATCH_SIZE = 50; // Concurrent file reads
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Detect languages in a repository
|
|
41
|
+
* @param {string} basePath - Repository root
|
|
42
|
+
* @returns {Promise<string[]>} - List of detected languages
|
|
43
|
+
*/
|
|
44
|
+
async function detectLanguages(basePath) {
|
|
45
|
+
const detected = new Set();
|
|
46
|
+
|
|
47
|
+
// Check for config files first (faster)
|
|
48
|
+
const configIndicators = {
|
|
49
|
+
javascript: ['package.json', 'jsconfig.json'],
|
|
50
|
+
typescript: ['tsconfig.json', 'tsconfig.base.json'],
|
|
51
|
+
python: ['pyproject.toml', 'setup.py', 'requirements.txt', 'Pipfile'],
|
|
52
|
+
rust: ['Cargo.toml'],
|
|
53
|
+
go: ['go.mod', 'go.sum'],
|
|
54
|
+
java: ['pom.xml', 'build.gradle', 'build.gradle.kts']
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
for (const [lang, files] of Object.entries(configIndicators)) {
|
|
58
|
+
for (const file of files) {
|
|
59
|
+
if (fs.existsSync(path.join(basePath, file))) {
|
|
60
|
+
detected.add(lang);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Supplement with extension scan to catch mixed-language repos
|
|
67
|
+
const extensions = scanForExtensions(basePath, LANGUAGE_EXTENSION_SCAN_LIMIT);
|
|
68
|
+
for (const [lang, exts] of Object.entries(LANGUAGE_EXTENSIONS)) {
|
|
69
|
+
if (exts.some(ext => extensions.has(ext))) {
|
|
70
|
+
detected.add(lang);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return Array.from(detected);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Scan repository for file extensions (sampling)
|
|
79
|
+
* @param {string} basePath - Repository root
|
|
80
|
+
* @param {number} maxFiles - Maximum files to check
|
|
81
|
+
* @returns {Set<string>} - Set of extensions found
|
|
82
|
+
*/
|
|
83
|
+
function scanForExtensions(basePath, maxFiles = 100) {
|
|
84
|
+
const extensions = new Set();
|
|
85
|
+
let count = 0;
|
|
86
|
+
const isIgnored = slopAnalyzers.parseGitignore(basePath, fs, path);
|
|
87
|
+
|
|
88
|
+
function scan(dir) {
|
|
89
|
+
if (count >= maxFiles) return;
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
93
|
+
for (const entry of entries) {
|
|
94
|
+
if (count >= maxFiles) break;
|
|
95
|
+
|
|
96
|
+
if (entry.isDirectory()) {
|
|
97
|
+
const relativePath = path.relative(basePath, path.join(dir, entry.name));
|
|
98
|
+
if (slopAnalyzers.shouldExclude(relativePath, EXCLUDE_DIRS)) continue;
|
|
99
|
+
if (isIgnored && isIgnored(relativePath, true)) continue;
|
|
100
|
+
if (!entry.name.startsWith('.')) {
|
|
101
|
+
scan(path.join(dir, entry.name));
|
|
102
|
+
}
|
|
103
|
+
} else if (entry.isFile()) {
|
|
104
|
+
const relativePath = path.relative(basePath, path.join(dir, entry.name));
|
|
105
|
+
if (slopAnalyzers.shouldExclude(relativePath, EXCLUDE_DIRS)) continue;
|
|
106
|
+
if (isIgnored && isIgnored(relativePath, false)) continue;
|
|
107
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
108
|
+
if (ext) {
|
|
109
|
+
extensions.add(ext);
|
|
110
|
+
count++;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
} catch {
|
|
115
|
+
// Skip directories we can't read
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
scan(basePath);
|
|
120
|
+
return extensions;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Run a full scan of the repository
|
|
125
|
+
* @param {string} basePath - Repository root
|
|
126
|
+
* @param {string[]} languages - Languages to scan
|
|
127
|
+
* @returns {Promise<Object>} - The generated map
|
|
128
|
+
*/
|
|
129
|
+
async function fullScan(basePath, languages, options = {}) {
|
|
130
|
+
const cmd = installer.getCommand();
|
|
131
|
+
if (!cmd) {
|
|
132
|
+
throw new Error('ast-grep not found');
|
|
133
|
+
}
|
|
134
|
+
const fileLimit = Number.isFinite(options.fileLimit) ? Math.max(0, Math.floor(options.fileLimit)) : null;
|
|
135
|
+
const filesByLanguage = collectFilesByLanguage(basePath, languages, {
|
|
136
|
+
maxFiles: fileLimit
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const map = {
|
|
140
|
+
version: '1.0.0',
|
|
141
|
+
generated: new Date().toISOString(),
|
|
142
|
+
updated: null,
|
|
143
|
+
git: getGitInfo(basePath),
|
|
144
|
+
project: {
|
|
145
|
+
type: detectProjectType(languages),
|
|
146
|
+
languages,
|
|
147
|
+
frameworks: [] // Could be enhanced later
|
|
148
|
+
},
|
|
149
|
+
stats: {
|
|
150
|
+
totalFiles: 0,
|
|
151
|
+
totalSymbols: 0,
|
|
152
|
+
scanDurationMs: 0,
|
|
153
|
+
errors: []
|
|
154
|
+
},
|
|
155
|
+
files: {},
|
|
156
|
+
dependencies: {}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// Run queries for each language
|
|
160
|
+
for (const lang of languages) {
|
|
161
|
+
const langQueries = queries.getQueriesForLanguage(lang);
|
|
162
|
+
if (!langQueries) continue;
|
|
163
|
+
|
|
164
|
+
const files = filesByLanguage.get(lang) || [];
|
|
165
|
+
if (files.length === 0) continue;
|
|
166
|
+
|
|
167
|
+
const fileEntries = [];
|
|
168
|
+
const symbolMapsByFile = new Map();
|
|
169
|
+
const importStateByFile = new Map();
|
|
170
|
+
const contentByFile = new Map();
|
|
171
|
+
|
|
172
|
+
// Filter out already processed files first
|
|
173
|
+
const filesToProcess = files.filter(file => {
|
|
174
|
+
const relativePath = path.relative(basePath, file).replace(/\\/g, '/');
|
|
175
|
+
return !map.files[relativePath];
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Batch read all files asynchronously
|
|
179
|
+
const fileContents = await batchReadFiles(filesToProcess);
|
|
180
|
+
|
|
181
|
+
for (const file of filesToProcess) {
|
|
182
|
+
const relativePath = path.relative(basePath, file).replace(/\\/g, '/');
|
|
183
|
+
const readResult = fileContents.get(file);
|
|
184
|
+
|
|
185
|
+
if (readResult.error || readResult.content === null) {
|
|
186
|
+
map.stats.errors.push({
|
|
187
|
+
file: relativePath,
|
|
188
|
+
error: readResult.error?.message || 'Failed to read file'
|
|
189
|
+
});
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const content = readResult.content;
|
|
194
|
+
const hash = crypto.createHash('sha256').update(content).digest('hex').slice(0, 16);
|
|
195
|
+
|
|
196
|
+
map.files[relativePath] = {
|
|
197
|
+
hash,
|
|
198
|
+
language: lang,
|
|
199
|
+
size: content.length,
|
|
200
|
+
symbols: {
|
|
201
|
+
exports: [],
|
|
202
|
+
functions: [],
|
|
203
|
+
classes: [],
|
|
204
|
+
types: [],
|
|
205
|
+
constants: []
|
|
206
|
+
},
|
|
207
|
+
imports: []
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
map.stats.totalFiles++;
|
|
211
|
+
fileEntries.push({ file, relativePath });
|
|
212
|
+
symbolMapsByFile.set(relativePath, createSymbolMaps());
|
|
213
|
+
importStateByFile.set(relativePath, { items: [], seen: new Set() });
|
|
214
|
+
contentByFile.set(relativePath, content);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (fileEntries.length === 0) continue;
|
|
218
|
+
|
|
219
|
+
const filesBySgLang = new Map();
|
|
220
|
+
for (const entry of fileEntries) {
|
|
221
|
+
const sgLang = queries.getSgLanguageForFile(entry.file, lang);
|
|
222
|
+
if (!filesBySgLang.has(sgLang)) {
|
|
223
|
+
filesBySgLang.set(sgLang, []);
|
|
224
|
+
}
|
|
225
|
+
filesBySgLang.get(sgLang).push(entry);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
for (const [sgLang, entries] of filesBySgLang) {
|
|
229
|
+
const filePaths = entries.map(entry => entry.file);
|
|
230
|
+
const experimentBatchSize = process.env.PERF_EXPERIMENT === '1'
|
|
231
|
+
? Number(process.env.REPO_MAP_AST_GREP_BATCH_SIZE)
|
|
232
|
+
: null;
|
|
233
|
+
const batchSize = Number.isFinite(options.astGrepBatchSize)
|
|
234
|
+
? Math.max(1, Math.floor(options.astGrepBatchSize))
|
|
235
|
+
: Number.isFinite(experimentBatchSize) && experimentBatchSize > 0
|
|
236
|
+
? Math.max(1, Math.floor(experimentBatchSize))
|
|
237
|
+
: AST_GREP_BATCH_SIZE;
|
|
238
|
+
const chunks = chunkArray(filePaths, batchSize);
|
|
239
|
+
|
|
240
|
+
const patternGroups = [
|
|
241
|
+
{ category: 'exports', patterns: langQueries.exports, defaultKind: 'export' },
|
|
242
|
+
{ category: 'functions', patterns: langQueries.functions, defaultKind: 'function' },
|
|
243
|
+
{ category: 'classes', patterns: langQueries.classes, defaultKind: 'class' },
|
|
244
|
+
{ category: 'types', patterns: langQueries.types, defaultKind: 'type' },
|
|
245
|
+
{ category: 'constants', patterns: langQueries.constants, defaultKind: 'constant' },
|
|
246
|
+
{ category: 'imports', patterns: langQueries.imports, defaultKind: 'import' }
|
|
247
|
+
];
|
|
248
|
+
|
|
249
|
+
for (const group of patternGroups) {
|
|
250
|
+
if (!group.patterns || group.patterns.length === 0) continue;
|
|
251
|
+
|
|
252
|
+
for (const patternDef of group.patterns) {
|
|
253
|
+
const pattern = typeof patternDef === 'string' ? patternDef : patternDef.pattern;
|
|
254
|
+
if (!pattern) continue;
|
|
255
|
+
|
|
256
|
+
for (const chunk of chunks) {
|
|
257
|
+
const matches = runAstGrepPattern(cmd, pattern, sgLang, basePath, chunk);
|
|
258
|
+
for (const match of matches) {
|
|
259
|
+
const matchedPath = normalizeMatchPath(match.file, basePath);
|
|
260
|
+
if (!matchedPath) continue;
|
|
261
|
+
|
|
262
|
+
const symbolMaps = symbolMapsByFile.get(matchedPath);
|
|
263
|
+
const importState = importStateByFile.get(matchedPath);
|
|
264
|
+
if (!symbolMaps || !importState) continue;
|
|
265
|
+
|
|
266
|
+
if (group.category === 'imports') {
|
|
267
|
+
const sourceResult = extractSourceFromMatch(match, patternDef);
|
|
268
|
+
const sources = Array.isArray(sourceResult) ? sourceResult : [sourceResult];
|
|
269
|
+
for (const source of sources) {
|
|
270
|
+
if (!source) continue;
|
|
271
|
+
const kind = patternDef.kind || 'import';
|
|
272
|
+
const key = `${source}:${kind}`;
|
|
273
|
+
if (importState.seen.has(key)) continue;
|
|
274
|
+
importState.seen.add(key);
|
|
275
|
+
importState.items.push({
|
|
276
|
+
source,
|
|
277
|
+
kind,
|
|
278
|
+
line: getLine(match)
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const names = extractNamesFromMatch(match, patternDef);
|
|
285
|
+
const targetMap = symbolMaps[group.category];
|
|
286
|
+
if (!targetMap) continue;
|
|
287
|
+
for (const name of names) {
|
|
288
|
+
const kind = patternDef.kind || group.defaultKind;
|
|
289
|
+
addSymbolToMap(targetMap, name, match, kind, patternDef.extra);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
for (const entry of fileEntries) {
|
|
298
|
+
const relativePath = entry.relativePath;
|
|
299
|
+
const symbolMaps = symbolMapsByFile.get(relativePath);
|
|
300
|
+
const importState = importStateByFile.get(relativePath);
|
|
301
|
+
if (!symbolMaps || !importState) continue;
|
|
302
|
+
|
|
303
|
+
const exportNames = new Set(symbolMaps.exports.keys());
|
|
304
|
+
const content = contentByFile.get(relativePath) || '';
|
|
305
|
+
applyLanguageExportRules(lang, content, exportNames, symbolMaps.functions, symbolMaps.classes, symbolMaps.types, symbolMaps.constants);
|
|
306
|
+
ensureExportEntries(symbolMaps.exports, exportNames, symbolMaps.functions, symbolMaps.classes, symbolMaps.types, symbolMaps.constants);
|
|
307
|
+
|
|
308
|
+
const symbols = {
|
|
309
|
+
exports: mapToSortedArray(symbolMaps.exports),
|
|
310
|
+
functions: mapToSortedArray(symbolMaps.functions, exportNames),
|
|
311
|
+
classes: mapToSortedArray(symbolMaps.classes, exportNames),
|
|
312
|
+
types: mapToSortedArray(symbolMaps.types, exportNames),
|
|
313
|
+
constants: mapToSortedArray(symbolMaps.constants, exportNames)
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
map.files[relativePath].symbols = symbols;
|
|
317
|
+
map.files[relativePath].imports = importState.items;
|
|
318
|
+
|
|
319
|
+
if (importState.items.length > 0) {
|
|
320
|
+
map.dependencies[relativePath] = Array.from(new Set(importState.items.map(imp => imp.source)));
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
map.stats.totalSymbols +=
|
|
324
|
+
(symbols.functions?.length || 0) +
|
|
325
|
+
(symbols.classes?.length || 0) +
|
|
326
|
+
(symbols.types?.length || 0) +
|
|
327
|
+
(symbols.constants?.length || 0);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return map;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Find all files for a language
|
|
336
|
+
* @param {string} basePath - Repository root
|
|
337
|
+
* @param {string} language - Language name
|
|
338
|
+
* @returns {string[]} - Array of file paths
|
|
339
|
+
*/
|
|
340
|
+
function findFilesForLanguage(basePath, language, options = {}) {
|
|
341
|
+
const extensions = LANGUAGE_EXTENSIONS[language] || [];
|
|
342
|
+
const files = [];
|
|
343
|
+
const isIgnored = slopAnalyzers.parseGitignore(basePath, fs, path);
|
|
344
|
+
const maxFiles = Number.isFinite(options.maxFiles) ? Math.max(0, Math.floor(options.maxFiles)) : null;
|
|
345
|
+
|
|
346
|
+
function scan(dir) {
|
|
347
|
+
if (maxFiles !== null && files.length >= maxFiles) return;
|
|
348
|
+
try {
|
|
349
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
350
|
+
for (const entry of entries) {
|
|
351
|
+
if (maxFiles !== null && files.length >= maxFiles) break;
|
|
352
|
+
const fullPath = path.join(dir, entry.name);
|
|
353
|
+
|
|
354
|
+
if (entry.isDirectory()) {
|
|
355
|
+
const relativePath = path.relative(basePath, fullPath);
|
|
356
|
+
if (slopAnalyzers.shouldExclude(relativePath, EXCLUDE_DIRS)) continue;
|
|
357
|
+
if (isIgnored && isIgnored(relativePath, true)) continue;
|
|
358
|
+
if (!entry.name.startsWith('.')) {
|
|
359
|
+
scan(fullPath);
|
|
360
|
+
}
|
|
361
|
+
} else if (entry.isFile()) {
|
|
362
|
+
const relativePath = path.relative(basePath, fullPath);
|
|
363
|
+
if (slopAnalyzers.shouldExclude(relativePath, EXCLUDE_DIRS)) continue;
|
|
364
|
+
if (isIgnored && isIgnored(relativePath, false)) continue;
|
|
365
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
366
|
+
if (extensions.includes(ext)) {
|
|
367
|
+
files.push(fullPath);
|
|
368
|
+
if (maxFiles !== null && files.length >= maxFiles) break;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
} catch {
|
|
373
|
+
// Skip directories we can't read
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
scan(basePath);
|
|
378
|
+
return files;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Collect files for all languages in a single walk.
|
|
383
|
+
* @param {string} basePath - Repository root
|
|
384
|
+
* @param {string[]} languages - Languages to collect
|
|
385
|
+
* @param {Object} options
|
|
386
|
+
* @param {number} [options.maxFiles] - Global file limit
|
|
387
|
+
* @returns {Map<string, string[]>} - Map of language -> file paths
|
|
388
|
+
*/
|
|
389
|
+
function collectFilesByLanguage(basePath, languages, options = {}) {
|
|
390
|
+
const langList = Array.isArray(languages) ? languages : [];
|
|
391
|
+
const filesByLanguage = new Map();
|
|
392
|
+
for (const lang of langList) {
|
|
393
|
+
filesByLanguage.set(lang, []);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const extensionToLang = new Map();
|
|
397
|
+
for (const lang of langList) {
|
|
398
|
+
const extensions = LANGUAGE_EXTENSIONS[lang] || [];
|
|
399
|
+
for (const ext of extensions) {
|
|
400
|
+
if (!extensionToLang.has(ext)) {
|
|
401
|
+
extensionToLang.set(ext, lang);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const isIgnored = slopAnalyzers.parseGitignore(basePath, fs, path);
|
|
407
|
+
const maxFiles = Number.isFinite(options.maxFiles) ? Math.max(0, Math.floor(options.maxFiles)) : null;
|
|
408
|
+
let count = 0;
|
|
409
|
+
|
|
410
|
+
function scan(dir) {
|
|
411
|
+
if (maxFiles !== null && count >= maxFiles) return;
|
|
412
|
+
try {
|
|
413
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
414
|
+
for (const entry of entries) {
|
|
415
|
+
if (maxFiles !== null && count >= maxFiles) break;
|
|
416
|
+
const fullPath = path.join(dir, entry.name);
|
|
417
|
+
|
|
418
|
+
if (entry.isDirectory()) {
|
|
419
|
+
const relativePath = path.relative(basePath, fullPath);
|
|
420
|
+
if (slopAnalyzers.shouldExclude(relativePath, EXCLUDE_DIRS)) continue;
|
|
421
|
+
if (isIgnored && isIgnored(relativePath, true)) continue;
|
|
422
|
+
if (!entry.name.startsWith('.')) {
|
|
423
|
+
scan(fullPath);
|
|
424
|
+
}
|
|
425
|
+
} else if (entry.isFile()) {
|
|
426
|
+
const relativePath = path.relative(basePath, fullPath);
|
|
427
|
+
if (slopAnalyzers.shouldExclude(relativePath, EXCLUDE_DIRS)) continue;
|
|
428
|
+
if (isIgnored && isIgnored(relativePath, false)) continue;
|
|
429
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
430
|
+
const lang = extensionToLang.get(ext);
|
|
431
|
+
if (lang) {
|
|
432
|
+
const bucket = filesByLanguage.get(lang);
|
|
433
|
+
if (bucket) {
|
|
434
|
+
bucket.push(fullPath);
|
|
435
|
+
count++;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
} catch {
|
|
441
|
+
// Skip directories we can't read
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
scan(basePath);
|
|
446
|
+
return filesByLanguage;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function createSymbolMaps() {
|
|
450
|
+
return {
|
|
451
|
+
exports: new Map(),
|
|
452
|
+
functions: new Map(),
|
|
453
|
+
classes: new Map(),
|
|
454
|
+
types: new Map(),
|
|
455
|
+
constants: new Map()
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Read multiple files asynchronously in batches
|
|
461
|
+
* @param {string[]} files - Array of file paths
|
|
462
|
+
* @param {number} batchSize - Concurrent reads per batch
|
|
463
|
+
* @returns {Promise<Map<string, {content: string, error: Error|null}>>}
|
|
464
|
+
*/
|
|
465
|
+
async function batchReadFiles(files, batchSize = FILE_READ_BATCH_SIZE) {
|
|
466
|
+
const results = new Map();
|
|
467
|
+
|
|
468
|
+
for (let i = 0; i < files.length; i += batchSize) {
|
|
469
|
+
const batch = files.slice(i, i + batchSize);
|
|
470
|
+
const batchResults = await Promise.all(
|
|
471
|
+
batch.map(async (file) => {
|
|
472
|
+
try {
|
|
473
|
+
const content = await fsPromises.readFile(file, 'utf8');
|
|
474
|
+
return { file, content, error: null };
|
|
475
|
+
} catch (err) {
|
|
476
|
+
return { file, content: null, error: err };
|
|
477
|
+
}
|
|
478
|
+
})
|
|
479
|
+
);
|
|
480
|
+
|
|
481
|
+
for (const result of batchResults) {
|
|
482
|
+
results.set(result.file, { content: result.content, error: result.error });
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
return results;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function chunkArray(items, size) {
|
|
490
|
+
if (!items || items.length === 0) return [];
|
|
491
|
+
const chunks = [];
|
|
492
|
+
for (let i = 0; i < items.length; i += size) {
|
|
493
|
+
chunks.push(items.slice(i, i + size));
|
|
494
|
+
}
|
|
495
|
+
return chunks;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function normalizeMatchPath(matchFile, basePath) {
|
|
499
|
+
if (!matchFile) return null;
|
|
500
|
+
const absolutePath = path.isAbsolute(matchFile) ? matchFile : path.join(basePath, matchFile);
|
|
501
|
+
return path.relative(basePath, absolutePath).replace(/\\/g, '/');
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
function addSymbolToMap(map, name, match, kind, extra = {}) {
|
|
505
|
+
if (!name) return;
|
|
506
|
+
if (!map.has(name)) {
|
|
507
|
+
map.set(name, {
|
|
508
|
+
name,
|
|
509
|
+
line: getLine(match),
|
|
510
|
+
kind,
|
|
511
|
+
...extra
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function runAstGrepPattern(cmd, pattern, lang, basePath, filePaths) {
|
|
517
|
+
if (!pattern || !filePaths || filePaths.length === 0) return [];
|
|
518
|
+
|
|
519
|
+
try {
|
|
520
|
+
const result = spawnSync(cmd, [
|
|
521
|
+
'run',
|
|
522
|
+
'--pattern', pattern,
|
|
523
|
+
'--lang', lang,
|
|
524
|
+
'--json=stream',
|
|
525
|
+
...filePaths
|
|
526
|
+
], {
|
|
527
|
+
cwd: basePath,
|
|
528
|
+
encoding: 'utf8',
|
|
529
|
+
timeout: 300000,
|
|
530
|
+
windowsHide: true,
|
|
531
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
if (result.error) {
|
|
535
|
+
return [];
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
if (typeof result.status === 'number' && result.status > 1) {
|
|
539
|
+
return [];
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
return parseNdjson(result.stdout);
|
|
543
|
+
} catch {
|
|
544
|
+
return [];
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Extract symbols from a file using ast-grep
|
|
550
|
+
* @param {string} cmd - ast-grep command
|
|
551
|
+
* @param {string} file - File path
|
|
552
|
+
* @param {string} language - Language name
|
|
553
|
+
* @param {Object} langQueries - Query patterns for this language
|
|
554
|
+
* @param {string} basePath - Repository root (for cwd)
|
|
555
|
+
* @param {string} content - File content
|
|
556
|
+
* @returns {Object} - Extracted symbols
|
|
557
|
+
*/
|
|
558
|
+
function extractSymbols(cmd, file, language, langQueries, basePath, content) {
|
|
559
|
+
const symbols = {
|
|
560
|
+
exports: [],
|
|
561
|
+
functions: [],
|
|
562
|
+
classes: [],
|
|
563
|
+
types: [],
|
|
564
|
+
constants: []
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
const sgLang = queries.getSgLanguageForFile(file, language);
|
|
568
|
+
|
|
569
|
+
const exportMap = new Map();
|
|
570
|
+
const functionMap = new Map();
|
|
571
|
+
const classMap = new Map();
|
|
572
|
+
const typeMap = new Map();
|
|
573
|
+
const constMap = new Map();
|
|
574
|
+
|
|
575
|
+
const addSymbol = (map, name, match, kind, extra = {}) => {
|
|
576
|
+
if (!name) return;
|
|
577
|
+
if (!map.has(name)) {
|
|
578
|
+
map.set(name, {
|
|
579
|
+
name,
|
|
580
|
+
line: getLine(match),
|
|
581
|
+
kind,
|
|
582
|
+
...extra
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
const runPatternSet = (patterns, targetMap, defaultKind) => {
|
|
588
|
+
if (!patterns) return;
|
|
589
|
+
for (const patternDef of patterns) {
|
|
590
|
+
const pattern = patternDef.pattern || patternDef;
|
|
591
|
+
const results = runAstGrep(cmd, file, pattern, sgLang, basePath);
|
|
592
|
+
for (const match of results) {
|
|
593
|
+
const names = extractNamesFromMatch(match, patternDef);
|
|
594
|
+
for (const name of names) {
|
|
595
|
+
const kind = patternDef.kind || defaultKind;
|
|
596
|
+
addSymbol(targetMap, name, match, kind, patternDef.extra);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
// Extract exports
|
|
603
|
+
runPatternSet(langQueries.exports, exportMap, 'export');
|
|
604
|
+
|
|
605
|
+
// Extract functions
|
|
606
|
+
runPatternSet(langQueries.functions, functionMap, 'function');
|
|
607
|
+
|
|
608
|
+
// Extract classes
|
|
609
|
+
runPatternSet(langQueries.classes, classMap, 'class');
|
|
610
|
+
|
|
611
|
+
// Extract types
|
|
612
|
+
runPatternSet(langQueries.types, typeMap, 'type');
|
|
613
|
+
|
|
614
|
+
// Extract constants
|
|
615
|
+
runPatternSet(langQueries.constants, constMap, 'constant');
|
|
616
|
+
|
|
617
|
+
// Infer exports for languages with implicit public rules
|
|
618
|
+
const exportNames = new Set(exportMap.keys());
|
|
619
|
+
applyLanguageExportRules(language, content, exportNames, functionMap, classMap, typeMap, constMap);
|
|
620
|
+
|
|
621
|
+
// Ensure export entries exist for inferred exports
|
|
622
|
+
ensureExportEntries(exportMap, exportNames, functionMap, classMap, typeMap, constMap);
|
|
623
|
+
|
|
624
|
+
// Convert maps to arrays and mark exported flags
|
|
625
|
+
symbols.exports = mapToSortedArray(exportMap);
|
|
626
|
+
symbols.functions = mapToSortedArray(functionMap, exportNames);
|
|
627
|
+
symbols.classes = mapToSortedArray(classMap, exportNames);
|
|
628
|
+
symbols.types = mapToSortedArray(typeMap, exportNames);
|
|
629
|
+
symbols.constants = mapToSortedArray(constMap, exportNames);
|
|
630
|
+
|
|
631
|
+
return symbols;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Extract imports from a file using ast-grep
|
|
636
|
+
* @param {string} cmd - ast-grep command
|
|
637
|
+
* @param {string} file - File path
|
|
638
|
+
* @param {string} language - Language name
|
|
639
|
+
* @param {Object} langQueries - Query patterns for this language
|
|
640
|
+
* @param {string} basePath - Repository root (for cwd)
|
|
641
|
+
* @returns {Array} - Extracted imports
|
|
642
|
+
*/
|
|
643
|
+
function extractImports(cmd, file, language, langQueries, basePath) {
|
|
644
|
+
const imports = [];
|
|
645
|
+
|
|
646
|
+
if (!langQueries.imports) return imports;
|
|
647
|
+
|
|
648
|
+
const sgLang = queries.getSgLanguageForFile(file, language);
|
|
649
|
+
const seen = new Set();
|
|
650
|
+
|
|
651
|
+
for (const patternDef of langQueries.imports) {
|
|
652
|
+
const pattern = patternDef.pattern || patternDef;
|
|
653
|
+
const results = runAstGrep(cmd, file, pattern, sgLang, basePath);
|
|
654
|
+
for (const match of results) {
|
|
655
|
+
const sourceResult = extractSourceFromMatch(match, patternDef);
|
|
656
|
+
const sources = Array.isArray(sourceResult) ? sourceResult : [sourceResult];
|
|
657
|
+
for (const source of sources) {
|
|
658
|
+
if (!source) continue;
|
|
659
|
+
const key = `${source}:${patternDef.kind || 'import'}`;
|
|
660
|
+
if (seen.has(key)) continue;
|
|
661
|
+
seen.add(key);
|
|
662
|
+
imports.push({
|
|
663
|
+
source,
|
|
664
|
+
kind: patternDef.kind || 'import',
|
|
665
|
+
line: getLine(match)
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
return imports;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Run ast-grep with a pattern
|
|
676
|
+
* @param {string} cmd - ast-grep command
|
|
677
|
+
* @param {string} file - File to scan
|
|
678
|
+
* @param {string} pattern - Pattern to match
|
|
679
|
+
* @param {string} lang - ast-grep language identifier
|
|
680
|
+
* @param {string} basePath - Working directory
|
|
681
|
+
* @returns {Array} - Match results
|
|
682
|
+
*/
|
|
683
|
+
function runAstGrep(cmd, file, pattern, lang, basePath) {
|
|
684
|
+
try {
|
|
685
|
+
const result = spawnSync(cmd, [
|
|
686
|
+
'run',
|
|
687
|
+
'--pattern', pattern,
|
|
688
|
+
'--lang', lang,
|
|
689
|
+
'--json=stream',
|
|
690
|
+
file
|
|
691
|
+
], {
|
|
692
|
+
cwd: basePath,
|
|
693
|
+
encoding: 'utf8',
|
|
694
|
+
timeout: 30000,
|
|
695
|
+
windowsHide: true,
|
|
696
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
if (result.error) {
|
|
700
|
+
return [];
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
// ast-grep exits with 1 when no matches
|
|
704
|
+
if (typeof result.status === 'number' && result.status > 1) {
|
|
705
|
+
return [];
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
return parseNdjson(result.stdout);
|
|
709
|
+
} catch {
|
|
710
|
+
return [];
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
function parseNdjson(output) {
|
|
715
|
+
const matches = [];
|
|
716
|
+
const lines = (output || '').split('\n').filter(Boolean);
|
|
717
|
+
for (const line of lines) {
|
|
718
|
+
try {
|
|
719
|
+
matches.push(JSON.parse(line));
|
|
720
|
+
} catch {
|
|
721
|
+
// Skip malformed lines
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return matches;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Extract names from an ast-grep match, based on pattern metadata
|
|
729
|
+
* @param {Object} match - ast-grep match result
|
|
730
|
+
* @param {Object|string} patternDef - Pattern definition or string
|
|
731
|
+
* @returns {string[]} - List of names
|
|
732
|
+
*/
|
|
733
|
+
function extractNamesFromMatch(match, patternDef) {
|
|
734
|
+
const def = typeof patternDef === 'string' ? {} : (patternDef || {});
|
|
735
|
+
|
|
736
|
+
if (def.multi === 'exportList') {
|
|
737
|
+
return extractNamesFromExportList(match.text || '');
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
if (def.multi === 'objectLiteral') {
|
|
741
|
+
return extractNamesFromObjectLiteral(match.text || '');
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
const name = extractNameFromMatch(match, def.nameVar);
|
|
745
|
+
if (name) return [name];
|
|
746
|
+
if (def.fallbackName) return [def.fallbackName];
|
|
747
|
+
return [];
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
function getMetaVariable(match, key) {
|
|
751
|
+
if (!match || !match.metaVariables) return null;
|
|
752
|
+
if (match.metaVariables[key]) return match.metaVariables[key];
|
|
753
|
+
if (match.metaVariables.single && match.metaVariables.single[key]) {
|
|
754
|
+
return match.metaVariables.single[key];
|
|
755
|
+
}
|
|
756
|
+
return null;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Extract a single name from ast-grep match
|
|
761
|
+
* @param {Object} match - ast-grep match result
|
|
762
|
+
* @param {string|string[]} nameVar - Preferred meta variable name(s)
|
|
763
|
+
* @returns {string|null}
|
|
764
|
+
*/
|
|
765
|
+
function extractNameFromMatch(match, nameVar) {
|
|
766
|
+
const vars = [];
|
|
767
|
+
if (Array.isArray(nameVar)) {
|
|
768
|
+
vars.push(...nameVar);
|
|
769
|
+
} else if (nameVar) {
|
|
770
|
+
vars.push(nameVar);
|
|
771
|
+
}
|
|
772
|
+
vars.push('NAME', 'FUNC', 'CLASS', 'IDENT', 'N');
|
|
773
|
+
|
|
774
|
+
for (const key of vars) {
|
|
775
|
+
const variable = getMetaVariable(match, key);
|
|
776
|
+
if (variable && variable.text) {
|
|
777
|
+
return variable.text;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// Fallback: extract from matched text
|
|
782
|
+
if (match.text) {
|
|
783
|
+
const nameMatch = match.text.match(/(?:function|class|const|let|var|def|fn|pub\s+fn|type|struct|enum|trait|interface|record)\s+([a-zA-Z_][a-zA-Z0-9_]*)/);
|
|
784
|
+
if (nameMatch) {
|
|
785
|
+
return nameMatch[1];
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
return null;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Extract import source from ast-grep match
|
|
794
|
+
* @param {Object} match - ast-grep match result
|
|
795
|
+
* @param {Object|string} patternDef - Pattern definition or string
|
|
796
|
+
* @returns {string|null}
|
|
797
|
+
*/
|
|
798
|
+
function extractSourceFromMatch(match, patternDef) {
|
|
799
|
+
const def = typeof patternDef === 'string' ? {} : (patternDef || {});
|
|
800
|
+
const sourceVar = def.sourceVar || 'SOURCE';
|
|
801
|
+
|
|
802
|
+
const variable = getMetaVariable(match, sourceVar);
|
|
803
|
+
if (variable && variable.text) {
|
|
804
|
+
const raw = variable.text.replace(/^['"]|['"]$/g, '');
|
|
805
|
+
if (def.multiSource) {
|
|
806
|
+
return splitMultiSource(raw);
|
|
807
|
+
}
|
|
808
|
+
return raw;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
// Fallback: extract quoted string from match
|
|
812
|
+
if (match.text) {
|
|
813
|
+
const sourceMatch = match.text.match(/['"]([^'"]+)['"]/);
|
|
814
|
+
if (sourceMatch) {
|
|
815
|
+
return sourceMatch[1];
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
return null;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* Extract export names from `export { ... }`
|
|
824
|
+
* @param {string} text - Match text
|
|
825
|
+
* @returns {string[]}
|
|
826
|
+
*/
|
|
827
|
+
function extractNamesFromExportList(text) {
|
|
828
|
+
const match = text.match(/\{([^}]+)\}/);
|
|
829
|
+
if (!match) return [];
|
|
830
|
+
|
|
831
|
+
const names = new Set();
|
|
832
|
+
const parts = match[1].split(',');
|
|
833
|
+
for (const part of parts) {
|
|
834
|
+
const trimmed = part.trim();
|
|
835
|
+
if (!trimmed) continue;
|
|
836
|
+
const aliasMatch = trimmed.split(/\s+as\s+/i).map(s => s.trim());
|
|
837
|
+
const name = (aliasMatch[1] || aliasMatch[0]).replace(/[^a-zA-Z0-9_\$]/g, '');
|
|
838
|
+
if (isValidIdentifier(name)) names.add(name);
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
return Array.from(names);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Extract property names from object literal
|
|
846
|
+
* @param {string} text - Match text
|
|
847
|
+
* @returns {string[]}
|
|
848
|
+
*/
|
|
849
|
+
function extractNamesFromObjectLiteral(text) {
|
|
850
|
+
const match = text.match(/\{([\s\S]*?)\}/);
|
|
851
|
+
if (!match) return [];
|
|
852
|
+
|
|
853
|
+
const body = match[1];
|
|
854
|
+
const names = new Set();
|
|
855
|
+
|
|
856
|
+
// Match shorthand properties and key: value pairs
|
|
857
|
+
const propRegex = /\b([A-Za-z_$][\w$]*)\b\s*(?=,|\}|:)/g;
|
|
858
|
+
let propMatch;
|
|
859
|
+
while ((propMatch = propRegex.exec(body)) !== null) {
|
|
860
|
+
const name = propMatch[1];
|
|
861
|
+
if (isValidIdentifier(name)) names.add(name);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
return Array.from(names);
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Split comma-separated import sources
|
|
869
|
+
* @param {string} raw - Raw source text
|
|
870
|
+
* @returns {string[]}
|
|
871
|
+
*/
|
|
872
|
+
function splitMultiSource(raw) {
|
|
873
|
+
if (!raw) return [];
|
|
874
|
+
const parts = raw.split(',').map(p => p.trim()).filter(Boolean);
|
|
875
|
+
const results = [];
|
|
876
|
+
for (const part of parts) {
|
|
877
|
+
const [name] = part.split(/\s+as\s+/i);
|
|
878
|
+
const cleaned = name.trim().replace(/^['"]|['"]$/g, '');
|
|
879
|
+
if (cleaned) results.push(cleaned);
|
|
880
|
+
}
|
|
881
|
+
return results;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Determine if a name is a valid identifier
|
|
886
|
+
* @param {string} name - Name to check
|
|
887
|
+
* @returns {boolean}
|
|
888
|
+
*/
|
|
889
|
+
function isValidIdentifier(name) {
|
|
890
|
+
return Boolean(name) && /^[A-Za-z_$][\w$]*$/.test(name);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Get 1-based line number from ast-grep match
|
|
895
|
+
* @param {Object} match - ast-grep match
|
|
896
|
+
* @returns {number|null}
|
|
897
|
+
*/
|
|
898
|
+
function getLine(match) {
|
|
899
|
+
const line = match?.range?.start?.line;
|
|
900
|
+
return typeof line === 'number' ? line + 1 : null;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* Apply language-specific export rules
|
|
905
|
+
* @param {string} language - Language name
|
|
906
|
+
* @param {string} content - File content
|
|
907
|
+
* @param {Set<string>} exportNames - Export name set (in-place)
|
|
908
|
+
* @param {Map} functionMap - Function symbols
|
|
909
|
+
* @param {Map} classMap - Class symbols
|
|
910
|
+
* @param {Map} typeMap - Type symbols
|
|
911
|
+
* @param {Map} constMap - Constant symbols
|
|
912
|
+
*/
|
|
913
|
+
function applyLanguageExportRules(language, content, exportNames, functionMap, classMap, typeMap, constMap) {
|
|
914
|
+
if (language === 'python') {
|
|
915
|
+
const explicit = extractPythonAll(content);
|
|
916
|
+
if (explicit.length > 0) {
|
|
917
|
+
for (const name of explicit) exportNames.add(name);
|
|
918
|
+
} else {
|
|
919
|
+
addPublicNames(exportNames, functionMap, classMap, typeMap, constMap, name => !name.startsWith('_'));
|
|
920
|
+
}
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
if (language === 'go') {
|
|
925
|
+
addPublicNames(exportNames, functionMap, classMap, typeMap, constMap, name => isExportedGoName(name));
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* Extract __all__ exports from Python content
|
|
931
|
+
* @param {string} content - File content
|
|
932
|
+
* @returns {string[]}
|
|
933
|
+
*/
|
|
934
|
+
function extractPythonAll(content) {
|
|
935
|
+
if (!content) return [];
|
|
936
|
+
const match = content.match(/__all__\s*=\s*[\[(]([\s\S]*?)[\])]\s*/m);
|
|
937
|
+
if (!match) return [];
|
|
938
|
+
|
|
939
|
+
const body = match[1];
|
|
940
|
+
const names = [];
|
|
941
|
+
const stringRegex = /['"]([^'"]+)['"]/g;
|
|
942
|
+
let m;
|
|
943
|
+
while ((m = stringRegex.exec(body)) !== null) {
|
|
944
|
+
if (m[1]) names.push(m[1]);
|
|
945
|
+
}
|
|
946
|
+
return names;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Add public names from symbol maps based on predicate
|
|
951
|
+
* @param {Set<string>} exportNames - Export name set
|
|
952
|
+
* @param {...Map} maps - Symbol maps
|
|
953
|
+
* @param {Function} predicate - Function(name) => boolean
|
|
954
|
+
*/
|
|
955
|
+
function addPublicNames(exportNames, ...args) {
|
|
956
|
+
const predicate = args.pop();
|
|
957
|
+
const maps = args;
|
|
958
|
+
for (const map of maps) {
|
|
959
|
+
for (const name of map.keys()) {
|
|
960
|
+
if (predicate(name)) exportNames.add(name);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* Determine if a Go identifier is exported
|
|
967
|
+
* @param {string} name - Identifier
|
|
968
|
+
* @returns {boolean}
|
|
969
|
+
*/
|
|
970
|
+
function isExportedGoName(name) {
|
|
971
|
+
if (!name) return false;
|
|
972
|
+
const first = name[0];
|
|
973
|
+
return first.toUpperCase() === first && first.toLowerCase() !== first;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Ensure export entries exist for inferred exports
|
|
978
|
+
* @param {Map} exportMap - Export map to populate
|
|
979
|
+
* @param {Set<string>} exportNames - Names to ensure
|
|
980
|
+
* @param {Map} functionMap - Function map
|
|
981
|
+
* @param {Map} classMap - Class map
|
|
982
|
+
* @param {Map} typeMap - Type map
|
|
983
|
+
* @param {Map} constMap - Constant map
|
|
984
|
+
*/
|
|
985
|
+
function ensureExportEntries(exportMap, exportNames, functionMap, classMap, typeMap, constMap) {
|
|
986
|
+
const sources = [functionMap, classMap, typeMap, constMap];
|
|
987
|
+
|
|
988
|
+
for (const name of exportNames) {
|
|
989
|
+
if (exportMap.has(name)) continue;
|
|
990
|
+
|
|
991
|
+
let entry = null;
|
|
992
|
+
for (const map of sources) {
|
|
993
|
+
if (map.has(name)) {
|
|
994
|
+
const item = map.get(name);
|
|
995
|
+
entry = { name, line: item.line, kind: item.kind };
|
|
996
|
+
break;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
if (!entry) {
|
|
1001
|
+
entry = { name, line: null, kind: 'export' };
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
exportMap.set(name, entry);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* Convert symbol map to sorted array and mark exported flags
|
|
1010
|
+
* @param {Map} map - Symbol map
|
|
1011
|
+
* @param {Set<string>} [exportNames] - Export name set
|
|
1012
|
+
* @returns {Array}
|
|
1013
|
+
*/
|
|
1014
|
+
function mapToSortedArray(map, exportNames) {
|
|
1015
|
+
const list = Array.from(map.values());
|
|
1016
|
+
if (exportNames) {
|
|
1017
|
+
for (const item of list) {
|
|
1018
|
+
item.exported = exportNames.has(item.name);
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
list.sort((a, b) => a.name.localeCompare(b.name));
|
|
1022
|
+
return list;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* Get git info for the repository
|
|
1027
|
+
* @param {string} basePath - Repository root
|
|
1028
|
+
* @returns {Object|null}
|
|
1029
|
+
*/
|
|
1030
|
+
function getGitInfo(basePath) {
|
|
1031
|
+
try {
|
|
1032
|
+
const commit = execFileSync('git', ['rev-parse', 'HEAD'], {
|
|
1033
|
+
cwd: basePath,
|
|
1034
|
+
encoding: 'utf8',
|
|
1035
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
1036
|
+
}).trim();
|
|
1037
|
+
|
|
1038
|
+
const branch = execFileSync('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {
|
|
1039
|
+
cwd: basePath,
|
|
1040
|
+
encoding: 'utf8',
|
|
1041
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
1042
|
+
}).trim();
|
|
1043
|
+
|
|
1044
|
+
return { commit, branch };
|
|
1045
|
+
} catch {
|
|
1046
|
+
return null;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Detect primary project type from languages
|
|
1052
|
+
* @param {string[]} languages - Detected languages
|
|
1053
|
+
* @returns {string}
|
|
1054
|
+
*/
|
|
1055
|
+
function detectProjectType(languages) {
|
|
1056
|
+
// Priority order
|
|
1057
|
+
const priority = ['typescript', 'javascript', 'python', 'rust', 'go', 'java'];
|
|
1058
|
+
for (const lang of priority) {
|
|
1059
|
+
if (languages.includes(lang)) {
|
|
1060
|
+
return lang === 'typescript' ? 'node' : lang;
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
return languages[0] || 'unknown';
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
* Scan a single file (for incremental updates)
|
|
1068
|
+
* @param {string} cmd - ast-grep command
|
|
1069
|
+
* @param {string} file - File path
|
|
1070
|
+
* @param {string} basePath - Repository root
|
|
1071
|
+
* @returns {Object|null} - File data or null if failed
|
|
1072
|
+
*/
|
|
1073
|
+
function scanSingleFile(cmd, file, basePath) {
|
|
1074
|
+
const ext = path.extname(file).toLowerCase();
|
|
1075
|
+
|
|
1076
|
+
// Find language for this extension
|
|
1077
|
+
let language = null;
|
|
1078
|
+
for (const [lang, exts] of Object.entries(LANGUAGE_EXTENSIONS)) {
|
|
1079
|
+
if (exts.includes(ext)) {
|
|
1080
|
+
language = lang;
|
|
1081
|
+
break;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
if (!language) return null;
|
|
1086
|
+
|
|
1087
|
+
const langQueries = queries.getQueriesForLanguage(language);
|
|
1088
|
+
if (!langQueries) return null;
|
|
1089
|
+
|
|
1090
|
+
try {
|
|
1091
|
+
const content = fs.readFileSync(file, 'utf8');
|
|
1092
|
+
const hash = crypto.createHash('sha256').update(content).digest('hex').slice(0, 16);
|
|
1093
|
+
|
|
1094
|
+
const symbols = extractSymbols(cmd, file, language, langQueries, basePath, content);
|
|
1095
|
+
const imports = extractImports(cmd, file, language, langQueries, basePath);
|
|
1096
|
+
|
|
1097
|
+
return {
|
|
1098
|
+
hash,
|
|
1099
|
+
language,
|
|
1100
|
+
size: content.length,
|
|
1101
|
+
symbols,
|
|
1102
|
+
imports
|
|
1103
|
+
};
|
|
1104
|
+
} catch {
|
|
1105
|
+
return null;
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* Scan a single file asynchronously (for incremental updates)
|
|
1111
|
+
* Uses async file read, but ast-grep subprocess remains synchronous
|
|
1112
|
+
* @param {string} cmd - ast-grep command
|
|
1113
|
+
* @param {string} file - File path
|
|
1114
|
+
* @param {string} basePath - Repository root
|
|
1115
|
+
* @returns {Promise<Object|null>} - File data or null if failed
|
|
1116
|
+
*/
|
|
1117
|
+
async function scanSingleFileAsync(cmd, file, basePath) {
|
|
1118
|
+
const ext = path.extname(file).toLowerCase();
|
|
1119
|
+
|
|
1120
|
+
// Find language for this extension
|
|
1121
|
+
let language = null;
|
|
1122
|
+
for (const [lang, exts] of Object.entries(LANGUAGE_EXTENSIONS)) {
|
|
1123
|
+
if (exts.includes(ext)) {
|
|
1124
|
+
language = lang;
|
|
1125
|
+
break;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
if (!language) return null;
|
|
1130
|
+
|
|
1131
|
+
const langQueries = queries.getQueriesForLanguage(language);
|
|
1132
|
+
if (!langQueries) return null;
|
|
1133
|
+
|
|
1134
|
+
try {
|
|
1135
|
+
const content = await fsPromises.readFile(file, 'utf8');
|
|
1136
|
+
const hash = crypto.createHash('sha256').update(content).digest('hex').slice(0, 16);
|
|
1137
|
+
|
|
1138
|
+
const symbols = extractSymbols(cmd, file, language, langQueries, basePath, content);
|
|
1139
|
+
const imports = extractImports(cmd, file, language, langQueries, basePath);
|
|
1140
|
+
|
|
1141
|
+
return {
|
|
1142
|
+
hash,
|
|
1143
|
+
language,
|
|
1144
|
+
size: content.length,
|
|
1145
|
+
symbols,
|
|
1146
|
+
imports
|
|
1147
|
+
};
|
|
1148
|
+
} catch {
|
|
1149
|
+
return null;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
module.exports = {
|
|
1154
|
+
detectLanguages,
|
|
1155
|
+
fullScan,
|
|
1156
|
+
findFilesForLanguage,
|
|
1157
|
+
collectFilesByLanguage,
|
|
1158
|
+
scanSingleFile,
|
|
1159
|
+
scanSingleFileAsync,
|
|
1160
|
+
runAstGrep,
|
|
1161
|
+
getGitInfo,
|
|
1162
|
+
batchReadFiles,
|
|
1163
|
+
LANGUAGE_EXTENSIONS,
|
|
1164
|
+
EXCLUDE_DIRS
|
|
1165
|
+
};
|