primcli 3.0.0-preview.2 → 3.0.0-preview.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -40
- package/bin/run.js +21 -2
- package/dist/api-command-Bab30eNp.js +61097 -0
- package/dist/cli-command-names-BYbYdipl.js +320 -0
- package/dist/help-inputs-NGARVZL_.js +109 -0
- package/dist/{json-output-BzSBR-KX.js → json-output-xgN0ZLWP.js} +31 -6
- package/dist/{listen-background-C0F9gNDD.js → listen-background-DyBYca28.js} +323 -36
- package/dist/{machine-session-g-xPd3X0.js → machine-session-cfgMKQ_U.js} +8 -8
- package/dist/{notify-session-Bo8WgG3q.js → notify-session-BRK9_xSb.js} +71 -32
- package/dist/oclif/auto-signal-worker.js +3 -3
- package/dist/oclif/auto-signals.js +1 -1
- package/dist/oclif/command-not-found.js +132 -0
- package/dist/oclif/command-stdin.js +9 -0
- package/dist/oclif/help.js +70 -13
- package/dist/oclif/index.js +3236 -104541
- package/dist/oclif/listen-supervisor.js +1 -1
- package/dist/oclif/proxy-auto-detect.js +1 -1
- package/dist/oclif/receiver-heal.js +4 -3
- package/dist/oclif/root-signup-hint.js +15 -15
- package/dist/receiver.d.ts +1 -1
- package/dist/{repeats-Dj_o6c-X-BzXj5ICh.js → repeats-Dj_o6c-X-CraZzs4t.js} +14615 -13905
- package/dist/retry-ids-04ZPJCZY.js +59 -0
- package/dist/{scoped-chat-TJlyUTi7.js → scoped-chat-YucNhX6U.js} +1 -1
- package/dist/{signal-command-BO93dM2Q.js → signal-command-AOnn_Him.js} +12 -6
- package/dist/skills/primitive-connect/references/contact-requests.md +4 -4
- package/dist/skills/primitive-connect/references/contacts.md +1 -1
- package/dist/skills/primitive-connect.json +4 -4
- package/man/primitive.1 +31 -15
- package/package.json +30 -14
- package/dist/api-command-B37DPKFA.js +0 -3634
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
// src/oclif/cli-command-names.ts
|
|
2
|
+
/** Canonical executable names. API operation identifiers stay unchanged. */
|
|
3
|
+
const COMMAND_RENAMES = {
|
|
4
|
+
"account:get-account": "account:get",
|
|
5
|
+
"account:get-storage-stats": "account:storage",
|
|
6
|
+
"account:get-webhook-secret": "account:webhook-secret",
|
|
7
|
+
"account:leave-organization": "roles-and-members:leave",
|
|
8
|
+
"account:show": "account:get",
|
|
9
|
+
"account:update-account": "account:update",
|
|
10
|
+
"activity:list-activity-objects": "activity:list",
|
|
11
|
+
"address-notes:delete-address-note": "address-notes:delete",
|
|
12
|
+
"address-notes:get-address-note": "address-notes:get",
|
|
13
|
+
"address-notes:get-public-address-note": "address-notes:get-public",
|
|
14
|
+
"address-notes:list-address-notes": "address-notes:list",
|
|
15
|
+
"address-notes:list-address-notes-batch": "address-notes:list-batch",
|
|
16
|
+
"address-notes:list-public-address-notes": "address-notes:list-public",
|
|
17
|
+
"address-notes:put-address-note": "address-notes:set",
|
|
18
|
+
"agent-connections:agent-connection-setup": "agent-connections:setup",
|
|
19
|
+
"agent-connections:agent-connection-trusted-origins": "agent-connections:trusted-origins",
|
|
20
|
+
"agent-connections:claim-agent-connection": "agent:connect",
|
|
21
|
+
"agent-connections:create-agent-connection": "agent-connections:create",
|
|
22
|
+
"agent-connections:get-agent-connection-settings": "agent-connections:get-settings",
|
|
23
|
+
"agent-connections:get-own-agent-connection": "agent-connections:get-own",
|
|
24
|
+
"agent-connections:invite-agent-connection": "agent-connections:invite",
|
|
25
|
+
"agent-connections:list-agent-connections": "agent-connections:list",
|
|
26
|
+
"agent-connections:remove-agent-connection": "agent-connections:delete",
|
|
27
|
+
"agent-connections:rename-agent-connection": "agent-connections:rename",
|
|
28
|
+
"agent-connections:revoke-agent-connection": "agent-connections:revoke",
|
|
29
|
+
"agent-connections:set-agent-connection-visibility": "agent-connections:set-visibility",
|
|
30
|
+
"agent-connections:update-agent-connection-settings": "agent-connections:update-settings",
|
|
31
|
+
"agent-networks:add-default-network-member": "agent-networks:add-member",
|
|
32
|
+
"agent-networks:check-default-network-contact-admission": "agent-networks:check-contact-admission",
|
|
33
|
+
"agent-networks:get-default-network-agent": "agent-networks:get-agent",
|
|
34
|
+
"agent-networks:list-agent-networks": "agent-networks:list",
|
|
35
|
+
"agent-networks:list-default-network-agents": "agent-networks:list-agents",
|
|
36
|
+
"agent-networks:list-default-network-members": "agent-networks:list-members",
|
|
37
|
+
"agent-networks:remove-default-network-member": "agent-networks:delete-member",
|
|
38
|
+
"agent-networks:update-default-network-member": "agent-networks:update-member",
|
|
39
|
+
"agent-work:agent-work-agree-deadline": "agent-work:agree-deadline",
|
|
40
|
+
"agent-work:agent-work-create": "agent-work:create",
|
|
41
|
+
"agent-work:agent-work-get": "agent-work:get",
|
|
42
|
+
"agent-work:agent-work-list": "agent-work:list",
|
|
43
|
+
"agent-work:agent-work-manage-state": "agent-work:manage-state",
|
|
44
|
+
"agent-work:agent-work-propose-deadline": "agent-work:propose-deadline",
|
|
45
|
+
"agent-work:agent-work-report-status": "agent-work:report-status",
|
|
46
|
+
"agent-work:agent-work-withdraw-deadline": "agent-work:withdraw-deadline",
|
|
47
|
+
"agent:contacts:add": "agent:contacts:create",
|
|
48
|
+
"agent:contacts:remove": "agent:contacts:delete",
|
|
49
|
+
"agent:create-agent-account": "agent:create",
|
|
50
|
+
"agent:create-agent-claim-link": "agent:claim-link",
|
|
51
|
+
"agent:resend-agent-signup-verification": "agent:resend-signup",
|
|
52
|
+
"agent:start-agent-claim": "agent:claim",
|
|
53
|
+
"agent:start-agent-signup": "agent:start-signup",
|
|
54
|
+
"agent:verify-agent-claim": "agent:claim-verify",
|
|
55
|
+
"agent:verify-agent-signup": "agent:verify-signup",
|
|
56
|
+
"changes:list-changes": "changes:list",
|
|
57
|
+
"cli:cli-logout": "cli:logout",
|
|
58
|
+
"cli:list-cli-orgs": "org:list",
|
|
59
|
+
"cli:poll-cli-login": "cli:poll-login",
|
|
60
|
+
"cli:resend-cli-signup-verification": "cli:resend-signup",
|
|
61
|
+
"cli:start-cli-login": "cli:start-login",
|
|
62
|
+
"cli:start-cli-signup": "cli:start-signup",
|
|
63
|
+
"cli:verify-cli-signup": "cli:verify-signup",
|
|
64
|
+
"contacts:add": "contacts:create",
|
|
65
|
+
"contacts:delete-agent-contact": "contacts:delete-for-agent",
|
|
66
|
+
"contacts:get-agent-contact-policy": "contacts:get-agent-policy",
|
|
67
|
+
"contacts:get-contact-policy": "contacts:get-policy",
|
|
68
|
+
"contacts:list-agent-contacts": "contacts:list-for-agent",
|
|
69
|
+
"contacts:prepare-contact-acceptance": "contacts:prepare-acceptance",
|
|
70
|
+
"contacts:prepare-contact-request": "contacts:prepare-request",
|
|
71
|
+
"contacts:put-agent-contact": "contacts:set-for-agent",
|
|
72
|
+
"contacts:put-agent-contact-policy": "contacts:set-agent-policy",
|
|
73
|
+
"contacts:put-contact": "contacts:set",
|
|
74
|
+
"contacts:put-contact-policy": "contacts:set-policy",
|
|
75
|
+
"contacts:remove": "contacts:delete",
|
|
76
|
+
"credentials:get-credential-policy": "credentials:get-policy",
|
|
77
|
+
"credentials:get-key-builder": "credentials:key-builder",
|
|
78
|
+
"credentials:get-key-suggestion": "credentials:key-suggestion",
|
|
79
|
+
"credentials:list-credential-events": "credentials:list-events",
|
|
80
|
+
"credentials:list-credentials": "credentials:list",
|
|
81
|
+
"credentials:revoke-all-credentials": "credentials:revoke-all",
|
|
82
|
+
"credentials:update-credential-policy": "credentials:update-policy",
|
|
83
|
+
"credits:redeem-credit-code": "credits:redeem",
|
|
84
|
+
"domains:add": "domains:create",
|
|
85
|
+
"domains:add-domain": "domains:create",
|
|
86
|
+
"domains:check-domain-dns": "domains:check-dns",
|
|
87
|
+
"domains:check-vanity-inbox-name": "domains:check-vanity-name",
|
|
88
|
+
"domains:claim-vanity-inbox-name": "domains:claim-vanity-name",
|
|
89
|
+
"domains:delete-domain": "domains:delete",
|
|
90
|
+
"domains:download-domain-zone-file": "domains:zone-file",
|
|
91
|
+
"domains:get-domain-agent-authorization": "domains:get-agent-authorization",
|
|
92
|
+
"domains:list-domains": "domains:list",
|
|
93
|
+
"domains:update-domain": "domains:update",
|
|
94
|
+
"domains:verify-domain": "domains:verify",
|
|
95
|
+
"email-rule-oversight:accept-email-rule-objection": "email-rule-oversight:accept-objection",
|
|
96
|
+
"email-rule-oversight:amend-email-rule-objection": "email-rule-oversight:amend-objection",
|
|
97
|
+
"email-rule-oversight:create-email-rule-objection": "email-rule-oversight:create-objection",
|
|
98
|
+
"email-rule-oversight:decline-email-rule-objection": "email-rule-oversight:decline-objection",
|
|
99
|
+
"email-rule-oversight:get-email-rule-covering-me": "email-rule-oversight:get-covering-me",
|
|
100
|
+
"email-rule-oversight:get-email-rule-objection": "email-rule-oversight:get-objection",
|
|
101
|
+
"email-rule-oversight:list-email-rule-decisions-on-my-mail": "email-rule-oversight:list-decisions-on-my-mail",
|
|
102
|
+
"email-rule-oversight:list-email-rule-objections": "email-rule-oversight:list-objections",
|
|
103
|
+
"email-rule-oversight:list-email-rule-versions-covering-me": "email-rule-oversight:list-versions-covering-me",
|
|
104
|
+
"email-rule-oversight:list-email-rules-covering-me": "email-rule-oversight:list-covering-me",
|
|
105
|
+
"email-rule-oversight:withdraw-email-rule-objection": "email-rule-oversight:withdraw-objection",
|
|
106
|
+
"email-rules:accept-email-rule-request": "email-rules:accept-request",
|
|
107
|
+
"email-rules:check-email-rule-request-target": "email-rules:check-request-target",
|
|
108
|
+
"email-rules:compile-email-rule": "email-rules:compile",
|
|
109
|
+
"email-rules:create-email-rule": "email-rules:create",
|
|
110
|
+
"email-rules:create-email-rule-request": "email-rules:create-request",
|
|
111
|
+
"email-rules:decline-email-rule-request": "email-rules:decline-request",
|
|
112
|
+
"email-rules:delete-email-rule": "email-rules:delete",
|
|
113
|
+
"email-rules:delete-email-rule-request": "email-rules:delete-request",
|
|
114
|
+
"email-rules:end-email-rule-share": "email-rules:end-share",
|
|
115
|
+
"email-rules:get-email-rule": "email-rules:get",
|
|
116
|
+
"email-rules:get-email-rule-request": "email-rules:get-request",
|
|
117
|
+
"email-rules:get-email-rule-scope": "email-rules:get-scope",
|
|
118
|
+
"email-rules:get-email-rule-share": "email-rules:get-share",
|
|
119
|
+
"email-rules:get-email-rule-vocabulary": "email-rules:vocabulary",
|
|
120
|
+
"email-rules:list-email-rule-decisions": "email-rules:list-decisions",
|
|
121
|
+
"email-rules:list-email-rule-requests": "email-rules:list-requests",
|
|
122
|
+
"email-rules:list-email-rule-results": "email-rules:list-results",
|
|
123
|
+
"email-rules:list-email-rule-scope-options": "email-rules:list-scope-options",
|
|
124
|
+
"email-rules:list-email-rule-share-emails": "email-rules:list-share-emails",
|
|
125
|
+
"email-rules:list-email-rule-shares": "email-rules:list-shares",
|
|
126
|
+
"email-rules:list-email-rule-versions": "email-rules:list-versions",
|
|
127
|
+
"email-rules:list-email-rules": "email-rules:list",
|
|
128
|
+
"email-rules:list-given-email-rule-shares": "email-rules:list-given-shares",
|
|
129
|
+
"email-rules:test-email-rule": "email-rules:test",
|
|
130
|
+
"email-rules:test-email-rule-on-sample": "email-rules:test-sample",
|
|
131
|
+
"email-rules:update-email-rule": "email-rules:update",
|
|
132
|
+
"email-rules:withdraw-email-rule-request": "email-rules:withdraw-request",
|
|
133
|
+
"emails:delete-email": "emails:delete",
|
|
134
|
+
"emails:discard-email-content": "emails:discard-content",
|
|
135
|
+
"emails:download-email-attachment-archive-member": "emails:download-attachment-archive-member",
|
|
136
|
+
"emails:download-email-attachment-by-filename": "emails:download-attachment-by-filename",
|
|
137
|
+
"emails:download-email-attachment-part": "emails:download-attachment-part",
|
|
138
|
+
"emails:download-raw-email": "emails:download-raw",
|
|
139
|
+
"emails:get-conversation": "emails:conversation",
|
|
140
|
+
"emails:get-email": "emails:get",
|
|
141
|
+
"emails:get-email-readable": "emails:get-readable",
|
|
142
|
+
"emails:list-email-attachment-archive-members": "emails:list-attachment-archive-members",
|
|
143
|
+
"emails:list-emails": "emails:list",
|
|
144
|
+
"emails:replay-email-webhooks": "emails:replay-webhooks",
|
|
145
|
+
"emails:search-emails": "emails:search",
|
|
146
|
+
"endpoints:complete-webhook-event": "endpoints:complete-event",
|
|
147
|
+
"endpoints:create-endpoint": "endpoints:create",
|
|
148
|
+
"endpoints:delete-endpoint": "endpoints:delete",
|
|
149
|
+
"endpoints:get-endpoint": "endpoints:get",
|
|
150
|
+
"endpoints:get-endpoint-signing-secret": "endpoints:signing-secret",
|
|
151
|
+
"endpoints:list-endpoints": "endpoints:list",
|
|
152
|
+
"endpoints:pull-webhook-event": "endpoints:pull-event",
|
|
153
|
+
"endpoints:rotate-endpoint-signing-secret": "endpoints:rotate-signing-secret",
|
|
154
|
+
"endpoints:test-endpoint": "endpoints:test",
|
|
155
|
+
"endpoints:test-endpoint-rules": "endpoints:test-rules",
|
|
156
|
+
"endpoints:update-endpoint": "endpoints:update",
|
|
157
|
+
"filters:create-filter": "filters:create",
|
|
158
|
+
"filters:delete-filter": "filters:delete",
|
|
159
|
+
"filters:list-filters": "filters:list",
|
|
160
|
+
"filters:update-filter": "filters:update",
|
|
161
|
+
"functions:create-function": "functions:create",
|
|
162
|
+
"functions:create-function-secret": "functions:create-secret",
|
|
163
|
+
"functions:delete-function": "functions:delete",
|
|
164
|
+
"functions:delete-function-secret": "functions:delete-secret",
|
|
165
|
+
"functions:get-function": "functions:get",
|
|
166
|
+
"functions:get-function-deployment": "functions:get-deployment",
|
|
167
|
+
"functions:get-function-invocation": "functions:get-invocation",
|
|
168
|
+
"functions:get-function-routing": "functions:get-routing",
|
|
169
|
+
"functions:get-function-runtime-key": "functions:get-runtime-key",
|
|
170
|
+
"functions:get-function-source": "functions:get-source",
|
|
171
|
+
"functions:get-function-test-run-trace": "functions:get-test-trace",
|
|
172
|
+
"functions:get-function-usage": "functions:get-usage",
|
|
173
|
+
"functions:get-function-users": "functions:get-users",
|
|
174
|
+
"functions:get-org-function-fallback": "functions:get-org-fallback",
|
|
175
|
+
"functions:get-org-function-invocation-series": "functions:get-org-invocation-series",
|
|
176
|
+
"functions:get-org-function-usage": "functions:get-org-usage",
|
|
177
|
+
"functions:get-org-routing-topology": "functions:get-org-routing",
|
|
178
|
+
"functions:list-function-activity": "functions:list-activity",
|
|
179
|
+
"functions:list-function-deployments": "functions:list-deployments",
|
|
180
|
+
"functions:list-function-invocations": "functions:list-invocations",
|
|
181
|
+
"functions:list-function-logs": "functions:list-logs",
|
|
182
|
+
"functions:list-function-runtime-key-presets": "functions:list-runtime-key-presets",
|
|
183
|
+
"functions:list-function-secrets": "functions:list-secrets",
|
|
184
|
+
"functions:list-functions": "functions:list",
|
|
185
|
+
"functions:lookup-function": "functions:lookup",
|
|
186
|
+
"functions:reaffirm-function-runtime-key": "functions:reaffirm-runtime-key",
|
|
187
|
+
"functions:request-function-runtime-key-runner": "functions:request-runtime-key-runner",
|
|
188
|
+
"functions:route-get": "functions:get-route",
|
|
189
|
+
"functions:route-set": "functions:set-route",
|
|
190
|
+
"functions:route-unset": "functions:unset-route",
|
|
191
|
+
"functions:set-function-runtime-key": "functions:set-runtime-key",
|
|
192
|
+
"functions:suspend-function-runtime-key": "functions:suspend-runtime-key",
|
|
193
|
+
"functions:test-function": "functions:test",
|
|
194
|
+
"functions:update-function": "functions:update",
|
|
195
|
+
"functions:update-function-tags": "functions:update-tags",
|
|
196
|
+
"inbox:get-inbox-status": "inbox:status",
|
|
197
|
+
"interactions:get-interaction": "interactions:get",
|
|
198
|
+
"interactions:list-interactions": "interactions:list",
|
|
199
|
+
"interactions:send-interaction-step": "interactions:send-step",
|
|
200
|
+
"interactions:start-interaction": "interactions:start",
|
|
201
|
+
"org:secrets:remove": "org:secrets:delete",
|
|
202
|
+
"organization-settings:get-organization": "organization-settings:get",
|
|
203
|
+
"organization-settings:list-oauth-grants": "organization-settings:list-grants",
|
|
204
|
+
"organization-settings:remove-organization-logo": "organization-settings:delete-logo",
|
|
205
|
+
"organization-settings:revoke-oauth-grant": "organization-settings:revoke-grant",
|
|
206
|
+
"organization-settings:update-organization": "organization-settings:update",
|
|
207
|
+
"organization-settings:update-organization-logo": "organization-settings:update-logo",
|
|
208
|
+
"organizations:invite-organization-member": "organizations:invite-member",
|
|
209
|
+
"organizations:list-organization-invitations": "organizations:list-invitations",
|
|
210
|
+
"organizations:revoke-organization-invitation": "organizations:revoke-invitation",
|
|
211
|
+
orgs: "org:list",
|
|
212
|
+
"projects:create-project": "projects:create",
|
|
213
|
+
"projects:delete-project": "projects:delete",
|
|
214
|
+
"projects:get-project": "projects:get",
|
|
215
|
+
"projects:invite-project-member": "projects:invite-member",
|
|
216
|
+
"projects:list-project-invitations": "projects:list-invitations",
|
|
217
|
+
"projects:list-projects": "projects:list",
|
|
218
|
+
"projects:revoke-project-invitation": "projects:revoke-invitation",
|
|
219
|
+
"projects:update-project": "projects:update",
|
|
220
|
+
"repeating-sends:delete-repeating-send": "repeating-sends:delete",
|
|
221
|
+
"repeating-sends:get-repeating-send": "repeating-sends:get",
|
|
222
|
+
"repeating-sends:list-repeating-sends": "repeating-sends:list",
|
|
223
|
+
"repeating-sends:stop-repeat-from-email": "repeating-sends:stop-from-email",
|
|
224
|
+
"repeating-sends:update-repeating-send": "repeating-sends:update",
|
|
225
|
+
"roles-and-members:leave-organization": "roles-and-members:leave",
|
|
226
|
+
"routes:add": "routes:create",
|
|
227
|
+
"routes:remove": "routes:delete",
|
|
228
|
+
"routes:simulate-route": "routes:simulate",
|
|
229
|
+
"search:semantic-search": "semantic-search",
|
|
230
|
+
"sending:cancel-sent-email": "sending:cancel",
|
|
231
|
+
"sending:cancel-sent-email-by-idempotency-key": "sending:cancel-by-key",
|
|
232
|
+
"sending:delete-sent-email": "sent:delete",
|
|
233
|
+
"sending:download-sent-attachment-archive-member": "sending:download-attachment-archive-member",
|
|
234
|
+
"sending:download-sent-attachment-by-filename": "sending:download-attachment-by-filename",
|
|
235
|
+
"sending:download-sent-attachment-part": "sending:download-attachment-part",
|
|
236
|
+
"sending:download-sent-attachments": "sending:download-attachments",
|
|
237
|
+
"sending:get-send-permissions": "sending:permissions",
|
|
238
|
+
"sending:get-sent-email": "sending:get",
|
|
239
|
+
"sending:list-sent-attachment-archive-members": "sending:list-attachment-archive-members",
|
|
240
|
+
"sending:list-sent-emails": "sending:list",
|
|
241
|
+
"sending:release-sent-email": "sending:release",
|
|
242
|
+
"sending:reply-to-email": "sending:reply",
|
|
243
|
+
"sending:reschedule-sent-email": "sending:reschedule",
|
|
244
|
+
"sending:send-email": "sending:send",
|
|
245
|
+
"sending:send-mail-batch": "sending:send-batch",
|
|
246
|
+
"sending:signal-email": "sending:signal",
|
|
247
|
+
"stats:get-inbound-hourly-stats": "stats:inbound-hourly",
|
|
248
|
+
"stats:get-sent-hourly-stats": "stats:sent-hourly",
|
|
249
|
+
"stats:get-webhook-delivery-stats": "stats:webhook-deliveries",
|
|
250
|
+
"templates:get-template": "templates:get",
|
|
251
|
+
"templates:get-template-install": "templates:get-install",
|
|
252
|
+
"templates:install-template": "templates:install",
|
|
253
|
+
"templates:list-templates": "templates:list",
|
|
254
|
+
"threads:get-thread": "threads:get",
|
|
255
|
+
"threads:list-muted-threads": "threads:list-muted",
|
|
256
|
+
"threads:list-thread-read-states": "threads:list-read-states",
|
|
257
|
+
"threads:mark-thread-read": "threads:mark-read",
|
|
258
|
+
"webhook-deliveries:get-delivery": "webhook-deliveries:get",
|
|
259
|
+
"webhook-deliveries:list-deliveries": "webhook-deliveries:list",
|
|
260
|
+
"webhook-deliveries:replay-delivery": "webhook-deliveries:replay"
|
|
261
|
+
};
|
|
262
|
+
function canonicalCommandId(id) {
|
|
263
|
+
return Object.hasOwn(COMMAND_RENAMES, id) ? COMMAND_RENAMES[id] ?? id : id;
|
|
264
|
+
}
|
|
265
|
+
/** Join presentation fields, including operations offered at the root. */
|
|
266
|
+
function operationCommandId(operation) {
|
|
267
|
+
return [operation.tagCommand, operation.command].filter(Boolean).join(":");
|
|
268
|
+
}
|
|
269
|
+
function canonicalOperation(operation) {
|
|
270
|
+
const id = canonicalCommandId(operationCommandId(operation));
|
|
271
|
+
const at = id.lastIndexOf(":");
|
|
272
|
+
return {
|
|
273
|
+
...operation,
|
|
274
|
+
...typeof operation.description === "string" ? { description: canonicalCliText(operation.description) } : {},
|
|
275
|
+
tagCommand: at < 0 ? "" : id.slice(0, at),
|
|
276
|
+
command: id.slice(at + 1)
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
const SCOPE_OPERATIONS = /* @__PURE__ */ new Set([
|
|
280
|
+
"compileEmailRule",
|
|
281
|
+
"createEmailRule",
|
|
282
|
+
"updateEmailRule",
|
|
283
|
+
"testEmailRule",
|
|
284
|
+
"testEmailRuleOnSample",
|
|
285
|
+
"generateLookAlikes"
|
|
286
|
+
]);
|
|
287
|
+
/** CLI flags project to the original request-body field, never a renamed wire key. */
|
|
288
|
+
function canonicalBodyFlagName(sdkName, property) {
|
|
289
|
+
return property === "evaluation_scope" && SCOPE_OPERATIONS.has(sdkName) ? "scope" : property.replace(/_/g, "-");
|
|
290
|
+
}
|
|
291
|
+
/** Rekey registrations without keeping retired names as executable aliases. */
|
|
292
|
+
function canonicalCommands(commands) {
|
|
293
|
+
const result = {};
|
|
294
|
+
for (const [oldId, command] of Object.entries(commands)) {
|
|
295
|
+
const id = canonicalCommandId(oldId);
|
|
296
|
+
if (Object.hasOwn(result, id) && result[id] !== command) throw new Error(`Different command implementations collide at ${id}`);
|
|
297
|
+
result[id] = command;
|
|
298
|
+
}
|
|
299
|
+
return result;
|
|
300
|
+
}
|
|
301
|
+
const commandTextPattern = new RegExp(`\\b(primitive(?:@[a-zA-Z0-9.+-]+)?|prim)[ \t]+(${Object.keys(COMMAND_RENAMES).sort((a, b) => b.length - a.length).map((id) => id.split(":").join("(?:[ ]+|:)")).join("|")})(?![a-zA-Z0-9_:-])`, "g");
|
|
302
|
+
function canonicalCliText(text) {
|
|
303
|
+
return text.replace(commandTextPattern, (_match, bin, name) => `${bin} ${canonicalCommandId(name.replace(/[ \t]+/g, ":")).replaceAll(":", " ")}`).replaceAll("--evaluation-scope", "--scope").replaceAll("--add-expectation-samples-file", "--add-samples-file").replaceAll("--expectation-samples-file", "--samples-file");
|
|
304
|
+
}
|
|
305
|
+
/** Detect retired paths before a positional parent can consume one as a value. */
|
|
306
|
+
function retiredCommandTarget(argv) {
|
|
307
|
+
let id = "";
|
|
308
|
+
let match;
|
|
309
|
+
for (const word of argv) {
|
|
310
|
+
if (word.startsWith("-")) break;
|
|
311
|
+
id = id ? `${id}:${word}` : word;
|
|
312
|
+
const replacement = Object.hasOwn(COMMAND_RENAMES, id) ? COMMAND_RENAMES[id] : void 0;
|
|
313
|
+
if (replacement) match = {
|
|
314
|
+
oldId: id,
|
|
315
|
+
newId: replacement
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
return match;
|
|
319
|
+
}
|
|
320
|
+
export { canonicalCommands as a, retiredCommandTarget as c, canonicalCommandId as i, canonicalBodyFlagName as n, canonicalOperation as o, canonicalCliText as r, operationCommandId as s, COMMAND_RENAMES as t };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { r as retryIdFields } from "./retry-ids-04ZPJCZY.js";
|
|
2
|
+
import { Errors } from "@oclif/core";
|
|
3
|
+
// src/oclif/required-body-fields.ts
|
|
4
|
+
function object(value) {
|
|
5
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
function jsonPath(parts) {
|
|
8
|
+
return parts.reduce((path, part) => typeof part === "number" || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(part) ? `${path}[${JSON.stringify(part)}]` : `${path}.${part}`, "$");
|
|
9
|
+
}
|
|
10
|
+
/** Only exclude a union branch when a supplied literal contradicts it. */
|
|
11
|
+
function compatible(schema, value) {
|
|
12
|
+
if (!object(schema) || !object(value)) return true;
|
|
13
|
+
const properties = object(schema.properties) ? schema.properties : {};
|
|
14
|
+
for (const [name, property] of Object.entries(properties)) {
|
|
15
|
+
if (!Object.hasOwn(value, name) || !object(property)) continue;
|
|
16
|
+
const literal = value[name];
|
|
17
|
+
if (literal === void 0 || literal !== null && typeof literal === "object") continue;
|
|
18
|
+
if (Object.hasOwn(property, "const") && !object(property.const) && !Array.isArray(property.const) && property.const !== literal) return false;
|
|
19
|
+
if (Array.isArray(property.enum) && !property.enum.includes(literal)) return false;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Report missing properties, not type or permission failures. Alternative
|
|
25
|
+
* schemas contribute only omissions shared by every still-possible branch.
|
|
26
|
+
*/
|
|
27
|
+
function missingBodyFields(schema, body, flags, required) {
|
|
28
|
+
if (body === void 0 && !required) return [];
|
|
29
|
+
function visit(node, value, path) {
|
|
30
|
+
if (!object(node)) return [];
|
|
31
|
+
const missing = [];
|
|
32
|
+
if (object(value)) {
|
|
33
|
+
const names = Array.isArray(node.required) ? node.required : [];
|
|
34
|
+
for (const name of names) {
|
|
35
|
+
if (typeof name !== "string") continue;
|
|
36
|
+
if (Object.hasOwn(value, name) && value[name] !== void 0) continue;
|
|
37
|
+
missing.push({
|
|
38
|
+
field: name,
|
|
39
|
+
flag: path.length === 0 ? flags.get(name) ?? null : null,
|
|
40
|
+
json_path: jsonPath([...path, name])
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (object(node.properties)) {
|
|
44
|
+
for (const [name, property] of Object.entries(node.properties)) if (Object.hasOwn(value, name) && value[name] !== void 0) missing.push(...visit(property, value[name], [...path, name]));
|
|
45
|
+
}
|
|
46
|
+
} else if (Array.isArray(value)) for (const [index, item] of value.entries()) missing.push(...visit(node.items, item, [...path, index]));
|
|
47
|
+
if (Array.isArray(node.allOf)) for (const branch of node.allOf) missing.push(...visit(branch, value, path));
|
|
48
|
+
for (const union of [node.oneOf, node.anyOf]) {
|
|
49
|
+
if (!Array.isArray(union)) continue;
|
|
50
|
+
const branches = union.filter((branch) => compatible(branch, value)).map((branch) => visit(branch, value, path));
|
|
51
|
+
if (branches.length === 0) continue;
|
|
52
|
+
missing.push(...branches[0].filter((field) => branches.every((branch) => branch.some((other) => other.json_path === field.json_path))));
|
|
53
|
+
}
|
|
54
|
+
return missing;
|
|
55
|
+
}
|
|
56
|
+
const missing = visit(schema, body === void 0 ? {} : body, []);
|
|
57
|
+
return [...new Map(missing.map((field) => [field.json_path, field])).values()];
|
|
58
|
+
}
|
|
59
|
+
function assertRequiredBodyFields(schema, body, flags, required) {
|
|
60
|
+
const missing = missingBodyFields(schema, body, flags, required);
|
|
61
|
+
if (missing.length === 0 && (!required || body !== void 0)) return;
|
|
62
|
+
const fields = missing.length ? missing : [{
|
|
63
|
+
field: "body",
|
|
64
|
+
flag: null,
|
|
65
|
+
json_path: "$"
|
|
66
|
+
}];
|
|
67
|
+
const message = `Missing required fields: ${fields.map((field) => field.flag ?? field.json_path).join(", ")}. Supply the fields as flags where available, or use --raw-body / --body-file JSON.`;
|
|
68
|
+
throw Object.assign(new Errors.CLIError(message, { exit: 2 }), {
|
|
69
|
+
code: "usage_error",
|
|
70
|
+
details: { missing: fields }
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
// src/oclif/help-inputs.ts
|
|
74
|
+
const HELP_GROUPS = [
|
|
75
|
+
"required",
|
|
76
|
+
"command",
|
|
77
|
+
"common"
|
|
78
|
+
];
|
|
79
|
+
const HELP_GROUP_HEADERS = {
|
|
80
|
+
required: "REQUIRED INPUTS",
|
|
81
|
+
command: "COMMAND OPTIONS",
|
|
82
|
+
common: "COMMON FLAGS"
|
|
83
|
+
};
|
|
84
|
+
const COMMON_FLAGS = /* @__PURE__ */ new Set([
|
|
85
|
+
"api-key",
|
|
86
|
+
"api-base-url",
|
|
87
|
+
"json",
|
|
88
|
+
"time",
|
|
89
|
+
"raw-body",
|
|
90
|
+
"envelope",
|
|
91
|
+
"output",
|
|
92
|
+
"idempotency-key",
|
|
93
|
+
"step-up-token"
|
|
94
|
+
]);
|
|
95
|
+
function helpFlagGroup(name, flag, inputs, flagNames) {
|
|
96
|
+
if (flag.required || flag.exactlyOne?.length || inputs?.requiredFlags.includes(name)) return "required";
|
|
97
|
+
if (COMMON_FLAGS.has(name) || name === "body-file" && flagNames.has("raw-body")) return "common";
|
|
98
|
+
return "command";
|
|
99
|
+
}
|
|
100
|
+
function operationHelpInputs(operation, bodyFlagToProperty, positionalFlag) {
|
|
101
|
+
const propertyFlags = new Map([...bodyFlagToProperty].map(([flag, property]) => [property, `--${flag}`]));
|
|
102
|
+
const generated = new Set(retryIdFields(operation.requestSchema));
|
|
103
|
+
const missing = operation.bodyRequired || generated.size > 0 ? missingBodyFields(operation.requestSchema, {}, propertyFlags, true).filter((field) => !generated.has(field.field)) : [];
|
|
104
|
+
return {
|
|
105
|
+
requiredFlags: [...missing.flatMap((field) => field.flag ? [field.flag.slice(2)] : []), ...positionalFlag ? [positionalFlag] : []],
|
|
106
|
+
requiredJsonFields: operation.bodyRequired && missing.length === 0 && generated.size === 0 ? ["$"] : missing.filter((field) => field.flag === null).map((field) => field.json_path)
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export { assertRequiredBodyFields as a, operationHelpInputs as i, HELP_GROUP_HEADERS as n, helpFlagGroup as r, HELP_GROUPS as t };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { i as takeRetryIds } from "./retry-ids-04ZPJCZY.js";
|
|
2
|
+
import { Flags } from "@oclif/core";
|
|
1
3
|
import { format } from "node:util";
|
|
2
4
|
// src/oclif/json-output.ts
|
|
3
5
|
/**
|
|
@@ -22,6 +24,11 @@ import { format } from "node:util";
|
|
|
22
24
|
* line per result on stdout, and on failure one more JSON line carrying
|
|
23
25
|
* `error` and `exit_code`.
|
|
24
26
|
*/
|
|
27
|
+
/**
|
|
28
|
+
* The `--json` flag for a hand-rolled command whose output is already JSON.
|
|
29
|
+
* Declaring it is enough: the registry guards every command that has it.
|
|
30
|
+
*/
|
|
31
|
+
const JSON_OUTPUT_FLAG = Flags.boolean({ description: "Print exactly one JSON document on stdout, on success and on failure, and nothing on stderr. A failure prints the error with exit_code." });
|
|
25
32
|
const GUARDED = Symbol.for("primitive.cli.jsonOutputGuard");
|
|
26
33
|
/** True when `--json` appears before any `--` separator. */
|
|
27
34
|
function jsonOutputRequested(argv) {
|
|
@@ -139,11 +146,18 @@ function errorExitCode(error) {
|
|
|
139
146
|
function isExitSignal(error) {
|
|
140
147
|
return error?.code === "EEXIT";
|
|
141
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* The `error` a `--json` document carries for a thrown error: its message,
|
|
151
|
+
* and its `code` and `details` when it has them (a refusal the CLI makes in
|
|
152
|
+
* an API error's shape, such as a send without mail:send).
|
|
153
|
+
*/
|
|
142
154
|
function thrownErrorBody(error) {
|
|
143
155
|
if (error instanceof Error) {
|
|
144
156
|
const body = { message: error.message };
|
|
145
157
|
const code = error.code;
|
|
146
158
|
if (typeof code === "string" && code !== "EEXIT") body.code = code;
|
|
159
|
+
const details = error.details;
|
|
160
|
+
if (isPlainObject(details)) body.details = details;
|
|
147
161
|
return body;
|
|
148
162
|
}
|
|
149
163
|
return { message: String(error) };
|
|
@@ -153,13 +167,25 @@ function thrownErrorBody(error) {
|
|
|
153
167
|
* what it wrote to stdout and stderr and how it ended.
|
|
154
168
|
*/
|
|
155
169
|
function composeJsonDocument(input) {
|
|
170
|
+
const document = composeResult(input);
|
|
171
|
+
if (!input.retryIds?.length) return document;
|
|
172
|
+
return {
|
|
173
|
+
...isPlainObject(document) ? document : { data: document },
|
|
174
|
+
cli_retry_ids: input.retryIds
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function composeResult(input) {
|
|
156
178
|
const { errorPayload, warnings: stderrLines } = summarizeStderr(input.stderr);
|
|
157
179
|
const failed = input.exitCode !== 0;
|
|
158
180
|
let warnings = stderrLines;
|
|
159
181
|
if (!failed && errorPayload !== null) warnings = [...warnings, JSON.stringify(errorPayload)];
|
|
160
182
|
const failure = () => {
|
|
161
183
|
if (errorPayload !== null) return errorPayload;
|
|
162
|
-
if (input.thrown && !isExitSignal(input.thrown.error))
|
|
184
|
+
if (input.thrown && !isExitSignal(input.thrown.error)) {
|
|
185
|
+
const body = thrownErrorBody(input.thrown.error);
|
|
186
|
+
if (body.code === void 0) body.code = errorExitCode(input.thrown.error) === 2 ? "usage_error" : "cli_error";
|
|
187
|
+
return body;
|
|
188
|
+
}
|
|
163
189
|
return { message: warnings.at(-1) ?? `The command failed with exit code ${input.exitCode}.` };
|
|
164
190
|
};
|
|
165
191
|
const text = input.stdout.trim();
|
|
@@ -195,9 +221,7 @@ function composeJsonDocument(input) {
|
|
|
195
221
|
if (merged.exit_code === void 0) merged.exit_code = input.exitCode;
|
|
196
222
|
}
|
|
197
223
|
if (warnings.length > 0) {
|
|
198
|
-
|
|
199
|
-
if (existing === void 0 || existing === null) merged.warnings = warnings;
|
|
200
|
-
else if (Array.isArray(existing)) merged.warnings = [...existing, ...warnings.filter((warning) => !existing.includes(warning))];
|
|
224
|
+
if (merged.warnings === void 0 || merged.warnings === null) merged.warnings = warnings;
|
|
201
225
|
else merged.cli_warnings = warnings;
|
|
202
226
|
}
|
|
203
227
|
return merged;
|
|
@@ -227,7 +251,8 @@ function guardJsonOutput(cls) {
|
|
|
227
251
|
exitCode: thrown ? isExitSignal(thrown.error) ? errorExitCode(thrown.error) ?? 0 : errorExitCode(thrown.error) ?? (typeof process.exitCode === "number" && process.exitCode !== 0 ? process.exitCode : 1) : typeof process.exitCode === "number" ? process.exitCode : 0,
|
|
228
252
|
stderr: capture.stderr,
|
|
229
253
|
stdout: capture.stdout.join(""),
|
|
230
|
-
thrown
|
|
254
|
+
thrown,
|
|
255
|
+
retryIds: takeRetryIds(this)
|
|
231
256
|
});
|
|
232
257
|
console.log(JSON.stringify(document, null, 2));
|
|
233
258
|
if (thrown) {
|
|
@@ -318,4 +343,4 @@ function guardJsonOutputCommands(commands) {
|
|
|
318
343
|
if (flags && "json" in flags || enableJsonFlag === true) guardJsonOutput(command);
|
|
319
344
|
}
|
|
320
345
|
}
|
|
321
|
-
export {
|
|
346
|
+
export { thrownErrorBody as a, runStreamingJson as i, guardJsonOutputCommands as n, jsonOutputRequested as r, JSON_OUTPUT_FLAG as t };
|