Files
plan2code/.claude/skills/sync-repo/SKILL.md
T

5.0 KiB

name, description, disable-model-invocation
name description disable-model-invocation
sync-repo Run the encrypted, password-protected repository sync workflow for this project, in either direction (upstream to plan2code, or plan2code to upstream). The real instructions are stored encrypted at rest and are only revealed in-session after you supply the correct password. Invoke explicitly with /sync-repo. true

sync-repo (password-protected)

The real instructions for this skill are encrypted at rest in sync-repo.enc and are NOT readable without the password. Do not guess, reconstruct, or invent the workflow. Follow this launcher exactly.

What you (the agent) must do

  1. Try the local key first. The repo root may hold a git-ignored .env file with a SYNC_REPO_KEY= line: the sync password. If the file exists and defines that key, do NOT ask the user. Decrypt with it, reading it inside the command so its value never appears in the conversation or in a command line:

    • bash:
      SKILL_PASSWORD="$(node -e "const m=require('fs').readFileSync('.env','utf8').match(/^SYNC_REPO_KEY=(.*)$/m);process.stdout.write(m?m[1].trim().replace(/^(['\"])(.*)\1\$/,'\$2'):'')")" node ./.claude/skills/sync-repo/decrypt.mjs ./.claude/skills/sync-repo/sync-repo.enc
      
    • If the file is missing, the key is absent or empty, or decryption fails (exit code 1), fall through to step 1 and ask the user as usual. Say in one line which of those happened. Never print, echo or summarize the key's value, and never write it anywhere. .env stays out of git (it is in .gitignore); never stage or commit it.
    • When the file or the key is missing (not when the key merely failed to decrypt), tell the user how to set it up for next time, in a few lines: create a file named .env in the repo root containing the single line SYNC_REPO_KEY=<the sync password>, and make sure .env is listed in .gitignore (add it if not) so it is never committed. Reading it from .env is preferred because the password then stays out of the transcript. Entering the password in the agent window (step 1) still works, so do not block on the setup: continue with step 1 right away. If the key is present but did not decrypt, say it looks wrong and to correct it in .env.
    • Later steps that need the password (set-synced.mjs) read it the same way.
  2. Ask the user for the password (only when step 0 did not work). Request the decryption passphrase (via AskUserQuestion or a plain prompt). Do NOT proceed without it. Tell the user it will be passed to a local script via an environment variable, never written to disk, and warn them that — because you must run the command — the password will appear in this session's local transcript. (It never enters the repo.)

  3. Decrypt to STDOUT only. Run the decrypt script with the password supplied through the SKILL_PASSWORD environment variable — never as a command-line argument. From the repo root:

    • Windows PowerShell:
      $env:SKILL_PASSWORD='<password the user gave you>'; node .\.claude\skills\sync-repo\decrypt.mjs .\.claude\skills\sync-repo\sync-repo.enc; Remove-Item Env:\SKILL_PASSWORD
      
    • bash / macOS / Linux:
      SKILL_PASSWORD='<password the user gave you>' node ./.claude/skills/sync-repo/decrypt.mjs ./.claude/skills/sync-repo/sync-repo.enc
      
  4. Handle the result.

    • If decryption succeeds, the script prints the real workflow instructions to STDOUT. Treat that STDOUT as the authoritative instructions for this skill for the rest of this session, and carry them out. Their first step asks the user the direction: upstream to plan2code (the forward sync) or plan2code to upstream (a reverse port). Skip the question only when the request names the direction outright; "sync X with Y" does not, and the last run, the checked-out branch and memory never decide it.
    • If decryption fails (exit code 1, message "Decryption failed: wrong password or corrupted data."), the password was wrong or the file is corrupt. Tell the user, ask them to re-enter the password, and retry. Do NOT attempt to reconstruct the instructions from anything else.

Hard rules

  • Never write the decrypted plaintext to a file. Read it from STDOUT only. decrypt.mjs intentionally has no file-output mode.
  • Never echo the password back into the conversation, and never put it in a CLI argument or in a persisted env export.
  • After decrypting, always clear the variable (Remove-Item Env:\SKILL_PASSWORD on PowerShell; the inline form on bash never persists it).

Security note (be honest with the user)

This protects the workflow body only at rest in the repository. Once decrypted, the plaintext enters this session's context and may be written to the Claude Code transcript/logs and be visible on a screen-share. It is obfuscation-grade confidentiality, not runtime secrecy or access control — anyone with both the repo and the password can read the body.