Skip to content

Commit ce0a2f3

Browse files
committed
Merge branch 'main' into copilot/dynamic-auth-config-c8ctl
2 parents 0c53c46 + fe794b4 commit ce0a2f3

36 files changed

+1255
-192
lines changed

.github/copilot-instructions.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,16 @@ Follow conventions in COMMIT-MESSAGE-GUIDELINE.md.
1111

1212
- this is a native Node.js project running TS files
1313
- there is no build step, files are run directly with Node.js >= 22.18.0
14+
- use modern Getter and Setter syntax for class properties. Examples:
15+
16+
```typescript
17+
class MyClass {
18+
private _myProp: string;
19+
get myProp(): string {
20+
return this._myProp;
21+
}
22+
set myProp(value: string) {
23+
this._myProp = value;
24+
}
25+
}
26+
```

EXAMPLES.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,14 @@ c8 output text
394394
### Load Plugin
395395

396396
```bash
397-
# Install a c8ctl plugin from npm
397+
# Install a c8ctl plugin from npm registry
398398
c8 load plugin my-custom-plugin
399399

400+
# Install a plugin from a URL (file, https, git, etc.)
401+
c8 load plugin --from https://github.com/user/my-plugin
402+
c8 load plugin --from file:///path/to/local/plugin
403+
c8 load plugin --from git://github.com/user/plugin.git
404+
400405
# The plugin is now available
401406
# (assuming the plugin exports an 'analyze' command)
402407
c8 analyze
@@ -418,7 +423,7 @@ c8 list plugins
418423

419424
**Plugin Development:**
420425

421-
Plugins should include a `c8ctl-plugin.js` or `c8ctl-plugin.ts` file that exports custom commands. The `c8ctl` runtime object provides environment information:
426+
Plugins must be regular Node.js modules with a `c8ctl-plugin.js` or `c8ctl-plugin.ts` file in the root directory. The plugin file must export a `commands` object. The `c8ctl` runtime object provides environment information:
422427

423428
```typescript
424429
// c8ctl-plugin.ts

README.md

Lines changed: 99 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,20 @@ A minimal-dependency CLI for Camunda 8 operations built on top of `@camunda8/orc
4545

4646
- Node.js >= 22.18.0 (for native TypeScript support)
4747

48-
### Install Dependencies
48+
### Global Installation (Recommended)
4949

5050
```bash
51-
npm install
51+
npm install @camunda8/cli -g
5252
```
5353

54-
### Make CLI Executable
54+
After installation, the CLI is available as `c8ctl` (or its alias `c8`).
5555

56-
The CLI runs directly with Node.js 22.18+ which has native TypeScript support:
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.
5757

58-
```bash
59-
# Run directly with Node.js
60-
node src/index.ts <command>
58+
### Local Development
6159

62-
# Or add an alias to your shell (recommended)
63-
alias c8='node src/index.ts'
60+
```bash
61+
npm install
6462
```
6563

6664
## Usage
@@ -69,28 +67,71 @@ alias c8='node src/index.ts'
6967

7068
```bash
7169
# Show help
72-
c8 help
70+
c8ctl help
7371

7472
# Show version
75-
c8 --version
73+
c8ctl --version
7674

77-
# List process instances
78-
c8 list pi
75+
# List process instances (using alias 'pi')
76+
c8ctl list pi
77+
# Or using full command name
78+
c8ctl list process-instances
7979

8080
# Get process instance by key
81-
c8 get pi 123456
81+
c8ctl get pi 123456
82+
c8ctl get process-instance 123456
8283

8384
# Create process instance
84-
c8 create pi --bpmnProcessId=myProcess
85+
c8ctl create pi --bpmnProcessId=myProcess
86+
c8ctl create process-instance --bpmnProcessId=myProcess
8587

8688
# Deploy BPMN file
87-
c8 deploy ./my-process.bpmn
89+
c8ctl deploy ./my-process.bpmn
8890

8991
# Deploy current directory
90-
c8 deploy
92+
c8ctl deploy
9193

9294
# Deploy and start process (run)
93-
c8 run ./my-process.bpmn
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
94135
```
95136

96137
### Profile Management
@@ -148,34 +189,55 @@ c8 list pi --profile=modeler:Cloud Cluster
148189
### Session Management
149190

