hazo_ui 2.16.0 → 3.0.1

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.
@@ -0,0 +1,144 @@
1
+ import React__default from 'react';
2
+
3
+ interface NavItem {
4
+ label: string;
5
+ href: string;
6
+ icon?: React__default.ReactNode;
7
+ }
8
+ /**
9
+ * Two-column layout shell.
10
+ * - Left column: sidebar (fixed height, scrollable internally)
11
+ * - Right column: main content (fills remaining width, scrollable)
12
+ */
13
+ declare function SidebarLayout({ sidebar, children, }: {
14
+ sidebar: React__default.ReactNode;
15
+ children: React__default.ReactNode;
16
+ }): React__default.JSX.Element;
17
+ /**
18
+ * Per-package navigation sidebar.
19
+ * Reads the current pathname from window.location (SSR-safe via state initialisation).
20
+ */
21
+ declare function AppSidebar({ pkg, navItems, }: {
22
+ pkg: string;
23
+ navItems: NavItem[];
24
+ }): React__default.JSX.Element;
25
+
26
+ type RunStatus = "pending" | "running" | "passed" | "failed";
27
+ interface CaseResult {
28
+ name: string;
29
+ scenarioId?: string;
30
+ status: RunStatus;
31
+ durationMs?: number;
32
+ error?: Error;
33
+ expected?: unknown;
34
+ actual?: unknown;
35
+ }
36
+ interface ScenarioResult {
37
+ id: string;
38
+ name: string;
39
+ status: RunStatus;
40
+ cases: CaseResult[];
41
+ }
42
+ interface AutoTestContextValue {
43
+ scenarios: Map<string, ScenarioResult>;
44
+ runScenario(id: string): Promise<void>;
45
+ runAll(): Promise<void>;
46
+ reset(): void;
47
+ }
48
+ declare function AutoTestProvider({ pkg: _pkg, children, }: {
49
+ pkg: string;
50
+ children: React__default.ReactNode;
51
+ }): React__default.JSX.Element;
52
+ declare function useAutoTest(): AutoTestContextValue;
53
+
54
+ declare function AutoTestRunner(): React__default.JSX.Element;
55
+
56
+ declare function CopyAllFailuresButton({ failedCases, }: {
57
+ failedCases: CaseResult[];
58
+ }): React__default.JSX.Element;
59
+
60
+ interface Case {
61
+ name: string;
62
+ run: () => Promise<void>;
63
+ }
64
+ interface Scenario {
65
+ id: string;
66
+ name: string;
67
+ pkg: string;
68
+ filePath?: string;
69
+ cases: Case[];
70
+ }
71
+ /**
72
+ * Register a scenario with the global registry.
73
+ * Call this at module load time in your scenario files.
74
+ */
75
+ declare function registerScenario(id: string, opts: {
76
+ name: string;
77
+ pkg: string;
78
+ cases: Case[];
79
+ }): void;
80
+ /** Return the entire registry (read-only reference). */
81
+ declare function getRegistry(): Map<string, Scenario>;
82
+ /** Clear the registry — used in tests only. */
83
+ declare function clearRegistry(): void;
84
+
85
+ /**
86
+ * Assertion error thrown by all helpers in this module.
87
+ * Carries expected/actual values and the call-site string for prompt generation.
88
+ */
89
+ declare class HazoAssertionError extends Error {
90
+ readonly expected: unknown;
91
+ readonly actual: unknown;
92
+ readonly callSite: string | undefined;
93
+ constructor(message: string, expected: unknown, actual: unknown, callSite: string | undefined);
94
+ }
95
+ /**
96
+ * Assert that actual deep-equals expected.
97
+ * Uses JSON serialisation for a lightweight but useful deep-equality check.
98
+ */
99
+ declare function assertEqual<T>(actual: T, expected: T): void;
100
+ /**
101
+ * Assert that fn throws (optionally an instance of ErrorClass).
102
+ */
103
+ declare function assertThrows(fn: () => unknown, ErrorClass?: new (...a: unknown[]) => Error): void;
104
+ /**
105
+ * Assert that the promise resolves without rejection.
106
+ */
107
+ declare function assertResolves(promise: Promise<unknown>): Promise<void>;
108
+ /**
109
+ * Assert that the promise rejects (optionally with a specific ErrorClass).
110
+ */
111
+ declare function assertRejects(promise: Promise<unknown>, ErrorClass?: new (...a: unknown[]) => Error): Promise<void>;
112
+ /**
113
+ * Assert that str matches pattern.
114
+ */
115
+ declare function assertMatch(str: string, pattern: RegExp): void;
116
+ /**
117
+ * Assert that arr includes value (using JSON equality).
118
+ */
119
+ declare function assertIncludes<T>(arr: T[], value: T): void;
120
+
121
+ interface FailedCase {
122
+ pkg: string;
123
+ scenarioId: string;
124
+ caseName: string;
125
+ correlationId?: string;
126
+ durationMs?: number;
127
+ failedAt: Date;
128
+ error: Error;
129
+ expected?: unknown;
130
+ actual?: unknown;
131
+ scenarioFilePath?: string;
132
+ /** e.g. 'sqlite (in-memory)' or 'postgres' */
133
+ adapter?: string;
134
+ /** Config values to surface in section 7. Secret values are auto-redacted. */
135
+ relevantConfig?: Record<string, string>;
136
+ }
137
+ interface FormatOptions {
138
+ includeRingBuffer?: boolean;
139
+ includeCodeContext?: boolean;
140
+ maxRingBufferEntries?: number;
141
+ }
142
+ declare function formatAsClaudePrompt(fc: FailedCase, opts?: FormatOptions): Promise<string>;
143
+
144
+ export { AppSidebar, type AutoTestContextValue, AutoTestProvider, AutoTestRunner, type Case, type CaseResult, CopyAllFailuresButton, type FailedCase, type FormatOptions, HazoAssertionError, type NavItem, type RunStatus, type Scenario, type ScenarioResult, SidebarLayout, assertEqual, assertIncludes, assertMatch, assertRejects, assertResolves, assertThrows, clearRegistry, formatAsClaudePrompt, getRegistry, registerScenario, useAutoTest };
@@ -0,0 +1,144 @@
1
+ import React__default from 'react';
2
+
3
+ interface NavItem {
4
+ label: string;
5
+ href: string;
6
+ icon?: React__default.ReactNode;
7
+ }
8
+ /**
9
+ * Two-column layout shell.
10
+ * - Left column: sidebar (fixed height, scrollable internally)
11
+ * - Right column: main content (fills remaining width, scrollable)
12
+ */
13
+ declare function SidebarLayout({ sidebar, children, }: {
14
+ sidebar: React__default.ReactNode;
15
+ children: React__default.ReactNode;
16
+ }): React__default.JSX.Element;
17
+ /**
18
+ * Per-package navigation sidebar.
19
+ * Reads the current pathname from window.location (SSR-safe via state initialisation).
20
+ */
21
+ declare function AppSidebar({ pkg, navItems, }: {
22
+ pkg: string;
23
+ navItems: NavItem[];
24
+ }): React__default.JSX.Element;
25
+
26
+ type RunStatus = "pending" | "running" | "passed" | "failed";
27
+ interface CaseResult {
28
+ name: string;
29
+ scenarioId?: string;
30
+ status: RunStatus;
31
+ durationMs?: number;
32
+ error?: Error;
33
+ expected?: unknown;
34
+ actual?: unknown;
35
+ }
36
+ interface ScenarioResult {
37
+ id: string;
38
+ name: string;
39
+ status: RunStatus;
40
+ cases: CaseResult[];
41
+ }
42
+ interface AutoTestContextValue {
43
+ scenarios: Map<string, ScenarioResult>;
44
+ runScenario(id: string): Promise<void>;
45
+ runAll(): Promise<void>;
46
+ reset(): void;
47
+ }
48
+ declare function AutoTestProvider({ pkg: _pkg, children, }: {
49
+ pkg: string;
50
+ children: React__default.ReactNode;
51
+ }): React__default.JSX.Element;
52
+ declare function useAutoTest(): AutoTestContextValue;
53
+
54
+ declare function AutoTestRunner(): React__default.JSX.Element;
55
+
56
+ declare function CopyAllFailuresButton({ failedCases, }: {
57
+ failedCases: CaseResult[];
58
+ }): React__default.JSX.Element;
59
+
60
+ interface Case {
61
+ name: string;
62
+ run: () => Promise<void>;
63
+ }
64
+ interface Scenario {
65
+ id: string;
66
+ name: string;
67
+ pkg: string;
68
+ filePath?: string;
69
+ cases: Case[];
70
+ }
71
+ /**
72
+ * Register a scenario with the global registry.
73
+ * Call this at module load time in your scenario files.
74
+ */
75
+ declare function registerScenario(id: string, opts: {
76
+ name: string;
77
+ pkg: string;
78
+ cases: Case[];
79
+ }): void;
80
+ /** Return the entire registry (read-only reference). */
81
+ declare function getRegistry(): Map<string, Scenario>;
82
+ /** Clear the registry — used in tests only. */
83
+ declare function clearRegistry(): void;
84
+
85
+ /**
86
+ * Assertion error thrown by all helpers in this module.
87
+ * Carries expected/actual values and the call-site string for prompt generation.
88
+ */
89
+ declare class HazoAssertionError extends Error {
90
+ readonly expected: unknown;
91
+ readonly actual: unknown;
92
+ readonly callSite: string | undefined;
93
+ constructor(message: string, expected: unknown, actual: unknown, callSite: string | undefined);
94
+ }
95
+ /**
96
+ * Assert that actual deep-equals expected.
97
+ * Uses JSON serialisation for a lightweight but useful deep-equality check.
98
+ */
99
+ declare function assertEqual<T>(actual: T, expected: T): void;
100
+ /**
101
+ * Assert that fn throws (optionally an instance of ErrorClass).
102
+ */
103
+ declare function assertThrows(fn: () => unknown, ErrorClass?: new (...a: unknown[]) => Error): void;
104
+ /**
105
+ * Assert that the promise resolves without rejection.
106
+ */
107
+ declare function assertResolves(promise: Promise<unknown>): Promise<void>;
108
+ /**
109
+ * Assert that the promise rejects (optionally with a specific ErrorClass).
110
+ */
111
+ declare function assertRejects(promise: Promise<unknown>, ErrorClass?: new (...a: unknown[]) => Error): Promise<void>;
112
+ /**
113
+ * Assert that str matches pattern.
114
+ */
115
+ declare function assertMatch(str: string, pattern: RegExp): void;
116
+ /**
117
+ * Assert that arr includes value (using JSON equality).
118
+ */
119
+ declare function assertIncludes<T>(arr: T[], value: T): void;
120
+
121
+ interface FailedCase {
122
+ pkg: string;
123
+ scenarioId: string;
124
+ caseName: string;
125
+ correlationId?: string;
126
+ durationMs?: number;
127
+ failedAt: Date;
128
+ error: Error;
129
+ expected?: unknown;
130
+ actual?: unknown;
131
+ scenarioFilePath?: string;
132
+ /** e.g. 'sqlite (in-memory)' or 'postgres' */
133
+ adapter?: string;
134
+ /** Config values to surface in section 7. Secret values are auto-redacted. */
135
+ relevantConfig?: Record<string, string>;
136
+ }
137
+ interface FormatOptions {
138
+ includeRingBuffer?: boolean;
139
+ includeCodeContext?: boolean;
140
+ maxRingBufferEntries?: number;
141
+ }
142
+ declare function formatAsClaudePrompt(fc: FailedCase, opts?: FormatOptions): Promise<string>;
143
+
144
+ export { AppSidebar, type AutoTestContextValue, AutoTestProvider, AutoTestRunner, type Case, type CaseResult, CopyAllFailuresButton, type FailedCase, type FormatOptions, HazoAssertionError, type NavItem, type RunStatus, type Scenario, type ScenarioResult, SidebarLayout, assertEqual, assertIncludes, assertMatch, assertRejects, assertResolves, assertThrows, clearRegistry, formatAsClaudePrompt, getRegistry, registerScenario, useAutoTest };