sync-code-to-workspace

Restores a diverged AOSP and kernel workspace to the archived code baseline via plan-based synchronization.

Updated Jun 9, 2026
One-click install
npx skills add https://github.com/lechao365/AndroidSystemEnhance --skill sync-code-to-workspace-lechao365
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sync-code-to-workspace
Source: https://github.com/lechao365/AndroidSystemEnhance/tree/main/harness/skills/sync-code-to-workspace
Command: npx skills add https://github.com/lechao365/AndroidSystemEnhance --skill sync-code-to-workspace-lechao365

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When a ~/workspace build tree (kernel + AOSP) drifts into a broken or inconsistent state, this Skill pulls it back to the known-good baseline archived in code/rpi5, providing a controlled disaster-recovery path instead of manual file-by-file repair. ## Core Features & Use Cases - Plan-based sync: Scans workspace versus code/rpi5 and classifies differences into MODIFIED-DIVERGED, NEW-MISMATCH, and EXTRA categories, writing a TSV plan file for review. - Human confirmation gates: Interactive mode requires per-item confirmation and a final summary approval before any apply; --auto mode runs a single-process closed loop without gates. - Mandatory post-apply verification: After execution, a full rescan classifies results as FIXED, KEPT, RESIDUAL, or NEW-DIFF, returning a non-zero exit code on residual or new differences. - Use Case: A kernel driver edit breaks the build on a Raspberry Pi 5 workspace. Run the sync to generate a plan, confirm which diverged files to check out from the code baseline, apply, and verify the tree matches the archived state before rebuilding. ## Quick Start Ask the AI to sync the workspace back to the code/rpi5 baseline and review the generated plan item by item before applying.

Frequently Asked Questions about sync-code-to-workspace

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I restore a broken AOSP workspace to a known-good baseline?

Run the sync script to generate a plan comparing ~/workspace against the code/rpi5 archive, confirm each MODIFIED-DIVERGED, NEW-MISMATCH, and EXTRA entry, then apply with --apply --plan-file. A full rescan afterward verifies every executed item reached the baseline state.

How to sync kernel and AOSP source trees from an archived code repository?

The script scans kernel modified diffs, new files, and unarchived extra changes on both kernel and AOSP sides, then applies checkout, restore, sync, or delete actions per plan entry. Use --auto for a single-process closed loop without confirmation gates.

Does the sync script commit changes to git automatically?

No. The script never runs git add or git commit; after execution the working tree holds the synchronized state so you can review with git diff and decide whether to commit. It also never modifies the code repository, which is read-only as the truth source.

What happens if the sync apply step fails partway through?

Execution stops immediately with a non-zero exit code to avoid a half-completed state. Checkout operations back up the original file content first and restore it if git apply fails, and broken diff files are flagged as BROKEN-DIFF.

What are the limitations of the workspace sync scan?

The vendor/lechao directory is a scan blind spot because it is a standalone git project not registered in .repo/project.list, so unarchived files there are not detected as EXTRA. The sync also only supports the rpi5 platform and does not handle code/*/others/ content.