@takagaki/cortex-decisions-viewer 0.12.147 → 0.12.151

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/repo.js CHANGED
@@ -155,7 +155,7 @@ function gitLog(cwd, args, what = "git の履歴") {
155
155
  //
156
156
  // ただし「**git が無い**(ENOENT)」「**git リポジトリでない**(git の致命エラー = 128)」は
157
157
  // **既定の状態**——手元のビルドやテストで普通に起きるので、ここで警告するとログが
158
- // 常に注意で埋まる(gold-proposals / weekly-curation の「無いことは警告しない」と同じ規律)。
158
+ // 常に注意で埋まる(weekly-curation の「無いことは警告しない」と同じ規律)。
159
159
  // 戻り値の契約(空文字 = 履歴なしで正常継続)はどちらでも変えない
160
160
  const err = e;
161
161
  if (err.code !== "ENOENT" && err.status !== 128) {
package/dist/story.js CHANGED
@@ -11,6 +11,7 @@ exports.successDaysOf = successDaysOf;
11
11
  exports.nightResultOf = nightResultOf;
12
12
  exports.splitFrontmatter = splitFrontmatter;
13
13
  exports.dayRelationTargets = dayRelationTargets;
14
+ exports.dayPartialHour = dayPartialHour;
14
15
  exports.storyNameLinks = storyNameLinks;
15
16
  exports.splitByNameLinks = splitByNameLinks;
16
17
  exports.storyDayMarkdown = storyDayMarkdown;
@@ -151,7 +152,7 @@ function nightResultOf(ledger) {
151
152
  }
152
153
  /**
153
154
  * 日・週・月のページの先頭の frontmatter(`---` で囲んだ塊)を本文から分ける(純関数)。
154
- * 日のページは `date` と `relations` を持ちうる(B-story)。画面には出さない。frontmatter が無い・閉じていないページは本文のまま返す。
155
+ * 日のページは `date`・`partial_at`(途中の日だけ)・`relations` を持ちうる(B-story)。本文には出さない(`partial_at` は日本時間の時だけを見出しの横に出す・`dayPartialHour`)。frontmatter が無い・閉じていないページは本文のまま返す。
155
156
  * YAML としては読まない(壊れた YAML のページでも本文を落とさない)
156
157
  */
157
158
  function splitFrontmatter(content) {
@@ -188,6 +189,25 @@ function dayRelationTargets(frontmatter) {
188
189
  }
189
190
  return out;
190
191
  }
192
+ /**
193
+ * 日のページの frontmatter の `partial_at`(途中の日の印・ISO 8601)から、日本時間の時(0〜23)を取る(純関数・YAML としては読まない)。
194
+ * 欄が無い・ISO として読めない日は `null`(何も出さない)。日本時間は UTC+9 固定(夏時間なし)
195
+ */
196
+ function dayPartialHour(frontmatter) {
197
+ if (!frontmatter)
198
+ return null;
199
+ for (const line of frontmatter.split("\n")) {
200
+ const m = line.match(/^partial_at\s*:\s*(?:"([^"]*)"|'([^']*)'|([^\s#]+))/);
201
+ if (!m)
202
+ continue;
203
+ const raw = (m[1] ?? m[2] ?? m[3] ?? "").trim();
204
+ if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})$/.test(raw))
205
+ return null;
206
+ const t = Date.parse(raw);
207
+ return Number.isFinite(t) ? new Date(t + 9 * 3600 * 1000).getUTCHours() : null;
208
+ }
209
+ return null;
210
+ }
191
211
  /**
192
212
  * その日の `relations` の target から、名前のリンクの表を作る(純関数)。
193
213
  *
@@ -519,10 +539,13 @@ linksOf = () => []) {
519
539
  continue;
520
540
  const { heading, markdown } = storyDayMarkdown(raw, f.day);
521
541
  const editUrl = editUrlOf(f.rel);
522
- const links = linksOf(dayRelationTargets(splitFrontmatter(raw).frontmatter));
542
+ const fm = splitFrontmatter(raw).frontmatter;
543
+ const links = linksOf(dayRelationTargets(fm));
544
+ const partialHour = dayPartialHour(fm);
523
545
  out.push({
524
546
  date: f.day, heading: heading, bodyHtml: await renderMarkdown(markdown),
525
547
  ...(editUrl ? { editUrl: editUrl } : {}),
548
+ ...(partialHour !== null ? { partialHour: partialHour } : {}),
526
549
  ...(links.length ? { links: links } : {}),
527
550
  });
528
551
  }
package/dist/view-dir.js CHANGED
@@ -31,8 +31,9 @@ exports.viewCountsLine = viewCountsLine;
31
31
  *
32
32
  * ## 名前(engine の宣言表 `publish: "viewer"` の行・V10a の `VIEW_HELD`)
33
33
  *
34
- * - 読む 11 本のうち、記憶側が置くのは 8 本+順位 1 本(`VIEW_NAMES`)
35
- * - 名寄せの提案(`gold-proposals`・A1 の答えまで)と確認の帳簿(`gold-confirmation`・再導出の帯の読み手 `readRederivationLedgers` が読む)は置かれないので、いつも `.cortex` から読む
34
+ * - 読む 10 本のうち、記憶側が置くのは 8 本+順位 1 本(`VIEW_NAMES`)
35
+ * - 確認の帳簿(`gold-confirmation`・再導出の帯の読み手 `readRederivationLedgers` が読む)は置かれないので、いつも `.cortex` から読む
36
+ * - 名寄せの提案(`gold-proposals`)はビューアが読まなくなった(cortex-engine #1094 B-viewer V4・問いはポータルから)。置かれても使わない
36
37
  */
37
38
  const node_child_process_1 = require("node:child_process");
38
39
  const node_crypto_1 = require("node:crypto");
@@ -40,7 +41,7 @@ const promises_1 = __importDefault(require("node:fs/promises"));
40
41
  const node_os_1 = __importDefault(require("node:os"));
41
42
  const node_path_1 = __importDefault(require("node:path"));
42
43
  const ledger_dir_1 = require("./ledger-dir");
43
- /** 記憶側が置く名前(宣言表の `publish: "viewer"` の行から、置かない 2 本を除いた 8 本と順位)。並びは名前順 */
44
+ /** 記憶側が置く名前(宣言表の `publish: "viewer"` の行から、置かない 1 本と読まなくなった名寄せの提案を除いた 8 本と順位)。並びは名前順 */
44
45
  exports.VIEW_NAMES = Object.freeze([
45
46
  "gold-activity",
46
47
  "gold-change-log",
@@ -54,7 +55,6 @@ exports.VIEW_NAMES = Object.freeze([
54
55
  ]);
55
56
  /** 置かれない名前(いつも `.cortex` から読む)と理由 */
56
57
  exports.VIEW_HELD = Object.freeze({
57
- "gold-proposals": "名寄せの提案のカード(A1 の答えまで .cortex)",
58
58
  "gold-confirmation": "人が確認した版と機械の書き直し(再導出の帯の材料・readRederivationLedgers)",
59
59
  });
60
60
  /** 目次の名前(engine `VIEW_INDEX_NAME`) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takagaki/cortex-decisions-viewer",
3
- "version": "0.12.147",
3
+ "version": "0.12.151",
4
4
  "description": "Cortexの意思決定記録(Decisions/*.md)を静的サイトにビルドして閲覧する。各レコードに「Edit on GitHub」リンクを付与する。",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,