Skip to content

Commit 30516d4

Browse files
feat(app, api, framework-editor): restructure compliance app and add framework editor CLI
* feat(app, api, framework-editor): restructure compliance app and add framework editor CLI Restructure the main compliance app to introduce a dedicated /overview landing page and a proper /frameworks table view with drill-down into requirements, controls, and their linked artifacts. App restructure: - Move dashboard (charts, todos, findings) from /frameworks to /overview - Create frameworks table page at /frameworks with compliance %, status - Add control detail as sub-page under /frameworks/:id/controls/:id - Add status and compliance columns to requirements and controls tables - Enhance control satisfaction logic with document freshness (6-month) - Redirect /controls to /frameworks, remove from sidebar - Remove Advanced Mode toggle from settings - Migrate sub-pages from PageWithBreadcrumb to PageLayout + DS Breadcrumb - Migrate tabs to DS Tabs variant="underline" pattern - Move shared types/hooks to @/ paths, eliminate deep relative imports API: - Update frameworks service to include controlDocumentTypes per control - Fetch evidenceSubmissions for document freshness checks - Add framework import/export endpoints and DTOs Framework editor CLI (new package): - Add CLI tool for managing frameworks, controls, requirements, policies, tasks - Device auth flow, session management, config persistence - Commands: framework, control, requirement, policy, task, control-relations - Migration scripts: import-prescient, rebuild-controls, replace-policies, replace-tasks, link-policies-tasks - API client with error handling and formatted output Framework editor app: - Add ImportFrameworkDialog for bulk framework import - Update DataTable, frameworks and requirements pages * fix(FrameworkDeleteDialog, FrameworkRequirements): update button type and add evidenceSubmissions dependency - Changed button type to 'button' in FrameworkDeleteDialog to prevent form submission on cancel. - Added evidenceSubmissions to dependency array in FrameworkRequirements to ensure proper reactivity. * fix: update redirects from frameworks to overview across admin layout and components - Changed redirect paths from '/frameworks' to '/overview' in AdminLayout, ImpersonationBanner, MembersTab, and ControlsPage. - Updated tests to reflect the new redirect behavior. * fix(frameworks-upsert): update content handling in upsertOrgFrameworkStructure - Changed content assignment to ensure it is always an array, using { set: Array.isArray(pt.content) ? pt.content : [pt.content] } for proper Prisma input handling. * fix(frameworks-controls): enhance breadcrumb navigation with requirement links - Updated breadcrumb items to include links to associated requirements when available, improving navigation within the framework control page. * refactor(requirements): remove RequirementControlsTableColumns component and optimize control status retrieval - Deleted the RequirementControlsTableColumns component to streamline the codebase. - Updated getControlStatus function to improve performance by sorting evidence submissions before processing. * chore: remove deprecated scripts and CSV file related to Prescient framework - Deleted prescient.csv and associated import, link, rebuild, replace policies, replace tasks, and test prompt scripts to clean up the codebase and remove unused functionality. - This change streamlines the framework editor CLI by eliminating obsolete components. * chore: remove deprecated scripts and CSV file related to Prescient framework - Deleted prescient.csv and associated import, link, rebuild, replace policies, replace tasks, and test prompt scripts to clean up the codebase and remove unused functionality. - This change streamlines the framework editor CLI by eliminating obsolete components. --------- Co-authored-by: Lewis Carhart <lewis@trycomp.ai>
1 parent ffb260b commit 30516d4

87 files changed

