@infodb/p3 0.12.0 → 0.14.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 -35
- package/bin/p3.mjs +3 -2
- package/dist/web/assets/CompletionReview-BD7d6Yzt.js +1 -0
- package/dist/web/assets/ImprovementDialog-BoAZN1KR.js +1 -0
- package/dist/web/assets/Outputs-D-ZouoxF.js +1 -0
- package/dist/web/assets/RequestStatus-Bl3fdSbM.js +1 -0
- package/dist/web/assets/Tabs-CxeceOL-.js +1 -0
- package/dist/web/assets/TagInput-CeAbmGRR.js +1 -0
- package/dist/web/assets/TaskDrawer-BCriSnhe.js +6 -0
- package/dist/web/assets/_requestId-CZKMe_mC.js +1 -0
- package/dist/web/assets/_requestId-Fx4lLkFo.js +1 -0
- package/dist/web/assets/appCtx-BdxbkSZa.js +1 -0
- package/dist/web/assets/archive-D5IIxcSV.js +1 -0
- package/dist/web/assets/board-p6R9KMqd.js +1 -0
- package/dist/web/assets/done-BTOF188x.js +1 -0
- package/dist/web/assets/draft-BWYpm3PD.js +2 -0
- package/dist/web/assets/index-DFbY8NAR.css +2 -0
- package/dist/web/assets/index-Dpqi2dcC.js +12 -0
- package/dist/web/assets/link-D481whDt.js +1 -0
- package/dist/web/assets/metrics-CAzP6V8I.js +1 -0
- package/dist/web/assets/new-C65IJJg3.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-_dAYMct_.js +1 -0
- package/dist/web/assets/{quality-Pu6EISAM.js → quality-RFd-7k3r.js} +1 -1
- package/dist/web/assets/release-notes-Dtif8xsQ.js +5 -0
- package/dist/web/assets/requestData-SPc36t8Q.js +1 -0
- package/dist/web/assets/routes-DJj8CWuk.js +6 -0
- package/dist/web/assets/settings-DKJd7CLe.js +1 -0
- package/dist/web/assets/ui-CbEOnPnF.js +1 -0
- package/dist/web/assets/workTarget-DavxMs-c.js +30 -0
- package/dist/web/index.html +6 -4
- package/docs/architecture.md +430 -72
- package/docs/chatgpt-sign-in.md +2 -2
- package/docs/development.md +141 -64
- package/docs/feature-inventory.md +139 -0
- package/docs/how-to-use.md +389 -31
- package/docs/installation.md +261 -147
- package/docs/publishing.md +33 -14
- package/docs/refactoring.md +332 -0
- package/lib/cli/agentsStatus.js +198 -0
- package/lib/cli/guide.js +27 -0
- package/lib/cli/guide.md +217 -0
- package/lib/cli/help.js +45 -7
- package/lib/cli/main.js +58 -207
- package/lib/cli/project.js +34 -294
- package/lib/core/projectRegistry.js +2 -2
- package/lib/kit/appInfo.js +13 -0
- package/lib/kit/usage.js +27 -0
- package/lib/server/api/projectsRoutes.js +5 -5
- package/lib/server/server.js +7 -4
- package/lib/{cli → tasks/cli}/args.js +73 -9
- package/lib/{cli → tasks/cli}/chatgpt.js +1 -1
- package/lib/{cli → tasks/cli}/codex.js +1 -1
- package/lib/{cli → tasks/cli}/output.js +12 -2
- package/lib/{cli → tasks/cli}/preflightCommands.js +1 -1
- package/lib/tasks/cli/readOnly.js +75 -0
- package/lib/{cli → tasks/cli}/render.js +1 -1
- package/lib/{cli → tasks/cli}/requestCommands.js +24 -7
- package/lib/tasks/cli/showView.js +279 -0
- package/lib/{cli → tasks/cli}/taskCommands.js +55 -21
- package/lib/tasks/cli/tasksCli.js +149 -0
- package/lib/{core → tasks/core}/context.js +6 -9
- package/lib/tasks/core/errorOutcome.js +125 -0
- package/lib/{core → tasks/core}/hierarchy.js +1 -1
- package/lib/{core → tasks/core}/ops.js +17 -2
- package/lib/{core → tasks/core}/preflight/carryover.js +5 -1
- package/lib/{core → tasks/core}/preflight/codexEngine.js +36 -28
- package/lib/{core → tasks/core}/preflight/diagnose.js +4 -9
- package/lib/{core → tasks/core}/preflight/engine.js +9 -0
- package/lib/tasks/core/preflight/hostPaths.js +299 -0
- package/lib/{core → tasks/core}/preflight/input.js +33 -5
- package/lib/{core → tasks/core}/preflight/instructions.js +19 -2
- package/lib/{core → tasks/core}/preflight/mockEngine.js +27 -8
- package/lib/{core → tasks/core}/preflight/render.js +22 -3
- package/lib/{core → tasks/core}/preflight/service.js +86 -11
- package/lib/{core → tasks/core}/preflight/uiRender.js +5 -2
- package/lib/{core → tasks/core}/requestOps.js +214 -17
- package/lib/{core → tasks/core}/reviewRuns.js +127 -22
- package/lib/{core → tasks/core}/store/attachments.js +3 -2
- package/lib/{core → tasks/core}/store/collection.js +21 -2
- package/lib/tasks/core/store/fieldGroups.js +30 -0
- package/lib/tasks/core/store/jsonRecord.js +30 -0
- package/lib/{core → tasks/core}/store/normalize.js +15 -10
- package/lib/{core → tasks/core}/store/noteStore.js +2 -2
- package/lib/{core → tasks/core}/store/preflightStore.js +59 -22
- package/lib/{core → tasks/core}/store/projectFile.js +1 -1
- package/lib/{core → tasks/core}/store/workspace.js +28 -6
- package/lib/{core → tasks/core}/userConfig.js +1 -1
- package/lib/{core → tasks/core}/workTargets.js +1 -1
- package/lib/tasks/features/metrics/cli/metricsCommands.js +77 -0
- package/lib/tasks/features/metrics/core/definitions.js +445 -0
- package/lib/tasks/features/metrics/core/index.js +112 -0
- package/lib/tasks/features/metrics/core/manual.js +179 -0
- package/lib/tasks/features/metrics/server/metricsRoutes.js +8 -0
- package/lib/tasks/features/metrics/shared/metrics.js +42 -0
- package/lib/{core/milestoneReview → tasks/features/milestoneReview/core}/code.js +2 -11
- package/lib/{core/milestoneReview → tasks/features/milestoneReview/core}/material.js +5 -6
- package/lib/{core/milestoneReview → tasks/features/milestoneReview/core}/review.js +2 -2
- package/lib/{core/milestoneReview → tasks/features/milestoneReview/core}/service.js +38 -100
- package/lib/{core/milestoneReview → tasks/features/milestoneReview/core}/store.js +3 -3
- package/lib/{server/api → tasks/features/milestoneReview/server}/milestoneReviewRoutes.js +7 -13
- package/lib/{cli → tasks/features/quality/cli}/qualityCommands.js +36 -11
- package/lib/{core → tasks/features/quality/core}/qualityImprovement.js +16 -15
- package/lib/tasks/features/records/cli/revisitCommands.js +73 -0
- package/lib/tasks/features/records/core/completionRefs.js +46 -0
- package/lib/tasks/features/records/core/reviewCandidates.js +76 -0
- package/lib/tasks/features/records/shared/completionRecord.js +329 -0
- package/lib/tasks/features/records/shared/reviewCandidate.js +313 -0
- package/lib/tasks/features/records/shared/reworkHistory.js +86 -0
- package/lib/{cli → tasks/features/releaseNotes/cli}/releaseNotesCommands.js +7 -7
- package/lib/{core/releaseNotes → tasks/features/releaseNotes/core}/completeRequests.js +5 -6
- package/lib/{core/releaseNotes → tasks/features/releaseNotes/core}/generate.js +3 -14
- package/lib/{core/releaseNotes → tasks/features/releaseNotes/core}/material.js +3 -4
- package/lib/{core/releaseNotes → tasks/features/releaseNotes/core}/service.js +1 -1
- package/lib/{core/releaseNotes → tasks/features/releaseNotes/core}/store.js +2 -2
- package/lib/{server/api → tasks/features/releaseNotes/server}/releaseNoteRoutes.js +11 -20
- package/lib/tasks/features/requirements/cli/requirementCommands.js +289 -0
- package/lib/{shared → tasks/features/requirements/shared}/acceptance.js +292 -18
- package/lib/tasks/features/requirements/shared/requirementSource.js +635 -0
- package/lib/tasks/features/retro/cli/retroCommands.js +106 -0
- package/lib/tasks/features/retro/core/retrospective.js +197 -0
- package/lib/tasks/features/retro/shared/retrospective.js +286 -0
- package/lib/tasks/features/settings/cli/projectSettings.js +245 -0
- package/lib/{cli → tasks/features/settings/cli}/userConfig.js +50 -3
- package/lib/{core → tasks/features/settings/core}/machineSettingsEdit.js +2 -2
- package/lib/{core → tasks/features/settings/core}/repoAdmin.js +3 -3
- package/lib/{core → tasks/features/settings/core}/userTheme.js +2 -2
- package/lib/{server/api → tasks/features/settings/server}/repoRoutes.js +2 -2
- package/lib/{server/api → tasks/features/settings/server}/userThemeRoutes.js +3 -3
- package/lib/{cli → tasks/features/taskReview/cli}/taskReviewCommands.js +5 -5
- package/lib/{core/taskReview → tasks/features/taskReview/core}/material.js +13 -7
- package/lib/{core/taskReview → tasks/features/taskReview/core}/review.js +10 -3
- package/lib/{core/taskReview → tasks/features/taskReview/core}/service.js +24 -85
- package/lib/{core/taskReview → tasks/features/taskReview/core}/store.js +4 -4
- package/lib/{server/api → tasks/features/taskReview/server}/taskReviewRoutes.js +7 -14
- package/lib/{server → tasks/server}/api/manifest.js +51 -3
- package/lib/{server → tasks/server}/api/routes.js +134 -65
- package/lib/tasks/shared/commitRefs.js +10 -0
- package/lib/{shared → tasks/shared}/preflightInput.js +1 -1
- package/package.json +1 -43
- package/skills/p3/SKILL.md +9 -181
- package/dist/web/assets/ImprovementDialog-kQaVBGWH.js +0 -1
- package/dist/web/assets/Outputs-_nU_p3nu.js +0 -1
- package/dist/web/assets/RequestStatus-RG-OVQYY.js +0 -1
- package/dist/web/assets/Tabs-ew9i5SKX.js +0 -1
- package/dist/web/assets/TagInput-BtlJTF7i.js +0 -1
- package/dist/web/assets/TaskDrawer-DW8GyJqI.js +0 -6
- package/dist/web/assets/_requestId-6Nb727dD.js +0 -1
- package/dist/web/assets/_requestId-BykTgPax.js +0 -1
- package/dist/web/assets/appCtx-CxDdXABS.js +0 -1
- package/dist/web/assets/archive-Ckh295Xe.js +0 -1
- package/dist/web/assets/board-BVAIjK-Y.js +0 -1
- package/dist/web/assets/done-BGfA-3MA.js +0 -1
- package/dist/web/assets/draft-CfJeyLOl.js +0 -1
- package/dist/web/assets/index-CgRU744I.css +0 -2
- package/dist/web/assets/index-DacQ0yl4.js +0 -12
- package/dist/web/assets/new-DVygWvVc.js +0 -1
- package/dist/web/assets/outputs-B6xDsLZf.js +0 -1
- package/dist/web/assets/preflightInput-BAeEJYUK.js +0 -2
- package/dist/web/assets/preload-helper-DyCqp21K.js +0 -1
- package/dist/web/assets/release-notes-CCpzyiNf.js +0 -5
- package/dist/web/assets/requestData-D5vBnuMh.js +0 -1
- package/dist/web/assets/routes-Q91zvNc0.js +0 -4
- package/dist/web/assets/settings-BzRgcmUm.js +0 -1
- package/dist/web/assets/workTarget-C9c57JAO.js +0 -30
- package/lib/cli/readOnly.js +0 -38
- package/lib/cli/showView.js +0 -166
- /package/lib/{core/store → kit}/frontmatter.js +0 -0
- /package/lib/{core/store → kit}/fsutil.js +0 -0
- /package/lib/{cli → tasks/cli}/format.js +0 -0
- /package/lib/{core → tasks/core}/chatgpt.js +0 -0
- /package/lib/{core → tasks/core}/machineSettings.js +0 -0
- /package/lib/{core → tasks/core}/preflight/codexImage.js +0 -0
- /package/lib/{core → tasks/core}/preflight/docker.js +0 -0
- /package/lib/{core → tasks/core}/preflight/launch.js +0 -0
- /package/lib/{core → tasks/core}/preflight/launcher.mjs +0 -0
- /package/lib/{core → tasks/core}/preflight/mock-ui.html +0 -0
- /package/lib/{core → tasks/core}/preflight/mock-ui.png +0 -0
- /package/lib/{core → tasks/core}/preflight/owner.js +0 -0
- /package/lib/{core → tasks/core}/preflight/render-image/Dockerfile +0 -0
- /package/lib/{core → tasks/core}/preflight/render-image/fonts-ja.conf +0 -0
- /package/lib/{core → tasks/core}/preflight/render-image/render.mjs +0 -0
- /package/lib/{core → tasks/core}/preflight/split.js +0 -0
- /package/lib/{core → tasks/core}/preflight/uiMaterials.js +0 -0
- /package/lib/{core → tasks/core}/preflight/wireframe.js +0 -0
- /package/lib/{core → tasks/core}/preflight/xlsx.js +0 -0
- /package/lib/{core → tasks/core}/redact.js +0 -0
- /package/lib/{core → tasks/core}/repoRefs.js +0 -0
- /package/lib/{core → tasks/core}/requestStatus.js +0 -0
- /package/lib/{core → tasks/core}/store/archivedTasks.js +0 -0
- /package/lib/{core → tasks/core}/store/dataWatcher.js +0 -0
- /package/lib/{core → tasks/core}/store/locate.js +0 -0
- /package/lib/{core → tasks/core}/supersede.js +0 -0
- /package/lib/{core/milestoneReview → tasks/features/milestoneReview/core}/mockReviewer.js +0 -0
- /package/lib/{shared → tasks/features/milestoneReview/shared}/milestoneReview.js +0 -0
- /package/lib/{core → tasks/features/quality/core}/quality.js +0 -0
- /package/lib/{shared → tasks/features/quality/shared}/quality.js +0 -0
- /package/lib/{shared → tasks/features/quality/shared}/qualityImprovement.js +0 -0
- /package/lib/{shared → tasks/features/quality/shared}/qualityTemplates.js +0 -0
- /package/lib/{core/releaseNotes → tasks/features/releaseNotes/core}/mockSummarizer.js +0 -0
- /package/lib/{core/taskReview → tasks/features/taskReview/core}/mockReviewer.js +0 -0
- /package/lib/{core/taskReview → tasks/features/taskReview/core}/paths.js +0 -0
- /package/lib/{shared → tasks/features/taskReview/shared}/taskReview.js +0 -0
- /package/lib/{server → tasks/server}/api/chatgptRoutes.js +0 -0
- /package/lib/{server → tasks/server}/api/local.js +0 -0
- /package/lib/{shared → tasks/shared}/dates.js +0 -0
- /package/lib/{shared → tasks/shared}/directTask.js +0 -0
- /package/lib/{shared → tasks/shared}/hierarchy.js +0 -0
- /package/lib/{shared → tasks/shared}/milestoneGoals.js +0 -0
- /package/lib/{shared → tasks/shared}/milestoneOrder.js +0 -0
- /package/lib/{shared → tasks/shared}/preflightRunner.js +0 -0
- /package/lib/{shared → tasks/shared}/refs.js +0 -0
- /package/lib/{shared → tasks/shared}/repos.js +0 -0
- /package/lib/{shared → tasks/shared}/scopeView.js +0 -0
- /package/lib/{shared → tasks/shared}/tags.js +0 -0
- /package/lib/{shared → tasks/shared}/taskBlock.js +0 -0
- /package/lib/{shared → tasks/shared}/types.js +0 -0
- /package/lib/{shared → tasks/shared}/workTarget.js +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { qualityVersion, readQuality } from "../../shared/quality.js";
|
|
1
|
+
import { qualityVersion, readQuality } from "../../features/quality/shared/quality.js";
|
|
2
|
+
import { keepRawOf, problemKeysOf, readFieldGroups, REQUEST_FIELD_GROUPS, TASK_FIELD_GROUPS } from "./fieldGroups.js";
|
|
4
3
|
import { repoNameProblem } from "../../shared/repos.js";
|
|
5
4
|
import { isPreflightRunner } from "../../shared/preflightRunner.js";
|
|
6
5
|
import { isTaskStatus, RELATION_TYPES, REQUEST_STATUSES } from "../../shared/types.js";
|
|
@@ -41,8 +40,8 @@ export const normalizeTaskIn = (requestId) => (d, body, id) => ({
|
|
|
41
40
|
doneAt: d.doneAt ? iso(d.doneAt) : undefined,
|
|
42
41
|
checkedAt: d.checkedAt ? iso(d.checkedAt) : undefined,
|
|
43
42
|
record: str(d.record)?.trim() || undefined,
|
|
44
|
-
|
|
45
|
-
...
|
|
43
|
+
// 受け入れ基準・停止・完了の記録・手戻り(fieldGroups.ts)
|
|
44
|
+
...readFieldGroups(TASK_FIELD_GROUPS, d),
|
|
46
45
|
relations: normalizeRelations(d.relations),
|
|
47
46
|
rev: num(d.rev) ?? 1,
|
|
48
47
|
createdAt: iso(d.createdAt),
|
|
@@ -51,12 +50,12 @@ export const normalizeTaskIn = (requestId) => (d, body, id) => ({
|
|
|
51
50
|
body,
|
|
52
51
|
});
|
|
53
52
|
/** タスクのうちファイルに書かないキー(場所から決まるもの・読んだときの問題) */
|
|
54
|
-
export const TASK_DERIVED = ["request", "ref",
|
|
55
|
-
/**
|
|
56
|
-
export const taskKeepRaw = (
|
|
53
|
+
export const TASK_DERIVED = ["request", "ref", ...problemKeysOf(TASK_FIELD_GROUPS)];
|
|
54
|
+
/** 項目のまとまりが壊れていたら、関係のない更新ではファイルの元の値のまま書き戻す(fieldGroups.ts) */
|
|
55
|
+
export const taskKeepRaw = keepRawOf(TASK_FIELD_GROUPS);
|
|
57
56
|
export const TASK_KEY_ORDER = [
|
|
58
57
|
"id", "title", "status", "repo", "labels", "areas", "outputs", "repoOutputs", "record",
|
|
59
|
-
"acceptanceCriteria", "acceptanceEvidence", "acceptanceSeq", "block", "blockHistory", "relations", "rev", "createdAt", "startedAt", "doneAt", "checkedAt", "updatedAt", "updatedBy",
|
|
58
|
+
"acceptanceCriteria", "acceptanceEvidence", "acceptanceSeq", "acceptanceSources", "acceptanceSourceSeq", "block", "blockHistory", "relations", "rev", "createdAt", "startedAt", "doneAt", "checkedAt", "updatedAt", "updatedBy", "reworkHistory", "completionRecords",
|
|
60
59
|
];
|
|
61
60
|
export function normalizeRequest(d, body, id) {
|
|
62
61
|
const status = str(d.status);
|
|
@@ -75,6 +74,8 @@ export function normalizeRequest(d, body, id) {
|
|
|
75
74
|
tags: strs(d.tags),
|
|
76
75
|
...(d.workstreams && typeof d.workstreams === "object" ? { workstreams: normalizeWorkstreams(d.workstreams) } : {}),
|
|
77
76
|
lastPreflight: str(d.lastPreflight),
|
|
77
|
+
// 要求の根拠・完了の記録・前提(fieldGroups.ts)
|
|
78
|
+
...readFieldGroups(REQUEST_FIELD_GROUPS, d),
|
|
78
79
|
rev: num(d.rev) ?? 1,
|
|
79
80
|
createdAt: iso(d.createdAt),
|
|
80
81
|
updatedAt: iso(d.updatedAt),
|
|
@@ -84,8 +85,12 @@ export function normalizeRequest(d, body, id) {
|
|
|
84
85
|
}
|
|
85
86
|
export const REQUEST_KEY_ORDER = [
|
|
86
87
|
"id", "title", "status", "parent", "childOrder", "splitFrom", "due", "milestone", "tags", "areas", "workstreams", "lastPreflight",
|
|
87
|
-
"rev", "createdAt", "updatedAt", "updatedBy",
|
|
88
|
+
"requirementSources", "requirementSeq", "clarifyAnswers", "rev", "createdAt", "updatedAt", "updatedBy", "premiseChanges", "completionRecords",
|
|
88
89
|
];
|
|
90
|
+
/** 要望のうちファイルに書かないキー(読んだときの問題) */
|
|
91
|
+
export const REQUEST_DERIVED = problemKeysOf(REQUEST_FIELD_GROUPS);
|
|
92
|
+
/** 項目のまとまりが壊れていたら、関係のない更新ではファイルの元の値のまま書き戻す(fieldGroups.ts) */
|
|
93
|
+
export const requestKeepRaw = keepRawOf(REQUEST_FIELD_GROUPS);
|
|
89
94
|
/** preflight.runner(未設定は書かない。読めない値は invalidRunner に残し、担当を推測しない) */
|
|
90
95
|
function runnerOf(v) {
|
|
91
96
|
const raw = str(v)?.trim();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readdir, readFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { randomBytes } from "node:crypto";
|
|
4
|
-
import { parseFrontmatter, stringifyFrontmatter } from "
|
|
5
|
-
import { createExclusive, nowIso } from "
|
|
4
|
+
import { parseFrontmatter, stringifyFrontmatter } from "../../../kit/frontmatter.js";
|
|
5
|
+
import { createExclusive, nowIso } from "../../../kit/fsutil.js";
|
|
6
6
|
export const NOTE_ID = /^N-\d{8}-\d{6}-[0-9a-f]{4}$/;
|
|
7
7
|
/**
|
|
8
8
|
* requests/<要望ID>/notes/N-....md Preflight へのメモ(1件1ファイル。書き足すだけで、直さない)
|
|
@@ -1,13 +1,39 @@
|
|
|
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 {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { readDraftCriteria, readSourceSeq } from "../../features/requirements/shared/acceptance.js";
|
|
4
|
+
import { readCriterionSources } from "../../features/requirements/shared/requirementSource.js";
|
|
5
|
+
import { parseFrontmatter, stringifyFrontmatter } from "../../../kit/frontmatter.js";
|
|
6
|
+
/** 案の受け入れ基準と要求の根拠(無い古い案は何も足さない。読めない項目は acceptanceProblems に理由) */
|
|
7
|
+
function draftCriteriaOf(raw, rawSources, rawSourceSeq) {
|
|
8
|
+
const { criteria, problems = [] } = readDraftCriteria(raw);
|
|
9
|
+
const sourceProblems = [];
|
|
10
|
+
const sources = readCriterionSources(rawSources, sourceProblems);
|
|
11
|
+
const seq = readSourceSeq(rawSourceSeq, sourceProblems);
|
|
12
|
+
const all = [...problems, ...sourceProblems];
|
|
13
|
+
return {
|
|
14
|
+
...(criteria ? { acceptanceCriteria: criteria } : {}),
|
|
15
|
+
...(sources ? { acceptanceSources: sources } : {}),
|
|
16
|
+
...(seq !== undefined ? { acceptanceSourceSeq: seq } : {}),
|
|
17
|
+
...(all.length ? { acceptanceProblems: all } : {}),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
import { withFileLock, writeFileAtomic } from "../../../kit/fsutil.js";
|
|
21
|
+
import { writeJsonRecord } from "./jsonRecord.js";
|
|
22
|
+
/** 案のファイル1つを読む(f: ファイル名。key が無い古い案はファイル名から) */
|
|
23
|
+
function draftOf(f, text) {
|
|
24
|
+
const { data, body } = parseFrontmatter(text);
|
|
25
|
+
return {
|
|
26
|
+
key: String(data.key ?? f.replace(/\.md$/, "")),
|
|
27
|
+
title: String(data.title ?? ""),
|
|
28
|
+
description: body.trim(),
|
|
29
|
+
areas: Array.isArray(data.areas) ? data.areas.map(String) : [],
|
|
30
|
+
dependsOn: Array.isArray(data.dependsOn) ? data.dependsOn.map(String) : [],
|
|
31
|
+
supersedes: Array.isArray(data.supersedes) ? data.supersedes.map(String) : [],
|
|
32
|
+
include: data.include !== false,
|
|
33
|
+
...("repo" in data ? { repo: data.repo === null || data.repo === "" || data.repo === "none" ? null : String(data.repo) } : {}),
|
|
34
|
+
...draftCriteriaOf(data.acceptanceCriteria, data.acceptanceSources, data.acceptanceSourceSeq),
|
|
35
|
+
};
|
|
9
36
|
}
|
|
10
|
-
import { writeFileAtomic } from "./fsutil.js";
|
|
11
37
|
/**
|
|
12
38
|
* requests/<要望ID>/preflight/<RUN-ID>/
|
|
13
39
|
* run.json 評価結果・ログ・文脈(機械向け)
|
|
@@ -28,7 +54,7 @@ export class PreflightStore {
|
|
|
28
54
|
async save(run) {
|
|
29
55
|
// 中断の依頼は別のファイル(cancel-request.json。頼む側と実行する側が同じファイルを書き合わないように)
|
|
30
56
|
const { drafts, children, cancelRequested, ...meta } = run;
|
|
31
|
-
await
|
|
57
|
+
await writeJsonRecord(join(this.runDir(run.requestId, run.id), "run.json"), meta);
|
|
32
58
|
}
|
|
33
59
|
async saveDrafts(requestId, runId, drafts) {
|
|
34
60
|
const dir = join(this.runDir(requestId, runId), "drafts");
|
|
@@ -42,26 +68,37 @@ export class PreflightStore {
|
|
|
42
68
|
const { description, acceptanceProblems: _p, ...meta } = d;
|
|
43
69
|
await writeFileAtomic(join(this.runDir(requestId, runId), "drafts", `${d.key}.md`), stringifyFrontmatter({ ...meta, include: d.include }, description));
|
|
44
70
|
}
|
|
71
|
+
/** 案を読んで直して書くまでを、同じ案の他の更新と重ねない(同じマシンのプロセスの間。根拠の採番を同じ番号で払い出さない) */
|
|
72
|
+
withDraftLock(requestId, runId, key, fn) {
|
|
73
|
+
return withFileLock(join(this.runDir(requestId, runId), "drafts", `.${key}.lock`), fn);
|
|
74
|
+
}
|
|
75
|
+
/** 案のファイルの frontmatter の元の値(読めなかった項目を、関係のない更新で消さないため) */
|
|
76
|
+
async rawDraftField(requestId, runId, key, field) {
|
|
77
|
+
const text = await readFile(join(this.runDir(requestId, runId), "drafts", `${key}.md`), "utf8").catch(() => undefined);
|
|
78
|
+
return text === undefined ? undefined : parseFrontmatter(text).data[field];
|
|
79
|
+
}
|
|
80
|
+
/** extra: 読めた値の代わりに元の値のまま書く項目 */
|
|
81
|
+
async saveDraftRaw(requestId, runId, d, extra) {
|
|
82
|
+
const { description, acceptanceProblems: _p, ...meta } = d;
|
|
83
|
+
await writeFileAtomic(join(this.runDir(requestId, runId), "drafts", `${d.key}.md`), stringifyFrontmatter({ ...meta, ...extra, include: d.include }, description));
|
|
84
|
+
}
|
|
45
85
|
async loadDrafts(requestId, runId) {
|
|
46
86
|
const dir = join(this.runDir(requestId, runId), "drafts");
|
|
47
87
|
const files = await readdir(dir).catch(() => []);
|
|
48
88
|
const drafts = [];
|
|
49
|
-
for (const f of files.filter((f) => f.endsWith(".md")))
|
|
50
|
-
|
|
51
|
-
drafts.push({
|
|
52
|
-
key: String(data.key ?? f.replace(/\.md$/, "")),
|
|
53
|
-
title: String(data.title ?? ""),
|
|
54
|
-
description: body.trim(),
|
|
55
|
-
areas: Array.isArray(data.areas) ? data.areas.map(String) : [],
|
|
56
|
-
dependsOn: Array.isArray(data.dependsOn) ? data.dependsOn.map(String) : [],
|
|
57
|
-
supersedes: Array.isArray(data.supersedes) ? data.supersedes.map(String) : [],
|
|
58
|
-
include: data.include !== false,
|
|
59
|
-
...("repo" in data ? { repo: data.repo === null || data.repo === "" || data.repo === "none" ? null : String(data.repo) } : {}),
|
|
60
|
-
...draftCriteriaOf(data.acceptanceCriteria),
|
|
61
|
-
});
|
|
62
|
-
}
|
|
89
|
+
for (const f of files.filter((f) => f.endsWith(".md")))
|
|
90
|
+
drafts.push(draftOf(f, await readFile(join(dir, f), "utf8")));
|
|
63
91
|
return drafts.sort((a, b) => a.key.localeCompare(b.key, undefined, { numeric: true }));
|
|
64
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* 1つの案を読み直す(loadDrafts と同じ規則。無ければ undefined)。案の更新は保存した後にこれで読み直して返し、更新の応答と
|
|
95
|
+
* 再読込で基準・根拠・採番と読めない理由(acceptanceProblems)を同じにする
|
|
96
|
+
*/
|
|
97
|
+
async loadDraft(requestId, runId, key) {
|
|
98
|
+
const f = `${key}.md`;
|
|
99
|
+
const text = await readFile(join(this.runDir(requestId, runId), "drafts", f), "utf8").catch(() => undefined);
|
|
100
|
+
return text === undefined ? undefined : draftOf(f, text);
|
|
101
|
+
}
|
|
65
102
|
async saveChild(requestId, runId, c) {
|
|
66
103
|
const { description, ...meta } = c;
|
|
67
104
|
await writeFileAtomic(join(this.runDir(requestId, runId), "children", `${c.key}.md`), stringifyFrontmatter({ ...meta, include: c.include }, description));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import YAML from "yaml";
|
|
3
|
-
import { writeFileAtomic } from "
|
|
3
|
+
import { writeFileAtomic } from "../../../kit/fsutil.js";
|
|
4
4
|
/** 設定の保存(画面・p3 config)で書き換える項目。repos は p3 repo だけが項目ごとに書く(writeRepoEntry) */
|
|
5
5
|
const ORDER = ["name", "description", "milestones", "branchPattern", "preflight"];
|
|
6
6
|
/** ファイルの中の並び */
|
|
@@ -4,19 +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
|
+
import { QualityInputError, qualityPlain } from "../../features/quality/shared/quality.js";
|
|
8
8
|
import { fileLayout, folderLayout, MarkdownCollection, NotFoundError } from "./collection.js";
|
|
9
|
-
import { newRequestId, withFileLock } from "
|
|
10
|
-
import { normalizeProject, normalizeRequest, normalizeTaskIn, REQUEST_KEY_ORDER, TASK_DERIVED, TASK_KEY_ORDER, taskKeepRaw } from "./normalize.js";
|
|
9
|
+
import { newRequestId, withFileLock } from "../../../kit/fsutil.js";
|
|
10
|
+
import { normalizeProject, normalizeRequest, normalizeTaskIn, REQUEST_KEY_ORDER, REQUEST_DERIVED, requestKeepRaw, TASK_DERIVED, TASK_KEY_ORDER, taskKeepRaw } from "./normalize.js";
|
|
11
11
|
import { AttachmentStore } from "./attachments.js";
|
|
12
12
|
import { DataWatcher } from "./dataWatcher.js";
|
|
13
13
|
import { NoteStore } from "./noteStore.js";
|
|
14
14
|
import { PreflightStore } from "./preflightStore.js";
|
|
15
15
|
import { writeProjectFile, writeQualityFile } from "./projectFile.js";
|
|
16
16
|
import { resolveRefs } from "../repoRefs.js";
|
|
17
|
-
import { RELEASE_NOTES_DIR, ReleaseNoteStore } from "
|
|
18
|
-
import { MILESTONE_REVIEWS_DIR, MilestoneReviewStore } from "
|
|
19
|
-
import { TASK_REVIEWS_DIR, TaskReviewStore } from "
|
|
17
|
+
import { RELEASE_NOTES_DIR, ReleaseNoteStore } from "../../features/releaseNotes/core/store.js";
|
|
18
|
+
import { MILESTONE_REVIEWS_DIR, MilestoneReviewStore } from "../../features/milestoneReview/core/store.js";
|
|
19
|
+
import { TASK_REVIEWS_DIR, TaskReviewStore } from "../../features/taskReview/core/store.js";
|
|
20
20
|
/** 保存する並びの各項目で、purpose / goals のキーが無ければ同じ ID の今の値を残す */
|
|
21
21
|
function keepGoals(next, cur) {
|
|
22
22
|
return next.map((m) => {
|
|
@@ -94,6 +94,10 @@ export class Workspace {
|
|
|
94
94
|
layout: folderLayout(this.requestsDir, "request.md", REQUEST_ID, () => newRequestId()),
|
|
95
95
|
normalize: normalizeRequest,
|
|
96
96
|
keyOrder: REQUEST_KEY_ORDER,
|
|
97
|
+
derived: REQUEST_DERIVED,
|
|
98
|
+
keepRaw: requestKeepRaw,
|
|
99
|
+
// 要望ごとのロック(タスクと同じ。要望のフォルダの外に置くので、アーカイブで一緒に動かない)
|
|
100
|
+
lock: (id) => (id ? this.requestLock(id) : undefined),
|
|
97
101
|
});
|
|
98
102
|
this.preflight = new PreflightStore(this.requestsDir);
|
|
99
103
|
this.notes = new NoteStore(this.requestsDir);
|
|
@@ -105,6 +109,13 @@ export class Workspace {
|
|
|
105
109
|
get requestsDir() {
|
|
106
110
|
return join(this.dataDir, "requests");
|
|
107
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* 要望とそのタスクの保存のロック(requests/.locks/<要望ID>.lock)。読み直してから書く・移すまでを、別のプロセスと1つずつにする。
|
|
114
|
+
* ロックの順: 親子の操作のロック(.hierarchy.lock)→ この要望のロック。このロックの中で別の要望・タスクのロックは取らない
|
|
115
|
+
*/
|
|
116
|
+
requestLock(rid) {
|
|
117
|
+
return join(this.requestsDir, ".locks", `${rid}.lock`);
|
|
118
|
+
}
|
|
108
119
|
/** このマシンのパスを変えた(個人設定に書いた後に呼ぶ) */
|
|
109
120
|
setLocalRepo(name, path) {
|
|
110
121
|
const next = { ...this.localRepos };
|
|
@@ -124,6 +135,12 @@ export class Workspace {
|
|
|
124
135
|
refs() {
|
|
125
136
|
return resolveRefs(this.project, { localRepos: this.localRepos });
|
|
126
137
|
}
|
|
138
|
+
/** ディスクから読み直した別の Workspace(材料の取り出しなど。画面・CLI のキャッシュに左右されない。複数のファイルを同じ時点で読んだとは保証しない) */
|
|
139
|
+
static async snapshot(dataDir) {
|
|
140
|
+
const snap = new Workspace(dataDir);
|
|
141
|
+
await snap.load();
|
|
142
|
+
return snap;
|
|
143
|
+
}
|
|
127
144
|
async load() {
|
|
128
145
|
await this.loadAll(false);
|
|
129
146
|
}
|
|
@@ -212,6 +229,7 @@ export class Workspace {
|
|
|
212
229
|
derived: TASK_DERIVED,
|
|
213
230
|
keepRaw: taskKeepRaw,
|
|
214
231
|
beforeWrite: (prev, next) => stampStatus(prev, next),
|
|
232
|
+
lock: () => this.requestLock(requestId),
|
|
215
233
|
});
|
|
216
234
|
this.taskCollections.set(requestId, col);
|
|
217
235
|
}
|
|
@@ -394,6 +412,10 @@ export class Workspace {
|
|
|
394
412
|
await this.tasksOf(rid).reload(id);
|
|
395
413
|
this.emit({ type: "changed", kind: "task", request: rid, ref: `${rid}/${id}` });
|
|
396
414
|
}
|
|
415
|
+
else if (kind === "retrospective.json") {
|
|
416
|
+
// 振り返りの記録(ほかのプロセスの確定・確認)
|
|
417
|
+
this.emit({ type: "changed", kind: "request", request: rid });
|
|
418
|
+
}
|
|
397
419
|
else if (kind === "preflight") {
|
|
398
420
|
this.emit({ type: "changed", kind: "preflight", request: rid });
|
|
399
421
|
}
|
|
@@ -3,7 +3,7 @@ import { homedir } from "node:os";
|
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
4
|
import YAML from "yaml";
|
|
5
5
|
import { isTheme } from "../shared/types.js";
|
|
6
|
-
import { withFileLock, writeFileAtomic } from "
|
|
6
|
+
import { withFileLock, writeFileAtomic } from "../../kit/fsutil.js";
|
|
7
7
|
export const SETTINGS_SECTIONS = ["codex", "preflight", "serve"];
|
|
8
8
|
export const PROJECT_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
9
9
|
/** 個人設定のファイル。XDG_CONFIG_HOME があればそれに従う(設定ファイルの置き場所を決めるだけで、プロジェクトの切り替えには使わない) */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
|
-
import { slugify } from "
|
|
2
|
+
import { slugify } from "../../kit/fsutil.js";
|
|
3
3
|
import { repoTargetProblem, requestWorkstreams } from "../shared/workTarget.js";
|
|
4
4
|
/** 作業先にできない(参照先に無い・参照だけ)。何も変えていない */
|
|
5
5
|
export class RepoTargetError extends Error {
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { metricScopeOf, metricsReport } from "../core/index.js";
|
|
2
|
+
import { readManual, recordManual, removeManual } from "../core/manual.js";
|
|
3
|
+
import { MetricsError, METRIC_STATE_LABEL, METRIC_UNIT_LABEL } from "../shared/metrics.js";
|
|
4
|
+
import { UsageError } from "../../../../kit/usage.js";
|
|
5
|
+
/**
|
|
6
|
+
* 開発の指標(定義は core/metrics/definitions.ts)。読むだけ。
|
|
7
|
+
*
|
|
8
|
+
* metrics [--milestone <ID>] プロジェクト全体(既定)か、登録済みのマイルストーンの指標(値・単位・対象・欠損・算出の方法)
|
|
9
|
+
* metrics record <指標> <値> --from YYYY-MM-DD --to YYYY-MM-DD --source 出典 [--unit 通貨] [--milestone ID] [--note メモ] [--rev 版]
|
|
10
|
+
* 人が記録する値(費用・リリース後の不具合)。同じ内容の再送は何もしない。訂正は --rev
|
|
11
|
+
* metrics records 人の記録の全部(範囲を問わない)
|
|
12
|
+
* metrics rm <M1> [--rev 版] 人の記録を消す
|
|
13
|
+
*/
|
|
14
|
+
const rowText = (r) => `${r.id} ${r.from}〜${r.to} ${r.value} ${r.unit} 出典: ${r.source}${r.note ? ` メモ: ${r.note}` : ""} (版 ${r.rev}・${r.updatedAt}${r.updatedBy ? `・${r.updatedBy}` : ""})`;
|
|
15
|
+
const recordText = (r) => `${r.metric} ${r.scope === "project" ? "プロジェクト全体" : r.scope} ${rowText(r)}`;
|
|
16
|
+
const valueText = (m) => {
|
|
17
|
+
if (m.rows?.length)
|
|
18
|
+
return m.rows.length === 1 ? `${m.rows[0].value} ${m.rows[0].unit}` : `${m.rows.length} 行(期間・単位ごと。合算しない)`;
|
|
19
|
+
if (m.value === null)
|
|
20
|
+
return METRIC_STATE_LABEL[m.state];
|
|
21
|
+
const v = `${m.value} ${METRIC_UNIT_LABEL[m.unit]}`;
|
|
22
|
+
return m.denominator !== undefined ? `${v} / 基準 ${m.denominator} 件` : v;
|
|
23
|
+
};
|
|
24
|
+
export function formatMetrics(r) {
|
|
25
|
+
const lines = [`開発の指標 範囲: ${r.scopeLabel}`, ` ${r.scopeRule}`, " (改善の材料です。人や AI の成績の評価には使いません)", ""];
|
|
26
|
+
for (const m of r.metrics) {
|
|
27
|
+
lines.push(`${m.label} [${m.id}] ${valueText(m)}${m.kind === "manual" ? " (人の記録)" : ""}`);
|
|
28
|
+
if (m.kind === "manual") {
|
|
29
|
+
for (const r of m.rows ?? [])
|
|
30
|
+
lines.push(` ${rowText(r)}`);
|
|
31
|
+
if (m.recordHint)
|
|
32
|
+
lines.push(` 記録: ${m.recordHint}`);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
lines.push(` 対象 ${m.targets}・値に入れた ${m.observed}・欠損 ${m.missing}`);
|
|
36
|
+
lines.push(` 内訳: ${m.breakdown.map((b) => `${b.label} ${b.count}`).join("・")}`);
|
|
37
|
+
}
|
|
38
|
+
lines.push(` 算出: ${m.method}`);
|
|
39
|
+
for (const x of m.missingItems.slice(0, 5))
|
|
40
|
+
lines.push(` 欠損: ${x.target} ${x.reason}`);
|
|
41
|
+
if (m.missingItems.length > 5)
|
|
42
|
+
lines.push(` 欠損: ほか ${m.missingItems.length - 5} 件(--json で全部)`);
|
|
43
|
+
}
|
|
44
|
+
if (r.notices.length)
|
|
45
|
+
lines.push("", "知らせ:", ...r.notices.map((n) => ` ${n.target} ${n.message}`));
|
|
46
|
+
lines.push("", `範囲: ${r.scopes.map((s) => (s.scope.kind === "project" ? "(省略)プロジェクト全体" : `--milestone ${s.scope.id}`)).join(" / ")}`);
|
|
47
|
+
return lines.join("\n");
|
|
48
|
+
}
|
|
49
|
+
export async function metricsCommand(cmd, env) {
|
|
50
|
+
if (cmd !== "metrics")
|
|
51
|
+
return undefined;
|
|
52
|
+
const { ctx, out, args, o, actor, expectedRev } = env;
|
|
53
|
+
const sub = args[0];
|
|
54
|
+
if (sub === "record") {
|
|
55
|
+
const [, metric, value] = args;
|
|
56
|
+
if (!metric || value === undefined || args.length > 3)
|
|
57
|
+
throw new UsageError("p3 metrics record <指標> <値> --from YYYY-MM-DD --to YYYY-MM-DD --source 出典 [--unit 通貨] [--milestone ID] [--note メモ] [--rev 版]");
|
|
58
|
+
const r = await recordManual(ctx, { metric, value, scope: o.milestone, from: o.from ?? "", to: o.to ?? "", unit: o.unit, source: o.source ?? "", note: o.note }, { expectedRev, actor });
|
|
59
|
+
return out.result(r, () => `${r.created ? "記録しました" : r.changed ? "訂正しました" : "同じ内容の記録があります(変えていません)"}\n ${recordText(r.record)}`);
|
|
60
|
+
}
|
|
61
|
+
if (sub === "records") {
|
|
62
|
+
const m = await readManual(ctx.ws.dataDir);
|
|
63
|
+
if (m.problem)
|
|
64
|
+
throw new MetricsError(m.problem, "metrics_unreadable");
|
|
65
|
+
return out.result({ records: m.records }, () => (m.records.length ? m.records.map(recordText).join("\n") : "人の記録はありません(p3 metrics record で記録します)"));
|
|
66
|
+
}
|
|
67
|
+
if (sub === "rm" || sub === "remove") {
|
|
68
|
+
if (!args[1] || args.length > 2)
|
|
69
|
+
throw new UsageError("p3 metrics rm <M1> [--rev 版]");
|
|
70
|
+
const r = await removeManual(ctx, args[1], { expectedRev });
|
|
71
|
+
return out.result({ removed: r }, () => `消しました: ${recordText(r)}`);
|
|
72
|
+
}
|
|
73
|
+
if (args.length)
|
|
74
|
+
throw new UsageError(`p3 metrics [--milestone <ID>] | record <指標> <値> ... | records | rm <M1>(知らない引数: ${args.join(" ")})`);
|
|
75
|
+
const r = await metricsReport(ctx, metricScopeOf(ctx, o.milestone));
|
|
76
|
+
return out.result(r, () => formatMetrics(r));
|
|
77
|
+
}
|