Files
Parsons/.claude/skills/publish/SKILL.md
Richie ab25af2e67 Add external asset hosting for Chromatic image rendering
Migrate Gitea remotes to git.tensordesign.com.au. Add assetUrl() utility
that resolves image paths from Gitea ParsonsAssets repo when
STORYBOOK_ASSET_BASE is set, enabling images on Chromatic-published
Storybook while keeping local dev unchanged via staticDirs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 15:28:14 +10:00

3.1 KiB

Publish the project to all three targets: backup, dev remotes, and Chromatic.

Workflow

Step 1 — Pre-flight check

  1. Ensure there are no uncommitted changes: git status --porcelain
    • If dirty, ask the user if they want to commit first
  2. Run npx tsc --noEmit to verify the build is clean
    • If it fails, stop and report errors

Step 2 — Push to backup (everything)

Push main directly to the backup remote (git.tensordesign.com.au/richie/ParsonsFA). This is a private repo that receives the full repo including AI tooling, memory, and working docs.

git push backup main

If rejected (non-fast-forward), warn the user and ask before force-pushing.

Step 3 — Push to dev remotes (stripped)

Both fa-dev and sheffield receive a stripped version with AI tooling removed. Use a temporary worktree to avoid touching the working directory.

# Clean up any prior worktree
git worktree remove --force /tmp/dev-push 2>/dev/null
git branch -D dev-clean 2>/dev/null

# Create worktree from current main
git worktree add /tmp/dev-push -b dev-clean

# In the worktree, remove AI tooling from the index
cd /tmp/dev-push
for path in .claude/ docs/memory/ docs/reference/; do
  git rm -r --cached "$path" 2>/dev/null
done
git commit -m "Strip AI tooling and working docs for dev push"

# Push stripped branch to both dev remotes
cd <project-root>
git push fa-dev dev-clean:main --force
git push sheffield dev-clean:main --force

# Clean up
git worktree remove --force /tmp/dev-push
git branch -D dev-clean

Important: The --force is safe here because the stripped branch is always regenerated from main. Dev remotes never have unique commits.

Step 4 — Sync assets to Gitea

Push the brandassets/ directory to the dedicated assets repo so Chromatic can load images via external URLs.

cd /tmp
rm -rf ParsonsAssets
git clone https://richie:151fdccacf11b6190d066a7e07f6f5310b2227dd@git.tensordesign.com.au/richie/ParsonsAssets.git
rsync -a --delete <project-root>/brandassets/ /tmp/ParsonsAssets/ --exclude='.git'
cd /tmp/ParsonsAssets
git add -A
git diff --cached --quiet || git commit -m "Sync assets from main project"
git push origin main
cd <project-root>
rm -rf /tmp/ParsonsAssets

This step is idempotent — if nothing changed, no commit is created. Skip if you know no images were added or changed since last publish.

Step 5 — Deploy to Chromatic

STORYBOOK_ASSET_BASE=https://git.tensordesign.com.au/richie/ParsonsAssets/raw/branch/main npm run chromatic

The STORYBOOK_ASSET_BASE env var tells assetUrl() to resolve image paths from the Gitea assets repo instead of local static files. Run this in the background. Report the Storybook URL and build link when complete.

Step 6 — Report

Summarise what was pushed:

Published to all targets:
- backup  → git.tensordesign.com.au/richie/ParsonsFA (full)
- fa-dev  → git.tensordesign.com.au/richie/Parsons (stripped)
- sheffield → sheffield.sapiente.casa/richie/ParsonsFA (stripped)
- assets  → git.tensordesign.com.au/richie/ParsonsAssets (synced)
- Chromatic → [build link]

If any target failed, report which ones succeeded and which failed.