@kosuke-ai/kosuke 1.0.141 → 1.0.143

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.
Files changed (91) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +3 -1
  3. package/dist/commands/skill-runs.js +3 -0
  4. package/dist/generated/commands/crons/list--personal.js +21 -0
  5. package/dist/generated/commands/crons/list.js +21 -0
  6. package/dist/generated/commands/github/connection-get.js +7 -0
  7. package/dist/generated/commands/integrations/browser-connections-create--personal-network-linkedin.js +4 -0
  8. package/dist/generated/commands/integrations/browser-connections-create--personal-network-x.js +4 -0
  9. package/dist/generated/commands/integrations/browser-connections-list--personal-network-linkedin.js +13 -0
  10. package/dist/generated/commands/integrations/browser-connections-list--personal-network-x.js +13 -0
  11. package/dist/generated/commands/integrations/connections-delete--personal.js +4 -0
  12. package/dist/generated/commands/integrations/connections-list--personal.js +31 -0
  13. package/dist/generated/commands/models/list.js +10 -0
  14. package/dist/generated/commands/projects/labels-list.js +4 -0
  15. package/dist/generated/commands/projects/list.js +63 -0
  16. package/dist/generated/commands/providers/get--personal.js +16 -0
  17. package/dist/generated/commands/providers/get.js +8 -0
  18. package/dist/generated/commands/providers/google-get.js +5 -0
  19. package/dist/generated/commands/providers/google-methods-set.js +4 -0
  20. package/dist/generated/commands/providers/google-set.js +5 -0
  21. package/dist/generated/commands/providers/grok-get--personal.js +9 -0
  22. package/dist/generated/commands/providers/grok-get.js +4 -0
  23. package/dist/generated/commands/providers/grok-update--personal.js +9 -0
  24. package/dist/generated/commands/providers/grok-update.js +9 -0
  25. package/dist/generated/commands/providers/logins-complete--personal-provider-antigravity.js +8 -0
  26. package/dist/generated/commands/providers/logins-complete--personal-provider-claude-code.js +6 -0
  27. package/dist/generated/commands/providers/logins-complete--personal-provider-codex.js +6 -0
  28. package/dist/generated/commands/providers/logins-complete--personal-provider-muse-code.js +6 -0
  29. package/dist/generated/commands/providers/logins-complete--provider-antigravity.js +8 -0
  30. package/dist/generated/commands/providers/logins-complete--provider-claude-code.js +6 -0
  31. package/dist/generated/commands/providers/logins-complete--provider-codex.js +6 -0
  32. package/dist/generated/commands/providers/logins-complete--provider-muse-code.js +6 -0
  33. package/dist/generated/commands/providers/logins-start--personal-provider-antigravity.js +8 -0
  34. package/dist/generated/commands/providers/logins-start--personal-provider-claude-code.js +4 -0
  35. package/dist/generated/commands/providers/logins-start--personal-provider-codex.js +6 -0
  36. package/dist/generated/commands/providers/logins-start--personal-provider-muse-code.js +6 -0
  37. package/dist/generated/commands/providers/logins-start--provider-antigravity.js +8 -0
  38. package/dist/generated/commands/providers/logins-start--provider-claude-code.js +4 -0
  39. package/dist/generated/commands/providers/logins-start--provider-codex.js +6 -0
  40. package/dist/generated/commands/providers/logins-start--provider-muse-code.js +6 -0
  41. package/dist/generated/commands/providers/set.js +8 -0
  42. package/dist/generated/commands/providers/usage-get--personal.js +8 -0
  43. package/dist/generated/commands/providers/usage-get--provider-antigravity.js +8 -0
  44. package/dist/generated/commands/providers/usage-get--provider-claude-code.js +8 -0
  45. package/dist/generated/commands/providers/usage-get--provider-codex.js +8 -0
  46. package/dist/generated/commands/providers/usage-get--provider-coding-plan.js +8 -0
  47. package/dist/generated/commands/providers/usage-get--provider-deepseek-api.js +8 -0
  48. package/dist/generated/commands/providers/usage-get--provider-grok.js +8 -0
  49. package/dist/generated/commands/providers/usage-get--provider-kimi-code.js +8 -0
  50. package/dist/generated/commands/providers/usage-get--provider-muse-code.js +8 -0
  51. package/dist/generated/commands/sensei/cards-list.js +68 -0
  52. package/dist/generated/commands/sensei/cards-set.js +16 -0
  53. package/dist/generated/commands/sensei/reels-later-holds-create.js +3 -0
  54. package/dist/generated/commands/sensei/reels-later-holds-delete.js +3 -0
  55. package/dist/generated/commands/sensei/reels-later-holds-list.js +8 -0
  56. package/dist/generated/commands/sensei/sessions-facts-get.js +23 -0
  57. package/dist/generated/commands/sensei/threads-close.js +4 -0
  58. package/dist/generated/commands/sensei/threads-get.js +16 -0
  59. package/dist/generated/commands/sensei/threads-list.js +8 -1
  60. package/dist/generated/commands/sessions/files-get.js +8 -0
  61. package/dist/generated/commands/sessions/get.js +17 -0
  62. package/dist/generated/commands/sessions/labels-set.js +4 -0
  63. package/dist/generated/commands/sessions/list--all.js +79 -0
  64. package/dist/generated/commands/sessions/list.js +126 -0
  65. package/dist/generated/commands/skills/get--personal.js +10 -0
  66. package/dist/generated/commands/skills/list--personal.js +9 -0
  67. package/dist/generated/commands/tasks/get--personal.js +29 -0
  68. package/dist/generated/commands/tasks/get.js +29 -0
  69. package/dist/generated/commands/tasks/labels-list.js +4 -0
  70. package/dist/generated/commands/tasks/list--all.js +23 -0
  71. package/dist/generated/commands/tasks/list--personal.js +23 -0
  72. package/dist/generated/commands/tasks/list.js +23 -0
  73. package/dist/generated/commands/tasks/start--personal.js +4 -0
  74. package/dist/generated/commands/tasks/start.js +4 -0
  75. package/dist/generated/commands/user/profile-get.js +16 -0
  76. package/dist/generated/commands/user/settings-get.js +7 -0
  77. package/dist/generated/commands/user/settings-update.js +7 -0
  78. package/dist/generated/commands/user/usage-get.js +11 -0
  79. package/dist/generated/commands/workspaces/get.js +11 -0
  80. package/dist/generated/commands/workspaces/list.js +6 -0
  81. package/dist/generated/commands/workspaces/members-list--all.js +5 -0
  82. package/dist/generated/commands/workspaces/members-list.js +6 -0
  83. package/dist/generated/commands/workspaces/timezone-set.js +3 -0
  84. package/dist/generated/commands/workspaces/usage-breakdown-get.js +11 -0
  85. package/dist/program.js +5 -3
  86. package/dist/runtime/attach.js +7 -4
  87. package/dist/runtime/fields.js +29 -10
  88. package/dist/runtime/help.js +119 -2
  89. package/dist/runtime/runtime.js +1 -0
  90. package/openapi.json +816 -2
  91. package/package.json +4 -4
