sync-code-to-doc

Converts code/rpi5 git diffs into chapter-level incremental documentation updates.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When kernel/AOSP enhancement code under code/rpi5 changes, the corresponding design documents (01-打点增强, 02-IO增强) drift out of sync. This Skill generates a structured change report from git diff and converts code changes into precise, chapter-level documentation updates without rewriting whole documents. ## Core Features & Use Cases - Change Report Generation: Groups git diff output by directory (kernel/modified, kernel/new, aosp/modified, aosp/new, others) with A/M/D/R status and line statistics, supporting workspace-vs-HEAD or branch-vs-main comparisons. - Mapping-Driven Doc Location: Routes changes to the correct design documents via doc-sync-mapping.yaml, resolves full source context through manifest.yaml, and locates affected sections using symbol names, line anchors, and filename searches across five reference forms. - Plan-First Incremental Updates: Produces an action-list plan (UPDATE-anchor, UPDATE-table, REMOVE-DOC, DOC-CONFLICT, etc.) requiring user confirmation before chapter-level edits, followed by automated consistency checks for dead indexes, broken links, orphan docs, and out-of-bounds line anchors. - Use Case: After editing LcView kernel code and before committing, run the script to get a diff report, confirm the proposed documentation action list, and let the docs update mechanically with refreshed #L line anchors. ## Quick Start Run python3 harness/skills/sync-code-to-doc/sync_code_to_doc.py --full-diff after modifying code/rpi5 and ask the AI to generate the documentation update plan from the report.

Frequently Asked Questions about sync-code-to-doc

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

FAQPage Schema
How do I sync documentation after changing kernel or AOSP code?

Run sync_code_to_doc.py to generate a grouped change report from git diff, then follow the 7-step workflow: map changes to docs via doc-sync-mapping.yaml, resolve full context through manifest.yaml, locate affected sections, produce an action-list plan, get user confirmation, apply chapter-level edits, and run consistency checks.

How do I compare committed changes against main before promotion?

Use the --base origin/main flag, which runs git diff origin/main...HEAD to report the accumulated committed changes of dev relative to main. This must be done before promote, since after promotion the working tree is clean and the default diff returns no changes.

Why does the script report no changes after promotion?

After promote, code commits are merged into dev=main HEAD and the working tree is clean, so git diff HEAD is empty and the script exits with code 4. Documentation sync must run before commit in default mode or before promote using --base origin/main.

What does the --check-docs option verify?

The --check-docs mode checks documentation index consistency without relying on git diff: dead README indexes, missing index entries, broken links, orphan documents, dead code/ links, out-of-bounds #L line anchors, and stale code-block comments. It exits with code 5 when inconsistencies are found.

What happens when a diff introduces content with no existing document section?

The change is flagged as DOC-CONFLICT in the action plan and is never applied automatically. The plan lists suggested structural adjustments, and the document structure may only be changed after explicit user confirmation, since existing chapter structure is controlled.

What are the limitations of this documentation sync approach?

It requires code/rpi5/manifest.yaml to exist for resolving full source context of modified .diff files, and it only covers the code/rpi5 archive mapped by doc-sync-mapping.yaml. It does not update code/rpi5/README.md mapping tables or perform full document rewrites.