@tasknet-protocol/cli 0.5.0 → 0.6.0

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.
package/dist/index.js CHANGED
@@ -9,6 +9,68 @@ var __export = (target, all) => {
9
9
  __defProp(target, name, { get: all[name], enumerable: true });
10
10
  };
11
11
 
12
+ // src/config.ts
13
+ var config_exports = {};
14
+ __export(config_exports, {
15
+ clearConfig: () => clearConfig,
16
+ config: () => config,
17
+ getConfig: () => getConfig,
18
+ getConfigPath: () => getConfigPath,
19
+ setConfig: () => setConfig
20
+ });
21
+ import Conf from "conf";
22
+ function getConfig() {
23
+ return {
24
+ apiUrl: config.get("apiUrl"),
25
+ apiKey: config.get("apiKey"),
26
+ network: config.get("network"),
27
+ rpcUrl: config.get("rpcUrl"),
28
+ packageId: config.get("packageId"),
29
+ walrusAggregator: config.get("walrusAggregator"),
30
+ walrusPublisher: config.get("walrusPublisher"),
31
+ agentId: config.get("agentId"),
32
+ agentName: config.get("agentName"),
33
+ outputFormat: config.get("outputFormat")
34
+ };
35
+ }
36
+ function setConfig(key, value) {
37
+ config.set(key, value);
38
+ }
39
+ function clearConfig() {
40
+ config.clear();
41
+ }
42
+ function getConfigPath() {
43
+ return config.path;
44
+ }
45
+ var defaults, config;
46
+ var init_config = __esm({
47
+ "src/config.ts"() {
48
+ "use strict";
49
+ defaults = {
50
+ apiUrl: "http://localhost:3000",
51
+ network: "testnet",
52
+ outputFormat: "table"
53
+ };
54
+ config = new Conf({
55
+ projectName: "tasknet-cli",
56
+ projectVersion: "0.6.0",
57
+ defaults,
58
+ schema: {
59
+ apiUrl: { type: "string" },
60
+ apiKey: { type: "string" },
61
+ network: { type: "string", enum: ["mainnet", "testnet", "devnet", "localnet"] },
62
+ rpcUrl: { type: "string" },
63
+ packageId: { type: "string" },
64
+ walrusAggregator: { type: "string" },
65
+ walrusPublisher: { type: "string" },
66
+ agentId: { type: "string" },
67
+ agentName: { type: "string" },
68
+ outputFormat: { type: "string", enum: ["table", "json"] }
69
+ }
70
+ });
71
+ }
72
+ });
73
+
12
74
  // ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/cryptoNode.js
13
75
  import * as nc from "crypto";
14
76
  var crypto;
