Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 46 additions & 17 deletions .github/workflows/translate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,33 +179,62 @@ jobs:
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Create PR if translations changed
- name: Create or update PR with translations
if: steps.changes.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
EXISTING=$(gh pr list --base main --search "[auto] update translations" --state open --json number --jq length)
if [ "$EXISTING" -gt 0 ]; then
echo "Translation PR already open. Skipping."
exit 0
fi
# When an auto-translation PR is already open, push to its branch
# instead of dropping these translations. Previously this step
# exited early if any open PR matched, which combined with the
# cache-save above meant lost translations were never re-attempted
# (cache marked them done, file changes were never committed).
EXISTING_PR=$(gh pr list --base main --search "[auto] update translations" --state open --json number,headRefName --limit 1)
EXISTING_COUNT=$(echo "$EXISTING_PR" | jq length)

BRANCH="auto/translate-docs-$(date +%Y%m%d-%H%M)"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "$BRANCH"

if [ "$EXISTING_COUNT" -gt 0 ]; then
EXISTING_BRANCH=$(echo "$EXISTING_PR" | jq -r '.[0].headRefName')
EXISTING_NUMBER=$(echo "$EXISTING_PR" | jq -r '.[0].number')
echo "Updating existing PR #$EXISTING_NUMBER on branch $EXISTING_BRANCH"

# Snapshot freshly-generated translations and the merged cache,
# then switch branches and replay them on top so newer English
# source wins over whatever the existing PR branch had.
git reset HEAD
tar -czf /tmp/translations.tar.gz docs/ scripts/translate-docs/.translation-cache.json
git fetch origin "$EXISTING_BRANCH"
git checkout -f -B "$EXISTING_BRANCH" "origin/$EXISTING_BRANCH"
tar -xzf /tmp/translations.tar.gz
rm /tmp/translations.tar.gz
BRANCH="$EXISTING_BRANCH"
else
BRANCH="auto/translate-docs-$(date +%Y%m%d-%H%M)"
git checkout -b "$BRANCH"
fi

git add -A
if git diff --cached --quiet; then
echo "No new translation changes to push. Done."
exit 0
fi

git commit -m "docs: update translations for changed English sources"
git push origin "$BRANCH"

PR_BODY="## Summary
if [ "$EXISTING_COUNT" -eq 0 ]; then
PR_BODY="## Summary

Automated translation update triggered by changes to English documentation sources.
Automated translation update triggered by changes to English documentation sources.

- Only changed pages were re-translated (content-hash cache)
- All 14 languages across 3 tiers (parallel matrix)"
- Only changed pages were re-translated (content-hash cache)
- All 14 languages across 3 tiers (parallel matrix)"

gh pr create \
--title "[auto] update translations" \
--body "$PR_BODY" \
--base main \
--head "$BRANCH"
gh pr create \
--title "[auto] update translations" \
--body "$PR_BODY" \
--base main \
--head "$BRANCH"
fi
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
- `scripts/launch.ts`: redesign the dashboard-startup ASCII banner to mirror the hosted PNG wordmark β€” hand-crafted chunky pixel-block lowercase "failproof ai" compressed with Unicode 2x2 quadrant block characters (β––β–—β–˜β–™β–šβ–›β–œβ–β–žβ–Ÿ + β–€ β–„ β–ˆ β–Œ ▐) and horizontally scaled 4:3 so the full wordmark fits in ~75 cols Γ— ~10 rows (clean on any standard β‰₯80-col terminal), with a plain-text fallback for narrower windows. Also drops the "Using default .claude projects path: …" log line at startup β€” it printed unconditionally on every dashboard launch and added no signal (#322).
- Remove the undocumented `--projects-path <path>` / `-p <path>` CLI flag from `scripts/parse-script-args.ts` and the corresponding plumbing in `scripts/launch.ts` (custom-path branch + log line + spawn-env override). Custom Claude project folders can still be pointed at via the `CLAUDE_PROJECTS_PATH` environment variable, which `lib/paths.ts:getClaudeProjectsPath` already honors. `docs/cli/dashboard.mdx` updated to reflect the env-var-only path; tests in `__tests__/scripts/parse-script-args.test.ts` trimmed to drop the 6 cases that exercised the removed flag (#322).

### Fixes
- `.github/workflows/translate-docs.yml`: when an `[auto] update translations` PR is already open, push the new translations to its existing branch instead of skipping. Previously the consolidate step exited early on any open auto-PR but the cache-save step ran first, so the cache advanced to mark the lost translations as done β€” and the next workflow run saw them as cached and never re-translated. Empirically: the README rewrite in #321 *did* successfully translate all 14 `docs/i18n/README.*.md` files (visible in run 25588145237's per-language logs as `translated (3258+3048 tokens)` lines), but the consolidate job logged `Translation PR already open. Skipping.` because an unrelated auto-PR was mid-flight; the next two runs (#322 β†’ #324) saw the README as cached and PR #324 only contained 14 dashboard.mdx files, leaving the 14 README translations stuck on the pre-redesign 358-line layout while English was 171 lines. The fix snapshots the freshly-generated `docs/` tree + merged cache via tar before any branch operations, fetches and force-checks-out the existing PR branch, then untars on top so the latest translation always wins over whatever the PR branch held; PR creation only fires when no existing PR matched (#325).

### Docs
- Rewrite the English `README.md`: new layout with shields.io badges (npm / CI / Slack / Docs / License), a CDN-hosted wordmark logo, the translation strip pulled back up to the header alongside the badges, the existing 7-CLI logo grid (Claude / Codex / Copilot / Cursor / OpenCode / Pi / Gemini) preserved with its install hint and beta caveat, a tighter "What it stops" table that leans on the git policies (`block-push-master` / `block-force-push` / `block-work-on-main` / `block-rm-rf` / `sanitize-api-keys`), a "License" section explaining the MIT + Commons Clause split, and a documentation index linking to docs.befailproof.ai. The hero GIF is the new `readme-arch-hq.gif` (added in this PR); the old `failproofai-hq.gif` is removed. The 14 translated `docs/i18n/README.*.md` files were swapped to the new GIF filename in the same PR β€” their structural rewrite is left to the next `translate-docs` workflow run on `main` (#321).

Expand Down