@proletariat/cli 0.2.0 → 0.3.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/README.md +561 -251
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +23 -0
- package/dist/commands/action/create.d.ts +21 -0
- package/dist/commands/action/create.js +126 -0
- package/dist/commands/action/delete.d.ts +17 -0
- package/dist/commands/action/delete.js +78 -0
- package/dist/commands/action/index.d.ts +15 -0
- package/dist/commands/action/index.js +107 -0
- package/dist/commands/action/list.d.ts +14 -0
- package/dist/commands/action/list.js +89 -0
- package/dist/commands/action/run.d.ts +19 -0
- package/dist/commands/action/run.js +179 -0
- package/dist/commands/action/show.d.ts +15 -0
- package/dist/commands/action/show.js +47 -0
- package/dist/commands/action/update.d.ts +22 -0
- package/dist/commands/action/update.js +168 -0
- package/dist/commands/agent/index.d.ts +13 -0
- package/dist/commands/agent/index.js +131 -0
- package/dist/commands/agent/list.d.ts +7 -0
- package/dist/commands/agent/list.js +126 -0
- package/dist/commands/agent/login.d.ts +16 -0
- package/dist/commands/agent/login.js +146 -0
- package/dist/commands/agent/rebuild.d.ts +18 -0
- package/dist/commands/agent/rebuild.js +133 -0
- package/dist/commands/agent/restart.d.ts +17 -0
- package/dist/commands/agent/restart.js +116 -0
- package/dist/commands/agent/shell.d.ts +23 -0
- package/dist/commands/agent/shell.js +378 -0
- package/dist/commands/agent/staff/add.d.ts +15 -0
- package/dist/commands/agent/staff/add.js +281 -0
- package/dist/commands/agent/staff/index.d.ts +14 -0
- package/dist/commands/agent/staff/index.js +90 -0
- package/dist/commands/agent/staff/list.d.ts +7 -0
- package/dist/commands/agent/staff/list.js +90 -0
- package/dist/commands/agent/staff/remove.d.ts +16 -0
- package/dist/commands/agent/staff/remove.js +137 -0
- package/dist/commands/agent/status.d.ts +17 -0
- package/dist/commands/agent/status.js +139 -0
- package/dist/commands/agent/temp/cleanup.d.ts +23 -0
- package/dist/commands/agent/temp/cleanup.js +388 -0
- package/dist/commands/agent/temp/index.d.ts +14 -0
- package/dist/commands/agent/temp/index.js +82 -0
- package/dist/commands/agent/temp/list.d.ts +7 -0
- package/dist/commands/agent/temp/list.js +108 -0
- package/dist/commands/agent/themes/add-names.d.ts +10 -0
- package/dist/commands/agent/themes/add-names.js +67 -0
- package/dist/commands/agent/themes/create.d.ts +13 -0
- package/dist/commands/agent/themes/create.js +66 -0
- package/dist/commands/agent/themes/index.d.ts +9 -0
- package/dist/commands/agent/themes/index.js +194 -0
- package/dist/commands/agent/themes/list.d.ts +6 -0
- package/dist/commands/agent/themes/list.js +41 -0
- package/dist/commands/agent/themes/set.d.ts +12 -0
- package/dist/commands/agent/themes/set.js +77 -0
- package/dist/commands/agent/visit.d.ts +16 -0
- package/dist/commands/agent/visit.js +88 -0
- package/dist/commands/autocomplete/setup.d.ts +14 -0
- package/dist/commands/autocomplete/setup.js +154 -0
- package/dist/commands/board/index.d.ts +17 -0
- package/dist/commands/board/index.js +255 -0
- package/dist/commands/board/watch.d.ts +13 -0
- package/dist/commands/board/watch.js +52 -0
- package/dist/commands/branch/create.d.ts +50 -0
- package/dist/commands/branch/create.js +624 -0
- package/dist/commands/branch/index.d.ts +13 -0
- package/dist/commands/branch/index.js +50 -0
- package/dist/commands/branch/list.d.ts +17 -0
- package/dist/commands/branch/list.js +120 -0
- package/dist/commands/branch/validate.d.ts +15 -0
- package/dist/commands/branch/validate.js +73 -0
- package/dist/commands/commit.d.ts +71 -0
- package/dist/commands/commit.js +499 -0
- package/dist/commands/docker/clean.d.ts +13 -0
- package/dist/commands/docker/clean.js +224 -0
- package/dist/commands/docker/index.d.ts +19 -0
- package/dist/commands/docker/index.js +274 -0
- package/dist/commands/docker/list.d.ts +16 -0
- package/dist/commands/docker/list.js +200 -0
- package/dist/commands/docker/logs.d.ts +14 -0
- package/dist/commands/docker/logs.js +118 -0
- package/dist/commands/docker/prune.d.ts +14 -0
- package/dist/commands/docker/prune.js +211 -0
- package/dist/commands/docker/restart.d.ts +14 -0
- package/dist/commands/docker/restart.js +129 -0
- package/dist/commands/docker/shell.d.ts +14 -0
- package/dist/commands/docker/shell.js +103 -0
- package/dist/commands/docker/start.d.ts +12 -0
- package/dist/commands/docker/start.js +92 -0
- package/dist/commands/docker/status.d.ts +7 -0
- package/dist/commands/docker/status.js +40 -0
- package/dist/commands/docker/stop.d.ts +14 -0
- package/dist/commands/docker/stop.js +134 -0
- package/dist/commands/docker/sync.d.ts +15 -0
- package/dist/commands/docker/sync.js +112 -0
- package/dist/commands/epic/activate.d.ts +13 -0
- package/dist/commands/epic/activate.js +118 -0
- package/dist/commands/epic/archive.d.ts +14 -0
- package/dist/commands/epic/archive.js +132 -0
- package/dist/commands/epic/create.d.ts +15 -0
- package/dist/commands/epic/create.js +137 -0
- package/dist/commands/epic/index.d.ts +13 -0
- package/dist/commands/epic/index.js +88 -0
- package/dist/commands/epic/link/block.d.ts +14 -0
- package/dist/commands/epic/link/block.js +79 -0
- package/dist/commands/epic/link/duplicates.d.ts +14 -0
- package/dist/commands/epic/link/duplicates.js +66 -0
- package/dist/commands/epic/link/index.d.ts +19 -0
- package/dist/commands/epic/link/index.js +242 -0
- package/dist/commands/epic/link/relates.d.ts +14 -0
- package/dist/commands/epic/link/relates.js +66 -0
- package/dist/commands/epic/link/remove.d.ts +16 -0
- package/dist/commands/epic/link/remove.js +89 -0
- package/dist/commands/epic/list.d.ts +11 -0
- package/dist/commands/epic/list.js +87 -0
- package/dist/commands/epic/move.d.ts +15 -0
- package/dist/commands/epic/move.js +184 -0
- package/dist/commands/epic/progress.d.ts +16 -0
- package/dist/commands/epic/progress.js +166 -0
- package/dist/commands/epic/project.d.ts +15 -0
- package/dist/commands/epic/project.js +219 -0
- package/dist/commands/epic/reorder.d.ts +21 -0
- package/dist/commands/epic/reorder.js +160 -0
- package/dist/commands/epic/spec.d.ts +15 -0
- package/dist/commands/epic/spec.js +191 -0
- package/dist/commands/epic/ticket.d.ts +18 -0
- package/dist/commands/epic/ticket.js +291 -0
- package/dist/commands/epic/view.d.ts +13 -0
- package/dist/commands/epic/view.js +117 -0
- package/dist/commands/execution/index.d.ts +13 -0
- package/dist/commands/execution/index.js +70 -0
- package/dist/commands/execution/list.d.ts +15 -0
- package/dist/commands/execution/list.js +144 -0
- package/dist/commands/execution/logs.d.ts +18 -0
- package/dist/commands/execution/logs.js +161 -0
- package/dist/commands/execution/stop.d.ts +22 -0
- package/dist/commands/execution/stop.js +248 -0
- package/dist/commands/gh/index.d.ts +9 -0
- package/dist/commands/gh/index.js +53 -0
- package/dist/commands/gh/login.d.ts +6 -0
- package/dist/commands/gh/login.js +57 -0
- package/dist/commands/gh/status.d.ts +6 -0
- package/dist/commands/gh/status.js +48 -0
- package/dist/commands/gh/token.d.ts +6 -0
- package/dist/commands/gh/token.js +59 -0
- package/dist/commands/init.d.ts +26 -0
- package/dist/commands/init.js +200 -0
- package/dist/commands/phase/create.d.ts +22 -0
- package/dist/commands/phase/create.js +123 -0
- package/dist/commands/phase/delete.d.ts +17 -0
- package/dist/commands/phase/delete.js +73 -0
- package/dist/commands/phase/list.d.ts +12 -0
- package/dist/commands/phase/list.js +76 -0
- package/dist/commands/phase/move.d.ts +17 -0
- package/dist/commands/phase/move.js +115 -0
- package/dist/commands/phase/template/apply.d.ts +17 -0
- package/dist/commands/phase/template/apply.js +106 -0
- package/dist/commands/phase/template/create.d.ts +16 -0
- package/dist/commands/phase/template/create.js +58 -0
- package/dist/commands/phase/template/delete.d.ts +17 -0
- package/dist/commands/phase/template/delete.js +98 -0
- package/dist/commands/phase/template/index.d.ts +15 -0
- package/dist/commands/phase/template/index.js +128 -0
- package/dist/commands/phase/template/list.d.ts +16 -0
- package/dist/commands/phase/template/list.js +95 -0
- package/dist/commands/phase/template/update.d.ts +17 -0
- package/dist/commands/phase/template/update.js +89 -0
- package/dist/commands/phase/update.d.ts +23 -0
- package/dist/commands/phase/update.js +174 -0
- package/dist/commands/pmo/init.d.ts +25 -0
- package/dist/commands/pmo/init.js +341 -0
- package/dist/commands/pr/create.d.ts +17 -0
- package/dist/commands/pr/create.js +242 -0
- package/dist/commands/pr/index.d.ts +9 -0
- package/dist/commands/pr/index.js +68 -0
- package/dist/commands/pr/link.d.ts +14 -0
- package/dist/commands/pr/link.js +212 -0
- package/dist/commands/pr/status.d.ts +12 -0
- package/dist/commands/pr/status.js +161 -0
- package/dist/commands/project/archive.d.ts +17 -0
- package/dist/commands/project/archive.js +83 -0
- package/dist/commands/project/create.d.ts +22 -0
- package/dist/commands/project/create.js +143 -0
- package/dist/commands/project/delete.d.ts +17 -0
- package/dist/commands/project/delete.js +128 -0
- package/dist/commands/project/index.d.ts +13 -0
- package/dist/commands/project/index.js +64 -0
- package/dist/commands/project/list.d.ts +14 -0
- package/dist/commands/project/list.js +96 -0
- package/dist/commands/project/spec.d.ts +18 -0
- package/dist/commands/project/spec.js +216 -0
- package/dist/commands/project/unarchive.d.ts +15 -0
- package/dist/commands/project/unarchive.js +35 -0
- package/dist/commands/project/view.d.ts +16 -0
- package/dist/commands/project/view.js +94 -0
- package/dist/commands/repo/add.d.ts +21 -0
- package/dist/commands/repo/add.js +118 -0
- package/dist/commands/repo/index.d.ts +13 -0
- package/dist/commands/repo/index.js +114 -0
- package/dist/commands/repo/list.d.ts +13 -0
- package/dist/commands/repo/list.js +96 -0
- package/dist/commands/repo/remove.d.ts +23 -0
- package/dist/commands/repo/remove.js +217 -0
- package/dist/commands/repo/view.d.ts +15 -0
- package/dist/commands/repo/view.js +99 -0
- package/dist/commands/session/attach.d.ts +40 -0
- package/dist/commands/session/attach.js +307 -0
- package/dist/commands/session/index.d.ts +13 -0
- package/dist/commands/session/index.js +64 -0
- package/dist/commands/session/list.d.ts +21 -0
- package/dist/commands/session/list.js +181 -0
- package/dist/commands/spec/create.d.ts +19 -0
- package/dist/commands/spec/create.js +130 -0
- package/dist/commands/spec/index.d.ts +13 -0
- package/dist/commands/spec/index.js +68 -0
- package/dist/commands/spec/link/depends.d.ts +14 -0
- package/dist/commands/spec/link/depends.js +64 -0
- package/dist/commands/spec/link/duplicates.d.ts +14 -0
- package/dist/commands/spec/link/duplicates.js +63 -0
- package/dist/commands/spec/link/index.d.ts +19 -0
- package/dist/commands/spec/link/index.js +200 -0
- package/dist/commands/spec/link/relates.d.ts +14 -0
- package/dist/commands/spec/link/relates.js +63 -0
- package/dist/commands/spec/link/remove.d.ts +16 -0
- package/dist/commands/spec/link/remove.js +94 -0
- package/dist/commands/spec/list.d.ts +12 -0
- package/dist/commands/spec/list.js +75 -0
- package/dist/commands/spec/plan.d.ts +15 -0
- package/dist/commands/spec/plan.js +108 -0
- package/dist/commands/spec/ticket.d.ts +18 -0
- package/dist/commands/spec/ticket.js +160 -0
- package/dist/commands/spec/view.d.ts +15 -0
- package/dist/commands/spec/view.js +163 -0
- package/dist/commands/status/create.d.ts +21 -0
- package/dist/commands/status/create.js +140 -0
- package/dist/commands/status/delete.d.ts +13 -0
- package/dist/commands/status/delete.js +77 -0
- package/dist/commands/status/index.d.ts +14 -0
- package/dist/commands/status/index.js +91 -0
- package/dist/commands/status/list.d.ts +12 -0
- package/dist/commands/status/list.js +93 -0
- package/dist/commands/status/move.d.ts +14 -0
- package/dist/commands/status/move.js +120 -0
- package/dist/commands/status/update.d.ts +20 -0
- package/dist/commands/status/update.js +180 -0
- package/dist/commands/template/delete.d.ts +15 -0
- package/dist/commands/template/delete.js +142 -0
- package/dist/commands/template/index.d.ts +10 -0
- package/dist/commands/template/index.js +64 -0
- package/dist/commands/template/list.d.ts +18 -0
- package/dist/commands/template/list.js +157 -0
- package/dist/commands/template/phase/apply.d.ts +14 -0
- package/dist/commands/template/phase/apply.js +41 -0
- package/dist/commands/template/phase/create.d.ts +12 -0
- package/dist/commands/template/phase/create.js +29 -0
- package/dist/commands/template/phase/delete.d.ts +13 -0
- package/dist/commands/template/phase/delete.js +34 -0
- package/dist/commands/template/phase/index.d.ts +10 -0
- package/dist/commands/template/phase/index.js +62 -0
- package/dist/commands/template/phase/list.d.ts +11 -0
- package/dist/commands/template/phase/list.js +34 -0
- package/dist/commands/template/phase/update.d.ts +13 -0
- package/dist/commands/template/phase/update.js +35 -0
- package/dist/commands/template/ticket/apply.d.ts +17 -0
- package/dist/commands/template/ticket/apply.js +58 -0
- package/dist/commands/template/ticket/delete.d.ts +13 -0
- package/dist/commands/template/ticket/delete.js +34 -0
- package/dist/commands/template/ticket/index.d.ts +10 -0
- package/dist/commands/template/ticket/index.js +62 -0
- package/dist/commands/template/ticket/list.d.ts +11 -0
- package/dist/commands/template/ticket/list.js +34 -0
- package/dist/commands/template/ticket/save.d.ts +13 -0
- package/dist/commands/template/ticket/save.js +35 -0
- package/dist/commands/ticket/bulk.d.ts +13 -0
- package/dist/commands/ticket/bulk.js +145 -0
- package/dist/commands/ticket/complete.d.ts +16 -0
- package/dist/commands/ticket/complete.js +170 -0
- package/dist/commands/ticket/create.d.ts +22 -0
- package/dist/commands/ticket/create.js +390 -0
- package/dist/commands/ticket/delete.d.ts +16 -0
- package/dist/commands/ticket/delete.js +178 -0
- package/dist/commands/ticket/edit.d.ts +27 -0
- package/dist/commands/ticket/edit.js +322 -0
- package/dist/commands/ticket/epic.d.ts +20 -0
- package/dist/commands/ticket/epic.js +333 -0
- package/dist/commands/ticket/index.d.ts +13 -0
- package/dist/commands/ticket/index.js +103 -0
- package/dist/commands/ticket/link/block.d.ts +14 -0
- package/dist/commands/ticket/link/block.js +94 -0
- package/dist/commands/ticket/link/duplicates.d.ts +14 -0
- package/dist/commands/ticket/link/duplicates.js +93 -0
- package/dist/commands/ticket/link/index.d.ts +19 -0
- package/dist/commands/ticket/link/index.js +239 -0
- package/dist/commands/ticket/link/relates.d.ts +14 -0
- package/dist/commands/ticket/link/relates.js +93 -0
- package/dist/commands/ticket/link/remove.d.ts +16 -0
- package/dist/commands/ticket/link/remove.js +128 -0
- package/dist/commands/ticket/list.d.ts +24 -0
- package/dist/commands/ticket/list.js +431 -0
- package/dist/commands/ticket/move.d.ts +18 -0
- package/dist/commands/ticket/move.js +212 -0
- package/dist/commands/ticket/project.d.ts +18 -0
- package/dist/commands/ticket/project.js +254 -0
- package/dist/commands/ticket/reassign.d.ts +19 -0
- package/dist/commands/ticket/reassign.js +279 -0
- package/dist/commands/ticket/spec.d.ts +18 -0
- package/dist/commands/ticket/spec.js +259 -0
- package/dist/commands/ticket/status.d.ts +13 -0
- package/dist/commands/ticket/status.js +87 -0
- package/dist/commands/ticket/template/apply.d.ts +25 -0
- package/dist/commands/ticket/template/apply.js +249 -0
- package/dist/commands/ticket/template/create.d.ts +19 -0
- package/dist/commands/ticket/template/create.js +210 -0
- package/dist/commands/ticket/template/delete.d.ts +17 -0
- package/dist/commands/ticket/template/delete.js +92 -0
- package/dist/commands/ticket/template/index.d.ts +15 -0
- package/dist/commands/ticket/template/index.js +118 -0
- package/dist/commands/ticket/template/list.d.ts +16 -0
- package/dist/commands/ticket/template/list.js +110 -0
- package/dist/commands/ticket/template/save.d.ts +14 -0
- package/dist/commands/ticket/template/save.js +110 -0
- package/dist/commands/ticket/update.d.ts +18 -0
- package/dist/commands/ticket/update.js +325 -0
- package/dist/commands/ticket/view.d.ts +13 -0
- package/dist/commands/ticket/view.js +80 -0
- package/dist/commands/whoami.d.ts +9 -0
- package/dist/commands/whoami.js +103 -0
- package/dist/commands/work/complete.d.ts +13 -0
- package/dist/commands/work/complete.js +121 -0
- package/dist/commands/work/index.d.ts +13 -0
- package/dist/commands/work/index.js +70 -0
- package/dist/commands/work/ready.d.ts +24 -0
- package/dist/commands/work/ready.js +290 -0
- package/dist/commands/work/revise.d.ts +19 -0
- package/dist/commands/work/revise.js +377 -0
- package/dist/commands/work/spawn-all.d.ts +17 -0
- package/dist/commands/work/spawn-all.js +58 -0
- package/dist/commands/work/spawn.d.ts +29 -0
- package/dist/commands/work/spawn.js +728 -0
- package/dist/commands/work/start.d.ts +39 -0
- package/dist/commands/work/start.js +1393 -0
- package/dist/commands/work/watch.d.ts +31 -0
- package/dist/commands/work/watch.js +359 -0
- package/dist/commands/workflow/create.d.ts +18 -0
- package/dist/commands/workflow/create.js +119 -0
- package/dist/commands/workflow/delete.d.ts +17 -0
- package/dist/commands/workflow/delete.js +119 -0
- package/dist/commands/workflow/index.d.ts +15 -0
- package/dist/commands/workflow/index.js +75 -0
- package/dist/commands/workflow/list.d.ts +15 -0
- package/dist/commands/workflow/list.js +75 -0
- package/dist/commands/workflow/switch.d.ts +13 -0
- package/dist/commands/workflow/switch.js +117 -0
- package/dist/commands/workflow/view.d.ts +16 -0
- package/dist/commands/workflow/view.js +114 -0
- package/dist/commands/workspace/add.d.ts +12 -0
- package/dist/commands/workspace/add.js +74 -0
- package/dist/commands/workspace/list.d.ts +9 -0
- package/dist/commands/workspace/list.js +153 -0
- package/dist/commands/workspace/remove.d.ts +13 -0
- package/dist/commands/workspace/remove.js +98 -0
- package/dist/commands/workspace/use.d.ts +12 -0
- package/dist/commands/workspace/use.js +111 -0
- package/dist/hooks/init.d.ts +11 -0
- package/dist/hooks/init.js +57 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/agents/commands.d.ts +189 -0
- package/dist/lib/agents/commands.js +893 -0
- package/dist/lib/agents/index.d.ts +54 -0
- package/dist/lib/agents/index.js +382 -0
- package/dist/lib/branch/index.d.ts +120 -0
- package/dist/lib/branch/index.js +334 -0
- package/dist/lib/colors.d.ts +94 -0
- package/dist/lib/colors.js +68 -0
- package/dist/lib/commands/docker-command.d.ts +21 -0
- package/dist/lib/commands/docker-command.js +27 -0
- package/dist/lib/database/index.d.ts +176 -0
- package/dist/lib/database/index.js +581 -0
- package/dist/lib/docker/resolve.d.ts +38 -0
- package/dist/lib/docker/resolve.js +175 -0
- package/dist/lib/execution/config.d.ts +150 -0
- package/dist/lib/execution/config.js +541 -0
- package/dist/lib/execution/devcontainer.d.ts +85 -0
- package/dist/lib/execution/devcontainer.js +594 -0
- package/dist/lib/execution/index.d.ts +10 -0
- package/dist/lib/execution/index.js +10 -0
- package/dist/lib/execution/runners.d.ts +53 -0
- package/dist/lib/execution/runners.js +1182 -0
- package/dist/lib/execution/spawner.d.ts +85 -0
- package/dist/lib/execution/spawner.js +548 -0
- package/dist/lib/execution/storage.d.ts +159 -0
- package/dist/lib/execution/storage.js +425 -0
- package/dist/lib/execution/types.d.ts +145 -0
- package/dist/lib/execution/types.js +157 -0
- package/dist/lib/init/index.d.ts +75 -0
- package/dist/lib/init/index.js +355 -0
- package/dist/lib/machine-config.d.ts +170 -0
- package/dist/lib/machine-config.js +386 -0
- package/dist/lib/pmo/base-command.d.ts +195 -0
- package/dist/lib/pmo/base-command.js +319 -0
- package/dist/lib/pmo/create-spec-folders.d.ts +43 -0
- package/dist/lib/pmo/create-spec-folders.js +64 -0
- package/dist/lib/pmo/epic-files.d.ts +56 -0
- package/dist/lib/pmo/epic-files.js +195 -0
- package/dist/lib/pmo/find-pmo.d.ts +14 -0
- package/dist/lib/pmo/find-pmo.js +172 -0
- package/dist/lib/pmo/index.d.ts +109 -0
- package/dist/lib/pmo/index.js +501 -0
- package/dist/lib/pmo/markdown.d.ts +31 -0
- package/dist/lib/pmo/markdown.js +245 -0
- package/dist/lib/pmo/pmo-context.d.ts +27 -0
- package/dist/lib/pmo/pmo-context.js +44 -0
- package/dist/lib/pmo/schema.d.ts +82 -0
- package/dist/lib/pmo/schema.js +531 -0
- package/dist/lib/pmo/spec-parser.d.ts +25 -0
- package/dist/lib/pmo/spec-parser.js +205 -0
- package/dist/lib/pmo/spec-types.d.ts +43 -0
- package/dist/lib/pmo/spec-types.js +7 -0
- package/dist/lib/pmo/storage/actions.d.ts +34 -0
- package/dist/lib/pmo/storage/actions.js +177 -0
- package/dist/lib/pmo/storage/base.d.ts +47 -0
- package/dist/lib/pmo/storage/base.js +858 -0
- package/dist/lib/pmo/storage/dependencies.d.ts +61 -0
- package/dist/lib/pmo/storage/dependencies.js +267 -0
- package/dist/lib/pmo/storage/epics.d.ts +46 -0
- package/dist/lib/pmo/storage/epics.js +243 -0
- package/dist/lib/pmo/storage/helpers.d.ts +33 -0
- package/dist/lib/pmo/storage/helpers.js +148 -0
- package/dist/lib/pmo/storage/index.d.ts +186 -0
- package/dist/lib/pmo/storage/index.js +689 -0
- package/dist/lib/pmo/storage/phases.d.ts +65 -0
- package/dist/lib/pmo/storage/phases.js +392 -0
- package/dist/lib/pmo/storage/projects.d.ts +79 -0
- package/dist/lib/pmo/storage/projects.js +303 -0
- package/dist/lib/pmo/storage/specs.d.ts +77 -0
- package/dist/lib/pmo/storage/specs.js +389 -0
- package/dist/lib/pmo/storage/statuses.d.ts +63 -0
- package/dist/lib/pmo/storage/statuses.js +404 -0
- package/dist/lib/pmo/storage/subtasks.d.ts +37 -0
- package/dist/lib/pmo/storage/subtasks.js +184 -0
- package/dist/lib/pmo/storage/templates.d.ts +40 -0
- package/dist/lib/pmo/storage/templates.js +210 -0
- package/dist/lib/pmo/storage/tickets.d.ts +57 -0
- package/dist/lib/pmo/storage/tickets.js +453 -0
- package/dist/lib/pmo/storage/types.d.ts +200 -0
- package/dist/lib/pmo/storage/types.js +5 -0
- package/dist/lib/pmo/storage/views.d.ts +44 -0
- package/dist/lib/pmo/storage/views.js +355 -0
- package/dist/lib/pmo/storage-sqlite.d.ts +7 -0
- package/dist/lib/pmo/storage-sqlite.js +7 -0
- package/dist/lib/pmo/sync-manager.d.ts +92 -0
- package/dist/lib/pmo/sync-manager.js +229 -0
- package/dist/lib/pmo/types.d.ts +710 -0
- package/dist/lib/pmo/types.js +108 -0
- package/dist/lib/pmo/utils.d.ts +122 -0
- package/dist/lib/pmo/utils.js +174 -0
- package/dist/lib/pmo/watcher.d.ts +43 -0
- package/dist/lib/pmo/watcher.js +208 -0
- package/dist/lib/pr/index.d.ts +150 -0
- package/dist/lib/pr/index.js +483 -0
- package/dist/lib/prompt-json.d.ts +231 -0
- package/dist/lib/prompt-json.js +213 -0
- package/dist/lib/repos/index.d.ts +81 -0
- package/dist/lib/repos/index.js +679 -0
- package/dist/lib/styles.d.ts +98 -0
- package/dist/lib/styles.js +195 -0
- package/dist/lib/themes.d.ts +128 -0
- package/dist/lib/themes.js +301 -0
- package/dist/lib/ui/BoardUI.d.ts +21 -0
- package/dist/lib/ui/BoardUI.js +85 -0
- package/dist/lib/ui/ClaimTicketUI.d.ts +17 -0
- package/dist/lib/ui/ClaimTicketUI.js +64 -0
- package/dist/lib/ui/CreateTicketUI.d.ts +13 -0
- package/dist/lib/ui/CreateTicketUI.js +101 -0
- package/dist/lib/workspace.d.ts +66 -0
- package/dist/lib/workspace.js +204 -0
- package/oclif.manifest.json +10593 -0
- package/package.json +103 -56
- package/LICENSE +0 -21
- package/dist/bin/prlt.d.ts +0 -11
- package/dist/bin/prlt.d.ts.map +0 -1
- package/dist/bin/prlt.js +0 -144
- package/dist/bin/prlt.js.map +0 -1
- package/dist/lib/config/index.d.ts +0 -14
- package/dist/lib/config/index.d.ts.map +0 -1
- package/dist/lib/config/index.js +0 -142
- package/dist/lib/config/index.js.map +0 -1
- package/dist/lib/config/upgrade.d.ts +0 -2
- package/dist/lib/config/upgrade.d.ts.map +0 -1
- package/dist/lib/config/upgrade.js +0 -248
- package/dist/lib/config/upgrade.js.map +0 -1
- package/dist/lib/themes/index.d.ts +0 -8
- package/dist/lib/themes/index.d.ts.map +0 -1
- package/dist/lib/themes/index.js +0 -80
- package/dist/lib/themes/index.js.map +0 -1
- package/dist/lib/utils/helpers.d.ts +0 -4
- package/dist/lib/utils/helpers.d.ts.map +0 -1
- package/dist/lib/utils/helpers.js +0 -39
- package/dist/lib/utils/helpers.js.map +0 -1
- package/dist/lib/utils/logger.d.ts +0 -4
- package/dist/lib/utils/logger.d.ts.map +0 -1
- package/dist/lib/utils/logger.js +0 -28
- package/dist/lib/utils/logger.js.map +0 -1
- package/dist/lib/workspace/index.d.ts +0 -13
- package/dist/lib/workspace/index.d.ts.map +0 -1
- package/dist/lib/workspace/index.js +0 -116
- package/dist/lib/workspace/index.js.map +0 -1
- package/dist/lib/worktree/index.d.ts +0 -7
- package/dist/lib/worktree/index.d.ts.map +0 -1
- package/dist/lib/worktree/index.js +0 -362
- package/dist/lib/worktree/index.js.map +0 -1
- package/dist/lib/worktree/migrate.d.ts +0 -2
- package/dist/lib/worktree/migrate.d.ts.map +0 -1
- package/dist/lib/worktree/migrate.js +0 -214
- package/dist/lib/worktree/migrate.js.map +0 -1
- package/dist/lib/worktree/repair.d.ts +0 -3
- package/dist/lib/worktree/repair.d.ts.map +0 -1
- package/dist/lib/worktree/repair.js +0 -320
- package/dist/lib/worktree/repair.js.map +0 -1
- package/dist/types/index.d.ts +0 -57
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
|
@@ -0,0 +1,858 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base storage module with database initialization, migrations, and seeding.
|
|
3
|
+
* This module handles database setup and provides shared utilities.
|
|
4
|
+
*/
|
|
5
|
+
import { PMO_TABLES, PMO_SCHEMA_SQL, validateTicketSchema } from '../schema.js';
|
|
6
|
+
const T = PMO_TABLES;
|
|
7
|
+
/**
|
|
8
|
+
* Initialize PMO tables in the database.
|
|
9
|
+
* Runs migrations, creates tables, seeds built-in data, and validates schema.
|
|
10
|
+
*/
|
|
11
|
+
export function initializePMOTables(db) {
|
|
12
|
+
runMigrations(db);
|
|
13
|
+
db.exec(PMO_SCHEMA_SQL);
|
|
14
|
+
seedBuiltinWorkflows(db); // Workflows are the source of truth for status configurations
|
|
15
|
+
seedBuiltinPhases(db);
|
|
16
|
+
seedBuiltinPhaseTemplates(db);
|
|
17
|
+
seedBuiltinActions(db);
|
|
18
|
+
seedBuiltinTicketTemplates(db);
|
|
19
|
+
validateTicketSchema(db);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Run schema migrations for existing databases.
|
|
23
|
+
*/
|
|
24
|
+
export function runMigrations(db) {
|
|
25
|
+
const tableExists = (name) => {
|
|
26
|
+
const result = db.prepare(`
|
|
27
|
+
SELECT name FROM sqlite_master WHERE type='table' AND name=?
|
|
28
|
+
`).get(name);
|
|
29
|
+
return !!result;
|
|
30
|
+
};
|
|
31
|
+
if (!tableExists(T.tickets) || !tableExists(T.specs) || !tableExists(T.projects)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// Migration: Update specs table to new simplified schema
|
|
35
|
+
if (tableExists(T.specs)) {
|
|
36
|
+
const specsColumns = db.pragma(`table_info(${T.specs})`);
|
|
37
|
+
const specsColumnNames = new Set(specsColumns.map(c => c.name));
|
|
38
|
+
const newColumns = [
|
|
39
|
+
{ name: 'type', sql: 'type TEXT' },
|
|
40
|
+
{ name: 'tags', sql: 'tags TEXT' },
|
|
41
|
+
{ name: 'depends_on', sql: 'depends_on TEXT' },
|
|
42
|
+
{ name: 'problem', sql: 'problem TEXT' },
|
|
43
|
+
{ name: 'solution', sql: 'solution TEXT' },
|
|
44
|
+
{ name: 'decisions', sql: 'decisions TEXT' },
|
|
45
|
+
{ name: 'not_now', sql: 'not_now TEXT' },
|
|
46
|
+
{ name: 'ui_ux', sql: 'ui_ux TEXT' },
|
|
47
|
+
{ name: 'acceptance_criteria', sql: 'acceptance_criteria TEXT' },
|
|
48
|
+
{ name: 'open_questions', sql: 'open_questions TEXT' },
|
|
49
|
+
{ name: 'requirements_functional', sql: 'requirements_functional TEXT' },
|
|
50
|
+
{ name: 'requirements_technical', sql: 'requirements_technical TEXT' },
|
|
51
|
+
{ name: 'context', sql: 'context TEXT' },
|
|
52
|
+
];
|
|
53
|
+
for (const col of newColumns) {
|
|
54
|
+
if (!specsColumnNames.has(col.name)) {
|
|
55
|
+
try {
|
|
56
|
+
db.exec(`ALTER TABLE ${T.specs} ADD COLUMN ${col.sql}`);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// Column may already exist
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Migration: Add status_id column to tickets table
|
|
65
|
+
const ticketsColumns = db.pragma(`table_info(${T.tickets})`);
|
|
66
|
+
const ticketsColumnNames = new Set(ticketsColumns.map(c => c.name));
|
|
67
|
+
if (!ticketsColumnNames.has('status_id')) {
|
|
68
|
+
try {
|
|
69
|
+
db.exec(`ALTER TABLE ${T.tickets} ADD COLUMN status_id TEXT`);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// Column may already exist
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Migration: Add status and target_date columns to projects table
|
|
76
|
+
const projectsColumns = db.pragma(`table_info(${T.projects})`);
|
|
77
|
+
const projectsColumnNames = new Set(projectsColumns.map(c => c.name));
|
|
78
|
+
if (!projectsColumnNames.has('status')) {
|
|
79
|
+
try {
|
|
80
|
+
db.exec(`ALTER TABLE ${T.projects} ADD COLUMN status TEXT NOT NULL DEFAULT 'active'`);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// Column may already exist
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!projectsColumnNames.has('target_date')) {
|
|
87
|
+
try {
|
|
88
|
+
db.exec(`ALTER TABLE ${T.projects} ADD COLUMN target_date TIMESTAMP`);
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
// Column may already exist
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (!projectsColumnNames.has('phase_id')) {
|
|
95
|
+
try {
|
|
96
|
+
db.exec(`ALTER TABLE ${T.projects} ADD COLUMN phase_id TEXT`);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// Column may already exist
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (!projectsColumnNames.has('is_archived')) {
|
|
103
|
+
try {
|
|
104
|
+
db.exec(`ALTER TABLE ${T.projects} ADD COLUMN is_archived INTEGER NOT NULL DEFAULT 0`);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// Column may already exist
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Migration: Add branch column to tickets table
|
|
111
|
+
if (!ticketsColumnNames.has('branch')) {
|
|
112
|
+
try {
|
|
113
|
+
db.exec(`ALTER TABLE ${T.tickets} ADD COLUMN branch TEXT`);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// Column may already exist
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Migration: Add position column to actions table
|
|
120
|
+
if (tableExists(T.actions)) {
|
|
121
|
+
const actionsColumns = db.pragma(`table_info(${T.actions})`);
|
|
122
|
+
const actionsColumnNames = actionsColumns.map(c => c.name);
|
|
123
|
+
if (!actionsColumnNames.includes('position')) {
|
|
124
|
+
try {
|
|
125
|
+
db.exec(`ALTER TABLE ${T.actions} ADD COLUMN position INTEGER NOT NULL DEFAULT 0`);
|
|
126
|
+
const positionMap = {
|
|
127
|
+
groom: 0, implement: 1, continue: 2, test: 3, review: 4, revise: 5
|
|
128
|
+
};
|
|
129
|
+
for (const [id, pos] of Object.entries(positionMap)) {
|
|
130
|
+
db.prepare(`UPDATE ${T.actions} SET position = ? WHERE id = ?`).run(pos, id);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// Column may already exist
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (!actionsColumnNames.includes('end_prompt')) {
|
|
138
|
+
try {
|
|
139
|
+
db.exec(`ALTER TABLE ${T.actions} ADD COLUMN end_prompt TEXT`);
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
// Column may already exist
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Migration: Add labels column to tickets table
|
|
147
|
+
if (!ticketsColumnNames.has('labels')) {
|
|
148
|
+
try {
|
|
149
|
+
db.exec(`ALTER TABLE ${T.tickets} ADD COLUMN labels TEXT NOT NULL DEFAULT '[]'`);
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
// Column may already exist
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Migration: Add new columns to ticket_templates table
|
|
156
|
+
if (tableExists(T.ticket_templates)) {
|
|
157
|
+
const templateColumns = db.pragma(`table_info(${T.ticket_templates})`);
|
|
158
|
+
const templateColumnNames = new Set(templateColumns.map(c => c.name));
|
|
159
|
+
const newTemplateColumns = [
|
|
160
|
+
{ name: 'default_status_id', sql: 'default_status_id TEXT' },
|
|
161
|
+
{ name: 'default_assignee', sql: 'default_assignee TEXT' },
|
|
162
|
+
{ name: 'default_owner', sql: 'default_owner TEXT' },
|
|
163
|
+
{ name: 'default_labels', sql: "default_labels TEXT NOT NULL DEFAULT '[]'" },
|
|
164
|
+
];
|
|
165
|
+
for (const col of newTemplateColumns) {
|
|
166
|
+
if (!templateColumnNames.has(col.name)) {
|
|
167
|
+
try {
|
|
168
|
+
db.exec(`ALTER TABLE ${T.ticket_templates} ADD COLUMN ${col.sql}`);
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
// Column may already exist
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// Migration: Convert legacy priority values (URGENT/HIGH/MEDIUM/LOW) to P0-P3
|
|
177
|
+
if (tableExists(T.tickets)) {
|
|
178
|
+
try {
|
|
179
|
+
// Convert ticket priorities
|
|
180
|
+
db.exec(`UPDATE ${T.tickets} SET priority = 'P0' WHERE priority = 'URGENT'`);
|
|
181
|
+
db.exec(`UPDATE ${T.tickets} SET priority = 'P1' WHERE priority = 'HIGH'`);
|
|
182
|
+
db.exec(`UPDATE ${T.tickets} SET priority = 'P2' WHERE priority = 'MEDIUM'`);
|
|
183
|
+
db.exec(`UPDATE ${T.tickets} SET priority = 'P3' WHERE priority = 'LOW'`);
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
// Ignore errors if migration already ran
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Migration: Convert legacy priority values in ticket templates
|
|
190
|
+
if (tableExists(T.ticket_templates)) {
|
|
191
|
+
try {
|
|
192
|
+
db.exec(`UPDATE ${T.ticket_templates} SET default_priority = 'P0' WHERE default_priority = 'URGENT'`);
|
|
193
|
+
db.exec(`UPDATE ${T.ticket_templates} SET default_priority = 'P1' WHERE default_priority = 'HIGH'`);
|
|
194
|
+
db.exec(`UPDATE ${T.ticket_templates} SET default_priority = 'P2' WHERE default_priority = 'MEDIUM'`);
|
|
195
|
+
db.exec(`UPDATE ${T.ticket_templates} SET default_priority = 'P3' WHERE default_priority = 'LOW'`);
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
// Ignore errors if migration already ran
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Migration: Add workflow_id column to projects table
|
|
202
|
+
if (!projectsColumnNames.has('workflow_id')) {
|
|
203
|
+
try {
|
|
204
|
+
db.exec(`ALTER TABLE ${T.projects} ADD COLUMN workflow_id TEXT`);
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
// Column may already exist
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// Migration: Drop pmo_templates table (workflows are now used directly)
|
|
211
|
+
if (tableExists('pmo_templates')) {
|
|
212
|
+
try {
|
|
213
|
+
db.exec('DROP TABLE pmo_templates');
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
// Table may already be dropped
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Seed built-in workflows (shared workflow definitions).
|
|
222
|
+
* Creates workflows from existing templates for reuse across projects.
|
|
223
|
+
*/
|
|
224
|
+
export function seedBuiltinWorkflows(db) {
|
|
225
|
+
// Define built-in workflows based on the template definitions
|
|
226
|
+
const builtinWorkflows = [
|
|
227
|
+
{
|
|
228
|
+
id: 'default',
|
|
229
|
+
name: 'Default',
|
|
230
|
+
description: 'Default workflow: Backlog → Ready → In Progress → Review → Done',
|
|
231
|
+
statuses: [
|
|
232
|
+
{ name: 'Backlog', category: 'backlog', position: 0, isDefault: true },
|
|
233
|
+
{ name: 'Ready', category: 'unstarted', position: 1 },
|
|
234
|
+
{ name: 'In Progress', category: 'started', position: 2 },
|
|
235
|
+
{ name: 'Review', category: 'started', position: 3 },
|
|
236
|
+
{ name: 'Done', category: 'completed', position: 4 },
|
|
237
|
+
],
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: 'kanban',
|
|
241
|
+
name: 'Kanban',
|
|
242
|
+
description: 'Simple kanban workflow: Backlog → To Do → In Progress → Done',
|
|
243
|
+
statuses: [
|
|
244
|
+
{ name: 'Backlog', category: 'backlog', position: 0, isDefault: true },
|
|
245
|
+
{ name: 'To Do', category: 'unstarted', position: 1 },
|
|
246
|
+
{ name: 'In Progress', category: 'started', position: 2 },
|
|
247
|
+
{ name: 'Done', category: 'completed', position: 3 },
|
|
248
|
+
{ name: 'Canceled', category: 'canceled', position: 4 },
|
|
249
|
+
],
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
id: 'linear',
|
|
253
|
+
name: 'Linear',
|
|
254
|
+
description: 'Linear-style workflow with backlog, triage, and review stages',
|
|
255
|
+
statuses: [
|
|
256
|
+
{ name: 'Backlog', category: 'backlog', position: 0, isDefault: true },
|
|
257
|
+
{ name: 'Triage', category: 'backlog', position: 1 },
|
|
258
|
+
{ name: 'Todo', category: 'unstarted', position: 2 },
|
|
259
|
+
{ name: 'In Progress', category: 'started', position: 3 },
|
|
260
|
+
{ name: 'In Review', category: 'started', position: 4 },
|
|
261
|
+
{ name: 'Done', category: 'completed', position: 5 },
|
|
262
|
+
{ name: 'Canceled', category: 'canceled', position: 6 },
|
|
263
|
+
],
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
id: 'bug-smash',
|
|
267
|
+
name: 'Bug Smash',
|
|
268
|
+
description: 'Bug tracking workflow with verification stages',
|
|
269
|
+
statuses: [
|
|
270
|
+
{ name: 'Reported', category: 'backlog', position: 0, isDefault: true },
|
|
271
|
+
{ name: 'Confirmed', category: 'unstarted', position: 1 },
|
|
272
|
+
{ name: 'Fixing', category: 'started', position: 2 },
|
|
273
|
+
{ name: 'Verifying', category: 'started', position: 3 },
|
|
274
|
+
{ name: 'Fixed', category: 'completed', position: 4 },
|
|
275
|
+
{ name: "Won't Fix", category: 'canceled', position: 5 },
|
|
276
|
+
],
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
id: '5-tool-founder',
|
|
280
|
+
name: '5-Tool Founder',
|
|
281
|
+
description: 'Founder workflow: Ship, Grow, Support, Strategy, BizOps backlogs → In Progress → Review → Done',
|
|
282
|
+
statuses: [
|
|
283
|
+
{ name: 'Ship', category: 'backlog', position: 0, isDefault: true },
|
|
284
|
+
{ name: 'Grow', category: 'backlog', position: 1 },
|
|
285
|
+
{ name: 'Support', category: 'backlog', position: 2 },
|
|
286
|
+
{ name: 'Strategy', category: 'backlog', position: 3 },
|
|
287
|
+
{ name: 'BizOps', category: 'backlog', position: 4 },
|
|
288
|
+
{ name: 'In Progress', category: 'started', position: 5 },
|
|
289
|
+
{ name: 'Review', category: 'started', position: 6 },
|
|
290
|
+
{ name: 'Done', category: 'completed', position: 7 },
|
|
291
|
+
],
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
id: 'gtm',
|
|
295
|
+
name: 'GTM',
|
|
296
|
+
description: 'Go-to-market workflow for launches and campaigns',
|
|
297
|
+
statuses: [
|
|
298
|
+
{ name: 'Ideation', category: 'backlog', position: 0, isDefault: true },
|
|
299
|
+
{ name: 'Planning', category: 'unstarted', position: 1 },
|
|
300
|
+
{ name: 'In Development', category: 'started', position: 2 },
|
|
301
|
+
{ name: 'Ready to Launch', category: 'started', position: 3 },
|
|
302
|
+
{ name: 'Launched', category: 'completed', position: 4 },
|
|
303
|
+
{ name: 'Retired', category: 'canceled', position: 5 },
|
|
304
|
+
],
|
|
305
|
+
},
|
|
306
|
+
];
|
|
307
|
+
const now = new Date().toISOString();
|
|
308
|
+
const insertWorkflow = db.prepare(`
|
|
309
|
+
INSERT OR IGNORE INTO ${T.workflows} (id, name, description, is_builtin, created_at, updated_at)
|
|
310
|
+
VALUES (?, ?, ?, 1, ?, ?)
|
|
311
|
+
`);
|
|
312
|
+
const insertStatus = db.prepare(`
|
|
313
|
+
INSERT OR IGNORE INTO ${T.workflow_statuses} (id, workflow_id, name, category, position, color, description, is_default, created_at)
|
|
314
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
315
|
+
`);
|
|
316
|
+
for (const workflow of builtinWorkflows) {
|
|
317
|
+
insertWorkflow.run(workflow.id, workflow.name, workflow.description, now, now);
|
|
318
|
+
for (const status of workflow.statuses) {
|
|
319
|
+
const statusId = `${workflow.id}-${status.name.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '')}`;
|
|
320
|
+
insertStatus.run(statusId, workflow.id, status.name, status.category, status.position, status.color || null, null, status.isDefault ? 1 : 0, now);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
// Assign default workflow to any projects without a workflow
|
|
324
|
+
db.prepare(`
|
|
325
|
+
UPDATE ${T.projects}
|
|
326
|
+
SET workflow_id = 'default'
|
|
327
|
+
WHERE workflow_id IS NULL
|
|
328
|
+
`).run();
|
|
329
|
+
}
|
|
330
|
+
// REMOVED: seedBuiltinTemplates - workflows are now used directly (no separate template concept)
|
|
331
|
+
// Built-in workflows are seeded in seedBuiltinWorkflows() above
|
|
332
|
+
/**
|
|
333
|
+
* Seed default project phases.
|
|
334
|
+
*/
|
|
335
|
+
export function seedBuiltinPhases(db) {
|
|
336
|
+
const defaultPhases = [
|
|
337
|
+
{ id: 'idea', name: 'Idea', category: 'backlog', position: 0, description: 'Project concept, not yet planned', isDefault: true },
|
|
338
|
+
{ id: 'planned', name: 'Planned', category: 'unstarted', position: 0, description: 'Scheduled for work but not started' },
|
|
339
|
+
{ id: 'active', name: 'Active', category: 'started', position: 0, description: 'Work is in progress' },
|
|
340
|
+
{ id: 'completed', name: 'Completed', category: 'completed', position: 0, description: 'Project finished successfully' },
|
|
341
|
+
{ id: 'canceled', name: 'Canceled', category: 'canceled', position: 0, description: "Project won't be completed" },
|
|
342
|
+
];
|
|
343
|
+
const insertPhase = db.prepare(`
|
|
344
|
+
INSERT OR IGNORE INTO ${T.phases} (id, name, category, position, description, is_default, created_at)
|
|
345
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
346
|
+
`);
|
|
347
|
+
const now = new Date().toISOString();
|
|
348
|
+
for (const phase of defaultPhases) {
|
|
349
|
+
insertPhase.run(phase.id, phase.name, phase.category, phase.position, phase.description || null, phase.isDefault ? 1 : 0, now);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Seed built-in phase templates.
|
|
354
|
+
*/
|
|
355
|
+
export function seedBuiltinPhaseTemplates(db) {
|
|
356
|
+
const builtinPhaseTemplates = [
|
|
357
|
+
{
|
|
358
|
+
id: 'default',
|
|
359
|
+
name: 'Default',
|
|
360
|
+
description: 'Standard project lifecycle phases',
|
|
361
|
+
phases: [
|
|
362
|
+
{ name: 'Idea', category: 'backlog', position: 0, description: 'Project concept, not yet planned', isDefault: true },
|
|
363
|
+
{ name: 'Planned', category: 'unstarted', position: 0, description: 'Scheduled for work but not started' },
|
|
364
|
+
{ name: 'Active', category: 'started', position: 0, description: 'Work is in progress' },
|
|
365
|
+
{ name: 'Completed', category: 'completed', position: 0, description: 'Project finished successfully' },
|
|
366
|
+
{ name: 'Canceled', category: 'canceled', position: 0, description: "Project won't be completed" },
|
|
367
|
+
],
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
id: 'agile',
|
|
371
|
+
name: 'Agile',
|
|
372
|
+
description: 'Agile/Scrum project phases',
|
|
373
|
+
phases: [
|
|
374
|
+
{ name: 'Backlog', category: 'backlog', position: 0, description: 'Not yet prioritized' },
|
|
375
|
+
{ name: 'Groomed', category: 'unstarted', position: 0, description: 'Ready to be picked up' },
|
|
376
|
+
{ name: 'In Sprint', category: 'started', position: 0, description: 'Actively being worked on', isDefault: true },
|
|
377
|
+
{ name: 'Done', category: 'completed', position: 0, description: 'Sprint work completed' },
|
|
378
|
+
{ name: 'Dropped', category: 'canceled', position: 0, description: 'Removed from backlog' },
|
|
379
|
+
],
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
id: 'product',
|
|
383
|
+
name: 'Product',
|
|
384
|
+
description: 'Product development lifecycle',
|
|
385
|
+
phases: [
|
|
386
|
+
{ name: 'Discovery', category: 'backlog', position: 0, description: 'Research and exploration' },
|
|
387
|
+
{ name: 'Definition', category: 'unstarted', position: 0, description: 'Requirements and specs', isDefault: true },
|
|
388
|
+
{ name: 'Development', category: 'started', position: 0, description: 'Building the product' },
|
|
389
|
+
{ name: 'Launch', category: 'completed', position: 0, description: 'Shipped to users' },
|
|
390
|
+
{ name: 'Growth', category: 'completed', position: 1, description: 'Post-launch iteration' },
|
|
391
|
+
{ name: 'Sunset', category: 'canceled', position: 0, description: 'End of life' },
|
|
392
|
+
],
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
id: 'startup',
|
|
396
|
+
name: 'Startup',
|
|
397
|
+
description: 'Lean startup methodology',
|
|
398
|
+
phases: [
|
|
399
|
+
{ name: 'Hypothesis', category: 'backlog', position: 0, description: 'Untested idea' },
|
|
400
|
+
{ name: 'Validated', category: 'unstarted', position: 0, description: 'Problem validated', isDefault: true },
|
|
401
|
+
{ name: 'Building', category: 'started', position: 0, description: 'MVP in progress' },
|
|
402
|
+
{ name: 'Measuring', category: 'started', position: 1, description: 'Collecting feedback' },
|
|
403
|
+
{ name: 'Scaling', category: 'completed', position: 0, description: 'Growth phase' },
|
|
404
|
+
{ name: 'Pivoted', category: 'canceled', position: 0, description: 'Changed direction' },
|
|
405
|
+
],
|
|
406
|
+
},
|
|
407
|
+
];
|
|
408
|
+
const insertTemplate = db.prepare(`
|
|
409
|
+
INSERT OR IGNORE INTO ${T.phase_templates} (id, name, description, is_builtin, phases, created_at)
|
|
410
|
+
VALUES (?, ?, ?, 1, ?, ?)
|
|
411
|
+
`);
|
|
412
|
+
const now = new Date().toISOString();
|
|
413
|
+
for (const template of builtinPhaseTemplates) {
|
|
414
|
+
insertTemplate.run(template.id, template.name, template.description, JSON.stringify(template.phases), now);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Seed built-in work actions.
|
|
419
|
+
*/
|
|
420
|
+
export function seedBuiltinActions(db) {
|
|
421
|
+
const builtinActions = [
|
|
422
|
+
{
|
|
423
|
+
id: 'groom',
|
|
424
|
+
name: 'Groom',
|
|
425
|
+
description: 'Flesh out ticket with requirements and acceptance criteria',
|
|
426
|
+
prompt: `Analyze this ticket and improve its definition:
|
|
427
|
+
- Add detailed requirements if missing or vague
|
|
428
|
+
- Add clear, testable acceptance criteria
|
|
429
|
+
- Break down into subtasks if the work is complex
|
|
430
|
+
- Estimate complexity (S/M/L/XL) if not already set
|
|
431
|
+
- Flag any ambiguities or missing information that need clarification
|
|
432
|
+
|
|
433
|
+
Do NOT implement the ticket - only improve its definition so it's ready to be worked on.
|
|
434
|
+
|
|
435
|
+
**AI Agent Tip:** When running \`prlt\` commands without all required arguments, use \`--json\` to receive interactive prompts as structured JSON.
|
|
436
|
+
|
|
437
|
+
## Ticket Schema Reference
|
|
438
|
+
|
|
439
|
+
| Field | Type | Valid Values | CLI Flag |
|
|
440
|
+
|-------|------|--------------|----------|
|
|
441
|
+
| title | string | any text | --title |
|
|
442
|
+
| description | markdown | requirements, context, notes | --description |
|
|
443
|
+
| priority | enum | P0 (critical), P1 (high), P2 (medium), P3 (low) | --priority |
|
|
444
|
+
| category | enum | feature, bug, refactor, docs, test, chore, performance, ci, build, security, database, release | --category |
|
|
445
|
+
| subtasks | list | task descriptions | --add-subtask (--clear-subtasks to replace) |
|
|
446
|
+
| acceptanceCriteria | list | testable statements | --add-ac (--clear-ac to replace) |
|
|
447
|
+
| labels | list | complexity:S/M/L/XL, ready, needs-clarification, etc. | --add-label, --remove-label |
|
|
448
|
+
| owner | string | human responsible | --owner |
|
|
449
|
+
| assignee | string | agent/person executing | --assignee |`,
|
|
450
|
+
endPrompt: `When you have finished analyzing and grooming the ticket, update it using prlt ticket edit.
|
|
451
|
+
|
|
452
|
+
## Field Mapping (use ONLY these fields)
|
|
453
|
+
|
|
454
|
+
| Your Analysis | Maps To | Example |
|
|
455
|
+
|--------------|---------|---------|
|
|
456
|
+
| Requirements/Context | --description | Include R1, R2, etc. in description text |
|
|
457
|
+
| Acceptance Criteria | --add-ac | One per criterion (testable statement) |
|
|
458
|
+
| Subtasks | --add-subtask | One per subtask |
|
|
459
|
+
| Complexity (S/M/L/XL) | --add-label | \`complexity:M\` or \`complexity:L\` |
|
|
460
|
+
| Priority | --priority | P0, P1, P2, or P3 only |
|
|
461
|
+
| Category | --category | feature, bug, refactor, docs, test, chore |
|
|
462
|
+
| Needs clarification | --add-label | \`needs-clarification\` |
|
|
463
|
+
| Ready for work | --add-label | \`ready\` |
|
|
464
|
+
|
|
465
|
+
## Example Command
|
|
466
|
+
|
|
467
|
+
\`\`\`bash
|
|
468
|
+
prlt ticket edit {{TICKET_ID}} \\
|
|
469
|
+
--description "Implement user session timeout...
|
|
470
|
+
|
|
471
|
+
Requirements:
|
|
472
|
+
- R1: Sessions expire after 30 minutes of inactivity
|
|
473
|
+
- R2: Users see a warning 5 minutes before timeout" \\
|
|
474
|
+
--priority P2 \\
|
|
475
|
+
--category feature \\
|
|
476
|
+
--add-label "complexity:M" \\
|
|
477
|
+
--add-ac "Sessions expire after 30 min inactivity" \\
|
|
478
|
+
--add-ac "Warning shown 5 min before timeout" \\
|
|
479
|
+
--add-subtask "Add session timeout config" \\
|
|
480
|
+
--add-subtask "Implement warning modal"
|
|
481
|
+
\`\`\`
|
|
482
|
+
|
|
483
|
+
## Important Rules
|
|
484
|
+
- Priority must be exactly: P0, P1, P2, or P3 (not custom values)
|
|
485
|
+
- Use \`--add-label "complexity:S|M|L|XL"\` for complexity (not a separate field)
|
|
486
|
+
- Technical notes/flagged ambiguities go in description
|
|
487
|
+
- Use \`--clear-subtasks\` if replacing existing subtasks
|
|
488
|
+
- Use \`--clear-ac\` if replacing existing acceptance criteria
|
|
489
|
+
|
|
490
|
+
After updating, output a brief summary of your grooming changes.`,
|
|
491
|
+
suggestedForCategories: ['backlog'],
|
|
492
|
+
defaultMoveToCategory: 'unstarted',
|
|
493
|
+
modifiesCode: false,
|
|
494
|
+
position: 0,
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
id: 'implement',
|
|
498
|
+
name: 'Implement',
|
|
499
|
+
description: 'Write code to implement the ticket requirements',
|
|
500
|
+
prompt: `Implement this ticket according to its requirements and acceptance criteria:
|
|
501
|
+
- Follow the acceptance criteria exactly
|
|
502
|
+
- Write clean, well-tested code
|
|
503
|
+
- Update documentation if the changes affect it
|
|
504
|
+
- Run tests to verify the implementation
|
|
505
|
+
|
|
506
|
+
**IMPORTANT: Commit and push frequently!**
|
|
507
|
+
- Commit after each logical change or completed subtask
|
|
508
|
+
- Push after every 1-2 commits to save your work
|
|
509
|
+
- Use atomic commits with clear messages describing the change
|
|
510
|
+
- Don't wait until the end to commit - your work could be lost!
|
|
511
|
+
|
|
512
|
+
Example workflow:
|
|
513
|
+
\`\`\`bash
|
|
514
|
+
# After completing a piece of work
|
|
515
|
+
git add -A
|
|
516
|
+
prlt commit "implement user validation"
|
|
517
|
+
git push
|
|
518
|
+
\`\`\`
|
|
519
|
+
|
|
520
|
+
When complete, the ticket should be ready for code review.`,
|
|
521
|
+
endPrompt: `When complete:
|
|
522
|
+
1. **Commit your work** in each repository directory you modified:
|
|
523
|
+
\`\`\`bash
|
|
524
|
+
cd /workspace/<repo-name>
|
|
525
|
+
git add -A
|
|
526
|
+
prlt commit "describe your change"
|
|
527
|
+
git push
|
|
528
|
+
\`\`\`
|
|
529
|
+
This formats your commit as a conventional commit with the ticket ID.
|
|
530
|
+
|
|
531
|
+
2. **Mark work as ready** by running:
|
|
532
|
+
\`\`\`bash
|
|
533
|
+
prlt work ready {{TICKET_ID}} --pr
|
|
534
|
+
\`\`\`
|
|
535
|
+
This moves the ticket to review and creates a pull request.
|
|
536
|
+
|
|
537
|
+
**IMPORTANT:** Use the global \`prlt\` command (just type \`prlt\`). Do NOT use \`./bin/run.js\` or any local path.`,
|
|
538
|
+
suggestedForCategories: ['unstarted', 'started'],
|
|
539
|
+
defaultMoveToCategory: 'started',
|
|
540
|
+
modifiesCode: true,
|
|
541
|
+
position: 1,
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
id: 'continue',
|
|
545
|
+
name: 'Continue',
|
|
546
|
+
description: 'Continue working from where you left off',
|
|
547
|
+
prompt: `Continue working on this ticket from where you left off.
|
|
548
|
+
- Review existing commits and changes to understand current state
|
|
549
|
+
- Check what subtasks remain incomplete
|
|
550
|
+
- Complete the remaining work
|
|
551
|
+
- Ensure all acceptance criteria are met
|
|
552
|
+
|
|
553
|
+
**IMPORTANT: Commit and push frequently!**
|
|
554
|
+
- Commit after each logical change or completed subtask
|
|
555
|
+
- Push after every 1-2 commits to save your work
|
|
556
|
+
- Don't wait until the end to commit - your work could be lost!
|
|
557
|
+
|
|
558
|
+
\`\`\`bash
|
|
559
|
+
git add -A && prlt commit "your change" && git push
|
|
560
|
+
\`\`\``,
|
|
561
|
+
endPrompt: `When complete:
|
|
562
|
+
1. **Commit your work** in each repository directory you modified:
|
|
563
|
+
\`\`\`bash
|
|
564
|
+
cd /workspace/<repo-name>
|
|
565
|
+
git add -A
|
|
566
|
+
prlt commit "describe your change"
|
|
567
|
+
git push
|
|
568
|
+
\`\`\`
|
|
569
|
+
|
|
570
|
+
2. **Mark work as ready** by running:
|
|
571
|
+
\`\`\`bash
|
|
572
|
+
prlt work ready {{TICKET_ID}} --pr
|
|
573
|
+
\`\`\`
|
|
574
|
+
This moves the ticket to review and creates a pull request.
|
|
575
|
+
|
|
576
|
+
**IMPORTANT:** Use the global \`prlt\` command (just type \`prlt\`). Do NOT use \`./bin/run.js\` or any local path.`,
|
|
577
|
+
suggestedForCategories: ['started'],
|
|
578
|
+
defaultMoveToCategory: 'started',
|
|
579
|
+
modifiesCode: true,
|
|
580
|
+
position: 2,
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
id: 'test',
|
|
584
|
+
name: 'Write Tests',
|
|
585
|
+
description: 'Add comprehensive tests for the implementation',
|
|
586
|
+
prompt: `Write comprehensive tests for this ticket's implementation:
|
|
587
|
+
- Add unit tests for core functionality
|
|
588
|
+
- Add integration tests where appropriate
|
|
589
|
+
- Cover edge cases and error handling
|
|
590
|
+
- Aim for good coverage of the changed code
|
|
591
|
+
- Ensure all tests pass
|
|
592
|
+
|
|
593
|
+
**IMPORTANT: Commit and push frequently!**
|
|
594
|
+
- Commit after each test file or logical group of tests
|
|
595
|
+
- Push after every 1-2 commits to save your work
|
|
596
|
+
|
|
597
|
+
\`\`\`bash
|
|
598
|
+
git add -A && prlt commit "add tests for X" && git push
|
|
599
|
+
\`\`\``,
|
|
600
|
+
endPrompt: `When complete:
|
|
601
|
+
1. **Commit your tests**:
|
|
602
|
+
\`\`\`bash
|
|
603
|
+
git add -A
|
|
604
|
+
prlt commit "add tests for {{TICKET_ID}}"
|
|
605
|
+
git push
|
|
606
|
+
\`\`\`
|
|
607
|
+
|
|
608
|
+
2. **Mark work as ready** by running:
|
|
609
|
+
\`\`\`bash
|
|
610
|
+
prlt work ready {{TICKET_ID}} --pr
|
|
611
|
+
\`\`\`
|
|
612
|
+
|
|
613
|
+
**IMPORTANT:** Use the global \`prlt\` command.`,
|
|
614
|
+
suggestedForCategories: ['started', 'completed'],
|
|
615
|
+
modifiesCode: true,
|
|
616
|
+
position: 3,
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
id: 'review',
|
|
620
|
+
name: 'Code Review',
|
|
621
|
+
description: 'Review the implementation for issues',
|
|
622
|
+
prompt: `Review this ticket's implementation thoroughly:
|
|
623
|
+
- Check for bugs, edge cases, and potential issues
|
|
624
|
+
- Look for security vulnerabilities
|
|
625
|
+
- Verify it meets all acceptance criteria
|
|
626
|
+
- Check code quality and maintainability
|
|
627
|
+
- Suggest improvements if appropriate
|
|
628
|
+
|
|
629
|
+
Output a review summary with your findings and any concerns.`,
|
|
630
|
+
endPrompt: `When you have finished reviewing, output a detailed review summary with:
|
|
631
|
+
- ✅ What looks good
|
|
632
|
+
- ⚠️ Concerns or potential issues
|
|
633
|
+
- 🔧 Suggested improvements
|
|
634
|
+
- 📋 Verdict: Approve, Request Changes, or Needs Discussion
|
|
635
|
+
|
|
636
|
+
No commits are needed for code review.`,
|
|
637
|
+
suggestedForCategories: ['started', 'completed'],
|
|
638
|
+
modifiesCode: false,
|
|
639
|
+
position: 4,
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
id: 'revise',
|
|
643
|
+
name: 'Revise',
|
|
644
|
+
description: 'Address PR feedback and review comments',
|
|
645
|
+
prompt: `Address the feedback on this ticket's pull request:
|
|
646
|
+
- Review all comments and requested changes carefully
|
|
647
|
+
- Make the necessary code changes to address each point
|
|
648
|
+
- Respond to questions with explanations
|
|
649
|
+
- Push updates to the PR branch
|
|
650
|
+
- Mark resolved conversations as resolved`,
|
|
651
|
+
endPrompt: `After addressing the feedback:
|
|
652
|
+
1. Commit your changes using \`prlt commit "your message"\`
|
|
653
|
+
2. Push your changes: \`git push\`
|
|
654
|
+
|
|
655
|
+
The PR will be updated automatically.`,
|
|
656
|
+
suggestedForCategories: ['completed'],
|
|
657
|
+
defaultMoveToCategory: 'started',
|
|
658
|
+
modifiesCode: true,
|
|
659
|
+
position: 5,
|
|
660
|
+
},
|
|
661
|
+
];
|
|
662
|
+
// Use INSERT OR REPLACE to always update builtin actions with latest prompts
|
|
663
|
+
// This ensures prompt improvements are applied to existing databases
|
|
664
|
+
const upsertAction = db.prepare(`
|
|
665
|
+
INSERT INTO ${T.actions} (id, name, description, prompt, end_prompt, suggested_for_categories, default_move_to_category, modifies_code, is_builtin, position, created_at)
|
|
666
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?)
|
|
667
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
668
|
+
name = excluded.name,
|
|
669
|
+
description = excluded.description,
|
|
670
|
+
prompt = excluded.prompt,
|
|
671
|
+
end_prompt = excluded.end_prompt,
|
|
672
|
+
suggested_for_categories = excluded.suggested_for_categories,
|
|
673
|
+
default_move_to_category = excluded.default_move_to_category,
|
|
674
|
+
modifies_code = excluded.modifies_code,
|
|
675
|
+
position = excluded.position
|
|
676
|
+
WHERE is_builtin = 1
|
|
677
|
+
`);
|
|
678
|
+
const now = new Date().toISOString();
|
|
679
|
+
for (const action of builtinActions) {
|
|
680
|
+
upsertAction.run(action.id, action.name, action.description, action.prompt, action.endPrompt || null, JSON.stringify(action.suggestedForCategories), action.defaultMoveToCategory || null, action.modifiesCode ? 1 : 0, action.position, now);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Seed built-in ticket templates.
|
|
685
|
+
*/
|
|
686
|
+
export function seedBuiltinTicketTemplates(db) {
|
|
687
|
+
const builtinTemplates = [
|
|
688
|
+
{
|
|
689
|
+
id: 'bug-report',
|
|
690
|
+
name: 'Bug Report',
|
|
691
|
+
description: 'Template for reporting bugs with reproduction steps',
|
|
692
|
+
titlePattern: '[BUG] ',
|
|
693
|
+
descriptionTemplate: `## Description
|
|
694
|
+
Brief description of the bug.
|
|
695
|
+
|
|
696
|
+
## Steps to Reproduce
|
|
697
|
+
1.
|
|
698
|
+
2.
|
|
699
|
+
3.
|
|
700
|
+
|
|
701
|
+
## Expected Behavior
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
## Actual Behavior
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
## Environment
|
|
708
|
+
- OS:
|
|
709
|
+
- Version:
|
|
710
|
+
`,
|
|
711
|
+
defaultPriority: 'P1',
|
|
712
|
+
defaultCategory: 'bug',
|
|
713
|
+
suggestedSubtasks: [
|
|
714
|
+
{ title: 'Reproduce the bug' },
|
|
715
|
+
{ title: 'Identify root cause' },
|
|
716
|
+
{ title: 'Implement fix' },
|
|
717
|
+
{ title: 'Add regression test' },
|
|
718
|
+
],
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
id: 'feature-request',
|
|
722
|
+
name: 'Feature Request',
|
|
723
|
+
description: 'Template for new feature requests',
|
|
724
|
+
titlePattern: '[FEATURE] ',
|
|
725
|
+
descriptionTemplate: `## Summary
|
|
726
|
+
Brief description of the feature.
|
|
727
|
+
|
|
728
|
+
## User Story
|
|
729
|
+
As a [type of user], I want [goal] so that [benefit].
|
|
730
|
+
|
|
731
|
+
## Acceptance Criteria
|
|
732
|
+
- [ ]
|
|
733
|
+
- [ ]
|
|
734
|
+
|
|
735
|
+
## Design Notes
|
|
736
|
+
|
|
737
|
+
`,
|
|
738
|
+
defaultPriority: 'P2',
|
|
739
|
+
defaultCategory: 'feature',
|
|
740
|
+
suggestedSubtasks: [
|
|
741
|
+
{ title: 'Design implementation approach' },
|
|
742
|
+
{ title: 'Implement feature' },
|
|
743
|
+
{ title: 'Add tests' },
|
|
744
|
+
{ title: 'Update documentation' },
|
|
745
|
+
],
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
id: 'task',
|
|
749
|
+
name: 'Task',
|
|
750
|
+
description: 'General task template',
|
|
751
|
+
descriptionTemplate: `## What
|
|
752
|
+
Describe what needs to be done.
|
|
753
|
+
|
|
754
|
+
## Done when
|
|
755
|
+
- [ ]
|
|
756
|
+
|
|
757
|
+
## Context
|
|
758
|
+
Any relevant context or notes.
|
|
759
|
+
`,
|
|
760
|
+
defaultPriority: 'P2',
|
|
761
|
+
defaultCategory: 'chore',
|
|
762
|
+
suggestedSubtasks: [],
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
id: 'refactor',
|
|
766
|
+
name: 'Refactor',
|
|
767
|
+
description: 'Template for refactoring tasks',
|
|
768
|
+
titlePattern: '[REFACTOR] ',
|
|
769
|
+
descriptionTemplate: `## Current State
|
|
770
|
+
Describe the current implementation.
|
|
771
|
+
|
|
772
|
+
## Desired State
|
|
773
|
+
Describe the target implementation.
|
|
774
|
+
|
|
775
|
+
## Motivation
|
|
776
|
+
Why is this refactor needed?
|
|
777
|
+
|
|
778
|
+
## Scope
|
|
779
|
+
- [ ] Files/modules to change
|
|
780
|
+
`,
|
|
781
|
+
defaultPriority: 'P3',
|
|
782
|
+
defaultCategory: 'refactor',
|
|
783
|
+
suggestedSubtasks: [
|
|
784
|
+
{ title: 'Analyze current code' },
|
|
785
|
+
{ title: 'Plan refactoring approach' },
|
|
786
|
+
{ title: 'Implement changes' },
|
|
787
|
+
{ title: 'Ensure tests pass' },
|
|
788
|
+
],
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
id: 'documentation',
|
|
792
|
+
name: 'Documentation',
|
|
793
|
+
description: 'Template for documentation tasks',
|
|
794
|
+
titlePattern: '[DOCS] ',
|
|
795
|
+
descriptionTemplate: `## Documentation Type
|
|
796
|
+
[ ] README
|
|
797
|
+
[ ] API docs
|
|
798
|
+
[ ] User guide
|
|
799
|
+
[ ] Internal docs
|
|
800
|
+
|
|
801
|
+
## Content to Document
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
## Target Audience
|
|
805
|
+
|
|
806
|
+
`,
|
|
807
|
+
defaultPriority: 'P3',
|
|
808
|
+
defaultCategory: 'docs',
|
|
809
|
+
suggestedSubtasks: [
|
|
810
|
+
{ title: 'Draft content' },
|
|
811
|
+
{ title: 'Review for accuracy' },
|
|
812
|
+
{ title: 'Add examples if needed' },
|
|
813
|
+
],
|
|
814
|
+
},
|
|
815
|
+
];
|
|
816
|
+
const insertTemplate = db.prepare(`
|
|
817
|
+
INSERT OR IGNORE INTO ${T.ticket_templates} (
|
|
818
|
+
id, name, description, is_builtin, title_pattern, description_template,
|
|
819
|
+
default_priority, default_category, default_status_id, default_assignee,
|
|
820
|
+
default_owner, default_labels, suggested_subtasks, created_at
|
|
821
|
+
)
|
|
822
|
+
VALUES (?, ?, ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
823
|
+
`);
|
|
824
|
+
const now = new Date().toISOString();
|
|
825
|
+
for (const template of builtinTemplates) {
|
|
826
|
+
insertTemplate.run(template.id, template.name, template.description || null, template.titlePattern || null, template.descriptionTemplate || null, template.defaultPriority || null, template.defaultCategory || null, null, null, null, '[]', JSON.stringify(template.suggestedSubtasks || []), now);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Update board timestamp for a project.
|
|
831
|
+
*/
|
|
832
|
+
export function updateBoardTimestamp(db, projectId) {
|
|
833
|
+
db.prepare(`
|
|
834
|
+
UPDATE ${T.projects}
|
|
835
|
+
SET updated_at = ?
|
|
836
|
+
WHERE id = ?
|
|
837
|
+
`).run(Date.now(), projectId);
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* Get max position for columns in a project.
|
|
841
|
+
*/
|
|
842
|
+
export function getMaxColumnPosition(db, projectId) {
|
|
843
|
+
const result = db.prepare(`
|
|
844
|
+
SELECT MAX(position) as max FROM ${T.columns}
|
|
845
|
+
WHERE project_id = ?
|
|
846
|
+
`).get(projectId);
|
|
847
|
+
return result.max ?? -1;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Get max position for tickets in a column.
|
|
851
|
+
*/
|
|
852
|
+
export function getMaxTicketPosition(db, projectId, columnId) {
|
|
853
|
+
const result = db.prepare(`
|
|
854
|
+
SELECT MAX(position) as max FROM ${T.board_tickets}
|
|
855
|
+
WHERE project_id = ? AND column_id = ?
|
|
856
|
+
`).get(projectId, columnId);
|
|
857
|
+
return result.max ?? -1;
|
|
858
|
+
}
|