takumi-cli 1.2.7 → 1.2.9

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/bin/takumi-mcp CHANGED
@@ -54,5 +54,8 @@ if [ -z "$NODE" ]; then
54
54
  exit 1
55
55
  fi
56
56
 
57
- SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
57
+ if [ -z "${SCRIPT_DIR:-}" ]; then
58
+ REAL_PATH="$(realpath "$0" 2>/dev/null || readlink -f "$0" 2>/dev/null || echo "$0")"
59
+ SCRIPT_DIR="$(cd "$(dirname "$REAL_PATH")/.." && pwd)"
60
+ fi
58
61
  exec "$NODE" "$SCRIPT_DIR/mcp/server.js"
package/mcp/server.js CHANGED
@@ -11,12 +11,18 @@ const BASH = findBash();
11
11
  const TAKUMI = path.resolve(__dirname, "..", "takumi.sh");
12
12
  const ENV = { ...process.env, SCRIPT_DIR: path.resolve(__dirname, "..") };
13
13
 
14
+ function result(text, isError = false) {
15
+ return {
16
+ content: [{ type: "text", text }],
17
+ isError,
18
+ };
19
+ }
20
+
14
21
  function run(args) {
15
22
  if (!BASH) {
16
- return Promise.resolve({
17
- text: "Error: bash not found. On Windows, install Git for Windows: https://git-scm.com/download/win",
18
- isError: true,
19
- });
23
+ return Promise.resolve(
24
+ result("Error: bash not found. On Windows, install Git for Windows: https://git-scm.com/download/win", true)
25
+ );
20
26
  }
21
27
 
22
28
  // Validate that file path args exist before running
@@ -24,10 +30,7 @@ function run(args) {
24
30
  if (filePath) {
25
31
  const fs = require("fs");
26
32
  if (!fs.existsSync(filePath)) {
27
- return Promise.resolve({
28
- text: `Error: file or folder not found: ${filePath}`,
29
- isError: true,
30
- });
33
+ return Promise.resolve(result(`Error: file or folder not found: ${filePath}`, true));
31
34
  }
32
35
  }
33
36
 
@@ -35,11 +38,11 @@ function run(args) {
35
38
  execFile(BASH, [TAKUMI, ...args], { timeout: 300_000, env: ENV }, (err, stdout, stderr) => {
36
39
  const output = [stdout, stderr].filter(Boolean).join("\n").trim();
37
40
  if (err && !output) {
38
- resolve({ text: `Error (exit code ${err.code}): ${err.message}`, isError: true });
41
+ resolve(result(`Error (exit code ${err.code}): ${err.message}`, true));
39
42
  } else if (err) {
40
- resolve({ text: `Error (exit code ${err.code}):\n${output}`, isError: true });
43
+ resolve(result(`Error (exit code ${err.code}):\n${output}`, true));
41
44
  } else {
42
- resolve({ text: output || "Done.", isError: false });
45
+ resolve(result(output || "Done."));
43
46
  }
44
47
  });
45
48
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "takumi-cli",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "The craftsman's toolkit for shaping video assets",
5
5
  "bin": {
6
6
  "takumi": "bin/takumi.js",