🎉 🤖 add file-first source for posts_gdocs#6545
Draft
mlbrgl wants to merge 8 commits into
Draft
Conversation
Introduce a new storage source for gdocs so ArchieML content can live in a
local content repo instead of Google Docs. A new posts_gdocs.source column
('gdocs' | 'file', default 'gdocs') records where each gdoc's authoritative
content lives. GdocBase.fetchFromFile reads the matching .md under
CONTENT_REPO_PATH (identified by the first 12 chars of the gdoc id) and runs
it through archieToEnriched — the same enrichment pipeline used for Google
Docs fetches.
loadGdocFromGdocBase routes transparently: when a caller passes
contentSource=Gdocs and the row's storage source is 'file', the file path
is taken. Callers (e.g. the admin client) don't need to discover the source
ahead of time. Storage and fetch concerns are expressed via a new
GdocStorageSource literal subset of GdocsContentSource.
All seven site/gdocs/pages/*.tsx Omit types exclude 'source' along with the
other backend-only fields (contentMd5, markdown, publicationContext,
revisionId). gdocsDeploy's lightning-prop config flags 'source' as
rendering-safe, so changes to it don't force a full site rebake.
The existing Google Docs path is unchanged for rows with source='gdocs' —
no behavioural difference, just a new routing branch for files.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two thin scripts that bracket the file-first lifecycle: - devTools/gdocs/fetch-all-to-files.ts: fetches every posts_gdocs row from Google Docs, converts the AST to ArchieML via gdocToArchie, and writes it under <CONTENT_REPO_PATH>/<type>/<slug>--<shortId>.md. On success it also flips the row's source to 'file' — exporting IS the migration. Supports --dry-run, --type, --id, --concurrency filters. - devTools/gdocs/create-content.ts: scaffolds a new piece of content (article | data-insight | topic-page | linear-topic-page | fragment). Generates a uuidv7 id, writes a minimal valid ArchieML scaffold, inserts a posts_gdocs row with source='file', and prints the admin preview URL. Replaces the admin's "Add a document" flow when there's no Google Doc to back the new piece. Together these cover the two on-ramps for the file-first workflow: migrating existing Gdoc content across, and creating new pieces from scratch. Day-to-day editing then happens in the file directly; the admin re-reads on every preview refresh via GdocBase.fetchFromFile. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two affordances on the gdoc preview page so authors/devs can tell at a
glance where content is being read from, and jump straight into editing
it:
- A coloured "File" / "Google Docs" tag next to the title, with a tooltip
explaining what each source implies for the refresh loop.
- The existing "[ Edit ]" link becomes source-aware:
- source='gdocs' → unchanged (links to the Google Doc edit URL).
- source='file' → replaced by two links: "Edit in Claude" (opens a
Claude Code session via claude://code/new scoped to the content repo,
with a prompt that nudges the agent toward the owid-content skill and
the component registry), plus the relative file path as click-to-copy
fallback.
CONTENT_REPO_PATH is newly exposed via clientSettings so the admin client
can build the absolute file path the claude:// deep-link expects. When the
env var isn't set, the "Edit in Claude" button is suppressed and only the
relative-path copy button remains.
No behaviour change for google-backed gdocs: the "Edit" link on those
rows still points at docs.google.com as before.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous commit rendered two action links for file-backed gdocs (Edit in Claude + the relative file path as a copy button). The path was long enough that the header wrapped to two lines and pushed the Draft tag off the first row. Collapse to a single "Edit in Claude" link, matching the visual weight of the "Edit" link used for Google Docs-backed rows. The file path moves into the tooltip — still visible on hover, no longer taking horizontal space. A copy-path fallback is preserved for sessions where CONTENT_REPO_PATH isn't configured on the client (no claude:// URL can be built). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
For authors who prefer VS Code to Claude Code, the file-backed edit area now renders two pipe-separated links inside the existing bracket decoration: [ Edit in Claude ✏️ | VS Code ]. The VS Code link uses the well-known vscode://file/<abs-path> deep-link scheme, built from the same absPath already computed for the claude:// URL. Both share the path-in-tooltip convention so the header stays on one line (header overflow was the regression that landed as 💄 in the previous commit). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Contributor
|
Quick links (staging server):
Login:
Archive:SVG tester:Number of differences (graphers): 0 ✅ Edited: 2026-05-27 20:29:41 UTC |
|
This PR has had no activity within the last two weeks. It is considered stale and will be closed in 3 days if no further activity is detected. |
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.

Context
Links to issues, Figma, Slack, and a technical introduction to the work.
Screenshots / Videos / Diagrams
Add if relevant, i.e. might not be necessary when there are no UI changes.
Testing guidance
Step-by-step instructions on how to test this change
Reminder to annotate the PR diff with design notes, alternatives you considered, and any other helpful context.
Checklist
(delete all that do not apply)
Before merging
If DB migrations exists:
After merging