@putdotio/taizn 1.4.0 → 1.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/README.md CHANGED
@@ -48,6 +48,8 @@ Project files:
48
48
  taizn check
49
49
  taizn apps
50
50
  taizn apps put
51
+ taizn launch GinifYRGmZ.putio
52
+ taizn prove GinifYRGmZ.putio
51
53
  taizn profile
52
54
  taizn package
53
55
  taizn install
@@ -61,7 +63,10 @@ taizn --version
61
63
 
62
64
  `check` verifies the configured Tizen CLI and `sdb`, then prints connected
63
65
  targets without requiring `taizn.json`. `apps` lists installed applications on
64
- the target, with an optional query filter. `profile` imports
66
+ the target, with an optional query filter. `launch` starts an already-installed
67
+ application by exact application ID, exact name, or a unique query. `prove`
68
+ checks the installed app inventory, launches the matched app, and prints a
69
+ compact proof transcript. `profile` imports
65
70
  `.taizn/certificates/author.p12` and
66
71
  `.taizn/certificates/distributor.p12` into a Tizen security profile.
67
72
  `package` builds and signs a `.wgt`. `install` packages and sideloads it.
package/dist/taizn.mjs CHANGED
@@ -57,6 +57,19 @@ var CommandFailed = class extends Schema.TaggedErrorClass()("CommandFailed", {
57
57
  return `Command failed: ${this.command} ${this.args.join(" ")}`;
58
58
  }
59
59
  };
