MCPcopy Index your code
hub / github.com/BuilderIO/agent-native / isValidProjectPath

Function isValidProjectPath

packages/core/src/scripts/utils.ts:74–82  ·  view source on GitHub ↗
(project: string)

Source from the content-addressed store, hash-verified

72 * Validate a project slug (e.g. "my-project" or "group/my-project").
73 */
74export function isValidProjectPath(project: string): boolean {
75 if (!project) return false;
76 const normalized = path.posix.normalize(project);
77 if (normalized.startsWith("..") || path.isAbsolute(normalized)) return false;
78 if (normalized.includes("\0")) return false;
79 const segments = normalized.split("/").filter(Boolean);
80 if (!segments.length) return false;
81 return segments.every((s) => /^[a-z0-9][a-z0-9-]*$/.test(s));
82}
83
84/**
85 * mkdir -p helper.

Callers 1

utils.spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected