selftune 0.2.8 → 0.2.10

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.
Files changed (140) hide show
  1. package/README.md +35 -35
  2. package/apps/local-dashboard/dist/assets/index-BZVLv70T.js +16 -0
  3. package/apps/local-dashboard/dist/assets/{index-CRtLkBTi.css → index-Bs3Y4ixf.css} +1 -1
  4. package/apps/local-dashboard/dist/assets/{vendor-react-BQH_6WrG.js → vendor-react-BXP54cYo.js} +4 -4
  5. package/apps/local-dashboard/dist/assets/{vendor-table-dK1QMLq9.js → vendor-table-DTF_SXoy.js} +1 -1
  6. package/apps/local-dashboard/dist/assets/{vendor-ui-CO2mrx6e.js → vendor-ui-CWU0d1wd.js} +66 -66
  7. package/apps/local-dashboard/dist/index.html +15 -15
  8. package/bin/selftune.cjs +1 -1
  9. package/cli/selftune/activation-rules.ts +37 -18
  10. package/cli/selftune/agent-guidance.ts +16 -16
  11. package/cli/selftune/alpha-identity.ts +1 -2
  12. package/cli/selftune/alpha-upload/build-payloads.ts +18 -2
  13. package/cli/selftune/alpha-upload/flush.ts +2 -2
  14. package/cli/selftune/alpha-upload/stage-canonical.ts +106 -3
  15. package/cli/selftune/auth/device-code.ts +32 -0
  16. package/cli/selftune/auto-update.ts +12 -0
  17. package/cli/selftune/badge/badge.ts +1 -0
  18. package/cli/selftune/canonical-export.ts +5 -0
  19. package/cli/selftune/claude-agents.ts +154 -0
  20. package/cli/selftune/contribute/bundle.ts +2 -0
  21. package/cli/selftune/contribute/contribute.ts +1 -0
  22. package/cli/selftune/cron/setup.ts +2 -2
  23. package/cli/selftune/dashboard-contract.ts +1 -1
  24. package/cli/selftune/dashboard-server.ts +11 -52
  25. package/cli/selftune/eval/hooks-to-evals.ts +13 -6
  26. package/cli/selftune/eval/import-skillsbench.ts +1 -0
  27. package/cli/selftune/eval/synthetic-evals.ts +2 -3
  28. package/cli/selftune/eval/unit-test.ts +1 -0
  29. package/cli/selftune/evolution/deploy-proposal.ts +1 -0
  30. package/cli/selftune/evolution/evolve-body.ts +93 -6
  31. package/cli/selftune/evolution/evolve.ts +0 -1
  32. package/cli/selftune/evolution/propose-body.ts +3 -2
  33. package/cli/selftune/evolution/propose-routing.ts +3 -2
  34. package/cli/selftune/evolution/refine-body.ts +3 -2
  35. package/cli/selftune/export.ts +1 -0
  36. package/cli/selftune/grading/auto-grade.ts +1 -0
  37. package/cli/selftune/grading/grade-session.ts +9 -0
  38. package/cli/selftune/hooks/auto-activate.ts +6 -0
  39. package/cli/selftune/hooks/evolution-guard.ts +12 -15
  40. package/cli/selftune/hooks/prompt-log.ts +1 -0
  41. package/cli/selftune/hooks/session-stop.ts +34 -40
  42. package/cli/selftune/hooks/skill-change-guard.ts +1 -0
  43. package/cli/selftune/hooks/skill-eval.ts +1 -1
  44. package/cli/selftune/index.ts +23 -14
  45. package/cli/selftune/ingestors/claude-replay.ts +1 -0
  46. package/cli/selftune/ingestors/codex-rollout.ts +1 -0
  47. package/cli/selftune/ingestors/codex-wrapper.ts +1 -0
  48. package/cli/selftune/ingestors/openclaw-ingest.ts +1 -0
  49. package/cli/selftune/ingestors/opencode-ingest.ts +1 -0
  50. package/cli/selftune/init.ts +197 -96
  51. package/cli/selftune/localdb/db.ts +1 -0
  52. package/cli/selftune/localdb/direct-write.ts +93 -12
  53. package/cli/selftune/localdb/materialize.ts +2 -0
  54. package/cli/selftune/localdb/queries.ts +210 -0
  55. package/cli/selftune/localdb/schema.ts +72 -1
  56. package/cli/selftune/monitoring/watch.ts +1 -0
  57. package/cli/selftune/normalization.ts +4 -0
  58. package/cli/selftune/observability.ts +14 -7
  59. package/cli/selftune/orchestrate.ts +15 -37
  60. package/cli/selftune/repair/skill-usage.ts +7 -3
  61. package/cli/selftune/routes/orchestrate-runs.ts +1 -0
  62. package/cli/selftune/routes/overview.ts +1 -0
  63. package/cli/selftune/routes/skill-report.ts +1 -0
  64. package/cli/selftune/sync.ts +31 -1
  65. package/cli/selftune/types.ts +2 -2
  66. package/cli/selftune/uninstall.ts +412 -0
  67. package/cli/selftune/utils/canonical-log.ts +2 -0
  68. package/cli/selftune/utils/jsonl.ts +1 -0
  69. package/cli/selftune/utils/llm-call.ts +131 -3
  70. package/cli/selftune/utils/skill-log.ts +1 -0
  71. package/cli/selftune/utils/transcript.ts +1 -0
  72. package/cli/selftune/utils/trigger-check.ts +1 -1
  73. package/cli/selftune/workflows/skill-md-writer.ts +5 -5
  74. package/cli/selftune/workflows/workflows.ts +1 -0
  75. package/package.json +38 -33
  76. package/packages/telemetry-contract/fixtures/golden.test.ts +1 -0
  77. package/packages/telemetry-contract/package.json +3 -3
  78. package/packages/telemetry-contract/src/index.ts +0 -1
  79. package/packages/telemetry-contract/src/schemas.ts +6 -24
  80. package/packages/telemetry-contract/tests/compatibility.test.ts +1 -0
  81. package/packages/ui/README.md +35 -34
  82. package/packages/ui/package.json +3 -3
  83. package/packages/ui/src/components/ActivityTimeline.tsx +49 -42
  84. package/packages/ui/src/components/EvidenceViewer.tsx +306 -182
  85. package/packages/ui/src/components/EvolutionTimeline.tsx +83 -72
  86. package/packages/ui/src/components/InfoTip.tsx +4 -3
  87. package/packages/ui/src/components/OrchestrateRunsPanel.tsx +60 -53
  88. package/packages/ui/src/components/section-cards.tsx +19 -24
  89. package/packages/ui/src/components/skill-health-grid.tsx +213 -193
  90. package/packages/ui/src/lib/constants.tsx +1 -0
  91. package/packages/ui/src/primitives/badge.tsx +12 -15
  92. package/packages/ui/src/primitives/button.tsx +7 -7
  93. package/packages/ui/src/primitives/card.tsx +15 -26
  94. package/packages/ui/src/primitives/checkbox.tsx +7 -8
  95. package/packages/ui/src/primitives/collapsible.tsx +5 -5
  96. package/packages/ui/src/primitives/dropdown-menu.tsx +45 -55
  97. package/packages/ui/src/primitives/label.tsx +6 -6
  98. package/packages/ui/src/primitives/select.tsx +28 -37
  99. package/packages/ui/src/primitives/table.tsx +17 -44
  100. package/packages/ui/src/primitives/tabs.tsx +14 -21
  101. package/packages/ui/src/primitives/tooltip.tsx +10 -22
  102. package/skill/SKILL.md +72 -59
  103. package/skill/Workflows/AlphaUpload.md +4 -4
  104. package/skill/Workflows/AutoActivation.md +11 -6
  105. package/skill/Workflows/Badge.md +22 -16
  106. package/skill/Workflows/Baseline.md +34 -36
  107. package/skill/Workflows/Composability.md +16 -11
  108. package/skill/Workflows/Contribute.md +26 -21
  109. package/skill/Workflows/Cron.md +23 -22
  110. package/skill/Workflows/Dashboard.md +40 -40
  111. package/skill/Workflows/Doctor.md +40 -34
  112. package/skill/Workflows/Evals.md +48 -47
  113. package/skill/Workflows/EvolutionMemory.md +31 -21
  114. package/skill/Workflows/Evolve.md +84 -82
  115. package/skill/Workflows/EvolveBody.md +58 -47
  116. package/skill/Workflows/Grade.md +16 -13
  117. package/skill/Workflows/ImportSkillsBench.md +9 -6
  118. package/skill/Workflows/Ingest.md +36 -21
  119. package/skill/Workflows/Initialize.md +138 -97
  120. package/skill/Workflows/Orchestrate.md +22 -16
  121. package/skill/Workflows/Replay.md +12 -7
  122. package/skill/Workflows/Rollback.md +13 -6
  123. package/skill/Workflows/Schedule.md +6 -6
  124. package/skill/Workflows/Sync.md +18 -11
  125. package/skill/Workflows/UnitTest.md +28 -17
  126. package/skill/Workflows/Watch.md +28 -21
  127. package/skill/agents/diagnosis-analyst.md +11 -0
  128. package/skill/agents/evolution-reviewer.md +15 -1
  129. package/skill/agents/integration-guide.md +10 -0
  130. package/skill/agents/pattern-analyst.md +12 -1
  131. package/skill/references/grading-methodology.md +23 -24
  132. package/skill/references/interactive-config.md +7 -7
  133. package/skill/references/invocation-taxonomy.md +22 -20
  134. package/skill/references/logs.md +20 -6
  135. package/skill/references/setup-patterns.md +4 -2
  136. package/.claude/agents/diagnosis-analyst.md +0 -156
  137. package/.claude/agents/evolution-reviewer.md +0 -180
  138. package/.claude/agents/integration-guide.md +0 -212
  139. package/.claude/agents/pattern-analyst.md +0 -160
  140. package/apps/local-dashboard/dist/assets/index-Bk9vSHHd.js +0 -15
