@j-256/ccam 0.1.0 → 0.1.1

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 (2) hide show
  1. package/README.md +53 -109
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,37 +1,35 @@
1
- # ccam
1
+ # @j-256/ccam
2
2
 
3
- TypeScript CLI and SDK for the Salesforce Commerce Cloud Account Manager REST API.
3
+ Command-line tool for the Salesforce Commerce Cloud Account Manager REST API.
4
4
 
5
- The AM API is largely undocumented. **ccam** serves as both a practical tool and a reference implementation for developers working with Commerce Cloud account management.
5
+ The AM API is largely undocumented. **ccam** gives Account Manager administrators a tool that covers every resource, every subresource, and every finder -- exportable to CSV/TSV/YAML/JSON for audits, automation, and integrations.
6
6
 
7
- ## Why ccam?
7
+ Built for:
8
8
 
9
- ccam is built for people who administer Account Manager: security and compliance teams running access audits, team leads onboarding and offboarding users, and developers integrating AM into their own tooling.
9
+ - **Security and compliance** -- access audits, "who has access to what", "what changed in the last 30 days", exportable reports
10
+ - **Team leads** -- onboarding/offboarding, bulk role assignment, org membership management
11
+ - **Developers and ops** -- troubleshooting login issues, checking client configuration, verifying role scopes
10
12
 
11
- - **Complete AM coverage.** Users, organizations, API clients, roles, realms, permissions, service types, org configurations, instances -- every resource, every subresource, every finder.
12
- - **Exportable.** CSV, TSV, YAML, JSON, or table. `ccam user list --org <id> --format csv` produces a spreadsheet-ready roster.
13
- - **Typed SDK.** `ccam-sdk` is a first-class, documented TypeScript library with TSDoc on every method, typed sort enums, and a structured error taxonomy.
14
- - **Named auth profiles.** Switch between orgs or accounts without re-authenticating. Refresh tokens are stored at `~/.config/ccam/credentials` with 0600 permissions.
15
- - **Interactive TUI.** Run `ccam` with no arguments for a keyboard-driven resource browser with drill-down from user to orgs to realms.
13
+ Highlights:
16
14
 
17
- Comparisons with the other Commerce Cloud CLIs:
15
+ - **Complete AM coverage.** Users, organizations, API clients, roles, realms, permissions, service types, org configurations, instances.
16
+ - **Exportable.** CSV, TSV, YAML, JSON, or a human-readable table. `ccam user list --org <id> --format csv` produces a spreadsheet-ready roster.
17
+ - **Named auth profiles.** Switch between orgs or accounts without re-authenticating. Refresh tokens stored at `~/.config/ccam/credentials` with 0600 permissions.
18
+ - **Interactive TUI.** Run `ccam` with no arguments for a keyboard-driven resource browser.
18
19
 
