@infodb/p3 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/README.md +1 -0
  2. package/bin/p3.mjs +11 -5
  3. package/dist/web/assets/Outputs-CQi0oba1.js +1 -0
  4. package/dist/web/assets/RequestStatus-grC0F_SQ.js +1 -0
  5. package/dist/web/assets/Tabs-BJRGzidj.js +1 -0
  6. package/dist/web/assets/TagInput-DkuISbfK.js +1 -0
  7. package/dist/web/assets/TaskDrawer-CysOMAjG.js +3 -0
  8. package/dist/web/assets/_requestId-BQCwOAbs.js +30 -0
  9. package/dist/web/assets/_requestId-DgSOUH78.js +1 -0
  10. package/dist/web/assets/{ui-DdOGYj9z.js → appCtx-DCiGJFAe.js} +1 -1
  11. package/dist/web/assets/board-BsntpZXP.js +1 -0
  12. package/dist/web/assets/done-Bhxqy7bH.js +1 -0
  13. package/dist/web/assets/index-BF1xMdJo.css +2 -0
  14. package/dist/web/assets/index-BTuEPzgc.js +12 -0
  15. package/dist/web/assets/new-BwknRX3V.js +1 -0
  16. package/dist/web/assets/{preflightInput-DMxqnvF8.js → preflightInput-BAeEJYUK.js} +1 -1
  17. package/dist/web/assets/preload-helper-B40dBmwL.js +1 -0
  18. package/dist/web/assets/progressTree-DgrdDFih.js +1 -0
  19. package/dist/web/assets/release-notes-AgwbykyG.js +3 -0
  20. package/dist/web/assets/requestData-w6fhCYmh.js +1 -0
  21. package/dist/web/assets/routes-Bu3bhOaC.js +3 -0
  22. package/dist/web/assets/settings-BkV8KeQk.js +1 -0
  23. package/dist/web/index.html +4 -4
  24. package/docs/architecture.md +271 -3
  25. package/docs/development.md +22 -9
  26. package/docs/how-to-use.md +83 -7
  27. package/docs/installation.md +8 -6
  28. package/docs/publishing.md +4 -2
  29. package/lib/cli/args.js +172 -0
  30. package/lib/cli/chatgpt.js +70 -0
  31. package/lib/cli/codex.js +30 -0
  32. package/lib/cli/format.js +9 -0
  33. package/{src/cli/help.ts → lib/cli/help.js} +10 -8
  34. package/lib/cli/main.js +327 -0
  35. package/lib/cli/output.js +110 -0
  36. package/lib/cli/preflightCommands.js +301 -0
  37. package/lib/cli/project.js +649 -0
  38. package/lib/cli/readOnly.js +36 -0
  39. package/lib/cli/releaseNotesCommands.js +197 -0
  40. package/lib/cli/render.js +58 -0
  41. package/lib/cli/requestCommands.js +191 -0
  42. package/lib/cli/showView.js +100 -0
  43. package/lib/cli/taskCommands.js +152 -0
  44. package/lib/cli/userConfig.js +64 -0
  45. package/{src/core/chatgpt.ts → lib/core/chatgpt.js} +10 -16
  46. package/lib/core/context.js +41 -0
  47. package/lib/core/hierarchy.js +158 -0
  48. package/lib/core/machineSettings.js +146 -0
  49. package/lib/core/machineSettingsEdit.js +148 -0
  50. package/lib/core/ops.js +120 -0
  51. package/lib/core/preflight/carryover.js +105 -0
  52. package/lib/core/preflight/codexEngine.js +687 -0
  53. package/lib/core/preflight/codexImage.js +61 -0
  54. package/lib/core/preflight/diagnose.js +95 -0
  55. package/lib/core/preflight/engine.js +58 -0
  56. package/lib/core/preflight/input.js +83 -0
  57. package/lib/core/preflight/launch.js +68 -0
  58. package/lib/core/preflight/mockEngine.js +175 -0
  59. package/lib/core/preflight/render.js +304 -0
  60. package/lib/core/preflight/service.js +883 -0
  61. package/lib/core/preflight/split.js +83 -0
  62. package/lib/core/preflight/uiMaterials.js +281 -0
  63. package/lib/core/preflight/uiRender.js +89 -0
  64. package/lib/core/preflight/wireframe.js +63 -0
  65. package/lib/core/preflight/xlsx.js +324 -0
  66. package/lib/core/projectRegistry.js +207 -0
  67. package/lib/core/redact.js +28 -0
  68. package/lib/core/releaseNotes/completeRequests.js +106 -0
  69. package/lib/core/releaseNotes/generate.js +266 -0
  70. package/lib/core/releaseNotes/material.js +141 -0
  71. package/lib/core/releaseNotes/mockSummarizer.js +26 -0
  72. package/lib/core/releaseNotes/service.js +83 -0
  73. package/lib/core/releaseNotes/store.js +209 -0
  74. package/lib/core/repoAdmin.js +82 -0
  75. package/lib/core/repoRefs.js +72 -0
  76. package/lib/core/requestOps.js +164 -0
  77. package/lib/core/requestStatus.js +171 -0
  78. package/lib/core/store/attachments.js +242 -0
  79. package/lib/core/store/collection.js +254 -0
  80. package/lib/core/store/frontmatter.js +18 -0
  81. package/lib/core/store/fsutil.js +84 -0
  82. package/lib/core/store/locate.js +162 -0
  83. package/lib/core/store/normalize.js +152 -0
  84. package/lib/core/store/noteStore.js +59 -0
  85. package/lib/core/store/preflightStore.js +161 -0
  86. package/lib/core/store/projectFile.js +99 -0
  87. package/lib/core/store/workspace.js +320 -0
  88. package/lib/core/supersede.js +69 -0
  89. package/lib/core/userConfig.js +158 -0
  90. package/{src/core/userTheme.ts → lib/core/userTheme.js} +11 -13
  91. package/lib/core/workTargets.js +106 -0
  92. package/lib/server/api/chatgptRoutes.js +46 -0
  93. package/{src/server/api/local.ts → lib/server/api/local.js} +23 -22
  94. package/lib/server/api/manifest.js +147 -0
  95. package/lib/server/api/projectsRoutes.js +82 -0
  96. package/lib/server/api/releaseNoteRoutes.js +88 -0
  97. package/lib/server/api/repoRoutes.js +67 -0
  98. package/lib/server/api/routes.js +416 -0
  99. package/lib/server/api/userThemeRoutes.js +60 -0
  100. package/lib/server/server.js +85 -0
  101. package/lib/shared/dates.js +10 -0
  102. package/{src/shared/directTask.ts → lib/shared/directTask.js} +3 -11
  103. package/lib/shared/hierarchy.js +135 -0
  104. package/lib/shared/milestoneOrder.js +45 -0
  105. package/lib/shared/preflightInput.js +19 -0
  106. package/lib/shared/refs.js +44 -0
  107. package/lib/shared/repos.js +69 -0
  108. package/lib/shared/scopeView.js +39 -0
  109. package/{src/shared/tags.ts → lib/shared/tags.js} +9 -14
  110. package/lib/shared/types.js +74 -0
  111. package/lib/shared/workTarget.js +31 -0
  112. package/package.json +4 -7
  113. package/skills/p3/SKILL.md +10 -0
  114. package/dist/web/assets/Outputs-5Hby-S5Q.js +0 -1
  115. package/dist/web/assets/RequestStatus-CTkGjT02.js +0 -1
  116. package/dist/web/assets/TagInput-Rj3PNOAF.js +0 -1
  117. package/dist/web/assets/TaskDrawer-DtPhiYxP.js +0 -3
  118. package/dist/web/assets/_requestId-CGvAfIkB.js +0 -30
  119. package/dist/web/assets/_requestId-DxfYhgAq.js +0 -1
  120. package/dist/web/assets/board-wt47lfrE.js +0 -1
  121. package/dist/web/assets/done-C9Ct7ssb.js +0 -1
  122. package/dist/web/assets/index-BTFL2rpp.js +0 -12
  123. package/dist/web/assets/index-DAyBsvua.css +0 -2
  124. package/dist/web/assets/new-e4ID2vQV.js +0 -1
  125. package/dist/web/assets/preload-helper-DhIyFaOW.js +0 -1
  126. package/dist/web/assets/release-notes-CQ0d2r0k.js +0 -3
  127. package/dist/web/assets/requestData-BDZqyl35.js +0 -1
  128. package/dist/web/assets/routes-Bipv3lwJ.js +0 -2
  129. package/dist/web/assets/settings-Dwh8fj6p.js +0 -1
  130. package/src/cli/args.ts +0 -186
  131. package/src/cli/chatgpt.ts +0 -74
  132. package/src/cli/codex.ts +0 -28
  133. package/src/cli/format.ts +0 -9
  134. package/src/cli/main.ts +0 -337
  135. package/src/cli/output.ts +0 -117
  136. package/src/cli/preflightCommands.ts +0 -245
  137. package/src/cli/project.ts +0 -675
  138. package/src/cli/readOnly.ts +0 -36
  139. package/src/cli/releaseNotesCommands.ts +0 -198
  140. package/src/cli/render.ts +0 -60
  141. package/src/cli/requestCommands.ts +0 -172
  142. package/src/cli/showView.ts +0 -110
  143. package/src/cli/taskCommands.ts +0 -167
  144. package/src/cli/userConfig.ts +0 -58
  145. package/src/core/context.ts +0 -58
  146. package/src/core/machineSettings.ts +0 -207
  147. package/src/core/machineSettingsEdit.ts +0 -156
  148. package/src/core/ops.ts +0 -114
  149. package/src/core/preflight/carryover.ts +0 -133
  150. package/src/core/preflight/codexEngine.ts +0 -703
  151. package/src/core/preflight/codexImage.ts +0 -98
  152. package/src/core/preflight/diagnose.ts +0 -124
  153. package/src/core/preflight/engine.ts +0 -92
  154. package/src/core/preflight/input.ts +0 -65
  155. package/src/core/preflight/launch.ts +0 -86
  156. package/src/core/preflight/mockEngine.ts +0 -145
  157. package/src/core/preflight/render.ts +0 -339
  158. package/src/core/preflight/service.ts +0 -707
  159. package/src/core/preflight/uiMaterials.ts +0 -272
  160. package/src/core/preflight/uiRender.ts +0 -84
  161. package/src/core/preflight/wireframe.ts +0 -69
  162. package/src/core/preflight/xlsx.ts +0 -328
  163. package/src/core/projectRegistry.ts +0 -264
  164. package/src/core/redact.ts +0 -31
  165. package/src/core/releaseNotes/completeRequests.ts +0 -102
  166. package/src/core/releaseNotes/generate.ts +0 -283
  167. package/src/core/releaseNotes/material.ts +0 -114
  168. package/src/core/releaseNotes/mockSummarizer.ts +0 -28
  169. package/src/core/releaseNotes/service.ts +0 -110
  170. package/src/core/releaseNotes/store.ts +0 -216
  171. package/src/core/repoAdmin.ts +0 -81
  172. package/src/core/repoRefs.ts +0 -90
  173. package/src/core/requestOps.ts +0 -140
  174. package/src/core/requestStatus.ts +0 -58
  175. package/src/core/store/attachments.ts +0 -228
  176. package/src/core/store/collection.ts +0 -282
  177. package/src/core/store/frontmatter.ts +0 -22
  178. package/src/core/store/fsutil.ts +0 -90
  179. package/src/core/store/locate.ts +0 -181
  180. package/src/core/store/normalize.ts +0 -155
  181. package/src/core/store/noteStore.ts +0 -56
  182. package/src/core/store/preflightStore.ts +0 -136
  183. package/src/core/store/projectFile.ts +0 -101
  184. package/src/core/store/workspace.ts +0 -328
  185. package/src/core/supersede.ts +0 -74
  186. package/src/core/userConfig.ts +0 -205
  187. package/src/core/workTargets.ts +0 -120
  188. package/src/server/api/chatgptRoutes.ts +0 -49
  189. package/src/server/api/manifest.ts +0 -135
  190. package/src/server/api/projectsRoutes.ts +0 -89
  191. package/src/server/api/releaseNoteRoutes.ts +0 -89
  192. package/src/server/api/repoRoutes.ts +0 -67
  193. package/src/server/api/routes.ts +0 -382
  194. package/src/server/api/userThemeRoutes.ts +0 -62
  195. package/src/server/server.ts +0 -108
  196. package/src/shared/dates.ts +0 -12
  197. package/src/shared/milestoneOrder.ts +0 -44
  198. package/src/shared/preflightInput.ts +0 -27
  199. package/src/shared/refs.ts +0 -55
  200. package/src/shared/repos.ts +0 -113
  201. package/src/shared/scopeView.ts +0 -48
  202. package/src/shared/types.ts +0 -730
  203. package/src/shared/workTarget.ts +0 -44
  204. /package/{src → lib}/core/preflight/launcher.mjs +0 -0
  205. /package/{src → lib}/core/preflight/mock-ui.html +0 -0
  206. /package/{src → lib}/core/preflight/mock-ui.png +0 -0
  207. /package/{src → lib}/core/preflight/render-image/Dockerfile +0 -0
  208. /package/{src → lib}/core/preflight/render-image/fonts-ja.conf +0 -0
  209. /package/{src → lib}/core/preflight/render-image/render.mjs +0 -0
