agentxchain 0.8.2 → 0.8.4
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 +60 -13
- package/bin/agentxchain.js +35 -0
- package/package.json +2 -1
- package/scripts/agentxchain-autonudge.applescript +122 -0
- package/scripts/build-binary.sh +42 -0
- package/scripts/publish-npm.sh +95 -0
- package/scripts/run-autonudge.sh +111 -0
- package/scripts/stop-autonudge.sh +13 -0
- package/src/adapters/cursor-local.js +65 -6
- package/src/commands/claim.js +17 -1
- package/src/commands/doctor.js +146 -0
- package/src/commands/init.js +16 -3
- package/src/commands/kickoff.js +119 -0
- package/src/commands/start.js +87 -6
- package/src/commands/supervise.js +100 -0
- package/src/commands/validate.js +49 -0
- package/src/commands/watch.js +50 -0
- package/src/lib/seed-prompt-polling.js +12 -0
- package/src/lib/validation.js +179 -0
package/README.md
CHANGED
|
@@ -20,27 +20,25 @@ npx agentxchain init
|
|
|
20
20
|
# 1. Create a project (interactive template selection)
|
|
21
21
|
agentxchain init
|
|
22
22
|
|
|
23
|
-
# 2.
|
|
23
|
+
# 2. Run guided PM-first kickoff wizard
|
|
24
24
|
cd my-project/
|
|
25
|
-
agentxchain
|
|
26
|
-
|
|
27
|
-
# 3. For each window: paste the prompt (auto-copied to clipboard), select Agent mode, send
|
|
28
|
-
# The CLI walks you through one agent at a time.
|
|
29
|
-
|
|
30
|
-
# 4. Release the human lock — agents start claiming turns
|
|
31
|
-
agentxchain release
|
|
25
|
+
agentxchain kickoff
|
|
32
26
|
```
|
|
33
27
|
|
|
34
|
-
Each agent runs in its own Cursor window with a self-polling loop. Agents check `lock.json` every 60 seconds, claim when it's their turn, do their work, release, and go back to waiting.
|
|
28
|
+
Each agent runs in its own Cursor window with a self-polling loop. Agents check `lock.json` every 60 seconds, claim when it's their turn, do their work, release, and go back to waiting. `supervise --autonudge` handles watch + nudging automatically.
|
|
35
29
|
|
|
36
30
|
## Commands
|
|
37
31
|
|
|
38
32
|
| Command | What it does |
|
|
39
33
|
|---------|-------------|
|
|
40
34
|
| `init` | Create project folder with agents, protocol files, and templates |
|
|
35
|
+
| `kickoff` | Guided PM-first flow: PM kickoff, validate, launch remaining, release |
|
|
41
36
|
| `start` | Open a Cursor window per agent + copy prompts to clipboard |
|
|
37
|
+
| `supervise` | Run watcher and optional AppleScript auto-nudge together |
|
|
42
38
|
| `generate` | Regenerate agent files from `agentxchain.json` |
|
|
39
|
+
| `validate` | Enforce PM signoff + waves/phases + turn artifact schema |
|
|
43
40
|
| `status` | Show lock holder, phase, turn number, agents |
|
|
41
|
+
| `doctor` | Validate local setup (tools, trigger flow, accessibility checks) |
|
|
44
42
|
| `claim` | Human takes control (agents stop claiming) |
|
|
45
43
|
| `release` | Hand lock back to agents |
|
|
46
44
|
| `stop` | Terminate running Claude Code agent sessions |
|
|
@@ -59,21 +57,70 @@ agentxchain start --ide claude-code # Claude Code — spawns CLI processes
|
|
|
59
57
|
### Additional flags
|
|
60
58
|
|
|
61
59
|
```bash
|
|
60
|
+
agentxchain kickoff # guided first-run PM-first workflow
|
|
61
|
+
agentxchain kickoff --ide vscode # guided flow for VS Code mode
|
|
62
|
+
agentxchain kickoff --send # with Cursor auto-nudge auto-send enabled
|
|
63
|
+
|
|
62
64
|
agentxchain start --agent pm # launch only one specific agent
|
|
65
|
+
agentxchain start --remaining # launch all agents except PM (PM-first flow)
|
|
63
66
|
agentxchain start --dry-run # preview agents without launching
|
|
67
|
+
agentxchain validate --mode kickoff # required before --remaining
|
|
68
|
+
agentxchain validate --mode turn --agent pm
|
|
64
69
|
agentxchain watch --daemon # run watch in background
|
|
70
|
+
agentxchain supervise --autonudge # run watch + AppleScript nudge loop
|
|
71
|
+
agentxchain supervise --autonudge --send # auto-press Enter after paste
|
|
65
72
|
agentxchain release --force # force-release non-human holder lock
|
|
66
73
|
```
|
|
67
74
|
|
|
75
|
+
## macOS auto-nudge (AppleScript)
|
|
76
|
+
|
|
77
|
+
If you want the next agent chat to be nudged automatically when turn changes, use the built-in AppleScript helper.
|
|
78
|
+
|
|
79
|
+
1) Keep watcher running in your project:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
agentxchain watch
|
|
83
|
+
# or use the combined command:
|
|
84
|
+
agentxchain supervise --autonudge
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
2) In another terminal (from `cli/`), start auto-nudge:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
bash scripts/run-autonudge.sh --project "/absolute/path/to/your-project"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
By default this is **paste-only** (safe mode): it opens chat and pastes the nudge message, but does not press Enter.
|
|
94
|
+
|
|
95
|
+
3) Enable auto-send once confirmed:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
bash scripts/run-autonudge.sh --project "/absolute/path/to/your-project" --send
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Stop it anytime:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
bash scripts/stop-autonudge.sh
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Notes:
|
|
108
|
+
- Requires macOS (`osascript`) and `jq` (`brew install jq`)
|
|
109
|
+
- Grant Accessibility permissions to Terminal and Cursor
|
|
110
|
+
- The script watches `.agentxchain-trigger.json`, which is written by `agentxchain watch`
|
|
111
|
+
- `run-autonudge.sh` now requires watch to be running first
|
|
112
|
+
- The script only nudges when it finds a unique matching agent window (no random fallback)
|
|
113
|
+
|
|
68
114
|
## How it works
|
|
69
115
|
|
|
70
116
|
### Cursor mode (default)
|
|
71
117
|
|
|
72
|
-
1. `agentxchain
|
|
118
|
+
1. `agentxchain kickoff` launches PM first for human-product alignment
|
|
73
119
|
2. Each window gets a unique prompt copied to clipboard
|
|
74
|
-
3.
|
|
75
|
-
4.
|
|
76
|
-
5.
|
|
120
|
+
3. Kickoff validates PM signoff and launches remaining agents
|
|
121
|
+
4. Agent prompts include a self-polling loop: read `lock.json` → check if it's my turn → claim → work → release → sleep 60s → repeat
|
|
122
|
+
5. Agents know their rotation order from `agentxchain.json` and only claim when the previous agent released
|
|
123
|
+
6. Human can `claim` to pause and `release` to resume anytime
|
|
77
124
|
|
|
78
125
|
### VS Code mode
|
|
79
126
|
|
package/bin/agentxchain.js
CHANGED
|
@@ -13,6 +13,10 @@ import { updateCommand } from '../src/commands/update.js';
|
|
|
13
13
|
import { watchCommand } from '../src/commands/watch.js';
|
|
14
14
|
import { claimCommand, releaseCommand } from '../src/commands/claim.js';
|
|
15
15
|
import { generateCommand } from '../src/commands/generate.js';
|
|
16
|
+
import { doctorCommand } from '../src/commands/doctor.js';
|
|
17
|
+
import { superviseCommand } from '../src/commands/supervise.js';
|
|
18
|
+
import { validateCommand } from '../src/commands/validate.js';
|
|
19
|
+
import { kickoffCommand } from '../src/commands/kickoff.js';
|
|
16
20
|
|
|
17
21
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
18
22
|
const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8'));
|
|
@@ -41,9 +45,19 @@ program
|
|
|
41
45
|
.description('Launch agents in your IDE')
|
|
42
46
|
.option('--ide <ide>', 'Target IDE: cursor, vscode, claude-code', 'cursor')
|
|
43
47
|
.option('--agent <id>', 'Launch a specific agent only')
|
|
48
|
+
.option('--remaining', 'Launch all remaining agents except PM (for PM-first flow)')
|
|
44
49
|
.option('--dry-run', 'Print what would be launched without doing it')
|
|
45
50
|
.action(startCommand);
|
|
46
51
|
|
|
52
|
+
program
|
|
53
|
+
.command('kickoff')
|
|
54
|
+
.description('Guided PM-first first-run workflow')
|
|
55
|
+
.option('--ide <ide>', 'Target IDE: cursor, vscode, claude-code', 'cursor')
|
|
56
|
+
.option('--send', 'When using Cursor auto-nudge, auto-send nudges')
|
|
57
|
+
.option('--interval <seconds>', 'Auto-nudge poll interval in seconds', '3')
|
|
58
|
+
.option('--no-autonudge', 'Skip auto-nudge supervisor prompt')
|
|
59
|
+
.action(kickoffCommand);
|
|
60
|
+
|
|
47
61
|
program
|
|
48
62
|
.command('stop')
|
|
49
63
|
.description('Stop all running agent sessions')
|
|
@@ -69,6 +83,14 @@ program
|
|
|
69
83
|
.option('--daemon', 'Run in background mode')
|
|
70
84
|
.action(watchCommand);
|
|
71
85
|
|
|
86
|
+
program
|
|
87
|
+
.command('supervise')
|
|
88
|
+
.description('Run watch loop and optional auto-nudge together')
|
|
89
|
+
.option('--autonudge', 'Start AppleScript auto-nudge alongside watch')
|
|
90
|
+
.option('--send', 'Auto-send nudges (default is paste-only)')
|
|
91
|
+
.option('--interval <seconds>', 'Auto-nudge poll interval in seconds', '3')
|
|
92
|
+
.action(superviseCommand);
|
|
93
|
+
|
|
72
94
|
program
|
|
73
95
|
.command('claim')
|
|
74
96
|
.description('Claim the lock as a human (take control)')
|
|
@@ -86,4 +108,17 @@ program
|
|
|
86
108
|
.description('Update agentxchain CLI to the latest version')
|
|
87
109
|
.action(updateCommand);
|
|
88
110
|
|
|
111
|
+
program
|
|
112
|
+
.command('doctor')
|
|
113
|
+
.description('Check local environment and first-run readiness')
|
|
114
|
+
.action(doctorCommand);
|
|
115
|
+
|
|
116
|
+
program
|
|
117
|
+
.command('validate')
|
|
118
|
+
.description('Validate Get Shit Done docs and QA protocol artifacts')
|
|
119
|
+
.option('--mode <mode>', 'Validation mode: kickoff, turn, full', 'full')
|
|
120
|
+
.option('--agent <id>', 'Expected agent for last history entry (turn mode)')
|
|
121
|
+
.option('-j, --json', 'Output as JSON')
|
|
122
|
+
.action(validateCommand);
|
|
123
|
+
|
|
89
124
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentxchain",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "CLI for AgentXchain — multi-agent coordination in your IDE",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"bin/",
|
|
11
11
|
"src/",
|
|
12
|
+
"scripts/",
|
|
12
13
|
"README.md"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
property projectRoot : ""
|
|
2
|
+
property pollSeconds : 3
|
|
3
|
+
property autoSend : false
|
|
4
|
+
|
|
5
|
+
on run argv
|
|
6
|
+
if (count of argv) < 1 then
|
|
7
|
+
error "Usage: osascript agentxchain-autonudge.applescript <projectRoot> [autoSend:true|false] [pollSeconds]"
|
|
8
|
+
end if
|
|
9
|
+
|
|
10
|
+
set projectRoot to item 1 of argv
|
|
11
|
+
|
|
12
|
+
if (count of argv) >= 2 then
|
|
13
|
+
set sendArg to item 2 of argv
|
|
14
|
+
if sendArg is "true" then
|
|
15
|
+
set autoSend to true
|
|
16
|
+
else
|
|
17
|
+
set autoSend to false
|
|
18
|
+
end if
|
|
19
|
+
end if
|
|
20
|
+
|
|
21
|
+
if (count of argv) >= 3 then
|
|
22
|
+
try
|
|
23
|
+
set pollSeconds to (item 3 of argv) as integer
|
|
24
|
+
on error
|
|
25
|
+
set pollSeconds to 3
|
|
26
|
+
end try
|
|
27
|
+
end if
|
|
28
|
+
|
|
29
|
+
set triggerPath to projectRoot & "/.agentxchain-trigger.json"
|
|
30
|
+
set statePath to projectRoot & "/.agentxchain-autonudge.state"
|
|
31
|
+
|
|
32
|
+
repeat
|
|
33
|
+
try
|
|
34
|
+
set hasTrigger to do shell script "test -f " & quoted form of triggerPath & " && echo yes || echo no"
|
|
35
|
+
if hasTrigger is "yes" then
|
|
36
|
+
set agentId to do shell script "jq -r '.agent // empty' " & quoted form of triggerPath
|
|
37
|
+
set turnNum to do shell script "jq -r '.turn_number // 0' " & quoted form of triggerPath
|
|
38
|
+
|
|
39
|
+
if agentId is not "" then
|
|
40
|
+
set dispatchKey to agentId & ":" & turnNum
|
|
41
|
+
set lastKey to do shell script "test -f " & quoted form of statePath & " && cat " & quoted form of statePath & " || echo ''"
|
|
42
|
+
|
|
43
|
+
if dispatchKey is not lastKey then
|
|
44
|
+
my nudgeAgent(agentId, turnNum)
|
|
45
|
+
do shell script "printf %s " & quoted form of dispatchKey & " > " & quoted form of statePath
|
|
46
|
+
end if
|
|
47
|
+
end if
|
|
48
|
+
end if
|
|
49
|
+
end try
|
|
50
|
+
|
|
51
|
+
delay pollSeconds
|
|
52
|
+
end repeat
|
|
53
|
+
end run
|
|
54
|
+
|
|
55
|
+
on nudgeAgent(agentId, turnNum)
|
|
56
|
+
set nudgeText to "Hey " & agentId & ", it is your turn now (turn " & turnNum & "). Read lock.json, claim the lock, check state.md + history.jsonl + planning docs, do your work, and release lock."
|
|
57
|
+
set the clipboard to nudgeText
|
|
58
|
+
|
|
59
|
+
tell application "Cursor" to activate
|
|
60
|
+
delay 0.5
|
|
61
|
+
set focusedOk to my focusAgentWindow(agentId)
|
|
62
|
+
if focusedOk is false then
|
|
63
|
+
do shell script "osascript -e " & quoted form of ("display notification \"Could not identify a unique window for " & agentId & ".\" with title \"AgentXchain\"")
|
|
64
|
+
return
|
|
65
|
+
end if
|
|
66
|
+
delay 0.2
|
|
67
|
+
|
|
68
|
+
tell application "System Events"
|
|
69
|
+
if not (exists process "Cursor") then return
|
|
70
|
+
|
|
71
|
+
tell process "Cursor"
|
|
72
|
+
set frontmost to true
|
|
73
|
+
keystroke "l" using {command down}
|
|
74
|
+
delay 0.2
|
|
75
|
+
keystroke "v" using {command down}
|
|
76
|
+
if autoSend then
|
|
77
|
+
delay 0.15
|
|
78
|
+
key code 36
|
|
79
|
+
end if
|
|
80
|
+
end tell
|
|
81
|
+
end tell
|
|
82
|
+
|
|
83
|
+
do shell script "osascript -e " & quoted form of ("display notification \"Nudged " & agentId & " for turn " & turnNum & "\" with title \"AgentXchain\"")
|
|
84
|
+
end nudgeAgent
|
|
85
|
+
|
|
86
|
+
on focusAgentWindow(agentId)
|
|
87
|
+
tell application "System Events"
|
|
88
|
+
if not (exists process "Cursor") then return
|
|
89
|
+
tell process "Cursor"
|
|
90
|
+
set frontmost to true
|
|
91
|
+
|
|
92
|
+
set matchedIndexes to {}
|
|
93
|
+
set idx to 0
|
|
94
|
+
repeat with w in windows
|
|
95
|
+
set idx to idx + 1
|
|
96
|
+
try
|
|
97
|
+
set wn to name of w as text
|
|
98
|
+
if my isStrongWindowMatch(wn, agentId) then
|
|
99
|
+
set end of matchedIndexes to idx
|
|
100
|
+
end if
|
|
101
|
+
end try
|
|
102
|
+
end repeat
|
|
103
|
+
|
|
104
|
+
if (count of matchedIndexes) = 1 then
|
|
105
|
+
try
|
|
106
|
+
set targetIndex to item 1 of matchedIndexes
|
|
107
|
+
perform action "AXRaise" of window targetIndex
|
|
108
|
+
return true
|
|
109
|
+
end try
|
|
110
|
+
else if (count of matchedIndexes) > 1 then
|
|
111
|
+
return false
|
|
112
|
+
end if
|
|
113
|
+
end tell
|
|
114
|
+
end tell
|
|
115
|
+
return false
|
|
116
|
+
end focusAgentWindow
|
|
117
|
+
|
|
118
|
+
on isStrongWindowMatch(windowName, agentId)
|
|
119
|
+
set tokenA to ".agentxchain-workspaces/" & agentId
|
|
120
|
+
if windowName contains tokenA then return true
|
|
121
|
+
return false
|
|
122
|
+
end isStrongWindowMatch
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Build standalone binaries for macOS and Linux using Bun.
|
|
3
|
+
# Requires: bun (install via `brew install oven-sh/bun/bun`)
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
7
|
+
CLI_DIR="${SCRIPT_DIR}/.."
|
|
8
|
+
cd "$CLI_DIR"
|
|
9
|
+
|
|
10
|
+
VERSION=$(node -e "console.log(require('./package.json').version)")
|
|
11
|
+
DIST="$CLI_DIR/dist"
|
|
12
|
+
mkdir -p "$DIST"
|
|
13
|
+
|
|
14
|
+
echo "Building agentxchain v${VERSION}..."
|
|
15
|
+
echo ""
|
|
16
|
+
|
|
17
|
+
echo "=== macOS arm64 ==="
|
|
18
|
+
bun build bin/agentxchain.js --compile --target=bun-darwin-arm64 --outfile="$DIST/agentxchain-macos-arm64"
|
|
19
|
+
echo " → $DIST/agentxchain-macos-arm64"
|
|
20
|
+
|
|
21
|
+
echo ""
|
|
22
|
+
echo "=== macOS x64 ==="
|
|
23
|
+
bun build bin/agentxchain.js --compile --target=bun-darwin-x64 --outfile="$DIST/agentxchain-macos-x64"
|
|
24
|
+
echo " → $DIST/agentxchain-macos-x64"
|
|
25
|
+
|
|
26
|
+
echo ""
|
|
27
|
+
echo "=== Linux x64 ==="
|
|
28
|
+
bun build bin/agentxchain.js --compile --target=bun-linux-x64 --outfile="$DIST/agentxchain-linux-x64"
|
|
29
|
+
echo " → $DIST/agentxchain-linux-x64"
|
|
30
|
+
|
|
31
|
+
echo ""
|
|
32
|
+
echo "Creating tarballs..."
|
|
33
|
+
cd "$DIST"
|
|
34
|
+
tar -czf "agentxchain-${VERSION}-macos-arm64.tar.gz" agentxchain-macos-arm64
|
|
35
|
+
tar -czf "agentxchain-${VERSION}-macos-x64.tar.gz" agentxchain-macos-x64
|
|
36
|
+
tar -czf "agentxchain-${VERSION}-linux-x64.tar.gz" agentxchain-linux-x64
|
|
37
|
+
|
|
38
|
+
echo ""
|
|
39
|
+
echo "Done. Upload these to a GitHub release, then update the Homebrew formula with the URLs and SHA256 hashes."
|
|
40
|
+
echo ""
|
|
41
|
+
echo "SHA256 hashes:"
|
|
42
|
+
shasum -a 256 *.tar.gz
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Publish a new version of agentxchain to npm.
|
|
3
|
+
# Usage:
|
|
4
|
+
# bash scripts/publish-npm.sh # bump patch + publish
|
|
5
|
+
# bash scripts/publish-npm.sh minor # bump minor + publish
|
|
6
|
+
# bash scripts/publish-npm.sh major # bump major + publish
|
|
7
|
+
# bash scripts/publish-npm.sh 0.5.0 # set explicit version + publish
|
|
8
|
+
# bash scripts/publish-npm.sh patch --dry-run
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
12
|
+
CLI_DIR="${SCRIPT_DIR}/.."
|
|
13
|
+
cd "$CLI_DIR"
|
|
14
|
+
|
|
15
|
+
if [[ ! -f "package.json" ]]; then
|
|
16
|
+
echo "Error: package.json not found in $CLI_DIR"
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
PACKAGE_NAME="$(node -e "console.log(JSON.parse(require('fs').readFileSync('package.json', 'utf8')).name)")"
|
|
21
|
+
BUMP="${1:-patch}"
|
|
22
|
+
DRY_RUN="${2:-}"
|
|
23
|
+
|
|
24
|
+
if [[ "$BUMP" != "patch" && "$BUMP" != "minor" && "$BUMP" != "major" && ! "$BUMP" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
25
|
+
echo "Error: invalid version bump '$BUMP'. Use patch|minor|major|x.y.z"
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Load NPM_TOKEN from agentXchain.dev/.env only.
|
|
30
|
+
PARENT_ENV_FILE="${CLI_DIR}/../.env"
|
|
31
|
+
if [[ -f "${PARENT_ENV_FILE}" ]]; then
|
|
32
|
+
set -a
|
|
33
|
+
# shellcheck disable=SC1090
|
|
34
|
+
source "${PARENT_ENV_FILE}"
|
|
35
|
+
set +a
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
CURRENT_VERSION="$(node -e "console.log(JSON.parse(require('fs').readFileSync('package.json', 'utf8')).version)")"
|
|
39
|
+
echo "Current version: ${CURRENT_VERSION}"
|
|
40
|
+
echo "Package name: ${PACKAGE_NAME}"
|
|
41
|
+
echo "Requested bump: ${BUMP}"
|
|
42
|
+
echo ""
|
|
43
|
+
|
|
44
|
+
if [[ "$DRY_RUN" == "--dry-run" ]]; then
|
|
45
|
+
echo "Dry run mode. No files changed."
|
|
46
|
+
exit 0
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
# Preflight auth/ownership checks before version bump.
|
|
50
|
+
echo "Running npm preflight checks..."
|
|
51
|
+
if [[ -n "${NPM_TOKEN:-}" ]]; then
|
|
52
|
+
if ! npm whoami --//registry.npmjs.org/:_authToken="${NPM_TOKEN}" >/dev/null 2>&1; then
|
|
53
|
+
echo "Error: npm auth failed with NPM_TOKEN from agentxchain.dev/.env"
|
|
54
|
+
echo "Verify NPM_TOKEN is valid and has package publish permissions."
|
|
55
|
+
exit 1
|
|
56
|
+
fi
|
|
57
|
+
NPM_USER="$(npm whoami --//registry.npmjs.org/:_authToken="${NPM_TOKEN}")"
|
|
58
|
+
else
|
|
59
|
+
if ! npm whoami >/dev/null 2>&1; then
|
|
60
|
+
echo "Error: npm auth missing. Run: npm login or set NPM_TOKEN in agentxchain.dev/.env"
|
|
61
|
+
exit 1
|
|
62
|
+
fi
|
|
63
|
+
NPM_USER="$(npm whoami)"
|
|
64
|
+
fi
|
|
65
|
+
echo "npm user: ${NPM_USER}"
|
|
66
|
+
|
|
67
|
+
if npm view "${PACKAGE_NAME}" version >/dev/null 2>&1; then
|
|
68
|
+
# Existing package: confirm owner access.
|
|
69
|
+
if ! npm owner ls "${PACKAGE_NAME}" | grep -q "^${NPM_USER} "; then
|
|
70
|
+
echo "Error: npm user '${NPM_USER}' is not an owner of '${PACKAGE_NAME}'."
|
|
71
|
+
echo "Ask an existing owner to run: npm owner add ${NPM_USER} ${PACKAGE_NAME}"
|
|
72
|
+
exit 1
|
|
73
|
+
fi
|
|
74
|
+
echo "ownership: ok"
|
|
75
|
+
else
|
|
76
|
+
echo "package status: new package or not visible to this auth context"
|
|
77
|
+
fi
|
|
78
|
+
echo ""
|
|
79
|
+
|
|
80
|
+
echo "Bumping package version..."
|
|
81
|
+
npm version "$BUMP" --no-git-tag-version
|
|
82
|
+
|
|
83
|
+
NEW_VERSION="$(node -e "console.log(JSON.parse(require('fs').readFileSync('package.json', 'utf8')).version)")"
|
|
84
|
+
echo "New version: ${NEW_VERSION}"
|
|
85
|
+
echo ""
|
|
86
|
+
|
|
87
|
+
echo "Publishing to npm..."
|
|
88
|
+
if [[ -n "${NPM_TOKEN:-}" ]]; then
|
|
89
|
+
npm publish --access public --//registry.npmjs.org/:_authToken="${NPM_TOKEN}"
|
|
90
|
+
else
|
|
91
|
+
npm publish --access public
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
echo ""
|
|
95
|
+
echo "Done. Published agentxchain@${NEW_VERSION}"
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
+
APPLESCRIPT_PATH="${SCRIPT_DIR}/agentxchain-autonudge.applescript"
|
|
6
|
+
|
|
7
|
+
PROJECT_ROOT="$(pwd)"
|
|
8
|
+
AUTO_SEND="false"
|
|
9
|
+
INTERVAL_SECONDS="3"
|
|
10
|
+
|
|
11
|
+
usage() {
|
|
12
|
+
cat <<'EOF'
|
|
13
|
+
Usage: bash scripts/run-autonudge.sh [options]
|
|
14
|
+
|
|
15
|
+
Options:
|
|
16
|
+
--project <path> Project root that contains lock.json
|
|
17
|
+
--send Auto-send message (presses Enter after paste)
|
|
18
|
+
--paste-only Paste only (default, no Enter)
|
|
19
|
+
--interval <seconds> Poll interval in seconds (default: 3)
|
|
20
|
+
-h, --help Show help
|
|
21
|
+
|
|
22
|
+
Example:
|
|
23
|
+
bash scripts/run-autonudge.sh --project "$(pwd)" --send --interval 2
|
|
24
|
+
EOF
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
while [[ $# -gt 0 ]]; do
|
|
28
|
+
case "$1" in
|
|
29
|
+
--project)
|
|
30
|
+
PROJECT_ROOT="$2"
|
|
31
|
+
shift 2
|
|
32
|
+
;;
|
|
33
|
+
--send)
|
|
34
|
+
AUTO_SEND="true"
|
|
35
|
+
shift
|
|
36
|
+
;;
|
|
37
|
+
--paste-only)
|
|
38
|
+
AUTO_SEND="false"
|
|
39
|
+
shift
|
|
40
|
+
;;
|
|
41
|
+
--interval)
|
|
42
|
+
INTERVAL_SECONDS="$2"
|
|
43
|
+
shift 2
|
|
44
|
+
;;
|
|
45
|
+
-h|--help)
|
|
46
|
+
usage
|
|
47
|
+
exit 0
|
|
48
|
+
;;
|
|
49
|
+
*)
|
|
50
|
+
echo "Unknown option: $1"
|
|
51
|
+
usage
|
|
52
|
+
exit 1
|
|
53
|
+
;;
|
|
54
|
+
esac
|
|
55
|
+
done
|
|
56
|
+
|
|
57
|
+
if ! command -v osascript >/dev/null 2>&1; then
|
|
58
|
+
echo "osascript not found. This script requires macOS."
|
|
59
|
+
exit 1
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
if ! command -v jq >/dev/null 2>&1; then
|
|
63
|
+
echo "jq not found. Install with: brew install jq"
|
|
64
|
+
exit 1
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
if [[ ! -f "${PROJECT_ROOT}/lock.json" ]]; then
|
|
68
|
+
echo "lock.json not found in: ${PROJECT_ROOT}"
|
|
69
|
+
echo "Run this from your AgentXchain project root, or pass --project <path>."
|
|
70
|
+
exit 1
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
if [[ ! -f "${APPLESCRIPT_PATH}" ]]; then
|
|
74
|
+
echo "AppleScript not found: ${APPLESCRIPT_PATH}"
|
|
75
|
+
exit 1
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
WATCH_READY="false"
|
|
79
|
+
for _ in {1..10}; do
|
|
80
|
+
if pgrep -f "agentxchain.*watch" >/dev/null 2>&1; then
|
|
81
|
+
WATCH_READY="true"
|
|
82
|
+
break
|
|
83
|
+
fi
|
|
84
|
+
sleep 1
|
|
85
|
+
done
|
|
86
|
+
|
|
87
|
+
if [[ "${WATCH_READY}" != "true" ]]; then
|
|
88
|
+
echo "watch process not detected."
|
|
89
|
+
echo "Run one of these first:"
|
|
90
|
+
echo " agentxchain watch"
|
|
91
|
+
echo " agentxchain supervise --autonudge"
|
|
92
|
+
exit 1
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
if [[ ! -f "${PROJECT_ROOT}/.agentxchain-trigger.json" ]]; then
|
|
96
|
+
echo "warning: .agentxchain-trigger.json does not exist yet."
|
|
97
|
+
echo "auto-nudge will start, but nudges begin only after watch writes a trigger."
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
echo ""
|
|
101
|
+
echo "AgentXchain auto-nudge starting..."
|
|
102
|
+
echo "Project: ${PROJECT_ROOT}"
|
|
103
|
+
echo "Mode: $( [[ "${AUTO_SEND}" == "true" ]] && echo "auto-send" || echo "paste-only" )"
|
|
104
|
+
echo "Interval: ${INTERVAL_SECONDS}s"
|
|
105
|
+
echo ""
|
|
106
|
+
echo "Requirements:"
|
|
107
|
+
echo "- Keep 'agentxchain watch' running in another terminal."
|
|
108
|
+
echo "- Grant Accessibility permission to Terminal and Cursor."
|
|
109
|
+
echo ""
|
|
110
|
+
|
|
111
|
+
osascript "${APPLESCRIPT_PATH}" "${PROJECT_ROOT}" "${AUTO_SEND}" "${INTERVAL_SECONDS}"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
PIDS="$(pgrep -f "agentxchain-autonudge.applescript" || true)"
|
|
5
|
+
|
|
6
|
+
if [[ -z "${PIDS}" ]]; then
|
|
7
|
+
echo "No running auto-nudge process found."
|
|
8
|
+
exit 0
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
echo "Stopping auto-nudge process(es): ${PIDS}"
|
|
12
|
+
kill ${PIDS}
|
|
13
|
+
echo "Stopped."
|