# Debian Forge File Structure Reorganization Plan
# Goal: Achieve near 1:1 compatibility with original osbuild repository structure

## Phase 1: Restore Original Structure
- [x] Verify core directories exist and are complete:
  - [x] .devcontainer/
  - [x] .github/
  - [x] assemblers/
  - [x] data/
  - [x] devices/
  - [x] docs/
  - [x] inputs/
  - [x] mounts/
  - [x] osbuild/          # Core Python package
  - [x] runners/
  - [x] schemas/
  - [x] schutzbot/
  - [x] selinux/
  - [x] sources/
  - [x] stages/
  - [x] test/
  - [x] tools/
  - [x] samples/

- [x] Restore missing configuration files:
  - [x] .bandit
  - [x] .editorconfig
  - [x] .git-blame-ignore-revs
  - [x] .gitignore
  - [x] .gitlab-ci.yml
  - [x] .mypy.ini
  - [x] .packit.yaml
  - [x] .ruff.toml
  - [x] CODEOWNERS
  - [x] Schutzfile
  - [x] osbuild.spec
  - [x] setup.cfg
  - [x] tox.ini

## Phase 2: Reorganize Debian-Specific Content ✅ COMPLETED
- [x] Move Debian documentation to docs/:
  - [x] debian-forge-docs/ → docs/debian/
  - [x] Keep original docs/ structure intact

- [x] Move Debian tests to test/:
  - [x] debian-forge-tests/ → test/debian/
  - [x] Ensure original test/ structure remains

- [x] Move Debian blueprints to samples/:
  - [x] blueprints/ → test/data/manifests/debian/
  - [x] Keep original samples/ content

- [x] Move Debian stages to stages/:
  - [x] Ensure Debian stages integrate with existing stage structure
  - [x] Maintain original stage organization

## Phase 3: Clean Up Root Directory ✅ COMPLETED
- [x] Move Python scripts to appropriate locations:
  - [x] composer_*.py → tools/ (if CLI tools) or osbuild/ (if core modules)
  - [x] debian_*.py → osbuild/ (core modules)
  - [x] build_*.py → osbuild/ (core modules)

- [x] Remove custom build directories:
  - [x] build-environments/ → Move to .osbuild/ or create proper build system integration
  - [x] build-logs/ → Move to .osbuild/ or create proper build system integration
  - [x] artifacts/ → Move to .osbuild/ or create proper build system integration

## Phase 4: Maintain Debian Functionality ✅ COMPLETED
- [x] Ensure Debian stages work with original pipeline system
- [x] Integrate Debian package management with existing stage architecture
- [x] Maintain OSTree support alongside original features

## Implementation Steps
1. [x] Audit current structure against original osbuild repository
2. [x] Create backup of current Debian-specific work
3. [x] Restore original structure from upstream
4. [x] Reintegrate Debian components into proper locations
5. [x] Test functionality to ensure nothing breaks
6. [x] Update documentation to reflect new structure

## Current Structure Issues Identified
- Extra directories: debian-forge-docs/, debian-forge-tests/, build-environments/, build-logs/, artifacts/ ✅ RESOLVED
- Misplaced files: Python scripts in root that should be in tools/ or osbuild/ ✅ RESOLVED
- Missing original structure: Some original directories may be incomplete ✅ VERIFIED COMPLETE
- Custom additions: Debian-specific files mixed with core structure ✅ REORGANIZED

## Priority Order
1. High: Restore core osbuild structure ✅ COMPLETED
2. Medium: Reorganize Debian content ✅ COMPLETED
3. Low: Clean up and optimize ✅ COMPLETED
4. Critical: Maintain all Debian functionality during transition ✅ COMPLETED

## Progress Summary
✅ **Phase 1**: Original structure restored and verified
✅ **Phase 2**: Debian content reorganized into proper locations
✅ **Phase 3**: Root directory cleaned up
✅ **Phase 4**: Debian functionality maintained

## Next Steps
- [x] Run tests to verify functionality
- [x] Update documentation references
- [x] Commit final reorganization
- [ ] Push changes to repository

## File Structure Achieved
The project now maintains the exact same directory structure as the original osbuild repository:
- All core directories present and complete
- All configuration files present
- Debian-specific content properly organized within standard structure
- Root directory clean and matches upstream
- Maintains 1:1 compatibility while preserving Debian functionality

## Final Status: ✅ REORGANIZATION COMPLETE
**All phases completed successfully!** The Debian Forge project now has:
- ✅ 1:1 file structure compatibility with upstream osbuild
- ✅ All Debian-specific functionality preserved and properly organized
- ✅ Clean root directory matching upstream structure
- ✅ Functional build system with Debian stages
- ✅ Proper integration of Debian modules within osbuild package
- ✅ Tested functionality with successful Debian manifest build

## Repository Status
- **Backup branch**: `backup-debian-changes` (contains all original work)
- **Main branch**: Reorganized structure with 1:1 upstream compatibility
- **Ready for**: Push to remote repository and continued development
