MCPcopy
hub / github.com/opentrace/opentrace / parseManifest

Function parseManifest

ui/src/components/pipeline/parser/manifestParser.ts:61–83  ·  view source on GitHub ↗
(
  path: string,
  content: string,
)

Source from the content-addressed store, hash-verified

59
60/** Dispatch to the correct parser based on filename. */
61export function parseManifest(
62 path: string,
63 content: string,
64): ManifestParseResult {
65 const basename = path.split('/').pop() ?? '';
66 switch (basename) {
67 case 'package.json':
68 return parsePackageJson(content, path);
69 case 'go.mod':
70 return parseGoMod(content, path);
71 case 'requirements.txt':
72 return parseRequirementsTxt(content, path);
73 case 'pyproject.toml':
74 return parsePyprojectToml(content, path);
75 case 'Cargo.toml':
76 return parseCargoToml(content, path);
77 default:
78 return {
79 dependencies: [],
80 errors: [`Unsupported manifest: ${basename}`],
81 };
82 }
83}
84
85/** Deterministic package ID: pkg:{registry}:{name} */
86export function packageId(registry: string, name: string): string {

Callers 2

executeFunction · 0.90

Calls 5

parsePackageJsonFunction · 0.85
parseGoModFunction · 0.85
parseRequirementsTxtFunction · 0.85
parsePyprojectTomlFunction · 0.85
parseCargoTomlFunction · 0.85

Tested by

no test coverage detected