feat(ql3): establish 3.0 incubation baseline

This commit is contained in:
whyour
2026-08-12 00:25:26 +08:00
parent 4bf92dcfeb
commit c699c32461
2817 changed files with 779642 additions and 653 deletions
@@ -0,0 +1,48 @@
import { createHash } from 'crypto';
export interface LegacyTaskRevisionInput {
command: string;
schedule?: string;
extraSchedules?: readonly string[];
taskBefore?: string;
taskAfter?: string;
workDirectory?: string;
logName?: string;
environmentRevision?: string;
sourceRevision?: string;
}
export function createLegacyLogArtifactId(logPath: string): string {
return `legacy-log:${createHash('sha256')
.update(logPath)
.digest('hex')
.slice(0, 25)}`;
}
export function createLegacyTaskRevision(
input: LegacyTaskRevisionInput,
): string {
const snapshot = {
schema: 1,
command: input.command,
...(input.schedule === undefined ? {} : { schedule: input.schedule }),
...(input.extraSchedules === undefined
? {}
: { extraSchedules: [...input.extraSchedules] }),
...(input.taskBefore === undefined ? {} : { taskBefore: input.taskBefore }),
...(input.taskAfter === undefined ? {} : { taskAfter: input.taskAfter }),
...(input.workDirectory === undefined
? {}
: { workDirectory: input.workDirectory }),
...(input.logName === undefined ? {} : { logName: input.logName }),
...(input.environmentRevision === undefined
? {}
: { environmentRevision: input.environmentRevision }),
...(input.sourceRevision === undefined
? {}
: { sourceRevision: input.sourceRevision }),
};
return `sha256:${createHash('sha256')
.update(JSON.stringify(snapshot))
.digest('hex')}`;
}