oh-my-customcode 1.1.98 → 1.1.100
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 +64 -20
- package/dist/index.js +8 -2
- package/package.json +1 -1
- package/templates/manifest.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -47,8 +47,9 @@ var __esm = (fn, res, err) => () => {
|
|
|
47
47
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
48
48
|
|
|
49
49
|
// src/utils/home.ts
|
|
50
|
+
import { realpathSync } from "node:fs";
|
|
50
51
|
import { homedir, userInfo } from "node:os";
|
|
51
|
-
import { parse, sep } from "node:path";
|
|
52
|
+
import { isAbsolute, parse, sep } from "node:path";
|
|
52
53
|
function readEnvHome() {
|
|
53
54
|
return process.env.HOME;
|
|
54
55
|
}
|
|
@@ -94,16 +95,28 @@ function isPathWithin(path, base) {
|
|
|
94
95
|
const prefix = strippedBase.endsWith(sep) || strippedBase.endsWith("/") ? strippedBase : strippedBase + sep;
|
|
95
96
|
return path.startsWith(prefix);
|
|
96
97
|
}
|
|
98
|
+
function realpathOrSelf(p) {
|
|
99
|
+
if (p === "" || !isAbsolute(p)) {
|
|
100
|
+
return p;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
return realpathSync(p);
|
|
104
|
+
} catch {
|
|
105
|
+
return p;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
97
108
|
function isUnderHome(path, home) {
|
|
98
|
-
|
|
109
|
+
const base = home ?? resolveHomeDir();
|
|
110
|
+
const paths = [path, realpathOrSelf(path)];
|
|
111
|
+
const bases = [base, realpathOrSelf(base)];
|
|
112
|
+
return paths.some((p) => bases.some((b) => isPathWithin(p, b)));
|
|
99
113
|
}
|
|
100
|
-
function
|
|
101
|
-
const base = stripTrailingSeparators(
|
|
114
|
+
function tildeRelative(path, rawBase) {
|
|
115
|
+
const base = stripTrailingSeparators(rawBase);
|
|
102
116
|
if (!isPathWithin(path, base)) {
|
|
103
|
-
return
|
|
117
|
+
return;
|
|
104
118
|
}
|
|
105
|
-
|
|
106
|
-
if (strippedPath === base) {
|
|
119
|
+
if (stripTrailingSeparators(path) === base) {
|
|
107
120
|
return "~";
|
|
108
121
|
}
|
|
109
122
|
let rest = path.slice(base.length);
|
|
@@ -112,9 +125,28 @@ function shortenHome(path, home) {
|
|
|
112
125
|
}
|
|
113
126
|
return `~${sep}${rest}`;
|
|
114
127
|
}
|
|
128
|
+
function shortenHome(path, home) {
|
|
129
|
+
const base = home ?? resolveHomeDir();
|
|
130
|
+
const realPath = realpathOrSelf(path);
|
|
131
|
+
const realBase = realpathOrSelf(base);
|
|
132
|
+
const candidates = [
|
|
133
|
+
[path, base],
|
|
134
|
+
[path, realBase],
|
|
135
|
+
[realPath, base],
|
|
136
|
+
[realPath, realBase]
|
|
137
|
+
];
|
|
138
|
+
for (const [p, b] of candidates) {
|
|
139
|
+
const shortened = tildeRelative(p, b);
|
|
140
|
+
if (shortened !== undefined) {
|
|
141
|
+
return shortened;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return path;
|
|
145
|
+
}
|
|
115
146
|
var init_home = () => {};
|
|
116
147
|
|
|
117
148
|
// src/core/registry.ts
|
|
149
|
+
import { realpathSync as realpathSync2 } from "node:fs";
|
|
118
150
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
119
151
|
import { tmpdir } from "node:os";
|
|
120
152
|
import { basename, join, resolve, sep as sep2 } from "node:path";
|
|
@@ -130,6 +162,11 @@ function isTempPath(projectPath) {
|
|
|
130
162
|
candidates.add("/tmp");
|
|
131
163
|
candidates.add("/var/tmp");
|
|
132
164
|
candidates.add("/var/folders");
|
|
165
|
+
for (const candidate of [...candidates]) {
|
|
166
|
+
try {
|
|
167
|
+
candidates.add(realpathSync2(candidate));
|
|
168
|
+
} catch {}
|
|
169
|
+
}
|
|
133
170
|
for (const candidate of candidates) {
|
|
134
171
|
if (normalized === candidate || normalized.startsWith(candidate + sep2)) {
|
|
135
172
|
return true;
|
|
@@ -291,7 +328,7 @@ var init_package = __esm(() => {
|
|
|
291
328
|
workspaces: [
|
|
292
329
|
"packages/*"
|
|
293
330
|
],
|
|
294
|
-
version: "1.1.
|
|
331
|
+
version: "1.1.100",
|
|
295
332
|
description: "Batteries-included agent harness for Claude Code",
|
|
296
333
|
type: "module",
|
|
297
334
|
bin: {
|
|
@@ -7287,7 +7324,7 @@ var require_public_api = __commonJS(function(exports) {
|
|
|
7287
7324
|
});
|
|
7288
7325
|
|
|
7289
7326
|
// src/utils/fs.ts
|
|
7290
|
-
import { dirname as dirname2, isAbsolute, join as join3, relative, resolve as resolve2, sep as sep3 } from "node:path";
|
|
7327
|
+
import { dirname as dirname2, isAbsolute as isAbsolute2, join as join3, relative, resolve as resolve2, sep as sep3 } from "node:path";
|
|
7291
7328
|
import { fileURLToPath } from "node:url";
|
|
7292
7329
|
function validatePreserveFilePath(filePath, projectRoot) {
|
|
7293
7330
|
if (!filePath || filePath.trim() === "") {
|
|
@@ -7296,7 +7333,7 @@ function validatePreserveFilePath(filePath, projectRoot) {
|
|
|
7296
7333
|
reason: "Path cannot be empty"
|
|
7297
7334
|
};
|
|
7298
7335
|
}
|
|
7299
|
-
if (
|
|
7336
|
+
if (isAbsolute2(filePath)) {
|
|
7300
7337
|
return {
|
|
7301
7338
|
valid: false,
|
|
7302
7339
|
reason: "Absolute paths are not allowed"
|
|
@@ -7304,7 +7341,7 @@ function validatePreserveFilePath(filePath, projectRoot) {
|
|
|
7304
7341
|
}
|
|
7305
7342
|
const resolvedPath = resolve2(projectRoot, filePath);
|
|
7306
7343
|
const relativePath = relative(projectRoot, resolvedPath);
|
|
7307
|
-
if (relativePath.startsWith("..") ||
|
|
7344
|
+
if (relativePath.startsWith("..") || isAbsolute2(relativePath)) {
|
|
7308
7345
|
return {
|
|
7309
7346
|
valid: false,
|
|
7310
7347
|
reason: "Path cannot traverse outside project root"
|
|
@@ -7499,7 +7536,7 @@ var UTF8_BOM = "\uFEFF";
|
|
|
7499
7536
|
var init_fs = () => {};
|
|
7500
7537
|
|
|
7501
7538
|
// src/cli/projects.ts
|
|
7502
|
-
import { basename as basename4, join as join11,
|
|
7539
|
+
import { basename as basename4, join as join11, resolve as resolve3 } from "node:path";
|
|
7503
7540
|
async function readLockFile(projectDir) {
|
|
7504
7541
|
const lockFilePath = join11(projectDir, ".omcustom.lock.json");
|
|
7505
7542
|
try {
|
|
@@ -7533,10 +7570,15 @@ async function getTemplateVersion() {
|
|
|
7533
7570
|
}
|
|
7534
7571
|
return package_default.version;
|
|
7535
7572
|
}
|
|
7573
|
+
function normalizeSearchPaths(paths) {
|
|
7574
|
+
if (!paths || paths.length === 0)
|
|
7575
|
+
return;
|
|
7576
|
+
return paths.map((p) => resolve3(p));
|
|
7577
|
+
}
|
|
7536
7578
|
function matchesSearchPaths(projectPath, searchPaths) {
|
|
7537
7579
|
if (!searchPaths || searchPaths.length === 0)
|
|
7538
7580
|
return true;
|
|
7539
|
-
return searchPaths.some((searchPath) => projectPath
|
|
7581
|
+
return searchPaths.some((searchPath) => isPathWithin(projectPath, searchPath));
|
|
7540
7582
|
}
|
|
7541
7583
|
function sortProjects(projects) {
|
|
7542
7584
|
return projects.sort((a, b) => {
|
|
@@ -7552,15 +7594,16 @@ async function findProjects(options = {}) {
|
|
|
7552
7594
|
const registry = await readRegistry();
|
|
7553
7595
|
if (Object.keys(registry.projects).length === 0) {
|
|
7554
7596
|
const fallbackResults = await _findProjectsFromLockfiles(options, currentVersion);
|
|
7555
|
-
if (fallbackResults.length === 0 && !options.paths) {
|
|
7597
|
+
if (fallbackResults.length === 0 && !normalizeSearchPaths(options.paths)) {
|
|
7556
7598
|
process.stderr.write(" No projects in registry. Run `omcustom projects --migrate` to import existing projects.\n");
|
|
7557
7599
|
}
|
|
7558
7600
|
return fallbackResults;
|
|
7559
7601
|
}
|
|
7560
7602
|
const results = [];
|
|
7561
7603
|
const home = resolveHomeDir();
|
|
7604
|
+
const searchPaths = normalizeSearchPaths(options.paths);
|
|
7562
7605
|
for (const [projectPath, entry] of Object.entries(registry.projects)) {
|
|
7563
|
-
if (!matchesSearchPaths(projectPath,
|
|
7606
|
+
if (!matchesSearchPaths(projectPath, searchPaths))
|
|
7564
7607
|
continue;
|
|
7565
7608
|
if (!isUnderHome(projectPath, home))
|
|
7566
7609
|
continue;
|
|
@@ -7613,8 +7656,9 @@ async function _findProjectsFromLockfiles(options, currentVersion) {
|
|
|
7613
7656
|
const seen = new Set;
|
|
7614
7657
|
const results = [];
|
|
7615
7658
|
const home = resolveHomeDir();
|
|
7616
|
-
const
|
|
7617
|
-
|
|
7659
|
+
const providedPaths = normalizeSearchPaths(options.paths);
|
|
7660
|
+
const searchPaths = providedPaths ? [...providedPaths] : [];
|
|
7661
|
+
if (!providedPaths) {
|
|
7618
7662
|
const cwd = process.cwd();
|
|
7619
7663
|
if (!searchPaths.includes(cwd))
|
|
7620
7664
|
searchPaths.push(cwd);
|
|
@@ -20948,7 +20992,7 @@ function runForeground(projectRoot, port, buildDirOpts) {
|
|
|
20948
20992
|
}
|
|
20949
20993
|
|
|
20950
20994
|
// src/cli/sync.ts
|
|
20951
|
-
import { resolve as
|
|
20995
|
+
import { resolve as resolve4 } from "node:path";
|
|
20952
20996
|
|
|
20953
20997
|
// src/core/sync.ts
|
|
20954
20998
|
init_fs();
|
|
@@ -21068,7 +21112,7 @@ async function exportSnapshot(targetDir, outputPath) {
|
|
|
21068
21112
|
|
|
21069
21113
|
// src/cli/sync.ts
|
|
21070
21114
|
async function runExport(targetDir, outputPath) {
|
|
21071
|
-
const result = await exportSnapshot(targetDir,
|
|
21115
|
+
const result = await exportSnapshot(targetDir, resolve4(outputPath));
|
|
21072
21116
|
if (!result.success) {
|
|
21073
21117
|
console.error(`
|
|
21074
21118
|
Export failed — no .claude/ directory found in current project.`);
|
|
@@ -21125,7 +21169,7 @@ Summary: ${result.unchanged} unchanged, ${result.modified.length} modified, ${re
|
|
|
21125
21169
|
}
|
|
21126
21170
|
function syncCommand(program) {
|
|
21127
21171
|
program.command("sync").description(i18n.t("cli.sync.description")).option("--check", "Compare current state against lockfile (default behavior)").option("--reference <path>", "Compare against an external snapshot instead of the lockfile").option("--export <path>", "Export current .claude/ state as a reusable snapshot").action(async (options) => {
|
|
21128
|
-
const targetDir =
|
|
21172
|
+
const targetDir = resolve4(".");
|
|
21129
21173
|
if (options.export) {
|
|
21130
21174
|
await runExport(targetDir, options.export);
|
|
21131
21175
|
return;
|
package/dist/index.js
CHANGED
|
@@ -206,7 +206,7 @@ var init_fs = () => {};
|
|
|
206
206
|
|
|
207
207
|
// src/utils/home.ts
|
|
208
208
|
import { homedir, userInfo } from "node:os";
|
|
209
|
-
import { parse, sep as sep2 } from "node:path";
|
|
209
|
+
import { isAbsolute as isAbsolute2, parse, sep as sep2 } from "node:path";
|
|
210
210
|
function readEnvHome() {
|
|
211
211
|
return process.env.HOME;
|
|
212
212
|
}
|
|
@@ -243,6 +243,7 @@ function resolveHomeDir(sources = {}) {
|
|
|
243
243
|
var init_home = () => {};
|
|
244
244
|
|
|
245
245
|
// src/core/registry.ts
|
|
246
|
+
import { realpathSync } from "node:fs";
|
|
246
247
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
247
248
|
import { tmpdir } from "node:os";
|
|
248
249
|
import { basename as basename3, join as join6, resolve as resolve2, sep as sep3 } from "node:path";
|
|
@@ -258,6 +259,11 @@ function isTempPath(projectPath) {
|
|
|
258
259
|
candidates.add("/tmp");
|
|
259
260
|
candidates.add("/var/tmp");
|
|
260
261
|
candidates.add("/var/folders");
|
|
262
|
+
for (const candidate of [...candidates]) {
|
|
263
|
+
try {
|
|
264
|
+
candidates.add(realpathSync(candidate));
|
|
265
|
+
} catch {}
|
|
266
|
+
}
|
|
261
267
|
for (const candidate of candidates) {
|
|
262
268
|
if (normalized === candidate || normalized.startsWith(candidate + sep3)) {
|
|
263
269
|
return true;
|
|
@@ -2808,7 +2814,7 @@ var package_default = {
|
|
|
2808
2814
|
workspaces: [
|
|
2809
2815
|
"packages/*"
|
|
2810
2816
|
],
|
|
2811
|
-
version: "1.1.
|
|
2817
|
+
version: "1.1.100",
|
|
2812
2818
|
description: "Batteries-included agent harness for Claude Code",
|
|
2813
2819
|
type: "module",
|
|
2814
2820
|
bin: {
|
package/package.json
CHANGED
package/templates/manifest.json
CHANGED