@camunda8/cli 2.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +387 -0
  3. package/dist/client.d.ts +9 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +39 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/commands/deployments.d.ts +10 -0
  8. package/dist/commands/deployments.d.ts.map +1 -0
  9. package/dist/commands/deployments.js +221 -0
  10. package/dist/commands/deployments.js.map +1 -0
  11. package/dist/commands/help.d.ts +20 -0
  12. package/dist/commands/help.d.ts.map +1 -0
  13. package/dist/commands/help.js +116 -0
  14. package/dist/commands/help.js.map +1 -0
  15. package/dist/commands/incidents.d.ts +18 -0
  16. package/dist/commands/incidents.d.ts.map +1 -0
  17. package/dist/commands/incidents.js +62 -0
  18. package/dist/commands/incidents.js.map +1 -0
  19. package/dist/commands/jobs.d.ts +36 -0
  20. package/dist/commands/jobs.d.ts.map +1 -0
  21. package/dist/commands/jobs.js +129 -0
  22. package/dist/commands/jobs.js.map +1 -0
  23. package/dist/commands/messages.d.ts +22 -0
  24. package/dist/commands/messages.d.ts.map +1 -0
  25. package/dist/commands/messages.js +48 -0
  26. package/dist/commands/messages.js.map +1 -0
  27. package/dist/commands/plugins.d.ts +17 -0
  28. package/dist/commands/plugins.d.ts.map +1 -0
  29. package/dist/commands/plugins.js +113 -0
  30. package/dist/commands/plugins.js.map +1 -0
  31. package/dist/commands/process-instances.d.ts +34 -0
  32. package/dist/commands/process-instances.d.ts.map +1 -0
  33. package/dist/commands/process-instances.js +116 -0
  34. package/dist/commands/process-instances.js.map +1 -0
  35. package/dist/commands/profiles.d.ts +23 -0
  36. package/dist/commands/profiles.d.ts.map +1 -0
  37. package/dist/commands/profiles.js +76 -0
  38. package/dist/commands/profiles.js.map +1 -0
  39. package/dist/commands/run.d.ts +11 -0
  40. package/dist/commands/run.d.ts.map +1 -0
  41. package/dist/commands/run.js +61 -0
  42. package/dist/commands/run.js.map +1 -0
  43. package/dist/commands/session.d.ts +20 -0
  44. package/dist/commands/session.d.ts.map +1 -0
  45. package/dist/commands/session.js +54 -0
  46. package/dist/commands/session.js.map +1 -0
  47. package/dist/commands/topology.d.ts +10 -0
  48. package/dist/commands/topology.d.ts.map +1 -0
  49. package/dist/commands/topology.js +21 -0
  50. package/dist/commands/topology.js.map +1 -0
  51. package/dist/commands/user-tasks.d.ts +20 -0
  52. package/dist/commands/user-tasks.d.ts.map +1 -0
  53. package/dist/commands/user-tasks.js +78 -0
  54. package/dist/commands/user-tasks.js.map +1 -0
  55. package/dist/commands/watch.d.ts +10 -0
  56. package/dist/commands/watch.d.ts.map +1 -0
  57. package/dist/commands/watch.js +76 -0
  58. package/dist/commands/watch.js.map +1 -0
  59. package/dist/config.d.ts +129 -0
  60. package/dist/config.d.ts.map +1 -0
  61. package/dist/config.js +356 -0
  62. package/dist/config.js.map +1 -0
  63. package/dist/index.d.ts +7 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +405 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/logger.d.ts +22 -0
  68. package/dist/logger.d.ts.map +1 -0
  69. package/dist/logger.js +132 -0
  70. package/dist/logger.js.map +1 -0
  71. package/dist/plugin-loader.d.ts +32 -0
  72. package/dist/plugin-loader.d.ts.map +1 -0
  73. package/dist/plugin-loader.js +104 -0
  74. package/dist/plugin-loader.js.map +1 -0
  75. package/dist/runtime.d.ts +20 -0
  76. package/dist/runtime.d.ts.map +1 -0
  77. package/dist/runtime.js +35 -0
  78. package/dist/runtime.js.map +1 -0
  79. package/package.json +61 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,387 @@