package/package.json CHANGED
@@ -1,41 +1,44 @@
1
1
  {
2
2
  "name": "selftune",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Self-improving skills CLI for AI agents",
5
- "type": "module",
5
+ "keywords": [
6
+ "agent",
7
+ "bun",
8
+ "claude-code",
9
+ "cli",
10
+ "codex",
11
+ "eval",
12
+ "evolution",
13
+ "grading",
14
+ "opencode",
15
+ "self-improving",
16
+ "selftune",
17
+ "skill",
18
+ "telemetry",
19
+ "typescript"
20
+ ],
21
+ "homepage": "https://github.com/selftune-dev/selftune#readme",
22
+ "bugs": {
23
+ "url": "https://github.com/selftune-dev/selftune/issues"
24
+ },
6
25
  "license": "MIT",
7
26
  "author": "Daniel Petro",
8
- "homepage": "https://github.com/selftune-dev/selftune#readme",
9
27
  "repository": {
10
28
  "type": "git",
11
29
  "url": "git+https://github.com/selftune-dev/selftune.git"
12
30
  },
13
- "bugs": {
14
- "url": "https://github.com/selftune-dev/selftune/issues"
15
- },
16
31
  "funding": {
17
32
  "type": "github",
18
33
  "url": "https://github.com/sponsors/WellDunDun"
19
34
  },
20
- "keywords": [
21
- "selftune",
22
- "skill",
23
- "self-improving",
24
- "claude-code",
25
- "codex",
26
- "opencode",
27
- "eval",
28
- "grading",
29
- "evolution",
30
- "cli",
31
- "agent",
32
- "telemetry",
33
- "bun",
34
- "typescript"
35
- ],
36
35
  "bin": {
37
36
  "selftune": "bin/selftune.cjs"
38
37
  },
38
+ "workspaces": [
39
+ "packages/*",
40
+ "apps/*"
41
+ ],
39
42
  "files": [
40
43
  "assets/",
41
44
  "bin/",
@@ -44,38 +47,40 @@
44
47
  "packages/telemetry-contract/",
45
48
  "packages/ui/",
46
49
  "templates/",
47
- ".claude/agents/",
48
50
  "skill/",
49
51
  "README.md",
50
52
  "CHANGELOG.md"
51
53
  ],
54
+ "type": "module",
52
55
  "scripts": {
53
- "dev": "sh -c 'if lsof -iTCP:7888 -sTCP:LISTEN >/dev/null 2>&1; then if curl -fsS http://localhost:7888/api/health | grep -q selftune-dashboard; then echo \"Using existing dashboard server on 7888\"; cd apps/local-dashboard && bunx vite --strictPort; else echo \"Port 7888 is occupied by a non-selftune service\"; exit 1; fi; else cd apps/local-dashboard && bun run dev; fi'",
56
+ "dev": "trap 'kill 0' EXIT; bun --watch run cli/selftune/dashboard-server.ts --port 7888 --runtime-mode dev-server & sleep 1 && cd apps/local-dashboard && bunx vite --strictPort",
54
57
  "dev:server": "bun --watch run cli/selftune/dashboard-server.ts --port 7888 --runtime-mode dev-server",
55
58
  "dev:dashboard": "bun run cli/selftune/index.ts dashboard --port 7888 --no-open",
56
- "lint": "bunx @biomejs/biome check .",
57
- "lint:fix": "bunx @biomejs/biome check --write .",
59
+ "lint": "bunx oxlint",
60
+ "lint:fix": "bunx oxlint --fix",
61
+ "format": "bunx oxfmt",
62
+ "format:check": "bunx oxfmt --check",
58
63
  "lint:arch": "bun run lint-architecture.ts",
59
64
  "test": "bun test tests/ packages/telemetry-contract/",
60
65
  "test:fast": "bun test $(find tests -name '*.test.ts' ! -name 'evolve.test.ts' ! -name 'integration.test.ts' ! -name 'dashboard-server.test.ts' ! -path '*/blog-proof/*')",
61
66
  "test:slow": "bun test tests/evolution/evolve.test.ts tests/evolution/integration.test.ts tests/monitoring/integration.test.ts tests/dashboard/dashboard-server.test.ts",
62
67
  "build:dashboard": "cd apps/local-dashboard && bunx vite build",
68
+ "link:claude-workspace": "bash scripts/link-claude-workspace.sh",
69
+ "prepack": "node scripts/publish-package-json.cjs prepare",
70
+ "postpack": "node scripts/publish-package-json.cjs restore",
63
71
  "sync-version": "bun run scripts/sync-skill-version.ts",
64
72
  "validate:subagents": "bun run scripts/validate-subagent-docs.ts",
65
73
  "prepublishOnly": "bun run sync-version && bun run build:dashboard",
66
74
  "typecheck:dashboard": "cd apps/local-dashboard && bunx tsc --noEmit",
67
- "check": "bun run lint && bun run lint:arch && bun run typecheck:dashboard && bun run test",
75
+ "check": "bun run lint && bun run format:check && bun run lint:arch && bun run typecheck:dashboard && bun run test",
68
76
  "start": "bun run cli/selftune/index.ts --help"
69
77
  },
70
- "workspaces": [
71
- "packages/*",
72
- "apps/*"
73
- ],
74
78
  "dependencies": {
75
79
  "@selftune/telemetry-contract": "file:packages/telemetry-contract"
76
80
  },
77
81
  "devDependencies": {
78
- "@biomejs/biome": "^2.4.7",
79
- "@types/bun": "^1.1.0"
82
+ "@types/bun": "^1.1.0",
83
+ "oxfmt": "^0.41.0",
84
+ "oxlint": "^1.56.0"
80
85
  }
81
86
  }
