@mikaelkaron/skills-tessl 0.2.2 → 0.3.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.
@@ -1,5 +1,5 @@
1
1
  import { Args, Command } from "@oclif/core";
2
- import { spawnSync } from "node:child_process";
2
+ import { install } from "../../lib/tessl.js";
3
3
  export default class TesslInstall extends Command {
4
4
  static summary = "Install the tessl skill tile for an installed plugin.";
5
5
  static examples = [
@@ -27,17 +27,11 @@ export default class TesslInstall extends Command {
27
27
  const tileRef = tesslPjson.version
28
28
  ? `${tesslPjson.tile}@${tesslPjson.version}`
29
29
  : tesslPjson.tile;
30
- const tessCmd = process.env["TESSL_CMD"] ?? "tessl";
31
- const result = spawnSync(tessCmd, ["tile", "install", tileRef], {
32
- stdio: "inherit",
33
- });
34
- if (result.error) {
35
- this.error(result.error.message.includes("ENOENT")
36
- ? "tessl CLI not found. Install it from https://tessl.io"
37
- : result.error.message, { exit: 1 });
30
+ try {
31
+ install(tileRef);
38
32
  }
39
- if (result.status !== 0) {
40
- this.exit(result.status ?? 1);
33
+ catch (err) {
34
+ this.error(err.message, { exit: 1 });
41
35
  }
42
36
  }
43
37
  }
@@ -0,0 +1 @@
1
+ export declare function install(tile: string, cmd?: string): void;
@@ -0,0 +1,12 @@
1
+ import { spawnSync } from "node:child_process";
2
+ export function install(tile, cmd = process.env["TESSL_CMD"] ?? "tessl") {
3
+ const result = spawnSync(cmd, ["install", tile], { stdio: "inherit" });
4
+ if (result.error) {
5
+ throw new Error(result.error.message.includes("ENOENT")
6
+ ? "tessl CLI not found. Install it from https://tessl.io"
7
+ : result.error.message);
8
+ }
9
+ if (result.status !== 0) {
10
+ process.exit(result.status ?? 1);
11
+ }
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikaelkaron/skills-tessl",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "bin": {
5
5
  "mks-tessl": "bin/run.js"
6
6
  },
@@ -19,11 +19,13 @@
19
19
  "test:types": "tsc -p test/tsconfig.json"
20
20
  },
21
21
  "dependencies": {
22
- "@oclif/core": "^4"
22
+ "@oclif/core": "^4",
23
+ "which": "^7.0.0"
23
24
  },
24
25
  "devDependencies": {
25
26
  "@oclif/test": "^4.1.18",
26
27
  "@types/node": "^22",
28
+ "@types/which": "^3.0.4",
27
29
  "typescript": "^5"
28
30
  },
29
31
  "oclif": {