@infodb/p3 0.11.0 → 0.13.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 +33 -33
- package/dist/web/assets/CompletionReview-gZKZrDu_.js +1 -0
- package/dist/web/assets/ImprovementDialog-Dno6dPnG.js +1 -0
- package/dist/web/assets/Outputs-BgHalMGb.js +1 -0
- package/dist/web/assets/RequestStatus-hZcBUUIu.js +1 -0
- package/dist/web/assets/Tabs-C3NmwCc3.js +1 -0
- package/dist/web/assets/TagInput-B2b862qn.js +1 -0
- package/dist/web/assets/TaskDrawer-4BQBELXa.js +6 -0
- package/dist/web/assets/_requestId-BMAG1t3o.js +1 -0
- package/dist/web/assets/_requestId-tbg2pA2S.js +1 -0
- package/dist/web/assets/archive-DMl6WyOe.js +1 -0
- package/dist/web/assets/board-BMTcHKyt.js +1 -0
- package/dist/web/assets/done-CL6Nlsua.js +1 -0
- package/dist/web/assets/draft-BvGxfD7v.js +2 -0
- package/dist/web/assets/index-Dp7Fc4VI.css +2 -0
- package/dist/web/assets/index-KdlgMitg.js +12 -0
- package/dist/web/assets/metrics-Cu7gJ7Rk.js +1 -0
- package/dist/web/assets/new-DTXWHuFO.js +1 -0
- package/dist/web/assets/outputs-CXqnjSqV.js +1 -0
- package/dist/web/assets/preflightInput-ClKwkp8R.js +2 -0
- package/dist/web/assets/preload-helper-oLCrNCwz.js +1 -0
- package/dist/web/assets/quality-RFd-7k3r.js +1 -0
- package/dist/web/assets/release-notes-Bpdi6RdY.js +5 -0
- package/dist/web/assets/requestData-CbFxwW5w.js +1 -0
- package/dist/web/assets/routes-BIt8bExF.js +6 -0
- package/dist/web/assets/settings-CsCqF_1B.js +1 -0
- package/dist/web/assets/taskReview-_WCgnQit.js +1 -0
- package/dist/web/assets/ui-BGK72r3u.js +1 -0
- package/dist/web/assets/workTarget-CySfKyfB.js +30 -0
- package/dist/web/index.html +4 -4
- package/docs/architecture.md +610 -33
- package/docs/development.md +61 -17
- package/docs/how-to-use.md +554 -17
- package/docs/installation.md +235 -144
- package/docs/publishing.md +1 -1
- package/lib/cli/agentsStatus.js +197 -0
- package/lib/cli/args.js +111 -2
- package/lib/cli/guide.js +27 -0
- package/lib/cli/guide.md +214 -0
- package/lib/cli/help.js +74 -1
- package/lib/cli/main.js +97 -17
- package/lib/cli/metricsCommands.js +77 -0
- package/lib/cli/output.js +19 -1
- package/lib/cli/preflightCommands.js +7 -1
- package/lib/cli/project.js +13 -24
- package/lib/cli/qualityCommands.js +188 -0
- package/lib/cli/readOnly.js +17 -0
- package/lib/cli/requestCommands.js +33 -4
- package/lib/cli/requirementCommands.js +288 -0
- package/lib/cli/retroCommands.js +106 -0
- package/lib/cli/revisitCommands.js +73 -0
- package/lib/cli/showView.js +183 -4
- package/lib/cli/taskCommands.js +341 -20
- package/lib/cli/taskReviewCommands.js +178 -0
- package/lib/cli/userConfig.js +47 -0
- package/lib/core/completionRefs.js +46 -0
- package/lib/core/context.js +4 -1
- package/lib/core/metrics/definitions.js +434 -0
- package/lib/core/metrics/index.js +88 -0
- package/lib/core/metrics/manual.js +180 -0
- package/lib/core/milestoneReview/material.js +11 -1
- package/lib/core/milestoneReview/mockReviewer.js +1 -0
- package/lib/core/milestoneReview/review.js +70 -6
- package/lib/core/milestoneReview/service.js +29 -93
- package/lib/core/milestoneReview/store.js +12 -62
- package/lib/core/ops.js +23 -3
- package/lib/core/preflight/carryover.js +6 -2
- package/lib/core/preflight/codexEngine.js +34 -17
- package/lib/core/preflight/diagnose.js +4 -9
- package/lib/core/preflight/engine.js +15 -0
- package/lib/core/preflight/hostPaths.js +260 -0
- package/lib/core/preflight/input.js +33 -5
- package/lib/core/preflight/instructions.js +36 -2
- package/lib/core/preflight/mockEngine.js +24 -2
- package/lib/core/preflight/render.js +22 -3
- package/lib/core/preflight/service.js +99 -8
- package/lib/core/preflight/uiRender.js +3 -0
- package/lib/core/projectRegistry.js +3 -3
- package/lib/core/quality.js +21 -0
- package/lib/core/qualityImprovement.js +221 -0
- package/lib/core/requestOps.js +294 -11
- package/lib/core/retrospective.js +208 -0
- package/lib/core/reviewCandidates.js +56 -0
- package/lib/core/reviewRuns.js +205 -0
- package/lib/core/store/archivedTasks.js +74 -0
- package/lib/core/store/collection.js +32 -3
- package/lib/core/store/normalize.js +35 -2
- package/lib/core/store/preflightStore.js +23 -1
- package/lib/core/store/projectFile.js +10 -0
- package/lib/core/store/workspace.js +49 -3
- package/lib/core/taskReview/material.js +459 -0
- package/lib/core/taskReview/mockReviewer.js +30 -0
- package/lib/core/taskReview/paths.js +15 -0
- package/lib/core/taskReview/review.js +312 -0
- package/lib/core/taskReview/service.js +187 -0
- package/lib/core/taskReview/store.js +214 -0
- package/lib/server/api/manifest.js +104 -5
- package/lib/server/api/milestoneReviewRoutes.js +4 -3
- package/lib/server/api/routes.js +265 -17
- package/lib/server/api/taskReviewRoutes.js +66 -0
- package/lib/server/server.js +2 -2
- package/lib/shared/acceptance.js +618 -0
- package/lib/shared/completionRecord.js +327 -0
- package/lib/shared/metrics.js +42 -0
- package/lib/shared/milestoneReview.js +2 -1
- package/lib/shared/preflightInput.js +1 -1
- package/lib/shared/quality.js +391 -0
- package/lib/shared/qualityImprovement.js +1 -0
- package/lib/shared/qualityTemplates.js +31 -0
- package/lib/shared/requirementSource.js +635 -0
- package/lib/shared/retrospective.js +286 -0
- package/lib/shared/reviewCandidate.js +308 -0
- package/lib/shared/reworkHistory.js +81 -0
- package/lib/shared/taskBlock.js +142 -0
- package/lib/shared/taskReview.js +56 -0
- package/package.json +3 -2
- package/skills/p3/SKILL.md +9 -152
- package/dist/web/assets/Outputs-ddwte0jj.js +0 -1
- package/dist/web/assets/RequestStatus-Bg1OLbRc.js +0 -1
- package/dist/web/assets/Tabs-DTmggzgg.js +0 -1
- package/dist/web/assets/TagInput-BHAgjLP7.js +0 -1
- package/dist/web/assets/TaskDrawer-Dz_5c2NH.js +0 -3
- package/dist/web/assets/_requestId-D9-gtIcG.js +0 -1
- package/dist/web/assets/_requestId-DzCNYvqf.js +0 -30
- package/dist/web/assets/appCtx-Cm24VpAf.js +0 -1
- package/dist/web/assets/board-MCHcZ-PU.js +0 -1
- package/dist/web/assets/done-zq10Bt08.js +0 -1
- package/dist/web/assets/draft-CfJeyLOl.js +0 -1
- package/dist/web/assets/index-Ce0ndpne.js +0 -12
- package/dist/web/assets/index-D68mkSnw.css +0 -2
- package/dist/web/assets/new-9TKiNT4O.js +0 -1
- package/dist/web/assets/preflightInput-BAeEJYUK.js +0 -2
- package/dist/web/assets/preload-helper-FBLw7u7x.js +0 -1
- package/dist/web/assets/release-notes-hK5XezLW.js +0 -5
- package/dist/web/assets/requestData-BnN7mctX.js +0 -1
- package/dist/web/assets/routes-usHwrrA0.js +0 -3
- package/dist/web/assets/settings-BVZDnL6O.js +0 -1
- package/dist/web/assets/workTarget-Cijqq4yH.js +0 -1
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { ACCEPTANCE_KEYS, readAcceptance } from "../../shared/acceptance.js";
|
|
2
|
+
import { BLOCK_KEYS, readBlock } from "../../shared/taskBlock.js";
|
|
3
|
+
import { COMPLETION_KEYS, readCompletion } from "../../shared/completionRecord.js";
|
|
4
|
+
import { PREMISE_KEYS, readPremises } from "../../shared/reviewCandidate.js";
|
|
5
|
+
import { readRework, REWORK_KEYS } from "../../shared/reworkHistory.js";
|
|
6
|
+
import { qualityVersion, readQuality } from "../../shared/quality.js";
|
|
7
|
+
import { readRequirement, REQUIREMENT_KEYS } from "../../shared/requirementSource.js";
|
|
1
8
|
import { repoNameProblem } from "../../shared/repos.js";
|
|
2
9
|
import { isPreflightRunner } from "../../shared/preflightRunner.js";
|
|
3
10
|
import { isTaskStatus, RELATION_TYPES, REQUEST_STATUSES } from "../../shared/types.js";
|
|
@@ -38,6 +45,10 @@ export const normalizeTaskIn = (requestId) => (d, body, id) => ({
|
|
|
38
45
|
doneAt: d.doneAt ? iso(d.doneAt) : undefined,
|
|
39
46
|
checkedAt: d.checkedAt ? iso(d.checkedAt) : undefined,
|
|
40
47
|
record: str(d.record)?.trim() || undefined,
|
|
48
|
+
...readAcceptance(d),
|
|
49
|
+
...readBlock(d),
|
|
50
|
+
...readCompletion(d),
|
|
51
|
+
...readRework(d),
|
|
41
52
|
relations: normalizeRelations(d.relations),
|
|
42
53
|
rev: num(d.rev) ?? 1,
|
|
43
54
|
createdAt: iso(d.createdAt),
|
|
@@ -45,9 +56,18 @@ export const normalizeTaskIn = (requestId) => (d, body, id) => ({
|
|
|
45
56
|
updatedBy: str(d.updatedBy),
|
|
46
57
|
body,
|
|
47
58
|
});
|
|
59
|
+
/** タスクのうちファイルに書かないキー(場所から決まるもの・読んだときの問題) */
|
|
60
|
+
export const TASK_DERIVED = ["request", "ref", "acceptanceProblems", "blockProblems", "completionProblems", "reworkProblems"];
|
|
61
|
+
/** 基準・証拠が壊れていたら、関係のない更新ではファイルの元の値のまま書き戻す(shared/acceptance.ts) */
|
|
62
|
+
export const taskKeepRaw = (t) => [
|
|
63
|
+
...(t.acceptanceProblems?.length ? ACCEPTANCE_KEYS : []),
|
|
64
|
+
...(t.blockProblems?.length ? BLOCK_KEYS : []),
|
|
65
|
+
...(t.completionProblems?.length ? COMPLETION_KEYS : []),
|
|
66
|
+
...(t.reworkProblems?.length ? REWORK_KEYS : []),
|
|
67
|
+
];
|
|
48
68
|
export const TASK_KEY_ORDER = [
|
|
49
69
|
"id", "title", "status", "repo", "labels", "areas", "outputs", "repoOutputs", "record",
|
|
50
|
-
"relations", "rev", "createdAt", "startedAt", "doneAt", "checkedAt", "updatedAt", "updatedBy",
|
|
70
|
+
"acceptanceCriteria", "acceptanceEvidence", "acceptanceSeq", "acceptanceSources", "block", "blockHistory", "relations", "rev", "createdAt", "startedAt", "doneAt", "checkedAt", "updatedAt", "updatedBy", "reworkHistory", "completionRecords",
|
|
51
71
|
];
|
|
52
72
|
export function normalizeRequest(d, body, id) {
|
|
53
73
|
const status = str(d.status);
|
|
@@ -66,6 +86,9 @@ export function normalizeRequest(d, body, id) {
|
|
|
66
86
|
tags: strs(d.tags),
|
|
67
87
|
...(d.workstreams && typeof d.workstreams === "object" ? { workstreams: normalizeWorkstreams(d.workstreams) } : {}),
|
|
68
88
|
lastPreflight: str(d.lastPreflight),
|
|
89
|
+
...readRequirement(d),
|
|
90
|
+
...readCompletion(d),
|
|
91
|
+
...readPremises(d),
|
|
69
92
|
rev: num(d.rev) ?? 1,
|
|
70
93
|
createdAt: iso(d.createdAt),
|
|
71
94
|
updatedAt: iso(d.updatedAt),
|
|
@@ -75,8 +98,12 @@ export function normalizeRequest(d, body, id) {
|
|
|
75
98
|
}
|
|
76
99
|
export const REQUEST_KEY_ORDER = [
|
|
77
100
|
"id", "title", "status", "parent", "childOrder", "splitFrom", "due", "milestone", "tags", "areas", "workstreams", "lastPreflight",
|
|
78
|
-
"rev", "createdAt", "updatedAt", "updatedBy",
|
|
101
|
+
"requirementSources", "requirementSeq", "clarifyAnswers", "rev", "createdAt", "updatedAt", "updatedBy", "premiseChanges", "completionRecords",
|
|
79
102
|
];
|
|
103
|
+
/** 要望のうちファイルに書かないキー(読んだときの問題) */
|
|
104
|
+
export const REQUEST_DERIVED = ["requirementProblems", "completionProblems", "premiseProblems"];
|
|
105
|
+
/** 要求の根拠・回答が壊れていたら、関係のない更新ではファイルの元の値のまま書き戻す(shared/requirementSource.ts) */
|
|
106
|
+
export const requestKeepRaw = (r) => [...(r.requirementProblems?.length ? REQUIREMENT_KEYS : []), ...(r.completionProblems?.length ? COMPLETION_KEYS : []), ...(r.premiseProblems?.length ? PREMISE_KEYS : [])];
|
|
80
107
|
/** preflight.runner(未設定は書かない。読めない値は invalidRunner に残し、担当を推測しない) */
|
|
81
108
|
function runnerOf(v) {
|
|
82
109
|
const raw = str(v)?.trim();
|
|
@@ -123,8 +150,14 @@ export function normalizeProject(d) {
|
|
|
123
150
|
: [],
|
|
124
151
|
branchPattern: str(d.branchPattern) ?? "req/{id}-{slug}",
|
|
125
152
|
preflight: { instructions: str(preflight.instructions) ?? "", ...runnerOf(preflight.runner) },
|
|
153
|
+
...qualityOf(d.quality, normalizeRepos(d.repos).map((r) => r.name)),
|
|
126
154
|
};
|
|
127
155
|
}
|
|
156
|
+
/** 品質基準(無い・読めない・読めるを分ける。読めない値もそのまま版に入れ、書き換えない) */
|
|
157
|
+
function qualityOf(raw, repoNames) {
|
|
158
|
+
const quality = readQuality(raw, repoNames);
|
|
159
|
+
return { quality, qualityVersion: qualityVersion(quality, raw) };
|
|
160
|
+
}
|
|
128
161
|
/**
|
|
129
162
|
* project.yaml の repos。名前をキーにした対応(推奨)か、name を持つ項目の並び。名前が使えない項目・重複は読まない
|
|
130
163
|
* (書き戻すときも p3 repo で変えた項目のほかは触らないので、ファイルからは消えない)。
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { readdir, readFile, mkdir, rm, stat } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { readDraftCriteria } from "../../shared/acceptance.js";
|
|
4
|
+
import { readCriterionSources } from "../../shared/requirementSource.js";
|
|
3
5
|
import { parseFrontmatter, stringifyFrontmatter } from "./frontmatter.js";
|
|
6
|
+
/** 案の受け入れ基準と要求の根拠(無い古い案は何も足さない。読めない項目は acceptanceProblems に理由) */
|
|
7
|
+
function draftCriteriaOf(raw, rawSources) {
|
|
8
|
+
const { criteria, problems = [] } = readDraftCriteria(raw);
|
|
9
|
+
const sourceProblems = [];
|
|
10
|
+
const sources = readCriterionSources(rawSources, sourceProblems);
|
|
11
|
+
const all = [...problems, ...sourceProblems];
|
|
12
|
+
return { ...(criteria ? { acceptanceCriteria: criteria } : {}), ...(sources ? { acceptanceSources: sources } : {}), ...(all.length ? { acceptanceProblems: all } : {}) };
|
|
13
|
+
}
|
|
4
14
|
import { writeFileAtomic } from "./fsutil.js";
|
|
5
15
|
/**
|
|
6
16
|
* requests/<要望ID>/preflight/<RUN-ID>/
|
|
@@ -32,9 +42,20 @@ export class PreflightStore {
|
|
|
32
42
|
await this.saveDraft(requestId, runId, d);
|
|
33
43
|
}
|
|
34
44
|
async saveDraft(requestId, runId, d) {
|
|
35
|
-
|
|
45
|
+
// 基準が読めない理由は書かない(読むたびに決まる)
|
|
46
|
+
const { description, acceptanceProblems: _p, ...meta } = d;
|
|
36
47
|
await writeFileAtomic(join(this.runDir(requestId, runId), "drafts", `${d.key}.md`), stringifyFrontmatter({ ...meta, include: d.include }, description));
|
|
37
48
|
}
|
|
49
|
+
/** 案のファイルの frontmatter の元の値(読めなかった項目を、関係のない更新で消さないため) */
|
|
50
|
+
async rawDraftField(requestId, runId, key, field) {
|
|
51
|
+
const text = await readFile(join(this.runDir(requestId, runId), "drafts", `${key}.md`), "utf8").catch(() => undefined);
|
|
52
|
+
return text === undefined ? undefined : parseFrontmatter(text).data[field];
|
|
53
|
+
}
|
|
54
|
+
/** extra: 読めた値の代わりに元の値のまま書く項目 */
|
|
55
|
+
async saveDraftRaw(requestId, runId, d, extra) {
|
|
56
|
+
const { description, acceptanceProblems: _p, ...meta } = d;
|
|
57
|
+
await writeFileAtomic(join(this.runDir(requestId, runId), "drafts", `${d.key}.md`), stringifyFrontmatter({ ...meta, ...extra, include: d.include }, description));
|
|
58
|
+
}
|
|
38
59
|
async loadDrafts(requestId, runId) {
|
|
39
60
|
const dir = join(this.runDir(requestId, runId), "drafts");
|
|
40
61
|
const files = await readdir(dir).catch(() => []);
|
|
@@ -50,6 +71,7 @@ export class PreflightStore {
|
|
|
50
71
|
supersedes: Array.isArray(data.supersedes) ? data.supersedes.map(String) : [],
|
|
51
72
|
include: data.include !== false,
|
|
52
73
|
...("repo" in data ? { repo: data.repo === null || data.repo === "" || data.repo === "none" ? null : String(data.repo) } : {}),
|
|
74
|
+
...draftCriteriaOf(data.acceptanceCriteria, data.acceptanceSources),
|
|
53
75
|
});
|
|
54
76
|
}
|
|
55
77
|
return drafts.sort((a, b) => a.key.localeCompare(b.key, undefined, { numeric: true }));
|
|
@@ -109,3 +109,13 @@ export async function writeRepoEntry(path, name, entry) {
|
|
|
109
109
|
sortKeys(doc);
|
|
110
110
|
await writeFileAtomic(path, doc.toString({ lineWidth: 0 }));
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* project.yaml の quality だけを書き換える(ほかの項目・コメントは残す)。plain は qualityPlain の形。
|
|
114
|
+
* ロックと版の照合は呼ぶ側(Workspace.writeQuality)
|
|
115
|
+
*/
|
|
116
|
+
export async function writeQualityFile(path, plain) {
|
|
117
|
+
const text = await readFile(path, "utf8").catch(() => "");
|
|
118
|
+
const doc = text.trim() ? YAML.parseDocument(text) : new YAML.Document({});
|
|
119
|
+
doc.set("quality", doc.createNode(plain));
|
|
120
|
+
await writeFileAtomic(path, doc.toString({ lineWidth: 0 }));
|
|
121
|
+
}
|
|
@@ -4,17 +4,19 @@ import { join } from "node:path";
|
|
|
4
4
|
import YAML from "yaml";
|
|
5
5
|
import { parseRef, REQUEST_ID, TASK_ID, taskId } from "../../shared/refs.js";
|
|
6
6
|
import { milestoneGoalProblems, tidyMilestoneGoals } from "../../shared/milestoneGoals.js";
|
|
7
|
+
import { QualityInputError, qualityPlain } from "../../shared/quality.js";
|
|
7
8
|
import { fileLayout, folderLayout, MarkdownCollection, NotFoundError } from "./collection.js";
|
|
8
9
|
import { newRequestId, withFileLock } from "./fsutil.js";
|
|
9
|
-
import { normalizeProject, normalizeRequest, normalizeTaskIn, REQUEST_KEY_ORDER, TASK_KEY_ORDER } from "./normalize.js";
|
|
10
|
+
import { normalizeProject, normalizeRequest, normalizeTaskIn, REQUEST_KEY_ORDER, REQUEST_DERIVED, requestKeepRaw, TASK_DERIVED, TASK_KEY_ORDER, taskKeepRaw } from "./normalize.js";
|
|
10
11
|
import { AttachmentStore } from "./attachments.js";
|
|
11
12
|
import { DataWatcher } from "./dataWatcher.js";
|
|
12
13
|
import { NoteStore } from "./noteStore.js";
|
|
13
14
|
import { PreflightStore } from "./preflightStore.js";
|
|
14
|
-
import { writeProjectFile } from "./projectFile.js";
|
|
15
|
+
import { writeProjectFile, writeQualityFile } from "./projectFile.js";
|
|
15
16
|
import { resolveRefs } from "../repoRefs.js";
|
|
16
17
|
import { RELEASE_NOTES_DIR, ReleaseNoteStore } from "../releaseNotes/store.js";
|
|
17
18
|
import { MILESTONE_REVIEWS_DIR, MilestoneReviewStore } from "../milestoneReview/store.js";
|
|
19
|
+
import { TASK_REVIEWS_DIR, TaskReviewStore } from "../taskReview/store.js";
|
|
18
20
|
/** 保存する並びの各項目で、purpose / goals のキーが無ければ同じ ID の今の値を残す */
|
|
19
21
|
function keepGoals(next, cur) {
|
|
20
22
|
return next.map((m) => {
|
|
@@ -78,6 +80,8 @@ export class Workspace {
|
|
|
78
80
|
releaseNotes;
|
|
79
81
|
/** マイルストーンレビューの履歴(milestoneReview/store.ts) */
|
|
80
82
|
milestoneReviews;
|
|
83
|
+
/** タスクの AI レビューの履歴(requests/<要望ID>/task-reviews/) */
|
|
84
|
+
taskReviews;
|
|
81
85
|
taskCollections = new Map();
|
|
82
86
|
listeners = new Set();
|
|
83
87
|
watcher;
|
|
@@ -90,16 +94,28 @@ export class Workspace {
|
|
|
90
94
|
layout: folderLayout(this.requestsDir, "request.md", REQUEST_ID, () => newRequestId()),
|
|
91
95
|
normalize: normalizeRequest,
|
|
92
96
|
keyOrder: REQUEST_KEY_ORDER,
|
|
97
|
+
derived: REQUEST_DERIVED,
|
|
98
|
+
keepRaw: requestKeepRaw,
|
|
99
|
+
// 要望ごとのロック(タスクと同じ。要望のフォルダの外に置くので、アーカイブで一緒に動かない)
|
|
100
|
+
lock: (id) => (id ? this.requestLock(id) : undefined),
|
|
93
101
|
});
|
|
94
102
|
this.preflight = new PreflightStore(this.requestsDir);
|
|
95
103
|
this.notes = new NoteStore(this.requestsDir);
|
|
96
104
|
this.attachments = new AttachmentStore(this.requestsDir);
|
|
97
105
|
this.releaseNotes = new ReleaseNoteStore(dataDir);
|
|
98
106
|
this.milestoneReviews = new MilestoneReviewStore(dataDir);
|
|
107
|
+
this.taskReviews = new TaskReviewStore(this.requestsDir);
|
|
99
108
|
}
|
|
100
109
|
get requestsDir() {
|
|
101
110
|
return join(this.dataDir, "requests");
|
|
102
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* 要望とそのタスクの保存のロック(requests/.locks/<要望ID>.lock)。読み直してから書く・移すまでを、別のプロセスと1つずつにする。
|
|
114
|
+
* ロックの順: 親子の操作のロック(.hierarchy.lock)→ この要望のロック。このロックの中で別の要望・タスクのロックは取らない
|
|
115
|
+
*/
|
|
116
|
+
requestLock(rid) {
|
|
117
|
+
return join(this.requestsDir, ".locks", `${rid}.lock`);
|
|
118
|
+
}
|
|
103
119
|
/** このマシンのパスを変えた(個人設定に書いた後に呼ぶ) */
|
|
104
120
|
setLocalRepo(name, path) {
|
|
105
121
|
const next = { ...this.localRepos };
|
|
@@ -204,8 +220,10 @@ export class Workspace {
|
|
|
204
220
|
layout: fileLayout(join(this.requestsDir, requestId, "tasks"), TASK_ID, taskId),
|
|
205
221
|
normalize: normalizeTaskIn(requestId),
|
|
206
222
|
keyOrder: TASK_KEY_ORDER,
|
|
207
|
-
derived:
|
|
223
|
+
derived: TASK_DERIVED,
|
|
224
|
+
keepRaw: taskKeepRaw,
|
|
208
225
|
beforeWrite: (prev, next) => stampStatus(prev, next),
|
|
226
|
+
lock: () => this.requestLock(requestId),
|
|
209
227
|
});
|
|
210
228
|
this.taskCollections.set(requestId, col);
|
|
211
229
|
}
|
|
@@ -266,6 +284,24 @@ export class Workspace {
|
|
|
266
284
|
return { ...cur, ...patch, milestones, preflight };
|
|
267
285
|
}, opts);
|
|
268
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* 品質基準を、ロックの中で読み直した最新の値から作り直して書く(project.yaml の quality だけ)。expectedVersion が今の版と違えば
|
|
289
|
+
* QualityInputError(quality_conflict)で何も書かない。make が投げたら何も書かない
|
|
290
|
+
*/
|
|
291
|
+
async writeQuality(make, opts = {}) {
|
|
292
|
+
const path = join(this.dataDir, "project.yaml");
|
|
293
|
+
await withFileLock(join(this.dataDir, ".project.yaml.lock"), async () => {
|
|
294
|
+
await this.loadProject();
|
|
295
|
+
const now = this.project.qualityVersion;
|
|
296
|
+
if (opts.expectedVersion !== undefined && opts.expectedVersion !== now) {
|
|
297
|
+
throw new QualityInputError("quality_conflict", `品質基準が他で変わりました(版 ${opts.expectedVersion} → ${now})。最新を読み直してからやり直してください`);
|
|
298
|
+
}
|
|
299
|
+
await writeQualityFile(path, qualityPlain(make(this.project)));
|
|
300
|
+
await this.loadProject();
|
|
301
|
+
});
|
|
302
|
+
this.emit({ type: "changed", kind: "project" });
|
|
303
|
+
return this.project;
|
|
304
|
+
}
|
|
269
305
|
/**
|
|
270
306
|
* マイルストーンを、ロックの中で読んだ最新の並びから作り直して書く(CLI の milestone の操作。指定した項目のほかを巻き戻さない)。
|
|
271
307
|
* fn が投げたら何も書かない
|
|
@@ -349,6 +385,12 @@ export class Workspace {
|
|
|
349
385
|
}
|
|
350
386
|
if (top !== "requests" || !rid || !REQUEST_ID.test(rid))
|
|
351
387
|
return;
|
|
388
|
+
if (kind === TASK_REVIEWS_DIR) {
|
|
389
|
+
// タスクのレビューの履歴(ほかのプロセスの実行・取消)。ロックのフォルダ .locks は除く
|
|
390
|
+
if (file && !file.startsWith("."))
|
|
391
|
+
this.emit({ type: "task-review", request: rid, task: file });
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
352
394
|
if (kind === undefined || kind === "request.md") {
|
|
353
395
|
// 要望の作成・削除(git pull でフォルダごと増減することもある)
|
|
354
396
|
const known = !!this.requests.get(rid);
|
|
@@ -364,6 +406,10 @@ export class Workspace {
|
|
|
364
406
|
await this.tasksOf(rid).reload(id);
|
|
365
407
|
this.emit({ type: "changed", kind: "task", request: rid, ref: `${rid}/${id}` });
|
|
366
408
|
}
|
|
409
|
+
else if (kind === "retrospective.json") {
|
|
410
|
+
// 振り返りの記録(ほかのプロセスの確定・確認)
|
|
411
|
+
this.emit({ type: "changed", kind: "request", request: rid });
|
|
412
|
+
}
|
|
367
413
|
else if (kind === "preflight") {
|
|
368
414
|
this.emit({ type: "changed", kind: "preflight", request: rid });
|
|
369
415
|
}
|