codeam-cli 2.2.1 → 2.2.2
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/index.js +66 -27
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -179,7 +179,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
|
|
|
179
179
|
// package.json
|
|
180
180
|
var package_default = {
|
|
181
181
|
name: "codeam-cli",
|
|
182
|
-
version: "2.2.
|
|
182
|
+
version: "2.2.2",
|
|
183
183
|
description: "Remote control Claude Code (and other AI coding agents) from your mobile phone. Pair your device, send prompts, stream responses in real-time, and approve commands \u2014 from anywhere.",
|
|
184
184
|
main: "dist/index.js",
|
|
185
185
|
bin: {
|
|
@@ -2174,6 +2174,8 @@ function parsePayload(schema, raw) {
|
|
|
2174
2174
|
var fs5 = __toESM(require("fs/promises"));
|
|
2175
2175
|
var path5 = __toESM(require("path"));
|
|
2176
2176
|
var MAX_FILE_BYTES = 5 * 1024 * 1024;
|
|
2177
|
+
var MAX_WALK_DEPTH = 6;
|
|
2178
|
+
var MAX_VISITED_DIRS = 5e3;
|
|
2177
2179
|
var SUBDIR_IGNORE = /* @__PURE__ */ new Set([
|
|
2178
2180
|
"node_modules",
|
|
2179
2181
|
".git",
|
|
@@ -2188,43 +2190,80 @@ var SUBDIR_IGNORE = /* @__PURE__ */ new Set([
|
|
|
2188
2190
|
".parcel-cache",
|
|
2189
2191
|
".idea",
|
|
2190
2192
|
".vscode",
|
|
2193
|
+
".vscode-test",
|
|
2191
2194
|
"ios",
|
|
2192
|
-
"android"
|
|
2195
|
+
"android",
|
|
2193
2196
|
// expo-managed native dirs are huge and rarely interesting
|
|
2197
|
+
".gradle",
|
|
2198
|
+
".cxx",
|
|
2199
|
+
".intellijPlatform",
|
|
2200
|
+
".kotlin",
|
|
2201
|
+
"tmp",
|
|
2202
|
+
"target",
|
|
2203
|
+
"venv",
|
|
2204
|
+
".venv",
|
|
2205
|
+
".mypy_cache",
|
|
2206
|
+
".pytest_cache",
|
|
2207
|
+
"__pycache__"
|
|
2194
2208
|
]);
|
|
2195
|
-
|
|
2209
|
+
function isUnder(parent, candidate) {
|
|
2210
|
+
const rel = path5.relative(parent, candidate);
|
|
2211
|
+
return rel === "" || !rel.startsWith("..") && !path5.isAbsolute(rel);
|
|
2212
|
+
}
|
|
2213
|
+
async function isExistingFile(absPath) {
|
|
2196
2214
|
try {
|
|
2197
|
-
const
|
|
2198
|
-
return
|
|
2215
|
+
const stat2 = await fs5.stat(absPath);
|
|
2216
|
+
return stat2.isFile();
|
|
2199
2217
|
} catch {
|
|
2200
|
-
return
|
|
2218
|
+
return false;
|
|
2201
2219
|
}
|
|
2202
2220
|
}
|
|
2203
|
-
function
|
|
2204
|
-
|
|
2205
|
-
|
|
2221
|
+
async function walkForSuffix(dir, needleVariants, depth, ctx) {
|
|
2222
|
+
if (depth > MAX_WALK_DEPTH) return;
|
|
2223
|
+
if (ctx.visited > MAX_VISITED_DIRS) return;
|
|
2224
|
+
if (ctx.matches.length >= ctx.cap) return;
|
|
2225
|
+
ctx.visited++;
|
|
2226
|
+
let entries = [];
|
|
2227
|
+
try {
|
|
2228
|
+
entries = await fs5.readdir(dir, { withFileTypes: true });
|
|
2229
|
+
} catch {
|
|
2230
|
+
return;
|
|
2231
|
+
}
|
|
2232
|
+
for (const e of entries) {
|
|
2233
|
+
if (!e.isFile()) continue;
|
|
2234
|
+
const full = path5.join(dir, e.name);
|
|
2235
|
+
if (needleVariants.some((needle) => full.endsWith(needle))) {
|
|
2236
|
+
ctx.matches.push(full);
|
|
2237
|
+
if (ctx.matches.length >= ctx.cap) return;
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
for (const e of entries) {
|
|
2241
|
+
if (!e.isDirectory()) continue;
|
|
2242
|
+
if (SUBDIR_IGNORE.has(e.name)) continue;
|
|
2243
|
+
if (e.name.startsWith(".") && SUBDIR_IGNORE.has(e.name)) continue;
|
|
2244
|
+
await walkForSuffix(path5.join(dir, e.name), needleVariants, depth + 1, ctx);
|
|
2245
|
+
if (ctx.matches.length >= ctx.cap) return;
|
|
2246
|
+
}
|
|
2206
2247
|
}
|
|
2207
2248
|
async function findFile(rawPath) {
|
|
2208
2249
|
const cwd = process.cwd();
|
|
2209
|
-
const candidates = [];
|
|
2210
2250
|
if (path5.isAbsolute(rawPath)) {
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
return null;
|
|
2251
|
+
const abs = path5.normalize(rawPath);
|
|
2252
|
+
if (isUnder(cwd, abs) && await isExistingFile(abs)) return abs;
|
|
2253
|
+
}
|
|
2254
|
+
const direct = path5.resolve(cwd, rawPath);
|
|
2255
|
+
if (isUnder(cwd, direct) && await isExistingFile(direct)) return direct;
|
|
2256
|
+
const normalized = path5.normalize(rawPath).replace(/^[./\\]+/, "");
|
|
2257
|
+
const needles = [
|
|
2258
|
+
`${path5.sep}${normalized}`,
|
|
2259
|
+
`/${normalized}`
|
|
2260
|
+
].filter((v, i, a) => a.indexOf(v) === i);
|
|
2261
|
+
const ctx = { visited: 0, matches: [], cap: 16 };
|
|
2262
|
+
await walkForSuffix(cwd, needles, 0, ctx);
|
|
2263
|
+
const candidates = ctx.matches.filter((c2) => isUnder(cwd, c2));
|
|
2264
|
+
if (candidates.length === 0) return null;
|
|
2265
|
+
candidates.sort((a, b) => a.length - b.length);
|
|
2266
|
+
return candidates[0];
|
|
2228
2267
|
}
|
|
2229
2268
|
async function findWriteTarget(rawPath) {
|
|
2230
2269
|
const found = await findFile(rawPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeam-cli",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "Remote control Claude Code (and other AI coding agents) from your mobile phone. Pair your device, send prompts, stream responses in real-time, and approve commands — from anywhere.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|