zinkee 0.1.22 → 0.1.24
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/.claude/settings.local.json +2 -1
- package/AGENTS.md +1 -0
- package/README.md +54 -0
- package/dist/index.js +1045 -328
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/document-templates.ts +110 -0
- package/src/command-registry.ts +56 -0
- package/src/commands/automations.test.ts +130 -0
- package/src/commands/automations.ts +50 -2
- package/src/commands/document-templates.test.ts +569 -0
- package/src/commands/document-templates.ts +563 -0
- package/src/program.ts +2 -0
- package/src/utils/examples.test.ts +46 -0
- package/src/utils/examples.ts +252 -0
package/src/utils/examples.ts
CHANGED
|
@@ -3515,6 +3515,47 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
3515
3515
|
"steps": ["one", "two"]
|
|
3516
3516
|
}
|
|
3517
3517
|
}
|
|
3518
|
+
}`,
|
|
3519
|
+
},
|
|
3520
|
+
{
|
|
3521
|
+
description:
|
|
3522
|
+
"Add a send-message action. --to maps to fieldMapping.recipients and --message maps to fieldMapping.body. Values are wrapped in {rawValue, source} like every other automation field mapping; use --map / --map-json for extra keys.",
|
|
3523
|
+
command:
|
|
3524
|
+
`zinkee --json automations actions add automation-1 --type send_message --name "Notify customer" --to customer@example.com --subject "Your order status has changed" --message "Hello, your order is now processed."`,
|
|
3525
|
+
raw: `{
|
|
3526
|
+
"type": "send_message",
|
|
3527
|
+
"name": "Notify customer",
|
|
3528
|
+
"config": {
|
|
3529
|
+
"fieldMapping": {
|
|
3530
|
+
"recipients": {
|
|
3531
|
+
"rawValue": "customer@example.com",
|
|
3532
|
+
"source": null
|
|
3533
|
+
},
|
|
3534
|
+
"subject": {
|
|
3535
|
+
"rawValue": "Your order status has changed",
|
|
3536
|
+
"source": null
|
|
3537
|
+
},
|
|
3538
|
+
"body": {
|
|
3539
|
+
"rawValue": "Hello, your order is now processed.",
|
|
3540
|
+
"source": null
|
|
3541
|
+
}
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3544
|
+
}`,
|
|
3545
|
+
},
|
|
3546
|
+
{
|
|
3547
|
+
description:
|
|
3548
|
+
"Add a generate-document action. The renderer reads the template, writes the file, and stores its id in the target FileField of the target schema.",
|
|
3549
|
+
command:
|
|
3550
|
+
'zinkee --json automations actions add automation-1 --type generate_document --name "Generate invoice PDF" --document-template 6c08673e-f8a6-44d2-8c91-d09eca911f8f --target-schema 68d2c7be-4392-42de-b5ae-625ad79cfc3c --target-file-field c8edbde8-a361-4e9f-a39a-2e88971f21a7',
|
|
3551
|
+
raw: `{
|
|
3552
|
+
"type": "generate_document",
|
|
3553
|
+
"name": "Generate invoice PDF",
|
|
3554
|
+
"config": {
|
|
3555
|
+
"documentTemplateId": "6c08673e-f8a6-44d2-8c91-d09eca911f8f",
|
|
3556
|
+
"targetSchemaId": "68d2c7be-4392-42de-b5ae-625ad79cfc3c",
|
|
3557
|
+
"targetFileFieldId": "c8edbde8-a361-4e9f-a39a-2e88971f21a7"
|
|
3558
|
+
}
|
|
3518
3559
|
}`,
|
|
3519
3560
|
},
|
|
3520
3561
|
]),
|
|
@@ -3569,6 +3610,32 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
3569
3610
|
"authMode": "STORED",
|
|
3570
3611
|
"connectionId": "connection-1"
|
|
3571
3612
|
}
|
|
3613
|
+
}`,
|
|
3614
|
+
},
|
|
3615
|
+
{
|
|
3616
|
+
description:
|
|
3617
|
+
"Replace a send-message action. --to maps to fieldMapping.recipients and --message maps to fieldMapping.body; values are wrapped in {rawValue, source}.",
|
|
3618
|
+
command:
|
|
3619
|
+
`zinkee --json automations actions update automation-1 action-1 --type send_message --name "Notify customer" --to customer@example.com --subject "Your order status has changed" --message "Hello, your order is now processed."`,
|
|
3620
|
+
raw: `{
|
|
3621
|
+
"type": "send_message",
|
|
3622
|
+
"name": "Notify customer",
|
|
3623
|
+
"config": {
|
|
3624
|
+
"fieldMapping": {
|
|
3625
|
+
"recipients": {
|
|
3626
|
+
"rawValue": "customer@example.com",
|
|
3627
|
+
"source": null
|
|
3628
|
+
},
|
|
3629
|
+
"subject": {
|
|
3630
|
+
"rawValue": "Your order status has changed",
|
|
3631
|
+
"source": null
|
|
3632
|
+
},
|
|
3633
|
+
"body": {
|
|
3634
|
+
"rawValue": "Hello, your order is now processed.",
|
|
3635
|
+
"source": null
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
}
|
|
3572
3639
|
}`,
|
|
3573
3640
|
},
|
|
3574
3641
|
]),
|
|
@@ -3739,6 +3806,191 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
3739
3806
|
}`,
|
|
3740
3807
|
},
|
|
3741
3808
|
]),
|
|
3809
|
+
"document-templates list": buildCommandExamples([
|
|
3810
|
+
{
|
|
3811
|
+
description:
|
|
3812
|
+
"List every document template in the workspace. Each asset's link is a relative path to the asset download endpoint, ready to call without composition.",
|
|
3813
|
+
command: "zinkee --json document-templates list",
|
|
3814
|
+
response: `[
|
|
3815
|
+
{
|
|
3816
|
+
"id": "7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e",
|
|
3817
|
+
"name": "Quarterly report",
|
|
3818
|
+
"assets": [
|
|
3819
|
+
{
|
|
3820
|
+
"id": "9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f",
|
|
3821
|
+
"name": "Requirements.docx",
|
|
3822
|
+
"link": "/api/v2/document-templates/7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e/assets/9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f/download"
|
|
3823
|
+
}
|
|
3824
|
+
],
|
|
3825
|
+
"createdAt": "2026-01-15T10:00:00Z",
|
|
3826
|
+
"updatedAt": "2026-01-20T14:30:00Z",
|
|
3827
|
+
"createdBy": "creator@example.com",
|
|
3828
|
+
"updatedBy": "updater@example.com"
|
|
3829
|
+
}
|
|
3830
|
+
]`,
|
|
3831
|
+
},
|
|
3832
|
+
]),
|
|
3833
|
+
"document-templates get": buildCommandExamples([
|
|
3834
|
+
{
|
|
3835
|
+
description:
|
|
3836
|
+
"Look up one template by UUID. The CLI filters the list endpoint locally (the backend does not expose a get-one route).",
|
|
3837
|
+
command:
|
|
3838
|
+
"zinkee --json document-templates get 7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e",
|
|
3839
|
+
response: `{
|
|
3840
|
+
"id": "7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e",
|
|
3841
|
+
"name": "Quarterly report",
|
|
3842
|
+
"assets": [
|
|
3843
|
+
{
|
|
3844
|
+
"id": "9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f",
|
|
3845
|
+
"name": "Requirements.docx",
|
|
3846
|
+
"link": "/api/v2/document-templates/7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e/assets/9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f/download"
|
|
3847
|
+
}
|
|
3848
|
+
],
|
|
3849
|
+
"createdAt": "2026-01-15T10:00:00Z",
|
|
3850
|
+
"updatedAt": "2026-01-20T14:30:00Z",
|
|
3851
|
+
"createdBy": "creator@example.com",
|
|
3852
|
+
"updatedBy": "creator@example.com"
|
|
3853
|
+
}`,
|
|
3854
|
+
},
|
|
3855
|
+
{
|
|
3856
|
+
description:
|
|
3857
|
+
"Look up by exact template name. Names are unique within the workspace; ambiguity is reported as an error.",
|
|
3858
|
+
command: 'zinkee --json document-templates get "Quarterly report"',
|
|
3859
|
+
},
|
|
3860
|
+
]),
|
|
3861
|
+
"document-templates create": buildCommandExamples([
|
|
3862
|
+
{
|
|
3863
|
+
description:
|
|
3864
|
+
"Typical create: empty template by name. Assets are uploaded afterwards via document-templates assets add.",
|
|
3865
|
+
command: 'zinkee --json document-templates create --name "Quarterly report"',
|
|
3866
|
+
raw: `{
|
|
3867
|
+
"name": "Quarterly report",
|
|
3868
|
+
"assets": []
|
|
3869
|
+
}`,
|
|
3870
|
+
response: `{
|
|
3871
|
+
"id": "7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e",
|
|
3872
|
+
"name": "Quarterly report",
|
|
3873
|
+
"assets": [],
|
|
3874
|
+
"createdAt": "2026-01-15T10:00:00Z",
|
|
3875
|
+
"updatedAt": "2026-01-15T10:00:00Z",
|
|
3876
|
+
"createdBy": "creator@example.com",
|
|
3877
|
+
"updatedBy": "creator@example.com"
|
|
3878
|
+
}`,
|
|
3879
|
+
},
|
|
3880
|
+
{
|
|
3881
|
+
description:
|
|
3882
|
+
"Create with pre-existing asset records via --raw. Used for import/migration flows where the assets already exist elsewhere; the typical UX is to create empty and upload via assets add.",
|
|
3883
|
+
command:
|
|
3884
|
+
`zinkee --json document-templates create --raw '{"name":"Annual report","assets":[{"id":"9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f","name":"Cover.docx","link":"/existing/cover.docx"},{"id":"3f2e1d0c-9b8a-7654-3210-fedcba987654","name":"Appendix.docx","link":"/existing/appendix.docx"}]}'`,
|
|
3885
|
+
raw: `{
|
|
3886
|
+
"name": "Annual report",
|
|
3887
|
+
"assets": [
|
|
3888
|
+
{
|
|
3889
|
+
"id": "9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f",
|
|
3890
|
+
"name": "Cover.docx",
|
|
3891
|
+
"link": "/existing/cover.docx"
|
|
3892
|
+
},
|
|
3893
|
+
{
|
|
3894
|
+
"id": "3f2e1d0c-9b8a-7654-3210-fedcba987654",
|
|
3895
|
+
"name": "Appendix.docx",
|
|
3896
|
+
"link": "/existing/appendix.docx"
|
|
3897
|
+
}
|
|
3898
|
+
]
|
|
3899
|
+
}`,
|
|
3900
|
+
},
|
|
3901
|
+
]),
|
|
3902
|
+
"document-templates update": buildCommandExamples([
|
|
3903
|
+
{
|
|
3904
|
+
description:
|
|
3905
|
+
"Rename a template. The template argument accepts a UUID or an exact current name. Only the name is updatable through this endpoint; assets are managed via the assets subcommands.",
|
|
3906
|
+
command:
|
|
3907
|
+
'zinkee --json document-templates update "Quarterly report" --name "Annual report"',
|
|
3908
|
+
raw: `{
|
|
3909
|
+
"name": "Annual report"
|
|
3910
|
+
}`,
|
|
3911
|
+
response: `{
|
|
3912
|
+
"id": "7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e",
|
|
3913
|
+
"name": "Annual report",
|
|
3914
|
+
"assets": [
|
|
3915
|
+
{
|
|
3916
|
+
"id": "9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f",
|
|
3917
|
+
"name": "Requirements.docx",
|
|
3918
|
+
"link": "/api/v2/document-templates/7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e/assets/9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f/download"
|
|
3919
|
+
}
|
|
3920
|
+
],
|
|
3921
|
+
"createdAt": "2026-01-15T10:00:00Z",
|
|
3922
|
+
"updatedAt": "2026-01-22T09:15:00Z",
|
|
3923
|
+
"createdBy": "creator@example.com",
|
|
3924
|
+
"updatedBy": "updater@example.com"
|
|
3925
|
+
}`,
|
|
3926
|
+
},
|
|
3927
|
+
]),
|
|
3928
|
+
"document-templates delete": buildCommandExamples([
|
|
3929
|
+
{
|
|
3930
|
+
description:
|
|
3931
|
+
"Delete a template and remove its asset files from storage. Record fields that reference previously generated documents are not modified.",
|
|
3932
|
+
command:
|
|
3933
|
+
"zinkee --json document-templates delete 7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e",
|
|
3934
|
+
response: `{
|
|
3935
|
+
"id": "7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e",
|
|
3936
|
+
"deleted": true
|
|
3937
|
+
}`,
|
|
3938
|
+
},
|
|
3939
|
+
]),
|
|
3940
|
+
"document-templates assets add": buildCommandExamples([
|
|
3941
|
+
{
|
|
3942
|
+
description:
|
|
3943
|
+
"Upload a local file as an asset of a template. The CLI sends a multipart form with a part named \"file\"; the asset display name defaults to the uploaded filename.",
|
|
3944
|
+
command:
|
|
3945
|
+
'zinkee --json document-templates assets add "Quarterly report" ./contract.docx',
|
|
3946
|
+
response: `{
|
|
3947
|
+
"id": "7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e",
|
|
3948
|
+
"name": "Quarterly report",
|
|
3949
|
+
"assets": [
|
|
3950
|
+
{
|
|
3951
|
+
"id": "9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f",
|
|
3952
|
+
"name": "contract.docx",
|
|
3953
|
+
"link": "/api/v2/document-templates/7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e/assets/9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f/download"
|
|
3954
|
+
}
|
|
3955
|
+
],
|
|
3956
|
+
"createdAt": "2026-01-15T10:00:00Z",
|
|
3957
|
+
"updatedAt": "2026-01-22T09:15:00Z",
|
|
3958
|
+
"createdBy": "creator@example.com",
|
|
3959
|
+
"updatedBy": "updater@example.com"
|
|
3960
|
+
}`,
|
|
3961
|
+
},
|
|
3962
|
+
{
|
|
3963
|
+
description:
|
|
3964
|
+
"Override the asset display name with --name (otherwise the uploaded filename is used).",
|
|
3965
|
+
command:
|
|
3966
|
+
'zinkee --json document-templates assets add "Quarterly report" ./contract.docx --name "Customer Contract"',
|
|
3967
|
+
},
|
|
3968
|
+
]),
|
|
3969
|
+
"document-templates assets delete": buildCommandExamples([
|
|
3970
|
+
{
|
|
3971
|
+
description: "Delete one asset from a template and remove its file from storage.",
|
|
3972
|
+
command:
|
|
3973
|
+
"zinkee --json document-templates assets delete 7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e 9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f",
|
|
3974
|
+
response: `{
|
|
3975
|
+
"id": "9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f",
|
|
3976
|
+
"deleted": true
|
|
3977
|
+
}`,
|
|
3978
|
+
},
|
|
3979
|
+
]),
|
|
3980
|
+
"document-templates assets download": buildCommandExamples([
|
|
3981
|
+
{
|
|
3982
|
+
description:
|
|
3983
|
+
"Download asset bytes to disk. The CLI streams the raw bytes to --output; in --json mode --output is required and the JSON envelope only carries metadata.",
|
|
3984
|
+
command:
|
|
3985
|
+
"zinkee --json document-templates assets download 7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e 9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f --output ./contract.docx",
|
|
3986
|
+
},
|
|
3987
|
+
{
|
|
3988
|
+
description:
|
|
3989
|
+
"Stream asset bytes to stdout (omit --json and --output). Useful for piping into other tools.",
|
|
3990
|
+
command:
|
|
3991
|
+
"zinkee document-templates assets download 7c4a8d3f-1b2e-4a5c-9d6e-1f2a3b4c5d6e 9e8d7c6b-5a4f-3e2d-1c0b-9a8b7c6d5e4f > contract.docx",
|
|
3992
|
+
},
|
|
3993
|
+
]),
|
|
3742
3994
|
};
|
|
3743
3995
|
|
|
3744
3996
|
function fallbackExamples(commandName: string): readonly CommandExample[] {
|