@intra-mart/accel 0.3.1 → 0.4.0-dev.202607170346
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/README.md +72 -12
- package/assets/githooks/.githooks/.gitattributes +2 -0
- package/assets/githooks/.githooks/pre-commit/_meta.json +24 -0
- package/assets/githooks/.githooks/pre-commit/pre-commit_en +268 -0
- package/assets/githooks/.githooks/pre-commit/pre-commit_ja +255 -0
- package/assets/githooks/.githooks/pre-commit/pre-commit_zh_CN +255 -0
- package/dist/asset/asset-tree.d.ts +5 -0
- package/dist/asset/asset-tree.js +7 -0
- package/dist/asset/deployer.d.ts +2 -1
- package/dist/asset/deployer.js +28 -59
- package/dist/asset/file-provider.js +19 -18
- package/dist/asset/git-provider.d.ts +14 -0
- package/dist/asset/git-provider.js +163 -0
- package/dist/asset/installer.d.ts +6 -0
- package/dist/asset/installer.js +31 -0
- package/dist/asset/renderer.d.ts +2 -0
- package/dist/asset/renderer.js +22 -0
- package/dist/asset/types.d.ts +1 -1
- package/dist/asset/updater.d.ts +52 -0
- package/dist/asset/updater.js +297 -0
- package/dist/asset/walker.d.ts +4 -2
- package/dist/asset/walker.js +74 -45
- package/dist/commands/asset-provider.d.ts +7 -0
- package/dist/commands/asset-provider.js +9 -0
- package/dist/commands/attach.d.ts +0 -4
- package/dist/commands/attach.js +11 -20
- package/dist/commands/deploy.d.ts +11 -6
- package/dist/commands/deploy.js +77 -23
- package/dist/commands/init.d.ts +0 -4
- package/dist/commands/init.js +11 -20
- package/dist/commands/update.d.ts +86 -0
- package/dist/commands/update.js +448 -0
- package/dist/core/constants.d.ts +3 -3
- package/dist/core/constants.js +4 -2
- package/dist/core/types.d.ts +13 -1
- package/dist/deploy/api-client.d.ts +6 -2
- package/dist/deploy/api-client.js +8 -4
- package/dist/deploy/deploy-files.d.ts +20 -0
- package/dist/deploy/deploy-files.js +37 -0
- package/dist/git/errors.d.ts +6 -0
- package/dist/git/errors.js +9 -0
- package/dist/git/http.d.ts +3 -0
- package/dist/git/http.js +58 -0
- package/dist/git/object-store.d.ts +13 -0
- package/dist/git/object-store.js +79 -0
- package/dist/git/pkt-line.d.ts +13 -0
- package/dist/git/pkt-line.js +41 -0
- package/dist/git/smart-http.d.ts +18 -0
- package/dist/git/smart-http.js +109 -0
- package/dist/i18n/en.js +53 -6
- package/dist/i18n/ja.js +53 -6
- package/dist/i18n/zh_CN.js +53 -6
- package/dist/index.js +4 -1
- package/dist/interactive/progress.js +1 -0
- package/dist/interactive/prompts.d.ts +7 -1
- package/dist/interactive/prompts.js +63 -64
- package/dist/markdown/section-replacement.js +34 -8
- package/dist/utils/args.d.ts +1 -0
- package/dist/utils/args.js +4 -0
- package/dist/utils/fs-list.d.ts +1 -0
- package/dist/utils/fs-list.js +11 -0
- package/dist/utils/githooks-sync.d.ts +1 -0
- package/dist/utils/githooks-sync.js +91 -0
- package/dist/utils/mcp-sync.js +6 -0
- package/dist/utils/merge-file.d.ts +6 -0
- package/dist/utils/merge-file.js +20 -0
- package/package.json +8 -9
- package/dist/asset/github-provider.d.ts +0 -2
- package/dist/asset/github-provider.js +0 -37
- package/dist/asset/local-provider.d.ts +0 -2
- package/dist/asset/local-provider.js +0 -24
- package/dist/utils/archive.d.ts +0 -3
- package/dist/utils/archive.js +0 -20
- package/dist/utils/https.d.ts +0 -2
- package/dist/utils/https.js +0 -44
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
2
|
+
import { basename, extname, relative, resolve } from "node:path";
|
|
3
|
+
export const toImmFileName = (zipPath) => {
|
|
4
|
+
const base = basename(zipPath);
|
|
5
|
+
return base.replace(/\.zip$/i, "") + ".imm";
|
|
6
|
+
};
|
|
7
|
+
export const sentAsName = (path) => /\.zip$/i.test(path) ? toImmFileName(path) : basename(path);
|
|
8
|
+
const ALLOWED_EXTENSIONS = new Set([".imm", ".zip"]);
|
|
9
|
+
export const validateAdditionalFiles = async (projectDir, args, mainPath) => {
|
|
10
|
+
const seen = new Set([resolve(projectDir, mainPath)]);
|
|
11
|
+
const paths = [];
|
|
12
|
+
for (const arg of args) {
|
|
13
|
+
const path = resolve(projectDir, arg);
|
|
14
|
+
try {
|
|
15
|
+
const s = await stat(path);
|
|
16
|
+
if (!s.isFile())
|
|
17
|
+
throw new Error("not a file");
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return { ok: false, error: { kind: "notFound", path: arg } };
|
|
21
|
+
}
|
|
22
|
+
if (!ALLOWED_EXTENSIONS.has(extname(path).toLowerCase())) {
|
|
23
|
+
return { ok: false, error: { kind: "invalidExtension", path: arg } };
|
|
24
|
+
}
|
|
25
|
+
if (seen.has(path)) {
|
|
26
|
+
return { ok: false, error: { kind: "duplicate", path: arg } };
|
|
27
|
+
}
|
|
28
|
+
seen.add(path);
|
|
29
|
+
paths.push(path);
|
|
30
|
+
}
|
|
31
|
+
return { ok: true, paths };
|
|
32
|
+
};
|
|
33
|
+
export const buildDeployFiles = (additionalPaths, mainPath, projectDir) => [...additionalPaths, mainPath].map((path) => ({
|
|
34
|
+
path,
|
|
35
|
+
display: relative(projectDir, path),
|
|
36
|
+
sentAs: sentAsName(path),
|
|
37
|
+
}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const createGitAuthError: (status: number, url: string) => Error;
|
|
2
|
+
export declare const isGitAuthError: (err: unknown) => err is Error;
|
|
3
|
+
export declare const createGitObjectMissingError: (filepath: string, oid: string) => Error;
|
|
4
|
+
export declare const isGitObjectMissingError: (err: unknown) => err is Error;
|
|
5
|
+
export declare const createGitServerUnsupportedError: (url: string, missing: string) => Error;
|
|
6
|
+
export declare const isGitServerUnsupportedError: (err: unknown) => err is Error;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const GIT_AUTH_ERROR = "GitAuthError";
|
|
2
|
+
const GIT_SERVER_UNSUPPORTED_ERROR = "GitServerUnsupportedError";
|
|
3
|
+
export const createGitAuthError = (status, url) => Object.assign(new Error(`Authentication required (HTTP ${status}) for ${url}`), { name: GIT_AUTH_ERROR });
|
|
4
|
+
export const isGitAuthError = (err) => err instanceof Error && err.name === GIT_AUTH_ERROR;
|
|
5
|
+
const GIT_OBJECT_MISSING_ERROR = "GitObjectMissingError";
|
|
6
|
+
export const createGitObjectMissingError = (filepath, oid) => Object.assign(new Error(`Object ${oid} for ${filepath} has not been fetched`), { name: GIT_OBJECT_MISSING_ERROR });
|
|
7
|
+
export const isGitObjectMissingError = (err) => err instanceof Error && err.name === GIT_OBJECT_MISSING_ERROR;
|
|
8
|
+
export const createGitServerUnsupportedError = (url, missing) => Object.assign(new Error(`Server does not support required git feature (${missing}): ${url}`), { name: GIT_SERVER_UNSUPPORTED_ERROR });
|
|
9
|
+
export const isGitServerUnsupportedError = (err) => err instanceof Error && err.name === GIT_SERVER_UNSUPPORTED_ERROR;
|
package/dist/git/http.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { fetch as undiciFetch, EnvHttpProxyAgent } from "undici";
|
|
2
|
+
import { createGitAuthError } from "./errors.js";
|
|
3
|
+
let dispatcher = null;
|
|
4
|
+
const getDispatcher = () => {
|
|
5
|
+
dispatcher ??= new EnvHttpProxyAgent();
|
|
6
|
+
return dispatcher;
|
|
7
|
+
};
|
|
8
|
+
export const normalizeRepoUrl = (url) => url.replace(/\/+$/, "");
|
|
9
|
+
const MAX_RESPONSE_BYTES = 256 * 1024 * 1024;
|
|
10
|
+
const ensureOk = (status, url, body) => {
|
|
11
|
+
if (status === 401 || status === 403) {
|
|
12
|
+
throw createGitAuthError(status, url);
|
|
13
|
+
}
|
|
14
|
+
throw new Error(`HTTP ${status} from ${url}${body ? `: ${body.slice(0, 200)}` : ""}`);
|
|
15
|
+
};
|
|
16
|
+
const readBody = async (res, url) => {
|
|
17
|
+
if (!res.body)
|
|
18
|
+
return Buffer.alloc(0);
|
|
19
|
+
const chunks = [];
|
|
20
|
+
let total = 0;
|
|
21
|
+
for await (const chunk of res.body) {
|
|
22
|
+
const buf = Buffer.from(chunk);
|
|
23
|
+
total += buf.length;
|
|
24
|
+
if (total > MAX_RESPONSE_BYTES) {
|
|
25
|
+
throw new Error(`Response from ${url} exceeded the maximum allowed size (${MAX_RESPONSE_BYTES} bytes)`);
|
|
26
|
+
}
|
|
27
|
+
chunks.push(buf);
|
|
28
|
+
}
|
|
29
|
+
return Buffer.concat(chunks);
|
|
30
|
+
};
|
|
31
|
+
export const getInfoRefs = async (repoUrl) => {
|
|
32
|
+
const url = `${normalizeRepoUrl(repoUrl)}/info/refs?service=git-upload-pack`;
|
|
33
|
+
const res = await undiciFetch(url, {
|
|
34
|
+
headers: { "Git-Protocol": "version=2" },
|
|
35
|
+
dispatcher: getDispatcher(),
|
|
36
|
+
});
|
|
37
|
+
if (!res.ok) {
|
|
38
|
+
ensureOk(res.status, url, await res.text().catch(() => ""));
|
|
39
|
+
}
|
|
40
|
+
return readBody(res, url);
|
|
41
|
+
};
|
|
42
|
+
export const postUploadPack = async (repoUrl, body) => {
|
|
43
|
+
const url = `${normalizeRepoUrl(repoUrl)}/git-upload-pack`;
|
|
44
|
+
const res = await undiciFetch(url, {
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: {
|
|
47
|
+
"Content-Type": "application/x-git-upload-pack-request",
|
|
48
|
+
Accept: "application/x-git-upload-pack-result",
|
|
49
|
+
"Git-Protocol": "version=2",
|
|
50
|
+
},
|
|
51
|
+
body,
|
|
52
|
+
dispatcher: getDispatcher(),
|
|
53
|
+
});
|
|
54
|
+
if (!res.ok) {
|
|
55
|
+
ensureOk(res.status, url, await res.text().catch(() => ""));
|
|
56
|
+
}
|
|
57
|
+
return readBody(res, url);
|
|
58
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type BlobEntry = {
|
|
2
|
+
path: string;
|
|
3
|
+
oid: string;
|
|
4
|
+
};
|
|
5
|
+
export type ObjectStore = {
|
|
6
|
+
dir: string;
|
|
7
|
+
writePack: (pack: Buffer, label: string) => Promise<void>;
|
|
8
|
+
listBlobEntries: (commitOid: string) => Promise<BlobEntry[]>;
|
|
9
|
+
readBlobAtPath: (commitOid: string, filepath: string) => Promise<string>;
|
|
10
|
+
hasObject: (oid: string) => Promise<boolean>;
|
|
11
|
+
cleanup: () => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
export declare const createObjectStore: () => Promise<ObjectStore>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import git, { Errors } from "isomorphic-git";
|
|
6
|
+
import { createGitObjectMissingError } from "./errors.js";
|
|
7
|
+
export const createObjectStore = async () => {
|
|
8
|
+
const dir = await mkdtemp(join(tmpdir(), "accel-assets-"));
|
|
9
|
+
await git.init({ fs, dir, defaultBranch: "main" });
|
|
10
|
+
await mkdir(join(dir, ".git", "objects", "pack"), { recursive: true });
|
|
11
|
+
const cache = {};
|
|
12
|
+
const blobEntriesByCommit = new Map();
|
|
13
|
+
const blobIndexByCommit = new Map();
|
|
14
|
+
const listBlobEntries = async (commitOid) => {
|
|
15
|
+
const cached = blobEntriesByCommit.get(commitOid);
|
|
16
|
+
if (cached)
|
|
17
|
+
return cached;
|
|
18
|
+
const entries = (await git.walk({
|
|
19
|
+
fs,
|
|
20
|
+
dir,
|
|
21
|
+
cache,
|
|
22
|
+
trees: [git.TREE({ ref: commitOid })],
|
|
23
|
+
map: async (filepath, [entry]) => {
|
|
24
|
+
if (!entry || filepath === ".")
|
|
25
|
+
return undefined;
|
|
26
|
+
if ((await entry.type()) !== "blob")
|
|
27
|
+
return undefined;
|
|
28
|
+
return { path: filepath, oid: await entry.oid() };
|
|
29
|
+
},
|
|
30
|
+
}));
|
|
31
|
+
blobEntriesByCommit.set(commitOid, entries);
|
|
32
|
+
return entries;
|
|
33
|
+
};
|
|
34
|
+
const getBlobOid = async (commitOid, filepath) => {
|
|
35
|
+
let index = blobIndexByCommit.get(commitOid);
|
|
36
|
+
if (!index) {
|
|
37
|
+
index = new Map((await listBlobEntries(commitOid)).map((e) => [e.path, e.oid]));
|
|
38
|
+
blobIndexByCommit.set(commitOid, index);
|
|
39
|
+
}
|
|
40
|
+
return index.get(filepath);
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
dir,
|
|
44
|
+
writePack: async (pack, label) => {
|
|
45
|
+
const rel = join(".git", "objects", "pack", `pack-${label}.pack`);
|
|
46
|
+
await writeFile(join(dir, rel), pack);
|
|
47
|
+
await git.indexPack({ fs, dir, filepath: rel });
|
|
48
|
+
},
|
|
49
|
+
listBlobEntries,
|
|
50
|
+
readBlobAtPath: async (commitOid, filepath) => {
|
|
51
|
+
const blobOid = await getBlobOid(commitOid, filepath);
|
|
52
|
+
if (blobOid === undefined) {
|
|
53
|
+
throw new Error(`File not found in commit ${commitOid}: ${filepath}`);
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const { blob } = await git.readBlob({ fs, dir, cache, oid: blobOid });
|
|
57
|
+
return Buffer.from(blob).toString("utf-8");
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
if (err instanceof Errors.NotFoundError) {
|
|
61
|
+
throw createGitObjectMissingError(filepath, blobOid);
|
|
62
|
+
}
|
|
63
|
+
throw err;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
hasObject: async (oid) => {
|
|
67
|
+
try {
|
|
68
|
+
await git.expandOid({ fs, dir, cache, oid });
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
cleanup: async () => {
|
|
76
|
+
await rm(dir, { recursive: true, force: true }).catch(() => { });
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const FLUSH_PKT: Buffer<ArrayBuffer>;
|
|
2
|
+
export declare const DELIM_PKT: Buffer<ArrayBuffer>;
|
|
3
|
+
export declare const encodePktLine: (text: string) => Buffer;
|
|
4
|
+
export type PktLine = {
|
|
5
|
+
type: "flush";
|
|
6
|
+
} | {
|
|
7
|
+
type: "delim";
|
|
8
|
+
} | {
|
|
9
|
+
type: "data";
|
|
10
|
+
data: Buffer;
|
|
11
|
+
};
|
|
12
|
+
export declare function decodePktLines(buf: Buffer): Generator<PktLine>;
|
|
13
|
+
export declare const decodeDataLines: (buf: Buffer) => string[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export const FLUSH_PKT = Buffer.from("0000");
|
|
2
|
+
export const DELIM_PKT = Buffer.from("0001");
|
|
3
|
+
export const encodePktLine = (text) => {
|
|
4
|
+
const payload = Buffer.from(text, "utf8");
|
|
5
|
+
const length = (payload.length + 4).toString(16).padStart(4, "0");
|
|
6
|
+
return Buffer.concat([Buffer.from(length, "ascii"), payload]);
|
|
7
|
+
};
|
|
8
|
+
export function* decodePktLines(buf) {
|
|
9
|
+
let offset = 0;
|
|
10
|
+
while (offset + 4 <= buf.length) {
|
|
11
|
+
const lengthField = buf.subarray(offset, offset + 4).toString("ascii");
|
|
12
|
+
const length = Number.parseInt(lengthField, 16);
|
|
13
|
+
if (Number.isNaN(length)) {
|
|
14
|
+
throw new Error(`Invalid pkt-line length field: ${lengthField}`);
|
|
15
|
+
}
|
|
16
|
+
if (length === 0) {
|
|
17
|
+
yield { type: "flush" };
|
|
18
|
+
offset += 4;
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (length === 1) {
|
|
22
|
+
yield { type: "delim" };
|
|
23
|
+
offset += 4;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (length < 4 || offset + length > buf.length) {
|
|
27
|
+
throw new Error(`Invalid pkt-line length: ${length}`);
|
|
28
|
+
}
|
|
29
|
+
yield { type: "data", data: buf.subarray(offset + 4, offset + length) };
|
|
30
|
+
offset += length;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export const decodeDataLines = (buf) => {
|
|
34
|
+
const lines = [];
|
|
35
|
+
for (const pkt of decodePktLines(buf)) {
|
|
36
|
+
if (pkt.type === "data") {
|
|
37
|
+
lines.push(pkt.data.toString("utf8").replace(/\n$/, ""));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return lines;
|
|
41
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ServerCapabilities = {
|
|
2
|
+
version2: boolean;
|
|
3
|
+
fetchFeatures: string[];
|
|
4
|
+
};
|
|
5
|
+
export declare const fetchCapabilities: (repoUrl: string) => Promise<ServerCapabilities>;
|
|
6
|
+
export declare const assertServerSupported: (repoUrl: string, caps: ServerCapabilities) => void;
|
|
7
|
+
export declare const isValidOid: (value: string) => boolean;
|
|
8
|
+
export declare const isValidRefName: (ref: string) => boolean;
|
|
9
|
+
export type ResolvedRef = {
|
|
10
|
+
oid: string;
|
|
11
|
+
fullRef: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const resolveRef: (repoUrl: string, ref: string) => Promise<ResolvedRef | null>;
|
|
14
|
+
export type FetchPackOptions = {
|
|
15
|
+
deepenOne?: boolean;
|
|
16
|
+
filterBlobNone?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare const fetchPack: (repoUrl: string, wants: string[], options?: FetchPackOptions) => Promise<Buffer>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { DELIM_PKT, FLUSH_PKT, decodeDataLines, decodePktLines, encodePktLine, } from "./pkt-line.js";
|
|
2
|
+
import { createGitServerUnsupportedError } from "./errors.js";
|
|
3
|
+
import { getInfoRefs, postUploadPack } from "./http.js";
|
|
4
|
+
const AGENT = "agent=accel-cli";
|
|
5
|
+
export const fetchCapabilities = async (repoUrl) => {
|
|
6
|
+
const buf = await getInfoRefs(repoUrl);
|
|
7
|
+
const lines = decodeDataLines(buf);
|
|
8
|
+
const version2 = lines.some((l) => l.trim() === "version 2");
|
|
9
|
+
const fetchLine = lines.find((l) => l.startsWith("fetch="));
|
|
10
|
+
return {
|
|
11
|
+
version2,
|
|
12
|
+
fetchFeatures: fetchLine ? fetchLine.slice("fetch=".length).split(" ") : [],
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export const assertServerSupported = (repoUrl, caps) => {
|
|
16
|
+
if (!caps.version2) {
|
|
17
|
+
throw createGitServerUnsupportedError(repoUrl, "protocol v2");
|
|
18
|
+
}
|
|
19
|
+
if (!caps.fetchFeatures.includes("filter")) {
|
|
20
|
+
throw createGitServerUnsupportedError(repoUrl, "fetch filter");
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const buildCommandBody = (command, args) => Buffer.concat([
|
|
24
|
+
encodePktLine(`command=${command}\n`),
|
|
25
|
+
encodePktLine(`${AGENT}\n`),
|
|
26
|
+
encodePktLine("object-format=sha1\n"),
|
|
27
|
+
DELIM_PKT,
|
|
28
|
+
...args.map((a) => encodePktLine(`${a}\n`)),
|
|
29
|
+
FLUSH_PKT,
|
|
30
|
+
]);
|
|
31
|
+
const OID_PATTERN = /^[0-9a-f]{40}$/;
|
|
32
|
+
export const isValidOid = (value) => OID_PATTERN.test(value);
|
|
33
|
+
export const isValidRefName = (ref) => ref.length > 0 &&
|
|
34
|
+
ref.length <= 255 &&
|
|
35
|
+
!/[\x00-\x20\x7f~^:?*[\\]/.test(ref) &&
|
|
36
|
+
!ref.includes("..") &&
|
|
37
|
+
!ref.startsWith("-") &&
|
|
38
|
+
!ref.startsWith("/") &&
|
|
39
|
+
!ref.endsWith("/") &&
|
|
40
|
+
!ref.endsWith(".lock");
|
|
41
|
+
export const resolveRef = async (repoUrl, ref) => {
|
|
42
|
+
if (!isValidRefName(ref)) {
|
|
43
|
+
throw new Error(`Invalid ref name: ${JSON.stringify(ref)}`);
|
|
44
|
+
}
|
|
45
|
+
const buf = await postUploadPack(repoUrl, buildCommandBody("ls-refs", [
|
|
46
|
+
"peel",
|
|
47
|
+
`ref-prefix refs/heads/${ref}`,
|
|
48
|
+
`ref-prefix refs/tags/${ref}`,
|
|
49
|
+
]));
|
|
50
|
+
const entries = new Map();
|
|
51
|
+
for (const line of decodeDataLines(buf)) {
|
|
52
|
+
const [oid, name, ...rest] = line.split(" ");
|
|
53
|
+
if (!oid || !name)
|
|
54
|
+
continue;
|
|
55
|
+
const peeled = rest.find((r) => r.startsWith("peeled:"));
|
|
56
|
+
entries.set(name, peeled ? peeled.slice("peeled:".length) : oid);
|
|
57
|
+
}
|
|
58
|
+
for (const fullRef of [`refs/heads/${ref}`, `refs/tags/${ref}`]) {
|
|
59
|
+
const oid = entries.get(fullRef);
|
|
60
|
+
if (oid)
|
|
61
|
+
return { oid, fullRef };
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
};
|
|
65
|
+
export const fetchPack = async (repoUrl, wants, options = {}) => {
|
|
66
|
+
if (wants.length === 0) {
|
|
67
|
+
return Buffer.alloc(0);
|
|
68
|
+
}
|
|
69
|
+
const invalidWant = wants.find((w) => !isValidOid(w));
|
|
70
|
+
if (invalidWant !== undefined) {
|
|
71
|
+
throw new Error(`Invalid object id: ${JSON.stringify(invalidWant)}`);
|
|
72
|
+
}
|
|
73
|
+
const args = [
|
|
74
|
+
...wants.map((w) => `want ${w}`),
|
|
75
|
+
...(options.deepenOne ? ["deepen 1"] : []),
|
|
76
|
+
...(options.filterBlobNone ? ["filter blob:none"] : []),
|
|
77
|
+
"no-progress",
|
|
78
|
+
"done",
|
|
79
|
+
];
|
|
80
|
+
const buf = await postUploadPack(repoUrl, buildCommandBody("fetch", args));
|
|
81
|
+
const chunks = [];
|
|
82
|
+
let inPackfile = false;
|
|
83
|
+
for (const pkt of decodePktLines(buf)) {
|
|
84
|
+
if (pkt.type !== "data")
|
|
85
|
+
continue;
|
|
86
|
+
if (inPackfile) {
|
|
87
|
+
const band = pkt.data[0];
|
|
88
|
+
if (band === 1) {
|
|
89
|
+
chunks.push(pkt.data.subarray(1));
|
|
90
|
+
}
|
|
91
|
+
else if (band === 3) {
|
|
92
|
+
throw new Error(`git server error: ${pkt.data.subarray(1).toString("utf8").trim()}`);
|
|
93
|
+
}
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const text = pkt.data.toString("utf8");
|
|
97
|
+
if (text === "packfile\n") {
|
|
98
|
+
inPackfile = true;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (text.startsWith("ERR ")) {
|
|
102
|
+
throw new Error(`git server error: ${text.slice(4).trim()}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (chunks.length === 0) {
|
|
106
|
+
throw new Error(`git server returned no packfile for wants: ${wants.slice(0, 3).join(", ")}${wants.length > 3 ? ", ..." : ""}`);
|
|
107
|
+
}
|
|
108
|
+
return Buffer.concat(chunks);
|
|
109
|
+
};
|
package/dist/i18n/en.js
CHANGED
|
@@ -6,7 +6,7 @@ export const messages = {
|
|
|
6
6
|
"prompt.artifactId": "Enter artifact ID (Maven artifactId)",
|
|
7
7
|
"prompt.artifactId.hint": "Recorded in pom.xml as the Maven artifactId (the artifact's identifier)\nThe identifier that forms the built artifact's file name (jar/war) and Maven coordinates. Defaults to the project name; change only if you want a different identifier",
|
|
8
8
|
"prompt.jugglingProject": "Enter IM-Juggling project path (optional)",
|
|
9
|
-
"prompt.jugglingProject.hint": "If set, the iAP version and modules are auto-detected from juggling.im\nPath to an existing IM-Juggling project directory you want to link
|
|
9
|
+
"prompt.jugglingProject.hint": "If set, the iAP version and modules are auto-detected from juggling.im\nPath to an existing IM-Juggling project directory you want to link (e.g. ../customer-portal-juggling)\nLeave empty for no link (in update, this clears the recorded link)",
|
|
10
10
|
"prompt.accelplatformVersion": "Select iAP version",
|
|
11
11
|
"prompt.accelplatformVersion.hint": "iAP release version. The deployed assets (CLAUDE.md, etc.) adapt to this version",
|
|
12
12
|
"prompt.modules": "Select modules to use",
|
|
@@ -27,14 +27,18 @@ export const messages = {
|
|
|
27
27
|
"prompt.agent.hint": "claude-code deploys under .claude/, codex deploys under .codex/, github-copilot deploys under .github/ (instructions, skills, etc.)",
|
|
28
28
|
"prompt.withGit": "Initialize Git repository?",
|
|
29
29
|
"prompt.withGit.hint": "Runs git init inside the created project directory",
|
|
30
|
+
"prompt.useExistingSettings": "Use the existing settings?",
|
|
31
|
+
"prompt.useExistingSettings.hint": "Yes: skip re-entering each setting and update assets with the current settings / No: re-enter each setting",
|
|
30
32
|
"juggling.detected.version": "Detected version from juggling.im: {version}",
|
|
31
|
-
"juggling.detected.modules": "Detected modules from juggling.im: {modules}",
|
|
32
33
|
"juggling.notFound": "juggling.im not found at specified path: {path}",
|
|
33
34
|
"juggling.versionUnknown": "The juggling.im version {version} is not in the catalog. Select the version and modules manually.",
|
|
34
35
|
"warning.versionMismatch": "Specified iAP version ({option}) differs from juggling.im ({juggling}). Using specified value.",
|
|
35
36
|
"warning.moduleMismatch": "Specified modules differ from juggling.im. Using specified values.",
|
|
36
37
|
"warning.gitNotFound": "git command not found. Skipping Git initialization.",
|
|
37
38
|
"warning.fileExists": "File already exists, skipping: {path}",
|
|
39
|
+
"warning.gitHooksUserFile": "Skipped placing the pre-commit hook because {path} is not managed by the CLI. To keep the token-leak check, integrate it into your existing hook manually.",
|
|
40
|
+
"warning.gitHooksPathConflict": "Skipped enabling the pre-commit hook because git core.hooksPath is set to {current}. Integrate the token-leak check (.githooks/pre-commit) into your existing hook setup manually.",
|
|
41
|
+
"warning.gitHooksForeignFiles": "Skipped setting core.hooksPath because .githooks contains files not managed by the CLI ({files}). After confirming they are safe, run git config core.hooksPath .githooks manually.",
|
|
38
42
|
"attach.skipSummary": "{count} file(s) were skipped because they already exist.",
|
|
39
43
|
"attach.overwritePrompt": "{path} already exists. Overwrite?",
|
|
40
44
|
"attach.overwritePrompt.yes": "Yes (overwrite this file)",
|
|
@@ -49,6 +53,42 @@ export const messages = {
|
|
|
49
53
|
"detach.complete": "Detach complete. {skipped} file(s) were skipped due to user modifications.",
|
|
50
54
|
"detach.completeAll": "Detach complete. All assets removed.",
|
|
51
55
|
"detach.cancelled": "Detach cancelled.",
|
|
56
|
+
"intro.update": "Updates deployed assets to the latest revision of the asset repository.\nFiles you have edited are preserved.\nReview the settings, then apply the changes.",
|
|
57
|
+
"update.error.legacyProject": "This project was created with a CLI version that does not support update.",
|
|
58
|
+
"update.error.notGitSource": "Only projects deployed from a git source can be updated (this project was deployed from a local directory).",
|
|
59
|
+
"update.error.baseFetch": "Failed to fetch the base commit {commit} (history may have been rewritten): {message}",
|
|
60
|
+
"update.warning.dirty": "The project has uncommitted changes. Committing before update is recommended.",
|
|
61
|
+
"update.confirmDirty": "There are uncommitted changes. Continue?",
|
|
62
|
+
"update.invalidSettings": "The existing settings contain invalid values. Re-enter each setting:\n{errors}",
|
|
63
|
+
"update.confirmApply": "Apply the update with these settings?",
|
|
64
|
+
"update.cancelled": "Update cancelled.",
|
|
65
|
+
"update.progress.range": "Updating assets... ({from} → {to})",
|
|
66
|
+
"update.result.updated": "Updated: {path}",
|
|
67
|
+
"update.result.merged": "Updated: {path} (merged with your edits)",
|
|
68
|
+
"update.result.kept": "Kept: {path} (edited by you, no upstream change)",
|
|
69
|
+
"update.result.keptDeleted": "Kept: {path} (deleted by you)",
|
|
70
|
+
"update.result.deleted": "Deleted: {path} (no longer deployed)",
|
|
71
|
+
"update.result.redeployed": "Redeployed: {path}",
|
|
72
|
+
"update.result.added": "Added: {path}",
|
|
73
|
+
"update.result.adopted": "Adopted: {path} (identical to the existing file)",
|
|
74
|
+
"update.result.conflict": "Conflict: {path}",
|
|
75
|
+
"update.result.keptWarn": "Kept: {path} (no longer deployed upstream, but preserved because you edited it)",
|
|
76
|
+
"update.upToDate": "Everything is up to date. Nothing to update.",
|
|
77
|
+
"update.complete": "Update complete. Updated {updated}, kept {kept}, deleted {deleted} file(s).",
|
|
78
|
+
"update.conflictSummary": "{count} conflict(s) found. Review the markers (<<<<<<<) and resolve them manually:",
|
|
79
|
+
"update.installSkippedConflict": "install / build were skipped. After resolving the conflicts, run:\n {installCommand} && {buildCommand}",
|
|
80
|
+
"update.error.keepEditedWithoutAllow": "--keep-edited can only be used together with --allow-missing-base.",
|
|
81
|
+
"update.error.baseFetchHint": "To continue in fallback mode, pass --allow-missing-base (add --keep-edited to keep edited files and skip them). If the asset repository moved, point to the new location with --asset-server-url / --asset-ref. As a last resort, run accel detach and re-run init.",
|
|
82
|
+
"update.fallback.editedCount": "Without the base commit, upstream changes to edited files cannot be detected. Edited files that differ from upstream: {count}",
|
|
83
|
+
"update.fallback.choice": "How would you like to proceed?",
|
|
84
|
+
"update.fallback.choice.abort": "Abort",
|
|
85
|
+
"update.fallback.choice.conflict": "Continue in fallback mode (insert conflict markers into edited files)",
|
|
86
|
+
"update.fallback.choice.keep": "Continue in fallback mode (keep edited files and skip them)",
|
|
87
|
+
"update.fallback.continuing": "Continuing in fallback mode without the base commit (classification uses hashsum-based edit detection only).",
|
|
88
|
+
"update.fallback.aborted": "Update aborted.",
|
|
89
|
+
"update.result.redeployedWarn": "Redeployed: {path} (you had deleted it, but upstream changes could not be determined without the base commit)",
|
|
90
|
+
"update.result.skippedEdited": "Kept: {path} (edited; skipped without applying upstream changes)",
|
|
91
|
+
"update.fallback.skippedSummary": "Skipped {count} edited file(s) without applying upstream changes:",
|
|
52
92
|
"error.directoryExists": "Directory already exists: {path}",
|
|
53
93
|
"error.accelExists": ".accel directory already exists",
|
|
54
94
|
"error.accelNotFound": ".accel directory not found",
|
|
@@ -64,6 +104,9 @@ export const messages = {
|
|
|
64
104
|
"error.invalidArtifactId": "Artifact ID violates Maven naming rules (^[A-Za-z0-9][A-Za-z0-9._-]*$): {value}",
|
|
65
105
|
"error.invalidGroup": "Group name violates Maven groupId naming rules (dot-separated Java identifiers): {value}",
|
|
66
106
|
"error.invalidProjectVersion": "Project version violates Maven version naming rules (^[A-Za-z0-9][A-Za-z0-9._-]*$): {value}",
|
|
107
|
+
"error.gitAuthHint": "The repository requires authentication (HTTP 401/403). Private repositories that require authentication are not supported. Please specify the URL of a public repository.",
|
|
108
|
+
"error.gitServerUnsupported": "This server does not support the git features required to fetch assets (smart HTTP protocol v2 / filter). Please use a major git hosting service such as GitHub, GitLab, or Gitea.",
|
|
109
|
+
"error.gitUrlUnsupported": "Asset repository URLs must use HTTP(S) (SSH and file:// are not supported): {url}",
|
|
67
110
|
"summary.heading": "Deployment settings",
|
|
68
111
|
"summary.label.name": "Project name",
|
|
69
112
|
"summary.label.artifactId": "Artifact ID",
|
|
@@ -82,6 +125,7 @@ export const messages = {
|
|
|
82
125
|
"summary.outputDir": "Output directory",
|
|
83
126
|
"summary.empty": "(none)",
|
|
84
127
|
"progress.fetching": "Fetching asset repository...",
|
|
128
|
+
"progress.downloading": "Downloading assets...",
|
|
85
129
|
"progress.deploying.section": "Deploying under {section} ({files})",
|
|
86
130
|
"progress.deploying.root": "Deploying root-level files ({files})",
|
|
87
131
|
"progress.installing": "Running {command}...",
|
|
@@ -116,8 +160,10 @@ export const messages = {
|
|
|
116
160
|
"deploy.confirm": "Deploy with the following settings. Continue?",
|
|
117
161
|
"deploy.confirm.endpoint": "Endpoint",
|
|
118
162
|
"deploy.confirm.stagingId": "Staging",
|
|
119
|
-
"deploy.confirm.
|
|
120
|
-
"deploy.
|
|
163
|
+
"deploy.confirm.files": "Files to deploy (in send order)",
|
|
164
|
+
"deploy.order.heading": "Deploy order",
|
|
165
|
+
"deploy.order.confirm": "Deploy in this order?",
|
|
166
|
+
"deploy.order.selectNext": "Select the file to deploy at position {position} (of {total})",
|
|
121
167
|
"deploy.result.deployId": "Deploy ID",
|
|
122
168
|
"deploy.result.stagingId": "Staging",
|
|
123
169
|
"deploy.result.status": "Status",
|
|
@@ -129,6 +175,9 @@ export const messages = {
|
|
|
129
175
|
"deploy.error.missingStagingId": "--staging-id is required in non-interactive mode. Specify the target staging ID.",
|
|
130
176
|
"deploy.error.zipNotResolved": "Could not uniquely determine the zip to deploy. Specify the file explicitly with --file.",
|
|
131
177
|
"deploy.error.fileNotFound": "The specified file was not found: {path}",
|
|
178
|
+
"deploy.error.additionalFileNotFound": "The specified additional file was not found: {path}",
|
|
179
|
+
"deploy.error.additionalFileInvalidExtension": "Additional files must be .imm or .zip: {path}",
|
|
180
|
+
"deploy.error.additionalFileDuplicate": "The same file is specified more than once: {path}",
|
|
132
181
|
"deploy.error.network": "Could not connect to iAP: {message}",
|
|
133
182
|
"deploy.error.server": "iAP returned an error: {message}",
|
|
134
183
|
"deploy.error.unauthorized": "Authentication failed (401). Check that the API key is correct.",
|
|
@@ -137,8 +186,6 @@ export const messages = {
|
|
|
137
186
|
"deploy.error.badRequest": "Bad request (400).",
|
|
138
187
|
"deploy.error.serverError": "A server error occurred (500).",
|
|
139
188
|
"deploy.error.unexpectedResponse": "Received an unexpected response (HTTP {status}).",
|
|
140
|
-
"deploy.reauth.notFound": "The endpoint could not be reached (404). Check that the endpoint URL is correct.",
|
|
141
|
-
"deploy.reauth.notice": "Please re-enter your connection information.",
|
|
142
189
|
"deploy.result.shortcutUrl": "Shortcut URL",
|
|
143
190
|
"deploy.setup.heading": "Tenant Environment Setup Configs",
|
|
144
191
|
"deploy.setup.confirm": "Run tenant environment setup?",
|