@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,330 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EXIT_CODE,
|
|
3
|
+
runActiveCommandOverride,
|
|
4
|
+
runActiveRendererOverride,
|
|
5
|
+
runActiveServiceOverrideSync,
|
|
6
|
+
setActiveCommandResult
|
|
7
|
+
} from "./chunk-LSXGH6NE.js";
|
|
8
|
+
|
|
9
|
+
// dist/core/output/mutation-projection.js
|
|
10
|
+
!(function() {
|
|
11
|
+
try {
|
|
12
|
+
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
13
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "5de7498f-df5a-5529-9058-a127633bba2d");
|
|
14
|
+
} catch (e2) {
|
|
15
|
+
}
|
|
16
|
+
})();
|
|
17
|
+
var CHANGED_FIELDS_KEY = "changed_fields";
|
|
18
|
+
var CHANGED_FIELD_COUNT_KEY = "changed_field_count";
|
|
19
|
+
var ROWS_KEY = "rows";
|
|
20
|
+
var UPDATE_MANY_MUTATION_MODES = /* @__PURE__ */ new Set(["apply", "rollback"]);
|
|
21
|
+
function isPlainObject(value) {
|
|
22
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
const proto = Object.getPrototypeOf(value);
|
|
26
|
+
return proto === null || proto === Object.prototype;
|
|
27
|
+
}
|
|
28
|
+
function compactOwnChangedFields(envelope) {
|
|
29
|
+
const changedFields = envelope[CHANGED_FIELDS_KEY];
|
|
30
|
+
if (!Array.isArray(changedFields)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const projected = Object.getPrototypeOf(envelope) === null ? /* @__PURE__ */ Object.create(null) : {};
|
|
34
|
+
for (const [key, value] of Object.entries(envelope)) {
|
|
35
|
+
if (key !== CHANGED_FIELDS_KEY) {
|
|
36
|
+
projected[key] = value;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
projected[CHANGED_FIELD_COUNT_KEY] = changedFields.length;
|
|
40
|
+
return projected;
|
|
41
|
+
}
|
|
42
|
+
function isMutationEnvelope(value) {
|
|
43
|
+
return "item" in value && Array.isArray(value[CHANGED_FIELDS_KEY]);
|
|
44
|
+
}
|
|
45
|
+
function isUpdateManyMutationEnvelope(value) {
|
|
46
|
+
return typeof value.mode === "string" && UPDATE_MANY_MUTATION_MODES.has(value.mode) && Array.isArray(value[ROWS_KEY]);
|
|
47
|
+
}
|
|
48
|
+
function replaceRows(envelope, rows) {
|
|
49
|
+
const projected = Object.getPrototypeOf(envelope) === null ? /* @__PURE__ */ Object.create(null) : {};
|
|
50
|
+
Object.assign(projected, envelope);
|
|
51
|
+
projected[ROWS_KEY] = rows;
|
|
52
|
+
return projected;
|
|
53
|
+
}
|
|
54
|
+
function projectMutationResult(result, options = {}) {
|
|
55
|
+
const mode = options.changedFields ?? "full";
|
|
56
|
+
if (mode === "full" || !isPlainObject(result)) {
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
let changed = false;
|
|
60
|
+
let projected = result;
|
|
61
|
+
const compactedTop = isMutationEnvelope(result) ? compactOwnChangedFields(result) : null;
|
|
62
|
+
if (compactedTop !== null) {
|
|
63
|
+
projected = compactedTop;
|
|
64
|
+
changed = true;
|
|
65
|
+
}
|
|
66
|
+
const rows = isUpdateManyMutationEnvelope(projected) ? projected[ROWS_KEY] : void 0;
|
|
67
|
+
if (Array.isArray(rows)) {
|
|
68
|
+
let rowsChanged = false;
|
|
69
|
+
const nextRows = rows.map((row) => {
|
|
70
|
+
if (!isPlainObject(row)) {
|
|
71
|
+
return row;
|
|
72
|
+
}
|
|
73
|
+
const compactedRow = compactOwnChangedFields(row);
|
|
74
|
+
if (compactedRow) {
|
|
75
|
+
rowsChanged = true;
|
|
76
|
+
return compactedRow;
|
|
77
|
+
}
|
|
78
|
+
return row;
|
|
79
|
+
});
|
|
80
|
+
if (rowsChanged) {
|
|
81
|
+
projected = replaceRows(projected, nextRows);
|
|
82
|
+
changed = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return changed ? projected : result;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// dist/core/output/output.js
|
|
89
|
+
!(function() {
|
|
90
|
+
try {
|
|
91
|
+
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
92
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "4294a479-42ff-5bc2-a600-74671b15c673");
|
|
93
|
+
} catch (e2) {
|
|
94
|
+
}
|
|
95
|
+
})();
|
|
96
|
+
var streamErrorHandlersInstalled = false;
|
|
97
|
+
function isPlainObject2(value) {
|
|
98
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
99
|
+
}
|
|
100
|
+
function isBrokenPipeError(error) {
|
|
101
|
+
return typeof error === "object" && error !== null && error.code === "EPIPE";
|
|
102
|
+
}
|
|
103
|
+
function markStdoutBrokenPipeExitCode() {
|
|
104
|
+
if (process.exitCode === void 0 || process.exitCode === EXIT_CODE.SUCCESS) {
|
|
105
|
+
process.exitCode = EXIT_CODE.SUCCESS;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function markStderrBrokenPipeExitCode() {
|
|
109
|
+
if (process.exitCode === void 0 || process.exitCode === EXIT_CODE.SUCCESS) {
|
|
110
|
+
process.exitCode = EXIT_CODE.GENERIC_FAILURE;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function markBrokenPipeExitCode(target) {
|
|
114
|
+
if (target === "stdout") {
|
|
115
|
+
markStdoutBrokenPipeExitCode();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
markStderrBrokenPipeExitCode();
|
|
119
|
+
}
|
|
120
|
+
function handleUnhandledStreamError(error) {
|
|
121
|
+
const unhandled = error instanceof Error ? error : new Error(String(error));
|
|
122
|
+
setImmediate(() => {
|
|
123
|
+
throw unhandled;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function installStreamErrorHandlers() {
|
|
127
|
+
if (streamErrorHandlersInstalled) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
streamErrorHandlersInstalled = true;
|
|
131
|
+
process.stdout.on("error", (error) => {
|
|
132
|
+
if (isBrokenPipeError(error)) {
|
|
133
|
+
markBrokenPipeExitCode("stdout");
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
handleUnhandledStreamError(error);
|
|
137
|
+
});
|
|
138
|
+
process.stderr.on("error", (error) => {
|
|
139
|
+
if (isBrokenPipeError(error)) {
|
|
140
|
+
markBrokenPipeExitCode("stderr");
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
handleUnhandledStreamError(error);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function writeToStream(target, text) {
|
|
147
|
+
installStreamErrorHandlers();
|
|
148
|
+
try {
|
|
149
|
+
if (target === "stdout") {
|
|
150
|
+
process.stdout.write(text);
|
|
151
|
+
} else {
|
|
152
|
+
process.stderr.write(text);
|
|
153
|
+
}
|
|
154
|
+
return true;
|
|
155
|
+
} catch (error) {
|
|
156
|
+
if (isBrokenPipeError(error)) {
|
|
157
|
+
markBrokenPipeExitCode(target);
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
throw error;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function writeStdout(text) {
|
|
164
|
+
return writeToStream("stdout", text);
|
|
165
|
+
}
|
|
166
|
+
function writeStderr(text) {
|
|
167
|
+
return writeToStream("stderr", text);
|
|
168
|
+
}
|
|
169
|
+
function renderScalar(value) {
|
|
170
|
+
if (typeof value === "string")
|
|
171
|
+
return JSON.stringify(value);
|
|
172
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
173
|
+
return String(value);
|
|
174
|
+
if (value === null)
|
|
175
|
+
return "null";
|
|
176
|
+
return JSON.stringify(value);
|
|
177
|
+
}
|
|
178
|
+
function compactToonValue(value) {
|
|
179
|
+
if (value === null || value === void 0) {
|
|
180
|
+
return void 0;
|
|
181
|
+
}
|
|
182
|
+
if (Array.isArray(value)) {
|
|
183
|
+
const compactedEntries = value.map((entry) => compactToonValue(entry)).filter((entry) => entry !== void 0);
|
|
184
|
+
return compactedEntries.length > 0 ? compactedEntries : void 0;
|
|
185
|
+
}
|
|
186
|
+
if (isPlainObject2(value)) {
|
|
187
|
+
const compacted = {};
|
|
188
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
189
|
+
const compactedEntry = compactToonValue(entry);
|
|
190
|
+
if (compactedEntry !== void 0) {
|
|
191
|
+
compacted[key] = compactedEntry;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return Object.keys(compacted).length > 0 ? compacted : void 0;
|
|
195
|
+
}
|
|
196
|
+
return value;
|
|
197
|
+
}
|
|
198
|
+
function renderToonValue(value, depth) {
|
|
199
|
+
const indent = " ".repeat(depth);
|
|
200
|
+
if (Array.isArray(value)) {
|
|
201
|
+
if (value.length === 0)
|
|
202
|
+
return "[]";
|
|
203
|
+
return value.map((entry) => {
|
|
204
|
+
if (!isPlainObject2(entry) && !Array.isArray(entry)) {
|
|
205
|
+
return `${indent}- ${renderScalar(entry)}`;
|
|
206
|
+
}
|
|
207
|
+
const rendered = renderToonValue(entry, depth + 1);
|
|
208
|
+
const lines = rendered.split("\n");
|
|
209
|
+
const [firstLine, ...rest] = lines;
|
|
210
|
+
if (rest.length === 0) {
|
|
211
|
+
return `${indent}- ${firstLine.trimStart()}`;
|
|
212
|
+
}
|
|
213
|
+
return `${indent}- ${firstLine.trimStart()}
|
|
214
|
+
${rest.join("\n")}`;
|
|
215
|
+
}).join("\n");
|
|
216
|
+
}
|
|
217
|
+
if (isPlainObject2(value)) {
|
|
218
|
+
const entries = Object.entries(value);
|
|
219
|
+
if (entries.length === 0)
|
|
220
|
+
return "{}";
|
|
221
|
+
return entries.map(([key, entry]) => {
|
|
222
|
+
if (!isPlainObject2(entry) && !Array.isArray(entry)) {
|
|
223
|
+
return `${indent}${key}: ${renderScalar(entry)}`;
|
|
224
|
+
}
|
|
225
|
+
if (Array.isArray(entry) && entry.length === 0) {
|
|
226
|
+
return `${indent}${key}: []`;
|
|
227
|
+
}
|
|
228
|
+
if (isPlainObject2(entry) && Object.keys(entry).length === 0) {
|
|
229
|
+
return `${indent}${key}: {}`;
|
|
230
|
+
}
|
|
231
|
+
return `${indent}${key}:
|
|
232
|
+
${renderToonValue(entry, depth + 1)}`;
|
|
233
|
+
}).join("\n");
|
|
234
|
+
}
|
|
235
|
+
return `${indent}${renderScalar(value)}`;
|
|
236
|
+
}
|
|
237
|
+
function renderDefaultMarkdownResult(value) {
|
|
238
|
+
if (!isPlainObject2(value) || value.output_default !== "markdown") {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
if (typeof value.view !== "string" || !Array.isArray(value.events) || !Array.isArray(value.days)) {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
const lines = [`# pm calendar (${value.view})`, ""];
|
|
245
|
+
const summary = isPlainObject2(value.summary) ? value.summary : {};
|
|
246
|
+
lines.push(`- events: ${String(summary.events ?? 0)}`);
|
|
247
|
+
lines.push("");
|
|
248
|
+
if (value.events.length === 0) {
|
|
249
|
+
lines.push("No calendar events matched the selected filters.");
|
|
250
|
+
return `${lines.join("\n")}
|
|
251
|
+
`;
|
|
252
|
+
}
|
|
253
|
+
for (const event of value.events) {
|
|
254
|
+
if (!isPlainObject2(event)) {
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
const kind = typeof event.kind === "string" ? event.kind : "event";
|
|
258
|
+
const title = typeof event.item_title === "string" ? event.item_title : "";
|
|
259
|
+
const itemId = typeof event.item_id === "string" ? event.item_id : "";
|
|
260
|
+
const reminderText = typeof event.reminder_text === "string" && event.reminder_text.length > 0 ? ` ${event.reminder_text}` : "";
|
|
261
|
+
lines.push(`- [${kind}] ${itemId} ${title}${reminderText}`.trim());
|
|
262
|
+
}
|
|
263
|
+
return `${lines.join("\n")}
|
|
264
|
+
`;
|
|
265
|
+
}
|
|
266
|
+
function formatOutput(result, options) {
|
|
267
|
+
const commandOverride = runActiveCommandOverride(result);
|
|
268
|
+
const effectiveResult = commandOverride.result;
|
|
269
|
+
setActiveCommandResult(effectiveResult);
|
|
270
|
+
const format = options.json === true ? "json" : options.json === false ? "toon" : options.defaultOutputFormat === "json" ? "json" : "toon";
|
|
271
|
+
const serviceOverride = runActiveServiceOverrideSync("output_format", {
|
|
272
|
+
command: options.command,
|
|
273
|
+
args: options.commandArgs,
|
|
274
|
+
command_options: options.commandOptions,
|
|
275
|
+
global: { ...options },
|
|
276
|
+
pm_root: options.pmRoot,
|
|
277
|
+
format,
|
|
278
|
+
options: { ...options },
|
|
279
|
+
result: effectiveResult
|
|
280
|
+
});
|
|
281
|
+
if (serviceOverride.handled && typeof serviceOverride.result === "string") {
|
|
282
|
+
return serviceOverride.result.endsWith("\n") ? serviceOverride.result : `${serviceOverride.result}
|
|
283
|
+
`;
|
|
284
|
+
}
|
|
285
|
+
const outputResult = serviceOverride.handled ? serviceOverride.result : effectiveResult;
|
|
286
|
+
if (format === "toon") {
|
|
287
|
+
const markdownDefault = renderDefaultMarkdownResult(outputResult);
|
|
288
|
+
if (markdownDefault !== null) {
|
|
289
|
+
return markdownDefault;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const rendererOverride = runActiveRendererOverride(format, outputResult);
|
|
293
|
+
if (rendererOverride.rendered !== null) {
|
|
294
|
+
return rendererOverride.rendered.endsWith("\n") ? rendererOverride.rendered : `${rendererOverride.rendered}
|
|
295
|
+
`;
|
|
296
|
+
}
|
|
297
|
+
if (format === "json") {
|
|
298
|
+
return `${JSON.stringify(outputResult, null, 2)}
|
|
299
|
+
`;
|
|
300
|
+
}
|
|
301
|
+
const compactedToon = compactToonValue(outputResult);
|
|
302
|
+
if (compactedToon === void 0) {
|
|
303
|
+
return "{}\n";
|
|
304
|
+
}
|
|
305
|
+
return `${renderToonValue(compactedToon, 0)}
|
|
306
|
+
`;
|
|
307
|
+
}
|
|
308
|
+
function printResult(result, options) {
|
|
309
|
+
const projected = options.noChangedFields ? projectMutationResult(result, { changedFields: "compact" }) : result;
|
|
310
|
+
const rendered = formatOutput(projected, options);
|
|
311
|
+
if (options.quiet) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
writeStdout(rendered);
|
|
315
|
+
}
|
|
316
|
+
function printError(message) {
|
|
317
|
+
const override = runActiveServiceOverrideSync("error_format", {
|
|
318
|
+
message
|
|
319
|
+
});
|
|
320
|
+
const rendered = override.handled && typeof override.result === "string" ? override.result : message;
|
|
321
|
+
writeStderr(rendered.endsWith("\n") ? rendered : `${rendered}
|
|
322
|
+
`);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export {
|
|
326
|
+
writeStdout,
|
|
327
|
+
printResult,
|
|
328
|
+
printError
|
|
329
|
+
};
|
|
330
|
+
//# sourceMappingURL=chunk-5HSEP75M.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../core/output/mutation-projection.ts", "../../../../../../../../core/output/output.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Shared projection helper for mutation command results.\n *\n * Mutation commands (create/update/close/append/update-many) return a result\n * envelope that carries a `changed_fields` string array. On create this array simply\n * re-lists every field the command just set, which the item echo above it already\n * shows, so for high-volume agent loops it is ~50% redundant payload. This helper\n * lets the CLI (`--no-changed-fields`) and the MCP agent path trim that array down\n * to a deterministic `changed_field_count` without losing mutation evidence.\n *\n * Compaction is deliberately scoped to the mutation envelope only:\n * - the envelope's own top-level `changed_fields` (create/update/close/append), and\n * - `rows[*].changed_fields` (update-many reports its delta per row).\n * It does NOT recurse into arbitrary nested objects, so unrelated payloads that\n * legitimately carry `changed_fields` (for example `pm history --diff` entries, or a\n * custom runtime metadata field) are left untouched.\n *\n * The helper is pure and side-effect free, reused by both the output layer and the\n * MCP server, and returns the original reference unchanged when nothing is compacted.\n */\n\nexport type ChangedFieldsMode = \"full\" | \"compact\";\n\nexport interface MutationProjectionOptions {\n /** Defaults to \"full\" (unchanged output). \"compact\" drops the array, keeping a count. */\n changedFields?: ChangedFieldsMode;\n}\n\nconst CHANGED_FIELDS_KEY = \"changed_fields\";\nconst CHANGED_FIELD_COUNT_KEY = \"changed_field_count\";\nconst ROWS_KEY = \"rows\";\nconst UPDATE_MANY_MUTATION_MODES = new Set([\"apply\", \"rollback\"]);\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n return proto === null || proto === Object.prototype;\n}\n\n/** Replace a single envelope's own top-level `changed_fields` array with a count. */\nfunction compactOwnChangedFields(envelope: Record<string, unknown>): Record<string, unknown> | null {\n const changedFields = envelope[CHANGED_FIELDS_KEY];\n if (!Array.isArray(changedFields)) {\n return null;\n }\n const projected: Record<string, unknown> =\n Object.getPrototypeOf(envelope) === null ? Object.create(null) : {};\n for (const [key, value] of Object.entries(envelope)) {\n if (key !== CHANGED_FIELDS_KEY) {\n projected[key] = value;\n }\n }\n projected[CHANGED_FIELD_COUNT_KEY] = changedFields.length;\n return projected;\n}\n\nfunction isMutationEnvelope(value: Record<string, unknown>): boolean {\n return \"item\" in value && Array.isArray(value[CHANGED_FIELDS_KEY]);\n}\n\nfunction isUpdateManyMutationEnvelope(value: Record<string, unknown>): boolean {\n return (\n typeof value.mode === \"string\" &&\n UPDATE_MANY_MUTATION_MODES.has(value.mode) &&\n Array.isArray(value[ROWS_KEY])\n );\n}\n\nfunction replaceRows(envelope: Record<string, unknown>, rows: unknown[]): Record<string, unknown> {\n const projected: Record<string, unknown> =\n Object.getPrototypeOf(envelope) === null ? Object.create(null) : {};\n Object.assign(projected, envelope);\n projected[ROWS_KEY] = rows;\n return projected;\n}\n\n/**\n * Returns a copy of a mutation result with the envelope `changed_fields` arrays\n * replaced by `changed_field_count` when compact mode is requested. Inputs that are\n * not a mutation envelope (or full mode) are returned unchanged (same reference).\n */\nexport function projectMutationResult(result: unknown, options: MutationProjectionOptions = {}): unknown {\n const mode = options.changedFields ?? \"full\";\n if (mode === \"full\" || !isPlainObject(result)) {\n return result;\n }\n\n let changed = false;\n let projected: Record<string, unknown> = result;\n\n const compactedTop = isMutationEnvelope(result) ? compactOwnChangedFields(result) : null;\n if (compactedTop !== null) {\n projected = compactedTop;\n changed = true;\n }\n\n // update-many reports its per-item delta under rows[*].changed_fields.\n const rows = isUpdateManyMutationEnvelope(projected) ? projected[ROWS_KEY] : undefined;\n if (Array.isArray(rows)) {\n let rowsChanged = false;\n const nextRows = rows.map((row) => {\n if (!isPlainObject(row)) {\n return row;\n }\n const compactedRow = compactOwnChangedFields(row);\n if (compactedRow) {\n rowsChanged = true;\n return compactedRow;\n }\n return row;\n });\n if (rowsChanged) {\n projected = replaceRows(projected, nextRows);\n changed = true;\n }\n }\n\n return changed ? projected : result;\n}\n", "import {\n runActiveCommandOverride,\n runActiveRendererOverride,\n runActiveServiceOverrideSync,\n setActiveCommandResult,\n} from \"../extensions/index.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\nimport { projectMutationResult } from \"./mutation-projection.js\";\n\nexport interface OutputOptions {\n json?: boolean;\n quiet?: boolean;\n /** When true, mutation results drop the verbose changed_fields array (keeps changed_field_count). */\n noChangedFields?: boolean;\n defaultOutputFormat?: \"toon\" | \"json\";\n command?: string;\n commandArgs?: string[];\n commandOptions?: Record<string, unknown>;\n pmRoot?: string;\n}\n\ninterface NodeLikeError {\n code?: string;\n}\n\nlet streamErrorHandlersInstalled = false;\ntype OutputStreamTarget = \"stdout\" | \"stderr\";\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isBrokenPipeError(error: unknown): boolean {\n return typeof error === \"object\" && error !== null && (error as NodeLikeError).code === \"EPIPE\";\n}\n\nfunction markStdoutBrokenPipeExitCode(): void {\n if (process.exitCode === undefined || process.exitCode === EXIT_CODE.SUCCESS) {\n process.exitCode = EXIT_CODE.SUCCESS;\n }\n}\n\nfunction markStderrBrokenPipeExitCode(): void {\n if (process.exitCode === undefined || process.exitCode === EXIT_CODE.SUCCESS) {\n process.exitCode = EXIT_CODE.GENERIC_FAILURE;\n }\n}\n\nfunction markBrokenPipeExitCode(target: OutputStreamTarget): void {\n if (target === \"stdout\") {\n markStdoutBrokenPipeExitCode();\n return;\n }\n markStderrBrokenPipeExitCode();\n}\n\nfunction handleUnhandledStreamError(error: unknown): void {\n const unhandled = error instanceof Error ? error : new Error(String(error));\n setImmediate(() => {\n throw unhandled;\n });\n}\n\nfunction installStreamErrorHandlers(): void {\n if (streamErrorHandlersInstalled) {\n return;\n }\n streamErrorHandlersInstalled = true;\n process.stdout.on(\"error\", (error: unknown) => {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(\"stdout\");\n return;\n }\n handleUnhandledStreamError(error);\n });\n process.stderr.on(\"error\", (error: unknown) => {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(\"stderr\");\n return;\n }\n handleUnhandledStreamError(error);\n });\n}\n\nfunction writeToStream(target: OutputStreamTarget, text: string): boolean {\n installStreamErrorHandlers();\n try {\n if (target === \"stdout\") {\n process.stdout.write(text);\n } else {\n process.stderr.write(text);\n }\n return true;\n } catch (error: unknown) {\n if (isBrokenPipeError(error)) {\n markBrokenPipeExitCode(target);\n return false;\n }\n throw error;\n }\n}\n\nexport function writeStdout(text: string): boolean {\n return writeToStream(\"stdout\", text);\n}\n\nexport function writeStderr(text: string): boolean {\n return writeToStream(\"stderr\", text);\n}\n\nfunction renderScalar(value: unknown): string {\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n if (value === null) return \"null\";\n return JSON.stringify(value);\n}\n\nfunction compactToonValue(value: unknown): unknown | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n const compactedEntries = value\n .map((entry) => compactToonValue(entry))\n .filter((entry): entry is unknown => entry !== undefined);\n return compactedEntries.length > 0 ? compactedEntries : undefined;\n }\n\n if (isPlainObject(value)) {\n const compacted: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n const compactedEntry = compactToonValue(entry);\n if (compactedEntry !== undefined) {\n compacted[key] = compactedEntry;\n }\n }\n return Object.keys(compacted).length > 0 ? compacted : undefined;\n }\n\n return value;\n}\n\nfunction renderToonValue(value: unknown, depth: number): string {\n const indent = \" \".repeat(depth);\n\n if (Array.isArray(value)) {\n if (value.length === 0) return \"[]\";\n return value\n .map((entry) => {\n if (!isPlainObject(entry) && !Array.isArray(entry)) {\n return `${indent}- ${renderScalar(entry)}`;\n }\n const rendered = renderToonValue(entry, depth + 1);\n const lines = rendered.split(\"\\n\");\n const [firstLine, ...rest] = lines;\n if (rest.length === 0) {\n return `${indent}- ${firstLine.trimStart()}`;\n }\n return `${indent}- ${firstLine.trimStart()}\\n${rest.join(\"\\n\")}`;\n })\n .join(\"\\n\");\n }\n\n if (isPlainObject(value)) {\n const entries = Object.entries(value);\n if (entries.length === 0) return \"{}\";\n return entries\n .map(([key, entry]) => {\n if (!isPlainObject(entry) && !Array.isArray(entry)) {\n return `${indent}${key}: ${renderScalar(entry)}`;\n }\n if (Array.isArray(entry) && entry.length === 0) {\n return `${indent}${key}: []`;\n }\n if (isPlainObject(entry) && Object.keys(entry).length === 0) {\n return `${indent}${key}: {}`;\n }\n return `${indent}${key}:\\n${renderToonValue(entry, depth + 1)}`;\n })\n .join(\"\\n\");\n }\n\n return `${indent}${renderScalar(value)}`;\n}\n\nfunction renderDefaultMarkdownResult(value: unknown): string | null {\n if (!isPlainObject(value) || value.output_default !== \"markdown\") {\n return null;\n }\n if (typeof value.view !== \"string\" || !Array.isArray(value.events) || !Array.isArray(value.days)) {\n return null;\n }\n const lines = [`# pm calendar (${value.view})`, \"\"];\n const summary = isPlainObject(value.summary) ? value.summary : {};\n lines.push(`- events: ${String(summary.events ?? 0)}`);\n lines.push(\"\");\n if (value.events.length === 0) {\n lines.push(\"No calendar events matched the selected filters.\");\n return `${lines.join(\"\\n\")}\\n`;\n }\n for (const event of value.events) {\n if (!isPlainObject(event)) {\n continue;\n }\n const kind = typeof event.kind === \"string\" ? event.kind : \"event\";\n const title = typeof event.item_title === \"string\" ? event.item_title : \"\";\n const itemId = typeof event.item_id === \"string\" ? event.item_id : \"\";\n const reminderText = typeof event.reminder_text === \"string\" && event.reminder_text.length > 0 ? ` ${event.reminder_text}` : \"\";\n lines.push(`- [${kind}] ${itemId} ${title}${reminderText}`.trim());\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nexport function formatOutput(result: unknown, options: OutputOptions): string {\n const commandOverride = runActiveCommandOverride(result);\n const effectiveResult = commandOverride.result;\n setActiveCommandResult(effectiveResult);\n const format =\n options.json === true\n ? \"json\"\n : options.json === false\n ? \"toon\"\n : options.defaultOutputFormat === \"json\"\n ? \"json\"\n : \"toon\";\n const serviceOverride = runActiveServiceOverrideSync(\"output_format\", {\n command: options.command,\n args: options.commandArgs,\n command_options: options.commandOptions,\n global: { ...options },\n pm_root: options.pmRoot,\n format,\n options: { ...options },\n result: effectiveResult,\n });\n if (serviceOverride.handled && typeof serviceOverride.result === \"string\") {\n return serviceOverride.result.endsWith(\"\\n\") ? serviceOverride.result : `${serviceOverride.result}\\n`;\n }\n const outputResult = serviceOverride.handled ? serviceOverride.result : effectiveResult;\n if (format === \"toon\") {\n const markdownDefault = renderDefaultMarkdownResult(outputResult);\n if (markdownDefault !== null) {\n return markdownDefault;\n }\n }\n const rendererOverride = runActiveRendererOverride(format, outputResult);\n if (rendererOverride.rendered !== null) {\n return rendererOverride.rendered.endsWith(\"\\n\") ? rendererOverride.rendered : `${rendererOverride.rendered}\\n`;\n }\n if (format === \"json\") {\n return `${JSON.stringify(outputResult, null, 2)}\\n`;\n }\n const compactedToon = compactToonValue(outputResult);\n if (compactedToon === undefined) {\n return \"{}\\n\";\n }\n return `${renderToonValue(compactedToon, 0)}\\n`;\n}\n\nexport function printResult(result: unknown, options: OutputOptions): void {\n const projected = options.noChangedFields ? projectMutationResult(result, { changedFields: \"compact\" }) : result;\n const rendered = formatOutput(projected, options);\n if (options.quiet) {\n return;\n }\n writeStdout(rendered);\n}\n\nexport function printError(message: string): void {\n const override = runActiveServiceOverrideSync(\"error_format\", {\n message,\n });\n const rendered = override.handled && typeof override.result === \"string\" ? override.result : message;\n writeStderr(rendered.endsWith(\"\\n\") ? rendered : `${rendered}\\n`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AA4BA,IAAM,qBAAqB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