@adobe-commerce/aio-toolkit 1.2.5 → 1.2.7

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 (31) hide show
  1. package/CHANGELOG.md +250 -0
  2. package/README.md +450 -1
  3. package/dist/aio-toolkit-cli-workflow/bin/cli.js +2048 -0
  4. package/dist/aio-toolkit-cli-workflow/bin/cli.js.map +1 -0
  5. package/dist/aio-toolkit-cursor-context/bin/cli.js +16 -0
  6. package/dist/aio-toolkit-cursor-context/bin/cli.js.map +1 -1
  7. package/dist/index.d.mts +61 -6
  8. package/dist/index.d.ts +61 -6
  9. package/dist/index.js +600 -42
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +610 -38
  12. package/dist/index.mjs.map +1 -1
  13. package/files/cursor-context/commands/aio-toolkit-analyze-adobe-commerce-module.md +612 -0
  14. package/files/cursor-context/commands/aio-toolkit-create-amazon-sqs-consumer.md +445 -0
  15. package/files/cursor-context/commands/aio-toolkit-create-event-consumer-action.md +6 -0
  16. package/files/cursor-context/commands/aio-toolkit-create-graphql-action.md +21 -7
  17. package/files/cursor-context/commands/aio-toolkit-create-openwhisk-action.md +326 -0
  18. package/files/cursor-context/commands/aio-toolkit-create-runtime-action.md +15 -5
  19. package/files/cursor-context/commands/aio-toolkit-create-shipping-carrier.md +681 -0
  20. package/files/cursor-context/commands/aio-toolkit-create-webhook-action.md +22 -9
  21. package/files/cursor-context/rules/aio-toolkit-create-adobe-commerce-client.mdc +252 -116
  22. package/files/cursor-context/rules/aio-toolkit-oop-best-practices.mdc +10 -4
  23. package/files/cursor-context/rules/aio-toolkit-setup-new-relic-telemetry.mdc +167 -2
  24. package/files/cursor-context/rules/aio-toolkit-use-abdb-collection.mdc +610 -0
  25. package/files/cursor-context/rules/aio-toolkit-use-abdb-repository.mdc +705 -0
  26. package/files/cursor-context/rules/aio-toolkit-use-adobe-auth.mdc +442 -0
  27. package/files/cursor-context/rules/aio-toolkit-use-amazon-sqs-publish.mdc +397 -0
  28. package/files/cursor-context/rules/aio-toolkit-use-file-repository.mdc +502 -0
  29. package/files/cursor-context/rules/aio-toolkit-use-publish-event.mdc +510 -0
  30. package/files/cursor-context/rules/aio-toolkit-use-runtime-api-gateway-service.mdc +542 -0
  31. package/package.json +4 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,256 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.2.7] - 2026-06-18
