@lousy-agents/mcp 5.3.7 → 5.3.8

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.
@@ -68251,70 +68251,61 @@ const remark = unified().use(remarkParse).use(remarkStringify).freeze()
68251
68251
  /**
68252
68252
  * Creates or updates Claude Code web environment setup files.
68253
68253
  */ const createClaudeCodeWebSetupHandler = async (args)=>{
68254
- const dir = args.targetDir || process.cwd();
68255
- if (!await file_system_utils_fileExists(dir)) {
68256
- return types_errorResponse(`Target directory does not exist: ${dir}`);
68257
- }
68258
- const environmentGateway = createEnvironmentGateway();
68259
- const claudeGateway = createClaudeFileGateway();
68260
- // Detect environment configuration
68261
- const environment = await environmentGateway.detectEnvironment(dir);
68262
- const copilotSetupConfig = await loadCopilotSetupConfig();
68263
- // Build SessionStart hooks from environment
68264
- const hooks = await buildSessionStartHooks(environment, copilotSetupConfig);
68265
- // Read existing settings
68266
- const existingSettings = await claudeGateway.readSettings(dir);
68267
- // Merge settings
68268
- const mergedSettings = mergeClaudeSettings(existingSettings, hooks);
68269
- // Check if settings changed (normalize JSON for comparison)
68270
- const settingsChanged = JSON.stringify(existingSettings, null, 2) !== JSON.stringify(mergedSettings, null, 2);
68271
- // Read existing documentation
68272
- const existingDocs = await claudeGateway.readDocumentation(dir);
68273
- // Generate environment setup section
68274
- const setupSection = generateEnvironmentSetupSection(environment, hooks);
68275
- // Merge documentation
68276
- const mergedDocs = mergeClaudeDocumentation(existingDocs, setupSection);
68277
- // Check if documentation changed (normalize for comparison - trim and ensure trailing newline)
68278
- const normalizeDoc = (doc)=>doc ? `${doc.trimEnd()}\n` : null;
68279
- const docsChanged = normalizeDoc(existingDocs) !== normalizeDoc(mergedDocs);
68280
- // Determine action before writing
68281
- let action;
68282
- if (!settingsChanged && !docsChanged) {
68283
- action = "no_changes_needed";
68284
- } else if (!existingSettings && !existingDocs) {
68285
- action = "created";
68286
- } else {
68287
- action = "updated";
68288
- }
68289
- // Only write if there are changes
68290
- if (settingsChanged) {
68291
- await claudeGateway.writeSettings(dir, mergedSettings);
68292
- }
68293
- if (docsChanged) {
68294
- await claudeGateway.writeDocumentation(dir, mergedDocs);
68254
+ try {
68255
+ const dir = args.targetDir || process.cwd();
68256
+ if (!await file_system_utils_fileExists(dir)) {
68257
+ return types_errorResponse(`Target directory does not exist: ${dir}`);
68258
+ }
68259
+ const environmentGateway = createEnvironmentGateway();
68260
+ const claudeGateway = createClaudeFileGateway();
68261
+ const environment = await environmentGateway.detectEnvironment(dir);
68262
+ const copilotSetupConfig = await loadCopilotSetupConfig(dir);
68263
+ const hooks = await buildSessionStartHooks(environment, copilotSetupConfig);
68264
+ const existingSettings = await claudeGateway.readSettings(dir);
68265
+ const mergedSettings = mergeClaudeSettings(existingSettings, hooks);
68266
+ const settingsChanged = JSON.stringify(existingSettings, null, 2) !== JSON.stringify(mergedSettings, null, 2);
68267
+ const existingDocs = await claudeGateway.readDocumentation(dir);
68268
+ const setupSection = generateEnvironmentSetupSection(environment, hooks);
68269
+ const mergedDocs = mergeClaudeDocumentation(existingDocs, setupSection);
68270
+ const normalizeDoc = (doc)=>doc ? `${doc.trimEnd()}\n` : null;
68271
+ const docsChanged = normalizeDoc(existingDocs) !== normalizeDoc(mergedDocs);
68272
+ let action;
68273
+ if (!settingsChanged && !docsChanged) {
68274
+ action = "no_changes_needed";
68275
+ } else if (!existingSettings && !existingDocs) {
68276
+ action = "created";
68277
+ } else {
68278
+ action = "updated";
68279
+ }
68280
+ if (settingsChanged) {
68281
+ await claudeGateway.writeSettings(dir, mergedSettings);
68282
+ }
68283
+ if (docsChanged) {
68284
+ await claudeGateway.writeDocumentation(dir, mergedDocs);
68285
+ }
68286
+ const settingsPath = (0,external_node_path_.join)(dir, ".claude", "settings.json");
68287
+ const documentationPath = (0,external_node_path_.join)(dir, "CLAUDE.md");
68288
+ const result = {
68289
+ hooks,
68290
+ environment,
68291
+ settingsPath,
68292
+ documentationPath,
68293
+ action,
68294
+ recommendations: buildRecommendations(environment)
68295
+ };
68296
+ const message = buildResultMessage(result);
68297
+ return successResponse({
68298
+ ...result,
68299
+ message,
68300
+ hooks: hooks.map((h)=>({
68301
+ command: h.command,
68302
+ description: h.description
68303
+ }))
68304
+ });
68305
+ } catch (error) {
68306
+ const message = error instanceof Error ? error.message : "Unknown error occurred";
68307
+ return types_errorResponse(`Failed to create Claude Code setup: ${message}`);
68295
68308
  }
68296
- const settingsPath = (0,external_node_path_.join)(dir, ".claude", "settings.json");
68297
- const documentationPath = (0,external_node_path_.join)(dir, "CLAUDE.md");
68298
- // Build result
68299
- const result = {
68300
- hooks,
68301
- environment,
68302
- settingsPath,
68303
- documentationPath,
68304
- action,
68305
- recommendations: buildRecommendations(environment)
68306
- };
68307
- // Format message
68308
- const message = buildResultMessage(result);
68309
- return successResponse({
68310
- ...result,
68311
- message,
68312
- // Make hooks serializable for JSON response
68313
- hooks: hooks.map((h)=>({
68314
- command: h.command,
68315
- description: h.description
68316
- }))
68317
- });
68318
68309
  };
68319
68310
  /**
68320
68311
  * Builds recommendations for UI-level environment configuration.
@@ -69271,29 +69262,30 @@ const workflow_generator_defaultActionVersionPort = createActionVersionPort(work
69271
69262
  /**
69272
69263
  * Creates or updates the Copilot Setup Steps workflow.
69273
69264
  */ const createCopilotSetupWorkflowHandler = async (args)=>{
69274
- const dir = args.targetDir || process.cwd();
69275
- if (!await file_system_utils_fileExists(dir)) {
69276
- return types_errorResponse(`Target directory does not exist: ${dir}`);
69277
- }
69278
- const workflowGateway = createWorkflowGateway();
69279
- const workflowsDir = await file_system_utils_resolveSafePath(dir, ".github/workflows");
69280
- const workflowsDirExists = await file_system_utils_fileExists(workflowsDir);
69281
- // Gather all candidates
69282
- const allCandidates = await gatherCandidates(dir, workflowsDirExists);
69283
- // Ensure workflows directory exists
69284
- if (!workflowsDirExists) {
69285
- await (0,promises_.mkdir)(workflowsDir, {
69286
- recursive: true
69287
- });
69288
- }
69289
- // Get the correct workflow path (supports both .yml and .yaml extensions)
69290
- const workflowPath = await workflowGateway.getCopilotSetupWorkflowPath(dir);
69291
- // Check if workflow exists and create/update accordingly
69292
- const workflowExists = await workflowGateway.copilotSetupWorkflowExists(dir);
69293
- if (workflowExists) {
69294
- return updateExistingWorkflow(dir, workflowPath, allCandidates, args);
69265
+ try {
69266
+ const dir = args.targetDir || process.cwd();
69267
+ if (!await file_system_utils_fileExists(dir)) {
69268
+ return types_errorResponse(`Target directory does not exist: ${dir}`);
69269
+ }
69270
+ const workflowGateway = createWorkflowGateway();
69271
+ const workflowsDir = await file_system_utils_resolveSafePath(dir, ".github/workflows");
69272
+ const workflowsDirExists = await file_system_utils_fileExists(workflowsDir);
69273
+ const allCandidates = await gatherCandidates(dir, workflowsDirExists);
69274
+ if (!workflowsDirExists) {
69275
+ await (0,promises_.mkdir)(workflowsDir, {
69276
+ recursive: true
69277
+ });
69278
+ }
69279
+ const workflowPath = await workflowGateway.getCopilotSetupWorkflowPath(dir);
69280
+ const workflowExists = await workflowGateway.copilotSetupWorkflowExists(dir);
69281
+ if (workflowExists) {
69282
+ return await updateExistingWorkflow(dir, workflowPath, allCandidates, args);
69283
+ }
69284
+ return await createNewWorkflow(dir, workflowPath, allCandidates, args);
69285
+ } catch (error) {
69286
+ const message = error instanceof Error ? error.message : "Unknown error occurred";
69287
+ return types_errorResponse(`Failed to create/update workflow: ${message}`);
69295
69288
  }
69296
- return createNewWorkflow(dir, workflowPath, allCandidates, args);
69297
69289
  };
69298
69290
 
69299
69291
  ;// CONCATENATED MODULE: ./src/tools/discover-environment.ts
@@ -69304,21 +69296,26 @@ const workflow_generator_defaultActionVersionPort = createActionVersionPort(work
69304
69296
  /**
69305
69297
  * Discovers environment configuration files (mise.toml, version files) in a directory.
69306
69298
  */ const discoverEnvironmentHandler = async (args)=>{
69307
- const dir = args.targetDir || process.cwd();
69308
- if (!await file_system_utils_fileExists(dir)) {
69309
- return types_errorResponse(`Target directory does not exist: ${dir}`);
69299
+ try {
69300
+ const dir = args.targetDir || process.cwd();
69301
+ if (!await file_system_utils_fileExists(dir)) {
69302
+ return types_errorResponse(`Target directory does not exist: ${dir}`);
69303
+ }
69304
+ const environmentGateway = createEnvironmentGateway();
69305
+ const environment = await environmentGateway.detectEnvironment(dir);
69306
+ return successResponse({
69307
+ hasMise: environment.hasMise,
69308
+ versionFiles: environment.versionFiles.map((vf)=>({
69309
+ type: vf.type,
69310
+ filename: vf.filename,
69311
+ version: vf.version
69312
+ })),
69313
+ message: environment.hasMise ? "Found mise.toml - mise will manage all tool versions" : environment.versionFiles.length > 0 ? `Found ${environment.versionFiles.length} version file(s)` : "No environment configuration files found"
69314
+ });
69315
+ } catch (error) {
69316
+ const message = error instanceof Error ? error.message : "Unknown error occurred";
69317
+ return types_errorResponse(`Failed to discover environment: ${message}`);
69310
69318
  }
69311
- const environmentGateway = createEnvironmentGateway();
69312
- const environment = await environmentGateway.detectEnvironment(dir);
69313
- return successResponse({
69314
- hasMise: environment.hasMise,
69315
- versionFiles: environment.versionFiles.map((vf)=>({
69316
- type: vf.type,
69317
- filename: vf.filename,
69318
- version: vf.version
69319
- })),
69320
- message: environment.hasMise ? "Found mise.toml - mise will manage all tool versions" : environment.versionFiles.length > 0 ? `Found ${environment.versionFiles.length} version file(s)` : "No environment configuration files found"
69321
- });
69322
69319
  };
69323
69320
 
69324
69321
  ;// CONCATENATED MODULE: ../core/src/use-cases/discover-feedback-loops.ts
@@ -69464,29 +69461,34 @@ const workflow_generator_defaultActionVersionPort = createActionVersionPort(work
69464
69461
  /**
69465
69462
  * Discovers setup actions used in existing GitHub Actions workflows.
69466
69463
  */ const discoverWorkflowSetupActionsHandler = async (args)=>{
69467
- const dir = args.targetDir || process.cwd();
69468
- if (!await file_system_utils_fileExists(dir)) {
69469
- return types_errorResponse(`Target directory does not exist: ${dir}`);
69470
- }
69471
- const workflowGateway = createWorkflowGateway();
69472
- const workflowsDir = (0,external_node_path_.join)(dir, ".github", "workflows");
69473
- const workflowsDirExists = await file_system_utils_fileExists(workflowsDir);
69474
- if (!workflowsDirExists) {
69464
+ try {
69465
+ const dir = args.targetDir || process.cwd();
69466
+ if (!await file_system_utils_fileExists(dir)) {
69467
+ return types_errorResponse(`Target directory does not exist: ${dir}`);
69468
+ }
69469
+ const workflowGateway = createWorkflowGateway();
69470
+ const workflowsDir = (0,external_node_path_.join)(dir, ".github", "workflows");
69471
+ const workflowsDirExists = await file_system_utils_fileExists(workflowsDir);
69472
+ if (!workflowsDirExists) {
69473
+ return successResponse({
69474
+ actions: [],
69475
+ message: "No .github/workflows directory found - no workflows to analyze"
69476
+ });
69477
+ }
69478
+ const candidates = await workflowGateway.parseWorkflowsForSetupActions(dir);
69475
69479
  return successResponse({
69476
- actions: [],
69477
- message: "No .github/workflows directory found - no workflows to analyze"
69480
+ actions: candidates.map((c)=>({
69481
+ action: c.action,
69482
+ version: c.version,
69483
+ config: c.config,
69484
+ source: c.source
69485
+ })),
69486
+ message: candidates.length > 0 ? `Found ${candidates.length} setup action(s) in workflows` : "No setup actions found in existing workflows"
69478
69487
  });
69488
+ } catch (error) {
69489
+ const message = error instanceof Error ? error.message : "Unknown error occurred";
69490
+ return types_errorResponse(`Failed to discover workflow setup actions: ${message}`);
69479
69491
  }
69480
- const candidates = await workflowGateway.parseWorkflowsForSetupActions(dir);
69481
- return successResponse({
69482
- actions: candidates.map((c)=>({
69483
- action: c.action,
69484
- version: c.version,
69485
- config: c.config,
69486
- source: c.source
69487
- })),
69488
- message: candidates.length > 0 ? `Found ${candidates.length} setup action(s) in workflows` : "No setup actions found in existing workflows"
69489
- });
69490
69492
  };
69491
69493
 
69492
69494
  ;// CONCATENATED MODULE: ./src/tools/read-copilot-setup-workflow.ts
@@ -69498,32 +69500,37 @@ const workflow_generator_defaultActionVersionPort = createActionVersionPort(work
69498
69500
  /**
69499
69501
  * Reads the existing Copilot Setup Steps workflow.
69500
69502
  */ const readCopilotSetupWorkflowHandler = async (args)=>{
69501
- const dir = args.targetDir || process.cwd();
69502
- if (!await file_system_utils_fileExists(dir)) {
69503
- return types_errorResponse(`Target directory does not exist: ${dir}`);
69504
- }
69505
- const workflowGateway = createWorkflowGateway();
69506
- const exists = await workflowGateway.copilotSetupWorkflowExists(dir);
69507
- const workflowPath = await workflowGateway.getCopilotSetupWorkflowPath(dir);
69508
- if (!exists) {
69503
+ try {
69504
+ const dir = args.targetDir || process.cwd();
69505
+ if (!await file_system_utils_fileExists(dir)) {
69506
+ return types_errorResponse(`Target directory does not exist: ${dir}`);
69507
+ }
69508
+ const workflowGateway = createWorkflowGateway();
69509
+ const exists = await workflowGateway.copilotSetupWorkflowExists(dir);
69510
+ const workflowPath = await workflowGateway.getCopilotSetupWorkflowPath(dir);
69511
+ if (!exists) {
69512
+ return successResponse({
69513
+ exists: false,
69514
+ workflowPath,
69515
+ message: "Copilot Setup Steps workflow does not exist. Use create_copilot_setup_workflow to create it."
69516
+ });
69517
+ }
69518
+ const workflow = await workflowGateway.readCopilotSetupWorkflow(dir);
69519
+ const workflowObj = workflow;
69520
+ const steps = extractAllWorkflowSteps(workflow);
69509
69521
  return successResponse({
69510
- exists: false,
69522
+ exists: true,
69511
69523
  workflowPath,
69512
- message: "Copilot Setup Steps workflow does not exist. Use create_copilot_setup_workflow to create it."
69524
+ workflow: {
69525
+ name: workflowObj?.name || "Copilot Setup Steps",
69526
+ steps
69527
+ },
69528
+ message: `Found Copilot Setup Steps workflow with ${steps.length} step(s)`
69513
69529
  });
69530
+ } catch (error) {
69531
+ const message = error instanceof Error ? error.message : "Unknown error occurred";
69532
+ return types_errorResponse(`Failed to read workflow: ${message}`);
69514
69533
  }
69515
- const workflow = await workflowGateway.readCopilotSetupWorkflow(dir);
69516
- const workflowObj = workflow;
69517
- const steps = extractAllWorkflowSteps(workflow);
69518
- return successResponse({
69519
- exists: true,
69520
- workflowPath,
69521
- workflow: {
69522
- name: workflowObj?.name || "Copilot Setup Steps",
69523
- steps
69524
- },
69525
- message: `Found Copilot Setup Steps workflow with ${steps.length} step(s)`
69526
- });
69527
69534
  };
69528
69535
 
69529
69536
  ;// CONCATENATED MODULE: ./src/tools/resolve-action-versions.ts
@@ -69533,45 +69540,49 @@ const workflow_generator_defaultActionVersionPort = createActionVersionPort(work
69533
69540
  */
69534
69541
 
69535
69542
 
69543
+
69536
69544
  /**
69537
69545
  * Resolves action versions for the provided actions or detected candidates.
69538
69546
  */ const resolveActionVersionsHandler = async (args)=>{
69539
- // If specific actions are provided, use them directly
69540
- if (args.actions && args.actions.length > 0) {
69541
- const actionsToResolve = args.actions.filter((action)=>{
69542
- // Filter out already-resolved actions
69543
- if (args.resolvedVersions) {
69544
- return !args.resolvedVersions.some((r)=>r.action === action);
69545
- }
69546
- return true;
69547
- }).map(buildActionToResolve);
69547
+ try {
69548
+ if (args.actions && args.actions.length > 0) {
69549
+ const actionsToResolve = args.actions.filter((action)=>{
69550
+ if (args.resolvedVersions) {
69551
+ return !args.resolvedVersions.some((r)=>r.action === action);
69552
+ }
69553
+ return true;
69554
+ }).map(buildActionToResolve);
69555
+ return successResponse({
69556
+ actionsToResolve,
69557
+ instructions: actionsToResolve.length > 0 ? VERSION_RESOLUTION_INSTRUCTIONS : undefined,
69558
+ message: actionsToResolve.length > 0 ? `Found ${actionsToResolve.length} action(s) needing version resolution` : "All actions have been resolved"
69559
+ });
69560
+ }
69561
+ const dir = args.targetDir || process.cwd();
69562
+ if (!await file_system_utils_fileExists(dir)) {
69563
+ return types_errorResponse(`Target directory does not exist: ${dir}`);
69564
+ }
69565
+ const config = await loadCopilotSetupConfig(dir);
69566
+ const defaultActions = [
69567
+ ...config.setupActions.map((actionConfig)=>({
69568
+ action: actionConfig.action,
69569
+ source: "version-file"
69570
+ })),
69571
+ ...config.setupActionPatterns.filter((pattern)=>!config.setupActions.some((a)=>a.action === pattern)).map((action)=>({
69572
+ action,
69573
+ source: "version-file"
69574
+ }))
69575
+ ];
69576
+ const actionsToResolve = buildActionsToResolve(defaultActions, args.resolvedVersions);
69548
69577
  return successResponse({
69549
69578
  actionsToResolve,
69550
69579
  instructions: actionsToResolve.length > 0 ? VERSION_RESOLUTION_INSTRUCTIONS : undefined,
69551
69580
  message: actionsToResolve.length > 0 ? `Found ${actionsToResolve.length} action(s) needing version resolution` : "All actions have been resolved"
69552
69581
  });
69582
+ } catch (error) {
69583
+ const message = error instanceof Error ? error.message : "Unknown error occurred";
69584
+ return types_errorResponse(`Failed to resolve action versions: ${message}`);
69553
69585
  }
69554
- // Load configuration to get supported setup actions
69555
- const config = await loadCopilotSetupConfig();
69556
- // Build candidates from configured setup actions and patterns
69557
- const defaultActions = [
69558
- // Add actions from setupActions config
69559
- ...config.setupActions.map((actionConfig)=>({
69560
- action: actionConfig.action,
69561
- source: "version-file"
69562
- })),
69563
- // Add mise-action if it's in the patterns but not in setupActions
69564
- ...config.setupActionPatterns.filter((pattern)=>!config.setupActions.some((a)=>a.action === pattern)).map((action)=>({
69565
- action,
69566
- source: "version-file"
69567
- }))
69568
- ];
69569
- const actionsToResolve = buildActionsToResolve(defaultActions, args.resolvedVersions);
69570
- return successResponse({
69571
- actionsToResolve,
69572
- instructions: actionsToResolve.length > 0 ? VERSION_RESOLUTION_INSTRUCTIONS : undefined,
69573
- message: actionsToResolve.length > 0 ? `Found ${actionsToResolve.length} action(s) needing version resolution` : "All actions have been resolved"
69574
- });
69575
69586
  };
69576
69587
 
69577
69588
  ;// CONCATENATED MODULE: ../core/src/use-cases/validate-instruction-coverage.ts
@@ -69766,7 +69777,7 @@ const workflow_generator_defaultActionVersionPort = createActionVersionPort(work
69766
69777
  /**
69767
69778
  * Shared input schema for tools that operate on a target directory.
69768
69779
  */ const targetDirInputSchema = {
69769
- targetDir: schemas_string().optional().describe("Target directory to operate on. Defaults to current working directory.")
69780
+ targetDir: schemas_string().min(1, "Target directory cannot be empty").optional().describe("Target directory to operate on. Defaults to current working directory.")
69770
69781
  };
69771
69782
  /**
69772
69783
  * Extended input schema for create_copilot_setup_workflow tool.