@takagaki/cortex-decisions-viewer 0.4.20 → 0.4.21
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/build.js +15 -2
- package/dist/render.js +41 -3
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -107,7 +107,7 @@ function resolveKnowledgeRoot(decisionsDirAbs) {
|
|
|
107
107
|
return null;
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
|
-
* リポジトリルートの fleet-status.json から externalSources / pipelines を読む。
|
|
110
|
+
* リポジトリルートの fleet-status.json から externalSources / internalSources / pipelines を読む。
|
|
111
111
|
* ファイルが無い・パース不能・当該フィールドが無い場合は undefined を返し、
|
|
112
112
|
* ビューア側で「データソースと自動化」セクションを出さない(後方互換・旧fleet-statusで壊れない)。
|
|
113
113
|
*/
|
|
@@ -130,11 +130,23 @@ async function readFleetSources(repoRoot) {
|
|
|
130
130
|
type: String(s.type ?? ""),
|
|
131
131
|
name: String(s.name ?? ""),
|
|
132
132
|
ref: s.ref != null ? String(s.ref) : undefined,
|
|
133
|
+
url: s.url != null ? String(s.url) : undefined,
|
|
133
134
|
gold: typeof s.gold === "boolean" ? s.gold : undefined,
|
|
134
135
|
notify: typeof s.notify === "boolean" ? s.notify : undefined,
|
|
135
136
|
gate: s.gate != null ? String(s.gate) : undefined,
|
|
136
137
|
}))
|
|
137
138
|
: undefined;
|
|
139
|
+
const internalSources = Array.isArray(obj.internalSources)
|
|
140
|
+
? obj.internalSources
|
|
141
|
+
.filter((s) => s != null && typeof s === "object")
|
|
142
|
+
.map((s) => ({
|
|
143
|
+
kind: String(s.kind ?? ""),
|
|
144
|
+
tool: String(s.tool ?? ""),
|
|
145
|
+
label: String(s.label ?? ""),
|
|
146
|
+
url: s.url != null ? String(s.url) : undefined,
|
|
147
|
+
lastSync: s.lastSync != null ? String(s.lastSync) : undefined,
|
|
148
|
+
}))
|
|
149
|
+
: undefined;
|
|
138
150
|
const pipelines = Array.isArray(obj.pipelines)
|
|
139
151
|
? obj.pipelines
|
|
140
152
|
.filter((p) => p != null && typeof p === "object")
|
|
@@ -144,7 +156,7 @@ async function readFleetSources(repoRoot) {
|
|
|
144
156
|
lastSuccess: p.lastSuccess != null ? String(p.lastSuccess) : undefined,
|
|
145
157
|
}))
|
|
146
158
|
: undefined;
|
|
147
|
-
return { externalSources, pipelines };
|
|
159
|
+
return { externalSources, internalSources, pipelines };
|
|
148
160
|
}
|
|
149
161
|
/** ディレクトリ内の .md を汎用レコードとして読み込む(存在しなければ空配列) */
|
|
150
162
|
async function loadGenericRecords(dirAbs, exclude, repoBaseUrl, branch) {
|
|
@@ -927,6 +939,7 @@ async function build(opts) {
|
|
|
927
939
|
}
|
|
928
940
|
: undefined,
|
|
929
941
|
externalSources: fleet.externalSources,
|
|
942
|
+
internalSources: fleet.internalSources,
|
|
930
943
|
pipelines: fleet.pipelines,
|
|
931
944
|
};
|
|
932
945
|
// サムネイル(デザイン画面等)をサイトに同梱し、ノードのパスをサイト内相対に書き換える
|
package/dist/render.js
CHANGED
|
@@ -339,6 +339,10 @@ a:hover { text-decoration: underline; }
|
|
|
339
339
|
.ds-icon { font-size: 18px; line-height: 1; flex: 0 0 auto; }
|
|
340
340
|
.ds-type { font-size: 12px; font-weight: 600; color: var(--muted); flex: 0 0 auto; }
|
|
341
341
|
.ds-name { font-size: 14.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
342
|
+
a.ds-name { color: var(--accent); }
|
|
343
|
+
a.ds-name:hover { text-decoration: underline; }
|
|
344
|
+
.ds-note { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 6px 0 0; }
|
|
345
|
+
.ds-sync { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
|
|
342
346
|
.ds-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; flex: 0 0 auto; }
|
|
343
347
|
.badge.ds-gold { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
|
|
344
348
|
.badge.ds-excluded { background: #eceef1; color: #6b7280; }
|
|
@@ -690,6 +694,14 @@ const CLIENT_JS = `
|
|
|
690
694
|
"no_token": { text: "トークン未設定", cls: "ds-gate-muted" },
|
|
691
695
|
"unknown": { text: "不明", cls: "ds-gate-muted" },
|
|
692
696
|
};
|
|
697
|
+
var DS_KIND_ICON = {
|
|
698
|
+
"課題管理": "📋",
|
|
699
|
+
"会議": "🗒️",
|
|
700
|
+
"共有資料": "📎",
|
|
701
|
+
"デザイン": "🎨",
|
|
702
|
+
"開発": "🐙",
|
|
703
|
+
"チャット": "💬",
|
|
704
|
+
};
|
|
693
705
|
function dsFmtTime(iso) {
|
|
694
706
|
var d = new Date(iso);
|
|
695
707
|
if (isNaN(d.getTime())) return "";
|
|
@@ -697,17 +709,43 @@ const CLIENT_JS = `
|
|
|
697
709
|
var mm = ("0" + d.getMinutes()).slice(-2);
|
|
698
710
|
return (d.getMonth() + 1) + "/" + d.getDate() + " " + hh + ":" + mm;
|
|
699
711
|
}
|
|
712
|
+
// 名前表示: url があれば新しいタブで正本を開くリンクにする
|
|
713
|
+
function dsNameEl(text, url) {
|
|
714
|
+
if (url) return el("a", { class: "ds-name", href: url, target: "_blank", rel: "noopener", text: text });
|
|
715
|
+
return el("span", { class: "ds-name", text: text });
|
|
716
|
+
}
|
|
700
717
|
function renderDataSources() {
|
|
718
|
+
var internals = SITE.internalSources || [];
|
|
701
719
|
var sources = SITE.externalSources || [];
|
|
702
720
|
var pipes = SITE.pipelines || [];
|
|
703
|
-
if (!sources.length && !pipes.length) return; //
|
|
721
|
+
if (!internals.length && !sources.length && !pipes.length) return; // すべて無ければセクションごと出さない
|
|
704
722
|
|
|
705
723
|
var sec = el("section", { class: "datasources" });
|
|
706
724
|
sec.appendChild(el("h2", { class: "datasources-head", text: "データソースと自動化" }));
|
|
707
725
|
sec.appendChild(el("p", { class: "datasources-intro", text: "このCortexが接続している情報源と、毎晩自動でGoldに昇格する処理の一覧です。" }));
|
|
708
726
|
|
|
727
|
+
if (internals.length) {
|
|
728
|
+
sec.appendChild(el("div", { class: "ds-sub", text: "リポジトリ内の情報源(自動同期)" }));
|
|
729
|
+
var ilist = el("div", { class: "ds-list" });
|
|
730
|
+
internals.forEach(function (s) {
|
|
731
|
+
var card = el("div", { class: "ds-card" }, [
|
|
732
|
+
el("div", { class: "ds-card-main" }, [
|
|
733
|
+
el("span", { class: "ds-icon", text: DS_KIND_ICON[s.kind] || "📁" }),
|
|
734
|
+
el("span", { class: "ds-type", text: s.kind || "" }),
|
|
735
|
+
dsNameEl(s.label || "", s.url),
|
|
736
|
+
]),
|
|
737
|
+
s.lastSync && dsFmtTime(s.lastSync)
|
|
738
|
+
? el("span", { class: "ds-sync", text: "最終同期: " + dsFmtTime(s.lastSync) })
|
|
739
|
+
: null,
|
|
740
|
+
]);
|
|
741
|
+
ilist.appendChild(card);
|
|
742
|
+
});
|
|
743
|
+
sec.appendChild(ilist);
|
|
744
|
+
sec.appendChild(el("p", { class: "ds-note", text: "これらの更新は毎晩の Gold 昇格が読み取ります。" }));
|
|
745
|
+
}
|
|
746
|
+
|
|
709
747
|
if (sources.length) {
|
|
710
|
-
sec.appendChild(el("div", { class: "ds-sub", text: "
|
|
748
|
+
sec.appendChild(el("div", { class: "ds-sub", text: "外部ソース(ライブ参照)" }));
|
|
711
749
|
var list = el("div", { class: "ds-list" });
|
|
712
750
|
sources.forEach(function (s) {
|
|
713
751
|
var meta = DS_TYPE[s.type] || { icon: "🔗", label: s.type || "その他" };
|
|
@@ -721,7 +759,7 @@ const CLIENT_JS = `
|
|
|
721
759
|
el("div", { class: "ds-card-main" }, [
|
|
722
760
|
el("span", { class: "ds-icon", text: meta.icon }),
|
|
723
761
|
el("span", { class: "ds-type", text: meta.label }),
|
|
724
|
-
|
|
762
|
+
dsNameEl(s.name || "", s.url),
|
|
725
763
|
]),
|
|
726
764
|
badges,
|
|
727
765
|
gateEl,
|
package/package.json
CHANGED