feat(abut): 교대 복합명(A1-완도 등)과 가져오기 문제 목록

교대 이름을 전체 명칭으로 해석하고, 엑셀 가져오기 문제를 목록으로 모은다.
교각 이름과의 중복을 저장 파일 검사에서도 막는다(checkStoredAbutments).
검사 스크립트 verify-abut-names · verify-abut-workflow 포함.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
ypshimandClaude Haiku 5.5 committed 2026-11-06 13:14:53 +09:00
1 parent 0c23173a1a
commit 3922b330d5
8 files changed
+610 -13

No files matched your search

+12 -4
View File
@@ -2,6 +2,7 @@ import type { FckByMember, Material } from './rebar/common';
import { checkStoredGroundModel, type GroundModelFile } from './ground-model';
import type { PierInput } from './types';
import type { AbutRecord } from './abut/parse';
import { abutNameError } from './abut/name';
import { normalizeBearingAzimuths } from './coordinate-frame';
/** Project file schema (spec §8). Bump only with a migration. */
@@ -74,8 +75,9 @@ export function parseProject(text: string): ProjectFile {
}
}
if (obj.groundModel !== undefined) checkStoredGroundModel(obj.groundModel);
if (obj.abutments !== undefined) checkStoredAbutments(obj.abutments);
if (obj.abutDefaults !== undefined) checkStoredAbutments(obj.abutDefaults);
const pierNames = obj.piers.map((p) => p?.input?.name).filter((name): name is string => typeof name === 'string');
if (obj.abutments !== undefined) checkStoredAbutments(obj.abutments, pierNames);
if (obj.abutDefaults !== undefined) checkStoredAbutments(obj.abutDefaults, pierNames);
obj.piers.forEach((p, i) => {
if (!p || typeof p.id !== 'string' || !p.input) throw new Error(`교각 ${i + 1}: id 또는 input이 없습니다.`);
const input = p.input;
@@ -111,11 +113,17 @@ const finite = (v: unknown) => typeof v === 'number' && Number.isFinite(v);
const isPoint = (v: unknown) => !!v && typeof v === 'object' && finite((v as { e?: unknown }).e) && finite((v as { n?: unknown }).n);
/** 교대 기록 check (AB): refuses a damaged abutment record with a message that names it. */
export function checkStoredAbutments(list: unknown): void {
export function checkStoredAbutments(list: unknown, reservedNames: readonly string[] = []): void {
if (!Array.isArray(list)) throw new Error('교대 목록 형식이 맞지 않습니다.');
const names = new Set(reservedNames.map((name) => name.trim()));
list.forEach((a: Partial<AbutRecord>, i) => {
const who = `교대 ${i + 1}(${String(a?.name)})`;
if (!a || typeof a.name !== 'string' || !/^A\d+$/.test(a.name)) throw new Error(`${who}: 교대명이 맞지 않습니다.`);
const nameError = abutNameError(a?.name);
if (nameError) throw new Error(`${who}: ${nameError}`);
const name = a.name!.trim();
if (names.has(name)) throw new Error(`${who}: 구조물명 "${name}"이 중복되었습니다.`);
names.add(name);
a.name = name;
if (a.type !== 'A1' && a.type !== 'A2') throw new Error(`${who}: 형식은 A1 또는 A2여야 합니다.`);
for (const key of ['seatEl', 'foundationBottomEl', 'groundEl', 'pileLengthMm', 'skewDeg', 'slopeI'] as const) {
if (!finite(a[key])) throw new Error(`${who}: ${key} 값이 맞지 않습니다.`);