@putdotio/taizn 1.9.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
@@ -46,6 +46,7 @@ Project files:
46
46
 
47
47
  ```bash
48
48
  taizn check
49
+ taizn check --json
49
50
  taizn apps
50
51
  taizn apps put
51
52
  taizn apps --json put
@@ -57,6 +58,7 @@ taizn package
57
58
  taizn install
58
59
  taizn run
59
60
  taizn tv info
61
+ taizn tv info --json
60
62
  taizn tv pair
61
63
  taizn tv press KEY_ENTER
62
64
  taizn tv press --delay-ms 250 KEY_HOME KEY_DOWN KEY_ENTER
@@ -64,9 +66,10 @@ taizn --version
64
66
  ```
65
67
 
66
68
  `check` verifies the configured Tizen CLI and `sdb`, then prints connected
67
- targets without requiring `taizn.json`. `apps` lists installed applications on
68
- the target, with an optional query filter. Add `--json` to emit a structured
69
- inventory for agents and scripts. `launch` starts an already-installed
69
+ targets without requiring `taizn.json`. Add `--json` to emit the configured
70
+ tool paths and connected targets for agents and scripts. `apps` lists installed
71
+ applications on the target, with an optional query filter. Add `--json` to emit
72
+ a structured inventory for agents and scripts. `launch` starts an already-installed
70
73
  application by exact application ID, exact name, or a unique query. `prove`
71
74
  checks the installed app inventory, launches the matched app, and prints a
72
75
  compact proof transcript. Add `--json` when an agent or script needs structured
@@ -76,7 +79,8 @@ proof output. `profile` imports
76
79
  `package` builds and signs a `.wgt`. `install` packages and sideloads it.
77
80
  `run` launches the configured variant application on the target. `tv` commands use
78
81
  Samsung's websocket remote-control API to inspect a TV,
79
- 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
80
84
  [Samsung TV Remote](./docs/TV_REMOTE.md) for pairing, environment, and limits.
81
85
  `tv press` accepts one key or a sequence of keys.
82
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;");
@@ -707,10 +732,25 @@ const setXmlAttribute = (tag, attribute, value) => {
707
732
  };
708
733
  //#endregion
709
734
  //#region src/tizen.ts
710
- const checkTizen = Effect.fn("checkTizen")(function* (env) {
735
+ const checkTizen = Effect.fn("checkTizen")(function* (env, options = {}) {
711
736
  const tizenPath = yield* resolveTizenCli(env);
712
737
  const sdbPath = yield* resolveSdb(env);
713
738
  const devices = yield* listSdbDevices(sdbPath);
739
+ if (options.json) {
740
+ yield* Console.log(JSON.stringify({
741
+ configuredTarget: env.target,
742
+ targets: devices.map((device) => ({
743
+ id: device.id,
744
+ label: device.label,
745
+ state: device.state
746
+ })),
747
+ tools: {
748
+ sdb: sdbPath,
749
+ tizenCli: tizenPath
750
+ }
751
+ }));
752
+ return;
753
+ }
714
754
  yield* Console.log(`Tizen CLI: ${tizenPath}`);
715
755
  yield* Console.log(`sdb: ${sdbPath}`);
716
756
  if (devices.length === 0) {
@@ -1181,8 +1221,8 @@ const withContext = (operation) => Effect.gen(function* () {
1181
1221
  yield* operation(yield* loadContext());
1182
1222
  });
1183
1223
  const taizn = Command.make("taizn", {}, () => withContext((context) => packageWidget(context).pipe(Effect.asVoid)));
1184
- const check = Command.make("check", {}, () => Effect.gen(function* () {
1185
- yield* checkTizen(yield* loadEnv());
1224
+ const check = Command.make("check", { json: Flag.boolean("json") }, ({ json }) => Effect.gen(function* () {
1225
+ yield* checkTizen(yield* loadEnv(), { json });
1186
1226
  }));
1187
1227
  const apps = Command.make("apps", {
1188
1228
  json: Flag.boolean("json"),
@@ -1212,8 +1252,8 @@ const tvPress = Command.make("press", {
1212
1252
  }, ({ delayMs, keys }) => Effect.gen(function* () {
1213
1253
  yield* sendSamsungTvKeys(yield* loadEnv(), keys, { delayMs });
1214
1254
  }));
1215
- const tvInfo = Command.make("info", {}, () => Effect.gen(function* () {
1216
- yield* showSamsungTvInfo(yield* loadEnv());
1255
+ const tvInfo = Command.make("info", { json: Flag.boolean("json") }, ({ json }) => Effect.gen(function* () {
1256
+ yield* showSamsungTvInfo(yield* loadEnv(), { json });
1217
1257
  }));
1218
1258
  const tv = Command.make("tv", {}).pipe(Command.withSubcommands([
1219
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.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "A tiny CLI companion for interacting with Tizen ecosystem.",
5
5
  "keywords": [
6
6
  "cli",