sync
Pull latest changes from remote and report status
- License 许可
- MIT
- 最近更新
- 2026-11-10
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- sync
- type
- shipping
- version
- v0.2
- description
- Pull latest changes from remote and report status
- argument-hint
- null
03 SKILL.md 正文
Sync
Pull the latest changes from the remote repository and report status.
Process
-
Check current state:
- Run
git statusto check for uncommitted changes. - If there are uncommitted changes, stash them first (
git stash), pull, then pop the stash. Warn the user about the stash.
- Run
-
Pull from remote:
- Run
git pull --rebase origin <current-branch>. - If rebase conflicts occur, abort the rebase (
git rebase --abort), trygit pull --no-rebaseinstead, and report any merge conflicts for the user to resolve.
- Run
-
Check for outstanding work:
- Check if
tasks/roadmap.mdexists for the full plan, andtasks/todo.mdfor the current phase. - If
tasks/todo.mdexists, read it and look for unchecked items (- [ ]). - If there are incomplete items, summarise: which phase is current, what the next step is, and how many steps/phases remain.
- If
tasks/manual-todo.mdexists, count unchecked manual tasks and include in the summary. - If
tasks/record-todo.mdortasks/recurring-todo.mdexists, count unchecked advisory items and include those counts separately. Do not treat them as active plan steps. - If all items are checked, report that the plan is complete.
- If neither file exists, note that there is no active plan.
- Check if
-
Check provisioned agent config:
- If
CLAUDE.mdorAGENTS.mdcontains<!-- provision-agentic-config vX.Y -->, extract the version. - Read the canonical
provision-agentic-configskill from the first existing path in this order:~/.claude/skills/provision-agentic-config/SKILL.md~/.codex/skills/provision-agentic-config/SKILL.mdglobal/claude/provision-agentic-config/SKILL.mdin the current repo, when presentglobal/codex/provision-agentic-config/SKILL.mdin the current repo, when present
- Extract the
version:field from the canonical skill's YAML frontmatter. - Extract the canonical provisioned blocks from the same skill:
CLAUDE.md: the fenced block underRequired Claude Blockor the section that says "The Claude block to insert into./CLAUDE.md".AGENTS.md: the fenced block underRequired AGENTS Blockor the section that says "The AGENTS block to insert into./AGENTS.md".
- Compare each existing project file against its corresponding canonical block after normalizing line endings and trimming only leading/trailing whitespace around the block. Do not ignore changed bullets, headings, command examples, or policy text.
- If the installed skill version is newer than the provisioned version in either file, warn:
⚠ CLAUDE.md provisioned with vX.Y but provision-agentic-config is at vX.Y — consider re-running /provision-agentic-config - If the version comment is missing from
CLAUDE.mdorAGENTS.md, note:ℹ No provision version found in CLAUDE.md/AGENTS.md — run /provision-agentic-config to add version tracking - If a project file has the current version comment but the provisioned block content differs from the canonical block, warn:
⚠ CLAUDE.md provisioned block differs from the canonical provision-agentic-config vX.Y block — re-run /provision-agentic-config - If a canonical block cannot be extracted, fall back to the version-only check and note:
ℹ Could not extract canonical provision-agentic-config block; checked version comment only - If none of the canonical skill files exists, skip this check silently.
- If
-
Report status:
- Branch name
- Commits pulled (if any) — show short log of new commits
- Whether stashed changes were re-applied
- Any conflicts that need manual resolution
- Current
git status - Agent config drift — provisioning version and canonical block match/drift status for
CLAUDE.mdandAGENTS.md, if checked - Outstanding work — summary from step 3 (next step, current phase, remaining work, pending manual tasks) or "No active plan"
- Advisory tasks — pending record/recurring counts, if those files exist
-
Post-sync actions:
a) Check if
sync.mdexists at the project root.b) If
sync.mdexists — parse and execute it:- Read
sync.mdand identify sections by H2 headings. - Dependencies (aliases: "Deps", "Dependency Management"):
Execute shell commands found in fenced code blocks (e.g.,
npm install). Report output briefly. - Conflict Resolution (aliases: "Conflicts"):
If the pull introduced merge conflicts (from step 2), apply the guidance in this section. For example, if it says "accept theirs for lockfiles", run the appropriate
git checkout --theirscommand. If no conflicts exist, skip silently. - Custom (aliases: "Project-Specific", "Scripts", "Setup"): Execute shell commands found in fenced code blocks in order. Report output briefly.
- Notifications (aliases: "Awareness", "Alerts", "Watch"):
For each bullet point, check if the mentioned file or directory was modified in the pulled commits (use
git diff --name-onlyagainst the pre-pull HEAD). If any match, print a prominent alert with the bullet's description. - Sections with unrecognised headings: skip with a note ("Skipped unknown sync.md section: <heading>").
- Report a summary of all post-sync actions taken.
c) If
sync.mddoes not exist — suggest creating one:- Analyse the project to detect:
- Package manager (look for
package-lock.json,yarn.lock,pnpm-lock.yaml,Pipfile.lock,requirements.txt,go.sum,Cargo.lock,Gemfile.lock,composer.lock) - Common scripts (check
package.jsonscripts,Makefile,Justfilefor build/codegen/migrate targets) - Config templates (
.env.example,docker-compose.yml,config/)
- Package manager (look for
- Present a suggested
sync.mdto the user with detected actions pre-filled, following the format in the sync.md format section below. - Ask: "Would you like me to create this
sync.md? You can customise it anytime." - Only create the file if the user approves.
- Read
sync.md format
The sync.md file lives at the project root. It uses H2 sections as categories. Shell commands go in fenced code blocks; prose guidance goes in bullet points.
# Post-Sync Actions
## Dependencies
Commands to run after pulling to keep local dependencies up to date.
```sh
npm install
Conflict Resolution
Project-specific guidance for handling merge conflicts.
- Always accept theirs for
package-lock.json— regenerate via install command above - For
generated/files, regenerate withnpm run codegeninstead of resolving manually
Custom
Project-specific scripts or commands to run after sync.
npm run codegen
Notifications
Files and patterns to check for changes after a pull. Alert the user if any were modified.
.env.example— check for new environment variables you may need to add to.envCLAUDE.md— review if project conventions were updatedconfig/— warn about config schema changes
## Constraints
- Do not force-push or rewrite history.
- Do not auto-resolve merge conflicts — report them and let the user decide. However, if `sync.md` has a **Conflict Resolution** section, follow its guidance for the specific files/patterns it covers.
- If stash pop fails due to conflicts, leave the stash intact and report it.
- Post-sync commands from `sync.md` run in the project root directory.
- If any post-sync command fails, report the error and continue with remaining actions (do not abort).
- Never auto-create `sync.md` without explicit user approval.
- Do not execute commands from `sync.md` sections that are commented out with HTML comments (`<!-- ... -->`).
## Default Shipping Contract
Follow the shared shipping contract convention in CLAUDE.md.
04 同仓库更多 Skills
source-checkout-allowed
Valid source-checkout-only fixture.
deck-install-valid
Valid deck install fixture.
codex-pack-guard-valid
Valid Codex Pack Availability Guard fixture.
codex-missing-skill-valid
Valid Codex missing skill fallback fixture.
codex-base-skill-fallback-valid
Valid Codex base skill fallback fixture.
claude-pack-guard-valid
Valid Claude Pack Availability Guard fixture.