u-foo 1.0.3 → 1.0.6
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/README.md +67 -8
- package/README.zh-CN.md +9 -7
- package/SKILLS/ufoo/SKILL.md +117 -0
- package/SKILLS/uinit/SKILL.md +73 -0
- package/SKILLS/ustatus/SKILL.md +36 -0
- package/bin/uclaude.js +13 -0
- package/bin/ucodex.js +13 -0
- package/bin/ufoo +9 -31
- package/bin/ufoo.js +13 -0
- package/modules/AGENTS.template.md +15 -7
- package/modules/bus/README.md +28 -23
- package/modules/bus/SKILLS/ubus/SKILL.md +18 -8
- package/modules/context/README.md +18 -40
- package/modules/context/SKILLS/uctx/SKILL.md +61 -1
- package/package.json +16 -4
- package/scripts/.archived/bash-to-js-migration/README.md +46 -0
- package/scripts/.archived/bash-to-js-migration/banner.sh +89 -0
- package/scripts/{bus-inject.sh → .archived/bash-to-js-migration/bus-inject.sh} +35 -3
- package/scripts/{bus.sh → .archived/bash-to-js-migration/bus.sh} +3 -1
- package/scripts/banner.sh +2 -89
- package/scripts/postinstall.js +59 -0
- package/src/agent/cliRunner.js +33 -5
- package/src/agent/internalRunner.js +78 -51
- package/src/agent/launcher.js +702 -0
- package/src/agent/notifier.js +200 -0
- package/src/agent/ptyRunner.js +377 -0
- package/src/agent/ptyWrapper.js +354 -0
- package/src/agent/readyDetector.js +159 -0
- package/src/agent/ufooAgent.js +37 -42
- package/src/bus/API_DESIGN.md +204 -0
- package/src/bus/activate.js +156 -0
- package/src/bus/daemon.js +308 -0
- package/src/bus/index.js +785 -0
- package/src/bus/inject.js +285 -0
- package/src/bus/message.js +302 -0
- package/src/bus/nickname.js +86 -0
- package/src/bus/queue.js +131 -0
- package/src/bus/shake.js +26 -0
- package/src/bus/subscriber.js +296 -0
- package/src/bus/utils.js +357 -0
- package/src/chat/index.js +1842 -249
- package/src/cli.js +658 -95
- package/src/config.js +9 -2
- package/src/context/decisions.js +314 -0
- package/src/context/doctor.js +183 -0
- package/src/context/index.js +38 -0
- package/src/daemon/index.js +749 -94
- package/src/daemon/ops.js +395 -51
- package/src/daemon/providerSessions.js +291 -0
- package/src/daemon/run.js +34 -1
- package/src/daemon/status.js +24 -7
- package/src/doctor/index.js +50 -0
- package/src/init/index.js +264 -0
- package/src/skills/index.js +159 -0
- package/src/status/index.js +252 -0
- package/src/terminal/detect.js +64 -0
- package/src/terminal/index.js +8 -0
- package/src/terminal/iterm2.js +126 -0
- package/src/ufoo/agentsStore.js +41 -0
- package/src/ufoo/paths.js +46 -0
- package/src/utils/banner.js +73 -0
- package/bin/uclaude +0 -65
- package/bin/ucodex +0 -65
- package/modules/bus/scripts/bus-alert.sh +0 -185
- package/modules/bus/scripts/bus-listen.sh +0 -117
- package/modules/context/ASSUMPTIONS.md +0 -7
- package/modules/context/CONSTRAINTS.md +0 -7
- package/modules/context/CONTEXT-STRUCTURE.md +0 -49
- package/modules/context/DECISION-PROTOCOL.md +0 -62
- package/modules/context/HANDOFF.md +0 -33
- package/modules/context/RULES.md +0 -15
- package/modules/context/SKILLS/README.md +0 -14
- package/modules/context/SYSTEM.md +0 -18
- package/modules/context/TEMPLATES/assumptions.md +0 -4
- package/modules/context/TEMPLATES/constraints.md +0 -4
- package/modules/context/TEMPLATES/decision.md +0 -16
- package/modules/context/TEMPLATES/project-context-readme.md +0 -6
- package/modules/context/TEMPLATES/system.md +0 -3
- package/modules/context/TEMPLATES/terminology.md +0 -4
- package/modules/context/TERMINOLOGY.md +0 -10
- /package/scripts/{bus-alert.sh → .archived/bash-to-js-migration/bus-alert.sh} +0 -0
- /package/scripts/{bus-autotrigger.sh → .archived/bash-to-js-migration/bus-autotrigger.sh} +0 -0
- /package/scripts/{bus-daemon.sh → .archived/bash-to-js-migration/bus-daemon.sh} +0 -0
- /package/scripts/{bus-listen.sh → .archived/bash-to-js-migration/bus-listen.sh} +0 -0
- /package/scripts/{context-decisions.sh → .archived/bash-to-js-migration/context-decisions.sh} +0 -0
- /package/scripts/{context-doctor.sh → .archived/bash-to-js-migration/context-doctor.sh} +0 -0
- /package/scripts/{context-lint.sh → .archived/bash-to-js-migration/context-lint.sh} +0 -0
- /package/scripts/{doctor.sh → .archived/bash-to-js-migration/doctor.sh} +0 -0
- /package/scripts/{init.sh → .archived/bash-to-js-migration/init.sh} +0 -0
- /package/scripts/{skills.sh → .archived/bash-to-js-migration/skills.sh} +0 -0
- /package/scripts/{status.sh → .archived/bash-to-js-migration/status.sh} +0 -0
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
# bus-listen.sh
|
|
5
|
-
# Foreground listener that prints incoming messages.
|
|
6
|
-
#
|
|
7
|
-
# Usage:
|
|
8
|
-
# bash bus-listen.sh <subscriber> [options]
|
|
9
|
-
#
|
|
10
|
-
# Options:
|
|
11
|
-
# --from-beginning Print existing queued messages first
|
|
12
|
-
# --reset Truncate pending queue before listening
|
|
13
|
-
# --auto-join Auto-join bus to get subscriber ID
|
|
14
|
-
|
|
15
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
16
|
-
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
|
17
|
-
BUS_DIR=".ufoo/bus"
|
|
18
|
-
FROM_BEGINNING=0
|
|
19
|
-
RESET=0
|
|
20
|
-
AUTO_JOIN=0
|
|
21
|
-
|
|
22
|
-
SUBSCRIBER="${1:-}"
|
|
23
|
-
shift || true
|
|
24
|
-
|
|
25
|
-
while [[ $# -gt 0 ]]; do
|
|
26
|
-
case "$1" in
|
|
27
|
-
--from-beginning)
|
|
28
|
-
FROM_BEGINNING=1
|
|
29
|
-
shift
|
|
30
|
-
;;
|
|
31
|
-
--reset)
|
|
32
|
-
RESET=1
|
|
33
|
-
shift
|
|
34
|
-
;;
|
|
35
|
-
--auto-join)
|
|
36
|
-
AUTO_JOIN=1
|
|
37
|
-
shift
|
|
38
|
-
;;
|
|
39
|
-
*)
|
|
40
|
-
shift
|
|
41
|
-
;;
|
|
42
|
-
esac
|
|
43
|
-
done
|
|
44
|
-
|
|
45
|
-
# Auto-join if requested
|
|
46
|
-
if [[ "$AUTO_JOIN" == "1" ]] && [[ -z "$SUBSCRIBER" ]]; then
|
|
47
|
-
SUBSCRIBER="$(ufoo bus join 2>/dev/null | tail -1)"
|
|
48
|
-
echo "[listen] Auto-joined as: $SUBSCRIBER"
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
if [[ -z "$SUBSCRIBER" ]]; then
|
|
52
|
-
echo "Usage: bus-listen.sh <subscriber> [options]" >&2
|
|
53
|
-
echo " or: bus-listen.sh --auto-join" >&2
|
|
54
|
-
exit 1
|
|
55
|
-
fi
|
|
56
|
-
|
|
57
|
-
# Sanitize subscriber for filename
|
|
58
|
-
SAFE_SUB="${SUBSCRIBER//:/_}"
|
|
59
|
-
QUEUE_FILE="$BUS_DIR/queues/${SAFE_SUB}/pending.jsonl"
|
|
60
|
-
QUEUE_DIR="$BUS_DIR/queues/${SAFE_SUB}"
|
|
61
|
-
|
|
62
|
-
mkdir -p "$QUEUE_DIR"
|
|
63
|
-
touch "$QUEUE_FILE"
|
|
64
|
-
|
|
65
|
-
# Reset queue if requested
|
|
66
|
-
if [[ "$RESET" == "1" ]]; then
|
|
67
|
-
echo "[listen] Resetting queue..."
|
|
68
|
-
: > "$QUEUE_FILE"
|
|
69
|
-
fi
|
|
70
|
-
|
|
71
|
-
# Print existing messages if requested
|
|
72
|
-
if [[ "$FROM_BEGINNING" == "1" ]] && [[ -s "$QUEUE_FILE" ]]; then
|
|
73
|
-
echo "[listen] Existing messages:"
|
|
74
|
-
echo "---"
|
|
75
|
-
while IFS= read -r line; do
|
|
76
|
-
# Parse JSON and extract message
|
|
77
|
-
msg="$(echo "$line" | jq -r '.data.message // .data // .' 2>/dev/null || echo "$line")"
|
|
78
|
-
from="$(echo "$line" | jq -r '.publisher // "unknown"' 2>/dev/null || echo "unknown")"
|
|
79
|
-
ts="$(echo "$line" | jq -r '.ts // ""' 2>/dev/null || echo "")"
|
|
80
|
-
short_ts="${ts:11:8}" # Extract HH:MM:SS
|
|
81
|
-
echo "[$short_ts] <$from> $msg"
|
|
82
|
-
done < "$QUEUE_FILE"
|
|
83
|
-
echo "---"
|
|
84
|
-
fi
|
|
85
|
-
|
|
86
|
-
echo "[listen] Listening for new messages... (Ctrl+C to stop)"
|
|
87
|
-
|
|
88
|
-
# Track last line count
|
|
89
|
-
LAST_LINES=0
|
|
90
|
-
if [[ -s "$QUEUE_FILE" ]]; then
|
|
91
|
-
LAST_LINES="$(wc -l < "$QUEUE_FILE" | tr -d ' ')"
|
|
92
|
-
fi
|
|
93
|
-
|
|
94
|
-
while true; do
|
|
95
|
-
if [[ -f "$QUEUE_FILE" ]]; then
|
|
96
|
-
CURRENT_LINES="$(wc -l < "$QUEUE_FILE" | tr -d ' ')"
|
|
97
|
-
|
|
98
|
-
if [[ "$CURRENT_LINES" -gt "$LAST_LINES" ]]; then
|
|
99
|
-
# Read new lines
|
|
100
|
-
tail -n "+$((LAST_LINES + 1))" "$QUEUE_FILE" | while IFS= read -r line; do
|
|
101
|
-
msg="$(echo "$line" | jq -r '.data.message // .data // .' 2>/dev/null || echo "$line")"
|
|
102
|
-
from="$(echo "$line" | jq -r '.publisher // "unknown"' 2>/dev/null || echo "unknown")"
|
|
103
|
-
ts="$(echo "$line" | jq -r '.ts // ""' 2>/dev/null || echo "")"
|
|
104
|
-
short_ts="${ts:11:8}"
|
|
105
|
-
|
|
106
|
-
# Bell notification
|
|
107
|
-
printf '\a'
|
|
108
|
-
|
|
109
|
-
echo "[$short_ts] <$from> $msg"
|
|
110
|
-
done
|
|
111
|
-
|
|
112
|
-
LAST_LINES="$CURRENT_LINES"
|
|
113
|
-
fi
|
|
114
|
-
fi
|
|
115
|
-
|
|
116
|
-
sleep 1
|
|
117
|
-
done
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# Context Structure
|
|
2
|
-
|
|
3
|
-
## Global (read-only)
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
~/.ufoo/
|
|
7
|
-
└── modules/
|
|
8
|
-
└── context/ # installed context module
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
- **Read-only**
|
|
12
|
-
- Template source for init
|
|
13
|
-
- No decisions, no assumptions
|
|
14
|
-
- Law, not truth
|
|
15
|
-
|
|
16
|
-
## Project-local (writable)
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
<project>/
|
|
20
|
-
└── .context/
|
|
21
|
-
├── README.md
|
|
22
|
-
├── SYSTEM.md
|
|
23
|
-
├── CONSTRAINTS.md
|
|
24
|
-
├── ASSUMPTIONS.md
|
|
25
|
-
├── TERMINOLOGY.md
|
|
26
|
-
└── DECISIONS/
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
- **In the repo** — can diff, can review
|
|
30
|
-
- This is where truth lives
|
|
31
|
-
- Must be versionable
|
|
32
|
-
|
|
33
|
-
## Required files (project)
|
|
34
|
-
|
|
35
|
-
| File | Purpose |
|
|
36
|
-
|------|---------|
|
|
37
|
-
| README.md | Entry point; how to use this context |
|
|
38
|
-
| SYSTEM.md | Project architecture and purpose |
|
|
39
|
-
| CONSTRAINTS.md | Non-negotiable rules |
|
|
40
|
-
| ASSUMPTIONS.md | Current assumptions (update when changed) |
|
|
41
|
-
| TERMINOLOGY.md | Shared vocabulary |
|
|
42
|
-
| DECISIONS/ | Append-only decision log |
|
|
43
|
-
|
|
44
|
-
## Red line
|
|
45
|
-
|
|
46
|
-
**Never write decisions or assumptions to global.**
|
|
47
|
-
|
|
48
|
-
Global = law.
|
|
49
|
-
Project = truth.
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# Decision Protocol
|
|
2
|
-
|
|
3
|
-
## What is a Decision?
|
|
4
|
-
|
|
5
|
-
A decision is any new or changed “shared truth” that affects future work, including:
|
|
6
|
-
- Architecture
|
|
7
|
-
- Semantics
|
|
8
|
-
- Roles or responsibilities
|
|
9
|
-
- UI meaning or behavior
|
|
10
|
-
- Naming or structure
|
|
11
|
-
- Installation / distribution / tooling workflows
|
|
12
|
-
- Trade-offs and “we chose X over Y”
|
|
13
|
-
|
|
14
|
-
## Triage (Must / Ask / Skip)
|
|
15
|
-
|
|
16
|
-
### Must record (no confirmation needed)
|
|
17
|
-
|
|
18
|
-
Write a decision **before replying** when you do any of the following:
|
|
19
|
-
|
|
20
|
-
- Provide an evaluation / analysis / recommendation that could steer future work
|
|
21
|
-
- Propose an improvement plan or a set of next steps
|
|
22
|
-
- Introduce or change any rule/constraint/process
|
|
23
|
-
- Choose a default (e.g. install method, folder structure, version pinning policy)
|
|
24
|
-
- Decide between alternatives (trade-off)
|
|
25
|
-
|
|
26
|
-
### Ask first (medium importance)
|
|
27
|
-
|
|
28
|
-
If you’re unsure whether the recommendation should become shared truth, ask:
|
|
29
|
-
|
|
30
|
-
> “Should I record a decision for X?”
|
|
31
|
-
|
|
32
|
-
Examples:
|
|
33
|
-
- Optional refactors or style preferences
|
|
34
|
-
- Suggestions that depend on missing info (URL, constraints, team preference)
|
|
35
|
-
- Reversible tweaks that may not be adopted
|
|
36
|
-
|
|
37
|
-
### Skip (not worth a decision)
|
|
38
|
-
|
|
39
|
-
Do **not** write a decision for:
|
|
40
|
-
|
|
41
|
-
- One-off clarifications or Q&A that doesn’t change future behavior
|
|
42
|
-
- Trivial edits (formatting, typos) with no semantic impact
|
|
43
|
-
- Ephemeral runtime details (logs, transient errors) unless they affect policy
|
|
44
|
-
|
|
45
|
-
## Where Decisions Live
|
|
46
|
-
|
|
47
|
-
- **Never** write decisions to global `~/.context/` (global = law).
|
|
48
|
-
- Always write decisions to the project-local log:
|
|
49
|
-
- `<project>/.context/DECISIONS/`
|
|
50
|
-
- For this repo, that is: `.context/DECISIONS/`
|
|
51
|
-
|
|
52
|
-
## Rules
|
|
53
|
-
|
|
54
|
-
- Decisions are append-only.
|
|
55
|
-
- Do not rewrite history.
|
|
56
|
-
- AI agents are allowed to write decisions.
|
|
57
|
-
|
|
58
|
-
## Minimum Content
|
|
59
|
-
|
|
60
|
-
- Context: why this matters now
|
|
61
|
-
- Decision: what is now considered true
|
|
62
|
-
- Implications: what must follow from this
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# AI Handoff Protocol
|
|
2
|
-
|
|
3
|
-
## When taking over work
|
|
4
|
-
|
|
5
|
-
1. Read this repository (global protocol).
|
|
6
|
-
2. Read the project-local `.context/`.
|
|
7
|
-
3. Check for open decisions: `bash scripts/context-decisions.sh -l`
|
|
8
|
-
|
|
9
|
-
## Processing open decisions
|
|
10
|
-
|
|
11
|
-
Open decisions are messages from other agents. You MUST:
|
|
12
|
-
|
|
13
|
-
1. **Read** — Read the full content, not just the title.
|
|
14
|
-
2. **Understand** — Sync their decisions to your understanding.
|
|
15
|
-
3. **Execute** — If action is required, do it first.
|
|
16
|
-
4. **Verify** — Confirm the action succeeded.
|
|
17
|
-
5. **Resolve** — Only then mark as resolved.
|
|
18
|
-
|
|
19
|
-
```yaml
|
|
20
|
-
---
|
|
21
|
-
status: resolved
|
|
22
|
-
resolved_by: <your-agent-name>
|
|
23
|
-
resolved_at: <date>
|
|
24
|
-
---
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**NEVER resolve blindly.** This defeats the purpose of multi-agent collaboration.
|
|
28
|
-
|
|
29
|
-
## Before finishing work
|
|
30
|
-
|
|
31
|
-
- Declare whether any new decisions were introduced.
|
|
32
|
-
- Ensure all decisions are written down.
|
|
33
|
-
- Leave the project ready for the next agent.
|
package/modules/context/RULES.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Collaboration Rules
|
|
2
|
-
|
|
3
|
-
## Core rules
|
|
4
|
-
|
|
5
|
-
- Always read this repository before coding.
|
|
6
|
-
- Do not rely on model-internal memory.
|
|
7
|
-
- All shared understanding must exist as files.
|
|
8
|
-
- Decisions override comments and discussions.
|
|
9
|
-
- When unsure, write a decision.
|
|
10
|
-
|
|
11
|
-
## Decision handling
|
|
12
|
-
|
|
13
|
-
- Open decisions are unprocessed messages from other agents.
|
|
14
|
-
- You must read, understand, and act before resolving.
|
|
15
|
-
- Never resolve without reading the full content.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Skills
|
|
2
|
-
|
|
3
|
-
Protocol-level skills that enforce context rules.
|
|
4
|
-
|
|
5
|
-
- NOT memory systems
|
|
6
|
-
- Do NOT store project knowledge
|
|
7
|
-
- Only bootstrap and validate protocol compliance
|
|
8
|
-
|
|
9
|
-
Available:
|
|
10
|
-
- `uctx` — quick context check (list decisions, show latest, report status)
|
|
11
|
-
|
|
12
|
-
Helpers:
|
|
13
|
-
- `bash scripts/skills.sh list`
|
|
14
|
-
- `bash scripts/skills.sh install <name|all> --codex|--agents|--target <dir>`
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# AI System Contract
|
|
2
|
-
|
|
3
|
-
This repository defines the canonical collaboration context
|
|
4
|
-
for all AI agents working on a codebase.
|
|
5
|
-
|
|
6
|
-
## Purpose
|
|
7
|
-
|
|
8
|
-
Solve one core problem with AI coding agents:
|
|
9
|
-
|
|
10
|
-
1. **Memory sync across agents** — Multiple AI tools (Claude Code, Codex, Cursor, etc.) have no shared memory. Decisions made in one session are lost to others. This protocol makes decisions persist as files, enabling true multi-agent collaboration.
|
|
11
|
-
|
|
12
|
-
## Rules
|
|
13
|
-
|
|
14
|
-
- Files in this repository are authoritative.
|
|
15
|
-
- Constraints are hard requirements, not suggestions.
|
|
16
|
-
- Silent architectural or semantic decisions are forbidden.
|
|
17
|
-
- If conflict or ambiguity exists, stop and ask.
|
|
18
|
-
- Shared truth must be written, not remembered.
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Terminology
|
|
2
|
-
|
|
3
|
-
| Term | Definition |
|
|
4
|
-
|------|------------|
|
|
5
|
-
| Protocol | The rules defined in this repository |
|
|
6
|
-
| Decision | A recorded change affecting architecture/semantics/behavior |
|
|
7
|
-
| Context | Project-specific knowledge stored in context/ |
|
|
8
|
-
| Handoff | One AI session ending, another beginning |
|
|
9
|
-
| Constraint | Non-negotiable rule |
|
|
10
|
-
| Assumption | Belief currently considered true, subject to change |
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/scripts/{context-decisions.sh → .archived/bash-to-js-migration/context-decisions.sh}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|