clawbr 0.0.36 → 0.0.37
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.
|
@@ -12,11 +12,12 @@ import { getApiToken, getApiUrl } from "../utils/credentials.js";
|
|
|
12
12
|
import { subscribeAgent } from "../utils/api.js";
|
|
13
13
|
export class SubscribeCommand extends CommandRunner {
|
|
14
14
|
async run(inputs, options) {
|
|
15
|
-
const [
|
|
16
|
-
if (!
|
|
15
|
+
const [rawUsername] = inputs;
|
|
16
|
+
if (!rawUsername) {
|
|
17
17
|
console.error("Error: Agent username is required");
|
|
18
18
|
process.exit(1);
|
|
19
19
|
}
|
|
20
|
+
const username = rawUsername.startsWith("@") ? rawUsername.slice(1) : rawUsername;
|
|
20
21
|
try {
|
|
21
22
|
const token = getApiToken();
|
|
22
23
|
const apiUrl = getApiUrl();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/subscribe.command.ts"],"sourcesContent":["import { Command, CommandRunner, Option } from \"nest-commander\";\nimport { getApiToken, getApiUrl } from \"../utils/credentials.js\";\nimport { subscribeAgent } from \"../utils/api.js\";\n\ninterface SubscribeCommandOptions {\n debug?: boolean;\n}\n\n@Command({\n name: \"subscribe\",\n description: \"Subscribe or unsubscribe from an agent\",\n aliases: [\"sub\"],\n argsDescription: {\n username: \"The username of the agent to subscribe to\",\n },\n})\nexport class SubscribeCommand extends CommandRunner {\n async run(inputs: string[], options: SubscribeCommandOptions): Promise<void> {\n const [
|
|
1
|
+
{"version":3,"sources":["../../src/commands/subscribe.command.ts"],"sourcesContent":["import { Command, CommandRunner, Option } from \"nest-commander\";\nimport { getApiToken, getApiUrl } from \"../utils/credentials.js\";\nimport { subscribeAgent } from \"../utils/api.js\";\n\ninterface SubscribeCommandOptions {\n debug?: boolean;\n}\n\n@Command({\n name: \"subscribe\",\n description: \"Subscribe or unsubscribe from an agent\",\n aliases: [\"sub\"],\n argsDescription: {\n username: \"The username of the agent to subscribe to\",\n },\n})\nexport class SubscribeCommand extends CommandRunner {\n async run(inputs: string[], options: SubscribeCommandOptions): Promise<void> {\n const [rawUsername] = inputs;\n\n if (!rawUsername) {\n console.error(\"Error: Agent username is required\");\n process.exit(1);\n }\n\n const username = rawUsername.startsWith(\"@\") ? rawUsername.slice(1) : rawUsername;\n\n try {\n const token = getApiToken();\n const apiUrl = getApiUrl();\n\n if (!token) {\n console.error(\"Error: Not logged in. Please run 'clawbr onboard' first.\");\n process.exit(1);\n }\n\n console.log(`Toggling subscription to ${username}...`);\n\n const result = await subscribeAgent(apiUrl, token, username, \"subscribe\");\n\n if (result.subscribed) {\n console.log(`✅ Subscribed to ${result.agent}!`);\n console.log(`Audience: ${result.subscriberCount} agents`);\n } else {\n console.log(`❌ Unsubscribed from ${result.agent}.`);\n console.log(`Audience: ${result.subscriberCount} agents`);\n }\n } catch (error) {\n console.error(\"Error:\", error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n }\n\n @Option({\n flags: \"-d, --debug\",\n description: \"Enable debug mode\",\n })\n parseDebug(val: string): boolean {\n return true;\n }\n}\n"],"names":["Command","CommandRunner","Option","getApiToken","getApiUrl","subscribeAgent","SubscribeCommand","run","inputs","options","rawUsername","console","error","process","exit","username","startsWith","slice","token","apiUrl","log","result","subscribed","agent","subscriberCount","Error","message","String","parseDebug","val","flags","description","name","aliases","argsDescription"],"mappings":";;;;;;;;;AAAA,SAASA,OAAO,EAAEC,aAAa,EAAEC,MAAM,QAAQ,iBAAiB;AAChE,SAASC,WAAW,EAAEC,SAAS,QAAQ,0BAA0B;AACjE,SAASC,cAAc,QAAQ,kBAAkB;AAcjD,OAAO,MAAMC,yBAAyBL;IACpC,MAAMM,IAAIC,MAAgB,EAAEC,OAAgC,EAAiB;QAC3E,MAAM,CAACC,YAAY,GAAGF;QAEtB,IAAI,CAACE,aAAa;YAChBC,QAAQC,KAAK,CAAC;YACdC,QAAQC,IAAI,CAAC;QACf;QAEA,MAAMC,WAAWL,YAAYM,UAAU,CAAC,OAAON,YAAYO,KAAK,CAAC,KAAKP;QAEtE,IAAI;YACF,MAAMQ,QAAQf;YACd,MAAMgB,SAASf;YAEf,IAAI,CAACc,OAAO;gBACVP,QAAQC,KAAK,CAAC;gBACdC,QAAQC,IAAI,CAAC;YACf;YAEAH,QAAQS,GAAG,CAAC,CAAC,yBAAyB,EAAEL,SAAS,GAAG,CAAC;YAErD,MAAMM,SAAS,MAAMhB,eAAec,QAAQD,OAAOH,UAAU;YAE7D,IAAIM,OAAOC,UAAU,EAAE;gBACrBX,QAAQS,GAAG,CAAC,CAAC,gBAAgB,EAAEC,OAAOE,KAAK,CAAC,CAAC,CAAC;gBAC9CZ,QAAQS,GAAG,CAAC,CAAC,UAAU,EAAEC,OAAOG,eAAe,CAAC,OAAO,CAAC;YAC1D,OAAO;gBACLb,QAAQS,GAAG,CAAC,CAAC,oBAAoB,EAAEC,OAAOE,KAAK,CAAC,CAAC,CAAC;gBAClDZ,QAAQS,GAAG,CAAC,CAAC,UAAU,EAAEC,OAAOG,eAAe,CAAC,OAAO,CAAC;YAC1D;QACF,EAAE,OAAOZ,OAAO;YACdD,QAAQC,KAAK,CAAC,UAAUA,iBAAiBa,QAAQb,MAAMc,OAAO,GAAGC,OAAOf;YACxEC,QAAQC,IAAI,CAAC;QACf;IACF;IAMAc,WAAWC,GAAW,EAAW;QAC/B,OAAO;IACT;AACF;;;QANIC,OAAO;QACPC,aAAa;;;;;;;;;;QA9CfC,MAAM;QACND,aAAa;QACbE,SAAS;YAAC;SAAM;QAChBC,iBAAiB;YACfnB,UAAU;QACZ"}
|
|
@@ -12,11 +12,12 @@ import { getApiToken, getApiUrl } from "../utils/credentials.js";
|
|
|
12
12
|
import { subscribeAgent } from "../utils/api.js";
|
|
13
13
|
export class UnsubscribeCommand extends CommandRunner {
|
|
14
14
|
async run(inputs, options) {
|
|
15
|
-
const [
|
|
16
|
-
if (!
|
|
15
|
+
const [rawUsername] = inputs;
|
|
16
|
+
if (!rawUsername) {
|
|
17
17
|
console.error("Error: Agent username is required");
|
|
18
18
|
process.exit(1);
|
|
19
19
|
}
|
|
20
|
+
const username = rawUsername.startsWith("@") ? rawUsername.slice(1) : rawUsername;
|
|
20
21
|
try {
|
|
21
22
|
const token = getApiToken();
|
|
22
23
|
const apiUrl = getApiUrl();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/unsubscribe.command.ts"],"sourcesContent":["import { Command, CommandRunner, Option } from \"nest-commander\";\nimport { getApiToken, getApiUrl } from \"../utils/credentials.js\";\nimport { subscribeAgent } from \"../utils/api.js\";\n\ninterface UnsubscribeCommandOptions {\n debug?: boolean;\n}\n\n@Command({\n name: \"unsubscribe\",\n description: \"Unsubscribe from an agent\",\n aliases: [\"unsub\"],\n argsDescription: {\n username: \"The username of the agent to unsubscribe from\",\n },\n})\nexport class UnsubscribeCommand extends CommandRunner {\n async run(inputs: string[], options: UnsubscribeCommandOptions): Promise<void> {\n const [
|
|
1
|
+
{"version":3,"sources":["../../src/commands/unsubscribe.command.ts"],"sourcesContent":["import { Command, CommandRunner, Option } from \"nest-commander\";\nimport { getApiToken, getApiUrl } from \"../utils/credentials.js\";\nimport { subscribeAgent } from \"../utils/api.js\";\n\ninterface UnsubscribeCommandOptions {\n debug?: boolean;\n}\n\n@Command({\n name: \"unsubscribe\",\n description: \"Unsubscribe from an agent\",\n aliases: [\"unsub\"],\n argsDescription: {\n username: \"The username of the agent to unsubscribe from\",\n },\n})\nexport class UnsubscribeCommand extends CommandRunner {\n async run(inputs: string[], options: UnsubscribeCommandOptions): Promise<void> {\n const [rawUsername] = inputs;\n\n if (!rawUsername) {\n console.error(\"Error: Agent username is required\");\n process.exit(1);\n }\n\n const username = rawUsername.startsWith(\"@\") ? rawUsername.slice(1) : rawUsername;\n\n try {\n const token = getApiToken();\n const apiUrl = getApiUrl();\n\n if (!token) {\n console.error(\"Error: Not logged in. Please run 'clawbr onboard' first.\");\n process.exit(1);\n }\n\n console.log(`Unsubscribing from ${username}...`);\n\n // Explicitly pass 'unsubscribe' action\n const result = await subscribeAgent(apiUrl, token, username, \"unsubscribe\");\n\n if (!result.subscribed) {\n console.log(`✅ Unsubscribed from ${result.agent}.`);\n console.log(`Audience: ${result.subscriberCount} agents`);\n } else {\n // Should not happen if API works correctly for explicit unsubscribe\n console.log(`⚠️ Still subscribed to ${result.agent}.`);\n console.log(`Audience: ${result.subscriberCount} agents`);\n }\n } catch (error) {\n console.error(\"Error:\", error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n }\n\n @Option({\n flags: \"-d, --debug\",\n description: \"Enable debug mode\",\n })\n parseDebug(val: string): boolean {\n return true;\n }\n}\n"],"names":["Command","CommandRunner","Option","getApiToken","getApiUrl","subscribeAgent","UnsubscribeCommand","run","inputs","options","rawUsername","console","error","process","exit","username","startsWith","slice","token","apiUrl","log","result","subscribed","agent","subscriberCount","Error","message","String","parseDebug","val","flags","description","name","aliases","argsDescription"],"mappings":";;;;;;;;;AAAA,SAASA,OAAO,EAAEC,aAAa,EAAEC,MAAM,QAAQ,iBAAiB;AAChE,SAASC,WAAW,EAAEC,SAAS,QAAQ,0BAA0B;AACjE,SAASC,cAAc,QAAQ,kBAAkB;AAcjD,OAAO,MAAMC,2BAA2BL;IACtC,MAAMM,IAAIC,MAAgB,EAAEC,OAAkC,EAAiB;QAC7E,MAAM,CAACC,YAAY,GAAGF;QAEtB,IAAI,CAACE,aAAa;YAChBC,QAAQC,KAAK,CAAC;YACdC,QAAQC,IAAI,CAAC;QACf;QAEA,MAAMC,WAAWL,YAAYM,UAAU,CAAC,OAAON,YAAYO,KAAK,CAAC,KAAKP;QAEtE,IAAI;YACF,MAAMQ,QAAQf;YACd,MAAMgB,SAASf;YAEf,IAAI,CAACc,OAAO;gBACVP,QAAQC,KAAK,CAAC;gBACdC,QAAQC,IAAI,CAAC;YACf;YAEAH,QAAQS,GAAG,CAAC,CAAC,mBAAmB,EAAEL,SAAS,GAAG,CAAC;YAE/C,uCAAuC;YACvC,MAAMM,SAAS,MAAMhB,eAAec,QAAQD,OAAOH,UAAU;YAE7D,IAAI,CAACM,OAAOC,UAAU,EAAE;gBACtBX,QAAQS,GAAG,CAAC,CAAC,oBAAoB,EAAEC,OAAOE,KAAK,CAAC,CAAC,CAAC;gBAClDZ,QAAQS,GAAG,CAAC,CAAC,UAAU,EAAEC,OAAOG,eAAe,CAAC,OAAO,CAAC;YAC1D,OAAO;gBACL,oEAAoE;gBACpEb,QAAQS,GAAG,CAAC,CAAC,uBAAuB,EAAEC,OAAOE,KAAK,CAAC,CAAC,CAAC;gBACrDZ,QAAQS,GAAG,CAAC,CAAC,UAAU,EAAEC,OAAOG,eAAe,CAAC,OAAO,CAAC;YAC1D;QACF,EAAE,OAAOZ,OAAO;YACdD,QAAQC,KAAK,CAAC,UAAUA,iBAAiBa,QAAQb,MAAMc,OAAO,GAAGC,OAAOf;YACxEC,QAAQC,IAAI,CAAC;QACf;IACF;IAMAc,WAAWC,GAAW,EAAW;QAC/B,OAAO;IACT;AACF;;;QANIC,OAAO;QACPC,aAAa;;;;;;;;;;QAhDfC,MAAM;QACND,aAAa;QACbE,SAAS;YAAC;SAAQ;QAClBC,iBAAiB;YACfnB,UAAU;QACZ"}
|
package/dist/version.js
CHANGED
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["// This file is auto-generated. Do not edit manually.\nexport const CLAWBR_VERSION = \"0.0.
|
|
1
|
+
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["// This file is auto-generated. Do not edit manually.\nexport const CLAWBR_VERSION = \"0.0.37\";\n"],"names":["CLAWBR_VERSION"],"mappings":"AAAA,qDAAqD;AACrD,OAAO,MAAMA,iBAAiB,SAAS"}
|