@@ -132,6 +132,132 @@ export const operation = {
132
132
  "body": null,
133
133
  "multipart": null,
134
134
  "attachments": false,
135
+ "fields": [
136
+ "id",
137
+ "projectId",
138
+ "userId",
139
+ "title",
140
+ "titleRevision",
141
+ "branchName",
142
+ "startBranch",
143
+ "requestedBranchName",
144
+ "status",
145
+ "priority",
146
+ "sandboxTier",
147
+ "appStack",
148
+ "appStackStartedAt",
149
+ "appStackStartingAt",
150
+ "appStackError",
151
+ "createdAt",
152
+ "updatedAt",
153
+ "lastActivityAt",
154
+ "endedAt",
155
+ "lastViewedAt",
156
+ "lastAgentActivityAt",
157
+ "lastReassignedAt",
158
+ "messageCount",
159
+ "branchMergedAt",
160
+ "branchMergedBy",
161
+ "mergeRulePullRequestNumber",
162
+ "mergeCommitSha",
163
+ "pullRequestNumber",
164
+ "pullRequestOpenedAt",
165
+ "pullRequestBaseBranch",
166
+ "pullRequestFactsUnavailable",
167
+ "prOpenedBy",
168
+ "labels",
169
+ "isBehind",
170
+ "behindRevision",
171
+ "behindBaseSha",
172
+ "prStatus",
173
+ "prChecksStatus",
174
+ "prChecksTotal",
175
+ "prRevision",
176
+ "prConflictSince",
177
+ "prBehindSince",
178
+ "prChecksFailedSince",
179
+ "model",
180
+ "kosukeFree",
181
+ "nextModel",
182
+ "nextChosenBy",
183
+ "nextRevision",
184
+ "linesAdded",
185
+ "linesRemoved",
186
+ "contextTokens",
187
+ "contextWindowTokens",
188
+ "checkStatus",
189
+ "reviewAsks",
190
+ "shipRunStartedAt",
191
+ "prRequestedReviewers",
192
+ "effort",
193
+ "shipStage",
194
+ "stage",
195
+ "qaPassedSha",
196
+ "goAheadSha",
197
+ "goAheadBy",
198
+ "goAheadAt",
199
+ "goAheadSource",
200
+ "shipQa",
201
+ "shipReview",
202
+ "qaRuntimeChangeSha",
203
+ "qaRuntimeChangeFile",
204
+ "goAheadMerges",
205
+ "pullRequestHeadSha",
206
+ "readyAt",
207
+ "assessment",
208
+ "senseiEstimate",
209
+ "assessmentHeadSha",
210
+ "assessmentRevision",
211
+ "unansweredClarification",
212
+ "workingMs",
213
+ "runningSince",
214
+ "workingMsAtReady",
215
+ "shipClock",
216
+ "shipEstimateSnapshot",
217
+ "prReviewDecision",
218
+ "prApproved",
219
+ "prUnresolvedThreads",
220
+ "prThreadsChangedAt",
221
+ "prSentReviewIds",
222
+ "historyBoundaryAt",
223
+ "sandboxId",
224
+ "anthropicCredentialOwner",
225
+ "openaiCredentialOwner",
226
+ "zaiCredentialOwner",
227
+ "moonshotCredentialOwner",
228
+ "deepseekCredentialOwner",
229
+ "metaCredentialOwner",
230
+ "googleCredentialOwner",
231
+ "credentialOrgId",
232
+ "sandboxStatus",
233
+ "sandboxRunningSince",
234
+ "sandboxLifecycleEventAt",
235
+ "frustrationAlertedSeverity",
236
+ "createdBy",
237
+ "filedBySessionId",
238
+ "filedByCronId",
239
+ "filedByCronRunId",
240
+ "filedReason",
241
+ "startWhenDeployedAt",
242
+ "closedBySwitchAt",
243
+ "freeReservedSourceId",
244
+ "freeReservedRevision",
245
+ "freeReservedModel",
246
+ "freeReservedAt",
247
+ "freeSourceId",
248
+ "freeRevision",
249
+ "freeModel",
250
+ "freeUsedAt",
251
+ "waitingForDeploy",
252
+ "latestChatJobStatus",
253
+ "latestChatJobCreatedAt",
254
+ "latestStopReason",
255
+ "isUnread",
256
+ "filedSource",
257
+ "prompt",
258
+ "promptTruncated",
259
+ "user"
260
+ ],
135
261
  "anonymous": false,
136
262
  "agents": "all"
137
263
  };
