blob: 7511090a45edad922b01c960f52e3bd3b3a8ada8 (
plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
# Development Tools and Workflow
## Tools
### run.sh
`run.sh` is a convenience wrapper that builds (if needed) and runs a namespace.
Examples:
```bash
Omni/Ide/run.sh Omni/Task.hs # Build and run task manager
Omni/Ide/run.sh Biz/PodcastItLater/Web.py # Build and run web server
```
This script will:
1. Check if the binary exists in `_/bin/`
2. Build it if it doesn't exist (exits on build failure)
3. Execute the binary with any additional arguments
### lint
Universal lint and formatting tool. Errors if lints fail or code is not formatted properly.
Examples:
```bash
lint Omni/Cli.hs # Lint a namespace
lint --fix **/*.py # Lint and fix all Python files
```
### repl.sh
Like `nix-shell` but specific to this repo. Analyzes the namespace, pulls dependencies, and starts a shell or repl.
Examples:
```bash
repl.sh Omni/Bild.hs # Start Haskell repl with namespace loaded
repl.sh --bash Omni/Log.py # Start bash shell for namespace
```
### typecheck.sh
Like `lint` but only runs type checkers. Currently just supports Python with `mypy`, but eventually will support everything that `bild` supports.
Examples:
```bash
typecheck.sh Omni/Bild/Example.py # Run the typechecker and report any errors
```
### Test Commands
Run tests:
```bash
bild --test Omni/Task.hs # Build and test a namespace
```
The convention for all programs in the omnirepo is to run their tests if the first argument is `test`. So for example:
```bash
# this will build a the latest executable and then run tests
bild --test Omni/Task.hs
# this will just run the tests from the existing executable
_/bin/task test
```
## Git Workflow
### Use git-branchless
This repository uses **git-branchless** for a patch-based workflow instead of traditional branch-based git.
Key concepts:
- Work with **patches** (commits) directly rather than branches
- Use **stacking** to organize related changes
- Leverage **smartlog** to visualize commit history
### Common git-branchless Commands
**View commit graph:**
```bash
git smartlog
```
**Create a new commit:**
```bash
# Make your changes
git add .
git commit -m "Your commit message"
```
**Amend the current commit:**
```bash
# Make additional changes
git add .
git amend
```
**Move/restack commits:**
```bash
git move -s <source> -d <destination>
git restack
```
### When to Record Changes in Git
**DO record in git:**
- Completed features or bug fixes
- Working code that passes tests and linting
- Significant milestones in task completion
**DO NOT record in git:**
- Work in progress (unless specifically requested)
- Broken or untested code
- Temporary debugging changes
**NEVER do these git operations without explicit user request:**
- ❌ `git push` - NEVER push to remote unless explicitly asked
- ❌ `git pull` - NEVER pull from remote unless explicitly asked
- ❌ Force pushes or destructive operations
- ❌ Branch deletion or remote branch operations
**Why:** The user maintains control over when code is shared with collaborators. Always ask before syncing with remote repositories.
### Workflow Best Practices
1. **Make small, focused commits** - Each commit should represent one logical change
2. **Write descriptive commit messages** - Explain what and why, not just what
3. **Rebase and clean up history** - Use `git commit --amend` and `git restack` to keep history clean
4. **Test before committing** - Run `bild --test` and `lint` on affected namespaces
### Required Checks Before Completing Tasks
After completing a task, **always** run these commands for the namespace(s) you modified:
```bash
# Run tests
bild --test Omni/YourNamespace.hs
# Run linter
lint Omni/YourNamespace.hs
```
**Fix all reported errors** related to your changes before marking the task as complete. This ensures code quality and prevents breaking the build for other contributors.
|