Skip to content

Commit ac4d8e1

Browse files
Copilotpethers
andauthored
Fix incorrect file and directory references in custom agent configurations (#542)
* Initial plan * Fix agent configuration file path and directory references Co-authored-by: pethers <1726836+pethers@users.noreply.github.com> * Fix TypeScript type errors in test mocks Co-authored-by: pethers <1726836+pethers@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
1 parent e097edd commit ac4d8e1

4 files changed

Lines changed: 15 additions & 12 deletions

File tree

.github/agents/code-review-agent.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ instructions: |
3030
- Require justification for any new utility/type/component creation
3131
3232
Key reusable locations to check:
33-
- **Types:** `src/types/cia.ts`, `src/types/businessImpact.ts`, `src/types/widgets.ts`, `src/types/compliance.ts`
33+
- **Types:** `src/types/cia.ts`, `src/types/businessImpact.ts`, `src/types/widgets.ts`, `src/types/compliance.ts`, `src/types/componentPropExports.ts`, `src/types/widget-props.ts`
3434
- **Constants:** `src/constants/securityLevels.ts`, `src/constants/businessConstants.ts`, `src/constants/appConstants.ts`, `src/constants/uiConstants.ts`
3535
- **Utilities:** `src/utils/securityLevelUtils.ts`, `src/utils/riskUtils.ts`, `src/utils/formatUtils.ts`, `src/utils/typeGuards.ts`
3636
- **Services:** `src/services/ciaContentService.ts`, `src/services/businessImpactService.ts`, `src/services/complianceService.ts`
37-
- **Components:** `src/components/UI/*`, `src/components/common/*`
37+
- **Components:** `src/components/common/*`, `src/components/charts/*`, `src/components/widgets/*`
3838
3939
### 3. Security
4040
- Identify potential security vulnerabilities

.github/agents/typescript-react-agent.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ instructions: |
2121
### Reusability (MANDATORY)
2222
Before creating ANY new types, components, or utilities, you MUST:
2323
1. Check existing reusable items in:
24-
- **Types:** `src/types/cia.ts`, `src/types/businessImpact.ts`, `src/types/widgets.ts`, `src/types/compliance.ts`, `src/types/componentProps.ts`, `src/types/widget-props.ts`
24+
- **Types:** `src/types/cia.ts`, `src/types/businessImpact.ts`, `src/types/widgets.ts`, `src/types/compliance.ts`, `src/types/componentPropExports.ts`, `src/types/widget-props.ts`
2525
- **Constants:** `src/constants/securityLevels.ts`, `src/constants/businessConstants.ts`, `src/constants/appConstants.ts`, `src/constants/uiConstants.ts`, `src/constants/testIds.ts`
2626
- **Utilities:** `src/utils/securityLevelUtils.ts`, `src/utils/riskUtils.ts`, `src/utils/formatUtils.ts`, `src/utils/typeGuards.ts`, `src/utils/colorUtils.ts`
27-
- **Components:** `src/components/UI/*`, `src/components/common/*`, `src/components/charts/RadarChart.tsx`
27+
- **Components:** `src/components/common/*`, `src/components/charts/*`, `src/components/widgets/*`
2828
2. Extend existing types/components rather than creating new ones
2929
3. If you must create something new, justify why existing code couldn't be reused
3030
@@ -33,7 +33,7 @@ instructions: |
3333
- Implement proper prop types using interfaces
3434
- Use React hooks appropriately (useState, useEffect, useMemo, useCallback)
3535
- Follow the existing component structure in `src/components/`
36-
- Reuse common UI components from `src/components/UI/` and `src/components/common/`
36+
- Reuse common components from `src/components/common/`, charts from `src/components/charts/`, and widgets from `src/components/widgets/`
3737
3838
### Code Quality
3939
- Write self-documenting code with clear variable and function names
-224 KB
Binary file not shown.

src/tests/testMocks/ciaOptionsMocks.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
// Use vi.hoisted to create mocks that can be used at the top level
2-
import { vi } from "vitest";
2+
import { vi, Mock } from "vitest";
33
import { SecurityLevel } from "../../types/cia";
44

55
// Define types for Chart.js mock
66
interface ChartMock {
7-
destroy: ReturnType<typeof vi.fn>;
8-
update: ReturnType<typeof vi.fn>;
9-
resize: ReturnType<typeof vi.fn>;
7+
destroy: Mock;
8+
update: Mock;
9+
resize: Mock;
1010
data: { datasets: any[] };
1111
}
1212

13-
interface ChartConstructor extends ReturnType<typeof vi.fn> {
14-
register: ReturnType<typeof vi.fn>;
13+
// ChartConstructor is a callable function that returns ChartMock
14+
// with additional properties
15+
type ChartConstructor = {
16+
(): ChartMock;
17+
register: Mock;
1518
defaults: {
1619
font: { family: string };
1720
plugins: { legend: { display: boolean } };
@@ -29,7 +32,7 @@ const mockChartInstance = vi.hoisted(
2932
);
3033

3134
const mockChartConstructor = vi.hoisted((): ChartConstructor => {
32-
const constructor = vi.fn(() => mockChartInstance) as ChartConstructor;
35+
const constructor = vi.fn(() => mockChartInstance) as unknown as ChartConstructor;
3336
constructor.register = vi.fn();
3437
constructor.defaults = {
3538
font: { family: "Arial" },

0 commit comments

Comments
 (0)