badgerclaw 0.1.3 → 0.1.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.
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare const logoutCommand: Command;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.logoutCommand = void 0;
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const auth_1 = require("../lib/auth");
10
+ const api_1 = require("../lib/api");
11
+ exports.logoutCommand = new commander_1.Command('logout')
12
+ .description('Disconnect this machine and log out of BadgerClaw')
13
+ .action(async () => {
14
+ const auth = (0, auth_1.readAuth)();
15
+ if (!auth) {
16
+ console.log(chalk_1.default.yellow('Not logged in.'));
17
+ return;
18
+ }
19
+ // Mark instance offline on backend
20
+ try {
21
+ const client = (0, api_1.getAuthenticatedClient)(auth.access_token);
22
+ const { version } = require('../../package.json');
23
+ await client.post('/api/v1/openclaw/register', {
24
+ instance_id: auth.instance_id,
25
+ label: require('os').hostname(),
26
+ version,
27
+ online: false,
28
+ });
29
+ }
30
+ catch {
31
+ // Non-fatal
32
+ }
33
+ (0, auth_1.clearAuth)();
34
+ console.log(chalk_1.default.green(`Logged out — this machine is now disconnected.`));
35
+ });
36
+ //# sourceMappingURL=logout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout.js","sourceRoot":"","sources":["../../src/commands/logout.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAoC;AACpC,kDAA0B;AAC1B,sCAAmE;AACnE,oCAAoD;AAEvC,QAAA,aAAa,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,mDAAmD,CAAC;KAChE,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,IAAI,GAAG,IAAA,eAAQ,GAAE,CAAC;IACxB,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC5C,OAAO;IACT,CAAC;IAED,mCAAmC;IACnC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,4BAAsB,EAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzD,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAClD,MAAM,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE;YAC7C,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;YAC/B,OAAO;YACP,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,YAAY;IACd,CAAC;IAED,IAAA,gBAAS,GAAE,CAAC;IACZ,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC,CAAC;AAC7E,CAAC,CAAC,CAAC"}
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const commander_1 = require("commander");
5
5
  const login_1 = require("./commands/login");
6
+ const logout_1 = require("./commands/logout");
6
7
  const status_1 = require("./commands/status");
7
8
  const bot_1 = require("./commands/bot");
8
9
  const program = new commander_1.Command();
@@ -11,6 +12,7 @@ program
11
12
  .description('BadgerClaw CLI — one-click bot provisioning')
12
13
  .version(require('../package.json').version);
13
14
  program.addCommand(login_1.loginCommand);
15
+ program.addCommand(logout_1.logoutCommand);
14
16
  program.addCommand(status_1.statusCommand);
15
17
  program.addCommand(bot_1.botCommand);
16
18
  program.parse(process.argv);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,4CAAgD;AAChD,8CAAkD;AAClD,wCAA4C;AAE5C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,6CAA6C,CAAC;KAC1D,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC;AAE/C,OAAO,CAAC,UAAU,CAAC,oBAAY,CAAC,CAAC;AACjC,OAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,gBAAU,CAAC,CAAC;AAE/B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,4CAAgD;AAChD,8CAAkD;AAClD,8CAAkD;AAClD,wCAA4C;AAE5C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,6CAA6C,CAAC;KAC1D,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC;AAE/C,OAAO,CAAC,UAAU,CAAC,oBAAY,CAAC,CAAC;AACjC,OAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,gBAAU,CAAC,CAAC;AAE/B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
package/dist/lib/api.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  export declare function getClient(): AxiosInstance;
3
3
  export declare function getUnauthenticatedClient(): AxiosInstance;
4
+ export declare function getAuthenticatedClient(token: string): AxiosInstance;
package/dist/lib/api.js CHANGED
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getClient = getClient;
7
7
  exports.getUnauthenticatedClient = getUnauthenticatedClient;
8
+ exports.getAuthenticatedClient = getAuthenticatedClient;
8
9
  const axios_1 = __importDefault(require("axios"));
9
10
  const auth_1 = require("./auth");
10
11
  const BASE_URL = 'https://api.badgerclaw.ai';
@@ -24,4 +25,13 @@ function getUnauthenticatedClient() {
24
25
  headers: { 'Content-Type': 'application/json' },
25
26
  });
26
27
  }
28
+ function getAuthenticatedClient(token) {
29
+ return axios_1.default.create({
30
+ baseURL: BASE_URL,
31
+ headers: {
32
+ 'Content-Type': 'application/json',
33
+ Authorization: `Bearer ${token}`,
34
+ },
35
+ });
36
+ }
27
37
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":";;;;;AAKA,8BASC;AAED,4DAKC;AArBD,kDAA6C;AAC7C,iCAAkC;AAElC,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AAE7C,SAAgB,SAAS;IACvB,MAAM,IAAI,GAAG,IAAA,eAAQ,GAAE,CAAC;IACxB,MAAM,OAAO,GAA2B;QACtC,cAAc,EAAE,kBAAkB;KACnC,CAAC;IACF,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,IAAI,CAAC,YAAY,EAAE,CAAC;IAC3D,CAAC;IACD,OAAO,eAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AACtD,CAAC;AAED,SAAgB,wBAAwB;IACtC,OAAO,eAAK,CAAC,MAAM,CAAC;QAClB,OAAO,EAAE,QAAQ;QACjB,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;KAChD,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":";;;;;AAKA,8BASC;AAED,4DAKC;AAED,wDAQC;AA/BD,kDAA6C;AAC7C,iCAAkC;AAElC,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AAE7C,SAAgB,SAAS;IACvB,MAAM,IAAI,GAAG,IAAA,eAAQ,GAAE,CAAC;IACxB,MAAM,OAAO,GAA2B;QACtC,cAAc,EAAE,kBAAkB;KACnC,CAAC;IACF,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,IAAI,CAAC,YAAY,EAAE,CAAC;IAC3D,CAAC;IACD,OAAO,eAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AACtD,CAAC;AAED,SAAgB,wBAAwB;IACtC,OAAO,eAAK,CAAC,MAAM,CAAC;QAClB,OAAO,EAAE,QAAQ;QACjB,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;KAChD,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,sBAAsB,CAAC,KAAa;IAClD,OAAO,eAAK,CAAC,MAAM,CAAC;QAClB,OAAO,EAAE,QAAQ;QACjB,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,KAAK,EAAE;SACjC;KACF,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badgerclaw",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "BadgerClaw CLI \u2014 one-click bot provisioning",
5
5
  "main": "dist/index.js",
6
6
  "bin": {