@decentnetwork/lan 0.1.13 → 0.1.14

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +14 -4
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -126,21 +126,31 @@ async function main() {
126
126
  configDir: argv["config-dir"],
127
127
  });
128
128
  })
129
- .command("friends list", "List Carrier friends (daemon must be down)", (y) => y.option("config-dir", { type: "string" }), async (argv) => {
129
+ // `friends X` MUST be defined as a nested subcommand tree, not as
130
+ // four flat `.command("friends X", ...)` entries — yargs treats the
131
+ // second word as a positional in that flat form and the
132
+ // last-registered subcommand silently swallows the others.
133
+ // Symptom: `agentnet friends pending` would run `friends reject` and
134
+ // complain about a missing --userid.
135
+ .command("friends", "Manage Carrier friends (run 'agentnet friends --help')", (y) => y
136
+ .command("list", "List Carrier friends (daemon must be down)", (yy) => yy.option("config-dir", { type: "string" }), async (argv) => {
130
137
  await cmdFriendsList({ configDir: argv["config-dir"] });
131
138
  })
132
- .command("friends pending", "List queued friend-requests (over IPC; daemon must be up)", (y) => y.option("config-dir", { type: "string" }), async (argv) => {
139
+ .command("pending", "List queued friend-requests (over IPC; daemon must be up)", (yy) => yy.option("config-dir", { type: "string" }), async (argv) => {
133
140
  await cmdFriendsPending({ configDir: argv["config-dir"] });
134
141
  })
135
- .command("friends accept", "Accept a queued friend-request by userid (over IPC; daemon stays up)", (y) => y
142
+ .command("accept", "Accept a queued friend-request by userid (over IPC; daemon stays up)", (yy) => yy
136
143
  .option("userid", { type: "string", demandOption: true, describe: "Sender's Carrier userid (base58)" })
137
144
  .option("config-dir", { type: "string" }), async (argv) => {
138
145
  await cmdFriendsAccept({ userid: argv.userid, configDir: argv["config-dir"] });
139
146
  })
140
- .command("friends reject", "Drop a queued friend-request by userid (over IPC; daemon stays up)", (y) => y
147
+ .command("reject", "Drop a queued friend-request by userid (over IPC; daemon stays up)", (yy) => yy
141
148
  .option("userid", { type: "string", demandOption: true })
142
149
  .option("config-dir", { type: "string" }), async (argv) => {
143
150
  await cmdFriendsReject({ userid: argv.userid, configDir: argv["config-dir"] });
151
+ })
152
+ .demandCommand(1, "Specify a friends subcommand (run 'agentnet friends --help')"), () => {
153
+ // parent handler — never invoked because demandCommand above
144
154
  })
145
155
  .command("audit log", "View audit log", (y) => y.option("tail", { type: "number", default: 50 }).option("config-dir", { type: "string" }), async (argv) => {
146
156
  await cmdAuditLog({ tail: argv.tail, configDir: argv["config-dir"] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/lan",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Private virtual LAN for self-hosted services and AI agents, built on Elastos Carrier. NAT-traversal, name service, ACL, all over a peer-to-peer mesh — no public IP required.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",