diff --git a/workflows/repo-assist.md b/workflows/repo-assist.md index 25cc52f..3179267 100644 --- a/workflows/repo-assist.md +++ b/workflows/repo-assist.md @@ -85,8 +85,8 @@ tools: repo-memory: max-file-size: 65536 max-patch-size: 65536 - # Allows the one-time removal of five legacy memory files plus notes.json. - # The validation script below still enforces exactly one persisted file. + # Allow one migration commit to delete up to five legacy entries while + # notes.json remains the only persisted file accepted by validation. max-file-count: 6 format-json: true allowed-extensions: [".json"] @@ -97,12 +97,9 @@ tools: const path = require("node:path"); const fail = message => { throw new Error(`notes.json: ${message}`); }; const notesPath = path.join(memoryRoot, "notes.json"); - for (const legacyFile of ["memory.json", "state.json"]) { - fs.rmSync(path.join(memoryRoot, legacyFile), { force: true }); - } const memoryEntries = fs.readdirSync(memoryRoot, { withFileTypes: true }); if (memoryEntries.length !== 1 || !memoryEntries[0].isFile() || memoryEntries[0].name !== "notes.json") { - fail("must be the only file in repo memory"); + fail(`must be the only file in repo memory; found: ${memoryEntries.map(entry => entry.name).join(", ") || "(none)"}`); } if (!fs.existsSync(notesPath)) fail("missing (create an initial notes.json that matches schema version 1)"); const data = JSON.parse(fs.readFileSync(notesPath, "utf8")); @@ -223,6 +220,21 @@ safe-outputs: target: "*" steps: + - name: Migrate legacy Repo Assist memory + env: + MEMORY_DIR: /tmp/gh-aw/repo-memory/default + run: | + node <<'EOF' + const fs = require("node:fs"); + const path = require("node:path"); + const memoryDir = process.env.MEMORY_DIR; + for (const entry of fs.readdirSync(memoryDir, { withFileTypes: true })) { + if (entry.name !== ".git" && entry.name !== "notes.json") { + fs.rmSync(path.join(memoryDir, entry.name), { recursive: true, force: true }); + } + } + EOF + - name: Fetch repo data for task weighting env: GH_TOKEN: ${{ github.token }}