Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ jobs:

- run: npm ci
- run: npm run lint
- run: npm run format:check
- run: npm test
- run: npm run build
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish to npm

on:
push:
tags:
- "v*"

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
registry-url: https://registry.npmjs.org

- run: npm ci
- run: npm run lint
- run: npm run format:check
- run: npm test
- run: npm run build
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "crucible-cli",
"version": "0.1.0",
"version": "0.1.3",
"description": "The kubectl of Azure Service Bus — CLI for message operations, DLQ management, and namespace monitoring",
"type": "module",
"bin": {
"crucible": "./dist/cli.js"
"crucible": "dist/cli.js"
},
"files": [
"dist",
Expand Down Expand Up @@ -35,7 +35,7 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/broediger/crucible-cli.git"
"url": "git+https://github.com/broediger/crucible-cli.git"
},
"homepage": "https://github.com/broediger/crucible-cli",
"bugs": {
Expand Down
14 changes: 12 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { createRequire } from "node:module";
import { Command } from "commander";

const require = createRequire(import.meta.url);
const { version } = require("../package.json") as { version: string };
import { configCommand } from "./commands/config.js";
import { loginCommand } from "./commands/login.js";
import { statusCommand } from "./commands/status.js";
Expand All @@ -25,7 +29,7 @@ program
.description(
"The kubectl of Azure Service Bus — message operations, DLQ management, and namespace monitoring"
)
.version("0.1.0");
.version(version);

// --- Phase 1: Foundation ---
program.addCommand(configCommand);
Expand Down Expand Up @@ -56,7 +60,13 @@ program.addCommand(costsCommand);
// --- Global error handler ---
// Exit codes: 0 = success, 1 = error, 2 = warning/threshold (set by commands like diff)
process.on("unhandledRejection", (err: unknown) => {
const msg = err instanceof Error ? err.message : String(err);
let msg: string;
if (err instanceof AggregateError && err.errors.length > 0) {
const unique = [...new Set(err.errors.map((e: Error) => e.message))];
msg = unique.join("\n");
} else {
msg = err instanceof Error ? err.message : String(err);
}
console.error(`Error: ${msg}`);
process.exit(1);
});
Expand Down
Loading