claude-dashboard 0.1.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.
Files changed (88) hide show
  1. package/.claude/settings.local.json +10 -0
  2. package/LICENSE +21 -0
  3. package/README.md +99 -0
  4. package/README.zh-TW.md +99 -0
  5. package/bin/cdb.ts +60 -0
  6. package/bun.lock +1612 -0
  7. package/bunfig.toml +4 -0
  8. package/components.json +20 -0
  9. package/next.config.ts +19 -0
  10. package/package.json +62 -0
  11. package/postcss.config.mjs +9 -0
  12. package/prompts/pm-system.md +61 -0
  13. package/prompts/rd-system.md +68 -0
  14. package/prompts/sec-system.md +93 -0
  15. package/prompts/test-system.md +71 -0
  16. package/prompts/ui-system.md +72 -0
  17. package/server.ts +118 -0
  18. package/sql.js.d.ts +33 -0
  19. package/src/__tests__/api/usage/route.test.ts +193 -0
  20. package/src/__tests__/components/layout/TopNav.test.tsx +155 -0
  21. package/src/__tests__/components/layout/UsageIndicator.test.tsx +503 -0
  22. package/src/__tests__/hooks/useUsage.test.tsx +174 -0
  23. package/src/__tests__/lib/usage/get-token.test.ts +117 -0
  24. package/src/__tests__/react-sanity.test.tsx +14 -0
  25. package/src/__tests__/sanity.test.ts +7 -0
  26. package/src/__tests__/setup.ts +1 -0
  27. package/src/app/api/health/route.ts +8 -0
  28. package/src/app/api/usage/route.ts +86 -0
  29. package/src/app/api/workflows/[id]/route.ts +17 -0
  30. package/src/app/api/workflows/route.ts +14 -0
  31. package/src/app/globals.css +74 -0
  32. package/src/app/history/page.tsx +15 -0
  33. package/src/app/layout.tsx +24 -0
  34. package/src/app/page.tsx +112 -0
  35. package/src/components/agent/AgentCard.tsx +117 -0
  36. package/src/components/agent/AgentCardGrid.tsx +14 -0
  37. package/src/components/agent/AgentOutput.tsx +87 -0
  38. package/src/components/agent/AgentStatusBadge.tsx +20 -0
  39. package/src/components/events/EventLog.tsx +65 -0
  40. package/src/components/events/EventLogItem.tsx +39 -0
  41. package/src/components/history/HistoryTable.tsx +105 -0
  42. package/src/components/layout/DashboardShell.tsx +12 -0
  43. package/src/components/layout/TopNav.tsx +86 -0
  44. package/src/components/layout/UsageIndicator.tsx +163 -0
  45. package/src/components/pipeline/PipelineBar.tsx +59 -0
  46. package/src/components/pipeline/PipelineNode.tsx +55 -0
  47. package/src/components/terminal/TerminalPanel.tsx +138 -0
  48. package/src/components/terminal/XTermRenderer.tsx +129 -0
  49. package/src/components/ui/badge.tsx +37 -0
  50. package/src/components/ui/button.tsx +55 -0
  51. package/src/components/ui/card.tsx +80 -0
  52. package/src/components/ui/input.tsx +26 -0
  53. package/src/components/ui/scroll-area.tsx +52 -0
  54. package/src/components/ui/separator.tsx +31 -0
  55. package/src/components/ui/textarea.tsx +25 -0
  56. package/src/components/ui/tooltip.tsx +73 -0
  57. package/src/components/workflow/WorkflowLauncher.tsx +102 -0
  58. package/src/hooks/useAgentStream.ts +27 -0
  59. package/src/hooks/useAutoScroll.ts +24 -0
  60. package/src/hooks/useUsage.ts +66 -0
  61. package/src/hooks/useWebSocket.ts +289 -0
  62. package/src/lib/agents/prompts.ts +341 -0
  63. package/src/lib/db/connection.ts +263 -0
  64. package/src/lib/db/queries.ts +257 -0
  65. package/src/lib/db/schema.ts +39 -0
  66. package/src/lib/output-buffer.ts +41 -0
  67. package/src/lib/terminal/pty-manager.ts +106 -0
  68. package/src/lib/usage/get-token.ts +48 -0
  69. package/src/lib/utils.ts +6 -0
  70. package/src/lib/websocket/connection-manager.ts +71 -0
  71. package/src/lib/websocket/protocol.ts +90 -0
  72. package/src/lib/websocket/server.ts +231 -0
  73. package/src/lib/workflow/agent-runner.ts +254 -0
  74. package/src/lib/workflow/context-builder.ts +62 -0
  75. package/src/lib/workflow/engine.ts +310 -0
  76. package/src/lib/workflow/pipeline.ts +28 -0
  77. package/src/lib/workflow/types.ts +111 -0
  78. package/src/stores/agentStore.ts +152 -0
  79. package/src/stores/eventStore.ts +35 -0
  80. package/src/stores/terminalStore.ts +20 -0
  81. package/src/stores/uiStore.ts +35 -0
  82. package/src/stores/workflowStore.ts +57 -0
  83. package/src/types/css.d.ts +4 -0
  84. package/src/types/index.ts +12 -0
  85. package/tailwind.config.ts +65 -0
  86. package/tsconfig.json +25 -0
  87. package/tsconfig.server.json +21 -0
  88. package/vitest.config.ts +25 -0
