@infodb/p3 0.1.0 → 0.3.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.
- package/README.md +6 -1
- package/dist/web/assets/{Outputs-Ni3pNuGU.js → Outputs-DqJdybkd.js} +1 -1
- package/dist/web/assets/{RequestStatus-K8TZwpur.js → RequestStatus-DN-2iAM0.js} +1 -1
- package/dist/web/assets/TagInput-D-1ILLDX.js +1 -0
- package/dist/web/assets/TaskDrawer-CHD7T-Su.js +3 -0
- package/dist/web/assets/_requestId-BzSepQIV.js +30 -0
- package/dist/web/assets/_requestId-pIds2tFU.js +1 -0
- package/dist/web/assets/board-BIkOpuC4.js +1 -0
- package/dist/web/assets/directTask-Dk3H5Q2B.js +1 -0
- package/dist/web/assets/done-BUAUhIRr.js +1 -0
- package/dist/web/assets/draft-CfJeyLOl.js +1 -0
- package/dist/web/assets/index-Byv9j77D.js +12 -0
- package/dist/web/assets/index-DTfUhuQw.css +2 -0
- package/dist/web/assets/new-6kly4-PX.js +1 -0
- package/dist/web/assets/preload-helper-DlN0ouRj.js +1 -0
- package/dist/web/assets/release-notes-iwQWmfX6.js +3 -0
- package/dist/web/assets/requestData-DJ1Rlx-u.js +1 -0
- package/dist/web/assets/routes-Ciot9p4x.js +2 -0
- package/dist/web/assets/settings-DBCi6lAY.js +1 -0
- package/dist/web/assets/ui-Sz7y5_TS.js +1 -0
- package/dist/web/assets/workTarget-Cijqq4yH.js +1 -0
- package/dist/web/index.html +4 -5
- package/docs/architecture.md +70 -14
- package/docs/development.md +83 -7
- package/docs/how-to-use.md +105 -12
- package/docs/installation.md +157 -11
- package/docs/publishing.md +27 -3
- package/package.json +8 -5
- package/skills/p3/SKILL.md +2 -0
- package/src/cli/args.ts +9 -2
- package/src/cli/help.ts +10 -4
- package/src/cli/main.ts +73 -4
- package/src/cli/output.ts +18 -0
- package/src/cli/preflightCommands.ts +10 -2
- package/src/cli/project.ts +269 -98
- package/src/cli/releaseNotesCommands.ts +21 -1
- package/src/core/context.ts +3 -2
- package/src/core/preflight/codexEngine.ts +2 -1
- package/src/core/preflight/render-image/Dockerfile +3 -0
- package/src/core/preflight/render-image/fonts-ja.conf +28 -0
- package/src/core/preflight/render-image/render.mjs +10 -1
- package/src/core/preflight/render.ts +5 -2
- package/src/core/preflight/service.ts +19 -2
- package/src/core/projectRegistry.ts +264 -0
- package/src/core/releaseNotes/generate.ts +12 -0
- package/src/core/store/locate.ts +6 -6
- package/src/core/userConfig.ts +25 -0
- package/src/server/api/chatgptRoutes.ts +6 -5
- package/src/server/api/manifest.ts +9 -0
- package/src/server/api/projectsRoutes.ts +89 -0
- package/src/server/api/routes.ts +33 -25
- package/src/server/server.ts +74 -15
- package/src/shared/directTask.ts +20 -0
- package/src/shared/types.ts +1 -1
- package/dist/web/assets/TagInput-BICKVH2x.js +0 -1
- package/dist/web/assets/TaskDrawer-BkDIstIN.js +0 -3
- package/dist/web/assets/_requestId-B5O_ytaq.js +0 -1
- package/dist/web/assets/_requestId-C66puEMO.js +0 -30
- package/dist/web/assets/board-CbfDjkls.js +0 -1
- package/dist/web/assets/done-CPQbCFHg.js +0 -1
- package/dist/web/assets/draft-dT3gLDIt.js +0 -1
- package/dist/web/assets/index-BUcs2J6N.js +0 -12
- package/dist/web/assets/index-C3DkqwJ9.css +0 -2
- package/dist/web/assets/link-_s8ndNKS.js +0 -1
- package/dist/web/assets/new-T60RB7de.js +0 -1
- package/dist/web/assets/preload-helper-dXqN7N-I.js +0 -1
- package/dist/web/assets/release-notes-DxrPhDbt.js +0 -3
- package/dist/web/assets/requestData-D8ZiSZss.js +0 -1
- package/dist/web/assets/routes-D9ZxXoLk.js +0 -2
- package/dist/web/assets/settings-DsHVyqzJ.js +0 -1
- package/dist/web/assets/supersede-CLXlhCq0.js +0 -1
- package/dist/web/assets/ui-Cvke4y4X.js +0 -1
package/src/server/api/routes.ts
CHANGED
|
@@ -106,8 +106,13 @@ function download(c: Context, data: Buffer, format: AttachmentFormat, name: stri
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
/**
|
|
110
|
+
* notify: プロジェクトに属さない変更(ChatGPT の接続・テーマ)の知らせ方。省くとこのプロジェクトの画面へだけ流す
|
|
111
|
+
* (プロジェクトを跨ぐ serve では開いている全プロジェクトへ)
|
|
112
|
+
*/
|
|
113
|
+
export function apiRoutes(ctx: P3Context, opts: { notify?: (kind: "user" | "chatgpt") => void } = {}) {
|
|
110
114
|
const { ws, preflight } = ctx;
|
|
115
|
+
const notify = opts.notify ?? ((kind: "user" | "chatgpt") => ws.emit({ type: "changed", kind }));
|
|
111
116
|
const app = new Hono();
|
|
112
117
|
|
|
113
118
|
app.onError((err, c) => {
|
|
@@ -156,9 +161,9 @@ export function apiRoutes(ctx: P3Context) {
|
|
|
156
161
|
app.post("/reload", async (c) => c.json(await ws.reloadAll()));
|
|
157
162
|
/** Preflight のエンジンが使えるか(Codex なら Docker・認証・イメージを確かめる) */
|
|
158
163
|
app.get("/engine", async (c) => c.json(await preflight.engineStatus()));
|
|
159
|
-
if (ctx.chatgpt) app.route("/chatgpt", chatgptRoutes(ctx.chatgpt,
|
|
164
|
+
if (ctx.chatgpt) app.route("/chatgpt", chatgptRoutes(ctx.chatgpt, { changed: () => notify("chatgpt"), engine: () => preflight.engineStatus() }));
|
|
160
165
|
/** 個人設定のテーマ(このマシンのすべてのプロジェクトで共通。ほかの個人設定は扱わない) */
|
|
161
|
-
app.route("/user-theme", userThemeRoutes(() =>
|
|
166
|
+
app.route("/user-theme", userThemeRoutes(() => notify("user")));
|
|
162
167
|
/** 最初の描画の前に読むスクリプト(index.html の先頭)。テーマだけを埋め込み、キャッシュさせない */
|
|
163
168
|
app.route("/user-theme.js", userThemeScriptRoute());
|
|
164
169
|
|
|
@@ -347,28 +352,31 @@ export function apiRoutes(ctx: P3Context) {
|
|
|
347
352
|
app.get("/resolve", (c) => c.json(resolve(ctx, c.req.query("q") ?? "", c.req.query("request"))));
|
|
348
353
|
|
|
349
354
|
// --- events (SSE) ------------------------------------------------------
|
|
350
|
-
app.get("/events", (c) =>
|
|
351
|
-
streamSSE(c, async (stream) => {
|
|
352
|
-
const queue: ServerEvent[] = [];
|
|
353
|
-
let wake: (() => void) | undefined;
|
|
354
|
-
const off = ws.on((e) => {
|
|
355
|
-
queue.push(e);
|
|
356
|
-
wake?.();
|
|
357
|
-
});
|
|
358
|
-
stream.onAbort(() => {
|
|
359
|
-
off();
|
|
360
|
-
wake?.();
|
|
361
|
-
});
|
|
362
|
-
while (!stream.aborted) {
|
|
363
|
-
if (!queue.length) {
|
|
364
|
-
await Promise.race([new Promise<void>((r) => (wake = r)), stream.sleep(25000)]);
|
|
365
|
-
wake = undefined;
|
|
366
|
-
if (!queue.length) await stream.writeSSE({ event: "ping", data: "" });
|
|
367
|
-
}
|
|
368
|
-
while (queue.length) await stream.writeSSE({ data: JSON.stringify(queue.shift()) });
|
|
369
|
-
}
|
|
370
|
-
}),
|
|
371
|
-
);
|
|
355
|
+
app.get("/events", (c) => eventStream(c, (push) => ws.on(push)));
|
|
372
356
|
|
|
373
357
|
return app;
|
|
374
358
|
}
|
|
359
|
+
|
|
360
|
+
/** 変更の知らせを SSE で流す(subscribe は知らせを受け取る関数を登録し、外す関数を返す)。25 秒ごとに ping */
|
|
361
|
+
export function eventStream(c: Context, subscribe: (push: (e: ServerEvent) => void) => () => void) {
|
|
362
|
+
return streamSSE(c, async (stream) => {
|
|
363
|
+
const queue: ServerEvent[] = [];
|
|
364
|
+
let wake: (() => void) | undefined;
|
|
365
|
+
const off = subscribe((e) => {
|
|
366
|
+
queue.push(e);
|
|
367
|
+
wake?.();
|
|
368
|
+
});
|
|
369
|
+
stream.onAbort(() => {
|
|
370
|
+
off();
|
|
371
|
+
wake?.();
|
|
372
|
+
});
|
|
373
|
+
while (!stream.aborted) {
|
|
374
|
+
if (!queue.length) {
|
|
375
|
+
await Promise.race([new Promise<void>((r) => (wake = r)), stream.sleep(25000)]);
|
|
376
|
+
wake = undefined;
|
|
377
|
+
if (!queue.length) await stream.writeSSE({ event: "ping", data: "" });
|
|
378
|
+
}
|
|
379
|
+
while (queue.length) await stream.writeSSE({ data: JSON.stringify(queue.shift()) });
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}
|
package/src/server/server.ts
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import { serve } from "@hono/node-server";
|
|
1
|
+
import { serve, type ServerType } from "@hono/node-server";
|
|
2
2
|
import { serveStatic } from "@hono/node-server/serve-static";
|
|
3
3
|
import { Hono } from "hono";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { relative } from "node:path";
|
|
6
6
|
import { apiRoutes } from "./api/routes.ts";
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
7
|
+
import { projectsRoutes } from "./api/projectsRoutes.ts";
|
|
8
|
+
import { chatgptAccount } from "../core/chatgpt.ts";
|
|
9
|
+
import { openProject, P3_ROOT, type P3Context } from "../core/context.ts";
|
|
10
|
+
import { machineSettingsSource, type MachineSettings, type SettingsSource } from "../core/machineSettings.ts";
|
|
11
|
+
import { ProjectRegistry } from "../core/projectRegistry.ts";
|
|
9
12
|
|
|
10
13
|
export interface ServeOptions {
|
|
11
|
-
|
|
14
|
+
/** 1つのプロジェクトのデータのフォルダ(allProjects のときは使わない) */
|
|
15
|
+
dataDir?: string;
|
|
12
16
|
/** 参照先の名前 → このマシンのパス(個人設定) */
|
|
13
17
|
repos?: Record<string, string>;
|
|
14
18
|
/** 個人設定に登録したプロジェクト名(設定画面で参照先のこのマシンのパスを書くため) */
|
|
15
19
|
projectName?: string;
|
|
20
|
+
/** 個人設定に登録したプロジェクトを跨いで扱う(p3 serve --all-projects) */
|
|
21
|
+
allProjects?: boolean;
|
|
16
22
|
port: number;
|
|
17
23
|
host: string;
|
|
18
24
|
/** ビルド済みの画面 (dist/web) も配信する */
|
|
@@ -21,14 +27,40 @@ export interface ServeOptions {
|
|
|
21
27
|
settings?: MachineSettings | SettingsSource;
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
export interface RunningServer {
|
|
31
|
+
/**
|
|
32
|
+
* 止める。新しい接続を断り、開いている接続(SSE を含む)を閉じ、実行中の Preflight・生成を取り消して終わるまで待つ
|
|
33
|
+
* (timeoutMs まで)。監視を外す。待ちきれなかった実行の数を返す
|
|
34
|
+
*/
|
|
35
|
+
close(opts?: { timeoutMs?: number }): Promise<{ pending: number }>;
|
|
36
|
+
}
|
|
29
37
|
|
|
38
|
+
/** 1つのプロジェクトの API(通常の serve)。/api の下 */
|
|
39
|
+
export function singleProjectApp(ctx: P3Context) {
|
|
30
40
|
const app = new Hono();
|
|
31
|
-
app.
|
|
41
|
+
app.get("/mode", (c) => c.json({ mode: "single", project: ctx.projectName ?? null }));
|
|
42
|
+
app.route("/", apiRoutes(ctx));
|
|
43
|
+
// 無い API は画面(index.html)に流さない
|
|
44
|
+
app.all("*", (c) => c.json({ error: `API がありません: ${c.req.method} ${new URL(c.req.url).pathname}` }, 404));
|
|
45
|
+
return app;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** ブラウザ用のローカルサーバ。ファイルを監視して画面へ流すビューア兼エディタ */
|
|
49
|
+
export async function startServer(opts: ServeOptions): Promise<RunningServer> {
|
|
50
|
+
const app = new Hono();
|
|
51
|
+
let ctx: P3Context | undefined;
|
|
52
|
+
let registry: ProjectRegistry | undefined;
|
|
53
|
+
if (opts.allProjects) {
|
|
54
|
+
const settings = !opts.settings ? machineSettingsSource() : "get" in opts.settings ? opts.settings : { path: "", get: async () => opts.settings as MachineSettings };
|
|
55
|
+
registry = new ProjectRegistry({ settings, chatgpt: chatgptAccount() });
|
|
56
|
+
await registry.refresh();
|
|
57
|
+
app.route("/api", projectsRoutes(registry));
|
|
58
|
+
} else {
|
|
59
|
+
if (!opts.dataDir) throw new Error("serve: データのフォルダが決まっていません");
|
|
60
|
+
ctx = await openProject(opts.dataDir, { repos: opts.repos, settings: opts.settings, projectName: opts.projectName });
|
|
61
|
+
void ctx.ws.watch();
|
|
62
|
+
app.route("/api", singleProjectApp(ctx));
|
|
63
|
+
}
|
|
32
64
|
if (opts.static) {
|
|
33
65
|
// serveStatic の root はカレントからの相対で解釈される
|
|
34
66
|
const root = relative(process.cwd(), `${P3_ROOT}dist/web`) || ".";
|
|
@@ -36,14 +68,41 @@ export async function startServer(opts: ServeOptions) {
|
|
|
36
68
|
app.get("*", serveStatic({ path: `${root}/index.html` }));
|
|
37
69
|
}
|
|
38
70
|
|
|
39
|
-
serve({ fetch: app.fetch, port: opts.port, hostname: opts.host }, () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
71
|
+
const server: ServerType = serve({ fetch: app.fetch, port: opts.port, hostname: opts.host }, () => {
|
|
72
|
+
if (registry) {
|
|
73
|
+
const l = registry.list();
|
|
74
|
+
console.log("p3: プロジェクトを跨ぐ serve(--all-projects)");
|
|
75
|
+
console.log(` projects ${l.projects.map((p) => p.name).join(", ") || "(登録なし。p3 init / p3 join で登録して、画面の一覧を読み直す)"}`);
|
|
76
|
+
if (l.configError) console.log(` ⚠ ${l.configError}`);
|
|
77
|
+
for (const i of l.invalid) console.log(` ⚠ 使えない登録 ${i.name}: ${i.reason}`);
|
|
78
|
+
} else if (ctx) {
|
|
79
|
+
console.log(`p3: ${ctx.ws.project.name}`);
|
|
80
|
+
console.log(` data ${opts.dataDir}`);
|
|
81
|
+
console.log(` repos ${ctx.ws.project.repos.map((r) => r.name).join(", ") || "(なし)"}`);
|
|
82
|
+
console.log(` engines ${ctx.preflight.availableEngines().join(", ")} (default: ${ctx.preflight.defaultEngine})`);
|
|
83
|
+
}
|
|
44
84
|
console.log(` listen http://${opts.host}:${opts.port}${opts.static ? "" : " (api only)"}`);
|
|
45
85
|
if (opts.static && !existsSync(`${P3_ROOT}dist/web/index.html`)) {
|
|
46
86
|
console.log(` ⚠ 画面がビルドされていません。${P3_ROOT} で \`pnpm build\` を実行してください`);
|
|
47
87
|
}
|
|
48
88
|
});
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
async close({ timeoutMs = 10_000 } = {}) {
|
|
92
|
+
// 新しい接続を断り、開いている接続(SSE)を閉じる
|
|
93
|
+
const closed = new Promise<void>((r) => server.close(() => r()));
|
|
94
|
+
(server as { closeAllConnections?: () => void }).closeAllConnections?.();
|
|
95
|
+
let pending = 0;
|
|
96
|
+
if (registry) pending = (await registry.close({ timeoutMs })).pending;
|
|
97
|
+
else if (ctx) {
|
|
98
|
+
const c = ctx;
|
|
99
|
+
const settle = Promise.all([c.preflight.settle({ cancel: true }), c.releaseGenerator.settle({ cancel: true })]).then(() => false);
|
|
100
|
+
const timedOut = await Promise.race([settle, new Promise<boolean>((r) => setTimeout(() => r(true), timeoutMs).unref())]);
|
|
101
|
+
c.ws.close();
|
|
102
|
+
pending = timedOut ? c.preflight.running() + c.releaseGenerator.running() : 0;
|
|
103
|
+
}
|
|
104
|
+
await Promise.race([closed, new Promise<void>((r) => setTimeout(r, 1000).unref())]);
|
|
105
|
+
return { pending };
|
|
106
|
+
},
|
|
107
|
+
};
|
|
49
108
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PreflightRun } from "./types.ts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Preflight を通さずにタスクを直接作る道(画面の「+ タスクを追加」・CLI の p3 new)の案内。
|
|
5
|
+
* 小さく内容のはっきりした要望ではふつうに選べる道で、Docker や ChatGPT の接続が無くて Preflight を使えないときにも案内する。
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** 直接作るタスクに付かないもの(画面と CLI で同じ言い方にする) */
|
|
9
|
+
export const DIRECT_TASK_NOTE =
|
|
10
|
+
"Preflight の評価・細分化・根拠の調査・画面イメージは付きません。必要な調査と完了条件を自分で整理して作成してください。";
|
|
11
|
+
|
|
12
|
+
/** 後から Preflight を使えるようになったとき(既にあるタスクとの関係) */
|
|
13
|
+
export const LATER_PREFLIGHT_NOTE =
|
|
14
|
+
"後から Preflight を使えるようになったら、この要望に実行できます。実行しても既にあるタスクは変わらず、案をタスク化すると新しいタスクが増えるので、重複を確かめて採否を選んでください。";
|
|
15
|
+
|
|
16
|
+
/** 取り消した Preflight の記録のエラー(失敗とは扱わない) */
|
|
17
|
+
export const PREFLIGHT_CANCELLED = "中止しました";
|
|
18
|
+
|
|
19
|
+
/** Preflight が失敗した(取消は含まない)。直接作る道を案内する */
|
|
20
|
+
export const preflightFailed = (run: Pick<PreflightRun, "status" | "error">) => run.status === "failed" && run.error !== PREFLIGHT_CANCELLED;
|
package/src/shared/types.ts
CHANGED
|
@@ -682,7 +682,7 @@ export interface ProjectConfig {
|
|
|
682
682
|
|
|
683
683
|
/** changed の kind "reload": データのフォルダを全部読み直した(画面の「再読み込み」)。画面はすべて取り直す */
|
|
684
684
|
export type ServerEvent =
|
|
685
|
-
| { type: "changed"; kind: "task" | "request" | "preflight" | "note" | "attachment" | "project" | "chatgpt" | "user" | "reload"; request?: string; ref?: string }
|
|
685
|
+
| { type: "changed"; kind: "task" | "request" | "preflight" | "note" | "attachment" | "project" | "projects" | "chatgpt" | "user" | "reload"; request?: string; ref?: string }
|
|
686
686
|
/** リリースノートのファイルが変わった・消えた(CLI・画面・直接編集) */
|
|
687
687
|
| { type: "changed"; kind: "release-note"; milestone: string }
|
|
688
688
|
/** リリースノートの要約の生成の状態が変わった */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,J as n,a as r,c as i,d as a,h as o,l as s,n as c,t as l,u,y as d}from"./ui-Cvke4y4X.js";import{c as f,n as p,r as m}from"./index-BUcs2J6N.js";var h=e(n(),1),g=(e,t,n)=>`/api/requests/${encodeURIComponent(e)}/preflight/${encodeURIComponent(t)}/ui/${encodeURIComponent(n)}`,_=(e,t)=>`/api/requests/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}`,v=(e,t,n,r=!1)=>`/api/requests/${encodeURIComponent(e)}/preflight/${encodeURIComponent(t)}/attachments/${encodeURIComponent(n)}${r?`/extract`:``}`,y=e=>`draft-${e}`,b={proposal:`indigo`,current:`slate`,spec:`emerald`},x=e=>f[e];function S(e){let t=e.ui;return t?t.status===`generating`||e.status===`running`?{label:`評価中`,tone:`indigo`,message:`評価が終わると、画面イメージを取り込みます`}:t.status===`not_needed`?{label:`不要`,tone:`slate`,message:t.reason}:t.status===`ready`?{label:`そろっています`,tone:`emerald`}:{label:`足りません`,tone:`amber`,message:t.reason}:{label:`記録なし`,tone:`slate`,message:`以前の run なので、画面資料の記録がありません`}}function C(e){let t=e.ui;if(t&&t.status===`missing`&&t.needed===!0)return`画面イメージが足りないままです(${t.reason??`理由不明`})。タスク化する前に画像を確かめるか、メモで再評価してください`}function w(e){let t=[`proposal`,`current`,`spec`];return[...e].sort((e,n)=>t.indexOf(e.kind)-t.indexOf(n.kind))}var T=e=>e>=1048576?`${(e/1024/1024).toFixed(1)}MB`:`${Math.max(1,Math.ceil(e/1024))}KB`,E=e=>m[e.format],D=()=>({file:null,description:``,source:``,busy:!1,error:null});async function O(e,t){if(!e.file)return{...e,error:`ファイルを選んでください`};try{return await t({file:e.file,description:e.description,source:e.source}),D()}catch(t){return{...e,busy:!1,error:t.message}}}var k=`.png,.jpg,.jpeg,.xlsx,image/png,image/jpeg,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`;function A(e){let t=e.toLowerCase().split(`.`).pop();return t===`png`?`png`:t===`jpg`||t===`jpeg`?`jpeg`:t===`xlsx`?`xlsx`:void 0}function j(e){let t=p,n=e.map(e=>{let n=A(e.name);if(!n)return`PNG / JPEG / xlsx だけ添付できます`;let r=n===`xlsx`?t.xlsxBytes:t.imageBytes;return e.size>r?`大きすぎます(上限 ${T(r)})`:void 0}),r=e.reduce((e,t)=>e+t.size,0),i=e.length>t.count?`添付は1つの要望に ${t.count} 件までです`:r>t.totalBytes?`添付の合計が上限(${T(t.totalBytes)})を超えます`:void 0;return{items:n,...i?{total:i}:{}}}async function M(e,t,n){let r=[];for(let[i,a]of e.entries()){try{await t({file:a.file,description:a.description,source:a.source})}catch(e){r.push({...a,error:e.message})}n?.(i+1)}return r}var N=new Map,P=e=>N.get(e)??[];function F(e,t){t.length?N.set(e,t):N.delete(e)}var I=t();function L({requestId:e,tick:t}){let[n,u]=(0,h.useState)(null),[f,p]=(0,h.useState)(null),[m,g]=(0,h.useState)(D),[v,y]=(0,h.useState)(null),[b,x]=(0,h.useState)(()=>P(e)),[S,C]=(0,h.useState)(null),w=(0,h.useRef)(null),A=t=>(x(t),F(e,t));async function j(t){C(t.key);try{await d.addAttachment(e,{file:t.file,description:t.description,source:t.source}),A(b.filter(e=>e.key!==t.key)),M()}catch(e){A(b.map(n=>n.key===t.key?{...n,error:e.message}:n))}finally{C(null)}}let M=()=>void d.attachments(e).then(e=>(u(e),p(null)),e=>p(`添付の一覧を取れません: ${e.message}`));(0,h.useEffect)(M,[e,t]),o(t=>{t.type===`changed`&&t.kind===`attachment`&&t.request===e&&M()});async function N(){g(e=>({...e,busy:!0,error:null}));let t=await O(m,t=>d.addAttachment(e,t));g(t),t.error||(w.current&&(w.current.value=``),M())}async function L(t){if(window.confirm(`${t.name} を外しますか?(実行済みの Preflight に固定した資料は残ります)`)){y(t.id);try{await d.removeAttachment(e,t.id),M()}catch(e){p(`外せませんでした: ${e.message}`)}finally{y(null)}}}let R=n?.items??[];return(0,I.jsx)(i,{title:`添付(次の Preflight に渡す)${R.length?` ${R.length}`:``}`,children:(0,I.jsxs)(`div`,{className:`space-y-3 rounded-lg bg-white p-4 ring-1 ring-slate-200 dark:bg-slate-900 dark:ring-slate-800`,children:[(0,I.jsxs)(`p`,{className:`text-sm text-slate-600 dark:text-slate-400`,children:[`Preflight を始めるときに、その時点の添付を run に固定して Codex に渡します。実行済みの run の資料は変わりません。 今の画面が要るときは、撮った画像を添付してください。PNG / JPEG / xlsx`,n?`(${n.limits.count} 件・合計 ${T(n.limits.totalBytes)} まで)`:``]}),R.length>0&&(0,I.jsx)(`ul`,{className:`divide-y divide-slate-100 dark:divide-slate-800`,children:R.map(t=>(0,I.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2 py-2`,children:[(0,I.jsx)(l,{children:E(t)}),(0,I.jsx)(`span`,{className:`min-w-0 break-all font-medium`,children:t.name}),(0,I.jsx)(`span`,{className:`min-w-0 break-words text-sm text-slate-500`,children:[t.description,t.source&&`出典: ${t.source}`,T(t.bytes),t.createdBy].filter(Boolean).join(` · `)}),(0,I.jsxs)(`span`,{className:`ml-auto flex gap-2`,children:[(0,I.jsx)(`a`,{href:_(e,t.id),className:s(`ghost`),...t.format===`xlsx`?{download:t.name}:{target:`_blank`,rel:`noreferrer`},children:`原本`}),(0,I.jsx)(c,{variant:`ghost`,disabled:v===t.id,onClick:()=>void L(t),children:`外す`})]})]},t.id))}),b.length>0&&(0,I.jsxs)(`div`,{role:`alert`,className:`space-y-2 rounded-md bg-amber-50 p-3 text-sm text-amber-900 dark:bg-amber-950 dark:text-amber-200`,children:[(0,I.jsx)(`p`,{className:`font-medium`,children:`作成時に添付できなかったファイルがあります(要望は作成済みです)`}),(0,I.jsx)(`ul`,{className:`space-y-1.5`,children:b.map(e=>(0,I.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`min-w-0 break-all font-medium`,children:e.file.name}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:e.error?.replace(`${e.file.name}: `,``)}),(0,I.jsxs)(`span`,{className:`flex gap-2`,children:[(0,I.jsx)(c,{disabled:S===e.key,onClick:()=>void j(e),children:S===e.key?`添付中…`:`付け直す`}),(0,I.jsx)(c,{variant:`ghost`,onClick:()=>A(b.filter(t=>t.key!==e.key)),children:`やめる`})]})]},e.key))}),(0,I.jsx)(`p`,{className:`text-amber-800 dark:text-amber-300`,children:`この一覧はページを再読み込みすると消えます。そのときは下の欄から選び直してください`})]}),n?.invalid.map(e=>(0,I.jsxs)(`p`,{className:`text-sm text-rose-600`,children:[`読めない添付: `,e.id,`(`,e.error,`)`]},e.id)),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,I.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-1 text-sm sm:w-auto`,children:[(0,I.jsx)(`span`,{className:`text-slate-500`,children:`ファイル`}),(0,I.jsx)(r,{inputRef:w,accept:k,"aria-label":`添付するファイルを選ぶ`,chosen:m.file?.name??``,onChange:e=>g(t=>({...t,file:e.target.files?.[0]??null,error:null}))})]}),(0,I.jsxs)(`label`,{className:`flex min-w-40 flex-1 flex-col gap-1 text-sm sm:max-w-xs`,children:[(0,I.jsx)(`span`,{className:`text-slate-500`,children:`説明`}),(0,I.jsx)(`input`,{className:a,value:m.description,placeholder:`例: 今の一覧画面`,onChange:e=>g(t=>({...t,description:e.target.value}))})]}),(0,I.jsxs)(`label`,{className:`flex min-w-40 flex-1 flex-col gap-1 text-sm sm:max-w-xs`,children:[(0,I.jsx)(`span`,{className:`text-slate-500`,children:`出典`}),(0,I.jsx)(`input`,{className:a,value:m.source,placeholder:`例: 本番の画面`,onChange:e=>g(t=>({...t,source:e.target.value}))})]}),(0,I.jsx)(c,{variant:`primary`,disabled:!m.file||m.busy,onClick:()=>void N(),children:m.busy?`添付中…`:`添付する`})]}),m.error&&(0,I.jsxs)(`p`,{role:`alert`,className:`text-sm text-rose-600`,children:[`添付できませんでした: `,m.error,`(入力は残しています。直してもう一度押してください)`]}),f&&(0,I.jsx)(`p`,{className:`text-sm text-rose-600`,children:f})]})})}function R({items:e,onChange:t,check:n,disabled:i}){let a=(0,h.useRef)(0),o=(n,r)=>t(e.map(e=>e.key===n?{...e,...r}:e));return(0,I.jsxs)(`fieldset`,{className:`space-y-2`,disabled:i,children:[(0,I.jsx)(`legend`,{className:`text-sm font-medium text-slate-500 dark:text-slate-400`,children:`添付(任意。PNG / JPEG / xlsx。今の画面のスクリーンショットや仕様書など。Preflight に渡します)`}),e.length>0&&(0,I.jsx)(`ul`,{className:`divide-y divide-slate-100 rounded-lg bg-white px-3 ring-1 ring-slate-200 dark:divide-slate-800 dark:bg-slate-900 dark:ring-slate-800`,children:e.map((r,i)=>(0,I.jsxs)(`li`,{className:`space-y-2 py-2`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`min-w-0 break-all font-medium`,children:r.file.name}),(0,I.jsx)(`span`,{className:`text-sm text-slate-500`,children:T(r.file.size)}),(0,I.jsx)(c,{variant:`ghost`,className:`ml-auto`,onClick:()=>t(e.filter(e=>e.key!==r.key)),children:`外す`})]}),n.items[i]&&(0,I.jsx)(`p`,{className:`text-sm text-rose-600`,children:n.items[i]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(`input`,{className:`w-full rounded-md border-0 bg-white px-2.5 py-1.5 text-base ring-1 ring-slate-300 ring-inset focus:ring-2 focus:ring-indigo-500 focus:outline-none dark:bg-slate-900 dark:ring-slate-700 min-w-0 flex-1`,"aria-label":`${r.file.name} の説明`,placeholder:`説明(例: 今の一覧画面)`,value:r.description,onChange:e=>o(r.key,{description:e.target.value})}),(0,I.jsx)(`input`,{className:`w-full rounded-md border-0 bg-white px-2.5 py-1.5 text-base ring-1 ring-slate-300 ring-inset focus:ring-2 focus:ring-indigo-500 focus:outline-none dark:bg-slate-900 dark:ring-slate-700 min-w-0 flex-1`,"aria-label":`${r.file.name} の出典`,placeholder:`出典(例: 本番の画面)`,value:r.source,onChange:e=>o(r.key,{source:e.target.value})})]})]},r.key))}),n.total&&(0,I.jsx)(`p`,{className:`text-sm text-rose-600`,children:n.total}),(0,I.jsx)(r,{label:e.length?`ファイルを追加`:`ファイルを選ぶ(複数可)`,multiple:!0,accept:k,"aria-label":`添付するファイルを選ぶ`,onChange:n=>{let r=[...n.target.files??[]].map(e=>({key:`f${++a.current}`,file:e,description:``,source:``}));t([...e,...r]),n.target.value=``}})]})}function z(e){return e.trim()||null}function B(e,t){let n=z(t);return n===null||e.includes(n)?e:[...e,n]}var V=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]);function H({tags:e,onChange:t,disabled:n,text:r,onText:i,id:o}){let[s,l]=(0,h.useState)(``),d=r??s,f=i??l,[p,m]=(0,h.useState)(null),g=()=>{let n=z(d);if(n!==null){if(e.includes(n))return m(`「${n}」は付いています`);m(null),t([...B(e,n)]),f(``)}};return(0,I.jsxs)(`div`,{className:`space-y-2`,children:[e.length>0&&(0,I.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,"aria-label":`付いているタグ`,children:e.map(r=>(0,I.jsxs)(`li`,{className:`inline-flex max-w-full items-start gap-1 rounded bg-slate-100 py-0.5 pr-0.5 pl-2 text-sm ring-1 ring-slate-200 ring-inset dark:bg-slate-800 dark:ring-slate-700`,children:[(0,I.jsx)(`span`,{className:`min-w-0 break-all whitespace-pre-wrap`,children:r}),(0,I.jsx)(`button`,{type:`button`,disabled:n,"aria-label":`タグ「${r}」を外す`,title:`外す`,onClick:()=>t(e.filter(e=>e!==r)),className:`shrink-0 rounded px-1 text-slate-500 hover:bg-slate-200 hover:text-slate-800 focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:outline-none disabled:opacity-50 dark:hover:bg-slate-700 dark:hover:text-slate-200`,children:`×`})]},r))}),(0,I.jsxs)(`div`,{className:`flex max-w-md gap-2`,children:[(0,I.jsx)(`input`,{id:o,className:u(a,`min-w-0 flex-1`),value:d,disabled:n,placeholder:`例: jira:PROJ-123、group:顧客A`,onChange:e=>(f(e.target.value),m(null)),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),g())}}),(0,I.jsx)(c,{type:`button`,disabled:n||z(d)===null,onClick:g,children:`追加`})]}),p&&(0,I.jsx)(`p`,{role:`status`,className:`text-sm text-slate-500`,children:p})]})}export{S as _,R as a,y as c,x as d,g as f,C as g,w as h,L as i,v as l,F as m,B as n,b as o,M as p,V as r,j as s,H as t,T as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,J as n,_ as r,c as i,d as a,g as o,i as s,n as c,o as l,r as u,x as d,y as f}from"./ui-Cvke4y4X.js";import{a as p,l as m,o as h}from"./index-BUcs2J6N.js";import{r as g,t as _}from"./Outputs-Ni3pNuGU.js";import{i as v,n as y}from"./supersede-CLXlhCq0.js";import{t as b}from"./format-DuK6P1hb.js";import{a as x,c as S,i as ee,l as C,n as w,o as T,r as E,t as D}from"./draft-dT3gLDIt.js";var O=e(n(),1);function k(e){return`T${String(e).padStart(3,`0`)}`}function A(e){let t=/^t?0*(\d+)$/i.exec(e.trim());return t?k(Number(t[1])):void 0}var j=t(),M=e=>({title:e.title,status:e.status,body:e.body,labels:e.labels.join(`, `),areas:e.areas.join(`, `),outputs:e.outputs.join(`
|
|
2
|
-
`),record:e.record??``}),N=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function P({ctx:e,data:t,id:n,onClose:S}){let C=t.request.id,k=`${C}/${A(n)??n}`,[P,L]=(0,O.useState)(),[R,z]=(0,O.useState)([]),[B,V]=(0,O.useState)(),[H,U]=(0,O.useState)(!1),[W,G]=(0,O.useState)(null),K=(0,O.useRef)(r()),q=!!B&&ee(B,x),J=async(e=!1,t=!1)=>{try{let n=await K.current.run(()=>f.task(k));if(n===o)return;L(n.task),z(n.superseded),U(!1);let r=M(n.task);V(i=>e||!i?w(r,n.task.rev):t&&x(i.base,r)?{...i,baseRev:n.task.rev,external:null}:T(i,r,n.task.rev,x))}catch(e){d(e)===`not_found`?U(!0):G(`最新の内容を読み込めませんでした(表示は前の内容のまま): ${e.message}`)}};if((0,O.useEffect)(()=>{V(void 0),U(!1),G(null),J(!0)},[k]),(0,O.useEffect)(()=>{P&&J()},[e.tick]),(0,O.useEffect)(()=>{let e=e=>e.key===`Escape`&&S();return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S]),!P||!B)return null;let Y=B.value,X=e.info.project.repos.length>0,Z=(e,t)=>V(n=>n&&E(n,{...n.value,[e]:t})),te=e=>t.tasks.find(t=>t.id===e)?.title??``,Q=[...P.relations.map(e=>({key:`out-${e.type}-${e.target}`,role:m(e.type,`out`),target:e.target})),...t.tasks.flatMap(e=>e.relations.filter(e=>e.target===P.id).map(t=>({key:`in-${t.type}-${e.id}`,role:m(t.type,`in`),target:e.id})))],$=t=>e.open(t);async function ne(){if(H)return G(`このタスクは見つからないので保存しません。入力は残してあります`);try{let n=await f.patchTask(k,{...Y,labels:N(Y.labels),areas:N(Y.areas),outputs:Y.outputs.split(`
|
|
3
|
-
`).map(e=>e.trim()).filter(Boolean),record:Y.record.trim()||null,rev:B.baseRev});V(w(M(n),n.rev));let r=v(n);G(r?`警告: ${r}`:null),await J(),t.reload(),e.reload()}catch(e){d(e)===`rev_conflict`?(G(`競合: 他で更新されています。入力は残してあります。「破棄」で最新を表示します。`),J()):d(e)===`not_found`?U(!0):G(String(e.message))}}async function re(){try{await f.patchTask(k,{checked:!P.checkedAt,rev:P.rev}),await J(!1,!0),t.reload(),e.reload()}catch(e){G(e.message)}}return(0,j.jsx)(`div`,{className:`fixed inset-0 z-40 flex justify-end bg-slate-900/20`,onClick:S,children:(0,j.jsxs)(`aside`,{onClick:e=>e.stopPropagation(),className:`flex h-full w-full max-w-2xl flex-col bg-white shadow-xl dark:bg-slate-900`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-slate-200 px-5 py-3 dark:border-slate-800`,children:[(0,j.jsx)(l,{id:P.id}),(0,j.jsxs)(`span`,{className:`text-sm text-slate-400`,children:[`rev `,P.rev,` · `,P.updatedBy??`?`]}),(0,j.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[q&&(0,j.jsx)(c,{variant:`ghost`,onClick:()=>(V(e=>e&&D(e)),G(null),void J()),children:`破棄`}),(0,j.jsx)(c,{variant:`primary`,disabled:!q||H,onClick:()=>void ne(),children:`保存`}),(0,j.jsx)(c,{variant:`ghost`,onClick:S,children:`✕`})]})]}),H&&(0,j.jsx)(`div`,{role:`alert`,className:`bg-rose-50 px-5 py-2 text-rose-800 dark:bg-rose-950 dark:text-rose-300`,children:`このタスクは見つかりません(外で削除・アーカイブされました)。保存はしません。入力は残っているので、必要なら写してから閉じてください。`}),q&&B.external&&(0,j.jsxs)(`div`,{role:`status`,className:`bg-amber-50 px-5 py-2 text-amber-800 dark:bg-amber-950 dark:text-amber-300`,children:[`編集中に他で更新されました(rev `,B.external.rev,`)。このまま保存すると競合になります。入力を捨てて最新にするには「破棄」。`]}),W&&(0,j.jsx)(`div`,{className:`bg-amber-50 px-5 py-2 text-amber-800 dark:bg-amber-950 dark:text-amber-300`,children:W}),R.length>0&&P.status!==`done`&&(0,j.jsxs)(`div`,{className:`bg-rose-50 px-5 py-2 text-rose-800 dark:bg-rose-950 dark:text-rose-300`,children:[`このタスクは置き換えられています:`,` `,R.map((e,t)=>(0,j.jsxs)(`span`,{children:[t>0&&` / `,e.from===C?`要望の再評価`:(0,j.jsx)(`button`,{className:`font-mono underline`,onClick:()=>$(e.from),children:y(e,C)}),e.note?`(${e.note})`:``]},e.from)),`。着手する前に確かめ、不要ならアーカイブしてください。`]}),(0,j.jsxs)(`div`,{className:`flex-1 space-y-6 overflow-y-auto p-5`,children:[(0,j.jsx)(`input`,{className:`${a} text-lg font-semibold`,value:Y.title,onChange:e=>Z(`title`,e.target.value)}),(0,j.jsxs)(`div`,{className:`grid grid-cols-[1fr_2fr] items-end gap-3`,children:[(0,j.jsx)(s,{label:`ステータス`,children:(0,j.jsx)(`select`,{className:a,value:Y.status,onChange:e=>Z(`status`,e.target.value),children:p.map(e=>(0,j.jsx)(`option`,{value:e,children:h[e]},e))})}),(0,j.jsxs)(`dl`,{className:`grid grid-cols-3 gap-2 pb-1.5 text-sm`,title:`ステータスを変えたときに p3 が記録する日時`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`dt`,{className:`text-slate-500`,children:`作成`}),(0,j.jsx)(`dd`,{children:b(P.createdAt)})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`dt`,{className:`text-slate-500`,children:`作業中にした`}),(0,j.jsx)(`dd`,{children:b(P.startedAt)||`—`})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`dt`,{className:`text-slate-500`,children:`完了にした`}),(0,j.jsx)(`dd`,{children:b(P.doneAt)||`—`})]})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,j.jsx)(s,{label:`ラベル (カンマ区切り)`,children:(0,j.jsx)(`input`,{className:a,value:Y.labels,onChange:e=>Z(`labels`,e.target.value)})}),(0,j.jsx)(s,{label:`影響領域 areas (カンマ区切り)`,children:(0,j.jsx)(`input`,{className:`${a} font-mono`,value:Y.areas,onChange:e=>Z(`areas`,e.target.value)})})]}),P.doneAt&&(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg bg-emerald-50 px-4 py-2.5 dark:bg-emerald-950/40`,children:[(0,j.jsx)(g,{checked:!!P.checkedAt}),(0,j.jsx)(`span`,{className:`flex-1`,children:P.checkedAt?`済み(${b(P.checkedAt)} に確認)`:`完了しています。成果物を確認したら済みにしてください`}),(0,j.jsx)(c,{variant:P.checkedAt?`ghost`:`primary`,onClick:()=>void re(),children:P.checkedAt?`済みを外す`:`済みにする`})]}),X&&(0,j.jsx)(F,{ctx:e,data:t,task:P,disabled:H,onSaved:()=>(J(!1,!0),t.reload()),onError:G}),(0,j.jsxs)(i,{title:`成果物`,children:[P.outputs.length||P.repoOutputs?.length?(0,j.jsx)(_,{outputs:P.outputs,repoOutputs:P.repoOutputs}):(0,j.jsx)(`p`,{className:`text-sm text-slate-400`,children:`まだありません`}),X&&(0,j.jsx)(I,{ctx:e,task:P,disabled:H,onSaved:()=>(J(!1,!0),t.reload()),onError:G})]}),(0,j.jsx)(s,{label:`成果物を編集(1行に1つ。PR / MR の URL・文章・ドキュメントのパスを混ぜてよい。http(s) の URL はリンクになる)`,children:(0,j.jsx)(`textarea`,{rows:3,className:a,value:Y.outputs,onChange:e=>Z(`outputs`,e.target.value)})}),(0,j.jsx)(s,{label:`本文 (Markdown)`,children:(0,j.jsx)(`textarea`,{rows:6,className:`${a} font-mono`,value:Y.body,onChange:e=>Z(`body`,e.target.value)})}),(0,j.jsx)(s,{label:`変更の記録 (Markdown。完了したら: 何を変えたか・なぜ・入れた決まり・やめたもの)`,children:(0,j.jsx)(`textarea`,{rows:4,className:`${a} font-mono`,value:Y.record,placeholder:P.status===`done`?`まだ書かれていません`:`完了にするときに書きます`,onChange:e=>Z(`record`,e.target.value)})}),(0,j.jsx)(i,{title:`関係(Preflight のタスク化で張ったもの)`,children:Q.length===0?(0,j.jsx)(u,{children:`関係はありません`}):(0,j.jsx)(`ul`,{className:`space-y-1`,children:Q.map(e=>(0,j.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`w-14 shrink-0 text-sm text-slate-500`,children:e.role}),(0,j.jsx)(l,{id:e.target,onClick:()=>$(`${C}/${e.target}`)}),(0,j.jsx)(`span`,{className:`min-w-0 truncate`,children:te(e.target)})]},e.key))})}),(0,j.jsxs)(`p`,{className:`font-mono text-sm text-slate-400`,children:[e.info.dataDir,`/requests/`,C,`/tasks/`,P.id,`.md`]})]})]})})}function F({ctx:e,data:t,task:n,disabled:r,onSaved:i,onError:o}){let c=n.repo,l=c?C(t.request)[c]:void 0,u=async e=>{try{await f.patchTask(`${n.request}/${n.id}`,{repo:e===``?null:e,rev:n.rev}),i()}catch(e){o(e.message)}};return(0,j.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,j.jsx)(s,{label:`作業先(すぐ保存)`,children:(0,j.jsx)(`select`,{className:`${a} !w-56`,value:c??``,disabled:r,onChange:e=>void u(e.target.value),children:S(e.info.project,c).map(e=>(0,j.jsx)(`option`,{value:e.value,disabled:e.invalid,children:e.label},e.value))})}),(0,j.jsx)(`p`,{className:`pb-2 text-sm text-slate-500`,children:c?l?(0,j.jsxs)(j.Fragment,{children:[`ブランチ `,(0,j.jsx)(`code`,{className:`font-mono break-all`,children:l.branch})]}):`ブランチなし(git でないフォルダ・まだ割り当てていない)`:`作業先なし(調査・人の判断など)`})]})}function I({ctx:e,task:t,disabled:n,onSaved:r,onError:i}){let o=S(e.info.project,null).filter(e=>e.value!==``),[s,l]=(0,O.useState)(t.repo??o[0]?.value??``),[u,d]=(0,O.useState)(``),p=async e=>{try{await f.patchTask(`${t.request}/${t.id}`,{repoOutputs:e,rev:t.rev}),d(``),r()}catch(e){i(e.message)}},m=t.repoOutputs??[];return(0,j.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[m.length>0&&(0,j.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,"aria-label":`リポジトリごとの成果物`,children:m.map((e,t)=>(0,j.jsxs)(`li`,{className:`inline-flex max-w-full items-center gap-1 rounded bg-slate-100 py-0.5 pr-0.5 pl-2 text-sm dark:bg-slate-800`,children:[(0,j.jsxs)(`span`,{className:`min-w-0 break-all`,children:[e.repo,`: `,e.output]}),(0,j.jsx)(`button`,{type:`button`,disabled:n,"aria-label":`${e.repo} の成果物「${e.output}」を外す`,onClick:()=>void p(m.filter((e,n)=>n!==t)),className:`shrink-0 rounded px-1 text-slate-500 hover:bg-slate-200 dark:hover:bg-slate-700`,children:`×`})]},`${t}:${e.repo}:${e.output}`))}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,j.jsx)(`select`,{className:`${a} !w-40`,value:s,disabled:n,"aria-label":`成果物のリポジトリ`,onChange:e=>l(e.target.value),children:o.map(e=>(0,j.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,j.jsx)(`input`,{className:`${a} min-w-0 flex-1`,value:u,disabled:n,placeholder:`リポジトリごとの成果物(PR の URL など)`,"aria-label":`リポジトリごとの成果物`,onChange:e=>d(e.target.value)}),(0,j.jsx)(c,{disabled:n||!s||!u.trim(),onClick:()=>void p([...m,{repo:s,output:u.trim()}]),children:`足す`})]})]})}export{P as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,S as t,r as n}from"./ui-Cvke4y4X.js";import{t as r}from"./link-_s8ndNKS.js";import{S as i,d as a,x as o}from"./index-BUcs2J6N.js";import{t as s}from"./TaskDrawer-BkDIstIN.js";import{n as c,t as l}from"./requestData-D8ZiSZss.js";var u=e();function d(){let{requestId:e}=a.useParams();return(0,u.jsx)(l,{requestId:e,fallback:(0,u.jsx)(`div`,{className:`p-10`,children:(0,u.jsxs)(n,{children:[e,` は見つかりません`]})}),children:(0,u.jsx)(p,{})},e)}var f=[{to:`/requests/$requestId`,label:`概要・Preflight`,exact:!0},{to:`/requests/$requestId/board`,label:`タスクボード`,exact:!1},{to:`/requests/$requestId/done`,label:`対応済み`,exact:!1,hint:`人が「済み」にしたタスクの一覧(要望のステータスの「対応済」とは別)`}];function p(){let e=o(),n=c(),{request:l,tasks:d}=n,{task:p}=a.useSearch(),m=t(),h=d.filter(e=>e.status===`done`).length;return(0,u.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,u.jsxs)(`div`,{className:`border-b border-slate-200 bg-white px-6 pt-4 dark:border-slate-800 dark:bg-slate-900`,children:[(0,u.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,u.jsx)(`h1`,{className:`min-w-0 text-xl font-bold break-words`,children:l.title}),d.length>0&&(0,u.jsxs)(`span`,{className:`text-sm whitespace-nowrap text-slate-500`,children:[`タスク `,h,`/`,d.length,` 完了`]})]}),n.gone&&(0,u.jsxs)(`p`,{role:`alert`,className:`mt-2 rounded-md bg-rose-50 px-3 py-2 text-rose-800 dark:bg-rose-950 dark:text-rose-300`,children:[`この要望は見つかりません(外で削除・アーカイブされました)。表示は最後に読み込めた内容で、保存はしません。 入力中の内容は残っているので、必要なら写してから`,` `,(0,u.jsx)(r,{to:`/`,className:`underline`,children:`進捗へ戻って`}),`ください。`]}),n.loadError&&!n.gone&&(0,u.jsxs)(`p`,{role:`alert`,className:`mt-2 rounded-md bg-amber-50 px-3 py-2 text-amber-800 dark:bg-amber-950 dark:text-amber-300`,children:[`最新の内容を読み込めませんでした(表示は前の内容のまま): `,n.loadError,` `,(0,u.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>n.reload(),children:`もう一度読み込む`})]}),(0,u.jsx)(`nav`,{className:`mt-3 flex gap-1 overflow-x-auto`,children:f.map(e=>(0,u.jsx)(r,{title:`hint`in e?e.hint:void 0,to:e.to,params:{requestId:l.id},activeOptions:{exact:e.exact,includeSearch:!1},className:`-mb-px border-b-2 px-3 py-2 font-medium whitespace-nowrap`,activeProps:{className:`border-indigo-600 text-indigo-700 dark:text-indigo-300`},inactiveProps:{className:`border-transparent text-slate-500 hover:text-slate-800 dark:hover:text-slate-200`},children:e.label},e.to))})]}),(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,u.jsx)(i,{})}),p&&(0,u.jsx)(s,{ctx:e,data:n,id:p,onClose:()=>void m({to:`.`,search:e=>({...e,task:void 0})})})]})}export{d as component};
|