@agentunion/kite 1.6.2 → 1.6.3
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/cli.js +2 -1
- package/kite_cli/commands/install_skill.py +3 -1
- package/main.py +44 -0
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -136,7 +136,8 @@ if (args[0] === 'start') {
|
|
|
136
136
|
...process.env,
|
|
137
137
|
KITE_PROJECT: cliWorkDir,
|
|
138
138
|
KITE_MODULES: modulesDir,
|
|
139
|
-
KITE_DATA: dataDir
|
|
139
|
+
KITE_DATA: dataDir,
|
|
140
|
+
KITE_CALLER_DIR: process.cwd()
|
|
140
141
|
}
|
|
141
142
|
});
|
|
142
143
|
result.on('exit', code => process.exit(code ?? 0));
|
|
@@ -32,7 +32,9 @@ def get_user_skill_dir():
|
|
|
32
32
|
|
|
33
33
|
def get_project_skill_dir():
|
|
34
34
|
"""获取项目级 skill 目录"""
|
|
35
|
-
cwd
|
|
35
|
+
# cli.js 会把 cwd 改成包目录,用 KITE_CALLER_DIR 获取用户的实际目录
|
|
36
|
+
caller_dir = os.environ.get("KITE_CALLER_DIR", "")
|
|
37
|
+
cwd = Path(caller_dir) if caller_dir else Path.cwd()
|
|
36
38
|
return cwd / ".claude" / "skills" / "kite"
|
|
37
39
|
|
|
38
40
|
|
package/main.py
CHANGED
|
@@ -19,6 +19,50 @@ if "--stop" in sys.argv:
|
|
|
19
19
|
stop_instances()
|
|
20
20
|
sys.exit(0)
|
|
21
21
|
|
|
22
|
+
# --daemon / -d: 后台运行模式,脱离终端,关闭终端不影响进程
|
|
23
|
+
if "--daemon" in sys.argv or "-d" in sys.argv:
|
|
24
|
+
import os
|
|
25
|
+
import subprocess
|
|
26
|
+
|
|
27
|
+
# 构建子进程参数:去掉 --daemon / -d,其余保留
|
|
28
|
+
child_args = [sys.executable, os.path.abspath(__file__)]
|
|
29
|
+
for arg in sys.argv[1:]:
|
|
30
|
+
if arg not in ("--daemon", "-d"):
|
|
31
|
+
child_args.append(arg)
|
|
32
|
+
|
|
33
|
+
# 日志输出到实例目录(复用 start_launcher 的路径逻辑)
|
|
34
|
+
home = os.environ.get("HOME") or os.environ.get("USERPROFILE") or os.path.expanduser("~")
|
|
35
|
+
workspace = os.environ.get("KITE_WORKSPACE") or os.path.join(home, ".kite", "workspace")
|
|
36
|
+
basename = os.path.basename(os.getcwd().rstrip(os.sep)) or "default"
|
|
37
|
+
instance_dir = os.path.join(workspace, basename)
|
|
38
|
+
log_dir = os.path.join(instance_dir, "launcher", "log")
|
|
39
|
+
os.makedirs(log_dir, exist_ok=True)
|
|
40
|
+
daemon_log = os.path.join(log_dir, "daemon.log")
|
|
41
|
+
|
|
42
|
+
log_fd = open(daemon_log, "w", encoding="utf-8")
|
|
43
|
+
|
|
44
|
+
kwargs = {
|
|
45
|
+
"stdout": log_fd,
|
|
46
|
+
"stderr": log_fd,
|
|
47
|
+
"stdin": subprocess.DEVNULL,
|
|
48
|
+
"cwd": os.getcwd(),
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if sys.platform == "win32":
|
|
52
|
+
# Windows: 脱离控制台,创建新进程组
|
|
53
|
+
CREATE_NEW_PROCESS_GROUP = 0x00000200
|
|
54
|
+
CREATE_NO_WINDOW = 0x08000000
|
|
55
|
+
kwargs["creationflags"] = CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW
|
|
56
|
+
else:
|
|
57
|
+
# Linux / macOS: 新会话,脱离终端
|
|
58
|
+
kwargs["start_new_session"] = True
|
|
59
|
+
|
|
60
|
+
proc = subprocess.Popen(child_args, **kwargs)
|
|
61
|
+
print(f"[Kite] 后台启动成功 (PID: {proc.pid})")
|
|
62
|
+
print(f"[Kite] 日志: {daemon_log}")
|
|
63
|
+
print(f"[Kite] 停止: python main.py --stop")
|
|
64
|
+
sys.exit(0)
|
|
65
|
+
|
|
22
66
|
# --no-tls: 禁用 TLS 要求(本地开发用)
|
|
23
67
|
if "--no-tls" in sys.argv:
|
|
24
68
|
import os
|