oh-my-customcode 1.1.96 → 1.1.98

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/dist/cli/index.js CHANGED
@@ -46,10 +46,78 @@ var __esm = (fn, res, err) => () => {
46
46
  };
47
47
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
48
48
 
49
+ // src/utils/home.ts
50
+ import { homedir, userInfo } from "node:os";
51
+ import { parse, sep } from "node:path";
52
+ function readEnvHome() {
53
+ return process.env.HOME;
54
+ }
55
+ function readOsHome() {
56
+ return homedir();
57
+ }
58
+ function readPasswdHome() {
59
+ return userInfo().homedir;
60
+ }
61
+ function stripTrailingSeparators(path) {
62
+ const rootLength = parse(path).root.length;
63
+ let end = path.length;
64
+ while (end > rootLength && (path[end - 1] === "/" || path[end - 1] === sep)) {
65
+ end--;
66
+ }
67
+ return path.slice(0, end);
68
+ }
69
+ function resolveHomeDir(sources = {}) {
70
+ const candidates = [
71
+ sources.envHome ?? readEnvHome,
72
+ sources.osHome ?? readOsHome,
73
+ sources.passwdHome ?? readPasswdHome
74
+ ];
75
+ for (const read of candidates) {
76
+ try {
77
+ const value = read();
78
+ if (value) {
79
+ return stripTrailingSeparators(value);
80
+ }
81
+ } catch {}
82
+ }
83
+ return "";
84
+ }
85
+ function isPathWithin(path, base) {
86
+ const strippedBase = stripTrailingSeparators(base);
87
+ if (strippedBase === "") {
88
+ return false;
89
+ }
90
+ const strippedPath = stripTrailingSeparators(path);
91
+ if (strippedPath === strippedBase) {
92
+ return true;
93
+ }
94
+ const prefix = strippedBase.endsWith(sep) || strippedBase.endsWith("/") ? strippedBase : strippedBase + sep;
95
+ return path.startsWith(prefix);
96
+ }
97
+ function isUnderHome(path, home) {
98
+ return isPathWithin(path, home ?? resolveHomeDir());
99
+ }
100
+ function shortenHome(path, home) {
101
+ const base = stripTrailingSeparators(home ?? resolveHomeDir());
102
+ if (!isPathWithin(path, base)) {
103
+ return path;
104
+ }
105
+ const strippedPath = stripTrailingSeparators(path);
106
+ if (strippedPath === base) {
107
+ return "~";
108
+ }
109
+ let rest = path.slice(base.length);
110
+ while (rest.startsWith("/") || rest.startsWith(sep)) {
111
+ rest = rest.slice(1);
112
+ }
113
+ return `~${sep}${rest}`;
114
+ }
115
+ var init_home = () => {};
116
+
49
117
  // src/core/registry.ts
50
118
  import { mkdir, readFile, writeFile } from "node:fs/promises";
