@hardkas/cli 0.4.0-alpha → 0.5.1-alpha

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 @@
1
+ #!/usr/bin/env node
package/dist/index.js CHANGED
@@ -121,7 +121,7 @@ function registerInitCommands(program) {
121
121
  const template = `import { defineHardkasConfig } from "@hardkas/sdk";
122
122
 
123
123
  export default defineHardkasConfig({
124
- // HardKAS v0.2.2-alpha Configuration
124
+ // HardKAS v0.5.1-alpha Configuration
125
125
  defaultNetwork: "simnet",
126
126
 
127
127
  networks: {
@@ -4176,6 +4176,7 @@ import fs9 from "fs/promises";
4176
4176
  import pc2 from "picocolors";
4177
4177
  import { DockerKaspadRunner as DockerKaspadRunner7 } from "@hardkas/node-runner";
4178
4178
  import { execa } from "execa";
4179
+ import { HARDKAS_VERSION as HARDKAS_VERSION5 } from "@hardkas/artifacts";
4179
4180
  function registerDoctorCommand(program) {
4180
4181
  program.command("doctor").description(`Perform a full system diagnostic and health report ${UI.maturity("stable")}`).option("--json", "Output results as stable JSON schema", false).action(async (opts) => {
4181
4182
  try {
@@ -4187,8 +4188,7 @@ function registerDoctorCommand(program) {
4187
4188
  }
4188
4189
  async function runDoctor(opts) {
4189
4190
  const report = {
4190
- version: "0.2.2-alpha.1",
4191
- // In real world, get this from constants
4191
+ version: HARDKAS_VERSION5,
4192
4192
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
4193
4193
  checks: [],
4194
4194
  summary: { total: 0, passed: 0, failed: 0, warnings: 0, skipped: 0 }
@@ -4562,11 +4562,11 @@ function registerRunCommand(program) {
4562
4562
 
4563
4563
  // src/commands/capabilities.ts
4564
4564
  import pc3 from "picocolors";
4565
- import { HARDKAS_VERSION as HARDKAS_VERSION5, CURRENT_HASH_VERSION } from "@hardkas/artifacts";
4565
+ import { HARDKAS_VERSION as HARDKAS_VERSION6, CURRENT_HASH_VERSION } from "@hardkas/artifacts";
4566
4566
  function registerCapabilitiesCommand(program) {
4567
4567
  program.command("capabilities").description("Show HardKAS capabilities and maturity level").option("--json", "Output as stable JSON schema", false).action(async (opts) => {
4568
4568
  const caps = {
4569
- version: HARDKAS_VERSION5,
4569
+ version: HARDKAS_VERSION6,
4570
4570
  maturity: "hardened-alpha",
4571
4571
  proofVersion: "repro-v0",
4572
4572
  hashVersion: CURRENT_HASH_VERSION,
@@ -4702,9 +4702,7 @@ function generateBasicTemplate(config) {
4702
4702
  "hardkas.config.ts": `import { defineConfig } from "@hardkas/cli";
4703
4703
 
4704
4704
  export default defineConfig({
4705
- network: "${config.network}",
4706
- accounts: ${config.accounts},
4707
- initialBalance: "1000", // KAS
4705
+ defaultNetwork: "${config.network}",
4708
4706
  });
4709
4707
  `,
4710
4708
  ".gitignore": `node_modules
@@ -5095,23 +5093,23 @@ function registerKaspaCommands(program) {
5095
5093
  const kaspaCmd = program.command("kaspa").description("Kaspa L1 native developer tools");
5096
5094
  const walletCmd = kaspaCmd.command("wallet").description("Manage local Kaspa L1 wallets");
5097
5095
  walletCmd.command("create <name>").description(`Create a new local Kaspa wallet ${UI.maturity("stable")}`).option("--network <id>", "Kaspa network ID", "simnet").action(async (name, options) => {
5098
- const { runKaspaWalletCreate } = await import("./kaspa-wallet-runner-ORJ5YFKU.js");
5096
+ const { runKaspaWalletCreate } = await import("./kaspa-wallet-runner-RFNM6W2E.js");
5099
5097
  await runKaspaWalletCreate(name, options);
5100
5098
  });
5101
5099
  walletCmd.command("list").description(`List local Kaspa wallets ${UI.maturity("stable")}`).option("--json", "Output as JSON", false).action(async (options) => {
5102
- const { runKaspaWalletList } = await import("./kaspa-wallet-runner-ORJ5YFKU.js");
5100
+ const { runKaspaWalletList } = await import("./kaspa-wallet-runner-RFNM6W2E.js");
5103
5101
  await runKaspaWalletList(options);
5104
5102
  });
5105
5103
  walletCmd.command("address <name>").description(`Show address of a local Kaspa wallet ${UI.maturity("stable")}`).action(async (name) => {
5106
- const { runKaspaWalletAddress } = await import("./kaspa-wallet-runner-ORJ5YFKU.js");
5104
+ const { runKaspaWalletAddress } = await import("./kaspa-wallet-runner-RFNM6W2E.js");
5107
5105
  await runKaspaWalletAddress(name);
5108
5106
  });
5109
5107
  walletCmd.command("balance <name>").description(`Show balance of a local Kaspa wallet ${UI.maturity("stable")}`).option("--rpc-url <url>", "Kaspa RPC URL", "http://127.0.0.1:16110").option("--json", "Output as JSON", false).action(async (name, options) => {
5110
- const { runKaspaWalletBalance } = await import("./kaspa-wallet-runner-ORJ5YFKU.js");
5108
+ const { runKaspaWalletBalance } = await import("./kaspa-wallet-runner-RFNM6W2E.js");
5111
5109
  await runKaspaWalletBalance(name, options);
5112
5110
  });
5113
5111
  walletCmd.command("send <from> <to>").description(`Send Kaspa between local wallets ${UI.maturity("stable")}`).option("--amount <kas>", "Amount in KAS to send").option("--dry-run", "Plan but do not sign or broadcast", false).option("--rpc-url <url>", "Kaspa RPC URL", "http://127.0.0.1:16110").action(async (from, to, options) => {
5114
- const { runKaspaWalletSend } = await import("./kaspa-wallet-runner-ORJ5YFKU.js");
5112
+ const { runKaspaWalletSend } = await import("./kaspa-wallet-runner-RFNM6W2E.js");
5115
5113
  await runKaspaWalletSend(from, to, options);
5116
5114
  });
5117
5115
  kaspaCmd.command("doctor").description(`Verify local Kaspa L1 environment readiness ${UI.maturity("stable")}`).option("--rpc-url <url>", "Kaspa RPC URL", "http://127.0.0.1:16110").option("--json", "Output as JSON", false).action(async (options) => {
@@ -5142,19 +5140,19 @@ function registerBridgeCommands(program) {
5142
5140
  function registerSessionCommands(program) {
5143
5141
  const sessionCmd = program.command("session").description("L1/L2 developer identity linkage and sessions");
5144
5142
  sessionCmd.command("create <name>").description(`Create a new L1/L2 session linkage ${UI.maturity("alpha")}`).requiredOption("--l1 <wallet>", "Name of the Kaspa L1 wallet").requiredOption("--l2 <account>", "Name of the Igra L2 account").action(async (name, options) => {
5145
- const { runSessionCreate } = await import("./session-runner-LDSGDP47.js");
5143
+ const { runSessionCreate } = await import("./session-runner-ZJRLREHE.js");
5146
5144
  await runSessionCreate(name, options);
5147
5145
  });
5148
5146
  sessionCmd.command("list").description(`List all configured sessions ${UI.maturity("alpha")}`).action(async () => {
5149
- const { runSessionList } = await import("./session-runner-LDSGDP47.js");
5147
+ const { runSessionList } = await import("./session-runner-ZJRLREHE.js");
5150
5148
  await runSessionList();
5151
5149
  });
5152
5150
  sessionCmd.command("status").description(`Show active session linkage ${UI.maturity("alpha")}`).action(async () => {
5153
- const { runSessionStatus } = await import("./session-runner-LDSGDP47.js");
5151
+ const { runSessionStatus } = await import("./session-runner-ZJRLREHE.js");
5154
5152
  await runSessionStatus();
5155
5153
  });
5156
5154
  sessionCmd.command("use <name>").description(`Set the active session ${UI.maturity("alpha")}`).action(async (name) => {
5157
- const { runSessionUse } = await import("./session-runner-LDSGDP47.js");
5155
+ const { runSessionUse } = await import("./session-runner-ZJRLREHE.js");
5158
5156
  await runSessionUse(name);
5159
5157
  });
5160
5158
  }
@@ -5318,10 +5316,10 @@ var packageJsonPath = path14.resolve(
5318
5316
  path14.dirname(fileURLToPath(import.meta.url)),
5319
5317
  "../package.json"
5320
5318
  );
5321
- var { version: HARDKAS_VERSION6 } = JSON.parse(readFileSync(packageJsonPath, "utf8"));
5319
+ var { version: HARDKAS_VERSION7 } = JSON.parse(readFileSync(packageJsonPath, "utf8"));
5322
5320
  function buildHardkasProgram(options) {
5323
5321
  const program = new Command();
5324
- program.name("hardkas").description("HardKAS: Kaspa-native developer operating environment").version(HARDKAS_VERSION6);
5322
+ program.name("hardkas").description("HardKAS: Kaspa-native developer operating environment").version(HARDKAS_VERSION7);
5325
5323
  registerInitCommands(program);
5326
5324
  registerTxCommands(program);
5327
5325
  registerArtifactCommands(program);
@@ -96,7 +96,7 @@ async function runKaspaWalletSend(from, to, options) {
96
96
  const { JsonWrpcKaspaClient } = await import("@hardkas/kaspa-rpc");
97
97
  const { buildPaymentPlan } = await import("@hardkas/tx-builder");
98
98
  const { signTxPlanArtifact } = await import("@hardkas/accounts");
99
- const { HARDKAS_VERSION } = await import("@hardkas/artifacts");
99
+ const { HARDKAS_VERSION, calculateContentHash } = await import("@hardkas/artifacts");
100
100
  const sender = resolveHardkasAccount({ nameOrAddress: from, config: config.config });
101
101
  const targetAddress = resolveHardkasAccountAddress(to, config.config);
102
102
  const amountSompi = BigInt(Math.floor(parseFloat(options.amount) * 1e8));
@@ -135,7 +135,7 @@ async function runKaspaWalletSend(from, to, options) {
135
135
  }
136
136
  const planArtifact = {
137
137
  schema: "hardkas.txPlan",
138
- planId: `plan-${Date.now()}`,
138
+ planId: `plan-${calculateContentHash({ from: sender.address, to: targetAddress, amount: amountSompi.toString() }).slice(0, 16)}`,
139
139
  hardkasVersion: HARDKAS_VERSION,
140
140
  version: "1.0.0-alpha",
141
141
  networkId: config.config.networkId || config.config.defaultNetwork || "simnet",
@@ -0,0 +1,9 @@
1
+ import { HardkasConfig } from '@hardkas/config';
2
+
3
+ /**
4
+ * Type-safe config helper for hardkas.config.ts files.
5
+ * This is a pass-through function that provides autocompletion.
6
+ */
7
+ declare function defineConfig(config: Partial<HardkasConfig>): Partial<HardkasConfig>;
8
+
9
+ export { defineConfig };
package/dist/public.js ADDED
@@ -0,0 +1,7 @@
1
+ // src/define-config.ts
2
+ function defineConfig(config) {
3
+ return config;
4
+ }
5
+ export {
6
+ defineConfig
7
+ };
@@ -44,7 +44,7 @@ async function runSessionList() {
44
44
  if (sessions.length === 0) {
45
45
  console.log(`
46
46
  No sessions found. Create one with:`);
47
- console.log(`hardkas session create dev-alice --l1 alice --l2 dev_alice
47
+ console.log(`hardkas session create dev --l1 alice --l2 bob
48
48
  `);
49
49
  return;
50
50
  }
package/package.json CHANGED
@@ -1,7 +1,13 @@
1
1
  {
2
2
  "name": "@hardkas/cli",
3
- "version": "0.4.0-alpha",
3
+ "version": "0.5.1-alpha",
4
4
  "type": "module",
5
+ "main": "./dist/public.js",
6
+ "types": "./dist/public.d.ts",
7
+ "exports": {
8
+ ".": "./dist/public.js",
9
+ "./bin": "./dist/index.js"
10
+ },
5
11
  "files": [
6
12
  "dist",
7
13
  "README.md",
@@ -18,24 +24,24 @@
18
24
  "picocolors": "^1.1.1",
19
25
  "viem": "^2.21.32",
20
26
  "zod": "^3.23.8",
21
- "@hardkas/accounts": "0.4.0-alpha",
22
- "@hardkas/artifacts": "0.4.0-alpha",
23
- "@hardkas/bridge-local": "0.4.0-alpha",
24
- "@hardkas/core": "0.4.0-alpha",
25
- "@hardkas/dev-server": "0.4.0-alpha",
26
- "@hardkas/config": "0.4.0-alpha",
27
- "@hardkas/kaspa-rpc": "0.4.0-alpha",
28
- "@hardkas/query": "0.4.0-alpha",
29
- "@hardkas/l2": "0.4.0-alpha",
30
- "@hardkas/localnet": "0.4.0-alpha",
31
- "@hardkas/node-runner": "0.4.0-alpha",
32
- "@hardkas/node-orchestrator": "0.4.0-alpha",
33
- "@hardkas/sdk": "0.4.0-alpha",
34
- "@hardkas/simulator": "0.4.0-alpha",
35
- "@hardkas/sessions": "0.4.0-alpha",
36
- "@hardkas/query-store": "0.4.0-alpha",
37
- "@hardkas/testing": "0.4.0-alpha",
38
- "@hardkas/tx-builder": "0.4.0-alpha"
27
+ "@hardkas/accounts": "0.5.1-alpha",
28
+ "@hardkas/artifacts": "0.5.1-alpha",
29
+ "@hardkas/dev-server": "0.5.1-alpha",
30
+ "@hardkas/config": "0.5.1-alpha",
31
+ "@hardkas/bridge-local": "0.5.1-alpha",
32
+ "@hardkas/core": "0.5.1-alpha",
33
+ "@hardkas/query": "0.5.1-alpha",
34
+ "@hardkas/kaspa-rpc": "0.5.1-alpha",
35
+ "@hardkas/localnet": "0.5.1-alpha",
36
+ "@hardkas/node-orchestrator": "0.5.1-alpha",
37
+ "@hardkas/node-runner": "0.5.1-alpha",
38
+ "@hardkas/l2": "0.5.1-alpha",
39
+ "@hardkas/query-store": "0.5.1-alpha",
40
+ "@hardkas/sessions": "0.5.1-alpha",
41
+ "@hardkas/sdk": "0.5.1-alpha",
42
+ "@hardkas/simulator": "0.5.1-alpha",
43
+ "@hardkas/tx-builder": "0.5.1-alpha",
44
+ "@hardkas/testing": "0.5.1-alpha"
39
45
  },
40
46
  "devDependencies": {
41
47
  "tsup": "^8.3.5",
@@ -55,7 +61,7 @@
55
61
  },
56
62
  "homepage": "https://github.com/KasLabDevs/HardKas/tree/main/packages/cli#readme",
57
63
  "scripts": {
58
- "build": "tsup src/index.ts --format esm --clean --external vitest",
64
+ "build": "tsup src/index.ts src/public.ts --format esm --dts --clean --external vitest",
59
65
  "dev": "tsx src/index.ts",
60
66
  "hardkas": "tsx src/index.ts",
61
67
  "typecheck": "tsc --noEmit",