agentplane 0.3.15 → 0.3.17
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/assets/policy/incidents.md +7 -0
- package/bin/agentplane.js +1 -1
- package/bin/framework-dev-contract.js +1 -0
- package/dist/.build-manifest.json +641 -351
- package/dist/backends/task-backend/load.d.ts.map +1 -1
- package/dist/backends/task-backend/load.js +32 -19
- package/dist/backends/task-backend/local-backend-doc.d.ts.map +1 -1
- package/dist/backends/task-backend/local-backend-doc.js +1 -1
- package/dist/backends/task-backend/redmine/backend-runtime.d.ts +5 -0
- package/dist/backends/task-backend/redmine/backend-runtime.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-runtime.js +4 -0
- package/dist/backends/task-backend/redmine/backend-sync/context.d.ts +44 -0
- package/dist/backends/task-backend/redmine/backend-sync/context.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync/context.js +8 -0
- package/dist/backends/task-backend/redmine/backend-sync/ids.d.ts +6 -0
- package/dist/backends/task-backend/redmine/backend-sync/ids.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync/ids.js +21 -0
- package/dist/backends/task-backend/redmine/backend-sync/migration.d.ts +4 -0
- package/dist/backends/task-backend/redmine/backend-sync/migration.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync/migration.js +87 -0
- package/dist/backends/task-backend/redmine/backend-sync/status.d.ts +10 -0
- package/dist/backends/task-backend/redmine/backend-sync/status.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync/status.js +78 -0
- package/dist/backends/task-backend/redmine/backend-sync/sync.d.ts +12 -0
- package/dist/backends/task-backend/redmine/backend-sync/sync.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync/sync.js +82 -0
- package/dist/backends/task-backend/redmine/backend-sync/write.d.ts +5 -0
- package/dist/backends/task-backend/redmine/backend-sync/write.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync/write.js +100 -0
- package/dist/backends/task-backend/redmine/backend-sync.d.ts +6 -66
- package/dist/backends/task-backend/redmine/backend-sync.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine/backend-sync.js +5 -367
- package/dist/backends/task-backend/redmine/mapping.js +1 -1
- package/dist/backends/task-backend/redmine/runtime-context.d.ts +98 -0
- package/dist/backends/task-backend/redmine/runtime-context.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/runtime-context.js +57 -0
- package/dist/backends/task-backend/redmine/runtime-methods.d.ts +33 -0
- package/dist/backends/task-backend/redmine/runtime-methods.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/runtime-methods.js +86 -0
- package/dist/backends/task-backend/redmine/runtime-operations.d.ts +19 -0
- package/dist/backends/task-backend/redmine/runtime-operations.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/runtime-operations.js +83 -0
- package/dist/backends/task-backend/redmine/runtime-state.d.ts +10 -0
- package/dist/backends/task-backend/redmine/runtime-state.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/runtime-state.js +45 -0
- package/dist/backends/task-backend/redmine-backend.d.ts +2 -33
- package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine-backend.js +26 -241
- package/dist/backends/task-backend/shared/constants.d.ts +1 -1
- package/dist/backends/task-backend/shared/constants.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/constants.js +1 -1
- package/dist/backends/task-backend/shared/errors.d.ts +12 -0
- package/dist/backends/task-backend/shared/errors.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/errors.js +12 -0
- package/dist/backends/task-index.d.ts +0 -4
- package/dist/backends/task-index.d.ts.map +1 -1
- package/dist/backends/task-index.js +0 -33
- package/dist/cli/archive.d.ts.map +1 -1
- package/dist/cli/archive.js +3 -5
- package/dist/cli/error-map.d.ts +7 -1
- package/dist/cli/error-map.d.ts.map +1 -1
- package/dist/cli/error-map.js +231 -19
- package/dist/cli/exit-codes.d.ts +14 -2
- package/dist/cli/exit-codes.d.ts.map +1 -1
- package/dist/cli/exit-codes.js +25 -11
- package/dist/cli/http.d.ts.map +1 -1
- package/dist/cli/http.js +34 -15
- package/dist/cli/output.d.ts +3 -0
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +25 -14
- package/dist/cli/prompts.d.ts.map +1 -1
- package/dist/cli/prompts.js +44 -0
- package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/core.js +34 -76
- package/dist/cli/run-cli/command-catalog/lifecycle.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/lifecycle.js +23 -26
- package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/project.js +39 -54
- package/dist/cli/run-cli/command-catalog/shared.d.ts +15 -3
- package/dist/cli/run-cli/command-catalog/shared.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/shared.js +19 -6
- package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/task.js +63 -57
- package/dist/cli/run-cli/command-loaders.d.ts +170 -0
- package/dist/cli/run-cli/command-loaders.d.ts.map +1 -0
- package/dist/cli/run-cli/command-loaders.js +128 -0
- package/dist/cli/run-cli/commands/init/model.d.ts +42 -0
- package/dist/cli/run-cli/commands/init/model.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/orchestrate.d.ts +9 -0
- package/dist/cli/run-cli/commands/init/orchestrate.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/orchestrate.js +321 -0
- package/dist/cli/run-cli/commands/init/parsers.d.ts +5 -0
- package/dist/cli/run-cli/commands/init/parsers.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/parsers.js +36 -0
- package/dist/cli/run-cli/commands/init/presets.d.ts +15 -0
- package/dist/cli/run-cli/commands/init/presets.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/presets.js +63 -0
- package/dist/cli/run-cli/commands/init/spec.d.ts +5 -0
- package/dist/cli/run-cli/commands/init/spec.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/spec.js +212 -0
- package/dist/cli/run-cli/commands/init/write-config.d.ts +1 -0
- package/dist/cli/run-cli/commands/init/write-config.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/write-config.js +1 -0
- package/dist/cli/run-cli/commands/init/write-gitignore.js +1 -1
- package/dist/cli/run-cli/commands/init.d.ts +1 -28
- package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init.js +1 -596
- package/dist/cli/run-cli/update-warning.d.ts +1 -0
- package/dist/cli/run-cli/update-warning.d.ts.map +1 -1
- package/dist/cli/run-cli/update-warning.js +10 -2
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +1 -2
- package/dist/cli/spec/errors.d.ts +18 -1
- package/dist/cli/spec/errors.d.ts.map +1 -1
- package/dist/cli/spec/errors.js +27 -4
- package/dist/cli/spec/parse.d.ts.map +1 -1
- package/dist/cli/spec/parse.js +8 -1
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +66 -118
- package/dist/commands/block.spec.js +1 -1
- package/dist/commands/branch/work-start.d.ts.map +1 -1
- package/dist/commands/branch/work-start.direct.d.ts +13 -0
- package/dist/commands/branch/work-start.direct.d.ts.map +1 -0
- package/dist/commands/branch/work-start.direct.js +75 -0
- package/dist/commands/branch/work-start.git.d.ts +3 -0
- package/dist/commands/branch/work-start.git.d.ts.map +1 -0
- package/dist/commands/branch/work-start.git.js +19 -0
- package/dist/commands/branch/work-start.hook-shim.d.ts +2 -0
- package/dist/commands/branch/work-start.hook-shim.d.ts.map +1 -0
- package/dist/commands/branch/work-start.hook-shim.js +38 -0
- package/dist/commands/branch/work-start.js +6 -235
- package/dist/commands/branch/work-start.materialize.d.ts +16 -0
- package/dist/commands/branch/work-start.materialize.d.ts.map +1 -0
- package/dist/commands/branch/work-start.materialize.js +110 -0
- package/dist/commands/commit.spec.js +1 -1
- package/dist/commands/doctor/branch-pr.js +1 -1
- package/dist/commands/doctor/fixes.d.ts +0 -5
- package/dist/commands/doctor/fixes.d.ts.map +1 -1
- package/dist/commands/doctor/fixes.js +1 -71
- package/dist/commands/doctor/runtime.d.ts.map +1 -1
- package/dist/commands/doctor/runtime.js +2 -2
- package/dist/commands/doctor/workflow.d.ts.map +1 -1
- package/dist/commands/doctor/workflow.js +2 -23
- package/dist/commands/doctor/workspace.js +1 -1
- package/dist/commands/doctor.run.d.ts.map +1 -1
- package/dist/commands/doctor.run.js +1 -3
- package/dist/commands/finish.spec.js +1 -1
- package/dist/commands/guard/commit.command.js +1 -1
- package/dist/commands/guard/impl/clean.d.ts +6 -0
- package/dist/commands/guard/impl/clean.d.ts.map +1 -0
- package/dist/commands/guard/impl/clean.js +29 -0
- package/dist/commands/guard/impl/close-dirt.d.ts +6 -0
- package/dist/commands/guard/impl/close-dirt.d.ts.map +1 -0
- package/dist/commands/guard/impl/close-dirt.js +56 -0
- package/dist/commands/guard/impl/commands.d.ts +4 -36
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +4 -549
- package/dist/commands/guard/impl/comment-commit.js +1 -1
- package/dist/commands/guard/impl/commit-diagnostics.d.ts +4 -0
- package/dist/commands/guard/impl/commit-diagnostics.d.ts.map +1 -0
- package/dist/commands/guard/impl/commit-diagnostics.js +150 -0
- package/dist/commands/guard/impl/commit.d.ts +25 -0
- package/dist/commands/guard/impl/commit.d.ts.map +1 -0
- package/dist/commands/guard/impl/commit.js +366 -0
- package/dist/commands/guard/impl/guard-commit.d.ts +3 -0
- package/dist/commands/guard/impl/guard-commit.d.ts.map +1 -0
- package/dist/commands/guard/impl/guard-commit.js +21 -0
- package/dist/commands/guard/impl/policy.d.ts +1 -0
- package/dist/commands/guard/impl/policy.d.ts.map +1 -1
- package/dist/commands/guard/impl/policy.js +9 -2
- package/dist/commands/guard/impl/suggest.d.ts +6 -0
- package/dist/commands/guard/impl/suggest.d.ts.map +1 -0
- package/dist/commands/guard/impl/suggest.js +33 -0
- package/dist/commands/hooks/index.d.ts +4 -17
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +4 -415
- package/dist/commands/hooks/install.d.ts +11 -0
- package/dist/commands/hooks/install.d.ts.map +1 -0
- package/dist/commands/hooks/install.js +136 -0
- package/dist/commands/hooks/run.commit-msg.d.ts +3 -0
- package/dist/commands/hooks/run.commit-msg.d.ts.map +1 -0
- package/dist/commands/hooks/run.commit-msg.js +67 -0
- package/dist/commands/hooks/run.d.ts +9 -0
- package/dist/commands/hooks/run.d.ts.map +1 -0
- package/dist/commands/hooks/run.js +45 -0
- package/dist/commands/hooks/run.post-merge.d.ts +3 -0
- package/dist/commands/hooks/run.post-merge.d.ts.map +1 -0
- package/dist/commands/hooks/run.post-merge.js +44 -0
- package/dist/commands/hooks/run.pre-commit.d.ts +3 -0
- package/dist/commands/hooks/run.pre-commit.d.ts.map +1 -0
- package/dist/commands/hooks/run.pre-commit.js +48 -0
- package/dist/commands/hooks/run.pre-push.d.ts +6 -0
- package/dist/commands/hooks/run.pre-push.d.ts.map +1 -0
- package/dist/commands/hooks/run.pre-push.js +88 -0
- package/dist/commands/hooks/shared.d.ts +7 -0
- package/dist/commands/hooks/shared.d.ts.map +1 -0
- package/dist/commands/hooks/shared.js +41 -0
- package/dist/commands/pr/integrate/cmd.js +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +1 -1
- package/dist/commands/pr/internal/auto-commit.d.ts.map +1 -1
- package/dist/commands/pr/internal/auto-commit.js +2 -5
- package/dist/commands/pr/internal/gh-api.d.ts.map +1 -1
- package/dist/commands/pr/internal/gh-api.js +15 -8
- package/dist/commands/pr/internal/sync-branch.d.ts +0 -1
- package/dist/commands/pr/internal/sync-branch.d.ts.map +1 -1
- package/dist/commands/pr/internal/sync-branch.js +2 -5
- package/dist/commands/pr/internal/sync.d.ts.map +1 -1
- package/dist/commands/pr/internal/sync.js +30 -0
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +98 -8
- package/dist/commands/recipes/impl/index.d.ts.map +1 -1
- package/dist/commands/recipes/impl/index.js +13 -3
- package/dist/commands/recipes/impl/resolver.js +1 -1
- package/dist/commands/recipes/impl/version.js +1 -1
- package/dist/commands/release/apply.command.js +1 -1
- package/dist/commands/release/apply.mutation.d.ts +1 -0
- package/dist/commands/release/apply.mutation.d.ts.map +1 -1
- package/dist/commands/release/apply.mutation.js +4 -0
- package/dist/commands/release/apply.pipeline/finalize.d.ts +21 -0
- package/dist/commands/release/apply.pipeline/finalize.d.ts.map +1 -0
- package/dist/commands/release/apply.pipeline/finalize.js +80 -0
- package/dist/commands/release/apply.pipeline/mutation.d.ts +18 -0
- package/dist/commands/release/apply.pipeline/mutation.d.ts.map +1 -0
- package/dist/commands/release/apply.pipeline/mutation.js +78 -0
- package/dist/commands/release/apply.pipeline/preflight.d.ts +25 -0
- package/dist/commands/release/apply.pipeline/preflight.d.ts.map +1 -0
- package/dist/commands/release/apply.pipeline/preflight.js +69 -0
- package/dist/commands/release/apply.pipeline/shared.d.ts +2 -0
- package/dist/commands/release/apply.pipeline/shared.d.ts.map +1 -0
- package/dist/commands/release/apply.pipeline/shared.js +5 -0
- package/dist/commands/release/apply.pipeline/state.d.ts +25 -0
- package/dist/commands/release/apply.pipeline/state.d.ts.map +1 -0
- package/dist/commands/release/apply.pipeline/state.js +129 -0
- package/dist/commands/release/apply.pipeline.d.ts +1 -1
- package/dist/commands/release/apply.pipeline.d.ts.map +1 -1
- package/dist/commands/release/apply.pipeline.js +4 -347
- package/dist/commands/release/apply.preflight.d.ts +9 -6
- package/dist/commands/release/apply.preflight.d.ts.map +1 -1
- package/dist/commands/release/apply.preflight.js +71 -51
- package/dist/commands/runtime.command.d.ts +2 -2
- package/dist/commands/runtime.command.d.ts.map +1 -1
- package/dist/commands/runtime.command.js +2 -2
- package/dist/commands/scenario/impl/commands.d.ts.map +1 -1
- package/dist/commands/scenario/impl/commands.js +52 -39
- package/dist/commands/scenario/impl/report.d.ts.map +1 -1
- package/dist/commands/scenario/impl/report.js +4 -7
- package/dist/commands/shared/allow-prefix-policy.d.ts.map +1 -0
- package/dist/{shared → commands/shared}/allow-prefix-policy.js +1 -1
- package/dist/commands/shared/comment-format.d.ts.map +1 -0
- package/dist/commands/shared/diagnostics.d.ts.map +1 -0
- package/dist/commands/shared/git-context.d.ts +1 -27
- package/dist/commands/shared/git-context.d.ts.map +1 -1
- package/dist/commands/shared/git-context.js +1 -156
- package/dist/commands/shared/git-diff.d.ts +1 -10
- package/dist/commands/shared/git-diff.d.ts.map +1 -1
- package/dist/commands/shared/git-diff.js +1 -49
- package/dist/commands/shared/git-ops.d.ts +1 -14
- package/dist/commands/shared/git-ops.d.ts.map +1 -1
- package/dist/commands/shared/git-ops.js +20 -150
- package/dist/commands/shared/git-worktree.d.ts +1 -9
- package/dist/commands/shared/git-worktree.d.ts.map +1 -1
- package/dist/commands/shared/git-worktree.js +1 -68
- package/dist/commands/shared/git.d.ts +1 -3
- package/dist/commands/shared/git.d.ts.map +1 -1
- package/dist/commands/shared/git.js +1 -14
- package/dist/commands/shared/policy-deny.d.ts +1 -1
- package/dist/commands/shared/reconcile-check.js +1 -1
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +24 -2
- package/dist/commands/shared/task-store/intents.d.ts.map +1 -1
- package/dist/commands/shared/task-store/intents.js +1 -1
- package/dist/commands/start.spec.js +1 -1
- package/dist/commands/task/close-tail-state.d.ts +7 -0
- package/dist/commands/task/close-tail-state.d.ts.map +1 -0
- package/dist/commands/task/close-tail-state.js +18 -0
- package/dist/commands/task/derive.js +1 -1
- package/dist/commands/task/finish-close.d.ts +22 -0
- package/dist/commands/task/finish-close.d.ts.map +1 -0
- package/dist/commands/task/finish-close.js +119 -0
- package/dist/commands/task/finish-command.d.ts +3 -0
- package/dist/commands/task/finish-command.d.ts.map +1 -0
- package/dist/commands/task/finish-command.js +56 -0
- package/dist/commands/task/finish-execute.d.ts +8 -0
- package/dist/commands/task/finish-execute.d.ts.map +1 -0
- package/dist/commands/task/finish-execute.js +272 -0
- package/dist/commands/task/finish-findings.d.ts +20 -0
- package/dist/commands/task/finish-findings.d.ts.map +1 -0
- package/dist/commands/task/finish-findings.js +27 -0
- package/dist/commands/task/finish-plan.d.ts +7 -0
- package/dist/commands/task/finish-plan.d.ts.map +1 -0
- package/dist/commands/task/finish-plan.js +157 -0
- package/dist/commands/task/finish-types.d.ts +69 -0
- package/dist/commands/task/finish-types.d.ts.map +1 -0
- package/dist/commands/task/finish.d.ts +1 -42
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +1 -527
- package/dist/commands/task/hosted-close-pr.command.d.ts +2 -7
- package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close-pr.command.js +9 -348
- package/dist/commands/task/hosted-close-pr.execute.d.ts +3 -0
- package/dist/commands/task/hosted-close-pr.execute.d.ts.map +1 -0
- package/dist/commands/task/hosted-close-pr.execute.js +135 -0
- package/dist/commands/task/hosted-close-pr.postcheck.d.ts +3 -0
- package/dist/commands/task/hosted-close-pr.postcheck.d.ts.map +1 -0
- package/dist/commands/task/hosted-close-pr.postcheck.js +13 -0
- package/dist/commands/task/hosted-close-pr.precheck.d.ts +4 -0
- package/dist/commands/task/hosted-close-pr.precheck.d.ts.map +1 -0
- package/dist/commands/task/hosted-close-pr.precheck.js +288 -0
- package/dist/commands/task/hosted-close-pr.report.d.ts +4 -0
- package/dist/commands/task/hosted-close-pr.report.d.ts.map +1 -0
- package/dist/commands/task/hosted-close-pr.report.js +42 -0
- package/dist/commands/task/hosted-close-pr.types.d.ts +75 -0
- package/dist/commands/task/hosted-close-pr.types.d.ts.map +1 -0
- package/dist/commands/task/hosted-merge-sync/builders.d.ts +35 -0
- package/dist/commands/task/hosted-merge-sync/builders.d.ts.map +1 -0
- package/dist/commands/task/hosted-merge-sync/builders.js +148 -0
- package/dist/commands/task/hosted-merge-sync/github.d.ts +10 -0
- package/dist/commands/task/hosted-merge-sync/github.d.ts.map +1 -0
- package/dist/commands/task/hosted-merge-sync/github.js +113 -0
- package/dist/commands/task/hosted-merge-sync/local-branch.d.ts +12 -0
- package/dist/commands/task/hosted-merge-sync/local-branch.d.ts.map +1 -0
- package/dist/commands/task/hosted-merge-sync/local-branch.js +143 -0
- package/dist/commands/task/hosted-merge-sync/model.d.ts +47 -0
- package/dist/commands/task/hosted-merge-sync/model.d.ts.map +1 -0
- package/dist/commands/task/hosted-merge-sync/pr-meta.d.ts +12 -0
- package/dist/commands/task/hosted-merge-sync/pr-meta.d.ts.map +1 -0
- package/dist/commands/task/hosted-merge-sync/pr-meta.js +26 -0
- package/dist/commands/task/hosted-merge-sync.d.ts +5 -63
- package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
- package/dist/commands/task/hosted-merge-sync.js +10 -444
- package/dist/commands/task/new.js +1 -1
- package/dist/commands/task/set-status.command.js +1 -1
- package/dist/commands/task/shared/direct-work-lock.d.ts.map +1 -0
- package/dist/commands/task/shared/git-log.d.ts.map +1 -0
- package/dist/commands/task/shared/transitions.d.ts +1 -1
- package/dist/commands/task/shared/transitions.d.ts.map +1 -1
- package/dist/commands/task/shared/transitions.js +4 -6
- package/dist/commands/upgrade/apply.js +1 -1
- package/dist/commands/upgrade/materialize.d.ts.map +1 -1
- package/dist/commands/upgrade/materialize.js +0 -7
- package/dist/commands/upgrade/source.d.ts +0 -1
- package/dist/commands/upgrade/source.d.ts.map +1 -1
- package/dist/commands/upgrade/source.js +1 -9
- package/dist/commands/workflow-playbook.command.d.ts.map +1 -1
- package/dist/commands/workflow-playbook.command.js +8 -7
- package/dist/harness/hooks-lifecycle.d.ts.map +1 -1
- package/dist/harness/hooks-lifecycle.js +11 -7
- package/dist/meta/release.d.ts.map +1 -1
- package/dist/meta/release.js +8 -4
- package/dist/policy/engine.d.ts +1 -1
- package/dist/policy/evaluate.d.ts +1 -1
- package/dist/policy/{types.d.ts → model.d.ts} +1 -1
- package/dist/policy/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/policy/result.d.ts +1 -1
- package/dist/policy/rules/allowlist.d.ts +1 -1
- package/dist/policy/rules/branch-pr-base.d.ts +1 -1
- package/dist/policy/rules/clean-tree.d.ts +1 -1
- package/dist/policy/rules/commit-subject.d.ts +1 -1
- package/dist/policy/rules/protected-paths.d.ts +1 -1
- package/dist/runner/adapters/base.d.ts +42 -0
- package/dist/runner/adapters/base.d.ts.map +1 -0
- package/dist/runner/adapters/base.js +107 -0
- package/dist/runner/adapters/codex-preparation.d.ts +7 -0
- package/dist/runner/adapters/codex-preparation.d.ts.map +1 -0
- package/dist/runner/adapters/codex-preparation.js +86 -0
- package/dist/runner/adapters/codex.d.ts.map +1 -1
- package/dist/runner/adapters/codex.js +30 -175
- package/dist/runner/adapters/custom-preparation.d.ts +9 -0
- package/dist/runner/adapters/custom-preparation.d.ts.map +1 -0
- package/dist/runner/adapters/custom-preparation.js +191 -0
- package/dist/runner/adapters/custom.d.ts.map +1 -1
- package/dist/runner/adapters/custom.js +26 -279
- package/dist/runner/context/base-prompts.d.ts.map +1 -1
- package/dist/runner/context/base-prompts.js +4 -0
- package/dist/runner/context/project-skill-prompt-blocks.d.ts +5 -0
- package/dist/runner/context/project-skill-prompt-blocks.d.ts.map +1 -0
- package/dist/runner/context/project-skill-prompt-blocks.js +57 -0
- package/dist/runner/process-supervision/run.d.ts +30 -0
- package/dist/runner/process-supervision/run.d.ts.map +1 -0
- package/dist/runner/process-supervision/run.js +351 -0
- package/dist/runner/process-supervision/signals.d.ts +16 -0
- package/dist/runner/process-supervision/signals.d.ts.map +1 -0
- package/dist/runner/process-supervision/signals.js +85 -0
- package/dist/runner/process-supervision/state.d.ts +10 -0
- package/dist/runner/process-supervision/state.d.ts.map +1 -0
- package/dist/runner/process-supervision/state.js +42 -0
- package/dist/runner/process-supervision/streams.d.ts +6 -0
- package/dist/runner/process-supervision/streams.d.ts.map +1 -0
- package/dist/runner/process-supervision/streams.js +23 -0
- package/dist/runner/process-supervision.d.ts +5 -47
- package/dist/runner/process-supervision.d.ts.map +1 -1
- package/dist/runner/process-supervision.js +3 -490
- package/dist/runner/usecases/scenario-materialize-task.js +1 -1
- package/dist/runtime/approvals/index.d.ts +1 -1
- package/dist/runtime/approvals/{types.d.ts → model.d.ts} +1 -1
- package/dist/runtime/approvals/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/runtime/approvals/runtime.d.ts +1 -1
- package/dist/runtime/behavior/index.d.ts +1 -1
- package/dist/runtime/behavior/{types.d.ts → model.d.ts} +1 -1
- package/dist/runtime/behavior/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/runtime/behavior/model.js +1 -0
- package/dist/runtime/behavior/resolve.d.ts +1 -1
- package/dist/runtime/capabilities/backend.d.ts +1 -1
- package/dist/runtime/capabilities/index.d.ts +1 -1
- package/dist/runtime/capabilities/{types.d.ts → model.d.ts} +1 -1
- package/dist/runtime/capabilities/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/runtime/capabilities/model.js +1 -0
- package/dist/runtime/capabilities/recipe.d.ts +1 -1
- package/dist/runtime/capabilities/registry.d.ts +1 -1
- package/dist/runtime/capabilities/runner.d.ts +1 -1
- package/dist/runtime/execution-context.d.ts.map +1 -1
- package/dist/runtime/execution-context.js +16 -0
- package/dist/runtime/execution-profile/index.d.ts +1 -1
- package/dist/runtime/execution-profile/{types.d.ts → model.d.ts} +1 -1
- package/dist/runtime/execution-profile/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/runtime/execution-profile/model.js +1 -0
- package/dist/runtime/execution-profile/resolve.d.ts +1 -1
- package/dist/runtime/explain/index.d.ts +1 -1
- package/dist/runtime/explain/{types.d.ts → model.d.ts} +1 -1
- package/dist/runtime/explain/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/runtime/explain/model.js +1 -0
- package/dist/runtime/explain/resolve.d.ts +1 -1
- package/dist/runtime/protocol/index.d.ts +1 -1
- package/dist/runtime/protocol/index.js +1 -1
- package/dist/runtime/protocol/{types.d.ts → model.d.ts} +1 -1
- package/dist/runtime/protocol/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/runtime/protocol/resolve.d.ts +1 -1
- package/dist/runtime/protocol/resolve.js +1 -1
- package/dist/runtime/shared/repo-cli-version.d.ts.map +1 -0
- package/dist/{shared → runtime/shared}/repo-cli-version.js +1 -1
- package/dist/runtime/shared/runtime-artifacts.d.ts.map +1 -0
- package/dist/{shared → runtime/shared}/runtime-source.d.ts +1 -1
- package/dist/runtime/shared/runtime-source.d.ts.map +1 -0
- package/dist/{shared → runtime/shared}/runtime-source.js +1 -1
- package/dist/runtime/shared/version-compare.d.ts.map +1 -0
- package/dist/runtime/task-intake/resolve.js +1 -1
- package/dist/shared/errors.d.ts +56 -3
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +72 -4
- package/dist/shared/trace-events.d.ts +13 -0
- package/dist/shared/trace-events.d.ts.map +1 -0
- package/dist/shared/trace-events.js +17 -0
- package/dist/shared/workflow-artifacts.d.ts.map +1 -1
- package/dist/shared/workflow-artifacts.js +1 -8
- package/dist/{shared/task-doc-conflicts.d.ts → task-doc/conflicts.d.ts} +1 -1
- package/dist/task-doc/conflicts.d.ts.map +1 -0
- package/dist/{shared/task-doc-conflicts.js → task-doc/conflicts.js} +1 -1
- package/dist/{shared/task-doc-state.d.ts → task-doc/state.d.ts} +1 -1
- package/dist/task-doc/state.d.ts.map +1 -0
- package/dist/workflow-runtime/file-ops.d.ts.map +1 -1
- package/dist/workflow-runtime/file-ops.js +1 -20
- package/dist/workflow-runtime/paths.d.ts.map +1 -1
- package/dist/workflow-runtime/paths.js +0 -1
- package/dist/workflow-runtime/types.d.ts +0 -1
- package/dist/workflow-runtime/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/cli/run-cli/error-guidance.d.ts +0 -9
- package/dist/cli/run-cli/error-guidance.d.ts.map +0 -1
- package/dist/cli/run-cli/error-guidance.js +0 -210
- package/dist/cli/run-cli.test-helpers.d.ts +0 -2
- package/dist/cli/run-cli.test-helpers.d.ts.map +0 -1
- package/dist/cli/run-cli.test-helpers.js +0 -1
- package/dist/commands/recipes.test-helpers.d.ts +0 -202
- package/dist/commands/recipes.test-helpers.d.ts.map +0 -1
- package/dist/commands/recipes.test-helpers.js +0 -483
- package/dist/commands/release.test-helpers.d.ts +0 -38
- package/dist/commands/release.test-helpers.d.ts.map +0 -1
- package/dist/commands/release.test-helpers.js +0 -55
- package/dist/commands/task.test-helpers.d.ts +0 -13
- package/dist/commands/task.test-helpers.d.ts.map +0 -1
- package/dist/commands/task.test-helpers.js +0 -65
- package/dist/runner/test-helpers.d.ts +0 -30
- package/dist/runner/test-helpers.d.ts.map +0 -1
- package/dist/runner/test-helpers.js +0 -97
- package/dist/shared/agent-emoji.d.ts +0 -5
- package/dist/shared/agent-emoji.d.ts.map +0 -1
- package/dist/shared/agent-emoji.js +0 -51
- package/dist/shared/allow-prefix-policy.d.ts.map +0 -1
- package/dist/shared/comment-format.d.ts.map +0 -1
- package/dist/shared/diagnostics.d.ts.map +0 -1
- package/dist/shared/direct-work-lock.d.ts.map +0 -1
- package/dist/shared/git-log.d.ts.map +0 -1
- package/dist/shared/repo-cli-version.d.ts.map +0 -1
- package/dist/shared/runtime-artifacts.d.ts.map +0 -1
- package/dist/shared/runtime-source.d.ts.map +0 -1
- package/dist/shared/task-doc-conflicts.d.ts.map +0 -1
- package/dist/shared/task-doc-state.d.ts.map +0 -1
- package/dist/shared/version-compare.d.ts.map +0 -1
- package/dist/testing/cli-harness/recipe-archives.d.ts +0 -28
- package/dist/testing/cli-harness/recipe-archives.d.ts.map +0 -1
- package/dist/testing/cli-harness/recipe-archives.js +0 -374
- package/dist/testing/cli-harness/stdio.d.ts +0 -26
- package/dist/testing/cli-harness/stdio.d.ts.map +0 -1
- package/dist/testing/cli-harness/stdio.js +0 -84
- package/dist/testing/cli-harness.d.ts +0 -25
- package/dist/testing/cli-harness.d.ts.map +0 -1
- package/dist/testing/cli-harness.js +0 -313
- package/dist/testing/index.d.ts +0 -2
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/testing/index.js +0 -1
- /package/dist/{policy/types.js → cli/run-cli/commands/init/model.js} +0 -0
- /package/dist/{shared → commands/shared}/allow-prefix-policy.d.ts +0 -0
- /package/dist/{shared → commands/shared}/comment-format.d.ts +0 -0
- /package/dist/{shared → commands/shared}/comment-format.js +0 -0
- /package/dist/{shared → commands/shared}/diagnostics.d.ts +0 -0
- /package/dist/{shared → commands/shared}/diagnostics.js +0 -0
- /package/dist/{runtime/approvals/types.js → commands/task/finish-types.js} +0 -0
- /package/dist/{runtime/behavior/types.js → commands/task/hosted-close-pr.types.js} +0 -0
- /package/dist/{runtime/capabilities/types.js → commands/task/hosted-merge-sync/model.js} +0 -0
- /package/dist/{shared → commands/task/shared}/direct-work-lock.d.ts +0 -0
- /package/dist/{shared → commands/task/shared}/direct-work-lock.js +0 -0
- /package/dist/{shared → commands/task/shared}/git-log.d.ts +0 -0
- /package/dist/{shared → commands/task/shared}/git-log.js +0 -0
- /package/dist/{runtime/execution-profile/types.js → policy/model.js} +0 -0
- /package/dist/runtime/{explain/types.js → approvals/model.js} +0 -0
- /package/dist/runtime/protocol/{types.js → model.js} +0 -0
- /package/dist/{shared → runtime/shared}/repo-cli-version.d.ts +0 -0
- /package/dist/{shared → runtime/shared}/runtime-artifacts.d.ts +0 -0
- /package/dist/{shared → runtime/shared}/runtime-artifacts.js +0 -0
- /package/dist/{shared → runtime/shared}/version-compare.d.ts +0 -0
- /package/dist/{shared → runtime/shared}/version-compare.js +0 -0
- /package/dist/{shared/task-doc-state.js → task-doc/state.js} +0 -0
|
@@ -1,67 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
export type RedmineSyncContext = {
|
|
8
|
-
cache: RedmineCachePort | null;
|
|
9
|
-
customFields: Record<string, unknown>;
|
|
10
|
-
ownerAgent: string;
|
|
11
|
-
projectId: string;
|
|
12
|
-
batchSize: number;
|
|
13
|
-
batchPauseMs: number;
|
|
14
|
-
statusMap: Record<string, unknown>;
|
|
15
|
-
issueCache: Map<string, Record<string, unknown>>;
|
|
16
|
-
inferredStatusByTaskStatus: Map<string, number> | null;
|
|
17
|
-
setInferredStatusByTaskStatus: (next: Map<string, number> | null) => void;
|
|
18
|
-
listTasksRemote: () => Promise<TaskData[]>;
|
|
19
|
-
writeTask: (task: TaskData, opts?: TaskWriteOptions) => Promise<void>;
|
|
20
|
-
writeTasks: (tasks: TaskData[], opts?: TaskWriteOptions) => Promise<void>;
|
|
21
|
-
findIssueByTaskId: (taskId: string) => Promise<Record<string, unknown> | null>;
|
|
22
|
-
issueToTask: (issue: Record<string, unknown>, taskIdOverride?: string) => TaskData | null;
|
|
23
|
-
taskToIssuePayload: (task: TaskData, existingIssue?: Record<string, unknown>) => Record<string, unknown>;
|
|
24
|
-
appendCustomField: (fields: Record<string, unknown>[], key: string, value: unknown) => void;
|
|
25
|
-
customFieldValue: (issue: Record<string, unknown>, fieldId: unknown) => string | null;
|
|
26
|
-
maybeParseJson: (value: unknown) => unknown;
|
|
27
|
-
normalizeComments: (value: unknown) => TaskComment[];
|
|
28
|
-
appendCommentNotes: (issueId: string, existingComments: TaskComment[], desiredComments: TaskComment[]) => Promise<void>;
|
|
29
|
-
cacheTask: (task: TaskData, dirty: boolean) => Promise<void>;
|
|
30
|
-
assertExpectedRevisionSupported: (taskId: string, opts?: TaskWriteOptions) => void;
|
|
31
|
-
assertExpectedRevision: (taskId: string, expectedRevision: number | undefined, currentRevision: number) => void;
|
|
32
|
-
ensureDocMetadata: (task: TaskDocMeta) => void;
|
|
33
|
-
diffTasks: (localTask: TaskData, remoteTask: TaskData) => string;
|
|
34
|
-
tasksDiffer: (localTask: TaskData, remoteTask: TaskData) => boolean;
|
|
35
|
-
taskIdFieldId: () => unknown;
|
|
36
|
-
setIssueCustomFieldValue: (issue: Record<string, unknown>, fieldId: unknown, value: unknown) => void;
|
|
37
|
-
requestJson: (method: string, reqPath: string, payload?: Record<string, unknown>, params?: Record<string, unknown>, opts?: {
|
|
38
|
-
attempts?: number;
|
|
39
|
-
backoff?: number;
|
|
40
|
-
}) => Promise<Record<string, unknown>>;
|
|
41
|
-
};
|
|
42
|
-
export declare function generateRedmineTaskId(context: RedmineSyncContext, opts: {
|
|
43
|
-
length: number;
|
|
44
|
-
attempts: number;
|
|
45
|
-
}): Promise<string>;
|
|
46
|
-
export declare function migrateRedmineCanonicalState(context: RedmineSyncContext): Promise<TaskCanonicalStateMigrationResult>;
|
|
47
|
-
export declare function writeRedmineTask(context: RedmineSyncContext, task: TaskData, opts?: TaskWriteOptions): Promise<void>;
|
|
48
|
-
export declare function writeRedmineTasks(context: RedmineSyncContext, tasks: TaskData[], opts?: TaskWriteOptions): Promise<void>;
|
|
49
|
-
export declare function syncRedmine(context: RedmineSyncContext, opts: {
|
|
50
|
-
direction: "push" | "pull";
|
|
51
|
-
conflict: "diff" | "prefer-local" | "prefer-remote" | "fail";
|
|
52
|
-
quiet: boolean;
|
|
53
|
-
confirm: boolean;
|
|
54
|
-
}): Promise<void>;
|
|
55
|
-
export declare function syncPushRedmine(context: RedmineSyncContext, quiet: boolean, confirm: boolean): Promise<void>;
|
|
56
|
-
export declare function syncPullRedmine(context: RedmineSyncContext, conflict: "diff" | "prefer-local" | "prefer-remote" | "fail", quiet: boolean): Promise<void>;
|
|
57
|
-
export declare function handleRedmineConflict(context: RedmineSyncContext, taskId: string, localTask: TaskData, remoteTask: TaskData, conflict: "diff" | "prefer-local" | "prefer-remote" | "fail"): Promise<void>;
|
|
58
|
-
export declare function inferRedmineStatusIdForTaskStatus(context: RedmineSyncContext, statusRaw: unknown): Promise<number | null>;
|
|
59
|
-
export declare function loadRedmineInferredStatusByTaskStatus(context: RedmineSyncContext): Promise<Map<string, number>>;
|
|
60
|
-
export declare function selectRedmineInferredStatus(statuses: {
|
|
61
|
-
id: number;
|
|
62
|
-
name: string;
|
|
63
|
-
isClosed: boolean;
|
|
64
|
-
isDefault: boolean;
|
|
65
|
-
}[], target: "TODO" | "DOING" | "DONE"): number | null;
|
|
66
|
-
export {};
|
|
1
|
+
export type { RedmineSyncContext } from "./backend-sync/context.js";
|
|
2
|
+
export { generateRedmineTaskId } from "./backend-sync/ids.js";
|
|
3
|
+
export { migrateRedmineCanonicalState } from "./backend-sync/migration.js";
|
|
4
|
+
export { inferRedmineStatusIdForTaskStatus, loadRedmineInferredStatusByTaskStatus, selectRedmineInferredStatus, } from "./backend-sync/status.js";
|
|
5
|
+
export { handleRedmineConflict, syncPullRedmine, syncPushRedmine, syncRedmine, } from "./backend-sync/sync.js";
|
|
6
|
+
export { writeRedmineTask, writeRedmineTasks } from "./backend-sync/write.js";
|
|
67
7
|
//# sourceMappingURL=backend-sync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend-sync.d.ts","sourceRoot":"","sources":["../../../../src/backends/task-backend/redmine/backend-sync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"backend-sync.d.ts","sourceRoot":"","sources":["../../../../src/backends/task-backend/redmine/backend-sync.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EACL,iCAAiC,EACjC,qCAAqC,EACrC,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,367 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
function issueFromPayload(payload) {
|
|
8
|
-
return payload.issue && typeof payload.issue === "object" && !Array.isArray(payload.issue)
|
|
9
|
-
? payload.issue
|
|
10
|
-
: null;
|
|
11
|
-
}
|
|
12
|
-
export async function generateRedmineTaskId(context, opts) {
|
|
13
|
-
let existingIds = new Set();
|
|
14
|
-
try {
|
|
15
|
-
const tasks = await context.listTasksRemote();
|
|
16
|
-
existingIds = new Set(tasks.map((task) => toStringSafe(task.id)).filter(Boolean));
|
|
17
|
-
}
|
|
18
|
-
catch (err) {
|
|
19
|
-
if (!(err instanceof RedmineUnavailable))
|
|
20
|
-
throw err;
|
|
21
|
-
if (!context.cache)
|
|
22
|
-
throw err;
|
|
23
|
-
const cached = await context.cache.listTasks();
|
|
24
|
-
existingIds = new Set(cached.map((task) => toStringSafe(task.id)).filter(Boolean));
|
|
25
|
-
}
|
|
26
|
-
return await generateTaskId({
|
|
27
|
-
length: opts.length,
|
|
28
|
-
attempts: opts.attempts,
|
|
29
|
-
isAvailable: (taskId) => !existingIds.has(taskId),
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
export async function migrateRedmineCanonicalState(context) {
|
|
33
|
-
if (!context.customFields.canonical_state) {
|
|
34
|
-
throw new BackendError(redmineConfigMissingEnvMessage("AGENTPLANE_REDMINE_CUSTOM_FIELDS_CANONICAL_STATE"), "E_BACKEND");
|
|
35
|
-
}
|
|
36
|
-
const tasks = await context.listTasksRemote();
|
|
37
|
-
const result = {
|
|
38
|
-
scanned: tasks.length,
|
|
39
|
-
migrated: [],
|
|
40
|
-
skippedStructured: [],
|
|
41
|
-
skippedNoDoc: [],
|
|
42
|
-
failed: [],
|
|
43
|
-
};
|
|
44
|
-
for (const [index, task] of tasks.entries()) {
|
|
45
|
-
const taskId = toStringSafe(task.id).trim();
|
|
46
|
-
if (!taskId)
|
|
47
|
-
continue;
|
|
48
|
-
const issue = context.issueCache.get(taskId);
|
|
49
|
-
if (!issue) {
|
|
50
|
-
result.failed.push({
|
|
51
|
-
taskId,
|
|
52
|
-
reason: "Redmine issue payload was not cached during remote list refresh",
|
|
53
|
-
});
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
const currentState = parseRedmineCanonicalState(context.customFieldValue(issue, context.customFields.canonical_state));
|
|
57
|
-
if (currentState) {
|
|
58
|
-
result.skippedStructured.push(taskId);
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
const sections = task.sections && Object.keys(task.sections).length > 0
|
|
62
|
-
? task.sections
|
|
63
|
-
: task.doc
|
|
64
|
-
? taskDocToSectionMap(task.doc)
|
|
65
|
-
: undefined;
|
|
66
|
-
if (!sections || Object.keys(sections).length === 0) {
|
|
67
|
-
result.skippedNoDoc.push(taskId);
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
const issueIdText = toStringSafe(issue.id);
|
|
71
|
-
if (!issueIdText) {
|
|
72
|
-
result.failed.push({ taskId, reason: redmineIssueIdMissingMessage() });
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const nextRevision = Math.max(revisionNumber(task.revision), 0, 1);
|
|
76
|
-
const nextCanonicalState = buildRedmineCanonicalStateWithOptions({
|
|
77
|
-
...task,
|
|
78
|
-
sections,
|
|
79
|
-
revision: nextRevision,
|
|
80
|
-
}, { base: currentState, revision: nextRevision });
|
|
81
|
-
if (!nextCanonicalState) {
|
|
82
|
-
result.skippedNoDoc.push(taskId);
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
const customFields = [];
|
|
86
|
-
context.appendCustomField(customFields, "canonical_state", nextCanonicalState);
|
|
87
|
-
try {
|
|
88
|
-
await context.requestJson("PUT", `issues/${issueIdText}.json`, {
|
|
89
|
-
issue: { custom_fields: customFields },
|
|
90
|
-
});
|
|
91
|
-
context.setIssueCustomFieldValue(issue, context.customFields.canonical_state, nextCanonicalState);
|
|
92
|
-
context.issueCache.set(taskId, issue);
|
|
93
|
-
await context.cacheTask({
|
|
94
|
-
...task,
|
|
95
|
-
sections,
|
|
96
|
-
revision: nextRevision,
|
|
97
|
-
dirty: false,
|
|
98
|
-
}, false);
|
|
99
|
-
result.migrated.push(taskId);
|
|
100
|
-
}
|
|
101
|
-
catch (err) {
|
|
102
|
-
result.failed.push({
|
|
103
|
-
taskId,
|
|
104
|
-
reason: err instanceof Error ? err.message : "Unknown Redmine canonical_state migration failure",
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
if (context.batchPauseMs > 0 &&
|
|
108
|
-
context.batchSize > 0 &&
|
|
109
|
-
(index + 1) % context.batchSize === 0) {
|
|
110
|
-
await sleep(context.batchPauseMs);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return result;
|
|
114
|
-
}
|
|
115
|
-
export async function writeRedmineTask(context, task, opts) {
|
|
116
|
-
const taskId = toStringSafe(task.id).trim();
|
|
117
|
-
if (!taskId)
|
|
118
|
-
throw new Error(missingTaskIdMessage());
|
|
119
|
-
validateTaskId(taskId);
|
|
120
|
-
try {
|
|
121
|
-
context.ensureDocMetadata(task);
|
|
122
|
-
let issue = await context.findIssueByTaskId(taskId);
|
|
123
|
-
let issueId = issue?.id;
|
|
124
|
-
let issueIdText = issueId ? toStringSafe(issueId) : "";
|
|
125
|
-
let existingIssue = issue ?? null;
|
|
126
|
-
if (issueIdText && !existingIssue) {
|
|
127
|
-
const payload = await context.requestJson("GET", `issues/${issueIdText}.json`);
|
|
128
|
-
existingIssue = issueFromPayload(payload);
|
|
129
|
-
}
|
|
130
|
-
const currentState = existingIssue && context.customFields.canonical_state
|
|
131
|
-
? parseRedmineCanonicalState(context.customFieldValue(existingIssue, context.customFields.canonical_state))
|
|
132
|
-
: null;
|
|
133
|
-
context.assertExpectedRevisionSupported(taskId, opts);
|
|
134
|
-
context.assertExpectedRevision(taskId, opts?.expectedRevision, currentState?.revision ?? 0);
|
|
135
|
-
const nextRevision = issueIdText
|
|
136
|
-
? Math.max(revisionNumber(task.revision), revisionNumber(currentState?.revision), 0) + 1
|
|
137
|
-
: Math.max(revisionNumber(task.revision), revisionNumber(currentState?.revision), 1);
|
|
138
|
-
const taskForWrite = {
|
|
139
|
-
...task,
|
|
140
|
-
revision: nextRevision,
|
|
141
|
-
sections: task.sections && Object.keys(task.sections).length > 0
|
|
142
|
-
? task.sections
|
|
143
|
-
: task.doc
|
|
144
|
-
? taskDocToSectionMap(task.doc)
|
|
145
|
-
: undefined,
|
|
146
|
-
};
|
|
147
|
-
const payload = context.taskToIssuePayload(taskForWrite, existingIssue ?? undefined);
|
|
148
|
-
if (payload.status_id === undefined) {
|
|
149
|
-
const inferredStatusId = await inferRedmineStatusIdForTaskStatus(context, taskForWrite.status);
|
|
150
|
-
if (inferredStatusId !== null)
|
|
151
|
-
payload.status_id = inferredStatusId;
|
|
152
|
-
}
|
|
153
|
-
if (issueIdText) {
|
|
154
|
-
await context.requestJson("PUT", `issues/${issueIdText}.json`, { issue: payload });
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
const createPayload = { ...payload, project_id: context.projectId };
|
|
158
|
-
const created = await context.requestJson("POST", "issues.json", { issue: createPayload });
|
|
159
|
-
const createdIssue = issueFromPayload(created);
|
|
160
|
-
issueId = createdIssue?.id;
|
|
161
|
-
issueIdText = issueId ? toStringSafe(issueId) : "";
|
|
162
|
-
if (issueIdText) {
|
|
163
|
-
const updatePayload = { ...payload };
|
|
164
|
-
delete updatePayload.project_id;
|
|
165
|
-
await context.requestJson("PUT", `issues/${issueIdText}.json`, { issue: updatePayload });
|
|
166
|
-
const refreshed = await context.requestJson("GET", `issues/${issueIdText}.json`);
|
|
167
|
-
existingIssue = issueFromPayload(refreshed);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (issueIdText) {
|
|
171
|
-
const existingComments = existingIssue && context.customFields.comments
|
|
172
|
-
? context.normalizeComments(context.maybeParseJson(context.customFieldValue(existingIssue, context.customFields.comments)))
|
|
173
|
-
: [];
|
|
174
|
-
const desiredComments = context.normalizeComments(taskForWrite.comments);
|
|
175
|
-
await context.appendCommentNotes(issueIdText, existingComments, desiredComments);
|
|
176
|
-
}
|
|
177
|
-
taskForWrite.dirty = false;
|
|
178
|
-
await context.cacheTask(taskForWrite, false);
|
|
179
|
-
context.issueCache.clear();
|
|
180
|
-
}
|
|
181
|
-
catch (err) {
|
|
182
|
-
if (!(err instanceof RedmineUnavailable))
|
|
183
|
-
throw err;
|
|
184
|
-
if (!context.cache)
|
|
185
|
-
throw err;
|
|
186
|
-
context.assertExpectedRevisionSupported(taskId, opts);
|
|
187
|
-
const taskForCache = {
|
|
188
|
-
...task,
|
|
189
|
-
revision: Math.max(revisionNumber(task.revision), 1),
|
|
190
|
-
sections: task.sections && Object.keys(task.sections).length > 0
|
|
191
|
-
? task.sections
|
|
192
|
-
: task.doc
|
|
193
|
-
? taskDocToSectionMap(task.doc)
|
|
194
|
-
: undefined,
|
|
195
|
-
dirty: true,
|
|
196
|
-
};
|
|
197
|
-
await context.cache.writeTask(taskForCache, opts);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
export async function writeRedmineTasks(context, tasks, opts) {
|
|
201
|
-
for (const [index, task] of tasks.entries()) {
|
|
202
|
-
await context.writeTask(task, opts);
|
|
203
|
-
if (context.batchPauseMs > 0 &&
|
|
204
|
-
context.batchSize > 0 &&
|
|
205
|
-
(index + 1) % context.batchSize === 0) {
|
|
206
|
-
await sleep(context.batchPauseMs);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
export async function syncRedmine(context, opts) {
|
|
211
|
-
if (opts.direction === "push") {
|
|
212
|
-
await syncPushRedmine(context, opts.quiet, opts.confirm);
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
if (opts.direction === "pull") {
|
|
216
|
-
await syncPullRedmine(context, opts.conflict, opts.quiet);
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
throw new BackendError("Invalid sync direction (expected push|pull)", "E_BACKEND");
|
|
220
|
-
}
|
|
221
|
-
export async function syncPushRedmine(context, quiet, confirm) {
|
|
222
|
-
if (!context.cache) {
|
|
223
|
-
throw new BackendError("Redmine cache is disabled; sync push is unavailable", "E_BACKEND");
|
|
224
|
-
}
|
|
225
|
-
const tasks = await context.cache.listTasks();
|
|
226
|
-
const dirty = tasks.filter((task) => task.dirty);
|
|
227
|
-
if (dirty.length === 0) {
|
|
228
|
-
if (!quiet)
|
|
229
|
-
process.stdout.write("ℹ️ no local task changes to push\n");
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
if (!confirm) {
|
|
233
|
-
for (const task of dirty) {
|
|
234
|
-
process.stdout.write(`- pending push: ${task.id}\n`);
|
|
235
|
-
}
|
|
236
|
-
throw new BackendError("Refusing to push without --yes (preview above)", "E_BACKEND");
|
|
237
|
-
}
|
|
238
|
-
await context.writeTasks(dirty);
|
|
239
|
-
if (!quiet)
|
|
240
|
-
process.stdout.write(`✅ pushed ${dirty.length} task(s) (dirty)\n`);
|
|
241
|
-
}
|
|
242
|
-
export async function syncPullRedmine(context, conflict, quiet) {
|
|
243
|
-
if (!context.cache) {
|
|
244
|
-
throw new BackendError("Redmine cache is disabled; sync pull is unavailable", "E_BACKEND");
|
|
245
|
-
}
|
|
246
|
-
const remoteTasks = await context.listTasksRemote();
|
|
247
|
-
const remoteById = new Map();
|
|
248
|
-
for (const task of remoteTasks) {
|
|
249
|
-
const taskId = toStringSafe(task.id);
|
|
250
|
-
if (taskId)
|
|
251
|
-
remoteById.set(taskId, task);
|
|
252
|
-
}
|
|
253
|
-
const localTasks = await context.cache.listTasks();
|
|
254
|
-
const localById = new Map();
|
|
255
|
-
for (const task of localTasks) {
|
|
256
|
-
const taskId = toStringSafe(task.id);
|
|
257
|
-
if (taskId)
|
|
258
|
-
localById.set(taskId, task);
|
|
259
|
-
}
|
|
260
|
-
for (const [taskId, remoteTask] of remoteById.entries()) {
|
|
261
|
-
const localTask = localById.get(taskId);
|
|
262
|
-
if (localTask?.dirty) {
|
|
263
|
-
if (context.tasksDiffer(localTask, remoteTask)) {
|
|
264
|
-
await handleRedmineConflict(context, taskId, localTask, remoteTask, conflict);
|
|
265
|
-
continue;
|
|
266
|
-
}
|
|
267
|
-
localTask.dirty = false;
|
|
268
|
-
await context.cacheTask(localTask, false);
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
await context.cacheTask(remoteTask, false);
|
|
272
|
-
}
|
|
273
|
-
if (!quiet)
|
|
274
|
-
process.stdout.write(`✅ pulled ${remoteById.size} task(s) (remote)\n`);
|
|
275
|
-
}
|
|
276
|
-
export async function handleRedmineConflict(context, taskId, localTask, remoteTask, conflict) {
|
|
277
|
-
if (conflict === "prefer-local") {
|
|
278
|
-
await context.writeTask(localTask);
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
if (conflict === "prefer-remote") {
|
|
282
|
-
await context.cacheTask(remoteTask, false);
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
if (conflict === "diff") {
|
|
286
|
-
process.stdout.write(`${context.diffTasks(localTask, remoteTask)}\n`);
|
|
287
|
-
throw new BackendError(`Conflict detected for ${taskId}`, "E_BACKEND");
|
|
288
|
-
}
|
|
289
|
-
throw new BackendError(`Conflict detected for ${taskId}`, "E_BACKEND");
|
|
290
|
-
}
|
|
291
|
-
export async function inferRedmineStatusIdForTaskStatus(context, statusRaw) {
|
|
292
|
-
const status = toStringSafe(statusRaw).trim().toUpperCase();
|
|
293
|
-
if (!status)
|
|
294
|
-
return null;
|
|
295
|
-
const explicit = context.statusMap?.[status];
|
|
296
|
-
if (typeof explicit === "number" && Number.isFinite(explicit))
|
|
297
|
-
return explicit;
|
|
298
|
-
const inferred = await loadRedmineInferredStatusByTaskStatus(context);
|
|
299
|
-
return inferred.get(status) ?? null;
|
|
300
|
-
}
|
|
301
|
-
export async function loadRedmineInferredStatusByTaskStatus(context) {
|
|
302
|
-
if (context.inferredStatusByTaskStatus)
|
|
303
|
-
return context.inferredStatusByTaskStatus;
|
|
304
|
-
const map = new Map();
|
|
305
|
-
context.setInferredStatusByTaskStatus(map);
|
|
306
|
-
try {
|
|
307
|
-
const payload = await context.requestJson("GET", "issue_statuses.json");
|
|
308
|
-
const statuses = Array.isArray(payload.issue_statuses) ? payload.issue_statuses : [];
|
|
309
|
-
const parsed = [];
|
|
310
|
-
for (const item of statuses) {
|
|
311
|
-
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
312
|
-
continue;
|
|
313
|
-
const status = item;
|
|
314
|
-
const id = typeof status.id === "number" ? status.id : null;
|
|
315
|
-
if (!id || !Number.isFinite(id))
|
|
316
|
-
continue;
|
|
317
|
-
parsed.push({
|
|
318
|
-
id,
|
|
319
|
-
name: toStringSafe(status.name).trim().toLowerCase(),
|
|
320
|
-
isClosed: status.is_closed === true,
|
|
321
|
-
isDefault: status.is_default === true,
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
const done = selectRedmineInferredStatus(parsed, "DONE");
|
|
325
|
-
const doing = selectRedmineInferredStatus(parsed, "DOING");
|
|
326
|
-
const todo = selectRedmineInferredStatus(parsed, "TODO");
|
|
327
|
-
if (done !== null)
|
|
328
|
-
map.set("DONE", done);
|
|
329
|
-
if (doing !== null)
|
|
330
|
-
map.set("DOING", doing);
|
|
331
|
-
if (todo !== null)
|
|
332
|
-
map.set("TODO", todo);
|
|
333
|
-
}
|
|
334
|
-
catch {
|
|
335
|
-
// Best effort: keep previous behavior when status discovery is unavailable.
|
|
336
|
-
}
|
|
337
|
-
return map;
|
|
338
|
-
}
|
|
339
|
-
export function selectRedmineInferredStatus(statuses, target) {
|
|
340
|
-
if (statuses.length === 0)
|
|
341
|
-
return null;
|
|
342
|
-
if (target === "DOING") {
|
|
343
|
-
const byId = statuses.find((item) => item.id === 2);
|
|
344
|
-
if (byId)
|
|
345
|
-
return byId.id;
|
|
346
|
-
const byName = statuses.find((item) => item.name.includes("progress") || item.name.includes("doing"));
|
|
347
|
-
return byName?.id ?? null;
|
|
348
|
-
}
|
|
349
|
-
if (target === "DONE") {
|
|
350
|
-
const closed = statuses.find((item) => item.isClosed);
|
|
351
|
-
if (closed)
|
|
352
|
-
return closed.id;
|
|
353
|
-
const byId = statuses.find((item) => item.id === 5 || item.id === 3 || item.id === 6);
|
|
354
|
-
if (byId)
|
|
355
|
-
return byId.id;
|
|
356
|
-
const byName = statuses.find((item) => item.name.includes("done") ||
|
|
357
|
-
item.name.includes("closed") ||
|
|
358
|
-
item.name.includes("resolved") ||
|
|
359
|
-
item.name.includes("complete"));
|
|
360
|
-
return byName?.id ?? null;
|
|
361
|
-
}
|
|
362
|
-
const byDefault = statuses.find((item) => item.isDefault);
|
|
363
|
-
if (byDefault)
|
|
364
|
-
return byDefault.id;
|
|
365
|
-
const byId = statuses.find((item) => item.id === 1);
|
|
366
|
-
return byId?.id ?? statuses[0]?.id ?? null;
|
|
367
|
-
}
|
|
1
|
+
export { generateRedmineTaskId } from "./backend-sync/ids.js";
|
|
2
|
+
export { migrateRedmineCanonicalState } from "./backend-sync/migration.js";
|
|
3
|
+
export { inferRedmineStatusIdForTaskStatus, loadRedmineInferredStatusByTaskStatus, selectRedmineInferredStatus, } from "./backend-sync/status.js";
|
|
4
|
+
export { handleRedmineConflict, syncPullRedmine, syncPushRedmine, syncRedmine, } from "./backend-sync/sync.js";
|
|
5
|
+
export { writeRedmineTask, writeRedmineTasks } from "./backend-sync/write.js";
|
|
@@ -139,7 +139,7 @@ export function issueToTask(opts) {
|
|
|
139
139
|
task.doc = derivedDoc;
|
|
140
140
|
task.sections = canonicalSections ?? (derivedDoc ? taskDocToSectionMap(derivedDoc) : undefined);
|
|
141
141
|
const docVersion = coerceDocVersion(docVersionVal);
|
|
142
|
-
task.doc_version = docVersion
|
|
142
|
+
task.doc_version = docVersion === opts.defaultDocVersion ? docVersion : opts.defaultDocVersion;
|
|
143
143
|
task.doc_updated_at = docUpdatedAtVal ? toStringSafe(docUpdatedAtVal) : (updatedOn ?? nowIso());
|
|
144
144
|
task.doc_updated_by = docUpdatedByVal ? toStringSafe(docUpdatedByVal) : opts.ownerAgent;
|
|
145
145
|
return task;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { LocalBackend } from "../local-backend.js";
|
|
2
|
+
import type { TaskBackend, TaskData, TaskDocMeta, TaskWriteOptions } from "../shared.js";
|
|
3
|
+
import type { TaskComment } from "./comments.js";
|
|
4
|
+
export type RedmineBackendRuntimeHost = {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
apiKey: string;
|
|
7
|
+
projectId: string;
|
|
8
|
+
assigneeId: number | null;
|
|
9
|
+
ownerAgent: string;
|
|
10
|
+
statusMap: Record<string, unknown>;
|
|
11
|
+
customFields: Record<string, unknown>;
|
|
12
|
+
batchSize: number;
|
|
13
|
+
batchPauseMs: number;
|
|
14
|
+
cache: LocalBackend | null;
|
|
15
|
+
issueCache: Map<string, Record<string, unknown>>;
|
|
16
|
+
reverseStatus: Map<number, string>;
|
|
17
|
+
inferredStatusByTaskStatus: Map<string, number> | null;
|
|
18
|
+
capabilities: TaskBackend["capabilities"];
|
|
19
|
+
setInferredStatusByTaskStatus: (next: Map<string, number> | null) => void;
|
|
20
|
+
ensureDocMetadata: (task: TaskDocMeta) => void;
|
|
21
|
+
cacheTask: (task: TaskData, dirty: boolean) => Promise<void>;
|
|
22
|
+
assertExpectedRevisionSupported: (taskId: string, opts?: TaskWriteOptions) => void;
|
|
23
|
+
assertExpectedRevision: (taskId: string, expectedRevision: number | undefined, currentRevision: number) => void;
|
|
24
|
+
taskIdFieldId: () => unknown;
|
|
25
|
+
setIssueCustomFieldValue: (issue: Record<string, unknown>, fieldId: unknown, value: unknown) => void;
|
|
26
|
+
listTasksRemote: () => Promise<TaskData[]>;
|
|
27
|
+
findIssueByTaskId: (taskId: string) => Promise<Record<string, unknown> | null>;
|
|
28
|
+
issueToTask: (issue: Record<string, unknown>, taskIdOverride?: string) => TaskData | null;
|
|
29
|
+
taskToIssuePayload: (task: TaskData, existingIssue?: Record<string, unknown>) => Record<string, unknown>;
|
|
30
|
+
appendCustomField: (fields: Record<string, unknown>[], key: string, value: unknown) => void;
|
|
31
|
+
normalizeComments: (value: unknown) => TaskComment[];
|
|
32
|
+
appendCommentNotes: (issueId: string, existingComments: TaskComment[], desiredComments: TaskComment[]) => Promise<void>;
|
|
33
|
+
customFieldValue: (issue: Record<string, unknown>, fieldId: unknown) => string | null;
|
|
34
|
+
maybeParseJson: (value: unknown) => unknown;
|
|
35
|
+
requestJson: (method: string, reqPath: string, payload?: Record<string, unknown>, params?: Record<string, unknown>, opts?: {
|
|
36
|
+
attempts?: number;
|
|
37
|
+
backoff?: number;
|
|
38
|
+
}) => Promise<Record<string, unknown>>;
|
|
39
|
+
diffTasks: (localTask: TaskData, remoteTask: TaskData) => string;
|
|
40
|
+
tasksDiffer: (localTask: TaskData, remoteTask: TaskData) => boolean;
|
|
41
|
+
writeTask: (task: TaskData, opts?: TaskWriteOptions) => Promise<void>;
|
|
42
|
+
writeTasks: (tasks: TaskData[], opts?: TaskWriteOptions) => Promise<void>;
|
|
43
|
+
};
|
|
44
|
+
export declare function createRedmineCacheDocContext(host: RedmineBackendRuntimeHost): {
|
|
45
|
+
cache: LocalBackend | null;
|
|
46
|
+
customFields: Record<string, unknown>;
|
|
47
|
+
ownerAgent: string;
|
|
48
|
+
batchSize: number;
|
|
49
|
+
findIssueByTaskId: (taskId: string) => Promise<Record<string, unknown> | null>;
|
|
50
|
+
issueToTask: (issue: Record<string, unknown>, taskIdOverride?: string) => TaskData | null;
|
|
51
|
+
customFieldValue: (issue: Record<string, unknown>, fieldId: unknown) => string | null;
|
|
52
|
+
appendCustomField: (fields: Record<string, unknown>[], key: string, value: unknown) => void;
|
|
53
|
+
requestJson: (method: string, reqPath: string, payload?: Record<string, unknown>, params?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
54
|
+
assertExpectedRevisionSupported: (taskId: string, opts?: TaskWriteOptions) => void;
|
|
55
|
+
assertExpectedRevision: (taskId: string, expectedRevision: number | undefined, currentRevision: number) => void;
|
|
56
|
+
cacheTask: (task: TaskData, dirty: boolean) => Promise<void>;
|
|
57
|
+
};
|
|
58
|
+
export declare function createRedmineReportContext(host: RedmineBackendRuntimeHost): {
|
|
59
|
+
projectId: string;
|
|
60
|
+
customFields: Record<string, unknown>;
|
|
61
|
+
requestJson: (method: string, reqPath: string, payload?: Record<string, unknown>, params?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
62
|
+
};
|
|
63
|
+
export declare function createRedmineSyncContext(host: RedmineBackendRuntimeHost): {
|
|
64
|
+
cache: LocalBackend | null;
|
|
65
|
+
customFields: Record<string, unknown>;
|
|
66
|
+
ownerAgent: string;
|
|
67
|
+
projectId: string;
|
|
68
|
+
batchSize: number;
|
|
69
|
+
batchPauseMs: number;
|
|
70
|
+
statusMap: Record<string, unknown>;
|
|
71
|
+
issueCache: Map<string, Record<string, unknown>>;
|
|
72
|
+
inferredStatusByTaskStatus: Map<string, number> | null;
|
|
73
|
+
setInferredStatusByTaskStatus: (next: Map<string, number> | null) => void;
|
|
74
|
+
listTasksRemote: () => Promise<TaskData[]>;
|
|
75
|
+
writeTask: (task: TaskData, opts?: TaskWriteOptions) => Promise<void>;
|
|
76
|
+
writeTasks: (tasks: TaskData[], opts?: TaskWriteOptions) => Promise<void>;
|
|
77
|
+
findIssueByTaskId: (taskId: string) => Promise<Record<string, unknown> | null>;
|
|
78
|
+
issueToTask: (issue: Record<string, unknown>, taskIdOverride?: string) => TaskData | null;
|
|
79
|
+
taskToIssuePayload: (task: TaskData, existingIssue?: Record<string, unknown>) => Record<string, unknown>;
|
|
80
|
+
appendCustomField: (fields: Record<string, unknown>[], key: string, value: unknown) => void;
|
|
81
|
+
customFieldValue: (issue: Record<string, unknown>, fieldId: unknown) => string | null;
|
|
82
|
+
maybeParseJson: (value: unknown) => unknown;
|
|
83
|
+
normalizeComments: (value: unknown) => TaskComment[];
|
|
84
|
+
appendCommentNotes: (issueId: string, existingComments: TaskComment[], desiredComments: TaskComment[]) => Promise<void>;
|
|
85
|
+
cacheTask: (task: TaskData, dirty: boolean) => Promise<void>;
|
|
86
|
+
assertExpectedRevisionSupported: (taskId: string, opts?: TaskWriteOptions) => void;
|
|
87
|
+
assertExpectedRevision: (taskId: string, expectedRevision: number | undefined, currentRevision: number) => void;
|
|
88
|
+
ensureDocMetadata: (task: TaskDocMeta) => void;
|
|
89
|
+
diffTasks: (localTask: TaskData, remoteTask: TaskData) => string;
|
|
90
|
+
tasksDiffer: (localTask: TaskData, remoteTask: TaskData) => boolean;
|
|
91
|
+
taskIdFieldId: () => unknown;
|
|
92
|
+
setIssueCustomFieldValue: (issue: Record<string, unknown>, fieldId: unknown, value: unknown) => void;
|
|
93
|
+
requestJson: (method: string, reqPath: string, payload?: Record<string, unknown>, params?: Record<string, unknown>, opts?: {
|
|
94
|
+
attempts?: number;
|
|
95
|
+
backoff?: number;
|
|
96
|
+
}) => Promise<Record<string, unknown>>;
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=runtime-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-context.d.ts","sourceRoot":"","sources":["../../../../src/backends/task-backend/redmine/runtime-context.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export function createRedmineCacheDocContext(host) {
|
|
2
|
+
return {
|
|
3
|
+
cache: host.cache,
|
|
4
|
+
customFields: host.customFields,
|
|
5
|
+
ownerAgent: host.ownerAgent,
|
|
6
|
+
batchSize: host.batchSize,
|
|
7
|
+
findIssueByTaskId: async (taskId) => await host.findIssueByTaskId(taskId),
|
|
8
|
+
issueToTask: (issue, taskIdOverride) => host.issueToTask(issue, taskIdOverride),
|
|
9
|
+
customFieldValue: (issue, fieldId) => host.customFieldValue(issue, fieldId),
|
|
10
|
+
appendCustomField: (fields, key, value) => host.appendCustomField(fields, key, value),
|
|
11
|
+
requestJson: async (method, reqPath, payload, params) => await host.requestJson(method, reqPath, payload, params),
|
|
12
|
+
assertExpectedRevisionSupported: (taskId, opts) => host.assertExpectedRevisionSupported(taskId, opts),
|
|
13
|
+
assertExpectedRevision: (taskId, expectedRevision, currentRevision) => host.assertExpectedRevision(taskId, expectedRevision, currentRevision),
|
|
14
|
+
cacheTask: async (task, dirty) => await host.cacheTask(task, dirty),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function createRedmineReportContext(host) {
|
|
18
|
+
return {
|
|
19
|
+
projectId: host.projectId,
|
|
20
|
+
customFields: host.customFields,
|
|
21
|
+
requestJson: async (method, reqPath, payload, params) => await host.requestJson(method, reqPath, payload, params),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function createRedmineSyncContext(host) {
|
|
25
|
+
return {
|
|
26
|
+
cache: host.cache,
|
|
27
|
+
customFields: host.customFields,
|
|
28
|
+
ownerAgent: host.ownerAgent,
|
|
29
|
+
projectId: host.projectId,
|
|
30
|
+
batchSize: host.batchSize,
|
|
31
|
+
batchPauseMs: host.batchPauseMs,
|
|
32
|
+
statusMap: host.statusMap,
|
|
33
|
+
issueCache: host.issueCache,
|
|
34
|
+
inferredStatusByTaskStatus: host.inferredStatusByTaskStatus,
|
|
35
|
+
setInferredStatusByTaskStatus: host.setInferredStatusByTaskStatus,
|
|
36
|
+
listTasksRemote: async () => await host.listTasksRemote(),
|
|
37
|
+
writeTask: async (task, opts) => await host.writeTask(task, opts),
|
|
38
|
+
writeTasks: async (tasks, opts) => await host.writeTasks(tasks, opts),
|
|
39
|
+
findIssueByTaskId: async (taskId) => await host.findIssueByTaskId(taskId),
|
|
40
|
+
issueToTask: (issue, taskIdOverride) => host.issueToTask(issue, taskIdOverride),
|
|
41
|
+
taskToIssuePayload: (task, existingIssue) => host.taskToIssuePayload(task, existingIssue),
|
|
42
|
+
appendCustomField: (fields, key, value) => host.appendCustomField(fields, key, value),
|
|
43
|
+
customFieldValue: (issue, fieldId) => host.customFieldValue(issue, fieldId),
|
|
44
|
+
maybeParseJson: (value) => host.maybeParseJson(value),
|
|
45
|
+
normalizeComments: (value) => host.normalizeComments(value),
|
|
46
|
+
appendCommentNotes: async (issueId, existingComments, desiredComments) => await host.appendCommentNotes(issueId, existingComments, desiredComments),
|
|
47
|
+
cacheTask: async (task, dirty) => await host.cacheTask(task, dirty),
|
|
48
|
+
assertExpectedRevisionSupported: (taskId, opts) => host.assertExpectedRevisionSupported(taskId, opts),
|
|
49
|
+
assertExpectedRevision: (taskId, expectedRevision, currentRevision) => host.assertExpectedRevision(taskId, expectedRevision, currentRevision),
|
|
50
|
+
ensureDocMetadata: (task) => host.ensureDocMetadata(task),
|
|
51
|
+
diffTasks: (localTask, remoteTask) => host.diffTasks(localTask, remoteTask),
|
|
52
|
+
tasksDiffer: (localTask, remoteTask) => host.tasksDiffer(localTask, remoteTask),
|
|
53
|
+
taskIdFieldId: () => host.taskIdFieldId(),
|
|
54
|
+
setIssueCustomFieldValue: (issue, fieldId, value) => host.setIssueCustomFieldValue(issue, fieldId, value),
|
|
55
|
+
requestJson: async (method, reqPath, payload, params, opts) => await host.requestJson(method, reqPath, payload, params, opts),
|
|
56
|
+
};
|
|
57
|
+
}
|