run402 4.157.0 → 4.158.0
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/lib/app-repos.mjs +28 -4
- package/package.json +1 -1
- package/vault-surface.json +1 -1
package/lib/app-repos.mjs
CHANGED
|
@@ -34,7 +34,7 @@ Usage:
|
|
|
34
34
|
run402 app-repos log [<name>] [--path <path>] [--cursor <cursor>] [--limit <n>] [--project <project_id>]
|
|
35
35
|
run402 app-repos cat [<name>] <path> [--at <commit>] [--project <project_id>]
|
|
36
36
|
run402 app-repos ls [<name>] [<dir>] [--at <commit>] [--project <project_id>]
|
|
37
|
-
run402 app-repos clone [<name>] [<dir>] [--project <project_id>]
|
|
37
|
+
run402 app-repos clone [<name>] [<dir>] [--depth <n>] [--project <project_id>]
|
|
38
38
|
run402 app-repos tokens create <name> --access read|write [--ttl <seconds>] [--project <project_id>]
|
|
39
39
|
run402 app-repos tokens revoke <token_id> --repo <name> [--project <project_id>]
|
|
40
40
|
|
|
@@ -51,6 +51,8 @@ Options:
|
|
|
51
51
|
--cursor <cursor> log: next_cursor from the previous page
|
|
52
52
|
--limit <n> log: 1-100 commits (default 50)
|
|
53
53
|
--at <commit> cat / ls: read at this commit instead of the head
|
|
54
|
+
--depth <n> clone: only the latest <n> commits (1 is the files as
|
|
55
|
+
they are now); without it, the whole history
|
|
54
56
|
--access read|write tokens create: what the token may do (required)
|
|
55
57
|
--ttl <seconds> tokens create: 60-86400, default 3600
|
|
56
58
|
|
|
@@ -64,7 +66,8 @@ Prints:
|
|
|
64
66
|
UTF-8, or base64 in place of text for other bytes; a missing file is
|
|
65
67
|
APP_REPO_PATH_NOT_FOUND (exit 1)
|
|
66
68
|
ls { commit, path, entries: [{ name, path, type: "file" | "dir", size, oid }] }
|
|
67
|
-
clone { project_id, repo_name, dir, clone_url, credential_helper }
|
|
69
|
+
clone { project_id, repo_name, dir, clone_url, credential_helper }, and
|
|
70
|
+
depth when --depth was given
|
|
68
71
|
tokens create { token_id, token, repo_name, access, clone_url, expires_at,
|
|
69
72
|
expires_in, next_actions }; token is shown only here
|
|
70
73
|
tokens revoke { revoked, token_id, revoked_at }
|
|
@@ -80,7 +83,9 @@ which works for any member of the project's organization with the role for it:
|
|
|
80
83
|
run402 --wallet <name> app-repos clone keeps that wallet for git pull and git
|
|
81
84
|
push. Nothing is written into the remote URL or .git/config, and the helper is
|
|
82
85
|
kept in the clone so git pull and git push keep working. main is the only branch and only fast-forward pushes land: undo a
|
|
83
|
-
commit with a revert.
|
|
86
|
+
commit with a revert. A clone with --depth holds the latest commits only and
|
|
87
|
+
works like any other: commit and git push, git pull for what landed since, and
|
|
88
|
+
git fetch --unshallow when you want the history after all. Each file is at most 4 MiB: put media in assets and
|
|
84
89
|
commit a reference to it.
|
|
85
90
|
|
|
86
91
|
Auth: the project's service_key, your wallet, a sign-in session, or a grant
|
|
@@ -94,6 +99,7 @@ Examples:
|
|
|
94
99
|
run402 app-repos cat site.json
|
|
95
100
|
run402 app-repos ls default people
|
|
96
101
|
run402 app-repos clone default ./content
|
|
102
|
+
run402 app-repos clone default ./content --depth 1
|
|
97
103
|
run402 app-repos tokens create user-42 --access read --ttl 900
|
|
98
104
|
`;
|
|
99
105
|
|
|
@@ -300,9 +306,25 @@ function shellQuote(value) {
|
|
|
300
306
|
return /^[A-Za-z0-9_./:@%+=-]+$/.test(value) ? value : `'${String(value).replace(/'/g, `'\\''`)}'`;
|
|
301
307
|
}
|
|
302
308
|
|
|
309
|
+
/** `--depth <n>`: how many commits back to clone; null when not given. Git's own limit is a 31-bit count. */
|
|
310
|
+
function cloneDepth(raw) {
|
|
311
|
+
if (raw === undefined || raw === null) return null;
|
|
312
|
+
const text = String(raw);
|
|
313
|
+
if (!/^[1-9][0-9]{0,9}$/.test(text) || Number(text) > 2147483646) {
|
|
314
|
+
fail({
|
|
315
|
+
code: "BAD_USAGE",
|
|
316
|
+
message: `app-repos clone: --depth takes a positive whole number, not ${JSON.stringify(text)}`,
|
|
317
|
+
hint: "--depth 1 clones the files as they are now; leave it out for the whole history.",
|
|
318
|
+
details: { flag: "--depth", value: text },
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
return Number(text);
|
|
322
|
+
}
|
|
323
|
+
|
|
303
324
|
async function clone(args) {
|
|
304
|
-
const { a, pos } = parse(args, ["--project", "--repo", "--dir"]);
|
|
325
|
+
const { a, pos } = parse(args, ["--project", "--repo", "--dir", "--depth"]);
|
|
305
326
|
if (pos.length > 2) tooMany("clone", pos[2]);
|
|
327
|
+
const depth = cloneDepth(flagValue(a, "--depth"));
|
|
306
328
|
const repoName = repoNameFrom(a, pos[0], "clone");
|
|
307
329
|
const dirFlag = flagValue(a, "--dir");
|
|
308
330
|
if (dirFlag && pos[1] && dirFlag !== pos[1]) {
|
|
@@ -353,6 +375,7 @@ async function clone(args) {
|
|
|
353
375
|
const scope = `credential.${url}`;
|
|
354
376
|
const result = spawnSync("git", [
|
|
355
377
|
"clone",
|
|
378
|
+
...(depth === null ? [] : ["--depth", String(depth)]),
|
|
356
379
|
"--config", `${scope}.helper=`,
|
|
357
380
|
"--config", `${scope}.helper=${helper}`,
|
|
358
381
|
"--config", `${scope}.useHttpPath=true`,
|
|
@@ -368,6 +391,7 @@ async function clone(args) {
|
|
|
368
391
|
});
|
|
369
392
|
}
|
|
370
393
|
const out = { project_id: projectId, repo_name: repoName, dir, clone_url: url, credential_helper: "run402 app-repos credential" };
|
|
394
|
+
if (depth !== null) out.depth = depth;
|
|
371
395
|
if (!byName) {
|
|
372
396
|
out.next_actions = [{
|
|
373
397
|
type: "install_cli",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "run402",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.158.0",
|
|
4
4
|
"description": "CLI for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/vault-surface.json
CHANGED