yitongl commited on
Commit
20666a8
·
1 Parent(s): 9b8961f

Document project-aware autorun aliases

Browse files
Files changed (2) hide show
  1. LOCAL_SETUP.txt +92 -0
  2. README.md +7 -0
LOCAL_SETUP.txt ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # codex_exec local shell setup
2
+ # ============================
3
+ #
4
+ # This file records the local runx/rund setup used on this machine. It is
5
+ # also valid Bash and can be copied directly to $HOME/.bash_aliases.
6
+ #
7
+ # Required files:
8
+ # runx: $HOME/codex_auto_run.py
9
+ # rund: $HOME/claude_auto_run.py (not included in this repository)
10
+ #
11
+ # Install and reload:
12
+ # cp LOCAL_SETUP.txt $HOME/.bash_aliases
13
+ # source $HOME/.bashrc
14
+
15
+ unalias runx rund 2>/dev/null || true
16
+
17
+ _autorun_dir_name() {
18
+ local rel
19
+
20
+ if [[ "$PWD" == "$HOME" ]]; then
21
+ rel="home"
22
+ elif [[ "$PWD" == "$HOME/"* ]]; then
23
+ rel="${PWD#"$HOME"/}"
24
+ else
25
+ rel="${PWD#/}"
26
+ fi
27
+
28
+ rel="${rel//\//-}"
29
+ rel="${rel//[^A-Za-z0-9_-]/-}"
30
+ while [[ "$rel" == *--* ]]; do
31
+ rel="${rel//--/-}"
32
+ done
33
+ while [[ -n "$rel" && ! "${rel:0:1}" =~ [A-Za-z0-9] ]]; do
34
+ rel="${rel:1}"
35
+ done
36
+ [[ -n "$rel" ]] || rel="home"
37
+
38
+ # codex_auto_run.py limits a session prefix to 48 characters.
39
+ if (( ${#rel} > 45 )); then
40
+ rel="${rel:0:28}-${rel: -16}"
41
+ fi
42
+ printf '%s' "$rel"
43
+ }
44
+
45
+ runx() {
46
+ local base
47
+ base="$(_autorun_dir_name)"
48
+ python3 "$HOME/codex_auto_run.py" --session-prefix "${base}-x" "$@"
49
+ }
50
+
51
+ rund() {
52
+ local base
53
+ base="$(_autorun_dir_name)"
54
+ python3 "$HOME/claude_auto_run.py" --session-prefix "${base}-d" "$@"
55
+ }
56
+
57
+ # Usage:
58
+ # cd $HOME/code/my_project
59
+ # runx
60
+ # rund
61
+ #
62
+ # Start with an initial prompt:
63
+ # runx -p "Inspect the project, make the requested changes, and run tests."
64
+ # rund -p "Inspect the project, make the requested changes, and run tests."
65
+ #
66
+ # Enable Codex web search:
67
+ # runx -p "Research and complete the task." -- --search
68
+ #
69
+ # Because the launchers default to the current directory, -C is unnecessary
70
+ # after cd. Additional arguments are passed through unchanged.
71
+ #
72
+ # Tmux naming for $HOME/code/my_project:
73
+ # code-my_project-x Codex / runx
74
+ # code-my_project-d Claude / rund
75
+ #
76
+ # The launcher appends a timestamp/PID uniqueness suffix to the actual tmux
77
+ # session name. The -x and -d suffixes deliberately keep the Codex and Claude
78
+ # approval watchers from scanning each other's sessions.
79
+ #
80
+ # Run status or stop commands from the same project directory so the dynamic
81
+ # prefix matches:
82
+ # runx --status
83
+ # rund --status
84
+ # runx --stop-daemon
85
+ # rund --stop-daemon
86
+ #
87
+ # Optional global Codex skill on this machine:
88
+ # Path: $HOME/.codex/skills/codex-autorun
89
+ # Invoke: $codex-autorun
90
+ #
91
+ # The filesystem skill name uses a hyphen because Codex skill identifiers do
92
+ # not allow underscores; its UI display name is codex_autorun.
README.md CHANGED
@@ -152,6 +152,13 @@ By default, private watcher state and logs are stored under `~/.runtime/codex-au
152
 
153
  Run `./codex_auto_run.py --help` for all tuning and safety options.
154
 
 
 
 
 
 
 
 
155
  ## Tests
156
 
157
  The unit tests exercise approval-screen detection, argument validation, resume command construction, binary probing, `tmux` command construction, and daemon lifecycle safeguards without starting a real Codex session:
 
152
 
153
  Run `./codex_auto_run.py --help` for all tuning and safety options.
154
 
155
+ ## Optional shell aliases
156
+
157
+ [`LOCAL_SETUP.txt`](LOCAL_SETUP.txt) contains the current `runx`/`rund` Bash
158
+ functions, project-relative tmux naming rules, usage examples, and the local
159
+ `codex-autorun` skill location. The `rund` function expects a separate
160
+ `~/claude_auto_run.py`, which is not included in this repository.
161
+
162
  ## Tests
163
 
164
  The unit tests exercise approval-screen detection, argument validation, resume command construction, binary probing, `tmux` command construction, and daemon lifecycle safeguards without starting a real Codex session: