{"draft":null,"from":99,"to":318,"files":[{"path":"client/scripts/import-git.ts","added":30,"removed":6,"diff":"--- a/client/scripts/import-git.ts\n+++ b/client/scripts/import-git.ts\n@@ -2,7 +2,15 @@\n // first used for #56, abso hosts abso). Each commit on the first-parent line\n // of --ref becomes a version of shared, oldest first: the first by `avcs\n // init`, each later one by a publish of that commit's tree, with the commit's\n-// message and a last line naming the commit, its author and its time.\n+// message and a last line naming the commit, its author and its time. When\n+// the repository's issues are on the web (origin on GitHub or GitLab, or\n+// --issues <url>), a line after it says where, so \"#39\" in the message, or\n+// in the lines it wrote, names that tracker's issue, not the project's:\n+//\n+//   git 4e1a7c2b9f03, Ada Lovelace, 2026-10-06T20:36:43-05:00\n+//   Issues: https://github.com/owner/repo/issues\n+//\n+// abso why and abso blame read these lines (client/src/git-origin.ts).\n // --last-only imports the last commit alone.\n //\n // Before anything is created, the last commit is checked: abso stores text\n@@ -14,7 +22,9 @@\n // What a first cut leaves for later (#58): every version's agent is the\n // importing agent and its time is the import's (the commit's author and time\n // are in the message); merges come in as their first parent's line; a run\n-// that stops partway goes on with --after <sha> in the same --dir.\n+// that stops partway goes on with --after <sha> in the same --dir. Version 0\n+// is made by init, which says \"Start the project\", so the first commit's own\n+// message and hash aren't on it: they're printed when the import starts.\n //\n // CI counts each imported version as seen as soon as it lands, so it never\n // checks or bisects the history; it checks what is published after the\n@@ -22,7 +32,7 @@\n //\n //   node client/scripts/import-git.ts --project <name> [--ref origin/main]\n //     [--server <url>] [--agent import] [--dir <empty folder>]\n-//     [--last-only] [--check-only] [--after <sha>]\n+//     [--last-only] [--check-only] [--after <sha>] [--issues <url>]\n \n import { spawnSync } from \"node:child_process\";\n import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync } from \"node:fs\";\n@@ -31,6 +41,7 @@\n import { parseArgs } from \"node:util\";\n import { open } from \"../src/commands.ts\";\n import { loadIgnore } from \"../src/folder.ts\";\n+import { issuesOf } from \"../src/git-origin.ts\";\n import { main } from \"../src/main.ts\";\n \n const { values } = parseArgs({\n@@ -43,6 +54,7 @@\n \t\t\"last-only\": { type: \"boolean\", default: false },\n \t\t\"check-only\": { type: \"boolean\", default: false },\n \t\tafter: { type: \"string\" },\n+\t\tissues: { type: \"string\" },\n \t},\n });\n const checkOnly = values[\"check-only\"] === true;\n@@ -94,18 +106,24 @@\n \tprocess.exit(0);\n }\n \n+// Where \"#N\" in the history points: --issues, else origin's issues on GitHub or GitLab.\n+if (values.issues !== undefined && !/^https?:\\/\\/\\S+$/.test(values.issues))\n+\tfail(`--issues is a web address, like https://github.com/owner/repo/issues (got ${JSON.stringify(values.issues)})`);\n+const tracker = values.issues ?? issuesOf(origin());\n+\n const env = { cwd: dir, env: process.env, write: () => {} };\n let skipped = 0;\n for (let i = start; i < line.length; i++) {\n \tconst sha = line[i]!;\n \textract(sha, dir);\n-\tconst message = `${git([\"log\", \"-1\", \"--format=%B\", sha]).trim()}\\n\\ngit ${sha.slice(0, 12)}, ${git([\"log\", \"-1\", \"--format=%an, %aI\", sha]).trim()}`;\n+\tconst message = `${git([\"log\", \"-1\", \"--format=%B\", sha]).trim()}\\n\\ngit ${sha.slice(0, 12)}, ${git([\"log\", \"-1\", \"--format=%an, %aI\", sha]).trim()}${tracker ? `\\nIssues: ${tracker}` : \"\"}`;\n+\tif (i === 0) console.log(`Version 0 is commit ${sha.slice(0, 12)}: ${message.split(\"\\n\")[0]}`);\n \tconst subject = message.split(\"\\n\")[0]!.slice(0, 72);\n \t// The first commit makes the project; --as-is adds no starting .absoignore or avcs.json git never had.\n \tconst argv =\n \t\ti === 0\n \t\t\t? [\"init\", dir, \"--server\", values.server!, \"--project\", values.project!, \"--agent\", values.agent!, \"--as-is\"]\n-\t\t\t: [\"publish\", \"-m\", message];\n+\t\t\t: [\"push\", \"-m\", message];\n \tlet r = await main(argv, env);\n \t// A lost connection: try again. If the lost publish did land, the next try finds nothing to publish.\n \tfor (\n@@ -120,7 +138,7 @@\n \t\tfail(\n \t\t\t`[${i + 1}/${line.length}] ${sha.slice(0, 12)} ${subject}: ${argv[0]} failed (exit ${r.exit}).\\n${r.stdout}${r.stderr}\\nGo on from the commit before it with --after ${i === 0 ? \"(none: start again in an empty folder)\" : line[i - 1]!.slice(0, 12)} --dir ${dir}`,\n \t\t);\n-\tconst empty = /^Nothing (to publish|published)/m.test(r.stdout);\n+\tconst empty = /^Nothing (to push|pushed)/m.test(r.stdout);\n \tif (empty) skipped++;\n \tconst version = /(?:version|at version) (\\d+)/.exec(r.stdout)?.[1];\n \tif (version !== undefined) await skipCi(Number(version));\n@@ -179,6 +197,12 @@\n \treturn r.stdout;\n }\n \n+/** origin's address, or \"\" when there's no origin. */\n+function origin(): string {\n+\tconst r = spawnSync(\"git\", [\"remote\", \"get-url\", \"origin\"], { encoding: \"utf8\" });\n+\treturn r.status === 0 ? r.stdout.trim() : \"\";\n+}\n+\n function fail(message: string): never {\n \tconsole.error(message);\n \tprocess.exit(1);"}],"unmatched":[]}