Switch to double quotes and reformat codebase with Biome

This commit is contained in:
Mohamed Boudra
2026-03-21 20:22:15 +07:00
parent ab40786882
commit f6579dbeb4
805 changed files with 38132 additions and 40175 deletions
+59 -59
View File
@@ -16,107 +16,107 @@
* - agent archive --force flag is accepted
*/
import assert from 'node:assert'
import { $ } from 'zx'
import { mkdtemp, rm } from 'fs/promises'
import { tmpdir } from 'os'
import { join } from 'path'
import assert from "node:assert";
import { $ } from "zx";
import { mkdtemp, rm } from "fs/promises";
import { tmpdir } from "os";
import { join } from "path";
$.verbose = false
$.verbose = false;
console.log('=== Agent Archive Command Tests ===\n')
console.log("=== Agent Archive Command Tests ===\n");
// Get random port that's definitely not in use (never 6767)
const port = 10000 + Math.floor(Math.random() * 50000)
const paseoHome = await mkdtemp(join(tmpdir(), 'paseo-test-home-'))
const port = 10000 + Math.floor(Math.random() * 50000);
const paseoHome = await mkdtemp(join(tmpdir(), "paseo-test-home-"));
try {
// Test 1: agent archive --help shows options
{
console.log('Test 1: agent archive --help shows options')
const result = await $`npx paseo agent archive --help`.nothrow()
assert.strictEqual(result.exitCode, 0, 'agent archive --help should exit 0')
assert(result.stdout.includes('--force'), 'help should mention --force flag')
assert(result.stdout.includes('--host'), 'help should mention --host option')
assert(result.stdout.includes('<id>'), 'help should mention required id argument')
console.log('✓ agent archive --help shows options\n')
console.log("Test 1: agent archive --help shows options");
const result = await $`npx paseo agent archive --help`.nothrow();
assert.strictEqual(result.exitCode, 0, "agent archive --help should exit 0");
assert(result.stdout.includes("--force"), "help should mention --force flag");
assert(result.stdout.includes("--host"), "help should mention --host option");
assert(result.stdout.includes("<id>"), "help should mention required id argument");
console.log("✓ agent archive --help shows options\n");
}
// Test 2: agent archive requires ID argument
{
console.log('Test 2: agent archive requires ID argument')
console.log("Test 2: agent archive requires ID argument");
const result =
await $`PASEO_HOST=localhost:${port} PASEO_HOME=${paseoHome} npx paseo agent archive`.nothrow()
assert.notStrictEqual(result.exitCode, 0, 'should fail without id')
const output = result.stdout + result.stderr
await $`PASEO_HOST=localhost:${port} PASEO_HOME=${paseoHome} npx paseo agent archive`.nothrow();
assert.notStrictEqual(result.exitCode, 0, "should fail without id");
const output = result.stdout + result.stderr;
const hasError =
output.toLowerCase().includes('missing') ||
output.toLowerCase().includes('required') ||
output.toLowerCase().includes('argument')
assert(hasError, 'error should mention missing argument')
console.log('✓ agent archive requires ID argument\n')
output.toLowerCase().includes("missing") ||
output.toLowerCase().includes("required") ||
output.toLowerCase().includes("argument");
assert(hasError, "error should mention missing argument");
console.log("✓ agent archive requires ID argument\n");
}
// Test 3: agent archive handles daemon not running
{
console.log('Test 3: agent archive handles daemon not running')
console.log("Test 3: agent archive handles daemon not running");
const result =
await $`PASEO_HOST=localhost:${port} PASEO_HOME=${paseoHome} npx paseo agent archive abc123`.nothrow()
await $`PASEO_HOST=localhost:${port} PASEO_HOME=${paseoHome} npx paseo agent archive abc123`.nothrow();
// Should fail because daemon not running
assert.notStrictEqual(result.exitCode, 0, 'should fail when daemon not running')
const output = result.stdout + result.stderr
assert.notStrictEqual(result.exitCode, 0, "should fail when daemon not running");
const output = result.stdout + result.stderr;
const hasError =
output.toLowerCase().includes('daemon') ||
output.toLowerCase().includes('connect') ||
output.toLowerCase().includes('cannot')
assert(hasError, 'error message should mention connection issue')
console.log('✓ agent archive handles daemon not running\n')
output.toLowerCase().includes("daemon") ||
output.toLowerCase().includes("connect") ||
output.toLowerCase().includes("cannot");
assert(hasError, "error message should mention connection issue");
console.log("✓ agent archive handles daemon not running\n");
}
// Test 4: agent archive --force flag is accepted
{
console.log('Test 4: agent archive --force flag is accepted')
console.log("Test 4: agent archive --force flag is accepted");
const result =
await $`PASEO_HOST=localhost:${port} PASEO_HOME=${paseoHome} npx paseo agent archive abc123 --force`.nothrow()
const output = result.stdout + result.stderr
assert(!output.includes('unknown option'), 'should accept --force flag')
assert(!output.includes('error: option'), 'should not have option parsing error')
console.log('✓ agent archive --force flag is accepted\n')
await $`PASEO_HOST=localhost:${port} PASEO_HOME=${paseoHome} npx paseo agent archive abc123 --force`.nothrow();
const output = result.stdout + result.stderr;
assert(!output.includes("unknown option"), "should accept --force flag");
assert(!output.includes("error: option"), "should not have option parsing error");
console.log("✓ agent archive --force flag is accepted\n");
}
// Test 5: agent archive with ID and --host flag is accepted
{
console.log('Test 5: agent archive with ID and --host flag is accepted')
console.log("Test 5: agent archive with ID and --host flag is accepted");
const result =
await $`PASEO_HOST=localhost:${port} PASEO_HOME=${paseoHome} npx paseo agent archive abc123 --host localhost:${port}`.nothrow()
const output = result.stdout + result.stderr
assert(!output.includes('unknown option'), 'should accept --host flag')
assert(!output.includes('error: option'), 'should not have option parsing error')
console.log('✓ agent archive with ID and --host flag is accepted\n')
await $`PASEO_HOST=localhost:${port} PASEO_HOME=${paseoHome} npx paseo agent archive abc123 --host localhost:${port}`.nothrow();
const output = result.stdout + result.stderr;
assert(!output.includes("unknown option"), "should accept --host flag");
assert(!output.includes("error: option"), "should not have option parsing error");
console.log("✓ agent archive with ID and --host flag is accepted\n");
}
// Test 6: agent shows archive in subcommands
{
console.log('Test 6: agent --help shows archive subcommand')
const result = await $`npx paseo agent --help`.nothrow()
assert.strictEqual(result.exitCode, 0, 'agent --help should exit 0')
assert(result.stdout.includes('archive'), 'help should mention archive subcommand')
console.log('✓ agent --help shows archive subcommand\n')
console.log("Test 6: agent --help shows archive subcommand");
const result = await $`npx paseo agent --help`.nothrow();
assert.strictEqual(result.exitCode, 0, "agent --help should exit 0");
assert(result.stdout.includes("archive"), "help should mention archive subcommand");
console.log("✓ agent --help shows archive subcommand\n");
}
// Test 7: -q (quiet) flag is accepted with agent archive
{
console.log('Test 7: -q (quiet) flag is accepted with agent archive')
console.log("Test 7: -q (quiet) flag is accepted with agent archive");
const result =
await $`PASEO_HOST=localhost:${port} PASEO_HOME=${paseoHome} npx paseo -q agent archive abc123`.nothrow()
const output = result.stdout + result.stderr
assert(!output.includes('unknown option'), 'should accept -q flag')
assert(!output.includes('error: option'), 'should not have option parsing error')
console.log('✓ -q (quiet) flag is accepted with agent archive\n')
await $`PASEO_HOST=localhost:${port} PASEO_HOME=${paseoHome} npx paseo -q agent archive abc123`.nothrow();
const output = result.stdout + result.stderr;
assert(!output.includes("unknown option"), "should accept -q flag");
assert(!output.includes("error: option"), "should not have option parsing error");
console.log("✓ -q (quiet) flag is accepted with agent archive\n");
}
} finally {
// Clean up temp directory
await rm(paseoHome, { recursive: true, force: true })
await rm(paseoHome, { recursive: true, force: true });
}
console.log('=== All agent archive tests passed ===')
console.log("=== All agent archive tests passed ===");