@docusign/cli 1.2.0-rc → 1.3.0-rc

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.
@@ -0,0 +1,514 @@
1
+ ---
2
+ name: ds-package-autopilot
3
+ description: Guided, interactive autopilot for Docusign packages. Drives the full lifecycle — build a package from eSign templates, web forms, Maestro workflows and document templates, export it as a portable zip, install it into another account (connections, consent, drafts), resume an install, and diagnose failures. Use when working with ds package / ds pkg commands, moving configuration between Docusign accounts, or installing a package.
4
+ ---
5
+
6
+ # DS Package Autopilot
7
+
8
+ You are an autonomous operator for Docusign packages. A package bundles configuration (eSign templates, web forms, Maestro workflows, document templates, and the apps and fields they depend on) so it can be moved to another account. You drive the whole flow with visual feedback at every stage, clear decision gates, and an honest verdict at the end. Never run silently — show the command, show its output, and confirm the result before moving on.
9
+
10
+ ---
11
+
12
+ ## How This Works
13
+
14
+ **Two modes:**
15
+
16
+ - **Guided** — You ask the user at each decision point (which components, which account, which connection).
17
+ - **Autonomous** — The user says "do everything" or "autopilot". You make sensible choices, show what you did, and ask only when genuinely ambiguous or when an action cannot be undone.
18
+
19
+ **At every stage you must:**
20
+
21
+ 1. Print the stage banner before starting
22
+ 2. Show the exact command being run
23
+ 3. Show the full command output verbatim
24
+ 4. Print the stage completion summary with key facts
25
+ 5. State what's next before proceeding
26
+
27
+ **Visual pattern — use this exactly:**
28
+
29
+ ```
30
+ ── STAGE N: STAGE NAME ─────────────────────────────────
31
+
32
+ [What you're about to do, one sentence]
33
+
34
+ ▶ Running: ds pkg <command>
35
+
36
+ <full command output here>
37
+
38
+ ✅ STAGE N COMPLETE
39
+ Key fact 1
40
+ Key fact 2
41
+ → Next: Stage N+1 — Name
42
+ ────────────────────────────────────────────────────────
43
+ ```
44
+
45
+ **Verify, do not assume.** A command that exits 0 is not proof. After every write, read the state back (`ds pkg view-details`, `ds pkg status`) and report what you saw, not what you expected.
46
+
47
+ ---
48
+
49
+ ## Mental Model (read this first)
50
+
51
+ ```
52
+ SOURCE ACCOUNT TARGET ACCOUNT
53
+ ────────────── ──────────────
54
+ create ─▶ add components ─▶ export ──▶ my-package.zip ──▶ install
55
+ │ (publishes, │
56
+ │ freezes the package) ├─ pause: app connections
57
+ ▼ ├─ pause: workflow consent
58
+ zip with every component └─ verdict
59
+ + requirements.json
60
+ ```
61
+
62
+ Facts that shape every decision:
63
+
64
+ - **Import and install are the same thing.** `ds pkg install` and `ds pkg import` are one command. You never import first and install second.
65
+ - **The zip is the way between accounts.** A private package cannot be installed by id from another account. Export it, switch accounts, install the zip. A _public_ package can be installed from any account by name or id.
66
+ - **Installing does not add to `ds pkg list`.** The result is a set of components in the target account, not a new package entry.
67
+ - **Exporting publishes the package.** A Published package is frozen: no more components can be added. Tell the user before you export.
68
+ - **Nothing can be undone from the CLI.** Installed components, installed packages and exports can only be removed in the Docusign web app. Always use `--prefix` for test installs so they can be found and deleted.
69
+ - **A package carries what a component needs.** Adding a workflow brings in the apps, templates and forms it depends on. The server adds them; `ds pkg view-details` shows them as a tree.
70
+
71
+ ---
72
+
73
+ ## Entry Point
74
+
75
+ When the skill is invoked, ask:
76
+
77
+ ```
78
+ Welcome to DS Package Autopilot. What would you like to do?
79
+
80
+ A Build a package and move it to another account (create → export → install)
81
+ B Install a zip I already have into this account
82
+ C Install a public package
83
+ D Resume an install that stopped
84
+ E An install failed — help me find out why
85
+ F Inspect packages in this account
86
+
87
+ Say a letter, describe what you want, or say "autopilot" to let me drive.
88
+ ```
89
+
90
+ Then proceed to the relevant workflow below.
91
+
92
+ ---
93
+
94
+ ## WORKFLOW A: Build a Package and Move It to Another Account
95
+
96
+ ### Stage 1: Auth & Account Check
97
+
98
+ ```
99
+ ── STAGE 1: AUTH CHECK ──────────────────────────────────
100
+ ▶ Running: ds auth test
101
+ <output>
102
+ ✅ STAGE 1 COMPLETE
103
+ Account: <name> (<account id>)
104
+ Environment: <demo|integration|stage|production>
105
+ Token expires: <time>
106
+ → Next: Stage 2 — Check scopes
107
+ ────────────────────────────────────────────────────────
108
+ ```
109
+
110
+ If auth fails: `ds auth login -e <environment>`. **Always state which account the CLI is on before any write.** Every account looks alike in the output; confusing source and target is the most common mistake.
111
+
112
+ ### Stage 2: Scope Check (only if the package will hold a workflow with an app)
113
+
114
+ Workflows that use an app (ACT) need four restricted scopes in the login: `act_read`, `act_write`, `transaction_management_api`, `proof_create_transaction`. The CLI also asks for `adm_entity_esign_read` and `adm_entity_esign_write`.
115
+
116
+ - Restricted scopes are added to the **integration key** by an admin, then the user must **log in again** — a token keeps the scopes it was issued with. Adding scopes without a fresh login changes nothing.
117
+ - A token missing them shows up as a `403` when adding a workflow (`Failed to process component … of type MaestroWorkflow: Request failed with status code 403`), or as an app that fails to install.
118
+ - To check a token without printing it, decode the `scp` claim and compare **names only**. Never print the token.
119
+
120
+ ### Stage 3: Find the Components
121
+
122
+ Ask:
123
+
124
+ ```
125
+ What should go into the package? I need each component's id and a name.
126
+
127
+ eSign templates → --esign-templates "<id>:<name>"
128
+ Document templates → --templates "<id>:<name>"
129
+ Maestro workflows → --workflow "<id>:<name>"
130
+ Web forms → --webform "<id>:<name>"
131
+
132
+ You can paste the web-app URL for each — the id is in the path.
133
+ ```
134
+
135
+ Ids come from the Docusign web app URLs. A URL may carry a `hash=` or `mtsec=` parameter: that is a credential. **Use only the id from the path and never repeat the rest.**
136
+
137
+ The component must exist **in the account the CLI is logged into**. A `400` (eSign) or `403` (web form, workflow) on add usually means the component belongs to a different account, not that the id is wrong. Check `ds auth test` before anything else.
138
+
139
+ ### Stage 4: Create the Package and Add Components
140
+
141
+ ```
142
+ ── STAGE 4: BUILD THE PACKAGE ───────────────────────────
143
+
144
+ ▶ Running: ds pkg create --name=<name>
145
+ <output>
146
+
147
+ ▶ Running: ds pkg add --id=<packageId> --esign-templates "<id>:<name>" --webform "<id>:<name>"
148
+ <output>
149
+
150
+ ▶ Running: ds pkg view-details --id=<packageId>
151
+ <output>
152
+
153
+ ✅ STAGE 4 COMPLETE
154
+ Package: <name> (<packageId>)
155
+ Components: <N> (<M> added by the server as dependencies)
156
+ → Next: Stage 5 — Export
157
+ ────────────────────────────────────────────────────────
158
+ ```
159
+
160
+ Rules:
161
+
162
+ - **Use `--id`, not `--name`, after creating.** Names are not unique. Read the id from the create output.
163
+ - **Add one risky component per call.** If a call fails, no component is added. Adding the workflow on its own isolates a failure.
164
+ - **Read back after every add.** The server can accept a request and still leave a component out. The CLI counts what the server kept and fails with "did not add N of M components", naming each one. When that happens, check the account (`ds auth test`) and the scopes. Run `ds pkg view-details` to see the tree.
165
+ - To change a component, `ds pkg remove` it and add it again. Only a Draft package can change.
166
+
167
+ ### Stage 5: Export
168
+
169
+ Tell the user first: **exporting publishes the package and freezes it.**
170
+
171
+ ```
172
+ ── STAGE 5: EXPORT ──────────────────────────────────────
173
+
174
+ ▶ Running: ds pkg export --id=<packageId>
175
+ <output>
176
+
177
+ ✅ STAGE 5 COMPLETE
178
+ Zip: <path>/package/files/<name>-<first 8 of id>.zip
179
+ Size: <size>
180
+ Components: <N>
181
+ → Next: Stage 6 — Inspect the zip
182
+ ────────────────────────────────────────────────────────
183
+ ```
184
+
185
+ Then inspect the zip before moving on. It is a normal zip:
186
+
187
+ ```bash
188
+ unzip -l <zip> # one folder per component type, plus metadata.json and requirements.json
189
+ unzip -p <zip> requirements.json # what the target account must supply
190
+ ```
191
+
192
+ `requirements.json` is an empty list `[]` when nothing is needed. When an app is used by a workflow it lists a `CONNECTION_INSTANCE` requirement, naming the app and the step that uses it. **That entry is what makes the install pause for a connection.** Tell the user what to expect: "This package needs a <app> connection in the target account."
193
+
194
+ If export ends with `Publishing ended with status FAILURE`, go to **Workflow E**.
195
+
196
+ ### Stage 6: Switch to the Target Account
197
+
198
+ ```
199
+ To install in another account:
200
+ 1. Run: ds auth login -e <environment> (choose the TARGET account)
201
+ 2. Tell me when you're logged in — I'll verify and continue.
202
+ ```
203
+
204
+ You cannot answer the login's account prompt for the user. After they confirm, run `ds auth test` and **check the account id is the target and not the source.** Refuse to continue until it is.
205
+
206
+ ### Stage 7: Pre-flight on the Target
207
+
208
+ - Scopes (Stage 2) for the target login, if the package holds an app.
209
+ - If `requirements.json` named an app: look at whether the target account already has an active connection for it. The install shows the connections it finds; there is no separate command.
210
+ - Tell the user about the **workflow limit**: an account can deploy only a fixed number of published workflows (3 was seen on a test account). A package with a workflow can fail at the very last step if the account is full. Ask them to free a slot beforehand if they know the account is busy, or plan to use `--draft-workflows`.
211
+
212
+ ### Stage 8: Install
213
+
214
+ Choose the flags with the user:
215
+
216
+ | Goal | Flags |
217
+ | ------------------------------------------------ | --------------------------------------------- |
218
+ | Test install, easy to find and delete afterwards | `--prefix "cli-test-"` |
219
+ | Do not publish workflows, skip the consent step | `--draft-workflows` |
220
+ | Overwrite components that already exist | `--update` |
221
+ | Reuse a known connection | `--connection <appId>=<connectionInstanceId>` |
222
+ | Do not open a browser | `--no-browser` |
223
+
224
+ ```
225
+ ── STAGE 8: INSTALL ─────────────────────────────────────
226
+
227
+ ▶ Running: ds pkg install --file <zip> --prefix "<prefix>"
228
+ <output — progress lines, then possibly a pause>
229
+ ```
230
+
231
+ **Critical: the install is interactive.** A real terminal is needed to answer the connection and consent questions.
232
+
233
+ - **Your shell is not a terminal.** An AI agent's shell has no TTY. In it, the CLI never prompts: it prints the pause, exits 1, and leaves the install open on the server. That is correct behaviour, not a failure.
234
+ - **Run the first part yourself, hand the second part to the user.** Start the install with `-y` so it begins. If it pauses, print the resume command and ask the user to run it in a normal terminal:
235
+
236
+ ```
237
+ The install is paused and waiting for you. In a normal terminal, run:
238
+
239
+ ds pkg install --resume
240
+
241
+ Pick the connection, finish the sign-in in the browser, and give consent when it asks.
242
+ Paste the output back here and I'll read the result.
243
+ ```
244
+
245
+ - A `!` command inside an agent session also has no terminal. Tell the user to use a separate terminal window.
246
+
247
+ Handle each pause (see **Install Pauses** below), then read the verdict (see **Verdicts** below).
248
+
249
+ ### Stage 9: Verify and Report
250
+
251
+ ```
252
+ ── STAGE 9: VERIFY ──────────────────────────────────────
253
+
254
+ ▶ Running: ds pkg install --resume --event <eventId> (only if the install was left open)
255
+
256
+ ✅ STAGE 9 COMPLETE
257
+ Verdict: Installed | Installed with drafts | Failed | Not finished
258
+ Created in <target account>:
259
+ <type> <name> (instance id <id>)
260
+ ...
261
+ To clean up: search the Docusign web app for "<prefix>" and delete these.
262
+ ────────────────────────────────────────────────────────
263
+ ```
264
+
265
+ **Always end with a cleanup list**: every component created, by name and type, with the prefix to search for. The CLI cannot delete them, so the user must.
266
+
267
+ ---
268
+
269
+ ## WORKFLOW B: Install a Zip I Already Have
270
+
271
+ 1. Run **Stage 1** (auth) and **Stage 7** (pre-flight) against the target account.
272
+ 2. Inspect the zip (`unzip -l`, `unzip -p <zip> requirements.json`) and tell the user what it holds and what it needs.
273
+ 3. Run **Stage 8** and **Stage 9**.
274
+
275
+ A bare file name is also looked up in the project's `package/files` folder, where `ds pkg export` writes.
276
+
277
+ A zip exported from the _same_ account installs as **copies** of what is already there, unless `--update` is given. Use `--prefix` to tell them apart.
278
+
279
+ ---
280
+
281
+ ## WORKFLOW C: Install a Public Package
282
+
283
+ ```
284
+ ▶ Running: ds pkg list --visibility public
285
+ ▶ Running: ds pkg install --name="<name>" --source public
286
+ ```
287
+
288
+ - Public packages answer only to the public scope. The CLI tries your own packages first, then public ones; `--source public` makes it exact.
289
+ - Run `ds pkg install --name "<name>"` first without `-y` in a terminal to see the plan: it lists each component as `NEW` (will be created) or `EXISTS` (already in this account).
290
+ - Several public packages can share a name. If the CLI lists more than one id, pick with `--id`.
291
+ - A public package can hold an app. The app is installed but may have **no connection**; the final report warns `<app> is installed but has no active connection. Connect it in App Center`. That is a warning, not a failure.
292
+
293
+ ---
294
+
295
+ ## WORKFLOW D: Resume an Install That Stopped
296
+
297
+ ```
298
+ ▶ Running: ds pkg install --resume
299
+ ▶ Running: ds pkg install --resume --event <eventId>
300
+ ```
301
+
302
+ - The install runs on the server. A closed terminal, a crash, or Ctrl+C loses nothing. `--resume` re-attaches and asks any pending question again.
303
+ - Details are saved under `~/.docusign/installs/<eventId>.json` (event id, account, source, options — never tokens). `--resume` with no `--event` picks the newest unfinished install **for the account the CLI is logged into**.
304
+ - Without a saved file, `--resume` searches the server for open install events.
305
+ - A saved install from another account is refused. Log into that account first.
306
+ - **Expired installs cannot be resumed.** Start a new one.
307
+ - A paused install stays open on the server. The lifetime is unknown — do not leave it for days.
308
+ - **To stop an install**, run `ds pkg install --cancel` (newest unfinished) or `--cancel --event <id>`. It asks first; pass `-y` without a terminal. The server cancels only an install that is waiting for the user or has not started work (`INIT`, `QUEUED`, `AWAITING_INPUT`). A running install cannot be cancelled; wait for it to pause. An install that already ended has nothing to cancel, so the CLI only forgets it. **Components created before the cancel stay**, and the CLI lists them.
309
+ - Resuming a **failed** install shows the old failure again and asks "Try the failed components again?". It does not change anything until the user says yes.
310
+
311
+ ---
312
+
313
+ ## WORKFLOW E: An Install or Export Failed
314
+
315
+ Work in this order. Stop at the first thing that explains it.
316
+
317
+ **1. Read the verdict and the per-component lines.** They name the failed component and the server's reason. The server marks an install `COMPLETED` even when a component failed, so the CLI checks each component itself.
318
+
319
+ **2. Match the message:**
320
+
321
+ | Message | Likely cause | What to do |
322
+ | ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
323
+ | `All workflow deployments failed for workflow(s): <id>` | A general message. Two causes were seen: the target account's **workflow limit** (see below), or a **403** because the target account has no Maestro access (workflows are not available there; check in the web app before installing) | Check the dev/prod logs (below). Free a slot, then `--resume` and retry |
324
+ | `Publishing ended with status FAILURE` on export | A component could not be exported. The CLI is not given the reason | Read the worker logs. Known cause: a workflow step with no saved settings |
325
+ | `Config instance not found for step ID: <id>` (in logs) | A workflow step has no saved configuration, so ALM cannot export it | Open the workflow, find that step, save it again, retry the export |
326
+ | `403` when adding a workflow or web form | Component is in another account, or the token lacks scopes | `ds auth test`; check the four ACT scopes; log in again after an admin adds them |
327
+ | `400` when adding an eSign template | Template is in another account | Log into the account that owns it |
328
+ | `Your session has expired` | Token expired | `ds auth login`. Use `DOCUSIGN_SKIP_CHECKS=cli.version`, not `DOCUSIGN_NO_GLOBAL_CHECKS`, in scripts so token refresh stays on |
329
+ | `Zip file not found` / `is not a zip file` | Wrong path, or a different file | The CLI lists every place it looked |
330
+ | Install exits 1 with "Install not finished" | It is waiting for a connection or consent and there is no terminal | Run `ds pkg install --resume` in a normal terminal |
331
+ | The install keeps `AWAITING_INPUT` after you answered | The server did not accept the answer | The CLI retries a few times and shows the server's message |
332
+
333
+ **3. The workflow limit.** An account can deploy a fixed number of published workflows. When it is full, the final publish step fails with the general `All workflow deployments failed` message and the real reason (`Account(<id>) has reached its maximum workflow deployment limit (3)`) is only in the service logs. The workflow itself is created and stays a **draft**. Ways out:
334
+
335
+ - Free a slot (unpublish or delete a workflow in the target account), then `ds pkg install --resume --event <id>` and answer yes to the retry.
336
+ - Install into an account that has room.
337
+ - Install with `--draft-workflows` so workflows are never published. **This must be chosen on a new install or at the consent step.** A failed event accepts only a retry; it cannot be turned into "installed with drafts".
338
+
339
+ **4. Reading the logs.** The CLI keeps a log of every run in `~/.docusign/logs/`, independent of `--debug`. It holds every request and its status, and is the first place to look. Link codes in it should be redacted before pasting anywhere. For server-side reasons, search the service logs (Kusto) by the event id, the package id, the account id, and the workflow id; the ALM packaging workers log the cause of a failed publish or export.
340
+
341
+ **5. Retry carefully.** A retry re-runs the install for the failed components. The server may skip components the first try created, or may create them again. After a retry, look for duplicates by searching the account for the prefix.
342
+
343
+ ---
344
+
345
+ ## Install Pauses
346
+
347
+ An install can stop twice to ask for something. Both are normal.
348
+
349
+ ### Pause 1: App connections (`REQUIREMENT_MAPPING`)
350
+
351
+ Happens when the package's `requirements.json` names an app connection the target account does not have. **Nothing is created until it is answered** — the whole install waits.
352
+
353
+ What the CLI does, in a terminal:
354
+
355
+ ```
356
+ ⚠ The install is paused: it needs a connection for each app below
357
+ Google Drive (oauth2Token connection)
358
+ Needed by: Google Drive workflow
359
+ You have no active Google Drive connection yet
360
+ ? Connection to use for Google Drive (oauth2Token connection):
361
+ ❯ Connect a new Google Drive account in the browser
362
+ Skip (the install stays paused)
363
+ ```
364
+
365
+ 1. It lists the account's **active** connections for the app. Only active ones can be used.
366
+ 2. If the user chooses to connect a new one, the CLI asks the platform for the app's sign-in page (the same page the App Center's Connect button uses), opens it in the browser, and prints it.
367
+ 3. It then polls every 3 seconds, up to 10 minutes, for a **new** active connection.
368
+ 4. When one appears it asks "Use this connection?", checks the choice with the server, and resumes once with the answer.
369
+
370
+ Things to know:
371
+
372
+ - The sign-in page belongs to the app (for example Google). The CLI never sees a password. The user signs in as whoever they choose; the connection belongs to that user.
373
+ - The install event itself carries **no link**. The CLI gets the link from a separate call. If that call fails, the CLI says why and tells the user to connect in App Center. If the user is in that fallback, ask them to connect there and the CLI will detect the new connection by polling.
374
+ - The browser tab stays open after sign-in; the user closes it. The CLI does not listen for the redirect, it only polls.
375
+ - Pressing Ctrl+C stops the CLI. The install stays paused on the server; `--resume` continues.
376
+ - `--connection <appId>=<connectionInstanceId>` answers this up front and skips the question. The connection must already be active.
377
+ - Choosing "Skip" leaves the install paused. There is no way to install the rest without the connection.
378
+
379
+ ### Pause 2: Workflow consent (`BULK_PUBLISH_CONSENT`)
380
+
381
+ Happens after the components are created, before workflows are published.
382
+
383
+ ```
384
+ ⚠ The install is paused: the workflows below need their owner's consent before they can be published
385
+ Workflows: <workflow id or name>
386
+ pendingUserInput.inputDetails.consentUrl: https://…/workflows/consent?…
387
+ ? Consent for the workflows:
388
+ ❯ I have given consent, continue
389
+ Create the workflows as drafts instead
390
+ Stop for now (the install can be resumed)
391
+ ```
392
+
393
+ - The CLI opens the consent page. The user consents in the browser, then picks "I have given consent, continue".
394
+ - If the server still shows the pause, it was not detected; the CLI asks again, up to three times.
395
+ - "Create the workflows as drafts instead" (or `--draft-workflows` up front) leaves them unpublished. The verdict becomes **Installed with drafts**.
396
+ - Not every install reaches this pause. A simple workflow with no app installed and published straight through, with no consent step, so do not promise it.
397
+ - The consent link is a credential. Do not copy it into a PR, chat or note.
398
+
399
+ ---
400
+
401
+ ## Verdicts
402
+
403
+ | Verdict | Meaning | Exit |
404
+ | --------------------- | ------------------------------------------------------------------------ | ---- |
405
+ | Installed | Every component installed | 0 |
406
+ | Installed with drafts | Installed; some workflows left as unpublished drafts | 0 |
407
+ | Failed | One or more components failed | 1 |
408
+ | Not finished | Waiting for the user (connection or consent), or the CLI stopped waiting | 1 |
409
+ | Cancelled / Expired | The server ended it | 1 |
410
+
411
+ Read the **components**, not just the headline:
412
+
413
+ - A workflow may print "created as a draft" and then "installed". The server creates workflows as drafts and publishes them a moment later. Only a draft that is still a draft at the end counts as "left as drafts".
414
+ - An installed app with no active connection gives a warning, not a failure.
415
+
416
+ ---
417
+
418
+ ## Limitations & Workarounds
419
+
420
+ These are known behaviours, not blockers. Autopilot handles them.
421
+
422
+ | Situation | What happens | Autopilot handles it by |
423
+ | ------------------------------------------------------------ | ------------------------------------------------------ | ----------------------------------------------------------------------------- |
424
+ | Private package installed from another account | There is no sharing route in the public API | Using export → zip → install --file |
425
+ | `pkg add` accepted by the server but a component is left out | The CLI exits 1 with "did not add N of M components" | Checking the account and scopes, then reading back with `ds pkg view-details` |
426
+ | Export or publish fails with a bare `FAILURE` | The status carries no reason | Reading service logs by event id; asking the user to re-save the broken step |
427
+ | Install fails at the final publish with a general message | Real reason (e.g. workflow limit) is two services down | Reading the logs; freeing a slot; or `--draft-workflows` |
428
+ | Failed event cannot become "installed with drafts" | The server accepts only a retry on a failed event | Starting a new install with `--draft-workflows` and a new `--prefix` |
429
+ | Install needs a terminal for its questions | An agent's shell has none | Starting with `-y`, then handing `--resume` to the user |
430
+ | Installed components cannot be deleted from the CLI | No delete route | `--prefix` on every test install; a final cleanup list |
431
+ | A closed browser tab after sign-in | The CLI polls and does not listen for the redirect | Telling the user to close the tab |
432
+ | A `hash=` / `mtsec=` / `code=` value in a URL | These are credentials | Using only the id; never repeating the rest |
433
+ | A paused install stays open on the server | Lifetime unknown | Telling the user to resume, or to stop it with `ds pkg install --cancel` |
434
+ | `--resume` of a failed event | Shows the old failure and asks about a retry | Explaining it is history until the user says yes |
435
+
436
+ **Not yet observed** — say so honestly when asked, do not guess:
437
+
438
+ - How long a paused install lives on the server.
439
+ - Whether a retry re-creates components that the first try already made.
440
+ - Which workflows trigger the consent pause (one simple workflow did not).
441
+
442
+ ---
443
+
444
+ ## Commands Reference
445
+
446
+ ### Authentication
447
+
448
+ ```bash
449
+ ds auth login -e <demo|integration|stage|production> # Log in, then choose the account
450
+ ds auth test # Show the account, environment and token expiry
451
+ ```
452
+
453
+ ### Build
454
+
455
+ ```bash
456
+ ds pkg create --name=my-package
457
+ ds pkg add --id=<packageId> --esign-templates "555:NDA" "775:MSA"
458
+ ds pkg add --id=<packageId> --workflow "111:Invoice approval" --webform "9f2:Intake form"
459
+ ds pkg add --id=<packageId> --templates "333:Contract template"
460
+ ds pkg remove --id=<packageId> --esign-templates "775:MSA"
461
+ ds pkg view-details --id=<packageId> # Dependency tree
462
+ ds pkg status --id=<packageId> # Draft | Processing | Awaiting input | Installed | Published
463
+ ds pkg update --id=<packageId> --rename=new-name --description="…"
464
+ ds pkg list [--visibility private|public|any] [--status Draft|Published|Archived|Review]
465
+ ds pkg delete --id=<packageId> [-y] # Deletes the package, not what an install created
466
+ ```
467
+
468
+ ### Move
469
+
470
+ ```bash
471
+ ds pkg export --id=<packageId> [--output ./backups/my.zip] # Publishes, then writes the zip
472
+ ds pkg install --file <zip> [--prefix "x-"] [--update] [--draft-workflows] [--connection a=c] [--no-browser] [-y]
473
+ ds pkg install --id=<packageId> [--source private|public|any]
474
+ ds pkg install --name="<name>" --source public
475
+ ds pkg install --resume [--event <eventId>]
476
+ ds pkg install --cancel [--event <eventId>] [-y]
477
+ ```
478
+
479
+ ### Inspect a zip
480
+
481
+ ```bash
482
+ unzip -l <zip>
483
+ unzip -p <zip> requirements.json
484
+ unzip -p <zip> metadata.json
485
+ ```
486
+
487
+ ### Component flags
488
+
489
+ | Flag | Component type |
490
+ | ------------------- | ------------------- |
491
+ | `--esign-templates` | eSignature template |
492
+ | `--templates` | Document template |
493
+ | `--workflow` | Maestro workflow |
494
+ | `--webform` | Web form |
495
+
496
+ Each value is `<id>:<name>`. Quote names that contain spaces. List several after one flag or repeat the flag.
497
+
498
+ ### Where things live
499
+
500
+ ```
501
+ <workspace>/<project>/package/files/ # Exported zips are written here
502
+ ~/.docusign/installs/<eventId>.json # Saved details for --resume (no tokens)
503
+ ~/.docusign/logs/ # A log for every run
504
+ ```
505
+
506
+ ---
507
+
508
+ ## Safety Rules
509
+
510
+ 1. **Say which account you are on** before every write, and refuse to continue if it is not the one the user named.
511
+ 2. **Ask before anything that cannot be undone**: export (freezes the package), install (creates components that only the web app can delete), retry of a failed install.
512
+ 3. **Never print or store** tokens, `hash=`/`mtsec=`/`code=`/`state=` values, or consent links. Compare scopes by name only.
513
+ 4. **Always use `--prefix`** for test installs, and finish with a list of what was created.
514
+ 5. **Report outcomes faithfully.** If a component failed, say so with the server's words. If something was not tested, say that. Do not call an install successful because it exited 0.
@@ -1,9 +1,10 @@
1
1
  ---