@@ -0,0 +1,57 @@
1
+ "use client";
2
+
3
+ import { create } from "zustand";
4
+ import type { WorkflowStatus } from "@/lib/workflow/types";
5
+
6
+ export interface WorkflowState {
7
+ workflowId: string | null;
8
+ status: WorkflowStatus;
9
+ title: string;
10
+ currentStageIndex: number;
11
+ startedAt: number | null;
12
+ completedAt: number | null;
13
+
14
+ setWorkflow: (id: string, title: string) => void;
15
+ setStatus: (status: WorkflowStatus) => void;
16
+ setCurrentStage: (index: number) => void;
17
+ setCompleted: () => void;
18
+ reset: () => void;
19
+ }
20
+
21
+ export const useWorkflowStore = create<WorkflowState>((set) => ({
22
+ workflowId: null,
23
+ status: "pending",
24
+ title: "",
25
+ currentStageIndex: 0,
26
+ startedAt: null,
27
+ completedAt: null,
28
+
29
+ setWorkflow: (id, title) =>
30
+ set({
31
+ workflowId: id,
32
+ title,
33
+ status: "running",
34
+ startedAt: Date.now(),
35
+ completedAt: null,
36
+ currentStageIndex: 0,
37
+ }),
38
+
39
+ setStatus: (status) => {
40
+ const isTerminal = status === "completed" || status === "failed" || status === "cancelled";
41
+ set(isTerminal ? { status, completedAt: Date.now() } : { status });
42
+ },
43
+
44
+ setCurrentStage: (index) => set({ currentStageIndex: index }),
45
+
46
+ setCompleted: () => set({ status: "completed", completedAt: Date.now() }),
47
+
48
+ reset: () =>
49
+ set({
50
+ workflowId: null,
51
+ status: "pending",
52
+ title: "",
53
+ currentStageIndex: 0,
54
+ startedAt: null,
55
+ completedAt: null,
56
+ }),
57
+ }));
@@ -0,0 +1,4 @@
1
+ declare module '*.css' {
2
+ const content: Record<string, string>;
3
+ export default content;
4
+ }
@@ -0,0 +1,12 @@
1
+ export * from '@/lib/workflow/types';
2
+ export * from '@/lib/websocket/protocol';
3
+
4
+ import type { AgentRole } from '@/lib/workflow/types';
5
+
6
+ export interface EventLogItem {
7
+ id: string;
8
+ timestamp: string;
9
+ type: 'info' | 'warning' | 'error' | 'success';
10
+ role?: AgentRole;
11
+ message: string;
12
+ }
@@ -0,0 +1,65 @@
1
+ import type { Config } from "tailwindcss";
2
+
3
+ const config: Config = {
4
+ darkMode: "class",
5
+ content: [
6
+ "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
7
+ "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
8
+ "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
9
+ ],
10
+ theme: {
11
+ extend: {
12
+ colors: {
13
+ background: "hsl(var(--background))",
14
+ foreground: "hsl(var(--foreground))",
15
+ card: {
16
+ DEFAULT: "hsl(var(--card))",
17
+ foreground: "hsl(var(--card-foreground))",
18
+ },
19
+ popover: {
20
+ DEFAULT: "hsl(var(--popover))",
21
+ foreground: "hsl(var(--popover-foreground))",
22
+ },
23
+ primary: {
24
+ DEFAULT: "hsl(var(--primary))",
25
+ foreground: "hsl(var(--primary-foreground))",
26
+ },
27
+ secondary: {
28
+ DEFAULT: "hsl(var(--secondary))",
29
+ foreground: "hsl(var(--secondary-foreground))",
30
+ },
31
+ muted: {
32
+ DEFAULT: "hsl(var(--muted))",
33
+ foreground: "hsl(var(--muted-foreground))",
34
+ },
35
+ accent: {
36
+ DEFAULT: "hsl(var(--accent))",
37
+ foreground: "hsl(var(--accent-foreground))",
38
+ },
39
+ destructive: {
40
+ DEFAULT: "hsl(var(--destructive))",
41
+ foreground: "hsl(var(--destructive-foreground))",
42
+ },
43
+ border: "hsl(var(--border))",
44
+ input: "hsl(var(--input))",
45
+ ring: "hsl(var(--ring))",
46
+ // Agent colors
47
+ agent: {
48
+ pm: "#A855F7",
49
+ rd: "#3B82F6",
50
+ ui: "#22C55E",
51
+ test: "#F97316",
52
+ sec: "#EF4444",
53
+ },
54
+ },
55
+ borderRadius: {
56
+ lg: "var(--radius)",
57
+ md: "calc(var(--radius) - 2px)",
58
+ sm: "calc(var(--radius) - 4px)",
59
+ },
60
+ },
61
+ },
62
+ plugins: [require("@tailwindcss/typography")],
63
+ };
64
+
65
+ export default config;
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2017",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "noEmit": true,
9
+ "esModuleInterop": true,
10
+ "module": "esnext",
11
+ "moduleResolution": "bundler",
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "jsx": "preserve",
15
+ "incremental": true,
16
+ "plugins": [
17
+ { "name": "next" }
18
+ ],
19
+ "paths": {
20
+ "@/*": ["./src/*"]
21
+ }
22
+ },
23
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
24
+ "exclude": ["node_modules", "dist"]
25
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2017",
4
+ "module": "nodenext",
5
+ "moduleResolution": "nodenext",
6
+ "rewriteRelativeImportExtensions": true,
7
+ "lib": ["esnext"],
8
+ "outDir": "./dist",
9
+ "rootDir": ".",
10
+ "strict": true,
11
+ "esModuleInterop": true,
12
+ "skipLibCheck": true,
13
+ "resolveJsonModule": true,
14
+ "declaration": false,
15
+ "paths": {
16
+ "@/*": ["./src/*"]
17
+ }
18
+ },
19
+ "include": ["server.ts", "bin/**/*.ts", "src/lib/**/*.ts"],
20
+ "exclude": ["node_modules", ".next"]
21
+ }
@@ -0,0 +1,25 @@
1
+ import { defineConfig } from "vitest/config";
2
+ import react from "@vitejs/plugin-react";
3
+ import path from "path";
4
+
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ test: {
8
+ environment: "jsdom",
9
+ globals: true,
10
+ setupFiles: ["./src/__tests__/setup.ts"],
11
+ include: ["src/**/*.test.{ts,tsx}"],
12
+ testTimeout: 10000,
13
+ pool: "forks",
14
+ server: {
15
+ deps: {
16
+ external: ["node-pty", "sql.js"],
17
+ },
18
+ },
19
+ },
20
+ resolve: {
21
+ alias: {
22
+ "@": path.resolve(__dirname, "./src"),
23
+ },
24
+ },
25
+ });