specweave 0.29.2 → 0.30.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/README.md +65 -16
- package/bin/specweave.js +16 -0
- package/dist/plugins/specweave-ado/lib/ado-spec-commit-sync.d.ts +1 -1
- package/dist/plugins/specweave-ado/lib/ado-spec-commit-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-ado/lib/ado-spec-commit-sync.js +1 -1
- package/dist/plugins/specweave-ado/lib/ado-spec-commit-sync.js.map +1 -1
- package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.d.ts +1 -1
- package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.js +1 -1
- package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.js.map +1 -1
- package/dist/plugins/specweave-ado/lib/conflict-resolver.d.ts +134 -0
- package/dist/plugins/specweave-ado/lib/conflict-resolver.d.ts.map +1 -0
- package/dist/plugins/specweave-ado/lib/conflict-resolver.js +423 -0
- package/dist/plugins/specweave-ado/lib/conflict-resolver.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-client-v2.d.ts +23 -1
- package/dist/plugins/specweave-github/lib/github-client-v2.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-client-v2.js +95 -0
- package/dist/plugins/specweave-github/lib/github-client-v2.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-commit-sync.d.ts +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-commit-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-commit-sync.js +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-commit-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/types.d.ts +20 -0
- package/dist/plugins/specweave-github/lib/types.d.ts.map +1 -1
- package/dist/plugins/specweave-jira/lib/jira-spec-commit-sync.d.ts +1 -1
- package/dist/plugins/specweave-jira/lib/jira-spec-commit-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-jira/lib/jira-spec-commit-sync.js +1 -1
- package/dist/plugins/specweave-jira/lib/jira-spec-commit-sync.js.map +1 -1
- package/dist/plugins/specweave-jira/lib/jira-spec-content-sync.d.ts +1 -1
- package/dist/plugins/specweave-jira/lib/jira-spec-content-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-jira/lib/jira-spec-content-sync.js +1 -1
- package/dist/plugins/specweave-jira/lib/jira-spec-content-sync.js.map +1 -1
- package/dist/plugins/specweave-jira/lib/setup-wizard.d.ts +2 -2
- package/dist/plugins/specweave-jira/lib/setup-wizard.d.ts.map +1 -1
- package/dist/plugins/specweave-jira/lib/setup-wizard.js +1 -1
- package/dist/plugins/specweave-jira/lib/setup-wizard.js.map +1 -1
- package/dist/src/adapters/claude/adapter.js +1 -1
- package/dist/src/adapters/claude/adapter.js.map +1 -1
- package/dist/src/cli/commands/detect-project.js +1 -1
- package/dist/src/cli/commands/detect-project.js.map +1 -1
- package/dist/src/cli/commands/detect-specs.js +1 -1
- package/dist/src/cli/commands/detect-specs.js.map +1 -1
- package/dist/src/cli/commands/import-docs.js +1 -1
- package/dist/src/cli/commands/import-docs.js.map +1 -1
- package/dist/src/cli/commands/init-multiproject.js +1 -1
- package/dist/src/cli/commands/init-multiproject.js.map +1 -1
- package/dist/src/cli/commands/init.d.ts.map +1 -1
- package/dist/src/cli/commands/init.js +31 -1
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/jobs.js +15 -1
- package/dist/src/cli/commands/jobs.js.map +1 -1
- package/dist/src/cli/commands/migrate-to-multiproject.js +1 -1
- package/dist/src/cli/commands/migrate-to-multiproject.js.map +1 -1
- package/dist/src/cli/commands/switch-project.js +1 -1
- package/dist/src/cli/commands/switch-project.js.map +1 -1
- package/dist/src/cli/commands/sync-scheduled.d.ts +38 -0
- package/dist/src/cli/commands/sync-scheduled.d.ts.map +1 -0
- package/dist/src/cli/commands/sync-scheduled.js +170 -0
- package/dist/src/cli/commands/sync-scheduled.js.map +1 -0
- package/dist/src/cli/helpers/init/external-import-grouping.d.ts +53 -0
- package/dist/src/cli/helpers/init/external-import-grouping.d.ts.map +1 -0
- package/dist/src/cli/helpers/init/external-import-grouping.js +287 -0
- package/dist/src/cli/helpers/init/external-import-grouping.js.map +1 -0
- package/dist/src/cli/helpers/init/external-import.d.ts +1 -34
- package/dist/src/cli/helpers/init/external-import.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/external-import.js +15 -486
- package/dist/src/cli/helpers/init/external-import.js.map +1 -1
- package/dist/src/cli/helpers/init/living-docs-preflight.d.ts +58 -0
- package/dist/src/cli/helpers/init/living-docs-preflight.d.ts.map +1 -0
- package/dist/src/cli/helpers/init/living-docs-preflight.js +290 -0
- package/dist/src/cli/helpers/init/living-docs-preflight.js.map +1 -0
- package/dist/src/cli/helpers/init/sync-profile-helpers.d.ts +48 -0
- package/dist/src/cli/helpers/init/sync-profile-helpers.d.ts.map +1 -0
- package/dist/src/cli/helpers/init/sync-profile-helpers.js +238 -0
- package/dist/src/cli/helpers/init/sync-profile-helpers.js.map +1 -0
- package/dist/src/cli/helpers/init/types.d.ts +1 -0
- package/dist/src/cli/helpers/init/types.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado.js +113 -3
- package/dist/src/cli/helpers/issue-tracker/ado.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/index.js +2 -287
- package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.d.ts +25 -0
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.d.ts.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js +306 -0
- package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/types.d.ts +27 -0
- package/dist/src/cli/helpers/issue-tracker/types.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/types.js.map +1 -1
- package/dist/src/cli/workers/living-docs-worker.d.ts +16 -0
- package/dist/src/cli/workers/living-docs-worker.d.ts.map +1 -0
- package/dist/src/cli/workers/living-docs-worker.js +395 -0
- package/dist/src/cli/workers/living-docs-worker.js.map +1 -0
- package/dist/src/core/background/job-dependency.d.ts +45 -0
- package/dist/src/core/background/job-dependency.d.ts.map +1 -0
- package/dist/src/core/background/job-dependency.js +144 -0
- package/dist/src/core/background/job-dependency.js.map +1 -0
- package/dist/src/core/background/job-launcher.d.ts +21 -1
- package/dist/src/core/background/job-launcher.d.ts.map +1 -1
- package/dist/src/core/background/job-launcher.js +93 -0
- package/dist/src/core/background/job-launcher.js.map +1 -1
- package/dist/src/core/background/types.d.ts +73 -2
- package/dist/src/core/background/types.d.ts.map +1 -1
- package/dist/src/core/brownfield/importer.js +1 -1
- package/dist/src/core/brownfield/importer.js.map +1 -1
- package/dist/src/core/comment-builder.d.ts +1 -1
- package/dist/src/core/comment-builder.d.ts.map +1 -1
- package/dist/src/core/{cost-tracker.d.ts → cost/cost-tracker.d.ts} +2 -2
- package/dist/src/core/cost/cost-tracker.d.ts.map +1 -0
- package/dist/src/core/{cost-tracker.js → cost/cost-tracker.js} +2 -2
- package/dist/src/core/cost/cost-tracker.js.map +1 -0
- package/dist/src/core/credentials/credentials-manager.d.ts.map +1 -0
- package/dist/src/core/credentials/credentials-manager.js.map +1 -0
- package/dist/src/core/increment/discipline-checker.js +1 -1
- package/dist/src/core/increment/discipline-checker.js.map +1 -1
- package/dist/src/core/increment/increment-archiver.d.ts +9 -8
- package/dist/src/core/increment/increment-archiver.d.ts.map +1 -1
- package/dist/src/core/increment/increment-archiver.js +40 -42
- package/dist/src/core/increment/increment-archiver.js.map +1 -1
- package/dist/src/core/increment/increment-status.d.ts.map +1 -0
- package/dist/src/core/{increment-status.js → increment/increment-status.js} +1 -1
- package/dist/src/core/increment/increment-status.js.map +1 -0
- package/dist/src/core/increment/increment-utils.d.ts.map +1 -0
- package/dist/src/core/increment/increment-utils.js.map +1 -0
- package/dist/src/core/increment/metadata-validator.js +1 -1
- package/dist/src/core/increment/metadata-validator.js.map +1 -1
- package/dist/src/core/living-docs/checkpoint-manager.d.ts +120 -0
- package/dist/src/core/living-docs/checkpoint-manager.d.ts.map +1 -0
- package/dist/src/core/living-docs/checkpoint-manager.js +231 -0
- package/dist/src/core/living-docs/checkpoint-manager.js.map +1 -0
- package/dist/src/core/living-docs/discovery.d.ts +91 -0
- package/dist/src/core/living-docs/discovery.d.ts.map +1 -0
- package/dist/src/core/living-docs/discovery.js +656 -0
- package/dist/src/core/living-docs/discovery.js.map +1 -0
- package/dist/src/core/living-docs/feature-archiver.d.ts +23 -4
- package/dist/src/core/living-docs/feature-archiver.d.ts.map +1 -1
- package/dist/src/core/living-docs/feature-archiver.js +133 -30
- package/dist/src/core/living-docs/feature-archiver.js.map +1 -1
- package/dist/src/core/living-docs/foundation-builder.d.ts +37 -0
- package/dist/src/core/living-docs/foundation-builder.d.ts.map +1 -0
- package/dist/src/core/living-docs/foundation-builder.js +357 -0
- package/dist/src/core/living-docs/foundation-builder.js.map +1 -0
- package/dist/src/core/living-docs/living-docs-sync.d.ts +58 -0
- package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.js +204 -7
- package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
- package/dist/src/core/living-docs/module-analyzer.d.ts +97 -0
- package/dist/src/core/living-docs/module-analyzer.d.ts.map +1 -0
- package/dist/src/core/living-docs/module-analyzer.js +427 -0
- package/dist/src/core/living-docs/module-analyzer.js.map +1 -0
- package/dist/src/core/living-docs/suggestions-generator.d.ts +112 -0
- package/dist/src/core/living-docs/suggestions-generator.d.ts.map +1 -0
- package/dist/src/core/living-docs/suggestions-generator.js +362 -0
- package/dist/src/core/living-docs/suggestions-generator.js.map +1 -0
- package/dist/src/core/living-docs/workitem-matcher.d.ts +116 -0
- package/dist/src/core/living-docs/workitem-matcher.d.ts.map +1 -0
- package/dist/src/core/living-docs/workitem-matcher.js +356 -0
- package/dist/src/core/living-docs/workitem-matcher.js.map +1 -0
- package/dist/src/core/{plugin-loader.d.ts → plugins/plugin-loader.d.ts} +1 -1
- package/dist/src/core/plugins/plugin-loader.d.ts.map +1 -0
- package/dist/src/core/{plugin-loader.js → plugins/plugin-loader.js} +2 -2
- package/dist/src/core/plugins/plugin-loader.js.map +1 -0
- package/dist/src/core/{project-manager.d.ts → project/project-manager.d.ts} +1 -1
- package/dist/src/core/project/project-manager.d.ts.map +1 -0
- package/dist/src/core/{project-manager.js → project/project-manager.js} +3 -3
- package/dist/src/core/project/project-manager.js.map +1 -0
- package/dist/src/core/project/project-structure-detector.d.ts.map +1 -0
- package/dist/src/core/project/project-structure-detector.js.map +1 -0
- package/dist/src/core/{rfc-generator-v2.d.ts → rfc/rfc-generator-v2.d.ts} +1 -1
- package/dist/src/core/rfc/rfc-generator-v2.d.ts.map +1 -0
- package/dist/src/core/{rfc-generator-v2.js → rfc/rfc-generator-v2.js} +1 -1
- package/dist/src/core/rfc/rfc-generator-v2.js.map +1 -0
- package/dist/src/core/scheduler/index.d.ts +1 -0
- package/dist/src/core/scheduler/index.d.ts.map +1 -1
- package/dist/src/core/scheduler/index.js +1 -0
- package/dist/src/core/scheduler/index.js.map +1 -1
- package/dist/src/core/scheduler/scheduled-job.d.ts +1 -1
- package/dist/src/core/scheduler/scheduled-job.d.ts.map +1 -1
- package/dist/src/core/scheduler/scheduled-job.js.map +1 -1
- package/dist/src/core/scheduler/session-sync-executor.d.ts +138 -0
- package/dist/src/core/scheduler/session-sync-executor.d.ts.map +1 -0
- package/dist/src/core/scheduler/session-sync-executor.js +333 -0
- package/dist/src/core/scheduler/session-sync-executor.js.map +1 -0
- package/dist/src/core/{spec-content-sync.d.ts → specs/spec-content-sync.d.ts} +2 -2
- package/dist/src/core/specs/spec-content-sync.d.ts.map +1 -0
- package/dist/src/core/{spec-content-sync.js → specs/spec-content-sync.js} +1 -1
- package/dist/src/core/specs/spec-content-sync.js.map +1 -0
- package/dist/src/core/{spec-detector.d.ts → specs/spec-detector.d.ts} +1 -1
- package/dist/src/core/specs/spec-detector.d.ts.map +1 -0
- package/dist/src/core/{spec-detector.js → specs/spec-detector.js} +1 -1
- package/dist/src/core/specs/spec-detector.js.map +1 -0
- package/dist/src/core/{spec-identifier-detector.d.ts → specs/spec-identifier-detector.d.ts} +2 -2
- package/dist/src/core/specs/spec-identifier-detector.d.ts.map +1 -0
- package/dist/src/core/{spec-identifier-detector.js → specs/spec-identifier-detector.js} +1 -1
- package/dist/src/core/specs/spec-identifier-detector.js.map +1 -0
- package/dist/src/core/specs/spec-metadata-manager.js +1 -1
- package/dist/src/core/specs/spec-metadata-manager.js.map +1 -1
- package/dist/src/core/specs/spec-task-mapper.d.ts.map +1 -0
- package/dist/src/core/specs/spec-task-mapper.js.map +1 -0
- package/dist/src/core/sync/sync-audit-logger.d.ts +62 -0
- package/dist/src/core/sync/sync-audit-logger.d.ts.map +1 -1
- package/dist/src/core/sync/sync-audit-logger.js +59 -0
- package/dist/src/core/sync/sync-audit-logger.js.map +1 -1
- package/dist/src/importers/item-converter.d.ts +51 -27
- package/dist/src/importers/item-converter.d.ts.map +1 -1
- package/dist/src/importers/item-converter.js +219 -179
- package/dist/src/importers/item-converter.js.map +1 -1
- package/dist/src/importers/markdown-generator.d.ts +75 -0
- package/dist/src/importers/markdown-generator.d.ts.map +1 -0
- package/dist/src/importers/markdown-generator.js +250 -0
- package/dist/src/importers/markdown-generator.js.map +1 -0
- package/dist/src/integrations/ado/ado-client.d.ts +93 -0
- package/dist/src/integrations/ado/ado-client.d.ts.map +1 -1
- package/dist/src/integrations/ado/ado-client.js +172 -1
- package/dist/src/integrations/ado/ado-client.js.map +1 -1
- package/dist/src/integrations/jira/jira-client.d.ts +44 -0
- package/dist/src/integrations/jira/jira-client.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-client.js +119 -1
- package/dist/src/integrations/jira/jira-client.js.map +1 -1
- package/dist/src/integrations/jira/jira-incremental-mapper.js +2 -2
- package/dist/src/integrations/jira/jira-incremental-mapper.js.map +1 -1
- package/dist/src/integrations/jira/jira-mapper.js +1 -1
- package/dist/src/integrations/jira/jira-mapper.js.map +1 -1
- package/dist/src/living-docs/epic-id-allocator.d.ts +177 -0
- package/dist/src/living-docs/epic-id-allocator.d.ts.map +1 -0
- package/dist/src/living-docs/epic-id-allocator.js +363 -0
- package/dist/src/living-docs/epic-id-allocator.js.map +1 -0
- package/dist/src/sync/external-change-puller.d.ts +94 -0
- package/dist/src/sync/external-change-puller.d.ts.map +1 -0
- package/dist/src/sync/external-change-puller.js +181 -0
- package/dist/src/sync/external-change-puller.js.map +1 -0
- package/dist/src/sync/index.d.ts +4 -0
- package/dist/src/sync/index.d.ts.map +1 -1
- package/dist/src/sync/index.js +2 -0
- package/dist/src/sync/index.js.map +1 -1
- package/dist/src/sync/living-docs-updater.d.ts +93 -0
- package/dist/src/sync/living-docs-updater.d.ts.map +1 -0
- package/dist/src/sync/living-docs-updater.js +218 -0
- package/dist/src/sync/living-docs-updater.js.map +1 -0
- package/dist/src/testing/test-generator.js +1 -1
- package/dist/src/testing/test-generator.js.map +1 -1
- package/dist/src/utils/cost-reporter.d.ts +1 -1
- package/dist/src/utils/cost-reporter.d.ts.map +1 -1
- package/dist/src/utils/model-selection.js +4 -4
- package/dist/src/utils/model-selection.js.map +1 -1
- package/dist/src/utils/pricing-constants.d.ts +2 -2
- package/dist/src/utils/pricing-constants.js +2 -2
- package/package.json +1 -1
- package/plugins/specweave/.claude-plugin/plugin.json +1 -28
- package/plugins/specweave/agents/code-standards-detective/AGENT.md +3 -3
- package/plugins/specweave/agents/infrastructure/AGENT.md +4 -0
- package/plugins/specweave/agents/performance/AGENT.md +2 -2
- package/plugins/specweave/agents/reflective-reviewer/AGENT.md +3 -3
- package/plugins/specweave/agents/translator/AGENT.md +2 -2
- package/plugins/specweave/commands/specweave-costs.md +2 -2
- package/plugins/specweave/commands/specweave-do.md +2 -2
- package/plugins/specweave/hooks/lib/scheduler-startup.sh +59 -8
- package/plugins/specweave/skills/code-reviewer/SKILL.md +1 -1
- package/plugins/specweave/skills/role-orchestrator/README.md +1 -1
- package/plugins/specweave-ado/agents/ado-manager/AGENT.md +8 -2
- package/plugins/specweave-ado/agents/ado-multi-project-mapper/AGENT.md +2 -2
- package/plugins/specweave-ado/agents/ado-sync-judge/AGENT.md +2 -2
- package/plugins/specweave-ado/lib/ado-spec-commit-sync.d.ts +1 -1
- package/plugins/specweave-ado/lib/ado-spec-commit-sync.js +1 -1
- package/plugins/specweave-ado/lib/ado-spec-commit-sync.ts +1 -1
- package/plugins/specweave-ado/lib/ado-spec-content-sync.js +1 -1
- package/plugins/specweave-ado/lib/ado-spec-content-sync.ts +1 -1
- package/plugins/specweave-ado/lib/conflict-resolver.js +87 -0
- package/plugins/specweave-ado/lib/conflict-resolver.ts +124 -0
- package/plugins/specweave-ado/skills/specweave-ado-mapper/SKILL.md +1 -1
- package/plugins/specweave-backend/agents/database-optimizer/AGENT.md +3 -3
- package/plugins/specweave-backend/skills/dotnet-backend/SKILL.md +1 -1
- package/plugins/specweave-backend/skills/nodejs-backend/SKILL.md +1 -1
- package/plugins/specweave-backend/skills/python-backend/SKILL.md +1 -1
- package/plugins/specweave-confluent/agents/confluent-architect/AGENT.md +6 -1
- package/plugins/specweave-diagrams/agents/diagrams-architect/AGENT.md +2 -2
- package/plugins/specweave-diagrams/skills/diagrams-architect/SKILL.md +1 -1
- package/plugins/specweave-frontend/agents/frontend-architect/AGENT.md +4 -0
- package/plugins/specweave-github/agents/github-manager/AGENT.md +1 -1
- package/plugins/specweave-github/agents/github-task-splitter/AGENT.md +11 -1
- package/plugins/specweave-github/agents/user-story-updater/AGENT.md +6 -1
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +90 -0
- package/plugins/specweave-github/lib/github-client-v2.js +97 -0
- package/plugins/specweave-github/lib/github-client-v2.ts +115 -1
- package/plugins/specweave-github/lib/github-spec-commit-sync.d.ts +1 -1
- package/plugins/specweave-github/lib/github-spec-commit-sync.js +1 -1
- package/plugins/specweave-github/lib/github-spec-commit-sync.ts +1 -1
- package/plugins/specweave-github/lib/github-spec-content-sync.js +1 -1
- package/plugins/specweave-github/lib/github-spec-content-sync.ts +1 -1
- package/plugins/specweave-github/lib/types.ts +21 -0
- package/plugins/specweave-infrastructure/agents/devops/AGENT.md +1 -1
- package/plugins/specweave-infrastructure/agents/network-engineer/AGENT.md +3 -3
- package/plugins/specweave-infrastructure/agents/observability-engineer/AGENT.md +2 -2
- package/plugins/specweave-infrastructure/agents/performance-engineer/AGENT.md +3 -3
- package/plugins/specweave-infrastructure/agents/sre/AGENT.md +2 -2
- package/plugins/specweave-jira/agents/jira-manager/AGENT.md +11 -1
- package/plugins/specweave-jira/commands/import-projects.js +1 -1
- package/plugins/specweave-jira/commands/import-projects.ts +1 -1
- package/plugins/specweave-jira/lib/jira-spec-commit-sync.d.ts +1 -1
- package/plugins/specweave-jira/lib/jira-spec-commit-sync.js +1 -1
- package/plugins/specweave-jira/lib/jira-spec-commit-sync.ts +1 -1
- package/plugins/specweave-jira/lib/jira-spec-content-sync.js +1 -1
- package/plugins/specweave-jira/lib/jira-spec-content-sync.ts +1 -1
- package/plugins/specweave-jira/lib/setup-wizard.js +2 -2
- package/plugins/specweave-jira/lib/setup-wizard.ts +2 -2
- package/plugins/specweave-jira/skills/specweave-jira-mapper/SKILL.md +1 -1
- package/plugins/specweave-kafka/agents/kafka-architect/AGENT.md +5 -1
- package/plugins/specweave-kafka/agents/kafka-devops/AGENT.md +6 -1
- package/plugins/specweave-kafka/agents/kafka-observability/AGENT.md +6 -1
- package/plugins/specweave-kubernetes/agents/kubernetes-architect/AGENT.md +3 -3
- package/plugins/specweave-ml/agents/data-scientist/AGENT.md +2 -1
- package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +2 -1
- package/plugins/specweave-ml/agents/mlops-engineer/AGENT.md +3 -3
- package/plugins/specweave-mobile/agents/mobile-architect/AGENT.md +6 -1
- package/plugins/specweave-payments/agents/payment-integration/AGENT.md +3 -3
- package/plugins/specweave-release/agents/release-manager/AGENT.md +6 -1
- package/plugins/specweave-release/commands/specweave-release-npm.md +8 -0
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +135 -0
- package/plugins/specweave-testing/agents/qa-engineer/AGENT.md +5 -0
- package/src/templates/AGENTS.md.template +97 -0
- package/dist/src/core/cost-tracker.d.ts.map +0 -1
- package/dist/src/core/cost-tracker.js.map +0 -1
- package/dist/src/core/credentials-manager.d.ts.map +0 -1
- package/dist/src/core/credentials-manager.js.map +0 -1
- package/dist/src/core/increment-status.d.ts.map +0 -1
- package/dist/src/core/increment-status.js.map +0 -1
- package/dist/src/core/increment-utils.d.ts.map +0 -1
- package/dist/src/core/increment-utils.js.map +0 -1
- package/dist/src/core/plugin-loader.d.ts.map +0 -1
- package/dist/src/core/plugin-loader.js.map +0 -1
- package/dist/src/core/project-manager.d.ts.map +0 -1
- package/dist/src/core/project-manager.js.map +0 -1
- package/dist/src/core/project-structure-detector.d.ts.map +0 -1
- package/dist/src/core/project-structure-detector.js.map +0 -1
- package/dist/src/core/rfc-generator-v2.d.ts.map +0 -1
- package/dist/src/core/rfc-generator-v2.js.map +0 -1
- package/dist/src/core/spec-content-sync.d.ts.map +0 -1
- package/dist/src/core/spec-content-sync.js.map +0 -1
- package/dist/src/core/spec-detector.d.ts.map +0 -1
- package/dist/src/core/spec-detector.js.map +0 -1
- package/dist/src/core/spec-identifier-detector.d.ts.map +0 -1
- package/dist/src/core/spec-identifier-detector.js.map +0 -1
- package/dist/src/core/spec-task-mapper.d.ts.map +0 -1
- package/dist/src/core/spec-task-mapper.js.map +0 -1
- package/dist/src/utils/spec-parser.d.ts +0 -145
- package/dist/src/utils/spec-parser.d.ts.map +0 -1
- package/dist/src/utils/spec-parser.js +0 -640
- package/dist/src/utils/spec-parser.js.map +0 -1
- package/plugins/specweave/agents/pm/AGENT.md.bak2 +0 -1754
- package/plugins/specweave/hooks/hooks.json.bak +0 -72
- package/plugins/specweave/hooks/hooks.json.v1-backup +0 -16
- package/plugins/specweave/hooks/v2/hooks.json +0 -16
- /package/dist/src/core/{credentials-manager.d.ts → credentials/credentials-manager.d.ts} +0 -0
- /package/dist/src/core/{credentials-manager.js → credentials/credentials-manager.js} +0 -0
- /package/dist/src/core/{increment-status.d.ts → increment/increment-status.d.ts} +0 -0
- /package/dist/src/core/{increment-utils.d.ts → increment/increment-utils.d.ts} +0 -0
- /package/dist/src/core/{increment-utils.js → increment/increment-utils.js} +0 -0
- /package/dist/src/core/{project-structure-detector.d.ts → project/project-structure-detector.d.ts} +0 -0
- /package/dist/src/core/{project-structure-detector.js → project/project-structure-detector.js} +0 -0
- /package/dist/src/core/{spec-task-mapper.d.ts → specs/spec-task-mapper.d.ts} +0 -0
- /package/dist/src/core/{spec-task-mapper.js → specs/spec-task-mapper.js} +0 -0
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Living Docs Builder - Discovery Phase
|
|
3
|
+
*
|
|
4
|
+
* Scans the codebase structure without LLM calls to:
|
|
5
|
+
* - Count files by type and extension
|
|
6
|
+
* - Detect tech stack from config files
|
|
7
|
+
* - Find existing documentation
|
|
8
|
+
* - Identify entry points
|
|
9
|
+
* - Group files into modules
|
|
10
|
+
* - Calculate sampling tier
|
|
11
|
+
*/
|
|
12
|
+
import * as fs from '../../utils/fs-native.js';
|
|
13
|
+
import * as path from 'path';
|
|
14
|
+
/**
|
|
15
|
+
* Skip patterns for directories that should not be scanned
|
|
16
|
+
*/
|
|
17
|
+
const SKIP_DIRS = new Set([
|
|
18
|
+
'node_modules',
|
|
19
|
+
'.git',
|
|
20
|
+
'.specweave',
|
|
21
|
+
'dist',
|
|
22
|
+
'build',
|
|
23
|
+
'out',
|
|
24
|
+
'coverage',
|
|
25
|
+
'.next',
|
|
26
|
+
'.nuxt',
|
|
27
|
+
'__pycache__',
|
|
28
|
+
'.pytest_cache',
|
|
29
|
+
'.venv',
|
|
30
|
+
'venv',
|
|
31
|
+
'env',
|
|
32
|
+
'.env',
|
|
33
|
+
'vendor',
|
|
34
|
+
'target', // Rust
|
|
35
|
+
'bin',
|
|
36
|
+
'obj', // .NET
|
|
37
|
+
]);
|
|
38
|
+
/**
|
|
39
|
+
* Extension to file type mapping
|
|
40
|
+
*/
|
|
41
|
+
const EXTENSION_TYPES = {
|
|
42
|
+
// Code
|
|
43
|
+
'.ts': 'code',
|
|
44
|
+
'.tsx': 'code',
|
|
45
|
+
'.js': 'code',
|
|
46
|
+
'.jsx': 'code',
|
|
47
|
+
'.mjs': 'code',
|
|
48
|
+
'.cjs': 'code',
|
|
49
|
+
'.py': 'code',
|
|
50
|
+
'.go': 'code',
|
|
51
|
+
'.rs': 'code',
|
|
52
|
+
'.java': 'code',
|
|
53
|
+
'.kt': 'code',
|
|
54
|
+
'.cs': 'code',
|
|
55
|
+
'.cpp': 'code',
|
|
56
|
+
'.c': 'code',
|
|
57
|
+
'.h': 'code',
|
|
58
|
+
'.hpp': 'code',
|
|
59
|
+
'.rb': 'code',
|
|
60
|
+
'.php': 'code',
|
|
61
|
+
'.swift': 'code',
|
|
62
|
+
'.scala': 'code',
|
|
63
|
+
'.vue': 'code',
|
|
64
|
+
'.svelte': 'code',
|
|
65
|
+
// Docs
|
|
66
|
+
'.md': 'docs',
|
|
67
|
+
'.mdx': 'docs',
|
|
68
|
+
'.rst': 'docs',
|
|
69
|
+
'.txt': 'docs',
|
|
70
|
+
'.adoc': 'docs',
|
|
71
|
+
// Config
|
|
72
|
+
'.json': 'config',
|
|
73
|
+
'.yaml': 'config',
|
|
74
|
+
'.yml': 'config',
|
|
75
|
+
'.toml': 'config',
|
|
76
|
+
'.xml': 'config',
|
|
77
|
+
'.ini': 'config',
|
|
78
|
+
'.env': 'config',
|
|
79
|
+
// Assets
|
|
80
|
+
'.png': 'assets',
|
|
81
|
+
'.jpg': 'assets',
|
|
82
|
+
'.jpeg': 'assets',
|
|
83
|
+
'.gif': 'assets',
|
|
84
|
+
'.svg': 'assets',
|
|
85
|
+
'.ico': 'assets',
|
|
86
|
+
'.woff': 'assets',
|
|
87
|
+
'.woff2': 'assets',
|
|
88
|
+
'.ttf': 'assets',
|
|
89
|
+
'.eot': 'assets',
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Test file patterns
|
|
93
|
+
*/
|
|
94
|
+
const TEST_PATTERNS = [
|
|
95
|
+
/\.test\./,
|
|
96
|
+
/\.spec\./,
|
|
97
|
+
/_test\./,
|
|
98
|
+
/_spec\./,
|
|
99
|
+
/test_/,
|
|
100
|
+
/spec_/,
|
|
101
|
+
/__tests__/,
|
|
102
|
+
/tests\//,
|
|
103
|
+
];
|
|
104
|
+
/**
|
|
105
|
+
* Run the discovery phase
|
|
106
|
+
*/
|
|
107
|
+
export async function runDiscovery(projectPath, additionalSources, onProgress) {
|
|
108
|
+
const result = {
|
|
109
|
+
codebaseStats: {
|
|
110
|
+
totalFiles: 0,
|
|
111
|
+
totalDirs: 0,
|
|
112
|
+
byExtension: {},
|
|
113
|
+
byType: { code: 0, tests: 0, docs: 0, config: 0, assets: 0 },
|
|
114
|
+
estimatedLOC: 0,
|
|
115
|
+
},
|
|
116
|
+
techStack: {
|
|
117
|
+
languages: [],
|
|
118
|
+
frameworks: [],
|
|
119
|
+
buildTools: [],
|
|
120
|
+
testFrameworks: [],
|
|
121
|
+
detectedFrom: [],
|
|
122
|
+
},
|
|
123
|
+
existingDocs: {
|
|
124
|
+
readme: null,
|
|
125
|
+
contributing: null,
|
|
126
|
+
docsFolder: null,
|
|
127
|
+
wikiFolder: null,
|
|
128
|
+
mdFiles: [],
|
|
129
|
+
},
|
|
130
|
+
entryPoints: {
|
|
131
|
+
main: [],
|
|
132
|
+
index: [],
|
|
133
|
+
exports: [],
|
|
134
|
+
},
|
|
135
|
+
modules: [],
|
|
136
|
+
tier: 'small',
|
|
137
|
+
samplingConfig: calculateTier(0),
|
|
138
|
+
discoveredAt: new Date().toISOString(),
|
|
139
|
+
};
|
|
140
|
+
// First pass: count directories for progress
|
|
141
|
+
const dirs = await countDirectories(projectPath);
|
|
142
|
+
let processedDirs = 0;
|
|
143
|
+
// Scan project structure
|
|
144
|
+
await scanDirectory(projectPath, projectPath, result, (dir) => {
|
|
145
|
+
processedDirs++;
|
|
146
|
+
onProgress?.(processedDirs, dirs, dir);
|
|
147
|
+
});
|
|
148
|
+
// Scan additional sources
|
|
149
|
+
for (const source of additionalSources) {
|
|
150
|
+
const fullPath = path.isAbsolute(source) ? source : path.join(projectPath, source);
|
|
151
|
+
if (fs.existsSync(fullPath) && fs.statSync(fullPath).isDirectory()) {
|
|
152
|
+
await scanDirectory(fullPath, projectPath, result, (dir) => {
|
|
153
|
+
onProgress?.(processedDirs, dirs, `[additional] ${dir}`);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Detect tech stack from config files
|
|
158
|
+
detectTechStack(projectPath, result);
|
|
159
|
+
// Find existing documentation
|
|
160
|
+
findExistingDocs(projectPath, result);
|
|
161
|
+
// Identify entry points
|
|
162
|
+
findEntryPoints(projectPath, result);
|
|
163
|
+
// Build modules from directory structure
|
|
164
|
+
buildModules(projectPath, result);
|
|
165
|
+
// Calculate sampling tier
|
|
166
|
+
result.tier = calculateTier(result.codebaseStats.totalFiles).tier;
|
|
167
|
+
result.samplingConfig = calculateTier(result.codebaseStats.totalFiles);
|
|
168
|
+
return result;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Count directories for progress estimation
|
|
172
|
+
*/
|
|
173
|
+
async function countDirectories(dirPath, count = 0) {
|
|
174
|
+
try {
|
|
175
|
+
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
176
|
+
let total = 1;
|
|
177
|
+
for (const entry of entries) {
|
|
178
|
+
if (entry.isDirectory() && !SKIP_DIRS.has(entry.name) && !entry.name.startsWith('.')) {
|
|
179
|
+
total += await countDirectories(path.join(dirPath, entry.name), total);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return total;
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return count;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Recursively scan a directory
|
|
190
|
+
*/
|
|
191
|
+
async function scanDirectory(dirPath, projectRoot, result, onDir, depth = 0) {
|
|
192
|
+
if (depth > 15)
|
|
193
|
+
return; // Prevent infinite recursion
|
|
194
|
+
try {
|
|
195
|
+
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
196
|
+
result.codebaseStats.totalDirs++;
|
|
197
|
+
onDir(path.relative(projectRoot, dirPath) || '.');
|
|
198
|
+
for (const entry of entries) {
|
|
199
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
200
|
+
const relativePath = path.relative(projectRoot, fullPath);
|
|
201
|
+
if (entry.isDirectory()) {
|
|
202
|
+
if (!SKIP_DIRS.has(entry.name) && !entry.name.startsWith('.')) {
|
|
203
|
+
await scanDirectory(fullPath, projectRoot, result, onDir, depth + 1);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else if (entry.isFile()) {
|
|
207
|
+
result.codebaseStats.totalFiles++;
|
|
208
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
209
|
+
result.codebaseStats.byExtension[ext] = (result.codebaseStats.byExtension[ext] || 0) + 1;
|
|
210
|
+
// Categorize by type
|
|
211
|
+
const fileType = EXTENSION_TYPES[ext] || 'assets';
|
|
212
|
+
const isTest = TEST_PATTERNS.some(p => p.test(relativePath));
|
|
213
|
+
if (isTest) {
|
|
214
|
+
result.codebaseStats.byType.tests++;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
result.codebaseStats.byType[fileType]++;
|
|
218
|
+
}
|
|
219
|
+
// Estimate LOC for code files
|
|
220
|
+
if (fileType === 'code' && !isTest) {
|
|
221
|
+
try {
|
|
222
|
+
const stat = fs.statSync(fullPath);
|
|
223
|
+
// Rough estimate: average 40 bytes per line of code
|
|
224
|
+
result.codebaseStats.estimatedLOC += Math.round(stat.size / 40);
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
// Ignore stat errors
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
// Ignore permission errors
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Detect tech stack from config files
|
|
239
|
+
*/
|
|
240
|
+
function detectTechStack(projectPath, result) {
|
|
241
|
+
// Check package.json (Node.js/JavaScript/TypeScript)
|
|
242
|
+
const packageJsonPath = path.join(projectPath, 'package.json');
|
|
243
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
244
|
+
try {
|
|
245
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
246
|
+
result.techStack.detectedFrom.push('package.json');
|
|
247
|
+
const allDeps = {
|
|
248
|
+
...(pkg.dependencies || {}),
|
|
249
|
+
...(pkg.devDependencies || {}),
|
|
250
|
+
};
|
|
251
|
+
// Languages
|
|
252
|
+
if (allDeps.typescript || fs.existsSync(path.join(projectPath, 'tsconfig.json'))) {
|
|
253
|
+
result.techStack.languages.push('TypeScript');
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
result.techStack.languages.push('JavaScript');
|
|
257
|
+
}
|
|
258
|
+
// Frameworks
|
|
259
|
+
if (allDeps.next)
|
|
260
|
+
result.techStack.frameworks.push('Next.js');
|
|
261
|
+
if (allDeps.react)
|
|
262
|
+
result.techStack.frameworks.push('React');
|
|
263
|
+
if (allDeps.vue)
|
|
264
|
+
result.techStack.frameworks.push('Vue');
|
|
265
|
+
if (allDeps.angular || allDeps['@angular/core'])
|
|
266
|
+
result.techStack.frameworks.push('Angular');
|
|
267
|
+
if (allDeps.svelte)
|
|
268
|
+
result.techStack.frameworks.push('Svelte');
|
|
269
|
+
if (allDeps.express)
|
|
270
|
+
result.techStack.frameworks.push('Express');
|
|
271
|
+
if (allDeps.fastify)
|
|
272
|
+
result.techStack.frameworks.push('Fastify');
|
|
273
|
+
if (allDeps.nestjs || allDeps['@nestjs/core'])
|
|
274
|
+
result.techStack.frameworks.push('NestJS');
|
|
275
|
+
// Build tools
|
|
276
|
+
if (allDeps.webpack)
|
|
277
|
+
result.techStack.buildTools.push('Webpack');
|
|
278
|
+
if (allDeps.vite)
|
|
279
|
+
result.techStack.buildTools.push('Vite');
|
|
280
|
+
if (allDeps.esbuild)
|
|
281
|
+
result.techStack.buildTools.push('esbuild');
|
|
282
|
+
if (allDeps.rollup)
|
|
283
|
+
result.techStack.buildTools.push('Rollup');
|
|
284
|
+
if (allDeps.parcel)
|
|
285
|
+
result.techStack.buildTools.push('Parcel');
|
|
286
|
+
// Test frameworks
|
|
287
|
+
if (allDeps.jest)
|
|
288
|
+
result.techStack.testFrameworks.push('Jest');
|
|
289
|
+
if (allDeps.vitest)
|
|
290
|
+
result.techStack.testFrameworks.push('Vitest');
|
|
291
|
+
if (allDeps.mocha)
|
|
292
|
+
result.techStack.testFrameworks.push('Mocha');
|
|
293
|
+
if (allDeps.playwright || allDeps['@playwright/test'])
|
|
294
|
+
result.techStack.testFrameworks.push('Playwright');
|
|
295
|
+
if (allDeps.cypress)
|
|
296
|
+
result.techStack.testFrameworks.push('Cypress');
|
|
297
|
+
}
|
|
298
|
+
catch {
|
|
299
|
+
// Ignore parse errors
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
// Check requirements.txt / pyproject.toml (Python)
|
|
303
|
+
const requirementsPath = path.join(projectPath, 'requirements.txt');
|
|
304
|
+
const pyprojectPath = path.join(projectPath, 'pyproject.toml');
|
|
305
|
+
if (fs.existsSync(requirementsPath) || fs.existsSync(pyprojectPath)) {
|
|
306
|
+
result.techStack.languages.push('Python');
|
|
307
|
+
result.techStack.detectedFrom.push(fs.existsSync(pyprojectPath) ? 'pyproject.toml' : 'requirements.txt');
|
|
308
|
+
// Try to detect frameworks
|
|
309
|
+
try {
|
|
310
|
+
const content = fs.existsSync(pyprojectPath)
|
|
311
|
+
? fs.readFileSync(pyprojectPath, 'utf-8')
|
|
312
|
+
: fs.readFileSync(requirementsPath, 'utf-8');
|
|
313
|
+
if (content.includes('django'))
|
|
314
|
+
result.techStack.frameworks.push('Django');
|
|
315
|
+
if (content.includes('fastapi'))
|
|
316
|
+
result.techStack.frameworks.push('FastAPI');
|
|
317
|
+
if (content.includes('flask'))
|
|
318
|
+
result.techStack.frameworks.push('Flask');
|
|
319
|
+
if (content.includes('pytest'))
|
|
320
|
+
result.techStack.testFrameworks.push('pytest');
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
// Ignore read errors
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
// Check go.mod (Go)
|
|
327
|
+
const goModPath = path.join(projectPath, 'go.mod');
|
|
328
|
+
if (fs.existsSync(goModPath)) {
|
|
329
|
+
result.techStack.languages.push('Go');
|
|
330
|
+
result.techStack.detectedFrom.push('go.mod');
|
|
331
|
+
try {
|
|
332
|
+
const content = fs.readFileSync(goModPath, 'utf-8');
|
|
333
|
+
if (content.includes('gin-gonic'))
|
|
334
|
+
result.techStack.frameworks.push('Gin');
|
|
335
|
+
if (content.includes('echo'))
|
|
336
|
+
result.techStack.frameworks.push('Echo');
|
|
337
|
+
if (content.includes('fiber'))
|
|
338
|
+
result.techStack.frameworks.push('Fiber');
|
|
339
|
+
}
|
|
340
|
+
catch {
|
|
341
|
+
// Ignore read errors
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
// Check Cargo.toml (Rust)
|
|
345
|
+
const cargoPath = path.join(projectPath, 'Cargo.toml');
|
|
346
|
+
if (fs.existsSync(cargoPath)) {
|
|
347
|
+
result.techStack.languages.push('Rust');
|
|
348
|
+
result.techStack.detectedFrom.push('Cargo.toml');
|
|
349
|
+
try {
|
|
350
|
+
const content = fs.readFileSync(cargoPath, 'utf-8');
|
|
351
|
+
if (content.includes('actix'))
|
|
352
|
+
result.techStack.frameworks.push('Actix');
|
|
353
|
+
if (content.includes('axum'))
|
|
354
|
+
result.techStack.frameworks.push('Axum');
|
|
355
|
+
if (content.includes('rocket'))
|
|
356
|
+
result.techStack.frameworks.push('Rocket');
|
|
357
|
+
}
|
|
358
|
+
catch {
|
|
359
|
+
// Ignore read errors
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
// Check pom.xml / build.gradle (Java)
|
|
363
|
+
const pomPath = path.join(projectPath, 'pom.xml');
|
|
364
|
+
const gradlePath = path.join(projectPath, 'build.gradle');
|
|
365
|
+
if (fs.existsSync(pomPath) || fs.existsSync(gradlePath)) {
|
|
366
|
+
result.techStack.languages.push('Java');
|
|
367
|
+
result.techStack.detectedFrom.push(fs.existsSync(pomPath) ? 'pom.xml' : 'build.gradle');
|
|
368
|
+
if (fs.existsSync(gradlePath)) {
|
|
369
|
+
result.techStack.buildTools.push('Gradle');
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
result.techStack.buildTools.push('Maven');
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
// Deduplicate
|
|
376
|
+
result.techStack.languages = [...new Set(result.techStack.languages)];
|
|
377
|
+
result.techStack.frameworks = [...new Set(result.techStack.frameworks)];
|
|
378
|
+
result.techStack.buildTools = [...new Set(result.techStack.buildTools)];
|
|
379
|
+
result.techStack.testFrameworks = [...new Set(result.techStack.testFrameworks)];
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Find existing documentation
|
|
383
|
+
*/
|
|
384
|
+
function findExistingDocs(projectPath, result) {
|
|
385
|
+
// Look for README
|
|
386
|
+
const readmeVariants = ['README.md', 'README.MD', 'readme.md', 'Readme.md', 'README'];
|
|
387
|
+
for (const variant of readmeVariants) {
|
|
388
|
+
const readmePath = path.join(projectPath, variant);
|
|
389
|
+
if (fs.existsSync(readmePath)) {
|
|
390
|
+
result.existingDocs.readme = variant;
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
// Look for CONTRIBUTING
|
|
395
|
+
const contributingVariants = ['CONTRIBUTING.md', 'CONTRIBUTING.MD', 'contributing.md'];
|
|
396
|
+
for (const variant of contributingVariants) {
|
|
397
|
+
const contribPath = path.join(projectPath, variant);
|
|
398
|
+
if (fs.existsSync(contribPath)) {
|
|
399
|
+
result.existingDocs.contributing = variant;
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
// Look for docs folder
|
|
404
|
+
const docsFolders = ['docs', 'doc', 'documentation', 'Docs', 'Documentation'];
|
|
405
|
+
for (const folder of docsFolders) {
|
|
406
|
+
const docsPath = path.join(projectPath, folder);
|
|
407
|
+
if (fs.existsSync(docsPath) && fs.statSync(docsPath).isDirectory()) {
|
|
408
|
+
result.existingDocs.docsFolder = folder;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
// Look for wiki folder
|
|
413
|
+
const wikiPath = path.join(projectPath, 'wiki');
|
|
414
|
+
if (fs.existsSync(wikiPath) && fs.statSync(wikiPath).isDirectory()) {
|
|
415
|
+
result.existingDocs.wikiFolder = 'wiki';
|
|
416
|
+
}
|
|
417
|
+
// Find all markdown files (top level and in docs)
|
|
418
|
+
const mdFiles = [];
|
|
419
|
+
try {
|
|
420
|
+
const entries = fs.readdirSync(projectPath);
|
|
421
|
+
for (const entry of entries) {
|
|
422
|
+
if (entry.endsWith('.md') || entry.endsWith('.mdx')) {
|
|
423
|
+
mdFiles.push(entry);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
catch {
|
|
428
|
+
// Ignore errors
|
|
429
|
+
}
|
|
430
|
+
result.existingDocs.mdFiles = mdFiles;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Find entry points
|
|
434
|
+
*/
|
|
435
|
+
function findEntryPoints(projectPath, result) {
|
|
436
|
+
const mainPatterns = ['main.ts', 'main.js', 'app.ts', 'app.js', 'server.ts', 'server.js', 'cli.ts', 'cli.js'];
|
|
437
|
+
const indexPatterns = ['index.ts', 'index.js', 'mod.ts', 'mod.js'];
|
|
438
|
+
const srcFolders = ['src', 'lib', 'app'];
|
|
439
|
+
// Check root level
|
|
440
|
+
for (const pattern of mainPatterns) {
|
|
441
|
+
const filePath = path.join(projectPath, pattern);
|
|
442
|
+
if (fs.existsSync(filePath)) {
|
|
443
|
+
result.entryPoints.main.push(pattern);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
for (const pattern of indexPatterns) {
|
|
447
|
+
const filePath = path.join(projectPath, pattern);
|
|
448
|
+
if (fs.existsSync(filePath)) {
|
|
449
|
+
result.entryPoints.index.push(pattern);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
// Check src folders
|
|
453
|
+
for (const folder of srcFolders) {
|
|
454
|
+
const folderPath = path.join(projectPath, folder);
|
|
455
|
+
if (fs.existsSync(folderPath) && fs.statSync(folderPath).isDirectory()) {
|
|
456
|
+
for (const pattern of mainPatterns) {
|
|
457
|
+
const filePath = path.join(folderPath, pattern);
|
|
458
|
+
if (fs.existsSync(filePath)) {
|
|
459
|
+
result.entryPoints.main.push(path.join(folder, pattern));
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
for (const pattern of indexPatterns) {
|
|
463
|
+
const filePath = path.join(folderPath, pattern);
|
|
464
|
+
if (fs.existsSync(filePath)) {
|
|
465
|
+
result.entryPoints.index.push(path.join(folder, pattern));
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
// Check package.json for main/exports
|
|
471
|
+
const packageJsonPath = path.join(projectPath, 'package.json');
|
|
472
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
473
|
+
try {
|
|
474
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
475
|
+
if (pkg.main)
|
|
476
|
+
result.entryPoints.exports.push(pkg.main);
|
|
477
|
+
if (pkg.module)
|
|
478
|
+
result.entryPoints.exports.push(pkg.module);
|
|
479
|
+
if (pkg.bin) {
|
|
480
|
+
if (typeof pkg.bin === 'string') {
|
|
481
|
+
result.entryPoints.exports.push(pkg.bin);
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
result.entryPoints.exports.push(...Object.values(pkg.bin));
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
catch {
|
|
489
|
+
// Ignore parse errors
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Build modules from directory structure
|
|
495
|
+
*/
|
|
496
|
+
function buildModules(projectPath, result) {
|
|
497
|
+
const srcFolders = ['src', 'lib', 'app', 'packages'];
|
|
498
|
+
for (const srcFolder of srcFolders) {
|
|
499
|
+
const srcPath = path.join(projectPath, srcFolder);
|
|
500
|
+
if (fs.existsSync(srcPath) && fs.statSync(srcPath).isDirectory()) {
|
|
501
|
+
try {
|
|
502
|
+
const entries = fs.readdirSync(srcPath, { withFileTypes: true });
|
|
503
|
+
for (const entry of entries) {
|
|
504
|
+
if (entry.isDirectory() && !SKIP_DIRS.has(entry.name) && !entry.name.startsWith('.')) {
|
|
505
|
+
const modulePath = path.join(srcFolder, entry.name);
|
|
506
|
+
const fullModulePath = path.join(projectPath, modulePath);
|
|
507
|
+
const moduleInfo = analyzeModule(fullModulePath, modulePath);
|
|
508
|
+
result.modules.push(moduleInfo);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
catch {
|
|
513
|
+
// Ignore errors
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
// Sort modules by file count (largest first)
|
|
518
|
+
result.modules.sort((a, b) => b.fileCount - a.fileCount);
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Analyze a module directory
|
|
522
|
+
*/
|
|
523
|
+
function analyzeModule(modulePath, relativePath) {
|
|
524
|
+
const info = {
|
|
525
|
+
name: path.basename(modulePath),
|
|
526
|
+
path: relativePath,
|
|
527
|
+
fileCount: 0,
|
|
528
|
+
estimatedLOC: 0,
|
|
529
|
+
hasTests: false,
|
|
530
|
+
hasReadme: false,
|
|
531
|
+
entryPoints: [],
|
|
532
|
+
extensions: {},
|
|
533
|
+
};
|
|
534
|
+
try {
|
|
535
|
+
const walk = (dir, depth = 0) => {
|
|
536
|
+
if (depth > 10)
|
|
537
|
+
return;
|
|
538
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
539
|
+
for (const entry of entries) {
|
|
540
|
+
const fullPath = path.join(dir, entry.name);
|
|
541
|
+
if (entry.isDirectory() && !SKIP_DIRS.has(entry.name)) {
|
|
542
|
+
walk(fullPath, depth + 1);
|
|
543
|
+
}
|
|
544
|
+
else if (entry.isFile()) {
|
|
545
|
+
info.fileCount++;
|
|
546
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
547
|
+
info.extensions[ext] = (info.extensions[ext] || 0) + 1;
|
|
548
|
+
// Check for tests
|
|
549
|
+
if (TEST_PATTERNS.some(p => p.test(entry.name))) {
|
|
550
|
+
info.hasTests = true;
|
|
551
|
+
}
|
|
552
|
+
// Check for README
|
|
553
|
+
if (entry.name.toLowerCase().includes('readme')) {
|
|
554
|
+
info.hasReadme = true;
|
|
555
|
+
}
|
|
556
|
+
// Check for entry points
|
|
557
|
+
if (entry.name === 'index.ts' || entry.name === 'index.js') {
|
|
558
|
+
info.entryPoints.push(path.relative(modulePath, fullPath));
|
|
559
|
+
}
|
|
560
|
+
// Estimate LOC
|
|
561
|
+
if (EXTENSION_TYPES[ext] === 'code') {
|
|
562
|
+
try {
|
|
563
|
+
const stat = fs.statSync(fullPath);
|
|
564
|
+
info.estimatedLOC += Math.round(stat.size / 40);
|
|
565
|
+
}
|
|
566
|
+
catch {
|
|
567
|
+
// Ignore stat errors
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
walk(modulePath);
|
|
574
|
+
}
|
|
575
|
+
catch {
|
|
576
|
+
// Ignore errors
|
|
577
|
+
}
|
|
578
|
+
return info;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Calculate sampling tier based on file count
|
|
582
|
+
*/
|
|
583
|
+
export function calculateTier(totalFiles) {
|
|
584
|
+
if (totalFiles < 500) {
|
|
585
|
+
return {
|
|
586
|
+
tier: 'small',
|
|
587
|
+
filesPerDir: 'all',
|
|
588
|
+
priorityPatterns: ['**/index.*', '**/main.*', '**/*.config.*', '**/types.*'],
|
|
589
|
+
skipPatterns: ['node_modules/**', 'dist/**', '**/*.test.*', '**/*.spec.*'],
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
else if (totalFiles < 2000) {
|
|
593
|
+
return {
|
|
594
|
+
tier: 'medium',
|
|
595
|
+
filesPerDir: 5,
|
|
596
|
+
priorityPatterns: ['**/index.*', '**/main.*', '**/*.config.*', '**/types.*', '**/README.md'],
|
|
597
|
+
skipPatterns: ['node_modules/**', 'dist/**', 'build/**', '**/*.test.*', '**/*.spec.*'],
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
else if (totalFiles < 10000) {
|
|
601
|
+
return {
|
|
602
|
+
tier: 'large',
|
|
603
|
+
filesPerDir: 3,
|
|
604
|
+
priorityPatterns: ['**/index.*', '**/main.*', '**/*.config.*', '**/types.*', '**/README.md'],
|
|
605
|
+
skipPatterns: ['node_modules/**', 'dist/**', 'build/**', 'coverage/**', '**/*.test.*', '**/*.spec.*', '**/__tests__/**'],
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
return {
|
|
610
|
+
tier: 'massive',
|
|
611
|
+
filesPerDir: 1,
|
|
612
|
+
priorityPatterns: ['**/index.*', '**/main.*', '**/app.*', '**/*.config.*'],
|
|
613
|
+
skipPatterns: ['node_modules/**', 'dist/**', 'build/**', 'coverage/**', '**/*.test.*', '**/*.spec.*', '**/__tests__/**', '**/*.min.*', '**/*.bundle.*'],
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Select representative files from a directory for analysis
|
|
619
|
+
*/
|
|
620
|
+
export function selectRepresentativeFiles(files, maxFiles, moduleName) {
|
|
621
|
+
if (maxFiles === 'all') {
|
|
622
|
+
return files;
|
|
623
|
+
}
|
|
624
|
+
if (files.length <= maxFiles) {
|
|
625
|
+
return files;
|
|
626
|
+
}
|
|
627
|
+
// Priority selection heuristics
|
|
628
|
+
const priority = [];
|
|
629
|
+
const regular = [];
|
|
630
|
+
for (const file of files) {
|
|
631
|
+
const basename = path.basename(file).toLowerCase();
|
|
632
|
+
const ext = path.extname(file);
|
|
633
|
+
// High priority files
|
|
634
|
+
if (basename.startsWith('index') ||
|
|
635
|
+
basename.startsWith('main') ||
|
|
636
|
+
basename.startsWith('app') ||
|
|
637
|
+
(moduleName && basename.startsWith(moduleName.toLowerCase())) ||
|
|
638
|
+
basename.includes('types') ||
|
|
639
|
+
basename.includes('config') ||
|
|
640
|
+
ext === '.d.ts') {
|
|
641
|
+
priority.push(file);
|
|
642
|
+
}
|
|
643
|
+
else {
|
|
644
|
+
regular.push(file);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
// Take priority files first, then fill with regular
|
|
648
|
+
const selected = [...priority.slice(0, maxFiles)];
|
|
649
|
+
const remaining = maxFiles - selected.length;
|
|
650
|
+
if (remaining > 0) {
|
|
651
|
+
// Sort regular files by size (larger = more content)
|
|
652
|
+
selected.push(...regular.slice(0, remaining));
|
|
653
|
+
}
|
|
654
|
+
return selected;
|
|
655
|
+
}
|
|
656
|
+
//# sourceMappingURL=discovery.js.map
|