(spec)
| 70 | } |
| 71 | |
| 72 | function validateProjectSpec(spec) { |
| 73 | const errors = []; |
| 74 | |
| 75 | if (!spec || typeof spec !== 'object') { |
| 76 | return ['Project spec must be an object']; |
| 77 | } |
| 78 | if (spec.version !== PROJECT_SPEC_VERSION) { |
| 79 | errors.push(`Unsupported project spec version: ${spec.version}`); |
| 80 | } |
| 81 | if (!spec.project || typeof spec.project !== 'object') { |
| 82 | errors.push('Project spec missing project metadata'); |
| 83 | } else { |
| 84 | if (!spec.project.name) errors.push('Project spec missing project name'); |
| 85 | if (!spec.project.summary) errors.push('Project spec missing project summary'); |
| 86 | } |
| 87 | |
| 88 | for (const field of ['conventions', 'workflows', 'constraints']) { |
| 89 | if (!Array.isArray(spec[field])) { |
| 90 | errors.push(`Project spec field must be an array: ${field}`); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | return errors; |
| 95 | } |
| 96 | |
| 97 | function resolveProjectSpecPath(projectRoot, explicitPath) { |
| 98 | if (explicitPath) return path.resolve(explicitPath); |
no outgoing calls
no test coverage detected