[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6K7W5RTRMRQMWAGXNSX8DM6":3,"skill-same:01M6K7W5RTRMRQMWAGXNSX8DM6":61},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":34,"linkOnly":35,"markdownContent":36,"markdownBody":37,"frontMatter":38,"refName":39,"commitSha":40,"skillDirectory":41,"forksCount":42,"repositoryHtmlUrl":43,"repositoryHomepageUrl":44,"ownerHtmlUrl":45,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":46,"install":47,"resources":60},"01M6K7W5RTRMRQMWAGXNSX8DM6","sync",null,"Pre-flight sync check for registered projects. Fetches from remote, reports uncommitted changes, and handles four states — up-to-date, ahead, behind (warns + pulls), or diverged (warns, no pull). Supports single-project (cwd detection), named-project (fsad-harness:sync key1 key2), and full-sync (fsad-harness:sync ALL) modes.","tbeack\u002Ffsad_playbook","tbeack","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F206807984?v=4","01M6K7Q3C3VRTCVC55T71A1SY9","Theo Beack","01M6K7Q3GDY8TXRQEH984SEE5W",8,"MIT","https:\u002F\u002Fgithub.com\u002Ftbeack\u002Ffsad_playbook\u002Fblob\u002Fmain\u002Fskills\u002Fsync\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33],"pull","harness","detection","projects","check","up","reports","project","full","remote","states","for","changes","modes","single","2026-11-10 10:12:30",false,"---\ndescription: Pre-flight sync check for registered projects. Fetches from remote, reports uncommitted changes, and handles four states — up-to-date, ahead, behind (warns + pulls), or diverged (warns, no pull). Supports single-project (cwd detection), named-project (fsad-harness:sync key1 key2), and full-sync (fsad-harness:sync ALL) modes.\n---\n\n# fsad-harness:sync — pre-flight sync check\n\nRun this before starting any work session to confirm your local repo(s) are in sync with the remote.\n\n**Invocation:**\n- `fsad-harness:sync` — sync the project for the current working directory\n- `fsad-harness:sync ALL` — sync every project in `add-task-projects.yaml`\n- `fsad-harness:sync \u003Ckey1> \u003Ckey2> …` — sync one or more named projects by YAML key\n\n## Step 0 — Parse arguments\n\n1. Inspect the arguments passed to the skill.\n2. **No arguments** → single-project mode. Proceed to Step 1 to detect the project from cwd.\n3. **Single argument `ALL`** (case-insensitive) → multi-project mode. Load `${CLAUDE_PLUGIN_ROOT}\u002Fskills\u002Fadd-task\u002Fadd-task-projects.yaml`. For every project key, resolve `match_paths[0]` (expand `~`) as that project's `project_root`. Build the full project list. Proceed to Step 2.\n4. **One or more project keys** → multi-project mode. Load `${CLAUDE_PLUGIN_ROOT}\u002Fskills\u002Fadd-task\u002Fadd-task-projects.yaml`. For each key:\n   - If found: add `(key, expand(match_paths[0]))` to the list.\n   - If **not found**: print `Unknown project: '\u003Ckey>' — skipping.` and continue.\n   - If all keys are unknown (list is empty after skipping): print `No valid projects to sync.` and stop.\n   Proceed to Step 2 with the resolved list.\n\n## Step 1 — Detect the project (single-project mode only)\n\n1. Determine the current working directory.\n2. Read `${CLAUDE_PLUGIN_ROOT}\u002Fskills\u002Fadd-task\u002Fadd-task-projects.yaml`.\n3. Match cwd against each project's `match_paths` (expand `~`). Prefer the longest match.\n4. If a project matches, note `project_root`. Build a one-item list: `[(matched_key, project_root)]`. Proceed to Step 2.\n5. If **no project matches**: use cwd as `project_root` — sync is useful in any git repo. Build a one-item list: `[(\"(unregistered)\", cwd)]`. Proceed to Step 2.\n\n## Step 2 — Sync each project in the list\n\n**Multi-project mode (2+ projects):** dispatch the **entire Steps 3–6 pipeline** for every project **concurrently**, not just the fetch — issue one `Bash` tool call per project that runs fetch, branch check, worktree check, dirty check, and the ahead\u002Fbehind (plus pull + re-verify, when applicable) comparison in sequence for that project, all in the same message across projects. Each dispatched call is self-contained and produces one structured result record (see the schema at the end of this step) — there's no cross-project dependency, so nothing after the initial fan-out needs to happen serially.\n\nThen loop through the projects in original list order purely to print output:\n- Print a separator header before each:\n  ```\n  ─── Syncing \u003Cproject_key> (\u003Cproject_root>) ───\n  ```\n- Print that project's result using its already-computed structured record — do not re-run any git command here, this loop is presentation only.\n\n**Single-project mode:** run Steps 3–6 in order as usual — there's only one project, so there's nothing to parallelize.\n\n**Structured per-project result.** Whether single- or multi-project mode, every project's pipeline run (Steps 3–6) must produce one result record with this shape, used to build the Step 7 summary instead of reconstructing status text from prose:\n\n```\n{\n  project_key,\n  state,              \u002F\u002F \"fetch_failed\" | \"no_upstream\" | \"up_to_date\" | \"behind\" | \"ahead\" | \"diverged\"\n  ahead,              \u002F\u002F integer, or null if not computed (e.g. fetch_failed, no_upstream)\n  behind,             \u002F\u002F integer, or null\n  dirty,              \u002F\u002F boolean — Step 5 result\n  pull_attempted,     \u002F\u002F boolean — true only if state was \"behind\" AND dirty was false\n  pull_succeeded,     \u002F\u002F boolean | null — null if pull_attempted is false\n  error,              \u002F\u002F string | null — fetch\u002Fremote-check error text, else null\n  is_worktree,        \u002F\u002F boolean — Step 4.5 result\n  worktree_branch,    \u002F\u002F string | null\n  stale_branch_warning \u002F\u002F string | null — Step 4's stale-release-branch message, if any\n}\n```\n\nPopulate this record as each step below executes for the project (Steps 3–6 write into it); Step 7 only reads from it.\n\n## Step 3 — Fetch\n\nRun `git fetch` from `project_root`. (In multi-project mode this is the call dispatched concurrently in Step 2 — this section describes what each dispatched fetch does.)\n\nIf `git fetch` fails (no remote, no network): set `state = \"fetch_failed\"`, `error = \"\u003Cerror>\"` in the result record, skip Steps 4–6 for this project, and continue to the next project.\n\n## Step 4 — Branch name check\n\n1. Run `git rev-parse --abbrev-ref HEAD` to get the current branch name.\n2. If the branch matches the pattern `release\u002FvX.Y.Z` (starts with `release\u002Fv` followed by a version string):\n   a. Read the project version from `cfg.version_files` (first file). If the project is unregistered or has no `version_files`, skip the rest of this step.\n   b. Derive the expected branch name from `cfg.release_branch_pattern` (default: `release\u002F{version}`).\n   c. If the local branch name does not equal the expected name, warn:\n      > \"Branch `\u003Clocal>` is stale — current version is `\u003Cversion>`, expected `\u003Cexpected>`. Run `\u002Ffsad-harness:ship` to rename it.\"\n   d. Run `git ls-remote --heads origin \u003Cexpected>` to check remote presence.\n      - Not found: note \"Expected branch `\u003Cexpected>` has not been pushed to the remote yet.\"\n      - Found and name is already correct: no action.\n      - Command itself fails (network\u002Fauth error, timeout — distinct from a clean \"not found\"): note \"Could not check remote for `\u003Cexpected>` — \u003Cerror>.\" and continue, the same way Step 3 handles a failed `git fetch`. Do not treat this as a stale-branch warning.\n3. If the branch does not match `release\u002FvX.Y.Z`: skip this step entirely.\n\n## Step 4.5 — Worktree check\n\nReuse the branch name from Step 4.\n\n1. If the branch name matches `worktree-task-*`, OR `project_root` is itself a path under `.claude\u002Fworktrees\u002F`, set `is_worktree = true` and record the branch name as `worktree_branch`.\n2. Otherwise `is_worktree = false`.\n\nThis flag only affects the summary annotation in Step 7 — it does not change fetch, branch-staleness, or ahead\u002Fbehind logic.\n\n## Step 5 — Check uncommitted changes\n\nRun `git status --porcelain` from `project_root`.\n\nIf output is non-empty: list the dirty files, prefixed with \"Uncommitted changes detected:\", and set the result record's `dirty = true`. Otherwise `dirty = false`.\n\nThis step alone is informational only — do not stop here. But its `dirty` result is a **precondition input to Step 6's Behind-state pull action** below; do not discard it.\n\n## Step 6 — Compare local vs remote\n\nFirst confirm the branch has an upstream tracking ref:\n\n```bash\ngit rev-parse --abbrev-ref --symbolic-full-name @{u}\n```\n\n- **Fails** (`fatal: no upstream configured for branch ...`): record state **No upstream** (`state = \"no_upstream\"`, `ahead = null`, `behind = null`) for this project and skip the rest of this step — do not run the `git rev-list` commands below, they will crash without an upstream ref. This is expected for local-only branches, e.g. a `worktree-task-*` branch created by `fsad-harness:do-task` that hasn't been merged\u002Fpushed yet.\n- **Succeeds**: continue with the ahead\u002Fbehind comparison:\n\n```bash\ngit rev-list --count HEAD..@{u}   # commits behind remote\ngit rev-list --count @{u}..HEAD   # commits ahead of remote\n```\n\n| State | `state` value | behind | ahead | Action |\n|-------|----------------|--------|-------|--------|\n| **No upstream** | `no_upstream` | — | — | Report \"No upstream branch — run `git push -u origin \u003Cbranch>` to enable sync checks.\" |\n| **Up-to-date** | `up_to_date` | 0 | 0 | Report \"Repo is up to date with remote.\" |\n| **Behind** | `behind` | > 0 | 0 | See **Behind-state action** below — do not pull unconditionally. |\n| **Ahead** | `ahead` | 0 | > 0 | Report \"Local is N commit(s) ahead of remote — ready to push.\" |\n| **Diverged** | `diverged` | > 0 | > 0 | Warn: \"Local and remote have diverged (N behind, M ahead). Manual resolution required — do not start work until resolved.\" Do NOT pull. Tell the user to run `git pull --rebase` or `git merge origin\u002F\u003Cbranch>`. |\n\nSet `ahead`\u002F`behind` in the result record from the `git rev-list` counts in all cases above.\n\n### Behind-state action (dirty-tree precondition + post-pull re-verification)\n\nWhen Step 6 finds `behind > 0` and `ahead == 0`, do not run `git pull` unconditionally. Instead:\n\n1. **Precondition — check the dirty-tree result already computed in Step 5.**\n   - If `dirty == true`: **skip the pull.** Set `pull_attempted = false`, `pull_succeeded = null`. Report:\n     > \"⚠ N commit(s) behind, but the working tree has uncommitted changes — skipping pull. Commit, stash, or discard your changes, then re-run fsad-harness:sync.\"\n     Stop here for this project's Behind-state handling — do not run `git pull`.\n   - If `dirty == false`: proceed to step 2.\n\n2. **Attempt the pull.** Run `git pull`. Set `pull_attempted = true`.\n\n3. **Post-pull re-verification.** Re-run the same comparison used in Step 6's initial detection:\n   ```bash\n   git rev-list --count HEAD..@{u}   # commits behind remote, re-checked\n   ```\n   - If the re-check returns `0`: the pull fully succeeded. Set `pull_succeeded = true`, `behind = 0`. Report:\n     > \"Pulled N commit(s). Repo is now up to date.\"\n   - If the re-check returns `> 0` (partial pull, fast-forward failure, or any other git-level issue): the pull did **not** fully succeed. Set `pull_succeeded = false`, `behind = \u003Cre-checked count>`. Report:\n     > \"✗ Pull did not fully succeed — still N commit(s) behind after pull. Manual resolution required.\"\n   - Never print the unconditional \"now up to date\" success message without this re-check confirming zero-behind.\n\n## Step 7 — Print summary\n\nBuild every summary line **from the structured per-project result record** (defined in Step 2) — never reconstruct status text from memory of what happened during the run. Each record's `state` (plus `pull_attempted`\u002F`pull_succeeded` for the Behind case) maps directly to one banner line:\n\n| `state` | `pull_attempted` | `pull_succeeded` | Banner line |\n|---------|------------------|-------------------|-------------|\n| `fetch_failed` | — | — | `✗ Fetch failed — \u003Cerror>` |\n| `no_upstream` | — | — | `⚠ No upstream branch — run 'git push -u origin \u003Cbranch>' to enable sync checks.` |\n| `up_to_date` | — | — | `✓ Up to date — safe to start work.` |\n| `behind` | `false` | `null` | `⚠ N commit(s) behind, but the working tree has uncommitted changes — skipping pull. Commit, stash, or discard your changes, then re-run fsad-harness:sync.` |\n| `behind` | `true` | `true` | `✓ Pulled N commit(s) — repo now up to date.` |\n| `behind` | `true` | `false` | `✗ Pull did not fully succeed — still N commit(s) behind after pull. Manual resolution required.` |\n| `ahead` | — | — | `⚠ N commit(s) ahead — push when ready.` |\n| `diverged` | — | — | `✗ Diverged — resolve before starting work.` |\n\n**Single-project mode** — one banner line, e.g.:\n\n```\n[fsad-harness:sync] ✓ Up to date — safe to start work.\n[fsad-harness:sync] ✓ Pulled 3 commit(s) — repo now up to date.\n[fsad-harness:sync] ⚠ 2 commit(s) behind, but the working tree has uncommitted changes — skipping pull.\n[fsad-harness:sync] ✗ Pull did not fully succeed — still 1 commit(s) behind after pull. Manual resolution required.\n[fsad-harness:sync] ⚠ 2 commit(s) ahead — push when ready.\n[fsad-harness:sync] ✗ Diverged — resolve before starting work.\n[fsad-harness:sync] ⚠ No upstream branch — run 'git push -u origin \u003Cbranch>' to enable sync checks.\n```\n\nAppend `(uncommitted changes present)` if the record's `dirty` field is true.\n\nIf the record's `is_worktree` is true, append `(worktree: \u003Cworktree_branch> — main checkout unaffected)` so the user isn't confused about which checkout the status line describes.\n\n**Multi-project mode** — summary table after all projects have been processed, one row per structured result record:\n\n```\nProject           Status\n──────────────────────────────────────────────────────\napi_service       ✓ Up to date\nweb_app           ✓ Pulled 2 commit(s) — now up to date\ndocs_site         ⚠ 2 commit(s) ahead — push when ready\ncli_tool          ✗ Diverged — resolve before starting work\ndata_pipeline     ⚠ No upstream branch — push to enable sync checks\nmobile_app        ⚠ Behind, uncommitted changes — skipping pull (uncommitted)\n```\n\nAppend `(uncommitted)` after the status text for any record with `dirty == true`, and `(worktree: \u003Cworktree_branch>)` for any record with `is_worktree == true`.\n","# fsad-harness:sync — pre-flight sync check\n\nRun this before starting any work session to confirm your local repo(s) are in sync with the remote.\n\n**Invocation:**\n- `fsad-harness:sync` — sync the project for the current working directory\n- `fsad-harness:sync ALL` — sync every project in `add-task-projects.yaml`\n- `fsad-harness:sync \u003Ckey1> \u003Ckey2> …` — sync one or more named projects by YAML key\n\n## Step 0 — Parse arguments\n\n1. Inspect the arguments passed to the skill.\n2. **No arguments** → single-project mode. Proceed to Step 1 to detect the project from cwd.\n3. **Single argument `ALL`** (case-insensitive) → multi-project mode. Load `${CLAUDE_PLUGIN_ROOT}\u002Fskills\u002Fadd-task\u002Fadd-task-projects.yaml`. For every project key, resolve `match_paths[0]` (expand `~`) as that project's `project_root`. Build the full project list. Proceed to Step 2.\n4. **One or more project keys** → multi-project mode. Load `${CLAUDE_PLUGIN_ROOT}\u002Fskills\u002Fadd-task\u002Fadd-task-projects.yaml`. For each key:\n   - If found: add `(key, expand(match_paths[0]))` to the list.\n   - If **not found**: print `Unknown project: '\u003Ckey>' — skipping.` and continue.\n   - If all keys are unknown (list is empty after skipping): print `No valid projects to sync.` and stop.\n   Proceed to Step 2 with the resolved list.\n\n## Step 1 — Detect the project (single-project mode only)\n\n1. Determine the current working directory.\n2. Read `${CLAUDE_PLUGIN_ROOT}\u002Fskills\u002Fadd-task\u002Fadd-task-projects.yaml`.\n3. Match cwd against each project's `match_paths` (expand `~`). Prefer the longest match.\n4. If a project matches, note `project_root`. Build a one-item list: `[(matched_key, project_root)]`. Proceed to Step 2.\n5. If **no project matches**: use cwd as `project_root` — sync is useful in any git repo. Build a one-item list: `[(\"(unregistered)\", cwd)]`. Proceed to Step 2.\n\n## Step 2 — Sync each project in the list\n\n**Multi-project mode (2+ projects):** dispatch the **entire Steps 3–6 pipeline** for every project **concurrently**, not just the fetch — issue one `Bash` tool call per project that runs fetch, branch check, worktree check, dirty check, and the ahead\u002Fbehind (plus pull + re-verify, when applicable) comparison in sequence for that project, all in the same message across projects. Each dispatched call is self-contained and produces one structured result record (see the schema at the end of this step) — there's no cross-project dependency, so nothing after the initial fan-out needs to happen serially.\n\nThen loop through the projects in original list order purely to print output:\n- Print a separator header before each:\n  ```\n  ─── Syncing \u003Cproject_key> (\u003Cproject_root>) ───\n  ```\n- Print that project's result using its already-computed structured record — do not re-run any git command here, this loop is presentation only.\n\n**Single-project mode:** run Steps 3–6 in order as usual — there's only one project, so there's nothing to parallelize.\n\n**Structured per-project result.** Whether single- or multi-project mode, every project's pipeline run (Steps 3–6) must produce one result record with this shape, used to build the Step 7 summary instead of reconstructing status text from prose:\n\n```\n{\n  project_key,\n  state,              \u002F\u002F \"fetch_failed\" | \"no_upstream\" | \"up_to_date\" | \"behind\" | \"ahead\" | \"diverged\"\n  ahead,              \u002F\u002F integer, or null if not computed (e.g. fetch_failed, no_upstream)\n  behind,             \u002F\u002F integer, or null\n  dirty,              \u002F\u002F boolean — Step 5 result\n  pull_attempted,     \u002F\u002F boolean — true only if state was \"behind\" AND dirty was false\n  pull_succeeded,     \u002F\u002F boolean | null — null if pull_attempted is false\n  error,              \u002F\u002F string | null — fetch\u002Fremote-check error text, else null\n  is_worktree,        \u002F\u002F boolean — Step 4.5 result\n  worktree_branch,    \u002F\u002F string | null\n  stale_branch_warning \u002F\u002F string | null — Step 4's stale-release-branch message, if any\n}\n```\n\nPopulate this record as each step below executes for the project (Steps 3–6 write into it); Step 7 only reads from it.\n\n## Step 3 — Fetch\n\nRun `git fetch` from `project_root`. (In multi-project mode this is the call dispatched concurrently in Step 2 — this section describes what each dispatched fetch does.)\n\nIf `git fetch` fails (no remote, no network): set `state = \"fetch_failed\"`, `error = \"\u003Cerror>\"` in the result record, skip Steps 4–6 for this project, and continue to the next project.\n\n## Step 4 — Branch name check\n\n1. Run `git rev-parse --abbrev-ref HEAD` to get the current branch name.\n2. If the branch matches the pattern `release\u002FvX.Y.Z` (starts with `release\u002Fv` followed by a version string):\n   a. Read the project version from `cfg.version_files` (first file). If the project is unregistered or has no `version_files`, skip the rest of this step.\n   b. Derive the expected branch name from `cfg.release_branch_pattern` (default: `release\u002F{version}`).\n   c. If the local branch name does not equal the expected name, warn:\n      > \"Branch `\u003Clocal>` is stale — current version is `\u003Cversion>`, expected `\u003Cexpected>`. Run `\u002Ffsad-harness:ship` to rename it.\"\n   d. Run `git ls-remote --heads origin \u003Cexpected>` to check remote presence.\n      - Not found: note \"Expected branch `\u003Cexpected>` has not been pushed to the remote yet.\"\n      - Found and name is already correct: no action.\n      - Command itself fails (network\u002Fauth error, timeout — distinct from a clean \"not found\"): note \"Could not check remote for `\u003Cexpected>` — \u003Cerror>.\" and continue, the same way Step 3 handles a failed `git fetch`. Do not treat this as a stale-branch warning.\n3. If the branch does not match `release\u002FvX.Y.Z`: skip this step entirely.\n\n## Step 4.5 — Worktree check\n\nReuse the branch name from Step 4.\n\n1. If the branch name matches `worktree-task-*`, OR `project_root` is itself a path under `.claude\u002Fworktrees\u002F`, set `is_worktree = true` and record the branch name as `worktree_branch`.\n2. Otherwise `is_worktree = false`.\n\nThis flag only affects the summary annotation in Step 7 — it does not change fetch, branch-staleness, or ahead\u002Fbehind logic.\n\n## Step 5 — Check uncommitted changes\n\nRun `git status --porcelain` from `project_root`.\n\nIf output is non-empty: list the dirty files, prefixed with \"Uncommitted changes detected:\", and set the result record's `dirty = true`. Otherwise `dirty = false`.\n\nThis step alone is informational only — do not stop here. But its `dirty` result is a **precondition input to Step 6's Behind-state pull action** below; do not discard it.\n\n## Step 6 — Compare local vs remote\n\nFirst confirm the branch has an upstream tracking ref:\n\n```bash\ngit rev-parse --abbrev-ref --symbolic-full-name @{u}\n```\n\n- **Fails** (`fatal: no upstream configured for branch ...`): record state **No upstream** (`state = \"no_upstream\"`, `ahead = null`, `behind = null`) for this project and skip the rest of this step — do not run the `git rev-list` commands below, they will crash without an upstream ref. This is expected for local-only branches, e.g. a `worktree-task-*` branch created by `fsad-harness:do-task` that hasn't been merged\u002Fpushed yet.\n- **Succeeds**: continue with the ahead\u002Fbehind comparison:\n\n```bash\ngit rev-list --count HEAD..@{u}   # commits behind remote\ngit rev-list --count @{u}..HEAD   # commits ahead of remote\n```\n\n| State | `state` value | behind | ahead | Action |\n|-------|----------------|--------|-------|--------|\n| **No upstream** | `no_upstream` | — | — | Report \"No upstream branch — run `git push -u origin \u003Cbranch>` to enable sync checks.\" |\n| **Up-to-date** | `up_to_date` | 0 | 0 | Report \"Repo is up to date with remote.\" |\n| **Behind** | `behind` | > 0 | 0 | See **Behind-state action** below — do not pull unconditionally. |\n| **Ahead** | `ahead` | 0 | > 0 | Report \"Local is N commit(s) ahead of remote — ready to push.\" |\n| **Diverged** | `diverged` | > 0 | > 0 | Warn: \"Local and remote have diverged (N behind, M ahead). Manual resolution required — do not start work until resolved.\" Do NOT pull. Tell the user to run `git pull --rebase` or `git merge origin\u002F\u003Cbranch>`. |\n\nSet `ahead`\u002F`behind` in the result record from the `git rev-list` counts in all cases above.\n\n### Behind-state action (dirty-tree precondition + post-pull re-verification)\n\nWhen Step 6 finds `behind > 0` and `ahead == 0`, do not run `git pull` unconditionally. Instead:\n\n1. **Precondition — check the dirty-tree result already computed in Step 5.**\n   - If `dirty == true`: **skip the pull.** Set `pull_attempted = false`, `pull_succeeded = null`. Report:\n     > \"⚠ N commit(s) behind, but the working tree has uncommitted changes — skipping pull. Commit, stash, or discard your changes, then re-run fsad-harness:sync.\"\n     Stop here for this project's Behind-state handling — do not run `git pull`.\n   - If `dirty == false`: proceed to step 2.\n\n2. **Attempt the pull.** Run `git pull`. Set `pull_attempted = true`.\n\n3. **Post-pull re-verification.** Re-run the same comparison used in Step 6's initial detection:\n   ```bash\n   git rev-list --count HEAD..@{u}   # commits behind remote, re-checked\n   ```\n   - If the re-check returns `0`: the pull fully succeeded. Set `pull_succeeded = true`, `behind = 0`. Report:\n     > \"Pulled N commit(s). Repo is now up to date.\"\n   - If the re-check returns `> 0` (partial pull, fast-forward failure, or any other git-level issue): the pull did **not** fully succeed. Set `pull_succeeded = false`, `behind = \u003Cre-checked count>`. Report:\n     > \"✗ Pull did not fully succeed — still N commit(s) behind after pull. Manual resolution required.\"\n   - Never print the unconditional \"now up to date\" success message without this re-check confirming zero-behind.\n\n## Step 7 — Print summary\n\nBuild every summary line **from the structured per-project result record** (defined in Step 2) — never reconstruct status text from memory of what happened during the run. Each record's `state` (plus `pull_attempted`\u002F`pull_succeeded` for the Behind case) maps directly to one banner line:\n\n| `state` | `pull_attempted` | `pull_succeeded` | Banner line |\n|---------|------------------|-------------------|-------------|\n| `fetch_failed` | — | — | `✗ Fetch failed — \u003Cerror>` |\n| `no_upstream` | — | — | `⚠ No upstream branch — run 'git push -u origin \u003Cbranch>' to enable sync checks.` |\n| `up_to_date` | — | — | `✓ Up to date — safe to start work.` |\n| `behind` | `false` | `null` | `⚠ N commit(s) behind, but the working tree has uncommitted changes — skipping pull. Commit, stash, or discard your changes, then re-run fsad-harness:sync.` |\n| `behind` | `true` | `true` | `✓ Pulled N commit(s) — repo now up to date.` |\n| `behind` | `true` | `false` | `✗ Pull did not fully succeed — still N commit(s) behind after pull. Manual resolution required.` |\n| `ahead` | — | — | `⚠ N commit(s) ahead — push when ready.` |\n| `diverged` | — | — | `✗ Diverged — resolve before starting work.` |\n\n**Single-project mode** — one banner line, e.g.:\n\n```\n[fsad-harness:sync] ✓ Up to date — safe to start work.\n[fsad-harness:sync] ✓ Pulled 3 commit(s) — repo now up to date.\n[fsad-harness:sync] ⚠ 2 commit(s) behind, but the working tree has uncommitted changes — skipping pull.\n[fsad-harness:sync] ✗ Pull did not fully succeed — still 1 commit(s) behind after pull. Manual resolution required.\n[fsad-harness:sync] ⚠ 2 commit(s) ahead — push when ready.\n[fsad-harness:sync] ✗ Diverged — resolve before starting work.\n[fsad-harness:sync] ⚠ No upstream branch — run 'git push -u origin \u003Cbranch>' to enable sync checks.\n```\n\nAppend `(uncommitted changes present)` if the record's `dirty` field is true.\n\nIf the record's `is_worktree` is true, append `(worktree: \u003Cworktree_branch> — main checkout unaffected)` so the user isn't confused about which checkout the status line describes.\n\n**Multi-project mode** — summary table after all projects have been processed, one row per structured result record:\n\n```\nProject           Status\n──────────────────────────────────────────────────────\napi_service       ✓ Up to date\nweb_app           ✓ Pulled 2 commit(s) — now up to date\ndocs_site         ⚠ 2 commit(s) ahead — push when ready\ncli_tool          ✗ Diverged — resolve before starting work\ndata_pipeline     ⚠ No upstream branch — push to enable sync checks\nmobile_app        ⚠ Behind, uncommitted changes — skipping pull (uncommitted)\n```\n\nAppend `(uncommitted)` after the status text for any record with `dirty == true`, and `(worktree: \u003Cworktree_branch>)` for any record with `is_worktree == true`.\n",{"description":7},"main","bf3a412c985273327682c956ca35341c64ce9f8c","skills\u002Fsync",4,"https:\u002F\u002Fgithub.com\u002Ftbeack\u002Ffsad_playbook","https:\u002F\u002Ffsad-playbook.vercel.app","https:\u002F\u002Fgithub.com\u002Ftbeack","2026-11-14 21:03:06",{"source":8,"skillName":5,"commands":48,"prompt":58,"zipAvailable":59},[49,52,55],{"tool":50,"command":51},"npx","npx skills add tbeack\u002Ffsad_playbook --skill sync",{"tool":53,"command":54},"bunx","bunx skills add tbeack\u002Ffsad_playbook --skill sync",{"tool":56,"command":57},"pnpm","pnpm dlx skills add tbeack\u002Ffsad_playbook --skill sync","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Ftbeack\u002Ffsad_playbook\u002Fblob\u002Fmain\u002Fskills\u002Fsync\u002FSKILL.md",true,[],[62,89,108,129,158,181],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":34},"01M6K7VY55SWBDD379T9JZVF16","spec-review","Run a detailed, adversarial multi-agent review of a written proposal or specification (spec.md, PRD, RFC, design doc, architecture proposal, business case) — reviews the document, not code. Runs a steelman\u002Finventory pass, then up to 10 specialist lenses (logic, assumptions, evidence, completeness, feasibility, alternatives, consistency, stakeholders, testability, risk), then adversarial validation that defaults to refuting each finding unless it survives, then a loop-until-dry completeness pass. Writes a single severity-ranked SPEC-REVIEW.md next to the document. Use when the user says \"review this spec\", \"adversarial review\", \"poke holes in this proposal\", \"red team this PRD\", \"critique this design doc\", \"what's wrong with this RFC\", \"stress test this plan\", or similar. Review-only — never edits the document.","https:\u002F\u002Fgithub.com\u002Ftbeack\u002Ffsad_playbook\u002Fblob\u002Fmain\u002Fskills\u002Fspec-review\u002FSKILL.md",[],[69,70,71,72,73,74,75,76,77,78,79,24,80,81,82,83,84,85,86,87,88],"review","spec","spec review","design","architecture","code","inventory","team","loop","never","only","specification","poke","deep","dry","proposal","lens","quick","reviews","when",{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":34},"01M6K7VVD3B0SM3VKJ5W26QPPV","ship","Short alias for \u002Ffsad-harness:ship-it. Wrap up finished work, cut a version, commit, push, and open a PR.","https:\u002F\u002Fgithub.com\u002Ftbeack\u002Ffsad_playbook\u002Fblob\u002Fmain\u002Fskills\u002Fship\u002FSKILL.md",[],[91,96,97,20,98,99,100,101,102,103,24,104,105,106,107,30],"commit","pr","push","open","wrap up","work","short","version","wrap","alias","cut","it",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":34},"01M6K7VP2QDRNX57KP2RH10FAW","ship-it","Wrap up a finished round of work — verify README and CHANGELOG are current, cut a version if warranted, move completed task files into the completed\u002F folder, then create a feature branch if needed, commit, push, and open a PR. Run after `\u002Ffsad-harness:do-task` has marked one or more tasks done. Takes no arguments.","https:\u002F\u002Fgithub.com\u002Ftbeack\u002Ffsad_playbook\u002Fblob\u002Fmain\u002Fskills\u002Fship-it\u002FSKILL.md",[],[91,115,107,96,116,117,99,118,119,101,120,121,24,122,123,124,125,126,28,127,128],"ship it","tasks","create","Bash","gh pr","branch","fetch","log","files","done","checkout","move","ls","parse",{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":135,"publishedAt":34},"01M6K7VEK1C0MK5BNDHV8S6HCA","set-context","Gather codebase and initiative context before planning starts — runs a graphify build or query when graphify is available locally, falls back to a manual repo sweep otherwise, then asks targeted questions and writes a single context.md. Invocable standalone or as fsad-harness:plan's mandatory Phase 0. Use when the user says \"set context\", \"gather context\", or as the first step of fsad-harness:plan.","https:\u002F\u002Fgithub.com\u002Ftbeack\u002Ffsad_playbook\u002Fblob\u002Fmain\u002Fskills\u002Fset-context\u002FSKILL.md",[],[136,137,138,139,20,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,33,156,157,88],"SET","context","set context","planning","first","graphify","plan","sweep","repo","user","use","build","back","query","as","questions","manual","standalone","path","codebase","phase","gather",{"skillNo":159,"name":160,"nameZh":6,"description":161,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":162,"categories":163,"keywords":164,"publishedAt":34},"01M6K7V17M3MQ92QZ99G294RYM","sec-review-team","Run a multi-agent security review TEAM over a codebase or recent diff. Picks a specialist roster based on detected stack signals (webapp \u002F desktop \u002F iac \u002F llm-agent \u002F container \u002F backend \u002F mobile \u002F etc.) from a library of 13 specialists. Each specialist writes structured JSONL + prose findings in parallel; input-validation-auditor and auth-authz-auditor run a loop-until-dry consensus fan-out (2-8 passes); every deduped finding is adversarially verified by a dedicated validator agent before it can appear in the report. Orchestrator consolidates into a single severity-ranked REPORT.md with deduped root issues, archived per-run under a known-findings.jsonl ledger that drives auto re-review. Distinct from the built-in `\u002Fsecurity-review` (which is a single-pass branch review). Use when the user says \"multi-agent security review\", \"security review team\", \"sec-review team\", \"audit this branch with a team\", \"pre-release hardening team pass\", or similar. Review-only — no fixes.","https:\u002F\u002Fgithub.com\u002Ftbeack\u002Ffsad_playbook\u002Fblob\u002Fmain\u002Fskills\u002Fsec-review-team\u002FSKILL.md",[],[69,76,165,166,167,168,169,170,171,77,172,120,173,174,175,83,176,177,178,179,180],"sec review team","review team","agent security","security review","run","release","security-review","stack","consensus","auto","mobile","input","re","jsonl","which","verified",{"skillNo":182,"name":183,"nameZh":6,"description":184,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":185,"categories":186,"keywords":187,"publishedAt":34},"01M6K7TP7VTTPW9H79AEHEVPGK","sec-review-fixes","Companion to `sec-review-team`. Takes the `REPORT.md` or `findings.jsonl` from a security review run and produces fix PRs (one per finding or one consolidated) with interactive approval. Each candidate finding becomes a proposed diff + a regression test that would have caught it + a commit\u002FPR citing the finding ID. Filters by default to `severity IN (critical, high) AND confidence IN (certain, likely)`. Modes: interactive (default), `--dry-run` (produces a fix-plan document with no code changes), `--re-verify` (re-runs sec-review-team against a specific set of finding IDs and reports fixed \u002F still-present \u002F inconclusive). Safeguards: branch-only commits (never main), no force-push, clean-working-tree required, regression-test must pass before commit lands. Use when the user says \"fix the security findings\", \"apply sec-review fixes\", \"open PRs for the security report\", \"re-verify the security fixes\", or similar.","https:\u002F\u002Fgithub.com\u002Ftbeack\u002Ffsad_playbook\u002Fblob\u002Fmain\u002Fskills\u002Fsec-review-fixes\u002FSKILL.md",[],[69,188,189,190,74,136,191,99,192,120,193,78,79,194,195,196,197,39,198,177,88],"fixes","review fixes","sec review fixes","ids","regression","fix","security report","filters","default","clean","critical"]