note-connector 0.2.3 → 0.2.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.
@@ -1,4 +1,4 @@
1
- import { execFileSync } from "node:child_process";
1
+ import { execFileSync, spawnSync } from "node:child_process";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { loadConfig, saveConfig } from "./config.js";
@@ -40,10 +40,33 @@ function repoHasPython(root) {
40
40
  return fs.existsSync(path.join(root, "pyproject.toml")) && fs.existsSync(path.join(root, "src", "note_mcp"));
41
41
  }
42
42
  function cloneRepo(target) {
43
+ if (!commandExists("git")) {
44
+ throw new Error("git が見つかりません。git をインストールするか、\n" +
45
+ "手動で clone して repoPath を設定してください。\n" +
46
+ ` git clone ${DEFAULT_REPO} ${target}\n` +
47
+ ` note-connector config set repoPath ${target}`);
48
+ }
43
49
  console.log(`Cloning note-connector → ${target}`);
44
50
  fs.mkdirSync(path.dirname(target), { recursive: true });
45
51
  execFileSync("git", ["clone", "--depth", "1", DEFAULT_REPO, target], { stdio: "inherit" });
46
52
  }
53
+ function updateRepo(repo) {
54
+ if (!commandExists("git"))
55
+ return;
56
+ try {
57
+ const result = spawnSync("git", ["pull", "--ff-only", "origin", "main"], {
58
+ cwd: repo,
59
+ encoding: "utf8",
60
+ timeout: 15000,
61
+ });
62
+ if (result.status === 0 && !String(result.stdout).trim().includes("Already up to date")) {
63
+ console.log("note-connector を最新に更新しました");
64
+ }
65
+ }
66
+ catch {
67
+ // Network issues or git not available — skip silently
68
+ }
69
+ }
47
70
  function ensureRepoPath(config) {
48
71
  if (config.repoPath && repoHasPython(config.repoPath)) {
49
72
  return path.resolve(config.repoPath);
@@ -90,11 +113,15 @@ export async function setupDependencies() {
90
113
  const config = loadConfig();
91
114
  ensureUv();
92
115
  const repo = ensureRepoPath(config);
116
+ updateRepo(repo);
93
117
  runUvSync(repo);
94
118
  ensurePlaywright(repo);
95
119
  if (!commandExists("tailscale") && config.tunnel.provider === "tailscale" && !config.tunnel.publicUrl) {
96
120
  warnings.push("Tailscale CLI がありません。tunnel.publicUrl を設定するか Tailscale をインストールしてください。");
97
121
  }
122
+ if (!commandExists("git")) {
123
+ warnings.push("git がありません。初回起動は動作しますが、更新を自動取得するには git をインストールしてください。");
124
+ }
98
125
  return {
99
126
  uvInstalled: true,
100
127
  repoReady: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "note-connector",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },