@jonit-dev/night-watch-cli 1.7.29 → 1.7.31
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/bin/night-watch.mjs +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/{src/cli.js → cli.js} +1 -0
- package/dist/cli.js.map +1 -0
- package/dist/{src/commands → commands}/audit.d.ts +2 -2
- package/dist/commands/audit.d.ts.map +1 -0
- package/dist/commands/audit.js +105 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/{src/commands → commands}/board.d.ts +1 -1
- package/dist/commands/board.d.ts.map +1 -0
- package/dist/commands/board.js +664 -0
- package/dist/commands/board.js.map +1 -0
- package/dist/{src/commands → commands}/cancel.d.ts +3 -3
- package/dist/commands/cancel.d.ts.map +1 -0
- package/dist/{src/commands → commands}/cancel.js +18 -20
- package/dist/commands/cancel.js.map +1 -0
- package/dist/commands/dashboard/tab-actions.d.ts.map +1 -0
- package/dist/commands/dashboard/tab-actions.js.map +1 -0
- package/dist/{src/commands → commands}/dashboard/tab-config.d.ts +3 -3
- package/dist/commands/dashboard/tab-config.d.ts.map +1 -0
- package/dist/{src/commands → commands}/dashboard/tab-config.js +250 -187
- package/dist/commands/dashboard/tab-config.js.map +1 -0
- package/dist/{src/commands → commands}/dashboard/tab-logs.d.ts +1 -1
- package/dist/commands/dashboard/tab-logs.d.ts.map +1 -0
- package/dist/{src/commands → commands}/dashboard/tab-logs.js +62 -38
- package/dist/commands/dashboard/tab-logs.js.map +1 -0
- package/dist/{src/commands → commands}/dashboard/tab-schedules.d.ts +1 -1
- package/dist/commands/dashboard/tab-schedules.d.ts.map +1 -0
- package/dist/{src/commands → commands}/dashboard/tab-schedules.js +85 -76
- package/dist/commands/dashboard/tab-schedules.js.map +1 -0
- package/dist/{src/commands → commands}/dashboard/tab-status.d.ts +7 -7
- package/dist/commands/dashboard/tab-status.d.ts.map +1 -0
- package/dist/{src/commands → commands}/dashboard/tab-status.js +98 -95
- package/dist/commands/dashboard/tab-status.js.map +1 -0
- package/dist/{src/commands → commands}/dashboard/types.d.ts +3 -4
- package/dist/commands/dashboard/types.d.ts.map +1 -0
- package/dist/commands/dashboard/types.js.map +1 -0
- package/dist/{src/commands → commands}/dashboard.d.ts +2 -2
- package/dist/commands/dashboard.d.ts.map +1 -0
- package/dist/{src/commands → commands}/dashboard.js +32 -33
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/{src/commands → commands}/doctor.d.ts +2 -2
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/{src/commands → commands}/doctor.js +40 -43
- package/dist/commands/doctor.js.map +1 -0
- package/dist/{src/commands → commands}/history.d.ts +1 -1
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/{src/commands → commands}/history.js +11 -18
- package/dist/commands/history.js.map +1 -0
- package/dist/{src/commands → commands}/init.d.ts +1 -1
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/{src/commands → commands}/init.js +62 -36
- package/dist/commands/init.js.map +1 -0
- package/dist/{src/commands → commands}/install.d.ts +2 -2
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/{src/commands → commands}/install.js +48 -50
- package/dist/commands/install.js.map +1 -0
- package/dist/{src/commands → commands}/logs.d.ts +1 -1
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/{src/commands → commands}/logs.js +29 -30
- package/dist/commands/logs.js.map +1 -0
- package/dist/{src/commands → commands}/prd-state.d.ts +1 -1
- package/dist/commands/prd-state.d.ts.map +1 -0
- package/dist/{src/commands → commands}/prd-state.js +14 -14
- package/dist/commands/prd-state.js.map +1 -0
- package/dist/{src/commands → commands}/prd.d.ts +1 -1
- package/dist/commands/prd.d.ts.map +1 -0
- package/dist/{src/commands → commands}/prd.js +57 -66
- package/dist/commands/prd.js.map +1 -0
- package/dist/{src/commands → commands}/prds.d.ts +1 -1
- package/dist/commands/prds.d.ts.map +1 -0
- package/dist/{src/commands → commands}/prds.js +51 -53
- package/dist/commands/prds.js.map +1 -0
- package/dist/{src/commands → commands}/prs.d.ts +1 -1
- package/dist/commands/prs.d.ts.map +1 -0
- package/dist/{src/commands → commands}/prs.js +22 -24
- package/dist/commands/prs.js.map +1 -0
- package/dist/{src/commands → commands}/qa.d.ts +2 -2
- package/dist/commands/qa.d.ts.map +1 -0
- package/dist/{src/commands → commands}/qa.js +50 -51
- package/dist/commands/qa.js.map +1 -0
- package/dist/{src/commands → commands}/retry.d.ts +1 -1
- package/dist/commands/retry.d.ts.map +1 -0
- package/dist/{src/commands → commands}/retry.js +9 -10
- package/dist/commands/retry.js.map +1 -0
- package/dist/{src/commands → commands}/review.d.ts +2 -2
- package/dist/commands/review.d.ts.map +1 -0
- package/dist/{src/commands → commands}/review.js +68 -59
- package/dist/commands/review.js.map +1 -0
- package/dist/{src/commands → commands}/run.d.ts +2 -2
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/{src/commands → commands}/run.js +87 -83
- package/dist/commands/run.js.map +1 -0
- package/dist/{src/commands → commands}/serve.d.ts +2 -2
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/{src/commands → commands}/serve.js +18 -18
- package/dist/commands/serve.js.map +1 -0
- package/dist/{src/commands → commands}/slice.d.ts +2 -2
- package/dist/commands/slice.d.ts.map +1 -0
- package/dist/{src/commands → commands}/slice.js +50 -46
- package/dist/commands/slice.js.map +1 -0
- package/dist/{src/commands → commands}/state.d.ts +1 -1
- package/dist/commands/state.d.ts.map +1 -0
- package/dist/{src/commands → commands}/state.js +20 -22
- package/dist/commands/state.js.map +1 -0
- package/dist/{src/commands → commands}/status.d.ts +1 -1
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/{src/commands → commands}/status.js +75 -54
- package/dist/commands/status.js.map +1 -0
- package/dist/{src/commands → commands}/uninstall.d.ts +1 -1
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/{src/commands → commands}/uninstall.js +12 -14
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/{src/commands → commands}/update.d.ts +1 -1
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/{src/commands → commands}/update.js +23 -23
- package/dist/commands/update.js.map +1 -0
- package/package.json +18 -42
- package/LICENSE +0 -21
- package/README.md +0 -132
- package/dist/shared/types.d.ts +0 -226
- package/dist/shared/types.d.ts.map +0 -1
- package/dist/shared/types.js +0 -7
- package/dist/shared/types.js.map +0 -1
- package/dist/src/agents/soul-compiler.d.ts +0 -11
- package/dist/src/agents/soul-compiler.d.ts.map +0 -1
- package/dist/src/agents/soul-compiler.js +0 -157
- package/dist/src/agents/soul-compiler.js.map +0 -1
- package/dist/src/board/factory.d.ts +0 -3
- package/dist/src/board/factory.d.ts.map +0 -1
- package/dist/src/board/factory.js +0 -10
- package/dist/src/board/factory.js.map +0 -1
- package/dist/src/board/providers/github-graphql.d.ts +0 -16
- package/dist/src/board/providers/github-graphql.d.ts.map +0 -1
- package/dist/src/board/providers/github-graphql.js +0 -43
- package/dist/src/board/providers/github-graphql.js.map +0 -1
- package/dist/src/board/providers/github-projects.d.ts +0 -51
- package/dist/src/board/providers/github-projects.d.ts.map +0 -1
- package/dist/src/board/providers/github-projects.js +0 -672
- package/dist/src/board/providers/github-projects.js.map +0 -1
- package/dist/src/board/types.d.ts +0 -60
- package/dist/src/board/types.d.ts.map +0 -1
- package/dist/src/board/types.js +0 -4
- package/dist/src/board/types.js.map +0 -1
- package/dist/src/cli.d.ts +0 -3
- package/dist/src/cli.d.ts.map +0 -1
- package/dist/src/cli.js.map +0 -1
- package/dist/src/commands/audit.d.ts.map +0 -1
- package/dist/src/commands/audit.js +0 -98
- package/dist/src/commands/audit.js.map +0 -1
- package/dist/src/commands/board.d.ts.map +0 -1
- package/dist/src/commands/board.js +0 -294
- package/dist/src/commands/board.js.map +0 -1
- package/dist/src/commands/cancel.d.ts.map +0 -1
- package/dist/src/commands/cancel.js.map +0 -1
- package/dist/src/commands/dashboard/tab-actions.d.ts.map +0 -1
- package/dist/src/commands/dashboard/tab-actions.js.map +0 -1
- package/dist/src/commands/dashboard/tab-config.d.ts.map +0 -1
- package/dist/src/commands/dashboard/tab-config.js.map +0 -1
- package/dist/src/commands/dashboard/tab-logs.d.ts.map +0 -1
- package/dist/src/commands/dashboard/tab-logs.js.map +0 -1
- package/dist/src/commands/dashboard/tab-schedules.d.ts.map +0 -1
- package/dist/src/commands/dashboard/tab-schedules.js.map +0 -1
- package/dist/src/commands/dashboard/tab-status.d.ts.map +0 -1
- package/dist/src/commands/dashboard/tab-status.js.map +0 -1
- package/dist/src/commands/dashboard/types.d.ts.map +0 -1
- package/dist/src/commands/dashboard/types.js.map +0 -1
- package/dist/src/commands/dashboard.d.ts.map +0 -1
- package/dist/src/commands/dashboard.js.map +0 -1
- package/dist/src/commands/doctor.d.ts.map +0 -1
- package/dist/src/commands/doctor.js.map +0 -1
- package/dist/src/commands/history.d.ts.map +0 -1
- package/dist/src/commands/history.js.map +0 -1
- package/dist/src/commands/init.d.ts.map +0 -1
- package/dist/src/commands/init.js.map +0 -1
- package/dist/src/commands/install.d.ts.map +0 -1
- package/dist/src/commands/install.js.map +0 -1
- package/dist/src/commands/logs.d.ts.map +0 -1
- package/dist/src/commands/logs.js.map +0 -1
- package/dist/src/commands/prd-state.d.ts.map +0 -1
- package/dist/src/commands/prd-state.js.map +0 -1
- package/dist/src/commands/prd.d.ts.map +0 -1
- package/dist/src/commands/prd.js.map +0 -1
- package/dist/src/commands/prds.d.ts.map +0 -1
- package/dist/src/commands/prds.js.map +0 -1
- package/dist/src/commands/prs.d.ts.map +0 -1
- package/dist/src/commands/prs.js.map +0 -1
- package/dist/src/commands/qa.d.ts.map +0 -1
- package/dist/src/commands/qa.js.map +0 -1
- package/dist/src/commands/retry.d.ts.map +0 -1
- package/dist/src/commands/retry.js.map +0 -1
- package/dist/src/commands/review.d.ts.map +0 -1
- package/dist/src/commands/review.js.map +0 -1
- package/dist/src/commands/run.d.ts.map +0 -1
- package/dist/src/commands/run.js.map +0 -1
- package/dist/src/commands/serve.d.ts.map +0 -1
- package/dist/src/commands/serve.js.map +0 -1
- package/dist/src/commands/slice.d.ts.map +0 -1
- package/dist/src/commands/slice.js.map +0 -1
- package/dist/src/commands/state.d.ts.map +0 -1
- package/dist/src/commands/state.js.map +0 -1
- package/dist/src/commands/status.d.ts.map +0 -1
- package/dist/src/commands/status.js.map +0 -1
- package/dist/src/commands/uninstall.d.ts.map +0 -1
- package/dist/src/commands/uninstall.js.map +0 -1
- package/dist/src/commands/update.d.ts.map +0 -1
- package/dist/src/commands/update.js.map +0 -1
- package/dist/src/config.d.ts +0 -23
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/config.js +0 -671
- package/dist/src/config.js.map +0 -1
- package/dist/src/constants.d.ts +0 -67
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js +0 -131
- package/dist/src/constants.js.map +0 -1
- package/dist/src/server/index.d.ts +0 -23
- package/dist/src/server/index.d.ts.map +0 -1
- package/dist/src/server/index.js +0 -1704
- package/dist/src/server/index.js.map +0 -1
- package/dist/src/slack/channel-manager.d.ts +0 -32
- package/dist/src/slack/channel-manager.d.ts.map +0 -1
- package/dist/src/slack/channel-manager.js +0 -128
- package/dist/src/slack/channel-manager.js.map +0 -1
- package/dist/src/slack/client.d.ts +0 -76
- package/dist/src/slack/client.d.ts.map +0 -1
- package/dist/src/slack/client.js +0 -193
- package/dist/src/slack/client.js.map +0 -1
- package/dist/src/slack/deliberation.d.ts +0 -87
- package/dist/src/slack/deliberation.d.ts.map +0 -1
- package/dist/src/slack/deliberation.js +0 -1354
- package/dist/src/slack/deliberation.js.map +0 -1
- package/dist/src/slack/index.d.ts +0 -6
- package/dist/src/slack/index.d.ts.map +0 -1
- package/dist/src/slack/index.js +0 -5
- package/dist/src/slack/index.js.map +0 -1
- package/dist/src/slack/interaction-listener.d.ts +0 -130
- package/dist/src/slack/interaction-listener.d.ts.map +0 -1
- package/dist/src/slack/interaction-listener.js +0 -1329
- package/dist/src/slack/interaction-listener.js.map +0 -1
- package/dist/src/storage/json-state-migrator.d.ts +0 -24
- package/dist/src/storage/json-state-migrator.d.ts.map +0 -1
- package/dist/src/storage/json-state-migrator.js +0 -197
- package/dist/src/storage/json-state-migrator.js.map +0 -1
- package/dist/src/storage/repositories/index.d.ts +0 -25
- package/dist/src/storage/repositories/index.d.ts.map +0 -1
- package/dist/src/storage/repositories/index.js +0 -45
- package/dist/src/storage/repositories/index.js.map +0 -1
- package/dist/src/storage/repositories/interfaces.d.ts +0 -60
- package/dist/src/storage/repositories/interfaces.d.ts.map +0 -1
- package/dist/src/storage/repositories/interfaces.js +0 -6
- package/dist/src/storage/repositories/interfaces.js.map +0 -1
- package/dist/src/storage/repositories/sqlite/agent-persona-repository.d.ts +0 -33
- package/dist/src/storage/repositories/sqlite/agent-persona-repository.d.ts.map +0 -1
- package/dist/src/storage/repositories/sqlite/agent-persona-repository.js +0 -715
- package/dist/src/storage/repositories/sqlite/agent-persona-repository.js.map +0 -1
- package/dist/src/storage/repositories/sqlite/execution-history-repository.d.ts +0 -21
- package/dist/src/storage/repositories/sqlite/execution-history-repository.d.ts.map +0 -1
- package/dist/src/storage/repositories/sqlite/execution-history-repository.js +0 -94
- package/dist/src/storage/repositories/sqlite/execution-history-repository.js.map +0 -1
- package/dist/src/storage/repositories/sqlite/prd-state-repository.d.ts +0 -17
- package/dist/src/storage/repositories/sqlite/prd-state-repository.d.ts.map +0 -1
- package/dist/src/storage/repositories/sqlite/prd-state-repository.js +0 -74
- package/dist/src/storage/repositories/sqlite/prd-state-repository.js.map +0 -1
- package/dist/src/storage/repositories/sqlite/project-registry-repository.d.ts +0 -17
- package/dist/src/storage/repositories/sqlite/project-registry-repository.d.ts.map +0 -1
- package/dist/src/storage/repositories/sqlite/project-registry-repository.js +0 -43
- package/dist/src/storage/repositories/sqlite/project-registry-repository.js.map +0 -1
- package/dist/src/storage/repositories/sqlite/roadmap-state-repository.d.ts +0 -14
- package/dist/src/storage/repositories/sqlite/roadmap-state-repository.d.ts.map +0 -1
- package/dist/src/storage/repositories/sqlite/roadmap-state-repository.js +0 -47
- package/dist/src/storage/repositories/sqlite/roadmap-state-repository.js.map +0 -1
- package/dist/src/storage/repositories/sqlite/slack-discussion-repository.d.ts +0 -20
- package/dist/src/storage/repositories/sqlite/slack-discussion-repository.d.ts.map +0 -1
- package/dist/src/storage/repositories/sqlite/slack-discussion-repository.js +0 -88
- package/dist/src/storage/repositories/sqlite/slack-discussion-repository.js.map +0 -1
- package/dist/src/storage/sqlite/client.d.ts +0 -23
- package/dist/src/storage/sqlite/client.d.ts.map +0 -1
- package/dist/src/storage/sqlite/client.js +0 -47
- package/dist/src/storage/sqlite/client.js.map +0 -1
- package/dist/src/storage/sqlite/migrations.d.ts +0 -11
- package/dist/src/storage/sqlite/migrations.d.ts.map +0 -1
- package/dist/src/storage/sqlite/migrations.js +0 -94
- package/dist/src/storage/sqlite/migrations.js.map +0 -1
- package/dist/src/templates/prd-template.d.ts +0 -11
- package/dist/src/templates/prd-template.d.ts.map +0 -1
- package/dist/src/templates/prd-template.js +0 -166
- package/dist/src/templates/prd-template.js.map +0 -1
- package/dist/src/templates/slicer-prompt.d.ts +0 -54
- package/dist/src/templates/slicer-prompt.d.ts.map +0 -1
- package/dist/src/templates/slicer-prompt.js +0 -163
- package/dist/src/templates/slicer-prompt.js.map +0 -1
- package/dist/src/types.d.ts +0 -140
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -5
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils/avatar-generator.d.ts +0 -6
- package/dist/src/utils/avatar-generator.d.ts.map +0 -1
- package/dist/src/utils/avatar-generator.js +0 -133
- package/dist/src/utils/avatar-generator.js.map +0 -1
- package/dist/src/utils/checks.d.ts +0 -55
- package/dist/src/utils/checks.d.ts.map +0 -1
- package/dist/src/utils/checks.js +0 -246
- package/dist/src/utils/checks.js.map +0 -1
- package/dist/src/utils/config-writer.d.ts +0 -16
- package/dist/src/utils/config-writer.d.ts.map +0 -1
- package/dist/src/utils/config-writer.js +0 -45
- package/dist/src/utils/config-writer.js.map +0 -1
- package/dist/src/utils/crontab.d.ts +0 -62
- package/dist/src/utils/crontab.d.ts.map +0 -1
- package/dist/src/utils/crontab.js +0 -168
- package/dist/src/utils/crontab.js.map +0 -1
- package/dist/src/utils/execution-history.d.ts +0 -54
- package/dist/src/utils/execution-history.d.ts.map +0 -1
- package/dist/src/utils/execution-history.js +0 -80
- package/dist/src/utils/execution-history.js.map +0 -1
- package/dist/src/utils/github.d.ts +0 -40
- package/dist/src/utils/github.d.ts.map +0 -1
- package/dist/src/utils/github.js +0 -126
- package/dist/src/utils/github.js.map +0 -1
- package/dist/src/utils/notify.d.ts +0 -64
- package/dist/src/utils/notify.d.ts.map +0 -1
- package/dist/src/utils/notify.js +0 -405
- package/dist/src/utils/notify.js.map +0 -1
- package/dist/src/utils/prd-states.d.ts +0 -16
- package/dist/src/utils/prd-states.d.ts.map +0 -1
- package/dist/src/utils/prd-states.js +0 -28
- package/dist/src/utils/prd-states.js.map +0 -1
- package/dist/src/utils/registry.d.ts +0 -45
- package/dist/src/utils/registry.d.ts.map +0 -1
- package/dist/src/utils/registry.js +0 -86
- package/dist/src/utils/registry.js.map +0 -1
- package/dist/src/utils/roadmap-parser.d.ts +0 -45
- package/dist/src/utils/roadmap-parser.d.ts.map +0 -1
- package/dist/src/utils/roadmap-parser.js +0 -136
- package/dist/src/utils/roadmap-parser.js.map +0 -1
- package/dist/src/utils/roadmap-scanner.d.ts +0 -92
- package/dist/src/utils/roadmap-scanner.d.ts.map +0 -1
- package/dist/src/utils/roadmap-scanner.js +0 -349
- package/dist/src/utils/roadmap-scanner.js.map +0 -1
- package/dist/src/utils/roadmap-state.d.ts +0 -90
- package/dist/src/utils/roadmap-state.d.ts.map +0 -1
- package/dist/src/utils/roadmap-state.js +0 -154
- package/dist/src/utils/roadmap-state.js.map +0 -1
- package/dist/src/utils/script-result.d.ts +0 -12
- package/dist/src/utils/script-result.d.ts.map +0 -1
- package/dist/src/utils/script-result.js +0 -46
- package/dist/src/utils/script-result.js.map +0 -1
- package/dist/src/utils/shell.d.ts +0 -27
- package/dist/src/utils/shell.d.ts.map +0 -1
- package/dist/src/utils/shell.js +0 -64
- package/dist/src/utils/shell.js.map +0 -1
- package/dist/src/utils/status-data.d.ts +0 -148
- package/dist/src/utils/status-data.d.ts.map +0 -1
- package/dist/src/utils/status-data.js +0 -548
- package/dist/src/utils/status-data.js.map +0 -1
- package/dist/src/utils/ui.d.ts +0 -55
- package/dist/src/utils/ui.d.ts.map +0 -1
- package/dist/src/utils/ui.js +0 -121
- package/dist/src/utils/ui.js.map +0 -1
- package/scripts/night-watch-audit-cron.sh +0 -149
- package/scripts/night-watch-cron.sh +0 -484
- package/scripts/night-watch-helpers.sh +0 -499
- package/scripts/night-watch-pr-reviewer-cron.sh +0 -528
- package/scripts/night-watch-qa-cron.sh +0 -281
- package/scripts/night-watch-slicer-cron.sh +0 -90
- package/scripts/test-helpers.bats +0 -77
- package/templates/night-watch-pr-reviewer.md +0 -174
- package/templates/night-watch-qa.md +0 -157
- package/templates/night-watch-slicer.md +0 -219
- package/templates/night-watch.config.json +0 -30
- package/templates/night-watch.md +0 -94
- package/templates/prd-executor.md +0 -235
- package/templates/prd.md +0 -26
- package/web/dist/assets/index-BiJf9LFT.js +0 -458
- package/web/dist/assets/index-OpSgvsYu.css +0 -1
- package/web/dist/avatars/carlos.webp +0 -0
- package/web/dist/avatars/dev.webp +0 -0
- package/web/dist/avatars/maya.webp +0 -0
- package/web/dist/avatars/priya.webp +0 -0
- package/web/dist/index.html +0 -82
- /package/dist/{src/commands → commands}/dashboard/tab-actions.d.ts +0 -0
- /package/dist/{src/commands → commands}/dashboard/tab-actions.js +0 -0
- /package/dist/{src/commands → commands}/dashboard/types.js +0 -0
package/dist/src/config.js
DELETED
|
@@ -1,671 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration loader for Night Watch CLI
|
|
3
|
-
* Loads config from: defaults -> config file -> environment variables
|
|
4
|
-
*/
|
|
5
|
-
import * as fs from "fs";
|
|
6
|
-
import * as path from "path";
|
|
7
|
-
import { fileURLToPath } from "url";
|
|
8
|
-
import { CONFIG_FILE_NAME, DEFAULT_AUDIT, DEFAULT_AUTO_MERGE, DEFAULT_AUTO_MERGE_METHOD, DEFAULT_BOARD_PROVIDER, DEFAULT_BRANCH_PATTERNS, DEFAULT_BRANCH_PREFIX, DEFAULT_CLAUDE_MODEL, DEFAULT_CRON_SCHEDULE, DEFAULT_CRON_SCHEDULE_OFFSET, DEFAULT_DEFAULT_BRANCH, DEFAULT_FALLBACK_ON_RATE_LIMIT, DEFAULT_MAX_LOG_SIZE, DEFAULT_MAX_RETRIES, DEFAULT_MAX_RUNTIME, DEFAULT_MIN_REVIEW_SCORE, DEFAULT_NOTIFICATIONS, DEFAULT_PRD_DIR, DEFAULT_PRD_PRIORITY, DEFAULT_PROVIDER, DEFAULT_PROVIDER_ENV, DEFAULT_QA, DEFAULT_REVIEWER_ENABLED, DEFAULT_REVIEWER_MAX_RUNTIME, DEFAULT_REVIEWER_SCHEDULE, DEFAULT_ROADMAP_SCANNER, DEFAULT_SLACK_BOT_CONFIG, DEFAULT_TEMPLATES_DIR, VALID_CLAUDE_MODELS, VALID_MERGE_METHODS, VALID_PROVIDERS, } from "./constants.js";
|
|
9
|
-
/**
|
|
10
|
-
* Get the default configuration values
|
|
11
|
-
*/
|
|
12
|
-
export function getDefaultConfig() {
|
|
13
|
-
return {
|
|
14
|
-
// PRD execution
|
|
15
|
-
defaultBranch: DEFAULT_DEFAULT_BRANCH,
|
|
16
|
-
prdDir: DEFAULT_PRD_DIR,
|
|
17
|
-
maxRuntime: DEFAULT_MAX_RUNTIME,
|
|
18
|
-
reviewerMaxRuntime: DEFAULT_REVIEWER_MAX_RUNTIME,
|
|
19
|
-
branchPrefix: DEFAULT_BRANCH_PREFIX,
|
|
20
|
-
branchPatterns: [...DEFAULT_BRANCH_PATTERNS],
|
|
21
|
-
minReviewScore: DEFAULT_MIN_REVIEW_SCORE,
|
|
22
|
-
maxLogSize: DEFAULT_MAX_LOG_SIZE,
|
|
23
|
-
// Cron scheduling
|
|
24
|
-
cronSchedule: DEFAULT_CRON_SCHEDULE,
|
|
25
|
-
reviewerSchedule: DEFAULT_REVIEWER_SCHEDULE,
|
|
26
|
-
cronScheduleOffset: DEFAULT_CRON_SCHEDULE_OFFSET,
|
|
27
|
-
maxRetries: DEFAULT_MAX_RETRIES,
|
|
28
|
-
// Provider configuration
|
|
29
|
-
provider: DEFAULT_PROVIDER,
|
|
30
|
-
reviewerEnabled: DEFAULT_REVIEWER_ENABLED,
|
|
31
|
-
providerEnv: { ...DEFAULT_PROVIDER_ENV },
|
|
32
|
-
// Notification configuration
|
|
33
|
-
notifications: { ...DEFAULT_NOTIFICATIONS, webhooks: [] },
|
|
34
|
-
// PRD priority
|
|
35
|
-
prdPriority: [...DEFAULT_PRD_PRIORITY],
|
|
36
|
-
// Roadmap scanner
|
|
37
|
-
roadmapScanner: { ...DEFAULT_ROADMAP_SCANNER },
|
|
38
|
-
// Templates
|
|
39
|
-
templatesDir: DEFAULT_TEMPLATES_DIR,
|
|
40
|
-
// Board provider
|
|
41
|
-
boardProvider: { ...DEFAULT_BOARD_PROVIDER },
|
|
42
|
-
// Auto-merge
|
|
43
|
-
autoMerge: DEFAULT_AUTO_MERGE,
|
|
44
|
-
autoMergeMethod: DEFAULT_AUTO_MERGE_METHOD,
|
|
45
|
-
// Rate-limit fallback
|
|
46
|
-
fallbackOnRateLimit: DEFAULT_FALLBACK_ON_RATE_LIMIT,
|
|
47
|
-
claudeModel: DEFAULT_CLAUDE_MODEL,
|
|
48
|
-
// QA process
|
|
49
|
-
qa: { ...DEFAULT_QA },
|
|
50
|
-
// Code audit
|
|
51
|
-
audit: { ...DEFAULT_AUDIT },
|
|
52
|
-
// Slack Bot API
|
|
53
|
-
slack: { ...DEFAULT_SLACK_BOT_CONFIG, channels: { ...DEFAULT_SLACK_BOT_CONFIG.channels } },
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Load configuration from a JSON file
|
|
58
|
-
*/
|
|
59
|
-
function loadConfigFile(configPath) {
|
|
60
|
-
try {
|
|
61
|
-
if (!fs.existsSync(configPath)) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
const content = fs.readFileSync(configPath, "utf-8");
|
|
65
|
-
const rawConfig = JSON.parse(content);
|
|
66
|
-
return normalizeConfig(rawConfig);
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
// If file exists but can't be parsed, warn but don't fail
|
|
70
|
-
console.warn(`Warning: Could not parse config file at ${configPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Convert legacy/nested config formats to the flat INightWatchConfig shape.
|
|
76
|
-
* Flat keys take precedence over nested aliases when both are present.
|
|
77
|
-
*/
|
|
78
|
-
function normalizeConfig(rawConfig) {
|
|
79
|
-
const normalized = {};
|
|
80
|
-
const readString = (value) => typeof value === "string" ? value : undefined;
|
|
81
|
-
const readNumber = (value) => typeof value === "number" && !Number.isNaN(value) ? value : undefined;
|
|
82
|
-
const readBoolean = (value) => typeof value === "boolean" ? value : undefined;
|
|
83
|
-
const readStringArray = (value) => Array.isArray(value) && value.every((v) => typeof v === "string")
|
|
84
|
-
? value
|
|
85
|
-
: undefined;
|
|
86
|
-
const readObject = (value) => value !== null && typeof value === "object" ? value : undefined;
|
|
87
|
-
const cron = readObject(rawConfig.cron);
|
|
88
|
-
const review = readObject(rawConfig.review);
|
|
89
|
-
const logging = readObject(rawConfig.logging);
|
|
90
|
-
normalized.defaultBranch = readString(rawConfig.defaultBranch);
|
|
91
|
-
normalized.prdDir =
|
|
92
|
-
readString(rawConfig.prdDir) ??
|
|
93
|
-
readString(rawConfig.prdDirectory);
|
|
94
|
-
normalized.maxRuntime = readNumber(rawConfig.maxRuntime);
|
|
95
|
-
normalized.reviewerMaxRuntime = readNumber(rawConfig.reviewerMaxRuntime);
|
|
96
|
-
normalized.branchPrefix = readString(rawConfig.branchPrefix);
|
|
97
|
-
normalized.branchPatterns =
|
|
98
|
-
readStringArray(rawConfig.branchPatterns) ??
|
|
99
|
-
readStringArray(review?.branchPatterns);
|
|
100
|
-
normalized.minReviewScore =
|
|
101
|
-
readNumber(rawConfig.minReviewScore) ??
|
|
102
|
-
readNumber(review?.minScore);
|
|
103
|
-
normalized.maxLogSize =
|
|
104
|
-
readNumber(rawConfig.maxLogSize) ??
|
|
105
|
-
readNumber(logging?.maxLogSize);
|
|
106
|
-
normalized.cronSchedule =
|
|
107
|
-
readString(rawConfig.cronSchedule) ??
|
|
108
|
-
readString(cron?.executorSchedule);
|
|
109
|
-
normalized.reviewerSchedule =
|
|
110
|
-
readString(rawConfig.reviewerSchedule) ??
|
|
111
|
-
readString(cron?.reviewerSchedule);
|
|
112
|
-
normalized.cronScheduleOffset = readNumber(rawConfig.cronScheduleOffset);
|
|
113
|
-
normalized.maxRetries = readNumber(rawConfig.maxRetries);
|
|
114
|
-
normalized.provider = validateProvider(String(rawConfig.provider ?? "")) ?? undefined;
|
|
115
|
-
normalized.reviewerEnabled = readBoolean(rawConfig.reviewerEnabled);
|
|
116
|
-
// providerEnv: Record<string, string> of extra env vars for the provider CLI
|
|
117
|
-
const rawProviderEnv = readObject(rawConfig.providerEnv);
|
|
118
|
-
if (rawProviderEnv) {
|
|
119
|
-
const env = {};
|
|
120
|
-
for (const [key, value] of Object.entries(rawProviderEnv)) {
|
|
121
|
-
if (typeof value === "string") {
|
|
122
|
-
env[key] = value;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
if (Object.keys(env).length > 0) {
|
|
126
|
-
normalized.providerEnv = env;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
// Notifications
|
|
130
|
-
const rawNotifications = readObject(rawConfig.notifications);
|
|
131
|
-
if (rawNotifications) {
|
|
132
|
-
const rawWebhooks = Array.isArray(rawNotifications.webhooks) ? rawNotifications.webhooks : [];
|
|
133
|
-
const webhooks = [];
|
|
134
|
-
for (const wh of rawWebhooks) {
|
|
135
|
-
if (wh && typeof wh === "object" && "type" in wh && "events" in wh) {
|
|
136
|
-
const whObj = wh;
|
|
137
|
-
webhooks.push({
|
|
138
|
-
type: String(whObj.type),
|
|
139
|
-
url: typeof whObj.url === "string" ? whObj.url : undefined,
|
|
140
|
-
botToken: typeof whObj.botToken === "string" ? whObj.botToken : undefined,
|
|
141
|
-
chatId: typeof whObj.chatId === "string" ? whObj.chatId : undefined,
|
|
142
|
-
events: Array.isArray(whObj.events)
|
|
143
|
-
? whObj.events.filter((e) => typeof e === "string")
|
|
144
|
-
: [],
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
normalized.notifications = { webhooks };
|
|
149
|
-
}
|
|
150
|
-
// PRD priority
|
|
151
|
-
normalized.prdPriority = readStringArray(rawConfig.prdPriority);
|
|
152
|
-
// Roadmap Scanner
|
|
153
|
-
const rawRoadmapScanner = readObject(rawConfig.roadmapScanner);
|
|
154
|
-
if (rawRoadmapScanner) {
|
|
155
|
-
const roadmapScanner = {
|
|
156
|
-
enabled: readBoolean(rawRoadmapScanner.enabled) ?? DEFAULT_ROADMAP_SCANNER.enabled,
|
|
157
|
-
roadmapPath: readString(rawRoadmapScanner.roadmapPath) ?? DEFAULT_ROADMAP_SCANNER.roadmapPath,
|
|
158
|
-
autoScanInterval: readNumber(rawRoadmapScanner.autoScanInterval) ?? DEFAULT_ROADMAP_SCANNER.autoScanInterval,
|
|
159
|
-
slicerSchedule: readString(rawRoadmapScanner.slicerSchedule) ?? DEFAULT_ROADMAP_SCANNER.slicerSchedule,
|
|
160
|
-
slicerMaxRuntime: readNumber(rawRoadmapScanner.slicerMaxRuntime) ?? DEFAULT_ROADMAP_SCANNER.slicerMaxRuntime,
|
|
161
|
-
};
|
|
162
|
-
// Validate autoScanInterval has minimum of 30 seconds
|
|
163
|
-
if (roadmapScanner.autoScanInterval < 30) {
|
|
164
|
-
roadmapScanner.autoScanInterval = 30;
|
|
165
|
-
}
|
|
166
|
-
normalized.roadmapScanner = roadmapScanner;
|
|
167
|
-
}
|
|
168
|
-
// Templates Directory
|
|
169
|
-
normalized.templatesDir = readString(rawConfig.templatesDir);
|
|
170
|
-
// Board Provider
|
|
171
|
-
const rawBoardProvider = readObject(rawConfig.boardProvider);
|
|
172
|
-
if (rawBoardProvider) {
|
|
173
|
-
const bp = {
|
|
174
|
-
enabled: readBoolean(rawBoardProvider.enabled) ?? DEFAULT_BOARD_PROVIDER.enabled,
|
|
175
|
-
provider: readString(rawBoardProvider.provider) ?? DEFAULT_BOARD_PROVIDER.provider,
|
|
176
|
-
};
|
|
177
|
-
if (typeof rawBoardProvider.projectNumber === "number") {
|
|
178
|
-
bp.projectNumber = rawBoardProvider.projectNumber;
|
|
179
|
-
}
|
|
180
|
-
if (typeof rawBoardProvider.repo === "string") {
|
|
181
|
-
bp.repo = rawBoardProvider.repo;
|
|
182
|
-
}
|
|
183
|
-
normalized.boardProvider = bp;
|
|
184
|
-
}
|
|
185
|
-
// Rate-limit fallback
|
|
186
|
-
normalized.fallbackOnRateLimit = readBoolean(rawConfig.fallbackOnRateLimit);
|
|
187
|
-
const claudeModelRaw = readString(rawConfig.claudeModel);
|
|
188
|
-
if (claudeModelRaw && VALID_CLAUDE_MODELS.includes(claudeModelRaw)) {
|
|
189
|
-
normalized.claudeModel = claudeModelRaw;
|
|
190
|
-
}
|
|
191
|
-
// Auto-Merge
|
|
192
|
-
normalized.autoMerge = readBoolean(rawConfig.autoMerge);
|
|
193
|
-
const mergeMethod = readString(rawConfig.autoMergeMethod);
|
|
194
|
-
if (mergeMethod && VALID_MERGE_METHODS.includes(mergeMethod)) {
|
|
195
|
-
normalized.autoMergeMethod = mergeMethod;
|
|
196
|
-
}
|
|
197
|
-
// Slack Bot Configuration
|
|
198
|
-
const rawSlack = readObject(rawConfig.slack);
|
|
199
|
-
if (rawSlack) {
|
|
200
|
-
const rawChannels = readObject(rawSlack.channels) ?? {};
|
|
201
|
-
const slack = {
|
|
202
|
-
enabled: readBoolean(rawSlack.enabled) ?? DEFAULT_SLACK_BOT_CONFIG.enabled,
|
|
203
|
-
botToken: readString(rawSlack.botToken) ?? DEFAULT_SLACK_BOT_CONFIG.botToken,
|
|
204
|
-
channels: {
|
|
205
|
-
eng: readString(rawChannels.eng) ?? DEFAULT_SLACK_BOT_CONFIG.channels.eng,
|
|
206
|
-
prs: readString(rawChannels.prs) ?? DEFAULT_SLACK_BOT_CONFIG.channels.prs,
|
|
207
|
-
incidents: readString(rawChannels.incidents) ?? DEFAULT_SLACK_BOT_CONFIG.channels.incidents,
|
|
208
|
-
releases: readString(rawChannels.releases) ?? DEFAULT_SLACK_BOT_CONFIG.channels.releases,
|
|
209
|
-
},
|
|
210
|
-
autoCreateProjectChannels: readBoolean(rawSlack.autoCreateProjectChannels) ??
|
|
211
|
-
DEFAULT_SLACK_BOT_CONFIG.autoCreateProjectChannels,
|
|
212
|
-
discussionEnabled: readBoolean(rawSlack.discussionEnabled) ?? DEFAULT_SLACK_BOT_CONFIG.discussionEnabled,
|
|
213
|
-
};
|
|
214
|
-
if (typeof rawSlack.appToken === "string") {
|
|
215
|
-
slack.appToken = rawSlack.appToken;
|
|
216
|
-
}
|
|
217
|
-
normalized.slack = slack;
|
|
218
|
-
}
|
|
219
|
-
// QA Configuration
|
|
220
|
-
const rawQa = readObject(rawConfig.qa);
|
|
221
|
-
if (rawQa) {
|
|
222
|
-
const artifactsValue = readString(rawQa.artifacts);
|
|
223
|
-
const artifacts = artifactsValue && ["screenshot", "video", "both"].includes(artifactsValue)
|
|
224
|
-
? artifactsValue
|
|
225
|
-
: DEFAULT_QA.artifacts;
|
|
226
|
-
const qa = {
|
|
227
|
-
enabled: readBoolean(rawQa.enabled) ?? DEFAULT_QA.enabled,
|
|
228
|
-
schedule: readString(rawQa.schedule) ?? DEFAULT_QA.schedule,
|
|
229
|
-
maxRuntime: readNumber(rawQa.maxRuntime) ?? DEFAULT_QA.maxRuntime,
|
|
230
|
-
branchPatterns: readStringArray(rawQa.branchPatterns) ?? DEFAULT_QA.branchPatterns,
|
|
231
|
-
artifacts,
|
|
232
|
-
skipLabel: readString(rawQa.skipLabel) ?? DEFAULT_QA.skipLabel,
|
|
233
|
-
autoInstallPlaywright: readBoolean(rawQa.autoInstallPlaywright) ?? DEFAULT_QA.autoInstallPlaywright,
|
|
234
|
-
};
|
|
235
|
-
normalized.qa = qa;
|
|
236
|
-
}
|
|
237
|
-
// Audit Configuration
|
|
238
|
-
const rawAudit = readObject(rawConfig.audit);
|
|
239
|
-
if (rawAudit) {
|
|
240
|
-
const audit = {
|
|
241
|
-
enabled: readBoolean(rawAudit.enabled) ?? DEFAULT_AUDIT.enabled,
|
|
242
|
-
schedule: readString(rawAudit.schedule) ?? DEFAULT_AUDIT.schedule,
|
|
243
|
-
maxRuntime: readNumber(rawAudit.maxRuntime) ?? DEFAULT_AUDIT.maxRuntime,
|
|
244
|
-
};
|
|
245
|
-
normalized.audit = audit;
|
|
246
|
-
}
|
|
247
|
-
return normalized;
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Parse a boolean string value
|
|
251
|
-
*/
|
|
252
|
-
function parseBoolean(value) {
|
|
253
|
-
const normalized = value.toLowerCase().trim();
|
|
254
|
-
if (normalized === "true" || normalized === "1") {
|
|
255
|
-
return true;
|
|
256
|
-
}
|
|
257
|
-
if (normalized === "false" || normalized === "0") {
|
|
258
|
-
return false;
|
|
259
|
-
}
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Validate and return a provider value
|
|
264
|
-
*/
|
|
265
|
-
function validateProvider(value) {
|
|
266
|
-
if (VALID_PROVIDERS.includes(value)) {
|
|
267
|
-
return value;
|
|
268
|
-
}
|
|
269
|
-
return null;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Validate and return a merge method value
|
|
273
|
-
*/
|
|
274
|
-
function validateMergeMethod(value) {
|
|
275
|
-
if (VALID_MERGE_METHODS.includes(value)) {
|
|
276
|
-
return value;
|
|
277
|
-
}
|
|
278
|
-
return null;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Normalize retry count to a safe positive integer.
|
|
282
|
-
*/
|
|
283
|
-
function sanitizeMaxRetries(value, fallback) {
|
|
284
|
-
if (!Number.isFinite(value)) {
|
|
285
|
-
return fallback;
|
|
286
|
-
}
|
|
287
|
-
const normalized = Math.floor(value);
|
|
288
|
-
return normalized >= 1 ? normalized : fallback;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Deep merge configuration objects
|
|
292
|
-
* Environment values take precedence over file values
|
|
293
|
-
*/
|
|
294
|
-
function mergeConfigs(base, fileConfig, envConfig) {
|
|
295
|
-
const merged = { ...base };
|
|
296
|
-
// Merge file config
|
|
297
|
-
if (fileConfig) {
|
|
298
|
-
if (fileConfig.defaultBranch !== undefined)
|
|
299
|
-
merged.defaultBranch = fileConfig.defaultBranch;
|
|
300
|
-
if (fileConfig.prdDir !== undefined)
|
|
301
|
-
merged.prdDir = fileConfig.prdDir;
|
|
302
|
-
if (fileConfig.maxRuntime !== undefined)
|
|
303
|
-
merged.maxRuntime = fileConfig.maxRuntime;
|
|
304
|
-
if (fileConfig.reviewerMaxRuntime !== undefined)
|
|
305
|
-
merged.reviewerMaxRuntime = fileConfig.reviewerMaxRuntime;
|
|
306
|
-
if (fileConfig.branchPrefix !== undefined)
|
|
307
|
-
merged.branchPrefix = fileConfig.branchPrefix;
|
|
308
|
-
if (fileConfig.branchPatterns !== undefined)
|
|
309
|
-
merged.branchPatterns = [...fileConfig.branchPatterns];
|
|
310
|
-
if (fileConfig.minReviewScore !== undefined)
|
|
311
|
-
merged.minReviewScore = fileConfig.minReviewScore;
|
|
312
|
-
if (fileConfig.maxLogSize !== undefined)
|
|
313
|
-
merged.maxLogSize = fileConfig.maxLogSize;
|
|
314
|
-
if (fileConfig.cronSchedule !== undefined)
|
|
315
|
-
merged.cronSchedule = fileConfig.cronSchedule;
|
|
316
|
-
if (fileConfig.reviewerSchedule !== undefined)
|
|
317
|
-
merged.reviewerSchedule = fileConfig.reviewerSchedule;
|
|
318
|
-
if (fileConfig.cronScheduleOffset !== undefined)
|
|
319
|
-
merged.cronScheduleOffset = fileConfig.cronScheduleOffset;
|
|
320
|
-
if (fileConfig.maxRetries !== undefined)
|
|
321
|
-
merged.maxRetries = fileConfig.maxRetries;
|
|
322
|
-
if (fileConfig.provider !== undefined)
|
|
323
|
-
merged.provider = fileConfig.provider;
|
|
324
|
-
if (fileConfig.reviewerEnabled !== undefined)
|
|
325
|
-
merged.reviewerEnabled = fileConfig.reviewerEnabled;
|
|
326
|
-
if (fileConfig.providerEnv !== undefined)
|
|
327
|
-
merged.providerEnv = { ...merged.providerEnv, ...fileConfig.providerEnv };
|
|
328
|
-
if (fileConfig.notifications !== undefined)
|
|
329
|
-
merged.notifications = fileConfig.notifications;
|
|
330
|
-
if (fileConfig.prdPriority !== undefined)
|
|
331
|
-
merged.prdPriority = [...fileConfig.prdPriority];
|
|
332
|
-
if (fileConfig.roadmapScanner !== undefined)
|
|
333
|
-
merged.roadmapScanner = { ...fileConfig.roadmapScanner };
|
|
334
|
-
if (fileConfig.templatesDir !== undefined)
|
|
335
|
-
merged.templatesDir = fileConfig.templatesDir;
|
|
336
|
-
if (fileConfig.boardProvider !== undefined)
|
|
337
|
-
merged.boardProvider = { ...merged.boardProvider, ...fileConfig.boardProvider };
|
|
338
|
-
if (fileConfig.autoMerge !== undefined)
|
|
339
|
-
merged.autoMerge = fileConfig.autoMerge;
|
|
340
|
-
if (fileConfig.autoMergeMethod !== undefined)
|
|
341
|
-
merged.autoMergeMethod = fileConfig.autoMergeMethod;
|
|
342
|
-
if (fileConfig.fallbackOnRateLimit !== undefined)
|
|
343
|
-
merged.fallbackOnRateLimit = fileConfig.fallbackOnRateLimit;
|
|
344
|
-
if (fileConfig.claudeModel !== undefined)
|
|
345
|
-
merged.claudeModel = fileConfig.claudeModel;
|
|
346
|
-
if (fileConfig.qa !== undefined)
|
|
347
|
-
merged.qa = { ...merged.qa, ...fileConfig.qa };
|
|
348
|
-
if (fileConfig.slack !== undefined)
|
|
349
|
-
merged.slack = { ...merged.slack, ...fileConfig.slack, channels: { ...merged.slack?.channels, ...fileConfig.slack.channels } };
|
|
350
|
-
}
|
|
351
|
-
// Merge env config (takes precedence)
|
|
352
|
-
if (envConfig.defaultBranch !== undefined)
|
|
353
|
-
merged.defaultBranch = envConfig.defaultBranch;
|
|
354
|
-
if (envConfig.prdDir !== undefined)
|
|
355
|
-
merged.prdDir = envConfig.prdDir;
|
|
356
|
-
if (envConfig.maxRuntime !== undefined)
|
|
357
|
-
merged.maxRuntime = envConfig.maxRuntime;
|
|
358
|
-
if (envConfig.reviewerMaxRuntime !== undefined)
|
|
359
|
-
merged.reviewerMaxRuntime = envConfig.reviewerMaxRuntime;
|
|
360
|
-
if (envConfig.branchPrefix !== undefined)
|
|
361
|
-
merged.branchPrefix = envConfig.branchPrefix;
|
|
362
|
-
if (envConfig.branchPatterns !== undefined)
|
|
363
|
-
merged.branchPatterns = [...envConfig.branchPatterns];
|
|
364
|
-
if (envConfig.minReviewScore !== undefined)
|
|
365
|
-
merged.minReviewScore = envConfig.minReviewScore;
|
|
366
|
-
if (envConfig.maxLogSize !== undefined)
|
|
367
|
-
merged.maxLogSize = envConfig.maxLogSize;
|
|
368
|
-
if (envConfig.cronSchedule !== undefined)
|
|
369
|
-
merged.cronSchedule = envConfig.cronSchedule;
|
|
370
|
-
if (envConfig.reviewerSchedule !== undefined)
|
|
371
|
-
merged.reviewerSchedule = envConfig.reviewerSchedule;
|
|
372
|
-
if (envConfig.cronScheduleOffset !== undefined)
|
|
373
|
-
merged.cronScheduleOffset = envConfig.cronScheduleOffset;
|
|
374
|
-
if (envConfig.maxRetries !== undefined)
|
|
375
|
-
merged.maxRetries = envConfig.maxRetries;
|
|
376
|
-
if (envConfig.provider !== undefined)
|
|
377
|
-
merged.provider = envConfig.provider;
|
|
378
|
-
if (envConfig.reviewerEnabled !== undefined)
|
|
379
|
-
merged.reviewerEnabled = envConfig.reviewerEnabled;
|
|
380
|
-
if (envConfig.providerEnv !== undefined)
|
|
381
|
-
merged.providerEnv = { ...merged.providerEnv, ...envConfig.providerEnv };
|
|
382
|
-
if (envConfig.notifications !== undefined)
|
|
383
|
-
merged.notifications = envConfig.notifications;
|
|
384
|
-
if (envConfig.prdPriority !== undefined)
|
|
385
|
-
merged.prdPriority = [...envConfig.prdPriority];
|
|
386
|
-
if (envConfig.roadmapScanner !== undefined)
|
|
387
|
-
merged.roadmapScanner = { ...envConfig.roadmapScanner };
|
|
388
|
-
if (envConfig.templatesDir !== undefined)
|
|
389
|
-
merged.templatesDir = envConfig.templatesDir;
|
|
390
|
-
if (envConfig.boardProvider !== undefined)
|
|
391
|
-
merged.boardProvider = { ...merged.boardProvider, ...envConfig.boardProvider };
|
|
392
|
-
if (envConfig.autoMerge !== undefined)
|
|
393
|
-
merged.autoMerge = envConfig.autoMerge;
|
|
394
|
-
if (envConfig.autoMergeMethod !== undefined)
|
|
395
|
-
merged.autoMergeMethod = envConfig.autoMergeMethod;
|
|
396
|
-
if (envConfig.fallbackOnRateLimit !== undefined)
|
|
397
|
-
merged.fallbackOnRateLimit = envConfig.fallbackOnRateLimit;
|
|
398
|
-
if (envConfig.claudeModel !== undefined)
|
|
399
|
-
merged.claudeModel = envConfig.claudeModel;
|
|
400
|
-
if (envConfig.qa !== undefined)
|
|
401
|
-
merged.qa = { ...merged.qa, ...envConfig.qa };
|
|
402
|
-
if (envConfig.slack !== undefined)
|
|
403
|
-
merged.slack = { ...merged.slack, ...envConfig.slack, channels: { ...merged.slack?.channels, ...envConfig.slack.channels } };
|
|
404
|
-
merged.maxRetries = sanitizeMaxRetries(merged.maxRetries, DEFAULT_MAX_RETRIES);
|
|
405
|
-
return merged;
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Load Night Watch configuration
|
|
409
|
-
* Priority: defaults < config file < environment variables
|
|
410
|
-
*
|
|
411
|
-
* @param projectDir - The project directory to load config from
|
|
412
|
-
* @returns Merged configuration object
|
|
413
|
-
*/
|
|
414
|
-
export function loadConfig(projectDir) {
|
|
415
|
-
// Start with defaults
|
|
416
|
-
const defaults = getDefaultConfig();
|
|
417
|
-
// Load config file
|
|
418
|
-
const configPath = path.join(projectDir, CONFIG_FILE_NAME);
|
|
419
|
-
const fileConfig = loadConfigFile(configPath);
|
|
420
|
-
// Load environment overrides
|
|
421
|
-
const envConfig = {};
|
|
422
|
-
// NW_* environment variables
|
|
423
|
-
if (process.env.NW_DEFAULT_BRANCH) {
|
|
424
|
-
envConfig.defaultBranch = process.env.NW_DEFAULT_BRANCH;
|
|
425
|
-
}
|
|
426
|
-
if (process.env.NW_PRD_DIR) {
|
|
427
|
-
envConfig.prdDir = process.env.NW_PRD_DIR;
|
|
428
|
-
}
|
|
429
|
-
if (process.env.NW_MAX_RUNTIME) {
|
|
430
|
-
const runtime = parseInt(process.env.NW_MAX_RUNTIME, 10);
|
|
431
|
-
if (!isNaN(runtime)) {
|
|
432
|
-
envConfig.maxRuntime = runtime;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
if (process.env.NW_REVIEWER_MAX_RUNTIME) {
|
|
436
|
-
const runtime = parseInt(process.env.NW_REVIEWER_MAX_RUNTIME, 10);
|
|
437
|
-
if (!isNaN(runtime)) {
|
|
438
|
-
envConfig.reviewerMaxRuntime = runtime;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
if (process.env.NW_BRANCH_PREFIX) {
|
|
442
|
-
envConfig.branchPrefix = process.env.NW_BRANCH_PREFIX;
|
|
443
|
-
}
|
|
444
|
-
if (process.env.NW_BRANCH_PATTERNS) {
|
|
445
|
-
try {
|
|
446
|
-
envConfig.branchPatterns = JSON.parse(process.env.NW_BRANCH_PATTERNS);
|
|
447
|
-
}
|
|
448
|
-
catch {
|
|
449
|
-
// If not valid JSON, treat as comma-separated
|
|
450
|
-
envConfig.branchPatterns = process.env.NW_BRANCH_PATTERNS.split(",").map((s) => s.trim());
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
if (process.env.NW_MIN_REVIEW_SCORE) {
|
|
454
|
-
const score = parseInt(process.env.NW_MIN_REVIEW_SCORE, 10);
|
|
455
|
-
if (!isNaN(score)) {
|
|
456
|
-
envConfig.minReviewScore = score;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
if (process.env.NW_MAX_LOG_SIZE) {
|
|
460
|
-
const size = parseInt(process.env.NW_MAX_LOG_SIZE, 10);
|
|
461
|
-
if (!isNaN(size)) {
|
|
462
|
-
envConfig.maxLogSize = size;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
if (process.env.NW_CRON_SCHEDULE) {
|
|
466
|
-
envConfig.cronSchedule = process.env.NW_CRON_SCHEDULE;
|
|
467
|
-
}
|
|
468
|
-
if (process.env.NW_REVIEWER_SCHEDULE) {
|
|
469
|
-
envConfig.reviewerSchedule = process.env.NW_REVIEWER_SCHEDULE;
|
|
470
|
-
}
|
|
471
|
-
if (process.env.NW_CRON_SCHEDULE_OFFSET) {
|
|
472
|
-
const offset = parseInt(process.env.NW_CRON_SCHEDULE_OFFSET, 10);
|
|
473
|
-
if (!isNaN(offset) && offset >= 0 && offset <= 59) {
|
|
474
|
-
envConfig.cronScheduleOffset = offset;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
if (process.env.NW_MAX_RETRIES) {
|
|
478
|
-
const retries = parseInt(process.env.NW_MAX_RETRIES, 10);
|
|
479
|
-
if (!isNaN(retries) && retries >= 1) {
|
|
480
|
-
envConfig.maxRetries = retries;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
// NW_PROVIDER environment variable
|
|
484
|
-
if (process.env.NW_PROVIDER) {
|
|
485
|
-
const provider = validateProvider(process.env.NW_PROVIDER);
|
|
486
|
-
if (provider !== null) {
|
|
487
|
-
envConfig.provider = provider;
|
|
488
|
-
}
|
|
489
|
-
// If invalid, fallback to default (don't set envConfig.provider)
|
|
490
|
-
}
|
|
491
|
-
// NW_REVIEWER_ENABLED environment variable
|
|
492
|
-
if (process.env.NW_REVIEWER_ENABLED) {
|
|
493
|
-
const reviewerEnabled = parseBoolean(process.env.NW_REVIEWER_ENABLED);
|
|
494
|
-
if (reviewerEnabled !== null) {
|
|
495
|
-
envConfig.reviewerEnabled = reviewerEnabled;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
// NW_NOTIFICATIONS environment variable (JSON)
|
|
499
|
-
if (process.env.NW_NOTIFICATIONS) {
|
|
500
|
-
try {
|
|
501
|
-
const parsed = JSON.parse(process.env.NW_NOTIFICATIONS);
|
|
502
|
-
if (parsed && typeof parsed === "object") {
|
|
503
|
-
envConfig.notifications = parsed;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
catch {
|
|
507
|
-
// Invalid JSON, ignore
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
// NW_ROADMAP_SCANNER_ENABLED environment variable
|
|
511
|
-
if (process.env.NW_ROADMAP_SCANNER_ENABLED) {
|
|
512
|
-
const roadmapScannerEnabled = parseBoolean(process.env.NW_ROADMAP_SCANNER_ENABLED);
|
|
513
|
-
if (roadmapScannerEnabled !== null) {
|
|
514
|
-
envConfig.roadmapScanner = {
|
|
515
|
-
...DEFAULT_ROADMAP_SCANNER,
|
|
516
|
-
enabled: roadmapScannerEnabled,
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
// NW_TEMPLATES_DIR environment variable
|
|
521
|
-
if (process.env.NW_TEMPLATES_DIR) {
|
|
522
|
-
envConfig.templatesDir = process.env.NW_TEMPLATES_DIR;
|
|
523
|
-
}
|
|
524
|
-
// NW_SLICER_SCHEDULE environment variable
|
|
525
|
-
if (process.env.NW_SLICER_SCHEDULE) {
|
|
526
|
-
envConfig.roadmapScanner = {
|
|
527
|
-
...(envConfig.roadmapScanner ?? DEFAULT_ROADMAP_SCANNER),
|
|
528
|
-
slicerSchedule: process.env.NW_SLICER_SCHEDULE,
|
|
529
|
-
};
|
|
530
|
-
}
|
|
531
|
-
// NW_SLICER_MAX_RUNTIME environment variable
|
|
532
|
-
if (process.env.NW_SLICER_MAX_RUNTIME) {
|
|
533
|
-
const slicerMaxRuntime = parseInt(process.env.NW_SLICER_MAX_RUNTIME, 10);
|
|
534
|
-
if (!isNaN(slicerMaxRuntime) && slicerMaxRuntime > 0) {
|
|
535
|
-
envConfig.roadmapScanner = {
|
|
536
|
-
...(envConfig.roadmapScanner ?? DEFAULT_ROADMAP_SCANNER),
|
|
537
|
-
slicerMaxRuntime,
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
// NW_AUTO_MERGE environment variable
|
|
542
|
-
if (process.env.NW_AUTO_MERGE) {
|
|
543
|
-
const autoMerge = parseBoolean(process.env.NW_AUTO_MERGE);
|
|
544
|
-
if (autoMerge !== null) {
|
|
545
|
-
envConfig.autoMerge = autoMerge;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
// NW_AUTO_MERGE_METHOD environment variable
|
|
549
|
-
if (process.env.NW_AUTO_MERGE_METHOD) {
|
|
550
|
-
const mergeMethod = validateMergeMethod(process.env.NW_AUTO_MERGE_METHOD);
|
|
551
|
-
if (mergeMethod !== null) {
|
|
552
|
-
envConfig.autoMergeMethod = mergeMethod;
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
// NW_FALLBACK_ON_RATE_LIMIT environment variable
|
|
556
|
-
if (process.env.NW_FALLBACK_ON_RATE_LIMIT) {
|
|
557
|
-
const fallback = parseBoolean(process.env.NW_FALLBACK_ON_RATE_LIMIT);
|
|
558
|
-
if (fallback !== null) {
|
|
559
|
-
envConfig.fallbackOnRateLimit = fallback;
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
// NW_CLAUDE_MODEL environment variable
|
|
563
|
-
if (process.env.NW_CLAUDE_MODEL) {
|
|
564
|
-
const model = process.env.NW_CLAUDE_MODEL;
|
|
565
|
-
if (VALID_CLAUDE_MODELS.includes(model)) {
|
|
566
|
-
envConfig.claudeModel = model;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
const qaBaseConfig = () => envConfig.qa ?? fileConfig?.qa ?? DEFAULT_QA;
|
|
570
|
-
// QA configuration from env vars
|
|
571
|
-
if (process.env.NW_QA_ENABLED) {
|
|
572
|
-
const qaEnabled = parseBoolean(process.env.NW_QA_ENABLED);
|
|
573
|
-
if (qaEnabled !== null) {
|
|
574
|
-
envConfig.qa = {
|
|
575
|
-
...qaBaseConfig(),
|
|
576
|
-
enabled: qaEnabled,
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
if (process.env.NW_QA_SCHEDULE) {
|
|
581
|
-
envConfig.qa = {
|
|
582
|
-
...qaBaseConfig(),
|
|
583
|
-
schedule: process.env.NW_QA_SCHEDULE,
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
if (process.env.NW_QA_MAX_RUNTIME) {
|
|
587
|
-
const qaMaxRuntime = parseInt(process.env.NW_QA_MAX_RUNTIME, 10);
|
|
588
|
-
if (!isNaN(qaMaxRuntime) && qaMaxRuntime > 0) {
|
|
589
|
-
envConfig.qa = {
|
|
590
|
-
...qaBaseConfig(),
|
|
591
|
-
maxRuntime: qaMaxRuntime,
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
if (process.env.NW_QA_ARTIFACTS) {
|
|
596
|
-
const artifacts = process.env.NW_QA_ARTIFACTS;
|
|
597
|
-
if (["screenshot", "video", "both"].includes(artifacts)) {
|
|
598
|
-
envConfig.qa = {
|
|
599
|
-
...qaBaseConfig(),
|
|
600
|
-
artifacts: artifacts,
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
if (process.env.NW_QA_SKIP_LABEL) {
|
|
605
|
-
envConfig.qa = {
|
|
606
|
-
...qaBaseConfig(),
|
|
607
|
-
skipLabel: process.env.NW_QA_SKIP_LABEL,
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
if (process.env.NW_QA_AUTO_INSTALL_PLAYWRIGHT) {
|
|
611
|
-
const autoInstall = parseBoolean(process.env.NW_QA_AUTO_INSTALL_PLAYWRIGHT);
|
|
612
|
-
if (autoInstall !== null) {
|
|
613
|
-
envConfig.qa = {
|
|
614
|
-
...qaBaseConfig(),
|
|
615
|
-
autoInstallPlaywright: autoInstall,
|
|
616
|
-
};
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
if (process.env.NW_QA_BRANCH_PATTERNS) {
|
|
620
|
-
const patterns = process.env.NW_QA_BRANCH_PATTERNS.split(",").map((s) => s.trim()).filter(Boolean);
|
|
621
|
-
if (patterns.length > 0) {
|
|
622
|
-
envConfig.qa = {
|
|
623
|
-
...qaBaseConfig(),
|
|
624
|
-
branchPatterns: patterns,
|
|
625
|
-
};
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
// Audit configuration from env vars
|
|
629
|
-
const auditBaseConfig = () => envConfig.audit ?? fileConfig?.audit ?? DEFAULT_AUDIT;
|
|
630
|
-
if (process.env.NW_AUDIT_ENABLED) {
|
|
631
|
-
const auditEnabled = parseBoolean(process.env.NW_AUDIT_ENABLED);
|
|
632
|
-
if (auditEnabled !== null) {
|
|
633
|
-
envConfig.audit = { ...auditBaseConfig(), enabled: auditEnabled };
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
if (process.env.NW_AUDIT_SCHEDULE) {
|
|
637
|
-
envConfig.audit = { ...auditBaseConfig(), schedule: process.env.NW_AUDIT_SCHEDULE };
|
|
638
|
-
}
|
|
639
|
-
if (process.env.NW_AUDIT_MAX_RUNTIME) {
|
|
640
|
-
const auditMaxRuntime = parseInt(process.env.NW_AUDIT_MAX_RUNTIME, 10);
|
|
641
|
-
if (!isNaN(auditMaxRuntime) && auditMaxRuntime > 0) {
|
|
642
|
-
envConfig.audit = { ...auditBaseConfig(), maxRuntime: auditMaxRuntime };
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
// Merge all configs
|
|
646
|
-
return mergeConfigs(defaults, fileConfig, envConfig);
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
* Get the path to a bundled script
|
|
650
|
-
* This returns the path to a script in the package's scripts/ directory
|
|
651
|
-
*/
|
|
652
|
-
export function getScriptPath(scriptName) {
|
|
653
|
-
const configFilePath = fileURLToPath(import.meta.url);
|
|
654
|
-
const baseDir = path.dirname(configFilePath);
|
|
655
|
-
const candidates = [
|
|
656
|
-
// Dev (tsx): src/config.ts -> ../scripts
|
|
657
|
-
path.resolve(baseDir, "..", "scripts", scriptName),
|
|
658
|
-
// Built package (dist/src/config.js): ../../scripts
|
|
659
|
-
path.resolve(baseDir, "..", "..", "scripts", scriptName),
|
|
660
|
-
// Fallback for unusual launch contexts
|
|
661
|
-
path.resolve(process.cwd(), "scripts", scriptName),
|
|
662
|
-
];
|
|
663
|
-
for (const candidate of candidates) {
|
|
664
|
-
if (fs.existsSync(candidate)) {
|
|
665
|
-
return candidate;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
// Return primary candidate for backward compatibility even if missing.
|
|
669
|
-
return candidates[0];
|
|
670
|
-
}
|
|
671
|
-
//# sourceMappingURL=config.js.map
|