Skip to content

Commit e788405

Browse files
jlia0claude
andauthored
refactor: merge packages/tinyagi into packages/cli, move tinyagi.sh to lib/ (#238)
- Move tinyagi.mjs and defaults.mjs from packages/tinyagi to packages/cli - Move tinyagi.sh from project root to lib/tinyagi.sh - Update bin/tinyagi and bin/tinyclaw to point to packages/cli - Update all path references in channels, server, cli, bundle, and release scripts - Fix install.sh to copy files to ~/.tinyagi permanently - Delete packages/tinyagi (merged into packages/cli) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e508363 commit e788405

File tree

16 files changed

+55
-66
lines changed

16 files changed

+55
-66
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ jobs:
8181
cp -r .agents/ "$BUNDLE_DIR/"
8282
cp -r tinyoffice/ "$BUNDLE_DIR/"
8383
84-
cp tinyagi.sh "$BUNDLE_DIR/"
85-
8684
# Copy root files
8785
cp package.json "$BUNDLE_DIR/"
8886
cp package-lock.json "$BUNDLE_DIR/"
@@ -97,9 +95,9 @@ jobs:
9795
# Make scripts executable
9896
chmod +x "$BUNDLE_DIR/bin/tinyagi"
9997
chmod +x "$BUNDLE_DIR/bin/tinyclaw"
100-
chmod +x "$BUNDLE_DIR/tinyagi.sh"
10198
chmod +x "$BUNDLE_DIR/scripts/install.sh"
10299
chmod +x "$BUNDLE_DIR/scripts/bundle.sh"
100+
chmod +x "$BUNDLE_DIR/lib/tinyagi.sh"
103101
chmod +x "$BUNDLE_DIR/lib/heartbeat-cron.sh"
104102
chmod +x "$BUNDLE_DIR/lib/update.sh"
105103

bin/tinyagi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ REPO_ROOT="$(dirname "$TINYAGI_DIR")"
2323
export TINYAGI_HOME="$HOME/.tinyagi"
2424

2525
# Execute tinyagi.mjs with all arguments
26-
exec node "$REPO_ROOT/packages/tinyagi/bin/tinyagi.mjs" "$@"
26+
exec node "$REPO_ROOT/packages/cli/bin/tinyagi.mjs" "$@"

bin/tinyclaw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ REPO_ROOT="$(dirname "$TINYCLAW_DIR")"
2323
export TINYCLAW_HOME="$HOME/.tinyclaw"
2424

2525
# Delegate to tinyagi entrypoint
26-
exec node "$REPO_ROOT/packages/tinyagi/bin/tinyagi.mjs" "$@"
26+
exec node "$REPO_ROOT/packages/cli/bin/tinyagi.mjs" "$@"

lib/daemon.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ restart_daemon() {
472472
local bash_bin
473473
bash_bin=$(command -v bash)
474474
log "Restart requested from inside tmux session; scheduling detached restart..."
475-
nohup "$bash_bin" "$SCRIPT_DIR/tinyagi.sh" __delayed_start >/dev/null 2>&1 &
475+
nohup "$bash_bin" "$SCRIPT_DIR/lib/tinyagi.sh" __delayed_start >/dev/null 2>&1 &
476476
stop_daemon
477477
return
478478
fi

tinyagi.sh renamed to lib/tinyagi.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# 4. Run setup wizard to enable it
1010

1111
# SCRIPT_DIR = repo root (where bash scripts live)
12-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
1313

1414
# TINYAGI_HOME = data directory (settings, queue, logs, etc.)
1515
# Always defaults to ~/.tinyagi; override via TINYAGI_HOME env var.

packages/channels/src/discord.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ client.on(Events.MessageCreate, async (message: Message) => {
324324
log('INFO', 'Restart command received');
325325
await message.reply('Restarting TinyAGI...');
326326
const { exec } = require('child_process');
327-
exec(`"${path.join(SCRIPT_DIR, 'tinyagi.sh')}" restart`, { detached: true, stdio: 'ignore' });
327+
exec(`"${path.join(SCRIPT_DIR, 'lib', 'tinyagi.sh')}" restart`, { detached: true, stdio: 'ignore' });
328328
return;
329329
}
330330

packages/channels/src/telegram.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ bot.on('message', async (msg: TelegramBot.Message) => {
443443
reply_to_message_id: msg.message_id,
444444
});
445445
const { exec } = require('child_process');
446-
exec(`"${path.join(SCRIPT_DIR, 'tinyagi.sh')}" restart`, { detached: true, stdio: 'ignore' });
446+
exec(`"${path.join(SCRIPT_DIR, 'lib', 'tinyagi.sh')}" restart`, { detached: true, stdio: 'ignore' });
447447
return;
448448
}
449449

packages/channels/src/whatsapp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ client.on('message_create', async (message: Message) => {
324324
log('INFO', 'Restart command received');
325325
await message.reply('Restarting TinyAGI...');
326326
const { exec } = require('child_process');
327-
exec(`"${path.join(SCRIPT_DIR, 'tinyagi.sh')}" restart`, { detached: true, stdio: 'ignore' });
327+
exec(`"${path.join(SCRIPT_DIR, 'lib', 'tinyagi.sh')}" restart`, { detached: true, stdio: 'ignore' });
328328
return;
329329
}
330330

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function checkPrerequisites() {
5656
// ── Installation ─────────────────────────────────────────────────────────────
5757

5858
function isInstalled() {
59-
return fs.existsSync(path.join(INSTALL_DIR, 'tinyagi.sh'));
59+
return fs.existsSync(path.join(INSTALL_DIR, 'lib/tinyagi.sh'));
6060
}
6161

6262
async function install() {
@@ -115,7 +115,7 @@ async function install() {
115115
}
116116

117117
// Make scripts executable
118-
exec(`chmod +x "${INSTALL_DIR}/bin/tinyagi" "${INSTALL_DIR}/bin/tinyclaw" "${INSTALL_DIR}/tinyagi.sh" "${INSTALL_DIR}/lib/heartbeat-cron.sh" "${INSTALL_DIR}/packages/tinyagi/bin/tinyagi.mjs"`);
118+
exec(`chmod +x "${INSTALL_DIR}/bin/tinyagi" "${INSTALL_DIR}/bin/tinyclaw" "${INSTALL_DIR}/lib/tinyagi.sh" "${INSTALL_DIR}/lib/heartbeat-cron.sh" "${INSTALL_DIR}/packages/cli/bin/tinyagi.mjs"`);
119119

120120
// Install CLI symlink (tinyagi command)
121121
installCli();
@@ -128,7 +128,7 @@ async function install() {
128128

129129
function installCli() {
130130
// Determine installation directory for the symlink
131-
const tinyagiSrc = path.join(INSTALL_DIR, 'packages/tinyagi/bin/tinyagi.mjs');
131+
const tinyagiSrc = path.join(INSTALL_DIR, 'packages/cli/bin/tinyagi.mjs');
132132
let installDir = '';
133133

134134
try {
@@ -250,9 +250,9 @@ async function run() {
250250
// ── Delegate to bash (tinyagi.sh) ───────────────────────────────────────────
251251

252252
function delegateToBash(args, opts = {}) {
253-
const tinyagiSh = path.join(INSTALL_DIR, 'tinyagi.sh');
253+
const tinyagiSh = path.join(INSTALL_DIR, 'lib/tinyagi.sh');
254254
if (!fs.existsSync(tinyagiSh)) {
255-
log(RED, 'TinyAGI is not installed. Run "tinyagi" or "npx tinyagi" first.');
255+
log(RED, 'TinyAGI is not installed. Run "tinyagi" first.');
256256
process.exit(1);
257257
}
258258

0 commit comments

Comments
 (0)