@unbrained/pm-cli 2026.9.1 → 2026.9.2
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/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +10 -0
- package/dist/cli-bundle/bundle-manifest.json +59 -59
- package/dist/cli-bundle/chunks/{chunk-2MC2LCXZ.js → chunk-FZ4Z2J4F.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-6XIIGE7U.js → chunk-T6H5BZCP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-U45JXJCC.js → chunk-UDW64J2W.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-ZLJIFSOE.js +35 -0
- package/dist/cli-bundle/chunks/{register-mutation-2MVLRS3J.js → register-mutation-WFQ7MJTX.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-WCIDXBU3.js → register-operations-JVTI7JPP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FWPLDEXF.js → chunk-242AXYB2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Y6JJIX6I.js → chunk-O67VDLOT.js} +48 -48
- package/dist/cli-bundle/main.js +2 -2
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +32 -32
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +1 -1
- package/dist/core/diagnostics/remediation.js +9 -4
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +14 -2
- package/dist/sdk/governance/health.js +77 -11
- package/dist/sdk/governance/validate.js +4 -2
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +2 -2
- package/dist/sdk/merge/receipts.d.ts +24 -0
- package/dist/sdk/merge/receipts.js +122 -30
- package/docs/CONTEXT_RECOVERY_PRIMITIVES.md +11 -2
- package/docs/MERGE_SAFETY.md +16 -2
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +29 -6
- package/dist/cli-bundle/chunks/chunk-ALKKAUFN.js +0 -35
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.",
|
|
9
|
-
"version": "2026.9.
|
|
9
|
+
"version": "2026.9.2"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "pm-claude",
|
|
14
14
|
"source": "./plugins/pm-claude",
|
|
15
15
|
"description": "Native pm CLI integration for Claude Code — 28 MCP tools, 5 workflow skills, 14 slash commands, 4 subagents, hybrid TUI task tracking, session context injection, and coordination subagents for git-based project management without leaving Claude Code.",
|
|
16
|
-
"version": "2026.9.
|
|
16
|
+
"version": "2026.9.2",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "unbrained",
|
|
19
19
|
"url": "https://github.com/unbraind/pm-cli"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026.9.2 - 2026-09-02
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- GH-1174: Windows Node 24 receipt traversal negative control must fail closed portably ([pm-r97901](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-r97901.toon))
|
|
8
|
+
|
|
9
|
+
### Security
|
|
10
|
+
|
|
11
|
+
- GH-1173: make merge-receipt evidence diagnostics source-stable and record-addressable ([pm-dn8rwl](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-dn8rwl.toon))
|
|
12
|
+
|
|
3
13
|
## 2026.9.1 - 2026-09-01
|
|
4
14
|
|
|
5
15
|
### Added
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": 1,
|
|
3
|
-
"generation": "
|
|
3
|
+
"generation": "722c1e23bfa9fa15359563dea426f8cc01ab0c6e7bc89dd314213ffad7b58f63",
|
|
4
4
|
"files": [
|
|
5
|
-
{
|
|
6
|
-
"path": "chunks/chunk-2MC2LCXZ.js",
|
|
7
|
-
"sha256": "69583adadc1d73540cbed441766b288368d6e680a1bd15876e445b7233c17801"
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"path": "chunks/chunk-2MC2LCXZ.js.map",
|
|
11
|
-
"sha256": "f92a23e4c883818a650581a318d8501c9828f875a129a186f6727091d42e29db"
|
|
12
|
-
},
|
|
13
5
|
{
|
|
14
6
|
"path": "chunks/chunk-3WICXLVT.js",
|
|
15
7
|
"sha256": "89777399e60fe94317f9f7e230b625aa1d671baf982723df9699e03baa4a6a80"
|
|
@@ -18,22 +10,6 @@
|
|
|
18
10
|
"path": "chunks/chunk-3WICXLVT.js.map",
|
|
19
11
|
"sha256": "431c95eff5c1443aac3e2e17b775a56a1ce49e150ed1b312f5f743cb551c8ca1"
|
|
20
12
|
},
|
|
21
|
-
{
|
|
22
|
-
"path": "chunks/chunk-6XIIGE7U.js",
|
|
23
|
-
"sha256": "a9c779b68396f22c164fd9f574e62ef4664191d75323033ba3fa54988aab8441"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"path": "chunks/chunk-6XIIGE7U.js.map",
|
|
27
|
-
"sha256": "1eadc292dbb57e9a40378c3341ac7b60a20a0ae3ea82b7190aef9280e5aa22e7"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"path": "chunks/chunk-ALKKAUFN.js",
|
|
31
|
-
"sha256": "4dafd01574283dcc7ca0aab1d0f2d7f79b341fee770e7163c2b28c8abfcec127"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"path": "chunks/chunk-ALKKAUFN.js.map",
|
|
35
|
-
"sha256": "6405f1eacf4f2ec8f7cd75b42ae01e47a03d94f8715ec69435f764ef5502b864"
|
|
36
|
-
},
|
|
37
13
|
{
|
|
38
14
|
"path": "chunks/chunk-DTGWEL23.js",
|
|
39
15
|
"sha256": "5e60220b784bafe21dccbea7506aae33878e0deb2e87ff4784759afd0ce288ed"
|
|
@@ -42,6 +18,14 @@
|
|
|
42
18
|
"path": "chunks/chunk-DTGWEL23.js.map",
|
|
43
19
|
"sha256": "33fb162aa765f304742e582a7c9897bb524f1d1cad1418131496cb8002457f71"
|
|
44
20
|
},
|
|
21
|
+
{
|
|
22
|
+
"path": "chunks/chunk-FZ4Z2J4F.js",
|
|
23
|
+
"sha256": "e818018f115371a4abb4f34ecf2c3ad1ae8c3a1daeff47ace74e5dda22bfba58"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"path": "chunks/chunk-FZ4Z2J4F.js.map",
|
|
27
|
+
"sha256": "f92a23e4c883818a650581a318d8501c9828f875a129a186f6727091d42e29db"
|
|
28
|
+
},
|
|
45
29
|
{
|
|
46
30
|
"path": "chunks/chunk-GOACULJW.js",
|
|
47
31
|
"sha256": "aed9f244f310aa816c339dabf9165e72e3f24198f18734a1355e9ca2b5f1f3af"
|
|
@@ -66,6 +50,14 @@
|
|
|
66
50
|
"path": "chunks/chunk-QWRRFYK3.js.map",
|
|
67
51
|
"sha256": "ed562b0bba7ee7214e56ac7f728054b3496bec4597c94a4eb7b4179e6f5cb1c9"
|
|
68
52
|
},
|
|
53
|
+
{
|
|
54
|
+
"path": "chunks/chunk-T6H5BZCP.js",
|
|
55
|
+
"sha256": "84b5e239795a50bf29a2c0068d8661da24a4f11586c92a5b0e68ccc867398f0e"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"path": "chunks/chunk-T6H5BZCP.js.map",
|
|
59
|
+
"sha256": "1eadc292dbb57e9a40378c3341ac7b60a20a0ae3ea82b7190aef9280e5aa22e7"
|
|
60
|
+
},
|
|
69
61
|
{
|
|
70
62
|
"path": "chunks/chunk-TAG4VC22.js",
|
|
71
63
|
"sha256": "d2125db009fbf9c3587a1c0abd45b9631ba8212ced823d51677f42eb461c4877"
|
|
@@ -75,11 +67,11 @@
|
|
|
75
67
|
"sha256": "c88313f11a270aa6e80604dfd6e472df7b445618fa1290933e16183bb6bc30bf"
|
|
76
68
|
},
|
|
77
69
|
{
|
|
78
|
-
"path": "chunks/chunk-
|
|
79
|
-
"sha256": "
|
|
70
|
+
"path": "chunks/chunk-UDW64J2W.js",
|
|
71
|
+
"sha256": "a4519a4ee4cf844381163c11acc7258e29409e815c7efeab653837cba05d107a"
|
|
80
72
|
},
|
|
81
73
|
{
|
|
82
|
-
"path": "chunks/chunk-
|
|
74
|
+
"path": "chunks/chunk-UDW64J2W.js.map",
|
|
83
75
|
"sha256": "6b489551e2cbb313da42230a4a8635560237dd0d6516d202e786c3ef480f9482"
|
|
84
76
|
},
|
|
85
77
|
{
|
|
@@ -106,6 +98,14 @@
|
|
|
106
98
|
"path": "chunks/chunk-Y7VOMSZT.js.map",
|
|
107
99
|
"sha256": "3798372c7c76968d63a5cb0c1c019c8f37f359f88edfc30424b48b67e82810c1"
|
|
108
100
|
},
|
|
101
|
+
{
|
|
102
|
+
"path": "chunks/chunk-ZLJIFSOE.js",
|
|
103
|
+
"sha256": "ba7eddfbead9ae83bb3a307c8bb5ea71ed1ad02aafb47d9586fc9edae7b8e64f"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"path": "chunks/chunk-ZLJIFSOE.js.map",
|
|
107
|
+
"sha256": "e690c5db942e368dc81710982f4a6e062321734fef10c8444b1bee3652f7e571"
|
|
108
|
+
},
|
|
109
109
|
{
|
|
110
110
|
"path": "chunks/register-list-query-XYNX4ASQ.js",
|
|
111
111
|
"sha256": "19ecd237f39fe354656250f1580fda7201837dd10cb0df0d39029a8ff2da6ed3"
|
|
@@ -115,19 +115,19 @@
|
|
|
115
115
|
"sha256": "9ca100ecd68efabf60142b8ceadd37dfa286fe51caf34105539e9d0486ffe0c0"
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
|
-
"path": "chunks/register-mutation-
|
|
119
|
-
"sha256": "
|
|
118
|
+
"path": "chunks/register-mutation-WFQ7MJTX.js",
|
|
119
|
+
"sha256": "5e5f7411c7670cc438de6c15d1b5d01ee50f760a0d0e2a667f7e2f28d700b726"
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
|
-
"path": "chunks/register-mutation-
|
|
122
|
+
"path": "chunks/register-mutation-WFQ7MJTX.js.map",
|
|
123
123
|
"sha256": "7b20c6c417f480635cc16dbdffc9f60025ae79f86d0935bbbb91a078158c709a"
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
|
-
"path": "chunks/register-operations-
|
|
127
|
-
"sha256": "
|
|
126
|
+
"path": "chunks/register-operations-JVTI7JPP.js",
|
|
127
|
+
"sha256": "b8ec88765ebf991548d4c80c3d9395eaa6f774ff22c53a307d3ec3cdb24b666d"
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
|
-
"path": "chunks/register-operations-
|
|
130
|
+
"path": "chunks/register-operations-JVTI7JPP.js.map",
|
|
131
131
|
"sha256": "c6ba10d7a8dc627a5bc8ec83f8c8e5fba52956cd6a086a392d9edf308f1563ed"
|
|
132
132
|
},
|
|
133
133
|
{
|
|
@@ -138,6 +138,14 @@
|
|
|
138
138
|
"path": "chunks/register-setup-KVNC5KPL.js.map",
|
|
139
139
|
"sha256": "64f7feebb6b4c267565f841fe072db90dbed8098ded6ad62cc57249467603edc"
|
|
140
140
|
},
|
|
141
|
+
{
|
|
142
|
+
"path": "focused-chunks/chunk-242AXYB2.js",
|
|
143
|
+
"sha256": "439fc706bd97ce431ea0ef83b91cf74baf8c1c881b5d664c3c26a64c54d8eb74"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"path": "focused-chunks/chunk-242AXYB2.js.map",
|
|
147
|
+
"sha256": "a5bbe677175d2137ad3734552fcdbdfd010574e45a7101def30e414f7f022e1e"
|
|
148
|
+
},
|
|
141
149
|
{
|
|
142
150
|
"path": "focused-chunks/chunk-2FEZ5SKM.js",
|
|
143
151
|
"sha256": "8f2f894c131ef37af84d9a556d751fc496eb0b319d7e3dcdf6f9c88a67411b0e"
|
|
@@ -178,14 +186,6 @@
|
|
|
178
186
|
"path": "focused-chunks/chunk-BEVHCEWG.js.map",
|
|
179
187
|
"sha256": "9dee493fc79a9036bd5c153c9d222da3087f0b0ee6933c417079e33bd16edc1f"
|
|
180
188
|
},
|
|
181
|
-
{
|
|
182
|
-
"path": "focused-chunks/chunk-FWPLDEXF.js",
|
|
183
|
-
"sha256": "d0c8f86f5461c3661ccc305bd92c4651c8757761c456a17785ddf7bd50fadb85"
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
"path": "focused-chunks/chunk-FWPLDEXF.js.map",
|
|
187
|
-
"sha256": "268a149d74b85c275ade4aed1ccfe33570a6f1a7da6ebe67ead88f29d79b5d19"
|
|
188
|
-
},
|
|
189
189
|
{
|
|
190
190
|
"path": "focused-chunks/chunk-JEFKLWMM.js",
|
|
191
191
|
"sha256": "42218e8899d36afce18031c719a78809942c0d432b7be177d18b653a92cfea3c"
|
|
@@ -218,6 +218,14 @@
|
|
|
218
218
|
"path": "focused-chunks/chunk-MKHG3T76.js.map",
|
|
219
219
|
"sha256": "3cfc2a9c77f3b835e9175551adbf8693e25c006d07f7941555bf48ae78422113"
|
|
220
220
|
},
|
|
221
|
+
{
|
|
222
|
+
"path": "focused-chunks/chunk-O67VDLOT.js",
|
|
223
|
+
"sha256": "f1e9e3c3a6336c95d556017f661ca5ae50e1530ec3b97ba30cabdd039ea15649"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"path": "focused-chunks/chunk-O67VDLOT.js.map",
|
|
227
|
+
"sha256": "05dc50f7a2725d0de63ebbc83b84e8ce6c8ee3cf678dc39f167f39517dd86ab9"
|
|
228
|
+
},
|
|
221
229
|
{
|
|
222
230
|
"path": "focused-chunks/chunk-PF3E6Q36.js",
|
|
223
231
|
"sha256": "b21284a35df0fdb541e047d1eb116f97be20d06a4e44efae12e1757e7218817d"
|
|
@@ -266,14 +274,6 @@
|
|
|
266
274
|
"path": "focused-chunks/chunk-T2LXXSOD.js.map",
|
|
267
275
|
"sha256": "043ab1eccbbdcf837fc4893f9db08eda00174c47b71c5bd1512f43375624901c"
|
|
268
276
|
},
|
|
269
|
-
{
|
|
270
|
-
"path": "focused-chunks/chunk-Y6JJIX6I.js",
|
|
271
|
-
"sha256": "ebaed53a697ab8e4cb6dce1fdf5109a691ba4d560dbc5820238319d8016886fd"
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
"path": "focused-chunks/chunk-Y6JJIX6I.js.map",
|
|
275
|
-
"sha256": "f8d658eb46078f5cb0e4b9a0174aaf0417a7a1dcf86bc0e80ca303a5984372a0"
|
|
276
|
-
},
|
|
277
277
|
{
|
|
278
278
|
"path": "focused-chunks/chunk-Z2USIBR2.js",
|
|
279
279
|
"sha256": "d76de87f3075f6836b6d063d96b718b11819fdecb3364412481d85e040bda016"
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
},
|
|
285
285
|
{
|
|
286
286
|
"path": "main.js",
|
|
287
|
-
"sha256": "
|
|
287
|
+
"sha256": "a96d754567cbdc5c2e8507c6425fb49b4d696f3be544ae673dd6537100fe17ba"
|
|
288
288
|
},
|
|
289
289
|
{
|
|
290
290
|
"path": "main.js.map",
|
|
@@ -300,7 +300,7 @@
|
|
|
300
300
|
},
|
|
301
301
|
{
|
|
302
302
|
"path": "sdk-contracts.js",
|
|
303
|
-
"sha256": "
|
|
303
|
+
"sha256": "abab5de651739c7b3c432dbf3e49ae9fdc286549cbdbc457733a5a92a6ddae3a"
|
|
304
304
|
},
|
|
305
305
|
{
|
|
306
306
|
"path": "sdk-contracts.js.map",
|
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
},
|
|
309
309
|
{
|
|
310
310
|
"path": "sdk-core.js",
|
|
311
|
-
"sha256": "
|
|
311
|
+
"sha256": "88b5958c83b98b85127bbac6eed9418b01ffbd08d82035e10dc37d4fcccb51cb"
|
|
312
312
|
},
|
|
313
313
|
{
|
|
314
314
|
"path": "sdk-core.js.map",
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
},
|
|
317
317
|
{
|
|
318
318
|
"path": "sdk-governance.js",
|
|
319
|
-
"sha256": "
|
|
319
|
+
"sha256": "99086861d93506928459bb617c7c44a928fcb8d6b1f4d6753338d1fa1ab1262d"
|
|
320
320
|
},
|
|
321
321
|
{
|
|
322
322
|
"path": "sdk-governance.js.map",
|
|
@@ -332,11 +332,11 @@
|
|
|
332
332
|
},
|
|
333
333
|
{
|
|
334
334
|
"path": "sdk-merge.js",
|
|
335
|
-
"sha256": "
|
|
335
|
+
"sha256": "afadf9a4265c9547c5b34e0c482c360d43ae40968117aa3112738a323b1d522e"
|
|
336
336
|
},
|
|
337
337
|
{
|
|
338
338
|
"path": "sdk-merge.js.map",
|
|
339
|
-
"sha256": "
|
|
339
|
+
"sha256": "414810dd5d0bd5ced3924c86be8e7e5d3ffa7fb9b015d1df91e1004caea3ef36"
|
|
340
340
|
},
|
|
341
341
|
{
|
|
342
342
|
"path": "sdk-query.js",
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
},
|
|
349
349
|
{
|
|
350
350
|
"path": "sdk-runtime.js",
|
|
351
|
-
"sha256": "
|
|
351
|
+
"sha256": "1c7684f52d07402d717d45559ff0ec6279a6fe887fb83878b2c807a7e1160bcb"
|
|
352
352
|
},
|
|
353
353
|
{
|
|
354
354
|
"path": "sdk-runtime.js.map",
|
|
@@ -356,7 +356,7 @@
|
|
|
356
356
|
},
|
|
357
357
|
{
|
|
358
358
|
"path": "sdk-testing.js",
|
|
359
|
-
"sha256": "
|
|
359
|
+
"sha256": "c22c2ab49a1de251f9e1d2a88ba0e5f67e572bb8e5cd65ed9f34c3f137a82ce4"
|
|
360
360
|
},
|
|
361
361
|
{
|
|
362
362
|
"path": "sdk-testing.js.map",
|
|
@@ -364,7 +364,7 @@
|
|
|
364
364
|
},
|
|
365
365
|
{
|
|
366
366
|
"path": "sdk.js",
|
|
367
|
-
"sha256": "
|
|
367
|
+
"sha256": "d7acefab1784cffc9cec186647ffead441122f9dd31632b987ce355d50aac738"
|
|
368
368
|
},
|
|
369
369
|
{
|
|
370
370
|
"path": "sdk.js.map",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as _c,b as tt,c as _n,d as gc,e as yc,h as bc}from"./chunk-Y7VOMSZT.js";import{C as Po,E as vc,a as xt,b as So,d as lc,j as $o}from"./chunk-X4RCGLTX.js";import{Ac as hc,Bb as et,Bc as Sc,Cc as Ic,Dc as Ec,F as St,Fb as Ao,G as y,Gb as dc,H as ba,Hb as fn,I as wa,Jc as xc,K as ee,Kc as Rc,L as va,Lc as Ac,M as nn,Mc as Cc,N as ka,Nc as Tc,Nd as Lo,O as _o,Ob as Me,Od as Mo,P as on,Pc as Oc,Q as ho,Qc as $c,Qd as Lc,R as we,Ra as nc,S as go,Sa as vo,T as H,Tc as hn,U as yo,Ua as oc,V as te,Va as sc,W as Sa,Wa as ko,Wb as De,X as Ia,Xb as Co,Xd as Mc,Y as bo,Yd as Dc,Z as Ea,Zb as mc,_ as wo,bc as To,bd as Pc,dd as Fc,ga as xa,gb as mn,la as Et,ma as Ja,na as Xa,pa as Za,ra as Qa,sb as rc,ta as dn,tb as pn,tc as Rt,ua as ec,ub as ac,uc as Oo,ud as Fo,va as ln,vc as pc,wb as Qe,wc as uc,xb as cc,xc as ve,ya as tc,yb as Io,yc as fc,zb as un}from"./chunk-ALKKAUFN.js";import{A as sn,Aa as Ya,B as Ta,C as Le,D as Oa,E as rn,F as $a,G as an,Ia as cn,J as Pa,L as Fa,M as La,N as Ma,O as Da,Oa as wc,P as Na,Q as ja,R as Ua,S as Ga,T as qa,U as za,V as Ha,W as Ba,X as Va,Y as Wa,Z as Ka,b as fa,q as Ra,ta as It,w as Aa,y as Fe,z as Ca}from"./chunk-TAG4VC22.js";import{A as _a,B as ha,Cc as Ro,Fc as kc,Ga as ya,Ta as ic,aa as ga,b as ia,c as tn,d as fo,dc as Eo,e as aa,f as ca,g as da,h as la,i as ma,l as pa,n as ua,ob as fe,xc as xo}from"./chunk-GOACULJW.js";import{$c as ht,$e as Ur,$g as bt,$i as Zt,$l as Hi,Ac as O,Ad as $r,Ae as Vt,Bg as Je,Bi as Pe,Bl as Mi,C as u,Cd as j,Cf as Hr,Cl as Di,Da as Gn,Di as li,E as p,Ea as qn,Eb as ir,Ed as yt,Ee as oe,Ei as Xt,Fa as zn,Fb as ar,Fc as Gt,Fd as Pr,Fg as Kr,Fh as Zr,G as or,Ga as Hn,Gb as cr,Gc as _t,Gj as po,H as be,Hb as dr,Hi as vt,Ib as lr,Id as Fr,Ii as mi,Ij as uo,Jb as mr,Jc as D,Jh as Qr,Kb as pr,Kc as gr,Ki as ao,Kl as Ni,Lc as to,Mi as co,Mk as xi,Ml as ji,N as jn,Nc as yr,Nh as ei,Oa as P,Oc as br,Ok as Ri,Pa as jt,Pb as F,Pd as Ae,Pk as Qt,Qb as ur,Qh as ue,Qi as pi,Qk as Ai,R as S,Rb as fr,Rd as Ke,Ri as ui,Sd as Bt,Si as fi,Sj as Si,Sl as Ui,Tc as Ve,Tg as ae,Th as ti,Ti as _i,Tj as Ii,Tl as Gi,U as Ft,Ug as Te,Uh as ni,Ui as hi,Ul as qi,Vd as Ye,Ve as Nr,W as sr,Wa as E,Wd as pe,Wg as Wt,Wh as Kt,Wi as gi,Wk as Ci,X as Lt,Xc as wr,Xd as Ce,Xg as Xe,Xi as yi,Xl as zi,Y as Mt,Yc as vr,Ye as jr,Yh as oi,Yi as bi,Z as Dt,Za as ut,Zg as Oe,Zi as kt,_ as Nt,_a as ft,_g as Yr,_i as wi,_k as Ti,ab as ie,ad as kr,aj as vi,am as Bi,bd as Sr,bj as lo,bk as Ei,bm as Vi,c as Z,cd as Ir,cj as mo,cl as Oi,cm as Wi,d as He,da as me,dd as Er,dh as so,di as si,dj as ki,dl as $i,dm as Ki,e as Nn,em as Yi,f as q,fh as Jr,fl as Pi,fm as Ji,g as z,ge as Lr,gh as $e,gi as R,gm as Xi,h as mt,hc as Bn,he as Mr,hi as ri,hm as Zi,i as Xs,ic as Vn,id as no,ie as Dr,ii,il as Fi,im as Qi,jc as Wn,jd as xr,jh as Xr,ji as ai,jm as ea,ka as rr,kd as gt,km as ta,la as pt,lc as _r,lf as Gr,lh as V,m as Zs,md as Rr,n as Qs,na as Un,nd as Ar,ng as Br,nm as na,o as er,om as en,p as tr,pd as qt,pm as oa,qg as Vr,qm as sa,rc as hr,rd as Cr,ri as Yt,s as nr,sd as zt,sh as Ze,tb as Ut,tc as Kn,td as Ht,ti as Jt,uc as Yn,ui as ci,vc as Jn,vd as We,vm as T,wc as Xn,wd as xe,wi as di,xc as Zn,xd as Tr,xh as ro,xi as $,xm as ra,yb as Be,yc as Qn,yd as Or,ye as oo,yf as qr,yg as Wr,yh as wt,yi as Q,yl as Li,zc as eo,zd as Re,ze as C,zf as zr,zh as io,zi as W}from"./chunk-NOPL37X4.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb16b445-3bd4-520d-becf-c55621bfa186")}catch{}})();var py=Xs,uy=Zs,fy=tr,_y=Qs,hy=er;function Nc(e,t,n,o){let s=e.flag.slice(2).replace(/[-_]([a-z])/gu,(i,a)=>a.toUpperCase()),r=n.has(s);return{long:t,...o?{short:o}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:r?"string":"boolean",...r?{value_name:e.value_name??"value"}:{}}}function jc(e,t=[]){let n=new Set(t.flatMap(s=>s.keys)),o=[];for(let s of xi(e.map(r=>({...r})))){o.push(Nc(s,s.flag,n,s.short));for(let r of s.aliases??[])o.push(Nc(s,r,n))}return o}var gy=jc(Qt,Si),im=jc(en,Ii);import{AsyncLocalStorage as yg}from"node:async_hooks";import Kl from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="27dd77f6-e53d-55b7-be15-db0e60eaec4e")}catch{}})();function Uc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function am(e){return e.brief===!0?"brief":typeof e.fields=="string"&&e.fields.trim().length>0||Array.isArray(e.fields)&&e.fields.length>0?"fields":e.compact===!0?"compact":"full"}function Do(e,t){let n=am(t),o=n==="brief"?n:Uc(e.projection)&&typeof e.projection.mode=="string"?e.projection.mode:n;return{...e,query_summary:{filters:Uc(e.filters)?e.filters:{},projection:o}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6ede8efb-54ec-5b13-a1bf-216b525acc12")}catch{}})();async function Gc(e,t){let n=E(t??process.cwd(),e),o=await R(n);return Pe(n,o.item_format,P(o,null).type_to_folder,void 0,o.schema)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c14a67b4-102d-5219-b2b3-15d39da36627")}catch{}})();var cm=["invalid_envelope","source_incomplete","source_unchecked","filtered_corpus","terminal_items_excluded","strict_read_unproven","page_incomplete","count_mismatch","projection_incomplete","field_omission","omission_receipt_missing","omission_receipt_invalid","read_output_missing","read_output_invalid","read_output_dimensions_incomplete","budget_compaction","budget_omission","session_projection","invalid_item_id","duplicate_item_id"],gn=class extends Error{receipt;constructor(t){super(`Complete-list certification failed: ${t.map(n=>n.code).join(", ")}.`),this.name="PmCompleteListValidationError",this.receipt={contract_version:1,contract:"complete_list",findings:t,recovery:{suggested_retry:"pm list --all --output-include full --strict-read --no-truncate --output-budget unbounded --output-limit unbounded --json",sdk:"await client.listAllComplete()"}}}};function No(e={}){return{excludeTerminal:!1,full:!0,...e.includeBody===void 0?{}:{includeBody:e.includeBody},noTruncate:!0,outputBudget:"unbounded",outputLimit:"unbounded",strictRead:!0}}function _e(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function L(e,t,n,o){t&&e.push({code:n,message:o})}function dm(e,t){let n=_e(e.completeness)?e.completeness:{};L(t,n.status==="partial","source_incomplete","The source scan reported unreadable tracker artifacts."),L(t,n.status!=="complete"&&n.status!=="partial","source_unchecked","The source scan did not prove completeness.");let o=n.unreadable_item_count,s=n.unreadable_directory_count;L(t,n.status==="complete"&&(o!==0||s!==0)&&Number.isSafeInteger(o)&&Number.isSafeInteger(s),"source_incomplete","The source scan reports unreadable tracker artifacts despite a complete status."),L(t,n.status==="complete"&&(!Number.isSafeInteger(o)||!Number.isSafeInteger(s)||Number(o)<0||Number(s)<0),"source_unchecked","The source scan did not report safe non-negative unreadable counts.");let r=_e(e.filters)?e.filters:{},i=_e(r.runtime_filters)?r.runtime_filters:{},a=new Set(["exclude_terminal","include_body","no_truncate","runtime_filters","status","strict_read"]);return L(t,r.status!=="all"||Object.keys(i).length>0||Object.keys(r).some(c=>!a.has(c)),"filtered_corpus","The list did not explicitly select every lifecycle status."),L(t,r.exclude_terminal===!0,"terminal_items_excluded","Terminal lifecycle states were explicitly excluded."),L(t,r.strict_read!==!0,"strict_read_unproven","The result does not echo strict source-read enforcement."),r}function lm(e,t,n){L(n,e.has_more!==!1||e.next_cursor!==null||e.truncated!==!1||e.applied_limit!==void 0||t.no_truncate!==!0,"page_incomplete","Pagination or a row ceiling may have withheld items."),L(n,e.count!==e.items.length||e.total!==e.items.length,"count_mismatch","Envelope counts do not equal the returned item count.");let o=_e(e.projection)?e.projection:{};L(n,o.mode!=="full"||o.fields!==null,"projection_incomplete","The result is not the full metadata projection.");let s=_e(e.omission_receipt)?e.omission_receipt:void 0;L(n,s===void 0,"omission_receipt_missing","The result carries no field-omission receipt."),L(n,s!==void 0&&(s.has_omissions!==!1||s.omitted_field_group_count!==0||!Number.isSafeInteger(s.omitted_field_group_count)||!Array.isArray(s.omitted_field_groups)||s.omitted_field_groups.length!==0),"omission_receipt_invalid","The field-omission receipt is malformed or contradicts its no-omission claim."),L(n,s?.has_omissions===!0,"field_omission","The omission receipt reports withheld field groups.")}function mm(e){return e.contract_version!==1||e.command!=="list"||e.within_budget!==!0||e.strings_compacted!==!1||e.rows_compacted!==!1||e.result_omitted!==!1}function pm(e){if(!Array.isArray(e.requested_dimensions))return!1;let t=new Set(e.requested_dimensions);return["include","amount","cost"].every(n=>t.has(n))}function um(e,t){let n=_e(e.read_output)?e.read_output:void 0;L(t,n===void 0,"read_output_missing","The result carries no universal read-output receipt."),L(t,n!==void 0&&mm(n),"read_output_invalid","The universal read-output receipt does not prove an intact list result."),L(t,n!==void 0&&!pm(n),"read_output_dimensions_incomplete","The universal read-output receipt does not prove full, unbounded include, amount, and cost dimensions."),L(t,n?.strings_compacted===!0||n?.rows_compacted===!0||e.output_budget_truncation!==void 0,"budget_compaction","Universal output shaping compacted the result.");let o=_e(e.output_budget_exceeded)?e.output_budget_exceeded:void 0;L(t,n?.result_omitted===!0||o?.omitted_result===!0,"budget_omission","Universal output shaping omitted the useful result."),L(t,e.read_session!==void 0,"session_projection","A cross-call read session can suppress previously served facts.")}function fm(e,t){let n=e.map(o=>_e(o)&&typeof o.id=="string"?o.id.trim():"");L(t,n.some(o=>o.length===0),"invalid_item_id","Every full item row must carry a non-empty string id."),L(t,new Set(n).size!==n.length,"duplicate_item_id","Every item id must occur exactly once.")}function qc(e){if(!_e(e)||!Array.isArray(e.items))return{ok:!1,findings:[{code:cm[0],message:"The result must be an object with an items array."}]};let t=e,n=[],o=dm(t,n);return lm(t,o,n),um(t,n),fm(t.items,n),{ok:n.length===0,findings:n}}function yn(e){let t=qc(e);if(!t.ok)throw new gn(t.findings);let n=e;return{...n,complete_list:{contract_version:1,item_count:n.items.length,unique_item_id_count:new Set(n.items.map(o=>o.id)).size,terminal_items_included:!0,source_complete:!0,full_projection:!0,no_omissions:!0,unbounded:!0}}}function _m(e){yn(e)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="10052b6f-216f-5b50-81ec-ee373cc13d17")}catch{}})();function zc(e){return e.map(t=>({key:t.key,optionName:Pr(t),metadataKey:t.metadata_key,type:t.type,commands:[...t.commands],repeatable:t.repeatable,requiredOnCreate:t.required_on_create,...t.description?{description:t.description}:{}}))}function Hc(e){return e.map(t=>({command:t.command,action:t.action,arguments:t.arguments.map(n=>({name:n.name,required:n.required===!0,variadic:n.variadic===!0,description:n.description})),description:t.description,tier:t.tier??"standard",family:t.family??"extensions"}))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7c898a52-eba4-5626-8207-5ffefd4990ba")}catch{}})();var hm=50,ke=new Map;function jo(){ke.clear()}function Bc(e,t){let n=ke.get(e);if(n!==void 0)return n;if(ke.size>=hm){let s=ke.keys().next().value;ke.delete(s)}let o=t().catch(s=>{throw ke.get(e)===o&&ke.delete(e),s});return ke.set(e,o),o}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1ff4005f-be23-5dcf-9834-dbd7d083b76d")}catch{}})();var gm={"list-all":{action:"list",options:{excludeTerminal:!1}},"list-draft":{action:"list",options:{status:"draft",excludeTerminal:!1}},"list-open":{action:"list",options:{status:"open",excludeTerminal:!1}},"list-in-progress":{action:"list",options:{status:"in_progress",excludeTerminal:!1}},"list-blocked":{action:"list",options:{status:"blocked",excludeTerminal:!1}},"list-closed":{action:"list",options:{status:"closed",excludeTerminal:!1}},"list-canceled":{action:"list",options:{status:"canceled",excludeTerminal:!1}}};function Vc(e){return Object.fromEntries(qr.map(t=>[`${e}-${t}`,{action:e,options:{[t==="adopt-all"?"adoptAll":t]:!0,...e==="package"?{vocabulary:"package"}:{}}}]))}var Uo={ctx:{action:"context"},...gm,...Vc("extension"),...Vc("package"),...Object.fromEntries(zr.map(e=>[`package-${e}`,{action:e}]))};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="41012e87-ed61-56b2-8505-8f786b3952b2")}catch{}})();var Wc="PmCliError";function ym(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=u.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function bm(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new p(e,ym(t.exitCode??u.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function Go(e){if(!(e instanceof Error)||e.name!==Wc)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}import{constants as At}from"node:fs";import{lstat as Kc,mkdir as zo,open as Yc}from"node:fs/promises";import he from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb5dfa6f-b60f-55f2-ae17-3dbcaaff1b47")}catch{}})();function qo(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Ho(e,t){let n=t.require(e.kind),o=n.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${n.kind}\0${o}`}function wm(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function vm(e,t,n,o){let s=n.require(e.kind),r=o.outgoingOne.get(`${s.kind}\0${e.source}`);if(r!==void 0&&r!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${s.kind}`);let i=o.incomingOne.get(`${s.kind}\0${e.target}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${s.kind}`);let a=Ho(e,n),c=o.identities.get(a);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${a}`)}function km(e){let t=new Map;for(let n of e)n.action==="remove"?t.delete(n.relationshipId):t.set(n.relationshipId,n.edge);return t}function Sm(e,t,n){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let o=qo(e.eventId,"eventId");if(n.has(o))throw new TypeError(`Relationship event already exists: ${o}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:o,relationshipId:qo(e.relationshipId,"relationshipId"),author:qo(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function Im(e,t,n,o,s,r){let i=n.has(t);if(e.action==="add"&&i)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!i)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let a=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(a)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${a} -> ${c}`);let d=new Be([a,c],[e.edge],s).edges()[0];return vm(d,t,s,r),wm(d)}var Ct=class{#t;#n;#o=[];#r=new Set;#e=new Map;#s={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,n={}){this.#t=new Set([...t].filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean)),this.#n=n.registry??Ut()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,s=t.batchSize??100;if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${o}`);if(!Number.isInteger(s)||s<1)throw new TypeError("Relationship event stream batchSize must be positive");if(n>o+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let r=n-1;r<o;r+=s)yield Object.freeze(this.#o.slice(r,Math.min(r+s,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let s=t,r=0,i;for(let a of this.stream({...o,batchSize:256}))for(let c of a)s=n(s,c),r+=1,i=c;return Object.freeze({state:s,version:i?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:r,...i===void 0?{}:{asOf:i.timestamp}})}#i(t,n){let o=this.#n.require(n.kind);this.#s.identities.set(Ho(n,this.#n),t),o.outgoing==="one"&&this.#s.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#s.incomingOne.set(`${o.kind}\0${n.target}`,t)}#a(t){let n=this.#n.require(t.kind);this.#s.identities.delete(Ho(t,this.#n)),n.outgoing==="one"&&this.#s.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#s.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=Sm(t,this.version,this.#r),o=this.#e.get(n.relationshipId),s=Im(t,n.relationshipId,this.#e,this.#t,this.#n,this.#s),r=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...s===void 0?{}:{edge:s},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(r),this.#r.add(n.eventId),o&&this.#a(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,s),this.#i(n.relationshipId,s)),r}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let n;if(t.atTimestamp!==void 0){let r=Date.parse(t.atTimestamp);if(!Number.isFinite(r))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(i=>Date.parse(i.timestamp)<=r)}else{let r=t.atVersion??this.version;if(!Number.isInteger(r)||r<0||r>this.version)throw new TypeError(`Relationship snapshot version out of range: ${r}`);n=this.#o.slice(0,r)}let o=km(n),s=new Be(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:s.edges(),graph:s})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=Nr("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(jr(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let s=Ur(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:r=>r.eventId,snapshot:String(o)});return{version:o,events:s.rows,hasMore:s.has_more,...s.next_cursor?{nextCursor:s.next_cursor}:{}}}},Em="relationship-event-store",Jc=At.O_NOFOLLOW;function bn(e){return V(e,Em,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function Ne(e,t="relationships/events.jsonl"){let n=he.resolve(e),o=he.resolve(n,t),s=he.relative(n,o);if(s.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(s===".."||s.startsWith(`..${he.sep}`)||he.isAbsolute(s))throw new TypeError("Relationship event path must stay within the tracker root");if(await zo(n,{recursive:!0}),(await Kc(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let i=n;for(let a of s.split(he.sep)){i=he.join(i,a);try{if((await Kc(i)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(Nn(c))break;throw c}}return o}async function wn(e,t,n){let o=new Ct(t,{registry:n}),s,r;try{r=await Yc(e,At.O_RDONLY|Jc),s=await r.readFile("utf8")}catch(a){if(Nn(a))return{log:o,raw:""};throw a}finally{await r?.close()}let i=s.split(`
|
|
1
|
+
import{a as _c,b as tt,c as _n,d as gc,e as yc,h as bc}from"./chunk-Y7VOMSZT.js";import{C as Po,E as vc,a as xt,b as So,d as lc,j as $o}from"./chunk-X4RCGLTX.js";import{Ac as hc,Bb as et,Bc as Sc,Cc as Ic,Dc as Ec,F as St,Fb as Ao,G as y,Gb as dc,H as ba,Hb as fn,I as wa,Jc as xc,K as ee,Kc as Rc,L as va,Lc as Ac,M as nn,Mc as Cc,N as ka,Nc as Tc,Nd as Lo,O as _o,Ob as Me,Od as Mo,P as on,Pc as Oc,Q as ho,Qc as $c,Qd as Lc,R as we,Ra as nc,S as go,Sa as vo,T as H,Tc as hn,U as yo,Ua as oc,V as te,Va as sc,W as Sa,Wa as ko,Wb as De,X as Ia,Xb as Co,Xd as Mc,Y as bo,Yd as Dc,Z as Ea,Zb as mc,_ as wo,bc as To,bd as Pc,dd as Fc,ga as xa,gb as mn,la as Et,ma as Ja,na as Xa,pa as Za,ra as Qa,sb as rc,ta as dn,tb as pn,tc as Rt,ua as ec,ub as ac,uc as Oo,ud as Fo,va as ln,vc as pc,wb as Qe,wc as uc,xb as cc,xc as ve,ya as tc,yb as Io,yc as fc,zb as un}from"./chunk-ZLJIFSOE.js";import{A as sn,Aa as Ya,B as Ta,C as Le,D as Oa,E as rn,F as $a,G as an,Ia as cn,J as Pa,L as Fa,M as La,N as Ma,O as Da,Oa as wc,P as Na,Q as ja,R as Ua,S as Ga,T as qa,U as za,V as Ha,W as Ba,X as Va,Y as Wa,Z as Ka,b as fa,q as Ra,ta as It,w as Aa,y as Fe,z as Ca}from"./chunk-TAG4VC22.js";import{A as _a,B as ha,Cc as Ro,Fc as kc,Ga as ya,Ta as ic,aa as ga,b as ia,c as tn,d as fo,dc as Eo,e as aa,f as ca,g as da,h as la,i as ma,l as pa,n as ua,ob as fe,xc as xo}from"./chunk-GOACULJW.js";import{$c as ht,$e as Ur,$g as bt,$i as Zt,$l as Hi,Ac as O,Ad as $r,Ae as Vt,Bg as Je,Bi as Pe,Bl as Mi,C as u,Cd as j,Cf as Hr,Cl as Di,Da as Gn,Di as li,E as p,Ea as qn,Eb as ir,Ed as yt,Ee as oe,Ei as Xt,Fa as zn,Fb as ar,Fc as Gt,Fd as Pr,Fg as Kr,Fh as Zr,G as or,Ga as Hn,Gb as cr,Gc as _t,Gj as po,H as be,Hb as dr,Hi as vt,Ib as lr,Id as Fr,Ii as mi,Ij as uo,Jb as mr,Jc as D,Jh as Qr,Kb as pr,Kc as gr,Ki as ao,Kl as Ni,Lc as to,Mi as co,Mk as xi,Ml as ji,N as jn,Nc as yr,Nh as ei,Oa as P,Oc as br,Ok as Ri,Pa as jt,Pb as F,Pd as Ae,Pk as Qt,Qb as ur,Qh as ue,Qi as pi,Qk as Ai,R as S,Rb as fr,Rd as Ke,Ri as ui,Sd as Bt,Si as fi,Sj as Si,Sl as Ui,Tc as Ve,Tg as ae,Th as ti,Ti as _i,Tj as Ii,Tl as Gi,U as Ft,Ug as Te,Uh as ni,Ui as hi,Ul as qi,Vd as Ye,Ve as Nr,W as sr,Wa as E,Wd as pe,Wg as Wt,Wh as Kt,Wi as gi,Wk as Ci,X as Lt,Xc as wr,Xd as Ce,Xg as Xe,Xi as yi,Xl as zi,Y as Mt,Yc as vr,Ye as jr,Yh as oi,Yi as bi,Z as Dt,Za as ut,Zg as Oe,Zi as kt,_ as Nt,_a as ft,_g as Yr,_i as wi,_k as Ti,ab as ie,ad as kr,aj as vi,am as Bi,bd as Sr,bj as lo,bk as Ei,bm as Vi,c as Z,cd as Ir,cj as mo,cl as Oi,cm as Wi,d as He,da as me,dd as Er,dh as so,di as si,dj as ki,dl as $i,dm as Ki,e as Nn,em as Yi,f as q,fh as Jr,fl as Pi,fm as Ji,g as z,ge as Lr,gh as $e,gi as R,gm as Xi,h as mt,hc as Bn,he as Mr,hi as ri,hm as Zi,i as Xs,ic as Vn,id as no,ie as Dr,ii,il as Fi,im as Qi,jc as Wn,jd as xr,jh as Xr,ji as ai,jm as ea,ka as rr,kd as gt,km as ta,la as pt,lc as _r,lf as Gr,lh as V,m as Zs,md as Rr,n as Qs,na as Un,nd as Ar,ng as Br,nm as na,o as er,om as en,p as tr,pd as qt,pm as oa,qg as Vr,qm as sa,rc as hr,rd as Cr,ri as Yt,s as nr,sd as zt,sh as Ze,tb as Ut,tc as Kn,td as Ht,ti as Jt,uc as Yn,ui as ci,vc as Jn,vd as We,vm as T,wc as Xn,wd as xe,wi as di,xc as Zn,xd as Tr,xh as ro,xi as $,xm as ra,yb as Be,yc as Qn,yd as Or,ye as oo,yf as qr,yg as Wr,yh as wt,yi as Q,yl as Li,zc as eo,zd as Re,ze as C,zf as zr,zh as io,zi as W}from"./chunk-NOPL37X4.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb16b445-3bd4-520d-becf-c55621bfa186")}catch{}})();var py=Xs,uy=Zs,fy=tr,_y=Qs,hy=er;function Nc(e,t,n,o){let s=e.flag.slice(2).replace(/[-_]([a-z])/gu,(i,a)=>a.toUpperCase()),r=n.has(s);return{long:t,...o?{short:o}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:r?"string":"boolean",...r?{value_name:e.value_name??"value"}:{}}}function jc(e,t=[]){let n=new Set(t.flatMap(s=>s.keys)),o=[];for(let s of xi(e.map(r=>({...r})))){o.push(Nc(s,s.flag,n,s.short));for(let r of s.aliases??[])o.push(Nc(s,r,n))}return o}var gy=jc(Qt,Si),im=jc(en,Ii);import{AsyncLocalStorage as yg}from"node:async_hooks";import Kl from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="27dd77f6-e53d-55b7-be15-db0e60eaec4e")}catch{}})();function Uc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function am(e){return e.brief===!0?"brief":typeof e.fields=="string"&&e.fields.trim().length>0||Array.isArray(e.fields)&&e.fields.length>0?"fields":e.compact===!0?"compact":"full"}function Do(e,t){let n=am(t),o=n==="brief"?n:Uc(e.projection)&&typeof e.projection.mode=="string"?e.projection.mode:n;return{...e,query_summary:{filters:Uc(e.filters)?e.filters:{},projection:o}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6ede8efb-54ec-5b13-a1bf-216b525acc12")}catch{}})();async function Gc(e,t){let n=E(t??process.cwd(),e),o=await R(n);return Pe(n,o.item_format,P(o,null).type_to_folder,void 0,o.schema)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c14a67b4-102d-5219-b2b3-15d39da36627")}catch{}})();var cm=["invalid_envelope","source_incomplete","source_unchecked","filtered_corpus","terminal_items_excluded","strict_read_unproven","page_incomplete","count_mismatch","projection_incomplete","field_omission","omission_receipt_missing","omission_receipt_invalid","read_output_missing","read_output_invalid","read_output_dimensions_incomplete","budget_compaction","budget_omission","session_projection","invalid_item_id","duplicate_item_id"],gn=class extends Error{receipt;constructor(t){super(`Complete-list certification failed: ${t.map(n=>n.code).join(", ")}.`),this.name="PmCompleteListValidationError",this.receipt={contract_version:1,contract:"complete_list",findings:t,recovery:{suggested_retry:"pm list --all --output-include full --strict-read --no-truncate --output-budget unbounded --output-limit unbounded --json",sdk:"await client.listAllComplete()"}}}};function No(e={}){return{excludeTerminal:!1,full:!0,...e.includeBody===void 0?{}:{includeBody:e.includeBody},noTruncate:!0,outputBudget:"unbounded",outputLimit:"unbounded",strictRead:!0}}function _e(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function L(e,t,n,o){t&&e.push({code:n,message:o})}function dm(e,t){let n=_e(e.completeness)?e.completeness:{};L(t,n.status==="partial","source_incomplete","The source scan reported unreadable tracker artifacts."),L(t,n.status!=="complete"&&n.status!=="partial","source_unchecked","The source scan did not prove completeness.");let o=n.unreadable_item_count,s=n.unreadable_directory_count;L(t,n.status==="complete"&&(o!==0||s!==0)&&Number.isSafeInteger(o)&&Number.isSafeInteger(s),"source_incomplete","The source scan reports unreadable tracker artifacts despite a complete status."),L(t,n.status==="complete"&&(!Number.isSafeInteger(o)||!Number.isSafeInteger(s)||Number(o)<0||Number(s)<0),"source_unchecked","The source scan did not report safe non-negative unreadable counts.");let r=_e(e.filters)?e.filters:{},i=_e(r.runtime_filters)?r.runtime_filters:{},a=new Set(["exclude_terminal","include_body","no_truncate","runtime_filters","status","strict_read"]);return L(t,r.status!=="all"||Object.keys(i).length>0||Object.keys(r).some(c=>!a.has(c)),"filtered_corpus","The list did not explicitly select every lifecycle status."),L(t,r.exclude_terminal===!0,"terminal_items_excluded","Terminal lifecycle states were explicitly excluded."),L(t,r.strict_read!==!0,"strict_read_unproven","The result does not echo strict source-read enforcement."),r}function lm(e,t,n){L(n,e.has_more!==!1||e.next_cursor!==null||e.truncated!==!1||e.applied_limit!==void 0||t.no_truncate!==!0,"page_incomplete","Pagination or a row ceiling may have withheld items."),L(n,e.count!==e.items.length||e.total!==e.items.length,"count_mismatch","Envelope counts do not equal the returned item count.");let o=_e(e.projection)?e.projection:{};L(n,o.mode!=="full"||o.fields!==null,"projection_incomplete","The result is not the full metadata projection.");let s=_e(e.omission_receipt)?e.omission_receipt:void 0;L(n,s===void 0,"omission_receipt_missing","The result carries no field-omission receipt."),L(n,s!==void 0&&(s.has_omissions!==!1||s.omitted_field_group_count!==0||!Number.isSafeInteger(s.omitted_field_group_count)||!Array.isArray(s.omitted_field_groups)||s.omitted_field_groups.length!==0),"omission_receipt_invalid","The field-omission receipt is malformed or contradicts its no-omission claim."),L(n,s?.has_omissions===!0,"field_omission","The omission receipt reports withheld field groups.")}function mm(e){return e.contract_version!==1||e.command!=="list"||e.within_budget!==!0||e.strings_compacted!==!1||e.rows_compacted!==!1||e.result_omitted!==!1}function pm(e){if(!Array.isArray(e.requested_dimensions))return!1;let t=new Set(e.requested_dimensions);return["include","amount","cost"].every(n=>t.has(n))}function um(e,t){let n=_e(e.read_output)?e.read_output:void 0;L(t,n===void 0,"read_output_missing","The result carries no universal read-output receipt."),L(t,n!==void 0&&mm(n),"read_output_invalid","The universal read-output receipt does not prove an intact list result."),L(t,n!==void 0&&!pm(n),"read_output_dimensions_incomplete","The universal read-output receipt does not prove full, unbounded include, amount, and cost dimensions."),L(t,n?.strings_compacted===!0||n?.rows_compacted===!0||e.output_budget_truncation!==void 0,"budget_compaction","Universal output shaping compacted the result.");let o=_e(e.output_budget_exceeded)?e.output_budget_exceeded:void 0;L(t,n?.result_omitted===!0||o?.omitted_result===!0,"budget_omission","Universal output shaping omitted the useful result."),L(t,e.read_session!==void 0,"session_projection","A cross-call read session can suppress previously served facts.")}function fm(e,t){let n=e.map(o=>_e(o)&&typeof o.id=="string"?o.id.trim():"");L(t,n.some(o=>o.length===0),"invalid_item_id","Every full item row must carry a non-empty string id."),L(t,new Set(n).size!==n.length,"duplicate_item_id","Every item id must occur exactly once.")}function qc(e){if(!_e(e)||!Array.isArray(e.items))return{ok:!1,findings:[{code:cm[0],message:"The result must be an object with an items array."}]};let t=e,n=[],o=dm(t,n);return lm(t,o,n),um(t,n),fm(t.items,n),{ok:n.length===0,findings:n}}function yn(e){let t=qc(e);if(!t.ok)throw new gn(t.findings);let n=e;return{...n,complete_list:{contract_version:1,item_count:n.items.length,unique_item_id_count:new Set(n.items.map(o=>o.id)).size,terminal_items_included:!0,source_complete:!0,full_projection:!0,no_omissions:!0,unbounded:!0}}}function _m(e){yn(e)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="10052b6f-216f-5b50-81ec-ee373cc13d17")}catch{}})();function zc(e){return e.map(t=>({key:t.key,optionName:Pr(t),metadataKey:t.metadata_key,type:t.type,commands:[...t.commands],repeatable:t.repeatable,requiredOnCreate:t.required_on_create,...t.description?{description:t.description}:{}}))}function Hc(e){return e.map(t=>({command:t.command,action:t.action,arguments:t.arguments.map(n=>({name:n.name,required:n.required===!0,variadic:n.variadic===!0,description:n.description})),description:t.description,tier:t.tier??"standard",family:t.family??"extensions"}))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7c898a52-eba4-5626-8207-5ffefd4990ba")}catch{}})();var hm=50,ke=new Map;function jo(){ke.clear()}function Bc(e,t){let n=ke.get(e);if(n!==void 0)return n;if(ke.size>=hm){let s=ke.keys().next().value;ke.delete(s)}let o=t().catch(s=>{throw ke.get(e)===o&&ke.delete(e),s});return ke.set(e,o),o}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1ff4005f-be23-5dcf-9834-dbd7d083b76d")}catch{}})();var gm={"list-all":{action:"list",options:{excludeTerminal:!1}},"list-draft":{action:"list",options:{status:"draft",excludeTerminal:!1}},"list-open":{action:"list",options:{status:"open",excludeTerminal:!1}},"list-in-progress":{action:"list",options:{status:"in_progress",excludeTerminal:!1}},"list-blocked":{action:"list",options:{status:"blocked",excludeTerminal:!1}},"list-closed":{action:"list",options:{status:"closed",excludeTerminal:!1}},"list-canceled":{action:"list",options:{status:"canceled",excludeTerminal:!1}}};function Vc(e){return Object.fromEntries(qr.map(t=>[`${e}-${t}`,{action:e,options:{[t==="adopt-all"?"adoptAll":t]:!0,...e==="package"?{vocabulary:"package"}:{}}}]))}var Uo={ctx:{action:"context"},...gm,...Vc("extension"),...Vc("package"),...Object.fromEntries(zr.map(e=>[`package-${e}`,{action:e}]))};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="41012e87-ed61-56b2-8505-8f786b3952b2")}catch{}})();var Wc="PmCliError";function ym(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=u.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function bm(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new p(e,ym(t.exitCode??u.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function Go(e){if(!(e instanceof Error)||e.name!==Wc)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}import{constants as At}from"node:fs";import{lstat as Kc,mkdir as zo,open as Yc}from"node:fs/promises";import he from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb5dfa6f-b60f-55f2-ae17-3dbcaaff1b47")}catch{}})();function qo(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Ho(e,t){let n=t.require(e.kind),o=n.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${n.kind}\0${o}`}function wm(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function vm(e,t,n,o){let s=n.require(e.kind),r=o.outgoingOne.get(`${s.kind}\0${e.source}`);if(r!==void 0&&r!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${s.kind}`);let i=o.incomingOne.get(`${s.kind}\0${e.target}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${s.kind}`);let a=Ho(e,n),c=o.identities.get(a);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${a}`)}function km(e){let t=new Map;for(let n of e)n.action==="remove"?t.delete(n.relationshipId):t.set(n.relationshipId,n.edge);return t}function Sm(e,t,n){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let o=qo(e.eventId,"eventId");if(n.has(o))throw new TypeError(`Relationship event already exists: ${o}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:o,relationshipId:qo(e.relationshipId,"relationshipId"),author:qo(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function Im(e,t,n,o,s,r){let i=n.has(t);if(e.action==="add"&&i)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!i)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let a=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(a)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${a} -> ${c}`);let d=new Be([a,c],[e.edge],s).edges()[0];return vm(d,t,s,r),wm(d)}var Ct=class{#t;#n;#o=[];#r=new Set;#e=new Map;#s={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,n={}){this.#t=new Set([...t].filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean)),this.#n=n.registry??Ut()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,s=t.batchSize??100;if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${o}`);if(!Number.isInteger(s)||s<1)throw new TypeError("Relationship event stream batchSize must be positive");if(n>o+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let r=n-1;r<o;r+=s)yield Object.freeze(this.#o.slice(r,Math.min(r+s,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let s=t,r=0,i;for(let a of this.stream({...o,batchSize:256}))for(let c of a)s=n(s,c),r+=1,i=c;return Object.freeze({state:s,version:i?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:r,...i===void 0?{}:{asOf:i.timestamp}})}#i(t,n){let o=this.#n.require(n.kind);this.#s.identities.set(Ho(n,this.#n),t),o.outgoing==="one"&&this.#s.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#s.incomingOne.set(`${o.kind}\0${n.target}`,t)}#a(t){let n=this.#n.require(t.kind);this.#s.identities.delete(Ho(t,this.#n)),n.outgoing==="one"&&this.#s.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#s.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=Sm(t,this.version,this.#r),o=this.#e.get(n.relationshipId),s=Im(t,n.relationshipId,this.#e,this.#t,this.#n,this.#s),r=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...s===void 0?{}:{edge:s},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(r),this.#r.add(n.eventId),o&&this.#a(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,s),this.#i(n.relationshipId,s)),r}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let n;if(t.atTimestamp!==void 0){let r=Date.parse(t.atTimestamp);if(!Number.isFinite(r))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(i=>Date.parse(i.timestamp)<=r)}else{let r=t.atVersion??this.version;if(!Number.isInteger(r)||r<0||r>this.version)throw new TypeError(`Relationship snapshot version out of range: ${r}`);n=this.#o.slice(0,r)}let o=km(n),s=new Be(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:s.edges(),graph:s})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=Nr("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(jr(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let s=Ur(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:r=>r.eventId,snapshot:String(o)});return{version:o,events:s.rows,hasMore:s.has_more,...s.next_cursor?{nextCursor:s.next_cursor}:{}}}},Em="relationship-event-store",Jc=At.O_NOFOLLOW;function bn(e){return V(e,Em,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function Ne(e,t="relationships/events.jsonl"){let n=he.resolve(e),o=he.resolve(n,t),s=he.relative(n,o);if(s.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(s===".."||s.startsWith(`..${he.sep}`)||he.isAbsolute(s))throw new TypeError("Relationship event path must stay within the tracker root");if(await zo(n,{recursive:!0}),(await Kc(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let i=n;for(let a of s.split(he.sep)){i=he.join(i,a);try{if((await Kc(i)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(Nn(c))break;throw c}}return o}async function wn(e,t,n){let o=new Ct(t,{registry:n}),s,r;try{r=await Yc(e,At.O_RDONLY|Jc),s=await r.readFile("utf8")}catch(a){if(Nn(a))return{log:o,raw:""};throw a}finally{await r?.close()}let i=s.split(`
|
|
2
2
|
`);for(let a=0;a<i.length;a+=1){let c=i[a].trim();if(!c)continue;let d;try{d=JSON.parse(c)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${a+1}`)}if(d.sequence!==o.version+1)throw new TypeError(`Invalid relationship event sequence at line ${a+1}`);o.append({eventId:d.eventId,relationshipId:d.relationshipId,action:d.action,...d.edge===void 0?{}:{edge:d.edge},author:d.author,timestamp:d.timestamp,...d.reason===void 0?{}:{reason:d.reason},expectedVersion:o.version})}return{log:o,raw:s}}function xm(e,t,n,o){let s=Date.parse(t.timestamp),r;return t.action!=="remove"&&t.edge!==void 0&&(r=new Be(n,[t.edge],o).edges()[0]),e.eventId===t.eventId.trim()&&e.relationshipId===t.relationshipId.trim()&&e.action===t.action&&e.author===t.author.trim()&&Number.isFinite(s)&&e.timestamp===new Date(s).toISOString()&&e.reason===(t.reason?.trim()||void 0)&&F(e.edge)===F(r)}var vn=class e{#t;#n;#o;#r;#e;constructor(t,n,o,s){this.#t=t.pmRoot,this.#n=n,this.#o=t.registry,this.#r=o,this.#e=s}static async open(t){let n=Object.freeze([...t.nodes]),o=await Ne(t.pmRoot,t.relativePath),s=await bn(t.pmRoot);try{await Ne(t.pmRoot,o);let{log:r}=await wn(o,n,t.registry);return new e(t,n,o,r)}finally{await s()}}get path(){return this.#r}async currentVersion(){return this.#e=await this.#s(),this.#e.version}async append(t){let n=await bn(this.#t);try{let o=await Ne(this.#t,this.#r),{log:s}=await wn(o,this.#n,this.#o),r=s.append(t);await zo(he.dirname(o),{recursive:!0}),await Ne(this.#t,o);let i=await Yc(o,At.O_APPEND|At.O_CREAT|At.O_WRONLY|Jc);try{await i.appendFile(`${JSON.stringify(r)}
|
|
3
3
|
`,"utf8")}finally{await i.close()}return this.#e=s,r}finally{await n()}}async appendBatch(t,n={}){let o=await bn(this.#t);try{let s=await Ne(this.#t,this.#r),{log:r,raw:i}=await wn(s,this.#n,this.#o),a=r.version,c=new Map(r.events().map(m=>[m.eventId,m])),d=[],l=[];for(let m of t){let f=m.eventId.trim(),_=c.get(f);if(_!==void 0){if(n.existingEventPolicy==="skip_identical"&&xm(_,m,this.#n,this.#o)){l.push(_.eventId);continue}if(n.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${f}`)}let w=r.append(m);c.set(w.eventId,w),d.push(w)}if(d.length>0){let m=i.length===0||i.endsWith(`
|
|
4
4
|
`)?i:`${i}
|
|
@@ -2111,4 +2111,4 @@ end`}var Bh={bash:'Add to ~/.bashrc or ~/.bash_profile: eval "$(pm completion ba
|
|
|
2111
2111
|
`);N(e.progressEnabled,"writing keyword artifacts"),await z(t,`${JSON.stringify(e.manifest,null,2)}
|
|
2112
2112
|
`),await z(n,`${s}
|
|
2113
2113
|
`);let r=[];if(e.mode!=="keyword")try{N(e.progressEnabled,"writing vectorization status ledger"),await ki(e.pmRoot,e.vectorizationLedgerEntries,e.vectorizationEmbeddingMetadata)}catch(i){r.push(`search_vectorization_status_ledger_write_failed:${i instanceof Error?i.message:String(i)}`)}return r}async function gg(e,t){let n=Jh(e.mode),o=Yh(e),s=e.full===!0;N(o,`start mode=${n}`);let r=E(process.cwd(),t.path);await $(r);let i=ii(await R(r)).settings,a=null;try{a=await V(r,ai,i.locks.ttl_seconds,C(void 0,"pm-reindex"),!1,i.governance.force_required_for_stale_lock,i.locks.wait_ms)}catch(c){throw c instanceof p&&c.exitCode===u.CONFLICT?new p("Another pm reindex run is already active for this project. Wait for it to finish before starting a new keyword, semantic, or hybrid reindex.",u.CONFLICT,{code:"reindex_already_running",type:"urn:pm-cli:error:reindex_already_running",why:"Semantic reindex can be expensive and duplicate runs compete for the same local embedding model and vector store.",nextSteps:["Check active pm reindex processes before starting another reindex.","Rerun with --progress when you need non-interactive visibility."]}):c}try{let c=Qh(i),d=eg(i),l=ig({requestedMode:n,pmRoot:r,settings:i,extensionEmbedding:c,extensionVectorAdapter:d}),m=n;N(o,"loading item corpus");let f=await ag({pmRoot:r,settings:i}),_=f.warnings,{documentCandidates:w,metadataDocuments:v}=f;N(o,`loaded_items=${v.length}`);let g=S(),h=rg(m,g,v),k=Pt.join(r,Vs),x=Pt.join(r,Ws),I=m==="keyword"?await Ys(r,w,i.schema,_):v,A=[],X={},G=null,se=sg(m);if(m==="keyword"&&await cg({pmRoot:r,settings:i,forceFullSemantic:s,extensionEmbedding:c,reindexWarnings:_}),m!=="keyword"){let re=await _g({pmRoot:r,settings:i,requestedMode:n,activeEmbeddingProvider:l.activeEmbeddingProvider,activeVectorStore:l.activeVectorStore,extensionEmbedding:c,extensionVectorAdapter:d,documentCandidates:w,metadataDocuments:v,documentsForKeywordArtifacts:I,forceFullSemantic:s,reindexWarnings:_,semanticWarnings:A,semanticSummary:se,progressEnabled:o});I=re.documentsForKeywordArtifacts,X=re.vectorizationLedgerEntries,G=re.vectorizationEmbeddingMetadata}let le=await hg({pmRoot:r,mode:m,manifest:h,documentsForKeywordArtifacts:I,settings:i,vectorizationLedgerEntries:X,vectorizationEmbeddingMetadata:G,progressEnabled:o}),Ee=[...await D({path:k,scope:"project",op:"reindex:manifest"}),...await D({path:x,scope:"project",op:"reindex:embeddings"}),...await yr({mode:m,total_items:v.length})];return N(o,"done"),{ok:!0,mode:m,total_items:v.length,semantic:se,artifacts:{manifest:Vs,embeddings:Ws},warnings:[..._,...A,...le,...Ee],generated_at:g}}finally{await a?.()}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b67ba0fe-bbca-57ab-b3be-a4a028f21de4")}catch{}})();var Zl=Symbol("pm.active-extension-host-context");function J(e){return{fullChangedFields:!0,options:e}}var b=class e{defaults;constructor(t={}){this.defaults={...t.pmRoot===void 0?{}:{path:t.pmRoot},...t.cwd===void 0?{}:{cwd:t.cwd},...t.author===void 0?{}:{author:t.author},...t.noExtensions===void 0?{}:{noExtensions:t.noExtensions}}}static forActiveExtensionHost(t){let n=new e({...t,noExtensions:!0});return n.defaults[Zl]=!0,n}run(t,n={}){return xg({...this.defaults,...n,action:t})}runTyped(t,n={}){return this.run(t,n)}context(t={}){return this.runTyped("context",{options:t})}listAllItemMetadataLight(){return Gc(this.defaults.path,this.defaults.cwd)}list(t={}){return this.runTyped("list",{options:t})}async listAllComplete(t={}){return yn(await this.list(No(t)))}search(t,n={}){return this.runTyped("search",{query:t,options:n})}get(t,n={}){return this.runTyped("get",{id:t,options:n})}next(t={}){return this.runTyped("next",{options:t})}aggregate(t={}){return this.runTyped("aggregate",{options:t})}stats(t={}){return this.runTyped("stats",{options:t})}duplicates(t={}){return this.runTyped("duplicates",{options:t})}comments(t,n={}){return this.runTyped("comments",{id:t,options:n})}notes(t,n={}){return this.runTyped("notes",{id:t,options:n})}learnings(t,n={}){return this.runTyped("learnings",{id:t,options:n})}files(t,n={}){return this.runTyped("files",{id:t,options:n})}filesDiscover(t,n={}){return this.runTyped("files-discover",{id:t,options:n})}filesLookup(t){return this.runTyped("files-lookup",{options:t})}docs(t,n={}){return this.runTyped("docs",{id:t,options:n})}deps(t,n={}){return this.runTyped("deps",{id:t,options:n})}graph(t,n={},o={}){return this.runTyped("graph",{subcommand:t,...n,options:o})}append(t,n,o={}){return this.runTyped("append",{id:t,...J(St(o,{body:n}))})}init(t,n={}){return this.runTyped("init",{...t===void 0?{}:{prefix:t},options:n})}config(t,n,o,s,r={}){return this.runTyped("config",{scope:t,configAction:n,...o===void 0?{}:{key:o},...s===void 0?{}:{value:s},options:r})}schema(t,n={}){return this.runTyped("schema",{options:{...n,subcommand:t}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(t){return this.runTyped("schema",{name:t,options:{subcommand:"show"}})}schemaAddType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-type"}})}schemaRemoveType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-type"}})}schemaAddStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-status"}})}schemaRemoveStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-status"}})}schemaAddField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-field"}})}schemaRemoveField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-field"}})}schemaApplyPreset(t,n={}){return this.runTyped("schema",{typePreset:t,options:{...n,subcommand:"apply-preset"}})}schemaInferTypes(t={}){return this.runTyped("schema",{options:{...t,subcommand:"add-type",infer:!0}})}schemaRenameType(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-type",to:n}})}schemaRenameField(t,n,o,s){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-field",to:n,...s?{fieldTypeScope:s}:{}}})}schemaRemapStatus(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"remap-status",to:n}})}schemaShowStatus(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-status"}})}profile(t,n={}){return this.runTyped("profile",{options:{...n,subcommand:t}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(t){return this.runTyped("profile",{name:t,options:{subcommand:"show"}})}profileApply(t,n={}){return this.runTyped("profile",{name:t,options:{...n,subcommand:"apply"}})}profileLint(t){return this.runTyped("profile",{name:t,options:{subcommand:"lint"}})}validate(t={}){return this.runTyped("validate",{options:t})}health(t={}){return this.runTyped("health",{options:t})}gc(t={}){return this.runTyped("gc",{options:t})}assurance(t){return this.runTyped("assurance",{options:{...t,subcommand:t.action}})}historyRedact(t,n){return this.runTyped("history-redact",{id:t,options:n})}historyRepair(t,n={}){return this.runTyped("history-repair",{id:t,options:n})}historyRepairAll(t={}){return this.runTyped("history-repair",{options:{...t,all:!0}})}historyCompact(t,n={}){return this.runTyped("history-compact",{id:t,options:n})}historyCompactBulk(t){return this.runTyped("history-compact",{options:t})}historyAuthorAcknowledge(t){return this.runTyped("history-author-acknowledge",{historyEvent:(t.events??[]).map(n=>`${n.item_id}:${String(n.line)}`),allActionable:t.all_actionable===!0,dryRun:t.dry_run===!0,planFingerprint:t.plan_fingerprint,limit:t.coordinate_limit,attributedAuthor:t.attributed_author,reviewer:t.reviewer,reason:t.reason})}plan(t,n,o={},s,r){return this.runTyped("plan",{...n===void 0?{}:{id:n},...s===void 0?{}:{stepRef:s},...r===void 0?{}:{reorderTo:r},options:St(o,{subcommand:t})})}planCreate(t){return this.plan("create",void 0,t)}planShow(t,n={}){return this.plan("show",t,n)}planAddStep(t,n){return this.plan("add-step",t,n)}planUpdateStep(t,n,o){return this.plan("update-step",t,o,n)}planCompleteStep(t,n,o={}){return this.plan("complete-step",t,o,n)}planBlockStep(t,n,o){return this.plan("block-step",t,o,n)}planReorderStep(t,n,o,s={}){return this.plan("reorder-step",t,s,n,o)}planRemoveStep(t,n,o={}){return this.plan("remove-step",t,o,n)}planLink(t,n,o){return this.plan("link",t,o,n)}planUnlink(t,n,o){return this.plan("unlink",t,o,n)}planDecision(t,n){return this.plan("decision",t,n)}planDiscovery(t,n){return this.plan("discovery",t,n)}planValidation(t,n){return this.plan("validation",t,n)}planResume(t,n){return this.plan("resume",t,n)}planApprove(t,n={}){return this.plan("approve",t,n)}planMaterialize(t,n){return this.plan("materialize",t,n)}create(t={}){return this.runTyped("create",J(t))}update(t,n={}){return this.runTyped("update",{id:t,...J(n)})}reopen(t,n,o={}){return this.runTyped("item-reopen",{id:t,reason:n,fullChangedFields:!0,options:o})}close(t,n,o={}){return this.runTyped("close",{id:t,reason:n,...J(o)})}claim(t,n={}){return this.runTyped("claim",{id:t,...J(n)})}claimNext(t={}){return this.runTyped("claim",{next:!0,...J(t)})}release(t,n={}){return this.runTyped("release",{id:t,...J(n)})}copy(t,n={}){return this.runTyped("copy",{id:t,...J(n)})}delete(t,n={}){return this.runTyped("delete",{id:t,...J(n)})}restore(t,n,o={}){return this.runTyped("restore",{fullChangedFields:!0,id:t,options:{...o,target:n}})}focus(t,n={}){return this.runTyped("focus",{...t===void 0?{}:{id:t},...J(n)})}startTask(t,n={}){return this.runTyped("start-task",{id:t,...J(n)})}pauseTask(t,n={}){return this.runTyped("pause-task",{id:t,...J(n)})}closeTask(t,n,o={}){return this.runTyped("close-task",{id:t,reason:n,...J(o)})}extension(t,n={}){return this.runTyped("extension",{...t===void 0?{}:{target:t},options:n})}extensionList(t={}){return this.extension("list",t)}extensionActivate(t,n={}){return this.runTyped("extension-activate",{target:t,options:n})}extensionDeactivate(t,n={}){return this.runTyped("extension-deactivate",{target:t,options:n})}package(t,n={}){return this.runTyped("package",{...t===void 0?{}:{target:t},options:{...n,vocabulary:"package"}})}packageList(t={}){return this.package("list",t)}packageInstall(t,n={}){return this.runTyped("package-install",{target:t,options:n})}packageUninstall(t,n={}){return this.runTyped("package-uninstall",{target:t,options:n})}packageDoctor(t={}){return this.runTyped("package-doctor",{options:t})}packageManage(t,n={}){return this.runTyped("package-manage",{...t===void 0?{}:{target:t},options:n})}packageDescribe(t,n={}){return this.runTyped("package-describe",{...t===void 0?{}:{target:t},options:n})}packageReload(t={}){return this.runTyped("package-reload",{options:t})}packageCatalog(t={}){return this.runTyped("package-catalog",{options:t})}packageActivate(t,n={}){return this.runTyped("package-activate",{target:t,options:n})}packageDeactivate(t,n={}){return this.runTyped("package-deactivate",{target:t,options:n})}packageMigrate(t={}){return this.package(void 0,{...t,migrate:!0})}upgrade(t,n={}){return this.runTyped("upgrade",{...t===void 0?{}:{target:t},options:n})}};function rx(e={},t={}){return new b(t).context(e)}function ix(e={},t={}){return new b(t).list(e)}function ax(e={},t={}){return new b(t).listAllComplete(e)}function cx(e,t={},n={}){return new b(n).search(e,t)}function dx(e,t={},n={}){return new b(n).get(e,t)}function lx(e={},t={}){return new b(t).next(e)}function mx(e={},t={}){return new b(t).aggregate(e)}function px(e={},t={}){return new b(t).stats(e)}function ux(e={},t={}){return new b(t).duplicates(e)}function fx(e,t={},n={}){return new b(n).comments(e,t)}function _x(e,t={},n={}){return new b(n).notes(e,t)}function hx(e,t={},n={}){return new b(n).learnings(e,t)}function gx(e,t={},n={}){return new b(n).files(e,t)}function yx(e,t={},n={}){return new b(n).filesDiscover(e,t)}function bx(e,t={}){return new b(t).filesLookup(e)}function wx(e,t={},n={}){return new b(n).docs(e,t)}function vx(e,t={},n={}){return new b(n).deps(e,t)}function kx(e,t={},n={},o={}){return new b(o).graph(e,t,n)}function Sx(e,t,n={},o={}){return new b(o).append(e,t,n)}function Ix(e,t={},n={}){return new b(n).init(e,t)}function Ex(e,t,n,o,s={},r={}){return new b(r).config(e,t,n,o,s)}function xx(e,t={},n={}){return new b(n).schema(e,t)}function Rx(e={}){return new b(e).schemaList()}function Ax(e,t={}){return new b(t).schemaShow(e)}function Cx(e,t={},n={}){return new b(n).schemaAddType(e,t)}function Tx(e,t={},n={}){return new b(n).schemaRemoveType(e,t)}function Ox(e,t={},n={}){return new b(n).schemaAddStatus(e,t)}function $x(e,t={},n={}){return new b(n).schemaRemoveStatus(e,t)}function Px(e,t={},n={}){return new b(n).schemaAddField(e,t)}function Fx(e,t={},n={}){return new b(n).schemaRemoveField(e,t)}function Lx(e={}){return new b(e).schemaListFields()}function Mx(e,t={}){return new b(t).schemaShowField(e)}function Dx(e,t={},n={}){return new b(n).schemaApplyPreset(e,t)}function Nx(e={},t={}){return new b(t).schemaInferTypes(e)}function jx(e,t,n,o={}){return new b(o).schemaRenameType(e,t,n)}function Ux(e,t,n,o,s={}){return new b(s).schemaRenameField(e,t,n,o)}function Gx(e,t,n,o={}){return new b(o).schemaRemapStatus(e,t,n)}function qx(e,t={}){return new b(t).schemaShowStatus(e)}function zx(e,t={},n={}){return new b(n).profile(e,t)}function Hx(e={}){return new b(e).profileList()}function Bx(e,t={}){return new b(t).profileShow(e)}function Vx(e,t={},n={}){return new b(n).profileApply(e,t)}function Wx(e,t={}){return new b(t).profileLint(e)}function Kx(e={},t={}){return new b(t).validate(e)}function Yx(e={},t={}){return new b(t).health(e)}function Jx(e={},t={}){return new b(t).gc(e)}function Xx(e,t,n={}){return new b(n).historyRedact(e,t)}function Zx(e,t={},n={}){return new b(n).historyRepair(e,t)}function Qx(e={},t={}){return new b(t).historyRepairAll(e)}function eR(e,t={},n={}){return new b(n).historyCompact(e,t)}function tR(e,t={}){return new b(t).historyCompactBulk(e)}function nR(e={},t={}){return new b(t).create(e)}function oR(e,t={},n={}){return new b(n).update(e,t)}function sR(e,t,n={},o={}){return new b(o).reopen(e,t,n)}function rR(e,t,n={},o={}){return new b(o).close(e,t,n)}function iR(e,t={},n={}){return new b(n).claim(e,t)}function aR(e={},t={}){return new b(t).claimNext(e)}function cR(e,t={},n={}){return new b(n).release(e,t)}function dR(e,t={},n={}){return new b(n).copy(e,t)}function lR(e,t={},n={}){return new b(n).delete(e,t)}function mR(e,t,n={},o={}){return new b(o).restore(e,t,n)}function pR(e,t={},n={}){return new b(n).focus(e,t)}function uR(e,t={},n={}){return new b(n).startTask(e,t)}function fR(e,t={},n={}){return new b(n).pauseTask(e,t)}function _R(e,t,n={},o={}){return new b(o).closeTask(e,t,n)}function hR(e,t={},n={}){return new b(n).extension(e,t)}function gR(e={},t={}){return new b(t).extensionList(e)}function yR(e,t={},n={}){return new b(n).extensionActivate(e,t)}function bR(e,t={},n={}){return new b(n).extensionDeactivate(e,t)}function wR(e,t={},n={}){return new b(n).package(e,t)}function vR(e={},t={}){return new b(t).packageList(e)}function kR(e,t={},n={}){return new b(n).packageInstall(e,t)}function SR(e,t={},n={}){return new b(n).packageUninstall(e,t)}function IR(e={},t={}){return new b(t).packageDoctor(e)}function ER(e,t={},n={}){return new b(n).packageManage(e,t)}function xR(e,t={},n={}){return new b(n).packageDescribe(e,t)}function RR(e={},t={}){return new b(t).packageReload(e)}function AR(e={},t={}){return new b(t).packageCatalog(e)}function CR(e,t={},n={}){return new b(n).packageActivate(e,t)}function TR(e,t={},n={}){return new b(n).packageDeactivate(e,t)}function OR(e,t={},n={}){return new b(n).upgrade(e,t)}function bg(e,t,n){return JSON.stringify([Kl.resolve(e),Kl.resolve(n??process.cwd()),t.extensions.enabled,t.extensions.disabled,t.extensions.policy])}async function wg(e,t,n){let o=bg(e,t,n);return Bc(o,()=>ry(e,t,n))}async function $R(e,t={}){let n=await R(e),o=t.extensionRegistrations??(t.noExtensions===!0?null:await wg(e,n,t.cwd)),s=P(n,o),r=j(n.schema),i=yt(n.schema);return{types:[...s.types],statuses:r.definitions.map(a=>a.id),openStatus:r.open_status,closeStatus:r.close_status,canceledStatus:r.canceled_status,fields:zc(i.definitions),extensionCommands:Hc(o?.commands??[])}}async function PR(e,t={}){let n=typeof e=="string"?{...t,pmRoot:e}:e??t,o={json:!0,quiet:n.quiet??!0,noExtensions:n.noExtensions??!1,noPager:!0,profile:n.profile??!1,path:n.pmRoot};return Fo(n,o)}function de(e,t){let n=y(e,t);if(!n)throw new p(`Missing required argument: ${t}`,64);return n}var Yl=_r(),Ql=new yg;function Mn(){Kn(ir()),Yn(ar()),Jn(cr()),Xn(dr()),Zn(lr()),Qn(mr()),eo(pr())}async function em(e,t,n,o){return hr(()=>t===void 0?Yl.read(()=>Jl(e,n,o)):Yl.write(()=>kg(t,()=>Jl(e,n,o))))}async function FR(e,t){let n=e.cwd,o=n??process.cwd();return em(nn({path:e.path,noExtensions:e.noExtensions}),n,o,()=>Ql.run(!0,t))}async function Jl(e,t,n){let o=E(t,e.path);if(e.noExtensions)return Mn(),Wo({pmRoot:o},()=>n(null));if(!await Z(ut(o)))return Mn(),n(null);let s=null,r;try{let i=await R(o),a=await Bn({pmRoot:o,settings:i,cwd:t,noExtensions:!1}),c=await Wn({...a,loaded:a.loaded});r={loadResult:a,activationResult:c},Kn(c.hooks),Yn(c.commands),Jn(c.parsers),Xn(c.preflight),Zn(c.services),Qn(c.renderers),eo(c.registrations),s={registrations:c.registrations,commands:c.commands,pmRoot:o,packages:a.loaded}}catch(i){Mn(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",i)}try{return await Wo({pmRoot:o,packages:s?.packages},()=>n(s))}finally{Mn(),r&&await Vn(r.loadResult,r.activationResult).catch(()=>{})}}async function vg(e,t,n,o,s){if(!s)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let r=we(e),a=s.registrations.commands.find(d=>we(d.action)===r)?.command??s.commands.handlers.find(d=>we(d.command)===r)?.command;if(!a)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let c=await br({command:go(a),args:H(n.args??t.args),options:yo(t,n),global:o,pm_root:s.pmRoot,sdk:Xc(s.pmRoot,b.forActiveExtensionHost({pmRoot:s.pmRoot,author:typeof o.author=="string"&&o.author.trim()?o.author.trim():"pm-extension"}))});if(!c.handled){let d=c.warnings.length>0?` (${c.warnings.join(", ")})`:"";throw new p(`Unsupported native pm action: ${e}${d}`,u.USAGE)}return c.result}async function kg(e,t){let n=process.cwd();process.chdir(e);try{return await t()}finally{process.chdir(n)}}var Sg=new Set(["activity","aggregate","context","contracts","deps","files-discover","get","graph","health","history","list","next","search","stats","telemetry","validate"]);function Ig(e){let t=de(e,"action"),n=we(t),o=lt(Uo,n),s=o?.action??n,r={...e,action:s};return o?.options!==void 0&&(r.options={...o.options,...jn(e.options)}),s==="package"&&(r.options={...jn(r.options),vocabulary:"package"}),{action:s,args:r}}function Eg(e){return!Sg.has(we(e))}async function xg(e){let t=Ig(e),n=nn(t.args),o=Eg(t.action),s=y(t.args,"cwd"),r=s??process.cwd();try{return e[Zl]===!0||Ql.getStore()===!0?await Xl(t.action,t.args,n,null):await em(n,s,r,i=>Xl(t.action,t.args,n,i))}finally{o&&jo()}}function lt(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function Dn(e){return y(e.args,"target")??y(e.options,"target")}function M(e,t=e.options){return e.id??de(t,"id")}async function Rg(e){let t=Je("list",e.options);return t.compact===void 0&&t.brief===void 0&&t.full===void 0&&t.fields===void 0&&t.includeBody===void 0&&(t.compact=!0),Do(await fe(y(e.args,"status")??y(t,"status"),t,e.global),t)}async function Ag(e){let t=de(e.args,"query"),n=Je("search",e.options,[t]);return n.compact===void 0&&n.full===void 0&&n.fields===void 0&&(n.compact=!0),Do(await Po(t,n,e.global),n)}async function Cg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=te(e.args,e.options);return oe(await Rt(o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function Tg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=te(e.args,e.options),s={...o,...o.title===void 0&&typeof e.args.title=="string"?{title:e.args.title}:{},...o.message===void 0&&typeof e.args.message=="string"?{message:e.args.message}:{}};return oe(await ps(M(e,s),s,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function Og(e){let{changedFields:t,idOnly:n,runnerOptions:o}=te(e.args,e.options);return oe(await ve(M(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function $g(e){let t=pn(e.options);return t.add===void 0&&t.stdin===void 0&&t.file===void 0&&t.edit===void 0&&t.delete===void 0&&(t.includeMeta=!0,t.limit===void 0&&t.fullHistory!==!0&&(t.limit="20")),rd(M(e),t,e.global)}function tm(e,t){return sc(kl(e.options,t,ee),e.global)}function Pg(e){let t=H(e.options.lookupPath);if(t&&t.length>0)return tm(e,t);let n=M(e);return e.options.discover===!0?ko(n,ho(e.options),e.global):oc(n,on(e.options),e.global)}function Fg(e){return Lc({subcommand:y(e.args,"subcommand")??y(e.options,"subcommand"),limit:va(e.args,e.options)},e.global)}function Lg(e){let t={...e.options};return t.brief===void 0&&t.summary===void 0&&t.full===void 0&&(t.summary=!0),tc(e.global,t)}function Mg(e){let t=y(e.args,"configAction")??y(e.options,"configAction")??y(e.options,"action");if(t===void 0)throw new p("Missing required argument: configAction",64);let n=y(e.args,"value")??y(e.options,"value"),o=y(e.options,"policy")!==void 0&&n!==void 0?{...e.options,value:n}:e.options;return bc(y(e.args,"scope")??y(e.options,"scope")??"project",t,y(e.args,"key")??y(e.options,"key"),o,e.global,y(e.options,"policy")===void 0?n:void 0)}function Dg(e){let t=e.options;return ha(_a(t),e.global)}function Ng(e,t){if(typeof e=="number"){if(!Number.isFinite(e)||!Number.isInteger(e))throw new p(`${t} must be a finite integer.`,64);return e}if(typeof e=="string"&&e.trim().length>0){let n=e.trim();if(!/^[+-]?\d+(?:st|nd|rd|th)?$/i.test(n))throw new p(`${t} must be a finite integer.`,64);let o=Number.parseInt(n,10);if(!Number.isInteger(o))throw new p(`${t} must be a finite integer.`,64);return o}}function jg(e){let t=y(e.args,"subcommand")??de(e.options,"subcommand"),n=e.options;return Ed({subcommand:t,id:typeof e.id=="string"?e.id:typeof n.id=="string"?n.id:void 0,stepRef:Ug(e),reorderTo:Ng(n.reorderTo??e.args.reorderTo,"plan reorderTo"),options:e.options,global:e.global})}function Ug(e){return typeof e.options.stepRef=="string"?e.options.stepRef:typeof e.args.stepRef=="string"?e.args.stepRef:void 0}function Gg(e){let t=y(e.args,"subcommand")??de(e.options,"subcommand"),n=e.args.alias??e.options.alias;return{ctx:e,subcommand:t.trim().toLowerCase(),name:y(e.args,"name")??y(e.options,"name"),author:y(e.args,"author")??y(e.options,"author"),force:e.args.force===!0||e.options.force===!0,aliases:n===void 0?void 0:H(n)}}function qg(e){let{ctx:t,subcommand:n,name:o,author:s,force:r}=e,a=lt({list:()=>Ua(t.global),show:()=>Ga(o,t.global),"show-status":()=>qa(o,t.global),"list-fields":()=>Ba(t.global),"show-field":()=>Va(o,t.global),"remove-type":()=>Ma(o,{author:s,force:r},t.global),"remove-field":()=>Ha(o,{author:s,force:r},t.global),"remove-status":()=>ja(o,{author:s,force:r},t.global),"apply-preset":()=>Wa(y(t.args,"typePreset")??y(t.options,"typePreset"),{author:s,force:r},t.global)},n);return a?a():null}function zg(e){let{ctx:t,name:n,author:o,force:s,aliases:r}=e,i=t.args.commands??t.options.commands,a=t.args.requiredTypes??t.options.requiredTypes;return za(n,{type:y(t.args,"fieldType")??y(t.options,"fieldType"),commands:i===void 0?void 0:H(i),description:y(t.args,"description")??y(t.options,"description"),cliFlag:y(t.args,"cliFlag")??y(t.options,"cliFlag"),alias:r,required:t.args.required===!0||t.options.required===!0,requiredOnCreate:t.args.requiredOnCreate===!0||t.options.requiredOnCreate===!0,allowUnset:!(t.args.allowUnset===!1||t.options.allowUnset===!1),requiredTypes:a===void 0?void 0:H(a),author:o,force:s},t.global)}function Hg(e){let{ctx:t,name:n,author:o,force:s,aliases:r}=e,i=t.args.role??t.options.role;return Na(n,{role:i===void 0?void 0:H(i),alias:r,description:y(t.args,"description")??y(t.options,"description"),order:ee(t.args.order??t.options.order,"schema add-status order"),author:o,force:s},t.global)}function Bg(e){let{ctx:t,name:n,author:o,force:s,aliases:r}=e;return La(n,{description:y(t.args,"description")??y(t.options,"description"),defaultStatus:y(t.args,"defaultStatus")??y(t.args,"default_status")??y(t.options,"defaultStatus")??y(t.options,"default_status"),folder:y(t.args,"folder")??y(t.options,"folder"),alias:r,author:o,force:s},t.global)}function Vg(e){let{ctx:t,subcommand:n,name:o,author:s,force:r}=e,i=y(t.args,"to")??de(t.options,"to"),a=y(t.args,"migrationId")??y(t.args,"migration_id")??y(t.options,"migrationId")??y(t.options,"migration_id"),c=y(t.args,"fieldTypeScope")??y(t.options,"fieldTypeScope")??y(t.args,"type")??y(t.options,"type"),d=n==="rename-type"?{kind:"rename-type",from:o??"",to:i}:n==="rename-field"?{kind:"rename-field",from:o??"",to:i,...c===void 0?{}:{type:c}}:{kind:"remap-status",from:o??"",to:i};return Pa(d,{migrationId:a,dryRun:t.args.dryRun===!0||t.options.dryRun===!0,author:s,force:r},t.global)}function Wg(e){let t=Gg(e),n=qg(t);if(n!==null)return n;if(t.subcommand==="rename-type"||t.subcommand==="rename-field"||t.subcommand==="remap-status")return Vg(t);if(t.subcommand==="add-field")return zg(t);if(t.subcommand==="add-status")return Hg(t);if(t.subcommand==="add-type")return e.args.infer===!0||e.options.infer===!0?Ka({minCount:ee(e.args.minCount??e.options.minCount,"schema infer minCount"),apply:e.args.apply===!0||e.options.apply===!0,author:t.author,force:t.force},e.global):Bg(t);throw me({command_path:"schema",token:t.subcommand,allowed:Fa,exit_code:64})}function Kg(e){let t=y(e.args,"subcommand")??de(e.options,"subcommand"),n=t.trim().toLowerCase(),o=y(e.args,"name")??y(e.options,"name"),r=lt({list:()=>al(),show:()=>cl(o),lint:()=>dl(o),apply:()=>ll(o,{dryRun:e.args.dryRun===!0||e.options.dryRun===!0,author:y(e.args,"author")??y(e.options,"author"),force:e.args.force===!0||e.options.force===!0},e.global)},n);if(!r)throw me({command_path:"profile",token:t,allowed:il,exit_code:64});return r()}async function Yg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=te(e.args,e.options);return oe(await ed(M(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function Jg(e){let{changedFields:t,runnerOptions:n}=te(e.args,e.options);return oe(await pd(wo(n),e.global),{changedFields:t})}async function Xg(e){let{changedFields:t,runnerOptions:n}=te(e.args,e.options),o=y(e.args,"reason"),s=o!==void 0&&n.reason===void 0?{...n,reason:o}:{...n};return e.force&&s.force===void 0&&(s.force=!0),oe(await sd(bo(s),e.global),{changedFields:t})}async function Zg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=te(e.args,e.options),s=y(o,"target")??de(e.args,"target");return oe(await je(M(e,o),s,o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function Qg(e){let t=E(process.cwd(),e.global.path),n=await R(t),o=hn(j(n.schema)),s=M(e),r=await Ao(s,e.force,e.global,e.options),i=await ve(s,St(e.options,{status:o,force:e.force},["assignee"]),e.global);return{id:s,action:"start_task",claim:r,update:i}}async function ey(e){let t=E(process.cwd(),e.global.path),n=await R(t),o=M(e),s=j(n.schema).open_status,r=await ve(o,St(e.options,{status:s,force:e.force},["assignee"]),e.global),i=await fn(o,e.force,e.global,e.options);return{id:o,action:"pause_task",update:r,release:i}}async function ty(e){let t=M(e),n=y(e.args,"reason")??y(e.args,"text")??y(e.options,"reason")??y(e.options,"text"),o=await Me(t,n,{...e.options,force:e.force},e.global),s=await fn(t,e.force,e.global,e.options);return{id:t,action:"close_task",close:o,release:s}}function ny(e){let t={...e.args,...e.options};return ya(de(t,"subcommand"),y(t,"id")??e.id,y(t,"target"),Ia(t),e.global)}function oy(e){return xa(E(process.cwd(),e.global.path),{...e.args,...e.options})}var nm={init:e=>wc(y(e.args,"prefix"),e.global,e.options),context:e=>xo(Je("context",e.options),e.global),next:e=>Ro(Je("next",e.options),e.global),eval:Dd,events:Nd,merge:jd,workspace:Ud,meet:xn,event:xn,remind:xn,list:Rg,get:e=>{let t=M(e);return $o(t,e.global,Je("get",e.options,[t]))},search:Ag,duplicates:e=>{let t=typeof e.options.status=="string"?[e.options.status]:H(e.options.status);return Mo(e.global,{...t.length===0?{}:{status:t},since:y(e.options,"since"),threshold:typeof e.options.threshold=="number"?e.options.threshold:void 0,limit:e.options.limit==="default"?void 0:ee(e.options.limit,"limit")})},create:Cg,copy:Tg,focus:e=>fs(e.id,{clear:e.options.clear===!0||e.args.clear===!0},e.global),update:Og,"item-reopen":vl,restore:Zg,claim:e=>e.options.next===!0||e.args.next===!0?dc(e.force,e.global,{...e.options,...e.args},{...e.options,...e.args}):Ao(M(e),e.force,e.global,e.options),release:e=>fn(M(e),e.force,e.global,e.options),"start-task":Qg,"pause-task":ey,"close-task":ty,close:wl,comments:$g,notes:e=>ad(M(e),pn(e.options),e.global),learnings:e=>id(M(e),pn(e.options),e.global),files:Pg,docs:e=>nc(M(e),on(e.options),e.global),test:e=>Mc(M(e),e.options,e.global),"test-all":e=>Dc(e.options,e.global),telemetry:Fg,validate:e=>mn(e.options,e.global,{runUpdate:(t,n,o)=>ve(t,n,o)}),health:Lg,assurance:e=>rc(e.args,e.options,e.global),contracts:e=>Fo(e.options,e.global),config:Mg,activity:Dg,aggregate:e=>So(e.options,e.global),extension:e=>cn(Dn(e),e.options,e.global),package:e=>cn(Dn(e),e.options,e.global),install:e=>cn(Dn(e),{...e.options,install:!0},e.global),upgrade:e=>_c(Dn(e),e.options,e.global),delete:e=>us(M(e),e.options,e.global),deps:e=>ga(M(e),e.options,e.global),graph:ny,"files-discover":e=>ko(M(e),e.options,e.global),"files-lookup":e=>tm(e,H(e.options.paths)),history:e=>lc(M(e),e.options,e.global),"history-redact":e=>ma(M(e),e.options,e.global),"history-repair":hl,"history-compact":gl,"history-author-acknowledge":oy,plan:jg,schema:Wg,profile:Kg,stats:e=>Lo(e.global,Sl(e.options)),append:Yg,"update-many":Jg,"close-many":Xg,gc:e=>hc(e.global,e.options)};function LR(e=Hr){return e.map(t=>{let n=we(t),o=lt(Uo,n),s=o?.action??n,r=lt(nm,s)!==void 0;return{action:t,resolved_action:s,covered:r,route:r?o?"alias":"native":"missing"}})}async function Xl(e,t,n,o){let s=_o(t,e);Br(e,s),Vr(e,s);let r={action:e,args:t,options:s,id:y(t,"id"),force:t.force===!0||s.force===!0,global:n,activeExtensions:o},i=lt(nm,e),a=i?await i(r):await vg(e,t,s,n,o);return s.resolvedOutputFormat="json",Kr(e,s,a)}var sy={closeManyOptionsFromFlat:bo,extensionOptionsFromArgs:yo,globalOptions:nn,mutationListOptions:Sa,normalizeActionName:we,normalizeCommandPath:go,normalizeMcpUpdateOptions:Ea,normalizeMcpOptionsArrays:ka,optionsWithAuthor:_o,readRequiredString:de,readScalarString:ba,readScalarStringAllowBlank:wa,readStringArray:H,updateManyOptionsFromFlat:wo,withAddNoteOption:on,withFilesDiscoveryOptions:ho,withMutationCompaction:te};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=sy);async function ry(e,t,n){let o=await Bn({pmRoot:e,settings:t,cwd:n??process.cwd(),noExtensions:!1}),s=await Wn(o);try{return s.registrations}finally{try{await Vn(o,s)}catch{}}}export{Wc as a,bm as b,Go as c,Ct as d,vn as e,Xc as f,py as g,uy as h,fy as i,_y as j,hy as k,jc as l,gy as m,im as n,cm as o,gn as p,No as q,qc as r,yn as s,_m as t,jo as u,Vo as v,Zc as w,Tm as x,$m as y,Pm as z,Wo as A,ed as B,je as C,sd as D,rd as E,id as F,ad as G,pd as H,Xp as I,ud as J,ss as K,Ed as L,ps as M,us as N,fs as O,Rd as P,Ad as Q,Ku as R,Yu as S,Od as T,Pd as U,Fd as V,Ld as W,Md as X,rt as Y,ks as Z,yf as _,nv as $,ov as aa,Es as ba,qd as ca,bv as da,wv as ea,Hd as fa,Wd as ga,jv as ha,Lf as ia,$s as ja,Df as ka,Nf as la,il as ma,al as na,cl as oa,dl as pa,ll as qa,lk as ra,mk as sa,pk as ta,uk as ua,Ps as va,s_ as wa,fl as xa,_l as ya,Fs as za,m_ as Aa,p_ as Ba,u_ as Ca,U as Da,f_ as Ea,__ as Fa,h_ as Ga,g_ as Ha,Ms as Ia,Il as Ja,at as Ka,Ls as La,El as Ma,y_ as Na,xl as Oa,b_ as Pa,w_ as Qa,v_ as Ra,k_ as Sa,S_ as Ta,T_ as Ua,Tl as Va,O_ as Wa,N_ as Xa,B_ as Ya,W_ as Za,Vh as _a,gg as $a,b as ab,rx as bb,ix as cb,ax as db,cx as eb,dx as fb,lx as gb,mx as hb,px as ib,ux as jb,fx as kb,_x as lb,hx as mb,gx as nb,yx as ob,bx as pb,wx as qb,vx as rb,kx as sb,Sx as tb,Ix as ub,Ex as vb,xx as wb,Rx as xb,Ax as yb,Cx as zb,Tx as Ab,Ox as Bb,$x as Cb,Px as Db,Fx as Eb,Lx as Fb,Mx as Gb,Dx as Hb,Nx as Ib,jx as Jb,Ux as Kb,Gx as Lb,qx as Mb,zx as Nb,Hx as Ob,Bx as Pb,Vx as Qb,Wx as Rb,Kx as Sb,Yx as Tb,Jx as Ub,Xx as Vb,Zx as Wb,Qx as Xb,eR as Yb,tR as Zb,nR as _b,oR as $b,sR as ac,rR as bc,iR as cc,aR as dc,cR as ec,dR as fc,lR as gc,mR as hc,pR as ic,uR as jc,fR as kc,_R as lc,hR as mc,gR as nc,yR as oc,bR as pc,wR as qc,vR as rc,kR as sc,SR as tc,IR as uc,ER as vc,xR as wc,RR as xc,AR as yc,CR as zc,TR as Ac,OR as Bc,$R as Cc,PR as Dc,de as Ec,FR as Fc,xg as Gc,LR as Hc};
|
|
2114
|
-
//# sourceMappingURL=chunk-
|
|
2114
|
+
//# sourceMappingURL=chunk-FZ4Z2J4F.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$b as F,_b as L,bc as b,ec as J,fb as B,gc as W,hc as Y}from"./chunk-2MC2LCXZ.js";import{b as K}from"./chunk-TAG4VC22.js";import{$j as j,Ae as D,Al as x,C as c,E as d,Gl as z,Pb as N,ba as $,ck as P,id as C,kd as U,r as k,wh as v,yh as G}from"./chunk-NOPL37X4.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a26f1126-3c87-5b0d-8712-2846fc9dcbb3")}catch{}})();import ce from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3f348972-0c8f-52da-abeb-46690df967d8")}catch{}})();var R=["op","id","reason","options"],q=[...R,"ref"],V=["schema_version","mutations"],ne="[a-z][a-z0-9._-]{0,63}",H=new RegExp(`^${ne}$`,"u"),re=new RegExp(`(^|,)id=@(${ne})(?=,|$)`,"gu"),X=e=>e.slice(2).replaceAll(/-([a-z])/gu,(t,n)=>n.toUpperCase()),E=["item","linked","schedule","claim_state","children","omission_receipt","row_contract","context_intent"],oe=new Set(["created_at","updated_at","closed_at","version","format_version","path","author","collection_counts","notes_count","tests_count"]),de=new Set([...oe,"completed_at","id"]),_=new Set(["id","title","description","type","status","priority","tags","body","deadline","estimated_minutes","acceptance_criteria","definition_of_ready","order","rank","assignee",...k,"affected_version","fixed_version","component","regression","customer_impact","close_reason","completed_at","dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"]),Z={create:j.map(e=>e.target),update:P.map(e=>e.target),close:x.map(e=>X(e.flag)).filter(e=>e!=="reason"),release:z.map(e=>X(e.flag))};function Et(e){let t={},n=e.createCompensation;if(n!==void 0){if(n!=="close"&&n!=="delete")throw new d("createCompensation must be close or delete.",c.USAGE);t.createCompensation=n}for(let r of["lockTtlSeconds","lockWaitMs"]){let o=e[r];if(o===void 0)continue;let i=typeof o=="number"||typeof o=="string"&&o.trim().length>0?Number(o):Number.NaN;if(!Number.isSafeInteger(i)||i<=0)throw new d(`${r} must be a positive safe integer.`,c.USAGE);t[r]=i}return t}function p(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function g(e,t){let n=Math.max(1,Math.min(3,Math.floor(e.length/4)+1)),r;for(let o of t){let i=$(e,o,n);i!==null&&(r===void 0||i<r.distance)&&(r={key:o,distance:i})}return r?.key}function y(e,t,n){let r=g(t,n);return new d(r===void 0?`${e} does not recognize key "${t}". Allowed keys: ${n.join(", ")}.`:`${e} does not recognize key "${t}". Did you mean "${r}"?`,c.USAGE,{code:"stdin_json_unknown_key",required:`Use documented ${e} keys only.`,why:"Strict structured input prevents silent typos from creating incomplete or unintended mutations.",nextSteps:[r===void 0?`Remove or correct "${t}".`:`Replace "${t}" with "${r}".`]})}function M(e,t){try{return JSON.parse(e)}catch(n){let r=n instanceof Error?n.message:String(n);throw new d(`${t} must be valid JSON: ${r}`,c.USAGE,{code:"stdin_json_invalid",required:`Pipe one valid JSON ${t.toLowerCase()} into stdin.`,why:"Structured mutation input must parse deterministically before any tracker write begins."})}}function ue(e,t){if(!p(e))throw new d(`Mutation ${t+1} must be an object.`,c.USAGE);for(let n of Object.keys(e))if(!R.includes(n))throw y(`mutation ${t+1}`,n,R);return e}function pe(e,t,n){if(e!==void 0){if(!p(e))throw new d(`Mutation ${n+1} options must be an object.`,c.USAGE);for(let r of Object.keys(e))if(!Z[t].includes(r))throw y(`mutation ${n+1} ${t} options`,r,Z[t]);return e}}function fe(e,t){let n=ue(e,t),{op:r,id:o,reason:i}=n;if(r!=="create"&&r!=="update"&&r!=="close"&&r!=="release")throw new d(`Mutation ${t+1} op must be create, update, close, or release.`,c.USAGE);let s=pe(n.options,r,t);if(typeof o!="string"||o.trim().length===0)throw new d(`Mutation ${t+1} requires a non-empty id.`,c.USAGE);let a=o.trim();if(r==="close"){if(typeof i!="string"||i.trim().length===0)throw new d(`Mutation ${t+1} close requires a non-empty reason.`,c.USAGE);return{op:r,id:a,reason:i.trim(),...s===void 0?{}:{options:s}}}if(r==="release")return{op:r,id:a,...s===void 0?{}:{options:s}};if(!p(s))throw new d(`Mutation ${t+1} ${r} requires an options object.`,c.USAGE);return{op:r,id:a,options:s}}function ie(e){let t=M(e,"Mutation batch"),n=Array.isArray(t)?t:p(t)&&Array.isArray(t.mutations)?t.mutations:void 0;if(n===void 0||n.length===0)throw new d("Mutation batch must be a non-empty JSON array or an object with a non-empty mutations array.",c.USAGE);return n.map((r,o)=>{let i=fe(r,o);return i.options!==void 0&&C(i.options),i})}function le(e,t,n){let r=ce.createHash("sha256").update(e).update("\0").update(t).digest("hex"),o=BigInt(`0x${r.slice(0,16)}`).toString(36).padStart(13,"0").slice(-12);return`${v(n)}${o}`}function Q(e,t){if(typeof e!="string"||!e.startsWith("@"))return e;let n=e.slice(1),r=t[n];if(r===void 0)throw new d(`Unknown mutation reference "${e}".`,c.USAGE);return r}function ee(e,t){if(typeof e!="string")return e;let n=e.replace(re,(r,o,i)=>{let s=t[i];if(s===void 0)throw new d(`Unknown mutation reference "@${i}".`,c.USAGE);return`${o}id=${s}`});if(/(^|,)id=@/u.test(n))throw new d(`Malformed mutation reference in dependency "${e}".`,c.USAGE);return n}function me(e){return typeof e!="string"?[]:e.startsWith("@")?[e.slice(1)]:[...e.matchAll(re)].map(t=>t[1]).filter(t=>t!==void 0)}function ye(e){let t=new Map;for(let i of e){if(i.op!=="create"||typeof i.ref!="string")continue;let s=p(i.options)?i.options:{},a=Array.isArray(s.dep)?s.dep:s.dep===void 0?[]:[s.dep];t.set(i.ref,[s.parent,s.blockedBy,...a].flatMap(me))}let n=new Set,r=new Set,o=i=>{if(n.has(i))throw new d(`Mutation reference cycle includes "@${i}".`,c.USAGE);if(!r.has(i)){n.add(i);for(let s of t.get(i))t.has(s)&&o(s);n.delete(i),r.add(i)}};for(let i of t.keys())o(i)}function he(e){let t=M(e,"Mutation document"),n=Array.isArray(t)?{schema_version:1,mutations:t}:t;if(!p(n))throw new d("Mutation document must be a JSON array or object.",c.USAGE);for(let r of Object.keys(n))if(!V.includes(r))throw y("mutation document",r,V);if(n.schema_version!==void 0&&n.schema_version!==1)throw new d("Mutation document schema_version must be 1.",c.USAGE);if(!Array.isArray(n.mutations)||n.mutations.length===0)throw new d("Mutation document requires a non-empty mutations array.",c.USAGE);return n.mutations.map((r,o)=>{if(!p(r))throw new d(`Mutation ${o+1} must be an object.`,c.USAGE);for(let i of Object.keys(r))if(!q.includes(i))throw y(`mutation ${o+1}`,i,q);return{...r}})}function we(e,t){let n=Object.create(null);for(let[r,o]of e.entries())if(o.ref!==void 0){if(o.op!=="create")throw new d(`Mutation ${r+1} ref is only valid for create operations.`,c.USAGE);if(typeof o.ref!="string"||!H.test(o.ref))throw new d(`Mutation ${r+1} ref must match ${H.source}.`,c.USAGE);if(n[o.ref]!==void 0)throw new d(`Duplicate mutation ref "${o.ref}".`,c.USAGE);n[o.ref]=typeof o.id=="string"&&o.id.trim().length>0?G(o.id,t.idPrefix):le(t.transactionId,o.ref,t.idPrefix)}return n}function gt(e,t){let n=he(e),r=we(n,t);ye(n);let o=n.map(a=>{let u={...a},m=typeof u.ref=="string"?u.ref:void 0;if(delete u.ref,m!==void 0?u.id=r[m]:u.id=Q(u.id,r),p(u.options)){let f={...u.options};for(let w of["parent","blockedBy"])f[w]!==void 0&&(f[w]=Q(f[w],r));Array.isArray(f.dep)?f.dep=f.dep.map(w=>ee(w,r)):f.dep!==void 0&&(f.dep=ee(f.dep,r)),u.options=f}return u}),i=ie(JSON.stringify(o)),s=i.filter(a=>a.op==="create").map(a=>a.id);if(new Set(s).size!==s.length)throw new d("Duplicate resolved create id in mutation document.",c.USAGE);return{schema_version:1,mutations:i,references:r}}function se(e,t){return t.filter(n=>e[n]!==void 0&&e[n]!==null).map(n=>{let r=String(e[n]);return`${n}=${/[",\n\r\\]/u.test(r)?JSON.stringify(r):r}`}).join(",")}function _e(e,t,n){if(e!==void 0){if(!Array.isArray(e)||!e.every(p))throw new d(`${n} must be an array of objects.`,c.USAGE);return e.map(r=>se(r,t))}}function Ee(e,t){return e==="tags"&&Array.isArray(t)&&t.every(n=>typeof n=="string")?JSON.stringify(t):typeof t=="number"||typeof t=="boolean"?String(t):t}function te(e,t,n=!1){let r=[["dependencies","dep",["id","kind","created_at","author","source_kind"]],["comments","comment",["text","created_at","author"]],["notes","note",["text","created_at","author"]],["learnings","learning",["text","created_at","author"]],["files","file",["path","scope","note"]],["tests","test",["command","scope","timeout_seconds"]],["docs","doc",["path","scope","note"]],["reminders","reminder",["at","text","created_at"]],["events","event",["start_at","end_at","title","location"]],["type_options","typeOption",["key","value"]]];for(let[o,i,s]of r){let a=t[o],u=_e(n&&["comments","notes","learnings"].includes(o)&&Array.isArray(a)?a.filter(m=>!p(m)||m.created_at===void 0):a,s,o);u!==void 0&&u.length>0&&(e[i]=u)}}function ge(e,t){for(let n of Object.keys(e)){if(t){if(!E.includes(n))throw y("item envelope",n,E);continue}if(!_.has(n)&&g(n,[..._])===void 0&&g(n,E)==="item")throw y("item envelope",n,E)}}function Te(e){let t=Object.hasOwn(e,"item");ge(e,t);let n=t?e.item:e;if(!p(n))throw new d("Item document item must be an object.",c.USAGE);return{item:n,...t&&p(e.linked)?{linked:e.linked}:{}}}function Ae(e,t,n,r){if(!(r==="update"?de:oe).has(t)){if(!_.has(t)){if(g(t,[..._])!==void 0)throw y("item document",t,[..._]);let s=Array.isArray(e.field)?e.field:[];s.push(se({key:t,value:typeof n=="string"?n:JSON.stringify(n)},["key","value"])),e.field=s;return}["dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"].includes(t)||(e[t.replaceAll(/_([a-z])/gu,(i,s)=>s.toUpperCase())]=Ee(t,n))}}function Tt(e,t,n={}){let r=M(e,"Item document");if(!p(r))throw new d("Item document must be a JSON object.",c.USAGE);let{item:o,linked:i}=Te(r),s={};for(let[a,u]of Object.entries(o))Ae(s,a,u,t);return te(s,o,t==="update"),i!==void 0&&te(s,i),{...s,...Object.fromEntries(Object.entries(n).filter(([,a])=>a!==void 0)),stdinJson:void 0}}function At(e){return ie(JSON.stringify(e))}import Se from"node:crypto";import be from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ea10685a-3187-533c-9699-73c23d377705")}catch{}})();function T(e,t){let n={...e,...t};return e===void 0?n:U(e,n)}async function l(e,t){try{let r=(await B(t,{},{pmRoot:e})).item;return{id:r.id,closedAt:r.closed_at,updatedAt:r.updated_at,assignee:r.assignee,claimPrincipal:r.claim_principal}}catch(n){if(n instanceof d&&n.exitCode===c.NOT_FOUND)return;throw n}}function I(e,t){let n=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_"),r=Se.createHash("sha256").update(N(e)).digest("hex").slice(0,12);return`${t+1}-${e.op}-${n}-${r}`}function Re(e,t){let n=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_");return`${t+1}-${e.op}-${n}`}function h(e,t,n){return`bulk-item-transaction ${e} ${t} ${n}`}async function A(e,t,n,r){let o=await D(be.join(e,"history",`${t}.jsonl`),t),i=h(n,r,"apply"),s=h(n,r,"compensate");for(let a=o.length-1;a>=0;a-=1){let u=o[a].message;if(u===i)return!0;if(u===s)return!1}return!1}async function O(e,t){let n=await l(e,t.id);if(n?.updatedAt===void 0)throw new d(`Bulk ${t.op} target ${t.id} does not exist or has no restorable version`,c.NOT_FOUND);return{target_updated_at:n.updatedAt}}async function S(e,t,n,r){let o=r!==null&&typeof r=="object"&&!Array.isArray(r)?r.target_updated_at:void 0;typeof o=="string"&&await l(e.pmRoot,t)!==void 0&&await Y(t,o,{force:!0,author:e.author,message:h(e.transactionId,n,"compensate")},{pmRoot:e.pmRoot})}function ae(e,t,n){return{id:n,async inspect(){let r=await l(e.pmRoot,t.id);return r===void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"create"}}},async apply(){let o=(await L(T(t.options,{author:e.author,id:t.id}),{pmRoot:e.pmRoot})).item;return{id:String(o.id),op:"create"}},async compensate(){let r=await l(e.pmRoot,t.id);if(r!==void 0){if(e.createCompensation==="delete"){await W(t.id,{force:!0,author:e.author,message:`Compensate interrupted bulk transaction ${e.transactionId}`},{pmRoot:e.pmRoot});return}r.closedAt===void 0&&await b(t.id,`Compensated: interrupted bulk transaction ${e.transactionId}`,{force:!0,author:e.author},{pmRoot:e.pmRoot})}}}}function Me(e,t,n){return{id:n,async inspect(){let r=await l(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await A(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"update"}}:{state:"pending"}},async prepareCompensation(){return O(e.pmRoot,t)},async apply(){let o=(await F(t.id,T(t.options,{author:e.author,message:h(e.transactionId,n,"apply")}),{pmRoot:e.pmRoot})).item;return{id:String(o.id),op:"update"}},async compensate(r){await S(e,t.id,n,r)}}}function Ie(e,t,n){return{id:n,async inspect(){let r=await l(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await A(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"close"}}:r.closedAt===void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"close"}}},async prepareCompensation(){return O(e.pmRoot,t)},async apply(){let o=(await b(t.id,t.reason,T(t.options,{author:e.author,message:h(e.transactionId,n,"apply")}),{pmRoot:e.pmRoot})).item;return{id:String(o.id),op:"close"}},async compensate(r){await S(e,t.id,n,r)}}}function Oe(e,t,n){return{id:n,async inspect(){let r=await l(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await A(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"release"}}:r.assignee!==void 0||r.claimPrincipal!==void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"release"}}},async prepareCompensation(){return O(e.pmRoot,t)},async apply(){let o=(await J(t.id,T(t.options,{author:e.author,message:h(e.transactionId,n,"apply")}),{pmRoot:e.pmRoot})).item;return{id:String(o.id),op:"release"}},async compensate(r){await S(e,t.id,n,r)}}}function ke(e,t,n){let r=I(t,n);switch(t.op){case"create":return ae(e,t,r);case"update":return Me(e,t,r);case"close":return Ie(e,t,r);case"release":return Oe(e,t,r)}}function $e(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`Bulk mutation ${t+1} must be an object`);if(!["create","update","close","release"].includes(e.op))throw new TypeError(`Bulk mutation ${t+1} op must be create, update, close, or release`);if(typeof e.id!="string"||e.id.trim().length===0)throw new TypeError(`Bulk mutation ${t+1} requires a non-empty id`);if(e.op==="close"&&(typeof e.reason!="string"||e.reason.trim().length===0))throw new TypeError(`Bulk close mutation ${t+1} requires a non-empty reason`)}async function Ne(e){let t=[...e.mutations];if(t.length===0)throw new TypeError("Bulk item transaction requires at least one mutation");for(let[s,a]of t.entries())$e(a,s);let n=e.createCompensation??"close";if(!["close","delete"].includes(n))throw new TypeError("Bulk item transaction createCompensation must be close or delete");let r={pmRoot:e.pmRoot,author:e.author,transactionId:e.transactionId,createCompensation:n},o=await K({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,steps:t.map((s,a)=>ke(r,s,a)),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}}),i={};for(let[s,a]of t.entries()){let u=I(a,s),m=o.results[u];i[Re(a,s)]=m}return{transactionId:o.transactionId,status:"committed",recovered:o.recovered,results:i}}function Ce(e){let t=[];return e.evidence!==void 0&&Object.keys(e.evidence).length>0&&t.push({op:"update",id:e.id,options:e.evidence}),t.push({op:"close",id:e.id,reason:e.reason,...e.closeOptions===void 0?{}:{options:e.closeOptions}},{op:"release",id:e.id,...e.releaseOptions===void 0?{}:{options:e.releaseOptions}}),t}function Ut(e){return Ne({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,mutations:Ce(e),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}})}var Dt={buildCreateStep:ae,bulkHistoryMarker:h,compensateByRestore:S,deriveStepId:I,isUpdateMarkerApplied:A,readItemSnapshot:l};export{Et as a,ie as b,gt as c,Tt as d,At as e,Ne as f,Ce as g,Ut as h,Dt as i};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{$b as F,_b as L,bc as b,ec as J,fb as B,gc as W,hc as Y}from"./chunk-FZ4Z2J4F.js";import{b as K}from"./chunk-TAG4VC22.js";import{$j as j,Ae as D,Al as x,C as c,E as d,Gl as z,Pb as N,ba as $,ck as P,id as C,kd as U,r as k,wh as v,yh as G}from"./chunk-NOPL37X4.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0a17e896-d54a-5796-8be3-535179c4d6e0")}catch{}})();import ce from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3f348972-0c8f-52da-abeb-46690df967d8")}catch{}})();var R=["op","id","reason","options"],q=[...R,"ref"],V=["schema_version","mutations"],ne="[a-z][a-z0-9._-]{0,63}",H=new RegExp(`^${ne}$`,"u"),re=new RegExp(`(^|,)id=@(${ne})(?=,|$)`,"gu"),X=e=>e.slice(2).replaceAll(/-([a-z])/gu,(t,n)=>n.toUpperCase()),E=["item","linked","schedule","claim_state","children","omission_receipt","row_contract","context_intent"],oe=new Set(["created_at","updated_at","closed_at","version","format_version","path","author","collection_counts","notes_count","tests_count"]),de=new Set([...oe,"completed_at","id"]),_=new Set(["id","title","description","type","status","priority","tags","body","deadline","estimated_minutes","acceptance_criteria","definition_of_ready","order","rank","assignee",...k,"affected_version","fixed_version","component","regression","customer_impact","close_reason","completed_at","dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"]),Z={create:j.map(e=>e.target),update:P.map(e=>e.target),close:x.map(e=>X(e.flag)).filter(e=>e!=="reason"),release:z.map(e=>X(e.flag))};function Et(e){let t={},n=e.createCompensation;if(n!==void 0){if(n!=="close"&&n!=="delete")throw new d("createCompensation must be close or delete.",c.USAGE);t.createCompensation=n}for(let r of["lockTtlSeconds","lockWaitMs"]){let o=e[r];if(o===void 0)continue;let i=typeof o=="number"||typeof o=="string"&&o.trim().length>0?Number(o):Number.NaN;if(!Number.isSafeInteger(i)||i<=0)throw new d(`${r} must be a positive safe integer.`,c.USAGE);t[r]=i}return t}function p(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function g(e,t){let n=Math.max(1,Math.min(3,Math.floor(e.length/4)+1)),r;for(let o of t){let i=$(e,o,n);i!==null&&(r===void 0||i<r.distance)&&(r={key:o,distance:i})}return r?.key}function y(e,t,n){let r=g(t,n);return new d(r===void 0?`${e} does not recognize key "${t}". Allowed keys: ${n.join(", ")}.`:`${e} does not recognize key "${t}". Did you mean "${r}"?`,c.USAGE,{code:"stdin_json_unknown_key",required:`Use documented ${e} keys only.`,why:"Strict structured input prevents silent typos from creating incomplete or unintended mutations.",nextSteps:[r===void 0?`Remove or correct "${t}".`:`Replace "${t}" with "${r}".`]})}function M(e,t){try{return JSON.parse(e)}catch(n){let r=n instanceof Error?n.message:String(n);throw new d(`${t} must be valid JSON: ${r}`,c.USAGE,{code:"stdin_json_invalid",required:`Pipe one valid JSON ${t.toLowerCase()} into stdin.`,why:"Structured mutation input must parse deterministically before any tracker write begins."})}}function ue(e,t){if(!p(e))throw new d(`Mutation ${t+1} must be an object.`,c.USAGE);for(let n of Object.keys(e))if(!R.includes(n))throw y(`mutation ${t+1}`,n,R);return e}function pe(e,t,n){if(e!==void 0){if(!p(e))throw new d(`Mutation ${n+1} options must be an object.`,c.USAGE);for(let r of Object.keys(e))if(!Z[t].includes(r))throw y(`mutation ${n+1} ${t} options`,r,Z[t]);return e}}function fe(e,t){let n=ue(e,t),{op:r,id:o,reason:i}=n;if(r!=="create"&&r!=="update"&&r!=="close"&&r!=="release")throw new d(`Mutation ${t+1} op must be create, update, close, or release.`,c.USAGE);let s=pe(n.options,r,t);if(typeof o!="string"||o.trim().length===0)throw new d(`Mutation ${t+1} requires a non-empty id.`,c.USAGE);let a=o.trim();if(r==="close"){if(typeof i!="string"||i.trim().length===0)throw new d(`Mutation ${t+1} close requires a non-empty reason.`,c.USAGE);return{op:r,id:a,reason:i.trim(),...s===void 0?{}:{options:s}}}if(r==="release")return{op:r,id:a,...s===void 0?{}:{options:s}};if(!p(s))throw new d(`Mutation ${t+1} ${r} requires an options object.`,c.USAGE);return{op:r,id:a,options:s}}function ie(e){let t=M(e,"Mutation batch"),n=Array.isArray(t)?t:p(t)&&Array.isArray(t.mutations)?t.mutations:void 0;if(n===void 0||n.length===0)throw new d("Mutation batch must be a non-empty JSON array or an object with a non-empty mutations array.",c.USAGE);return n.map((r,o)=>{let i=fe(r,o);return i.options!==void 0&&C(i.options),i})}function le(e,t,n){let r=ce.createHash("sha256").update(e).update("\0").update(t).digest("hex"),o=BigInt(`0x${r.slice(0,16)}`).toString(36).padStart(13,"0").slice(-12);return`${v(n)}${o}`}function Q(e,t){if(typeof e!="string"||!e.startsWith("@"))return e;let n=e.slice(1),r=t[n];if(r===void 0)throw new d(`Unknown mutation reference "${e}".`,c.USAGE);return r}function ee(e,t){if(typeof e!="string")return e;let n=e.replace(re,(r,o,i)=>{let s=t[i];if(s===void 0)throw new d(`Unknown mutation reference "@${i}".`,c.USAGE);return`${o}id=${s}`});if(/(^|,)id=@/u.test(n))throw new d(`Malformed mutation reference in dependency "${e}".`,c.USAGE);return n}function me(e){return typeof e!="string"?[]:e.startsWith("@")?[e.slice(1)]:[...e.matchAll(re)].map(t=>t[1]).filter(t=>t!==void 0)}function ye(e){let t=new Map;for(let i of e){if(i.op!=="create"||typeof i.ref!="string")continue;let s=p(i.options)?i.options:{},a=Array.isArray(s.dep)?s.dep:s.dep===void 0?[]:[s.dep];t.set(i.ref,[s.parent,s.blockedBy,...a].flatMap(me))}let n=new Set,r=new Set,o=i=>{if(n.has(i))throw new d(`Mutation reference cycle includes "@${i}".`,c.USAGE);if(!r.has(i)){n.add(i);for(let s of t.get(i))t.has(s)&&o(s);n.delete(i),r.add(i)}};for(let i of t.keys())o(i)}function he(e){let t=M(e,"Mutation document"),n=Array.isArray(t)?{schema_version:1,mutations:t}:t;if(!p(n))throw new d("Mutation document must be a JSON array or object.",c.USAGE);for(let r of Object.keys(n))if(!V.includes(r))throw y("mutation document",r,V);if(n.schema_version!==void 0&&n.schema_version!==1)throw new d("Mutation document schema_version must be 1.",c.USAGE);if(!Array.isArray(n.mutations)||n.mutations.length===0)throw new d("Mutation document requires a non-empty mutations array.",c.USAGE);return n.mutations.map((r,o)=>{if(!p(r))throw new d(`Mutation ${o+1} must be an object.`,c.USAGE);for(let i of Object.keys(r))if(!q.includes(i))throw y(`mutation ${o+1}`,i,q);return{...r}})}function we(e,t){let n=Object.create(null);for(let[r,o]of e.entries())if(o.ref!==void 0){if(o.op!=="create")throw new d(`Mutation ${r+1} ref is only valid for create operations.`,c.USAGE);if(typeof o.ref!="string"||!H.test(o.ref))throw new d(`Mutation ${r+1} ref must match ${H.source}.`,c.USAGE);if(n[o.ref]!==void 0)throw new d(`Duplicate mutation ref "${o.ref}".`,c.USAGE);n[o.ref]=typeof o.id=="string"&&o.id.trim().length>0?G(o.id,t.idPrefix):le(t.transactionId,o.ref,t.idPrefix)}return n}function gt(e,t){let n=he(e),r=we(n,t);ye(n);let o=n.map(a=>{let u={...a},m=typeof u.ref=="string"?u.ref:void 0;if(delete u.ref,m!==void 0?u.id=r[m]:u.id=Q(u.id,r),p(u.options)){let f={...u.options};for(let w of["parent","blockedBy"])f[w]!==void 0&&(f[w]=Q(f[w],r));Array.isArray(f.dep)?f.dep=f.dep.map(w=>ee(w,r)):f.dep!==void 0&&(f.dep=ee(f.dep,r)),u.options=f}return u}),i=ie(JSON.stringify(o)),s=i.filter(a=>a.op==="create").map(a=>a.id);if(new Set(s).size!==s.length)throw new d("Duplicate resolved create id in mutation document.",c.USAGE);return{schema_version:1,mutations:i,references:r}}function se(e,t){return t.filter(n=>e[n]!==void 0&&e[n]!==null).map(n=>{let r=String(e[n]);return`${n}=${/[",\n\r\\]/u.test(r)?JSON.stringify(r):r}`}).join(",")}function _e(e,t,n){if(e!==void 0){if(!Array.isArray(e)||!e.every(p))throw new d(`${n} must be an array of objects.`,c.USAGE);return e.map(r=>se(r,t))}}function Ee(e,t){return e==="tags"&&Array.isArray(t)&&t.every(n=>typeof n=="string")?JSON.stringify(t):typeof t=="number"||typeof t=="boolean"?String(t):t}function te(e,t,n=!1){let r=[["dependencies","dep",["id","kind","created_at","author","source_kind"]],["comments","comment",["text","created_at","author"]],["notes","note",["text","created_at","author"]],["learnings","learning",["text","created_at","author"]],["files","file",["path","scope","note"]],["tests","test",["command","scope","timeout_seconds"]],["docs","doc",["path","scope","note"]],["reminders","reminder",["at","text","created_at"]],["events","event",["start_at","end_at","title","location"]],["type_options","typeOption",["key","value"]]];for(let[o,i,s]of r){let a=t[o],u=_e(n&&["comments","notes","learnings"].includes(o)&&Array.isArray(a)?a.filter(m=>!p(m)||m.created_at===void 0):a,s,o);u!==void 0&&u.length>0&&(e[i]=u)}}function ge(e,t){for(let n of Object.keys(e)){if(t){if(!E.includes(n))throw y("item envelope",n,E);continue}if(!_.has(n)&&g(n,[..._])===void 0&&g(n,E)==="item")throw y("item envelope",n,E)}}function Te(e){let t=Object.hasOwn(e,"item");ge(e,t);let n=t?e.item:e;if(!p(n))throw new d("Item document item must be an object.",c.USAGE);return{item:n,...t&&p(e.linked)?{linked:e.linked}:{}}}function Ae(e,t,n,r){if(!(r==="update"?de:oe).has(t)){if(!_.has(t)){if(g(t,[..._])!==void 0)throw y("item document",t,[..._]);let s=Array.isArray(e.field)?e.field:[];s.push(se({key:t,value:typeof n=="string"?n:JSON.stringify(n)},["key","value"])),e.field=s;return}["dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"].includes(t)||(e[t.replaceAll(/_([a-z])/gu,(i,s)=>s.toUpperCase())]=Ee(t,n))}}function Tt(e,t,n={}){let r=M(e,"Item document");if(!p(r))throw new d("Item document must be a JSON object.",c.USAGE);let{item:o,linked:i}=Te(r),s={};for(let[a,u]of Object.entries(o))Ae(s,a,u,t);return te(s,o,t==="update"),i!==void 0&&te(s,i),{...s,...Object.fromEntries(Object.entries(n).filter(([,a])=>a!==void 0)),stdinJson:void 0}}function At(e){return ie(JSON.stringify(e))}import Se from"node:crypto";import be from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ea10685a-3187-533c-9699-73c23d377705")}catch{}})();function T(e,t){let n={...e,...t};return e===void 0?n:U(e,n)}async function l(e,t){try{let r=(await B(t,{},{pmRoot:e})).item;return{id:r.id,closedAt:r.closed_at,updatedAt:r.updated_at,assignee:r.assignee,claimPrincipal:r.claim_principal}}catch(n){if(n instanceof d&&n.exitCode===c.NOT_FOUND)return;throw n}}function I(e,t){let n=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_"),r=Se.createHash("sha256").update(N(e)).digest("hex").slice(0,12);return`${t+1}-${e.op}-${n}-${r}`}function Re(e,t){let n=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_");return`${t+1}-${e.op}-${n}`}function h(e,t,n){return`bulk-item-transaction ${e} ${t} ${n}`}async function A(e,t,n,r){let o=await D(be.join(e,"history",`${t}.jsonl`),t),i=h(n,r,"apply"),s=h(n,r,"compensate");for(let a=o.length-1;a>=0;a-=1){let u=o[a].message;if(u===i)return!0;if(u===s)return!1}return!1}async function O(e,t){let n=await l(e,t.id);if(n?.updatedAt===void 0)throw new d(`Bulk ${t.op} target ${t.id} does not exist or has no restorable version`,c.NOT_FOUND);return{target_updated_at:n.updatedAt}}async function S(e,t,n,r){let o=r!==null&&typeof r=="object"&&!Array.isArray(r)?r.target_updated_at:void 0;typeof o=="string"&&await l(e.pmRoot,t)!==void 0&&await Y(t,o,{force:!0,author:e.author,message:h(e.transactionId,n,"compensate")},{pmRoot:e.pmRoot})}function ae(e,t,n){return{id:n,async inspect(){let r=await l(e.pmRoot,t.id);return r===void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"create"}}},async apply(){let o=(await L(T(t.options,{author:e.author,id:t.id}),{pmRoot:e.pmRoot})).item;return{id:String(o.id),op:"create"}},async compensate(){let r=await l(e.pmRoot,t.id);if(r!==void 0){if(e.createCompensation==="delete"){await W(t.id,{force:!0,author:e.author,message:`Compensate interrupted bulk transaction ${e.transactionId}`},{pmRoot:e.pmRoot});return}r.closedAt===void 0&&await b(t.id,`Compensated: interrupted bulk transaction ${e.transactionId}`,{force:!0,author:e.author},{pmRoot:e.pmRoot})}}}}function Me(e,t,n){return{id:n,async inspect(){let r=await l(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await A(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"update"}}:{state:"pending"}},async prepareCompensation(){return O(e.pmRoot,t)},async apply(){let o=(await F(t.id,T(t.options,{author:e.author,message:h(e.transactionId,n,"apply")}),{pmRoot:e.pmRoot})).item;return{id:String(o.id),op:"update"}},async compensate(r){await S(e,t.id,n,r)}}}function Ie(e,t,n){return{id:n,async inspect(){let r=await l(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await A(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"close"}}:r.closedAt===void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"close"}}},async prepareCompensation(){return O(e.pmRoot,t)},async apply(){let o=(await b(t.id,t.reason,T(t.options,{author:e.author,message:h(e.transactionId,n,"apply")}),{pmRoot:e.pmRoot})).item;return{id:String(o.id),op:"close"}},async compensate(r){await S(e,t.id,n,r)}}}function Oe(e,t,n){return{id:n,async inspect(){let r=await l(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await A(e.pmRoot,r.id,e.transactionId,n)?{state:"applied",result:{id:r.id,op:"release"}}:r.assignee!==void 0||r.claimPrincipal!==void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"release"}}},async prepareCompensation(){return O(e.pmRoot,t)},async apply(){let o=(await J(t.id,T(t.options,{author:e.author,message:h(e.transactionId,n,"apply")}),{pmRoot:e.pmRoot})).item;return{id:String(o.id),op:"release"}},async compensate(r){await S(e,t.id,n,r)}}}function ke(e,t,n){let r=I(t,n);switch(t.op){case"create":return ae(e,t,r);case"update":return Me(e,t,r);case"close":return Ie(e,t,r);case"release":return Oe(e,t,r)}}function $e(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`Bulk mutation ${t+1} must be an object`);if(!["create","update","close","release"].includes(e.op))throw new TypeError(`Bulk mutation ${t+1} op must be create, update, close, or release`);if(typeof e.id!="string"||e.id.trim().length===0)throw new TypeError(`Bulk mutation ${t+1} requires a non-empty id`);if(e.op==="close"&&(typeof e.reason!="string"||e.reason.trim().length===0))throw new TypeError(`Bulk close mutation ${t+1} requires a non-empty reason`)}async function Ne(e){let t=[...e.mutations];if(t.length===0)throw new TypeError("Bulk item transaction requires at least one mutation");for(let[s,a]of t.entries())$e(a,s);let n=e.createCompensation??"close";if(!["close","delete"].includes(n))throw new TypeError("Bulk item transaction createCompensation must be close or delete");let r={pmRoot:e.pmRoot,author:e.author,transactionId:e.transactionId,createCompensation:n},o=await K({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,steps:t.map((s,a)=>ke(r,s,a)),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}}),i={};for(let[s,a]of t.entries()){let u=I(a,s),m=o.results[u];i[Re(a,s)]=m}return{transactionId:o.transactionId,status:"committed",recovered:o.recovered,results:i}}function Ce(e){let t=[];return e.evidence!==void 0&&Object.keys(e.evidence).length>0&&t.push({op:"update",id:e.id,options:e.evidence}),t.push({op:"close",id:e.id,reason:e.reason,...e.closeOptions===void 0?{}:{options:e.closeOptions}},{op:"release",id:e.id,...e.releaseOptions===void 0?{}:{options:e.releaseOptions}}),t}function Ut(e){return Ne({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,mutations:Ce(e),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}})}var Dt={buildCreateStep:ae,bulkHistoryMarker:h,compensateByRestore:S,deriveStepId:I,isUpdateMarkerApplied:A,readItemSnapshot:l};export{Et as a,ie as b,gt as c,Tt as d,At as e,Ne as f,Ce as g,Ut as h,Dt as i};
|
|
2
|
+
//# sourceMappingURL=chunk-T6H5BZCP.js.map
|