@putdotio/taizn 1.10.0 → 1.11.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/README.md CHANGED
@@ -58,6 +58,7 @@ taizn package
58
58
  taizn install
59
59
  taizn run
60
60
  taizn tv info
61
+ taizn tv info --json
61
62
  taizn tv pair
62
63
  taizn tv press KEY_ENTER
63
64
  taizn tv press --delay-ms 250 KEY_HOME KEY_DOWN KEY_ENTER
@@ -78,7 +79,8 @@ proof output. `profile` imports
78
79
  `package` builds and signs a `.wgt`. `install` packages and sideloads it.
79
80
  `run` launches the configured variant application on the target. `tv` commands use
80
81
  Samsung's websocket remote-control API to inspect a TV,
81
- pair for a remote token, and send remote-control key presses. See
82
+ pair for a remote token, and send remote-control key presses. Add `--json` to
83
+ `tv info` for a structured TV capability snapshot. See
82
84
  [Samsung TV Remote](./docs/TV_REMOTE.md) for pairing, environment, and limits.
83
85
  `tv press` accepts one key or a sequence of keys.
84
86
 
package/dist/taizn.mjs CHANGED
@@ -468,13 +468,33 @@ const sendSamsungTvKeys = Effect.fn("sendSamsungTvKeys")(function* (env, keys, p
468
468
  });
469
469
  yield* Console.log(keys.length === 1 ? `Sent Samsung TV remote key: ${keys[0]}` : `Sent Samsung TV remote keys: ${keys.join(", ")}`);
470
470
  });
471
- const showSamsungTvInfo = Effect.fn("showSamsungTvInfo")(function* (env) {
471
+ const showSamsungTvInfo = Effect.fn("showSamsungTvInfo")(function* (env, infoOptions = {}) {
472
472
  const options = yield* resolveRemoteOptions(env);
473
473
  const info = yield* fetchSamsungTvInfo(options.host, {
474
474
  port: env.tvInfoPort,
475
475
  timeoutMs: options.timeoutMs
476
476
  });
477
477
  const support = info.isSupport ? parseSupport(info.isSupport) : void 0;
478
+ if (infoOptions.json) {
479
+ yield* Console.log(JSON.stringify({
480
+ developer: {
481
+ enabled: stringFlag(info.device.developerMode),
482
+ ip: info.device.developerIP,
483
+ mode: info.device.developerMode
484
+ },
485
+ host: options.host,
486
+ infoPort: env.tvInfoPort ?? TV_INFO_PORT,
487
+ ip: info.device.ip ?? options.host,
488
+ model: info.device.modelName,
489
+ name: decodeHtml(info.name),
490
+ remote: info.remote,
491
+ remoteAvailable: stringFlag(support?.remote_available),
492
+ tokenAuth: stringFlag(info.device.TokenAuthSupport),
493
+ type: info.type,
494
+ uri: info.uri
495
+ }));
496
+ return;
497
+ }
478
498
  yield* Console.log(`Samsung TV: ${decodeHtml(info.name)}`);
479
499
  yield* Console.log(`model: ${info.device.modelName ?? "unknown"}`);
480
500
  yield* Console.log(`ip: ${info.device.ip ?? options.host}`);
@@ -696,6 +716,11 @@ const hostFromTarget = (target) => {
696
716
  };
697
717
  const causeToMessage = (cause) => cause instanceof Error ? cause.message : String(cause);
698
718
  const decodeHtml = (value) => value.replaceAll(""", "\"").replaceAll("&", "&");
719
+ const stringFlag = (value) => {
720
+ const normalized = value?.trim().toLowerCase();
721
+ if (normalized === "true" || normalized === "1") return true;
722
+ if (normalized === "false" || normalized === "0") return false;
723
+ };
699
724
  //#endregion
700
725
  //#region src/xml.ts
701
726
  const escapeXml = (value) => value.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
@@ -1227,8 +1252,8 @@ const tvPress = Command.make("press", {
1227
1252
  }, ({ delayMs, keys }) => Effect.gen(function* () {
1228
1253
  yield* sendSamsungTvKeys(yield* loadEnv(), keys, { delayMs });
1229
1254
  }));
1230
- const tvInfo = Command.make("info", {}, () => Effect.gen(function* () {
1231
- yield* showSamsungTvInfo(yield* loadEnv());
1255
+ const tvInfo = Command.make("info", { json: Flag.boolean("json") }, ({ json }) => Effect.gen(function* () {
1256
+ yield* showSamsungTvInfo(yield* loadEnv(), { json });
1232
1257
  }));
1233
1258
  const tv = Command.make("tv", {}).pipe(Command.withSubcommands([
1234
1259
  tvPair,
package/docs/TV_REMOTE.md CHANGED
@@ -7,13 +7,15 @@ and smoke checks against a physical TV or monitor.
7
7
 
8
8
  ```bash
9
9
  taizn tv info
10
+ taizn tv info --json
10
11
  taizn tv pair
11
12
  taizn tv press KEY_ENTER
12
13
  taizn tv press --delay-ms 250 KEY_HOME KEY_DOWN KEY_ENTER
13
14
  ```
14
15
 
15
16
  - `info` reads the TV's local `/api/v2/` metadata and reports remote-control
16
- support.
17
+ support. Add `--json` to emit a structured TV capability snapshot for agents
18
+ and scripts.
17
19
  - `pair` opens a Samsung remote websocket and waits for the TV to approve the
18
20
  client. When pairing succeeds, it stores the token in `.taizn/remote.json`.
19
21
  - `press` reconnects with the paired token and sends a Samsung remote key such
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putdotio/taizn",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "A tiny CLI companion for interacting with Tizen ecosystem.",
5
5
  "keywords": [
6
6
  "cli",