agentplane 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/assets/AGENTS.md +294 -72
- package/assets/agents/CODER.json +1 -0
- package/assets/agents/INTEGRATOR.json +1 -0
- package/assets/agents/ORCHESTRATOR.json +1 -0
- package/assets/agents/PLANNER.json +1 -0
- package/assets/agents/TESTER.json +1 -0
- package/dist/backends/task-backend/load.d.ts +13 -0
- package/dist/backends/task-backend/load.d.ts.map +1 -0
- package/dist/backends/task-backend/load.js +58 -0
- package/dist/backends/task-backend/local-backend.d.ts +28 -0
- package/dist/backends/task-backend/local-backend.d.ts.map +1 -0
- package/dist/backends/task-backend/local-backend.js +335 -0
- package/dist/backends/task-backend/redmine/client.d.ts +8 -0
- package/dist/backends/task-backend/redmine/client.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/client.js +60 -0
- package/dist/backends/task-backend/redmine/comments.d.ts +12 -0
- package/dist/backends/task-backend/redmine/comments.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/comments.js +54 -0
- package/dist/backends/task-backend/redmine/fields.d.ts +9 -0
- package/dist/backends/task-backend/redmine/fields.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/fields.js +38 -0
- package/dist/backends/task-backend/redmine/mapping.d.ts +20 -0
- package/dist/backends/task-backend/redmine/mapping.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/mapping.js +114 -0
- package/dist/backends/task-backend/redmine/parse.d.ts +3 -0
- package/dist/backends/task-backend/redmine/parse.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/parse.js +27 -0
- package/dist/backends/task-backend/redmine/remote.d.ts +19 -0
- package/dist/backends/task-backend/redmine/remote.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/remote.js +82 -0
- package/dist/backends/task-backend/redmine-backend.d.ts +80 -0
- package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine-backend.js +505 -0
- package/dist/backends/task-backend/shared/concurrency.d.ts +3 -0
- package/dist/backends/task-backend/shared/concurrency.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/concurrency.js +21 -0
- package/dist/backends/task-backend/shared/constants.d.ts +4 -0
- package/dist/backends/task-backend/shared/constants.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/constants.js +4 -0
- package/dist/backends/task-backend/shared/doc.d.ts +11 -0
- package/dist/backends/task-backend/shared/doc.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/doc.js +78 -0
- package/dist/backends/task-backend/shared/errors.d.ts +10 -0
- package/dist/backends/task-backend/shared/errors.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/errors.js +18 -0
- package/dist/backends/task-backend/shared/events.d.ts +3 -0
- package/dist/backends/task-backend/shared/events.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/events.js +29 -0
- package/dist/backends/task-backend/shared/export.d.ts +15 -0
- package/dist/backends/task-backend/shared/export.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/export.js +60 -0
- package/dist/backends/task-backend/shared/id.d.ts +13 -0
- package/dist/backends/task-backend/shared/id.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/id.js +17 -0
- package/dist/backends/task-backend/shared/normalize.d.ts +8 -0
- package/dist/backends/task-backend/shared/normalize.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/normalize.js +54 -0
- package/dist/backends/task-backend/shared/record.d.ts +4 -0
- package/dist/backends/task-backend/shared/record.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/record.js +53 -0
- package/dist/backends/task-backend/shared/strings.d.ts +4 -0
- package/dist/backends/task-backend/shared/strings.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/strings.js +21 -0
- package/dist/backends/task-backend/shared/types.d.ts +84 -0
- package/dist/backends/task-backend/shared/types.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/types.js +1 -0
- package/dist/backends/task-backend/shared.d.ts +11 -0
- package/dist/backends/task-backend/shared.d.ts.map +1 -0
- package/dist/backends/task-backend/shared.js +9 -0
- package/dist/backends/task-backend.d.ts +4 -192
- package/dist/backends/task-backend.d.ts.map +1 -1
- package/dist/backends/task-backend.js +4 -1329
- package/dist/backends/task-index.js +2 -2
- package/dist/cli/archive.d.ts +0 -2
- package/dist/cli/archive.d.ts.map +1 -1
- package/dist/cli/archive.js +1 -2
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +28 -12
- package/dist/cli/parse/lifecycle.d.ts +64 -0
- package/dist/cli/parse/lifecycle.d.ts.map +1 -0
- package/dist/cli/parse/lifecycle.js +280 -0
- package/dist/cli/run-cli/command-catalog.d.ts +16 -0
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -0
- package/dist/cli/run-cli/command-catalog.js +204 -0
- package/dist/cli/run-cli/commands/config.d.ts +20 -0
- package/dist/cli/run-cli/commands/config.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/config.js +130 -0
- package/dist/cli/run-cli/commands/core.d.ts +14 -0
- package/dist/cli/run-cli/commands/core.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/core.js +144 -0
- package/dist/cli/run-cli/commands/ide.d.ts +13 -0
- package/dist/cli/run-cli/commands/ide.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/ide.js +67 -0
- package/dist/cli/run-cli/commands/init/base-branch.d.ts +9 -0
- package/dist/cli/run-cli/commands/init/base-branch.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/base-branch.js +11 -0
- package/dist/cli/run-cli/commands/init/conflicts.d.ts +11 -0
- package/dist/cli/run-cli/commands/init/conflicts.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/conflicts.js +42 -0
- package/dist/cli/run-cli/commands/init/git.d.ts +8 -0
- package/dist/cli/run-cli/commands/init/git.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/git.js +12 -0
- package/dist/cli/run-cli/commands/init/ide-sync.d.ts +9 -0
- package/dist/cli/run-cli/commands/init/ide-sync.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/ide-sync.js +18 -0
- package/dist/cli/run-cli/commands/init/recipes.d.ts +2 -0
- package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/recipes.js +11 -0
- package/dist/cli/run-cli/commands/init/write-agents.d.ts +11 -0
- package/dist/cli/run-cli/commands/init/write-agents.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/write-agents.js +30 -0
- package/dist/cli/run-cli/commands/init/write-config.d.ts +15 -0
- package/dist/cli/run-cli/commands/init/write-config.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/write-config.js +45 -0
- package/dist/cli/run-cli/commands/init.d.ts +21 -0
- package/dist/cli/run-cli/commands/init.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init.js +332 -0
- package/dist/cli/run-cli/registry.run.d.ts +4 -0
- package/dist/cli/run-cli/registry.run.d.ts.map +1 -0
- package/dist/cli/run-cli/registry.run.js +19 -0
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +182 -2408
- package/dist/cli/spec/docs-render.d.ts +3 -0
- package/dist/cli/spec/docs-render.d.ts.map +1 -0
- package/dist/cli/spec/docs-render.js +118 -0
- package/dist/cli/spec/errors.d.ts +9 -0
- package/dist/cli/spec/errors.d.ts.map +1 -0
- package/dist/cli/spec/errors.js +18 -0
- package/dist/cli/spec/help-render.d.ts +43 -0
- package/dist/cli/spec/help-render.d.ts.map +1 -0
- package/dist/cli/spec/help-render.js +185 -0
- package/dist/cli/spec/help.d.ts +10 -0
- package/dist/cli/spec/help.d.ts.map +1 -0
- package/dist/cli/spec/help.js +64 -0
- package/dist/cli/spec/parse.d.ts +8 -0
- package/dist/cli/spec/parse.d.ts.map +1 -0
- package/dist/cli/spec/parse.js +188 -0
- package/dist/cli/spec/registry.d.ts +12 -0
- package/dist/cli/spec/registry.d.ts.map +1 -0
- package/dist/cli/spec/registry.js +47 -0
- package/dist/cli/spec/spec.d.ts +76 -0
- package/dist/cli/spec/spec.d.ts.map +1 -0
- package/dist/cli/spec/spec.js +1 -0
- package/dist/cli/spec/suggest.d.ts +2 -0
- package/dist/cli/spec/suggest.d.ts.map +1 -0
- package/dist/cli/spec/suggest.js +45 -0
- package/dist/commands/backend/sync.command.d.ts +12 -0
- package/dist/commands/backend/sync.command.d.ts.map +1 -0
- package/dist/commands/backend/sync.command.js +79 -0
- package/dist/commands/backend.d.ts +21 -8
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +28 -165
- package/dist/commands/block.command.d.ts +19 -0
- package/dist/commands/block.command.d.ts.map +1 -0
- package/dist/commands/block.command.js +143 -0
- package/dist/commands/branch/base.command.d.ts +20 -0
- package/dist/commands/branch/base.command.d.ts.map +1 -0
- package/dist/commands/branch/base.command.js +110 -0
- package/dist/commands/branch/base.d.ts +19 -0
- package/dist/commands/branch/base.d.ts.map +1 -0
- package/dist/commands/branch/base.js +114 -0
- package/dist/commands/branch/cleanup-merged.d.ts +11 -0
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -0
- package/dist/commands/branch/cleanup-merged.js +141 -0
- package/dist/commands/branch/index.d.ts +6 -59
- package/dist/commands/branch/index.d.ts.map +1 -1
- package/dist/commands/branch/index.js +6 -513
- package/dist/commands/branch/internal/archive-pr.d.ts +2 -0
- package/dist/commands/branch/internal/archive-pr.d.ts.map +1 -0
- package/dist/commands/branch/internal/archive-pr.js +17 -0
- package/dist/commands/branch/internal/work-validate.d.ts +3 -0
- package/dist/commands/branch/internal/work-validate.d.ts.map +1 -0
- package/dist/commands/branch/internal/work-validate.js +27 -0
- package/dist/commands/branch/remove.command.d.ts +10 -0
- package/dist/commands/branch/remove.command.d.ts.map +1 -0
- package/dist/commands/branch/remove.command.js +63 -0
- package/dist/commands/branch/remove.d.ts +9 -0
- package/dist/commands/branch/remove.d.ts.map +1 -0
- package/dist/commands/branch/remove.js +65 -0
- package/dist/commands/branch/status.command.d.ts +8 -0
- package/dist/commands/branch/status.command.d.ts.map +1 -0
- package/dist/commands/branch/status.command.js +36 -0
- package/dist/commands/branch/status.d.ts +7 -0
- package/dist/commands/branch/status.d.ts.map +1 -0
- package/dist/commands/branch/status.js +60 -0
- package/dist/commands/branch/work-start.command.d.ts +11 -0
- package/dist/commands/branch/work-start.command.d.ts.map +1 -0
- package/dist/commands/branch/work-start.command.js +80 -0
- package/dist/commands/branch/work-start.d.ts +11 -0
- package/dist/commands/branch/work-start.d.ts.map +1 -0
- package/dist/commands/branch/work-start.js +120 -0
- package/dist/commands/cleanup/merged.command.d.ts +17 -0
- package/dist/commands/cleanup/merged.command.d.ts.map +1 -0
- package/dist/commands/cleanup/merged.command.js +75 -0
- package/dist/commands/commit.command.d.ts +6 -0
- package/dist/commands/commit.command.d.ts.map +1 -0
- package/dist/commands/commit.command.js +24 -0
- package/dist/commands/commit.spec.d.ts +18 -0
- package/dist/commands/commit.spec.d.ts.map +1 -0
- package/dist/commands/commit.spec.js +119 -0
- package/dist/commands/docs/cli.command.d.ts +9 -0
- package/dist/commands/docs/cli.command.d.ts.map +1 -0
- package/dist/commands/docs/cli.command.js +51 -0
- package/dist/commands/finish.command.d.ts +28 -0
- package/dist/commands/finish.command.d.ts.map +1 -0
- package/dist/commands/finish.command.js +237 -0
- package/dist/commands/guard/clean.command.d.ts +7 -0
- package/dist/commands/guard/clean.command.d.ts.map +1 -0
- package/dist/commands/guard/clean.command.js +14 -0
- package/dist/commands/guard/commit.command.d.ts +19 -0
- package/dist/commands/guard/commit.command.d.ts.map +1 -0
- package/dist/commands/guard/commit.command.js +132 -0
- package/dist/commands/guard/guard.command.d.ts +5 -0
- package/dist/commands/guard/guard.command.d.ts.map +1 -0
- package/dist/commands/guard/guard.command.js +21 -0
- package/dist/commands/guard/impl/allow.d.ts +18 -0
- package/dist/commands/guard/impl/allow.d.ts.map +1 -0
- package/dist/commands/guard/impl/allow.js +77 -0
- package/dist/commands/guard/impl/close-message.d.ts +16 -0
- package/dist/commands/guard/impl/close-message.d.ts.map +1 -0
- package/dist/commands/guard/impl/close-message.js +156 -0
- package/dist/commands/guard/impl/commands.d.ts +32 -0
- package/dist/commands/guard/impl/commands.d.ts.map +1 -0
- package/dist/commands/guard/impl/commands.js +191 -0
- package/dist/commands/guard/impl/comment-commit.d.ts +25 -0
- package/dist/commands/guard/impl/comment-commit.d.ts.map +1 -0
- package/dist/commands/guard/impl/comment-commit.js +137 -0
- package/dist/commands/guard/impl/env.d.ts +10 -0
- package/dist/commands/guard/impl/env.d.ts.map +1 -0
- package/dist/commands/guard/impl/env.js +12 -0
- package/dist/commands/guard/impl/policy.d.ts +19 -0
- package/dist/commands/guard/impl/policy.d.ts.map +1 -0
- package/dist/commands/guard/impl/policy.js +46 -0
- package/dist/commands/guard/index.d.ts +4 -66
- package/dist/commands/guard/index.d.ts.map +1 -1
- package/dist/commands/guard/index.js +4 -367
- package/dist/commands/guard/suggest-allow.command.d.ts +7 -0
- package/dist/commands/guard/suggest-allow.command.d.ts.map +1 -0
- package/dist/commands/guard/suggest-allow.command.js +28 -0
- package/dist/commands/hooks/hooks.command.d.ts +5 -0
- package/dist/commands/hooks/hooks.command.d.ts.map +1 -0
- package/dist/commands/hooks/hooks.command.js +18 -0
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +42 -77
- package/dist/commands/hooks/install.command.d.ts +7 -0
- package/dist/commands/hooks/install.command.d.ts.map +1 -0
- package/dist/commands/hooks/install.command.js +14 -0
- package/dist/commands/hooks/run.command.d.ts +9 -0
- package/dist/commands/hooks/run.command.d.ts.map +1 -0
- package/dist/commands/hooks/run.command.js +39 -0
- package/dist/commands/hooks/uninstall.command.d.ts +7 -0
- package/dist/commands/hooks/uninstall.command.d.ts.map +1 -0
- package/dist/commands/hooks/uninstall.command.js +16 -0
- package/dist/commands/integrate.command.d.ts +14 -0
- package/dist/commands/integrate.command.d.ts.map +1 -0
- package/dist/commands/integrate.command.js +61 -0
- package/dist/commands/pr/check.d.ts +8 -0
- package/dist/commands/pr/check.d.ts.map +1 -0
- package/dist/commands/pr/check.js +78 -0
- package/dist/commands/pr/index.d.ts +5 -45
- package/dist/commands/pr/index.d.ts.map +1 -1
- package/dist/commands/pr/index.js +5 -857
- package/dist/commands/pr/integrate/artifacts.d.ts +14 -0
- package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -0
- package/dist/commands/pr/integrate/artifacts.js +45 -0
- package/dist/commands/pr/integrate/cmd.d.ts +14 -0
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -0
- package/dist/commands/pr/integrate/cmd.js +150 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts +25 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/finalize.js +86 -0
- package/dist/commands/pr/integrate/internal/merge.d.ts +40 -0
- package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/merge.js +138 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts +33 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/prepare.js +142 -0
- package/dist/commands/pr/integrate/internal/worktree.d.ts +14 -0
- package/dist/commands/pr/integrate/internal/worktree.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/worktree.js +51 -0
- package/dist/commands/pr/integrate/verify.d.ts +22 -0
- package/dist/commands/pr/integrate/verify.d.ts.map +1 -0
- package/dist/commands/pr/integrate/verify.js +60 -0
- package/dist/commands/pr/integrate.d.ts +2 -0
- package/dist/commands/pr/integrate.d.ts.map +1 -0
- package/dist/commands/pr/integrate.js +1 -0
- package/dist/commands/pr/internal/pr-paths.d.ts +29 -0
- package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -0
- package/dist/commands/pr/internal/pr-paths.js +38 -0
- package/dist/commands/pr/internal/review-template.d.ts +9 -0
- package/dist/commands/pr/internal/review-template.d.ts.map +1 -0
- package/dist/commands/pr/internal/review-template.js +62 -0
- package/dist/commands/pr/note.d.ts +10 -0
- package/dist/commands/pr/note.d.ts.map +1 -0
- package/dist/commands/pr/note.js +50 -0
- package/dist/commands/pr/open.d.ts +10 -0
- package/dist/commands/pr/open.d.ts.map +1 -0
- package/dist/commands/pr/open.js +80 -0
- package/dist/commands/pr/pr.command.d.ts +33 -0
- package/dist/commands/pr/pr.command.d.ts.map +1 -0
- package/dist/commands/pr/pr.command.js +172 -0
- package/dist/commands/pr/update.d.ts +8 -0
- package/dist/commands/pr/update.d.ts.map +1 -0
- package/dist/commands/pr/update.js +103 -0
- package/dist/commands/ready.command.d.ts +8 -0
- package/dist/commands/ready.command.d.ts.map +1 -0
- package/dist/commands/ready.command.js +28 -0
- package/dist/commands/recipes/cache-prune.command.d.ts +6 -0
- package/dist/commands/recipes/cache-prune.command.d.ts.map +1 -0
- package/dist/commands/recipes/cache-prune.command.js +30 -0
- package/dist/commands/recipes/cache.command.d.ts +6 -0
- package/dist/commands/recipes/cache.command.d.ts.map +1 -0
- package/dist/commands/recipes/cache.command.js +37 -0
- package/dist/commands/recipes/explain.command.d.ts +7 -0
- package/dist/commands/recipes/explain.command.d.ts.map +1 -0
- package/dist/commands/recipes/explain.command.js +10 -0
- package/dist/commands/recipes/impl/apply.d.ts +16 -0
- package/dist/commands/recipes/impl/apply.d.ts.map +1 -0
- package/dist/commands/recipes/impl/apply.js +97 -0
- package/dist/commands/recipes/impl/archive.d.ts +2 -0
- package/dist/commands/recipes/impl/archive.d.ts.map +1 -0
- package/dist/commands/recipes/impl/archive.js +19 -0
- package/dist/commands/recipes/impl/commands/cache-prune.d.ts +7 -0
- package/dist/commands/recipes/impl/commands/cache-prune.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/cache-prune.js +94 -0
- package/dist/commands/recipes/impl/commands/explain.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/explain.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/explain.js +88 -0
- package/dist/commands/recipes/impl/commands/info.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/info.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/info.js +58 -0
- package/dist/commands/recipes/impl/commands/install.d.ts +11 -0
- package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/install.js +212 -0
- package/dist/commands/recipes/impl/commands/list-remote.d.ts +7 -0
- package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/list-remote.js +53 -0
- package/dist/commands/recipes/impl/commands/list.d.ts +7 -0
- package/dist/commands/recipes/impl/commands/list.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/list.js +38 -0
- package/dist/commands/recipes/impl/commands/remove.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/remove.js +35 -0
- package/dist/commands/recipes/impl/commands.d.ts +8 -0
- package/dist/commands/recipes/impl/commands.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands.js +7 -0
- package/dist/commands/recipes/impl/constants.d.ts +13 -0
- package/dist/commands/recipes/impl/constants.d.ts.map +1 -0
- package/dist/commands/recipes/impl/constants.js +16 -0
- package/dist/commands/recipes/impl/format.d.ts +2 -0
- package/dist/commands/recipes/impl/format.d.ts.map +1 -0
- package/dist/commands/recipes/impl/format.js +9 -0
- package/dist/commands/recipes/impl/index.d.ts +12 -0
- package/dist/commands/recipes/impl/index.d.ts.map +1 -0
- package/dist/commands/recipes/impl/index.js +150 -0
- package/dist/commands/recipes/impl/installed-recipes.d.ts +4 -0
- package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -0
- package/dist/commands/recipes/impl/installed-recipes.js +58 -0
- package/dist/commands/recipes/impl/manifest.d.ts +4 -0
- package/dist/commands/recipes/impl/manifest.d.ts.map +1 -0
- package/dist/commands/recipes/impl/manifest.js +43 -0
- package/dist/commands/recipes/impl/normalize.d.ts +5 -0
- package/dist/commands/recipes/impl/normalize.d.ts.map +1 -0
- package/dist/commands/recipes/impl/normalize.js +50 -0
- package/dist/commands/recipes/impl/paths.d.ts +13 -0
- package/dist/commands/recipes/impl/paths.d.ts.map +1 -0
- package/dist/commands/recipes/impl/paths.js +27 -0
- package/dist/commands/recipes/impl/project.d.ts +8 -0
- package/dist/commands/recipes/impl/project.d.ts.map +1 -0
- package/dist/commands/recipes/impl/project.js +23 -0
- package/dist/commands/recipes/impl/scenario.d.ts +16 -0
- package/dist/commands/recipes/impl/scenario.d.ts.map +1 -0
- package/dist/commands/recipes/impl/scenario.js +128 -0
- package/dist/commands/recipes/impl/types.d.ts +107 -0
- package/dist/commands/recipes/impl/types.d.ts.map +1 -0
- package/dist/commands/recipes/impl/types.js +1 -0
- package/dist/commands/recipes/info.command.d.ts +7 -0
- package/dist/commands/recipes/info.command.d.ts.map +1 -0
- package/dist/commands/recipes/info.command.js +10 -0
- package/dist/commands/recipes/install.command.d.ts +12 -0
- package/dist/commands/recipes/install.command.d.ts.map +1 -0
- package/dist/commands/recipes/install.command.js +161 -0
- package/dist/commands/recipes/list-remote.command.d.ts +6 -0
- package/dist/commands/recipes/list-remote.command.d.ts.map +1 -0
- package/dist/commands/recipes/list-remote.command.js +46 -0
- package/dist/commands/recipes/list.command.d.ts +6 -0
- package/dist/commands/recipes/list.command.d.ts.map +1 -0
- package/dist/commands/recipes/list.command.js +39 -0
- package/dist/commands/recipes/recipes.command.d.ts +6 -0
- package/dist/commands/recipes/recipes.command.d.ts.map +1 -0
- package/dist/commands/recipes/recipes.command.js +45 -0
- package/dist/commands/recipes/remove.command.d.ts +7 -0
- package/dist/commands/recipes/remove.command.d.ts.map +1 -0
- package/dist/commands/recipes/remove.command.js +10 -0
- package/dist/commands/recipes.d.ts +7 -12
- package/dist/commands/recipes.d.ts.map +1 -1
- package/dist/commands/recipes.js +6 -1963
- package/dist/commands/scenario/impl/commands.d.ts +19 -0
- package/dist/commands/scenario/impl/commands.d.ts.map +1 -0
- package/dist/commands/scenario/impl/commands.js +336 -0
- package/dist/commands/scenario/impl/report.d.ts +30 -0
- package/dist/commands/scenario/impl/report.d.ts.map +1 -0
- package/dist/commands/scenario/impl/report.js +99 -0
- package/dist/commands/scenario/info.command.d.ts +8 -0
- package/dist/commands/scenario/info.command.d.ts.map +1 -0
- package/dist/commands/scenario/info.command.js +27 -0
- package/dist/commands/scenario/list.command.d.ts +5 -0
- package/dist/commands/scenario/list.command.d.ts.map +1 -0
- package/dist/commands/scenario/list.command.js +9 -0
- package/dist/commands/scenario/run.command.d.ts +8 -0
- package/dist/commands/scenario/run.command.d.ts.map +1 -0
- package/dist/commands/scenario/run.command.js +27 -0
- package/dist/commands/scenario/scenario.command.d.ts +6 -0
- package/dist/commands/scenario/scenario.command.d.ts.map +1 -0
- package/dist/commands/scenario/scenario.command.js +37 -0
- package/dist/commands/scenario.d.ts +2 -0
- package/dist/commands/scenario.d.ts.map +1 -0
- package/dist/commands/scenario.js +1 -0
- package/dist/commands/shared/git-context.d.ts +23 -0
- package/dist/commands/shared/git-context.d.ts.map +1 -0
- package/dist/commands/shared/git-context.js +140 -0
- package/dist/commands/shared/policy-deny.d.ts +3 -0
- package/dist/commands/shared/policy-deny.d.ts.map +1 -0
- package/dist/commands/shared/policy-deny.js +12 -0
- package/dist/commands/shared/task-backend.d.ts +31 -3
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +42 -5
- package/dist/commands/shared/task-store.d.ts +16 -0
- package/dist/commands/shared/task-store.d.ts.map +1 -0
- package/dist/commands/shared/task-store.js +142 -0
- package/dist/commands/start.command.d.ts +19 -0
- package/dist/commands/start.command.d.ts.map +1 -0
- package/dist/commands/start.command.js +143 -0
- package/dist/commands/sync.command.d.ts +6 -0
- package/dist/commands/sync.command.d.ts.map +1 -0
- package/dist/commands/sync.command.js +57 -0
- package/dist/commands/task/add.command.d.ts +18 -0
- package/dist/commands/task/add.command.d.ts.map +1 -0
- package/dist/commands/task/add.command.js +157 -0
- package/dist/commands/task/add.d.ts +13 -3
- package/dist/commands/task/add.d.ts.map +1 -1
- package/dist/commands/task/add.js +21 -126
- package/dist/commands/task/block.d.ts +2 -2
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +31 -21
- package/dist/commands/task/comment.command.d.ts +10 -0
- package/dist/commands/task/comment.command.d.ts.map +1 -0
- package/dist/commands/task/comment.command.js +57 -0
- package/dist/commands/task/comment.d.ts +2 -0
- package/dist/commands/task/comment.d.ts.map +1 -1
- package/dist/commands/task/comment.js +19 -9
- package/dist/commands/task/derive.command.d.ts +13 -0
- package/dist/commands/task/derive.command.d.ts.map +1 -0
- package/dist/commands/task/derive.command.js +94 -0
- package/dist/commands/task/derive.d.ts +13 -0
- package/dist/commands/task/derive.d.ts.map +1 -0
- package/dist/commands/task/derive.js +71 -0
- package/dist/commands/task/doc-set.command.d.ts +12 -0
- package/dist/commands/task/doc-set.command.d.ts.map +1 -0
- package/dist/commands/task/doc-set.command.js +82 -0
- package/dist/commands/task/doc-show.command.d.ts +10 -0
- package/dist/commands/task/doc-show.command.d.ts.map +1 -0
- package/dist/commands/task/doc-show.command.js +54 -0
- package/dist/commands/task/doc.command.d.ts +7 -0
- package/dist/commands/task/doc.command.d.ts.map +1 -0
- package/dist/commands/task/doc.command.js +22 -0
- package/dist/commands/task/doc.d.ts +9 -6
- package/dist/commands/task/doc.d.ts.map +1 -1
- package/dist/commands/task/doc.js +61 -113
- package/dist/commands/task/export.command.d.ts +6 -0
- package/dist/commands/task/export.command.d.ts.map +1 -0
- package/dist/commands/task/export.command.js +17 -0
- package/dist/commands/task/export.d.ts +2 -0
- package/dist/commands/task/export.d.ts.map +1 -1
- package/dist/commands/task/export.js +7 -9
- package/dist/commands/task/finish.d.ts +5 -4
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +80 -37
- package/dist/commands/task/index.d.ts +14 -13
- package/dist/commands/task/index.d.ts.map +1 -1
- package/dist/commands/task/index.js +13 -13
- package/dist/commands/task/lint.command.d.ts +5 -0
- package/dist/commands/task/lint.command.d.ts.map +1 -0
- package/dist/commands/task/lint.command.js +11 -0
- package/dist/commands/task/list.command.d.ts +9 -0
- package/dist/commands/task/list.command.d.ts.map +1 -0
- package/dist/commands/task/list.command.js +68 -0
- package/dist/commands/task/list.d.ts +6 -2
- package/dist/commands/task/list.d.ts.map +1 -1
- package/dist/commands/task/list.js +12 -15
- package/dist/commands/task/migrate-doc.command.d.ts +9 -0
- package/dist/commands/task/migrate-doc.command.d.ts.map +1 -0
- package/dist/commands/task/migrate-doc.command.js +65 -0
- package/dist/commands/task/migrate-doc.d.ts +3 -3
- package/dist/commands/task/migrate-doc.d.ts.map +1 -1
- package/dist/commands/task/migrate-doc.js +40 -47
- package/dist/commands/task/migrate.command.d.ts +10 -0
- package/dist/commands/task/migrate.command.d.ts.map +1 -0
- package/dist/commands/task/migrate.command.js +50 -0
- package/dist/commands/task/migrate.d.ts +5 -1
- package/dist/commands/task/migrate.d.ts.map +1 -1
- package/dist/commands/task/migrate.js +10 -44
- package/dist/commands/task/new.command.d.ts +6 -0
- package/dist/commands/task/new.command.d.ts.map +1 -0
- package/dist/commands/task/new.command.js +13 -0
- package/dist/commands/task/new.d.ts +13 -4
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +30 -92
- package/dist/commands/task/new.spec.d.ts +4 -0
- package/dist/commands/task/new.spec.d.ts.map +1 -0
- package/dist/commands/task/new.spec.js +79 -0
- package/dist/commands/task/next.command.d.ts +9 -0
- package/dist/commands/task/next.command.d.ts.map +1 -0
- package/dist/commands/task/next.command.js +89 -0
- package/dist/commands/task/next.d.ts +4 -1
- package/dist/commands/task/next.d.ts.map +1 -1
- package/dist/commands/task/next.js +15 -16
- package/dist/commands/task/normalize.command.d.ts +9 -0
- package/dist/commands/task/normalize.command.d.ts.map +1 -0
- package/dist/commands/task/normalize.command.js +39 -0
- package/dist/commands/task/normalize.d.ts +4 -1
- package/dist/commands/task/normalize.d.ts.map +1 -1
- package/dist/commands/task/normalize.js +18 -31
- package/dist/commands/task/plan-approve.command.d.ts +10 -0
- package/dist/commands/task/plan-approve.command.d.ts.map +1 -0
- package/dist/commands/task/plan-approve.command.js +54 -0
- package/dist/commands/task/plan-reject.command.d.ts +10 -0
- package/dist/commands/task/plan-reject.command.d.ts.map +1 -0
- package/dist/commands/task/plan-reject.command.js +59 -0
- package/dist/commands/task/plan-set.command.d.ts +11 -0
- package/dist/commands/task/plan-set.command.d.ts.map +1 -0
- package/dist/commands/task/plan-set.command.js +76 -0
- package/dist/commands/task/plan.d.ts +23 -10
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +182 -177
- package/dist/commands/task/ready.d.ts +2 -0
- package/dist/commands/task/ready.d.ts.map +1 -1
- package/dist/commands/task/ready.js +4 -6
- package/dist/commands/task/scaffold.command.d.ts +12 -0
- package/dist/commands/task/scaffold.command.d.ts.map +1 -0
- package/dist/commands/task/scaffold.command.js +73 -0
- package/dist/commands/task/scaffold.d.ts +7 -3
- package/dist/commands/task/scaffold.d.ts.map +1 -1
- package/dist/commands/task/scaffold.js +57 -67
- package/dist/commands/task/scrub.command.d.ts +11 -0
- package/dist/commands/task/scrub.command.d.ts.map +1 -0
- package/dist/commands/task/scrub.command.js +72 -0
- package/dist/commands/task/scrub.d.ts +6 -3
- package/dist/commands/task/scrub.d.ts.map +1 -1
- package/dist/commands/task/scrub.js +12 -68
- package/dist/commands/task/search.command.d.ts +11 -0
- package/dist/commands/task/search.command.d.ts.map +1 -0
- package/dist/commands/task/search.command.js +101 -0
- package/dist/commands/task/search.d.ts +5 -1
- package/dist/commands/task/search.d.ts.map +1 -1
- package/dist/commands/task/search.js +14 -23
- package/dist/commands/task/set-status.command.d.ts +21 -0
- package/dist/commands/task/set-status.command.d.ts.map +1 -0
- package/dist/commands/task/set-status.command.js +171 -0
- package/dist/commands/task/set-status.d.ts +2 -0
- package/dist/commands/task/set-status.d.ts.map +1 -1
- package/dist/commands/task/set-status.js +32 -12
- package/dist/commands/task/shared.d.ts +8 -2
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +68 -28
- package/dist/commands/task/show.command.d.ts +8 -0
- package/dist/commands/task/show.command.d.ts.map +1 -0
- package/dist/commands/task/show.command.js +19 -0
- package/dist/commands/task/show.d.ts +2 -0
- package/dist/commands/task/show.d.ts.map +1 -1
- package/dist/commands/task/show.js +5 -7
- package/dist/commands/task/start.d.ts +2 -2
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +66 -23
- package/dist/commands/task/update.command.d.ts +18 -0
- package/dist/commands/task/update.command.d.ts.map +1 -0
- package/dist/commands/task/update.command.js +141 -0
- package/dist/commands/task/update.d.ts +13 -3
- package/dist/commands/task/update.d.ts.map +1 -1
- package/dist/commands/task/update.js +31 -122
- package/dist/commands/task/verify-ok.command.d.ts +13 -0
- package/dist/commands/task/verify-ok.command.d.ts.map +1 -0
- package/dist/commands/task/verify-ok.command.js +83 -0
- package/dist/commands/task/verify-record.d.ts +30 -8
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +114 -117
- package/dist/commands/task/verify-rework.command.d.ts +13 -0
- package/dist/commands/task/verify-rework.command.d.ts.map +1 -0
- package/dist/commands/task/verify-rework.command.js +83 -0
- package/dist/commands/task/verify-show.command.d.ts +9 -0
- package/dist/commands/task/verify-show.command.d.ts.map +1 -0
- package/dist/commands/task/verify-show.command.js +38 -0
- package/dist/commands/task/verify.command.d.ts +7 -0
- package/dist/commands/task/verify.command.d.ts.map +1 -0
- package/dist/commands/task/verify.command.js +20 -0
- package/dist/commands/upgrade.command.d.ts +6 -0
- package/dist/commands/upgrade.command.d.ts.map +1 -0
- package/dist/commands/upgrade.command.js +104 -0
- package/dist/commands/upgrade.d.ts +13 -2
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +12 -80
- package/dist/commands/verify.command.d.ts +16 -0
- package/dist/commands/verify.command.d.ts.map +1 -0
- package/dist/commands/verify.command.js +113 -0
- package/dist/commands/workflow.d.ts +4 -6
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +4 -7
- package/dist/meta/release.d.ts +2 -0
- package/dist/meta/release.d.ts.map +1 -0
- package/dist/meta/release.js +50 -0
- package/dist/policy/evaluate.d.ts +3 -0
- package/dist/policy/evaluate.d.ts.map +1 -0
- package/dist/policy/evaluate.js +27 -0
- package/dist/policy/result.d.ts +7 -0
- package/dist/policy/result.d.ts.map +1 -0
- package/dist/policy/result.js +21 -0
- package/dist/policy/rules/allowlist.d.ts +3 -0
- package/dist/policy/rules/allowlist.d.ts.map +1 -0
- package/dist/policy/rules/allowlist.js +30 -0
- package/dist/policy/rules/branch-pr-base.d.ts +3 -0
- package/dist/policy/rules/branch-pr-base.d.ts.map +1 -0
- package/dist/policy/rules/branch-pr-base.js +43 -0
- package/dist/policy/rules/clean-tree.d.ts +3 -0
- package/dist/policy/rules/clean-tree.d.ts.map +1 -0
- package/dist/policy/rules/clean-tree.js +19 -0
- package/dist/policy/rules/commit-subject.d.ts +3 -0
- package/dist/policy/rules/commit-subject.d.ts.map +1 -0
- package/dist/policy/rules/commit-subject.js +33 -0
- package/dist/policy/rules/protected-paths.d.ts +3 -0
- package/dist/policy/rules/protected-paths.d.ts.map +1 -0
- package/dist/policy/rules/protected-paths.js +53 -0
- package/dist/policy/types.d.ts +38 -0
- package/dist/policy/types.d.ts.map +1 -0
- package/dist/policy/types.js +1 -0
- package/dist/shared/git-log.d.ts +5 -0
- package/dist/shared/git-log.d.ts.map +1 -0
- package/dist/shared/git-log.js +14 -0
- package/dist/shared/git-path.d.ts +3 -0
- package/dist/shared/git-path.d.ts.map +1 -0
- package/dist/shared/git-path.js +30 -0
- package/dist/shared/guards.d.ts +2 -0
- package/dist/shared/guards.d.ts.map +1 -0
- package/dist/shared/guards.js +3 -0
- package/dist/shared/protected-paths.d.ts +12 -0
- package/dist/shared/protected-paths.d.ts.map +1 -0
- package/dist/shared/protected-paths.js +51 -0
- package/dist/shared/strings.d.ts +2 -0
- package/dist/shared/strings.d.ts.map +1 -0
- package/dist/shared/strings.js +14 -0
- package/dist/shared/write-if-changed.d.ts +3 -0
- package/dist/shared/write-if-changed.d.ts.map +1 -0
- package/dist/shared/write-if-changed.js +25 -0
- package/package.json +2 -2
- package/dist/cli/help.d.ts +0 -2
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -127
- package/dist/commands/task/verify.d.ts +0 -2
- package/dist/commands/task/verify.d.ts.map +0 -1
- package/dist/commands/task/verify.js +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type TaskBackend, type TaskData } from "./shared.js";
|
|
2
|
+
export declare class LocalBackend implements TaskBackend {
|
|
3
|
+
id: string;
|
|
4
|
+
root: string;
|
|
5
|
+
updatedBy: string;
|
|
6
|
+
constructor(settings?: {
|
|
7
|
+
dir?: string;
|
|
8
|
+
updatedBy?: string;
|
|
9
|
+
});
|
|
10
|
+
generateTaskId(opts: {
|
|
11
|
+
length: number;
|
|
12
|
+
attempts: number;
|
|
13
|
+
}): Promise<string>;
|
|
14
|
+
listTasks(): Promise<TaskData[]>;
|
|
15
|
+
getTask(taskId: string): Promise<TaskData | null>;
|
|
16
|
+
getTasks(taskIds: string[]): Promise<(TaskData | null)[]>;
|
|
17
|
+
getTaskDoc(taskId: string): Promise<string>;
|
|
18
|
+
writeTask(task: TaskData): Promise<void>;
|
|
19
|
+
setTaskDoc(taskId: string, doc: string, updatedBy?: string): Promise<void>;
|
|
20
|
+
touchTaskDocMetadata(taskId: string, updatedBy?: string): Promise<void>;
|
|
21
|
+
writeTasks(tasks: TaskData[]): Promise<void>;
|
|
22
|
+
normalizeTasks(): Promise<{
|
|
23
|
+
scanned: number;
|
|
24
|
+
changed: number;
|
|
25
|
+
}>;
|
|
26
|
+
exportTasksJson(outputPath: string): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=local-backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-backend.d.ts","sourceRoot":"","sources":["../../../src/backends/task-backend/local-backend.ts"],"names":[],"mappings":"AAqBA,OAAO,EAiBL,KAAK,WAAW,EAChB,KAAK,QAAQ,EACd,MAAM,aAAa,CAAC;AAErB,qBAAa,YAAa,YAAW,WAAW;IAC9C,EAAE,SAAW;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;gBAEN,QAAQ,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;IAKrD,cAAc,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAqB3E,SAAS,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IA4EhC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAoBjD,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC;IAKzD,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAO3C,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAyExC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB1E,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBvE,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAO5C,cAAc,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAoF/D,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIzD"}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { mkdir, readdir, readFile, stat } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { docChanged, parseTaskReadme, renderTaskReadme, taskReadmePath, } from "@agentplaneorg/core";
|
|
4
|
+
import { isRecord } from "../../shared/guards.js";
|
|
5
|
+
import { writeTextIfChanged } from "../../shared/write-if-changed.js";
|
|
6
|
+
import { buildTaskIndexEntry, loadTaskIndex, resolveTaskIndexPath, saveTaskIndex, } from "../task-index.js";
|
|
7
|
+
import { DEFAULT_DOC_UPDATED_BY, DOC_VERSION, defaultPlanApproval, defaultVerificationResult, extractTaskDoc, generateTaskId, invalidLengthMessage, mapLimit, mergeTaskDoc, missingTaskIdMessage, nowIso, resolveDocUpdatedByFromFrontmatter, resolveDocUpdatedByFromTask, taskRecordToData, validateTaskId, writeTasksExportFromTasks, } from "./shared.js";
|
|
8
|
+
export class LocalBackend {
|
|
9
|
+
id = "local";
|
|
10
|
+
root;
|
|
11
|
+
updatedBy;
|
|
12
|
+
constructor(settings) {
|
|
13
|
+
this.root = path.resolve(settings?.dir ?? ".agentplane/tasks");
|
|
14
|
+
this.updatedBy = settings?.updatedBy ?? DEFAULT_DOC_UPDATED_BY;
|
|
15
|
+
}
|
|
16
|
+
async generateTaskId(opts) {
|
|
17
|
+
const length = opts.length;
|
|
18
|
+
if (length < 4)
|
|
19
|
+
throw new Error(invalidLengthMessage(length, 4));
|
|
20
|
+
const attempts = Math.max(1, opts.attempts);
|
|
21
|
+
return await generateTaskId({
|
|
22
|
+
length,
|
|
23
|
+
attempts,
|
|
24
|
+
isAvailable: async (taskId) => {
|
|
25
|
+
const readmePath = taskReadmePath(this.root, taskId);
|
|
26
|
+
try {
|
|
27
|
+
await readFile(readmePath, "utf8");
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
const code = err?.code;
|
|
32
|
+
if (code === "ENOENT")
|
|
33
|
+
return true;
|
|
34
|
+
throw err;
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async listTasks() {
|
|
40
|
+
const tasks = [];
|
|
41
|
+
const entries = await readdir(this.root, { withFileTypes: true }).catch(() => []);
|
|
42
|
+
const indexPath = resolveTaskIndexPath(this.root);
|
|
43
|
+
const cachedIndex = await loadTaskIndex(indexPath);
|
|
44
|
+
const cachedByPath = new Map();
|
|
45
|
+
if (cachedIndex) {
|
|
46
|
+
for (const entry of cachedIndex.tasks) {
|
|
47
|
+
cachedByPath.set(entry.readmePath, entry);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const nextIndex = [];
|
|
51
|
+
const seen = new Set();
|
|
52
|
+
for (const entry of entries) {
|
|
53
|
+
if (!entry.isDirectory())
|
|
54
|
+
continue;
|
|
55
|
+
const readme = path.join(this.root, entry.name, "README.md");
|
|
56
|
+
let stats;
|
|
57
|
+
try {
|
|
58
|
+
stats = await stat(readme);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (!stats.isFile())
|
|
64
|
+
continue;
|
|
65
|
+
const cached = cachedByPath.get(readme);
|
|
66
|
+
if (cached?.mtimeMs === stats.mtimeMs) {
|
|
67
|
+
const taskId = cached.task.id.trim();
|
|
68
|
+
if (taskId) {
|
|
69
|
+
validateTaskId(taskId);
|
|
70
|
+
if (seen.has(taskId)) {
|
|
71
|
+
throw new Error(`Duplicate task id in local backend: ${taskId}`);
|
|
72
|
+
}
|
|
73
|
+
seen.add(taskId);
|
|
74
|
+
}
|
|
75
|
+
tasks.push(cached.task);
|
|
76
|
+
nextIndex.push(cached);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
let text = "";
|
|
80
|
+
try {
|
|
81
|
+
text = await readFile(readme, "utf8");
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
let parsed;
|
|
87
|
+
try {
|
|
88
|
+
parsed = parseTaskReadme(text);
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const fm = parsed.frontmatter;
|
|
94
|
+
if (!isRecord(fm) || Object.keys(fm).length === 0)
|
|
95
|
+
continue;
|
|
96
|
+
const taskId = (typeof fm.id === "string" ? fm.id : entry.name).trim();
|
|
97
|
+
if (taskId) {
|
|
98
|
+
validateTaskId(taskId);
|
|
99
|
+
if (seen.has(taskId)) {
|
|
100
|
+
throw new Error(`Duplicate task id in local backend: ${taskId}`);
|
|
101
|
+
}
|
|
102
|
+
seen.add(taskId);
|
|
103
|
+
}
|
|
104
|
+
const task = taskRecordToData({
|
|
105
|
+
id: taskId,
|
|
106
|
+
frontmatter: fm,
|
|
107
|
+
body: parsed.body,
|
|
108
|
+
readmePath: readme,
|
|
109
|
+
});
|
|
110
|
+
tasks.push(task);
|
|
111
|
+
nextIndex.push(buildTaskIndexEntry(task, readme, stats.mtimeMs));
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
await saveTaskIndex(indexPath, { schema_version: 1, tasks: nextIndex });
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
// Best-effort cache; ignore failures.
|
|
118
|
+
}
|
|
119
|
+
return tasks;
|
|
120
|
+
}
|
|
121
|
+
async getTask(taskId) {
|
|
122
|
+
const readme = taskReadmePath(this.root, taskId);
|
|
123
|
+
let text = "";
|
|
124
|
+
try {
|
|
125
|
+
text = await readFile(readme, "utf8");
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
const code = err?.code;
|
|
129
|
+
if (code === "ENOENT")
|
|
130
|
+
return null;
|
|
131
|
+
throw err;
|
|
132
|
+
}
|
|
133
|
+
const parsed = parseTaskReadme(text);
|
|
134
|
+
const task = taskRecordToData({
|
|
135
|
+
id: taskId,
|
|
136
|
+
frontmatter: parsed.frontmatter,
|
|
137
|
+
body: parsed.body,
|
|
138
|
+
readmePath: readme,
|
|
139
|
+
});
|
|
140
|
+
return task;
|
|
141
|
+
}
|
|
142
|
+
async getTasks(taskIds) {
|
|
143
|
+
// Keep ordering stable for callers; use limited parallelism to avoid IO storms.
|
|
144
|
+
return await mapLimit(taskIds, 8, async (taskId) => await this.getTask(taskId));
|
|
145
|
+
}
|
|
146
|
+
async getTaskDoc(taskId) {
|
|
147
|
+
const readme = taskReadmePath(this.root, taskId);
|
|
148
|
+
const text = await readFile(readme, "utf8");
|
|
149
|
+
const parsed = parseTaskReadme(text);
|
|
150
|
+
return extractTaskDoc(parsed.body);
|
|
151
|
+
}
|
|
152
|
+
async writeTask(task) {
|
|
153
|
+
const taskId = task.id.trim();
|
|
154
|
+
if (!taskId)
|
|
155
|
+
throw new Error(missingTaskIdMessage());
|
|
156
|
+
validateTaskId(taskId);
|
|
157
|
+
const readme = taskReadmePath(this.root, taskId);
|
|
158
|
+
let body = "";
|
|
159
|
+
let existingDoc = "";
|
|
160
|
+
let existingFrontmatter = {};
|
|
161
|
+
try {
|
|
162
|
+
const text = await readFile(readme, "utf8");
|
|
163
|
+
const parsed = parseTaskReadme(text);
|
|
164
|
+
body = parsed.body;
|
|
165
|
+
existingDoc = extractTaskDoc(parsed.body);
|
|
166
|
+
existingFrontmatter = parsed.frontmatter;
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
const code = err?.code;
|
|
170
|
+
if (code !== "ENOENT")
|
|
171
|
+
throw err;
|
|
172
|
+
}
|
|
173
|
+
const payload = { ...task };
|
|
174
|
+
delete payload.doc;
|
|
175
|
+
for (const [key, value] of Object.entries(payload)) {
|
|
176
|
+
if (value === undefined)
|
|
177
|
+
delete payload[key];
|
|
178
|
+
}
|
|
179
|
+
for (const key of ["doc_version", "doc_updated_at", "doc_updated_by"]) {
|
|
180
|
+
if (payload[key] === undefined && existingFrontmatter[key] !== undefined) {
|
|
181
|
+
payload[key] = existingFrontmatter[key];
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (payload.plan_approval === undefined && existingFrontmatter.plan_approval !== undefined) {
|
|
185
|
+
payload.plan_approval = existingFrontmatter.plan_approval;
|
|
186
|
+
}
|
|
187
|
+
if (payload.plan_approval === undefined) {
|
|
188
|
+
payload.plan_approval = defaultPlanApproval();
|
|
189
|
+
}
|
|
190
|
+
if (payload.verification === undefined && existingFrontmatter.verification !== undefined) {
|
|
191
|
+
payload.verification = existingFrontmatter.verification;
|
|
192
|
+
}
|
|
193
|
+
if (payload.verification === undefined) {
|
|
194
|
+
payload.verification = defaultVerificationResult();
|
|
195
|
+
}
|
|
196
|
+
if (task.doc !== undefined) {
|
|
197
|
+
const docText = String(task.doc ?? "");
|
|
198
|
+
body = mergeTaskDoc(body, docText);
|
|
199
|
+
if (docChanged(existingDoc, docText)) {
|
|
200
|
+
payload.doc_version = DOC_VERSION;
|
|
201
|
+
payload.doc_updated_at = nowIso();
|
|
202
|
+
payload.doc_updated_by = resolveDocUpdatedByFromTask(task, this.updatedBy);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (payload.doc_version !== DOC_VERSION) {
|
|
206
|
+
payload.doc_version = DOC_VERSION;
|
|
207
|
+
}
|
|
208
|
+
if (payload.doc_updated_at === undefined || payload.doc_updated_at === "") {
|
|
209
|
+
payload.doc_updated_at = nowIso();
|
|
210
|
+
}
|
|
211
|
+
if (payload.doc_updated_by === undefined || payload.doc_updated_by === "") {
|
|
212
|
+
payload.doc_updated_by = resolveDocUpdatedByFromTask(task, this.updatedBy);
|
|
213
|
+
}
|
|
214
|
+
await mkdir(path.dirname(readme), { recursive: true });
|
|
215
|
+
const text = renderTaskReadme(payload, body || "");
|
|
216
|
+
await writeTextIfChanged(readme, text.endsWith("\n") ? text : `${text}\n`);
|
|
217
|
+
}
|
|
218
|
+
async setTaskDoc(taskId, doc, updatedBy) {
|
|
219
|
+
const readme = taskReadmePath(this.root, taskId);
|
|
220
|
+
const text = await readFile(readme, "utf8");
|
|
221
|
+
const parsed = parseTaskReadme(text);
|
|
222
|
+
const docText = String(doc ?? "");
|
|
223
|
+
const body = mergeTaskDoc(parsed.body, docText);
|
|
224
|
+
const frontmatter = { ...parsed.frontmatter };
|
|
225
|
+
if (docChanged(extractTaskDoc(parsed.body), docText) || !frontmatter.doc_updated_at) {
|
|
226
|
+
frontmatter.doc_version = DOC_VERSION;
|
|
227
|
+
frontmatter.doc_updated_at = nowIso();
|
|
228
|
+
frontmatter.doc_updated_by = resolveDocUpdatedByFromFrontmatter(frontmatter, updatedBy, this.updatedBy);
|
|
229
|
+
}
|
|
230
|
+
if (frontmatter.doc_version !== DOC_VERSION) {
|
|
231
|
+
frontmatter.doc_version = DOC_VERSION;
|
|
232
|
+
}
|
|
233
|
+
const next = renderTaskReadme(frontmatter, body);
|
|
234
|
+
await writeTextIfChanged(readme, next.endsWith("\n") ? next : `${next}\n`);
|
|
235
|
+
}
|
|
236
|
+
async touchTaskDocMetadata(taskId, updatedBy) {
|
|
237
|
+
const readme = taskReadmePath(this.root, taskId);
|
|
238
|
+
const text = await readFile(readme, "utf8");
|
|
239
|
+
const parsed = parseTaskReadme(text);
|
|
240
|
+
const frontmatter = { ...parsed.frontmatter };
|
|
241
|
+
frontmatter.doc_version = DOC_VERSION;
|
|
242
|
+
frontmatter.doc_updated_at = nowIso();
|
|
243
|
+
frontmatter.doc_updated_by = resolveDocUpdatedByFromFrontmatter(frontmatter, updatedBy, this.updatedBy);
|
|
244
|
+
const next = renderTaskReadme(frontmatter, parsed.body || "");
|
|
245
|
+
await writeTextIfChanged(readme, next.endsWith("\n") ? next : `${next}\n`);
|
|
246
|
+
}
|
|
247
|
+
async writeTasks(tasks) {
|
|
248
|
+
await mapLimit(tasks, 4, async (task) => {
|
|
249
|
+
await this.writeTask(task);
|
|
250
|
+
return null;
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
async normalizeTasks() {
|
|
254
|
+
const entries = await readdir(this.root, { withFileTypes: true }).catch(() => []);
|
|
255
|
+
const dirs = entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
256
|
+
const results = await mapLimit(dirs, 8, async (dirName) => {
|
|
257
|
+
const readme = path.join(this.root, dirName, "README.md");
|
|
258
|
+
let text = "";
|
|
259
|
+
try {
|
|
260
|
+
text = await readFile(readme, "utf8");
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
return { taskId: "", scanned: false, changed: false };
|
|
264
|
+
}
|
|
265
|
+
let parsed;
|
|
266
|
+
try {
|
|
267
|
+
parsed = parseTaskReadme(text);
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
return { taskId: "", scanned: false, changed: false };
|
|
271
|
+
}
|
|
272
|
+
const fm = parsed.frontmatter;
|
|
273
|
+
if (!isRecord(fm) || Object.keys(fm).length === 0) {
|
|
274
|
+
return { taskId: "", scanned: false, changed: false };
|
|
275
|
+
}
|
|
276
|
+
const taskId = (typeof fm.id === "string" ? fm.id : dirName).trim();
|
|
277
|
+
if (taskId)
|
|
278
|
+
validateTaskId(taskId);
|
|
279
|
+
const task = taskRecordToData({
|
|
280
|
+
id: taskId,
|
|
281
|
+
frontmatter: fm,
|
|
282
|
+
body: parsed.body,
|
|
283
|
+
readmePath: readme,
|
|
284
|
+
});
|
|
285
|
+
// Render using the same normalization rules as writeTask, but avoid rewriting the file when the
|
|
286
|
+
// rendered output is identical (prevents mtime churn and diff-noise).
|
|
287
|
+
const payload = { ...task };
|
|
288
|
+
delete payload.doc;
|
|
289
|
+
for (const [key, value] of Object.entries(payload)) {
|
|
290
|
+
if (value === undefined)
|
|
291
|
+
delete payload[key];
|
|
292
|
+
}
|
|
293
|
+
for (const key of ["doc_version", "doc_updated_at", "doc_updated_by"]) {
|
|
294
|
+
if (payload[key] === undefined && fm[key] !== undefined)
|
|
295
|
+
payload[key] = fm[key];
|
|
296
|
+
}
|
|
297
|
+
if (payload.plan_approval === undefined && fm.plan_approval !== undefined) {
|
|
298
|
+
payload.plan_approval = fm.plan_approval;
|
|
299
|
+
}
|
|
300
|
+
if (payload.plan_approval === undefined)
|
|
301
|
+
payload.plan_approval = defaultPlanApproval();
|
|
302
|
+
if (payload.verification === undefined && fm.verification !== undefined) {
|
|
303
|
+
payload.verification = fm.verification;
|
|
304
|
+
}
|
|
305
|
+
if (payload.verification === undefined)
|
|
306
|
+
payload.verification = defaultVerificationResult();
|
|
307
|
+
if (payload.doc_version !== DOC_VERSION)
|
|
308
|
+
payload.doc_version = DOC_VERSION;
|
|
309
|
+
if (payload.doc_updated_at === undefined || payload.doc_updated_at === "") {
|
|
310
|
+
payload.doc_updated_at = nowIso();
|
|
311
|
+
}
|
|
312
|
+
if (payload.doc_updated_by === undefined || payload.doc_updated_by === "") {
|
|
313
|
+
payload.doc_updated_by = resolveDocUpdatedByFromTask(task, this.updatedBy);
|
|
314
|
+
}
|
|
315
|
+
const next = renderTaskReadme(payload, parsed.body || "");
|
|
316
|
+
const didWrite = await writeTextIfChanged(readme, next.endsWith("\n") ? next : `${next}\n`);
|
|
317
|
+
return { taskId, scanned: true, changed: didWrite };
|
|
318
|
+
});
|
|
319
|
+
const seen = new Set();
|
|
320
|
+
for (const { taskId } of results) {
|
|
321
|
+
if (!taskId)
|
|
322
|
+
continue;
|
|
323
|
+
if (seen.has(taskId))
|
|
324
|
+
throw new Error(`Duplicate task id in local backend: ${taskId}`);
|
|
325
|
+
seen.add(taskId);
|
|
326
|
+
}
|
|
327
|
+
const scanned = results.reduce((acc, r) => acc + (r.scanned ? 1 : 0), 0);
|
|
328
|
+
const changed = results.reduce((acc, r) => acc + (r.changed ? 1 : 0), 0);
|
|
329
|
+
return { scanned, changed };
|
|
330
|
+
}
|
|
331
|
+
async exportTasksJson(outputPath) {
|
|
332
|
+
const tasks = await this.listTasks();
|
|
333
|
+
await writeTasksExportFromTasks({ outputPath, tasks });
|
|
334
|
+
}
|
|
335
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function requestJson(opts: {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
apiKey: string;
|
|
4
|
+
}, method: string, reqPath: string, payload?: Record<string, unknown>, params?: Record<string, unknown>, requestOpts?: {
|
|
5
|
+
attempts?: number;
|
|
6
|
+
backoff?: number;
|
|
7
|
+
}): Promise<Record<string, unknown>>;
|
|
8
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/backends/task-backend/redmine/client.ts"],"names":[],"mappings":"AAIA,wBAAsB,WAAW,CAC/B,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACzC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,WAAW,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACpD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAqDlC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { isRecord } from "../../../shared/guards.js";
|
|
2
|
+
import { BackendError, RedmineUnavailable, sleep, toStringSafe } from "../shared.js";
|
|
3
|
+
export async function requestJson(opts, method, reqPath, payload, params, requestOpts) {
|
|
4
|
+
let url = `${opts.baseUrl}/${reqPath.replace(/^\//u, "")}`;
|
|
5
|
+
if (params) {
|
|
6
|
+
const search = new URLSearchParams();
|
|
7
|
+
for (const [key, value] of Object.entries(params)) {
|
|
8
|
+
if (value === undefined || value === null)
|
|
9
|
+
continue;
|
|
10
|
+
search.append(key, toStringSafe(value));
|
|
11
|
+
}
|
|
12
|
+
const qs = search.toString();
|
|
13
|
+
if (qs)
|
|
14
|
+
url += `?${qs}`;
|
|
15
|
+
}
|
|
16
|
+
const attempts = Math.max(1, requestOpts?.attempts ?? 3);
|
|
17
|
+
const backoff = requestOpts?.backoff ?? 0.5;
|
|
18
|
+
let lastError = null;
|
|
19
|
+
for (let attempt = 1; attempt <= attempts; attempt++) {
|
|
20
|
+
try {
|
|
21
|
+
const resp = await fetch(url, {
|
|
22
|
+
method,
|
|
23
|
+
headers: {
|
|
24
|
+
"Content-Type": "application/json",
|
|
25
|
+
"X-Redmine-API-Key": opts.apiKey,
|
|
26
|
+
},
|
|
27
|
+
body: payload ? JSON.stringify(payload) : undefined,
|
|
28
|
+
});
|
|
29
|
+
const text = await resp.text();
|
|
30
|
+
if (!resp.ok) {
|
|
31
|
+
if ((resp.status === 429 || resp.status >= 500) && attempt < attempts) {
|
|
32
|
+
await sleep(backoff * attempt * 1000);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
throw new BackendError(`Redmine API error: ${resp.status} ${text}`, "E_BACKEND");
|
|
36
|
+
}
|
|
37
|
+
if (!text)
|
|
38
|
+
return {};
|
|
39
|
+
try {
|
|
40
|
+
const parsed = JSON.parse(text);
|
|
41
|
+
if (isRecord(parsed))
|
|
42
|
+
return parsed;
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
lastError = err;
|
|
51
|
+
if (err instanceof BackendError)
|
|
52
|
+
throw err;
|
|
53
|
+
if (attempt >= attempts) {
|
|
54
|
+
throw new RedmineUnavailable("Redmine unavailable");
|
|
55
|
+
}
|
|
56
|
+
await sleep(backoff * attempt * 1000);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
throw lastError instanceof Error ? lastError : new RedmineUnavailable("Redmine unavailable");
|
|
60
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type TaskComment = {
|
|
2
|
+
author: string;
|
|
3
|
+
body: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function normalizeComments(value: unknown): TaskComment[];
|
|
6
|
+
export declare function appendCommentNotes(opts: {
|
|
7
|
+
issueId: string;
|
|
8
|
+
existingComments: TaskComment[];
|
|
9
|
+
desiredComments: TaskComment[];
|
|
10
|
+
requestJson: (method: string, reqPath: string, payload?: Record<string, unknown>, params?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../../../src/backends/task-backend/redmine/comments.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,EAAE,CAW/D;AAmBD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,WAAW,EAAE,CAAC;IAChC,eAAe,EAAE,WAAW,EAAE,CAAC;IAC/B,WAAW,EAAE,CACX,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACvC,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBhB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { isRecord } from "../../../shared/guards.js";
|
|
2
|
+
import { toStringSafe } from "../shared.js";
|
|
3
|
+
export function normalizeComments(value) {
|
|
4
|
+
if (Array.isArray(value)) {
|
|
5
|
+
return value.filter((item) => isRecord(item) ? typeof item.author === "string" && typeof item.body === "string" : false);
|
|
6
|
+
}
|
|
7
|
+
if (isRecord(value))
|
|
8
|
+
return [value];
|
|
9
|
+
if (typeof value === "string" && value.trim()) {
|
|
10
|
+
return [{ author: "redmine", body: value.trim() }];
|
|
11
|
+
}
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
function commentsToPairs(comments) {
|
|
15
|
+
const pairs = [];
|
|
16
|
+
for (const comment of comments) {
|
|
17
|
+
const author = toStringSafe(comment.author).trim();
|
|
18
|
+
const body = toStringSafe(comment.body).trim();
|
|
19
|
+
if (!author && !body)
|
|
20
|
+
continue;
|
|
21
|
+
pairs.push([author, body]);
|
|
22
|
+
}
|
|
23
|
+
return pairs;
|
|
24
|
+
}
|
|
25
|
+
function formatCommentNote(author = "unknown", body = "") {
|
|
26
|
+
const authorText = author;
|
|
27
|
+
const bodyText = body;
|
|
28
|
+
return `[comment] ${authorText}: ${bodyText}`.trim();
|
|
29
|
+
}
|
|
30
|
+
export async function appendCommentNotes(opts) {
|
|
31
|
+
const issueIdText = toStringSafe(opts.issueId);
|
|
32
|
+
if (!issueIdText)
|
|
33
|
+
return;
|
|
34
|
+
const existingPairs = commentsToPairs(opts.existingComments);
|
|
35
|
+
const desiredPairs = commentsToPairs(opts.desiredComments);
|
|
36
|
+
if (desiredPairs.length === 0)
|
|
37
|
+
return;
|
|
38
|
+
if (desiredPairs.length < existingPairs.length)
|
|
39
|
+
return;
|
|
40
|
+
if (existingPairs.length > 0) {
|
|
41
|
+
const prefix = desiredPairs.slice(0, existingPairs.length);
|
|
42
|
+
const matches = prefix.length === existingPairs.length &&
|
|
43
|
+
prefix.every((pair, idx) => pair[0] === existingPairs[idx]?.[0] && pair[1] === existingPairs[idx]?.[1]);
|
|
44
|
+
if (!matches)
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const newPairs = desiredPairs.slice(existingPairs.length);
|
|
48
|
+
for (const [author, body] of newPairs) {
|
|
49
|
+
const note = formatCommentNote(author, body);
|
|
50
|
+
if (note) {
|
|
51
|
+
await opts.requestJson("PUT", `issues/${issueIdText}.json`, { issue: { notes: note } });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function customFieldValue(issue: Record<string, unknown>, fieldId: unknown): string | null;
|
|
2
|
+
export declare function setIssueCustomFieldValue(issue: Record<string, unknown>, fieldId: unknown, value: unknown): void;
|
|
3
|
+
export declare function appendCustomField(opts: {
|
|
4
|
+
customFields: Record<string, unknown>;
|
|
5
|
+
fields: Record<string, unknown>[];
|
|
6
|
+
key: string;
|
|
7
|
+
value: unknown;
|
|
8
|
+
}): void;
|
|
9
|
+
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/backends/task-backend/redmine/fields.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAUhG;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,OAAO,GACb,IAAI,CAYN;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,IAAI,CAQP"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { isRecord } from "../../../shared/guards.js";
|
|
2
|
+
import { toStringSafe } from "../shared.js";
|
|
3
|
+
export function customFieldValue(issue, fieldId) {
|
|
4
|
+
if (!fieldId)
|
|
5
|
+
return null;
|
|
6
|
+
const fields = Array.isArray(issue.custom_fields) ? issue.custom_fields : [];
|
|
7
|
+
for (const field of fields) {
|
|
8
|
+
if (isRecord(field) && field.id === fieldId) {
|
|
9
|
+
const value = field.value;
|
|
10
|
+
return value !== undefined && value !== null ? toStringSafe(value) : "";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
export function setIssueCustomFieldValue(issue, fieldId, value) {
|
|
16
|
+
const fields = Array.isArray(issue.custom_fields) ? issue.custom_fields : [];
|
|
17
|
+
let found = false;
|
|
18
|
+
const updated = fields.map((field) => {
|
|
19
|
+
if (isRecord(field) && field.id === fieldId) {
|
|
20
|
+
found = true;
|
|
21
|
+
return { ...field, value };
|
|
22
|
+
}
|
|
23
|
+
return field;
|
|
24
|
+
});
|
|
25
|
+
if (!found)
|
|
26
|
+
updated.push({ id: fieldId, value });
|
|
27
|
+
issue.custom_fields = updated;
|
|
28
|
+
}
|
|
29
|
+
export function appendCustomField(opts) {
|
|
30
|
+
const fieldId = opts.customFields?.[opts.key];
|
|
31
|
+
if (!fieldId)
|
|
32
|
+
return;
|
|
33
|
+
let payloadValue = opts.value;
|
|
34
|
+
if (Array.isArray(opts.value) || isRecord(opts.value)) {
|
|
35
|
+
payloadValue = JSON.stringify(opts.value);
|
|
36
|
+
}
|
|
37
|
+
opts.fields.push({ id: fieldId, value: payloadValue });
|
|
38
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type TaskData } from "../shared.js";
|
|
2
|
+
export declare function startDateFromTaskId(taskId: string): string | null;
|
|
3
|
+
export declare function doneRatioForStatus(status: string): number | null;
|
|
4
|
+
export declare function issueToTask(opts: {
|
|
5
|
+
issue: Record<string, unknown>;
|
|
6
|
+
taskIdOverride?: string;
|
|
7
|
+
reverseStatus: Map<number, string>;
|
|
8
|
+
customFields: Record<string, unknown>;
|
|
9
|
+
ownerAgent: string;
|
|
10
|
+
defaultDocVersion: number;
|
|
11
|
+
}): TaskData | null;
|
|
12
|
+
export declare function taskToIssuePayload(opts: {
|
|
13
|
+
task: TaskData;
|
|
14
|
+
existingIssue?: Record<string, unknown>;
|
|
15
|
+
statusMap: Record<string, unknown>;
|
|
16
|
+
assigneeId: number | null;
|
|
17
|
+
customFields: Record<string, unknown>;
|
|
18
|
+
appendCustomField: (fields: Record<string, unknown>[], key: string, value: unknown) => void;
|
|
19
|
+
}): Record<string, unknown>;
|
|
20
|
+
//# sourceMappingURL=mapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../../../src/backends/task-backend/redmine/mapping.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,QAAQ,EACd,MAAM,cAAc,CAAC;AAMtB,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASjE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIhE;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,GAAG,QAAQ,GAAG,IAAI,CAwDlB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,iBAAiB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7F,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsC1B"}
|