loopflow 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- loopflow-0.5.0/.claude/commands/compare.md +75 -0
- loopflow-0.5.0/.claude/commands/debug.md +44 -0
- loopflow-0.5.0/.claude/commands/design.md +63 -0
- loopflow-0.5.0/.claude/commands/draft_commit.md +61 -0
- loopflow-0.5.0/.claude/commands/expand.md +43 -0
- loopflow-0.5.0/.claude/commands/implement.md +47 -0
- loopflow-0.5.0/.claude/commands/iterate.md +43 -0
- loopflow-0.5.0/.claude/commands/polish.md +68 -0
- loopflow-0.5.0/.claude/commands/publish.md +91 -0
- loopflow-0.5.0/.claude/commands/rebase.md +58 -0
- loopflow-0.5.0/.claude/commands/reduce.md +43 -0
- loopflow-0.5.0/.claude/commands/review.md +73 -0
- loopflow-0.5.0/.gitignore +11 -0
- loopflow-0.5.0/PKG-INFO +202 -0
- loopflow-0.5.0/README.md +173 -0
- loopflow-0.5.0/pyproject.toml +65 -0
- loopflow-0.5.0/src/loopflow/LOOPFLOW_STYLE.md +130 -0
- loopflow-0.5.0/src/loopflow/__init__.py +1 -0
- loopflow-0.5.0/src/loopflow/builtins/__init__.py +15 -0
- loopflow-0.5.0/src/loopflow/builtins/commit_message.txt +26 -0
- loopflow-0.5.0/src/loopflow/builtins/pr_message.txt +48 -0
- loopflow-0.5.0/src/loopflow/cli/__init__.py +85 -0
- loopflow-0.5.0/src/loopflow/cli/agent.py +447 -0
- loopflow-0.5.0/src/loopflow/cli/compare.py +199 -0
- loopflow-0.5.0/src/loopflow/cli/land.py +215 -0
- loopflow-0.5.0/src/loopflow/cli/maestro.py +75 -0
- loopflow-0.5.0/src/loopflow/cli/meta.py +327 -0
- loopflow-0.5.0/src/loopflow/cli/ops.py +24 -0
- loopflow-0.5.0/src/loopflow/cli/pr.py +334 -0
- loopflow-0.5.0/src/loopflow/cli/run.py +466 -0
- loopflow-0.5.0/src/loopflow/cli/sessions.py +88 -0
- loopflow-0.5.0/src/loopflow/cli/status.py +49 -0
- loopflow-0.5.0/src/loopflow/config.py +117 -0
- loopflow-0.5.0/src/loopflow/config_template.yaml +49 -0
- loopflow-0.5.0/src/loopflow/context.py +276 -0
- loopflow-0.5.0/src/loopflow/design.py +48 -0
- loopflow-0.5.0/src/loopflow/files.py +242 -0
- loopflow-0.5.0/src/loopflow/git.py +195 -0
- loopflow-0.5.0/src/loopflow/launcher.py +596 -0
- loopflow-0.5.0/src/loopflow/llm_http.py +203 -0
- loopflow-0.5.0/src/loopflow/logging.py +71 -0
- loopflow-0.5.0/src/loopflow/maestro/__init__.py +45 -0
- loopflow-0.5.0/src/loopflow/maestro/agent.py +154 -0
- loopflow-0.5.0/src/loopflow/maestro/agent_runner.py +55 -0
- loopflow-0.5.0/src/loopflow/maestro/agents.py +199 -0
- loopflow-0.5.0/src/loopflow/maestro/api.py +231 -0
- loopflow-0.5.0/src/loopflow/maestro/collector.py +337 -0
- loopflow-0.5.0/src/loopflow/maestro/daemon.py +219 -0
- loopflow-0.5.0/src/loopflow/maestro/db.py +357 -0
- loopflow-0.5.0/src/loopflow/maestro/launchd.py +140 -0
- loopflow-0.5.0/src/loopflow/maestro/markdown.py +185 -0
- loopflow-0.5.0/src/loopflow/maestro/runner.py +501 -0
- loopflow-0.5.0/src/loopflow/maestro/session.py +56 -0
- loopflow-0.5.0/src/loopflow/maestro/triggers.py +91 -0
- loopflow-0.5.0/src/loopflow/maestro/worktree.py +96 -0
- loopflow-0.5.0/src/loopflow/pipeline.py +145 -0
- loopflow-0.5.0/src/loopflow/prompts/CHECKPOINT_MESSAGE.md +29 -0
- loopflow-0.5.0/src/loopflow/prompts/COMMIT_MESSAGE.md +24 -0
- loopflow-0.5.0/src/loopflow/tokens.py +215 -0
- loopflow-0.5.0/src/loopflow/worktrees.py +167 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Compare two implementations and recommend which to use.
|
|
2
|
+
|
|
3
|
+
This task is typically invoked via `lf ops compare <branch-a> <branch-b>`, which injects the diffs below.
|
|
4
|
+
|
|
5
|
+
## Implementation A: {{name_a}}
|
|
6
|
+
|
|
7
|
+
<diff>
|
|
8
|
+
{{diff_a}}
|
|
9
|
+
</diff>
|
|
10
|
+
|
|
11
|
+
## Implementation B: {{name_b}}
|
|
12
|
+
|
|
13
|
+
<diff>
|
|
14
|
+
{{diff_b}}
|
|
15
|
+
</diff>
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
1. Read both diffs to understand what each implementation does
|
|
20
|
+
2. Identify the key differences in approach
|
|
21
|
+
3. Evaluate against loopflow's design principles (below)
|
|
22
|
+
4. Write your analysis to `{{output_dir}}/comparison.md`
|
|
23
|
+
|
|
24
|
+
## What to cover
|
|
25
|
+
|
|
26
|
+
**Approach.** How does each solve the problem? What are the architectural differences? One-paragraph summary for each.
|
|
27
|
+
|
|
28
|
+
**Trade-offs.** What does each gain and lose? Consider:
|
|
29
|
+
- Code complexity (less code is usually better)
|
|
30
|
+
- Match with existing patterns in the codebase
|
|
31
|
+
- Error handling and edge cases
|
|
32
|
+
- Testability
|
|
33
|
+
|
|
34
|
+
**Recommendation.** Which implementation should be used? Be specific. If parts of each are better, note what to cherry-pick.
|
|
35
|
+
|
|
36
|
+
## Evaluation criteria for loopflow
|
|
37
|
+
|
|
38
|
+
When comparing, prefer implementations that:
|
|
39
|
+
|
|
40
|
+
- **Use fewer lines of code.** The best code is code that doesn't exist.
|
|
41
|
+
- **Match existing patterns.** If the codebase uses `@dataclass`, use `@dataclass`. If it uses functions, use functions.
|
|
42
|
+
- **Avoid new abstractions.** Don't prefer the implementation that adds a base class or registry.
|
|
43
|
+
- **Work in auto mode.** Implementations that require interactive confirmation are worse.
|
|
44
|
+
- **Delegate to CLIs.** Implementations that shell out to claude/codex are better than ones that reimplement.
|
|
45
|
+
|
|
46
|
+
## Output format
|
|
47
|
+
|
|
48
|
+
Write to `{{output_dir}}/comparison.md`:
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
# {{name_a}} vs {{name_b}}
|
|
52
|
+
|
|
53
|
+
## Summary
|
|
54
|
+
|
|
55
|
+
<Which to use and why, in 2-3 sentences>
|
|
56
|
+
|
|
57
|
+
## Approach comparison
|
|
58
|
+
|
|
59
|
+
<One paragraph per implementation>
|
|
60
|
+
|
|
61
|
+
## Recommendation
|
|
62
|
+
|
|
63
|
+
<Specific recommendation with rationale>
|
|
64
|
+
|
|
65
|
+
## Cherry-pick opportunities
|
|
66
|
+
|
|
67
|
+
<If applicable: what to take from the non-recommended implementation>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Keep it under 500 words. This is a decision document, not an exhaustive review.
|
|
71
|
+
|
|
72
|
+
## Auto mode
|
|
73
|
+
|
|
74
|
+
In auto/headless runs, do not pause to ask questions. Make the best assumption you can and append any open questions to `.design/questions.md`.
|
|
75
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Debug an error using the stacktrace or error message from clipboard.
|
|
2
|
+
|
|
3
|
+
Run with `-v` to include clipboard content:
|
|
4
|
+
```bash
|
|
5
|
+
lf debug -v
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## Workflow
|
|
9
|
+
|
|
10
|
+
1. Parse the error/stacktrace from the clipboard content
|
|
11
|
+
2. Identify the file and line number where the error originated
|
|
12
|
+
3. Run `git diff main...HEAD -- <file>` to see if this file was changed on this branch
|
|
13
|
+
4. Read the relevant files to understand context
|
|
14
|
+
5. Fix the bug
|
|
15
|
+
6. Run `uv run pytest tests/` to verify the fix doesn't break anything
|
|
16
|
+
|
|
17
|
+
## Debugging strategy
|
|
18
|
+
|
|
19
|
+
**Follow the stack trace.** The deepest frame in your code (not library code) is usually where the problem originates. Start there.
|
|
20
|
+
|
|
21
|
+
**Check recent changes.** If the error is new, run `git diff` to see what changed. The bug is likely in the delta.
|
|
22
|
+
|
|
23
|
+
**Reproduce first.** Before fixing, understand how to trigger the error. A fix you can't verify isn't a fix.
|
|
24
|
+
|
|
25
|
+
## Common patterns in this codebase
|
|
26
|
+
|
|
27
|
+
**Import errors.** Imports are at top of file. Check if a new import was added but not the dependency.
|
|
28
|
+
|
|
29
|
+
**Path errors.** Loopflow uses `Path` objects. Check if something expects a string or vice versa.
|
|
30
|
+
|
|
31
|
+
**Subprocess failures.** Many operations shell out to git, claude, codex. Check if the subprocess command is correct and the tool is available.
|
|
32
|
+
|
|
33
|
+
**Config errors.** `.lf/config.yaml` parsing uses Pydantic. Check if required fields are missing or types are wrong.
|
|
34
|
+
|
|
35
|
+
## Output
|
|
36
|
+
|
|
37
|
+
Fix the bug directly. If the cause isn't obvious from the fix, add a brief inline comment.
|
|
38
|
+
|
|
39
|
+
If you can't determine the cause, describe what you learned and what additional context is needed.
|
|
40
|
+
|
|
41
|
+
## Auto mode
|
|
42
|
+
|
|
43
|
+
In auto/headless runs, do not pause to ask questions. Make the best assumption you can and append any open questions to `.design/questions.md`.
|
|
44
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Produce a short implementation spec that another LLM session can use to write a first draft.
|
|
2
|
+
|
|
3
|
+
The design doc is scaffolding—a checkpoint for recovery, not documentation for posterity. If a session crashes, the spec lets a fresh session pick up where things left off. `lf ops pr land` deletes `.design/` contents.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
1. Run `git branch --show-current` to confirm you're on a feature branch (not `main`)
|
|
8
|
+
2. Create `.design/<feature-name>.md` early—after the first exchange or two
|
|
9
|
+
3. Write as you go, refining with each conversation turn
|
|
10
|
+
4. Run `git add .design/ && git commit -m "design: <branch>"` when done
|
|
11
|
+
5. End session. Implementation happens via `lf implement`.
|
|
12
|
+
|
|
13
|
+
Write as you go, not at the end. If the session crashes mid-design, the partial doc is still useful. Let writing inspire questions—gaps become obvious when you make things concrete.
|
|
14
|
+
|
|
15
|
+
## What makes a good design doc
|
|
16
|
+
|
|
17
|
+
**Heavy on code.** Sketch data structures, function signatures, example API calls. The code is for communication, not execution:
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
@dataclass
|
|
21
|
+
class Worktree:
|
|
22
|
+
path: Path
|
|
23
|
+
branch: str
|
|
24
|
+
|
|
25
|
+
def create_worktree(name: str) -> Worktree:
|
|
26
|
+
"""Create sibling worktree at ../{repo}.{name}"""
|
|
27
|
+
...
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Quote the user verbatim.** When they say something that captures intent, constraint, or priority—copy it into the doc. Quotes anchor what matters and prevent drift.
|
|
31
|
+
|
|
32
|
+
**Specify "done when."** A command to run, output to expect. The implementing session needs to know when to stop.
|
|
33
|
+
|
|
34
|
+
## Required sections (~1000 words max)
|
|
35
|
+
|
|
36
|
+
- **What to build** — One sentence. What exists after this that doesn't exist now.
|
|
37
|
+
- **Data structures** — Core types, sketched in code.
|
|
38
|
+
- **Key functions** — Signatures with one-line intent.
|
|
39
|
+
- **Constraints** — What would require rewriting if guessed wrong.
|
|
40
|
+
- **Done when** — Verification command and expected output.
|
|
41
|
+
|
|
42
|
+
## Loopflow design principles
|
|
43
|
+
|
|
44
|
+
When designing for this codebase:
|
|
45
|
+
|
|
46
|
+
- **Worktrees are first-class.** Features should work across isolated worktrees. Don't assume a single working directory.
|
|
47
|
+
- **Prompts are files, not config.** Task definitions live in `.claude/commands/` or `.lf/`. Don't design template systems or prompt builders.
|
|
48
|
+
- **Design for auto mode.** Most tasks run headless. Don't require interactive confirmation for core flows.
|
|
49
|
+
- **Wrap, don't reimplement.** Loopflow delegates to Claude Code and Codex CLIs. Design to pass through, not duplicate.
|
|
50
|
+
- **Simple data structures.** Prefer `@dataclass` over inheritance hierarchies. Prefer functions over classes when state isn't needed.
|
|
51
|
+
|
|
52
|
+
## Conversation guidance
|
|
53
|
+
|
|
54
|
+
Bias toward brevity. Ask only what's needed to start coding.
|
|
55
|
+
|
|
56
|
+
If scope is unclear, ask "what's the smallest version that's useful?" and spec that.
|
|
57
|
+
|
|
58
|
+
Completeness is not required. Wrong guesses get fixed in implementation. The goal is to not block the implementing session, not to predict everything.
|
|
59
|
+
|
|
60
|
+
## Auto mode
|
|
61
|
+
|
|
62
|
+
In auto/headless runs, do not pause to ask questions. Make the best assumption you can and append any open questions to `.design/questions.md`.
|
|
63
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Draft a commit message for landing this branch.
|
|
2
|
+
|
|
3
|
+
## Workflow
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# 1. See commit history on this branch
|
|
7
|
+
git log main..HEAD --oneline
|
|
8
|
+
|
|
9
|
+
# 2. See all changes
|
|
10
|
+
git diff main...HEAD --stat
|
|
11
|
+
git diff main...HEAD
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the changes and write a commit message to `.lf/COMMIT`.
|
|
15
|
+
|
|
16
|
+
## Commit message format
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
<area>: <summary>
|
|
20
|
+
|
|
21
|
+
<body explaining what and why>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Title:** Lowercase, under 50 chars. Optional area prefix for focused changes.
|
|
25
|
+
|
|
26
|
+
**Body:** One paragraph explaining what this branch accomplished and why. Skip if the title is self-explanatory.
|
|
27
|
+
|
|
28
|
+
## Style examples
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
maestro: add session tracking daemon
|
|
32
|
+
|
|
33
|
+
Sessions now write to SQLite and can be viewed via lf ops status.
|
|
34
|
+
The maestro daemon provides a web UI for tailing logs across worktrees.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
fix worktree cleanup on branch delete
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
prompts: improve expand and iterate focus
|
|
43
|
+
|
|
44
|
+
Both prompts now direct agents to focus on code touched by the current
|
|
45
|
+
branch rather than generic improvements across the codebase.
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## What NOT to do
|
|
49
|
+
|
|
50
|
+
- Don't list individual commits. Summarize the branch's overall change.
|
|
51
|
+
- Don't add "Generated with Claude" or co-author footers.
|
|
52
|
+
- Don't use imperative mood in the body ("Add X" → "X now works").
|
|
53
|
+
|
|
54
|
+
## Output
|
|
55
|
+
|
|
56
|
+
Write the commit message to `.lf/COMMIT`. Tell the user to review it and run `lf ops land` when ready.
|
|
57
|
+
|
|
58
|
+
## Auto mode
|
|
59
|
+
|
|
60
|
+
In auto/headless runs, do not pause to ask questions. Make the best assumption you can and append any open questions to `.design/questions.md`.
|
|
61
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Explore ambitious changes that extend what this branch is already doing.
|
|
2
|
+
|
|
3
|
+
This is for bigger swings—but grounded in the current work. Look at what this branch changes, then ask: what's the natural next step that would multiply the value?
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
1. Run `git diff main...HEAD` to see what this branch has changed
|
|
8
|
+
2. Read the modified files to understand the current direction
|
|
9
|
+
3. Identify one expansion that extends this work meaningfully
|
|
10
|
+
4. Write a design doc to `.design/<expansion-name>.md`
|
|
11
|
+
5. If the expansion is tractable, start building it
|
|
12
|
+
|
|
13
|
+
## What makes a good expansion
|
|
14
|
+
|
|
15
|
+
**Extends the branch's intent.** If this branch adds worktree support, expand might add parallel worktree execution. If it improves commit messages, expand might add PR description generation. The expansion should feel like "part 2" of what's already here.
|
|
16
|
+
|
|
17
|
+
**Multiplicative value.** Changes that make everything else better, not just add one more thing. A new abstraction that simplifies three existing features beats a fourth feature.
|
|
18
|
+
|
|
19
|
+
**Tractable scope.** Ambitious but achievable in one session. If it needs a design doc longer than 500 words, it's too big for expand.
|
|
20
|
+
|
|
21
|
+
## Loopflow's architectural beliefs
|
|
22
|
+
|
|
23
|
+
When expanding, stay aligned with these principles:
|
|
24
|
+
|
|
25
|
+
- **Worktrees over branches.** Agents run in isolated worktrees so you can work in parallel. Expansions should assume multi-worktree workflows.
|
|
26
|
+
- **Prompts are files.** Tasks live in `.claude/commands/` or `.lf/`. Don't add config-driven prompt generation or template engines.
|
|
27
|
+
- **Auto mode is default.** Most tasks run headless with `--print`. Interactive is the exception. Design for unattended execution.
|
|
28
|
+
- **CLI passthrough.** Loopflow wraps Claude Code and Codex CLIs. Don't reimplement their features—pass args through.
|
|
29
|
+
- **Design docs are scaffolding.** `.design/` is for session recovery, not permanent documentation. `lf ops pr land` deletes it.
|
|
30
|
+
- **Simple data, simple APIs.** Prefer dataclasses over complex hierarchies. Prefer functions over classes when state isn't needed.
|
|
31
|
+
|
|
32
|
+
## What to avoid
|
|
33
|
+
|
|
34
|
+
**Unrelated improvements.** The expansion must connect to what this branch is doing. Generic "wouldn't it be nice" ideas belong in a separate branch.
|
|
35
|
+
|
|
36
|
+
**Abstraction layers.** If you're tempted to add a plugin system, registry pattern, or config-driven dispatch, that's a sign to stop and reconsider.
|
|
37
|
+
|
|
38
|
+
**Trend-chasing.** The project should be better at being itself, not more like whatever's popular this month.
|
|
39
|
+
|
|
40
|
+
## Auto mode
|
|
41
|
+
|
|
42
|
+
In auto/headless runs, do not pause to ask questions. Make the best assumption you can and append any open questions to `.design/questions.md`.
|
|
43
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Turn the design doc into working code.
|
|
2
|
+
|
|
3
|
+
The design doc is under `.design/` and auto-included in this prompt. It contains data structures, function signatures, constraints, and a "done when" verification step.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
1. Read the design doc in `.design/` to understand what to build
|
|
8
|
+
2. Read STYLE.md to understand code conventions
|
|
9
|
+
3. Implement data structures first—get the core types right
|
|
10
|
+
4. Implement functions one at a time, following the signatures in the design
|
|
11
|
+
5. Run `uv run pytest tests/` to verify nothing broke
|
|
12
|
+
6. Run the "done when" check from the design doc
|
|
13
|
+
7. Do not commit—leave that to the caller or pipeline
|
|
14
|
+
|
|
15
|
+
## Implementation rules
|
|
16
|
+
|
|
17
|
+
**Match existing patterns.** Before writing new code, find similar code nearby and match its style. If the codebase uses `@dataclass`, use `@dataclass`. If it uses type hints, use type hints.
|
|
18
|
+
|
|
19
|
+
**Stay in scope.** Implement exactly what the design doc describes. If something should be added, note it in `.design/questions.md` but don't build it.
|
|
20
|
+
|
|
21
|
+
**Tests prove it works.** Add tests for user-visible behavior. Don't test implementation details. Don't write tests that just verify mock calls—assert on actual results.
|
|
22
|
+
|
|
23
|
+
**Skip obvious docstrings.** If the function name and types tell the whole story, don't repeat it in prose. No `Args:`/`Returns:` blocks.
|
|
24
|
+
|
|
25
|
+
**Leave the design doc.** Don't delete `.design/*.md`. The review step and landing process handle cleanup.
|
|
26
|
+
|
|
27
|
+
## Loopflow code conventions
|
|
28
|
+
|
|
29
|
+
These are specific to this codebase:
|
|
30
|
+
|
|
31
|
+
- **Use `uv run`** for all Python commands, or activate `.venv` first
|
|
32
|
+
- **Imports at top of file**, never inline
|
|
33
|
+
- **Prefix private functions with `_`**
|
|
34
|
+
- **Return `None` for "not found"**, raise exceptions for "shouldn't happen"
|
|
35
|
+
- **Prefer functions over classes** when you don't need state
|
|
36
|
+
- **No backwards-compatibility shims** unless explicitly required
|
|
37
|
+
|
|
38
|
+
## If something's wrong
|
|
39
|
+
|
|
40
|
+
If the design doc is unclear, make the simplest choice and move on. Note your assumption in `.design/questions.md`. The code can be rewritten if needed.
|
|
41
|
+
|
|
42
|
+
If implementation reveals a design flaw, note it but keep going. The design was scaffolding—reality should diverge when it makes sense.
|
|
43
|
+
|
|
44
|
+
## Auto mode
|
|
45
|
+
|
|
46
|
+
In auto/headless runs, do not pause to ask questions. Make the best assumption you can and append any open questions to `.design/questions.md`.
|
|
47
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Make meaningful improvements to code touched by this branch.
|
|
2
|
+
|
|
3
|
+
Focus on the areas this branch has already modified. The goal is incremental quality improvements that compound—not generic refactoring across the whole codebase.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
1. Run `git diff main...HEAD --stat` to see which files this branch modified
|
|
8
|
+
2. Read those files and identify the highest-impact improvement
|
|
9
|
+
3. Make one focused change—don't scatter effort across multiple areas
|
|
10
|
+
4. Run `uv run pytest tests/` to verify nothing broke
|
|
11
|
+
5. If tests pass, you're done. If not, fix what you broke.
|
|
12
|
+
|
|
13
|
+
## Priority order (within the branch's scope)
|
|
14
|
+
|
|
15
|
+
**1. User experience problems.** Error messages that don't help. Workflows that require too many steps. Missing feedback. Fix the worst friction first.
|
|
16
|
+
|
|
17
|
+
**2. Bugs and edge cases.** Logic errors, off-by-ones, unhandled errors in the modified code.
|
|
18
|
+
|
|
19
|
+
**3. Simplification.** Code that could be deleted. Abstractions that don't earn their keep. Duplication within the changed files.
|
|
20
|
+
|
|
21
|
+
**4. Test coverage.** Missing tests for the new behavior. Tests that verify mock calls instead of results.
|
|
22
|
+
|
|
23
|
+
## Loopflow's quality bar
|
|
24
|
+
|
|
25
|
+
These aren't generic best practices—they're specific to how this codebase works:
|
|
26
|
+
|
|
27
|
+
- **No Args:/Returns: docstrings.** If types are clear, skip the docstring entirely.
|
|
28
|
+
- **Assert on results, not mock calls.** Mocks prevent side effects; tests verify behavior.
|
|
29
|
+
- **One implementation.** No `_v2`, `_old`, `_new` suffixes. Delete the old version.
|
|
30
|
+
- **Errors for users, exceptions for programmers.** Return None for "not found"; raise for "shouldn't happen."
|
|
31
|
+
|
|
32
|
+
## What to avoid
|
|
33
|
+
|
|
34
|
+
**Scope creep.** Only improve code this branch touched. "While I'm here" improvements belong in a separate branch.
|
|
35
|
+
|
|
36
|
+
**Refactoring for style.** Don't rewrite working code because you'd write it differently. Only fix actual problems.
|
|
37
|
+
|
|
38
|
+
**Adding features.** This is about quality, not scope. New capabilities need their own design.
|
|
39
|
+
|
|
40
|
+
## Auto mode
|
|
41
|
+
|
|
42
|
+
In auto/headless runs, do not pause to ask questions. Make the best assumption you can and append any open questions to `.design/questions.md`.
|
|
43
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Fix issues and run tests before landing.
|
|
2
|
+
|
|
3
|
+
The deliverable is working, clean code that passes tests.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
1. **Review and fix**
|
|
8
|
+
- Run `git diff main...HEAD` to see what changed
|
|
9
|
+
- Review against STYLE.md and general code quality
|
|
10
|
+
- Fix bugs, style violations, and unnecessary complexity directly
|
|
11
|
+
- Don't just note issues—fix them
|
|
12
|
+
- Rewrite the primary design doc in `.design/` to match the implementation (keep any decisions log)
|
|
13
|
+
|
|
14
|
+
2. **Test**
|
|
15
|
+
- Run the full test suite: `./dev test` (runs both Python and Swift tests)
|
|
16
|
+
- If tests fail, determine: broken test or broken code?
|
|
17
|
+
- Fix failures one by one, running single tests while debugging
|
|
18
|
+
- Add missing tests for key behavior changes
|
|
19
|
+
- Reduce or simplify existing tests according to new behavioral requirements.
|
|
20
|
+
|
|
21
|
+
For component-specific testing:
|
|
22
|
+
- Python only: `./dev py`
|
|
23
|
+
- Swift only: `./dev swift`
|
|
24
|
+
|
|
25
|
+
## What to fix
|
|
26
|
+
|
|
27
|
+
Focus only on code changed by this branch.
|
|
28
|
+
|
|
29
|
+
**Test failures.** Get the suite green first. Run single tests while debugging:
|
|
30
|
+
```bash
|
|
31
|
+
uv run pytest tests/test_specific.py::test_name -v
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Style violations specific to this codebase:**
|
|
35
|
+
- Remove `Args:`/`Returns:` docstrings when types are clear
|
|
36
|
+
- Move inline imports to top of file
|
|
37
|
+
- Add `_` prefix to private functions
|
|
38
|
+
- Replace tests that assert on mock calls with tests that assert on results
|
|
39
|
+
|
|
40
|
+
**Bugs.** Logic errors, edge cases, off-by-ones in the new code.
|
|
41
|
+
|
|
42
|
+
**Missing tests.** Add tests for user-visible behavior that isn't covered. Keep them short and focused.
|
|
43
|
+
|
|
44
|
+
## What to ignore
|
|
45
|
+
|
|
46
|
+
**Unrelated code.** Don't fix things outside this branch's scope. "While I'm here" improvements belong in a separate branch.
|
|
47
|
+
|
|
48
|
+
**Working code you'd write differently.** Only fix actual problems, not style preferences.
|
|
49
|
+
|
|
50
|
+
**Design doc deviations.** The implementation is the source of truth. Deviations are intentional.
|
|
51
|
+
|
|
52
|
+
## Test standards
|
|
53
|
+
|
|
54
|
+
These are specific to this codebase:
|
|
55
|
+
|
|
56
|
+
- **Test behavior, not implementation.** Assert on what the function returns, not how it works internally.
|
|
57
|
+
- **Mocks prevent side effects.** Use them for network, subprocess, file I/O. But don't assert on mock calls—assert on the result.
|
|
58
|
+
- **Delete flaky tests.** Don't add retries or sleeps. If a test is flaky, it's testing the wrong thing.
|
|
59
|
+
- **One behavior per test.** Short, focused tests that prove one thing works.
|
|
60
|
+
|
|
61
|
+
## Output
|
|
62
|
+
|
|
63
|
+
Fix issues directly. Run tests until they pass. If nothing needs fixing and tests pass, say so.
|
|
64
|
+
|
|
65
|
+
## Auto mode
|
|
66
|
+
|
|
67
|
+
In auto/headless runs, do not pause to ask questions. Make the best assumption you can and append any open questions to `.design/questions.md`.
|
|
68
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Publish the loopflow package to PyPI.
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
lf publish # auto-detect version bump from changes
|
|
5
|
+
lf publish minor # force minor version bump
|
|
6
|
+
lf publish major # force major version bump
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Workflow
|
|
10
|
+
|
|
11
|
+
Execute these steps in order. Stop if any step fails.
|
|
12
|
+
|
|
13
|
+
### 1. Run tests
|
|
14
|
+
```bash
|
|
15
|
+
uv run pytest tests/
|
|
16
|
+
```
|
|
17
|
+
If tests fail, stop and report which tests failed. Do not publish broken code.
|
|
18
|
+
|
|
19
|
+
### 2. Determine version bump
|
|
20
|
+
|
|
21
|
+
Read current version from `src/loopflow/__init__.py`. Then:
|
|
22
|
+
|
|
23
|
+
- If `minor` or `major` was passed as argument, use that
|
|
24
|
+
- Otherwise, analyze `git diff main...HEAD`:
|
|
25
|
+
- **Major**: Breaking changes to CLI flags, removed commands, incompatible config changes
|
|
26
|
+
- **Minor**: New commands, new flags, non-breaking additions (default)
|
|
27
|
+
|
|
28
|
+
Calculate new version (X.Y.Z):
|
|
29
|
+
- Minor: increment Y, reset Z to 0
|
|
30
|
+
- Major: increment X, reset Y and Z to 0
|
|
31
|
+
|
|
32
|
+
### 3. Update version
|
|
33
|
+
Edit `src/loopflow/__init__.py`:
|
|
34
|
+
```python
|
|
35
|
+
__version__ = "X.Y.Z"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 4. Generate release notes
|
|
39
|
+
Write `RELEASE_NOTES.md` (overwrite if exists):
|
|
40
|
+
```markdown
|
|
41
|
+
# vX.Y.Z
|
|
42
|
+
|
|
43
|
+
<2-3 sentence summary>
|
|
44
|
+
|
|
45
|
+
## Changes
|
|
46
|
+
|
|
47
|
+
- <notable change 1>
|
|
48
|
+
- <notable change 2>
|
|
49
|
+
|
|
50
|
+
## Breaking changes
|
|
51
|
+
|
|
52
|
+
<if major bump, list what breaks>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 5. Build and publish
|
|
56
|
+
```bash
|
|
57
|
+
uv build
|
|
58
|
+
uv publish
|
|
59
|
+
```
|
|
60
|
+
Requires `UV_PUBLISH_TOKEN` env var or `~/.pypirc` credentials.
|
|
61
|
+
|
|
62
|
+
### 6. Install locally
|
|
63
|
+
```bash
|
|
64
|
+
uv tool install --force loopflow
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 7. Commit and tag
|
|
68
|
+
```bash
|
|
69
|
+
git add src/loopflow/__init__.py RELEASE_NOTES.md
|
|
70
|
+
git commit -m "release: vX.Y.Z"
|
|
71
|
+
git tag vX.Y.Z
|
|
72
|
+
git push && git push --tags
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## If something fails
|
|
76
|
+
|
|
77
|
+
- **Test failures:** Stop immediately. Report which tests failed.
|
|
78
|
+
- **Build failures:** Check `pyproject.toml`. Common issue: missing file in `[tool.hatch.build]`.
|
|
79
|
+
- **Publish failures:** Check `UV_PUBLISH_TOKEN`. May need to generate new token at pypi.org.
|
|
80
|
+
- **Don't leave partial state.** If publish fails, revert the version bump before stopping.
|
|
81
|
+
|
|
82
|
+
## Output
|
|
83
|
+
|
|
84
|
+
Report each step as it completes. End with:
|
|
85
|
+
- New version number
|
|
86
|
+
- PyPI URL: https://pypi.org/project/loopflow/
|
|
87
|
+
|
|
88
|
+
## Auto mode
|
|
89
|
+
|
|
90
|
+
In auto/headless runs, do not pause to ask questions. Make the best assumption you can and append any open questions to `.design/questions.md`.
|
|
91
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Rebase this branch onto main.
|
|
2
|
+
|
|
3
|
+
## Workflow
|
|
4
|
+
|
|
5
|
+
### 1. Understand the branch's intent
|
|
6
|
+
```bash
|
|
7
|
+
git log main..HEAD --oneline
|
|
8
|
+
git diff main...HEAD --stat
|
|
9
|
+
```
|
|
10
|
+
Note which files this branch modified and what it's trying to accomplish.
|
|
11
|
+
|
|
12
|
+
### 2. Fetch and rebase
|
|
13
|
+
```bash
|
|
14
|
+
git fetch origin main
|
|
15
|
+
git rebase origin/main
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 3. Handle conflicts
|
|
19
|
+
|
|
20
|
+
If conflicts occur:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# See which files have conflicts
|
|
24
|
+
git status
|
|
25
|
+
|
|
26
|
+
# After resolving each file
|
|
27
|
+
git add <file>
|
|
28
|
+
git rebase --continue
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Conflict resolution strategy:**
|
|
32
|
+
|
|
33
|
+
- **Files central to the branch's intent:** Preserve the branch's changes. These are the files listed in `git diff main...HEAD --stat`.
|
|
34
|
+
- **Files outside the branch's scope:** Accept main's version. The branch probably touched these incidentally.
|
|
35
|
+
- **Both versions are valid:** Combine manually if both changes make sense. Otherwise, prefer the branch's version for modified files, main's version for everything else.
|
|
36
|
+
|
|
37
|
+
### 4. Verify and push
|
|
38
|
+
```bash
|
|
39
|
+
# Verify nothing broke
|
|
40
|
+
uv run pytest tests/
|
|
41
|
+
|
|
42
|
+
# Push the rebased branch
|
|
43
|
+
git push --force-with-lease
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## If rebase goes wrong
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Abort and return to pre-rebase state
|
|
50
|
+
git rebase --abort
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Then note what went wrong in `.design/questions.md` and stop.
|
|
54
|
+
|
|
55
|
+
## Auto mode
|
|
56
|
+
|
|
57
|
+
In auto/headless runs, do not pause to ask questions. Make the best assumption you can and append any open questions to `.design/questions.md`.
|
|
58
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Simplify code touched by this branch while preserving user behavior.
|
|
2
|
+
|
|
3
|
+
Focus on trimming complexity within files this branch has already modified. Don't refactor unrelated code.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
1. Run `git diff main...HEAD --stat` to see which files this branch modified
|
|
8
|
+
2. Read those files and identify what can be deleted or simplified
|
|
9
|
+
3. Make one focused simplification
|
|
10
|
+
4. Run `uv run pytest tests/` to verify behavior is preserved
|
|
11
|
+
5. If tests pass, you're done
|
|
12
|
+
|
|
13
|
+
## Priority order
|
|
14
|
+
|
|
15
|
+
1. **Delete dead code.** Unused functions, unreachable branches, obsolete options. If it's not called, delete it.
|
|
16
|
+
2. **Collapse duplication.** Repeated patterns within the changed files. Don't create new abstractions—inline the common code or pick one location.
|
|
17
|
+
3. **Simplify logic.** Replace nested conditionals with early returns. Replace clever code with obvious code.
|
|
18
|
+
4. **Tighten APIs.** Remove optional parameters that are never used. Remove public functions that should be private.
|
|
19
|
+
|
|
20
|
+
## Guardrails
|
|
21
|
+
|
|
22
|
+
**Preserve user behavior.** CLI flags, outputs, and workflows must stay the same. If behavior must change to simplify, document the tradeoff in `.design/questions.md`.
|
|
23
|
+
|
|
24
|
+
**Prefer deletion over rewriting.** The best refactor is code that doesn't exist anymore.
|
|
25
|
+
|
|
26
|
+
**Stay in scope.** Only simplify code this branch touched. "While I'm here" refactoring belongs in a separate branch.
|
|
27
|
+
|
|
28
|
+
**No new abstractions.** If you're tempted to extract a helper, base class, or utility—don't. Reduce means less code, not different code.
|
|
29
|
+
|
|
30
|
+
## Loopflow's simplicity principles
|
|
31
|
+
|
|
32
|
+
- **One implementation.** No `_v2`, `_old`, `_new`. Delete the old version.
|
|
33
|
+
- **No backwards compatibility.** If something's unused, delete it completely. No `_deprecated` stubs.
|
|
34
|
+
- **Functions over classes.** If you can delete a class and use a function, do it.
|
|
35
|
+
- **Inline over abstract.** Three similar lines of code is better than a premature abstraction.
|
|
36
|
+
|
|
37
|
+
## Output
|
|
38
|
+
|
|
39
|
+
Make the simplification directly. Run tests to verify. Note any assumptions in `.design/questions.md`.
|
|
40
|
+
|
|
41
|
+
## Auto mode
|
|
42
|
+
|
|
43
|
+
In auto/headless runs, do not pause to ask questions. Make the best assumption you can and append any open questions to `.design/questions.md`.
|