Repository navigation
Expand file tree
/
Copy pathbundle_source.py
More file actions
80 lines (68 loc) · 2.27 KB
/
Copy pathbundle_source.py
File metadata and controls
80 lines (68 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env python3
"""Bundle all Contractor OS source files into one copy-paste document."""
import os
FILES = [
# Backend
"backend/server.py",
"backend/estimator.py",
"backend/seed_data.py",
"backend/requirements.txt",
"backend/.env",
# Frontend config
"frontend/package.json",
"frontend/app.json",
# Frontend shared
"frontend/src/theme.ts",
"frontend/src/api/client.ts",
"frontend/src/context/AuthContext.tsx",
"frontend/src/components/ui.tsx",
"frontend/src/components/Estimator.tsx",
# Frontend routes
"frontend/app/_layout.tsx",
"frontend/app/index.tsx",
"frontend/app/login.tsx",
"frontend/app/(tabs)/_layout.tsx",
"frontend/app/(tabs)/index.tsx",
"frontend/app/(tabs)/crm.tsx",
"frontend/app/(tabs)/quotes.tsx",
"frontend/app/(tabs)/jobs.tsx",
]
ROOT = "/app"
OUT = "/app/contractor_os_full_source.md"
LANG = {".py": "python", ".ts": "typescript", ".tsx": "tsx",
".json": "json", ".env": "bash", ".txt": "text"}
def lang_for(path):
if path.endswith(".env"):
return "bash"
_, ext = os.path.splitext(path)
return LANG.get(ext, "text")
def main():
parts = []
parts.append("# CONTRACTOR OS — Full Source Code\n")
parts.append("Stack: FastAPI + MongoDB (backend) · Expo React Native / expo-router (frontend)\n")
parts.append("\n## File Index\n")
for f in FILES:
parts.append(f"- `{f}`\n")
parts.append("\n---\n")
for f in FILES:
full = os.path.join(ROOT, f)
if not os.path.exists(full):
continue
with open(full, "r") as fh:
content = fh.read()
# Redact secret values in .env
if f.endswith(".env"):
lines = []
for ln in content.splitlines():
if ln.startswith("JWT_SECRET"):
ln = 'JWT_SECRET="<your-secret-here>"'
lines.append(ln)
content = "\n".join(lines)
parts.append(f"\n\n## `{f}`\n\n```{lang_for(f)}\n{content}\n```\n")
with open(OUT, "w") as out:
out.write("".join(parts))
size = os.path.getsize(OUT)
lines = sum(1 for _ in open(OUT))
print(f"Wrote {OUT} ({size:,} bytes, {lines:,} lines) from {len(FILES)} files")
if __name__ == "__main__":
main()