Sidebar Reorg Plan Implementation
Overview
This plan describes exactly how to implement the Sidebar Reorg spec in full.
The goal is to preserve the existing sidebar hierarchy while making it more complete:
every project gets a README.md landing page, non-Markdown source files become
readable through auto-generated file-view pages, and image folders are represented
through generated MEDIA.md pages. All new pages are added to the existing sidebar
hierarchy alongside — not instead of — existing entries.
Reference documents:
Generation Strategy
Three categories of generated content, each with a different lifecycle:
| Category | Location | Committed to Git | Regenerated when |
|---|---|---|---|
Project README.md | In each project folder | ✅ Yes | Agent runs generator on demand after project changes |
| File-view pages | .generated/Product/…/<file>.view.md | ❌ No (gitignored) | Every Astro build |
MEDIA.md pages | In image-containing subfolders | ✅ Yes | Agent runs generator on demand |
Why commit READMEs? READMEs are primary navigation documents. An agent may later customize the overview section. They are referenced by sidebar config (which is static). They should appear in the Git log as project history.
Why build-time for file-view pages?
File-view pages are always derived from source files and never manually edited. Generating
them during every Astro build keeps them perpetually fresh without polluting Git history.
The .generated/ directory is gitignored; it exists only during the build and in
local dev after running the generator.
Components
1. view_folder_config.json
Location: Forge/Projects/Sidebar_Reorg/view_folder_config.json
Defines the parameters that drive all generation:
Adding a new project holder folder in the future requires only a one-line change here and in .internal/src/content.config.ts.
2. generate_view_pages.ts
Location: Forge/Projects/Sidebar_Reorg/Scripts/generate_view_pages.ts
Single script with five responsibilities:
2a. Project scanner
- Reads
view_folder_config.json - For each project holder folder, lists all immediate subdirectories as project folders
- Returns a list of
ProjectFolderobjects (path, name, parent project, sub-projects)
2b. README generator
Generates README.md in each project folder root.
README structure (as defined in the spec):
- YAML frontmatter (
title,visibility,status,owner) - Page title (
# Project Name) - Auto-generated overview paragraph (1–3 sentences describing the folder contents)
## Parent Project(omitted if none)## Sub-projects(omitted if none)## Folder Structure— clickable tree showing all visible files
Folder structure link rules:
.mdfile → links to its Starlight slug (e.g.,/architecture/domain_quiz/domain_quiz_spec/)- Supported non-Markdown file → links to its file-view page slug (e.g.,
/architecture/domain_quiz/scripts/life-domain-quiz-qc.ts.view/) - Media-containing folder → links to its
MEDIA.mdslug (e.g.,/architecture/domain_quiz/media/media/) - Empty folder or fully-excluded folder → listed without a link
Overview preservation:
If a README.md already exists and contains the marker
<!-- CUSTOM OVERVIEW START -->, the block between that marker and
<!-- CUSTOM OVERVIEW END --> is preserved verbatim on regeneration.
All other sections are always overwritten.
2c. File-view page generator
For each supported non-Markdown file found under a project folder tree
(excluding excluded_dirs), generates a Markdown page at:
Example:
- Source:
Product/Projects/Domain_Quiz/Scripts/life-domain-quiz-qc.ts - Generated:
.generated/Product/Projects/Domain_Quiz/Scripts/life-domain-quiz-qc.ts.view.md
Each file-view page contains:
If the file exceeds 500 lines, show the first 500 lines followed by a note and the source link.
2d. MEDIA.md generator
For each project subfolder containing at least one media file:
- Generates
MEDIA.mdin that subfolder - Content: folder title, path breadcrumb, one section per media file with:
- Media preview (Markdown
![]()for images) - Filename, dimensions if detectable
- Download link (GitHub raw URL)
- Media preview (Markdown
MEDIA.md is treated as a regular file in the sidebar — it appears alongside .md
files and file-view pages within the same folder group, not as a separate sidebar entry.
Media folders are committed (like READMEs).
2e. Sidebar snippet generator
Outputs a complete updated sidebar group for each Product project, formatted as
valid JavaScript for the agent to review and paste into astro.config.mjs.
The generator does NOT parse astro.config.mjs directly (brittle). Instead it outputs
a .generated/sidebar-additions.md report listing, per project:
- The README slug to add at the top of that project’s
itemsarray - The file-view page slugs to add (with suggested placement)
- The MEDIA.md slugs to add alongside other
.mdfiles in the same folder
MEDIA.md files are treated as regular content files — they appear in the sidebar
alongside .md files and file-view pages for the same folder, not as a separate
special entry.
The agent reads this report and manually applies the additions to astro.config.mjs,
preserving all existing entries and nested groups.
Example: Domain Quiz before and after:
The existing sidebar entries are always preserved. New entries are additions only.
3. Content config update (content.config.ts)
Two changes needed:
Add .generated/ glob pattern:
Update generateId to strip the .generated/ prefix so slugs are clean:
This makes .generated/Architecture/Domain_Quiz/Scripts/life-domain-quiz-qc.ts.view.md
resolve to slug architecture/domain_quiz/scripts/life-domain-quiz-qc.ts.view, which
maps to URL /architecture/domain_quiz/scripts/life-domain-quiz-qc.ts.view/.
4. Package.json build/dev scripts
.internal/package.json is updated to run the generator before every Astro build.
The script is executed with tsx, a zero-config TypeScript runner. Add it as a dev
dependency:
Then update the scripts:
tsx runs TypeScript directly without a separate compilation step, using the existing
tsconfig.json in .internal/. No build output is produced — the script is executed
once at dev/build time and discarded.
Running npm run generate locally before astro dev ensures file-view pages are present
for the dev server. Running it as part of build ensures Vercel always has fresh pages.
5. .gitignore update
Add to the repo root .gitignore:
READMEs and MEDIA.md files are committed normally and are NOT excluded.
Current Project Inventory
All 15 immediate subfolders of Architecture/ are project folders.
The table below summarizes what generation is needed for each:
| Project | README needed | Non-Markdown files | Image folders |
|---|---|---|---|
| Analytics | ✅ | None found | None found |
| Analyze_Convo | ✅ | None found | None found |
| Domain_Quiz | ✅ | Scripts/.ts, Schemas/.ts | None found |
| Goodreads | ✅ | .html,.csv × many | None found |
| Libre_Agents | ✅ | None found | None found |
| Life_Circumstances | ✅ | *.csv × 2 | None found |
| Life_Domains | ✅ | None found | None found |
| Onboarding_Quiz | ✅ | None found | None found |
| OpenRouter | ✅ | None found | None found |
| Persistent_Memory | ✅ | None found | None found |
| Sidebar_Reorg | Already exists | None found | None found |
| Taxonomy | ✅ | Scripts/taxonomy_qc.ts | None found |
| Uvilo_Method | ✅ | None found | None found |
| Uvilo_OS | ✅ | None found | None found |
| Bash_Refactor | ✅ | None found | None found |
The generator script will perform a full scan at runtime and handle any files not captured in this table.
Phases
Phase 1 — Infrastructure Setup
Build the generator script and configuration; update the Astro content pipeline. Nothing is visible to site users yet.
Tasks:
- Create
Architecture/Sidebar_Reorg/view_folder_config.json - Install
tsxas a dev dependency in.internal/ - Implement project scanner module in
generate_view_pages.ts - Implement README generator module (overview, folder structure, parent/sub-project sections)
- Implement file-view page generator module
- Implement MEDIA.md generator module
- Implement sidebar snippet generator module
- Update
content.config.ts— add.generated/glob and updategenerateId - Update
.internal/package.json— addtsxdev dep, addgenerate, updatedevandbuildscripts - Add
.generated/to repo root.gitignore - Add generator script and config to sidebar in
astro.config.mjs
Verification: Run npm run generate locally; confirm .generated/ is created with
the correct file-view pages. Run npm run dev; confirm file-view pages are accessible.
Phase 2 — README Generation (First Run)
Generate and commit README.md for all 14 Architecture projects that currently lack one,
and add each README slug to the top of its project’s existing sidebar group.
Tasks:
- Run generator:
npm run generate - Review generated READMEs — spot check folder structure links and overview text
- Manually adjust any auto-generated overview text that is misleading or empty
- Read
.generated/sidebar-additions.md— apply README slug additions to the top of each project’s existingitemsarray inastro.config.mjs(preserve all existing entries) - Commit all new
README.mdfiles and the updatedastro.config.mjs
Verification: Deploy to Vercel preview; confirm all project READMEs are accessible from the sidebar, existing entries are still present, and folder structure links resolve.
Phase 3 — Non-Markdown File Visibility
Generate file-view pages for all supported non-Markdown files, add their slugs to the sidebar, and confirm they are reachable from both the sidebar and their project READMEs.
Tasks:
- Run
npm run buildlocally and confirm.generated/is populated with file-view pages - Spot-check file-view pages for Domain_Quiz
.tsfiles, Goodreads.html/.csvfiles, and Taxonomy.tsfile - Confirm syntax highlighting renders correctly in Starlight
- Confirm that each project README’s folder structure links to the correct file-view slugs
- Handle large files: verify the 500-line truncation rule works for Goodreads
.csv/.html - Read
.generated/sidebar-additions.md— apply file-view page slug additions to each project’s sidebar group inastro.config.mjs, grouped by subfolder where appropriate (e.g. aScriptssub-group forarchitecture/domain_quiz/scripts/…) - Commit updated
astro.config.mjs
Verification: Navigate both the sidebar AND project READMEs in preview; confirm file-view links in both routes resolve; content is readable; GitHub source link is correct.
Phase 4 — Media Folder Pages
Generate MEDIA.md pages for any media-containing folders. MEDIA.md files are listed
in the sidebar alongside other .md files in the same folder.
Tasks:
- Run full directory scan across all Architecture projects to find media files
- If media folders are found: generate
MEDIA.md, review previews, commit - If no media folders are found: mark this phase N/A and note in State doc
Verification: If applicable, confirm MEDIA.md pages render media previews and
download links in the preview deployment. Confirm MEDIA.md appears in the sidebar
alongside sibling .md files.
Phase 5 — Sidebar Completeness Review
Verify that the sidebar is now a complete and accurate representation of all project contents. Nothing is removed; this phase is a review and gap-fill pass.
Tasks:
- Confirm all 15 Architecture project groups have a
{ slug: '…/readme' }entry at the top - Confirm all file-view page slugs from Phase 3 are present in the sidebar
- Confirm all MEDIA.md slugs from Phase 4 (if any) are present in the sidebar
- Identify any remaining non-Markdown files that were missed and add their file-view slugs
- Decide whether
architecture/architecture(the Architecture overview page) should link to all project READMEs — update if yes - Commit final
astro.config.mjs
Verification: Full manual walk-through of the Architecture section in the preview site. Every project is reachable via sidebar and README. No broken links. No hidden files remain.
Phase 6 — Build Integration & Final Verification
Confirm the generator is correctly integrated into the Vercel build pipeline and the production site reflects all changes.
Tasks:
- Verify Vercel project build command invokes
npm run build(which now includesnpm run generate) - Trigger a full Vercel preview deployment and confirm
.generated/file-view pages are present and accessible - Confirm
astro checkpasses (no type errors from new content) - Confirm
starlightAutoSidebarplugin does not conflict with the new sidebar structure - Full end-to-end test: pick one project (Domain_Quiz), navigate from sidebar → README → file-view page → GitHub source link
- Merge to
devand confirm production deployment at os.uvilo.com
Verification: All above steps pass. No 404s. No build warnings from generated content.
Technical Decisions Log
| Decision | Choice | Rationale |
|---|---|---|
| README lifecycle | Generated + committed | Primary docs; may be agent-customized; transparent in Git |
| File-view page lifecycle | Generated at build time; gitignored | Always derived from source; no manual editing; keeps Git clean |
| MEDIA.md lifecycle | Generated + committed | Treated as project docs, like README |
| File-view page location | .generated/Architecture/…/<file>.<ext>.view.md | Mirrors source path; clean slug after prefix strip |
| Overview preservation | Marker-based (<!-- CUSTOM OVERVIEW START/END -->) | Allows agent customization without losing auto-generated sections |
| Sidebar per-project entry | README added to top of existing group; file-view and MEDIA.md slugs added alongside | Existing hierarchy preserved; sidebar becomes more complete, not collapsed |
| Generator language | TypeScript | Consistent with codebase language; runs via tsx (zero-config); type-safe path/fs operations |
| Truncation threshold | 500 lines | Balances readability with page weight; exact value configurable |
Files Created or Modified by This Project
New files (this plan)
Architecture/Sidebar_Reorg/Sidebar_Reorg_Plan_Implementation.md— this file
New files (implementation)
Architecture/Sidebar_Reorg/view_folder_config.jsonArchitecture/Sidebar_Reorg/Scripts/generate_view_pages.tsArchitecture/<each project>/README.md× 14 (generated, committed)<media folder>/MEDIA.md× TBD (generated, committed).generated/Architecture/…/*.view.md× many (generated, gitignored)
Modified files (implementation)
.internal/src/content.config.ts— add.generated/glob and updatedgenerateId.internal/package.json— addgeneratescript, updatedevandbuild.internal/astro.config.mjs— add Plan to sidebar; Phase 2 README slugs added; Phase 3 file-view slugs added; Phase 4 MEDIA.md slugs added (if applicable).gitignore(repo root) — add.generated/