INNER CODE UNIT · JavaScript
m
entropy-cloud/nop-entropy · tools/mission-driver/src/main.js:217
const m = clean.match(/<MISSION_FILE>\s*([^\s<]+)\s*<\/MISSION_FILE>/i);
if (m && m[1]) {
const file = m[1].trim();
try {
const mission = JSON.parse(readFileSync(file, "utf8"));
if (mission && typeof mission === "object") {
out.missionFile = file;
out.missionName = mission.name || basenameNoExt(file);
out.roadmapPath = mission.roadmapPath || null;
// WI3 (draft-robustness-design §4.3.3): warn when the resolved
// mission.json lands outside the expected missionsDir — usually a
// projectRoot / cwd mismatch that splits artifacts across two roots.
// Uses path.relative + startsWith("..") rather than string
// startsWith to avoid /foo/bar vs /foo/barbaz prefix false positives
// and Windows drive-letter casing ambiguity. Warn-only: drafting
// from a sub-module is a legitimate use case (design §4.3.4).
if (missionsDir) {
const rel = relative(resolve(missionsDir), resolve(dirname(file)));