@haenah/u1z 0.1.4 → 0.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haenah/u1z",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "AI 집 비서 — Raspberry Pi home assistant powered by Claude + Discord",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  import { copyFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
2
2
  import { homedir } from "node:os";
3
- import { join } from "node:path";
3
+ import { dirname, join } from "node:path";
4
4
  import { c } from "../utils/color";
5
5
  import { ask } from "../utils/prompt";
6
6
 
@@ -98,6 +98,8 @@ export async function init(): Promise<void> {
98
98
  ensureDir(serviceDir);
99
99
 
100
100
  const u1zBin = Bun.which("u1z") ?? join(homedir(), ".bun", "bin", "u1z");
101
+ const bunBinDir = dirname(process.execPath);
102
+ const envPath = `${bunBinDir}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`;
101
103
 
102
104
  const serviceContent = `[Unit]
103
105
  Description=u1z AI 집 비서
@@ -106,6 +108,7 @@ After=network.target
106
108
  [Service]
107
109
  Type=simple
108
110
  WorkingDirectory=${u1zHome}
111
+ Environment=PATH=${envPath}
109
112
  ExecStart=${u1zBin} server
110
113
  EnvironmentFile=${configPath}
111
114
  Restart=on-failure
@@ -0,0 +1,7 @@
1
+ export async function restart(): Promise<void> {
2
+ const proc = Bun.spawn(["systemctl", "--user", "restart", "u1z"], {
3
+ stdout: "inherit",
4
+ stderr: "inherit",
5
+ });
6
+ process.exit(await proc.exited);
7
+ }
package/src/cli/index.ts CHANGED
@@ -22,6 +22,9 @@ yargs(hideBin(process.argv))
22
22
  { n: { type: "number", describe: "최근 N줄" } },
23
23
  (argv) => import("./commands/logs").then((m) => m.logs(argv)),
24
24
  )
25
+ .command("restart", "서비스 재시작", {}, () =>
26
+ import("./commands/restart").then((m) => m.restart()),
27
+ )
25
28
  .command("update", "최신 버전으로 업데이트", {}, () =>
26
29
  import("./commands/update").then((m) => m.update()),
27
30
  )