@infodb/p3 0.6.0 → 0.7.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/dist/web/assets/{TagInput-DkuISbfK.js → TagInput-cIIwXAHA.js} +1 -1
- package/dist/web/assets/{TaskDrawer-CysOMAjG.js → TaskDrawer-CSZ7Z0JC.js} +1 -1
- package/dist/web/assets/{_requestId-BQCwOAbs.js → _requestId-C8WYk2kC.js} +1 -1
- package/dist/web/assets/{_requestId-DgSOUH78.js → _requestId-Z3CBhTIL.js} +1 -1
- package/dist/web/assets/{board-BsntpZXP.js → board-DyfGX5h0.js} +1 -1
- package/dist/web/assets/{index-BTuEPzgc.js → index-Bt13tvIX.js} +2 -2
- package/dist/web/assets/{new-BwknRX3V.js → new-BRsIUNIb.js} +1 -1
- package/dist/web/assets/{release-notes-AgwbykyG.js → release-notes-C3FdiM36.js} +1 -1
- package/dist/web/assets/{routes-Bu3bhOaC.js → routes-QNgQHe48.js} +1 -1
- package/dist/web/assets/{settings-BkV8KeQk.js → settings-CoKJahEe.js} +1 -1
- package/dist/web/index.html +1 -1
- package/docs/architecture.md +7 -1
- package/docs/development.md +1 -1
- package/docs/how-to-use.md +8 -2
- package/docs/installation.md +9 -6
- package/docs/publishing.md +3 -4
- package/lib/cli/project.js +1 -1
- package/lib/core/hierarchy.js +20 -0
- package/lib/core/store/collection.js +17 -6
- package/package.json +1 -1
- package/skills/p3/SKILL.md +7 -3
|
@@ -97,7 +97,10 @@ export class MarkdownCollection {
|
|
|
97
97
|
async read(id) {
|
|
98
98
|
try {
|
|
99
99
|
const { data, body } = parseFrontmatter(await readFile(this.layout.path(id), "utf8"));
|
|
100
|
-
|
|
100
|
+
const item = this.opts.normalize(data, body, id);
|
|
101
|
+
const known = new Set(["body", ...this.opts.keyOrder, ...(this.opts.derived ?? []), ...Object.keys(item)]);
|
|
102
|
+
const extra = Object.fromEntries(Object.entries(data).filter(([k]) => !known.has(k)));
|
|
103
|
+
return { item, extra };
|
|
101
104
|
}
|
|
102
105
|
catch (e) {
|
|
103
106
|
return e.code === "ENOENT" ? { missing: true } : { error: String(e) };
|
|
@@ -113,7 +116,9 @@ export class MarkdownCollection {
|
|
|
113
116
|
}
|
|
114
117
|
/** 1件を読み直す。消えていれば除く */
|
|
115
118
|
async reload(id) {
|
|
116
|
-
|
|
119
|
+
this.apply(id, await this.read(id));
|
|
120
|
+
}
|
|
121
|
+
apply(id, r) {
|
|
117
122
|
if ("item" in r) {
|
|
118
123
|
this.put(id, r.item);
|
|
119
124
|
this.errors.delete(id);
|
|
@@ -142,7 +147,7 @@ export class MarkdownCollection {
|
|
|
142
147
|
path(id) {
|
|
143
148
|
return this.layout.path(id);
|
|
144
149
|
}
|
|
145
|
-
serialize(item) {
|
|
150
|
+
serialize(item, extra = {}) {
|
|
146
151
|
const { body, ...rest } = item;
|
|
147
152
|
const skip = new Set(["body", ...(this.opts.derived ?? [])]);
|
|
148
153
|
const ordered = {};
|
|
@@ -152,6 +157,9 @@ export class MarkdownCollection {
|
|
|
152
157
|
for (const [k, v] of Object.entries(rest))
|
|
153
158
|
if (!(k in ordered) && !skip.has(k))
|
|
154
159
|
ordered[k] = v;
|
|
160
|
+
for (const [k, v] of Object.entries(extra))
|
|
161
|
+
if (!(k in ordered) && !skip.has(k))
|
|
162
|
+
ordered[k] = v;
|
|
155
163
|
return stringifyFrontmatter(ordered, body);
|
|
156
164
|
}
|
|
157
165
|
/** 作る。省いた項目は normalize の既定値になる */
|
|
@@ -190,8 +198,11 @@ export class MarkdownCollection {
|
|
|
190
198
|
* 部分更新。expectedRev を渡すと楽観ロック(AI が古い状態を元に上書きするのを防ぐ)。
|
|
191
199
|
*/
|
|
192
200
|
async update(id, patch, opts = {}) {
|
|
193
|
-
//
|
|
194
|
-
|
|
201
|
+
// 外部での編集を取りこぼさないよう、更新の直前にディスクから読み直す。
|
|
202
|
+
// この版が知らない項目(新しい版の p3 が書いた項目)は消さずに書き戻す(古い版の更新で親子などが消えないように)
|
|
203
|
+
const r = await this.read(id);
|
|
204
|
+
this.apply(id, r);
|
|
205
|
+
const extra = "item" in r ? r.extra : {};
|
|
195
206
|
const cur = this.require(id);
|
|
196
207
|
if (opts.expectedRev !== undefined && opts.expectedRev !== cur.rev) {
|
|
197
208
|
throw new ConflictError(id, opts.expectedRev, cur.rev);
|
|
@@ -206,7 +217,7 @@ export class MarkdownCollection {
|
|
|
206
217
|
updatedBy: opts.actor ?? cur.updatedBy,
|
|
207
218
|
};
|
|
208
219
|
const next = this.opts.beforeWrite?.(cur, merged) ?? merged;
|
|
209
|
-
await writeFileAtomic(this.layout.path(id), this.serialize(next));
|
|
220
|
+
await writeFileAtomic(this.layout.path(id), this.serialize(next, extra));
|
|
210
221
|
this.put(id, next);
|
|
211
222
|
return next;
|
|
212
223
|
}
|
package/package.json
CHANGED
package/skills/p3/SKILL.md
CHANGED
|
@@ -78,11 +78,15 @@ P3_ACTOR=ai:<エージェント名> p3 <コマンド> [引数] --json
|
|
|
78
78
|
`archive`)。拒否をタスクを偽って完了にする・ファイルを直接書き換えるなどで回避しない
|
|
79
79
|
7. コミットして push する。データのフォルダ(`whoami` の場所)がこの作業ツリーの中にあって git で管理されている(無視されていない)なら、
|
|
80
80
|
**要望のフォルダ(`<データのフォルダ>/requests/<要望ID>/`)の変更も実装と同じコミットに入れる**。要望とタスク・変更の記録が
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
コードと一緒に残り、後のレビュー(AI のレビューも)で、コードだけでなく「何を目的に頼まれ、何をしたか」を精査できる。
|
|
82
|
+
親子でつながる要望のフォルダも、まだコミットに入っていない変更があれば入れる: 子の要望なら**祖先の要望のフォルダ**(分割の採用・
|
|
83
|
+
子の順・状態は親に残る)、親を対応済にするときは**子孫の要望のフォルダ**(見送りにした子など、実装の無い要望)。それ以外の要望や
|
|
84
|
+
関係ない変更はまとめて add しない(`git status` でフォルダを確かめてから add する)。データのフォルダが外・別のリポジトリ・git で無視されている、または git の作業ツリー(worktree)で作業して
|
|
83
85
|
いてデータがメインの作業ツリーにあるときは、同じコミットには入らない(データの移動・写し・`git add -f` はしない。記録は p3 に
|
|
84
86
|
残り、コードとは成果物の URL で結ぶ)。commit・push に失敗したら、完了の記録はそのまま残し、公開できていないことをユーザーに
|
|
85
|
-
伝えてやり直す(完了を push
|
|
87
|
+
伝えてやり直す(完了を push できたことのように伝えない)。同じコミットに入れた要望のフォルダは、
|
|
88
|
+
マージするまで要望のブランチにしか無い。既定のブランチに切り替えると、その要望(子なら親の子の一覧からも)が消えたように見えるが、
|
|
89
|
+
データはブランチにある(作り直したり、別のブランチから写したりしない。親の詳細には `child_missing` が出る)
|
|
86
90
|
8. コミットや PR の URL を残すなら、後から `move T003 done --req <要望ID> --output <URL>` で足す(完了・記録・前の成果物はそのまま。
|
|
87
91
|
完了から戻さない)。要望のフォルダを同じコミットに入れているなら、この追記もコミットして同じブランチに push する(追記のコミット
|
|
88
92
|
自身の URL は残さなくてよい)。PR はユーザーに確認してから作る(本文に要望 ID とタスクの一覧)。作った PR の URL は最後のタスクに
|