From 088dc766da5b6fa1a1616ff82d1a2f13d34dd3f1 Mon Sep 17 00:00:00 2001 From: Angelo Ashmore Date: Sat, 18 Apr 2026 01:14:11 +0000 Subject: [PATCH 1/4] feat: add examples to --help output for complex commands Adds EXAMPLES sections to field add rich-text, field add content-relationship, field add select, type create, and slice connect. Resolves #148 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/commands/field-add-content-relationship.ts | 12 ++++++++++++ src/commands/field-add-rich-text.ts | 7 +++++++ src/commands/field-add-select.ts | 9 +++++++++ src/commands/slice-connect.ts | 9 +++++++++ src/commands/type-create.ts | 10 ++++++++++ 5 files changed, 47 insertions(+) diff --git a/src/commands/field-add-content-relationship.ts b/src/commands/field-add-content-relationship.ts index 03fb30e..309f0de 100644 --- a/src/commands/field-add-content-relationship.ts +++ b/src/commands/field-add-content-relationship.ts @@ -22,6 +22,18 @@ const config = { selected. These filters define exactly which documents are queryable through this field. If neither is specified, all documents are allowed. `, + sections: { + EXAMPLES: ` + Relate to any document: + prismic field add content-relationship author --to-type blog_post + + Restrict to a specific type: + prismic field add content-relationship category --to-type blog_post --custom-type blog_category + + Fetch fields from the related document: + prismic field add content-relationship author --to-type blog_post --custom-type author --field name --field bio + `, + }, positionals: { id: { description: "Field ID", required: true }, }, diff --git a/src/commands/field-add-rich-text.ts b/src/commands/field-add-rich-text.ts index 61d4a65..46b310f 100644 --- a/src/commands/field-add-rich-text.ts +++ b/src/commands/field-add-rich-text.ts @@ -19,6 +19,13 @@ const config = { paragraph, strong, em, preformatted, hyperlink, image, embed, list-item, o-list-item, rtl `, + EXAMPLES: ` + Add a title field (single heading): + prismic field add rich-text title --to-type blog_post --allow heading1 --single + + Add a body field with common blocks: + prismic field add rich-text body --to-type blog_post --allow heading1,heading2,paragraph,strong,em,hyperlink,image,list-item,o-list-item + `, }, positionals: { id: { description: "Field ID", required: true }, diff --git a/src/commands/field-add-select.ts b/src/commands/field-add-select.ts index 949d946..cb8710a 100644 --- a/src/commands/field-add-select.ts +++ b/src/commands/field-add-select.ts @@ -10,6 +10,15 @@ import { getRepositoryName } from "../project"; const config = { name: "prismic field add select", description: "Add a select field to a slice or custom type.", + sections: { + EXAMPLES: ` + Add a select with options: + prismic field add select status --to-type blog_post --option draft --option published --option archived + + With a default value: + prismic field add select priority --to-type task --option low --option medium --option high --default-value medium + `, + }, positionals: { id: { description: "Field ID", required: true }, }, diff --git a/src/commands/slice-connect.ts b/src/commands/slice-connect.ts index 1d8b40e..8553493 100644 --- a/src/commands/slice-connect.ts +++ b/src/commands/slice-connect.ts @@ -10,6 +10,15 @@ import { getRepositoryName } from "../project"; const config = { name: "prismic slice connect", description: "Connect a slice to a type's slice zone.", + sections: { + EXAMPLES: ` + Connect a slice to a type's default slice zone: + prismic slice connect hero --to blog_post + + Connect to a named slice zone: + prismic slice connect hero --to blog_post --slice-zone page_slices + `, + }, positionals: { id: { description: "ID of the slice", required: true }, }, diff --git a/src/commands/type-create.ts b/src/commands/type-create.ts index db6f364..830c84d 100644 --- a/src/commands/type-create.ts +++ b/src/commands/type-create.ts @@ -33,6 +33,16 @@ const config = { page). Includes a slice zone and SEO & Metadata tab by default, and configures a route in prismic.config.json. `, + EXAMPLES: ` + Create a page type: + prismic type create "Blog Post" --format page + + Create a singleton custom type: + prismic type create Settings --single + + Create with a custom ID: + prismic type create "Landing Page" --format page --id landing + `, }, } satisfies CommandConfig; From 457141d9d95c4b61cfa70148e0692e57d8cb84a2 Mon Sep 17 00:00:00 2001 From: Angelo Ashmore Date: Sat, 18 Apr 2026 01:36:17 +0000 Subject: [PATCH 2/4] fix: improve examples based on review feedback - Use "Allow any document" instead of "Relate to any document" - Simplify rich-text --allow list - Use marketing-site examples for select field Co-Authored-By: Claude Opus 4.6 (1M context) --- src/commands/field-add-content-relationship.ts | 2 +- src/commands/field-add-rich-text.ts | 4 ++-- src/commands/field-add-select.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/field-add-content-relationship.ts b/src/commands/field-add-content-relationship.ts index 309f0de..d76316c 100644 --- a/src/commands/field-add-content-relationship.ts +++ b/src/commands/field-add-content-relationship.ts @@ -24,7 +24,7 @@ const config = { `, sections: { EXAMPLES: ` - Relate to any document: + Allow any document: prismic field add content-relationship author --to-type blog_post Restrict to a specific type: diff --git a/src/commands/field-add-rich-text.ts b/src/commands/field-add-rich-text.ts index 46b310f..181207a 100644 --- a/src/commands/field-add-rich-text.ts +++ b/src/commands/field-add-rich-text.ts @@ -23,8 +23,8 @@ const config = { Add a title field (single heading): prismic field add rich-text title --to-type blog_post --allow heading1 --single - Add a body field with common blocks: - prismic field add rich-text body --to-type blog_post --allow heading1,heading2,paragraph,strong,em,hyperlink,image,list-item,o-list-item + Add a body field with only headings and paragraphs: + prismic field add rich-text body --to-type blog_post --allow heading1,heading2,paragraph,strong,em,hyperlink `, }, positionals: { diff --git a/src/commands/field-add-select.ts b/src/commands/field-add-select.ts index cb8710a..9e2faa4 100644 --- a/src/commands/field-add-select.ts +++ b/src/commands/field-add-select.ts @@ -13,10 +13,10 @@ const config = { sections: { EXAMPLES: ` Add a select with options: - prismic field add select status --to-type blog_post --option draft --option published --option archived + prismic field add select theme --to-type landing_page --option light --option dark --option brand With a default value: - prismic field add select priority --to-type task --option low --option medium --option high --default-value medium + prismic field add select layout --to-type landing_page --option full --option centered --option sidebar --default-value full `, }, positionals: { From 243e96e78f8d89b8cb309586cab8df19d2630673 Mon Sep 17 00:00:00 2001 From: Angelo Ashmore Date: Sat, 18 Apr 2026 01:49:18 +0000 Subject: [PATCH 3/4] feat: add examples to link, webhook create, token create, and field edit Co-Authored-By: Claude Opus 4.6 (1M context) --- src/commands/field-add-link.ts | 12 ++++++++++++ src/commands/field-edit.ts | 10 ++++++++++ src/commands/token-create.ts | 12 ++++++++++++ src/commands/webhook-create.ts | 10 ++++++++++ 4 files changed, 44 insertions(+) diff --git a/src/commands/field-add-link.ts b/src/commands/field-add-link.ts index b28bb26..3a8a1ad 100644 --- a/src/commands/field-add-link.ts +++ b/src/commands/field-add-link.ts @@ -11,6 +11,18 @@ const config = { name: "prismic field add link", description: "Add a link field to a slice or custom type. Use for navigational links to URLs, documents, or media. For data-level relations between documents, use content-relationship instead.", + sections: { + EXAMPLES: ` + Add a link that opens in a new tab: + prismic field add link cta --to-type landing_page --allow-target-blank + + Restrict to media links only: + prismic field add link download --to-type blog_post --allow media + + Add a repeatable link with custom text: + prismic field add link nav_item --to-type navigation --repeatable --allow-text + `, + }, positionals: { id: { description: "Field ID", required: true }, }, diff --git a/src/commands/field-edit.ts b/src/commands/field-edit.ts index 648f081..96450d3 100644 --- a/src/commands/field-edit.ts +++ b/src/commands/field-edit.ts @@ -18,6 +18,16 @@ const config = { type will be applied. See \`prismic field add --help\` for type-specific option details. `, + EXAMPLES: ` + Rename a field's label: + prismic field edit title --from-type blog_post --label "Page Title" + + Change a select field's options: + prismic field edit theme --from-type landing_page --option light --option dark + + Restrict a rich text field to a single block: + prismic field edit subtitle --from-type blog_post --single + `, }, positionals: { id: { description: "Field ID", required: true }, diff --git a/src/commands/token-create.ts b/src/commands/token-create.ts index 73e25c0..e47dcb9 100644 --- a/src/commands/token-create.ts +++ b/src/commands/token-create.ts @@ -19,6 +19,18 @@ const config = { By default, this command reads the repository from prismic.config.json at the project root. `, + sections: { + EXAMPLES: ` + Create a read token: + prismic token create + + Create a read token with release access: + prismic token create --allow-releases + + Create a write token: + prismic token create --write + `, + }, options: { write: { type: "boolean", description: "Create a write token" }, "allow-releases": { diff --git a/src/commands/webhook-create.ts b/src/commands/webhook-create.ts index 19c15f8..6db83ac 100644 --- a/src/commands/webhook-create.ts +++ b/src/commands/webhook-create.ts @@ -37,6 +37,16 @@ const config = { If no triggers specified, all are enabled. `, + EXAMPLES: ` + Create a webhook for all events: + prismic webhook create https://example.com/webhook + + Create a webhook for specific events: + prismic webhook create https://example.com/webhook -t documentsPublished -t documentsUnpublished + + Create a named webhook with a secret: + prismic webhook create https://example.com/webhook --name "Deploy" --secret my-secret + `, }, } satisfies CommandConfig; From 0c12274ee4a0d98500ad9430e531feb62fdb87d5 Mon Sep 17 00:00:00 2001 From: Angelo Ashmore Date: Sat, 18 Apr 2026 01:57:00 +0000 Subject: [PATCH 4/4] fix: remove trivial token create examples Co-Authored-By: Claude Opus 4.6 (1M context) --- src/commands/token-create.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/commands/token-create.ts b/src/commands/token-create.ts index e47dcb9..73e25c0 100644 --- a/src/commands/token-create.ts +++ b/src/commands/token-create.ts @@ -19,18 +19,6 @@ const config = { By default, this command reads the repository from prismic.config.json at the project root. `, - sections: { - EXAMPLES: ` - Create a read token: - prismic token create - - Create a read token with release access: - prismic token create --allow-releases - - Create a write token: - prismic token create --write - `, - }, options: { write: { type: "boolean", description: "Create a write token" }, "allow-releases": {