1
+ # c8ctl - Camunda 8 CLI
2
+
3
+ A minimal-dependency CLI for Camunda 8 operations built on top of `@camunda8/orchestration-cluster-api`.
4
+
5
+ ## Features
6
+
7
+ - **Minimal Dependencies**: Only one runtime dependency (`@camunda8/orchestration-cluster-api`)
8
+ - **Native TypeScript**: Runs directly with Node.js 22.18+ (no compilation needed)
9
+ - **Multi-Tenant Support**: Full support for multi-tenancy across all operations
10
+ - **Profile Management**: Store and manage multiple cluster configurations
11
+ - **Camunda Modeler Integration**: Automatically import and use profiles from Camunda Modeler
12
+ - **Plugin System**: Extend c8ctl with custom commands via npm packages
13
+ - **Session State**: Maintain active profile, tenant, and output preferences
14
+ - **Building Block Deployment**: Automatic prioritization of `_bb-` folders during deployment
15
+ - **Flexible Output**: Switch between human-readable text and JSON output modes
16
+
17
+ ## Architecture
18
+
19
+ ### Core Components
20
+
21
+ - **Logger** (`src/logger.ts`): Handles output in text or JSON mode
22
+ - **Config** (`src/config.ts`): Manages profiles, session state, and credential resolution
23
+ - **Client** (`src/client.ts`): Factory for creating Camunda 8 SDK clients
24
+ - **Commands** (`src/commands/`): Domain-specific command handlers
25
+
26
+ ### Credential Resolution Order
27
+
28
+ 1. `--profile` flag (one-off override, supports both c8ctl and modeler profiles)
29
+ 2. Active profile from session state
30
+ 3. Environment variables (`CAMUNDA_*`)
31
+ 4. Localhost fallback (`http://localhost:8080/v2`)
32
+
33
+ **Note**: Modeler profiles can be used anywhere a c8ctl profile is expected by using the `modeler:` prefix (e.g., `--profile=modeler:Local Dev` or `c8 use profile modeler:Cloud Cluster`).
34
+
35
+ ### Tenant Resolution Order
36
+
37
+ 1. Active tenant from session state
38
+ 2. Default tenant from active profile
39
+ 3. `CAMUNDA_DEFAULT_TENANT_ID` environment variable
40
+ 4. `<default>` tenant
41
+
42
+ ## Installation
43
+
44
+ ### Requirements
45
+
46
+ - Node.js >= 22.18.0 (for native TypeScript support)
47
+
48
+ ### Global Installation (Recommended)
49
+
50
+ ```bash
51
+ npm install @camunda8/cli -g
52
+ ```
53
+
54
+ After installation, the CLI is available as `c8ctl` (or its alias `c8`).
55
+
56
+ **Note**: The `c8` alias provides typing ergonomics for common keyboard layouts - the `c` key (left index finger) followed by `8` (right middle finger) makes for a comfortable typing experience on both QWERTY and QWERTZ keyboards.
57
+
58
+ ### Local Development
59
+
60
+ ```bash
61
+ npm install
62
+ ```
63
+
64
+ ## Usage
65
+
66
+ ### Basic Commands
67
+
68
+ ```bash
69
+ # Show help
70
+ c8ctl help
71
+
72
+ # Show version
73
+ c8ctl --version
74
+
75
+ # List process instances (using alias 'pi')
76
+ c8ctl list pi
77
+ # Or using full command name
78
+ c8ctl list process-instances
79
+
80
+ # Get process instance by key
81
+ c8ctl get pi 123456
82
+ c8ctl get process-instance 123456
83
+
84
+ # Create process instance
85
+ c8ctl create pi --bpmnProcessId=myProcess
86
+ c8ctl create process-instance --bpmnProcessId=myProcess
87
+
88
+ # Deploy BPMN file
89
+ c8ctl deploy ./my-process.bpmn
90
+
91
+ # Deploy current directory
92
+ c8ctl deploy
93
+
94
+ # Deploy and start process (run)
95
+ c8ctl run ./my-process.bpmn
96
+ ```
97
+
98
+ ### Credential Resolution
99
+
100
+ Credentials are resolved in the following order:
101
+
102
+ 1. `--profile` flag (one-off override)
103
+ 2. Active profile from session state
104
+ 3. Environment variables (`CAMUNDA_*`)
105
+ 4. Localhost fallback (`http://localhost:8080`)
106
+
107
+ **Note**: Credential configuration via environment variables follows the same conventions as the `@camunda8/orchestration-cluster-api` module.
108
+
109
+ ```bash
110
+ # Using environment variables
111
+ export CAMUNDA_BASE_URL=https://camunda.example.com
112
+ export CAMUNDA_CLIENT_ID=your-client-id
113
+ export CAMUNDA_CLIENT_SECRET=your-client-secret
114
+ c8ctl list process-instances
115
+
116
+ # Using profile override
117
+ c8ctl list process-instances --profile prod
118
+ ```
119
+
120
+ ### Tenant Resolution
121
+
122
+ Tenants are resolved in the following order:
123
+
124
+ 1. Active tenant from session state
125
+ 2. Default tenant from active profile
126
+ 3. `CAMUNDA_DEFAULT_TENANT_ID` environment variable
127
+ 4. `<default>` tenant
128
+
129
+ ```bash
130
+ # Set active tenant for the session
131
+ c8ctl use tenant my-tenant-id
132
+
133
+ # Now all commands use this tenant
134
+ c8ctl list process-instances
135
+ ```
136
+
137
+ ### Profile Management
138
+
139
+ c8ctl supports two types of profiles:
140
+ 1. **c8ctl profiles**: Managed directly by c8ctl
141
+ 2. **Camunda Modeler profiles**: Automatically imported from Camunda Modeler (with `modeler:` prefix)
142
+
143
+ ```bash
144
+ # Add a c8ctl profile
145
+ c8 add profile prod --baseUrl=https://camunda.example.com --clientId=xxx --clientSecret=yyy
146
+
147
+ # List all profiles (includes both c8ctl and modeler profiles)
148
+ c8 list profiles
149
+
150
+ # Set active profile (works with both types)
151
+ c8 use profile prod
152
+ c8 use profile modeler:Local Dev
153
+
154
+ # Remove c8ctl profile (modeler profiles are read-only)
155
+ c8 remove profile prod
156
+ ```
157
+
158
+ #### Camunda Modeler Integration
159
+
160
+ c8ctl automatically reads profiles from Camunda Modeler's `profiles.json` file. These profiles are:
161
+ - **Read-only**: Cannot be modified or deleted via c8ctl
162
+ - **Prefixed**: Always displayed with `modeler:` prefix (e.g., `modeler:Local Dev`)
163
+ - **Dynamic**: Loaded fresh on each command execution (no caching)
164
+ - **Platform-specific locations**:
165
+ - Linux: `~/.config/camunda-modeler/profiles.json`
166
+ - macOS: `~/Library/Application Support/camunda-modeler/profiles.json`
167
+ - Windows: `%APPDATA%\camunda-modeler\profiles.json`
168
+
169
+ **Using modeler profiles:**
170
+ ```bash
171
+ # List includes modeler profiles with 'modeler:' prefix
172
+ c8 list profiles
173
+
174
+ # Use a modeler profile by name
175
+ c8 use profile modeler:Local Dev
176
+
177
+ # Use a modeler profile by cluster ID
178
+ c8 use profile modeler:abc123-def456
179
+
180
+ # One-off command with modeler profile
181
+ c8 list pi --profile=modeler:Cloud Cluster
182
+ ```
183
+
184
+ **URL Construction:**
185
+ - **Self-managed** (localhost): Appends `/v2` to the URL (e.g., `http://localhost:8080/v2`)
186
+ - **Cloud**: Uses the cluster URL as-is (e.g., `https://abc123.region.zeebe.camunda.io`)
187
+ - **Any port**: Supports any port number in the URL
188
+
189
+ ### Session Management
190
+
191
+ ```bash
192
+ # Switch to JSON output
193
+ c8ctl output json
194
+
195
+ # Switch back to text output
196
+ c8ctl output text
197
+ ```
198
+
199
+ ### Debug Mode
200
+
201
+ Enable debug logging to see detailed information about plugin loading and other internal operations:
202
+
203
+ ```bash
204
+ # Enable debug mode with environment variable
205
+ DEBUG=1 c8 <command>
206
+
207
+ # Or use C8CTL_DEBUG
208
+ C8CTL_DEBUG=true c8 <command>
209
+
210
+ # Example: See plugin loading details
211
+ DEBUG=1 c8 list plugins
212
+ ```
213
+
214
+ Debug output is written to stderr with timestamps and won't interfere with normal command output.
215
+
216
+ ### Plugin Management
217
+
218
+ c8ctl supports a plugin system that allows extending the CLI with custom commands via npm packages.
219
+
220
+ ```bash
221
+ # Load a plugin from npm registry
222
+ c8ctl load plugin <package-name>
223
+
224
+ # Load a plugin from a URL (including file URLs)
225
+ c8ctl load plugin --from <url>
226
+ c8ctl load plugin --from file:///path/to/plugin
227
+ c8ctl load plugin --from https://github.com/user/repo
228
+ c8ctl load plugin --from git://github.com/user/repo.git
229
+
230
+ # Unload a plugin (wraps npm uninstall)
231
+ c8ctl unload plugin <package-name>
232
+
233
+ # List installed plugins
234
+ c8ctl list plugins
235
+ ```
236
+
237
+ **Plugin Requirements:**
238
+ - Plugin packages must be regular Node.js modules
239
+ - They must include a `c8ctl-plugin.js` or `c8ctl-plugin.ts` file in the root directory
240
+ - The plugin file must export a `commands` object
241
+ - Plugins are installed in `node_modules` like regular npm packages
242
+ - The runtime object `c8ctl` provides environment information to plugins
243
+
244
+ **Example Plugin Structure:**
245
+ ```typescript
246
+ // c8ctl-plugin.ts
247
+ export const commands = {
248
+ analyze: async (args: string[]) => {
249
+ console.log('Analyzing...', args);
250
+ }
251
+ };
252
+ ```
253
+
254
+ ### Resource Aliases
255
+
256
+ - `pi` = process-instance(s)
257
+ - `ut` = user-task(s)
258
+ - `inc` = incident(s)
259
+ - `msg` = message
260
+
261
+ ### Command Structure
262
+
263
+ ```
264
+ c8ctl <verb> <resource> [arguments] [flags]
265
+ ```
266
+
267
+ **Verbs**: list, get, create, cancel, complete, fail, activate, resolve, publish, correlate, deploy, run, add, remove, use, output
268
+
269
+ **Resources**: process-instance, user-task, incident, job, message, topology, profile, tenant
270
+
271
+ ## Testing
272
+
273
+ ### Run All Tests
274
+
275
+ ```bash
276
+ npm test
277
+ ```
278
+
279
+ ### Run Unit Tests Only
280
+
281
+ ```bash
282
+ npm run test:unit
283
+ ```
284
+
285
+ ### Run Integration Tests
286
+
287
+ Integration tests require a running Camunda 8 instance at `http://localhost:8080`.
288
+
289
+ 1. Start a local Camunda 8 instance (e.g., using c8run)
290
+ 2. Run: `npm run test:integration`
291
+
292
+ ## Development
293
+
294
+ ### Project Structure
295
+
296
+ ```
297
+ c8ctl/
298
+ ├── src/
299
+ │ ├── index.ts # CLI entry point
300
+ │ ├── logger.ts # Output handling
301
+ │ ├── config.ts # Configuration management
302
+ │ ├── client.ts # SDK client factory
303
+ │ └── commands/ # Command handlers
304
+ │ ├── help.ts
305
+ │ ├── session.ts
306
+ │ ├── profiles.ts
307
+ │ ├── process-instances.ts
308
+ │ ├── user-tasks.ts
309
+ │ ├── incidents.ts
310
+ │ ├── jobs.ts
311
+ │ ├── messages.ts
312
+ │ ├── topology.ts
313
+ │ ├── deployments.ts
314
+ │ └── run.ts
315
+ ├── tests/
316
+ │ ├── unit/ # Unit tests
317
+ │ ├── integration/ # Integration tests
318
+ │ └── fixtures/ # Test fixtures
319
+ ├── package.json
320
+ ├── tsconfig.json
321
+ └── README.md
322
+ ```
323
+
324
+ ### Running the CLI
325
+
326
+ ```bash
327
+ # If installed globally
328
+ c8ctl <command>
329
+ # Or using the alias
330
+ c8 <command>
331
+
332
+ # For local development with Node.js 22.18+ (native TypeScript)
333
+ node src/index.ts <command>
334
+ ```
335
+
336
+ ### Adding New Commands
337
+
338
+ 1. Create command handler in `src/commands/`
339
+ 2. Wire into `src/index.ts` command routing
340
+ 3. Add tests in `tests/unit/` and `tests/integration/`
341
+ 4. Update help text in `src/commands/help.ts`
342
+ 5. Document in `EXAMPLES.md`
343
+
344
+ ## Environment Variables
345
+
346
+ - `CAMUNDA_BASE_URL`: Cluster base URL
347
+ - `CAMUNDA_CLIENT_ID`: OAuth client ID
348
+ - `CAMUNDA_CLIENT_SECRET`: OAuth client secret
349
+ - `CAMUNDA_AUDIENCE`: OAuth audience
350
+ - `CAMUNDA_OAUTH_URL`: OAuth token endpoint
351
+ - `CAMUNDA_DEFAULT_TENANT_ID`: Default tenant ID
352
+
353
+ ## Configuration Files
354
+
355
+ ### c8ctl Configuration
356
+
357
+ Configuration is stored in platform-specific user data directories:
358
+
359
+ - **Linux**: `~/.local/share/c8ctl/`
360
+ - **macOS**: `~/Library/Application Support/c8ctl/`
361
+ - **Windows**: `%APPDATA%\c8ctl\`
362
+
363
+ Files:
364
+ - `profiles.json`: Saved cluster configurations
365
+ - `session.json`: Active profile, tenant, and output mode
366
+
367
+ ### Camunda Modeler Configuration
368
+
369
+ c8ctl automatically reads profiles from Camunda Modeler (if installed):
370
+
371
+ - **Linux**: `~/.config/camunda-modeler/profiles.json`
372
+ - **macOS**: `~/Library/Application Support/camunda-modeler/profiles.json`
373
+ - **Windows**: `%APPDATA%\camunda-modeler\profiles.json`
374
+
375
+ Modeler profiles are:
376
+ - Read-only in c8ctl (managed via Camunda Modeler)
377
+ - Automatically loaded on each command execution
378
+ - Prefixed with `modeler:` when used in c8ctl
379
+ - Support both cloud and self-managed clusters
380
+
381
+ ## License
382
+
383
+ MIT
384
+
385
+ ## Contributing
386
+
387
+ See `COMMIT-MESSAGE-GUIDELINE.md` for commit message conventions.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * SDK client factory using resolved configuration
3
+ */
4
+ import { type CamundaClient } from '@camunda8/orchestration-cluster-api';
5
+ /**
6
+ * Create a Camunda 8 cluster client with resolved configuration
7
+ */
8
+ export declare function createClient(profileFlag?: string): CamundaClient;
9
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAG9F;;GAEG;AACH,wBAAgB,YAAY,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,aAAa,CAgChE"}
package/dist/client.js ADDED
@@ -0,0 +1,39 @@
1
+ /**
2
+ * SDK client factory using resolved configuration
3
+ */
4
+ import { createCamundaClient } from '@camunda8/orchestration-cluster-api';
5
+ import { resolveClusterConfig } from "./config.js";
6
+ /**
7
+ * Create a Camunda 8 cluster client with resolved configuration
8
+ */
9
+ export function createClient(profileFlag) {
10
+ const config = resolveClusterConfig(profileFlag);
11
+ // Build config object for the SDK
12
+ const sdkConfig = {
13
+ CAMUNDA_REST_ADDRESS: config.baseUrl,
14
+ };
15
+ // Add OAuth configuration if present
16
+ if (config.clientId && config.clientSecret) {
17
+ sdkConfig.CAMUNDA_AUTH_STRATEGY = 'OAUTH';
18
+ sdkConfig.CAMUNDA_CLIENT_ID = config.clientId;
19
+ sdkConfig.CAMUNDA_CLIENT_SECRET = config.clientSecret;
20
+ if (config.audience) {
21
+ sdkConfig.CAMUNDA_OAUTH_AUDIENCE = config.audience;
22
+ }
23
+ if (config.oAuthUrl) {
24
+ sdkConfig.CAMUNDA_OAUTH_URL = config.oAuthUrl;
25
+ }
26
+ }
27
+ // Add Basic auth configuration if present
28
+ else if (config.username && config.password) {
29
+ sdkConfig.CAMUNDA_AUTH_STRATEGY = 'BASIC';
30
+ sdkConfig.CAMUNDA_BASIC_AUTH_USERNAME = config.username;
31
+ sdkConfig.CAMUNDA_BASIC_AUTH_PASSWORD = config.password;
32
+ }
33
+ // No authentication
34
+ else {
35
+ sdkConfig.CAMUNDA_AUTH_STRATEGY = 'NONE';
36
+ }
37
+ return createCamundaClient({ config: sdkConfig });
38
+ }
39
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAsB,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,WAAoB;IAC/C,MAAM,MAAM,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAEjD,kCAAkC;IAClC,MAAM,SAAS,GAAQ;QACrB,oBAAoB,EAAE,MAAM,CAAC,OAAO;KACrC,CAAC;IAEF,qCAAqC;IACrC,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QAC3C,SAAS,CAAC,qBAAqB,GAAG,OAAO,CAAC;QAC1C,SAAS,CAAC,iBAAiB,GAAG,MAAM,CAAC,QAAQ,CAAC;QAC9C,SAAS,CAAC,qBAAqB,GAAG,MAAM,CAAC,YAAY,CAAC;QACtD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,SAAS,CAAC,sBAAsB,GAAG,MAAM,CAAC,QAAQ,CAAC;QACrD,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,SAAS,CAAC,iBAAiB,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChD,CAAC;IACH,CAAC;IACD,0CAA0C;SACrC,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC5C,SAAS,CAAC,qBAAqB,GAAG,OAAO,CAAC;QAC1C,SAAS,CAAC,2BAA2B,GAAG,MAAM,CAAC,QAAQ,CAAC;QACxD,SAAS,CAAC,2BAA2B,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC1D,CAAC;IACD,oBAAoB;SACf,CAAC;QACJ,SAAS,CAAC,qBAAqB,GAAG,MAAM,CAAC;IAC3C,CAAC;IAED,OAAO,mBAAmB,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Deployment commands with building-block folder prioritization
3
+ */
4
+ /**
5
+ * Deploy resources
6
+ */
7
+ export declare function deploy(paths: string[], options: {
8
+ profile?: string;
9
+ }): Promise<void>;
10
+ //# sourceMappingURL=deployments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../../src/commands/deployments.ts"],"names":[],"mappings":"AAAA;;GAEG;AAwIH;;GAEG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8GhB"}