@@ -1,6 +1,7 @@
1
1
  import { describe, expect, test } from "bun:test";
2
2
  import { readFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
+
4
5
  import { CANONICAL_SCHEMA_VERSION } from "../src/types.js";
5
6
  import { isCanonicalRecord } from "../src/validators.js";
6
7
 
@@ -3,7 +3,6 @@
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "description": "Canonical telemetry schema, types, and validators for selftune",
6
- "type": "module",
7
6
  "license": "MIT",
8
7
  "author": "Daniel Petro",
9
8
  "repository": {
@@ -11,14 +10,15 @@
11
10
  "url": "git+https://github.com/selftune-dev/selftune.git",
12
11
  "directory": "packages/telemetry-contract"
13
12
  },
13
+ "type": "module",
14
14
  "exports": {
15
15
  ".": "./index.ts",
16
+ "./schemas": "./src/schemas.ts",
16
17
  "./types": "./src/types.ts",
17
18
  "./validators": "./src/validators.ts",
18
- "./schemas": "./src/schemas.ts",
19
19
  "./fixtures": "./fixtures/index.ts"
20
20
  },
21
21
  "dependencies": {
22
- "zod": "^3.24.0"
22
+ "zod": "^4.3.6"
23
23
  }
24
24
  }
@@ -1,3 +1,2 @@
1
- export * from "./schemas.js";
2
1
  export * from "./types.js";