60
+ var ApplicationNotFound = class extends Schema.TaggedErrorClass()("ApplicationNotFound", { query: Schema.String }) {
61
+ get message() {
62
+ return `No installed Tizen application matched "${this.query}".`;
63
+ }
64
+ };
65
+ var MultipleApplicationsMatched = class extends Schema.TaggedErrorClass()("MultipleApplicationsMatched", {
66
+ matches: Schema.Array(Schema.String),
67
+ query: Schema.String
68
+ }) {
69
+ get message() {
70
+ return `Multiple installed Tizen applications matched "${this.query}": ${this.matches.join(", ")}. Use the application ID.`;
71
+ }
72
+ };
60
73
  var PackageNotProduced = class extends Schema.TaggedErrorClass()("PackageNotProduced", { outputDir: Schema.String }) {
61
74
  get message() {
62
75
  return `No .wgt package was produced in ${this.outputDir}`;
@@ -799,19 +812,10 @@ const runWidget = Effect.fn("runWidget")(function* ({ config, env }) {
799
812
  yield* Console.log(`Launched ${variant.applicationId}`);
800
813
  });
801
814
  const listInstalledApplications = Effect.fn("listInstalledApplications")(function* (env, query) {
802
- const sdbPath = yield* resolveSdb(env);
803
- if (env.target) yield* run$1(sdbPath, ["connect", env.target], { env: yield* baseChildEnv() });
804
- const target = yield* resolveRequiredSdbTarget(env, sdbPath);
805
- const output = yield* capture(sdbPath, [
806
- "-s",
807
- target,
808
- "shell",
809
- "0",
810
- "applist"
811
- ]);
815
+ const { applications: installedApplications, target } = yield* loadInstalledApplications(env);
812
816
  const queryLabel = query?.trim();
813
817
  const normalizedQuery = normalizeQuery(queryLabel);
814
- const applications = parseInstalledApplications(output).filter((application) => matchesApplicationQuery(application, normalizedQuery));
818
+ const applications = installedApplications.filter((application) => matchesApplicationQuery(application, normalizedQuery));
815
819
  const suffix = queryLabel ? ` matching "${queryLabel}"` : "";
816
820
  yield* Console.log(`Installed Tizen applications${suffix} on ${target}:`);
817
821
  if (applications.length === 0) {
@@ -820,6 +824,22 @@ const listInstalledApplications = Effect.fn("listInstalledApplications")(functio
820
824
  }
821
825
  for (const application of applications) yield* Console.log(`- ${application.name} (${application.applicationId})`);
822
826
  });
827
+ const launchInstalledApplication = Effect.fn("launchInstalledApplication")(function* (env, query) {
828
+ const tizenPath = yield* resolveTizenCli(env);
829
+ const { applications, target } = yield* loadInstalledApplications(env);
830
+ const application = yield* resolveInstalledApplication(query, applications);
831
+ yield* launchApplication(tizenPath, target, application);
832
+ yield* Console.log(`Launched ${application.name} (${application.applicationId}) on ${target}`);
833
+ });
834
+ const proveInstalledApplication = Effect.fn("proveInstalledApplication")(function* (env, query) {
835
+ const tizenPath = yield* resolveTizenCli(env);
836
+ const { applications, target } = yield* loadInstalledApplications(env);
837
+ const application = yield* resolveInstalledApplication(query, applications);
838
+ yield* Console.log(`Tizen target: ${target}`);
839
+ yield* Console.log(`Installed application: ${application.name} (${application.applicationId})`);
840
+ yield* launchApplication(tizenPath, target, application);
841
+ yield* Console.log(`Launch proof: ${application.applicationId} started on ${target}`);
842
+ });
823
843
  const resolveTizenCli = Effect.fn("resolveTizenCli")(function* (env) {
824
844
  return yield* requireFile(env.tizenCli ?? (yield* defaultTizenCli()), "Tizen CLI");
825
845
  });
@@ -1011,6 +1031,21 @@ const resolveRequiredSdbTarget = Effect.fn("resolveRequiredSdbTarget")(function*
1011
1031
  if (devices.length > 1) return yield* MultipleTargetsConnected.make({ targets: devices.map((device) => device.id) });
1012
1032
  return yield* MissingTizenTarget.make({});
1013
1033
  });
1034
+ const loadInstalledApplications = Effect.fn("loadInstalledApplications")(function* (env) {
1035
+ const sdbPath = yield* resolveSdb(env);
1036
+ if (env.target) yield* run$1(sdbPath, ["connect", env.target], { env: yield* baseChildEnv() });
1037
+ const target = yield* resolveRequiredSdbTarget(env, sdbPath);
1038
+ return {
1039
+ applications: parseInstalledApplications(yield* capture(sdbPath, [
1040
+ "-s",
1041
+ target,
1042
+ "shell",
1043
+ "0",
1044
+ "applist"
1045
+ ])),
1046
+ target
1047
+ };
1048
+ });
1014
1049
  const parseInstalledApplications = (output) => output.split("\n").flatMap((line) => {
1015
1050
  const match = line.match(/^\s*'([^']*)'\s+'([^']*)'\s*$/);
1016
1051
  const name = match?.[1]?.trim();
@@ -1022,6 +1057,41 @@ const parseInstalledApplications = (output) => output.split("\n").flatMap((line)
1022
1057
  });
1023
1058
  const normalizeQuery = (query) => query?.trim().toLowerCase();
1024
1059
  const matchesApplicationQuery = (application, normalizedQuery) => !normalizedQuery || application.name.toLowerCase().includes(normalizedQuery) || application.applicationId.toLowerCase().includes(normalizedQuery);
1060
+ const resolveInstalledApplication = Effect.fn("resolveInstalledApplication")(function* (query, applications) {
1061
+ const queryLabel = query.trim();
1062
+ const normalizedQuery = normalizeQuery(queryLabel);
1063
+ if (!normalizedQuery) return yield* ApplicationNotFound.make({ query });
1064
+ const exactMatch = applications.find((application) => application.applicationId.toLowerCase() === normalizedQuery);
1065
+ if (exactMatch) return exactMatch;
1066
+ const exactNameMatches = applications.filter((application) => application.name.toLowerCase() === normalizedQuery);
1067
+ if (exactNameMatches.length === 1) {
1068
+ const [match] = exactNameMatches;
1069
+ if (match) return match;
1070
+ }
1071
+ if (exactNameMatches.length > 1) return yield* MultipleApplicationsMatched.make({
1072
+ matches: exactNameMatches.map((application) => `${application.name} (${application.applicationId})`),
1073
+ query: queryLabel
1074
+ });
1075
+ const matches = applications.filter((application) => matchesApplicationQuery(application, normalizedQuery));
1076
+ if (matches.length === 1) {
1077
+ const [match] = matches;
1078
+ if (match) return match;
1079
+ }
1080
+ if (matches.length > 1) return yield* MultipleApplicationsMatched.make({
1081
+ matches: matches.map((application) => `${application.name} (${application.applicationId})`),
1082
+ query: queryLabel
1083
+ });
1084
+ return yield* ApplicationNotFound.make({ query: queryLabel });
1085
+ });
1086
+ const launchApplication = Effect.fn("launchApplication")(function* (tizenPath, target, application) {
1087
+ yield* run$1(tizenPath, [
1088
+ "run",
1089
+ "-p",
1090
+ application.applicationId,
1091
+ "-s",
1092
+ target
1093
+ ], { env: yield* baseChildEnv() });
1094
+ });
1025
1095
  const run$1 = Effect.fn("run")(function* (command, args, options) {
1026
1096
  const paths = yield* getPaths();
1027
1097
  const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
@@ -1082,6 +1152,12 @@ const check = Command.make("check", {}, () => Effect.gen(function* () {
1082
1152
  const apps = Command.make("apps", { query: Argument.string("query").pipe(Argument.optional) }, ({ query }) => Effect.gen(function* () {
1083
1153
  yield* listInstalledApplications(yield* loadEnv(), Option.getOrUndefined(query));
1084
1154
  }));
1155
+ const launch = Command.make("launch", { query: Argument.string("query") }, ({ query }) => Effect.gen(function* () {
1156
+ yield* launchInstalledApplication(yield* loadEnv(), query);
1157
+ }));
1158
+ const prove = Command.make("prove", { query: Argument.string("query") }, ({ query }) => Effect.gen(function* () {
1159
+ yield* proveInstalledApplication(yield* loadEnv(), query);
1160
+ }));
1085
1161
  const profile = Command.make("profile", {}, () => withContext((context) => createProfile(context)));
1086
1162
  const pack = Command.make("package", {}, () => withContext((context) => packageWidget(context).pipe(Effect.asVoid)));
1087
1163
  const install = Command.make("install", {}, () => withContext((context) => installWidget(context)));
@@ -1106,6 +1182,8 @@ const tv = Command.make("tv", {}).pipe(Command.withSubcommands([
1106
1182
  const command = taizn.pipe(Command.withSubcommands([
1107
1183
  apps,
1108
1184
  check,
1185
+ launch,
1186
+ prove,
1109
1187
  profile,
1110
1188
  pack,
1111
1189
  install,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putdotio/taizn",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "A tiny CLI companion for interacting with Tizen ecosystem.",
5
5
  "keywords": [
6
6
  "cli",