All files / src/cli/setup presets.ts

100% Statements 16/16
100% Branches 0/0
100% Functions 10/10
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286                  3x                                                                                                                                                                                                                                                                                                               3x                                                                                                                                               57x                                                 3x 7x           3x 20x           3x 171x 40x               3x 95x    
/**
 * Preset definitions and tool categories for the setup wizard
 */
 
import { ToolCategory, PresetDefinition } from "./types";
 
/**
 * All available tool categories with their tools
 */
export const TOOL_CATEGORIES: ToolCategory[] = [
  {
    id: "core",
    name: "Core",
    description: "Projects, namespaces, users, events",
    tools: [
      "browse_projects",
      "browse_namespaces",
      "browse_events",
      "browse_users",
      "manage_project",
      "manage_namespace",
    ],
    defaultEnabled: true,
  },
  {
    id: "merge-requests",
    name: "Merge Requests",
    description: "MR browsing, creation, discussions, approvals",
    tools: [
      "browse_merge_requests",
      "manage_merge_request",
      "browse_mr_discussions",
      "manage_mr_discussion",
      "manage_draft_notes",
    ],
    defaultEnabled: true,
  },
  {
    id: "work-items",
    name: "Work Items",
    description: "Issues, epics, tasks, incidents",
    tools: ["browse_work_items", "manage_work_item"],
    defaultEnabled: true,
  },
  {
    id: "pipelines",
    name: "Pipelines & CI/CD",
    description: "Pipeline browsing, job management, triggers",
    tools: ["browse_pipelines", "manage_pipeline", "manage_pipeline_job"],
    defaultEnabled: true,
  },
  {
    id: "files",
    name: "Files & Commits",
    description: "Repository file browsing, commits, and diffs",
    tools: ["browse_files", "manage_files", "browse_commits"],
    defaultEnabled: true,
  },
  {
    id: "refs",
    name: "Branches & Tags",
    description: "Branch/tag browsing and protection rules",
    tools: ["browse_refs", "manage_ref"],
    defaultEnabled: false,
  },
  {
    id: "releases",
    name: "Releases",
    description: "Release management and asset links",
    tools: ["browse_releases", "manage_release"],
    defaultEnabled: false,
  },
  {
    id: "labels",
    name: "Labels",
    description: "Label browsing and management",
    tools: ["browse_labels", "manage_label"],
    defaultEnabled: false,
  },
  {
    id: "milestones",
    name: "Milestones",
    description: "Milestone tracking and burndown charts",
    tools: ["browse_milestones", "manage_milestone"],
    defaultEnabled: false,
  },
  {
    id: "iterations",
    name: "Iterations",
    description: "Sprint/iteration planning (Premium)",
    tools: ["browse_iterations"],
    defaultEnabled: false,
  },
  {
    id: "wiki",
    name: "Wiki",
    description: "Wiki page browsing and editing",
    tools: ["browse_wiki", "manage_wiki"],
    defaultEnabled: false,
  },
  {
    id: "snippets",
    name: "Snippets",
    description: "Code snippet management",
    tools: ["browse_snippets", "manage_snippet"],
    defaultEnabled: false,
  },
  {
    id: "variables",
    name: "CI/CD Variables",
    description: "Pipeline variable management",
    tools: ["browse_variables", "manage_variable"],
    defaultEnabled: false,
  },
  {
    id: "webhooks",
    name: "Webhooks",
    description: "Webhook configuration and testing",
    tools: ["browse_webhooks", "manage_webhook"],
    defaultEnabled: false,
  },
  {
    id: "integrations",
    name: "Integrations",
    description: "Third-party service integrations",
    tools: ["browse_integrations", "manage_integration"],
    defaultEnabled: false,
  },
  {
    id: "members",
    name: "Members",
    description: "Team member management and access levels",
    tools: ["browse_members", "manage_member"],
    defaultEnabled: false,
  },
  {
    id: "todos",
    name: "Todos",
    description: "Personal notification queue management",
    tools: ["browse_todos", "manage_todos"],
    defaultEnabled: false,
  },
  {
    id: "search",
    name: "Search",
    description: "Global, project, and group search",
    tools: ["browse_search"],
    defaultEnabled: false,
  },
  {
    id: "context",
    name: "Context",
    description: "Runtime session context management",
    tools: ["manage_context"],
    defaultEnabled: false,
  },
];
 
/**
 * Preset definitions for quick setup
 */
export const PRESET_DEFINITIONS: PresetDefinition[] = [
  {
    id: "developer",
    name: "Developer",
    description: "Standard development workflow (issues, MRs, pipelines)",
    enabledCategories: [
      "core",
      "merge-requests",
      "work-items",
      "pipelines",
      "files",
      "labels",
      "snippets",
      "releases",
      "todos",
      "search",
    ],
  },
  {
    id: "senior-dev",
    name: "Senior Developer",
    description: "Extended access with refs, wiki, and branch management",
    enabledCategories: [
      "core",
      "merge-requests",
      "work-items",
      "pipelines",
      "files",
      "refs",
      "labels",
      "snippets",
      "releases",
      "iterations",
      "todos",
      "search",
    ],
  },
  {
    id: "devops",
    name: "DevOps Engineer",
    description: "CI/CD focused (pipelines, variables, webhooks, releases)",
    enabledCategories: [
      "core",
      "pipelines",
      "files",
      "refs",
      "releases",
      "variables",
      "webhooks",
      "integrations",
      "search",
    ],
  },
  {
    id: "code-reviewer",
    name: "Code Reviewer",
    description: "Code review workflow (MRs, discussions, approvals)",
    enabledCategories: [
      "core",
      "merge-requests",
      "work-items",
      "pipelines",
      "files",
      "labels",
      "todos",
      "search",
    ],
  },
  {
    id: "full-access",
    name: "Full Access",
    description: "All features enabled (admin/tech-lead)",
    enabledCategories: TOOL_CATEGORIES.map(c => c.id),
  },
  {
    id: "readonly",
    name: "Read-Only",
    description: "Read-only access for monitoring and viewing",
    enabledCategories: [
      "core",
      "merge-requests",
      "work-items",
      "pipelines",
      "files",
      "refs",
      "releases",
      "labels",
      "milestones",
      "members",
      "search",
    ],
  },
];
 
/**
 * Get preset definition by ID
 */
export function getPresetById(id: string): PresetDefinition | undefined {
  return PRESET_DEFINITIONS.find(p => p.id === id);
}
 
/**
 * Get tool category by ID
 */
export function getCategoryById(id: string): ToolCategory | undefined {
  return TOOL_CATEGORIES.find(c => c.id === id);
}
 
/**
 * Get total tool count for a list of category IDs
 */
export function getToolCount(categoryIds: string[]): number {
  return TOOL_CATEGORIES.filter(c => categoryIds.includes(c.id)).reduce(
    (count, c) => count + c.tools.length,
    0
  );
}
 
/**
 * Get total available tool count
 */
export function getTotalToolCount(): number {
  return TOOL_CATEGORIES.reduce((count, c) => count + c.tools.length, 0);
}