3
2
  export * from "./validators.js";
@@ -1,13 +1,5 @@
1
- /**
2
- * Zod validation schemas for all canonical telemetry record types
3
- * and the PushPayloadV2 envelope.
4
- *
5
- * This is the single source of truth -- cloud consumers should import
6
- * from @selftune/telemetry-contract/schemas instead of maintaining
7
- * their own copies.
8
- */
9
-
10
1
  import { z } from "zod";
2
+
11
3
  import {
12
4
  CANONICAL_CAPTURE_MODES,
13
5
  CANONICAL_COMPLETION_STATUSES,
@@ -19,8 +11,6 @@ import {
19
11
  CANONICAL_SOURCE_SESSION_KINDS,
20
12
  } from "./types.js";
21
13
 
22
- // ---------- Shared enum schemas ----------
23
-
24
14
  export const canonicalPlatformSchema = z.enum(CANONICAL_PLATFORMS);
25
15
  export const captureModeSchema = z.enum(CANONICAL_CAPTURE_MODES);
26
16
  export const sourceSessionKindSchema = z.enum(CANONICAL_SOURCE_SESSION_KINDS);
@@ -29,14 +19,12 @@ export const invocationModeSchema = z.enum(CANONICAL_INVOCATION_MODES);
29
19
  export const completionStatusSchema = z.enum(CANONICAL_COMPLETION_STATUSES);
30
20
  export const recordKindSchema = z.enum(CANONICAL_RECORD_KINDS);
31
21
 
32
- // ---------- Shared structural schemas ----------
33
-
34
22
  export const rawSourceRefSchema = z.object({
35
23
  path: z.string().optional(),
36
24
  line: z.number().int().nonnegative().optional(),
37
25
  event_type: z.string().optional(),
38
26
  raw_id: z.string().optional(),
39
- metadata: z.record(z.unknown()).optional(),
27
+ metadata: z.record(z.string(), z.unknown()).optional(),
40
28
  });
41
29
 
42
30
  export const canonicalRecordBaseSchema = z.object({
@@ -54,8 +42,6 @@ export const canonicalSessionRecordBaseSchema = canonicalRecordBaseSchema.extend
54
42
  session_id: z.string().min(1),
55
43
  });
56
44
 
57
- // ---------- Canonical record schemas ----------
58
-
59
45
  export const CanonicalSessionRecordSchema = canonicalSessionRecordBaseSchema.extend({
60
46
  record_kind: z.literal("session"),
61
47
  external_session_id: z.string().optional(),
@@ -115,7 +101,7 @@ export const CanonicalExecutionFactRecordSchema = canonicalSessionRecordBaseSche
115
101
  execution_fact_id: z.string().min(1),
116
102
  occurred_at: z.string().datetime(),
117
103
  prompt_id: z.string().optional(),
118
- tool_calls_json: z.record(z.number().finite()),
104
+ tool_calls_json: z.record(z.string(), z.number().finite()),
119
105
  total_tool_calls: z.number().int().nonnegative(),
120
106
  bash_commands_redacted: z.array(z.string()).optional(),
121
107
  assistant_turns: z.number().int().nonnegative(),
@@ -151,8 +137,6 @@ export const CanonicalEvolutionEvidenceRecordSchema = z.object({
151
137
  raw_source_ref: rawSourceRefSchema.optional(),
152
138
  });
153
139
 
154
- // ---------- Orchestrate run schemas ----------
155
-
156
140
  export const OrchestrateRunSkillActionSchema = z.object({
157
141
  skill: z.string().min(1),
158
142
  action: z.enum(["evolve", "watch", "skip"]),
@@ -179,12 +163,12 @@ export const PushOrchestrateRunRecordSchema = z.object({
179
163
  skill_actions: z.array(OrchestrateRunSkillActionSchema),
180
164
  });
181
165
 
182
- // ---------- Push V2 envelope ----------
183
-
184
166
  export const PushPayloadV2Schema = z.object({
185
167
  schema_version: z.literal("2.0"),
186
168
  client_version: z.string().min(1),
187
- push_id: z.string().uuid(),
169
+ // Queue-generated push IDs are typically UUIDs, but the wire contract only
170
+ // requires a stable non-empty idempotency key.
171
+ push_id: z.string().min(1),
188
172
  normalizer_version: z.string().min(1),
189
173
  canonical: z.object({
190
174
  sessions: z.array(CanonicalSessionRecordSchema).min(0),
@@ -197,8 +181,6 @@ export const PushPayloadV2Schema = z.object({
197
181
  }),
198
182
  });
199
183
 
200
- // ---------- Inferred types from Zod schemas ----------
201
-
202
184
  export type PushPayloadV2 = z.infer<typeof PushPayloadV2Schema>;
203
185
  export type ZodCanonicalSessionRecord = z.infer<typeof CanonicalSessionRecordSchema>;
204
186
  export type ZodCanonicalPromptRecord = z.infer<typeof CanonicalPromptRecordSchema>;
@@ -1,4 +1,5 @@
1
1
  import { describe, expect, test } from "bun:test";
2
+
2
3
  import { completePush } from "../fixtures/complete-push.js";
3
4
  import { evidenceOnlyPush } from "../fixtures/evidence-only-push.js";
4
5
  import { partialPushNoSessions } from "../fixtures/partial-push-no-sessions.js";
@@ -17,16 +17,16 @@ Add as a workspace dependency:
17
17
  Import from subpath exports:
18
18
 
19
19
  ```tsx
20
- import { Badge, Button, Card } from "@selftune/ui/primitives"
21
- import { SkillHealthGrid, EvolutionTimeline } from "@selftune/ui/components"
22
- import { cn, timeAgo, deriveStatus, STATUS_CONFIG } from "@selftune/ui/lib"
23
- import type { SkillCard, EvolutionEntry } from "@selftune/ui/types"
20
+ import { Badge, Button, Card } from "@selftune/ui/primitives";
21
+ import { SkillHealthGrid, EvolutionTimeline } from "@selftune/ui/components";
22
+ import { cn, timeAgo, deriveStatus, STATUS_CONFIG } from "@selftune/ui/lib";
23
+ import type { SkillCard, EvolutionEntry } from "@selftune/ui/types";
24
24
  ```
25
25
 
26
26
  Or import everything from the root:
27
27
 
28
28
  ```tsx
29
- import { Badge, SkillHealthGrid, cn, type SkillCard } from "@selftune/ui"
29
+ import { Badge, SkillHealthGrid, cn, type SkillCard } from "@selftune/ui";
30
30
  ```
31
31
 
32
32
  ## Exports
@@ -35,44 +35,44 @@ import { Badge, SkillHealthGrid, cn, type SkillCard } from "@selftune/ui"
35
35
 
36
36
  shadcn/ui components built on [@base-ui/react](https://base-ui.com/):
37
37
 
38
- | Component | Source |
39
- |-----------|--------|
40
- | `Badge`, `badgeVariants` | badge.tsx |
41
- | `Button`, `buttonVariants` | button.tsx |
42
- | `Card`, `CardHeader`, `CardTitle`, `CardDescription`, `CardAction`, `CardContent`, `CardFooter` | card.tsx |
43
- | `Checkbox` | checkbox.tsx |
44
- | `Collapsible`, `CollapsibleTrigger`, `CollapsibleContent` | collapsible.tsx |
45
- | `DropdownMenu`, `DropdownMenuTrigger`, `DropdownMenuContent`, `DropdownMenuItem`, ... | dropdown-menu.tsx |
46
- | `Label` | label.tsx |
47
- | `Select`, `SelectTrigger`, `SelectContent`, `SelectItem`, ... | select.tsx |
48
- | `Table`, `TableHeader`, `TableBody`, `TableRow`, `TableHead`, `TableCell`, ... | table.tsx |
49
- | `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent` | tabs.tsx |
50
- | `Tooltip`, `TooltipTrigger`, `TooltipContent`, `TooltipProvider` | tooltip.tsx |
38
+ | Component | Source |
39
+ | ----------------------------------------------------------------------------------------------- | ----------------- |
40
+ | `Badge`, `badgeVariants` | badge.tsx |
41
+ | `Button`, `buttonVariants` | button.tsx |
42
+ | `Card`, `CardHeader`, `CardTitle`, `CardDescription`, `CardAction`, `CardContent`, `CardFooter` | card.tsx |
43
+ | `Checkbox` | checkbox.tsx |
44
+ | `Collapsible`, `CollapsibleTrigger`, `CollapsibleContent` | collapsible.tsx |
45
+ | `DropdownMenu`, `DropdownMenuTrigger`, `DropdownMenuContent`, `DropdownMenuItem`, ... | dropdown-menu.tsx |
46
+ | `Label` | label.tsx |
47
+ | `Select`, `SelectTrigger`, `SelectContent`, `SelectItem`, ... | select.tsx |
48
+ | `Table`, `TableHeader`, `TableBody`, `TableRow`, `TableHead`, `TableCell`, ... | table.tsx |
49
+ | `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent` | tabs.tsx |
50
+ | `Tooltip`, `TooltipTrigger`, `TooltipContent`, `TooltipProvider` | tooltip.tsx |
51
51
 
52
52
  ### Domain Components (`@selftune/ui/components`)
53
53
 
54
54
  Presentational components for selftune dashboard views. No data fetching, no routing — pass data and callbacks as props.
55
55
 
56
- | Component | Description |
57
- |-----------|-------------|
58
- | `SkillHealthGrid` | Sortable/filterable data table with drag-and-drop, pagination, and view tabs. Accepts `renderSkillName` prop for custom routing. |
59
- | `EvolutionTimeline` | Proposal lifecycle timeline grouped by proposal ID, with pass rate deltas. |
60
- | `ActivityPanel` | Tabbed activity feed (pending proposals, timeline events, unmatched queries). |
61
- | `EvidenceViewer` | Full evidence trail for a proposal — side-by-side diffs, validation results, iteration rounds. |
62
- | `SectionCards` | Dashboard metric stat cards (skills count, pass rate, unmatched, sessions, etc.). |
63
- | `OrchestrateRunsPanel` | Collapsible orchestrate run reports with per-skill action details. |
64
- | `InfoTip` | Small info icon with tooltip, used to explain metrics. |
56
+ | Component | Description |
57
+ | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
58
+ | `SkillHealthGrid` | Sortable/filterable data table with drag-and-drop, pagination, and view tabs. Accepts `renderSkillName` prop for custom routing. |
59
+ | `EvolutionTimeline` | Proposal lifecycle timeline grouped by proposal ID, with pass rate deltas. |
60
+ | `ActivityPanel` | Tabbed activity feed (pending proposals, timeline events, unmatched queries). |
61
+ | `EvidenceViewer` | Full evidence trail for a proposal — side-by-side diffs, validation results, iteration rounds. |
62
+ | `SectionCards` | Dashboard metric stat cards (skills count, pass rate, unmatched, sessions, etc.). |
63
+ | `OrchestrateRunsPanel` | Collapsible orchestrate run reports with per-skill action details. |
64
+ | `InfoTip` | Small info icon with tooltip, used to explain metrics. |
65
65
 
66
66
  ### Utilities (`@selftune/ui/lib`)
67
67
 
68
- | Export | Description |
69
- |--------|-------------|
70
- | `cn(...inputs)` | Tailwind class merge utility (clsx + tailwind-merge) |
71
- | `timeAgo(timestamp)` | Relative time string ("3h ago", "2d ago") |
72
- | `formatRate(rate)` | Format 0-1 rate as percentage string ("85%") |
73
- | `deriveStatus(passRate, checks)` | Derive `SkillHealthStatus` from pass rate and check count |
68
+ | Export | Description |
69
+ | -------------------------------- | --------------------------------------------------------------- |
70
+ | `cn(...inputs)` | Tailwind class merge utility (clsx + tailwind-merge) |
71
+ | `timeAgo(timestamp)` | Relative time string ("3h ago", "2d ago") |
72
+ | `formatRate(rate)` | Format 0-1 rate as percentage string ("85%") |
73
+ | `deriveStatus(passRate, checks)` | Derive `SkillHealthStatus` from pass rate and check count |
74
74
  | `sortByPassRateAndChecks(items)` | Sort skill cards by pass rate ascending, then checks descending |
75
- | `STATUS_CONFIG` | Icon, variant, and label for each `SkillHealthStatus` value |
75
+ | `STATUS_CONFIG` | Icon, variant, and label for each `SkillHealthStatus` value |
76
76
 
77
77
  ### Types (`@selftune/ui/types`)
78
78
 
@@ -107,6 +107,7 @@ This package uses Tailwind v4. The Vite plugin auto-scans imported workspace pac
107
107
  Required: `react`, `react-dom`
108
108
 
109
109
  Optional (only needed by specific components):
110
+
110
111
  - `@dnd-kit/*` — SkillHealthGrid drag-and-drop
111
112
  - `@tanstack/react-table` — SkillHealthGrid table
112
113
  - `react-markdown` — EvidenceViewer markdown rendering
@@ -3,7 +3,6 @@
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "description": "Shared UI components for selftune dashboards",
6
- "type": "module",
7
6
  "license": "MIT",
8
7
  "author": "Daniel Petro",
9
8
  "repository": {
@@ -11,6 +10,7 @@
11
10
  "url": "git+https://github.com/selftune-dev/selftune.git",
12
11
  "directory": "packages/ui"
13
12
  },
13
+ "type": "module",
14
14
  "exports": {
15
15
  ".": "./index.ts",
16
16
  "./primitives": "./src/primitives/index.ts",
@@ -30,13 +30,13 @@
30
30
  "@types/react-dom": "^19.0.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "react": "^19.0.0",
34
- "react-dom": "^19.0.0",
35
33
  "@dnd-kit/core": "^6.0.0",
36
34
  "@dnd-kit/modifiers": "^9.0.0",
37
35
  "@dnd-kit/sortable": "^10.0.0",
38
36
  "@dnd-kit/utilities": "^3.0.0",
39
37
  "@tanstack/react-table": "^8.0.0",
38
+ "react": "^19.0.0",
39
+ "react-dom": "^19.0.0",
40
40
  "react-markdown": "^10.0.0",
41
41
  "recharts": "^2.0.0"
42
42
  },
@@ -1,21 +1,11 @@
1
- import { Badge } from "../primitives/badge"
2
- import {
3
- Card,
4
- CardContent,
5
- CardDescription,
6
- CardHeader,
7
- CardTitle,
8
- } from "../primitives/card"
9
- import { Tabs, TabsContent, TabsList, TabsTrigger } from "../primitives/tabs"
10
- import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../primitives/tooltip"
11
- import type { EvolutionEntry, PendingProposal, UnmatchedQuery } from "../types"
12
- import { timeAgo } from "../lib/format"
13
- import {
14
- ClockIcon,
15
- GitPullRequestArrowIcon,
16
- SearchXIcon,
17
- ActivityIcon,
18
- } from "lucide-react"
1
+ import { ClockIcon, GitPullRequestArrowIcon, SearchXIcon, ActivityIcon } from "lucide-react";
2
+
3
+ import { timeAgo } from "../lib/format";
4
+ import { Badge } from "../primitives/badge";
5
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../primitives/card";
6
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "../primitives/tabs";
7
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../primitives/tooltip";
8
+ import type { EvolutionEntry, PendingProposal, UnmatchedQuery } from "../types";
19
9
 
20
10
  const ACTION_VARIANT: Record<string, "default" | "secondary" | "destructive" | "outline"> = {
21
11
  created: "outline",
@@ -24,7 +14,7 @@ const ACTION_VARIANT: Record<string, "default" | "secondary" | "destructive" | "
24
14
  rejected: "destructive",
25
15
  rolled_back: "destructive",
26
16
  pending: "secondary",
27
- }
17
+ };
28
18
 
29
19
  export function ActivityPanel({
30
20
  evolution,
@@ -32,12 +22,13 @@ export function ActivityPanel({
32
22
  unmatchedQueries,
33
23
  onSelectProposal,
34
24
  }: {
35
- evolution: EvolutionEntry[]
36
- pendingProposals: PendingProposal[]
37
- unmatchedQueries: UnmatchedQuery[]
38
- onSelectProposal?: (skillName: string, proposalId: string) => void
25
+ evolution: EvolutionEntry[];
26
+ pendingProposals: PendingProposal[];
27
+ unmatchedQueries: UnmatchedQuery[];
28
+ onSelectProposal?: (skillName: string, proposalId: string) => void;
39
29
  }) {
40
- const hasActivity = evolution.length > 0 || pendingProposals.length > 0 || unmatchedQueries.length > 0
30
+ const hasActivity =
31
+ evolution.length > 0 || pendingProposals.length > 0 || unmatchedQueries.length > 0;
41
32
 
42
33
  if (!hasActivity) {
43
34
  return (
@@ -49,12 +40,10 @@ export function ActivityPanel({
49
40
  </CardTitle>
50
41
  </CardHeader>
51
42
  <CardContent>
52
- <p className="text-sm text-muted-foreground text-center py-8">
53
- No recent activity
54
- </p>
43
+ <p className="text-sm text-muted-foreground text-center py-8">No recent activity</p>
55
44
  </CardContent>
56
45
  </Card>
57
- )
46
+ );
58
47
  }
59
48
 
60
49
  return (
@@ -80,7 +69,9 @@ export function ActivityPanel({
80
69
  <TabsList className="w-full">
81
70
  {pendingProposals.length > 0 && (
82
71
  <Tooltip>
83
- <TooltipTrigger render={<TabsTrigger value="pending" className="flex-1 gap-1.5" />}>
72
+ <TooltipTrigger
73
+ render={<TabsTrigger value="pending" className="flex-1 gap-1.5" />}
74
+ >
84
75
  <GitPullRequestArrowIcon className="size-3.5" />
85
76
  <Badge variant="secondary" className="h-4 px-1 text-[10px]">
86
77
  {pendingProposals.length}
@@ -97,7 +88,9 @@ export function ActivityPanel({
97
88
  </Tooltip>
98
89
  {unmatchedQueries.length > 0 && (
99
90
  <Tooltip>
100
- <TooltipTrigger render={<TabsTrigger value="unmatched" className="flex-1 gap-1.5" />}>
91
+ <TooltipTrigger
92
+ render={<TabsTrigger value="unmatched" className="flex-1 gap-1.5" />}
93
+ >
101
94
  <SearchXIcon className="size-3.5" />
102
95
  <Badge variant="destructive" className="h-4 px-1 text-[10px]">
103
96
  {unmatchedQueries.length}
@@ -116,7 +109,8 @@ export function ActivityPanel({
116
109
  key={p.proposal_id}
117
110
  type="button"
118
111
  onClick={() => {
119
- if (p.skill_name && onSelectProposal) onSelectProposal(p.skill_name, p.proposal_id)
112
+ if (p.skill_name && onSelectProposal)
113
+ onSelectProposal(p.skill_name, p.proposal_id);
120
114
  }}
121
115
  disabled={!p.skill_name || !onSelectProposal}
122
116
  className="flex w-full gap-3 rounded-md p-1.5 text-left transition-colors enabled:hover:bg-accent/40 disabled:cursor-default"
@@ -124,7 +118,10 @@ export function ActivityPanel({
124
118
  <div className="mt-1 size-2 shrink-0 rounded-full bg-amber-400" />
125
119
  <div className="flex-1 min-w-0 space-y-1">
126
120
  <div className="flex items-center gap-2">
127
- <Badge variant={ACTION_VARIANT[p.action] ?? "secondary"} className="text-[10px]">
121
+ <Badge
122
+ variant={ACTION_VARIANT[p.action] ?? "secondary"}
123
+ className="text-[10px]"
124
+ >
128
125
  {p.action}
129
126
  </Badge>
130
127
  <span className="text-xs text-muted-foreground font-mono">
@@ -149,20 +146,29 @@ export function ActivityPanel({
149
146
  key={`${entry.proposal_id}-${i}`}
150
147
  type="button"
151
148
  onClick={() => {
152
- if (entry.skill_name && onSelectProposal) onSelectProposal(entry.skill_name, entry.proposal_id)
149
+ if (entry.skill_name && onSelectProposal)
150
+ onSelectProposal(entry.skill_name, entry.proposal_id);
153
151
  }}
154
152
  disabled={!entry.skill_name || !onSelectProposal}
155
153
  className="flex w-full gap-3 rounded-md p-1.5 text-left transition-colors enabled:hover:bg-accent/40 disabled:cursor-default"
156
154
  >
157
- <div className={`mt-1 size-2 shrink-0 rounded-full ${
158
- entry.action === "deployed" ? "bg-emerald-500"
159
- : entry.action === "rejected" || entry.action === "rolled_back" ? "bg-red-500"
160
- : entry.action === "validated" ? "bg-amber-400"
161
- : "bg-primary-accent"
162
- }`} />
155
+ <div
156
+ className={`mt-1 size-2 shrink-0 rounded-full ${
157
+ entry.action === "deployed"
158
+ ? "bg-emerald-500"
159
+ : entry.action === "rejected" || entry.action === "rolled_back"
160
+ ? "bg-red-500"
161
+ : entry.action === "validated"
162
+ ? "bg-amber-400"
163
+ : "bg-primary-accent"
164
+ }`}
165
+ />
163
166
  <div className="flex-1 min-w-0 space-y-1">
164
167
  <div className="flex items-center gap-2">
165
- <Badge variant={ACTION_VARIANT[entry.action] ?? "secondary"} className="text-[10px]">
168
+ <Badge
169
+ variant={ACTION_VARIANT[entry.action] ?? "secondary"}
170
+ className="text-[10px]"
171
+ >
166
172
  {entry.action}
167
173
  </Badge>
168
174
  <span className="text-xs text-muted-foreground font-mono">
@@ -171,7 +177,8 @@ export function ActivityPanel({
171
177
  </div>
172
178
  <p className="text-xs text-muted-foreground line-clamp-2">{entry.details}</p>
173
179
  <span className="text-[10px] text-muted-foreground/60 font-mono">
174
- {entry.skill_name ? `${entry.skill_name} · ` : ""}#{entry.proposal_id.slice(0, 8)}
180
+ {entry.skill_name ? `${entry.skill_name} · ` : ""}#
181
+ {entry.proposal_id.slice(0, 8)}
175
182
  </span>
176
183
  </div>
177
184
  </button>
@@ -199,5 +206,5 @@ export function ActivityPanel({
199
206
  </Tabs>
200
207
  </CardContent>
201
208
  </Card>
202
- )
209
+ );
203
210
  }