u-foo 1.0.0
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.
- package/LICENSE +35 -0
- package/README.md +163 -0
- package/README.zh-CN.md +163 -0
- package/bin/uclaude +65 -0
- package/bin/ucodex +65 -0
- package/bin/ufoo +93 -0
- package/bin/ufoo.js +35 -0
- package/modules/AGENTS.template.md +87 -0
- package/modules/bus/README.md +132 -0
- package/modules/bus/SKILLS/ubus/SKILL.md +209 -0
- package/modules/bus/scripts/bus-alert.sh +185 -0
- package/modules/bus/scripts/bus-listen.sh +117 -0
- package/modules/context/ASSUMPTIONS.md +7 -0
- package/modules/context/CONSTRAINTS.md +7 -0
- package/modules/context/CONTEXT-STRUCTURE.md +49 -0
- package/modules/context/DECISION-PROTOCOL.md +62 -0
- package/modules/context/HANDOFF.md +33 -0
- package/modules/context/README.md +82 -0
- package/modules/context/RULES.md +15 -0
- package/modules/context/SKILLS/README.md +14 -0
- package/modules/context/SKILLS/uctx/SKILL.md +91 -0
- package/modules/context/SYSTEM.md +18 -0
- package/modules/context/TEMPLATES/assumptions.md +4 -0
- package/modules/context/TEMPLATES/constraints.md +4 -0
- package/modules/context/TEMPLATES/decision.md +16 -0
- package/modules/context/TEMPLATES/project-context-readme.md +6 -0
- package/modules/context/TEMPLATES/system.md +3 -0
- package/modules/context/TEMPLATES/terminology.md +4 -0
- package/modules/context/TERMINOLOGY.md +10 -0
- package/modules/resources/ICONS/README.md +12 -0
- package/modules/resources/ICONS/libraries/README.md +17 -0
- package/modules/resources/ICONS/libraries/heroicons/LICENSE +22 -0
- package/modules/resources/ICONS/libraries/heroicons/README.md +15 -0
- package/modules/resources/ICONS/libraries/heroicons/arrow-right.svg +4 -0
- package/modules/resources/ICONS/libraries/heroicons/check.svg +4 -0
- package/modules/resources/ICONS/libraries/heroicons/chevron-down.svg +4 -0
- package/modules/resources/ICONS/libraries/heroicons/cog-6-tooth.svg +5 -0
- package/modules/resources/ICONS/libraries/heroicons/magnifying-glass.svg +4 -0
- package/modules/resources/ICONS/libraries/heroicons/x-mark.svg +4 -0
- package/modules/resources/ICONS/libraries/lucide/LICENSE +40 -0
- package/modules/resources/ICONS/libraries/lucide/README.md +15 -0
- package/modules/resources/ICONS/libraries/lucide/arrow-right.svg +15 -0
- package/modules/resources/ICONS/libraries/lucide/check.svg +14 -0
- package/modules/resources/ICONS/libraries/lucide/chevron-down.svg +14 -0
- package/modules/resources/ICONS/libraries/lucide/search.svg +15 -0
- package/modules/resources/ICONS/libraries/lucide/settings.svg +15 -0
- package/modules/resources/ICONS/libraries/lucide/x.svg +15 -0
- package/modules/resources/ICONS/rules.md +7 -0
- package/modules/resources/README.md +9 -0
- package/modules/resources/UI/ANTI-PATTERNS.md +6 -0
- package/modules/resources/UI/TONE.md +6 -0
- package/package.json +40 -0
- package/scripts/banner.sh +89 -0
- package/scripts/bus-alert.sh +6 -0
- package/scripts/bus-autotrigger.sh +6 -0
- package/scripts/bus-daemon.sh +231 -0
- package/scripts/bus-inject.sh +144 -0
- package/scripts/bus-listen.sh +6 -0
- package/scripts/bus.sh +984 -0
- package/scripts/context-decisions.sh +167 -0
- package/scripts/context-doctor.sh +72 -0
- package/scripts/context-lint.sh +110 -0
- package/scripts/doctor.sh +22 -0
- package/scripts/init.sh +247 -0
- package/scripts/skills.sh +113 -0
- package/scripts/status.sh +125 -0
- package/src/agent/cliRunner.js +190 -0
- package/src/agent/internalRunner.js +212 -0
- package/src/agent/normalizeOutput.js +41 -0
- package/src/agent/ufooAgent.js +222 -0
- package/src/chat/index.js +1603 -0
- package/src/cli.js +349 -0
- package/src/config.js +37 -0
- package/src/daemon/index.js +501 -0
- package/src/daemon/ops.js +120 -0
- package/src/daemon/run.js +41 -0
- package/src/daemon/status.js +78 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# bus-inject.sh
|
|
5
|
+
# Inject `/ubus` command into Terminal.app tab.
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# bash scripts/bus-inject.sh <subscriber-id>
|
|
9
|
+
#
|
|
10
|
+
# Method:
|
|
11
|
+
# - Clipboard paste (Cmd+V) to bypass IME
|
|
12
|
+
# - Accessibility (System Events) for Escape + Paste + Enter
|
|
13
|
+
#
|
|
14
|
+
# Requirements:
|
|
15
|
+
# - macOS Accessibility permission for Terminal (first run will prompt)
|
|
16
|
+
# - Subscriber must have joined via `claude-bus` wrapper
|
|
17
|
+
|
|
18
|
+
BUS_DIR=".ufoo/bus"
|
|
19
|
+
SUBSCRIBER="${1:-}"
|
|
20
|
+
|
|
21
|
+
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
|
|
22
|
+
echo "Usage: bus-inject.sh <subscriber-id>"
|
|
23
|
+
echo ""
|
|
24
|
+
echo "Injects '/ubus' + Enter into Terminal.app tab by tty device."
|
|
25
|
+
echo "The subscriber must have joined from that terminal first."
|
|
26
|
+
exit 0
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
if [[ -z "$SUBSCRIBER" ]]; then
|
|
30
|
+
echo "Error: subscriber ID required" >&2
|
|
31
|
+
echo "Usage: bus-inject.sh <subscriber-id>" >&2
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# Convert subscriber to safe name
|
|
36
|
+
safe_name="${SUBSCRIBER//:/_}"
|
|
37
|
+
tty_file="$BUS_DIR/queues/${safe_name}/tty"
|
|
38
|
+
|
|
39
|
+
if [[ ! -f "$tty_file" ]]; then
|
|
40
|
+
echo "[inject] Error: No tty recorded for $SUBSCRIBER" >&2
|
|
41
|
+
echo "[inject] Make sure to run 'ufoo bus join' from the target terminal first" >&2
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
TARGET_TTY=$(cat "$tty_file")
|
|
46
|
+
echo "[inject] Looking for Terminal tab with tty: $TARGET_TTY"
|
|
47
|
+
|
|
48
|
+
# Determine command based on agent type
|
|
49
|
+
# codex uses "ubus" without slash, claude-code uses "/ubus"
|
|
50
|
+
if [[ "$SUBSCRIBER" == codex:* ]]; then
|
|
51
|
+
INJECT_CMD="ubus"
|
|
52
|
+
else
|
|
53
|
+
INJECT_CMD="/ubus"
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
# Detect terminal type from tty path or environment
|
|
57
|
+
# iTerm2 uses "write text", Terminal.app uses "do script"
|
|
58
|
+
|
|
59
|
+
# Check if iTerm2 is running and has this tty
|
|
60
|
+
USE_ITERM=0
|
|
61
|
+
if pgrep -q "iTerm2"; then
|
|
62
|
+
# Check if iTerm2 has a session with this tty
|
|
63
|
+
if osascript -e 'tell application "iTerm2" to get tty of current session of current window' 2>/dev/null | grep -q "$TARGET_TTY"; then
|
|
64
|
+
USE_ITERM=1
|
|
65
|
+
fi
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
if [[ "$USE_ITERM" == "1" ]]; then
|
|
69
|
+
echo "[inject] Using iTerm2 write text method"
|
|
70
|
+
osascript <<EOF
|
|
71
|
+
tell application "iTerm2"
|
|
72
|
+
activate
|
|
73
|
+
repeat with w in windows
|
|
74
|
+
repeat with t in tabs of w
|
|
75
|
+
repeat with s in sessions of t
|
|
76
|
+
try
|
|
77
|
+
if tty of s is "$TARGET_TTY" then
|
|
78
|
+
select s
|
|
79
|
+
-- Use write text which includes newline automatically
|
|
80
|
+
write text "$INJECT_CMD" to s
|
|
81
|
+
return
|
|
82
|
+
end if
|
|
83
|
+
end try
|
|
84
|
+
end repeat
|
|
85
|
+
end repeat
|
|
86
|
+
end repeat
|
|
87
|
+
error "No iTerm2 session found with tty: $TARGET_TTY"
|
|
88
|
+
end tell
|
|
89
|
+
EOF
|
|
90
|
+
else
|
|
91
|
+
echo "[inject] Using Terminal.app keystroke method (for interactive apps like Codex)"
|
|
92
|
+
osascript <<EOF
|
|
93
|
+
tell application "Terminal"
|
|
94
|
+
set targetWindow to missing value
|
|
95
|
+
set targetTab to missing value
|
|
96
|
+
|
|
97
|
+
repeat with w in windows
|
|
98
|
+
repeat with t in tabs of w
|
|
99
|
+
try
|
|
100
|
+
if tty of t is "$TARGET_TTY" then
|
|
101
|
+
set targetWindow to w
|
|
102
|
+
set targetTab to t
|
|
103
|
+
exit repeat
|
|
104
|
+
end if
|
|
105
|
+
end try
|
|
106
|
+
end repeat
|
|
107
|
+
if targetTab is not missing value then exit repeat
|
|
108
|
+
end repeat
|
|
109
|
+
|
|
110
|
+
if targetTab is missing value then
|
|
111
|
+
error "No Terminal tab found with tty: $TARGET_TTY"
|
|
112
|
+
end if
|
|
113
|
+
|
|
114
|
+
-- Activate and bring to front
|
|
115
|
+
activate
|
|
116
|
+
set selected tab of targetWindow to targetTab
|
|
117
|
+
set index of targetWindow to 1
|
|
118
|
+
end tell
|
|
119
|
+
|
|
120
|
+
-- Save current clipboard, set /ubus, paste, restore
|
|
121
|
+
set oldClipboard to the clipboard
|
|
122
|
+
|
|
123
|
+
set the clipboard to "$INJECT_CMD"
|
|
124
|
+
delay 0.1
|
|
125
|
+
|
|
126
|
+
tell application "System Events"
|
|
127
|
+
tell process "Terminal"
|
|
128
|
+
-- Escape to ensure input mode
|
|
129
|
+
key code 53
|
|
130
|
+
delay 0.1
|
|
131
|
+
-- Cmd+V to paste
|
|
132
|
+
keystroke "v" using command down
|
|
133
|
+
delay 0.2
|
|
134
|
+
-- Enter (Return key)
|
|
135
|
+
keystroke return
|
|
136
|
+
end tell
|
|
137
|
+
end tell
|
|
138
|
+
|
|
139
|
+
delay 0.2
|
|
140
|
+
set the clipboard to oldClipboard
|
|
141
|
+
EOF
|
|
142
|
+
fi
|
|
143
|
+
|
|
144
|
+
echo "[inject] Done"
|