2
- description: Docusign Agreement Manager — IAM Toolkit CLI workflow guide for AI-powered document extraction
2
+ description: Docusign IAM Toolkit CLI workflow guides — Agreement Manager document extraction and package export/install
3
3
  globs: ["**/*.json", "**/*.csv", "**/agreement-manager/**"]
4
4
  alwaysApply: true
5
5
  ---
6
6
 
7
7
  @file:.claude/skills/ds-agm-autopilot/SKILL.md
8
+ @file:.claude/skills/ds-package-autopilot/SKILL.md
8
9
  @file:.claude/skills/ds-agreement-manager-workflow/SKILL.md
9
10
  @file:.claude/skills/ds-testing/SKILL.md
@@ -3,7 +3,8 @@
3
3
  Read the following skill files for the full workflow guide and testing instructions:
4
4
 
5
5
  - `.claude/skills/ds-agm-autopilot/SKILL.md`
6
+ - `.claude/skills/ds-package-autopilot/SKILL.md`
6
7
  - `.claude/skills/ds-agreement-manager-workflow/SKILL.md`
7
8
  - `.claude/skills/ds-testing/SKILL.md`
8
9
 
9
- These files contain step-by-step guidance for the `ds agm` CLI commands, manifest authoring rules, AI-assisted testing workflows, and full autopilot operation of the Agreement Manager lifecycle.
10
+ These files contain step-by-step guidance for the `ds agm` CLI commands, manifest authoring rules, AI-assisted testing workflows, full autopilot operation of the Agreement Manager lifecycle, and the package lifecycle (`ds pkg`: build, export, install in another account, resume, diagnose).
@@ -44,6 +44,10 @@ ds agm test run [-y] [--partial-match] # Run extraction tests
44
44
 
