feat(core,cli): harden install engine and extend skill lint and interview eval
- update only touches the recorded project root; project installs do not follow symlinks or junctions; repeated --force rotates .orig backups; uninstall never deletes outside the recorded root - run npm/npx without a shell on Windows and pin optional tool versions - skip the update check in CI and non-interactive output - lint: cross-document section pointers, preflight row ids, gate rule numbers, per-document size budgets, gate copy equality - eval: scenarios S19-S21, route and read-cost rejudging, interpretation card judging, temp-dir previews and table-form cards no longer fail
This commit is contained in:
parent
ee3bef2ce5
commit
9bcb45cbd3
122 changed files with 5836 additions and 831 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import {
|
||||
applyPlan,
|
||||
planInstall,
|
||||
type EnvOptions,
|
||||
samePath,
|
||||
tildify,
|
||||
type Scope,
|
||||
type TargetId,
|
||||
|
|
@ -14,6 +16,13 @@ export interface InstallOptions {
|
|||
force?: boolean;
|
||||
/** 실제로 쓰지 않고 계획만 출력 */
|
||||
dryRun?: boolean;
|
||||
/**
|
||||
* 계획 기준 디렉터리. update 가 기록의 프로젝트·홈을 그대로 넘긴다 — 없으면 cwd·홈.
|
||||
* 실측 사고: 이걸 넘기지 않아 project 설치가 update 를 실행한 cwd 에 다시 깔렸다.
|
||||
*/
|
||||
env?: EnvOptions;
|
||||
/** 계획한 root 가 이 경로와 다르면 쓰지 않는다(update 의 방어선) */
|
||||
expectRoot?: string;
|
||||
}
|
||||
|
||||
export interface InstallOutcome {
|
||||
|
|
@ -21,6 +30,8 @@ export interface InstallOutcome {
|
|||
root: string;
|
||||
written: number;
|
||||
skipped: string[];
|
||||
/** 덮기 전에 남긴 백업(.orig) */
|
||||
backedUp?: string[];
|
||||
blocked?: string;
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +41,10 @@ export async function runInstall(opts: InstallOptions): Promise<InstallOutcome[]
|
|||
const outcomes: InstallOutcome[] = [];
|
||||
|
||||
for (const target of opts.targets) {
|
||||
const plan = await planInstall(target, opts.scope, skill);
|
||||
const plan = await planInstall(target, opts.scope, skill, opts.env);
|
||||
if (!plan.blocked && opts.expectRoot !== undefined && !samePath(plan.root, opts.expectRoot)) {
|
||||
plan.blocked = `계획한 위치(${tildify(plan.root)})가 설치 기록(${tildify(opts.expectRoot)})과 다릅니다`;
|
||||
}
|
||||
if (plan.blocked) {
|
||||
outcomes.push({ target, root: "", written: 0, skipped: [], blocked: plan.blocked });
|
||||
continue;
|
||||
|
|
@ -39,12 +53,21 @@ export async function runInstall(opts: InstallOptions): Promise<InstallOutcome[]
|
|||
outcomes.push({ target, root: plan.root, written: plan.actions.length, skipped: [] });
|
||||
continue;
|
||||
}
|
||||
const res = await applyPlan(plan, skill.version, { force: opts.force });
|
||||
let res;
|
||||
try {
|
||||
res = await applyPlan(plan, skill.version, { force: opts.force, expectRoot: opts.expectRoot });
|
||||
} catch (err) {
|
||||
// 링크 거부·꼬인 마커 등은 이 대상만 막고 다른 대상은 계속 진행한다
|
||||
const msg = err instanceof Error ? err.message : String(err);
|
||||
outcomes.push({ target, root: plan.root, written: 0, skipped: [], blocked: msg });
|
||||
continue;
|
||||
}
|
||||
outcomes.push({
|
||||
target,
|
||||
root: plan.root,
|
||||
written: res.written.length,
|
||||
skipped: res.skipped,
|
||||
backedUp: res.backedUp,
|
||||
});
|
||||
}
|
||||
return outcomes;
|
||||
|
|
@ -63,6 +86,10 @@ export function printOutcomes(outcomes: InstallOutcome[], dryRun = false): void
|
|||
console.log(warn(` 직접 수정하신 파일이라 그대로 두었습니다 (--force 로 덮어쓸 수 있습니다):`));
|
||||
for (const s of fold(o.skipped)) console.log(dim(` ${tildify(s)}`));
|
||||
}
|
||||
if (o.backedUp && o.backedUp.length > 0) {
|
||||
console.log(warn(` 기존 파일을 덮기 전에 백업해 두었습니다:`));
|
||||
for (const b of fold(o.backedUp)) console.log(dim(` ${tildify(b)}`));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue