@sunasteriskrnd/takumi 1.0.0-dev.55 → 1.0.0-dev.57

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 +138 -85
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -19815,7 +19815,7 @@ var package_default;
19815
19815
  var init_package = __esm(() => {
19816
19816
  package_default = {
19817
19817
  name: "@sunasteriskrnd/takumi",
19818
- version: "1.0.0-dev.55",
19818
+ version: "1.0.0-dev.57",
19819
19819
  description: "CLI tool for bootstrapping and managing Takumi projects",
19820
19820
  type: "module",
19821
19821
  repository: {
@@ -20011,7 +20011,7 @@ function getLegacyManifestPath(providerRoot) {
20011
20011
  return join4(providerRoot, LEGACY_MANIFEST_FILENAME);
20012
20012
  }
20013
20013
  function getCliVersion() {
20014
- return "1.0.0-dev.55"?.trim() || process.env.npm_package_version?.trim() || "unknown";
20014
+ return "1.0.0-dev.57"?.trim() || process.env.npm_package_version?.trim() || "unknown";
20015
20015
  }
20016
20016
  function getCliUserAgent() {
20017
20017
  return `${TAKUMI_CLI_NPM_PACKAGE_NAME}/${getCliVersion()}`;
@@ -42315,6 +42315,9 @@ var init_prune_deleted_hooks = __esm(() => {
42315
42315
  });
42316
42316
 
42317
42317
  // src/commands/portable/model-taxonomy.ts
42318
+ function isValidCodexEffort(value) {
42319
+ return typeof value === "string" && CODEX_REASONING_EFFORTS.includes(value);
42320
+ }
42318
42321
  function setTaxonomyOverrides(overrides) {
42319
42322
  userOverrides = overrides;
42320
42323
  }
@@ -42352,8 +42355,9 @@ function resolveModel(sourceModel, targetProvider) {
42352
42355
  }
42353
42356
  return { resolved: providerMap[tier] };
42354
42357
  }
42355
- var SOURCE_TIER_MAP, DEFAULT_PROVIDER_MODEL_MAP, userOverrides;
42358
+ var CODEX_REASONING_EFFORTS, SOURCE_TIER_MAP, DEFAULT_PROVIDER_MODEL_MAP, userOverrides;
42356
42359
  var init_model_taxonomy = __esm(() => {
42360
+ CODEX_REASONING_EFFORTS = ["minimal", "low", "medium", "high", "xhigh"];
42357
42361
  SOURCE_TIER_MAP = {
42358
42362
  fable: "heavy",
42359
42363
  opus: "heavy",
@@ -42457,8 +42461,18 @@ function convertFmToCodexToml(item) {
42457
42461
  }
42458
42462
  if (modelResult.resolved) {
42459
42463
  lines.push(`model = ${JSON.stringify(modelResult.resolved.model)}`);
42460
- if (modelResult.resolved.effort) {
42461
- lines.push(`# effort = ${JSON.stringify(modelResult.resolved.effort)}`);
42464
+ const rawEffort = item.frontmatter.codexReasoningEffort;
42465
+ if (typeof rawEffort === "string") {
42466
+ const effort = rawEffort.trim();
42467
+ if (effort) {
42468
+ if (isValidCodexEffort(effort)) {
42469
+ lines.push(`model_reasoning_effort = ${JSON.stringify(effort)}`);
42470
+ } else {
42471
+ warnings.push(`Ignored invalid codexReasoningEffort "${effort}" (allowed: ${CODEX_REASONING_EFFORTS.join(", ")})`);
42472
+ }
42473
+ }
42474
+ } else if (rawEffort !== undefined && rawEffort !== null) {
42475
+ warnings.push(`Ignored non-string codexReasoningEffort frontmatter (${typeof rawEffort})`);
42462
42476
  }
42463
42477
  } else if (typeof item.frontmatter.model === "string" && item.frontmatter.model.trim().length > 0 && item.frontmatter.model.trim() !== "inherit") {
42464
42478
  lines.push(`# model = ${JSON.stringify(item.frontmatter.model.trim())}`);
@@ -50589,23 +50603,23 @@ import {
50589
50603
  closeSync as closeSync5,
50590
50604
  constants as fsConstants3,
50591
50605
  fstatSync,
50592
- mkdirSync as mkdirSync5,
50593
- openSync as openSync8,
50606
+ mkdirSync as mkdirSync4,
50607
+ openSync as openSync6,
50594
50608
  readSync as readSync5,
50595
50609
  renameSync as renameSync3,
50596
50610
  rmSync as rmSync4,
50597
50611
  writeFileSync as writeFileSync9
50598
50612
  } from "node:fs";
50599
- import { join as join105 } from "node:path";
50613
+ import { join as join103 } from "node:path";
50600
50614
  function getStatuslineCacheDir() {
50601
- return join105(getConfigDir(), "cache", "statusline");
50615
+ return join103(getConfigDir(), "cache", "statusline");
50602
50616
  }
50603
50617
  function getStatuslineCachePath(fileName) {
50604
- return join105(getStatuslineCacheDir(), fileName);
50618
+ return join103(getStatuslineCacheDir(), fileName);
50605
50619
  }
50606
50620
  function ensureStatuslineCacheDir() {
50607
50621
  try {
50608
- mkdirSync5(getStatuslineCacheDir(), { recursive: true, mode: 448 });
50622
+ mkdirSync4(getStatuslineCacheDir(), { recursive: true, mode: 448 });
50609
50623
  return true;
50610
50624
  } catch {
50611
50625
  return false;
@@ -50614,7 +50628,7 @@ function ensureStatuslineCacheDir() {
50614
50628
  function readCacheFileSafe(path10) {
50615
50629
  let fd;
50616
50630
  try {
50617
- fd = openSync8(path10, fsConstants3.O_RDONLY | fsConstants3.O_NOFOLLOW);
50631
+ fd = openSync6(path10, fsConstants3.O_RDONLY | fsConstants3.O_NOFOLLOW);
50618
50632
  const stat8 = fstatSync(fd);
50619
50633
  if (!stat8.isFile())
50620
50634
  return null;
@@ -50627,10 +50641,10 @@ function readCacheFileSafe(path10) {
50627
50641
  const buf = Buffer.allocUnsafe(size);
50628
50642
  let read = 0;
50629
50643
  while (read < size) {
50630
- const n2 = readSync5(fd, buf, read, size - read, read);
50631
- if (n2 <= 0)
50644
+ const n = readSync5(fd, buf, read, size - read, read);
50645
+ if (n <= 0)
50632
50646
  break;
50633
- read += n2;
50647
+ read += n;
50634
50648
  }
50635
50649
  return buf.toString("utf8", 0, read);
50636
50650
  } catch {
@@ -50664,10 +50678,10 @@ var init_cache_dir = __esm(() => {
50664
50678
  });
50665
50679
 
50666
50680
  // src/domains/hooks/handlers/usage-cache/usage-credential.ts
50667
- import { execFileSync as execFileSync6 } from "node:child_process";
50668
- import { closeSync as closeSync6, constants as fsConstants4, fstatSync as fstatSync2, openSync as openSync9, readFileSync as readFileSync18 } from "node:fs";
50669
- import { homedir as homedir29, platform as platform10 } from "node:os";
50670
- import { join as join114 } from "node:path";
50681
+ import { execFileSync as execFileSync2 } from "node:child_process";
50682
+ import { closeSync as closeSync6, constants as fsConstants4, fstatSync as fstatSync2, openSync as openSync7, readFileSync as readFileSync15 } from "node:fs";
50683
+ import { homedir as homedir28, platform as platform8 } from "node:os";
50684
+ import { join as join104 } from "node:path";
50671
50685
  function hasAnthropicRuntimeOverride(env2 = process.env) {
50672
50686
  return OVERRIDE_ENV_KEYS.some((key) => {
50673
50687
  const value = env2[key];
@@ -50696,7 +50710,7 @@ function parseOAuth(raw) {
50696
50710
  function readTrustedFile(path10) {
50697
50711
  let fd;
50698
50712
  try {
50699
- fd = openSync9(path10, fsConstants4.O_RDONLY | fsConstants4.O_NOFOLLOW);
50713
+ fd = openSync7(path10, fsConstants4.O_RDONLY | fsConstants4.O_NOFOLLOW);
50700
50714
  const stat8 = fstatSync2(fd);
50701
50715
  if (!stat8.isFile())
50702
50716
  return null;
@@ -50705,7 +50719,7 @@ function readTrustedFile(path10) {
50705
50719
  return null;
50706
50720
  if ((stat8.mode & 18) !== 0)
50707
50721
  return null;
50708
- return readFileSync18(fd, "utf8");
50722
+ return readFileSync15(fd, "utf8");
50709
50723
  } catch {
50710
50724
  return null;
50711
50725
  } finally {
@@ -50717,7 +50731,7 @@ function readTrustedFile(path10) {
50717
50731
  }
50718
50732
  }
50719
50733
  function fromCredentialsFile() {
50720
- const raw = readTrustedFile(join114(homedir29(), ".claude", ".credentials.json"));
50734
+ const raw = readTrustedFile(join104(homedir28(), ".claude", ".credentials.json"));
50721
50735
  if (!raw)
50722
50736
  return null;
50723
50737
  try {
@@ -50727,10 +50741,10 @@ function fromCredentialsFile() {
50727
50741
  }
50728
50742
  }
50729
50743
  function fromKeychain() {
50730
- if (platform10() !== "darwin")
50744
+ if (platform8() !== "darwin")
50731
50745
  return null;
50732
50746
  try {
50733
- const out = execFileSync6("security", ["find-generic-password", "-s", KEYCHAIN_SERVICE, "-w"], {
50747
+ const out = execFileSync2("security", ["find-generic-password", "-s", KEYCHAIN_SERVICE, "-w"], {
50734
50748
  timeout: 5000,
50735
50749
  encoding: "utf8",
50736
50750
  stdio: ["ignore", "pipe", "ignore"]
@@ -72743,6 +72757,42 @@ function decodeJobArgv(argv) {
72743
72757
  }
72744
72758
  }
72745
72759
 
72760
+ // src/domains/hooks/telemetry/lib/quota-snapshot.ts
72761
+ init_usage_limits_cache();
72762
+ function isoFromDateLike(raw) {
72763
+ if (typeof raw !== "string")
72764
+ return null;
72765
+ const ms = Date.parse(raw);
72766
+ return Number.isFinite(ms) ? new Date(ms).toISOString() : null;
72767
+ }
72768
+ function isoFromEpochMs(ms) {
72769
+ if (typeof ms !== "number" || !Number.isFinite(ms))
72770
+ return null;
72771
+ return new Date(ms).toISOString();
72772
+ }
72773
+ function toQuotaSnapshot(cache3) {
72774
+ if (!cache3 || cache3.status !== "available")
72775
+ return null;
72776
+ const weeklyPct = cache3.snapshot?.weekPercent;
72777
+ if (typeof weeklyPct !== "number" || !Number.isFinite(weeklyPct) || weeklyPct < 0) {
72778
+ return null;
72779
+ }
72780
+ const resetsAt = isoFromDateLike(cache3.data?.seven_day?.resets_at);
72781
+ if (!resetsAt)
72782
+ return null;
72783
+ const capturedAt = isoFromDateLike(cache3.snapshot?.fetchedAt) ?? isoFromEpochMs(cache3.timestamp);
72784
+ if (!capturedAt)
72785
+ return null;
72786
+ return { weekly_pct: weeklyPct, resets_at: resetsAt, captured_at: capturedAt };
72787
+ }
72788
+ function readQuotaSnapshot() {
72789
+ try {
72790
+ return toQuotaSnapshot(readUsageCache());
72791
+ } catch {
72792
+ return null;
72793
+ }
72794
+ }
72795
+
72746
72796
  // src/domains/hooks/telemetry/lib/session-lifecycle.ts
72747
72797
  function elapsedSeconds(sinceIso, nowIso) {
72748
72798
  if (!sinceIso)
@@ -72819,6 +72869,7 @@ function buildSessionPayload(args) {
72819
72869
  ...summary.turn_count !== undefined ? { turn_count: summary.turn_count } : {},
72820
72870
  ...summary.api_error_count !== undefined ? { api_error_count: summary.api_error_count } : {},
72821
72871
  ...summary.agent_busy_time_s !== undefined ? { agent_busy_time_s: Math.round(summary.agent_busy_time_s) } : {},
72872
+ ...args.quota ? { quota: args.quota } : {},
72822
72873
  summary_generated_at: new Date().toISOString()
72823
72874
  }
72824
72875
  };
@@ -72923,8 +72974,8 @@ async function runSessionEndFlush(data, ctx) {
72923
72974
  session_end_raw: data
72924
72975
  };
72925
72976
  const { promises: fs25 } = await import("node:fs");
72926
- const { join: join103 } = await import("node:path");
72927
- const target = join103(sessionDir, "meta.json");
72977
+ const { join: join105 } = await import("node:path");
72978
+ const target = join105(sessionDir, "meta.json");
72928
72979
  const tmp = `${target}.tmp`;
72929
72980
  await fs25.writeFile(tmp, JSON.stringify(updated), "utf8");
72930
72981
  await fs25.rename(tmp, target);
@@ -72952,7 +73003,8 @@ async function runSessionEndFlush(data, ctx) {
72952
73003
  cliVersion: readCliVersion(),
72953
73004
  kitVersions: manifest.kitVersions,
72954
73005
  milestone: null,
72955
- errorCount: 0
73006
+ errorCount: 0,
73007
+ quota: readQuotaSnapshot()
72956
73008
  });
72957
73009
  const url = `${endpoint.url}/api/v1/telemetry/sessions/${sessionId}`;
72958
73010
  const mode = effectiveDetachMode(flags);
@@ -73108,7 +73160,7 @@ async function applyCodexTranscriptDelta(args) {
73108
73160
  }
73109
73161
 
73110
73162
  // src/domains/hooks/lib/jsonl-append.ts
73111
- import { promises as fs26, appendFileSync as appendFileSync2, mkdirSync as mkdirSync4 } from "node:fs";
73163
+ import { promises as fs26, appendFileSync as appendFileSync2, mkdirSync as mkdirSync5 } from "node:fs";
73112
73164
  import { dirname as dirname28 } from "node:path";
73113
73165
  async function appendJsonl(filePath, record) {
73114
73166
  try {
@@ -73119,7 +73171,7 @@ async function appendJsonl(filePath, record) {
73119
73171
  }
73120
73172
  function appendJsonlLineSync(filePath, line) {
73121
73173
  try {
73122
- mkdirSync4(dirname28(filePath), { recursive: true });
73174
+ mkdirSync5(dirname28(filePath), { recursive: true });
73123
73175
  appendFileSync2(filePath, `${line}
73124
73176
  `, "utf8");
73125
73177
  } catch {}
@@ -73350,7 +73402,8 @@ async function runStopFlush(data, ctx) {
73350
73402
  cliVersion,
73351
73403
  kitVersions: manifest.kitVersions,
73352
73404
  milestone,
73353
- errorCount
73405
+ errorCount,
73406
+ quota: readQuotaSnapshot()
73354
73407
  });
73355
73408
  const url = `${endpoint.url}/api/v1/telemetry/sessions/${sessionId}`;
73356
73409
  const mode = effectiveDetachMode(flags);
@@ -73409,12 +73462,12 @@ async function handleStop(agent, flags = {}) {
73409
73462
 
73410
73463
  // src/domains/hooks/telemetry/otlp/observations-export.ts
73411
73464
  init_paths2();
73412
- import { promises as fs30, openSync as openSync7 } from "node:fs";
73413
- import { join as join104 } from "node:path";
73465
+ import { promises as fs30, openSync as openSync9 } from "node:fs";
73466
+ import { join as join106 } from "node:path";
73414
73467
 
73415
73468
  // src/domains/hooks/telemetry/lib/retention.ts
73416
73469
  import { promises as fs27 } from "node:fs";
73417
- import { join as join103 } from "node:path";
73470
+ import { join as join105 } from "node:path";
73418
73471
  async function pathExists25(path10) {
73419
73472
  try {
73420
73473
  await fs27.access(path10);
@@ -73449,7 +73502,7 @@ async function decideDelete(dir, args) {
73449
73502
  async function listChildren(dir) {
73450
73503
  try {
73451
73504
  const names = await fs27.readdir(dir);
73452
- return names.map((n2) => join103(dir, n2));
73505
+ return names.map((n2) => join105(dir, n2));
73453
73506
  } catch {
73454
73507
  return [];
73455
73508
  }
@@ -73460,7 +73513,7 @@ async function collectV2Sessions() {
73460
73513
  const sessions = [];
73461
73514
  for (const projectDir of projects) {
73462
73515
  for (const agentDir of await listChildren(projectDir)) {
73463
- for (const sessionDir of await listChildren(join103(agentDir, "sessions"))) {
73516
+ for (const sessionDir of await listChildren(join105(agentDir, "sessions"))) {
73464
73517
  sessions.push(sessionDir);
73465
73518
  }
73466
73519
  }
@@ -73565,7 +73618,7 @@ async function resolveOtlpConfig() {
73565
73618
 
73566
73619
  // src/domains/hooks/telemetry/otlp/otlp-post.ts
73567
73620
  import { spawn as spawn3 } from "node:child_process";
73568
- import { promises as fs29, openSync as openSync6 } from "node:fs";
73621
+ import { promises as fs29, openSync as openSync8 } from "node:fs";
73569
73622
 
73570
73623
  // src/domains/hooks/telemetry/otlp/otlp-payload-builder.ts
73571
73624
  import { createHash as createHash13 } from "node:crypto";
@@ -73808,7 +73861,7 @@ function postOtlpDetached(job) {
73808
73861
  let stdio = "ignore";
73809
73862
  if (job.debug) {
73810
73863
  try {
73811
- const fd = openSync6(sessionDebugLogPath(job.sessionDir), "a");
73864
+ const fd = openSync8(sessionDebugLogPath(job.sessionDir), "a");
73812
73865
  stdio = ["ignore", fd, fd];
73813
73866
  } catch {
73814
73867
  stdio = "ignore";
@@ -73889,7 +73942,7 @@ async function exportSessionObservations(sessionDir, opts = {}, deps = {}) {
73889
73942
  }
73890
73943
  }
73891
73944
  function lockPath() {
73892
- return join104(getConfigDir(), "obs-flush.lock");
73945
+ return join106(getConfigDir(), "obs-flush.lock");
73893
73946
  }
73894
73947
  async function acquireSweepLock(now) {
73895
73948
  const path10 = lockPath();
@@ -73899,14 +73952,14 @@ async function acquireSweepLock(now) {
73899
73952
  return false;
73900
73953
  }
73901
73954
  try {
73902
- openSync7(path10, "wx");
73955
+ openSync9(path10, "wx");
73903
73956
  return true;
73904
73957
  } catch {
73905
73958
  try {
73906
73959
  const stat8 = await fs30.stat(path10);
73907
73960
  if (now - stat8.mtimeMs > STALE_LOCK_MS) {
73908
73961
  await fs30.rm(path10, { force: true });
73909
- openSync7(path10, "wx");
73962
+ openSync9(path10, "wx");
73910
73963
  return true;
73911
73964
  }
73912
73965
  } catch {}
@@ -74528,7 +74581,7 @@ var metricsRecord = {
74528
74581
 
74529
74582
  // src/domains/statusline/activity-cache.ts
74530
74583
  import { readdirSync as readdirSync8, rmSync as rmSync5, statSync as statSync8 } from "node:fs";
74531
- import { join as join106 } from "node:path";
74584
+ import { join as join107 } from "node:path";
74532
74585
 
74533
74586
  // src/domains/statusline/activity-snapshot.ts
74534
74587
  import { existsSync as existsSync51 } from "node:fs";
@@ -74988,7 +75041,7 @@ function cleanupStaleActivity(now = Date.now()) {
74988
75041
  for (const entry of entries) {
74989
75042
  if (!entry.startsWith(FILE_PREFIX) || !entry.endsWith(FILE_SUFFIX))
74990
75043
  continue;
74991
- const full = join106(getStatuslineCacheDir(), entry);
75044
+ const full = join107(getStatuslineCacheDir(), entry);
74992
75045
  try {
74993
75046
  if (now - statSync8(full).mtimeMs > ACTIVITY_TTL_MS)
74994
75047
  rmSync5(full, { force: true });
@@ -75053,11 +75106,11 @@ var sessionActivity = {
75053
75106
 
75054
75107
  // src/domains/hooks/handlers/session-init/handler.ts
75055
75108
  import { mkdirSync as mkdirSync6 } from "node:fs";
75056
- import { dirname as dirname29, join as join110 } from "node:path";
75109
+ import { dirname as dirname29, join as join111 } from "node:path";
75057
75110
 
75058
75111
  // src/domains/hooks/handlers/_shared/project-detector.ts
75059
- import { existsSync as existsSync52, readFileSync as readFileSync15 } from "node:fs";
75060
- import { join as join107 } from "node:path";
75112
+ import { existsSync as existsSync52, readFileSync as readFileSync16 } from "node:fs";
75113
+ import { join as join108 } from "node:path";
75061
75114
  var LOCKFILE_PRIORITY = [
75062
75115
  { manager: "bun", files: ["bun.lockb", "bun.lock"] },
75063
75116
  { manager: "pnpm", files: ["pnpm-lock.yaml"] },
@@ -75092,14 +75145,14 @@ var APP_FRAMEWORKS = new Set([
75092
75145
  var WORKSPACE_MARKER_FILES = ["pnpm-workspace.yaml", "turbo.json", "lerna.json"];
75093
75146
  function fileExists(cwd2, name2) {
75094
75147
  try {
75095
- return existsSync52(join107(cwd2, name2));
75148
+ return existsSync52(join108(cwd2, name2));
75096
75149
  } catch {
75097
75150
  return false;
75098
75151
  }
75099
75152
  }
75100
75153
  function readPackageJson(cwd2) {
75101
75154
  try {
75102
- const raw = readFileSync15(join107(cwd2, "package.json"), "utf8");
75155
+ const raw = readFileSync16(join108(cwd2, "package.json"), "utf8");
75103
75156
  const parsed = JSON.parse(raw);
75104
75157
  if (parsed && typeof parsed === "object")
75105
75158
  return parsed;
@@ -75182,12 +75235,12 @@ function detectProject(cwd2) {
75182
75235
 
75183
75236
  // src/domains/hooks/handlers/session-init/env-entries.ts
75184
75237
  import { createHash as createHash14 } from "node:crypto";
75185
- import { platform as platform8, userInfo } from "node:os";
75186
- import { join as join109 } from "node:path";
75238
+ import { platform as platform9, userInfo } from "node:os";
75239
+ import { join as join110 } from "node:path";
75187
75240
 
75188
75241
  // src/domains/hooks/handlers/session-init/plan-resolver.ts
75189
- import { existsSync as existsSync53, readFileSync as readFileSync16, readdirSync as readdirSync9 } from "node:fs";
75190
- import { join as join108 } from "node:path";
75242
+ import { existsSync as existsSync53, readFileSync as readFileSync17, readdirSync as readdirSync9 } from "node:fs";
75243
+ import { join as join109 } from "node:path";
75191
75244
  var MAX_PLAN_DIRS = 100;
75192
75245
  var MAX_PLAN_FILE_BYTES = 64 * 1024;
75193
75246
  function listPlanDirs(plansPath) {
@@ -75201,10 +75254,10 @@ function listPlanDirs(plansPath) {
75201
75254
  }
75202
75255
  function planFileMentionsSession(planDir, sessionId) {
75203
75256
  try {
75204
- const planFile = join108(planDir, "plan.md");
75257
+ const planFile = join109(planDir, "plan.md");
75205
75258
  if (!existsSync53(planFile))
75206
75259
  return false;
75207
- const body = readFileSync16(planFile, { encoding: "utf8" });
75260
+ const body = readFileSync17(planFile, { encoding: "utf8" });
75208
75261
  if (body.length > MAX_PLAN_FILE_BYTES)
75209
75262
  return false;
75210
75263
  return body.includes(sessionId);
@@ -75216,7 +75269,7 @@ function resolveActivePlan(plansPath, sessionId) {
75216
75269
  if (!sessionId)
75217
75270
  return "";
75218
75271
  for (const name2 of listPlanDirs(plansPath)) {
75219
- const dir = join108(plansPath, name2);
75272
+ const dir = join109(plansPath, name2);
75220
75273
  if (name2.includes(sessionId) || planFileMentionsSession(dir, sessionId)) {
75221
75274
  return dir;
75222
75275
  }
@@ -75237,7 +75290,7 @@ function resolveSuggestedPlan(plansPath, branch, branchPattern) {
75237
75290
  return "";
75238
75291
  for (const name2 of listPlanDirs(plansPath)) {
75239
75292
  if (name2.includes(slug))
75240
- return join108(plansPath, name2);
75293
+ return join109(plansPath, name2);
75241
75294
  }
75242
75295
  return "";
75243
75296
  }
@@ -75291,18 +75344,18 @@ function buildEnvEntries(params) {
75291
75344
  const plan = config.plan ?? {};
75292
75345
  const locale = config.locale ?? {};
75293
75346
  const validation = plan.validation ?? {};
75294
- const settingsDir = join109(projectRoot, ".claude");
75295
- const docsPath = join109(projectRoot, paths.docs ?? "docs");
75296
- const plansPath = join109(projectRoot, paths.plans ?? "plans");
75347
+ const settingsDir = join110(projectRoot, ".claude");
75348
+ const docsPath = join110(projectRoot, paths.docs ?? "docs");
75349
+ const plansPath = join110(projectRoot, paths.plans ?? "plans");
75297
75350
  const reportsDir = plan.reportsDir ?? "reports";
75298
- const reportsPath = join109(plansPath, reportsDir);
75351
+ const reportsPath = join110(plansPath, reportsDir);
75299
75352
  const namingFormat = plan.namingFormat ?? "";
75300
75353
  const activePlan = resolveActivePlan(plansPath, ctx.sessionId);
75301
75354
  const suggestedPlan = resolveSuggestedPlan(plansPath, branch, plan.resolution?.branchPattern ?? "");
75302
75355
  return {
75303
75356
  TKM_SESSION_ID: ctx.sessionId ?? "",
75304
75357
  TKM_USER: resolveUser(),
75305
- TKM_OS_PLATFORM: platform8(),
75358
+ TKM_OS_PLATFORM: platform9(),
75306
75359
  TKM_NODE_VERSION: process.versions.node ?? "",
75307
75360
  TKM_TIMEZONE: resolveTimezone(),
75308
75361
  TKM_LOCALE: process.env.LANG || process.env.LC_ALL || "",
@@ -75342,12 +75395,12 @@ function numberString(value) {
75342
75395
  }
75343
75396
 
75344
75397
  // src/domains/hooks/handlers/session-init/git-facts.ts
75345
- import { execFileSync as execFileSync2 } from "node:child_process";
75398
+ import { execFileSync as execFileSync3 } from "node:child_process";
75346
75399
  var GIT_TIMEOUT_MS = 800;
75347
75400
  var GIT_STATUS_TIMEOUT_MS = 500;
75348
75401
  function runGit(cwd2, args, timeoutMs = GIT_TIMEOUT_MS) {
75349
75402
  try {
75350
- const out = execFileSync2("git", ["-C", cwd2, ...args], {
75403
+ const out = execFileSync3("git", ["-C", cwd2, ...args], {
75351
75404
  encoding: "utf8",
75352
75405
  timeout: timeoutMs,
75353
75406
  stdio: ["ignore", "pipe", "ignore"]
@@ -75384,7 +75437,7 @@ function resolveEnvFilePath(settingsDir) {
75384
75437
  const override = process.env.CLAUDE_ENV_FILE;
75385
75438
  if (override && override.trim().length > 0)
75386
75439
  return override;
75387
- return join110(settingsDir, DEFAULT_ENV_FILE);
75440
+ return join111(settingsDir, DEFAULT_ENV_FILE);
75388
75441
  }
75389
75442
  function persistEntries(envFilePath, entries) {
75390
75443
  try {
@@ -75437,16 +75490,16 @@ var sessionInit = {
75437
75490
  };
75438
75491
 
75439
75492
  // src/domains/hooks/handlers/_shared/context-assembler.ts
75440
- import { execFileSync as execFileSync3 } from "node:child_process";
75493
+ import { execFileSync as execFileSync4 } from "node:child_process";
75441
75494
  import { createHash as createHash15 } from "node:crypto";
75442
- import { existsSync as existsSync54, mkdirSync as mkdirSync7, readFileSync as readFileSync17, rmSync as rmSync6, statSync as statSync9, writeFileSync as writeFileSync10 } from "node:fs";
75443
- import { homedir as homedir28, platform as platform9, tmpdir as tmpdir4 } from "node:os";
75444
- import { basename as basename18, join as join111, resolve as resolve24 } from "node:path";
75495
+ import { existsSync as existsSync54, mkdirSync as mkdirSync7, readFileSync as readFileSync18, rmSync as rmSync6, statSync as statSync9, writeFileSync as writeFileSync10 } from "node:fs";
75496
+ import { homedir as homedir29, platform as platform10, tmpdir as tmpdir4 } from "node:os";
75497
+ import { basename as basename18, join as join112, resolve as resolve24 } from "node:path";
75445
75498
  var INJECTED_TTL_MS = 12 * 60 * 60 * 1000;
75446
75499
  var RESERVATION_TTL_MS = 60 * 1000;
75447
75500
  function gitBranch(dir) {
75448
75501
  try {
75449
- const out = execFileSync3("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
75502
+ const out = execFileSync4("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
75450
75503
  cwd: dir,
75451
75504
  timeout: 500,
75452
75505
  stdio: ["ignore", "pipe", "ignore"],
@@ -75518,18 +75571,18 @@ function scopeKey(baseDir) {
75518
75571
  return `${slug}-${hash}`;
75519
75572
  }
75520
75573
  function stateDir() {
75521
- return join111(tmpdir4(), "takumi-context-throttle");
75574
+ return join112(tmpdir4(), "takumi-context-throttle");
75522
75575
  }
75523
75576
  function stateFile(sessionId, scope, transcriptPath) {
75524
75577
  const key = `${sessionId}\x00${scope}\x00${transcriptPath ?? ""}`;
75525
75578
  const hash = createHash15("sha256").update(key).digest("hex").slice(0, 32);
75526
- return join111(stateDir(), `${hash}.json`);
75579
+ return join112(stateDir(), `${hash}.json`);
75527
75580
  }
75528
75581
  function readState(file) {
75529
75582
  try {
75530
75583
  if (!existsSync54(file))
75531
75584
  return null;
75532
- return JSON.parse(readFileSync17(file, "utf8"));
75585
+ return JSON.parse(readFileSync18(file, "utf8"));
75533
75586
  } catch {
75534
75587
  return null;
75535
75588
  }
@@ -75592,8 +75645,8 @@ function clearPending(sessionId, scope, transcriptPath) {
75592
75645
  } catch {}
75593
75646
  }
75594
75647
  function resolveSkillsVenv(_cwd) {
75595
- const base = join111(homedir28(), ".claude", "skills", ".venv");
75596
- const interpreter = platform9() === "win32" ? join111(base, "Scripts", "python.exe") : join111(base, "bin", "python3");
75648
+ const base = join112(homedir29(), ".claude", "skills", ".venv");
75649
+ const interpreter = platform10() === "win32" ? join112(base, "Scripts", "python.exe") : join112(base, "bin", "python3");
75597
75650
  return existsSync54(interpreter) ? interpreter : null;
75598
75651
  }
75599
75652
 
@@ -75632,18 +75685,18 @@ var sessionPromptContext = {
75632
75685
  };
75633
75686
 
75634
75687
  // src/domains/hooks/handlers/session-subagent-init/context-block.ts
75635
- import { join as join113 } from "node:path";
75688
+ import { join as join114 } from "node:path";
75636
75689
 
75637
75690
  // src/domains/hooks/handlers/session-subagent-init/context-sources.ts
75638
- import { execFileSync as execFileSync4 } from "node:child_process";
75691
+ import { execFileSync as execFileSync5 } from "node:child_process";
75639
75692
  import { readdirSync as readdirSync10, statSync as statSync10 } from "node:fs";
75640
- import { isAbsolute as isAbsolute5, join as join112, resolve as resolve25 } from "node:path";
75693
+ import { isAbsolute as isAbsolute5, join as join113, resolve as resolve25 } from "node:path";
75641
75694
  var MAX_DOCS_FILES = 15;
75642
75695
  var MAX_DOCS_SUBDIRS = 5;
75643
75696
  function gitFacts(dir) {
75644
75697
  const run2 = (args) => {
75645
75698
  try {
75646
- const out = execFileSync4("git", args, {
75699
+ const out = execFileSync5("git", args, {
75647
75700
  cwd: dir,
75648
75701
  timeout: 500,
75649
75702
  stdio: ["ignore", "pipe", "ignore"],
@@ -75674,11 +75727,11 @@ function detectPlan(plansAbs) {
75674
75727
  for (const e2 of entries) {
75675
75728
  if (!e2.isDirectory())
75676
75729
  continue;
75677
- const dir = join112(plansAbs, e2.name);
75730
+ const dir = join113(plansAbs, e2.name);
75678
75731
  try {
75679
75732
  if (!readdirSync10(dir).includes("plan.md"))
75680
75733
  continue;
75681
- const mtime = statSync10(join112(dir, "plan.md")).mtimeMs;
75734
+ const mtime = statSync10(join113(dir, "plan.md")).mtimeMs;
75682
75735
  if (!best || mtime > best.mtime)
75683
75736
  best = { name: e2.name, mtime };
75684
75737
  } catch {}
@@ -75701,7 +75754,7 @@ function docsCatalogue(docsAbs) {
75701
75754
  for (const d3 of subdirs.slice(0, MAX_DOCS_SUBDIRS)) {
75702
75755
  let count = 0;
75703
75756
  try {
75704
- count = readdirSync10(join112(docsAbs, d3)).length;
75757
+ count = readdirSync10(join113(docsAbs, d3)).length;
75705
75758
  } catch {}
75706
75759
  lines.push(`- ${d3}/ (${count} entries)`);
75707
75760
  }
@@ -75745,11 +75798,11 @@ function buildSubagentContext(input, ctx) {
75745
75798
  const agentId = strField(input, "agent_id") || "unknown";
75746
75799
  const plansAbs = abs(base, cfg.paths?.plans?.trim() || "plans");
75747
75800
  const docsAbs = abs(base, cfg.paths?.docs?.trim() || "docs");
75748
- const reportsAbs = join113(plansAbs, cfg.plan?.reportsDir?.trim() || "reports");
75801
+ const reportsAbs = join114(plansAbs, cfg.plan?.reportsDir?.trim() || "reports");
75749
75802
  const dateStr = stamp(cfg.plan?.dateFormat?.trim() || "YYMMDD-HHmm", new Date);
75750
75803
  const namingFormat = cfg.plan?.namingFormat?.trim() || "{date}-{slug}";
75751
- const planDir = join113(plansAbs, planDirTemplate(namingFormat, dateStr));
75752
- const reportFile = join113(reportsAbs, `${agentKey}-${dateStr}-{slug}-report.md`);
75804
+ const planDir = join114(plansAbs, planDirTemplate(namingFormat, dateStr));
75805
+ const reportFile = join114(reportsAbs, `${agentKey}-${dateStr}-{slug}-report.md`);
75753
75806
  const activePlan = detectPlan(plansAbs);
75754
75807
  const venv = resolveSkillsVenv(effectiveCwd);
75755
75808
  const respLang = cfg.locale?.responseLanguage?.trim() || null;
@@ -75825,12 +75878,12 @@ var sessionSubagentInit = {
75825
75878
  };
75826
75879
 
75827
75880
  // src/domains/hooks/handlers/session-wip-checkpoint/handler.ts
75828
- import { execFileSync as execFileSync5 } from "node:child_process";
75881
+ import { execFileSync as execFileSync6 } from "node:child_process";
75829
75882
  var CONFIG_KEY5 = "precompact-guard";
75830
75883
  var GIT_STATUS_TIMEOUT_MS2 = 800;
75831
75884
  function countUncommittedEntries(cwd2) {
75832
75885
  try {
75833
- const stdout = execFileSync5("git", ["status", "--porcelain"], {
75886
+ const stdout = execFileSync6("git", ["status", "--porcelain"], {
75834
75887
  cwd: cwd2,
75835
75888
  timeout: GIT_STATUS_TIMEOUT_MS2,
75836
75889
  encoding: "utf8",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunasteriskrnd/takumi",
3
- "version": "1.0.0-dev.55",
3
+ "version": "1.0.0-dev.57",
4
4
  "description": "CLI tool for bootstrapping and managing Takumi projects",
5
5
  "type": "module",
6
6
  "repository": {