@thask-org/cli 0.3.0 → 0.5.2

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
@@ -1,43 +1,36 @@
1
- # thask
1
+ # Thask CLI
2
2
 
3
- Graph-based dependency visualization for AI-assisted development.
4
-
5
- ## Install
6
-
7
- ```bash
8
- npm install -g thask
9
- ```
3
+ Command-line interface and MCP server for Thask.
10
4
 
11
5
  ## Quick Start
12
6
 
13
7
  ```bash
14
- # Configure
15
- thask config set url http://localhost:7244
16
- thask config set token <your-api-key>
17
-
18
- # Scan a Go project
19
- thask scan --path . --dry-run
8
+ # Build
9
+ go build -o thask ./cmd/thask
20
10
 
21
- # Analyze dependencies
22
- thask graph analyze -p <projectId>
11
+ # Configure
12
+ ./thask config set url http://localhost:7244
13
+ ./thask config set token <your-api-key>
23
14
 
24
- # Use with Claude Code (.claude/mcp.json)
15
+ # Use
16
+ ./thask node list --pretty
17
+ ./thask impact --node <nodeId>
18
+ ./thask mcp serve # Start MCP server for Claude Code
25
19
  ```
26
20
 
27
- ```json
28
- {
29
- "mcpServers": {
30
- "thask": {
31
- "command": "npx",
32
- "args": ["-y", "thask", "mcp", "serve", "--url", "http://localhost:7244", "--token", "<key>"]
33
- }
34
- }
35
- }
36
- ```
21
+ ## Documentation
22
+
23
+ - [CLI Reference](../docs/CLI.md) — Full command reference, flags, output formats
24
+ - [MCP Guide](../docs/MCP.md) — AI agent integration (Claude Code, Cursor)
37
25
 
38
- ## Links
26
+ ## Structure
39
27
 
