-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfactory.sh
More file actions
executable file
·72 lines (65 loc) · 2.31 KB
/
Copy pathfactory.sh
File metadata and controls
executable file
·72 lines (65 loc) · 2.31 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
#!/bin/bash
# factory.sh — detroit code factory
# Reads next task file from tasks/, ships them as PRs.
# Usage: bash factory.sh [--dry-run] [--issues owner/repo] [--parallel N] [--verify owner/repo [pr]]
#
# Entry point only — the pipeline lives in lib/:
# core.sh logging, status, resolve_gh_repo, lessons, cleanup
# args.sh CLI flag parsing
# factory-md.sh factory.md section/stage/rule parsing
# gates.sh deterministic rule gates
# agent.sh agent CLI invocation (claude, dotbot, grok)
# devserver.sh dev server + test-account helpers
# modes.sh --parallel and --issues modes
# verify-prs.sh --verify mode
# shipped.sh verify_shipped (PR/remote facts)
# code-stage.sh TRIAGE → PLAN → CODE
# pipeline.sh PICK → ROUTE → PREPARE → SCAFFOLD → CODE → GATES → FIX → SHIP
# postship.sh CI → VERIFY → UPDATE → DONE
set -u -o pipefail # no -e: pipeline control flow inspects failures explicitly
DETROIT="${DETROIT_DIR:-$(cd "$(dirname "$0")" && pwd)}"
TASK_DIR="$DETROIT/tasks"
DONE_DIR="$TASK_DIR/done"
FAILED_DIR="$TASK_DIR/failed"
LOCK_DIR="$TASK_DIR/.locks"
PROJECTS="${DETROIT_PROJECTS:-$(dirname "$DETROIT")}"
LOGDIR="$DETROIT/logs"
TIMESTAMP=$(date +"%Y%m%d-%H%M%S")
STATUS_DIR="$DETROIT/.status"
mkdir -p "$LOGDIR" "$DONE_DIR" "$FAILED_DIR" "$LOCK_DIR" "$STATUS_DIR"
AGENT_ID="${DETROIT_AGENT_ID:-0}"
LOGFILE="$LOGDIR/$TIMESTAMP-w$AGENT_ID.log"
WORKTREE_DIR=""
MAIN_REPO_DIR=""
TASK_FILE=""
QUALITY_OK=true
HAS_SHIPPED=false
FACTORY_OK=false
# Force headless browser for all agent-browser calls
export AGENT_BROWSER_HEADED=""
# Shared function libraries (definitions only — no side effects on source)
. "$DETROIT/lib/core.sh"
. "$DETROIT/lib/args.sh"
. "$DETROIT/lib/factory-md.sh"
. "$DETROIT/lib/gates.sh"
. "$DETROIT/lib/agent.sh"
. "$DETROIT/lib/devserver.sh"
. "$DETROIT/lib/modes.sh"
. "$DETROIT/lib/verify-prs.sh"
. "$DETROIT/lib/shipped.sh"
. "$DETROIT/lib/code-stage.sh"
. "$DETROIT/lib/pipeline.sh"
. "$DETROIT/lib/postship.sh"
parse_args "$@" || exit 2
# Ctrl+C cleanup (cleanup() defined in lib/core.sh)
trap cleanup INT
case "$MODE" in
help) usage; exit 0 ;;
parallel) mode_parallel ;;
verify) mode_verify ;;
issues) mode_issues ;;
run)
run_pipeline
run_postship # its final check is the factory run's exit code
;;
esac