import type { MigrationTask } from "#lib/api/migrator.ts"; import type { GitHubRepo } from "#lib/github.ts"; export type GitHubImportDatasetName = "demo" | "worst" | "empty" | "one" | "huge"; export interface GitHubImportDataset { repos: GitHubRepo[]; knots: string[]; tasks: MigrationTask[]; } const owner = "aleksandra-wisniewska-kowalczyk"; const repo = ( id: number, name: string, fields: Partial> = {} ): GitHubRepo => ({ id, name, fullName: `${owner}/${name}`, description: null, cloneUrl: `https://github.com/${owner}/${name}.git`, htmlUrl: `https://github.com/${owner}/${name}`, defaultBranch: "main", ...fields }); type Job = MigrationTask["jobs"][number]; type JobFields = Partial; const job = (id: string, name: string, status: string, fields: JobFields = {}): Job => ({ id, name, knotDid: "did:web:knot.northwind-industries-holdings.example.com", sourceUrl: `https://github.com/${owner}/${name}.git`, private: false, status, attempts: 1, ...fields }); const task = (id: string, jobs: MigrationTask["jobs"]): MigrationTask => ({ id, ownerDid: "did:plc:alice", createdAt: "2026-10-27T09:14:00Z", jobs }); const longestName = "NorthwindIndustriesHoldings.Platform.Infrastructure.Terraform.Modules.AWS.eu-central-1.production.v2".slice( 0, 100 ); const proxyErrorPage = `knot createRepo returned HTTP 502: knot.northwind-industries-holdings.example.com | 502: Bad gateway

Bad gatewayError code 502

Visit example.com for more information.
2026-10-27 09:14:07 UTC
`; const worstRepos: GitHubRepo[] = [ repo(1, longestName, { description: "Shared Terraform modules for every production account in eu-central-1, including VPC peering, Transit Gateway attachments, IAM permission boundaries, KMS key policies, and the Datadog forwarder. Owned by Platform Infrastructure; ask in #platform-infra before changing anything under modules/networking/.", language: "HCL", stars: 1284, private: true }), repo(2, "a", { description: null, language: null, stars: 0 }), repo(3, "dotfiles", { description: "🦊 My config — 設定ファイル & scripts for zsh, nvim, and ", language: "Vim Script", stars: 1, private: true }), repo(4, "Q3-board-deck-FINAL-revised-v12-approved-by-legal", { description: "Fix & escaping in **bold** headings", language: "Common Workflow Language", stars: 128_400 }), repo(5, "benachrichtigungseinstellungen", { description: "Paramètres de confidentialité et de sécurité pour les notifications", language: "Jupyter Notebook", stars: 999_999 }), ...Array.from({ length: 18 }, (_, i) => repo(6 + i, `service-${String(i + 1).padStart(2, "0")}`, { description: i % 3 === 0 ? null : `Internal service ${i + 1}`, language: i % 2 === 0 ? "Go" : "TypeScript", stars: i * 7 }) ) ]; const worstTasks: MigrationTask[] = [ task("task-worst", [ job("job-proxy", longestName, "failed", { error: proxyErrorPage, private: true }), job("job-a", "a", "queued"), job("job-dotfiles", "dotfiles", "completed", { repoDid: "did:plc:7f3k2m9xq4w8z1v5n6b0c2d4" }), job("job-deck", "Q3-board-deck-FINAL-revised-v12-approved-by-legal", "failed", { error: `a repository named "Q3-board-deck-FINAL-revised-v12-approved-by-legal" already exists on did:web:knot.northwind-industries-holdings.example.com and was not created from https://github.com/${owner}/Q3-board-deck-FINAL-revised-v12-approved-by-legal.git` }), job("job-benach", "benachrichtigungseinstellungen", "importing"), job("job-404", "service-01", "failed", { error: "knot createRepo returned HTTP 404: " }), job("job-grant", "service-02", "authorization_required", { error: "ScopeMissingError: Missing required scope rpc:org.tangled.repo.createRepo?aud=*" }), job("job-cloning", "service-03", "cloning"), job("job-unknown", "service-04", "paused"), job("job-silent", "service-05", "failed") ]) ]; const demo: GitHubImportDataset = { repos: [ repo(1, "alpha", { description: "first" }), repo(2, "beta", { description: "second" }), repo(3, "gamma", { description: "third" }) ], knots: ["knot.example.test"], tasks: [task("task-earlier", [job("job-earlier", "delta", "completed")])] }; const statuses = ["completed", "failed", "queued", "cloning", "importing", "completed"]; export const githubImportDatasets: Record = { demo, worst: { repos: worstRepos, knots: [ "knot.northwind-industries-holdings.example.com", "k.example.test", "eu-central-1.knots.sub.department.region.example.co.uk" ], tasks: worstTasks }, empty: { repos: [], knots: [], tasks: [] }, one: { repos: [repo(1, "dotfiles", { description: "My config", language: "Shell", stars: 1 })], knots: ["knot.example.test"], tasks: [task("task-one", [job("job-one", "dotfiles", "completed")])] }, huge: { repos: Array.from({ length: 1284 }, (_, i) => repo(i + 1, `repository-${String(i + 1).padStart(4, "0")}`, { description: `Repository number ${i + 1}`, language: i % 2 === 0 ? "Rust" : "Python", stars: i * 13 }) ), knots: ["knot.example.test"], tasks: Array.from({ length: 20 }, (_, t) => task( `task-${t}`, Array.from({ length: 50 }, (_, j) => { const n = t * 50 + j + 1; const status = statuses[n % statuses.length]; return job( `job-${n}`, `repository-${String(n).padStart(4, "0")}`, status, status === "failed" ? { error: "knot createRepo returned HTTP 404: " } : {} ); }) ) ) } };