fix: configure JD01 workspace git proxy
This commit is contained in:
@@ -353,6 +353,7 @@ export interface HwlabRuntimeCodeAgentRuntimeSpec {
|
||||
}
|
||||
|
||||
export interface HwlabRuntimeSourceWorkspaceSpec {
|
||||
readonly git?: HwlabRuntimeSourceWorkspaceGitSpec;
|
||||
readonly requiredCommands: readonly string[];
|
||||
readonly requiredFiles: readonly string[];
|
||||
readonly hostDependencies?: HwlabRuntimeSourceWorkspaceHostDependenciesSpec;
|
||||
@@ -365,6 +366,16 @@ export interface HwlabRuntimeSourceWorkspaceSpec {
|
||||
};
|
||||
}
|
||||
|
||||
export interface HwlabRuntimeSourceWorkspaceGitSpec {
|
||||
readonly remoteName: string;
|
||||
readonly remoteUrl: string;
|
||||
readonly identityTarget?: string;
|
||||
readonly identityId?: string;
|
||||
readonly proxyEnvPath?: string;
|
||||
readonly verifyRemote: boolean;
|
||||
readonly requireUpToDate: boolean;
|
||||
}
|
||||
|
||||
export interface HwlabRuntimeSourceWorkspaceHostDependenciesSpec {
|
||||
readonly checkCommands: readonly string[];
|
||||
readonly stateDir: string;
|
||||
@@ -873,11 +884,31 @@ function absoluteHostPathField(value: string, path: string): string {
|
||||
return value;
|
||||
}
|
||||
|
||||
function gitRemoteNameField(value: string, path: string): string {
|
||||
if (!/^[A-Za-z0-9._-]+$/u.test(value)) throw new Error(`${path} must be a git remote name`);
|
||||
return value;
|
||||
}
|
||||
|
||||
function sourceWorkspaceGitConfig(value: unknown, path: string): HwlabRuntimeSourceWorkspaceGitSpec | undefined {
|
||||
if (value === undefined) return undefined;
|
||||
const raw = asRecord(value, path);
|
||||
return {
|
||||
remoteName: gitRemoteNameField(stringField(raw, "remoteName", path), `${path}.remoteName`),
|
||||
remoteUrl: stringField(raw, "remoteUrl", path),
|
||||
...(raw.identityTarget === undefined ? {} : { identityTarget: stringField(raw, "identityTarget", path) }),
|
||||
...(raw.identityId === undefined ? {} : { identityId: stringField(raw, "identityId", path) }),
|
||||
...(raw.proxyEnvPath === undefined ? {} : { proxyEnvPath: absoluteHostPathField(stringField(raw, "proxyEnvPath", path), `${path}.proxyEnvPath`) }),
|
||||
verifyRemote: booleanField(raw, "verifyRemote", path),
|
||||
requireUpToDate: booleanField(raw, "requireUpToDate", path),
|
||||
};
|
||||
}
|
||||
|
||||
function sourceWorkspaceConfig(value: unknown, path: string): HwlabRuntimeSourceWorkspaceSpec | undefined {
|
||||
if (value === undefined) return undefined;
|
||||
const raw = asRecord(value, path);
|
||||
const install = asRecord(raw.install, `${path}.install`);
|
||||
return {
|
||||
git: sourceWorkspaceGitConfig(raw.git, `${path}.git`),
|
||||
requiredCommands: stringArrayField(raw, "requiredCommands", path)
|
||||
.map((item, index) => commandNameField(item, `${path}.requiredCommands[${index}]`)),
|
||||
requiredFiles: stringArrayField(raw, "requiredFiles", path)
|
||||
|
||||
Reference in New Issue
Block a user