150191
```bash
151-
# Set active tenant
152-
c8 use tenant my-tenant-id
153-
154192
# Switch to JSON output
155-
c8 output json
193+
c8ctl output json
156194

157195
# Switch back to text output
158-
c8 output text
196+
c8ctl output text
159197
```
160198

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+
161216
### Plugin Management
162217

163218
c8ctl supports a plugin system that allows extending the CLI with custom commands via npm packages.
164219

165220
```bash
166-
# Load a plugin (wraps npm install)
167-
c8 load plugin <package-name>
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
168229

169230
# Unload a plugin (wraps npm uninstall)
170-
c8 unload plugin <package-name>
231+
c8ctl unload plugin <package-name>
171232

172233
# List installed plugins
173-
c8 list plugins
234+
c8ctl list plugins
174235
```
175236

176237
**Plugin Requirements:**
177-
- Plugin packages must include a `c8ctl-plugin.js` or `c8ctl-plugin.ts` file
178-
- The plugin file should export custom commands
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
179241
- Plugins are installed in `node_modules` like regular npm packages
180242
- The runtime object `c8ctl` provides environment information to plugins
181243

@@ -199,7 +261,7 @@ export const commands = {
199261
### Command Structure
200262

201263
```
202-
c8 <verb> <resource> [arguments] [flags]
264+
c8ctl <verb> <resource> [arguments] [flags]
203265
```
204266

205267
**Verbs**: list, get, create, cancel, complete, fail, activate, resolve, publish, correlate, deploy, run, add, remove, use, output
@@ -222,11 +284,10 @@ npm run test:unit
222284

223285
### Run Integration Tests
224286

225-
Integration tests are skipped by default as they require a running Camunda 8 instance at `http://localhost:8080`. To run them:
287+
Integration tests require a running Camunda 8 instance at `http://localhost:8080`.
226288

227289
1. Start a local Camunda 8 instance (e.g., using c8run)
228-
2. Update the test files to remove `.skip` from the tests
229-
3. Run: `npm run test:integration`
290+
2. Run: `npm run test:integration`
230291

231292
## Development
232293

@@ -263,11 +324,13 @@ c8ctl/
263324
### Running the CLI
264325

265326
```bash
266-
# With Node.js 22.18+ (native TypeScript)
267-
node src/index.ts <command>
268-
327+
# If installed globally
328+
c8ctl <command>
269329
# Or using the alias
270330
c8 <command>
331+
332+
# For local development with Node.js 22.18+ (native TypeScript)
333+
node src/index.ts <command>
271334
```
272335

273336
### Adding New Commands

package-lock.json

Lines changed: 43 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
{
22
"name": "c8ctl",
3-
"version": "1.0.0",
3+
"version": "2.0.0",
44
"description": "Camunda 8 CLI - minimal-dependency CLI for Camunda 8 operations",
55
"type": "module",
66
"engines": {
77
"node": ">=22.18.0"
88
},
99
"bin": {
10-
"c8ctl": "./src/index.ts",
11-
"c8": "./src/index.ts"
10+
"c8ctl": "./dist/index.js",
11+
"c8": "./dist/index.js"
1212
},
13+
"exports": {
14+
"./runtime": "./dist/runtime.js"
15+
},
16+
"files": [
17+
"dist",
18+
"README.md",
19+
"LICENSE"
20+
],
1321
"scripts": {
14-
"test": "node --test tests/unit/*.test.ts tests/integration/*.test.ts",
15-
"test:unit": "node --test tests/unit/*.test.ts",
22+
"build": "tsc",
23+
"prepare": "npm run build",
24+
"test": "node --test tests/unit/setup.test.ts tests/unit/*.test.ts tests/integration/*.test.ts",
25+
"test:unit": "node --test tests/unit/setup.test.ts tests/unit/*.test.ts",
1626
"test:integration": "node --test tests/integration/*.test.ts",
17-
"cli": "node src/index.ts"
27+
"cli": "node src/index.ts",
28+
"dev": "node src/index.ts"
1829
},
1930
"keywords": [
2031
"camunda",
@@ -30,6 +41,7 @@
3041
"@camunda8/orchestration-cluster-api": "^8.8.3"
3142
},
3243
"devDependencies": {
44+
"typescript": "^5.9.3",
3345
"@types/node": "^22.10.0"
3446
}
3547
}

0 commit comments

Comments
 (0)