51
- import { homedir, tmpdir } from "node:os";
52
- import { basename, join, resolve, sep } from "node:path";
119
+ import { tmpdir } from "node:os";
120
+ import { basename, join, resolve, sep as sep2 } from "node:path";
53
121
  function isTempPath(projectPath) {
54
122
  const normalized = resolve(projectPath);
55
123
  const candidates = new Set;
@@ -63,20 +131,23 @@ function isTempPath(projectPath) {
63
131
  candidates.add("/var/tmp");
64
132
  candidates.add("/var/folders");
65
133
  for (const candidate of candidates) {
66
- if (normalized === candidate || normalized.startsWith(candidate + sep)) {
134
+ if (normalized === candidate || normalized.startsWith(candidate + sep2)) {
67
135
  return true;
68
136
  }
69
137
  }
70
138
  return false;
71
139
  }
72
- function registryDir() {
140
+ function registryDir(home) {
73
141
  if (_registryDirOverride !== undefined)
74
142
  return _registryDirOverride;
75
143
  const envOverride = process.env.OMCUSTOM_REGISTRY_DIR;
76
144
  if (envOverride)
77
145
  return envOverride;
78
- const home = process.env.HOME ?? homedir();
79
- return join(home, ".oh-my-customcode");
146
+ const resolved = home ?? resolveHomeDir();
147
+ if (resolved === "") {
148
+ throw new Error("Could not determine the home directory for the project registry");
149
+ }
150
+ return join(resolved, ".oh-my-customcode");
80
151
  }
81
152
  function registryPath() {
82
153
  return join(registryDir(), "projects.json");
@@ -208,6 +279,7 @@ async function migrateFromLockfiles(searchDirs) {
208
279
  }
209
280
  var _registryDirOverride, SCAN_SKIP_DIRS;
210
281
  var init_registry = __esm(() => {
282
+ init_home();
211
283
  SCAN_SKIP_DIRS = new Set(["node_modules", "dist", "build", ".git"]);
212
284
  });
213
285
 
@@ -219,7 +291,7 @@ var init_package = __esm(() => {
219
291
  workspaces: [
220
292
  "packages/*"
221
293
  ],
222
- version: "1.1.96",
294
+ version: "1.1.98",
223
295
  description: "Batteries-included agent harness for Claude Code",
224
296
  type: "module",
225
297
  bin: {
@@ -7215,7 +7287,7 @@ var require_public_api = __commonJS(function(exports) {
7215
7287
  });
7216
7288
 
7217
7289
  // src/utils/fs.ts
7218
- import { dirname as dirname2, isAbsolute, join as join3, relative, resolve as resolve2, sep as sep2 } from "node:path";
7290
+ import { dirname as dirname2, isAbsolute, join as join3, relative, resolve as resolve2, sep as sep3 } from "node:path";
7219
7291
  import { fileURLToPath } from "node:url";
7220
7292
  function validatePreserveFilePath(filePath, projectRoot) {
7221
7293
  if (!filePath || filePath.trim() === "") {
@@ -7311,7 +7383,7 @@ function shouldSkipPath(destPath, destRoot, skipPaths) {
7311
7383
  for (const skipPath of skipPaths) {
7312
7384
  if (skipPath.endsWith("/")) {
7313
7385
  const dirPath = skipPath.slice(0, -1);
7314
- if (relativePath === dirPath || relativePath.startsWith(dirPath + sep2)) {
7386
+ if (relativePath === dirPath || relativePath.startsWith(dirPath + sep3)) {
7315
7387
  return true;
7316
7388
  }
7317
7389
  } else {
@@ -7427,8 +7499,7 @@ var UTF8_BOM = "\uFEFF";
7427
7499
  var init_fs = () => {};
7428
7500
 
7429
7501
  // src/cli/projects.ts
7430
- import { homedir as homedir3 } from "node:os";
7431
- import { basename as basename4, join as join11, sep as sep3 } from "node:path";
7502
+ import { basename as basename4, join as join11, sep as sep4 } from "node:path";
7432
7503
  async function readLockFile(projectDir) {
7433
7504
  const lockFilePath = join11(projectDir, ".omcustom.lock.json");
7434
7505
  try {
@@ -7465,10 +7536,7 @@ async function getTemplateVersion() {
7465
7536
  function matchesSearchPaths(projectPath, searchPaths) {
7466
7537
  if (!searchPaths || searchPaths.length === 0)
7467
7538
  return true;
7468
- return searchPaths.some((searchPath) => projectPath === searchPath || projectPath.startsWith(searchPath + sep3));
7469
- }
7470
- function isUnderHome(projectPath, home) {
7471
- return projectPath.startsWith(home + sep3) || projectPath === home;
7539
+ return searchPaths.some((searchPath) => projectPath === searchPath || projectPath.startsWith(searchPath + sep4));
7472
7540
  }
7473
7541
  function sortProjects(projects) {
7474
7542
  return projects.sort((a, b) => {
@@ -7490,7 +7558,7 @@ async function findProjects(options = {}) {
7490
7558
  return fallbackResults;
7491
7559
  }
7492
7560
  const results = [];
7493
- const home = process.env.HOME ?? homedir3();
7561
+ const home = resolveHomeDir();
7494
7562
  for (const [projectPath, entry] of Object.entries(registry.projects)) {
7495
7563
  if (!matchesSearchPaths(projectPath, options.paths))
7496
7564
  continue;
@@ -7544,7 +7612,7 @@ async function _findProjectsFromLockfiles(options, currentVersion) {
7544
7612
  const fs = await import("node:fs/promises");
7545
7613
  const seen = new Set;
7546
7614
  const results = [];
7547
- const home = process.env.HOME ?? homedir3();
7615
+ const home = resolveHomeDir();
7548
7616
  const searchPaths = options.paths ? [...options.paths] : [];
7549
7617
  if (!options.paths) {
7550
7618
  const cwd = process.cwd();
@@ -7576,8 +7644,9 @@ function formatProjectsTable(projects, currentVersion) {
7576
7644
  console.log(" 레지스트리가 비어 있습니다. `omcustom projects --migrate`를 실행하여 기존 프로젝트를 가져오세요.\n");
7577
7645
  return;
7578
7646
  }
7647
+ const home = resolveHomeDir();
7579
7648
  const nameWidth = Math.max(20, ...projects.map((p) => p.name.length));
7580
- const pathWidth = Math.max(35, ...projects.map((p) => shortenPath(p.path).length));
7649
+ const pathWidth = Math.max(35, ...projects.map((p) => shortenHome(p.path, home).length));
7581
7650
  const versionWidth = 10;
7582
7651
  console.log(`
7583
7652
  oh-my-customcode 적용 프로젝트 목록:
@@ -7590,7 +7659,7 @@ function formatProjectsTable(projects, currentVersion) {
7590
7659
  console.log(` ${"─".repeat(nameWidth)} ${"─".repeat(pathWidth)} ${"─".repeat(versionWidth)} ${"─".repeat(12)}`);
7591
7660
  for (const project of projects) {
7592
7661
  const name = project.name.padEnd(nameWidth);
7593
- const path = shortenPath(project.path).padEnd(pathWidth);
7662
+ const path = shortenHome(project.path, home).padEnd(pathWidth);
7594
7663
  const version = (project.version || "unknown").padEnd(versionWidth);
7595
7664
  const statusIcon = project.status === "latest" ? "✓ latest" : project.status === "outdated" ? "⚠ outdated" : "? unknown";
7596
7665
  console.log(` ${name} ${path} ${version} ${statusIcon}`);
@@ -7604,29 +7673,24 @@ function formatProjectsTable(projects, currentVersion) {
7604
7673
  console.log(` Latest version: v${currentVersion}
7605
7674
  `);
7606
7675
  }
7607
- function shortenPath(path) {
7608
- const home = process.env.HOME ?? homedir3();
7609
- if (path.startsWith(home)) {
7610
- return `~${path.slice(home.length)}`;
7611
- }
7612
- return path;
7613
- }
7614
7676
  function formatProjectsSimple(projects, currentVersion) {
7615
7677
  console.log(`
7616
7678
  oh-my-customcode 적용 프로젝트 (${projects.length}개):`);
7679
+ const home = resolveHomeDir();
7617
7680
  for (const project of projects) {
7618
7681
  const version = project.version ? `v${project.version}` : "unknown";
7619
7682
  const status = project.status === "latest" ? "✓" : project.status === "outdated" ? "⚠" : "?";
7620
- console.log(` ${status} ${project.name} [${version}] — ${shortenPath(project.path)}`);
7683
+ console.log(` ${status} ${project.name} [${version}] — ${shortenHome(project.path, home)}`);
7621
7684
  }
7622
7685
  console.log(`
7623
7686
  현재 설치 버전: v${currentVersion}`);
7624
7687
  }
7688
+ function buildMigrationSearchDirs(home, extraPaths = []) {
7689
+ return [...home ? DEFAULT_SEARCH_DIRS.map((d) => join11(home, d)) : [], ...extraPaths];
7690
+ }
7625
7691
  async function runMigration(options) {
7626
7692
  await Promise.resolve().then(() => init_registry());
7627
- const DEFAULT_SEARCH_DIRS = ["workspace", "projects", "dev", "src", "code", "repos", "work"];
7628
- const home = process.env.HOME ?? homedir3();
7629
- const searchDirs = [...DEFAULT_SEARCH_DIRS.map((d) => join11(home, d)), ...options.paths ?? []];
7693
+ const searchDirs = buildMigrationSearchDirs(resolveHomeDir(), options.paths ?? []);
7630
7694
  const cwd = process.cwd();
7631
7695
  if (!searchDirs.includes(cwd))
7632
7696
  searchDirs.push(cwd);
@@ -7675,12 +7739,14 @@ async function projectsCommand(options = {}) {
7675
7739
  return { success: false, projects: [], currentVersion, errors: [errorMessage] };
7676
7740
  }
7677
7741
  }
7678
- var SCAN_SKIP_DIRS2;
7742
+ var SCAN_SKIP_DIRS2, DEFAULT_SEARCH_DIRS;
7679
7743
  var init_projects = __esm(() => {
7680
7744
  init_package();
7681
7745
  init_registry();
7682
7746
  init_fs();
7747
+ init_home();
7683
7748
  SCAN_SKIP_DIRS2 = new Set(["node_modules", "dist", "build", ".git"]);
7749
+ DEFAULT_SEARCH_DIRS = ["workspace", "projects", "dev", "src", "code", "repos", "work"];
7684
7750
  });
7685
7751
 
7686
7752
  // node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
package/dist/index.js CHANGED
@@ -204,10 +204,48 @@ function matchesPattern(filename, pattern) {
204
204
  var UTF8_BOM = "\uFEFF";
205
205
  var init_fs = () => {};
206
206
 
207
+ // src/utils/home.ts
208
+ import { homedir, userInfo } from "node:os";
209
+ import { parse, sep as sep2 } from "node:path";
210
+ function readEnvHome() {
211
+ return process.env.HOME;
212
+ }
213
+ function readOsHome() {
214
+ return homedir();
215
+ }
216
+ function readPasswdHome() {
217
+ return userInfo().homedir;
218
+ }
219
+ function stripTrailingSeparators(path) {
220
+ const rootLength = parse(path).root.length;
221
+ let end = path.length;
222
+ while (end > rootLength && (path[end - 1] === "/" || path[end - 1] === sep2)) {
223
+ end--;
224
+ }
225
+ return path.slice(0, end);
226
+ }
227
+ function resolveHomeDir(sources = {}) {
228
+ const candidates = [
229
+ sources.envHome ?? readEnvHome,
230
+ sources.osHome ?? readOsHome,
231
+ sources.passwdHome ?? readPasswdHome
232
+ ];
233
+ for (const read of candidates) {
234
+ try {
235
+ const value = read();
236
+ if (value) {
237
+ return stripTrailingSeparators(value);
238
+ }
239
+ } catch {}
240
+ }
241
+ return "";
242
+ }
243
+ var init_home = () => {};
244
+
207
245
  // src/core/registry.ts
208
246
  import { mkdir, readFile, writeFile } from "node:fs/promises";
209
- import { homedir, tmpdir } from "node:os";
210
- import { basename as basename3, join as join6, resolve as resolve2, sep as sep2 } from "node:path";
247
+ import { tmpdir } from "node:os";
248
+ import { basename as basename3, join as join6, resolve as resolve2, sep as sep3 } from "node:path";
211
249
  function isTempPath(projectPath) {
212
250
  const normalized = resolve2(projectPath);
213
251
  const candidates = new Set;
@@ -221,20 +259,23 @@ function isTempPath(projectPath) {
221
259
  candidates.add("/var/tmp");
222
260
  candidates.add("/var/folders");
223
261
  for (const candidate of candidates) {
224
- if (normalized === candidate || normalized.startsWith(candidate + sep2)) {
262
+ if (normalized === candidate || normalized.startsWith(candidate + sep3)) {
225
263
  return true;
226
264
  }
227
265
  }
228
266
  return false;
229
267
  }
230
- function registryDir() {
268
+ function registryDir(home) {
231
269
  if (_registryDirOverride !== undefined)
232
270
  return _registryDirOverride;
233
271
  const envOverride = process.env.OMCUSTOM_REGISTRY_DIR;
234
272
  if (envOverride)
235
273
  return envOverride;
236
- const home = process.env.HOME ?? homedir();
237
- return join6(home, ".oh-my-customcode");
274
+ const resolved = home ?? resolveHomeDir();
275
+ if (resolved === "") {
276
+ throw new Error("Could not determine the home directory for the project registry");
277
+ }
278
+ return join6(resolved, ".oh-my-customcode");
238
279
  }
239
280
  function registryPath() {
240
281
  return join6(registryDir(), "projects.json");
@@ -277,6 +318,7 @@ async function registerProject(projectPath, version) {
277
318
  }
278
319
  var _registryDirOverride, SCAN_SKIP_DIRS;
279
320
  var init_registry = __esm(() => {
321
+ init_home();
280
322
  SCAN_SKIP_DIRS = new Set(["node_modules", "dist", "build", ".git"]);
281
323
  });
282
324
 
@@ -2766,7 +2808,7 @@ var package_default = {
2766
2808
  workspaces: [
2767
2809
  "packages/*"
2768
2810
  ],
2769
- version: "1.1.96",
2811
+ version: "1.1.98",
2770
2812
  description: "Batteries-included agent harness for Claude Code",
2771
2813
  type: "module",
2772
2814
  bin: {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "workspaces": [
4
4
  "packages/*"
5
5
  ],
6
- "version": "1.1.96",
6
+ "version": "1.1.98",
7
7
  "description": "Batteries-included agent harness for Claude Code",
8
8
  "type": "module",
9
9
  "bin": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.96",
2
+ "version": "1.1.98",
3
3
  "lastUpdated": "2026-09-03",
4
4
  "omcustomMinClaudeCode": "2.1.121",
5
5
  "omcustomMinClaudeCodeReason": "Sensitive-path direct Write/Edit on .claude/** under bypassPermissions (R010 deprecation, #1101)",