mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-10-31 18:02:05 +00:00
Verify torch/src/ with lint
- Restore missing source files in `torch/src/` from `torch-lock` dependency. - Setup ESLint in `torch/`. - Fix linting issues in `src/lock-ops.mjs`, `src/lock-utils.mjs`, `src/ops.mjs`, `src/services/memory/embedder.js`. - Mark 'Verify with lint' as completed in `src/todo/TODO_2026-02-14T13-30-00Z.md`. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
8cdf1c523d
commit
22bb29f16f
67 files changed
+7105
-24
No files matched your search
@@ -0,0 +1,137 @@
|
||||
import { DEFAULT_DASHBOARD_PORT } from './constants.mjs';
|
||||
|
||||
/**
|
||||
* Parses command-line arguments into a structured object.
|
||||
*
|
||||
* @param {string[]} argv - Arguments from process.argv.slice(2)
|
||||
* @returns {Object} - Parsed arguments (command, flags, values)
|
||||
*/
|
||||
export function parseArgs(argv) {
|
||||
const args = {
|
||||
command: null,
|
||||
agent: null,
|
||||
cadence: null,
|
||||
json: false,
|
||||
jsonFile: null,
|
||||
quiet: false,
|
||||
dryRun: false,
|
||||
force: false,
|
||||
port: DEFAULT_DASHBOARD_PORT,
|
||||
host: null,
|
||||
logDir: 'task-logs',
|
||||
ignoreLogs: false,
|
||||
id: null,
|
||||
type: null,
|
||||
tags: [],
|
||||
pinned: null,
|
||||
limit: null,
|
||||
offset: null,
|
||||
retentionMs: null,
|
||||
windowMs: null,
|
||||
timeoutMs: null,
|
||||
allRelaysDownMinutes: null,
|
||||
minSuccessRate: null,
|
||||
windowMinutes: null,
|
||||
platform: null,
|
||||
model: null,
|
||||
};
|
||||
let i = 0;
|
||||
|
||||
if (argv.length > 0 && !argv[0].startsWith('-')) {
|
||||
args.command = argv[0];
|
||||
i = 1;
|
||||
}
|
||||
|
||||
for (; i < argv.length; i++) {
|
||||
const arg = argv[i];
|
||||
if (arg === '--agent' || arg === '-a') {
|
||||
args.agent = argv[++i];
|
||||
} else if (arg === '--cadence' || arg === '-c') {
|
||||
args.cadence = argv[++i];
|
||||
} else if (arg === '--json') {
|
||||
args.json = true;
|
||||
} else if (arg === '--json-file') {
|
||||
args.jsonFile = argv[++i];
|
||||
} else if (arg.startsWith('--json-file=')) {
|
||||
args.jsonFile = arg.split('=')[1];
|
||||
} else if (arg === '--quiet') {
|
||||
args.quiet = true;
|
||||
} else if (arg.startsWith('--agent=')) {
|
||||
args.agent = arg.split('=')[1];
|
||||
} else if (arg.startsWith('--cadence=')) {
|
||||
args.cadence = arg.split('=')[1];
|
||||
} else if (arg === '--dry-run') {
|
||||
args.dryRun = true;
|
||||
} else if (arg === '--force') {
|
||||
args.force = true;
|
||||
} else if (arg === '--port') {
|
||||
args.port = parseInt(argv[++i], 10) || DEFAULT_DASHBOARD_PORT;
|
||||
} else if (arg === '--host') {
|
||||
args.host = argv[++i];
|
||||
} else if (arg === '--log-dir') {
|
||||
args.logDir = argv[++i];
|
||||
} else if (arg === '--ignore-logs') {
|
||||
args.ignoreLogs = true;
|
||||
} else if (arg === '--id') {
|
||||
args.id = argv[++i];
|
||||
} else if (arg.startsWith('--id=')) {
|
||||
args.id = arg.split('=')[1];
|
||||
} else if (arg === '--type') {
|
||||
args.type = argv[++i];
|
||||
} else if (arg.startsWith('--type=')) {
|
||||
args.type = arg.split('=')[1];
|
||||
} else if (arg === '--tags') {
|
||||
args.tags = String(argv[++i]).split(',').map((tag) => tag.trim()).filter(Boolean);
|
||||
} else if (arg.startsWith('--tags=')) {
|
||||
args.tags = String(arg.split('=')[1]).split(',').map((tag) => tag.trim()).filter(Boolean);
|
||||
} else if (arg === '--pinned') {
|
||||
const value = String(argv[++i]).toLowerCase();
|
||||
args.pinned = value === 'true' ? true : value === 'false' ? false : null;
|
||||
} else if (arg.startsWith('--pinned=')) {
|
||||
const value = String(arg.split('=')[1]).toLowerCase();
|
||||
args.pinned = value === 'true' ? true : value === 'false' ? false : null;
|
||||
} else if (arg === '--limit') {
|
||||
args.limit = parseInt(argv[++i], 10);
|
||||
} else if (arg.startsWith('--limit=')) {
|
||||
args.limit = parseInt(arg.split('=')[1], 10);
|
||||
} else if (arg === '--offset') {
|
||||
args.offset = parseInt(argv[++i], 10);
|
||||
} else if (arg.startsWith('--offset=')) {
|
||||
args.offset = parseInt(arg.split('=')[1], 10);
|
||||
} else if (arg === '--retention-ms') {
|
||||
args.retentionMs = parseInt(argv[++i], 10);
|
||||
} else if (arg.startsWith('--retention-ms=')) {
|
||||
args.retentionMs = parseInt(arg.split('=')[1], 10);
|
||||
} else if (arg === '--window-ms') {
|
||||
args.windowMs = parseInt(argv[++i], 10);
|
||||
} else if (arg.startsWith('--window-ms=')) {
|
||||
args.windowMs = parseInt(arg.split('=')[1], 10);
|
||||
} else if (arg === '--timeout-ms') {
|
||||
args.timeoutMs = parseInt(argv[++i], 10);
|
||||
} else if (arg.startsWith('--timeout-ms=')) {
|
||||
args.timeoutMs = parseInt(arg.split('=')[1], 10);
|
||||
} else if (arg === '--all-relays-down-minutes') {
|
||||
args.allRelaysDownMinutes = parseInt(argv[++i], 10);
|
||||
} else if (arg.startsWith('--all-relays-down-minutes=')) {
|
||||
args.allRelaysDownMinutes = parseInt(arg.split('=')[1], 10);
|
||||
} else if (arg === '--min-success-rate') {
|
||||
args.minSuccessRate = parseFloat(argv[++i]);
|
||||
} else if (arg.startsWith('--min-success-rate=')) {
|
||||
args.minSuccessRate = parseFloat(arg.split('=')[1]);
|
||||
} else if (arg === '--window-minutes') {
|
||||
args.windowMinutes = parseInt(argv[++i], 10);
|
||||
} else if (arg.startsWith('--window-minutes=')) {
|
||||
args.windowMinutes = parseInt(arg.split('=')[1], 10);
|
||||
} else if (arg === '--platform') {
|
||||
args.platform = argv[++i];
|
||||
} else if (arg.startsWith('--platform=')) {
|
||||
args.platform = arg.split('=')[1];
|
||||
} else if (arg === '--model') {
|
||||
args.model = argv[++i];
|
||||
} else if (arg.startsWith('--model=')) {
|
||||
args.model = arg.split('=')[1];
|
||||
}
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
Reference in new issue
Block a user