@swifty.js/larky 0.0.1-alpha

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/kill.mjs ADDED
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Copyright (c) 2026 hangtiancheng
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+ // @ts-check
24
+
25
+ // Force-kill all larky related processes
26
+ // Usage: node kill.mjs
27
+ import { execSync } from "node:child_process";
28
+
29
+ const TARGETS = [
30
+ { pattern: "larky/src/core/app.ts", label: "daemon" },
31
+ { pattern: "larky/src/dev.ts", label: "dev.ts" },
32
+ { pattern: "larky/src/tui/bootstrap.ts", label: "tui" },
33
+ ];
34
+
35
+ let killed = 0;
36
+
37
+ for (const { pattern, label } of TARGETS) {
38
+ try {
39
+ const pids = execSync(`pgrep -f "${pattern}"`, {
40
+ encoding: "utf-8",
41
+ }).trim();
42
+ if (!pids) continue;
43
+ const pidList = pids.split("\n");
44
+ console.log(`[kill] found ${pidList.length} ${label} process(es): ${pidList.join(", ")}`);
45
+ execSync(`kill -TERM ${pids}`);
46
+ killed += pidList.length;
47
+ } catch {
48
+ // pgrep no match or kill failed — both fine
49
+ }
50
+ }
51
+
52
+ if (killed === 0) {
53
+ console.log("[kill] no larky processes found");
54
+ process.exit(0);
55
+ }
56
+
57
+ // Wait 1s then check for survivors
58
+ await new Promise((r) => setTimeout(r, 1000));
59
+
60
+ for (const { pattern, label } of TARGETS) {
61
+ try {
62
+ const pids = execSync(`pgrep -f "${pattern}"`, {
63
+ encoding: "utf-8",
64
+ }).trim();
65
+ if (!pids) continue;
66
+ console.log(`[kill] ${label} still alive (${pids.replace(/\n/g, ", ")}), sending SIGKILL`);
67
+ execSync(`kill -KILL ${pids}`);
68
+ } catch {
69
+ // No survivors
70
+ }
71
+ }
72
+
73
+ // Also free port 5520 if anything is still holding it
74
+ try {
75
+ const portPids = execSync("lsof -ti :5520", { encoding: "utf-8" }).trim();
76
+ if (portPids) {
77
+ console.log(`[kill] port 5520 still held by: ${portPids.replace(/\n/g, ", ")}, SIGKILL`);
78
+ execSync(`kill -KILL ${portPids}`);
79
+ }
80
+ } catch {
81
+ // Port already free
82
+ }
83
+
84
+ console.log("[kill] done");
package/package.json ADDED
@@ -0,0 +1,98 @@
1
+ {
2
+ "name": "@swifty.js/larky",
3
+ "version": "0.0.1-alpha",
4
+ "description": "Larky - Dual-process CLI coding agent",
5
+ "keywords": [
6
+ "ai",
7
+ "cli",
8
+ "coding-agent",
9
+ "larky",
10
+ "swifty.js"
11
+ ],
12
+ "homepage": "https://github.com/hangtiancheng/swifty-cli",
13
+ "bugs": {
14
+ "url": "https://github.com/hangtiancheng/swifty-cli/issues"
15
+ },
16
+ "license": "MIT",
17
+ "author": "https://github.com/hangtiancheng",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/hangtiancheng/swifty-cli.git",
21
+ "directory": "apps/larky"
22
+ },
23
+ "bin": {
24
+ "larky": "./dist/cli/main.js"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md",
29
+ "kill.mjs",
30
+ "LICENSE",
31
+ "RUNBOOK.md",
32
+ "WIRE_PROTOCOL.md"
33
+ ],
34
+ "type": "module",
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "scripts": {
39
+ "build": "tsup",
40
+ "typecheck": "tsc --noEmit -p tsconfig.json",
41
+ "lint": "eslint ./scripts ./src ./tests",
42
+ "lint:fix": "eslint --fix ./scripts ./src ./tests",
43
+ "format": "oxfmt --write ./",
44
+ "test": "vitest run",
45
+ "test:watch": "vitest",
46
+ "test:coverage": "vitest run --coverage",
47
+ "doc": "tsx ./scripts/gen-protocol-doc.ts",
48
+ "dev": "tsx ./src/dev.ts",
49
+ "dev:core": "tsx ./src/core/app.ts",
50
+ "dev:tui": "tsx ./src/tui/bootstrap.ts",
51
+ "prepublishOnly": "pnpm build",
52
+ "add:user": "npm adduser --registry=https://registry.npmjs.org/",
53
+ "publish:latest": "npm publish --access public --registry=https://registry.npmjs.org/",
54
+ "publish:alpha": "npm publish --access public --registry=https://registry.npmjs.org/ --tag alpha",
55
+ "publish:beta": "npm publish --access public --registry=https://registry.npmjs.org/ --tag beta",
56
+ "publish:rc": "npm publish --access public --registry=https://registry.npmjs.org/ --tag rc",
57
+ "publish:canary": "npm publish --access public --registry=https://registry.npmjs.org/ --tag canary",
58
+ "publish:nightly": "npm publish --access public --registry=https://registry.npmjs.org/ --tag nightly",
59
+ "publish:dev": "npm publish --access public --registry=https://registry.npmjs.org/ --tag dev"
60
+ },
61
+ "dependencies": {
62
+ "@anthropic-ai/sdk": "^0.104.2",
63
+ "@swifty.js/marked-terminal": "workspace:*",
64
+ "chalk": "^5.6.2",
65
+ "dotenv": "^17.4.2",
66
+ "fuse.js": "^7.4.2",
67
+ "ink": "^7.1.0",
68
+ "ink-spinner": "^5.0.0",
69
+ "ink-text-input": "^6.0.0",
70
+ "marked": "^18.0.6",
71
+ "picomatch": "^4.0.5",
72
+ "pino": "^10.3.1",
73
+ "react": "^19.2.7",
74
+ "toml": "^4.1.2",
75
+ "zod": "^4.4.3"
76
+ },
77
+ "devDependencies": {
78
+ "@eslint/js": "^9.39.5",
79
+ "@types/node": "^24.13.3",
80
+ "@types/picomatch": "^4.0.3",
81
+ "@types/react": "^19.2.17",
82
+ "@vitest/coverage-v8": "^4.1.10",
83
+ "concurrently": "^9.2.4",
84
+ "eslint": "^9.39.5",
85
+ "eslint-plugin-react-hooks": "^5.2.0",
86
+ "eslint-plugin-react-refresh": "^0.5.3",
87
+ "eslint-plugin-unicorn": "^65.0.1",
88
+ "globals": "^17.7.0",
89
+ "ink-testing-library": "^4.0.0",
90
+ "oxfmt": "^0.53.0",
91
+ "tsup": "^8.5.1",
92
+ "tsx": "^4.23.0",
93
+ "typescript": "^5.9.3",
94
+ "typescript-eslint": "^8.63.0",
95
+ "vitest": "^4.1.10"
96
+ },
97
+ "packageManager": "pnpm@10.33.1"
98
+ }