Lines changed: 4250 additions & 935 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2+
import { Type } from 'class-transformer';
3+
import {
4+
IsString,
5+
IsNotEmpty,
6+
IsBoolean,
7+
IsOptional,
8+
IsArray,
9+
IsInt,
10+
IsObject,
11+
IsEnum,
12+
MaxLength,
13+
ValidateNested,
14+
ArrayMaxSize,
15+
Min,
16+
} from 'class-validator';
17+
import {
18+
EvidenceFormType,
19+
Frequency,
20+
Departments,
21+
TaskAutomationStatus,
22+
} from '@trycompai/db';
23+
import { MaxJsonSize } from '../../validators/max-json-size.validator';
24+
25+
class ImportFrameworkMetaDto {
26+
@ApiProperty()
27+
@IsString()
28+
@IsNotEmpty()
29+
@MaxLength(255)
30+
name: string;
31+
32+
@ApiProperty()
33+
@IsString()
34+
@IsNotEmpty()
35+
@MaxLength(50)
36+
version: string;
37+
38+
@ApiProperty()
39+
@IsString()
40+
@IsNotEmpty()
41+
@MaxLength(2000)
42+
description: string;
43+
44+
@ApiPropertyOptional()
45+
@IsBoolean()
46+
@IsOptional()
47+
visible?: boolean;
48+
}
49+
50+
class ImportRequirementDto {
51+
@ApiProperty()
52+
@IsString()
53+
@IsNotEmpty()
54+
@MaxLength(255)
55+
name: string;
56+
57+
@ApiPropertyOptional()
58+
@IsString()
59+
@IsOptional()
60+
@MaxLength(255)
61+
identifier?: string;
62+
63+
@ApiProperty()
64+
@IsString()
65+
@IsNotEmpty()
66+
@MaxLength(5000)
67+
description: string;
68+
}
69+
70+
class ImportControlTemplateDto {
71+
@ApiProperty()
72+
@IsString()
73+
@IsNotEmpty()
74+
@MaxLength(255)
75+
name: string;
76+
77+
@ApiProperty()
78+
@IsString()
79+
@IsNotEmpty()
80+
@MaxLength(5000)
81+
description: string;
82+
83+
@ApiPropertyOptional()
84+
@IsArray()
85+
@ArrayMaxSize(50)
86+
@IsEnum(EvidenceFormType, { each: true })
87+
@IsOptional()
88+
documentTypes?: EvidenceFormType[];
89+
90+
@ApiPropertyOptional()
91+
@IsArray()
92+
@ArrayMaxSize(500)
93+
@IsInt({ each: true })
94+
@Min(0, { each: true })
95+
@IsOptional()
96+
requirementIndices?: number[];
97+
98+
@ApiPropertyOptional()
99+
@IsArray()
100+
@ArrayMaxSize(500)
101+
@IsInt({ each: true })
102+
@Min(0, { each: true })
103+
@IsOptional()
104+
policyTemplateIndices?: number[];
105+
106+
@ApiPropertyOptional()
107+
@IsArray()
108+
@ArrayMaxSize(500)
109+
@IsInt({ each: true })
110+
@Min(0, { each: true })
111+
@IsOptional()
112+
taskTemplateIndices?: number[];
113+
}
114+
115+
class ImportPolicyTemplateDto {
116+
@ApiProperty()
117+
@IsString()
118+
@IsNotEmpty()
119+
@MaxLength(255)
120+
name: string;
121+
122+
@ApiProperty()
123+
@IsString()
124+
@IsNotEmpty()
125+
@MaxLength(5000)
126+
description: string;
127+
128+
@ApiProperty()
129+
@IsEnum(Frequency)
130+
frequency: Frequency;
131+
132+
@ApiProperty()
133+
@IsEnum(Departments)
134+
department: Departments;
135+
136+
@ApiPropertyOptional()
137+
@IsObject()
138+
@IsOptional()
139+
@MaxJsonSize()
140+
content?: Record<string, unknown>;
141+
}
142+
143+
class ImportTaskTemplateDto {
144+
@ApiProperty()
145+
@IsString()
146+
@IsNotEmpty()
147+
@MaxLength(255)
148+
name: string;
149+
150+
@ApiProperty()
151+
@IsString()
152+
@IsNotEmpty()
153+
@MaxLength(5000)
154+
description: string;
155+
156+
@ApiProperty()
157+
@IsEnum(Frequency)
158+
frequency: Frequency;
159+
160+
@ApiProperty()
161+
@IsEnum(Departments)
162+
department: Departments;
163+
164+
@ApiPropertyOptional()
165+
@IsEnum(TaskAutomationStatus)
166+
@IsOptional()
167+
automationStatus?: TaskAutomationStatus;
168+
}
169+
170+
export class ImportFrameworkDto {
171+
@ApiProperty({ example: '1' })
172+
@IsString()
173+
@IsNotEmpty()
174+
@MaxLength(10)
175+
version: string;
176+
177+
@ApiPropertyOptional()
178+
@IsString()
179+
@IsOptional()
180+
@MaxLength(50)
181+
exportedAt?: string;
182+
183+
@ApiProperty()
184+
@ValidateNested()
185+
@Type(() => ImportFrameworkMetaDto)
186+
framework: ImportFrameworkMetaDto;
187+
188+
@ApiPropertyOptional()
189+
@IsArray()
190+
@ArrayMaxSize(1000)
191+
@ValidateNested({ each: true })
192+
@Type(() => ImportRequirementDto)
193+
@IsOptional()
194+
requirements?: ImportRequirementDto[];
195+
196+
@ApiPropertyOptional()
197+
@IsArray()
198+
@ArrayMaxSize(1000)
199+
@ValidateNested({ each: true })
200+
@Type(() => ImportControlTemplateDto)
201+
@IsOptional()
202+
controlTemplates?: ImportControlTemplateDto[];
203+
204+
@ApiPropertyOptional()
205+
@IsArray()
206+
@ArrayMaxSize(500)
207+
@ValidateNested({ each: true })
208+
@Type(() => ImportPolicyTemplateDto)
209+
@IsOptional()
210+
policyTemplates?: ImportPolicyTemplateDto[];
211+
212+
@ApiPropertyOptional()
213+
@IsArray()
214+
@ArrayMaxSize(500)
215+
@ValidateNested({ each: true })
216+
@Type(() => ImportTaskTemplateDto)
217+
@IsOptional()
218+
taskTemplates?: ImportTaskTemplateDto[];
219+
}

0 commit comments

Comments
 (0)