diff --git a/src/features/tech-log/adapters/static/public-content.ts b/src/features/tech-log/adapters/static/public-content.ts
index eda7293..270bd52 100644
--- a/src/features/tech-log/adapters/static/public-content.ts
+++ b/src/features/tech-log/adapters/static/public-content.ts
@@ -856,7 +856,7 @@ export const profile: Profile = {
},
{
title: "프로젝트 맥락으로 다시 연결합니다",
- description: "Case와 Reference, Question, Decision이 따로 흩어지지 않게 실제 작업과 연결합니다.",
+ description: "검증 기록과 적용 기준, 열린 질문, 설계 결정이 따로 흩어지지 않게 실제 작업과 연결합니다.",
},
],
currentProjectSlugs: ["backend-skeleton", "auth-lab"],
diff --git a/src/features/tech-log/presentation/public/pages/profile-page.tsx b/src/features/tech-log/presentation/public/pages/profile-page.tsx
index 84fdef5..70c94c4 100644
--- a/src/features/tech-log/presentation/public/pages/profile-page.tsx
+++ b/src/features/tech-log/presentation/public/pages/profile-page.tsx
@@ -19,7 +19,7 @@ const principles = [
{
title: "프로젝트 맥락으로 다시 연결합니다",
description:
- "Case와 Reference, Question, Decision이 따로 흩어지지 않게 실제 작업과 연결합니다.",
+ "검증 기록과 적용 기준, 열린 질문, 설계 결정이 따로 흩어지지 않게 실제 작업과 연결합니다.",
},
] as const;
diff --git a/src/features/tech-log/presentation/public/pages/projects-page.tsx b/src/features/tech-log/presentation/public/pages/projects-page.tsx
index 705e057..37fb127 100644
--- a/src/features/tech-log/presentation/public/pages/projects-page.tsx
+++ b/src/features/tech-log/presentation/public/pages/projects-page.tsx
@@ -23,7 +23,7 @@ export function ProjectsPage() {
Projects
프로젝트
- Case와 Reference, Question을 실제 설계 목표와 결정의 흐름으로 묶어
+ 검증 기록과 적용 기준, 열린 질문을 실제 설계 목표와 결정의 흐름으로 묶어
봅니다.
diff --git a/src/features/tech-log/presentation/shared/public-render/prose-text.tsx b/src/features/tech-log/presentation/shared/public-render/prose-text.tsx
index 534e22f..d7b1b57 100644
--- a/src/features/tech-log/presentation/shared/public-render/prose-text.tsx
+++ b/src/features/tech-log/presentation/shared/public-render/prose-text.tsx
@@ -25,7 +25,12 @@ function renderInlineCode(text: string, keyPrefix: string): ReactNode[] {
if (parts.length % 2 === 0) return [text];
return parts.map((part, index) =>
index % 2 === 1 ? (
- {part}
+ /*
+ 클래스를 붙인다. 인라인 코드 스타일이 `.document-body`·`.question-options`·`.code-block`
+ 세 곳에 따로 있었고, 그 어디에도 속하지 않는 자리 — 문서 머리말의 요약 — 에서는 코드가
+ 본문과 같은 19px 민무늬로 나왔다. 이 칸은 화면 어디에나 놓이므로 자기 이름을 갖는다.
+ */
+ {part}
) : (
{part}
),
diff --git a/src/features/tech-log/presentation/studio/components/case-fields.tsx b/src/features/tech-log/presentation/studio/components/case-fields.tsx
index 89dd5b2..6a01c3b 100644
--- a/src/features/tech-log/presentation/studio/components/case-fields.tsx
+++ b/src/features/tech-log/presentation/studio/components/case-fields.tsx
@@ -5,6 +5,7 @@ import type { Asset, AssetKind } from "../../../contracts/studio/contract.ts";
import { useStudioAssetGateway } from "../use-studio.ts";
import { AssetPicker, buildEvidenceDirective } from "./asset-picker.tsx";
import { AssetUploadDialog } from "./asset-upload-dialog.tsx";
+import { MarkdownToolbar } from "./markdown-toolbar.tsx";
import { FieldNotice, type FieldIssue } from "./field-issues.tsx";
type CaseInput = components["schemas"]["CaseInput"];
@@ -100,7 +101,7 @@ export function CaseFields({
-
+
update({ bodyMarkdown: next })} />
EVIDENCE
diff --git a/src/features/tech-log/presentation/studio/components/concept-fields.tsx b/src/features/tech-log/presentation/studio/components/concept-fields.tsx
index 399fed0..8c41cc4 100644
--- a/src/features/tech-log/presentation/studio/components/concept-fields.tsx
+++ b/src/features/tech-log/presentation/studio/components/concept-fields.tsx
@@ -5,6 +5,7 @@ import type { Asset, AssetKind } from "../../../contracts/studio/contract.ts";
import { useStudioAssetGateway } from "../use-studio.ts";
import { AssetPicker, buildEvidenceDirective } from "./asset-picker.tsx";
import { AssetUploadDialog } from "./asset-upload-dialog.tsx";
+import { MarkdownToolbar } from "./markdown-toolbar.tsx";
import { FieldNotice, type FieldIssue } from "./field-issues.tsx";
type ConceptInput = components["schemas"]["ConceptInput"];
@@ -89,7 +90,7 @@ export function ConceptFields({
CONCEPT
개념
-
+
update({ bodyMarkdown: next })} />
EVIDENCE
diff --git a/src/features/tech-log/presentation/studio/components/document-list.tsx b/src/features/tech-log/presentation/studio/components/document-list.tsx
index 22c29d3..e2d844f 100644
--- a/src/features/tech-log/presentation/studio/components/document-list.tsx
+++ b/src/features/tech-log/presentation/studio/components/document-list.tsx
@@ -182,7 +182,7 @@ export function DocumentList() {
WORKING COPIES
작업본
- 세션에 있는 Case, Reference, Question, Decision을 찾고 다음 작업으로 이동합니다.
+ 세션에 있는 검증 기록·동작 원리·적용 기준·열린 질문·설계 결정을 찾고 다음 작업으로 이동합니다.
diff --git a/src/features/tech-log/presentation/studio/components/home-focus-editor.tsx b/src/features/tech-log/presentation/studio/components/home-focus-editor.tsx
index a8a390e..ba54226 100644
--- a/src/features/tech-log/presentation/studio/components/home-focus-editor.tsx
+++ b/src/features/tech-log/presentation/studio/components/home-focus-editor.tsx
@@ -32,6 +32,8 @@ export function HomeFocusEditor() {
const [questionId, setQuestionId] = useState("");
const [decisionId, setDecisionId] = useState("");
const [projectQuestions, setProjectQuestions] = useState<{ id: string; label: string }[]>([]);
+ /** 고를 목록을 못 읽었다. 「없다」와 구분해야 작성자가 자기 글이 사라진 줄 알지 않는다. */
+ const [choicesFailed, setChoicesFailed] = useState(false);
const [projectDecisions, setProjectDecisions] = useState<{ id: string; label: string }[]>([]);
const [pending, setPending] = useState(false);
const [error, setError] = useState("");
@@ -106,10 +108,17 @@ export function HomeFocusEditor() {
setProjectDecisions(
decisionList.map((item) => ({ id: item.id, label: item.statement })),
);
+ setChoicesFailed(false);
} catch {
+ /*
+ 못 읽은 것과 없는 것은 다르다. 예전에는 둘 다 빈 배열이 되어 화면이 「이 프로젝트에
+ 열린 질문이 없습니다」라고 적었고 — 실제로는 넷이 있었다 — 작성자는 자기가 아직
+ 쓰지 않은 줄 알게 됐다. 거짓말을 하느니 못 읽었다고 말한다.
+ */
if (!cancelled) {
setProjectQuestions([]);
setProjectDecisions([]);
+ setChoicesFailed(true);
}
}
})();
@@ -227,7 +236,9 @@ export function HomeFocusEditor() {
{questions.length === 0 ? (
- {projectId
+ {choicesFailed
+ ? "열린 질문을 불러오지 못했습니다. 새로고침해 주세요."
+ : projectId
? "이 프로젝트에 열린 질문이 없습니다."
: "프로젝트를 먼저 고르세요."}
@@ -250,7 +261,9 @@ export function HomeFocusEditor() {
{decisions.length === 0 ? (
- {projectId
+ {choicesFailed
+ ? "결정을 불러오지 못했습니다. 새로고침해 주세요."
+ : projectId
? "이 프로젝트에 결정이 없습니다."
: "프로젝트를 먼저 고르세요."}
diff --git a/src/features/tech-log/presentation/studio/components/markdown-toolbar.tsx b/src/features/tech-log/presentation/studio/components/markdown-toolbar.tsx
new file mode 100644
index 0000000..d8057b6
--- /dev/null
+++ b/src/features/tech-log/presentation/studio/components/markdown-toolbar.tsx
@@ -0,0 +1,99 @@
+import { type RefObject } from "react";
+
+/**
+ * 본문 Markdown 위의 삽입 도구.
+ *
+ *
Markdown 을 쓰려면 문법을 외우고 있어야 했다. 코드 블록과 표는 특히 그래서, 주제 화면에
+ * 비교표를 두자고 정해 놓고도 그 표를 작성할 수단이 편집기에 없었다.
+ *
+ *
세 개만 둔다 — 코드·표·목록. 굵게나 기울임은 문법이 짧아 외우기 쉽고, 버튼을 늘리면 이
+ * 화면의 다른 목록들처럼 반복 버튼 더미가 된다. Asset 삽입은 이미 자기 버튼을 갖고 있다.
+ */
+export type MarkdownSnippet = {
+ label: string;
+ /** 커서 자리에 넣을 조각. 선택한 글이 있으면 `{selection}` 자리에 들어간다. */
+ template: string;
+ /** 넣은 뒤 커서를 둘 자리 — 조각 안에서 이 글자를 찾아 거기에 선택을 건다. */
+ placeholder?: string;
+};
+
+export const MARKDOWN_SNIPPETS: ReadonlyArray = [
+ {
+ label: "코드",
+ template: "```\n{selection}\n```",
+ placeholder: "{selection}",
+ },
+ {
+ label: "표",
+ // 머리글 한 줄과 본문 두 줄. 셋 이하면 표를 왜 쓰는지가 보이지 않는다.
+ template: "| 구분 | 값 | 비고 |\n| --- | --- | --- |\n| | | |\n| | | |",
+ },
+ {
+ label: "목록",
+ template: "- {selection}\n- \n- ",
+ placeholder: "{selection}",
+ },
+];
+
+/** 조각을 커서 자리에 넣는다. 앞뒤로 빈 줄을 지켜 블록이 문단에 붙지 않게 한다. */
+export function applySnippet(
+ textarea: HTMLTextAreaElement,
+ snippet: MarkdownSnippet,
+ commit: (next: string) => void,
+) {
+ const { selectionStart, selectionEnd, value } = textarea;
+ const selected = value.slice(selectionStart, selectionEnd);
+ const body = snippet.template.replaceAll("{selection}", selected);
+ const prefix = value.slice(0, selectionStart);
+ const suffix = value.slice(selectionEnd);
+ const before = prefix.length === 0 || prefix.endsWith("\n\n") ? prefix : `${prefix}\n\n`;
+ const after = suffix.startsWith("\n") ? suffix : `\n${suffix}`;
+ const next = `${before}${body}${after}`;
+ commit(next);
+
+ /*
+ 넣고 나서 커서를 조각 안으로 옮긴다. 그러지 않으면 작성자가 스크롤을 되짚어 방금 넣은
+ 자리를 눈으로 찾아야 한다. React 가 값을 다시 그린 뒤에 자리를 잡아야 하므로 한 틱 미룬다.
+ */
+ const caret = before.length + (selected.length > 0 ? body.length : firstBlank(body));
+ queueMicrotask(() => {
+ textarea.focus();
+ textarea.setSelectionRange(caret, caret);
+ });
+}
+
+/** 빈 조각을 넣었을 때 커서가 갈 자리 — 첫 빈 칸, 없으면 조각 끝. */
+function firstBlank(body: string): number {
+ const cell = body.indexOf("| |");
+ if (cell >= 0) return cell + 2;
+ const bullet = body.indexOf("- \n");
+ if (bullet >= 0) return bullet + 2;
+ const fence = body.indexOf("```\n");
+ return fence >= 0 ? fence + 4 : body.length;
+}
+
+export function MarkdownToolbar({
+ target,
+ onInsert,
+}: {
+ target: RefObject;
+ onInsert(next: string): void;
+}) {
+ return (
+
+ {MARKDOWN_SNIPPETS.map((snippet) => (
+
+ ))}
+
+ );
+}
diff --git a/src/features/tech-log/presentation/studio/components/relation-editor.tsx b/src/features/tech-log/presentation/studio/components/relation-editor.tsx
index fecdc10..698f0ac 100644
--- a/src/features/tech-log/presentation/studio/components/relation-editor.tsx
+++ b/src/features/tech-log/presentation/studio/components/relation-editor.tsx
@@ -1,15 +1,60 @@
import type { components } from "../../../contracts/studio/generated.ts";
import { createNewItemId } from "../../../domain/studio/local-id.ts";
+import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts";
type CatalogEntry = components["schemas"]["CatalogEntry"];
type RelationInput = components["schemas"]["RelationInput"];
+type RecordKind = components["schemas"]["RecordKind"];
function ordered(relations: RelationInput[]): RelationInput[] {
return relations.map((relation, order) => ({ ...relation, order }));
}
+/**
+ * 고를 수 있는 대상을 종류별로 묶는다.
+ *
+ *
평면 목록은 문서가 늘수록 나빠진다 — 25개일 때는 훑을 수 있었지만 49개가 되자 원하는 것을
+ * 찾으려면 목록 전체를 읽어야 한다. 종류는 이미 카탈로그가 알려 주고 있었고 화면만 버리고 있었다.
+ *
+ *
순서는 목록 화면과 같다. 프로젝트는 기록이 아니라 그릇이므로 맨 뒤에 둔다.
+ */
+const GROUP_ORDER: ReadonlyArray = [
+ "CASE",
+ "CONCEPT",
+ "REFERENCE",
+ "QUESTION",
+ "PROJECT_DECISION",
+ "PROJECT",
+];
+
+function groupLabel(kind: RecordKind | "PROJECT"): string {
+ return kind === "PROJECT" ? "프로젝트" : DOCUMENT_KIND_LABELS[kind];
+}
+
+function grouped(catalog: CatalogEntry[]) {
+ const buckets = new Map();
+ for (const entry of catalog) {
+ // 종류를 모르는 항목도 고를 수는 있어야 한다 — 묶음 없이 맨 뒤에 남긴다.
+ const key = entry.kind ?? "";
+ const bucket = buckets.get(key);
+ if (bucket) bucket.push(entry);
+ else buckets.set(key, [entry]);
+ }
+ const known = GROUP_ORDER.filter((kind) => buckets.has(kind)).map((kind) => ({
+ label: groupLabel(kind),
+ entries: buckets.get(kind)!,
+ }));
+ const rest = buckets.get("") ?? [];
+ return { known, rest };
+}
+
export function RelationEditor({ relations, catalog, evidence = false, onChange }: { relations: RelationInput[]; catalog: CatalogEntry[]; evidence?: boolean; onChange(relations: RelationInput[]): void }) {
const noun = evidence ? "근거" : "관계";
+ const groups = grouped(catalog);
+ const taken = (index: number, id: string) =>
+ relations.some(
+ (candidate, candidateIndex) => candidateIndex !== index && candidate.targetId === id,
+ );
const update = (index: number, patch: Partial) => onChange(ordered(relations.map((relation, candidateIndex) => candidateIndex === index ? { ...relation, ...patch } : relation)));
const move = (index: number, delta: -1 | 1) => {
const target = index + delta;
@@ -24,8 +69,50 @@ export function RelationEditor({ relations, catalog, evidence = false, onChange
{relations.length === 0 ?
{evidence ? "연결한 근거 기록이 없습니다." : "연결한 공개 기록이 없습니다."}
: null}
{relations.map((relation, index) => (
-
-
+
+ {/*
+ 이 문장은 이제 공개 화면의 「다음에 읽을 것」에 그대로 나간다. 한 줄 input 이던 동안
+ 작성자는 자기가 쓴 문장의 끝을 볼 수 없었다.
+
+ 안내는 label 밖에 둔다 — 안에 두면 그 글까지 칸의 이름이 되어, 이름이 「관계 1 이유」가
+ 아니라 문장 하나가 된다. 요약 칸에서 같은 것을 이미 겪었다.
+ */}
+
+
+
))}
diff --git a/src/features/tech-log/presentation/styles/globals.css b/src/features/tech-log/presentation/styles/globals.css
index 56d7337..4c240bd 100644
--- a/src/features/tech-log/presentation/styles/globals.css
+++ b/src/features/tech-log/presentation/styles/globals.css
@@ -3015,3 +3015,20 @@ textarea.studio-control { min-height: 118px; resize: vertical; line-height: 1.65
font-size: 12px;
line-height: 1.6;
}
+
+/*
+ 작성자가 백틱으로 적은 식별자. `ProseText` 가 놓이는 자리는 문서 머리말·판단 기준·질문·주제
+ 논지로 흩어져 있어, 컨테이너로 범위를 잡으면 늘 어딘가가 빠진다 — 실제로 머리말의 요약에서만
+ 코드가 본문과 같은 크기의 민무늬로 나왔다.
+
+ 값은 `.document-body` 의 인라인 코드와 같게 둔다. 같은 것이 화면마다 다르게 보일 이유가 없다.
+*/
+.prose-code {
+ padding: 0.08em 0.3em;
+ border-radius: 4px;
+ background: #ececea;
+ color: #30333a;
+ font-family: "IBM Plex Mono", monospace;
+ font-size: 0.86em;
+ word-break: break-word;
+}
diff --git a/src/features/tech-log/presentation/styles/studio-editor.css b/src/features/tech-log/presentation/styles/studio-editor.css
index 2239eff..4e3c063 100644
--- a/src/features/tech-log/presentation/styles/studio-editor.css
+++ b/src/features/tech-log/presentation/styles/studio-editor.css
@@ -237,3 +237,14 @@
.studio-app .studio-document-status-bar__actions { gap: 12px; }
/* 게시만 강조한다. 저장은 되돌릴 수 있으므로 같은 무게로 부를 이유가 없다. */
.studio-app .studio-document-status-bar button:not(.studio-primary-button) { color: var(--muted); font-weight: 600; }
+
+/* 관계의 이유. 요약 칸과 같은 배치다 — 라벨, 칸, 그리고 이름에 들어가지 않는 안내 한 줄. */
+.studio-app .studio-relation-reason { display: grid; gap: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
+
+/*
+ Markdown 삽입 도구. 버튼 셋뿐이므로 격자를 만들지 않는다 — 이 화면의 다른 반복 버튼들과 같은
+ 모양을 쓰되, 본문 칸 바로 위에 붙여 무엇에 작용하는지가 자리로 드러나게 한다.
+*/
+.studio-app .studio-markdown-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 6px; }
+.studio-app .studio-markdown-toolbar button { min-height: 32px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; color: var(--ink-soft); font-size: 12px; font-weight: 600; cursor: pointer; }
+.studio-app .studio-markdown-toolbar button:hover { border-color: var(--signal); color: var(--signal); }
diff --git a/tests/features/tech-log/markdown-toolbar.test.ts b/tests/features/tech-log/markdown-toolbar.test.ts
new file mode 100644
index 0000000..f8c4730
--- /dev/null
+++ b/tests/features/tech-log/markdown-toolbar.test.ts
@@ -0,0 +1,62 @@
+import assert from "node:assert/strict";
+import { test } from "vitest";
+
+import {
+ MARKDOWN_SNIPPETS,
+ applySnippet,
+} from "../../../src/features/tech-log/presentation/studio/components/markdown-toolbar.tsx";
+
+/**
+ * 표를 넣을 수단이 편집기에 없었다. 주제 화면에 비교표를 두자고 정해 놓고도 그 표를 작성할 방법이
+ * 문법을 외우는 것뿐이었다.
+ */
+function textareaOf(value: string, start: number, end = start) {
+ return {
+ value,
+ selectionStart: start,
+ selectionEnd: end,
+ focus() {},
+ setSelectionRange() {},
+ } as unknown as HTMLTextAreaElement;
+}
+
+function snippet(label: string) {
+ const found = MARKDOWN_SNIPPETS.find((entry) => entry.label === label);
+ assert.ok(found, `${label} 조각이 없다`);
+ return found;
+}
+
+test("표 조각은 머리글과 구분선, 빈 줄 둘을 넣는다", () => {
+ let next = "";
+ applySnippet(textareaOf("", 0), snippet("표"), (value) => {
+ next = value;
+ });
+
+ const lines = next.trim().split("\n");
+ assert.equal(lines.length, 4, "머리글 + 구분선 + 본문 둘이어야 한다");
+ assert.match(lines[1]!, /^\|\s*---/u, "구분선이 없으면 Markdown 표로 읽히지 않는다");
+});
+
+test("고른 글이 있으면 코드 조각이 그것을 감싼다", () => {
+ let next = "";
+ applySnippet(textareaOf("앞 SELECT 1 뒤", 2, 10), snippet("코드"), (value) => {
+ next = value;
+ });
+
+ assert.ok(next.includes("```\nSELECT 1\n```"), next);
+ // 고른 글이 사라지면 안 된다 — 감싸는 것이지 지우는 것이 아니다.
+ assert.ok(next.includes("앞") && next.includes("뒤"), next);
+});
+
+/*
+ 블록이 앞 문단에 붙으면 Markdown 이 한 문단으로 읽는다. 빈 줄을 지키는 것이 이 함수가 하는
+ 일의 절반이다.
+*/
+test("앞 문단과 블록 사이에 빈 줄을 지킨다", () => {
+ let next = "";
+ applySnippet(textareaOf("문단", 2), snippet("목록"), (value) => {
+ next = value;
+ });
+
+ assert.ok(next.startsWith("문단\n\n- "), JSON.stringify(next));
+});
diff --git a/tests/features/tech-log/public-index-screens.test.tsx b/tests/features/tech-log/public-index-screens.test.tsx
index 8218e4b..55c1e77 100644
--- a/tests/features/tech-log/public-index-screens.test.tsx
+++ b/tests/features/tech-log/public-index-screens.test.tsx
@@ -120,7 +120,7 @@ describe("TechLog project screens", () => {
expect(within(main).getByRole("heading", { level: 1, name: "프로젝트" })).toBeVisible();
expect(
within(main).getByText(
- "Case와 Reference, Question을 실제 설계 목표와 결정의 흐름으로 묶어 봅니다.",
+ "검증 기록과 적용 기준, 열린 질문을 실제 설계 목표와 결정의 흐름으로 묶어 봅니다.",
),
).toBeVisible();
expect(