9
+
10
+ ### ✨ Features
11
+
12
+ - **feat(telemetry): add Grafana LGTM telemetry provider**
13
+
14
+ New `GrafanaTelemetry` class in `src/framework/telemetry/grafana/` forwards OpenTelemetry
15
+ signals (traces, metrics, logs) to a Grafana LGTM collector via OTLP/HTTP. Three operating
16
+ modes:
17
+
18
+ - **Dev** (`GRAFANA_DEV=true`) — targets `http://localhost:4318`, the default OTLP port of the
19
+ [Grafana LGTM Docker image](https://github.com/grafana/docker-otel-lgtm); no credentials
20
+ required. Start the stack with:
21
+ ```bash
22
+ docker run --rm -p 3000:3000 -p 4317:4317 -p 4318:4318 --name otel-lgtm grafana/otel-lgtm:latest
23
+ ```
24
+ - **Tunnel / deployed** — targets `GRAFANA_ENDPOINT` without authentication; use a Cloudflare
25
+ tunnel to expose a local stack to deployed Runtime actions:
26
+ ```bash
27
+ npx cloudflared tunnel --url http://localhost:4318
28
+ ```
29
+ - **Grafana Cloud** (`GRAFANA_CLOUD=true`) — targets `GRAFANA_ENDPOINT` with HTTP Basic auth
30
+ derived from `GRAFANA_INSTANCE_ID` and `GRAFANA_API_KEY`.
31
+
32
+ Added to the provider fallback chain after New Relic:
33
+ 1. New Relic — `NEW_RELIC_TELEMETRY=true`
34
+ 2. Grafana LGTM — `GRAFANA_TELEMETRY=true`
35
+ 3. No telemetry — original action runs uninstrumented
36
+
37
+ **Configuration reference:**
38
+
39
+ | Variable | Required | Default | Description |
40
+ |---|---|---|---|
41
+ | `ENABLE_TELEMETRY` | ✅ | — | Must be `true` to enable any telemetry |
42
+ | `GRAFANA_TELEMETRY` | ✅ | — | Must be `true` to select this provider |
43
+ | `GRAFANA_DEV` | — | `false` | `true` for localhost dev mode |
44
+ | `GRAFANA_ENDPOINT` | ✅ tunnel & Cloud / — dev | — | Collector base URL |
45
+ | `GRAFANA_SERVICE_NAME` | — | `app-builder-app` | Service name tag |
46
+ | `GRAFANA_CLOUD` | — | `false` | `true` for Grafana Cloud Basic auth |
47
+ | `GRAFANA_INSTANCE_ID` | ✅ when `GRAFANA_CLOUD=true` | — | Grafana Cloud stack instance ID |
48
+ | `GRAFANA_API_KEY` | ✅ when `GRAFANA_CLOUD=true` | — | Grafana Cloud API key / token |
49
+
50
+ - **feat(log-sanitizer): add `LogSanitizer` class and `SENSITIVE_KEYS` param support**
51
+
52
+ New `LogSanitizer` class in `src/framework/telemetry/helpers/log-sanitizer/` deep-clones a
53
+ value and replaces sensitive field values with `"[REDACTED]"` before they reach the log stream.
54
+
55
+ **Built-in sensitive key detection (case-insensitive):**
56
+ - Exact matches: `authorization`, `x-api-key`, `cookie`, `set-cookie`
57
+ - Suffix patterns: `*_api_key`, `*_secret`, `*_token`, `*_password`, `*_key`, `*-token`, `*-secret`, `*-key`
58
+
59
+ All action classes (`RuntimeAction`, `EventConsumerAction`, `OpenwhiskAction`) automatically
60
+ sanitize headers, parameters, and results in their debug log calls. `Telemetry.createLogger()`
61
+ also sanitizes all object-type arguments passed to the returned logger. `LogSanitizer` is
62
+ exported from the main package index for direct use.
63
+
64
+ **Project-specific keys via `SENSITIVE_KEYS` param:**
65
+
66
+ New `static parseSensitiveKeys(raw: unknown): ReadonlySet<string>` parses the optional
67
+ `SENSITIVE_KEYS` action param into additional keys to redact. All action classes and
68
+ `Telemetry.createLogger()` call it automatically. Accepts:
69
+
70
+ | Input type | Example | Result |
71
+ |---|---|---|
72
+ | Comma-separated string | `"x-merchant-token,internal_id"` | `Set { "x-merchant-token", "internal_id" }` |
73
+ | Array | `["x-merchant-token", "INTERNAL_ID"]` | `Set { "x-merchant-token", "internal_id" }` |
74
+ | Single string | `"x-merchant-token"` | `Set { "x-merchant-token" }` |
75
+ | Anything else (incl. `undefined`) | — | `Set {}` (no additional keys) |
76
+
77
+ Add project-specific keys in `app.config.yaml`:
78
+ ```yaml
79
+ inputs:
80
+ SENSITIVE_KEYS: "x-merchant-token,internal_order_id"
81
+ ```
82
+
83
+ ### 🛠️ Internal
84
+
85
+ - **chore(telemetry): replace `@ts-expect-error` directives with ambient OTel type declaration**
86
+
87
+ Three stale `@ts-expect-error` directives in the telemetry source are replaced by a new
88
+ ambient module declaration in `src/global-types/adobe-aio-lib-telemetry-otel.d.ts` that
89
+ correctly types the `@adobe/aio-lib-telemetry/otel` sub-path export.
90
+
91
+ - **refactor(log-sanitizer): extract constants to `types.ts`**
92
+
93
+ `EXACT_SENSITIVE_KEYS` and `SENSITIVE_KEY_SUFFIXES` moved from inline module-level constants
94
+ to exported constants in a dedicated `types.ts`, making them importable and independently
95
+ testable.
96
+
97
+ - **feat(telemetry): add `GrafanaTelemetryValidator`**
98
+
99
+ New `GrafanaTelemetryValidator` implementing `BaseTelemetryValidator`:
100
+ - `isConfigured()` — `true` when both `ENABLE_TELEMETRY=true` and `GRAFANA_TELEMETRY=true`
101
+ - `validateConfiguration()` — no-op in dev mode; throws `TelemetryInputError` when
102
+ `GRAFANA_ENDPOINT` or `GRAFANA_SERVICE_NAME` is missing/empty in tunnel or Cloud mode
103
+
104
+ - **chore(test): add `test/tsconfig.json`**
105
+
106
+ Gives VS Code's TypeScript language server the correct context for test files (jest/node
107
+ types, relaxed `noUncheckedIndexedAccess` and `exactOptionalPropertyTypes`).
108
+
109
+ - **chore(test): fix missing platform mock in Linux `isCursorIde()` test**
110
+
111
+ The Linux `execPath` test case was not mocking `os.platform()` to return `'linux'`,
112
+ causing it to fall through to the macOS branch on macOS developer machines.
113
+
114
+ ### 📚 Documentation
115
+
116
+ - **README** — new Grafana LGTM section covering all three operating modes, `app.config.yaml`
117
+ snippets, `.env` variables, usage example, and full env-var reference table.
118
+ - **README** — `LogSanitizer` section documenting the class API, `parseSensitiveKeys()`,
119
+ `SENSITIVE_KEYS` param usage, sensitive key detection table, constructor options, and
120
+ behavioural notes.
121
+
122
+ ---
123
+
124
+ ## [1.2.6] - 2026-05-10
125
+
126
+ ### ✨ Features
127
+
128
+ - **feat(cli-workflow): add `aio-toolkit-cli-workflow` CLI**
129
+
130
+ New `npx aio-toolkit-cli-workflow` binary for orchestrating Adobe I/O CLI workflows.
131
+ Performs an AIO CLI pre-flight check with installation guidance on startup.
132
+
133
+ **`env:setup`** — interactive environment configuration:
134
+ - Prompts "Do you have a workspace config file?" and runs `aio app use <file>` if yes.
135
+ - Falls back to `aio console org select` → `aio console project select` → `aio console workspace select` if no config file is provided.
136
+ - Accepts `--config-file` to skip the prompt and use a specified file directly.
137
+
138
+ **`env:reset`** — full AIO CLI environment reset:
139
+ - Accepts `--env stage|prod` (default `prod`).
140
+ - Runs: logout → clear local & global config → telemetry off → set env → login → telemetry on.
141
+
142
+ **`cron:enable`** — enable AIO Runtime cron rules:
143
+ - Confirms the current workspace, lists rules via `aio rt rule list --json`, and prompts for rule selection.
144
+ - Accepts `--all` to enable every rule without prompting.
145
+
146
+ **`cron:disable`** — disable AIO Runtime cron rules:
147
+ - Mirrors `cron:enable` but calls `aio rt rule disable`.
148
+
149
+ **`cron:status`** — display detailed cron rule status:
150
+ - Lists all rules with action name, status, trigger name, cron schedule, and version.
151
+ - Accepts `--name <ruleName>` to inspect a single rule.
152
+ - Uses a multi-strategy JSON parser (stdout/stderr fallback, ANSI stripping, oclif-envelope unwrapping, prefix-text slicing) for reliable output capture.
153
+
154
+ **`cron:delete`** — delete cron rules and their triggers:
155
+ - Confirms workspace, prompts for rule selection, then deletes the trigger (`aio rt trigger delete`) before the rule (`aio rt rule delete`).
156
+
157
+ - **feat(integration): add `AmazonSQSClient`**
158
+
159
+ New `AmazonSQSClient` in `src/integration/amazon-sqs-client/` for Amazon SQS integration:
160
+ - **Batched publish** for standard and FIFO queues (with `MessageGroupId` and `MessageDeduplicationId` support).
161
+ - **Long-polling consume** with configurable batch size, wait time, and auto-deletion.
162
+ - Full TypeScript types: `AmazonSQSConfig`, `MessageHandler`, `PublishStats`, `ConsumeStats`.
163
+ - 38 tests with 100% statement, branch, function, and line coverage.
164
+
165
+ ### 🛠️ Internal
166
+
167
+ - **feat(framework): add `ParseCliFlag` helper**
168
+
169
+ New `ParseCliFlag` class with a static `parse(args, flag)` method that handles both
170
+ `--flag=value` and `--flag value` argument styles. Used by `env:setup`, `env:reset`,
171
+ and `cron:status`.
172
+
173
+ - **feat(framework): add `AioCliDetector` helper**
174
+
175
+ New `AioCliDetector` class to detect whether the `aio` CLI is installed and to verify
176
+ availability of sub-commands. Integrated into the `aio-toolkit-cli-workflow` startup check.
177
+
178
+ - **feat(framework): extend `CommandDescriptor` with `options`**
179
+
180
+ Added optional `options?: CommandOption[]` to `CommandDescriptor` so each command class
181
+ can declare its own flags. `CliWorkflowHelp` reads these dynamically when rendering help output.
182
+
183
+ ### 📚 Documentation & Cursor Context
184
+
185
+ - **Package overview** — added `docs/OVERVIEW.md` covering installation, dependency
186
+ resolution, and a full module index for all toolkit components.
187
+
188
+ - **Framework reference docs** — new docs added under `docs/framework/`:
189
+ `runtime-action`, `webhook-action`, `graphql-action`, `event-consumer-action`,
190
+ `openwhisk`, `publish-event`, `abdb-collection`, `abdb-repository`,
191
+ `file-repository`, `runtime-api-gateway-service`, `telemetry`.
192
+
193
+ - **Commerce reference docs** — new docs added under `docs/commerce/`:
194
+ `adobe-commerce-client`, `adobe-auth`, `shipping-carrier`, `onboard-commerce`.
195
+
196
+ - **Integration reference docs** — new `docs/integration/amazon-sqs-client.md`.
197
+
198
+ - **Security rules** — 13 global security rules added under `.cursor/rules/security-global/`
199
+ covering API security, authentication, injection, SSRF, path traversal, SQL, XXE,
200
+ output encoding, data protection, error handling, dependency management, input validation,
201
+ and dangerous flows. Also added `security-lang-node.mdc` for Node.js-specific patterns.
202
+
203
+ - **New Cursor commands**:
204
+ - `aio-toolkit-create-openwhisk-action.md` — AI-guided scaffolding for OpenWhisk sub-actions and orchestrators.
205
+ - `aio-toolkit-analyze-adobe-commerce-module.md` — analyzes existing Adobe Commerce modules.
206
+ - `aio-toolkit-create-shipping-carrier.md` — scaffolds a custom shipping carrier integration.
207
+ - `aio-toolkit-create-amazon-sqs-consumer.md` — scaffolds an Amazon SQS consumer action.
208
+
209
+ - **New Cursor rules**:
210
+ - `aio-toolkit-use-publish-event.mdc` — guides integrating `PublishEvent` for CloudEvents publishing to Adobe I/O Events.
211
+ - `aio-toolkit-use-abdb-collection.mdc` — guides schema-validated ABDB collection usage.
212
+ - `aio-toolkit-use-abdb-repository.mdc` — guides repository pattern usage with ABDB.
213
+ - `aio-toolkit-use-file-repository.mdc` — guides Adobe I/O Files-based persistence.
214
+ - `aio-toolkit-use-runtime-api-gateway-service.mdc` — guides API Gateway HTTP calls via `RuntimeApiGatewayService`.
215
+ - `aio-toolkit-use-adobe-auth.mdc` — guides Adobe IMS authentication patterns.
216
+ - `aio-toolkit-use-amazon-sqs-publish.mdc` — guides SQS message publishing with `AmazonSQSClient`.
217
+
218
+ ### 🔧 Fixes & Improvements
219
+
220
+ - **fix(cursor): rename exception field `class` → `type` in webhook command**
221
+
222
+ `WebhookActionResponse.exception()` parameter renamed from `exceptionClass` to
223
+ `exceptionType` and the JSON response field from `class` to `type`, matching the
224
+ actual library behavior introduced in v1.2.4.
225
+
226
+ - **fix(cursor): correct `IMS_ORD_ID` typo to `IMS_ORG_ID` in Commerce client rule**
227
+
228
+ All env var references in `aio-toolkit-create-adobe-commerce-client.mdc` now use
229
+ the correct `IMS_ORG_ID` key.
230
+
231
+ - **fix(cursor): document `raw-http: true` requirement for webhook signature verification**
232
+
233
+ The webhook command now explicitly states that `raw-http: true` must be set under
234
+ `annotations:` in `app.config.yaml` for signature verification to work.
235
+
236
+ - **fix(cursor): expand GraphQL resolver `ctx` destructuring in commands and rules**
237
+
238
+ Resolver examples now show the full context (`logger`, `headers`, `telemetry`,
239
+ `params`) with inline descriptions of each field.
240
+
241
+ - **fix(cursor): add HEAD/OPTIONS to supported HTTP methods in runtime-action command**
242
+
243
+ `create-runtime-action.md` now lists all six supported methods including `HEAD`
244
+ and `OPTIONS`.
245
+
246
+ - **fix(cursor): document optional `headers` parameter on `RuntimeActionResponse.success()`**
247
+
248
+ Updated command docs to reflect that `success(result, headers?)` accepts an optional
249
+ second argument for custom HTTP response headers.
250
+
251
+ - **chore(cursor): set `alwaysApply: false` on Commerce client rule**
252
+
253
+ `aio-toolkit-create-adobe-commerce-client.mdc` is now opt-in; it was previously
254
+ applying on every session regardless of context.
255
+
256
+ ---
257
+
8
258
  ## [1.2.5] - 2026-04-20
9
259
 
10
260
  ### 🔧 Chores