recon-generate 0.0.37 → 0.0.38
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/index.js +26 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43,6 +43,7 @@ const coverage_1 = require("./coverage");
|
|
|
43
43
|
const pathsGenerator_1 = require("./pathsGenerator");
|
|
44
44
|
const info_1 = require("./info");
|
|
45
45
|
const utils_1 = require("./utils");
|
|
46
|
+
const fs = __importStar(require("fs"));
|
|
46
47
|
const link_1 = require("./link");
|
|
47
48
|
const link2_1 = require("./link2");
|
|
48
49
|
const sourcemap_1 = require("./sourcemap");
|
|
@@ -133,7 +134,8 @@ async function main() {
|
|
|
133
134
|
.option('--list', 'List available contracts/functions (after filters) and exit')
|
|
134
135
|
.option('--force', 'Replace existing generated suite output (under --output). Does not rebuild .recon/out.')
|
|
135
136
|
.option('--force-build', 'Delete .recon/out to force a fresh forge build before generating')
|
|
136
|
-
.option('--foundry-config <path>', 'Path to foundry.toml (defaults to ./foundry.toml)')
|
|
137
|
+
.option('--foundry-config <path>', 'Path to foundry.toml (defaults to ./foundry.toml)')
|
|
138
|
+
.option('--scaffold <path>', 'Path to contracts-to-scaffold.json (Scout V2 output)');
|
|
137
139
|
program
|
|
138
140
|
.command('coverage')
|
|
139
141
|
.description('Generate recon-coverage.json from a Crytic tester contract without scaffolding tests')
|
|
@@ -354,6 +356,29 @@ async function main() {
|
|
|
354
356
|
const foundryConfigPath = (0, utils_1.getFoundryConfigPath)(workspaceRoot, opts.foundryConfig);
|
|
355
357
|
const foundryRoot = path.dirname(foundryConfigPath);
|
|
356
358
|
const forgeConfig = await (0, utils_1.getFoundryConfig)(foundryRoot);
|
|
359
|
+
// Scout V2: load contracts-to-scaffold.json and merge into include/mock filters
|
|
360
|
+
if (opts.scaffold) {
|
|
361
|
+
const scaffoldPath = path.isAbsolute(opts.scaffold)
|
|
362
|
+
? opts.scaffold
|
|
363
|
+
: path.resolve(workspaceRoot, opts.scaffold);
|
|
364
|
+
try {
|
|
365
|
+
const scaffoldData = JSON.parse(fs.readFileSync(scaffoldPath, 'utf-8'));
|
|
366
|
+
const sourceContracts = scaffoldData.source_contracts || [];
|
|
367
|
+
const mockedContracts = scaffoldData.mocked_contracts || [];
|
|
368
|
+
if (sourceContracts.length) {
|
|
369
|
+
const existing = opts.include || '';
|
|
370
|
+
opts.include = [existing, sourceContracts.join(',')].filter(Boolean).join(',');
|
|
371
|
+
}
|
|
372
|
+
if (mockedContracts.length) {
|
|
373
|
+
const existing = opts.mock || '';
|
|
374
|
+
opts.mock = [existing, mockedContracts.join(',')].filter(Boolean).join(',');
|
|
375
|
+
}
|
|
376
|
+
console.log(`Scout V2: loaded ${sourceContracts.length} source + ${mockedContracts.length} mock contracts from ${opts.scaffold}`);
|
|
377
|
+
}
|
|
378
|
+
catch (err) {
|
|
379
|
+
console.error(`Scout V2: failed to load scaffold file ${opts.scaffold}: ${err.message}`);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
357
382
|
const includeFilter = parseFilter(opts.include);
|
|
358
383
|
const excludeFilter = parseFilter(opts.exclude);
|
|
359
384
|
const adminFilter = parseFilter(opts.admin);
|