@nolto/cli 0.19.4 → 0.20.1

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.
Files changed (2) hide show
  1. package/dist/index.js +116 -48
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -90,6 +90,9 @@ function mapHttpStatusToCliError(status, opts = {}) {
90
90
  opts.body
91
91
  );
92
92
  }
93
+ if (status === 409 && opts.serverError === "project_key_taken") {
94
+ return new CliError(opts.serverMessage ?? "\u3053\u306E\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30AD\u30FC\u306F\u65E2\u306B\u4F7F\u308F\u308C\u3066\u3044\u307E\u3059\u3002", 2, void 0, status, opts.serverError, opts.body);
95
+ }
93
96
  if (status === 429 && opts.serverError === "rebind_cooldown") {
94
97
  return new CliError(
95
98
  opts.serverMessage ?? "Rebind cooldown active.",
@@ -386,7 +389,7 @@ ${MEMORY_INSTRUCTIONS}
386
389
  // src/index.ts
387
390
  import { createRequire as createRequire3 } from "module";
388
391
  import { fileURLToPath as fileURLToPath4 } from "url";
389
- import path23 from "path";
392
+ import path24 from "path";
390
393
  import os5 from "os";
391
394
  import { CommanderError } from "commander";
392
395
 
@@ -605,11 +608,11 @@ function maskToken(token) {
605
608
  function createHttpClient(opts) {
606
609
  const { baseUrl, version, token } = opts;
607
610
  const base = baseUrl.replace(/\/+$/, "");
608
- async function request(method, path24, body, extraHeaders, signal) {
609
- if (!path24.startsWith("/api/")) {
610
- throw new CliError(`HTTP client path must start with /api/, got: ${path24}`, 2);
611
+ async function request(method, path25, body, extraHeaders, signal) {
612
+ if (!path25.startsWith("/api/")) {
613
+ throw new CliError(`HTTP client path must start with /api/, got: ${path25}`, 2);
611
614
  }
612
- const url = `${base}${path24}`;
615
+ const url = `${base}${path25}`;
613
616
  const headers2 = {
614
617
  ...extraHeaders,
615
618
  "Content-Type": "application/json",
@@ -826,12 +829,12 @@ function normalizeRemote(raw) {
826
829
  const firstSlash = s.indexOf("/");
827
830
  if (firstSlash <= 0) return null;
828
831
  let host = s.slice(0, firstSlash).toLowerCase();
829
- let path24 = s.slice(firstSlash + 1);
832
+ let path25 = s.slice(firstSlash + 1);
830
833
  if (hadScheme) host = host.replace(/:\d+$/, "");
831
- path24 = path24.replace(/\/+/g, "/").replace(/^\/+/, "").replace(/\/+$/, "").replace(/\.git$/i, "").replace(/\/+$/, "");
832
- if (path24.length === 0) return null;
833
- if (HOSTED_LOWERCASE_PATH.has(host)) path24 = path24.toLowerCase();
834
- return `${host}/${path24}`;
834
+ path25 = path25.replace(/\/+/g, "/").replace(/^\/+/, "").replace(/\/+$/, "").replace(/\.git$/i, "").replace(/\/+$/, "");
835
+ if (path25.length === 0) return null;
836
+ if (HOSTED_LOWERCASE_PATH.has(host)) path25 = path25.toLowerCase();
837
+ return `${host}/${path25}`;
835
838
  }
836
839
  function repoIdentityToString(id) {
837
840
  return `${id.kind}:${id.value}`;
@@ -1166,8 +1169,15 @@ function formatIssueView(bundle) {
1166
1169
  categories: issue.categories.map((row) => row.name).join(", "),
1167
1170
  parent: issue.parent?.key ?? "\u2014"
1168
1171
  });
1169
- const comments = bundle.comments.map((comment) => `${personLabel(comment.author)} / ${formatTimestamp(comment.createdAt)}${!comment.deletedAt && comment.via ? ` [API \u7D4C\u7531: ${comment.via.tokenName}]` : ""}
1170
- ${comment.deletedAt ? "\u30B3\u30E1\u30F3\u30C8\u306F\u524A\u9664\u3055\u308C\u3066\u3044\u307E\u3059\u3002" : comment.body}`);
1172
+ const comments = bundle.comments.map((comment) => {
1173
+ let via = "";
1174
+ if (!comment.deletedAt && comment.via) {
1175
+ const name = comment.via.tokenName.replace(new RegExp("\\p{Cf}", "gu"), "").trim();
1176
+ via = comment.via.kind === "oauth_app" ? name ? ` [${name} \u7D4C\u7531]` : " [\u30A2\u30D7\u30EA\u7D4C\u7531]" : ` [API \u7D4C\u7531: ${comment.via.tokenName}]`;
1177
+ }
1178
+ return `${personLabel(comment.author)} / ${formatTimestamp(comment.createdAt)}${via}
1179
+ ${comment.deletedAt ? "\u30B3\u30E1\u30F3\u30C8\u306F\u524A\u9664\u3055\u308C\u3066\u3044\u307E\u3059\u3002" : comment.body}`;
1180
+ });
1171
1181
  return [attributes, issue.body, ...comments].join("\n\n");
1172
1182
  }
1173
1183
  function addIssueToRoadmapTask(roadmapJson, taskId, key) {
@@ -3163,6 +3173,25 @@ import { fileURLToPath as fileURLToPath2 } from "url";
3163
3173
  import os3 from "os";
3164
3174
  import path17 from "path";
3165
3175
  import fs2 from "fs";
3176
+
3177
+ // src/project-key.ts
3178
+ var PROJECT_KEY_RE = /^[A-Z][A-Z0-9]{1,9}$/;
3179
+ var PROJECT_KEY_MAX = 10;
3180
+ function normalizeProjectKey(raw) {
3181
+ return raw.trim().toUpperCase();
3182
+ }
3183
+ function isValidProjectKey(value) {
3184
+ return PROJECT_KEY_RE.test(value);
3185
+ }
3186
+ function suggestProjectKey(name) {
3187
+ const words = name.split(/[^A-Za-z0-9]+/).map((word) => word.replace(/[^A-Za-z0-9]/g, "")).filter((word) => word.length > 0);
3188
+ if (words.length === 0) return "";
3189
+ const raw = words.length >= 2 ? words.slice(0, 6).map((word) => word[0]).join("") : words[0].slice(0, 6);
3190
+ const candidate = raw.toUpperCase().replace(/^[0-9]+/, "").slice(0, PROJECT_KEY_MAX);
3191
+ return isValidProjectKey(candidate) ? candidate : "";
3192
+ }
3193
+
3194
+ // src/commands/init.ts
3166
3195
  var __dirname2 = path17.dirname(fileURLToPath2(import.meta.url));
3167
3196
  var _require = createRequire(import.meta.url);
3168
3197
  function getCliVersion() {
@@ -3200,6 +3229,11 @@ async function pickProject(rl, http, projects, promptText, baseUrl) {
3200
3229
  if (name.trim().length === 0) {
3201
3230
  throw new CliError("Project name is required.", 2);
3202
3231
  }
3232
+ const suggestedKey = suggestProjectKey(name);
3233
+ const rawKey = await rl.question(`Project key (2-10 chars, e.g. NF)${suggestedKey ? ` [${suggestedKey}]` : ""}: `);
3234
+ const key = normalizeProjectKey(rawKey) || suggestedKey;
3235
+ if (!key) throw new CliError("Project key is required.", 2);
3236
+ if (!isValidProjectKey(key)) throw new CliError("Project key must start with an uppercase letter and contain 2-10 alphanumeric characters.", 2);
3203
3237
  const { orgs } = await http.get("/api/orgs/eligible");
3204
3238
  if (orgs.length === 0) {
3205
3239
  throw new CliError(`No organization to create the project in. Create one at ${baseUrl.replace(/\/+$/, "")}/orgs/new first.`, 2);
@@ -3220,7 +3254,7 @@ async function pickProject(rl, http, projects, promptText, baseUrl) {
3220
3254
  }
3221
3255
  const created = await http.post(
3222
3256
  "/api/projects",
3223
- { name: name.trim(), orgId: organization.id }
3257
+ { name: name.trim(), key, orgId: organization.id }
3224
3258
  );
3225
3259
  if (created.project?.id == null) {
3226
3260
  throw new CliError("Project API did not return a project id.", 2);
@@ -3229,7 +3263,7 @@ async function pickProject(rl, http, projects, promptText, baseUrl) {
3229
3263
  id: created.project.id,
3230
3264
  name: created.project.name ?? name.trim()
3231
3265
  };
3232
- process.stdout.write(`Created project ${project.name} (${project.id}) in ${organization.name}
3266
+ process.stdout.write(`Created project ${project.name} [${key}] (${project.id}) in ${organization.name}
3233
3267
  `);
3234
3268
  return project;
3235
3269
  }
@@ -3583,6 +3617,8 @@ async function promptHidden(rl, prompt) {
3583
3617
 
3584
3618
  // src/commands/login.ts
3585
3619
  import readline4 from "readline/promises";
3620
+ import { readdir as readdir6, rm as rm3 } from "fs/promises";
3621
+ import path18 from "path";
3586
3622
 
3587
3623
  // src/login-poll.ts
3588
3624
  async function pollUntilToken(opts) {
@@ -3703,6 +3739,13 @@ function register6(program, deps) {
3703
3739
  token
3704
3740
  };
3705
3741
  await saveConfigFile(configPath, newConfig);
3742
+ const projects = await readdir6(path18.join(path18.dirname(configPath), "projects")).catch(() => []);
3743
+ for (const project of projects) {
3744
+ try {
3745
+ await rm3(memoryDir(configPath, project), { recursive: true, force: true });
3746
+ } catch {
3747
+ }
3748
+ }
3706
3749
  process.stdout.write("\n");
3707
3750
  if (output.mode === "json") {
3708
3751
  process.stdout.write(
@@ -3990,11 +4033,11 @@ import { execFile as execFile4 } from "child_process";
3990
4033
  import { promisify as promisify3 } from "util";
3991
4034
  import { readFile as readFile15, realpath as realpath4 } from "fs/promises";
3992
4035
  import { existsSync as existsSync7, mkdirSync } from "fs";
3993
- import path20 from "path";
4036
+ import path21 from "path";
3994
4037
  import chokidar from "chokidar";
3995
4038
 
3996
4039
  // src/watch-core.ts
3997
- import path18 from "path";
4040
+ import path19 from "path";
3998
4041
  var WatchSet = class {
3999
4042
  constructor(deps) {
4000
4043
  this.deps = deps;
@@ -4043,7 +4086,7 @@ async function reloadRoots(deps) {
4043
4086
  continue;
4044
4087
  }
4045
4088
  try {
4046
- const projectId = repo.projectId ?? (await loadRepoBinding(path18.join(repo.root, "nolto.json")))?.projectId;
4089
+ const projectId = repo.projectId ?? (await loadRepoBinding(path19.join(repo.root, "nolto.json")))?.projectId;
4047
4090
  if (projectId) repos.push({ root: repo.root, projectId });
4048
4091
  else deps.warn(`registered repo has no project binding, skipping: ${repo.root}`);
4049
4092
  } catch (err) {
@@ -4114,7 +4157,7 @@ var RepoWatch = class {
4114
4157
  };
4115
4158
 
4116
4159
  // src/service-install.ts
4117
- import path19 from "path";
4160
+ import path20 from "path";
4118
4161
  import os4 from "os";
4119
4162
  function buildUnitFile(args) {
4120
4163
  return [
@@ -4134,8 +4177,8 @@ function buildUnitFile(args) {
4134
4177
  }
4135
4178
  function getUnitPath(env) {
4136
4179
  const xdg = env["XDG_CONFIG_HOME"];
4137
- const base = xdg != null && xdg.length > 0 ? xdg : path19.join(os4.homedir(), ".config");
4138
- return path19.join(base, "systemd", "user", "nolto-watch.service");
4180
+ const base = xdg != null && xdg.length > 0 ? xdg : path20.join(os4.homedir(), ".config");
4181
+ return path20.join(base, "systemd", "user", "nolto-watch.service");
4139
4182
  }
4140
4183
  async function installServiceWith(deps) {
4141
4184
  if (deps.platform !== "linux") {
@@ -4146,7 +4189,7 @@ async function installServiceWith(deps) {
4146
4189
  );
4147
4190
  }
4148
4191
  const unitPath = getUnitPath(deps.env);
4149
- await deps.mkdir(path19.dirname(unitPath));
4192
+ await deps.mkdir(path20.dirname(unitPath));
4150
4193
  await deps.writeFile(unitPath, buildUnitFile({ nodePath: deps.nodePath, scriptPath: deps.scriptPath }));
4151
4194
  deps.log(`Wrote ${unitPath}`);
4152
4195
  const reload = await deps.exec(["systemctl", "--user", "daemon-reload"]);
@@ -4168,7 +4211,7 @@ async function installService() {
4168
4211
  platform: process.platform,
4169
4212
  env: process.env,
4170
4213
  nodePath: process.execPath,
4171
- scriptPath: path19.resolve(process.argv[1] ?? ""),
4214
+ scriptPath: path20.resolve(process.argv[1] ?? ""),
4172
4215
  writeFile: (p, content) => writeFile11(p, content, "utf8"),
4173
4216
  mkdir: async (p) => {
4174
4217
  await mkdir9(p, { recursive: true });
@@ -4310,7 +4353,7 @@ function register10(program, deps) {
4310
4353
  const startRepo = ({ root, projectId }) => {
4311
4354
  const roadmapsPath = cacheDir(process.env, projectId);
4312
4355
  const warn2 = (line2) => {
4313
- process.stderr.write(line2.startsWith(" ") ? line2 + "\n" : `Warning: [${path20.basename(root)}] ${line2}
4356
+ process.stderr.write(line2.startsWith(" ") ? line2 + "\n" : `Warning: [${path21.basename(root)}] ${line2}
4314
4357
  `);
4315
4358
  };
4316
4359
  mkdirSync(roadmapsPath, { recursive: true, mode: 448 });
@@ -4327,7 +4370,7 @@ function register10(program, deps) {
4327
4370
  exec: promisify3(execFile4),
4328
4371
  gitLinks: process.env.NOLTO_GIT_LINKS !== "0",
4329
4372
  http,
4330
- log: (line2) => process.stdout.write(`[${path20.basename(root)}] ${line2}
4373
+ log: (line2) => process.stdout.write(`[${path21.basename(root)}] ${line2}
4331
4374
  `),
4332
4375
  warn: warn2
4333
4376
  }
@@ -4340,7 +4383,7 @@ function register10(program, deps) {
4340
4383
  warn: (line2) => process.stderr.write(line2 + "\n")
4341
4384
  });
4342
4385
  watcher.on("all", (_event, filePath) => {
4343
- if (path20.dirname(filePath) === roadmapsPath && !filePath.endsWith(".json")) return;
4386
+ if (path21.dirname(filePath) === roadmapsPath && !filePath.endsWith(".json")) return;
4344
4387
  repoWatch.handleEvent(filePath);
4345
4388
  });
4346
4389
  void checkSkillDrift(root, { homeSkillDirs: deps.homeSkillDirs }).then((drifted) => {
@@ -4460,7 +4503,7 @@ stale: ${result.stale}`, deps.output.mode);
4460
4503
  printResult(deps.output.mode === "json" ? { repos } : repos.map((repo) => `${repo.root} ${repo.projectId ?? "\u2014"}${repo.exists ? "" : " (missing)"}`).join("\n"), deps.output.mode);
4461
4504
  });
4462
4505
  watch.command("remove [root]").description("Remove a repository from the watch registry.").action(async (arg) => {
4463
- const root = arg === void 0 ? findRepoRoot(resolveStartDir(process.env, process.cwd())).root : path20.resolve(arg);
4506
+ const root = arg === void 0 ? findRepoRoot(resolveStartDir(process.env, process.cwd())).root : path21.resolve(arg);
4464
4507
  const { removed } = await removeRepoFromRegistry(getRegistryPath(process.env), root);
4465
4508
  if (!removed) throw new CliError(`${root} is not in the watch registry.`, 2, "Run `nolto watch list` to see registered repositories.");
4466
4509
  printResult(deps.output.mode === "json" ? { removed: true, root } : `Removed ${root} from the watch registry.`, deps.output.mode);
@@ -4472,14 +4515,14 @@ import { execFile as execFile5 } from "child_process";
4472
4515
  import { existsSync as existsSync8 } from "fs";
4473
4516
  import { realpath as realpath5 } from "fs/promises";
4474
4517
  import { createRequire as createRequire2 } from "module";
4475
- import path22 from "path";
4518
+ import path23 from "path";
4476
4519
  import { fileURLToPath as fileURLToPath3 } from "url";
4477
4520
  import { promisify as promisify4 } from "util";
4478
4521
 
4479
4522
  // src/update-notifier.ts
4480
4523
  import { readFile as readFile16, writeFile as writeFile9, mkdir as mkdir8 } from "fs/promises";
4481
4524
  import https from "https";
4482
- import path21 from "path";
4525
+ import path22 from "path";
4483
4526
  var PACKAGE = "@nolto/cli";
4484
4527
  var CACHE_FILE = "update-check.json";
4485
4528
  var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
@@ -4537,7 +4580,7 @@ function fetchLatestFromRegistry(timeoutMs = REQUEST_TIMEOUT_MS, opts = {}) {
4537
4580
  });
4538
4581
  }
4539
4582
  async function writeUpdateCache(cachePath, now, latest2) {
4540
- await mkdir8(path21.dirname(cachePath), { recursive: true });
4583
+ await mkdir8(path22.dirname(cachePath), { recursive: true });
4541
4584
  const payload = { checkedAt: now, latest: latest2 };
4542
4585
  await writeFile9(cachePath, JSON.stringify(payload), { mode: 384 });
4543
4586
  }
@@ -4548,16 +4591,17 @@ async function refreshCache(cachePath, now, fetchLatest) {
4548
4591
  }
4549
4592
  async function checkForUpdate(opts) {
4550
4593
  if (isDisabled(opts.env)) return null;
4551
- const cachePath = path21.join(opts.configDir, CACHE_FILE);
4594
+ const cachePath = path22.join(opts.configDir, CACHE_FILE);
4552
4595
  let cache = {};
4553
4596
  try {
4554
4597
  cache = JSON.parse(await readFile16(cachePath, "utf8"));
4555
4598
  } catch {
4556
4599
  }
4557
4600
  if (typeof cache.checkedAt !== "number" || opts.now - cache.checkedAt > CACHE_TTL_MS) {
4558
- void refreshCache(cachePath, opts.now, opts.fetchLatest ?? fetchLatestFromRegistry).catch(
4601
+ const refresh = refreshCache(cachePath, opts.now, opts.fetchLatest ?? fetchLatestFromRegistry).catch(
4559
4602
  () => void 0
4560
4603
  );
4604
+ opts.onRefresh?.(refresh);
4561
4605
  }
4562
4606
  if (typeof cache.latest === "string" && isNewerVersion(cache.latest, opts.current)) {
4563
4607
  return cache.latest;
@@ -4656,7 +4700,7 @@ async function updateCliWith(deps) {
4656
4700
  }
4657
4701
  deps.log(`Updated ${PACKAGE2} ${deps.currentVersion} \u2192 ${latest2}.`);
4658
4702
  await deps.writeCache(
4659
- path22.join(deps.configDir, UPDATE_CACHE_FILE),
4703
+ path23.join(deps.configDir, UPDATE_CACHE_FILE),
4660
4704
  deps.now,
4661
4705
  latest2
4662
4706
  ).catch(() => void 0);
@@ -4687,10 +4731,10 @@ async function updateCliWith(deps) {
4687
4731
  };
4688
4732
  }
4689
4733
  function getCurrentVersion() {
4690
- const dirname = path22.dirname(fileURLToPath3(import.meta.url));
4734
+ const dirname = path23.dirname(fileURLToPath3(import.meta.url));
4691
4735
  const require3 = createRequire2(import.meta.url);
4692
4736
  try {
4693
- const pkg = require3(path22.resolve(dirname, "../package.json"));
4737
+ const pkg = require3(path23.resolve(dirname, "../package.json"));
4694
4738
  return pkg.version ?? "0.0.0";
4695
4739
  } catch {
4696
4740
  return "0.0.0";
@@ -5116,6 +5160,9 @@ function printWrite(deps, ctx, action, response, isNew = false, put) {
5116
5160
  }
5117
5161
  async function pull2(deps, opts) {
5118
5162
  let ctx;
5163
+ let userChanged = false;
5164
+ let updateNotice = Promise.resolve("");
5165
+ let updateRefresh = Promise.resolve();
5119
5166
  const signal = opts.hook ? AbortSignal.timeout(8e3) : void 0;
5120
5167
  try {
5121
5168
  const explicitProject = deps.settings.source?.project === "flag" || deps.settings.source?.project === "env";
@@ -5127,11 +5174,33 @@ async function pull2(deps, opts) {
5127
5174
  process.stdout.write(hookOutput(opts.hook, "nolto login \u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044"));
5128
5175
  return;
5129
5176
  }
5177
+ if (opts.hook) {
5178
+ updateNotice = checkForUpdate({
5179
+ current: deps.version,
5180
+ configDir: getConfigDir(process.env),
5181
+ env: process.env,
5182
+ now: Date.now(),
5183
+ onRefresh: (pending) => {
5184
+ updateRefresh = new Promise((resolve) => {
5185
+ const timer = setTimeout(resolve, 2e3);
5186
+ void pending.finally(() => {
5187
+ clearTimeout(timer);
5188
+ resolve();
5189
+ });
5190
+ });
5191
+ }
5192
+ }).then((latest2) => latest2 ? `nolto CLI ${latest2} \u304C\u516C\u958B\u3055\u308C\u3066\u3044\u307E\u3059(\u4ECA\u306F ${deps.version})\u3002\`nolto update\` \u3067\u66F4\u65B0\u3067\u304D\u307E\u3059\u3002
5193
+ ` : "").catch(() => "");
5194
+ }
5130
5195
  ctx = await context2(deps, true);
5131
5196
  if (opts.hook && typeof opts.hook === "string" && !["claude", "codex", "gemini"].includes(opts.hook)) throw new CliError("Unknown hook agent", 2);
5132
5197
  const scope = opts.scope ? [...new Set(opts.scope.split(",").map((s) => parseScope(s.trim(), scopeHint)))].sort().join(",") : "";
5133
5198
  const previous = ctx.cache.state.entries;
5134
- const reset = ctx.cache.meta.cursor === 0 || ctx.cache.state.scope !== scope;
5199
+ const profile = await deps.http.get("/api/me/profile", signal).catch(() => null);
5200
+ const profileUserId = typeof profile?.profile?.id === "string" ? profile.profile.id : void 0;
5201
+ const userId = profileUserId ?? ctx.cache.state.userId;
5202
+ userChanged = profileUserId !== void 0 && (profileUserId !== ctx.cache.state.userId || !ctx.cache.state.userId && previous.length > 0);
5203
+ const reset = ctx.cache.meta.cursor === 0 || ctx.cache.state.scope !== scope || userChanged;
5135
5204
  let cursor = reset ? 0 : ctx.cache.meta.cursor;
5136
5205
  let entries = reset ? [] : previous;
5137
5206
  while (true) {
@@ -5142,23 +5211,19 @@ async function pull2(deps, opts) {
5142
5211
  cursor = page.cursor;
5143
5212
  if (!page.hasMore) break;
5144
5213
  }
5145
- const [projects, profile] = await Promise.all([
5146
- deps.http.get("/api/projects", signal).catch(() => null),
5147
- deps.http.get("/api/me/profile", signal).catch(() => null)
5148
- ]);
5214
+ const projects = await deps.http.get("/api/projects", signal).catch(() => null);
5149
5215
  const projectName = projects?.projects?.find((p) => p.id === ctx.project)?.name ?? ctx.cache.state.projectName;
5150
- const userId = typeof profile?.profile?.id === "string" ? profile.profile.id : ctx.cache.state.userId;
5151
5216
  const next = { ...ctx, cache: { state: { entries, scope, projectName, ...userId ? { userId } : {} }, meta: { cursor, pulledAt: (/* @__PURE__ */ new Date()).toISOString() } } };
5152
5217
  const text = await memoryIndexText(next, deps);
5153
5218
  const unsafe = await saveMemoryCache(ctx.dir, next.cache, previous, text, reset);
5154
5219
  if (unsafe.length && !opts.hook) process.stderr.write(`Warning: \u30AD\u30E3\u30C3\u30B7\u30E5\u306B\u7F6E\u3051\u306A\u3044\u30A8\u30F3\u30C8\u30EA ${unsafe.length} \u4EF6\u3092\u7D22\u5F15\u3068 list \u304B\u3089\u5916\u3057\u305F: ${unsafe.map((e) => `${e.scope}/${oneLine(e.name)}`).join(", ")}
5155
5220
  `);
5156
- if (opts.hook) process.stdout.write(hookOutput(opts.hook, text));
5221
+ if (opts.hook) process.stdout.write(hookOutput(opts.hook, await updateNotice + text));
5157
5222
  else printResult(deps.output.mode === "json" ? { cursor, entries: entries.filter((e) => !e.deleted).length } : `pulled memory (${entries.filter((e) => !e.deleted).length} \u4EF6)`, deps.output.mode);
5158
5223
  } catch (error) {
5159
5224
  if (!opts.hook) throw error;
5160
5225
  let text = pullHint;
5161
- if (ctx?.cache.meta.pulledAt) {
5226
+ if (!userChanged && ctx?.cache.meta.pulledAt) {
5162
5227
  try {
5163
5228
  const age = Math.max(0, Math.floor((Date.now() - Date.parse(ctx.cache.meta.pulledAt)) / 6e4));
5164
5229
  text = `(\u6700\u7D42\u540C\u671F ${Number.isFinite(age) ? age : "\u4E0D\u660E"} \u5206\u524D\u3002\u4ECA\u56DE\u306F\u540C\u671F\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F)
@@ -5166,7 +5231,10 @@ ${await memoryIndexText(ctx, deps)}`;
5166
5231
  } catch {
5167
5232
  }
5168
5233
  }
5169
- process.stdout.write(hookOutput(opts.hook, text));
5234
+ process.stdout.write(hookOutput(opts.hook, await updateNotice + text));
5235
+ } finally {
5236
+ await updateNotice;
5237
+ await updateRefresh;
5170
5238
  }
5171
5239
  }
5172
5240
  async function inputText(file) {
@@ -5335,11 +5403,11 @@ function buildProgram(deps) {
5335
5403
  }
5336
5404
 
5337
5405
  // src/index.ts
5338
- var __dirname3 = path23.dirname(fileURLToPath4(import.meta.url));
5406
+ var __dirname3 = path24.dirname(fileURLToPath4(import.meta.url));
5339
5407
  var require2 = createRequire3(import.meta.url);
5340
5408
  function getVersion() {
5341
5409
  try {
5342
- const pkgPath = path23.resolve(__dirname3, "../package.json");
5410
+ const pkgPath = path24.resolve(__dirname3, "../package.json");
5343
5411
  const pkg = require2(pkgPath);
5344
5412
  return pkg.version ?? "0.0.0";
5345
5413
  } catch {
@@ -5393,10 +5461,10 @@ async function main() {
5393
5461
  output: { mode },
5394
5462
  version,
5395
5463
  configPath,
5396
- claudeProjectsDir: path23.join(process.env.CLAUDE_CONFIG_DIR ?? path23.join(os5.homedir(), ".claude"), "projects"),
5464
+ claudeProjectsDir: path24.join(process.env.CLAUDE_CONFIG_DIR ?? path24.join(os5.homedir(), ".claude"), "projects"),
5397
5465
  homeSkillDirs: [
5398
- path23.join(process.env.CLAUDE_CONFIG_DIR ?? path23.join(os5.homedir(), ".claude"), "skills"),
5399
- path23.join(os5.homedir(), ".agents", "skills")
5466
+ path24.join(process.env.CLAUDE_CONFIG_DIR ?? path24.join(os5.homedir(), ".claude"), "skills"),
5467
+ path24.join(os5.homedir(), ".agents", "skills")
5400
5468
  ],
5401
5469
  repoBinding
5402
5470
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nolto/cli",
3
- "version": "0.19.4",
3
+ "version": "0.20.1",
4
4
  "description": "CLI for syncing repository roadmaps with Nolto.",
5
5
  "license": "MIT",
6
6
  "type": "module",