- {sortedGroups.map(([key, group]) => {
+ {sortedGroups.map(({ key, group, effectiveScore }) => {
const critical = group.items.filter((i) => i.severity === 'critical').length
const high = group.items.filter((i) => i.severity === 'high').length
const sorted = [...group.items].sort((a, b) => severityRank[a.severity] - severityRank[b.severity])
@@ -326,10 +425,24 @@ function DebtRegister({
-
{group.label}
+
+
{group.label}
+ {group.asset && (
+
+ {group.asset.health}
+
+ )}
+
{group.product}
+
= 60 ? severityStyles.critical : effectiveScore >= 30 ? severityStyles.high : severityStyles.medium)}
+ title={group.asset?.techDebtScore != null ? 'Manually set debt score' : 'Derived from open tech-debt severity'}
+ >
+ Debt score {effectiveScore}
+
{critical > 0 && (
{critical} critical
)}
diff --git a/lib/db/queries.ts b/lib/db/queries.ts
index 573b883..f0666f2 100644
--- a/lib/db/queries.ts
+++ b/lib/db/queries.ts
@@ -762,6 +762,23 @@ export async function getAssetOptions(
.orderBy(assets.name)
}
+export type AssetDebtInfo = {
+ id: string
+ health: 'healthy' | 'warning' | 'critical'
+ /** Manual override score, when set. */
+ techDebtScore: number | null
+}
+
+/** Health + manual debt-score override for accessible assets — for the tech debt register. */
+export async function getAssetDebtInfo(userId: string): Promise
{
+ const productFilter = await productAccessWhere(userId)
+ return db
+ .select({ id: assets.id, health: assets.health, techDebtScore: assets.techDebtScore })
+ .from(assets)
+ .innerJoin(products, eq(assets.productId, products.id))
+ .where(productFilter)
+}
+
// ---------------------------------------------------------------------------
// Asset dependencies & impact analysis
// ---------------------------------------------------------------------------
diff --git a/lib/plans-view-cookie.ts b/lib/plans-view-cookie.ts
new file mode 100644
index 0000000..def22e9
--- /dev/null
+++ b/lib/plans-view-cookie.ts
@@ -0,0 +1,6 @@
+export const PLANS_VIEW_COOKIE = 'plans_view'
+export type PlansView = 'card' | 'list'
+
+export function parsePlansView(value: string | undefined): PlansView {
+ return value === 'list' ? 'list' : 'card'
+}
diff --git a/package.json b/package.json
index 2fcdf5d..40fef35 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "codeplans",
- "version": "0.3.22",
+ "version": "0.3.23",
"description": "Manage and track coordinated changes across your software architecture.",
"author": "Sai Prakash ",
"homepage": "https://codeplans.ai",