Quick reference for all modules in the bootstrap source.
Purpose: Central configuration and constants Dependencies: None
| Export | Type | Purpose |
|---|---|---|
VERSION |
str | Script version ("1.0.0") |
EXIT_SUCCESS |
int | Exit code 0 |
EXIT_VALIDATION_ERROR |
int | Exit code 1 |
EXIT_CREATION_ERROR |
int | Exit code 2 |
TIERS |
dict | Tier metadata (Lite, Standard, Enterprise) |
TEMPLATES |
dict | Built-in templates (fastapi, cli, scraper, etc.) |
DEFAULT_DIRECTORIES |
list | Base directory structure |
PHONY_TARGETS |
dict | Makefile targets by tier |
GITIGNORE_PATTERNS |
list | .gitignore template |
from config import VERSION, TIERS
print(f"Bootstrap v{VERSION}")
print(f"Tier 2: {TIERS['2']['name']}") # "Standard"Purpose: Base exceptions, utilities, and validators
Dependencies: config.py
WorkspaceError (base)
├── ValidationError
├── CreationError
├── UpgradeError
├── RollbackError
└── ConfigurationError
validate_project_name(name: str)- Validate project name formatvalidate_tier_upgrade(current, target)- Prevent downgradesvalidate_python_version(version)- Check version formatvalidate_manifest_path(path)- Security: Prevent path traversalvalidate_rollback_backup(name, path)- Verify backup exists
success(msg),error(msg),warning(msg),info(msg)- Colored outputheader(msg),dim(msg)- Formattingshow_progress(step, total, message)- Progress barload_config(path)- Load .gemini-bootstrap.json
Purpose: LLM provider abstraction
Dependencies: config.py, core.py
class LLMProvider:
"""Base interface for LLM providers."""
def generate(self, prompt: str) -> str:
"""Generate content from prompt."""
raise NotImplementedErrorGeminiProvider(Google Gemini)
Purpose: Generate Makefiles for all tiers
Dependencies: config.py
def generate_makefile(tier: str, pkg_name: str) -> str:
"""Generate tier-specific Makefile content."""
# Returns complete Makefile as string| Tier | Unique Targets |
|---|---|
| Lite | run, install |
| Standard | + test, coverage, snapshot |
| Enterprise | + eval, scan, shift-report, lock |
Purpose: Generate file templates
Dependencies: config.py
get_gemini_md(tier)- GEMINI.md constitutionget_audit_script(tier)- Workspace audit scriptget_session_script()- Session trackingget_status_script(tier)- Health dashboardget_doc_indexer()- Documentation indexerget_list_skills_script()- Skill listerget_workspace_schema()- JSON schema for workspace.jsonget_settings_schema()- JSON schema for settings.jsonget_ci_workflow(tier, pkg, py_ver)- GitHub Actions CIget_pre_commit_config()- Pre-commit hooksget_snapshot_script(tier)- Snapshot/restore (Tiers 2-3)
Purpose: Generate dynamic content
Dependencies: config.py, core.py
get_workspace_json(tier, name, parent)- workspace.json metadataget_getting_started(tier, pkg)- Tier-specific quickstart guideget_readme(tier, pkg)- README templateget_roadmap(tier)- Backlog templateget_cheatsheet(tier)- Commands referenceget_archive_workflow()- Deprecation workflowget_test_sample(tier, pkg)- Sample test file
Purpose: Workspace CRUD operations Dependencies: All above modules
def create_workspace(
name: str,
tier: str,
base_path: Path,
template: str | None = None,
git: bool = False,
force: bool = False,
quiet: bool = False
) -> None:
"""Create new workspace with specified tier."""Process:
- Validate inputs
- Create directory structure
- Generate files (Makefile, GEMINI.md, scripts, etc.)
- Set permissions
- Initialize git (if requested)
- Log telemetry (if enabled)
def validate_workspace(workspace_path: Path) -> None:
"""Validate existing workspace structure."""Checks:
- Required files exist (GEMINI.md, Makefile, etc.)
- JSON files valid
- Tier-specific requirements met
def upgrade_workspace(
workspace_path: Path,
target_tier: str,
yes: bool = False
) -> None:
"""Upgrade workspace to higher tier."""Process:
- Validate upgrade path (no downgrades)
- Create backup in
.gemini/backups/ - Add tier-specific directories
- Update files (Makefile, GEMINI.md, etc.)
- Update workspace.json
def rollback_workspace(
workspace_path: Path,
backup_name: str | None = None
) -> None:
"""Restore from backup."""Purpose: CLI entry point Dependencies: All modules
def main() -> int:
"""Main entry point with exception handling."""
try:
return _main_impl()
except WorkspaceError as e:
error(str(e))
return EXIT_WORKSPACE_ERROR
except KeyboardInterrupt:
return EXIT_INTERRUPT# Creation
python bootstrap.py -t 2 -n myapp
# Validation
python bootstrap.py --validate ./myapp
# Upgrade
python bootstrap.py --upgrade ./myapp -t 3
# Templates
python bootstrap.py -t 2 -n api --from-template fastapi
# Options
python bootstrap.py --help
python bootstrap.py --version
python bootstrap.py --list-templates
python bootstrap.py --run-self-testsPurpose: Build modular source → single file Dependencies: None (standalone build script)
- Read
module_orderlist - For each module:
- Read source
- Strip internal imports
- Preserve external imports
- Append to output
- Write to
../bootstrap.py - Make executable
module_order = [
"config.py",
"core.py",
"providers/base.py",
"core/makefile.py",
"core/templates.py",
"content_generators.py",
"operations/create.py",
"__main__.py"
]| Task | Module | Function |
|---|---|---|
| Validate project name | core.py |
validate_project_name() |
| Generate Makefile | core/makefile.py |
generate_makefile() |
| Create workspace | operations/create.py |
create_workspace() |
| Handle errors | core.py |
Exception hierarchy |
| Build bootstrap | build.py |
main() |
- Source: This repository (
source-workspace/) - Compiled:
../bootstrap.py - Build Script:
build.py - Tests:
tests/(to be implemented)
Last Updated: 2026-01-28