@@ -16,6 +16,16 @@ export const operation = {
16
16
  "body": null,
17
17
  "multipart": null,
18
18
  "attachments": false,
19
+ "fields": [
20
+ "id",
21
+ "name",
22
+ "description",
23
+ "argumentHint",
24
+ "enabled",
25
+ "fileCount",
26
+ "replaces",
27
+ "files"
28
+ ],
19
29
  "anonymous": false,
20
30
  "agents": "all"
21
31
  };
@@ -14,6 +14,15 @@ export const operation = {
14
14
  "body": null,
15
15
  "multipart": null,
16
16
  "attachments": false,
17
+ "fields": [
18
+ "id",
19
+ "name",
20
+ "description",
21
+ "argumentHint",
22
+ "enabled",
23
+ "fileCount",
24
+ "replaces"
25
+ ],
17
26
  "anonymous": false,
18
27
  "agents": "all"
19
28
  };
@@ -17,6 +17,35 @@ export const operation = {
17
17
  "body": null,
18
18
  "multipart": null,
19
19
  "attachments": false,
20
+ "fields": [
21
+ "id",
22
+ "organizationId",
23
+ "status",
24
+ "title",
25
+ "priority",
26
+ "userId",
27
+ "projectId",
28
+ "hintProjectId",
29
+ "hintProjectName",
30
+ "filedThreadId",
31
+ "personalTask",
32
+ "createdAt",
33
+ "updatedAt",
34
+ "chatSession",
35
+ "model",
36
+ "description",
37
+ "descriptionRevision",
38
+ "dueOn",
39
+ "doneAt",
40
+ "archivedAt",
41
+ "thread",
42
+ "sandboxTier",
43
+ "defaultSandboxTier",
44
+ "appStack",
45
+ "pullRequestUrl",
46
+ "branchUrl",
47
+ "session"
48
+ ],
20
49
  "anonymous": false,
21
50
  "agents": [
22
51
  "senseiToken"
@@ -14,6 +14,35 @@ export const operation = {
14
14
  "body": null,
15
15
  "multipart": null,
16
16
  "attachments": false,
17
+ "fields": [
18
+ "id",
19
+ "organizationId",
20
+ "status",
21
+ "title",
22
+ "priority",
23
+ "userId",
24
+ "projectId",
25
+ "hintProjectId",
26
+ "hintProjectName",
27
+ "filedThreadId",
28
+ "personalTask",
29
+ "createdAt",
30
+ "updatedAt",
31
+ "chatSession",
32
+ "model",
33
+ "description",
34
+ "descriptionRevision",
35
+ "dueOn",
36
+ "doneAt",
37
+ "archivedAt",
38
+ "thread",
39
+ "sandboxTier",
40
+ "defaultSandboxTier",
41
+ "appStack",
42
+ "pullRequestUrl",
43
+ "branchUrl",
44
+ "session"
45
+ ],
17
46
  "anonymous": false,
18
47
  "agents": "all"
19
48
  };
@@ -14,6 +14,10 @@ export const operation = {
14
14
  "body": null,
15
15
  "multipart": null,
16
16
  "attachments": false,
17
+ "fields": [
18
+ "name",
19
+ "color"
20
+ ],
17
21
  "anonymous": false,
18
22
  "agents": "all"
19
23
  };
@@ -139,6 +139,29 @@ export const operation = {
139
139
  "body": null,
140
140
  "multipart": null,
141
141
  "attachments": false,
142
+ "fields": [
143
+ "id",
144
+ "title",
145
+ "status",
146
+ "priority",
147
+ "organizationId",
148
+ "projectId",
149
+ "hintProjectId",
150
+ "hintProjectName",
151
+ "userId",
152
+ "createdBy",
153
+ "model",
154
+ "personalTask",
155
+ "filedThreadId",
156
+ "description",
157
+ "prompt",
158
+ "promptTruncated",
159
+ "chatSession",
160
+ "createdAt",
161
+ "updatedAt",
162
+ "chatSession.id",
163
+ "chatSession.status"
164
+ ],
142
165
  "anonymous": false,
143
166
  "agents": "all"
144
167
  };
@@ -140,6 +140,29 @@ export const operation = {
140
140
  "body": null,
141
141
  "multipart": null,
142
142
  "attachments": false,
143
+ "fields": [
144
+ "id",
145
+ "title",
146
+ "status",
147
+ "priority",
148
+ "organizationId",
149
+ "projectId",
150
+ "hintProjectId",
151
+ "hintProjectName",
152
+ "userId",
153
+ "createdBy",
154
+ "model",
155
+ "personalTask",
156
+ "filedThreadId",
157
+ "description",
158
+ "prompt",
159
+ "promptTruncated",
160
+ "chatSession",
161
+ "createdAt",
162
+ "updatedAt",
163
+ "chatSession.id",
164
+ "chatSession.status"
165
+ ],
143
166
  "anonymous": false,
144
167
  "agents": [
145
168
  "senseiToken"
@@ -138,6 +138,29 @@ export const operation = {
138
138
  "body": null,
139
139
  "multipart": null,
140
140
  "attachments": false,
141
+ "fields": [
142
+ "id",
143
+ "title",
144
+ "status",
145
+ "priority",
146
+ "organizationId",
147
+ "projectId",
148
+ "hintProjectId",
149
+ "hintProjectName",
150
+ "userId",
151
+ "createdBy",
152
+ "model",
153
+ "personalTask",
154
+ "filedThreadId",
155
+ "description",
156
+ "prompt",
157
+ "promptTruncated",
158
+ "chatSession",
159
+ "createdAt",
160
+ "updatedAt",
161
+ "chatSession.id",
162
+ "chatSession.status"
163
+ ],
141
164
  "anonymous": false,
142
165
  "agents": "all"
143
166
  };
@@ -67,6 +67,10 @@ export const operation = {
67
67
  },
68
68
  "multipart": null,
69
69
  "attachments": false,
70
+ "fields": [
71
+ "session",
72
+ "chatJobId"
73
+ ],
70
74
  "anonymous": false,
71
75
  "agents": [
72
76
  "senseiToken"
@@ -64,6 +64,10 @@ export const operation = {
64
64
  },
65
65
  "multipart": null,
66
66
  "attachments": false,
67
+ "fields": [
68
+ "session",
69
+ "chatJobId"
70
+ ],
67
71
  "anonymous": false,
68
72
  "agents": "all"
69
73
  };
@@ -12,6 +12,22 @@ export const operation = {
12
12
  "body": null,
13
13
  "multipart": null,
14
14
  "attachments": false,
15
+ "fields": [
16
+ "id",
17
+ "personalSpaceId",
18
+ "email",
19
+ "name",
20
+ "imageUrl",
21
+ "onboardingCompleted",
22
+ "createdAt",
23
+ "marketingEmails",
24
+ "fyiDigestMinutes",
25
+ "threadRouting",
26
+ "locale",
27
+ "defaultModel",
28
+ "isSuperAdmin",
29
+ "canRedeemPromoCode"
30
+ ],
15
31
  "anonymous": false,
16
32
  "agents": "all"
17
33
  };
@@ -12,6 +12,13 @@ export const operation = {
12
12
  "body": null,
13
13
  "multipart": null,
14
14
  "attachments": false,
15
+ "fields": [
16
+ "timeZone",
17
+ "timeZoneSource",
18
+ "resolvedTimeZone",
19
+ "resolvedFrom",
20
+ "systemCrons"
21
+ ],
15
22
  "anonymous": false,
16
23
  "agents": "all"
17
24
  };
@@ -51,6 +51,13 @@ export const operation = {
51
51
  },
52
52
  "multipart": null,
53
53
  "attachments": false,
54
+ "fields": [
55
+ "timeZone",
56
+ "timeZoneSource",
57
+ "resolvedTimeZone",
58
+ "resolvedFrom",
59
+ "systemCrons"
60
+ ],
54
61
  "anonymous": false,
55
62
  "agents": "all"
56
63
  };
@@ -32,5 +32,16 @@ export const operation = {
32
32
  "body": null,
33
33
  "multipart": null,
34
34
  "attachments": false,
35
+ "fields": [
36
+ "range",
37
+ "timeZone",
38
+ "from",
39
+ "to",
40
+ "recordingStartedOn",
41
+ "firstUsedOn",
42
+ "totals",
43
+ "days",
44
+ "groups"
45
+ ],
35
46
  "anonymous": false
36
47
  };
@@ -13,6 +13,17 @@ export const operation = {
13
13
  "body": null,
14
14
  "multipart": null,
15
15
  "attachments": false,
16
+ "fields": [
17
+ "personal",
18
+ "id",
19
+ "name",
20
+ "logo",
21
+ "createdAt",
22
+ "role",
23
+ "isAdmin",
24
+ "isOwner",
25
+ "timezone"
26
+ ],
16
27
  "anonymous": false,
17
28
  "agents": "all"
18
29
  };
@@ -11,6 +11,12 @@ export const operation = {
11
11
  "body": null,
12
12
  "multipart": null,
13
13
  "attachments": false,
14
+ "fields": [
15
+ "id",
16
+ "name",
17
+ "slug",
18
+ "logo"
19
+ ],
14
20
  "anonymous": false,
15
21
  "agents": "all"
16
22
  };
@@ -23,6 +23,11 @@ export const operation = {
23
23
  "body": null,
24
24
  "multipart": null,
25
25
  "attachments": false,
26
+ "fields": [
27
+ "id",
28
+ "name",
29
+ "members"
30
+ ],
26
31
  "anonymous": false,
27
32
  "agents": "all"
28
33
  };
@@ -22,6 +22,12 @@ export const operation = {
22
22
  "body": null,
23
23
  "multipart": null,
24
24
  "attachments": false,
25
+ "fields": [
26
+ "members",
27
+ "membersCount",
28
+ "invitations",
29
+ "invitationsCount"
30
+ ],
25
31
  "anonymous": false,
26
32
  "agents": "all"
27
33
  };
@@ -25,6 +25,9 @@ export const operation = {
25
25
  },
26
26
  "multipart": null,
27
27
  "attachments": false,
28
+ "fields": [
29
+ "timezone"
30
+ ],
28
31
  "anonymous": false,
29
32
  "agents": "all"
30
33
  };
@@ -35,6 +35,17 @@ export const operation = {
35
35
  "body": null,
36
36
  "multipart": null,
37
37
  "attachments": false,
38
+ "fields": [
39
+ "range",
40
+ "timeZone",
41
+ "from",
42
+ "to",
43
+ "recordingStartedOn",
44
+ "firstUsedOn",
45
+ "totals",
46
+ "days",
47
+ "groups"
48
+ ],
38
49
  "anonymous": false,
39
50
  "agents": "all"
40
51
  };
package/dist/program.js CHANGED
@@ -10,7 +10,7 @@ import { HAND_WRITTEN } from './commands/hand-written.js';
10
10
  import { operations } from './generated/commands/index.js';
11
11
  import { attachCommand } from './runtime/attach.js';
12
12
  import { parseFields, parseFormat } from './runtime/fields.js';
13
- import { helpConfiguration, suggestOnError, takeLongHelp } from './runtime/help.js';
13
+ import { helpConfiguration, setOwnOutput, suggestOnError, takeLongHelp } from './runtime/help.js';
14
14
  import { formsOf } from './runtime/variants.js';
15
15
  import { agentTokenOf, isReachable } from './runtime/agent-tokens.js';
16
16
  import { createRuntime, ExitSignal } from './runtime/runtime.js';
@@ -41,13 +41,15 @@ export function createProgram(options = {}) {
41
41
  .option('--api-key <key>', 'API key; overrides KOSUKE_API_KEY and the stored one.')
42
42
  .option('--api-url <url>', 'Platform URL; overrides KOSUKE_API_URL. Default https://app.kosuke.ai.')
43
43
  .option('--pretty', 'Indented JSON; the default at a terminal, one line when piped.')
44
- .option('--json', "The platform's whole answer as JSON, for a script. Or KOSUKE_OUTPUT=json.")
44
+ .option('--json', "The platform's whole answer as JSON, every field; pick fields with --fields. Or KOSUKE_OUTPUT=json.")
45
45
  .option('--fields <paths>', 'Only these comma-separated fields; dots reach nested ones. Per row on a list, else on the object: id,chatSession.id.', asOption(parseFields))
46
- .option('--format <format>', 'compact: a header, then one tab-separated line per row. Nulls print empty, timestamps to the second; json is the default.', asOption(parseFormat))
46
+ .option('--format <json|compact>', 'compact: a header, then one tab-separated line per row. Nulls print empty, timestamps to the second; json is the default.', asOption(parseFormat))
47
47
  // commander's default is kept: a program option is read wherever it
48
48
  // appears, so `kosuke projects list --api-key X` works as the README shows.
49
49
  .showHelpAfterError('(add --help for usage)')
50
50
  .configureHelp(helpConfiguration(options.longHelp === true));
51
+ // Each command's help lists the output flags, or says it prints its own text.
52
+ setOwnOutput(program, OWN_OUTPUT);
51
53
  // Built lazily, on the first use, so `--help` and `--version` never touch
52
54
  // the credentials file.
53
55
  let runtime = null;
@@ -1,7 +1,7 @@
1
1
  import { readFileSync } from 'node:fs';
2
2
  import { Argument, Command, InvalidArgumentError, Option } from 'commander';
3
3
  import { addsSessionIdFlag, CLI_ONLY_FLAGS, omitsProject, SESSION_ID_FLAG, sessionIdField, } from './arguments.js';
4
- import { setAfterHelp, setOptionShape, shortSummary, usageError } from './help.js';
4
+ import { setAfterHelp, setFormFields, setOptionShape, shortSummary, usageError } from './help.js';
5
5
  import { buildRequest, execute, readWholeBody, UsageError } from './invoke.js';
6
6
  import { LIST_FLAG_HELP, listAnswer, shortList, shortRequestFields } from './list-defaults.js';
7
7
  import { collect, jsonParser } from './option-parsers.js';
@@ -32,7 +32,7 @@ export function attachCommand(root, forms, runtime, { reachable = () => true } =
32
32
  function attachLeaf(root, path, operation, runtime, hidden) {
33
33
  const parent = groupFor(root, path.slice(0, -1));
34
34
  const leaf = parent.command(path[path.length - 1], { hidden });
35
- leaf.description(operation.summary);
35
+ setFormFields(leaf.description(operation.summary), [operation], () => '');
36
36
  // `projectId, sessionId, ...`: commander takes one fewer, the project looked up (sessionArgs).
37
37
  const lookup = omitsProject(operation);
38
38
  for (const name of operation.pathParams) {
@@ -201,6 +201,7 @@ function attachForms(root, forms, runtime, reachable) {
201
201
  const visible = forms.filter(reachable);
202
202
  const lead = forms.find((form) => scopeOf(form) === 'workspace') ?? forms[0];
203
203
  leaf.description(lead.summary);
204
+ setFormFields(leaf, visible, (form) => formUsage(form, shape));
204
205
  if (shape.scope) {
205
206
  leaf.addArgument(new Argument(shape.scope.label, shape.scope.label === `<${PERSONAL}>`
206
207
  ? 'The word personal: this command works on your own only.'
@@ -352,13 +353,15 @@ async function run(leaf, runtime, operation, input, options = {}) {
352
353
  // `--fields` and `--format` pick from the platform's own JSON, so a text view steps aside.
353
354
  const { fields, format } = leaf.optsWithGlobals();
354
355
  const view = fields || format ? undefined : VIEWS[operation.command.join(' ')]?.view;
356
+ const context = { list: operation.command.at(-1) === 'list', declared: operation.fields };
355
357
  if (list && outcome.ok) {
356
358
  const sent = request;
357
359
  const short = await listAnswer(list.rules, list.call, outcome, (more) => execute(client, { ...sent, query: { ...sent.query, ...more } }, controller.signal));
358
- runtime.output(short.answer, { list: true, footer: short.footer });
360
+ runtime.output(short.answer, { ...context, list: true, footer: short.footer });
359
361
  return;
360
362
  }
361
- runtime.output(view && outcome.ok ? { ...outcome, body: view(outcome.body, options) } : outcome, { list: operation.command[operation.command.length - 1] === 'list' });
363
+ const answer = view && outcome.ok ? { ...outcome, body: view(outcome.body, options) } : outcome;
364
+ runtime.output(answer, context);
362
365
  }
363
366
  finally {
364
367
  process.removeListener('SIGINT', cancel);