19
- - [b2c-cli](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling) is Salesforce's official CLI (GA, supersedes sfcc-ci). Broad Commerce Cloud coverage (OCAPI, sandboxes, SLAS, MRT), basic AM commands. See [docs/vs-b2c-cli.md](docs/vs-b2c-cli.md).
20
- - [sfcc-ci](https://github.com/SalesforceCommerceCloud/sfcc-ci) is the long-standing community CLI for CI/CD. Minimal AM coverage. See [docs/vs-sfcc-ci.md](docs/vs-sfcc-ci.md).
20
+ For programmatic use, see [`ccam-sdk`](https://www.npmjs.com/package/ccam-sdk) -- the typed TypeScript library that powers this CLI.
21
21
 
22
- ccam fills the AM-administration gap both leave open.
23
-
24
- ## Quick Start: CLI
25
-
26
- ### Installation
22
+ ## Installation
27
23
 
28
24
  ```bash
29
25
  npm install -g @j-256/ccam
30
26
  ```
31
27
 
32
- ### First run
28
+ The install adds a `ccam` binary to your PATH. Requires Node.js 22 or later.
33
29
 
34
- ccam talks to Account Manager over OAuth2, so you need an AM API client before you can log in. If you already use sfcc-ci or other Commerce Cloud tooling, you can reuse that client; otherwise see [`docs/getting-started.md`](docs/getting-started.md) for a step-by-step walkthrough of creating one.
30
+ ## First run
31
+
32
+ ccam talks to Account Manager over OAuth2, so you need an AM API client before you can log in. If you already use sfcc-ci or other Commerce Cloud tooling, you can reuse that client; otherwise see [the getting-started guide](https://github.com/j-256/ccam/blob/main/docs/getting-started.md) for a step-by-step walkthrough.
35
33
 
36
34
  Once you have a client ID (and secret, for confidential clients):
37
35
 
@@ -48,9 +46,9 @@ Non-interactive alternatives:
48
46
  - `ccam auth login --manual` -- browser flow without a loopback server (for SSH/headless)
49
47
  - Set environment variables instead -- see below
50
48
 
51
- ### Authentication
49
+ ## Environment variables
52
50
 
53
- Set environment variables for your API client credentials:
51
+ For non-profile-based auth, set:
54
52
 
55
53
  ```bash
56
54
  export CCAM_CLIENT_ID="your-client-id"
@@ -58,25 +56,27 @@ export CCAM_CLIENT_SECRET="your-client-secret"
58
56
  export CCAM_HOST="https://account.demandware.com" # optional, this is the default
59
57
  ```
60
58
 
61
- For user-context operations (e.g. `client.users.current()` in the SDK), also set:
59
+ For user-context operations (e.g. `ccam user current`):
62
60
 
63
61
  ```bash
64
62
  export CCAM_USER="your-email@example.com"
65
63
  export CCAM_USER_PASSWORD="your-password"
66
64
  ```
67
65
 
68
- ### Example Commands
66
+ Resolution order: CLI flags > env vars > active profile > defaults.
67
+
68
+ ## Example commands
69
69
 
70
70
  List users:
71
71
  ```bash
72
72
  ccam user list
73
73
  ```
74
74
 
75
- List users with filters:
75
+ Filter users:
76
76
  ```bash
77
77
  ccam user list --org abc123 --role def456
78
78
  ccam user list --login user@example.com
79
- ccam user list --org-type customer
79
+ ccam user list --org-realm-access abc123
80
80
  ```
81
81
 
82
82
  Filter organizations:
@@ -86,74 +86,12 @@ ccam org list --starts-with "Acme"
86
86
  ccam org list --sf-account-id "001..."
87
87
  ```
88
88
 
89
- List roles:
90
- ```bash
91
- ccam role list
92
- ```
93
-
94
89
  Export to CSV:
95
90
  ```bash
96
91
  ccam user list --org abc123 --format csv > users.csv
97
92
  ```
98
93
 
99
- ## Quick Start: SDK
100
-
101
- ### Installation
102
-
103
- ```bash
104
- npm install ccam-sdk
105
- ```
106
-
107
- ### Usage
108
-
109
- ```typescript
110
- import { CcamClient } from 'ccam-sdk';
111
-
112
- // Create client (uses environment variables or explicit options)
113
- const client = new CcamClient({
114
- clientId: 'your-client-id',
115
- clientSecret: 'your-client-secret',
116
- host: 'https://account.demandware.com' // optional
117
- });
118
-
119
- // List users with pagination
120
- const result = await client.users.list({
121
- page: 0,
122
- size: 25
123
- });
124
-
125
- console.log(result.content);
126
- console.log(`Page ${result.page.number + 1} of ${result.page.totalPages}`);
127
-
128
- // Get user by login with expanded organizations
129
- const user = await client.users.getByLogin('user@example.com', {
130
- expand: 'organizations'
131
- });
132
-
133
- console.log(user.mail, user.organizations);
134
-
135
- // List roles with sorting
136
- const roles = await client.roles.list({
137
- page: 0,
138
- size: 50,
139
- sort: { field: 'name', direction: 'asc' }
140
- });
141
- ```
142
-
143
- ## Authentication
144
-
145
- ccam supports three credential sources (first wins):
146
-
147
- 1. **Explicit options** passed to `CcamClient` constructor
148
- 2. **Environment variables**: `CCAM_CLIENT_ID`, `CCAM_CLIENT_SECRET`, `CCAM_USER`, `CCAM_USER_PASSWORD`, `CCAM_HOST`
149
- 3. **Default host**: `https://account.demandware.com`
150
-
151
- Two authentication modes:
152
-
153
- - **Client-only** (system context): read all resources, most common mode
154
- - **Client + user** (user context): required for the `/users/current` endpoint
155
-
156
- ## Output Formats
94
+ ## Output formats
157
95
 
158
96
  | Format | Use case | CLI flag |
159
97
  |--------|----------|----------|
@@ -163,35 +101,36 @@ Two authentication modes:
163
101
  | `tsv` | Tab-separated (better for whitespace) | `--format tsv` |
164
102
  | `yaml` | Config files, human-readable structured | `--format yaml` |
165
103
 
166
- When output is piped (not a TTY), JSON is the default format.
104
+ When output is piped (not a TTY), JSON is the default.
167
105
 
168
106
  ## Resources
169
107
 
170
- | Resource | CLI command | SDK property |
171
- |----------|-------------|--------------|
172
- | Users | `ccam user` | `client.users` |
173
- | Organizations | `ccam org` | `client.organizations` |
174
- | API Clients | `ccam client` | `client.apiClients` |
175
- | Roles | `ccam role` | `client.roles` |
176
- | Realms | `ccam realm` | `client.realms` |
177
- | Permissions | `ccam permission` | `client.permissions` |
178
- | Service Types | `ccam service-type` | `client.serviceTypes` |
108
+ | Resource | Command |
109
+ |----------|---------|
110
+ | Users | `ccam user` |
111
+ | Organizations | `ccam org` |
112
+ | API Clients | `ccam client` |
113
+ | Roles | `ccam role` |
114
+ | Realms | `ccam realm` |
115
+ | Permissions | `ccam permission` |
116
+ | Service Types | `ccam service-type` |
117
+ | Instances | `ccam instance` |
118
+ | Org Configurations | `ccam org-config` |
179
119
 
180
- Most resources support:
181
- - `list` -- paginated list of resources
182
- - `get <id>` -- get a single resource by ID
120
+ Most resources support `list` (paginated) and `get <id>`.
183
121
 
184
122
  Additional commands:
185
- - Users: `get` by login (default) or by ID (`--id`), `current`, `audit`, `roles`, `instances`, `assigned-realms`, `assigned-instances`, `create`, `update`, `delete`, `reset`, `disable`, `revoke-verifier`. Filter flags on `list` (see below).
186
- - Organizations: `realms`, `instances`, `audit`, `update`. Filter flags on `list` (`--name`, `--starts-with`, `--sf-account-id`).
187
- - API Clients: `audit`, `assigned-realms`, `assigned-instances`, `create`, `update`, `delete`, `set-password`, `set-auth-type`.
188
- - Instances: `validate-filter`.
189
123
 
190
- Users and API Clients support `--expand` on `get` to include related resources (`organizations`, `roles`, or `organizations,roles`). Roles and Org Realms support `--expand serviceType` / `--expand instance` respectively.
124
+ - **Users**: `get` by login (default) or by ID (`--id`), `current`, `audit`, `roles`, `instances`, `assigned-realms`, `assigned-instances`, `create`, `update`, `delete`, `reset`, `disable`, `revoke-verifier`, `grant-role`, `revoke-role`.
125
+ - **Organizations**: `realms`, `instances`, `audit`, `update`.
126
+ - **API Clients**: `audit`, `assigned-realms`, `assigned-instances`, `create`, `update`, `delete`, `set-password`, `set-auth-type`, `grant-role`, `revoke-role`.
127
+ - **Instances**: `validate-filter`.
191
128
 
192
- ## User Search Filters
129
+ Users and API Clients support `--expand` on `get` to include related resources (`organizations`, `roles`, or `organizations,roles`). Roles and Org Realms support `--expand serviceType` and `--expand instance` respectively.
193
130
 
194
- The `ccam user list` command maps filter flags to AM API finder methods:
131
+ ## User search filters
132
+
133
+ `ccam user list` maps filter flags to AM API finder methods:
195
134
 
196
135
  | Flag | API finder | Example |
197
136
  |------|------------|---------|
@@ -204,6 +143,11 @@ The `ccam user list` command maps filter flags to AM API finder methods:
204
143
 
205
144
  Add `--modified-after <date>` with `--role` to filter by modification date.
206
145
 
146
+ ## Source and issues
147
+
148
+ - Source: <https://github.com/j-256/ccam>
149
+ - Issues: <https://github.com/j-256/ccam/issues>
150
+
207
151
  ## License
208
152
 
209
153
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j-256/ccam",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "CLI for the Salesforce Commerce Cloud Account Manager API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "ccam-sdk": "0.1.0",
27
+ "ccam-sdk": "0.1.1",
28
28
  "chalk": "^5.6.2",
29
29
  "cli-table3": "^0.6.5",
30
30
  "commander": "^14.0.3",