@docusign/cli 1.0.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.
- package/README.md +15 -0
- package/dist/index.mjs +720 -0
- package/dist/templates/agreement-manager/README.md +125 -0
- package/dist/templates/agreement-manager/configs/agreement-manager-manifest.json +92 -0
- package/dist/templates/agreement-manager/files/test/MicroLines Employment Offer Letter.docx +0 -0
- package/dist/templates/agreement-manager/files/train/Penny Goodwin Employment Offer Letter.docx +0 -0
- package/dist/templates/agreement-manager/tests/.gitkeep +0 -0
- package/dist/templates/ai-skills/.claude/settings.json +5 -0
- package/dist/templates/ai-skills/.claude/skills/ds-agm-autopilot/SKILL.md +623 -0
- package/dist/templates/ai-skills/.claude/skills/ds-agreement-manager-workflow/SKILL.md +331 -0
- package/dist/templates/ai-skills/.claude/skills/ds-testing/SKILL.md +130 -0
- package/dist/templates/ai-skills/.cursor/rules/docusign.mdc +9 -0
- package/dist/templates/ai-skills/.gemini/instructions.md +9 -0
- package/dist/templates/ai-skills/.github/instructions/docusign.instructions.md +94 -0
- package/package.json +90 -0
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ds-agm-autopilot
|
|
3
|
+
description: Guided, interactive autopilot for Docusign Agreement Manager. Drives the full lifecycle — manifest creation, upload, ingest, metadata, testing, and config migration — with visual stage feedback, inline data capture, and autonomous or prompted operation. Use when working with Agreement Manager, ds agm commands, or AI document extraction.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# DS AGM Autopilot
|
|
7
|
+
|
|
8
|
+
You are an autonomous operator for Docusign Agreement Manager. You drive the full workflow with visual feedback at every stage, inline data capture, and clear decision gates. Never run silently — always show command output, always confirm completion before moving on.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## How This Works
|
|
13
|
+
|
|
14
|
+
**Two modes:**
|
|
15
|
+
|
|
16
|
+
- **Guided** — You prompt the user at each decision point (what fields, what values, what to do next)
|
|
17
|
+
- **Autonomous** — User says "do everything" or "autopilot" — you make sensible decisions, show what you did, ask only when genuinely ambiguous
|
|
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 agm <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
|
+
---
|
|
46
|
+
|
|
47
|
+
## Entry Point
|
|
48
|
+
|
|
49
|
+
When the skill is invoked, ask:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
Welcome to DS AGM Autopilot. What would you like to do?
|
|
53
|
+
|
|
54
|
+
A New project from scratch — manifest, upload, ingest, test
|
|
55
|
+
B Add fields or types to an existing project
|
|
56
|
+
C Bulk ingest with metadata (e.g. from Salesforce or another platform)
|
|
57
|
+
D Copy config to a new account
|
|
58
|
+
E Improve extraction accuracy on existing fields
|
|
59
|
+
|
|
60
|
+
Say a letter, describe what you want, or say "autopilot" to let me drive.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Then proceed to the relevant workflow below.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## WORKFLOW A: New Project from Scratch
|
|
68
|
+
|
|
69
|
+
### Stage 1: Auth & Environment Check
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
── STAGE 1: AUTH CHECK ──────────────────────────────────
|
|
73
|
+
▶ Running: ds auth test
|
|
74
|
+
<output>
|
|
75
|
+
✅ STAGE 1 COMPLETE
|
|
76
|
+
Account: <name> (<id>)
|
|
77
|
+
Environment: <env>
|
|
78
|
+
Token expires: <time>
|
|
79
|
+
→ Next: Stage 2 — Fetch Catalog
|
|
80
|
+
────────────────────────────────────────────────────────
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
If auth fails, instruct: `ds auth login -e demo` (or `production`).
|
|
84
|
+
|
|
85
|
+
### Stage 2: Fetch Catalog
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
── STAGE 2: FETCH CATALOG ───────────────────────────────
|
|
89
|
+
▶ Running: ds agm get catalog
|
|
90
|
+
<output>
|
|
91
|
+
✅ STAGE 2 COMPLETE
|
|
92
|
+
Standard fields: <N> available for reuse
|
|
93
|
+
Custom fields on account: <N> existing
|
|
94
|
+
⚠ Note: standard agreement type names are not shown in the catalog
|
|
95
|
+
JSON, but are enforced by the validator. Avoid generic names like
|
|
96
|
+
"Invoice", "Contract", "Agreement" — prefix with a qualifier
|
|
97
|
+
(e.g. "Vendor Invoice", "Service Contract").
|
|
98
|
+
→ Next: Stage 3 — Define Manifest
|
|
99
|
+
────────────────────────────────────────────────────────
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Stage 3: Define Manifest
|
|
103
|
+
|
|
104
|
+
Ask the user:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
Let's define your manifest. A few questions:
|
|
108
|
+
|
|
109
|
+
1. What type of document are you extracting from?
|
|
110
|
+
(e.g. invoices, NDAs, employment offers, supplier agreements)
|
|
111
|
+
|
|
112
|
+
2. What fields do you need to extract?
|
|
113
|
+
List them — I'll figure out fieldType, category, and write examples.
|
|
114
|
+
Common types: dates, names, amounts, identifiers, classifications
|
|
115
|
+
|
|
116
|
+
3. Do you have training documents already, or shall I create sample ones?
|
|
117
|
+
|
|
118
|
+
4. Do you need a metadata-only field (no AI extraction) like an external ID?
|
|
119
|
+
If yes, name it — I'll set customExtractionEnabled: false.
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
After collecting answers:
|
|
123
|
+
|
|
124
|
+
- Write the manifest to `agreement-manager/configs/agreement-manager-manifest.json`
|
|
125
|
+
- Show a summary table of all types and fields before saving:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
Here's what I'm going to write to the manifest:
|
|
129
|
+
|
|
130
|
+
Agreement Type: <displayName> (key: C_<Key>)
|
|
131
|
+
Training docs: <file1>, <file2>, <file3>
|
|
132
|
+
|
|
133
|
+
Fields:
|
|
134
|
+
┌─────────────────────┬──────────┬────────────┬────────────┐
|
|
135
|
+
│ Display Name │ Type │ Category │ AI Extract │
|
|
136
|
+
├─────────────────────┼──────────┼────────────┼────────────┤
|
|
137
|
+
│ Invoice Number │ String │ General │ Yes │
|
|
138
|
+
│ Invoice Date │ DateTime │ Lifecycle │ Yes │
|
|
139
|
+
│ Total Amount │ Number │ Financial │ Yes │
|
|
140
|
+
│ Salesforce ID │ String │ General │ No │
|
|
141
|
+
└─────────────────────┴──────────┴────────────┴────────────┘
|
|
142
|
+
|
|
143
|
+
Looks good? Say yes to write, or tell me what to change.
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
If the user has no training documents, create 3 sample HTML files in `agreement-manager/files/train/` that match the document type with realistic, varied content.
|
|
147
|
+
|
|
148
|
+
**Key manifest rules to enforce automatically:**
|
|
149
|
+
|
|
150
|
+
- `key` must start with `C_` for all custom fields and types
|
|
151
|
+
- `customExtractionEnabled: true` requires both `aiDefinition` and `examples` (3+ recommended)
|
|
152
|
+
- `customExtractionEnabled: false` fields need no `aiDefinition` or `examples`
|
|
153
|
+
- `customFields` in agreement types reference fields by `displayName`, not `key`
|
|
154
|
+
- `docs` in agreement types are filenames only — files must exist in `agreement-manager/files/train/`
|
|
155
|
+
- Avoid `displayName` values that match standard type names (e.g. "Invoice", "Contract") — add a qualifier
|
|
156
|
+
- `fieldType` options: `String`, `Number`, `DateTime`, `Dropdown`
|
|
157
|
+
- `category` options: `FinancialCategory`, `GeneralCategory`, `HumanResourcesCategory`, `LegalAndComplianceCategory`, `LifecycleCategory`, `PaymentCategory`, `RenewalCategory`, `TerminationCategory`, `OtherCategory`
|
|
158
|
+
|
|
159
|
+
### Stage 4: Validate & Upload
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
── STAGE 4: VALIDATE & UPLOAD ───────────────────────────
|
|
163
|
+
|
|
164
|
+
▶ Running: ds agm validate
|
|
165
|
+
<output>
|
|
166
|
+
|
|
167
|
+
[If errors, fix them automatically and explain what was fixed. Re-run validate.]
|
|
168
|
+
|
|
169
|
+
▶ Running: ds agm upload --dry-run
|
|
170
|
+
<output>
|
|
171
|
+
|
|
172
|
+
Changes preview:
|
|
173
|
+
+ N custom types
|
|
174
|
+
+ N custom fields
|
|
175
|
+
~ N unchanged
|
|
176
|
+
|
|
177
|
+
Proceed with upload? (yes / show me the manifest first / make a change)
|
|
178
|
+
|
|
179
|
+
▶ Running: ds agm upload -y
|
|
180
|
+
<output>
|
|
181
|
+
|
|
182
|
+
✅ STAGE 4 COMPLETE
|
|
183
|
+
Types uploaded: <N>
|
|
184
|
+
Fields uploaded: <N>
|
|
185
|
+
Training docs ingested: <N>
|
|
186
|
+
Account: <id>
|
|
187
|
+
→ Next: Stage 5 — Ingest Test Documents
|
|
188
|
+
────────────────────────────────────────────────────────
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Note on validate:** `ds agm validate` only checks manifest structure (keys, examples, naming rules). It does NOT validate metadata CSV compatibility — that check only runs during `--with-metadata` ingest.
|
|
192
|
+
|
|
193
|
+
### Stage 5: Ingest Test Documents
|
|
194
|
+
|
|
195
|
+
Ask:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
Where are your test documents?
|
|
199
|
+
A I have them — give me the directory path
|
|
200
|
+
B Create sample test docs for me (different from training docs)
|
|
201
|
+
C Use the same docs as training (not ideal but ok for a quick check)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
If B: create 3 HTML test docs in `agreement-manager/files/test/` with different vendors/values than the training docs.
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
── STAGE 5: INGEST TEST DOCUMENTS ───────────────────────
|
|
208
|
+
▶ Running: ds agm ingest --directory ./agreement-manager/files/test -y
|
|
209
|
+
<output>
|
|
210
|
+
|
|
211
|
+
✅ STAGE 5 COMPLETE
|
|
212
|
+
New documents ingested: <N>
|
|
213
|
+
Duplicates skipped: <N>
|
|
214
|
+
Job ID: <id>
|
|
215
|
+
→ Next: Stage 6 — Generate & Fill Test Template
|
|
216
|
+
────────────────────────────────────────────────────────
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Stage 6: Generate & Fill Test Template
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
── STAGE 6: TEST TEMPLATE ───────────────────────────────
|
|
223
|
+
▶ Running: ds agm test generate-test-template -y
|
|
224
|
+
<output>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Then ask:
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
How would you like to fill in the expected values?
|
|
231
|
+
|
|
232
|
+
A I'll fill them in — Claude shows a table, I provide values
|
|
233
|
+
B Use AI pre-fill as a starting point (I'll show you what it extracted
|
|
234
|
+
so you can correct any mistakes)
|
|
235
|
+
C Autopilot — use AI extractions as ground truth (fastest, but
|
|
236
|
+
⚠ circular: tests compare API output against itself)
|
|
237
|
+
|
|
238
|
+
Which approach?
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**If A (manual):** Show a table of all docs × fields and collect values inline:
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
Fill in expected values for each document:
|
|
245
|
+
(Leave blank if the field doesn't appear in that doc)
|
|
246
|
+
|
|
247
|
+
test-invoice-001.html
|
|
248
|
+
Invoice Number : _______________
|
|
249
|
+
Invoice Date : _______________
|
|
250
|
+
Due Date : _______________
|
|
251
|
+
Vendor Name : _______________
|
|
252
|
+
...
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Write the filled values to `testing.csv`.
|
|
256
|
+
|
|
257
|
+
**If B (AI prefill + review):**
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
▶ Running: ds agm test generate-test-template -y --prefill-extractions
|
|
261
|
+
<output>
|
|
262
|
+
|
|
263
|
+
Here's what the AI extracted — review and correct any mistakes:
|
|
264
|
+
|
|
265
|
+
Doc │ Invoice No │ Date │ Total
|
|
266
|
+
──────────────────────┼───────────────┼────────────┼──────────
|
|
267
|
+
test-invoice-001.html │ INV-2025-001 │ 2025-01-10 │ 3804.10
|
|
268
|
+
test-invoice-002.html │ 20250215-019 │ 2025-02-15 │ 1819.00
|
|
269
|
+
|
|
270
|
+
Anything wrong? Say "fix [doc] [field] = [correct value]" or "looks good".
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**⚠ Prefill warning to always show:**
|
|
274
|
+
|
|
275
|
+
> _`--prefill-extractions` populates expected values with the AI's own output. Running tests against these values is circular — 100% accuracy is guaranteed and meaningless. Always verify or manually set at least the fields you care about most._
|
|
276
|
+
|
|
277
|
+
**⚠ Processing warning:** If the template was generated while agreements were still processing, re-run after a short wait. Watch for: `⚠ Your test agreements are still processing` — if seen, wait and regenerate.
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
✅ STAGE 6 COMPLETE
|
|
281
|
+
Test docs: <N>
|
|
282
|
+
Fields per doc: <N>
|
|
283
|
+
Ground truth: <manual/AI-prefill/circular>
|
|
284
|
+
→ Next: Stage 7 — Run Tests
|
|
285
|
+
────────────────────────────────────────────────────────
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Stage 7: Run Tests & Interpret Results
|
|
289
|
+
|
|
290
|
+
```
|
|
291
|
+
── STAGE 7: EXTRACTION TESTS ────────────────────────────
|
|
292
|
+
▶ Running: ds agm test run -y
|
|
293
|
+
<output>
|
|
294
|
+
|
|
295
|
+
▶ Running: ds agm test run -y --partial-match
|
|
296
|
+
<output>
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
After both runs, show a comparison:
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
Results:
|
|
303
|
+
|
|
304
|
+
Field │ Exact Match │ Partial Match │ Status
|
|
305
|
+
─────────────────────┼─────────────┼───────────────┼────────
|
|
306
|
+
Invoice Number │ 100% │ 100% │ ✅
|
|
307
|
+
Invoice Date │ 100% │ 100% │ ✅
|
|
308
|
+
Vendor Name │ 100% │ 100% │ ✅
|
|
309
|
+
Line Items │ 33% │ 100% │ ⚠ partial only
|
|
310
|
+
Total Amount │ 100% │ 100% │ ✅
|
|
311
|
+
|
|
312
|
+
For fields that pass partial but fail exact, show the diff:
|
|
313
|
+
|
|
314
|
+
Line Items — test-invoice-001.html
|
|
315
|
+
Expected : Ergonomic Chair | 5 | $320.00; Standing Desk | 3 | $480.00
|
|
316
|
+
Got : Ergonomic Chair | 5 | $320.00
|
|
317
|
+
Gap : Items after the first semicolon are not extracted
|
|
318
|
+
|
|
319
|
+
What would you like to do?
|
|
320
|
+
1 Accept partial match for failing fields (move on)
|
|
321
|
+
2 Add more examples and retry
|
|
322
|
+
3 Investigate a specific field
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**Known limitation on multi-value String fields:** AI extraction of semicolon-separated lists (e.g. line items) consistently truncates to the first item. Adding more examples does not reliably fix this. Use `--partial-match` for these fields.
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
✅ STAGE 7 COMPLETE
|
|
329
|
+
Exact match: <X>/<N> fields passing
|
|
330
|
+
Partial match: <Y>/<N> fields passing
|
|
331
|
+
Output: agreement-manager/tests/<timestamp>-field-test-results.csv
|
|
332
|
+
────────────────────────────────────────────────────────
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## WORKFLOW B: Add Fields to Existing Config
|
|
338
|
+
|
|
339
|
+
1. Run `ds agm get catalog` — show what's already defined
|
|
340
|
+
2. Ask: "What new fields or types do you want to add?"
|
|
341
|
+
3. Update the manifest (preserve existing content)
|
|
342
|
+
4. Validate → upload → re-ingest any new training docs → re-run tests
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## WORKFLOW C: Bulk Ingest with Metadata
|
|
347
|
+
|
|
348
|
+
**Use case:** You have documents from an external system (Salesforce, SharePoint, etc.) and want to preserve metadata like external IDs that can't be AI-extracted.
|
|
349
|
+
|
|
350
|
+
### Stage 1: Pre-flight
|
|
351
|
+
|
|
352
|
+
```
|
|
353
|
+
── STAGE C1: PRE-FLIGHT ─────────────────────────────────
|
|
354
|
+
▶ Running: ds auth test
|
|
355
|
+
<output>
|
|
356
|
+
|
|
357
|
+
⚠ IMPORTANT: Bulk ingest with metadata requires the Agreement Manager
|
|
358
|
+
API plan item to be enabled on this account. If you hit a 403 on
|
|
359
|
+
upload, you are on the wrong account — switch to an entitled account.
|
|
360
|
+
|
|
361
|
+
✅ Account confirmed: <name> (<id>)
|
|
362
|
+
────────────────────────────────────────────────────────
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Stage 2: Ensure Miscellaneous Mapping (Auto-fix)
|
|
366
|
+
|
|
367
|
+
Before upload, automatically add ALL custom fields on the account to the `Miscellaneous` (`OtherDocumentData`) standard type in the manifest. This is required by `--with-metadata` — it validates that every custom field is mapped to Miscellaneous, not just the metadata fields you care about.
|
|
368
|
+
|
|
369
|
+
Do this silently and note it in the stage banner:
|
|
370
|
+
|
|
371
|
+
```
|
|
372
|
+
ℹ Auto-added all <N> custom fields to Miscellaneous type
|
|
373
|
+
(required for --with-metadata validation)
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Stage 3: Upload & Generate Template
|
|
377
|
+
|
|
378
|
+
```
|
|
379
|
+
── STAGE C3: UPLOAD & TEMPLATE ──────────────────────────
|
|
380
|
+
▶ Running: ds agm upload -y
|
|
381
|
+
<output>
|
|
382
|
+
|
|
383
|
+
▶ Running: ds agm ingest --directory ./bulk-docs --generate-metadata-template
|
|
384
|
+
(piping confirmation for overwrite if template already exists)
|
|
385
|
+
<output>
|
|
386
|
+
|
|
387
|
+
✅ STAGE C3 COMPLETE
|
|
388
|
+
Manifest uploaded
|
|
389
|
+
Metadata template: agreement-manager/metadata/metadata.csv
|
|
390
|
+
Documents found: <N> | Fields: <N> (<standard> standard, <custom> custom)
|
|
391
|
+
→ Next: Stage C4 — Fill Metadata
|
|
392
|
+
────────────────────────────────────────────────────────
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### Stage C4: Metadata Collection
|
|
396
|
+
|
|
397
|
+
Show the user a structured table and offer options:
|
|
398
|
+
|
|
399
|
+
```
|
|
400
|
+
── STAGE C4: METADATA COLLECTION ────────────────────────
|
|
401
|
+
|
|
402
|
+
I need values for <N> documents. Which fields do you want to populate?
|
|
403
|
+
(Tip: you don't need to fill all columns — just what matters for your use case)
|
|
404
|
+
|
|
405
|
+
Common metadata fields to fill:
|
|
406
|
+
• Salesforce ID (or other external system ID)
|
|
407
|
+
• Any fields that can't be AI-extracted from the document content
|
|
408
|
+
|
|
409
|
+
Options:
|
|
410
|
+
A Give me values now — I'll show a table, you fill it in
|
|
411
|
+
B You edit the CSV directly at:
|
|
412
|
+
agreement-manager/metadata/metadata.csv
|
|
413
|
+
Tell me when done.
|
|
414
|
+
C Let me fill it using AI-extracted values
|
|
415
|
+
(I'll show you before saving — good for production budget, dates, etc.)
|
|
416
|
+
|
|
417
|
+
Which approach?
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
**If A — inline collection:**
|
|
421
|
+
|
|
422
|
+
```
|
|
423
|
+
Enter values for each document.
|
|
424
|
+
Format: one line per field, or a full row, or a paste from a spreadsheet.
|
|
425
|
+
|
|
426
|
+
film_deal_001.html
|
|
427
|
+
Salesforce ID : _______________
|
|
428
|
+
[other fields the user chose]
|
|
429
|
+
|
|
430
|
+
film_deal_002.html
|
|
431
|
+
...
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
Write values to `agreement-manager/metadata/metadata.csv`, show confirmation before saving.
|
|
435
|
+
|
|
436
|
+
**If C — AI fill + review:**
|
|
437
|
+
Show a preview table of extracted values, allow corrections, then write.
|
|
438
|
+
|
|
439
|
+
### Stage C5: Ingest with Metadata
|
|
440
|
+
|
|
441
|
+
```
|
|
442
|
+
── STAGE C5: BULK INGEST WITH METADATA ──────────────────
|
|
443
|
+
▶ Running: ds agm ingest --directory ./bulk-docs --with-metadata -y
|
|
444
|
+
<output>
|
|
445
|
+
|
|
446
|
+
✅ STAGE C5 COMPLETE
|
|
447
|
+
Documents ingested: <N>
|
|
448
|
+
Metadata applied: Salesforce IDs + <other fields>
|
|
449
|
+
Job ID: <id>
|
|
450
|
+
→ Verify in Agreement Manager UI once AI processing completes
|
|
451
|
+
────────────────────────────────────────────────────────
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
If a 403 occurs: `✖ 403 on upload job — this account does not have the Agreement Manager API plan item. Switch to an entitled account and retry.`
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
## WORKFLOW D: Copy Config to New Account
|
|
459
|
+
|
|
460
|
+
**Use case:** Migrate an existing Agreement Manager config (types, fields, training docs) to a new account.
|
|
461
|
+
|
|
462
|
+
### Stage D1: Export from Source Account
|
|
463
|
+
|
|
464
|
+
```
|
|
465
|
+
── STAGE D1: EXPORT CONFIG ──────────────────────────────
|
|
466
|
+
▶ Running: ds agm catalog-to-manifest --all
|
|
467
|
+
(piping confirmation for overwrite if export already exists)
|
|
468
|
+
<output>
|
|
469
|
+
|
|
470
|
+
✅ STAGE D1 COMPLETE
|
|
471
|
+
Custom types: <N>
|
|
472
|
+
Custom fields: <N>
|
|
473
|
+
Extended standard types: <N>
|
|
474
|
+
Training files downloaded: <N> → agreement-manager/export/train/
|
|
475
|
+
────────────────────────────────────────────────────────
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
### Stage D2: Auto-patch Exported Manifest
|
|
479
|
+
|
|
480
|
+
The exported manifest is missing `namespace`, `version`, `defaultLocale`, and `metadata` fields — automatically add them back before upload:
|
|
481
|
+
|
|
482
|
+
```
|
|
483
|
+
── STAGE D2: PATCH EXPORTED MANIFEST ────────────────────
|
|
484
|
+
ℹ Exported manifest is missing top-level fields (known limitation).
|
|
485
|
+
Auto-adding: namespace, version, defaultLocale, metadata block.
|
|
486
|
+
|
|
487
|
+
Patched manifest saved to: agreement-manager/export/agreement-manager-manifest.json
|
|
488
|
+
|
|
489
|
+
Also copying training docs:
|
|
490
|
+
agreement-manager/export/train/ → agreement-manager/files/train/
|
|
491
|
+
────────────────────────────────────────────────────────
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
Then copy the exported manifest content into the main `agreement-manager/configs/agreement-manager-manifest.json`.
|
|
495
|
+
|
|
496
|
+
### Stage D3: Switch Account & Upload
|
|
497
|
+
|
|
498
|
+
```
|
|
499
|
+
To switch accounts:
|
|
500
|
+
1. Run: ds auth login -e <environment>
|
|
501
|
+
2. Tell me when you're logged in — I'll verify and continue.
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
Once switched, run Stage 4 (validate + upload) on the new account.
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
## WORKFLOW E: Improve Extraction Accuracy
|
|
509
|
+
|
|
510
|
+
1. Run `ds agm test run -y` and `ds agm test run -y --partial-match`
|
|
511
|
+
2. Show failing fields with diff (expected vs got)
|
|
512
|
+
3. For each failing field, offer:
|
|
513
|
+
- **Add examples** — Claude writes new examples to the manifest based on the actual document content
|
|
514
|
+
- **Improve aiDefinition** — rewrite to be more specific
|
|
515
|
+
- **Add training docs** — create more varied training documents
|
|
516
|
+
4. Re-upload and re-test automatically, show before/after comparison
|
|
517
|
+
|
|
518
|
+
---
|
|
519
|
+
|
|
520
|
+
## Limitations & Workarounds
|
|
521
|
+
|
|
522
|
+
These are known behaviors — not blockers. Autopilot handles them automatically.
|
|
523
|
+
|
|
524
|
+
| Situation | What Happens | Autopilot Handles It By |
|
|
525
|
+
| ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- |
|
|
526
|
+
| Standard catalog `agreementTypes[]` is empty | Reserved type names (like "Invoice") are enforced server-side but not visible in catalog JSON | Qualifying displayNames with prefixes (e.g. "Vendor Invoice") |
|
|
527
|
+
| Multi-value String fields (e.g. line items) | AI consistently extracts only the first semicolon-delimited item regardless of examples | Using `--partial-match` for these fields; noting in test results |
|
|
528
|
+
| `--with-metadata` requires ALL custom fields in Miscellaneous | Validator rejects if any custom field is not mapped to `OtherDocumentData` — even unrelated ones | Auto-adding all custom fields to Miscellaneous before upload |
|
|
529
|
+
| `--generate-metadata-template` and `catalog-to-manifest --all` prompt for overwrite | No `-y` flag available | Piping `echo "y"` via shell |
|
|
530
|
+
| `catalog-to-manifest --all` strips namespace/version/defaultLocale/metadata | Exported manifest is incomplete | Auto-patching the exported file before upload |
|
|
531
|
+
| `--prefill-extractions` is circular | Expected values are set to AI output — 100% accuracy is guaranteed and meaningless | Warning the user; recommending manual verification of key fields |
|
|
532
|
+
| Agreements still processing warning | Tests run against incomplete extractions | Waiting and re-running; watching for "still processing" warning in output |
|
|
533
|
+
| 403 on `--with-metadata` upload job | Account does not have Agreement Manager API plan item | Detecting 403, explaining cause, asking user to switch accounts |
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
537
|
+
## Commands Reference
|
|
538
|
+
|
|
539
|
+
### Authentication
|
|
540
|
+
|
|
541
|
+
```bash
|
|
542
|
+
ds auth login -e demo # Authenticate (demo or production)
|
|
543
|
+
ds auth test # Verify auth and show account info
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
### Catalog
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
ds agm get catalog # Fetch standard + custom catalog
|
|
550
|
+
# Note: agreementTypes[] in JSON will be empty (server-side reserved)
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
### Manifest
|
|
554
|
+
|
|
555
|
+
```bash
|
|
556
|
+
ds agm validate # Validate manifest structure only (not metadata compat)
|
|
557
|
+
ds agm upload --dry-run # Preview changes without applying
|
|
558
|
+
ds agm upload -y # Deploy manifest to account (idempotent — safe to re-run)
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
### Ingest
|
|
562
|
+
|
|
563
|
+
```bash
|
|
564
|
+
ds agm ingest --files ./path/to/file.pdf -y # Single file
|
|
565
|
+
ds agm ingest --directory ./path/to/dir -y # Directory
|
|
566
|
+
ds agm ingest --directory ./path/to/dir --recursive -y # Recursive
|
|
567
|
+
ds agm ingest --directory ./path/to/dir --dry-run # Preview
|
|
568
|
+
|
|
569
|
+
# Bulk ingest with metadata (requires Agreement Manager API plan item)
|
|
570
|
+
ds agm ingest --directory ./bulk-docs --generate-metadata-template
|
|
571
|
+
# → creates agreement-manager/metadata/metadata.csv
|
|
572
|
+
# → prompts overwrite if exists (no -y flag) — pipe: echo "y" | ds agm ingest ...
|
|
573
|
+
|
|
574
|
+
ds agm ingest --directory ./bulk-docs --with-metadata -y
|
|
575
|
+
# → requires ALL custom fields mapped to Miscellaneous in manifest
|
|
576
|
+
# → 403 = wrong account (plan item not enabled)
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
### Testing
|
|
580
|
+
|
|
581
|
+
```bash
|
|
582
|
+
ds agm test generate-test-template -y # Basic template
|
|
583
|
+
ds agm test generate-test-template -y --prefill-extractions # AI prefill (circular — use carefully)
|
|
584
|
+
ds agm test run -y # Exact match
|
|
585
|
+
ds agm test run -y --partial-match # Partial match (lenient — good for long text)
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
### Config Export & Migration
|
|
589
|
+
|
|
590
|
+
```bash
|
|
591
|
+
# Export existing config (for copying to new account)
|
|
592
|
+
echo "y" | ds agm catalog-to-manifest --all
|
|
593
|
+
# → writes to agreement-manager/export/agreement-manager-manifest.json
|
|
594
|
+
# → downloads training docs to agreement-manager/export/train/
|
|
595
|
+
# ⚠ exported manifest missing namespace/version/defaultLocale/metadata — patch before upload
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
### Manifest Field Rules (Quick Ref)
|
|
599
|
+
|
|
600
|
+
| Field | Rule |
|
|
601
|
+
| -------------------------------- | ----------------------------------------------------------------------------- |
|
|
602
|
+
| `key` | Must start with `C_` for all custom fields and types |
|
|
603
|
+
| `displayName` | Must not match standard type names — add qualifier if generic |
|
|
604
|
+
| `customExtractionEnabled: true` | Requires `aiDefinition` + `examples` (3+ recommended) |
|
|
605
|
+
| `customExtractionEnabled: false` | No `aiDefinition` or `examples` needed — for metadata-only fields |
|
|
606
|
+
| `customFields` in types | Reference by `displayName`, not `key` |
|
|
607
|
+
| `docs` in types | Filename only — files must be in `agreement-manager/files/train/` |
|
|
608
|
+
| `fieldType` | `String`, `Number`, `DateTime`, `Dropdown` |
|
|
609
|
+
| `Dropdown` fields | `confirmedValue` in examples must exactly match an entry in `dropdownOptions` |
|
|
610
|
+
|
|
611
|
+
### Supported File Formats
|
|
612
|
+
|
|
613
|
+
PDF, DOCX, DOC, HTML, XLSX, XLS, XLSB, PPTX, PPT, PPSX, RTF, JPG, PNG, TIF
|
|
614
|
+
|
|
615
|
+
### Duplicate Detection
|
|
616
|
+
|
|
617
|
+
Tracked in `~/.docusign/tracking.json`. To force re-ingest of previously ingested files:
|
|
618
|
+
|
|
619
|
+
```bash
|
|
620
|
+
rm ~/.docusign/tracking.json
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
Only needed when re-ingesting the same files — new files are always detected as NEW regardless.
|