@camunda8/cli 2.6.1 → 2.7.0-alpha.10
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 +80 -1
- package/dist/command-dispatch.d.ts +16 -0
- package/dist/command-dispatch.d.ts.map +1 -0
- package/dist/command-dispatch.js +129 -0
- package/dist/command-dispatch.js.map +1 -0
- package/dist/command-framework.d.ts +248 -0
- package/dist/command-framework.d.ts.map +1 -0
- package/dist/command-framework.js +229 -0
- package/dist/command-framework.js.map +1 -0
- package/dist/command-registry.d.ts +2089 -0
- package/dist/command-registry.d.ts.map +1 -0
- package/dist/command-registry.js +1482 -0
- package/dist/command-registry.js.map +1 -0
- package/dist/command-validation.d.ts +30 -4
- package/dist/command-validation.d.ts.map +1 -1
- package/dist/command-validation.js +90 -4
- package/dist/command-validation.js.map +1 -1
- package/dist/commands/completion.d.ts +25 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +590 -1223
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/deployments.d.ts +2 -0
- package/dist/commands/deployments.d.ts.map +1 -1
- package/dist/commands/deployments.js +13 -2
- package/dist/commands/deployments.js.map +1 -1
- package/dist/commands/forms.d.ts +2 -20
- package/dist/commands/forms.d.ts.map +1 -1
- package/dist/commands/forms.js +76 -79
- package/dist/commands/forms.js.map +1 -1
- package/dist/commands/help.d.ts +4 -88
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +574 -1941
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/identity-authorizations.d.ts +5 -24
- package/dist/commands/identity-authorizations.d.ts.map +1 -1
- package/dist/commands/identity-authorizations.js +113 -137
- package/dist/commands/identity-authorizations.js.map +1 -1
- package/dist/commands/identity-groups.d.ts +5 -26
- package/dist/commands/identity-groups.d.ts.map +1 -1
- package/dist/commands/identity-groups.js +91 -124
- package/dist/commands/identity-groups.js.map +1 -1
- package/dist/commands/identity-mapping-rules.d.ts +5 -30
- package/dist/commands/identity-mapping-rules.d.ts.map +1 -1
- package/dist/commands/identity-mapping-rules.js +106 -136
- package/dist/commands/identity-mapping-rules.js.map +1 -1
- package/dist/commands/identity-roles.d.ts +5 -26
- package/dist/commands/identity-roles.d.ts.map +1 -1
- package/dist/commands/identity-roles.js +91 -124
- package/dist/commands/identity-roles.js.map +1 -1
- package/dist/commands/identity-tenants.d.ts +5 -26
- package/dist/commands/identity-tenants.d.ts.map +1 -1
- package/dist/commands/identity-tenants.js +92 -126
- package/dist/commands/identity-tenants.js.map +1 -1
- package/dist/commands/identity-users.d.ts +5 -29
- package/dist/commands/identity-users.d.ts.map +1 -1
- package/dist/commands/identity-users.js +95 -129
- package/dist/commands/identity-users.js.map +1 -1
- package/dist/commands/identity.d.ts +6 -6
- package/dist/commands/identity.d.ts.map +1 -1
- package/dist/commands/identity.js +6 -7
- package/dist/commands/identity.js.map +1 -1
- package/dist/commands/incidents.d.ts +3 -16
- package/dist/commands/incidents.d.ts.map +1 -1
- package/dist/commands/incidents.js +71 -98
- package/dist/commands/incidents.js.map +1 -1
- package/dist/commands/jobs.d.ts +4 -26
- package/dist/commands/jobs.d.ts.map +1 -1
- package/dist/commands/jobs.js +143 -159
- package/dist/commands/jobs.js.map +1 -1
- package/dist/commands/mcp-proxy.d.ts +1 -0
- package/dist/commands/mcp-proxy.d.ts.map +1 -1
- package/dist/commands/mcp-proxy.js +10 -2
- package/dist/commands/mcp-proxy.js.map +1 -1
- package/dist/commands/messages.d.ts +2 -12
- package/dist/commands/messages.d.ts.map +1 -1
- package/dist/commands/messages.js +87 -81
- package/dist/commands/messages.js.map +1 -1
- package/dist/commands/open.d.ts +4 -0
- package/dist/commands/open.d.ts.map +1 -1
- package/dist/commands/open.js +18 -0
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/plugins.d.ts +7 -9
- package/dist/commands/plugins.d.ts.map +1 -1
- package/dist/commands/plugins.js +32 -25
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/process-definitions.d.ts +2 -14
- package/dist/commands/process-definitions.d.ts.map +1 -1
- package/dist/commands/process-definitions.js +57 -80
- package/dist/commands/process-definitions.js.map +1 -1
- package/dist/commands/process-instances.d.ts +8 -37
- package/dist/commands/process-instances.d.ts.map +1 -1
- package/dist/commands/process-instances.js +242 -193
- package/dist/commands/process-instances.js.map +1 -1
- package/dist/commands/profiles.d.ts +4 -0
- package/dist/commands/profiles.d.ts.map +1 -1
- package/dist/commands/profiles.js +29 -0
- package/dist/commands/profiles.js.map +1 -1
- package/dist/commands/run.d.ts +2 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +10 -0
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/search.d.ts +7 -100
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +530 -694
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/session.d.ts +3 -0
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +30 -0
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/topology.d.ts +1 -3
- package/dist/commands/topology.d.ts.map +1 -1
- package/dist/commands/topology.js +11 -18
- package/dist/commands/topology.js.map +1 -1
- package/dist/commands/user-tasks.d.ts +2 -16
- package/dist/commands/user-tasks.d.ts.map +1 -1
- package/dist/commands/user-tasks.js +73 -101
- package/dist/commands/user-tasks.js.map +1 -1
- package/dist/commands/watch.d.ts +1 -0
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +15 -0
- package/dist/commands/watch.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -1
- package/dist/default-plugins/cluster/README.md +1 -1
- package/dist/default-plugins/cluster/c8ctl-plugin.js +281 -59
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +111 -1023
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +5 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +7 -1
- package/dist/logger.js.map +1 -1
- package/dist/plugin-loader.d.ts +5 -0
- package/dist/plugin-loader.d.ts.map +1 -1
- package/dist/plugin-loader.js +1 -0
- package/dist/plugin-loader.js.map +1 -1
- package/dist/update-check.d.ts +67 -0
- package/dist/update-check.d.ts.map +1 -0
- package/dist/update-check.js +284 -0
- package/dist/update-check.js.map +1 -0
- package/package.json +3 -2
- /package/dist/templates/{tsconfig.json → tsconfig.json.template} +0 -0
package/README.md
CHANGED
|
@@ -65,6 +65,7 @@ c8ctl help fail # Shows fail command with all flags
|
|
|
65
65
|
c8ctl help activate # Shows activate command with all flags
|
|
66
66
|
c8ctl help publish # Shows publish command with all flags
|
|
67
67
|
c8ctl help correlate # Shows correlate command with all flags
|
|
68
|
+
c8ctl help cluster # Shows local cluster management help
|
|
68
69
|
c8ctl help profiles # Shows profile management help
|
|
69
70
|
c8ctl help plugin # Shows plugin management help
|
|
70
71
|
|
|
@@ -165,7 +166,23 @@ For comprehensive examples of all commands and their flags, see [EXAMPLES.md](EX
|
|
|
165
166
|
|
|
166
167
|
### Shell Completion
|
|
167
168
|
|
|
168
|
-
c8ctl supports shell completion for `bash`, `zsh`, and `fish`.
|
|
169
|
+
c8ctl supports shell completion for `bash`, `zsh`, and `fish`.
|
|
170
|
+
|
|
171
|
+
#### Quick Install (recommended)
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Auto-detect your shell and install completions
|
|
175
|
+
c8ctl completion install
|
|
176
|
+
|
|
177
|
+
# Or specify a shell explicitly
|
|
178
|
+
c8ctl completion install --shell zsh
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
This writes a completion script to the c8ctl data directory and wires it into your shell config (RC file for bash/zsh; completions directory for fish). Completions are **automatically refreshed** when c8ctl is upgraded — no manual re-install needed.
|
|
182
|
+
|
|
183
|
+
#### Manual Setup
|
|
184
|
+
|
|
185
|
+
If you prefer to manage the completion script yourself:
|
|
169
186
|
|
|
170
187
|
#### Bash
|
|
171
188
|
|
|
@@ -568,6 +585,67 @@ c8ctl help list # → JSON for specific command
|
|
|
568
585
|
|
|
569
586
|
---
|
|
570
587
|
|
|
588
|
+
### Local Cluster
|
|
589
|
+
|
|
590
|
+
c8ctl includes a built-in `cluster` command for managing a local Camunda 8 instance (powered by a default plugin). No Docker or docker-compose required — it downloads and runs Camunda directly.
|
|
591
|
+
|
|
592
|
+
```bash
|
|
593
|
+
# Start the latest stable version
|
|
594
|
+
c8ctl cluster start
|
|
595
|
+
|
|
596
|
+
# Start a specific version
|
|
597
|
+
c8ctl cluster start 8.9
|
|
598
|
+
c8ctl cluster start 8.9.0-alpha5
|
|
599
|
+
|
|
600
|
+
# Stop the running cluster
|
|
601
|
+
c8ctl cluster stop
|
|
602
|
+
|
|
603
|
+
# Check cluster status
|
|
604
|
+
c8ctl cluster status
|
|
605
|
+
|
|
606
|
+
# Stream cluster logs
|
|
607
|
+
c8ctl cluster logs
|
|
608
|
+
|
|
609
|
+
# List locally cached versions
|
|
610
|
+
c8ctl cluster list
|
|
611
|
+
|
|
612
|
+
# List available remote versions
|
|
613
|
+
c8ctl cluster list-remote
|
|
614
|
+
|
|
615
|
+
# Pre-download a version without starting it
|
|
616
|
+
c8ctl cluster install 8.9
|
|
617
|
+
|
|
618
|
+
# Remove a cached version
|
|
619
|
+
c8ctl cluster delete 8.9
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
#### Version Aliases
|
|
623
|
+
|
|
624
|
+
Instead of an exact version number, you can use:
|
|
625
|
+
|
|
626
|
+
- **`stable`** — the latest GA release (highest minor version that has shipped a `.0` release)
|
|
627
|
+
- **`alpha`** — the latest alpha-train release (highest minor version overall, which may only have alpha builds)
|
|
628
|
+
- **A major.minor pattern** like `8.9` — resolves to the latest patch/alpha within that minor
|
|
629
|
+
|
|
630
|
+
`c8ctl cluster start` with no version argument defaults to `stable`.
|
|
631
|
+
|
|
632
|
+
```bash
|
|
633
|
+
c8ctl cluster start stable
|
|
634
|
+
c8ctl cluster start alpha
|
|
635
|
+
c8ctl cluster start 8.9 # latest 8.9.x
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
#### Online vs Offline Behaviour
|
|
639
|
+
|
|
640
|
+
- **`cluster start`** prefers locally cached versions. If the requested version is already installed, it starts immediately without going online. A non-blocking background check runs to hint if a newer build is available, but never delays startup.
|
|
641
|
+
- **`cluster install`** always checks the remote download server for the latest build. If a newer ETag is detected for an already-installed version, it re-downloads.
|
|
642
|
+
- **`cluster list-remote`** fetches the full list of available versions from the download server.
|
|
643
|
+
- **Offline fallback**: if the network is unavailable, alias resolution falls back to a locally cached mapping, then to a hardcoded default.
|
|
644
|
+
|
|
645
|
+
Run `c8ctl help cluster` for full details. See [EXAMPLES.md](EXAMPLES.md#local-cluster) for a complete local development workflow.
|
|
646
|
+
|
|
647
|
+
---
|
|
648
|
+
|
|
571
649
|
### Core Components
|
|
572
650
|
|
|
573
651
|
- **Logger** (`src/logger.ts`): Handles output in text or JSON mode
|
|
@@ -604,6 +682,7 @@ c8ctl <verb> <resource> [arguments] [flags]
|
|
|
604
682
|
- `sync` - Synchronize plugins
|
|
605
683
|
- `use` - Set active profile or tenant
|
|
606
684
|
- `output` - Show or set output format
|
|
685
|
+
- `cluster` - Manage local Camunda 8 cluster (start, stop, status, logs, install, delete, list, list-remote)
|
|
607
686
|
- `completion` - Generate shell completion script
|
|
608
687
|
- `feedback` - Open the feedback page to report issues or request features
|
|
609
688
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry-driven command dispatch map.
|
|
3
|
+
*
|
|
4
|
+
* Maps "verb:resource" keys to command handlers. For resourceless verbs
|
|
5
|
+
* (deploy, run, watch, etc.), the key is "verb:".
|
|
6
|
+
*
|
|
7
|
+
* This replaces the ~1800-line if/else dispatch chain that previously
|
|
8
|
+
* lived in index.ts.
|
|
9
|
+
*/
|
|
10
|
+
import type { AnyCommandHandler } from "./command-framework.ts";
|
|
11
|
+
/**
|
|
12
|
+
* Dispatch map keyed by "verb:resource".
|
|
13
|
+
* For resourceless verbs the key is "verb:" (empty resource).
|
|
14
|
+
*/
|
|
15
|
+
export declare const COMMAND_DISPATCH: ReadonlyMap<string, AnyCommandHandler>;
|
|
16
|
+
//# sourceMappingURL=command-dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-dispatch.d.ts","sourceRoot":"","sources":["../src/command-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAmGhE;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAiHlE,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry-driven command dispatch map.
|
|
3
|
+
*
|
|
4
|
+
* Maps "verb:resource" keys to command handlers. For resourceless verbs
|
|
5
|
+
* (deploy, run, watch, etc.), the key is "verb:".
|
|
6
|
+
*
|
|
7
|
+
* This replaces the ~1800-line if/else dispatch chain that previously
|
|
8
|
+
* lived in index.ts.
|
|
9
|
+
*/
|
|
10
|
+
import { deployCommand } from "./commands/deployments.js";
|
|
11
|
+
import { getFormCommand } from "./commands/forms.js";
|
|
12
|
+
import { createIdentityAuthorizationCommand, createIdentityGroupCommand, createIdentityMappingRuleCommand, createIdentityRoleCommand, createIdentityTenantCommand, createIdentityUserCommand, deleteIdentityAuthorizationCommand, deleteIdentityGroupCommand, deleteIdentityMappingRuleCommand, deleteIdentityRoleCommand, deleteIdentityTenantCommand, deleteIdentityUserCommand, getIdentityAuthorizationCommand, getIdentityGroupCommand, getIdentityMappingRuleCommand, getIdentityRoleCommand, getIdentityTenantCommand, getIdentityUserCommand, listAuthorizationsCommand, listGroupsCommand, listMappingRulesCommand, listRolesCommand, listTenantsCommand, listUsersCommand, searchIdentityAuthorizationsCommand, searchIdentityGroupsCommand, searchIdentityMappingRulesCommand, searchIdentityRolesCommand, searchIdentityTenantsCommand, searchIdentityUsersCommand, } from "./commands/identity.js";
|
|
13
|
+
import { getIncidentCommand, listIncidentsCommand, resolveIncidentCommand, } from "./commands/incidents.js";
|
|
14
|
+
import { activateJobsCommand, completeJobCommand, failJobCommand, listJobsCommand, } from "./commands/jobs.js";
|
|
15
|
+
import { mcpProxyCommand } from "./commands/mcp-proxy.js";
|
|
16
|
+
import { correlateMessageCommand, publishMessageCommand, } from "./commands/messages.js";
|
|
17
|
+
import { feedbackCommand, openAppCommand } from "./commands/open.js";
|
|
18
|
+
import { downgradePluginCommand, initPluginCommand, listPluginsCommand, loadPluginCommand, syncPluginsCommand, unloadPluginCommand, upgradePluginCommand, } from "./commands/plugins.js";
|
|
19
|
+
import { getProcessDefinitionCommand, listProcessDefinitionsCommand, } from "./commands/process-definitions.js";
|
|
20
|
+
import { awaitProcessInstanceCommand, cancelProcessInstanceCommand, createProcessInstanceCommand, getProcessInstanceCommand, listProcessInstancesCommand, } from "./commands/process-instances.js";
|
|
21
|
+
import { addProfileCommand, listProfileCommand, removeProfileCommand, whichProfileCommand, } from "./commands/profiles.js";
|
|
22
|
+
import { runCommand } from "./commands/run.js";
|
|
23
|
+
import { searchIncidentsCommand, searchJobsCommand, searchProcessDefinitionsCommand, searchProcessInstancesCommand, searchUserTasksCommand, searchVariablesCommand, } from "./commands/search.js";
|
|
24
|
+
import { outputCommand, useProfileCommand, useTenantCommand, } from "./commands/session.js";
|
|
25
|
+
import { getTopologyCommand } from "./commands/topology.js";
|
|
26
|
+
import { completeUserTaskCommand, listUserTasksCommand, } from "./commands/user-tasks.js";
|
|
27
|
+
import { watchCommand } from "./commands/watch.js";
|
|
28
|
+
/**
|
|
29
|
+
* Dispatch map keyed by "verb:resource".
|
|
30
|
+
* For resourceless verbs the key is "verb:" (empty resource).
|
|
31
|
+
*/
|
|
32
|
+
export const COMMAND_DISPATCH = new Map([
|
|
33
|
+
// ── Session / profile ──────────────────────────────────────────────
|
|
34
|
+
["use:profile", useProfileCommand],
|
|
35
|
+
["use:tenant", useTenantCommand],
|
|
36
|
+
["output:", outputCommand],
|
|
37
|
+
["list:profile", listProfileCommand],
|
|
38
|
+
["add:profile", addProfileCommand],
|
|
39
|
+
["remove:profile", removeProfileCommand],
|
|
40
|
+
["which:profile", whichProfileCommand],
|
|
41
|
+
// ── Plugins ────────────────────────────────────────────────────────
|
|
42
|
+
["list:plugin", listPluginsCommand],
|
|
43
|
+
["load:plugin", loadPluginCommand],
|
|
44
|
+
["unload:plugin", unloadPluginCommand],
|
|
45
|
+
["sync:plugin", syncPluginsCommand],
|
|
46
|
+
["upgrade:plugin", upgradePluginCommand],
|
|
47
|
+
["downgrade:plugin", downgradePluginCommand],
|
|
48
|
+
["init:plugin", initPluginCommand],
|
|
49
|
+
// ── Process instances ──────────────────────────────────────────────
|
|
50
|
+
["list:process-instance", listProcessInstancesCommand],
|
|
51
|
+
["get:process-instance", getProcessInstanceCommand],
|
|
52
|
+
["create:process-instance", createProcessInstanceCommand],
|
|
53
|
+
["cancel:process-instance", cancelProcessInstanceCommand],
|
|
54
|
+
["await:process-instance", awaitProcessInstanceCommand],
|
|
55
|
+
// ── Process definitions ────────────────────────────────────────────
|
|
56
|
+
["list:process-definition", listProcessDefinitionsCommand],
|
|
57
|
+
["get:process-definition", getProcessDefinitionCommand],
|
|
58
|
+
// ── User tasks ─────────────────────────────────────────────────────
|
|
59
|
+
["list:user-task", listUserTasksCommand],
|
|
60
|
+
["complete:user-task", completeUserTaskCommand],
|
|
61
|
+
// ── Incidents ──────────────────────────────────────────────────────
|
|
62
|
+
["list:incident", listIncidentsCommand],
|
|
63
|
+
["get:incident", getIncidentCommand],
|
|
64
|
+
["resolve:incident", resolveIncidentCommand],
|
|
65
|
+
// ── Jobs ────────────────────────────────────────────────────────────
|
|
66
|
+
["list:jobs", listJobsCommand],
|
|
67
|
+
["activate:jobs", activateJobsCommand],
|
|
68
|
+
["complete:job", completeJobCommand],
|
|
69
|
+
["fail:job", failJobCommand],
|
|
70
|
+
// ── Messages ───────────────────────────────────────────────────────
|
|
71
|
+
["publish:message", publishMessageCommand],
|
|
72
|
+
["correlate:message", correlateMessageCommand],
|
|
73
|
+
// ── Topology / forms ───────────────────────────────────────────────
|
|
74
|
+
["get:topology", getTopologyCommand],
|
|
75
|
+
["get:form", getFormCommand],
|
|
76
|
+
// ── Search ─────────────────────────────────────────────────────────
|
|
77
|
+
["search:process-definition", searchProcessDefinitionsCommand],
|
|
78
|
+
["search:process-instance", searchProcessInstancesCommand],
|
|
79
|
+
["search:user-task", searchUserTasksCommand],
|
|
80
|
+
["search:incident", searchIncidentsCommand],
|
|
81
|
+
["search:jobs", searchJobsCommand],
|
|
82
|
+
["search:variable", searchVariablesCommand],
|
|
83
|
+
["search:user", searchIdentityUsersCommand],
|
|
84
|
+
["search:role", searchIdentityRolesCommand],
|
|
85
|
+
["search:group", searchIdentityGroupsCommand],
|
|
86
|
+
["search:tenant", searchIdentityTenantsCommand],
|
|
87
|
+
["search:authorization", searchIdentityAuthorizationsCommand],
|
|
88
|
+
["search:mapping-rule", searchIdentityMappingRulesCommand],
|
|
89
|
+
// ── Identity: list ─────────────────────────────────────────────────
|
|
90
|
+
["list:user", listUsersCommand],
|
|
91
|
+
["list:role", listRolesCommand],
|
|
92
|
+
["list:group", listGroupsCommand],
|
|
93
|
+
["list:tenant", listTenantsCommand],
|
|
94
|
+
["list:authorization", listAuthorizationsCommand],
|
|
95
|
+
["list:mapping-rule", listMappingRulesCommand],
|
|
96
|
+
// ── Identity: get ──────────────────────────────────────────────────
|
|
97
|
+
["get:user", getIdentityUserCommand],
|
|
98
|
+
["get:role", getIdentityRoleCommand],
|
|
99
|
+
["get:group", getIdentityGroupCommand],
|
|
100
|
+
["get:tenant", getIdentityTenantCommand],
|
|
101
|
+
["get:authorization", getIdentityAuthorizationCommand],
|
|
102
|
+
["get:mapping-rule", getIdentityMappingRuleCommand],
|
|
103
|
+
// ── Identity: create ───────────────────────────────────────────────
|
|
104
|
+
["create:user", createIdentityUserCommand],
|
|
105
|
+
["create:role", createIdentityRoleCommand],
|
|
106
|
+
["create:group", createIdentityGroupCommand],
|
|
107
|
+
["create:tenant", createIdentityTenantCommand],
|
|
108
|
+
["create:authorization", createIdentityAuthorizationCommand],
|
|
109
|
+
["create:mapping-rule", createIdentityMappingRuleCommand],
|
|
110
|
+
// ── Identity: delete ───────────────────────────────────────────────
|
|
111
|
+
["delete:user", deleteIdentityUserCommand],
|
|
112
|
+
["delete:role", deleteIdentityRoleCommand],
|
|
113
|
+
["delete:group", deleteIdentityGroupCommand],
|
|
114
|
+
["delete:tenant", deleteIdentityTenantCommand],
|
|
115
|
+
["delete:authorization", deleteIdentityAuthorizationCommand],
|
|
116
|
+
["delete:mapping-rule", deleteIdentityMappingRuleCommand],
|
|
117
|
+
// ── Resourceless verbs ─────────────────────────────────────────────
|
|
118
|
+
["deploy:", deployCommand],
|
|
119
|
+
["run:", runCommand],
|
|
120
|
+
["watch:", watchCommand],
|
|
121
|
+
["open:", openAppCommand],
|
|
122
|
+
["open:operate", openAppCommand],
|
|
123
|
+
["open:tasklist", openAppCommand],
|
|
124
|
+
["open:modeler", openAppCommand],
|
|
125
|
+
["open:optimize", openAppCommand],
|
|
126
|
+
["feedback:", feedbackCommand],
|
|
127
|
+
["mcp-proxy:", mcpProxyCommand],
|
|
128
|
+
]);
|
|
129
|
+
//# sourceMappingURL=command-dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-dispatch.js","sourceRoot":"","sources":["../src/command-dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACN,kCAAkC,EAClC,0BAA0B,EAC1B,gCAAgC,EAChC,yBAAyB,EACzB,2BAA2B,EAC3B,yBAAyB,EACzB,kCAAkC,EAClC,0BAA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cAAc,CAAC;IACjC,CAAC,WAAW,EAAE,eAAe,CAAC;IAC9B,CAAC,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC,CAAC"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-safe command definition framework.
|
|
3
|
+
*
|
|
4
|
+
* Provides `defineCommand(verb, resource, handler)` — flags and positionals
|
|
5
|
+
* are derived from the command registry, so handlers receive branded SDK types
|
|
6
|
+
* without any ceremony or `as` casts.
|
|
7
|
+
*
|
|
8
|
+
* Handlers return a `CommandResult` discriminated union. The framework renders
|
|
9
|
+
* results and catches errors in a single place, eliminating per-handler
|
|
10
|
+
* boilerplate for table/json output, empty-list messages, dry-run emission,
|
|
11
|
+
* sorting, and error handling.
|
|
12
|
+
*
|
|
13
|
+
* Phase 2 of #230.
|
|
14
|
+
*/
|
|
15
|
+
import type { CamundaClient } from "@camunda8/orchestration-cluster-api";
|
|
16
|
+
import { COMMAND_REGISTRY, type FlagDef, type PositionalDef } from "./command-registry.ts";
|
|
17
|
+
import { type Logger, type SortOrder } from "./logger.ts";
|
|
18
|
+
export type { PositionalDef };
|
|
19
|
+
/** Narrow type of the registry — preserves literal keys and `as const` values. */
|
|
20
|
+
type Registry = typeof COMMAND_REGISTRY;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the flag schema for a verb×resource pair.
|
|
23
|
+
*
|
|
24
|
+
* If the verb has `resourceFlags[R]`, use it. Otherwise fall back to
|
|
25
|
+
* the verb-level `flags` superset.
|
|
26
|
+
*/
|
|
27
|
+
export type ResolvedFlags<V extends keyof Registry, R extends string> = Registry[V] extends {
|
|
28
|
+
resourceFlags: Record<string, Record<string, FlagDef>>;
|
|
29
|
+
} ? R extends keyof Registry[V]["resourceFlags"] ? Registry[V]["resourceFlags"][R] : Registry[V]["flags"] : Registry[V]["flags"];
|
|
30
|
+
/**
|
|
31
|
+
* Resolve the positional schema for a verb×resource pair.
|
|
32
|
+
*
|
|
33
|
+
* If the verb has `resourcePositionals[R]`, use it. Otherwise the
|
|
34
|
+
* command has no positional arguments.
|
|
35
|
+
*/
|
|
36
|
+
export type ResolvedPositionals<V extends keyof Registry, R extends string> = Registry[V] extends {
|
|
37
|
+
resourcePositionals: Record<string, readonly PositionalDef[]>;
|
|
38
|
+
} ? R extends keyof Registry[V]["resourcePositionals"] ? Registry[V]["resourcePositionals"][R] : readonly [] : readonly [];
|
|
39
|
+
/**
|
|
40
|
+
* Map a flag schema to typed handler parameters.
|
|
41
|
+
*
|
|
42
|
+
* - Flags with `validate` → the validator's return type (branded) | undefined
|
|
43
|
+
* - Boolean flags → boolean | undefined
|
|
44
|
+
* - Everything else → string | undefined
|
|
45
|
+
*
|
|
46
|
+
* All flags are optional because CLI users may omit any flag.
|
|
47
|
+
*
|
|
48
|
+
* The type parameter is unconstrained so conditional types like
|
|
49
|
+
* `ResolvedFlags<V, R>` can be passed through without constraint errors.
|
|
50
|
+
*/
|
|
51
|
+
export type InferFlags<F extends Record<string, any>> = {
|
|
52
|
+
[K in keyof F]: F[K] extends {
|
|
53
|
+
validate: (v: string) => infer R;
|
|
54
|
+
} ? R | undefined : F[K] extends {
|
|
55
|
+
type: "boolean";
|
|
56
|
+
} ? boolean | undefined : string | undefined;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Map a readonly positional schema tuple to a named record of typed values.
|
|
60
|
+
*
|
|
61
|
+
* - Positionals with `validate` → the validator's return type
|
|
62
|
+
* - Positionals without `validate` → string
|
|
63
|
+
* - Required positionals → non-optional
|
|
64
|
+
* - Optional positionals → `| undefined`
|
|
65
|
+
*
|
|
66
|
+
* Accepts any type and uses a conditional guard so deferred types
|
|
67
|
+
* like `ResolvedPositionals<V, R>` pass through cleanly.
|
|
68
|
+
*/
|
|
69
|
+
export type InferPositionals<P> = P extends readonly PositionalDef[] ? {
|
|
70
|
+
[K in P[number] as K["name"]]: K extends {
|
|
71
|
+
validate: (v: string) => infer R;
|
|
72
|
+
} ? K extends {
|
|
73
|
+
required: true;
|
|
74
|
+
} ? R : R | undefined : K extends {
|
|
75
|
+
required: true;
|
|
76
|
+
} ? string : string | undefined;
|
|
77
|
+
} : Record<string, never>;
|
|
78
|
+
/**
|
|
79
|
+
* Discriminated union returned by command handlers.
|
|
80
|
+
*
|
|
81
|
+
* The framework's `execute` method renders these centrally — handlers
|
|
82
|
+
* never call `logger.table()` or `logger.json()` directly.
|
|
83
|
+
*/
|
|
84
|
+
/** List/search command: render as table or JSON array. */
|
|
85
|
+
export interface ListResult {
|
|
86
|
+
readonly kind: "list";
|
|
87
|
+
/** Already-mapped display rows (e.g. { Key, "Process ID", State }). */
|
|
88
|
+
readonly items: Record<string, unknown>[];
|
|
89
|
+
/** Message when items is empty (e.g. "No process instances found"). */
|
|
90
|
+
readonly emptyMessage: string;
|
|
91
|
+
}
|
|
92
|
+
/** Get command: render a single object as JSON. */
|
|
93
|
+
export interface GetResult {
|
|
94
|
+
readonly kind: "get";
|
|
95
|
+
/** The raw API response object. */
|
|
96
|
+
readonly data: unknown;
|
|
97
|
+
/** Optional info message logged before the JSON data (e.g. source hint). */
|
|
98
|
+
readonly message?: string;
|
|
99
|
+
}
|
|
100
|
+
/** Raw output: emit a string verbatim (e.g. BPMN XML). */
|
|
101
|
+
export interface RawResult {
|
|
102
|
+
readonly kind: "raw";
|
|
103
|
+
/** String content to output verbatim. */
|
|
104
|
+
readonly content: string;
|
|
105
|
+
}
|
|
106
|
+
/** Dry-run: handler determined a dry-run was emitted and wants to stop. */
|
|
107
|
+
export interface DryRunResult {
|
|
108
|
+
readonly kind: "dryRun";
|
|
109
|
+
/** Dry-run info object (passed to logger.json). */
|
|
110
|
+
readonly info: Record<string, unknown>;
|
|
111
|
+
}
|
|
112
|
+
/** Info message: no data to display, just a message (e.g. "User task has no form"). */
|
|
113
|
+
export interface InfoResult {
|
|
114
|
+
readonly kind: "info";
|
|
115
|
+
/** Message to display. */
|
|
116
|
+
readonly message: string;
|
|
117
|
+
}
|
|
118
|
+
/** Success message: a mutating operation succeeded (e.g. "Incident 77777 resolved"). */
|
|
119
|
+
export interface SuccessResult {
|
|
120
|
+
readonly kind: "success";
|
|
121
|
+
/** Human-readable success message. */
|
|
122
|
+
readonly message: string;
|
|
123
|
+
/** Optional resource key to display alongside the message. */
|
|
124
|
+
readonly key?: string | number;
|
|
125
|
+
}
|
|
126
|
+
/** No result: side-effectful command that handles its own output (e.g. deploy, run, open). */
|
|
127
|
+
export interface NoResult {
|
|
128
|
+
readonly kind: "none";
|
|
129
|
+
}
|
|
130
|
+
/** Never-returning command: runs indefinitely or takes over the process (e.g. watch, mcp-proxy). */
|
|
131
|
+
export interface NeverResult {
|
|
132
|
+
readonly kind: "never";
|
|
133
|
+
}
|
|
134
|
+
export type CommandResult = ListResult | GetResult | RawResult | DryRunResult | InfoResult | SuccessResult | NoResult | NeverResult;
|
|
135
|
+
/**
|
|
136
|
+
* Shared dependencies injected into every command handler.
|
|
137
|
+
*
|
|
138
|
+
* Replaces the current pattern where each handler independently calls
|
|
139
|
+
* createClient(), resolveTenantId(), getLogger().
|
|
140
|
+
*/
|
|
141
|
+
export interface CommandContext {
|
|
142
|
+
/** Authenticated SDK client for the active profile. */
|
|
143
|
+
client: CamundaClient;
|
|
144
|
+
/** Logger configured for the current output mode. */
|
|
145
|
+
logger: Logger;
|
|
146
|
+
/** Tenant ID from the active profile (undefined if not multi-tenant). */
|
|
147
|
+
tenantId: string | undefined;
|
|
148
|
+
/** Normalised resource name (e.g. "process-instance"). */
|
|
149
|
+
resource: string;
|
|
150
|
+
/** Positional arguments after verb and resource (e.g. the key in `get pi <key>`). */
|
|
151
|
+
positionals: string[];
|
|
152
|
+
/** Sort direction from --asc / --desc flags. */
|
|
153
|
+
sortOrder: SortOrder;
|
|
154
|
+
/** Sort field from --sortBy flag. */
|
|
155
|
+
sortBy: string | undefined;
|
|
156
|
+
/** Pagination limit from --limit flag (parsed to number). */
|
|
157
|
+
limit: number | undefined;
|
|
158
|
+
/** Whether --all was set (e.g. list all, disable default state filter). */
|
|
159
|
+
all: boolean | undefined;
|
|
160
|
+
/** Date range from --between flag (e.g. "7d", "2024-01-01..2024-12-31"). */
|
|
161
|
+
between: string | undefined;
|
|
162
|
+
/** Date field for --between filter. */
|
|
163
|
+
dateField: string | undefined;
|
|
164
|
+
/** Version filter (parsed from --version flag). */
|
|
165
|
+
version?: number | undefined;
|
|
166
|
+
/** Whether --dry-run was set. */
|
|
167
|
+
dryRun: boolean | undefined;
|
|
168
|
+
/** Active profile name (for client/tenant resolution). */
|
|
169
|
+
profile: string | undefined;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Return type of `defineCommand`. Stores the verb, resource, and an
|
|
173
|
+
* `execute` method that deserializes raw CLI input and calls the handler
|
|
174
|
+
* with fully typed flags and positionals.
|
|
175
|
+
*/
|
|
176
|
+
export interface CommandHandler<V extends keyof Registry, R extends string> {
|
|
177
|
+
verb: V;
|
|
178
|
+
resource: R;
|
|
179
|
+
execute: (ctx: CommandContext, rawValues: Record<string, unknown>, rawArgs: string[]) => Promise<void>;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Type-erased command handler for use in dispatch maps.
|
|
183
|
+
* Preserves the `execute` signature without carrying generic type params.
|
|
184
|
+
*/
|
|
185
|
+
export type AnyCommandHandler = CommandHandler<keyof Registry, string>;
|
|
186
|
+
/**
|
|
187
|
+
* Define a command handler for a verb×resource pair.
|
|
188
|
+
*
|
|
189
|
+
* Flags and positionals are derived from the command registry —
|
|
190
|
+
* no ceremony, no duplication. The handler receives fully typed
|
|
191
|
+
* parameters.
|
|
192
|
+
*
|
|
193
|
+
* ```ts
|
|
194
|
+
* export const getProcessDefinition = defineCommand(
|
|
195
|
+
* "get",
|
|
196
|
+
* "process-definition",
|
|
197
|
+
* async (ctx, flags, args) => {
|
|
198
|
+
* // ctx.client is CamundaClient
|
|
199
|
+
* // flags.xml is boolean | undefined
|
|
200
|
+
* // args.key is ProcessDefinitionKey
|
|
201
|
+
* },
|
|
202
|
+
* );
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
export declare function defineCommand<V extends keyof Registry, R extends string>(verb: V, resource: R, handler: (ctx: CommandContext, flags: InferFlags<ResolvedFlags<V, R>>, args: InferPositionals<ResolvedPositionals<V, R>>) => Promise<CommandResult | undefined>): CommandHandler<V, R>;
|
|
206
|
+
/**
|
|
207
|
+
* Deserialize raw parseArgs values into typed flags.
|
|
208
|
+
*
|
|
209
|
+
* For each flag in the schema:
|
|
210
|
+
* - If the flag has a `validate` function and the raw value is a non-empty
|
|
211
|
+
* string, call the validator (which returns a branded type).
|
|
212
|
+
* - If the flag is boolean, extract the boolean value.
|
|
213
|
+
* - Otherwise, extract the string value.
|
|
214
|
+
*
|
|
215
|
+
* Validators that throw are intentionally NOT caught here — validation
|
|
216
|
+
* errors should propagate to the top-level error handler.
|
|
217
|
+
*/
|
|
218
|
+
export declare function deserializeFlags<F extends Record<string, FlagDef>>(values: Record<string, unknown>, flagDefs: F): InferFlags<F>;
|
|
219
|
+
/**
|
|
220
|
+
* Deserialize raw positional strings into a typed named record.
|
|
221
|
+
*
|
|
222
|
+
* For each positional in the schema (in order):
|
|
223
|
+
* - If required and missing, exits with an error message.
|
|
224
|
+
* - If a `validate` function is present, calls it to produce a branded type.
|
|
225
|
+
* - Otherwise, passes the raw string through.
|
|
226
|
+
*
|
|
227
|
+
* Returns a named record keyed by each positional's `name`.
|
|
228
|
+
*/
|
|
229
|
+
export declare function deserializePositionals<P extends readonly PositionalDef[]>(raw: string[], positionalDefs: P, verb: string, resource: string): InferPositionals<P>;
|
|
230
|
+
/**
|
|
231
|
+
* Check if dry-run mode is active and return a `DryRunResult` if so.
|
|
232
|
+
*
|
|
233
|
+
* Usage in handlers:
|
|
234
|
+
* ```ts
|
|
235
|
+
* const dr = dryRun({ command: "list pi", method: "POST", endpoint: "/process-instances/search", profile, body: filter });
|
|
236
|
+
* if (dr) return dr;
|
|
237
|
+
* ```
|
|
238
|
+
*
|
|
239
|
+
* Replaces the old `emitDryRun()` side-effecting pattern.
|
|
240
|
+
*/
|
|
241
|
+
export declare function dryRun(opts: {
|
|
242
|
+
command: string;
|
|
243
|
+
method: string;
|
|
244
|
+
endpoint: string;
|
|
245
|
+
profile?: string;
|
|
246
|
+
body?: unknown;
|
|
247
|
+
}): DryRunResult | null;
|
|
248
|
+
//# sourceMappingURL=command-framework.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-framework.d.ts","sourceRoot":"","sources":["../src/command-framework.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,EACN,gBAAgB,EAEhB,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAEN,KAAK,MAAM,EACX,KAAK,SAAS,EAEd,MAAM,aAAa,CAAC;AAGrB,YAAY,EAAE,aAAa,EAAE,CAAC;AAI9B,kFAAkF;AAClF,KAAK,QAAQ,GAAG,OAAO,gBAAgB,CAAC;AAIxC;;;;;GAKG;AACH,MAAM,MAAM,aAAa,CACxB,CAAC,SAAS,MAAM,QAAQ,EACxB,CAAC,SAAS,MAAM,IACb,QAAQ,CAAC,CAAC,CAAC,SAAS;IACvB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACvD,GACE,CAAC,SAAS,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,GAC3C,QAAQ,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,GAC/B,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GACrB,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AAExB;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,CAC9B,CAAC,SAAS,MAAM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