45
45
  To drive the full Agreement Manager lifecycle interactively, invoke the `ds-agm-autopilot` skill. It guides you through auth, manifest creation, upload, ingest, metadata ingestion, testing, and config migration with visual stage feedback. Say "autopilot" for autonomous operation or answer prompts step-by-step.
46
46
 
47
+ ## Package Autopilot Mode
48
+
49
+ To build a package, export it, and install it into another account, invoke the `ds-package-autopilot` skill. It covers `ds pkg` end to end: creating a package, adding eSign templates, web forms, Maestro workflows and document templates, exporting a portable zip, installing it (app connections, workflow consent, drafts), resuming an install, and diagnosing failures. Say "autopilot" for autonomous operation.
50
+
47
51
  ## Agreement Manager Workflow
48
52
 
49
53
  1. `ds auth login -e demo`
@@ -0,0 +1,57 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+
4
+ const SKILLS_DIR = path.join(__dirname, '.claude', 'skills');
5
+ const read = (...parts: string[]): string => fs.readFileSync(path.join(__dirname, ...parts), 'utf8');
6
+
7
+ const frontmatter = (text: string): Record<string, string> => {
8
+ const match = /^---\n([\s\S]*?)\n---/.exec(text);
9
+ if (!match) return {};
10
+ return Object.fromEntries(
11
+ match[1]
12
+ .split('\n')
13
+ .map(line => /^([a-z-]+):\s*(.*)$/.exec(line))
14
+ .filter((m): m is RegExpExecArray => m !== null)
15
+ .map(m => [m[1], m[2]]),
16
+ );
17
+ };
18
+
19
+ describe('AI skill templates', () => {
20
+ const skillDirs = fs.readdirSync(SKILLS_DIR, { withFileTypes: true }).filter(entry => entry.isDirectory());
21
+
22
+ it.each(skillDirs.map(dir => [dir.name]))('%s should name itself after its folder and describe when to use it', name => {
23
+ const meta = frontmatter(read('.claude', 'skills', name, 'SKILL.md'));
24
+
25
+ expect(meta.name).toBe(name);
26
+ expect(meta.description?.length).toBeGreaterThan(40);
27
+ });
28
+
29
+ describe('ds-package-autopilot', () => {
30
+ const skill = read('.claude', 'skills', 'ds-package-autopilot', 'SKILL.md');
31
+
32
+ it('should be listed for every assistant that lists skills', () => {
33
+ expect(read('.cursor', 'rules', 'docusign.mdc')).toContain('.claude/skills/ds-package-autopilot/SKILL.md');
34
+ expect(read('.gemini', 'instructions.md')).toContain('.claude/skills/ds-package-autopilot/SKILL.md');
35
+ expect(read('.github', 'instructions', 'docusign.instructions.md')).toContain('ds-package-autopilot');
36
+ });
37
+
38
+ it('should cover the whole lifecycle a user can ask for', () => {
39
+ ['ds pkg create', 'ds pkg add', 'ds pkg export', 'ds pkg install --file', 'ds pkg install --resume', 'ds pkg view-details'].forEach(command =>
40
+ expect(skill).toContain(command),
41
+ );
42
+ ['REQUIREMENT_MAPPING', 'BULK_PUBLISH_CONSENT', '--draft-workflows', '--prefix', 'requirements.json'].forEach(term =>
43
+ expect(skill).toContain(term),
44
+ );
45
+ });
46
+
47
+ it('should name the four restricted scopes an app needs', () => {
48
+ ['act_read', 'act_write', 'transaction_management_api', 'proof_create_transaction'].forEach(scope => expect(skill).toContain(scope));
49
+ });
50
+
51
+ it('should carry no secret: no token, no link code, no real account or package id', () => {
52
+ expect(skill).not.toMatch(/eyJ[A-Za-z0-9_-]{20,}/);
53
+ expect(skill).not.toMatch(/[?&](code|state|hash|mtsec|sig)=[A-Za-z0-9+/=_-]{12,}/);
54
+ expect(skill).not.toMatch(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/);
55
+ });
56
+ });
57
+ });
@@ -0,0 +1,40 @@
1
+ # Integration
2
+
3
+ Tools for your integration keys (IKs).
4
+
5
+ ## Directory structure
6
+
7
+ - **logs/**: CSV files written by `ds integration logs`
8
+
9
+ ## Download the API logs of an integration key
10
+
11
+ ```bash
12
+ ds integration logs --ik <integration-key> # last hour
13
+ ds integration logs --ik <integration-key> --limit 7d # last 7 days
14
+ ds ik logs --ik <integration-key> --limit 30d # 'ik' is short for 'integration'
15
+ ```
16
+
17
+ | Option | Default | What it does |
18
+ | ------------ | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
19
+ | `--ik` | required | The integration key (client ID). A GUID, or a GUID with up to six letters and a `-` or `_` in front. Case does not matter. |
20
+ | `--limit` | `1h` | How far back to read, from now: `10m`, `1h`, `6h`, `12h`, `1d`, `7d`, `15d` or `30d`. The longest window is 30 days. |
21
+ | `--max-rows` | `1000000` | Stop before the download if the window holds more rows than this. Each row is roughly 0.6 to 0.9 KB, so the default is a file of about 0.6 to 0.9 GB. |
22
+
23
+ The file is `logs/<integration-key>_<limit>_<time>.csv`, with one header row and one row per request.
24
+
25
+ - Logs come from the environment you are logged in to, for the account you are logged in to. An integration key that
26
+ does not belong to this account returns no rows.
27
+ - While it downloads, the command prints a progress line after every 25,000 rows, for example
28
+ `Fetched 25,000 of 1,000,000 rows (2.5%) in 11s, 2,273 rows/s, about 7m 9s left`. The estimate is the average speed so far,
29
+ so treat it as a rough guide. The same lines go to the debug log in `~/.docusign/logs`.
30
+ - The command counts the rows first. If there are more than `--max-rows` (1,000,000 by default), it stops before it
31
+ downloads anything. Use a shorter `--limit`, or raise `--max-rows`.
32
+ - A file that ends in `.csv.partial` is an export that stopped early. The rows it holds are real, but the pull is not
33
+ complete. Run the command again.
34
+
35
+ ## Columns
36
+
37
+ The columns are the fields the log dataset returns, in the order it returns them, with one row per request, oldest
38
+ first. A field added to the dataset shows up as a new column without a CLI update.
39
+
40
+ A text cell that starts with `=`, `+`, `-` or `@` begins with an extra `'`, so a spreadsheet does not run it as a formula.