@automatify-au/cli 0.1.11 → 0.1.13

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 (3) hide show
  1. package/README.md +110 -1
  2. package/dist/automatify.cjs +1726 -32
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -141,6 +141,11 @@ All TestOps commands are invoked as `automatify testops <command>`:
141
141
 
142
142
  ### Setup, ingestion, and CI commands
143
143
 
144
+ - `setup`
145
+ - `automatify testops setup plan ... > testops-setup-plan.json`
146
+ - `automatify testops setup apply --plan testops-setup-plan.json --dry-run`
147
+ - `automatify testops setup apply --plan testops-setup-plan.json --approve all --confirm ...`
148
+ - `automatify testops setup doctor --plan testops-setup-plan.json ...`
144
149
  - `ingest`
145
150
  - `automatify testops ingest feature --file <path>` or `--stdin`
146
151
  - `run`
@@ -154,6 +159,110 @@ All TestOps commands are invoked as `automatify testops <command>`:
154
159
  - `automatify testops auto --dry-run`
155
160
  - `automatify testops auto`
156
161
 
162
+ ## Agent-friendly provider setup
163
+
164
+ `automatify testops setup` provides a GitHub-first, provider-bounded onboarding flow. The CLI remains a thin Forge client: Jira profile reads/writes/default selection use the existing `listScenarioAutomationProfiles`, `upsertScenarioAutomationProfile`, and `setScenarioAutomationDefaultProfile` contracts. Forge continues to own profile validation, tier limits, provider-secret storage, and default-profile rules.
165
+
166
+ ### 1. Generate a deterministic plan
167
+
168
+ Run this from the repository that contains the approved workflow source:
169
+
170
+ ```bash
171
+ automatify testops setup plan \
172
+ --provider github-actions \
173
+ --project-key DEV \
174
+ --owner Automatify-Pty-Ltd \
175
+ --repo customer-tests \
176
+ --ref main \
177
+ --workflow-id scenario-dispatch.yml \
178
+ --workflow-source .github/workflows/scenario-dispatch.yml \
179
+ --workflow-path .github/workflows/scenario-dispatch.yml \
180
+ --profile-label "Customer GitHub Actions" \
181
+ --set-default \
182
+ > testops-setup-plan.json
183
+ ```
184
+
185
+ The command itself writes nothing: it emits one versioned JSON plan to stdout, and the shell redirection above saves it. The plan contains the workflow source path and SHA-256 digest, not workflow contents or secret values. The source must declare `workflow_dispatch` and reference the selected callback secret names. Given the same explicit inputs and unchanged workflow source, the plan and `planId` are deterministic.
186
+
187
+ The GitHub plan covers:
188
+
189
+ - local workflow destination and approved source hash;
190
+ - repository, ref, workflow id, and Jira profile fields;
191
+ - required `TESTOPS_FORGE_ENDPOINT` and `TESTOPS_FORGE_AUTH_TOKEN` repository secret names;
192
+ - profile create/update, optional project-default selection, read-only smoke checks, and rollback guidance;
193
+ - explicit exclusion of account creation, credentials, commits, pull requests, and workflow runs.
194
+
195
+ ### 2. Validate with a mutation-free dry-run
196
+
197
+ ```bash
198
+ automatify testops setup apply \
199
+ --plan testops-setup-plan.json \
200
+ --repo-root /path/to/customer-tests \
201
+ --dry-run
202
+ ```
203
+
204
+ Dry-run previews all plan actions when no `--approve` is supplied. It may call read contracts to describe current state, but it does not write files, Jira profiles/defaults, GitHub secrets, commits, PRs, or workflow runs. Output is stable JSON.
205
+
206
+ ### 3. Apply only explicitly approved scopes
207
+
208
+ Secrets must come from stdin or safe environment references. Secret values are rejected as ordinary command options and are not printed in JSON, logs, diagnostics, snapshots, or child-process arguments.
209
+
210
+ ```bash
211
+ export TESTOPS_GITHUB_PROVIDER_TOKEN="<github-app-installation-or-fine-grained-token>"
212
+ export TESTOPS_GITHUB_ADMIN_TOKEN="<least-privilege-token-allowed-to-manage-actions-secrets>"
213
+ export TESTOPS_FORGE_ENDPOINT="<forge-webtrigger-url>"
214
+ export TESTOPS_FORGE_AUTH_TOKEN="<one-time-project-cli-key>"
215
+
216
+ automatify testops setup apply \
217
+ --plan testops-setup-plan.json \
218
+ --repo-root /path/to/customer-tests \
219
+ --approve all \
220
+ --confirm \
221
+ --secret-ref githubProviderToken=env:TESTOPS_GITHUB_PROVIDER_TOKEN \
222
+ --secret-ref githubAdminToken=env:TESTOPS_GITHUB_ADMIN_TOKEN \
223
+ --secret-ref callbackEndpoint=env:TESTOPS_FORGE_ENDPOINT \
224
+ --secret-ref callbackAuthToken=env:TESTOPS_FORGE_AUTH_TOKEN
225
+ ```
226
+
227
+ Available scopes are `workflow-file`, `github-secrets`, `jira-profile`, and `project-default` when the plan includes the default action. Real mutations require both `--confirm` and one or more `--approve` flags; use repeated flags for a partial apply. `--approve all` approves every action in the content-addressed plan.
228
+
229
+ The `github-secrets` scope uses the installed `gh` CLI, sends each repository secret through stdin, and passes the GitHub admin credential through `GH_TOKEN` in the child environment. Existing secret names are skipped because GitHub does not expose their values. Use `--rotate-secrets` to explicitly overwrite them. An existing matching Jira profile is also skipped; use `--rotate-provider-token` to explicitly replace its stored provider credential.
230
+
231
+ For JSON secret input instead of references, pipe one object with supported keys to `--secrets-stdin`:
232
+
233
+ ```bash
234
+ node -e 'process.stdout.write(JSON.stringify({githubProviderToken:process.env.TESTOPS_GITHUB_PROVIDER_TOKEN,githubAdminToken:process.env.TESTOPS_GITHUB_ADMIN_TOKEN,callbackEndpoint:process.env.TESTOPS_FORGE_ENDPOINT,callbackAuthToken:process.env.TESTOPS_FORGE_AUTH_TOKEN}))' \
235
+ | automatify testops setup apply \
236
+ --plan testops-setup-plan.json \
237
+ --repo-root /path/to/customer-tests \
238
+ --approve all \
239
+ --confirm \
240
+ --secrets-stdin
241
+ ```
242
+
243
+ Prefer a GitHub App installation token. When using fine-grained tokens, grant only the selected repository access plus the minimum Actions/Contents/Secrets permissions needed for the approved scopes. The command never creates or commits the workflow remotely; review and commit the local workflow through the repository's normal change-control process.
244
+
245
+ ### 4. Run read-only provider doctor/smoke validation
246
+
247
+ ```bash
248
+ automatify testops setup doctor \
249
+ --plan testops-setup-plan.json \
250
+ --repo-root /path/to/customer-tests \
251
+ --secret-ref githubProviderToken=env:TESTOPS_GITHUB_PROVIDER_TOKEN \
252
+ --secret-ref githubAdminToken=env:TESTOPS_GITHUB_ADMIN_TOKEN
253
+ ```
254
+
255
+ Doctor verifies the local workflow hash, GitHub workflow metadata/content at the configured ref, required repository secret names, Jira profile fields/provider-secret metadata, and optional project default. It never dispatches a workflow. GitHub secret values cannot be read, so doctor verifies names only and reports that limitation. If the workflow has not been committed to the repository default branch, doctor reports what remains unverifiable without creating a commit or run.
256
+
257
+ Current authentication boundary:
258
+
259
+ - `TESTOPS_FORGE_AUTH_TOKEN` is still a project-scoped, project-admin-created CLI key from Jira `Operations -> CLI access`.
260
+ - The key authorizes the current Forge webtrigger transport for that project; command groups are not separate security scopes.
261
+ - Setup does not turn this into an all-user auth model. Customer-admin packaging and any future user-level authentication remain separate work.
262
+ - The same callback key may be stored as a GitHub Actions repository secret only under the explicit `github-secrets` apply scope.
263
+
264
+ Azure DevOps setup uses the same plan/apply/doctor safety boundary. Generate a plan with `--provider azure-devops`, mapping `--organization`, `--azure-project`, `--pipeline-id`, and `--ref` into the existing `azureDevops` Forge profile. Callback pipeline variables are accepted only through stdin or `--secret-ref key=env:NAME`; dry-run, explicit approval, idempotency, and redaction are identical to GitHub setup. Doctor inspects pipeline metadata and variable names only; it never queues a pipeline run.
265
+
157
266
  ## Allure Evidence for Jira
158
267
 
159
268
  Purpose:
@@ -551,7 +660,7 @@ Recommended CI sequence:
551
660
  - `0` success
552
661
  - `1` internal/runtime error
553
662
  - `2` usage/argument errors
554
- - `3` local validation errors
663
+ - `3` local/plan validation errors, doctor failures, or post-apply smoke validation failures
555
664
  - `4` Forge service errors (`ok: false` payload)
556
665
  - `5` Forge transport/connectivity errors
557
666