@c-d-cc/reap 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +113 -14
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9817,7 +9817,7 @@ async function initProject(projectRoot, projectName, entryMode, preset, onProgre
|
|
|
9817
9817
|
log("GitHub CLI(gh) not found. Install from https://cli.github.com for auto issue reporting.");
|
|
9818
9818
|
}
|
|
9819
9819
|
const config = {
|
|
9820
|
-
version: "0.1
|
|
9820
|
+
version: "0.10.1",
|
|
9821
9821
|
project: projectName,
|
|
9822
9822
|
entryMode,
|
|
9823
9823
|
autoUpdate: true,
|
|
@@ -10758,6 +10758,98 @@ async function migrateLineage(paths) {
|
|
|
10758
10758
|
return result;
|
|
10759
10759
|
}
|
|
10760
10760
|
|
|
10761
|
+
// src/core/migrations/0.0.0-to-0.10.0.ts
|
|
10762
|
+
var migration_0_0_0_to_0_10_0 = {
|
|
10763
|
+
fromVersion: "0.0.0",
|
|
10764
|
+
toVersion: "0.10.0",
|
|
10765
|
+
description: "Lineage DAG migration — legacy gen-NNN directories to gen-NNN-HASH format",
|
|
10766
|
+
async check(paths) {
|
|
10767
|
+
return needsMigration(paths);
|
|
10768
|
+
},
|
|
10769
|
+
async up(paths) {
|
|
10770
|
+
const result = await migrateLineage(paths);
|
|
10771
|
+
const messages = [];
|
|
10772
|
+
for (const m of result.migrated) {
|
|
10773
|
+
messages.push(`[lineage] ${m}`);
|
|
10774
|
+
}
|
|
10775
|
+
if (result.errors.length > 0) {
|
|
10776
|
+
throw new Error(`Lineage migration errors: ${result.errors.join("; ")}`);
|
|
10777
|
+
}
|
|
10778
|
+
return messages;
|
|
10779
|
+
}
|
|
10780
|
+
};
|
|
10781
|
+
|
|
10782
|
+
// src/core/migrations/index.ts
|
|
10783
|
+
var MIGRATIONS = [
|
|
10784
|
+
migration_0_0_0_to_0_10_0
|
|
10785
|
+
];
|
|
10786
|
+
function compareSemver(a, b) {
|
|
10787
|
+
const pa = a.split(".").map(Number);
|
|
10788
|
+
const pb = b.split(".").map(Number);
|
|
10789
|
+
for (let i = 0;i < 3; i++) {
|
|
10790
|
+
const na = pa[i] ?? 0;
|
|
10791
|
+
const nb = pb[i] ?? 0;
|
|
10792
|
+
if (na < nb)
|
|
10793
|
+
return -1;
|
|
10794
|
+
if (na > nb)
|
|
10795
|
+
return 1;
|
|
10796
|
+
}
|
|
10797
|
+
return 0;
|
|
10798
|
+
}
|
|
10799
|
+
function normalizeVersion(version) {
|
|
10800
|
+
if (!version)
|
|
10801
|
+
return "0.0.0";
|
|
10802
|
+
if (version === "0.1.0")
|
|
10803
|
+
return "0.0.0";
|
|
10804
|
+
return version.replace(/\+.*$/, "");
|
|
10805
|
+
}
|
|
10806
|
+
|
|
10807
|
+
class MigrationRunner {
|
|
10808
|
+
static async run(paths, currentPackageVersion, dryRun = false) {
|
|
10809
|
+
const config = await ConfigManager.read(paths);
|
|
10810
|
+
const configVersion = normalizeVersion(config.version);
|
|
10811
|
+
const targetVersion = normalizeVersion(currentPackageVersion);
|
|
10812
|
+
const result = {
|
|
10813
|
+
migrated: [],
|
|
10814
|
+
skipped: [],
|
|
10815
|
+
errors: [],
|
|
10816
|
+
fromVersion: configVersion,
|
|
10817
|
+
toVersion: targetVersion
|
|
10818
|
+
};
|
|
10819
|
+
if (compareSemver(configVersion, targetVersion) >= 0) {
|
|
10820
|
+
return result;
|
|
10821
|
+
}
|
|
10822
|
+
const applicable = MIGRATIONS.filter((m) => compareSemver(configVersion, m.toVersion) < 0).filter((m) => compareSemver(m.toVersion, targetVersion) <= 0).sort((a, b) => compareSemver(a.toVersion, b.toVersion));
|
|
10823
|
+
for (const migration of applicable) {
|
|
10824
|
+
const needs = await migration.check(paths);
|
|
10825
|
+
if (!needs) {
|
|
10826
|
+
result.skipped.push(migration.description);
|
|
10827
|
+
continue;
|
|
10828
|
+
}
|
|
10829
|
+
if (dryRun) {
|
|
10830
|
+
result.migrated.push(`[dry-run] ${migration.description}`);
|
|
10831
|
+
continue;
|
|
10832
|
+
}
|
|
10833
|
+
try {
|
|
10834
|
+
const messages = await migration.up(paths);
|
|
10835
|
+
result.migrated.push(...messages);
|
|
10836
|
+
} catch (err) {
|
|
10837
|
+
const errorMsg = `${migration.description}: ${err instanceof Error ? err.message : String(err)}`;
|
|
10838
|
+
result.errors.push(errorMsg);
|
|
10839
|
+
break;
|
|
10840
|
+
}
|
|
10841
|
+
}
|
|
10842
|
+
if (result.errors.length === 0 && !dryRun) {
|
|
10843
|
+
config.version = currentPackageVersion;
|
|
10844
|
+
await ConfigManager.write(paths, config);
|
|
10845
|
+
}
|
|
10846
|
+
return result;
|
|
10847
|
+
}
|
|
10848
|
+
static getMigrations() {
|
|
10849
|
+
return MIGRATIONS;
|
|
10850
|
+
}
|
|
10851
|
+
}
|
|
10852
|
+
|
|
10761
10853
|
// src/cli/commands/update.ts
|
|
10762
10854
|
function selfUpgrade() {
|
|
10763
10855
|
try {
|
|
@@ -10900,18 +10992,25 @@ async function updateProject(projectRoot, dryRun = false) {
|
|
|
10900
10992
|
result.skipped.push(`.claude/commands/ (${reapCmdFiles.length} unchanged)`);
|
|
10901
10993
|
}
|
|
10902
10994
|
await migrateLegacyFiles(paths, dryRun, result);
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10995
|
+
const currentVersion = "0.10.1";
|
|
10996
|
+
const migrationResult = await MigrationRunner.run(paths, currentVersion, dryRun);
|
|
10997
|
+
for (const m of migrationResult.migrated) {
|
|
10998
|
+
result.updated.push(`[migration] ${m}`);
|
|
10999
|
+
}
|
|
11000
|
+
for (const s of migrationResult.skipped) {
|
|
11001
|
+
result.skipped.push(`[migration] ${s}`);
|
|
11002
|
+
}
|
|
11003
|
+
for (const e of migrationResult.errors) {
|
|
11004
|
+
result.removed.push(`[migration error] ${e}`);
|
|
11005
|
+
}
|
|
11006
|
+
if (migrationResult.errors.length > 0 && config?.autoIssueReport) {
|
|
11007
|
+
try {
|
|
11008
|
+
const { execSync: execSync3 } = await import("child_process");
|
|
11009
|
+
const errorSummary = migrationResult.errors.join("\\n");
|
|
11010
|
+
const title = `Migration failure: ${migrationResult.fromVersion} → ${migrationResult.toVersion}`;
|
|
11011
|
+
const body = `## Migration Error\\n\\nFrom: ${migrationResult.fromVersion}\\nTo: ${migrationResult.toVersion}\\n\\n### Errors\\n\\n${errorSummary}`;
|
|
11012
|
+
execSync3(`gh issue create --repo c-d-cc/reap --title "${title}" --label "auto-reported,migration" --body "${body}"`, { encoding: "utf-8", timeout: 15000, stdio: "pipe" });
|
|
11013
|
+
} catch {}
|
|
10915
11014
|
}
|
|
10916
11015
|
}
|
|
10917
11016
|
return result;
|
|
@@ -11070,7 +11169,7 @@ async function fixProject(projectRoot) {
|
|
|
11070
11169
|
// src/cli/index.ts
|
|
11071
11170
|
init_fs();
|
|
11072
11171
|
import { join as join12 } from "path";
|
|
11073
|
-
program.name("reap").description("REAP — Recursive Evolutionary Autonomous Pipeline").version("0.10.
|
|
11172
|
+
program.name("reap").description("REAP — Recursive Evolutionary Autonomous Pipeline").version("0.10.1");
|
|
11074
11173
|
program.command("init").description("Initialize a new REAP project (Genesis)").argument("[project-name]", "Project name (defaults to current directory name)").option("-m, --mode <mode>", "Entry mode: greenfield, migration, adoption", "greenfield").option("-p, --preset <preset>", "Bootstrap with a genome preset (e.g., bun-hono-react)").action(async (projectName, options) => {
|
|
11075
11174
|
try {
|
|
11076
11175
|
const cwd = process.cwd();
|