feat(skills): add dryRun flag for scan prune path

Add a `dryRun` option to the scan-projects endpoint. When true, the
scan identifies which skills would be pruned and which agents would be
affected, but does not delete anything or modify agent configs.

The response now includes:
- `pruned[]`: list of skills that would be (or were) removed, with
  affected agent names
- `dryRun`: boolean echoed back so callers can distinguish preview
  results from live mutations

This lets callers preview destructive prune operations before committing
to them, addressing the review concern about silent deletion of
production data.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-13 00:31:37 +00:00
parent 3610559cc7
commit e739a2d130
8 changed files with 92 additions and 1 deletions
+2
View File
@@ -176,6 +176,7 @@ export type {
CompanySkillProjectScanRequest,
CompanySkillProjectScanSkipped,
CompanySkillProjectScanConflict,
CompanySkillProjectScanPruned,
CompanySkillProjectScanResult,
CompanySkillCreateRequest,
CompanySkillFileDetail,
@@ -561,6 +562,7 @@ export {
companySkillProjectScanRequestSchema,
companySkillProjectScanSkippedSchema,
companySkillProjectScanConflictSchema,
companySkillProjectScanPrunedSchema,
companySkillProjectScanResultSchema,
companySkillCreateSchema,
companySkillFileDetailSchema,
@@ -93,6 +93,7 @@ export interface CompanySkillImportResult {
export interface CompanySkillProjectScanRequest {
projectIds?: string[];
workspaceIds?: string[];
dryRun?: boolean;
}
export interface CompanySkillProjectScanSkipped {
@@ -118,6 +119,14 @@ export interface CompanySkillProjectScanConflict {
reason: string;
}
export interface CompanySkillProjectScanPruned {
skillId: string;
slug: string;
key: string;
sourceLocator: string | null;
affectedAgents: string[];
}
export interface CompanySkillProjectScanResult {
scannedProjects: number;
scannedWorkspaces: number;
@@ -126,7 +135,9 @@ export interface CompanySkillProjectScanResult {
updated: CompanySkill[];
skipped: CompanySkillProjectScanSkipped[];
conflicts: CompanySkillProjectScanConflict[];
pruned: CompanySkillProjectScanPruned[];
warnings: string[];
dryRun: boolean;
}
export interface CompanySkillCreateRequest {
+1
View File
@@ -28,6 +28,7 @@ export type {
CompanySkillProjectScanRequest,
CompanySkillProjectScanSkipped,
CompanySkillProjectScanConflict,
CompanySkillProjectScanPruned,
CompanySkillProjectScanResult,
CompanySkillCreateRequest,
CompanySkillFileDetail,
@@ -76,6 +76,7 @@ export const companySkillUpdateAuthSchema = z.object({
export const companySkillProjectScanRequestSchema = z.object({
projectIds: z.array(z.string().uuid()).optional(),
workspaceIds: z.array(z.string().uuid()).optional(),
dryRun: z.boolean().optional(),
});
export const companySkillProjectScanSkippedSchema = z.object({
@@ -101,6 +102,14 @@ export const companySkillProjectScanConflictSchema = z.object({
reason: z.string().min(1),
});
export const companySkillProjectScanPrunedSchema = z.object({
skillId: z.string().uuid(),
slug: z.string().min(1),
key: z.string().min(1),
sourceLocator: z.string().nullable(),
affectedAgents: z.array(z.string()),
});
export const companySkillProjectScanResultSchema = z.object({
scannedProjects: z.number().int().nonnegative(),
scannedWorkspaces: z.number().int().nonnegative(),
@@ -109,7 +118,9 @@ export const companySkillProjectScanResultSchema = z.object({
updated: z.array(companySkillSchema),
skipped: z.array(companySkillProjectScanSkippedSchema),
conflicts: z.array(companySkillProjectScanConflictSchema),
pruned: z.array(companySkillProjectScanPrunedSchema),
warnings: z.array(z.string()),
dryRun: z.boolean(),
});
export const companySkillCreateSchema = z.object({
+1
View File
@@ -48,6 +48,7 @@ export {
companySkillProjectScanRequestSchema,
companySkillProjectScanSkippedSchema,
companySkillProjectScanConflictSchema,
companySkillProjectScanPrunedSchema,
companySkillProjectScanResultSchema,
companySkillCreateSchema,
companySkillFileDetailSchema,