diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 267e865..40d17dd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -89,10 +89,12 @@ jobs: cp -R /tmp/release/cli-linux-x64/. packages/cli-linux-x64/ - name: Publish platform packages run: | + VERSION="${{ github.ref_name }}" + VERSION="${VERSION#v}" for pkg in cli-darwin-arm64 cli-darwin-x64 cli-linux-arm64 cli-linux-x64; do npm publish --access public --workspace "@tpsdev-ai/$pkg" || { - if npm view "@tpsdev-ai/$pkg@${{ github.ref_name }}" version 2>/dev/null; then - echo "⏭️ @tpsdev-ai/$pkg already published, skipping" + if npm view "@tpsdev-ai/$pkg@$VERSION" version 2>/dev/null; then + echo "⏭️ @tpsdev-ai/$pkg@$VERSION already published, skipping" else echo "❌ Failed to publish @tpsdev-ai/$pkg" && exit 1 fi @@ -102,9 +104,11 @@ jobs: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Publish meta package run: | + VERSION="${{ github.ref_name }}" + VERSION="${VERSION#v}" npm publish --access public --workspace @tpsdev-ai/cli || { - if npm view "@tpsdev-ai/cli@${{ github.ref_name }}" version 2>/dev/null; then - echo "⏭️ @tpsdev-ai/cli already published, skipping" + if npm view "@tpsdev-ai/cli@$VERSION" version 2>/dev/null; then + echo "⏭️ @tpsdev-ai/cli@$VERSION already published, skipping" else exit 1 fi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4ecd43c..7ae6f07 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,7 +55,7 @@ jobs: bun-version: latest - run: bun install --frozen-lockfile - name: Check for known vulnerabilities - run: bunx audit-ci --high + run: bun audit docker: name: Docker Integration diff --git a/package.json b/package.json index 3c0914e..b2943b0 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,10 @@ "packages/*" ], "scripts": { - "build": "npm run build --workspaces --if-present", - "test": "npm run test --workspaces --if-present", - "lint": "npm run lint --workspaces --if-present", - "lint:ci": "npm run lint:ci --workspaces --if-present", + "build": "cd packages/agent && bun run build && cd ../cli && bun run build", + "test": "cd packages/agent && bun test && cd ../cli && bun test", + "lint": "cd packages/cli && bun run lint", + "lint:ci": "cd packages/cli && bun run lint:ci", "tps": "node packages/cli/dist/bin/tps.js" }, "devDependencies": { diff --git a/packages/cli/bin/tps.ts b/packages/cli/bin/tps.ts index 95f5996..3030799 100755 --- a/packages/cli/bin/tps.ts +++ b/packages/cli/bin/tps.ts @@ -429,4 +429,7 @@ async function main() { } } -main(); +main().catch((err) => { + console.error(err?.message || err); + process.exit(1); +}); diff --git a/packages/cli/src/commands/backup.ts b/packages/cli/src/commands/backup.ts index 3c1c29b..03df8b0 100644 --- a/packages/cli/src/commands/backup.ts +++ b/packages/cli/src/commands/backup.ts @@ -220,8 +220,9 @@ function readManifestFromArchive(tmpDir: string): Manifest { function runTarCreate(stagingDir: string, archivePath: string): void { const cmd = ["tar", "-czf", archivePath, "-C", stagingDir, "."]; const res = spawnSync(cmd[0], cmd.slice(1), { encoding: "utf-8" }); - if (res.status !== 0) { - throw new Error(`tar create failed: ${res.stderr || res.stdout}`); + // GNU tar exits 1 for "file changed as we read it" — archive is still valid + if (res.status !== 0 && res.status !== 1) { + throw new Error(`tar create failed (exit ${res.status}): ${res.stderr || res.stdout}`); } } diff --git a/packages/cli/test/backup.test.ts b/packages/cli/test/backup.test.ts index bfc0b4a..93f9859 100644 --- a/packages/cli/test/backup.test.ts +++ b/packages/cli/test/backup.test.ts @@ -56,11 +56,13 @@ exit 0 }); function run(args: string[]) { - return spawnSync("bun", [TPS_BIN, ...args], { + const result = spawnSync("bun", [TPS_BIN, ...args], { cwd: tempRoot, encoding: "utf-8", env: process.env, }); + + return result; } function createWorkspace(agent: string) {