@@ -12408,55 +12470,11 @@ var init_cryptography = __esm({
12408
12470
  import { Command as Command2 } from "commander";
12409
12471
  import chalk3 from "chalk";
12410
12472
 
12411
- // src/config.ts
12412
- import Conf from "conf";
12413
- var defaults = {
12414
- apiUrl: "http://localhost:3000",
12415
- network: "testnet",
12416
- outputFormat: "table"
12417
- };
12418
- var config = new Conf({
12419
- projectName: "tasknet-cli",
12420
- projectVersion: "0.5.0",
12421
- defaults,
12422
- schema: {
12423
- apiUrl: { type: "string" },
12424
- apiKey: { type: "string" },
12425
- network: { type: "string", enum: ["mainnet", "testnet", "devnet", "localnet"] },
12426
- rpcUrl: { type: "string" },
12427
- packageId: { type: "string" },
12428
- walrusAggregator: { type: "string" },
12429
- walrusPublisher: { type: "string" },
12430
- agentId: { type: "string" },
12431
- agentName: { type: "string" },
12432
- outputFormat: { type: "string", enum: ["table", "json"] }
12433
- }
12434
- });
12435
- function getConfig() {
12436
- return {
12437
- apiUrl: config.get("apiUrl"),
12438
- apiKey: config.get("apiKey"),
12439
- network: config.get("network"),
12440
- rpcUrl: config.get("rpcUrl"),
12441
- packageId: config.get("packageId"),
12442
- walrusAggregator: config.get("walrusAggregator"),
12443
- walrusPublisher: config.get("walrusPublisher"),
12444
- agentId: config.get("agentId"),
12445
- agentName: config.get("agentName"),
12446
- outputFormat: config.get("outputFormat")
12447
- };
12448
- }
12449
- function setConfig(key, value) {
12450
- config.set(key, value);
12451
- }
12452
- function clearConfig() {
12453
- config.clear();
12454
- }
12455
- function getConfigPath() {
12456
- return config.path;
12457
- }
12473
+ // src/commands/config.ts
12474
+ init_config();
12458
12475
 
12459
12476
  // src/utils.ts
12477
+ init_config();
12460
12478
  import chalk from "chalk";
12461
12479
  import ora from "ora";
12462
12480
  var colors = {
@@ -12536,6 +12554,19 @@ function output(data, tableFormatter) {
12536
12554
  jsonOutput(data);
12537
12555
  }
12538
12556
  }
12557
+ function requireConfig(key) {
12558
+ const config2 = getConfig();
12559
+ const value = config2[key];
12560
+ if (!value) {
12561
+ error(`Missing configuration: ${key}`);
12562
+ error(`Run: tasknet config set ${key} <value>`);
12563
+ process.exit(1);
12564
+ }
12565
+ return value;
12566
+ }
12567
+ function requireApiKey() {
12568
+ return requireConfig("apiKey");
12569
+ }
12539
12570
 
12540
12571
  // src/commands/config.ts
12541
12572
  function registerConfigCommands(program2) {
@@ -12630,6 +12661,7 @@ Valid keys: ${validKeys.join(", ")}`);
12630
12661
  }
12631
12662
 
12632
12663
  // src/client.ts
12664
+ init_config();
12633
12665
  import { TaskNetClient } from "@tasknet-protocol/sdk";
12634
12666
  var clientInstance = null;
12635
12667
  function getClient() {
@@ -12649,6 +12681,7 @@ function getClient() {
12649
12681
  }
12650
12682
 
12651
12683
  // src/commands/agent.ts
12684
+ init_config();
12652
12685
  function generateSignatureChallenge(agentId, action, timestamp) {
12653
12686
  return `TaskNet Verification
12654
12687
 
@@ -13300,6 +13333,7 @@ ${colors.primary("Search Results")} for "${query}"
13300
13333
 
13301
13334
  // src/commands/task.ts
13302
13335
  import { STATUS } from "@tasknet-protocol/shared";
13336
+ init_config();
13303
13337
  function registerTaskCommands(program2) {
13304
13338
  const taskCmd = program2.command("task").alias("tasks").description("Manage tasks");
13305
13339
  taskCmd.command("list").description("List tasks").option("-p, --page <number>", "Page number", "1").option("-l, --limit <number>", "Items per page", "20").option("-s, --status <status>", "Filter by status (0-9)").option("--skill <id>", "Filter by skill ID").option("--requester <id>", "Filter by requester agent ID").option("--worker <id>", "Filter by worker agent ID").option("--mine", "Show my tasks (as requester or worker)").option("--available", "Show only available tasks (Posted status)").option("--sort <field>", "Sort by: created_at, expires_at, payment, priority", "created_at").option("-o, --order <dir>", "Sort order: asc, desc", "desc").action(async (options) => {
@@ -13789,7 +13823,231 @@ function getTierColor(tier) {
13789
13823
  }
13790
13824
  }
13791
13825
 
13826
+ // src/commands/claim.ts
13827
+ import { CLAIM_TYPE, CLAIM_TYPE_LABELS, CLAIM_STATUS_LABELS } from "@tasknet-protocol/shared";
13828
+ function registerClaimCommands(program2) {
13829
+ const claimCmd = program2.command("claim").description("Identity verification commands");
13830
+ claimCmd.command("generate <type>").description("Generate a verification claim").addHelpText(
13831
+ "after",
13832
+ `
13833
+ Claim Types:
13834
+ twitter - Verify via Twitter/X post
13835
+ moltbook - Verify via Moltbook post
13836
+ github - Verify via GitHub Gist
13837
+ wallet - Verify via wallet signature
13838
+
13839
+ Examples:
13840
+ $ tasknet claim generate twitter
13841
+ $ tasknet claim generate github
13842
+ $ tasknet claim generate wallet
13843
+ `
13844
+ ).action(async (type) => {
13845
+ await requireApiKey();
13846
+ const client = getClient();
13847
+ const typeMap = {
13848
+ twitter: CLAIM_TYPE.TWITTER,
13849
+ x: CLAIM_TYPE.TWITTER,
13850
+ moltbook: CLAIM_TYPE.MOLTBOOK,
13851
+ github: CLAIM_TYPE.GITHUB,
13852
+ wallet: CLAIM_TYPE.WALLET
13853
+ };
13854
+ const claimType = typeMap[type.toLowerCase()];
13855
+ if (claimType === void 0) {
13856
+ error(`Invalid claim type: ${type}`);
13857
+ log("Valid types: twitter, moltbook, github, wallet");
13858
+ process.exit(1);
13859
+ }
13860
+ const spin = spinner(`Generating ${type} claim...`).start();
13861
+ try {
13862
+ const result = await client.api.generateClaim(claimType);
13863
+ spin.stop();
13864
+ success(`Claim generated successfully!
13865
+ `);
13866
+ output(result, () => {
13867
+ let str = `${colors.primary("Claim Details")}
13868
+
13869
+ `;
13870
+ str += ` Claim ID: ${result.claim_id}
13871
+ `;
13872
+ str += ` Type: ${result.claim_type}
13873
+ `;
13874
+ str += ` Status: ${result.status}
13875
+ `;
13876
+ str += ` Code: ${colors.success(result.verification_code)}
13877
+
13878
+ `;
13879
+ str += `${colors.primary("Instructions")}
13880
+
13881
+ `;
13882
+ str += ` ${result.instructions.split("\n").join("\n ")}
13883
+
13884
+ `;
13885
+ str += `${colors.muted("Next step:")}
13886
+ `;
13887
+ str += ` After completing the verification step, run:
13888
+ `;
13889
+ str += ` tasknet claim verify ${result.claim_id} <post_url_or_signature>
13890
+ `;
13891
+ return str;
13892
+ });
13893
+ } catch (err) {
13894
+ spin.stop();
13895
+ error(`Failed to generate claim: ${err.message}`);
13896
+ process.exit(1);
13897
+ }
13898
+ });
13899
+ claimCmd.command("verify <claim-id> <proof>").description("Verify a pending claim with post URL or signature").addHelpText(
13900
+ "after",
13901
+ `
13902
+ Arguments:
13903
+ claim-id - The claim ID from 'claim generate'
13904
+ proof - Post URL (twitter/moltbook/github) or wallet signature
13905
+
13906
+ Examples:
13907
+ $ tasknet claim verify abc123 https://twitter.com/user/status/123456789
13908
+ $ tasknet claim verify abc123 https://gist.github.com/user/abc123
13909
+ $ tasknet claim verify abc123 <base64-signature>
13910
+ `
13911
+ ).action(async (claimId, proof) => {
13912
+ await requireApiKey();
13913
+ const client = getClient();
13914
+ const spin = spinner("Verifying claim...").start();
13915
+ try {
13916
+ const isUrl = proof.startsWith("http");
13917
+ const result = await client.api.verifyClaim({
13918
+ claimId,
13919
+ postUrl: isUrl ? proof : void 0,
13920
+ signature: !isUrl ? proof : void 0
13921
+ });
13922
+ spin.stop();
13923
+ success(`Claim verified successfully!
13924
+ `);
13925
+ output(result, () => {
13926
+ let str = `${colors.primary("Verification Result")}
13927
+
13928
+ `;
13929
+ str += ` Claim ID: ${result.claim_id}
13930
+ `;
13931
+ str += ` Type: ${result.claim_type}
13932
+ `;
13933
+ str += ` Handle: ${result.verified_handle || "N/A"}
13934
+ `;
13935
+ str += ` Verified: ${result.verified_at}
13936
+ `;
13937
+ if (result.badge_awarded) {
13938
+ str += `
13939
+ \u{1F3C5} Badge Awarded: ${result.badge_awarded}
13940
+ `;
13941
+ }
13942
+ return str;
13943
+ });
13944
+ } catch (err) {
13945
+ spin.stop();
13946
+ error(`Verification failed: ${err.message}`);
13947
+ process.exit(1);
13948
+ }
13949
+ });
13950
+ claimCmd.command("status <claim-id>").description("Get claim status").action(async (claimId) => {
13951
+ const client = getClient();
13952
+ const spin = spinner("Fetching claim...").start();
13953
+ try {
13954
+ const result = await client.api.getClaim(claimId);
13955
+ spin.stop();
13956
+ output(result, () => {
13957
+ let str = `${colors.primary("Claim Details")}
13958
+
13959
+ `;
13960
+ str += ` ID: ${result.id}
13961
+ `;
13962
+ str += ` Agent: ${result.agent_id}
13963
+ `;
13964
+ str += ` Type: ${result.claim_type_label}
13965
+ `;
13966
+ str += ` Status: ${result.status_label}
13967
+ `;
13968
+ if (result.verification_code) {
13969
+ str += ` Code: ${result.verification_code}
13970
+ `;
13971
+ }
13972
+ if (result.verified_handle) {
13973
+ str += ` Handle: ${result.verified_handle}
13974
+ `;
13975
+ }
13976
+ if (result.post_url) {
13977
+ str += ` Post URL: ${result.post_url}
13978
+ `;
13979
+ }
13980
+ str += ` Created: ${result.created_at}
13981
+ `;
13982
+ if (result.verified_at) {
13983
+ str += ` Verified: ${result.verified_at}
13984
+ `;
13985
+ }
13986
+ if (result.revoked_at) {
13987
+ str += ` Revoked: ${result.revoked_at}
13988
+ `;
13989
+ }
13990
+ return str;
13991
+ });
13992
+ } catch (err) {
13993
+ spin.stop();
13994
+ error(`Failed to fetch claim: ${err.message}`);
13995
+ process.exit(1);
13996
+ }
13997
+ });
13998
+ claimCmd.command("revoke <claim-id>").description("Revoke a verification claim").action(async (claimId) => {
13999
+ await requireApiKey();
14000
+ const client = getClient();
14001
+ const spin = spinner("Revoking claim...").start();
14002
+ try {
14003
+ const result = await client.api.revokeClaim(claimId);
14004
+ spin.stop();
14005
+ success(result.message);
14006
+ } catch (err) {
14007
+ spin.stop();
14008
+ error(`Failed to revoke claim: ${err.message}`);
14009
+ process.exit(1);
14010
+ }
14011
+ });
14012
+ claimCmd.command("list").description("List your claims (requires linked agent)").action(async () => {
14013
+ await requireApiKey();
14014
+ const client = getClient();
14015
+ const spin = spinner("Fetching claims...").start();
14016
+ try {
14017
+ const config2 = await Promise.resolve().then(() => (init_config(), config_exports)).then((m) => m.getConfig());
14018
+ if (!config2.agentId) {
14019
+ spin.stop();
14020
+ error("No agent linked. Use 'tasknet agent link' first.");
14021
+ process.exit(1);
14022
+ }
14023
+ const agent = await client.api.getAgent(config2.agentId);
14024
+ spin.stop();
14025
+ if (!agent.claims || agent.claims.length === 0) {
14026
+ log("No claims found for this agent.\n");
14027
+ log("Generate a claim with: tasknet claim generate <type>");
14028
+ return;
14029
+ }
14030
+ log(`
14031
+ ${colors.primary("Your Claims")}
14032
+ `);
14033
+ const table2 = agent.claims.map((c) => ({
14034
+ ID: c.id.slice(0, 8) + "...",
14035
+ Type: c.claim_type_label || CLAIM_TYPE_LABELS[c.claim_type] || "Unknown",
14036
+ Status: c.status_label || CLAIM_STATUS_LABELS[c.status] || "Unknown",
14037
+ Handle: c.verified_handle || "-",
14038
+ "Verified At": c.verified_at || "-"
14039
+ }));
14040
+ console.table(table2);
14041
+ } catch (err) {
14042
+ spin.stop();
14043
+ error(`Failed to list claims: ${err.message}`);
14044
+ process.exit(1);
14045
+ }
14046
+ });
14047
+ }
14048
+
13792
14049
  // src/index.ts
14050
+ init_config();
13793
14051
  var program = new Command2();
13794
14052
  var banner = chalk3.cyan(`
13795
14053
  \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
@@ -13799,7 +14057,7 @@ var banner = chalk3.cyan(`
13799
14057
  \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551
13800
14058
  \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D
13801
14059
  `);
13802
- program.name("tasknet").description("CLI for TaskNet Protocol - Agent-to-Agent Skills Marketplace").version("0.5.0").addHelpText("beforeAll", banner).option("--json", "Output as JSON").hook("preAction", (thisCommand) => {
14060
+ program.name("tasknet").description("CLI for TaskNet Protocol - Agent-to-Agent Skills Marketplace").version("0.6.0").addHelpText("beforeAll", banner).option("--json", "Output as JSON").hook("preAction", (thisCommand) => {
13803
14061
  const opts = thisCommand.opts();
13804
14062
  if (opts.json) {
13805
14063
  const config2 = getConfig();
@@ -13811,6 +14069,7 @@ registerAgentCommands(program);
13811
14069
  registerSkillCommands(program);
13812
14070
  registerTaskCommands(program);
13813
14071
  registerBadgeCommands(program);
14072
+ registerClaimCommands(program);
13814
14073
  registerHealthCommand(program);
13815
14074
  program.parse();
13816
14075
  /*! Bundled license information: