mcpField
E
enhance-orchestrator

enhance-orchestrator

github.com/agent-shエージェントワークフロー1.0k83 回インストール2 日前に更新
リポジトリ

enhance-orchestrator について

enhance-orchestratorは、プラグイン、エージェント、ドキュメントなどを確認する拡張分析器を調整し、結果をまとめるスキルです。存在するコンテンツに対応する分析器を並列実行し、明示的な指定がある場合に限って確度の高い修正を適用します。

主な機能

  1. 01プロジェクト内の既存コンテンツを検出
  2. 02該当する拡張分析器を並列実行
  3. 03結果を集約して重複を除去
  4. 04確度順に問題を並べ替え
  5. 05--apply の指定時のみ確度の高い修正を適用

活用シーン

  1. 01プラグイン、エージェント、ドキュメントの並列分析
  2. 02複数の分析器による検出結果の統合
  3. 03明示的な許可後に確度の高い自動修正を適用

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/agent-sh/agentsys --skill enhance-orchestrator

インストール後、Claude Code で/enhance-orchestratorを入力して読み込まれたか確認します。

詳細

enhance-orchestrator

すべての拡張アナライザーを並列で実行し、統合レポートを生成します。

重要なルール

  1. 拡張機能は必ず並列で実行すること - 効率化のために Promise.all を使用します
  2. 既存のコンテンツに対してのみ拡張機能を実行すること - ファイルが見つからない場合はスキップします
  3. 確度の高い項目から必ず報告すること - 優先順位:HIGH → MEDIUM → LOW
  4. --apply フラグなしで自動修正しないこと - 明示的な同意が必要です
  5. 確度が MEDIUM または LOW の問題を自動修正しないこと - 確度が HIGH のもののみ対象です

ワークフロー

フェーズ 1:引数の解析
const args = '$ARGUMENTS'.split(' ').filter(Boolean);
const targetPath = args.find(a => !a.startsWith('--')) || '.';

const flags = {
  apply: args.includes('--apply'),
  focus: args.find(a => a.startsWith('--focus='))?.split('=')[1],
  verbose: args.includes('--verbose'),
  showSuppressed: args.includes('--show-suppressed'),
  resetLearned: args.includes('--reset-learned'),
  noLearn: args.includes('--no-learn'),
  exportLearned: args.includes('--export-learned')
};

// Validate focus type
const VALID_FOCUS = ['plugin', 'agent', 'claudemd', 'claude-memory', 'docs', 'prompt', 'hooks', 'skills', 'cross-file'];
if (flags.focus && !VALID_FOCUS.includes(flags.focus)) {
  console.error(`Invalid --focus: "${flags.focus}". Valid: ${VALID_FOCUS.join(', ')}`);
  return;
}
フェーズ 2:検出

対象パスに存在するものを検出します:

const discovery = {
  plugins: await Glob({ pattern: 'plugins/*/.claude-plugin/plugin.json', path: targetPath }),
  agents: await Glob({ pattern: '**/agents/*.md', path: targetPath }),
  claudemd: await Glob({ pattern: '**/CLAUDE.md', path: targetPath }) ||
            await Glob({ pattern: '**/AGENTS.md', path: targetPath }),
  docs: await Glob({ pattern: 'docs/**/*.md', path: targetPath }),
  prompts: await Glob({ pattern: '**/prompts/**/*.md', path: targetPath }) ||
           await Glob({ pattern: '**/commands/**/*.md', path: targetPath }),
  hooks: await Glob({ pattern: '**/hooks/**/*.md', path: targetPath }),
  skills: await Glob({ pattern: '**/skills/**/SKILL.md', path: targetPath }),
  // Cross-file runs if agents OR skills exist (analyzes relationships)
  'cross-file': discovery.agents?.length || discovery.skills?.length ? ['enabled'] : []
};
フェーズ 3:抑制設定の読み込み
// Use relative path from skill directory to plugin lib
// Path: skills/enhance-orchestrator/ -> ../../lib/
const { getSuppressionPath } = require('../../lib/cross-platform');
const { loadAutoSuppressions, getProjectId, clearAutoSuppressions } = require('../../lib/enhance/auto-suppression');

const suppressionPath = getSuppressionPath();
const projectId = getProjectId(targetPath);

if (flags.resetLearned) {
  clearAutoSuppressions(suppressionPath, projectId);
  console.log(`Cleared suppressions for project: ${projectId}`);
}

const autoLearned = loadAutoSuppressions(suppressionPath, projectId);
フェーズ 4:拡張機能を並列で起動

重要:Task() を使用して、以下のエージェントを正確に起動する必要があります。Explore や他のエージェントは使用しないでください。

