zinkee 0.1.23 → 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/AGENTS.md +1 -0
- package/README.md +54 -0
- package/dist/index.js +943 -318
- 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/document-templates.test.ts +569 -0
- package/src/commands/document-templates.ts +563 -0
- package/src/program.ts +2 -0
- package/src/utils/examples.ts +185 -0
package/src/utils/examples.ts
CHANGED
|
@@ -3806,6 +3806,191 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
3806
3806
|
}`,
|
|
3807
3807
|
},
|
|
3808
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
|
+
]),
|
|
3809
3994
|
};
|
|
3810
3995
|
|
|
3811
3996
|
function fallbackExamples(commandName: string): readonly CommandExample[] {
|