Skip to content

feat: add remote modeling commands for custom types, page types, and slices#83

Draft
angeloashmore wants to merge 22 commits intomainfrom
aa/remote-modeling
Draft

feat: add remote modeling commands for custom types, page types, and slices#83
angeloashmore wants to merge 22 commits intomainfrom
aa/remote-modeling

Conversation

@angeloashmore
Copy link
Copy Markdown
Member

@angeloashmore angeloashmore commented Mar 31, 2026

Resolves: #21, #22

Description

Adds CLI commands to manage custom types, page types, and slices directly against the Custom Types API. This lets users create, list, view, and remove these resources without going through the dashboard, and includes slice-specific commands for managing variations and slice connections.

Checklist

  • A comprehensive Linear ticket, providing sufficient context and details to facilitate the review of the PR, is linked to the PR.
  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

Preview

How to QA 1

Footnotes

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment.

angeloashmore and others added 13 commits March 30, 2026 16:10
…slices

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The insert/update endpoints were using incorrect paths (e.g. `customtypes`
instead of `customtypes/insert`), causing 401 errors on write operations.
Also fixes copy-paste errors in slice command output messages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Covers create, list, view, remove for all three command groups, plus
slice-specific connect, disconnect, add-variation, and remove-variation.
All tests verify state against the Custom Types API.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Page types need a slice zone in Main tab by default. Replace `as any`
casts in slice connect/disconnect tests with proper types.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds `field add`, `field list`, and `field remove` commands that operate
on custom types and slices via the Custom Types API, along with per-type
`field add <type>` subcommands for all supported field types.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds `prismic field edit` to modify existing field properties (label,
placeholder, type-specific options) on slices and custom types via the
API. Extracts shared `resolveFieldContainer` from `resolveModel` for
reuse across field-edit and field-remove.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Consolidates sync logic (syncModels, syncSlices, syncCustomTypes) into
the Adapter class so all modeling commands can sync local files after
remote changes. This ensures local models stay up-to-date after any
create, remove, or field mutation command.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move adapter sync into resolveModel/resolveFieldContainer so field
commands no longer depend on the adapter directly. Type/slice CRUD
commands now call specific adapter methods (create/update/delete)
instead of a full sync.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	src/commands/init.ts
#	src/index.ts
…104)

* feat: unify `page-type` and `custom-type` into single `type` command

Consolidates the separate `page-type` and `custom-type` top-level
commands into a single `type` command with a `--format` flag on create.

- `prismic type create <name> --format page` for page types
- `prismic type create <name>` defaults to custom format
- `prismic type list` shows all types with format in output
- `prismic type view/remove` work regardless of format
- Field targeting simplified: `--to-type`/`--from-type` replace
  `--to-page-type`/`--to-custom-type`/`--from-page-type`/`--from-custom-type`

Closes #96

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: use "content type" in command descriptions for clarity

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Closes #91

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add `slice edit` and `slice edit-variation` commands

Adds two new subcommands for editing slice and variation metadata after
creation. Also adds E2E tests for the recently added `type edit` command.

Closes #92

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: add local fallback for `type edit` adapter call

Wraps adapter.updateCustomType in try/catch with createCustomType
fallback, matching the pattern used in other commands. Prevents crash
when the local customtypes/ directory doesn't contain the edited type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: remove --repeatable/--single flags from `type edit`

The Custom Types API does not support updating the repeatable property;
it must be changed from the writing room UI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: remove --description from `slice edit-variation`

Edit commands should only expose options that the corresponding create
command exposes. `slice add-variation` does not accept --description.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
angeloashmore and others added 9 commits April 9, 2026 17:54
* feat: add `type add-tab`, `type edit-tab`, and `type remove-tab` commands

Adds tab management commands for content types:
- `add-tab` creates a new tab, optionally with a slice zone
- `edit-tab` renames a tab and/or adds/removes a slice zone
- `remove-tab` deletes a tab (guards against removing the last one)

Closes #94

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: validate mutually exclusive --with-slice-zone and --without-slice-zone flags

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor: rename `--in` flag to `--from-slice`/`--from-type`

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: update tests to use renamed flags

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…111)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add `field view` command

Add a command to inspect a single field's full configuration,
including label, placeholder, constraints, and type-specific settings.

Resolves #93

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: use compact buildSlice pattern in field-view tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: consolidate link-related field types

Merge `link-to-media` into `link` with a new `--allow` option that
accepts `document`, `media`, or `web`. Omitting `--allow` creates a
generic link. Keep `content-relationship` separate.

Update descriptions on `link` and `content-relationship` so agents
can tell when to use each one.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: validate --allow option and restore field-edit subtype guards

Validate that --allow is one of document, media, or web. Restore
subtype guards in field-edit so content-relationship fields can't
receive link-only options and vice versa.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: allow all Link options regardless of select value

Remove the select-based guard in field-edit so link fields with
select: "document" can still be edited with link-specific options
like --allow-target-blank and --allow-text.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: improve `content-relationship` help text

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: drop FIELD CONSTRAINTS section from content-relationship help

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add a consistent table formatter for tabular output

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: add header support to formatTable and add headers to list commands

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: avoid blank line in `preview list` when only simulator URL exists

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: rename preview list header from LABEL to NAME

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: replace name-based model specifiers with IDs

Slice commands now resolve by `id` instead of `name`, content type
commands resolve by `id` instead of `label`, and variation commands
resolve by `id` instead of `name`.

Closes #105

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: rename `currentId` to `id` in slice-edit-variation

The "current" prefix was a holdover from name-based specifiers where
names could change. IDs are immutable, so the prefix is unnecessary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	test/prismic.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Design API-first modeling approach

1 participant