recon-generate 0.0.2
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/README.md +84 -0
- package/dist/generator.d.ts +52 -0
- package/dist/generator.js +512 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +169 -0
- package/dist/templateManager.d.ts +14 -0
- package/dist/templateManager.js +236 -0
- package/dist/templates/before-after.d.ts +1 -0
- package/dist/templates/before-after.js +37 -0
- package/dist/templates/crytic-tester.d.ts +1 -0
- package/dist/templates/crytic-tester.js +23 -0
- package/dist/templates/crytic-to-foundry.d.ts +1 -0
- package/dist/templates/crytic-to-foundry.js +32 -0
- package/dist/templates/echidna-config.d.ts +1 -0
- package/dist/templates/echidna-config.js +20 -0
- package/dist/templates/halmos-config.d.ts +1 -0
- package/dist/templates/halmos-config.js +14 -0
- package/dist/templates/handlebars-helpers.d.ts +2 -0
- package/dist/templates/handlebars-helpers.js +142 -0
- package/dist/templates/index.d.ts +14 -0
- package/dist/templates/index.js +29 -0
- package/dist/templates/medusa-config.d.ts +1 -0
- package/dist/templates/medusa-config.js +112 -0
- package/dist/templates/properties.d.ts +1 -0
- package/dist/templates/properties.js +18 -0
- package/dist/templates/setup.d.ts +1 -0
- package/dist/templates/setup.js +55 -0
- package/dist/templates/target-functions.d.ts +1 -0
- package/dist/templates/target-functions.js +37 -0
- package/dist/templates/targets/admin-targets.d.ts +1 -0
- package/dist/templates/targets/admin-targets.js +33 -0
- package/dist/templates/targets/doomsday-targets.d.ts +1 -0
- package/dist/templates/targets/doomsday-targets.js +33 -0
- package/dist/templates/targets/managers-targets.d.ts +1 -0
- package/dist/templates/targets/managers-targets.js +61 -0
- package/dist/templates/targets/targets.d.ts +1 -0
- package/dist/templates/targets/targets.js +35 -0
- package/dist/types.d.ts +45 -0
- package/dist/types.js +14 -0
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +106 -0
- package/package.json +30 -0
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function fileExists(p: string): Promise<boolean>;
|
|
2
|
+
export declare function getFoundryConfigPath(workspaceRoot: string, override?: string): string;
|
|
3
|
+
export declare function findOutputDirectory(workspaceRoot: string, foundryConfigPath: string): Promise<string>;
|
|
4
|
+
export declare function findSrcDirectory(workspaceRoot: string, foundryConfigPath: string): Promise<string>;
|
|
5
|
+
export declare function getTestFolder(foundryRoot: string): Promise<string>;
|
|
6
|
+
export declare function stripAnsiCodes(text: string): string;
|
|
7
|
+
export declare function getEnvPath(): string;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.fileExists = fileExists;
|
|
37
|
+
exports.getFoundryConfigPath = getFoundryConfigPath;
|
|
38
|
+
exports.findOutputDirectory = findOutputDirectory;
|
|
39
|
+
exports.findSrcDirectory = findSrcDirectory;
|
|
40
|
+
exports.getTestFolder = getTestFolder;
|
|
41
|
+
exports.stripAnsiCodes = stripAnsiCodes;
|
|
42
|
+
exports.getEnvPath = getEnvPath;
|
|
43
|
+
const fs = __importStar(require("fs/promises"));
|
|
44
|
+
const path = __importStar(require("path"));
|
|
45
|
+
async function fileExists(p) {
|
|
46
|
+
try {
|
|
47
|
+
await fs.access(p);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function getFoundryConfigPath(workspaceRoot, override) {
|
|
55
|
+
const config = override || 'foundry.toml';
|
|
56
|
+
return path.isAbsolute(config) ? config : path.join(workspaceRoot, config);
|
|
57
|
+
}
|
|
58
|
+
async function findOutputDirectory(workspaceRoot, foundryConfigPath) {
|
|
59
|
+
try {
|
|
60
|
+
const configContent = await fs.readFile(foundryConfigPath, 'utf8');
|
|
61
|
+
const match = configContent.match(/out\s*=\s*["'](.+?)["']/);
|
|
62
|
+
if (match) {
|
|
63
|
+
const outPath = match[1];
|
|
64
|
+
return path.join(path.dirname(foundryConfigPath), outPath);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// ignore, use defaults
|
|
69
|
+
}
|
|
70
|
+
return path.join(path.dirname(foundryConfigPath), 'out');
|
|
71
|
+
}
|
|
72
|
+
async function findSrcDirectory(workspaceRoot, foundryConfigPath) {
|
|
73
|
+
try {
|
|
74
|
+
const configContent = await fs.readFile(foundryConfigPath, 'utf8');
|
|
75
|
+
const match = configContent.match(/src\s*=\s*["'](.+?)["']/);
|
|
76
|
+
if (match) {
|
|
77
|
+
return match[1];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// ignore
|
|
82
|
+
}
|
|
83
|
+
return 'src';
|
|
84
|
+
}
|
|
85
|
+
async function getTestFolder(foundryRoot) {
|
|
86
|
+
const testPaths = [
|
|
87
|
+
'test',
|
|
88
|
+
'tests',
|
|
89
|
+
'src/tests',
|
|
90
|
+
'src/test',
|
|
91
|
+
'contracts/tests',
|
|
92
|
+
'contracts/test'
|
|
93
|
+
];
|
|
94
|
+
for (const testPath of testPaths) {
|
|
95
|
+
if (await fileExists(path.join(foundryRoot, testPath))) {
|
|
96
|
+
return testPath;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return 'test';
|
|
100
|
+
}
|
|
101
|
+
function stripAnsiCodes(text) {
|
|
102
|
+
return text.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, '');
|
|
103
|
+
}
|
|
104
|
+
function getEnvPath() {
|
|
105
|
+
return process.env.PATH || '';
|
|
106
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "recon-generate",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "CLI to scaffold Recon fuzzing suite inside Foundry projects",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"recon-generate": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc -p .",
|
|
11
|
+
"prepare": "npm run build"
|
|
12
|
+
},
|
|
13
|
+
"license": "GPL-2.0",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE.md",
|
|
18
|
+
"package.json"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"abi-to-mock": "^1.0.4",
|
|
22
|
+
"case": "^1.6.3",
|
|
23
|
+
"commander": "^12.1.0",
|
|
24
|
+
"handlebars": "^4.7.8"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^24.0.4",
|
|
28
|
+
"typescript": "^5.8.3"
|
|
29
|
+
}
|
|
30
|
+
}
|