@unbrained/pm-cli 2026.5.29 → 2026.5.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -12
- package/dist/cli/bootstrap-args.d.ts +1 -1
- package/dist/cli/bootstrap-args.js +59 -9
- package/dist/cli/bootstrap-args.js.map +1 -1
- package/dist/cli/commands/activity.js +4 -4
- package/dist/cli/commands/activity.js.map +1 -1
- package/dist/cli/commands/calendar.js +83 -11
- package/dist/cli/commands/calendar.js.map +1 -1
- package/dist/cli/commands/close.js +4 -4
- package/dist/cli/commands/close.js.map +1 -1
- package/dist/cli/commands/completion.js +4 -4
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/create.js +50 -7
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/deps.js +4 -4
- package/dist/cli/commands/deps.js.map +1 -1
- package/dist/cli/commands/extension/install-sources.d.ts +3 -0
- package/dist/cli/commands/extension/install-sources.js +29 -4
- package/dist/cli/commands/extension/install-sources.js.map +1 -1
- package/dist/cli/commands/extension.js +26 -5
- package/dist/cli/commands/extension.js.map +1 -1
- package/dist/cli/commands/get.js +6 -3
- package/dist/cli/commands/get.js.map +1 -1
- package/dist/cli/commands/list.js +25 -6
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/reindex.js +3 -3
- package/dist/cli/commands/reindex.js.map +1 -1
- package/dist/cli/commands/search.d.ts +17 -0
- package/dist/cli/commands/search.js +40 -10
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/stats.js +4 -4
- package/dist/cli/commands/stats.js.map +1 -1
- package/dist/cli/commands/test-all.js +4 -4
- package/dist/cli/commands/test-all.js.map +1 -1
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +39 -11
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/register-list-query.js +10 -12
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.js +20 -22
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-operations.js +32 -25
- package/dist/cli/register-operations.js.map +1 -1
- package/dist/cli/register-setup.js +7 -9
- package/dist/cli/register-setup.js.map +1 -1
- package/dist/cli/registration-helpers.js +6 -3
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/cli/search-refresh.d.ts +2 -0
- package/dist/cli/search-refresh.js +13 -0
- package/dist/cli/search-refresh.js.map +1 -0
- package/dist/cli-bundle/chunks/activity-OWYSUZOY.js +17 -0
- package/dist/cli-bundle/chunks/activity-OWYSUZOY.js.map +7 -0
- package/dist/cli-bundle/chunks/aggregate-ADUOSFRO.js +209 -0
- package/dist/cli-bundle/chunks/aggregate-ADUOSFRO.js.map +7 -0
- package/dist/cli-bundle/chunks/append-JD2DETU7.js +73 -0
- package/dist/cli-bundle/chunks/append-JD2DETU7.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js +27 -0
- package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-3M73P3G6.js +1636 -0
- package/dist/cli-bundle/chunks/chunk-3M73P3G6.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js +189 -0
- package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-5HSEP75M.js +330 -0
- package/dist/cli-bundle/chunks/chunk-5HSEP75M.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js +1770 -0
- package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-6YCV7WSL.js +552 -0
- package/dist/cli-bundle/chunks/chunk-6YCV7WSL.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js +202 -0
- package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-A7E7PUVX.js +157 -0
- package/dist/cli-bundle/chunks/chunk-A7E7PUVX.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-AKOOMO3T.js +90 -0
- package/dist/cli-bundle/chunks/chunk-AKOOMO3T.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js +950 -0
- package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-CEFIVZPG.js +79 -0
- package/dist/cli-bundle/chunks/chunk-CEFIVZPG.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-D7AOMPRH.js +349 -0
- package/dist/cli-bundle/chunks/chunk-D7AOMPRH.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-EAOG77HM.js +56 -0
- package/dist/cli-bundle/chunks/chunk-EAOG77HM.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js +47 -0
- package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-FM26RGSU.js +56 -0
- package/dist/cli-bundle/chunks/chunk-FM26RGSU.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js +435 -0
- package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-G57E5D7T.js +185 -0
- package/dist/cli-bundle/chunks/chunk-G57E5D7T.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js +3621 -0
- package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-JFWUHHS2.js +233 -0
- package/dist/cli-bundle/chunks/chunk-JFWUHHS2.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js +1861 -0
- package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js +648 -0
- package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-KBQY3YG5.js +122 -0
- package/dist/cli-bundle/chunks/chunk-KBQY3YG5.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-L2FXEKDB.js +185 -0
- package/dist/cli-bundle/chunks/chunk-L2FXEKDB.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js +189 -0
- package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js +5153 -0
- package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js +1345 -0
- package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-NGN7UV5K.js +341 -0
- package/dist/cli-bundle/chunks/chunk-NGN7UV5K.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-O7IWB35H.js +18 -0
- package/dist/cli-bundle/chunks/chunk-O7IWB35H.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js +2929 -0
- package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-P53TN6IA.js +674 -0
- package/dist/cli-bundle/chunks/chunk-P53TN6IA.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-PVNQLCIS.js +176 -0
- package/dist/cli-bundle/chunks/chunk-PVNQLCIS.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js +1680 -0
- package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js +20 -0
- package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-SEXQN4KL.js +60 -0
- package/dist/cli-bundle/chunks/chunk-SEXQN4KL.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js +362 -0
- package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-VGICHR7D.js +141 -0
- package/dist/cli-bundle/chunks/chunk-VGICHR7D.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js +632 -0
- package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-WJ2NAC37.js +252 -0
- package/dist/cli-bundle/chunks/chunk-WJ2NAC37.js.map +7 -0
- package/dist/cli-bundle/chunks/claim-EE4TKKCV.js +133 -0
- package/dist/cli-bundle/chunks/claim-EE4TKKCV.js.map +7 -0
- package/dist/cli-bundle/chunks/close-XY4CSAYF.js +14 -0
- package/dist/cli-bundle/chunks/close-XY4CSAYF.js.map +7 -0
- package/dist/cli-bundle/chunks/comments-AAKJQ6LW.js +104 -0
- package/dist/cli-bundle/chunks/comments-AAKJQ6LW.js.map +7 -0
- package/dist/cli-bundle/chunks/config-V3FZOKLI.js +1577 -0
- package/dist/cli-bundle/chunks/config-V3FZOKLI.js.map +7 -0
- package/dist/cli-bundle/chunks/context-RZ5QPNJB.js +1458 -0
- package/dist/cli-bundle/chunks/context-RZ5QPNJB.js.map +7 -0
- package/dist/cli-bundle/chunks/contracts-YLMH33VU.js +1245 -0
- package/dist/cli-bundle/chunks/contracts-YLMH33VU.js.map +7 -0
- package/dist/cli-bundle/chunks/create-PZVHRIZQ.js +28 -0
- package/dist/cli-bundle/chunks/create-PZVHRIZQ.js.map +7 -0
- package/dist/cli-bundle/chunks/delete-RHCTEORS.js +59 -0
- package/dist/cli-bundle/chunks/delete-RHCTEORS.js.map +7 -0
- package/dist/cli-bundle/chunks/deps-MZYCMLAO.js +229 -0
- package/dist/cli-bundle/chunks/deps-MZYCMLAO.js.map +7 -0
- package/dist/cli-bundle/chunks/docs-FXXUCZYU.js +35 -0
- package/dist/cli-bundle/chunks/docs-FXXUCZYU.js.map +7 -0
- package/dist/cli-bundle/chunks/extension-B4WL7BQU.js +25 -0
- package/dist/cli-bundle/chunks/extension-B4WL7BQU.js.map +7 -0
- package/dist/cli-bundle/chunks/files-WVOX67PE.js +286 -0
- package/dist/cli-bundle/chunks/files-WVOX67PE.js.map +7 -0
- package/dist/cli-bundle/chunks/gc-JWNF66EC.js +181 -0
- package/dist/cli-bundle/chunks/gc-JWNF66EC.js.map +7 -0
- package/dist/cli-bundle/chunks/get-LTK3HOCQ.js +198 -0
- package/dist/cli-bundle/chunks/get-LTK3HOCQ.js.map +7 -0
- package/dist/cli-bundle/chunks/health-TCWL55KM.js +1233 -0
- package/dist/cli-bundle/chunks/health-TCWL55KM.js.map +7 -0
- package/dist/cli-bundle/chunks/history-A2JUDXUE.js +21 -0
- package/dist/cli-bundle/chunks/history-A2JUDXUE.js.map +7 -0
- package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js +20 -0
- package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js.map +7 -0
- package/dist/cli-bundle/chunks/history-repair-ZWSTDRH2.js +198 -0
- package/dist/cli-bundle/chunks/history-repair-ZWSTDRH2.js.map +7 -0
- package/dist/cli-bundle/chunks/init-M2WUB4YH.js +16 -0
- package/dist/cli-bundle/chunks/init-M2WUB4YH.js.map +7 -0
- package/dist/cli-bundle/chunks/learnings-NXTWE3FR.js +48 -0
- package/dist/cli-bundle/chunks/learnings-NXTWE3FR.js.map +7 -0
- package/dist/cli-bundle/chunks/list-OGWQPC26.js +20 -0
- package/dist/cli-bundle/chunks/list-OGWQPC26.js.map +7 -0
- package/dist/cli-bundle/chunks/notes-DFS5ZGOO.js +48 -0
- package/dist/cli-bundle/chunks/notes-DFS5ZGOO.js.map +7 -0
- package/dist/cli-bundle/chunks/plan-67AB2PLM.js +1175 -0
- package/dist/cli-bundle/chunks/plan-67AB2PLM.js.map +7 -0
- package/dist/cli-bundle/chunks/register-list-query-UP3VRUFS.js +232 -0
- package/dist/cli-bundle/chunks/register-list-query-UP3VRUFS.js.map +7 -0
- package/dist/cli-bundle/chunks/register-mutation-YWSBF545.js +712 -0
- package/dist/cli-bundle/chunks/register-mutation-YWSBF545.js.map +7 -0
- package/dist/cli-bundle/chunks/register-operations-3BDTGSDH.js +374 -0
- package/dist/cli-bundle/chunks/register-operations-3BDTGSDH.js.map +7 -0
- package/dist/cli-bundle/chunks/register-setup-V56GDRUS.js +246 -0
- package/dist/cli-bundle/chunks/register-setup-V56GDRUS.js.map +7 -0
- package/dist/cli-bundle/chunks/restore-MB2ISME7.js +18 -0
- package/dist/cli-bundle/chunks/restore-MB2ISME7.js.map +7 -0
- package/dist/cli-bundle/chunks/schema-Q622KC46.js +119 -0
- package/dist/cli-bundle/chunks/schema-Q622KC46.js.map +7 -0
- package/dist/cli-bundle/chunks/search-HENBL456.js +1135 -0
- package/dist/cli-bundle/chunks/search-HENBL456.js.map +7 -0
- package/dist/cli-bundle/chunks/stats-N6H3YP2F.js +124 -0
- package/dist/cli-bundle/chunks/stats-N6H3YP2F.js.map +7 -0
- package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js +32 -0
- package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js.map +7 -0
- package/dist/cli-bundle/chunks/test-all-G2AZOHXI.js +332 -0
- package/dist/cli-bundle/chunks/test-all-G2AZOHXI.js.map +7 -0
- package/dist/cli-bundle/chunks/test-runs-GX5HTPSF.js +939 -0
- package/dist/cli-bundle/chunks/test-runs-GX5HTPSF.js.map +7 -0
- package/dist/cli-bundle/chunks/update-H6SCWNMA.js +22 -0
- package/dist/cli-bundle/chunks/update-H6SCWNMA.js.map +7 -0
- package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js +676 -0
- package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js.map +7 -0
- package/dist/cli-bundle/chunks/upgrade-H5HHM5UV.js +271 -0
- package/dist/cli-bundle/chunks/upgrade-H5HHM5UV.js.map +7 -0
- package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js +1110 -0
- package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js.map +7 -0
- package/dist/cli-bundle/main.js +6952 -0
- package/dist/cli-bundle/main.js.map +7 -0
- package/dist/cli.js +1 -1
- package/dist/core/config/nested-settings.d.ts +2 -0
- package/dist/core/config/nested-settings.js +17 -2
- package/dist/core/config/nested-settings.js.map +1 -1
- package/dist/core/item/item-type-definition.js +6 -2
- package/dist/core/item/item-type-definition.js.map +1 -1
- package/dist/core/item/type-registry.d.ts +4 -0
- package/dist/core/item/type-registry.js +10 -2
- package/dist/core/item/type-registry.js.map +1 -1
- package/dist/core/item/type-synonyms.d.ts +20 -0
- package/dist/core/item/type-synonyms.js +42 -0
- package/dist/core/item/type-synonyms.js.map +1 -0
- package/dist/core/search/background-refresh.d.ts +53 -0
- package/dist/core/search/background-refresh.js +286 -0
- package/dist/core/search/background-refresh.js.map +1 -0
- package/dist/core/search/cache.d.ts +20 -1
- package/dist/core/search/cache.js +76 -5
- package/dist/core/search/cache.js.map +1 -1
- package/dist/core/search/semantic-defaults.js +73 -32
- package/dist/core/search/semantic-defaults.js.map +1 -1
- package/dist/core/search/vector-stores.js +7 -3
- package/dist/core/search/vector-stores.js.map +1 -1
- package/dist/core/sentry/helpers.d.ts +1 -1
- package/dist/core/sentry/helpers.js +4 -4
- package/dist/core/sentry/helpers.js.map +1 -1
- package/dist/core/shared/constants.d.ts +2 -2
- package/dist/core/shared/constants.js +3 -3
- package/dist/core/shared/constants.js.map +1 -1
- package/dist/core/shared/html-entity-decode.d.ts +2 -1
- package/dist/core/shared/html-entity-decode.js +14 -9
- package/dist/core/shared/html-entity-decode.js.map +1 -1
- package/dist/core/shared/time.js +52 -2
- package/dist/core/shared/time.js.map +1 -1
- package/dist/core/store/front-matter-cache.d.ts +24 -0
- package/dist/core/store/front-matter-cache.js +119 -8
- package/dist/core/store/front-matter-cache.js.map +1 -1
- package/dist/core/store/item-format-migration.js +25 -15
- package/dist/core/store/item-format-migration.js.map +1 -1
- package/dist/core/store/item-store.d.ts +7 -0
- package/dist/core/store/item-store.js +13 -3
- package/dist/core/store/item-store.js.map +1 -1
- package/dist/core/store/settings-validator.d.ts +1 -0
- package/dist/core/store/settings-validator.js +7 -2
- package/dist/core/store/settings-validator.js.map +1 -1
- package/dist/core/store/settings.js +19 -3
- package/dist/core/store/settings.js.map +1 -1
- package/dist/core/telemetry/runtime.d.ts +10 -0
- package/dist/core/telemetry/runtime.js +86 -2
- package/dist/core/telemetry/runtime.js.map +1 -1
- package/dist/mcp/server.js +3 -3
- package/dist/mcp/server.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +4 -4
- package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
- package/dist/sdk/cli-contracts.js +29 -8
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/types.d.ts +9 -1
- package/dist/types.js +2 -2
- package/dist/types.js.map +1 -1
- package/docs/CONFIGURATION.md +11 -0
- package/docs/RELEASING.md +1 -1
- package/package.json +7 -5
- package/packages/pm-calendar/extensions/calendar/index.js +27 -2
- package/packages/pm-calendar/extensions/calendar/index.ts +28 -2
- package/scripts/bundle-cli.mjs +39 -0
|
@@ -0,0 +1,676 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runUpdate
|
|
3
|
+
} from "./chunk-3M73P3G6.js";
|
|
4
|
+
import {
|
|
5
|
+
runRestore
|
|
6
|
+
} from "./chunk-U7FMKRXH.js";
|
|
7
|
+
import {
|
|
8
|
+
resolveAuthor
|
|
9
|
+
} from "./chunk-O7IWB35H.js";
|
|
10
|
+
import "./chunk-LRBOHPUE.js";
|
|
11
|
+
import "./chunk-JFWUHHS2.js";
|
|
12
|
+
import "./chunk-JTWRXG4B.js";
|
|
13
|
+
import "./chunk-WJ2NAC37.js";
|
|
14
|
+
import "./chunk-7Y53ZJIQ.js";
|
|
15
|
+
import {
|
|
16
|
+
applyTagRemovals,
|
|
17
|
+
mergeAdditiveTags,
|
|
18
|
+
parseTags
|
|
19
|
+
} from "./chunk-NGN7UV5K.js";
|
|
20
|
+
import "./chunk-G57E5D7T.js";
|
|
21
|
+
import "./chunk-AKOOMO3T.js";
|
|
22
|
+
import "./chunk-5HSEP75M.js";
|
|
23
|
+
import "./chunk-3HUE7XOF.js";
|
|
24
|
+
import {
|
|
25
|
+
runList
|
|
26
|
+
} from "./chunk-FQE6XZDB.js";
|
|
27
|
+
import "./chunk-FM26RGSU.js";
|
|
28
|
+
import "./chunk-SEXQN4KL.js";
|
|
29
|
+
import {
|
|
30
|
+
toItemRecord
|
|
31
|
+
} from "./chunk-BUPWJ3IJ.js";
|
|
32
|
+
import "./chunk-4AEZR5EJ.js";
|
|
33
|
+
import "./chunk-CEFIVZPG.js";
|
|
34
|
+
import {
|
|
35
|
+
normalizeStatusInput
|
|
36
|
+
} from "./chunk-MD7K4JYF.js";
|
|
37
|
+
import "./chunk-WDPXDQFG.js";
|
|
38
|
+
import {
|
|
39
|
+
nowIso
|
|
40
|
+
} from "./chunk-PVNQLCIS.js";
|
|
41
|
+
import {
|
|
42
|
+
EXIT_CODE,
|
|
43
|
+
PmCliError,
|
|
44
|
+
getSettingsPath,
|
|
45
|
+
pathExists,
|
|
46
|
+
readSettings,
|
|
47
|
+
resolvePmRoot,
|
|
48
|
+
resolveRuntimeStatusRegistry,
|
|
49
|
+
toErrorMessage,
|
|
50
|
+
writeFileAtomic
|
|
51
|
+
} from "./chunk-LSXGH6NE.js";
|
|
52
|
+
|
|
53
|
+
// dist/cli/commands/update-many.js
|
|
54
|
+
import { mkdir, readFile } from "node:fs/promises";
|
|
55
|
+
import path from "node:path";
|
|
56
|
+
!(function() {
|
|
57
|
+
try {
|
|
58
|
+
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
59
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "336bc6cc-4b0e-5267-bc17-33833bd43370");
|
|
60
|
+
} catch (e2) {
|
|
61
|
+
}
|
|
62
|
+
})();
|
|
63
|
+
var UPDATE_MANY_CHECKPOINT_SCHEMA_VERSION = 1;
|
|
64
|
+
var UPDATE_MANY_CHECKPOINT_DIRECTORY = ["checkpoints", "update-many"];
|
|
65
|
+
var NON_MUTATION_UPDATE_OPTION_KEYS = /* @__PURE__ */ new Set([
|
|
66
|
+
"author",
|
|
67
|
+
"message",
|
|
68
|
+
"force",
|
|
69
|
+
"allowAuditUpdate",
|
|
70
|
+
"allowAuditDepUpdate"
|
|
71
|
+
]);
|
|
72
|
+
var UPDATE_MANY_MUTATION_FLAG_GUIDANCE = [
|
|
73
|
+
"--status",
|
|
74
|
+
"--priority",
|
|
75
|
+
"--type",
|
|
76
|
+
"--tags",
|
|
77
|
+
"--description",
|
|
78
|
+
"--body",
|
|
79
|
+
"--deadline",
|
|
80
|
+
"--estimate",
|
|
81
|
+
"--assignee",
|
|
82
|
+
"--dep",
|
|
83
|
+
"--dep-remove",
|
|
84
|
+
"--comment",
|
|
85
|
+
"--note",
|
|
86
|
+
"--learning",
|
|
87
|
+
"--file",
|
|
88
|
+
"--test",
|
|
89
|
+
"--doc",
|
|
90
|
+
"--replace-deps",
|
|
91
|
+
"--replace-tests",
|
|
92
|
+
"--unset",
|
|
93
|
+
"--clear-*"
|
|
94
|
+
].join(", ");
|
|
95
|
+
var UPDATE_OPTION_TO_ITEM_KEY = {
|
|
96
|
+
title: "title",
|
|
97
|
+
description: "description",
|
|
98
|
+
body: "body",
|
|
99
|
+
status: "status",
|
|
100
|
+
closeReason: "close_reason",
|
|
101
|
+
priority: "priority",
|
|
102
|
+
type: "type",
|
|
103
|
+
deadline: "deadline",
|
|
104
|
+
estimatedMinutes: "estimated_minutes",
|
|
105
|
+
acceptanceCriteria: "acceptance_criteria",
|
|
106
|
+
definitionOfReady: "definition_of_ready",
|
|
107
|
+
order: "order",
|
|
108
|
+
goal: "goal",
|
|
109
|
+
objective: "objective",
|
|
110
|
+
value: "value",
|
|
111
|
+
impact: "impact",
|
|
112
|
+
outcome: "outcome",
|
|
113
|
+
whyNow: "why_now",
|
|
114
|
+
assignee: "assignee",
|
|
115
|
+
parent: "parent",
|
|
116
|
+
reviewer: "reviewer",
|
|
117
|
+
risk: "risk",
|
|
118
|
+
confidence: "confidence",
|
|
119
|
+
sprint: "sprint",
|
|
120
|
+
release: "release",
|
|
121
|
+
blockedBy: "blocked_by",
|
|
122
|
+
blockedReason: "blocked_reason",
|
|
123
|
+
unblockNote: "unblock_note",
|
|
124
|
+
reporter: "reporter",
|
|
125
|
+
severity: "severity",
|
|
126
|
+
environment: "environment",
|
|
127
|
+
reproSteps: "repro_steps",
|
|
128
|
+
resolution: "resolution",
|
|
129
|
+
expectedResult: "expected_result",
|
|
130
|
+
actualResult: "actual_result",
|
|
131
|
+
affectedVersion: "affected_version",
|
|
132
|
+
fixedVersion: "fixed_version",
|
|
133
|
+
component: "component",
|
|
134
|
+
regression: "regression",
|
|
135
|
+
customerImpact: "customer_impact"
|
|
136
|
+
};
|
|
137
|
+
var COLLECTION_MUTATION_PLAN_DEFINITIONS = [
|
|
138
|
+
{
|
|
139
|
+
field: "dependencies",
|
|
140
|
+
addKey: "dep",
|
|
141
|
+
removeKey: "depRemove",
|
|
142
|
+
clearKey: "clearDeps",
|
|
143
|
+
replaceKey: "replaceDeps"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
field: "comments",
|
|
147
|
+
addKey: "comment",
|
|
148
|
+
clearKey: "clearComments"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
field: "notes",
|
|
152
|
+
addKey: "note",
|
|
153
|
+
clearKey: "clearNotes"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
field: "learnings",
|
|
157
|
+
addKey: "learning",
|
|
158
|
+
clearKey: "clearLearnings"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
field: "files",
|
|
162
|
+
addKey: "file",
|
|
163
|
+
clearKey: "clearFiles"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
field: "tests",
|
|
167
|
+
addKey: "test",
|
|
168
|
+
clearKey: "clearTests",
|
|
169
|
+
replaceKey: "replaceTests"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
field: "docs",
|
|
173
|
+
addKey: "doc",
|
|
174
|
+
clearKey: "clearDocs"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
field: "reminders",
|
|
178
|
+
addKey: "reminder",
|
|
179
|
+
clearKey: "clearReminders"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
field: "events",
|
|
183
|
+
addKey: "event",
|
|
184
|
+
clearKey: "clearEvents"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
field: "type_options",
|
|
188
|
+
addKey: "typeOption",
|
|
189
|
+
clearKey: "clearTypeOptions"
|
|
190
|
+
}
|
|
191
|
+
];
|
|
192
|
+
var UNSET_FIELD_ALIASES = {
|
|
193
|
+
close_reason: "close_reason",
|
|
194
|
+
"close-reason": "close_reason",
|
|
195
|
+
deadline: "deadline",
|
|
196
|
+
estimate: "estimated_minutes",
|
|
197
|
+
estimated_minutes: "estimated_minutes",
|
|
198
|
+
"estimated-minutes": "estimated_minutes",
|
|
199
|
+
acceptance_criteria: "acceptance_criteria",
|
|
200
|
+
"acceptance-criteria": "acceptance_criteria",
|
|
201
|
+
ac: "acceptance_criteria",
|
|
202
|
+
definition_of_ready: "definition_of_ready",
|
|
203
|
+
"definition-of-ready": "definition_of_ready",
|
|
204
|
+
order: "order",
|
|
205
|
+
rank: "order",
|
|
206
|
+
goal: "goal",
|
|
207
|
+
objective: "objective",
|
|
208
|
+
value: "value",
|
|
209
|
+
impact: "impact",
|
|
210
|
+
outcome: "outcome",
|
|
211
|
+
why_now: "why_now",
|
|
212
|
+
"why-now": "why_now",
|
|
213
|
+
assignee: "assignee",
|
|
214
|
+
parent: "parent",
|
|
215
|
+
reviewer: "reviewer",
|
|
216
|
+
risk: "risk",
|
|
217
|
+
confidence: "confidence",
|
|
218
|
+
sprint: "sprint",
|
|
219
|
+
release: "release",
|
|
220
|
+
blocked_by: "blocked_by",
|
|
221
|
+
"blocked-by": "blocked_by",
|
|
222
|
+
blocked_reason: "blocked_reason",
|
|
223
|
+
"blocked-reason": "blocked_reason",
|
|
224
|
+
unblock_note: "unblock_note",
|
|
225
|
+
"unblock-note": "unblock_note",
|
|
226
|
+
reporter: "reporter",
|
|
227
|
+
severity: "severity",
|
|
228
|
+
environment: "environment",
|
|
229
|
+
repro_steps: "repro_steps",
|
|
230
|
+
"repro-steps": "repro_steps",
|
|
231
|
+
resolution: "resolution",
|
|
232
|
+
expected_result: "expected_result",
|
|
233
|
+
"expected-result": "expected_result",
|
|
234
|
+
actual_result: "actual_result",
|
|
235
|
+
"actual-result": "actual_result",
|
|
236
|
+
affected_version: "affected_version",
|
|
237
|
+
"affected-version": "affected_version",
|
|
238
|
+
fixed_version: "fixed_version",
|
|
239
|
+
"fixed-version": "fixed_version",
|
|
240
|
+
component: "component",
|
|
241
|
+
regression: "regression",
|
|
242
|
+
customer_impact: "customer_impact",
|
|
243
|
+
"customer-impact": "customer_impact",
|
|
244
|
+
type_options: "type_options",
|
|
245
|
+
"type-options": "type_options",
|
|
246
|
+
tags: "tags"
|
|
247
|
+
};
|
|
248
|
+
function normalizeCheckpointId(raw) {
|
|
249
|
+
const trimmed = raw.trim();
|
|
250
|
+
if (!trimmed) {
|
|
251
|
+
throw new PmCliError("--rollback requires a non-empty checkpoint ID", EXIT_CODE.USAGE);
|
|
252
|
+
}
|
|
253
|
+
if (!/^[a-zA-Z0-9._-]+$/.test(trimmed)) {
|
|
254
|
+
throw new PmCliError("--rollback checkpoint ID must match [a-zA-Z0-9._-]+", EXIT_CODE.USAGE);
|
|
255
|
+
}
|
|
256
|
+
return trimmed;
|
|
257
|
+
}
|
|
258
|
+
function sanitizeUpdateOptionsForSummary(options) {
|
|
259
|
+
const summary = {};
|
|
260
|
+
for (const [key, value] of Object.entries(options)) {
|
|
261
|
+
if (NON_MUTATION_UPDATE_OPTION_KEYS.has(key)) {
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (value === void 0) {
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
summary[key] = value;
|
|
268
|
+
}
|
|
269
|
+
return summary;
|
|
270
|
+
}
|
|
271
|
+
function hasAnyUpdateMutationInput(options) {
|
|
272
|
+
return Object.keys(sanitizeUpdateOptionsForSummary(options)).length > 0;
|
|
273
|
+
}
|
|
274
|
+
function toComparablePreviewValue(optionKey, value) {
|
|
275
|
+
if (value === void 0) {
|
|
276
|
+
return void 0;
|
|
277
|
+
}
|
|
278
|
+
if (optionKey === "priority") {
|
|
279
|
+
const parsed = Number(String(value).trim());
|
|
280
|
+
return Number.isInteger(parsed) ? parsed : String(value).trim();
|
|
281
|
+
}
|
|
282
|
+
if (optionKey === "estimatedMinutes" || optionKey === "order" || optionKey === "rank") {
|
|
283
|
+
const parsed = Number(String(value).trim());
|
|
284
|
+
return Number.isFinite(parsed) ? parsed : String(value).trim();
|
|
285
|
+
}
|
|
286
|
+
if (optionKey === "regression") {
|
|
287
|
+
const normalized = String(value).trim().toLowerCase();
|
|
288
|
+
if (normalized === "true" || normalized === "1") {
|
|
289
|
+
return true;
|
|
290
|
+
}
|
|
291
|
+
if (normalized === "false" || normalized === "0") {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (typeof value === "string") {
|
|
296
|
+
return value.trim();
|
|
297
|
+
}
|
|
298
|
+
return value;
|
|
299
|
+
}
|
|
300
|
+
function normalizeUnsetField(rawField) {
|
|
301
|
+
const normalized = rawField.trim().toLowerCase().replaceAll("-", "_");
|
|
302
|
+
return UNSET_FIELD_ALIASES[normalized] ?? normalized;
|
|
303
|
+
}
|
|
304
|
+
function areValuesEqual(left, right) {
|
|
305
|
+
return JSON.stringify(left) === JSON.stringify(right);
|
|
306
|
+
}
|
|
307
|
+
function normalizeCollectionBeforeValue(field, value) {
|
|
308
|
+
if (value !== void 0) {
|
|
309
|
+
return value;
|
|
310
|
+
}
|
|
311
|
+
if (field === "type_options") {
|
|
312
|
+
return {};
|
|
313
|
+
}
|
|
314
|
+
return [];
|
|
315
|
+
}
|
|
316
|
+
function collectionValueCount(field, value) {
|
|
317
|
+
if (Array.isArray(value)) {
|
|
318
|
+
return value.length;
|
|
319
|
+
}
|
|
320
|
+
if (field === "type_options" && value && typeof value === "object") {
|
|
321
|
+
return Object.keys(value).length;
|
|
322
|
+
}
|
|
323
|
+
return 0;
|
|
324
|
+
}
|
|
325
|
+
function buildCollectionMutationPlans(row, update) {
|
|
326
|
+
const changes = [];
|
|
327
|
+
for (const definition of COLLECTION_MUTATION_PLAN_DEFINITIONS) {
|
|
328
|
+
const addValues = definition.addKey ? update[definition.addKey] : void 0;
|
|
329
|
+
const removeValues = definition.removeKey ? update[definition.removeKey] : void 0;
|
|
330
|
+
const addCount = Array.isArray(addValues) ? addValues.length : 0;
|
|
331
|
+
const removeCount = Array.isArray(removeValues) ? removeValues.length : 0;
|
|
332
|
+
const clear = definition.clearKey ? update[definition.clearKey] === true : false;
|
|
333
|
+
const replace = definition.replaceKey ? update[definition.replaceKey] === true : false;
|
|
334
|
+
if (!clear && !replace && addCount === 0 && removeCount === 0) {
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
const before = normalizeCollectionBeforeValue(definition.field, row[definition.field]);
|
|
338
|
+
const beforeCount = collectionValueCount(definition.field, before);
|
|
339
|
+
const operation = replace ? "replace" : clear ? "clear_or_reset" : removeCount > 0 ? "merge_remove" : "append";
|
|
340
|
+
changes.push({
|
|
341
|
+
field: definition.field,
|
|
342
|
+
before,
|
|
343
|
+
after: {
|
|
344
|
+
operation,
|
|
345
|
+
clear,
|
|
346
|
+
replace,
|
|
347
|
+
add_count: addCount,
|
|
348
|
+
remove_count: removeCount,
|
|
349
|
+
before_count: beforeCount
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
return changes;
|
|
354
|
+
}
|
|
355
|
+
function normalizeExistingTags(value) {
|
|
356
|
+
if (!Array.isArray(value)) {
|
|
357
|
+
return [];
|
|
358
|
+
}
|
|
359
|
+
return value.filter((tag) => typeof tag === "string");
|
|
360
|
+
}
|
|
361
|
+
function buildTagMutationPlan(row, update) {
|
|
362
|
+
const hasReplace = update.tags !== void 0;
|
|
363
|
+
const hasAdd = Array.isArray(update.addTags) && update.addTags.length > 0;
|
|
364
|
+
const hasRemove = Array.isArray(update.removeTags) && update.removeTags.length > 0;
|
|
365
|
+
if (!hasReplace && !hasAdd && !hasRemove) {
|
|
366
|
+
return void 0;
|
|
367
|
+
}
|
|
368
|
+
const existing = normalizeExistingTags(row.tags);
|
|
369
|
+
const baseTags = hasReplace ? parseTags(update.tags ?? "") : existing;
|
|
370
|
+
const withAdditions = mergeAdditiveTags(baseTags, update.addTags);
|
|
371
|
+
const after = applyTagRemovals(withAdditions, update.removeTags).slice().sort((a, b) => a.localeCompare(b));
|
|
372
|
+
const before = existing.slice().sort((a, b) => a.localeCompare(b));
|
|
373
|
+
if (areValuesEqual(before, after)) {
|
|
374
|
+
return void 0;
|
|
375
|
+
}
|
|
376
|
+
return { field: "tags", before: existing, after };
|
|
377
|
+
}
|
|
378
|
+
function buildPlannedItemDiff(item, update) {
|
|
379
|
+
const row = toItemRecord(item);
|
|
380
|
+
const changes = [];
|
|
381
|
+
const tagPlan = buildTagMutationPlan(row, update);
|
|
382
|
+
if (tagPlan) {
|
|
383
|
+
changes.push(tagPlan);
|
|
384
|
+
}
|
|
385
|
+
for (const [optionKey, itemKey] of Object.entries(UPDATE_OPTION_TO_ITEM_KEY)) {
|
|
386
|
+
const candidate = update[optionKey];
|
|
387
|
+
if (candidate === void 0) {
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
const before = row[itemKey];
|
|
391
|
+
const after = toComparablePreviewValue(optionKey, candidate);
|
|
392
|
+
if (areValuesEqual(before, after)) {
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
changes.push({
|
|
396
|
+
field: itemKey,
|
|
397
|
+
before,
|
|
398
|
+
after
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
changes.push(...buildCollectionMutationPlans(row, update));
|
|
402
|
+
if (update.unset && update.unset.length > 0) {
|
|
403
|
+
for (const rawUnsetField of update.unset) {
|
|
404
|
+
const field = normalizeUnsetField(rawUnsetField);
|
|
405
|
+
const before = row[field];
|
|
406
|
+
if (before === void 0) {
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
changes.push({
|
|
410
|
+
field,
|
|
411
|
+
before,
|
|
412
|
+
after: null
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return {
|
|
417
|
+
id: item.id,
|
|
418
|
+
changes
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
function createCheckpointId(nowValue) {
|
|
422
|
+
const compactTimestamp = nowValue.replace(/[-:.TZ]/g, "").slice(0, 14);
|
|
423
|
+
const randomSuffix = Math.random().toString(36).slice(2, 8);
|
|
424
|
+
return `update-many-${compactTimestamp}-${randomSuffix}`;
|
|
425
|
+
}
|
|
426
|
+
function checkpointDirectoryPath(pmRoot) {
|
|
427
|
+
return path.join(pmRoot, ...UPDATE_MANY_CHECKPOINT_DIRECTORY);
|
|
428
|
+
}
|
|
429
|
+
function checkpointFilePath(pmRoot, checkpointId) {
|
|
430
|
+
return path.join(checkpointDirectoryPath(pmRoot), `${checkpointId}.json`);
|
|
431
|
+
}
|
|
432
|
+
function normalizeStatusFilter(value, statusRegistry) {
|
|
433
|
+
if (value === void 0) {
|
|
434
|
+
return void 0;
|
|
435
|
+
}
|
|
436
|
+
const normalized = normalizeStatusInput(value, statusRegistry);
|
|
437
|
+
if (!normalized) {
|
|
438
|
+
const allowedStatuses = statusRegistry.definitions.map((definition) => definition.id);
|
|
439
|
+
throw new PmCliError(`Invalid --filter-status value "${value}". Allowed: ${allowedStatuses.join(", ")}`, EXIT_CODE.USAGE);
|
|
440
|
+
}
|
|
441
|
+
return normalized;
|
|
442
|
+
}
|
|
443
|
+
function hasListFilters(list, status) {
|
|
444
|
+
return status !== void 0 || list.type !== void 0 || list.tag !== void 0 || list.priority !== void 0 || list.deadlineBefore !== void 0 || list.deadlineAfter !== void 0 || list.assignee !== void 0 || list.assigneeFilter !== void 0 || list.parent !== void 0 || list.sprint !== void 0 || list.release !== void 0 || list.limit !== void 0 || list.offset !== void 0;
|
|
445
|
+
}
|
|
446
|
+
function ensureCheckpointShape(value, checkpointId) {
|
|
447
|
+
if (!value || typeof value !== "object") {
|
|
448
|
+
throw new PmCliError(`Checkpoint ${checkpointId} is invalid`, EXIT_CODE.GENERIC_FAILURE);
|
|
449
|
+
}
|
|
450
|
+
const record = value;
|
|
451
|
+
if (record.schema_version !== UPDATE_MANY_CHECKPOINT_SCHEMA_VERSION) {
|
|
452
|
+
throw new PmCliError(`Checkpoint ${checkpointId} has unsupported schema version`, EXIT_CODE.GENERIC_FAILURE);
|
|
453
|
+
}
|
|
454
|
+
if (!Array.isArray(record.items)) {
|
|
455
|
+
throw new PmCliError(`Checkpoint ${checkpointId} is missing items`, EXIT_CODE.GENERIC_FAILURE);
|
|
456
|
+
}
|
|
457
|
+
const items = record.items.map((entry) => {
|
|
458
|
+
if (!entry || typeof entry !== "object") {
|
|
459
|
+
throw new PmCliError(`Checkpoint ${checkpointId} contains an invalid item entry`, EXIT_CODE.GENERIC_FAILURE);
|
|
460
|
+
}
|
|
461
|
+
const row = entry;
|
|
462
|
+
if (typeof row.id !== "string" || row.id.trim().length === 0) {
|
|
463
|
+
throw new PmCliError(`Checkpoint ${checkpointId} contains an item entry without ID`, EXIT_CODE.GENERIC_FAILURE);
|
|
464
|
+
}
|
|
465
|
+
if (typeof row.target_updated_at !== "string" || row.target_updated_at.trim().length === 0) {
|
|
466
|
+
throw new PmCliError(`Checkpoint ${checkpointId} contains an item entry without target_updated_at`, EXIT_CODE.GENERIC_FAILURE);
|
|
467
|
+
}
|
|
468
|
+
return {
|
|
469
|
+
id: row.id.trim(),
|
|
470
|
+
target_updated_at: row.target_updated_at.trim()
|
|
471
|
+
};
|
|
472
|
+
});
|
|
473
|
+
return {
|
|
474
|
+
schema_version: UPDATE_MANY_CHECKPOINT_SCHEMA_VERSION,
|
|
475
|
+
id: typeof record.id === "string" ? record.id : checkpointId,
|
|
476
|
+
created_at: typeof record.created_at === "string" ? record.created_at : nowIso(),
|
|
477
|
+
author: typeof record.author === "string" ? record.author : "unknown",
|
|
478
|
+
status_filter: typeof record.status_filter === "string" ? record.status_filter : null,
|
|
479
|
+
list_filters: record.list_filters && typeof record.list_filters === "object" && !Array.isArray(record.list_filters) ? record.list_filters : {},
|
|
480
|
+
update_options: record.update_options && typeof record.update_options === "object" && !Array.isArray(record.update_options) ? record.update_options : {},
|
|
481
|
+
items
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
async function loadCheckpoint(pmRoot, checkpointId) {
|
|
485
|
+
const normalizedId = normalizeCheckpointId(checkpointId);
|
|
486
|
+
const filePath = checkpointFilePath(pmRoot, normalizedId);
|
|
487
|
+
if (!await pathExists(filePath)) {
|
|
488
|
+
throw new PmCliError(`Checkpoint ${normalizedId} not found`, EXIT_CODE.NOT_FOUND);
|
|
489
|
+
}
|
|
490
|
+
const raw = await readFile(filePath, "utf8");
|
|
491
|
+
const parsed = JSON.parse(raw);
|
|
492
|
+
return {
|
|
493
|
+
checkpoint: ensureCheckpointShape(parsed, normalizedId),
|
|
494
|
+
path: filePath
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
async function runUpdateMany(options, global2) {
|
|
498
|
+
const pmRoot = resolvePmRoot(process.cwd(), global2.path);
|
|
499
|
+
if (!await pathExists(getSettingsPath(pmRoot))) {
|
|
500
|
+
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
501
|
+
}
|
|
502
|
+
const settings = await readSettings(pmRoot);
|
|
503
|
+
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
504
|
+
const dryRun = options.dryRun === true;
|
|
505
|
+
const rollbackId = typeof options.rollback === "string" ? options.rollback : void 0;
|
|
506
|
+
const updateSummary = sanitizeUpdateOptionsForSummary(options.update);
|
|
507
|
+
if (rollbackId) {
|
|
508
|
+
if (dryRun) {
|
|
509
|
+
throw new PmCliError("--dry-run cannot be combined with --rollback", EXIT_CODE.USAGE);
|
|
510
|
+
}
|
|
511
|
+
if (hasListFilters(options.list, options.status)) {
|
|
512
|
+
throw new PmCliError("Rollback mode does not accept filter options", EXIT_CODE.USAGE);
|
|
513
|
+
}
|
|
514
|
+
if (Object.keys(updateSummary).length > 0) {
|
|
515
|
+
throw new PmCliError("Rollback mode does not accept update mutation flags", EXIT_CODE.USAGE);
|
|
516
|
+
}
|
|
517
|
+
const { checkpoint, path: checkpointPath } = await loadCheckpoint(pmRoot, rollbackId);
|
|
518
|
+
const rollbackRows = [];
|
|
519
|
+
const restoredIds = [];
|
|
520
|
+
const restoreMessage = options.update.message ?? `Rollback update-many checkpoint ${checkpoint.id}`;
|
|
521
|
+
for (const entry of checkpoint.items) {
|
|
522
|
+
try {
|
|
523
|
+
const restored = await runRestore(entry.id, entry.target_updated_at, {
|
|
524
|
+
author: options.update.author,
|
|
525
|
+
message: restoreMessage,
|
|
526
|
+
force: options.update.force ?? true
|
|
527
|
+
}, global2);
|
|
528
|
+
rollbackRows.push({
|
|
529
|
+
id: entry.id,
|
|
530
|
+
status: "restored",
|
|
531
|
+
changed_fields: restored.changed_fields,
|
|
532
|
+
warnings: restored.warnings
|
|
533
|
+
});
|
|
534
|
+
restoredIds.push(entry.id);
|
|
535
|
+
} catch (error) {
|
|
536
|
+
rollbackRows.push({
|
|
537
|
+
id: entry.id,
|
|
538
|
+
status: "failed",
|
|
539
|
+
error: toErrorMessage(error)
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
const failedCount2 = rollbackRows.filter((row) => row.status === "failed").length;
|
|
544
|
+
return {
|
|
545
|
+
mode: "rollback",
|
|
546
|
+
matched_count: checkpoint.items.length,
|
|
547
|
+
dry_run: false,
|
|
548
|
+
rollback_checkpoint_id: checkpoint.id,
|
|
549
|
+
checkpoint: {
|
|
550
|
+
id: checkpoint.id,
|
|
551
|
+
created_at: checkpoint.created_at,
|
|
552
|
+
path: checkpointPath,
|
|
553
|
+
rollback_command: `pm update-many --rollback ${checkpoint.id}`
|
|
554
|
+
},
|
|
555
|
+
restored_count: restoredIds.length,
|
|
556
|
+
failed_count: failedCount2,
|
|
557
|
+
rows: rollbackRows,
|
|
558
|
+
ids: restoredIds
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
if (!hasAnyUpdateMutationInput(options.update)) {
|
|
562
|
+
throw new PmCliError(`No update-many mutation flags provided. Add at least one mutation flag (for example: ${UPDATE_MANY_MUTATION_FLAG_GUIDANCE}).`, EXIT_CODE.USAGE);
|
|
563
|
+
}
|
|
564
|
+
const statusFilter = normalizeStatusFilter(options.status, statusRegistry);
|
|
565
|
+
const listed = await runList(statusFilter, { ...options.list, includeBody: true }, global2);
|
|
566
|
+
const planned = listed.items.map((item) => buildPlannedItemDiff(item, options.update));
|
|
567
|
+
const actionable = planned.filter((row) => row.changes.length > 0);
|
|
568
|
+
if (dryRun) {
|
|
569
|
+
return {
|
|
570
|
+
mode: "dry_run",
|
|
571
|
+
matched_count: listed.items.length,
|
|
572
|
+
dry_run: true,
|
|
573
|
+
filters: listed.filters,
|
|
574
|
+
planned_update_options: updateSummary,
|
|
575
|
+
item_plans: planned,
|
|
576
|
+
ids: []
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
if (actionable.length === 0) {
|
|
580
|
+
return {
|
|
581
|
+
mode: "apply",
|
|
582
|
+
matched_count: listed.items.length,
|
|
583
|
+
dry_run: false,
|
|
584
|
+
filters: listed.filters,
|
|
585
|
+
planned_update_options: updateSummary,
|
|
586
|
+
updated_count: 0,
|
|
587
|
+
skipped_count: listed.items.length,
|
|
588
|
+
failed_count: 0,
|
|
589
|
+
rows: planned.map((row) => ({
|
|
590
|
+
id: row.id,
|
|
591
|
+
status: "skipped"
|
|
592
|
+
})),
|
|
593
|
+
ids: []
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
const nowValue = nowIso();
|
|
597
|
+
const checkpointId = createCheckpointId(nowValue);
|
|
598
|
+
const checkpointEnabled = options.checkpoint !== false;
|
|
599
|
+
const checkpointItems = listed.items.filter((item) => actionable.some((candidate) => candidate.id === item.id)).map((item) => ({
|
|
600
|
+
id: item.id,
|
|
601
|
+
target_updated_at: item.updated_at
|
|
602
|
+
}));
|
|
603
|
+
let checkpointInfo;
|
|
604
|
+
if (checkpointEnabled) {
|
|
605
|
+
const checkpointPayload = {
|
|
606
|
+
schema_version: UPDATE_MANY_CHECKPOINT_SCHEMA_VERSION,
|
|
607
|
+
id: checkpointId,
|
|
608
|
+
created_at: nowValue,
|
|
609
|
+
author: resolveAuthor(options.update.author, "unknown"),
|
|
610
|
+
status_filter: statusFilter ?? null,
|
|
611
|
+
list_filters: listed.filters,
|
|
612
|
+
update_options: updateSummary,
|
|
613
|
+
items: checkpointItems
|
|
614
|
+
};
|
|
615
|
+
const checkpointDir = checkpointDirectoryPath(pmRoot);
|
|
616
|
+
await mkdir(checkpointDir, { recursive: true });
|
|
617
|
+
const checkpointPath = checkpointFilePath(pmRoot, checkpointId);
|
|
618
|
+
await writeFileAtomic(checkpointPath, `${JSON.stringify(checkpointPayload, null, 2)}
|
|
619
|
+
`);
|
|
620
|
+
checkpointInfo = {
|
|
621
|
+
id: checkpointId,
|
|
622
|
+
created_at: nowValue,
|
|
623
|
+
path: checkpointPath,
|
|
624
|
+
rollback_command: `pm update-many --rollback ${checkpointId}`
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
const applyRows = [];
|
|
628
|
+
const updatedIds = [];
|
|
629
|
+
const updateMessage = options.update.message ?? `update-many apply ${checkpointId}`;
|
|
630
|
+
const actionableById = new Set(actionable.map((row) => row.id));
|
|
631
|
+
for (const item of listed.items) {
|
|
632
|
+
if (!actionableById.has(item.id)) {
|
|
633
|
+
applyRows.push({ id: item.id, status: "skipped" });
|
|
634
|
+
continue;
|
|
635
|
+
}
|
|
636
|
+
try {
|
|
637
|
+
const result = await runUpdate(item.id, {
|
|
638
|
+
...options.update,
|
|
639
|
+
message: updateMessage
|
|
640
|
+
}, global2);
|
|
641
|
+
applyRows.push({
|
|
642
|
+
id: item.id,
|
|
643
|
+
status: "updated",
|
|
644
|
+
changed_fields: result.changed_fields,
|
|
645
|
+
warnings: result.warnings
|
|
646
|
+
});
|
|
647
|
+
updatedIds.push(item.id);
|
|
648
|
+
} catch (error) {
|
|
649
|
+
applyRows.push({
|
|
650
|
+
id: item.id,
|
|
651
|
+
status: "failed",
|
|
652
|
+
error: toErrorMessage(error)
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
const updatedCount = applyRows.filter((row) => row.status === "updated").length;
|
|
657
|
+
const skippedCount = applyRows.filter((row) => row.status === "skipped").length;
|
|
658
|
+
const failedCount = applyRows.filter((row) => row.status === "failed").length;
|
|
659
|
+
return {
|
|
660
|
+
mode: "apply",
|
|
661
|
+
matched_count: listed.items.length,
|
|
662
|
+
dry_run: false,
|
|
663
|
+
filters: listed.filters,
|
|
664
|
+
planned_update_options: updateSummary,
|
|
665
|
+
...checkpointInfo ? { checkpoint: checkpointInfo } : {},
|
|
666
|
+
updated_count: updatedCount,
|
|
667
|
+
skipped_count: skippedCount,
|
|
668
|
+
failed_count: failedCount,
|
|
669
|
+
rows: applyRows,
|
|
670
|
+
ids: updatedIds
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
export {
|
|
674
|
+
runUpdateMany
|
|
675
|
+
};
|
|
676
|
+
//# sourceMappingURL=update-many-46HRSP2Q.js.map
|