feat: report file and remote mutations via structured action logger#143
Draft
angeloashmore wants to merge 1 commit intomainfrom
Draft
feat: report file and remote mutations via structured action logger#143angeloashmore wants to merge 1 commit intomainfrom
angeloashmore wants to merge 1 commit intomainfrom
Conversation
Adds `src/lib/logger.ts` — a module-level action collector with a discriminated union for file/remote created/updated/deleted actions, `reportAction`, `flushActions`, and `formatAction`. Adapters and commands report mutations; commands flush and print them alongside their summary. Lays groundwork for future `--json`/`--quiet` modes. Resolves: #142 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #142
Description
Adds a structured action logger (
src/lib/logger.ts) so commands can tell users (and AI agents) exactly which files and remote resources were mutated. Adapters and commands callreportActionat mutation sites; commandsflushActionsandformatActionto print details alongside their existing summary line.Actions are a discriminated union (
file-created/file-updated/file-deleted/remote-created/remote-updated/remote-deleted), so future--jsonand--quietmodes can format the same data differently without changing call sites.Example output for
prismic type create "Blog Post" --format page:Wired into the adapter base class (all seven CRUD methods), all three framework adapters (Next.js/Nuxt/SvelteKit hooks +
setupProjecthelpers), and the following commands:type-create,slice-create,type-remove,slice-remove,gen-types,gen-setup,init,sync(both non-watch and watch modes).Deferred to follow-up: field mutation commands (
models.ts,field-add-*, etc.), webhook/preview/token commands,--json/--quietflags themselves.Checklist
Preview
How to QA
prismic type create Foo --format page— confirm file paths and remote action print before the summaryprismic slice create Hero— sameprismic gen types— confirmUpdated prismicio-types.d.tsprintsprismic sync --watch— confirm actions flush per cycle (no accumulation)prismic initin a fresh Next.js/Nuxt/SvelteKit project — confirm all generated files are listed