40
- - [GitHub](https://github.com/kimgh06/Thask)
41
- - [Documentation](https://github.com/kimgh06/Thask/tree/main/docs)
42
- - [CLI Reference](https://github.com/kimgh06/Thask/blob/main/docs/CLI.md)
43
- - [MCP Guide](https://github.com/kimgh06/Thask/blob/main/docs/MCP.md)
28
+ ```
29
+ cmd/thask/ Entry point
30
+ internal/
31
+ cmd/ Cobra commands (node, edge, team, project, graph, impact, etc.)
32
+ mcp/ MCP server (stdio protocol, 12 tools)
33
+ client/ HTTP client for backend API
34
+ config/ Config file management (~/.config/thask/)
35
+ output/ Output formatting (JSON, table, quiet)
36
+ ```
package/bin/thask.js CHANGED
@@ -1,47 +1,15 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
2
+ const { spawnSync } = require('child_process');
3
+ const path = require('path');
4
+ const fs = require('fs');
3
5
 
4
- const { spawnSync } = require("child_process");
6
+ const ext = process.platform === 'win32' ? '.exe' : '';
7
+ const binary = path.join(__dirname, '..', 'native', `thask${ext}`);
5
8
 
6
- const PLATFORMS = {
7
- "darwin-arm64": "@thask-org/cli-darwin-arm64",
8
- "darwin-x64": "@thask-org/cli-darwin-x64",
9
- "linux-arm64": "@thask-org/cli-linux-arm64",
10
- "linux-x64": "@thask-org/cli-linux-x64",
11
- "win32-x64": "@thask-org/cli-win32-x64",
12
- };
13
-
14
- const key = `${process.platform}-${process.arch}`;
15
- const pkg = PLATFORMS[key];
16
-
17
- if (!pkg) {
18
- console.error(
19
- `thask: unsupported platform ${key}\n` +
20
- `Supported: ${Object.keys(PLATFORMS).join(", ")}\n` +
21
- `Install from source: https://github.com/kimgh06/Thask/tree/main/cli`
22
- );
23
- process.exit(1);
24
- }
25
-
26
- let binPath;
27
- try {
28
- const suffix = process.platform === "win32" ? ".exe" : "";
29
- binPath = require.resolve(`${pkg}/bin/thask${suffix}`);
30
- } catch {
31
- console.error(
32
- `thask: failed to find binary for ${key}\n` +
33
- `Try reinstalling: npm install -g thask`
34
- );
35
- process.exit(1);
36
- }
37
-
38
- const { status, error } = spawnSync(binPath, process.argv.slice(2), {
39
- stdio: "inherit",
40
- });
41
-
42
- if (error) {
43
- console.error(`thask: ${error.message}`);
9
+ if (!fs.existsSync(binary)) {
10
+ console.error('[thask] Binary not found. Try reinstalling: npm install -g thask');
44
11
  process.exit(1);
45
12
  }
46
13
 
47
- process.exit(status ?? 1);
14
+ const result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' });
15
+ process.exit(result.status ?? 1);
package/install.js ADDED
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env node
2
+ // Downloads the correct thask binary from GitHub Releases at install time.
3
+
4
+ const { execSync } = require('child_process');
5
+ const https = require('https');
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+
9
+ const VERSION = require('./package.json').version;
10
+ const REPO = 'kimgh06/Thask';
11
+
12
+ const PLATFORM_MAP = {
13
+ 'darwin-arm64': 'thask-darwin-arm64',
14
+ 'darwin-x64': 'thask-darwin-amd64',
15
+ 'linux-arm64': 'thask-linux-arm64',
16
+ 'linux-x64': 'thask-linux-amd64',
17
+ 'win32-x64': 'thask-windows-amd64.exe',
18
+ };
19
+
20
+ const key = `${process.platform}-${process.arch}`;
21
+ const binaryName = PLATFORM_MAP[key];
22
+
23
+ if (!binaryName) {
24
+ console.error(`[thask] Unsupported platform: ${key}`);
25
+ process.exit(0); // non-fatal — user can install manually
26
+ }
27
+
28
+ const nativeDir = path.join(__dirname, 'native');
29
+ const ext = process.platform === 'win32' ? '.exe' : '';
30
+ const dest = path.join(nativeDir, `thask${ext}`);
31
+
32
+ if (fs.existsSync(dest)) {
33
+ process.exit(0); // already installed
34
+ }
35
+
36
+ fs.mkdirSync(nativeDir, { recursive: true });
37
+
38
+ const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${binaryName}`;
39
+ console.log(`[thask] Downloading ${binaryName} from GitHub Releases...`);
40
+
41
+ function download(url, dest, cb) {
42
+ const file = fs.createWriteStream(dest);
43
+ https.get(url, (res) => {
44
+ if (res.statusCode === 302 || res.statusCode === 301) {
45
+ file.close();
46
+ fs.unlinkSync(dest);
47
+ download(res.headers.location, dest, cb);
48
+ return;
49
+ }
50
+ if (res.statusCode !== 200) {
51
+ file.close();
52
+ fs.unlinkSync(dest);
53
+ cb(new Error(`HTTP ${res.statusCode}`));
54
+ return;
55
+ }
56
+ res.pipe(file);
57
+ file.on('finish', () => file.close(cb));
58
+ }).on('error', (err) => {
59
+ fs.unlinkSync(dest);
60
+ cb(err);
61
+ });
62
+ }
63
+
64
+ download(url, dest, (err) => {
65
+ if (err) {
66
+ console.error(`[thask] Download failed: ${err.message}`);
67
+ console.error(`[thask] Install manually: https://github.com/${REPO}/releases/tag/v${VERSION}`);
68
+ process.exit(0); // non-fatal
69
+ }
70
+ fs.chmodSync(dest, 0o755);
71
+ console.log(`[thask] Installed successfully.`);
72
+ });
package/package.json CHANGED
@@ -1,33 +1,24 @@
1
1
  {
2
2
  "name": "@thask-org/cli",
3
- "version": "0.3.0",
4
- "description": "Graph-based dependency visualization for AI-assisted development",
3
+ "version": "0.5.2",
4
+ "description": "Graph-based dependency visualization CLI for AI-assisted development",
5
5
  "license": "MIT",
6
+ "homepage": "https://github.com/kimgh06/Thask",
6
7
  "repository": {
7
8
  "type": "git",
8
- "url": "https://github.com/kimgh06/Thask"
9
+ "url": "https://github.com/kimgh06/Thask.git"
9
10
  },
10
- "homepage": "https://thask.kimgh06.com",
11
- "keywords": [
12
- "dependency-graph",
13
- "mcp",
14
- "claude-code",
15
- "cursor",
16
- "ai-tools",
17
- "devtools",
18
- "cli"
19
- ],
20
11
  "bin": {
21
12
  "thask": "bin/thask.js"
22
13
  },
23
- "engines": {
24
- "node": ">=18"
14
+ "scripts": {
15
+ "postinstall": "node install.js"
25
16
  },
26
- "optionalDependencies": {
27
- "@thask-org/cli-darwin-arm64": "0.3.0",
28
- "@thask-org/cli-darwin-x64": "0.3.0",
29
- "@thask-org/cli-linux-arm64": "0.3.0",
30
- "@thask-org/cli-linux-x64": "0.3.0",
31
- "@thask-org/cli-win32-x64": "0.3.0"
17
+ "files": [
18
+ "bin/thask.js",
19
+ "install.js"
20
+ ],
21
+ "engines": {
22
+ "node": ">=16"
32
23
  }
33
24
  }