Files
orcs-code/src/commands/plugin/ValidatePlugin.tsx
anandh8x bd8d0ef0fa Remove embedded source map directives from tracked sources
Inline base64 source maps had been checked into tracked src files. This strips those comments from the repository without changing runtime behavior or adding ongoing guardrails, per the requested one-time cleanup scope.

Constraint: Keep this change limited to tracked source cleanup only
Rejected: Add CI/source verification guard | user requested one-time cleanup only
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: If these directives reappear, fix the producing transform instead of reintroducing repo-side cleanup code
Tested: rg -n "sourceMappingURL" ., bun run smoke, bun run verify:privacy, bun run test:provider, npm run test:provider-recommendation
Not-tested: bun run typecheck (repository has many pre-existing unrelated failures)
2026-04-04 13:38:49 +05:30

98 lines
3.4 KiB
TypeScript

import { c as _c } from "react-compiler-runtime";
import figures from 'figures';
import * as React from 'react';
import { useEffect } from 'react';
import { Box, Text } from '../../ink.js';
import { errorMessage } from '../../utils/errors.js';
import { logError } from '../../utils/log.js';
import { validateManifest } from '../../utils/plugins/validatePlugin.js';
import { plural } from '../../utils/stringUtils.js';
type Props = {
onComplete: (result?: string) => void;
path?: string;
};
export function ValidatePlugin(t0) {
const $ = _c(5);
const {
onComplete,
path
} = t0;
let t1;
let t2;
if ($[0] !== onComplete || $[1] !== path) {
t1 = () => {
const runValidation = async function runValidation() {
if (!path) {
onComplete("Usage: /plugin validate <path>\n\nValidate a plugin or marketplace manifest file or directory.\n\nExamples:\n /plugin validate .claude-plugin/plugin.json\n /plugin validate /path/to/plugin-directory\n /plugin validate .\n\nWhen given a directory, automatically validates .claude-plugin/marketplace.json\nor .claude-plugin/plugin.json (prefers marketplace if both exist).\n\nOr from the command line:\n claude plugin validate <path>");
return;
}
;
try {
const result = await validateManifest(path);
let output = "";
output = output + `Validating ${result.fileType} manifest: ${result.filePath}\n\n`;
output;
if (result.errors.length > 0) {
output = output + `${figures.cross} Found ${result.errors.length} ${plural(result.errors.length, "error")}:\n\n`;
output;
result.errors.forEach(error_0 => {
output = output + ` ${figures.pointer} ${error_0.path}: ${error_0.message}\n`;
output;
});
output = output + "\n";
output;
}
if (result.warnings.length > 0) {
output = output + `${figures.warning} Found ${result.warnings.length} ${plural(result.warnings.length, "warning")}:\n\n`;
output;
result.warnings.forEach(warning => {
output = output + ` ${figures.pointer} ${warning.path}: ${warning.message}\n`;
output;
});
output = output + "\n";
output;
}
if (result.success) {
if (result.warnings.length > 0) {
output = output + `${figures.tick} Validation passed with warnings\n`;
output;
} else {
output = output + `${figures.tick} Validation passed\n`;
output;
}
process.exitCode = 0;
} else {
output = output + `${figures.cross} Validation failed\n`;
output;
process.exitCode = 1;
}
onComplete(output);
} catch (t3) {
const error = t3;
process.exitCode = 2;
logError(error);
onComplete(`${figures.cross} Unexpected error during validation: ${errorMessage(error)}`);
}
};
runValidation();
};
t2 = [onComplete, path];
$[0] = onComplete;
$[1] = path;
$[2] = t1;
$[3] = t2;
} else {
t1 = $[2];
t2 = $[3];
}
useEffect(t1, t2);
let t3;
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
t3 = <Box flexDirection="column"><Text>Running validation...</Text></Box>;
$[4] = t3;
} else {
t3 = $[4];
}
return t3;
}