prjct-cli 0.11.5 → 0.12.1
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/CHANGELOG.md +58 -0
- package/README.md +81 -25
- package/bin/dev.js +1 -1
- package/bin/generate-views.js +209 -0
- package/bin/migrate-to-json.js +742 -0
- package/bin/prjct +5 -5
- package/bin/serve.js +226 -50
- package/core/__tests__/agentic/{memory-system.test.js → memory-system.test.ts} +12 -23
- package/core/__tests__/agentic/{plan-mode.test.js → plan-mode.test.ts} +26 -24
- package/core/__tests__/agentic/{prompt-builder.test.js → prompt-builder.test.ts} +3 -8
- package/core/__tests__/utils/{date-helper.test.js → date-helper.test.ts} +19 -30
- package/core/__tests__/utils/{output.test.js → output.test.ts} +12 -24
- package/core/agentic/agent-router.ts +137 -0
- package/core/agentic/chain-of-thought.ts +228 -0
- package/core/agentic/command-executor/command-executor.ts +384 -0
- package/core/agentic/command-executor/index.ts +16 -0
- package/core/agentic/command-executor/status-signal.ts +38 -0
- package/core/agentic/command-executor/types.ts +79 -0
- package/core/agentic/command-executor.ts +8 -0
- package/core/agentic/{context-builder.js → context-builder.ts} +92 -81
- package/core/agentic/context-filter.ts +365 -0
- package/core/agentic/ground-truth/index.ts +76 -0
- package/core/agentic/ground-truth/types.ts +33 -0
- package/core/agentic/ground-truth/utils.ts +48 -0
- package/core/agentic/ground-truth/verifiers/analyze.ts +54 -0
- package/core/agentic/ground-truth/verifiers/done.ts +75 -0
- package/core/agentic/ground-truth/verifiers/feature.ts +70 -0
- package/core/agentic/ground-truth/verifiers/index.ts +37 -0
- package/core/agentic/ground-truth/verifiers/init.ts +52 -0
- package/core/agentic/ground-truth/verifiers/now.ts +57 -0
- package/core/agentic/ground-truth/verifiers/ship.ts +85 -0
- package/core/agentic/ground-truth/verifiers/spec.ts +45 -0
- package/core/agentic/ground-truth/verifiers/sync.ts +47 -0
- package/core/agentic/ground-truth/verifiers.ts +6 -0
- package/core/agentic/ground-truth.ts +8 -0
- package/core/agentic/loop-detector/error-analysis.ts +97 -0
- package/core/agentic/loop-detector/hallucination.ts +71 -0
- package/core/agentic/loop-detector/index.ts +41 -0
- package/core/agentic/loop-detector/loop-detector.ts +222 -0
- package/core/agentic/loop-detector/types.ts +66 -0
- package/core/agentic/loop-detector.ts +8 -0
- package/core/agentic/memory-system/history.ts +53 -0
- package/core/agentic/memory-system/index.ts +192 -0
- package/core/agentic/memory-system/patterns.ts +156 -0
- package/core/agentic/memory-system/semantic-memories.ts +277 -0
- package/core/agentic/memory-system/session.ts +21 -0
- package/core/agentic/memory-system/types.ts +159 -0
- package/core/agentic/memory-system.ts +8 -0
- package/core/agentic/parallel-tools.ts +165 -0
- package/core/agentic/plan-mode/approval.ts +57 -0
- package/core/agentic/plan-mode/constants.ts +44 -0
- package/core/agentic/plan-mode/index.ts +28 -0
- package/core/agentic/plan-mode/plan-mode.ts +406 -0
- package/core/agentic/plan-mode/types.ts +193 -0
- package/core/agentic/plan-mode.ts +8 -0
- package/core/agentic/prompt-builder.ts +566 -0
- package/core/agentic/response-templates.ts +164 -0
- package/core/agentic/semantic-compression.ts +273 -0
- package/core/agentic/services.ts +206 -0
- package/core/agentic/smart-context.ts +476 -0
- package/core/agentic/{template-loader.js → template-loader.ts} +27 -16
- package/core/agentic/think-blocks.ts +202 -0
- package/core/agentic/tool-registry.ts +119 -0
- package/core/agentic/validation-rules.ts +313 -0
- package/core/agents/index.ts +28 -0
- package/core/agents/performance.ts +444 -0
- package/core/agents/types.ts +126 -0
- package/core/bus/{index.js → index.ts} +57 -61
- package/core/command-registry/categories.ts +23 -0
- package/core/command-registry/commands.ts +15 -0
- package/core/command-registry/core-commands.ts +319 -0
- package/core/command-registry/index.ts +158 -0
- package/core/command-registry/optional-commands.ts +119 -0
- package/core/command-registry/setup-commands.ts +53 -0
- package/core/command-registry/types.ts +59 -0
- package/core/command-registry.ts +9 -0
- package/core/commands/analysis.ts +298 -0
- package/core/commands/analytics.ts +288 -0
- package/core/commands/base.ts +273 -0
- package/core/commands/index.ts +211 -0
- package/core/commands/maintenance.ts +226 -0
- package/core/commands/planning.ts +311 -0
- package/core/commands/setup.ts +309 -0
- package/core/commands/shipping.ts +188 -0
- package/core/commands/types.ts +183 -0
- package/core/commands/workflow.ts +226 -0
- package/core/commands.ts +11 -0
- package/core/constants/formats.ts +187 -0
- package/core/constants/index.ts +7 -0
- package/core/{context-sync.js → context-sync.ts} +59 -26
- package/core/data/agents-manager.ts +76 -0
- package/core/data/analysis-manager.ts +83 -0
- package/core/data/base-manager.ts +156 -0
- package/core/data/ideas-manager.ts +81 -0
- package/core/data/index.ts +32 -0
- package/core/data/outcomes-manager.ts +96 -0
- package/core/data/project-manager.ts +75 -0
- package/core/data/roadmap-manager.ts +118 -0
- package/core/data/shipped-manager.ts +65 -0
- package/core/data/state-manager.ts +214 -0
- package/core/domain/{agent-generator.js → agent-generator.ts} +77 -57
- package/core/domain/{agent-loader.js → agent-loader.ts} +65 -56
- package/core/domain/{agent-matcher.js → agent-matcher.ts} +51 -24
- package/core/domain/{agent-validator.js → agent-validator.ts} +70 -37
- package/core/domain/{analyzer.js → analyzer.ts} +91 -85
- package/core/domain/{architect-session.js → architect-session.ts} +49 -34
- package/core/domain/{architecture-generator.js → architecture-generator.ts} +25 -13
- package/core/domain/{context-estimator.js → context-estimator.ts} +57 -36
- package/core/domain/{product-standards.js → product-standards.ts} +40 -26
- package/core/domain/{smart-cache.js → smart-cache.ts} +39 -30
- package/core/domain/{snapshot-manager.js → snapshot-manager.ts} +103 -100
- package/core/domain/{task-analyzer.js → task-analyzer.ts} +82 -43
- package/core/domain/task-stack/index.ts +19 -0
- package/core/domain/task-stack/parser.ts +86 -0
- package/core/domain/task-stack/storage.ts +123 -0
- package/core/domain/task-stack/task-stack.ts +340 -0
- package/core/domain/task-stack/types.ts +51 -0
- package/core/domain/task-stack.ts +8 -0
- package/core/{index.js → index.ts} +61 -18
- package/core/infrastructure/{agent-detector.js → agent-detector.ts} +55 -19
- package/core/infrastructure/agents/{claude-agent.js → claude-agent.ts} +61 -21
- package/core/infrastructure/{author-detector.js → author-detector.ts} +42 -49
- package/core/infrastructure/{capability-installer.js → capability-installer.ts} +51 -27
- package/core/infrastructure/{command-installer.js → command-installer/command-installer.ts} +43 -144
- package/core/infrastructure/command-installer/global-config.ts +106 -0
- package/core/infrastructure/command-installer/index.ts +25 -0
- package/core/infrastructure/command-installer/types.ts +41 -0
- package/core/infrastructure/command-installer.ts +8 -0
- package/core/infrastructure/{config-manager.js → config-manager.ts} +60 -80
- package/core/infrastructure/{editors-config.js → editors-config.ts} +33 -31
- package/core/infrastructure/legacy-installer-detector/cleanup.ts +216 -0
- package/core/infrastructure/legacy-installer-detector/detection.ts +95 -0
- package/core/infrastructure/legacy-installer-detector/index.ts +171 -0
- package/core/infrastructure/legacy-installer-detector/migration.ts +87 -0
- package/core/infrastructure/legacy-installer-detector/types.ts +42 -0
- package/core/infrastructure/legacy-installer-detector.ts +7 -0
- package/core/infrastructure/migrator/file-operations.ts +125 -0
- package/core/infrastructure/migrator/index.ts +288 -0
- package/core/infrastructure/migrator/project-scanner.ts +89 -0
- package/core/infrastructure/migrator/reports.ts +117 -0
- package/core/infrastructure/migrator/types.ts +124 -0
- package/core/infrastructure/migrator/validation.ts +94 -0
- package/core/infrastructure/migrator/version-migration.ts +117 -0
- package/core/infrastructure/migrator.ts +10 -0
- package/core/infrastructure/{path-manager.js → path-manager.ts} +51 -91
- package/core/infrastructure/session-manager/index.ts +23 -0
- package/core/infrastructure/session-manager/migration.ts +88 -0
- package/core/infrastructure/session-manager/session-manager.ts +307 -0
- package/core/infrastructure/session-manager/types.ts +45 -0
- package/core/infrastructure/session-manager.ts +8 -0
- package/core/infrastructure/{setup.js → setup.ts} +29 -21
- package/core/infrastructure/{update-checker.js → update-checker.ts} +40 -18
- package/core/outcomes/analyzer.ts +333 -0
- package/core/outcomes/index.ts +34 -0
- package/core/outcomes/recorder.ts +194 -0
- package/core/outcomes/types.ts +145 -0
- package/core/plugin/{hooks.js → hooks.ts} +56 -58
- package/core/plugin/{index.js → index.ts} +19 -8
- package/core/plugin/{loader.js → loader.ts} +87 -69
- package/core/plugin/{registry.js → registry.ts} +49 -45
- package/core/plugins/{webhook.js → webhook.ts} +43 -27
- package/core/schemas/agents.ts +27 -0
- package/core/schemas/analysis.ts +41 -0
- package/core/schemas/ideas.ts +83 -0
- package/core/schemas/index.ts +73 -0
- package/core/schemas/outcomes.ts +22 -0
- package/core/schemas/project.ts +26 -0
- package/core/schemas/roadmap.ts +90 -0
- package/core/schemas/shipped.ts +82 -0
- package/core/schemas/state.ts +107 -0
- package/core/session/index.ts +17 -0
- package/core/session/{metrics.js → metrics.ts} +64 -46
- package/core/session/{index.js → session-manager.ts} +51 -117
- package/core/session/types.ts +29 -0
- package/core/session/utils.ts +57 -0
- package/core/state/index.ts +25 -0
- package/core/state/manager.ts +376 -0
- package/core/state/types.ts +185 -0
- package/core/tsconfig.json +22 -0
- package/core/types/index.ts +506 -0
- package/core/utils/{animations.js → animations.ts} +74 -28
- package/core/utils/{branding.js → branding.ts} +29 -4
- package/core/utils/{date-helper.js → date-helper.ts} +31 -74
- package/core/utils/file-helper.ts +262 -0
- package/core/utils/{jsonl-helper.js → jsonl-helper.ts} +71 -107
- package/core/utils/{logger.js → logger.ts} +24 -12
- package/core/utils/{output.js → output.ts} +25 -13
- package/core/utils/{project-capabilities.js → project-capabilities.ts} +31 -18
- package/core/utils/{session-helper.js → session-helper.ts} +79 -66
- package/core/utils/{version.js → version.ts} +23 -31
- package/core/view-generator.ts +536 -0
- package/package.json +23 -17
- package/packages/shared/.turbo/turbo-build.log +14 -0
- package/packages/shared/dist/index.d.ts +8 -613
- package/packages/shared/dist/index.d.ts.map +1 -0
- package/packages/shared/dist/index.js +4110 -118
- package/packages/shared/dist/schemas.d.ts +408 -0
- package/packages/shared/dist/schemas.d.ts.map +1 -0
- package/packages/shared/dist/types.d.ts +144 -0
- package/packages/shared/dist/types.d.ts.map +1 -0
- package/packages/shared/dist/unified.d.ts +139 -0
- package/packages/shared/dist/unified.d.ts.map +1 -0
- package/packages/shared/dist/utils.d.ts +60 -0
- package/packages/shared/dist/utils.d.ts.map +1 -0
- package/packages/shared/package.json +4 -4
- package/packages/shared/src/index.ts +1 -0
- package/packages/shared/src/unified.ts +174 -0
- package/packages/web/app/api/claude/sessions/route.ts +1 -1
- package/packages/web/app/api/claude/status/route.ts +1 -1
- package/packages/web/app/api/migrate/route.ts +46 -0
- package/packages/web/app/api/projects/[id]/route.ts +1 -1
- package/packages/web/app/api/projects/[id]/stats/route.ts +30 -2
- package/packages/web/app/api/projects/[id]/status/route.ts +1 -1
- package/packages/web/app/api/projects/route.ts +1 -1
- package/packages/web/app/api/settings/route.ts +97 -0
- package/packages/web/app/api/v2/projects/[id]/unified/route.ts +57 -0
- package/packages/web/app/globals.css +38 -0
- package/packages/web/app/layout.tsx +10 -2
- package/packages/web/app/page.tsx +9 -224
- package/packages/web/app/project/[id]/page.tsx +191 -63
- package/packages/web/app/project/[id]/stats/loading.tsx +43 -0
- package/packages/web/app/project/[id]/stats/page.tsx +204 -163
- package/packages/web/app/settings/page.tsx +222 -2
- package/packages/web/components/ActivityTimeline/ActivityTimeline.constants.ts +2 -0
- package/packages/web/components/ActivityTimeline/ActivityTimeline.tsx +50 -0
- package/packages/web/components/ActivityTimeline/ActivityTimeline.types.ts +8 -0
- package/packages/web/components/ActivityTimeline/hooks/index.ts +2 -0
- package/packages/web/components/ActivityTimeline/hooks/useExpandable.ts +9 -0
- package/packages/web/components/ActivityTimeline/hooks/useGroupedEvents.ts +23 -0
- package/packages/web/components/ActivityTimeline/index.ts +2 -0
- package/packages/web/components/AgentsCard/AgentsCard.tsx +63 -0
- package/packages/web/components/AgentsCard/AgentsCard.types.ts +13 -0
- package/packages/web/components/AgentsCard/index.ts +2 -0
- package/packages/web/components/AppSidebar/AppSidebar.tsx +190 -0
- package/packages/web/components/AppSidebar/index.ts +1 -0
- package/packages/web/components/BackLink/BackLink.tsx +18 -0
- package/packages/web/components/BackLink/BackLink.types.ts +5 -0
- package/packages/web/components/BackLink/index.ts +2 -0
- package/packages/web/components/BentoCard/BentoCard.constants.ts +16 -0
- package/packages/web/components/BentoCard/BentoCard.tsx +47 -0
- package/packages/web/components/BentoCard/BentoCard.types.ts +15 -0
- package/packages/web/components/BentoCard/index.ts +2 -0
- package/packages/web/components/BentoCardSkeleton/BentoCardSkeleton.constants.ts +9 -0
- package/packages/web/components/BentoCardSkeleton/BentoCardSkeleton.tsx +18 -0
- package/packages/web/components/BentoCardSkeleton/BentoCardSkeleton.types.ts +5 -0
- package/packages/web/components/BentoCardSkeleton/index.ts +2 -0
- package/packages/web/components/{stats → BentoGrid}/BentoGrid.tsx +4 -8
- package/packages/web/components/BentoGrid/BentoGrid.types.ts +4 -0
- package/packages/web/components/BentoGrid/index.ts +2 -0
- package/packages/web/components/CommandButton/index.ts +1 -0
- package/packages/web/components/ConnectionStatus/index.ts +1 -0
- package/packages/web/components/DashboardContent/DashboardContent.tsx +254 -0
- package/packages/web/components/DashboardContent/index.ts +1 -0
- package/packages/web/components/DateGroup/DateGroup.tsx +18 -0
- package/packages/web/components/DateGroup/DateGroup.types.ts +6 -0
- package/packages/web/components/DateGroup/DateGroup.utils.ts +11 -0
- package/packages/web/components/DateGroup/index.ts +2 -0
- package/packages/web/components/{stats → EmptyState}/EmptyState.tsx +1 -10
- package/packages/web/components/EmptyState/EmptyState.types.ts +10 -0
- package/packages/web/components/EmptyState/index.ts +2 -0
- package/packages/web/components/EventRow/EventRow.constants.ts +10 -0
- package/packages/web/components/EventRow/EventRow.tsx +49 -0
- package/packages/web/components/EventRow/EventRow.types.ts +7 -0
- package/packages/web/components/EventRow/EventRow.utils.ts +49 -0
- package/packages/web/components/EventRow/index.ts +2 -0
- package/packages/web/components/ExpandButton/ExpandButton.tsx +18 -0
- package/packages/web/components/ExpandButton/ExpandButton.types.ts +6 -0
- package/packages/web/components/ExpandButton/index.ts +2 -0
- package/packages/web/components/HealthGradientBackground/HealthGradientBackground.tsx +14 -0
- package/packages/web/components/HealthGradientBackground/HealthGradientBackground.types.ts +5 -0
- package/packages/web/components/HealthGradientBackground/HealthGradientBackground.utils.ts +13 -0
- package/packages/web/components/HealthGradientBackground/index.ts +2 -0
- package/packages/web/components/HeroSection/HeroSection.tsx +55 -0
- package/packages/web/components/HeroSection/HeroSection.types.ts +14 -0
- package/packages/web/components/HeroSection/HeroSection.utils.ts +7 -0
- package/packages/web/components/HeroSection/hooks/index.ts +2 -0
- package/packages/web/components/HeroSection/hooks/useCountUp.ts +45 -0
- package/packages/web/components/HeroSection/hooks/useWeeklyActivity.ts +18 -0
- package/packages/web/components/HeroSection/index.ts +2 -0
- package/packages/web/components/{stats → IdeasCard}/IdeasCard.tsx +3 -14
- package/packages/web/components/IdeasCard/IdeasCard.types.ts +9 -0
- package/packages/web/components/IdeasCard/index.ts +2 -0
- package/packages/web/components/InsightMessage/InsightMessage.tsx +9 -0
- package/packages/web/components/InsightMessage/InsightMessage.types.ts +3 -0
- package/packages/web/components/InsightMessage/index.ts +2 -0
- package/packages/web/components/Logo/index.ts +1 -0
- package/packages/web/components/MarkdownContent/index.ts +1 -0
- package/packages/web/components/NowCard/NowCard.tsx +93 -0
- package/packages/web/components/NowCard/NowCard.types.ts +15 -0
- package/packages/web/components/NowCard/index.ts +2 -0
- package/packages/web/components/ProgressRing/ProgressRing.constants.ts +20 -0
- package/packages/web/components/{stats → ProgressRing}/ProgressRing.tsx +4 -27
- package/packages/web/components/ProgressRing/ProgressRing.types.ts +11 -0
- package/packages/web/components/ProgressRing/index.ts +2 -0
- package/packages/web/components/ProjectAvatar/index.ts +1 -0
- package/packages/web/components/Providers/index.ts +1 -0
- package/packages/web/components/QueueCard/QueueCard.tsx +72 -0
- package/packages/web/components/QueueCard/QueueCard.types.ts +11 -0
- package/packages/web/components/QueueCard/QueueCard.utils.ts +12 -0
- package/packages/web/components/QueueCard/index.ts +2 -0
- package/packages/web/components/{stats → RoadmapCard}/RoadmapCard.tsx +3 -23
- package/packages/web/components/RoadmapCard/RoadmapCard.types.ts +15 -0
- package/packages/web/components/RoadmapCard/index.ts +2 -0
- package/packages/web/components/{stats → ShipsCard}/ShipsCard.tsx +4 -22
- package/packages/web/components/ShipsCard/ShipsCard.types.ts +12 -0
- package/packages/web/components/ShipsCard/ShipsCard.utils.ts +4 -0
- package/packages/web/components/ShipsCard/index.ts +2 -0
- package/packages/web/components/{stats → SparklineChart}/SparklineChart.tsx +1 -7
- package/packages/web/components/SparklineChart/SparklineChart.types.ts +6 -0
- package/packages/web/components/SparklineChart/index.ts +2 -0
- package/packages/web/components/StreakCard/StreakCard.constants.ts +2 -0
- package/packages/web/components/{stats → StreakCard}/StreakCard.tsx +5 -11
- package/packages/web/components/StreakCard/StreakCard.types.ts +4 -0
- package/packages/web/components/StreakCard/index.ts +2 -0
- package/packages/web/components/TasksCounter/TasksCounter.tsx +14 -0
- package/packages/web/components/TasksCounter/TasksCounter.types.ts +3 -0
- package/packages/web/components/TasksCounter/index.ts +2 -0
- package/packages/web/components/TechStackBadges/index.ts +1 -0
- package/packages/web/components/{TerminalTab.tsx → TerminalTabs/TerminalTab.tsx} +11 -0
- package/packages/web/components/{TerminalTabs.tsx → TerminalTabs/TerminalTabs.tsx} +29 -28
- package/packages/web/components/TerminalTabs/index.ts +1 -0
- package/packages/web/components/VelocityBadge/VelocityBadge.tsx +27 -0
- package/packages/web/components/VelocityBadge/VelocityBadge.types.ts +3 -0
- package/packages/web/components/VelocityBadge/index.ts +2 -0
- package/packages/web/components/VelocityCard/VelocityCard.tsx +71 -0
- package/packages/web/components/VelocityCard/VelocityCard.types.ts +7 -0
- package/packages/web/components/VelocityCard/index.ts +2 -0
- package/packages/web/components/WeeklySparkline/WeeklySparkline.tsx +13 -0
- package/packages/web/components/WeeklySparkline/WeeklySparkline.types.ts +3 -0
- package/packages/web/components/WeeklySparkline/index.ts +2 -0
- package/packages/web/components/ui/input.tsx +21 -0
- package/packages/web/context/TerminalTabsContext.tsx +46 -1
- package/packages/web/hooks/useClaudeTerminal.ts +71 -21
- package/packages/web/hooks/useProjectStats.ts +55 -0
- package/packages/web/hooks/useProjects.ts +6 -6
- package/packages/web/lib/actions/projects.ts +15 -0
- package/packages/web/lib/json-loader.ts +630 -0
- package/packages/web/lib/services/index.ts +9 -0
- package/packages/web/lib/services/migration.server.ts +600 -0
- package/packages/web/lib/services/projects.server.ts +52 -0
- package/packages/web/lib/services/stats.server.ts +264 -0
- package/packages/web/lib/unified-loader.ts +396 -0
- package/packages/web/package.json +10 -7
- package/packages/web/server.ts +58 -8
- package/templates/commands/done.md +76 -32
- package/templates/commands/feature.md +121 -47
- package/templates/commands/idea.md +81 -8
- package/templates/commands/now.md +41 -17
- package/templates/commands/ship.md +64 -25
- package/templates/commands/sync.md +28 -3
- package/core/agentic/agent-router.js +0 -140
- package/core/agentic/chain-of-thought.js +0 -578
- package/core/agentic/command-executor.js +0 -417
- package/core/agentic/context-filter.js +0 -354
- package/core/agentic/ground-truth.js +0 -591
- package/core/agentic/loop-detector.js +0 -406
- package/core/agentic/memory-system.js +0 -845
- package/core/agentic/parallel-tools.js +0 -366
- package/core/agentic/plan-mode.js +0 -572
- package/core/agentic/prompt-builder.js +0 -352
- package/core/agentic/response-templates.js +0 -290
- package/core/agentic/semantic-compression.js +0 -517
- package/core/agentic/think-blocks.js +0 -657
- package/core/agentic/tool-registry.js +0 -184
- package/core/agentic/validation-rules.js +0 -380
- package/core/command-registry.js +0 -698
- package/core/commands.js +0 -2237
- package/core/domain/task-stack.js +0 -497
- package/core/infrastructure/legacy-installer-detector.js +0 -546
- package/core/infrastructure/migrator.js +0 -796
- package/core/infrastructure/session-manager.js +0 -390
- package/core/utils/file-helper.js +0 -329
- package/packages/web/app/api/projects/[id]/delete/route.ts +0 -21
- package/packages/web/app/api/stats/route.ts +0 -38
- package/packages/web/components/AppSidebar.tsx +0 -113
- package/packages/web/components/stats/ActivityTimeline.tsx +0 -201
- package/packages/web/components/stats/AgentsCard.tsx +0 -56
- package/packages/web/components/stats/BentoCard.tsx +0 -88
- package/packages/web/components/stats/HeroSection.tsx +0 -172
- package/packages/web/components/stats/NowCard.tsx +0 -71
- package/packages/web/components/stats/QueueCard.tsx +0 -58
- package/packages/web/components/stats/VelocityCard.tsx +0 -60
- package/packages/web/components/stats/index.ts +0 -17
- package/packages/web/hooks/useStats.ts +0 -28
- /package/packages/web/components/{CommandButton.tsx → CommandButton/CommandButton.tsx} +0 -0
- /package/packages/web/components/{ConnectionStatus.tsx → ConnectionStatus/ConnectionStatus.tsx} +0 -0
- /package/packages/web/components/{Logo.tsx → Logo/Logo.tsx} +0 -0
- /package/packages/web/components/{MarkdownContent.tsx → MarkdownContent/MarkdownContent.tsx} +0 -0
- /package/packages/web/components/{ProjectAvatar.tsx → ProjectAvatar/ProjectAvatar.tsx} +0 -0
- /package/packages/web/components/{providers.tsx → Providers/Providers.tsx} +0 -0
- /package/packages/web/components/{TechStackBadges.tsx → TechStackBadges/TechStackBadges.tsx} +0 -0
|
@@ -1,578 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Chain of Thought Layer
|
|
3
|
-
*
|
|
4
|
-
* Adds internal reasoning for critical commands before execution.
|
|
5
|
-
* Inspired by Devin's <think> blocks pattern.
|
|
6
|
-
*
|
|
7
|
-
* OPTIMIZATION (P2.2): Chain of Thought
|
|
8
|
-
* - Internal reasoning for critical commands
|
|
9
|
-
* - Visible reasoning in debug mode
|
|
10
|
-
* - Ground truth verification before action
|
|
11
|
-
*
|
|
12
|
-
* Source: Devin pattern
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const memorySystem = require('./memory-system')
|
|
16
|
-
|
|
17
|
-
class ChainOfThought {
|
|
18
|
-
constructor() {
|
|
19
|
-
// Commands that require reasoning
|
|
20
|
-
this.criticalCommands = ['ship', 'feature', 'analyze', 'sync', 'cleanup', 'init', 'spec']
|
|
21
|
-
|
|
22
|
-
// Debug mode for visible reasoning
|
|
23
|
-
this.debugMode = process.env.PRJCT_DEBUG === 'true'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Check if command requires chain of thought
|
|
28
|
-
* @param {string} commandName
|
|
29
|
-
* @returns {boolean}
|
|
30
|
-
*/
|
|
31
|
-
requiresReasoning(commandName) {
|
|
32
|
-
return this.criticalCommands.includes(commandName)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Generate reasoning chain for a command
|
|
37
|
-
* @param {string} commandName
|
|
38
|
-
* @param {Object} context
|
|
39
|
-
* @param {Object} state
|
|
40
|
-
* @returns {Promise<Object>} Reasoning result
|
|
41
|
-
*/
|
|
42
|
-
async reason(commandName, context, state) {
|
|
43
|
-
if (!this.requiresReasoning(commandName)) {
|
|
44
|
-
return { skip: true, reason: 'Non-critical command' }
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const reasoner = this._getReasonerForCommand(commandName)
|
|
48
|
-
if (!reasoner) {
|
|
49
|
-
return { skip: true, reason: 'No reasoner defined' }
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const startTime = Date.now()
|
|
53
|
-
const reasoning = await reasoner.call(this, context, state)
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
command: commandName,
|
|
57
|
-
reasoning,
|
|
58
|
-
duration: Date.now() - startTime,
|
|
59
|
-
timestamp: new Date().toISOString()
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Get the appropriate reasoner for a command
|
|
65
|
-
* @private
|
|
66
|
-
*/
|
|
67
|
-
_getReasonerForCommand(commandName) {
|
|
68
|
-
const reasoners = {
|
|
69
|
-
ship: this._reasonShip,
|
|
70
|
-
feature: this._reasonFeature,
|
|
71
|
-
analyze: this._reasonAnalyze,
|
|
72
|
-
sync: this._reasonSync,
|
|
73
|
-
cleanup: this._reasonCleanup,
|
|
74
|
-
init: this._reasonInit,
|
|
75
|
-
spec: this._reasonSpec
|
|
76
|
-
}
|
|
77
|
-
return reasoners[commandName]
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Reasoning for /p:ship
|
|
82
|
-
* @private
|
|
83
|
-
*/
|
|
84
|
-
async _reasonShip(context, state) {
|
|
85
|
-
const steps = []
|
|
86
|
-
|
|
87
|
-
// Step 1: Verify current task
|
|
88
|
-
steps.push({
|
|
89
|
-
step: 'verify_task',
|
|
90
|
-
question: 'Is there an active task to ship?',
|
|
91
|
-
check: state.now && state.now.trim() !== '',
|
|
92
|
-
result: state.now ? `Active: "${this._extractTaskName(state.now)}"` : 'No active task',
|
|
93
|
-
pass: !!state.now && state.now.trim() !== ''
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
// Step 2: Check shipped history format
|
|
97
|
-
steps.push({
|
|
98
|
-
step: 'check_format',
|
|
99
|
-
question: 'What format does shipped.md use?',
|
|
100
|
-
check: true,
|
|
101
|
-
result: state.shipped ? 'Found existing format' : 'New file, will use default',
|
|
102
|
-
pass: true
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
// Step 3: Check version
|
|
106
|
-
steps.push({
|
|
107
|
-
step: 'check_version',
|
|
108
|
-
question: 'What version should we use?',
|
|
109
|
-
check: true,
|
|
110
|
-
result: context.version || 'Will read from package.json',
|
|
111
|
-
pass: true
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
// Step 4: Check for memory patterns
|
|
115
|
-
const commitPattern = await memorySystem.getSmartDecision(
|
|
116
|
-
context.projectId,
|
|
117
|
-
'commit_footer'
|
|
118
|
-
)
|
|
119
|
-
steps.push({
|
|
120
|
-
step: 'check_memory',
|
|
121
|
-
question: 'Is there a learned commit pattern?',
|
|
122
|
-
check: !!commitPattern,
|
|
123
|
-
result: commitPattern ? `Pattern: "${commitPattern}"` : 'Will use default prjct footer',
|
|
124
|
-
pass: true
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
// Step 5: Propose plan
|
|
128
|
-
const plan = this._generateShipPlan(steps, context)
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
steps,
|
|
132
|
-
allPassed: steps.every(s => s.pass),
|
|
133
|
-
plan,
|
|
134
|
-
confidence: this._calculateConfidence(steps)
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Reasoning for /p:feature
|
|
140
|
-
* @private
|
|
141
|
-
*/
|
|
142
|
-
async _reasonFeature(context, state) {
|
|
143
|
-
const steps = []
|
|
144
|
-
|
|
145
|
-
// Step 1: Check if feature description provided
|
|
146
|
-
const featureDesc = context.params?.description || context.params?.feature
|
|
147
|
-
steps.push({
|
|
148
|
-
step: 'check_description',
|
|
149
|
-
question: 'Is feature description provided?',
|
|
150
|
-
check: !!featureDesc,
|
|
151
|
-
result: featureDesc ? `Feature: "${featureDesc}"` : 'No description - will show template',
|
|
152
|
-
pass: true // Both modes are valid
|
|
153
|
-
})
|
|
154
|
-
|
|
155
|
-
// Step 2: Check roadmap state
|
|
156
|
-
steps.push({
|
|
157
|
-
step: 'check_roadmap',
|
|
158
|
-
question: 'What is current roadmap state?',
|
|
159
|
-
check: true,
|
|
160
|
-
result: state.roadmap ? 'Roadmap exists' : 'No roadmap yet',
|
|
161
|
-
pass: true
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
// Step 3: Check queue capacity
|
|
165
|
-
const queueSize = this._countQueueItems(state.next)
|
|
166
|
-
steps.push({
|
|
167
|
-
step: 'check_queue',
|
|
168
|
-
question: 'Is there room in the queue?',
|
|
169
|
-
check: queueSize < 100,
|
|
170
|
-
result: `Queue: ${queueSize}/100 tasks`,
|
|
171
|
-
pass: queueSize < 100
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
// Step 4: Analyze impact/effort if description given
|
|
175
|
-
if (featureDesc) {
|
|
176
|
-
const analysis = this._analyzeFeature(featureDesc)
|
|
177
|
-
steps.push({
|
|
178
|
-
step: 'analyze_feature',
|
|
179
|
-
question: 'What is estimated impact/effort?',
|
|
180
|
-
check: true,
|
|
181
|
-
result: `Impact: ${analysis.impact}, Effort: ${analysis.effort}`,
|
|
182
|
-
pass: true
|
|
183
|
-
})
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return {
|
|
187
|
-
steps,
|
|
188
|
-
allPassed: steps.every(s => s.pass),
|
|
189
|
-
plan: this._generateFeaturePlan(steps, featureDesc),
|
|
190
|
-
confidence: this._calculateConfidence(steps)
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Reasoning for /p:analyze
|
|
196
|
-
* @private
|
|
197
|
-
*/
|
|
198
|
-
async _reasonAnalyze(context, state) {
|
|
199
|
-
const steps = []
|
|
200
|
-
|
|
201
|
-
// Step 1: Check if analysis exists
|
|
202
|
-
steps.push({
|
|
203
|
-
step: 'check_existing',
|
|
204
|
-
question: 'Does analysis already exist?',
|
|
205
|
-
check: true,
|
|
206
|
-
result: state.analysis ? 'Existing analysis found' : 'No previous analysis',
|
|
207
|
-
pass: true
|
|
208
|
-
})
|
|
209
|
-
|
|
210
|
-
// Step 2: Check project structure
|
|
211
|
-
steps.push({
|
|
212
|
-
step: 'check_structure',
|
|
213
|
-
question: 'Is project structure valid?',
|
|
214
|
-
check: true,
|
|
215
|
-
result: context.projectPath ? 'Valid project path' : 'No project path',
|
|
216
|
-
pass: !!context.projectPath
|
|
217
|
-
})
|
|
218
|
-
|
|
219
|
-
// Step 3: Check agents directory
|
|
220
|
-
steps.push({
|
|
221
|
-
step: 'check_agents',
|
|
222
|
-
question: 'Are agents generated?',
|
|
223
|
-
check: true,
|
|
224
|
-
result: 'Will regenerate based on analysis',
|
|
225
|
-
pass: true
|
|
226
|
-
})
|
|
227
|
-
|
|
228
|
-
return {
|
|
229
|
-
steps,
|
|
230
|
-
allPassed: steps.every(s => s.pass),
|
|
231
|
-
plan: ['Analyze codebase', 'Detect technologies', 'Generate specialized agents', 'Update context'],
|
|
232
|
-
confidence: this._calculateConfidence(steps)
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Reasoning for /p:sync
|
|
238
|
-
* @private
|
|
239
|
-
*/
|
|
240
|
-
async _reasonSync(_context, state) {
|
|
241
|
-
const steps = []
|
|
242
|
-
|
|
243
|
-
// Step 1: Check current state
|
|
244
|
-
steps.push({
|
|
245
|
-
step: 'check_state',
|
|
246
|
-
question: 'What needs syncing?',
|
|
247
|
-
check: true,
|
|
248
|
-
result: 'Will sync agents, context, and metrics',
|
|
249
|
-
pass: true
|
|
250
|
-
})
|
|
251
|
-
|
|
252
|
-
// Step 2: Check for stale data
|
|
253
|
-
const isStale = !state.analysis || this._isDataStale(state)
|
|
254
|
-
steps.push({
|
|
255
|
-
step: 'check_stale',
|
|
256
|
-
question: 'Is project data stale?',
|
|
257
|
-
check: isStale,
|
|
258
|
-
result: isStale ? 'Data is stale, will refresh' : 'Data is current',
|
|
259
|
-
pass: true
|
|
260
|
-
})
|
|
261
|
-
|
|
262
|
-
return {
|
|
263
|
-
steps,
|
|
264
|
-
allPassed: steps.every(s => s.pass),
|
|
265
|
-
plan: ['Refresh context', 'Update agents', 'Sync metrics'],
|
|
266
|
-
confidence: this._calculateConfidence(steps)
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Reasoning for /p:cleanup
|
|
272
|
-
* @private
|
|
273
|
-
*/
|
|
274
|
-
async _reasonCleanup(context, _state) {
|
|
275
|
-
const steps = []
|
|
276
|
-
|
|
277
|
-
// Step 1: Identify cleanup targets
|
|
278
|
-
const cleanupType = context.params?.type || 'all'
|
|
279
|
-
steps.push({
|
|
280
|
-
step: 'identify_targets',
|
|
281
|
-
question: 'What should be cleaned up?',
|
|
282
|
-
check: true,
|
|
283
|
-
result: `Cleanup type: ${cleanupType}`,
|
|
284
|
-
pass: true
|
|
285
|
-
})
|
|
286
|
-
|
|
287
|
-
// Step 2: Check for safe cleanup
|
|
288
|
-
steps.push({
|
|
289
|
-
step: 'safety_check',
|
|
290
|
-
question: 'Is cleanup safe to proceed?',
|
|
291
|
-
check: true,
|
|
292
|
-
result: 'Will only remove temp files and stale entries',
|
|
293
|
-
pass: true
|
|
294
|
-
})
|
|
295
|
-
|
|
296
|
-
return {
|
|
297
|
-
steps,
|
|
298
|
-
allPassed: steps.every(s => s.pass),
|
|
299
|
-
plan: ['Identify stale files', 'Archive old entries', 'Clean temp data'],
|
|
300
|
-
confidence: this._calculateConfidence(steps)
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Reasoning for /p:init
|
|
306
|
-
* @private
|
|
307
|
-
*/
|
|
308
|
-
async _reasonInit(context, _state) {
|
|
309
|
-
const steps = []
|
|
310
|
-
|
|
311
|
-
// Step 1: Check if already initialized
|
|
312
|
-
steps.push({
|
|
313
|
-
step: 'check_existing',
|
|
314
|
-
question: 'Is project already initialized?',
|
|
315
|
-
check: true,
|
|
316
|
-
result: context.projectId ? 'Already initialized' : 'Not initialized',
|
|
317
|
-
pass: true
|
|
318
|
-
})
|
|
319
|
-
|
|
320
|
-
// Step 2: Check for idea/description
|
|
321
|
-
const idea = context.params?.idea || context.params?.description
|
|
322
|
-
steps.push({
|
|
323
|
-
step: 'check_idea',
|
|
324
|
-
question: 'Is there a project idea?',
|
|
325
|
-
check: !!idea,
|
|
326
|
-
result: idea ? `Idea: "${idea}"` : 'No idea - will ask or analyze existing code',
|
|
327
|
-
pass: true
|
|
328
|
-
})
|
|
329
|
-
|
|
330
|
-
// Step 3: Determine mode
|
|
331
|
-
const mode = idea ? 'architect' : 'standard'
|
|
332
|
-
steps.push({
|
|
333
|
-
step: 'determine_mode',
|
|
334
|
-
question: 'Which initialization mode?',
|
|
335
|
-
check: true,
|
|
336
|
-
result: `Mode: ${mode}`,
|
|
337
|
-
pass: true
|
|
338
|
-
})
|
|
339
|
-
|
|
340
|
-
return {
|
|
341
|
-
steps,
|
|
342
|
-
allPassed: steps.every(s => s.pass),
|
|
343
|
-
plan: mode === 'architect'
|
|
344
|
-
? ['Enter architect mode', 'Ask discovery questions', 'Generate plan', 'Create structure']
|
|
345
|
-
: ['Create config', 'Initialize storage', 'Analyze existing code'],
|
|
346
|
-
confidence: this._calculateConfidence(steps)
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Reasoning for /p:spec
|
|
352
|
-
* @private
|
|
353
|
-
*/
|
|
354
|
-
async _reasonSpec(context, state) {
|
|
355
|
-
const steps = []
|
|
356
|
-
|
|
357
|
-
// Step 1: Check if feature name provided
|
|
358
|
-
const featureName = context.params?.feature || context.params?.name || context.params?.description
|
|
359
|
-
steps.push({
|
|
360
|
-
step: 'check_feature',
|
|
361
|
-
question: 'Is feature name provided?',
|
|
362
|
-
check: !!featureName,
|
|
363
|
-
result: featureName ? `Feature: "${featureName}"` : 'No feature - will show template',
|
|
364
|
-
pass: true // Both modes valid
|
|
365
|
-
})
|
|
366
|
-
|
|
367
|
-
// Step 2: Check for existing spec
|
|
368
|
-
if (featureName) {
|
|
369
|
-
const slug = featureName.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '')
|
|
370
|
-
const specExists = state.specs && state.specs.includes(slug)
|
|
371
|
-
steps.push({
|
|
372
|
-
step: 'check_existing',
|
|
373
|
-
question: 'Does spec already exist?',
|
|
374
|
-
check: !specExists,
|
|
375
|
-
result: specExists ? `Spec "${slug}.md" exists - will update` : 'New spec',
|
|
376
|
-
pass: true
|
|
377
|
-
})
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
// Step 3: Check queue capacity
|
|
381
|
-
const queueSize = this._countQueueItems(state.next)
|
|
382
|
-
steps.push({
|
|
383
|
-
step: 'check_queue',
|
|
384
|
-
question: 'Is there room for new tasks?',
|
|
385
|
-
check: queueSize < 90,
|
|
386
|
-
result: `Queue: ${queueSize}/100`,
|
|
387
|
-
pass: queueSize < 90
|
|
388
|
-
})
|
|
389
|
-
|
|
390
|
-
// Step 4: Check complexity
|
|
391
|
-
if (featureName) {
|
|
392
|
-
const isComplex = this._isComplexFeature(featureName)
|
|
393
|
-
steps.push({
|
|
394
|
-
step: 'assess_complexity',
|
|
395
|
-
question: 'Is this a complex feature?',
|
|
396
|
-
check: true,
|
|
397
|
-
result: isComplex ? 'Complex - spec recommended' : 'Simple - consider /p:feature',
|
|
398
|
-
pass: true
|
|
399
|
-
})
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
return {
|
|
403
|
-
steps,
|
|
404
|
-
allPassed: steps.every(s => s.pass),
|
|
405
|
-
plan: featureName
|
|
406
|
-
? ['Analyze requirements', 'Propose design', 'Break into tasks', 'Request approval', 'Add to queue']
|
|
407
|
-
: ['Show spec template', 'Guide through requirements'],
|
|
408
|
-
confidence: this._calculateConfidence(steps)
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* Check if feature sounds complex
|
|
414
|
-
* @private
|
|
415
|
-
*/
|
|
416
|
-
_isComplexFeature(name) {
|
|
417
|
-
const complexKeywords = [
|
|
418
|
-
'authentication', 'auth', 'payment', 'integration', 'migration',
|
|
419
|
-
'refactor', 'architecture', 'database', 'api', 'system',
|
|
420
|
-
'security', 'performance', 'scale', 'redesign'
|
|
421
|
-
]
|
|
422
|
-
const nameLower = name.toLowerCase()
|
|
423
|
-
return complexKeywords.some(kw => nameLower.includes(kw))
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* Format reasoning for output
|
|
428
|
-
* @param {Object} reasoning
|
|
429
|
-
* @returns {string}
|
|
430
|
-
*/
|
|
431
|
-
formatReasoning(reasoning) {
|
|
432
|
-
if (reasoning.skip) {
|
|
433
|
-
return ''
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
const lines = ['<think>']
|
|
437
|
-
|
|
438
|
-
reasoning.reasoning.steps.forEach(step => {
|
|
439
|
-
const icon = step.pass ? '✓' : '✗'
|
|
440
|
-
lines.push(`${icon} ${step.question}`)
|
|
441
|
-
lines.push(` → ${step.result}`)
|
|
442
|
-
})
|
|
443
|
-
|
|
444
|
-
if (reasoning.reasoning.plan) {
|
|
445
|
-
lines.push('')
|
|
446
|
-
lines.push('PLAN:')
|
|
447
|
-
reasoning.reasoning.plan.forEach((step, i) => {
|
|
448
|
-
lines.push(`${i + 1}. ${step}`)
|
|
449
|
-
})
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
lines.push(`</think>`)
|
|
453
|
-
lines.push(`Confidence: ${Math.round(reasoning.reasoning.confidence * 100)}%`)
|
|
454
|
-
|
|
455
|
-
return lines.join('\n')
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* Format for user-visible output (non-debug)
|
|
460
|
-
* @param {Object} reasoning
|
|
461
|
-
* @returns {string}
|
|
462
|
-
*/
|
|
463
|
-
formatPlan(reasoning) {
|
|
464
|
-
if (reasoning.skip || !reasoning.reasoning?.plan) {
|
|
465
|
-
return ''
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
const lines = ['PLAN:']
|
|
469
|
-
reasoning.reasoning.plan.forEach((step, i) => {
|
|
470
|
-
lines.push(`${i + 1}. ${step}`)
|
|
471
|
-
})
|
|
472
|
-
|
|
473
|
-
if (!reasoning.reasoning.allPassed) {
|
|
474
|
-
const failed = reasoning.reasoning.steps.filter(s => !s.pass)
|
|
475
|
-
lines.push('')
|
|
476
|
-
lines.push('⚠️ Issues:')
|
|
477
|
-
failed.forEach(s => {
|
|
478
|
-
lines.push(` - ${s.result}`)
|
|
479
|
-
})
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
return lines.join('\n')
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// Helper methods
|
|
486
|
-
|
|
487
|
-
_extractTaskName(nowContent) {
|
|
488
|
-
if (!nowContent) return ''
|
|
489
|
-
const lines = nowContent.split('\n')
|
|
490
|
-
for (const line of lines) {
|
|
491
|
-
if (line.startsWith('**') && line.includes('**')) {
|
|
492
|
-
return line.replace(/\*\*/g, '').trim()
|
|
493
|
-
}
|
|
494
|
-
if (line.startsWith('# ')) {
|
|
495
|
-
return line.replace('# ', '').trim()
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
return nowContent.substring(0, 50).trim()
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
_countQueueItems(nextContent) {
|
|
502
|
-
if (!nextContent) return 0
|
|
503
|
-
const matches = nextContent.match(/- \[[ x]\]/g)
|
|
504
|
-
return matches ? matches.length : 0
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
_analyzeFeature(description) {
|
|
508
|
-
const desc = description.toLowerCase()
|
|
509
|
-
|
|
510
|
-
// Simple heuristics for impact/effort
|
|
511
|
-
let impact = 'medium'
|
|
512
|
-
let effort = 'medium'
|
|
513
|
-
|
|
514
|
-
if (desc.includes('critical') || desc.includes('urgent') || desc.includes('security')) {
|
|
515
|
-
impact = 'high'
|
|
516
|
-
} else if (desc.includes('minor') || desc.includes('small') || desc.includes('typo')) {
|
|
517
|
-
impact = 'low'
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
if (desc.includes('refactor') || desc.includes('rewrite') || desc.includes('migrate')) {
|
|
521
|
-
effort = 'high'
|
|
522
|
-
} else if (desc.includes('fix') || desc.includes('update') || desc.includes('add')) {
|
|
523
|
-
effort = 'low'
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
return { impact, effort }
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
_isDataStale(state) {
|
|
530
|
-
// Consider data stale if analysis is more than 24 hours old
|
|
531
|
-
// This is a placeholder - actual implementation would check timestamps
|
|
532
|
-
return !state.analysis
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
_generateShipPlan(steps, context) {
|
|
536
|
-
const plan = []
|
|
537
|
-
|
|
538
|
-
if (steps.find(s => s.step === 'verify_task')?.pass) {
|
|
539
|
-
plan.push('Mark task complete')
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
plan.push('Update shipped.md')
|
|
543
|
-
plan.push('Update metrics')
|
|
544
|
-
|
|
545
|
-
if (context.params?.commit !== false) {
|
|
546
|
-
plan.push('Create commit')
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
if (context.params?.push !== false) {
|
|
550
|
-
plan.push('Push to remote')
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
return plan
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
_generateFeaturePlan(_steps, featureDesc) {
|
|
557
|
-
if (!featureDesc) {
|
|
558
|
-
return ['Show feature template', 'Wait for user input']
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
return [
|
|
562
|
-
'Analyze feature value',
|
|
563
|
-
'Estimate effort',
|
|
564
|
-
'Break into tasks',
|
|
565
|
-
'Add to roadmap',
|
|
566
|
-
'Start first task'
|
|
567
|
-
]
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
_calculateConfidence(steps) {
|
|
571
|
-
if (steps.length === 0) return 1.0
|
|
572
|
-
|
|
573
|
-
const passed = steps.filter(s => s.pass).length
|
|
574
|
-
return passed / steps.length
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
module.exports = new ChainOfThought()
|