フォーカスの種類起動するエージェントモデルJS アナライザー
pluginplugin-enhancersonnetlib/enhance/plugin-analyzer.js
agentagent-enhanceropuslib/enhance/agent-analyzer.js
claudemdclaudemd-enhanceropuslib/enhance/projectmemory-analyzer.js
docsdocs-enhanceropuslib/enhance/docs-analyzer.js
promptprompt-enhanceropuslib/enhance/prompt-analyzer.js
hookshooks-enhanceropuslib/enhance/hook-analyzer.js
skillsskills-enhanceropuslib/enhance/skill-analyzer.js
cross-filecross-file-enhancersonnetlib/enhance/cross-file-analyzer.js

各エージェントは、JS アナライザーを実行するための Bash(node:*) を使用できます。Explore エージェントで代用しないでください。

// EXACT agent mapping - do not change
const ENHANCER_AGENTS = {
  plugin: 'plugin-enhancer',
  agent: 'agent-enhancer',
  claudemd: 'claudemd-enhancer',
  docs: 'docs-enhancer',
  prompt: 'prompt-enhancer',
  hooks: 'hooks-enhancer',
  skills: 'skills-enhancer',
  'cross-file': 'cross-file-enhancer'
};

const promises = [];

for (const [type, agentType] of Object.entries(ENHANCER_AGENTS)) {
  if (focus && focus !== type) continue;
  if (!discovery[type]?.length) continue;

  // MUST use exact subagent_type - these agents have Bash(node:*) to run JS analyzers
  promises.push(Task({
    subagent_type: agentType,
    prompt: `Analyze ${type} in ${targetPath}.
MUST use Skill tool to invoke your enhance-* skill.
The skill runs the JavaScript analyzer and returns structured findings.
verbose: ${flags.verbose}
Return JSON: { "enhancerType": "${type}", "findings": [...], "summary": { high, medium, low } }`
  }));
}

// MUST use Promise.all for parallel execution
const results = await Promise.all(promises);
フェーズ 5:結果の集約
function aggregateResults(enhancerResults) {
  const findings = [];
  const byEnhancer = {};

  for (const result of enhancerResults) {
    if (!result?.findings) continue;
    for (const finding of result.findings) {
      findings.push({ ...finding, source: result.enhancerType });
    }
    byEnhancer[result.enhancerType] = result.summary;
  }

  return {
    findings,
    byEnhancer,
    totals: {
      high: findings.filter(f => f.certainty === 'HIGH').length,
      medium: findings.filter(f => f.certainty === 'MEDIUM').length,
      low: findings.filter(f => f.certainty === 'LOW').length
    }
  };
}
フェーズ 6:レポートの生成

集約した検出結果から直接レポートを生成します:

const { generateReport } = require('../../lib/enhance/reporter');

const report = generateReport(aggregated, {
  verbose: flags.verbose,
  showAutoFixable: flags.apply
});

console.log(report);
フェーズ 7:自動学習
if (!flags.noLearn) {
  const { analyzeForAutoSuppression, saveAutoSuppressions } = require('../../lib/enhance/auto-suppression');

  const newSuppressions = analyzeForAutoSuppression(aggregated.findings, fileContents, { projectRoot: targetPath });

  if (newSuppressions.length > 0) {
    saveAutoSuppressions(suppressionPath, projectId, newSuppressions);
    console.log(`\nLearned ${newSuppressions.length} new suppressions.`);
  }
}
フェーズ 8:修正の適用
if (flags.apply) {
  const autoFixable = aggregated.findings.filter(f => f.certainty === 'HIGH' && f.autoFixable);

  if (autoFixable.length > 0) {
    console.log(`\n## Applying ${autoFixable.length} Auto-Fixes\n`);

    const byEnhancer = {};
    for (const fix of autoFixable) {
      const type = fix.source;
      if (!byEnhancer[type]) byEnhancer[type] = [];
      byEnhancer[type].push(fix);
    }

    for (const [type, fixes] of Object.entries(byEnhancer)) {
      await Task({
        subagent_type: enhancerAgents[type],
        prompt: `Apply HIGH certainty fixes: ${JSON.stringify(fixes, null, 2)}`
      });
    }

    console.log(`Applied ${autoFixable.length} fixes.`);
  }
}

出力形式

# Enhancement Analysis Report

**Target**: {targetPath}
**Date**: {timestamp}
**Enhancers Run**: {list}

## Executive Summary

| Enhancer | HIGH | MEDIUM | LOW | Auto-Fixable |
|----------|------|--------|-----|--------------|
| plugin   | 2    | 3      | 1   | 1            |
| agent    | 1    | 2      | 0   | 1            |
| **Total**| **3**| **5**  | **1**| **2**       |

## HIGH Certainty Issues
[Grouped by enhancer, then file]

## MEDIUM Certainty Issues
[...]

## Auto-Fix Summary
{n} issues can be fixed with `--apply` flag.

制約

  • 拡張機能は必ず並列で実行すること(Promise.all)
  • コンテンツの種類が存在しない場合、その種類の拡張機能は必ずスキップすること
  • 確度が HIGH の問題から必ず報告すること
  • 拡張機能間で検出結果を必ず重複排除すること
  • 明示的な --apply フラグなしで自動修正しないこと
  • 確度が MEDIUM または LOW の問題を自動修正しないこと

コメント