package/src/core/ops.ts DELETED
@@ -1,114 +0,0 @@
1
- import { normalizeTaskId } from "../shared/refs.ts";
2
- import { type RequestProgress, type Task, TASK_STATUSES, type TaskStatus } from "../shared/types.ts";
3
- import type { P3Context } from "./context.ts";
4
-
5
- /**
6
- * API と CLI で共通の読み取り(一覧・参照の解き方・進捗)。変更の手順は requestOps.ts。
7
- */
8
-
9
- export interface TaskFilter {
10
- /** 要望(無ければ全要望) */
11
- request?: string;
12
- status?: string[];
13
- area?: string;
14
- q?: string;
15
- /** 作業先(参照先の名前。none は作業先なし) */
16
- repo?: string;
17
- }
18
-
19
- export function listTasks({ ws }: P3Context, f: TaskFilter = {}): Task[] {
20
- let tasks = f.request ? ws.tasksOf(f.request).list() : ws.allTasks();
21
- if (f.status?.length) tasks = tasks.filter((t) => f.status!.includes(t.status));
22
- if (f.area) tasks = tasks.filter((t) => t.areas.some((a) => a.startsWith(f.area!)));
23
- // 作業先で絞る(none は作業先なし)
24
- if (f.repo !== undefined) tasks = tasks.filter((t) => (t.repo ?? null) === (f.repo === "none" ? null : f.repo));
25
- if (f.q) {
26
- const q = f.q.toLowerCase();
27
- tasks = tasks.filter((t) => `${t.ref} ${t.title} ${t.body}`.toLowerCase().includes(q));
28
- }
29
- return tasks;
30
- }
31
-
32
- /**
33
- * 要望の ID を短い書き方からも解く: 完全な ID、乱数部分(k7m3x)、ID の先頭・末尾の一部(一意なときだけ)。
34
- */
35
- export function resolveRequestId({ ws }: P3Context, raw: string): string | undefined {
36
- const s = raw.trim().toLowerCase();
37
- if (!s) return undefined;
38
- if (ws.requests.get(s)) return s;
39
- if (s.length < 3) return undefined;
40
- const hits = ws.requests.list().filter((r) => r.id.startsWith(s) || r.id.endsWith(s));
41
- return hits.length === 1 ? hits[0].id : undefined;
42
- }
43
-
44
- /**
45
- * 参照を絶対参照に解く。存在しなければ undefined。
46
- * "<要望>/T3" "<要望>" — 要望は短い書き方でもよい
47
- * "T3" / "3" — current(今の要望)の中のタスク
48
- */
49
- export function resolveRef(ctx: P3Context, raw: string, current?: string): string | undefined {
50
- const s = raw.trim();
51
- const [head, tail] = s.split("/", 2);
52
- if (tail !== undefined) {
53
- const rid = resolveRequestId(ctx, head);
54
- const tid = normalizeTaskId(tail);
55
- return rid && tid && ctx.ws.tasksOf(rid).get(tid) ? `${rid}/${tid}` : undefined;
56
- }
57
- const tid = normalizeTaskId(s);
58
- if (tid && current) return ctx.ws.tasksOf(current).get(tid) ? `${current}/${tid}` : undefined;
59
- return resolveRequestId(ctx, s);
60
- }
61
-
62
- export interface ResolveResult {
63
- match: string | null;
64
- candidates: { ref: string; title: string; score: number; reasons: string[] }[];
65
- }
66
-
67
- /** 参照・タイトル・自然文から対象を特定する。参照の一致 → タイトル部分一致 → 内容類似 */
68
- export function resolve(ctx: P3Context, q: string, current?: string): ResolveResult {
69
- const query = q.trim();
70
- const exact = query ? resolveRef(ctx, query, current) : undefined;
71
- if (exact) return { match: exact, candidates: [{ ref: exact, title: titleOf(ctx, exact), score: 1, reasons: ["参照が一致"] }] };
72
- const items = [
73
- ...ctx.ws.requests.list().map((r) => ({ ref: r.id, title: r.title, request: r.id })),
74
- ...ctx.ws.allTasks().map((t) => ({ ref: t.ref, title: t.title, request: t.request })),
75
- ];
76
- const byTitle = items
77
- .filter((t) => query && t.title.toLowerCase().includes(query.toLowerCase()))
78
- // 今の要望の中のものを先に
79
- .sort((a, b) => Number(b.request === current) - Number(a.request === current))
80
- .map((t) => ({ ref: t.ref, title: t.title, score: 0.9, reasons: ["タイトルに含む"] }));
81
- const candidates = byTitle.slice(0, 8);
82
- return { match: candidates.length === 1 ? candidates[0].ref : null, candidates };
83
- }
84
-
85
- export function titleOf({ ws }: P3Context, ref: string): string {
86
- return ws.task(ref)?.title ?? ws.requests.get(ref)?.title ?? "?";
87
- }
88
-
89
- /**
90
- * 要望ごとの進捗。進捗の画面と `p3 progress` で使う。
91
- * 並び: 最終更新(要望自身と、アーカイブしていないタスクの updatedAt の最大)の新しい順。同じ日時なら要望 ID の順。
92
- */
93
- export function progress(ctx: P3Context): RequestProgress[] {
94
- return ctx.ws.requests
95
- .list()
96
- .map((request) => {
97
- const tasks = ctx.ws.tasksOf(request.id).list();
98
- const counts = Object.fromEntries(TASK_STATUSES.map((s) => [s, 0])) as Record<TaskStatus, number>;
99
- for (const t of tasks) counts[t.status]++;
100
- const done = tasks.filter((t) => t.status === "done");
101
- return {
102
- request,
103
- tasks: tasks.map(({ id, ref, title, status, createdAt, startedAt, doneAt, checkedAt }) => ({ id, ref, title, status, createdAt, startedAt, doneAt, checkedAt })),
104
- counts,
105
- total: tasks.length,
106
- done: done.length,
107
- updatedAt: [request.updatedAt, ...tasks.map((t) => t.updatedAt)].sort().at(-1)!,
108
- };
109
- })
110
- .sort((a, b) => b.updatedAt.localeCompare(a.updatedAt) || byId(a.request.id, b.request.id));
111
- }
112
-
113
- /** ID の順(数を含む部分は数として比べる: T2 < T10) */
114
- const byId = (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true });
@@ -1,133 +0,0 @@
1
- import type { InputMatch, PreflightInput, PreflightNote, PreflightRun } from "../../shared/types.ts";
2
- import type { Workspace } from "../store/workspace.ts";
3
- import { compareInput, runInput } from "./input.ts";
4
- import { changedLabel } from "../../shared/preflightInput.ts";
5
-
6
- /** 次の Preflight に引き継ぐもの: 前回の結果と、その後に書き足されたメモ */
7
- export interface Carryover {
8
- /** 引き継ぐ前回の run(直近の run が完了していて結果を読めるときだけ) */
9
- previous?: PreflightRun;
10
- /** 前回の run を引き継がない理由(前回が無いときは undefined) */
11
- previousSkipped?: string;
12
- /** まだ渡していないメモ(古い順) */
13
- notes: PreflightNote[];
14
- /** 読めなかったメモ(渡さない) */
15
- invalidNotes: { file: string; error: string }[];
16
- /**
17
- * 前回の評価のあとで要望(タイトル・本文)が変わったか。前回を引き継ぐときだけ。
18
- * before は前回が評価した内容(読めなければ無し)
19
- */
20
- requestChange?: { match: InputMatch; before?: PreflightInput };
21
- }
22
-
23
- /**
24
- * 引き継ぐものを選ぶ。
25
- * - 前回: 直近の run が completed で評価を読めるときだけ。失敗・欠損なら、古い成功 run に戻らず「前回なし」
26
- * - メモ: 前回を引き継ぐなら、前回までの引き継ぎの経路(previous を辿った run)で渡し済みのものを除く。
27
- * 失敗した run に渡しただけのメモは渡し済みにしない。前回を引き継がないなら全部渡す
28
- */
29
- export async function selectCarryover(ws: Workspace, requestId: string): Promise<Carryover> {
30
- const runs = await ws.preflight.list(requestId);
31
- const latest = runs[0];
32
- const { notes, invalid } = await ws.notes.list(requestId);
33
- let previous: PreflightRun | undefined;
34
- let previousSkipped: string | undefined;
35
- if (latest) {
36
- if (latest.status !== "completed") previousSkipped = `直近の ${latest.id} が${latest.status === "failed" ? "失敗" : "実行中"}のため`;
37
- else if (!latest.assessment) previousSkipped = `直近の ${latest.id} に評価がないため`;
38
- else previous = latest;
39
- }
40
- const used = new Set<string>();
41
- const seen = new Set<string>();
42
- for (let r = previous; r && !seen.has(r.id); r = r.previous ? runs.find((x) => x.id === r.previous) : undefined) {
43
- seen.add(r.id);
44
- for (const n of r.notes ?? []) used.add(n);
45
- }
46
- let requestChange: Carryover["requestChange"];
47
- if (previous) {
48
- const before = await runInput(previous, ws.preflight.runDir(requestId, previous.id));
49
- const match = compareInput(before, ws.requests.require(requestId));
50
- if (match.status !== "same") requestChange = { match, ...("error" in before ? {} : { before }) };
51
- }
52
- return { previous, previousSkipped, notes: notes.filter((n) => !used.has(n.id)), invalidNotes: invalid, ...(requestChange ? { requestChange } : {}) };
53
- }
54
-
55
- /** 前回の評価のあとの要望の変更。今の要望を基準にし、前回の評価・案・メモとの食い違いは確認事項にさせる */
56
- function requestChangeSection(c: NonNullable<Carryover["requestChange"]>, previousId: string): string {
57
- const quote = (s: string) => (s ? s.split("\n").map((l) => `> ${l}`).join("\n") : "> (空)");
58
- const head = "## 前回の評価のあとで変わった要望(評価の基準は今の要望。前回の評価・タスク案・メモと食い違う点は確認事項に)";
59
- if (c.match.status === "unknown" || !c.before) {
60
- return `${head}\n前回 ${previousId} が何を評価したか確かめられません(${c.match.reason ?? "不明"})。前回の評価は今の要望に合っていないものとして扱ってください。`;
61
- }
62
- const parts = [head, `前回 ${previousId} の後で、要望の${changedLabel(c.match.changed)}が書き換えられました。前回が評価した内容:`];
63
- if (c.match.changed?.includes("title")) parts.push(`### 前回の時点のタイトル\n${quote(c.before.title)}`);
64
- if (c.match.changed?.includes("body")) parts.push(`### 前回の時点の本文\n${quote(c.before.body)}`);
65
- return parts.join("\n\n");
66
- }
67
-
68
- /**
69
- * 前回の画面イメージ(固定した参照)。前回の提案であり、今の画面の証拠ではない。パスはデータのフォルダからの相対
70
- * (コンテナの中では /data/ の下)。作り直すときは今回の run の ui/ に書く
71
- */
72
- function uiCarryover(p: PreflightRun): string {
73
- const ui = p.ui;
74
- const head = "## 前回の画面イメージ(前回の提案。今の画面の証拠ではありません。案を変えたら今回の ui/ に原稿を書き直す)";
75
- if (!ui) return `${head}
76
- (記録なし)`;
77
- if (ui.status === "not_needed") return `${head}
78
- 不要としていました(${ui.reason ?? "理由なし"})`;
79
- const dir = `requests/${p.requestId}/preflight/${p.id}/ui`;
80
- const items = ui.items.map(
81
- (m) =>
82
- `- ${m.id} ${m.title}(対象 ${m.drafts.join(", ")}${m.viewport ? ` / 幅 ${m.viewport}` : ""}): 画像 ${dir}/${m.file}${m.html ? ` / 原稿 ${dir}/${m.html}` : ""}${
83
- m.assumptions.length ? ` / 前提: ${m.assumptions.join("・")}` : ""
84
- }`,
85
- );
86
- return [head, ...(items.length ? items : ["(なし)"]), ...(ui.status === "missing" ? [`足りなかったもの: ${ui.reason ?? "不明"}`] : [])].join("\n");
87
- }
88
-
89
- /**
90
- * 引き継ぐものを Markdown にする。run ディレクトリの carryover.md に固定して残し、そのままエンジンに渡す
91
- * (前回のタスク案やメモが後から直されても、この run が何を根拠にしたかは変わらない)。
92
- * 引き継ぐものが無ければ undefined。
93
- */
94
- export function renderCarryover(c: Carryover): string | undefined {
95
- if (!c.previous && !c.notes.length) return undefined;
96
- const out: string[] = ["# 引き継ぎ"];
97
- const p = c.previous;
98
- if (p?.assessment) {
99
- const a = p.assessment;
100
- const list = (xs: string[]) => (xs.length ? xs.map((x) => `- ${x}`).join("\n") : "(なし)");
101
- if (c.requestChange) out.push(requestChangeSection(c.requestChange, p.id));
102
- out.push(
103
- `## 前回の評価(${p.id})`,
104
- `判定: ${a.verdict} / 妥当性 ${a.validity.score} / 実現可能性 ${a.feasibility.score}`,
105
- a.summary,
106
- `### 確認事項\n${list(a.questions)}`,
107
- `### リスク\n${list(a.risks)}`,
108
- // 前回の根拠は前回の時点のもの。今回の確かめた根拠としてそのまま写させない
109
- `### 前回の根拠(前回の時点のもの。使うなら今回あらためて確かめ、確かめていなければ assumed にする)\n${
110
- a.evidence === undefined
111
- ? "(記録なし)"
112
- : list(a.evidence.map((e) => `${e.kind === "verified" ? "確かめた" : "推測"}: ${e.claim}${e.repo && e.file ? `(${e.repo}:${e.file}${e.location ? ` ${e.location}` : ""})` : ""}`))
113
- }`,
114
- `## 前回のタスク案(人の編集と採否を含む)`,
115
- ...(p.drafts.length
116
- ? p.drafts.map(
117
- (d) =>
118
- `### ${d.key} ${d.title}(${d.include ? "採用" : "不採用"}${d.dependsOn.length ? ` / 依存: ${d.dependsOn.join(", ")}` : ""}${d.repo !== undefined ? ` / 作業先: ${d.repo ?? "なし"}` : ""})\n${d.description}`,
119
- )
120
- : ["(なし)"]),
121
- uiCarryover(p),
122
- );
123
- } else if (c.previousSkipped) {
124
- out.push(`## 前回の評価\n引き継ぎません(${c.previousSkipped})。`);
125
- }
126
- if (c.notes.length) {
127
- out.push(
128
- "## その後のメモ(確認事項への回答・方針の変更。古い順)",
129
- ...c.notes.map((n) => `### ${n.id}(${n.createdBy ?? "不明"}, ${n.createdAt})\n${n.body}`),
130
- );
131
- }
132
- return `${out.join("\n\n")}\n`;
133
- }