@josstei/maestro 1.6.4-rc.1
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.
- package/.agents/plugins/marketplace.json +20 -0
- package/CHANGELOG.md +485 -0
- package/EXAMPLES.md +255 -0
- package/GEMINI.md +231 -0
- package/LICENSE +201 -0
- package/QWEN.md +241 -0
- package/README.md +220 -0
- package/agents/accessibility_specialist.md +20 -0
- package/agents/analytics_engineer.md +22 -0
- package/agents/api_designer.md +19 -0
- package/agents/architect.md +19 -0
- package/agents/cloud_architect.md +19 -0
- package/agents/cobol_engineer.md +22 -0
- package/agents/code_reviewer.md +17 -0
- package/agents/coder.md +22 -0
- package/agents/compliance_reviewer.md +19 -0
- package/agents/content_strategist.md +19 -0
- package/agents/copywriter.md +19 -0
- package/agents/data_engineer.md +22 -0
- package/agents/database_administrator.md +21 -0
- package/agents/db2_dba.md +21 -0
- package/agents/debugger.md +19 -0
- package/agents/design_system_engineer.md +22 -0
- package/agents/devops_engineer.md +23 -0
- package/agents/hlasm_assembler_specialist.md +22 -0
- package/agents/i18n_specialist.md +21 -0
- package/agents/ibm_i_specialist.md +22 -0
- package/agents/integration_engineer.md +23 -0
- package/agents/ml_engineer.md +23 -0
- package/agents/mlops_engineer.md +23 -0
- package/agents/mobile_engineer.md +23 -0
- package/agents/observability_engineer.md +23 -0
- package/agents/performance_engineer.md +21 -0
- package/agents/platform_engineer.md +24 -0
- package/agents/product_manager.md +20 -0
- package/agents/prompt_engineer.md +22 -0
- package/agents/refactor.md +22 -0
- package/agents/release_manager.md +22 -0
- package/agents/security_engineer.md +21 -0
- package/agents/seo_specialist.md +21 -0
- package/agents/site_reliability_engineer.md +21 -0
- package/agents/solutions_architect.md +19 -0
- package/agents/technical_writer.md +21 -0
- package/agents/tester.md +23 -0
- package/agents/ux_designer.md +20 -0
- package/agents/zos_sysprog.md +21 -0
- package/bin/maestro-mcp-server.js +10 -0
- package/claude/.claude-plugin/plugin.json +21 -0
- package/claude/.mcp.json +11 -0
- package/claude/README.md +191 -0
- package/claude/agents/accessibility-specialist.md +36 -0
- package/claude/agents/analytics-engineer.md +38 -0
- package/claude/agents/api-designer.md +33 -0
- package/claude/agents/architect.md +33 -0
- package/claude/agents/cloud-architect.md +33 -0
- package/claude/agents/cobol-engineer.md +38 -0
- package/claude/agents/code-reviewer.md +31 -0
- package/claude/agents/coder.md +38 -0
- package/claude/agents/compliance-reviewer.md +33 -0
- package/claude/agents/content-strategist.md +33 -0
- package/claude/agents/copywriter.md +33 -0
- package/claude/agents/data-engineer.md +37 -0
- package/claude/agents/database-administrator.md +37 -0
- package/claude/agents/db2-dba.md +37 -0
- package/claude/agents/debugger.md +32 -0
- package/claude/agents/design-system-engineer.md +38 -0
- package/claude/agents/devops-engineer.md +39 -0
- package/claude/agents/hlasm-assembler-specialist.md +38 -0
- package/claude/agents/i18n-specialist.md +37 -0
- package/claude/agents/ibm-i-specialist.md +38 -0
- package/claude/agents/integration-engineer.md +39 -0
- package/claude/agents/ml-engineer.md +39 -0
- package/claude/agents/mlops-engineer.md +39 -0
- package/claude/agents/mobile-engineer.md +39 -0
- package/claude/agents/observability-engineer.md +39 -0
- package/claude/agents/performance-engineer.md +34 -0
- package/claude/agents/platform-engineer.md +40 -0
- package/claude/agents/product-manager.md +34 -0
- package/claude/agents/prompt-engineer.md +38 -0
- package/claude/agents/refactor.md +38 -0
- package/claude/agents/release-manager.md +38 -0
- package/claude/agents/security-engineer.md +37 -0
- package/claude/agents/seo-specialist.md +37 -0
- package/claude/agents/site-reliability-engineer.md +37 -0
- package/claude/agents/solutions-architect.md +33 -0
- package/claude/agents/technical-writer.md +37 -0
- package/claude/agents/tester.md +39 -0
- package/claude/agents/ux-designer.md +34 -0
- package/claude/agents/zos-sysprog.md +37 -0
- package/claude/hooks/claude-hooks.json +48 -0
- package/claude/mcp/maestro-server.js +9 -0
- package/claude/mcp-config.example.json +9 -0
- package/claude/scripts/adapters/claude-adapter.js +7 -0
- package/claude/scripts/hook-runner.js +8 -0
- package/claude/scripts/policy-enforcer.js +294 -0
- package/claude/skills/a11y-audit/SKILL.md +26 -0
- package/claude/skills/archive/SKILL.md +24 -0
- package/claude/skills/code-review/SKILL.md +7 -0
- package/claude/skills/compliance-check/SKILL.md +26 -0
- package/claude/skills/debug-workflow/SKILL.md +27 -0
- package/claude/skills/delegation/SKILL.md +7 -0
- package/claude/skills/design-dialogue/SKILL.md +7 -0
- package/claude/skills/execute/SKILL.md +38 -0
- package/claude/skills/execution/SKILL.md +7 -0
- package/claude/skills/implementation-planning/SKILL.md +7 -0
- package/claude/skills/orchestrate/SKILL.md +38 -0
- package/claude/skills/perf-check/SKILL.md +26 -0
- package/claude/skills/resume-session/SKILL.md +38 -0
- package/claude/skills/review-code/SKILL.md +27 -0
- package/claude/skills/security-audit/SKILL.md +28 -0
- package/claude/skills/seo-audit/SKILL.md +26 -0
- package/claude/skills/session-management/SKILL.md +7 -0
- package/claude/skills/status/SKILL.md +22 -0
- package/claude/skills/validation/SKILL.md +7 -0
- package/claude/src/agents/accessibility-specialist.md +163 -0
- package/claude/src/agents/analytics-engineer.md +182 -0
- package/claude/src/agents/api-designer.md +124 -0
- package/claude/src/agents/architect.md +120 -0
- package/claude/src/agents/cloud-architect.md +134 -0
- package/claude/src/agents/cobol-engineer.md +127 -0
- package/claude/src/agents/code-reviewer.md +123 -0
- package/claude/src/agents/coder.md +132 -0
- package/claude/src/agents/compliance-reviewer.md +219 -0
- package/claude/src/agents/content-strategist.md +111 -0
- package/claude/src/agents/copywriter.md +113 -0
- package/claude/src/agents/data-engineer.md +130 -0
- package/claude/src/agents/database-administrator.md +126 -0
- package/claude/src/agents/db2-dba.md +124 -0
- package/claude/src/agents/debugger.md +133 -0
- package/claude/src/agents/design-system-engineer.md +258 -0
- package/claude/src/agents/devops-engineer.md +138 -0
- package/claude/src/agents/hlasm-assembler-specialist.md +134 -0
- package/claude/src/agents/i18n-specialist.md +241 -0
- package/claude/src/agents/ibm-i-specialist.md +132 -0
- package/claude/src/agents/integration-engineer.md +133 -0
- package/claude/src/agents/ml-engineer.md +115 -0
- package/claude/src/agents/mlops-engineer.md +116 -0
- package/claude/src/agents/mobile-engineer.md +115 -0
- package/claude/src/agents/observability-engineer.md +133 -0
- package/claude/src/agents/performance-engineer.md +139 -0
- package/claude/src/agents/platform-engineer.md +129 -0
- package/claude/src/agents/product-manager.md +170 -0
- package/claude/src/agents/prompt-engineer.md +129 -0
- package/claude/src/agents/refactor.md +138 -0
- package/claude/src/agents/release-manager.md +132 -0
- package/claude/src/agents/security-engineer.md +143 -0
- package/claude/src/agents/seo-specialist.md +129 -0
- package/claude/src/agents/site-reliability-engineer.md +131 -0
- package/claude/src/agents/solutions-architect.md +137 -0
- package/claude/src/agents/technical-writer.md +129 -0
- package/claude/src/agents/tester.md +135 -0
- package/claude/src/agents/ux-designer.md +168 -0
- package/claude/src/agents/zos-sysprog.md +134 -0
- package/claude/src/config/setting-resolver.js +32 -0
- package/claude/src/core/agent-registry.js +67 -0
- package/claude/src/core/canonical-source.js +39 -0
- package/claude/src/core/env-file-parser.js +82 -0
- package/claude/src/core/feature-blocks.js +34 -0
- package/claude/src/core/logger.js +12 -0
- package/claude/src/core/markdown-state.js +36 -0
- package/claude/src/core/policy-rules.js +32 -0
- package/claude/src/core/project-root-resolver.js +184 -0
- package/claude/src/core/stdin-reader.js +77 -0
- package/claude/src/core/version.js +50 -0
- package/claude/src/entry-points/core-command-registry.js +37 -0
- package/claude/src/entry-points/preamble-builders.js +54 -0
- package/claude/src/entry-points/registry.js +199 -0
- package/claude/src/entry-points/templates/claude-core-command.md.tmpl +38 -0
- package/claude/src/entry-points/templates/claude-skill.md.tmpl +18 -0
- package/claude/src/entry-points/templates/codex-core-command.md.tmpl +16 -0
- package/claude/src/entry-points/templates/codex-skill.md.tmpl +11 -0
- package/claude/src/entry-points/templates/gemini-command.toml.tmpl +17 -0
- package/claude/src/entry-points/templates/gemini-core-command.toml.tmpl +30 -0
- package/claude/src/generated/agent-registry.json +630 -0
- package/claude/src/generated/hook-registry.json +18 -0
- package/claude/src/generated/resource-registry.json +16 -0
- package/claude/src/hooks/logic/after-agent-logic.js +54 -0
- package/claude/src/hooks/logic/before-agent-logic.js +57 -0
- package/claude/src/hooks/logic/hook-state.js +127 -0
- package/claude/src/hooks/logic/session-end-logic.js +17 -0
- package/claude/src/hooks/logic/session-start-logic.js +25 -0
- package/claude/src/lib/discovery/index.js +172 -0
- package/claude/src/lib/errors/index.js +104 -0
- package/claude/src/lib/framework-detection.js +50 -0
- package/claude/src/lib/frontmatter/index.js +262 -0
- package/claude/src/lib/io/index.js +96 -0
- package/claude/src/lib/naming/index.js +94 -0
- package/claude/src/lib/validation/index.js +124 -0
- package/claude/src/lib/yaml-emit.js +38 -0
- package/claude/src/mcp/content/provider.js +68 -0
- package/claude/src/mcp/content/runtime-content.js +188 -0
- package/claude/src/mcp/contracts/cache-path-rejector.js +39 -0
- package/claude/src/mcp/contracts/downstream-context.js +106 -0
- package/claude/src/mcp/contracts/plan-schema.js +148 -0
- package/claude/src/mcp/contracts/workspace-marker.js +61 -0
- package/claude/src/mcp/core/create-server.js +76 -0
- package/claude/src/mcp/core/line-reader.js +35 -0
- package/claude/src/mcp/core/project-root-cache.js +120 -0
- package/claude/src/mcp/core/protocol-dispatcher.js +274 -0
- package/claude/src/mcp/core/recovery-hints.js +43 -0
- package/claude/src/mcp/core/tool-outcome.js +77 -0
- package/claude/src/mcp/core/tool-registry.js +82 -0
- package/claude/src/mcp/handlers/assess-task-complexity.js +108 -0
- package/claude/src/mcp/handlers/blocker-parser.js +34 -0
- package/claude/src/mcp/handlers/design-gate.js +393 -0
- package/claude/src/mcp/handlers/get-agent.js +54 -0
- package/claude/src/mcp/handlers/get-runtime-context.js +49 -0
- package/claude/src/mcp/handlers/get-skill-content.js +51 -0
- package/claude/src/mcp/handlers/initialize-workspace.js +45 -0
- package/claude/src/mcp/handlers/reconciliation.js +224 -0
- package/claude/src/mcp/handlers/resolve-settings.js +39 -0
- package/claude/src/mcp/handlers/session-state-core.js +108 -0
- package/claude/src/mcp/handlers/session-state-tools.js +562 -0
- package/claude/src/mcp/handlers/validate-plan.js +76 -0
- package/claude/src/mcp/maestro-server.js +122 -0
- package/claude/src/mcp/runtime/runtime-config-map.js +70 -0
- package/claude/src/mcp/tool-packs/content/index.js +80 -0
- package/claude/src/mcp/tool-packs/contracts.js +30 -0
- package/claude/src/mcp/tool-packs/index.js +15 -0
- package/claude/src/mcp/tool-packs/session/index.js +243 -0
- package/claude/src/mcp/tool-packs/workspace/index.js +98 -0
- package/claude/src/mcp/utils/extension-root.js +31 -0
- package/claude/src/mcp/validation/agent-checker.js +81 -0
- package/claude/src/mcp/validation/dag-checker.js +214 -0
- package/claude/src/mcp/validation/file-overlap-checker.js +63 -0
- package/claude/src/mcp/validation/schema-checker.js +108 -0
- package/claude/src/platforms/claude/runtime-config.js +60 -0
- package/claude/src/platforms/shared/adapters/claude-adapter.js +36 -0
- package/claude/src/platforms/shared/adapters/conventions.js +29 -0
- package/claude/src/platforms/shared/adapters/exit-codes.js +6 -0
- package/claude/src/platforms/shared/adapters/factory.js +40 -0
- package/claude/src/platforms/shared/agent-names.js +10 -0
- package/claude/src/platforms/shared/hook-runner.js +52 -0
- package/claude/src/references/architecture.md +139 -0
- package/claude/src/references/orchestration-steps.md +193 -0
- package/claude/src/skills/shared/code-review/SKILL.md +145 -0
- package/claude/src/skills/shared/delegation/SKILL.md +370 -0
- package/claude/src/skills/shared/delegation/protocols/agent-base-protocol.md +145 -0
- package/claude/src/skills/shared/delegation/protocols/filesystem-safety-protocol.md +31 -0
- package/claude/src/skills/shared/design-dialogue/SKILL.md +284 -0
- package/claude/src/skills/shared/execution/SKILL.md +258 -0
- package/claude/src/skills/shared/implementation-planning/SKILL.md +303 -0
- package/claude/src/skills/shared/session-management/SKILL.md +314 -0
- package/claude/src/skills/shared/validation/SKILL.md +204 -0
- package/claude/src/state/session-state.js +113 -0
- package/claude/src/templates/design-document.md +95 -0
- package/claude/src/templates/implementation-plan.md +86 -0
- package/claude/src/templates/session-state.md +68 -0
- package/claude/src/version.json +3 -0
- package/commands/maestro/a11y-audit.toml +22 -0
- package/commands/maestro/archive.toml +23 -0
- package/commands/maestro/compliance-check.toml +22 -0
- package/commands/maestro/debug.toml +23 -0
- package/commands/maestro/execute.toml +30 -0
- package/commands/maestro/orchestrate.toml +30 -0
- package/commands/maestro/perf-check.toml +22 -0
- package/commands/maestro/resume.toml +38 -0
- package/commands/maestro/review.toml +23 -0
- package/commands/maestro/security-audit.toml +24 -0
- package/commands/maestro/seo-audit.toml +22 -0
- package/commands/maestro/status.toml +21 -0
- package/docs/architecture.md +310 -0
- package/docs/cicd.md +647 -0
- package/docs/flow.md +255 -0
- package/docs/maestro-cheatsheet.md +199 -0
- package/docs/overview.md +141 -0
- package/docs/runtime-claude.md +190 -0
- package/docs/runtime-codex.md +197 -0
- package/docs/runtime-gemini.md +170 -0
- package/docs/runtime-qwen.md +147 -0
- package/docs/usage.md +312 -0
- package/gemini-extension.json +55 -0
- package/hooks/adapters/gemini-adapter.js +2 -0
- package/hooks/adapters/qwen-adapter.js +2 -0
- package/hooks/hook-runner.js +3 -0
- package/hooks/hooks.json +56 -0
- package/mcp/maestro-server.js +4 -0
- package/package.json +93 -0
- package/plugins/maestro/.app.json +3 -0
- package/plugins/maestro/.codex-plugin/plugin.json +41 -0
- package/plugins/maestro/.mcp.json +16 -0
- package/plugins/maestro/README.md +57 -0
- package/plugins/maestro/references/runtime-guide.md +125 -0
- package/plugins/maestro/skills/a11y-audit/SKILL.md +16 -0
- package/plugins/maestro/skills/archive/SKILL.md +16 -0
- package/plugins/maestro/skills/code-review/SKILL.md +6 -0
- package/plugins/maestro/skills/compliance-check/SKILL.md +16 -0
- package/plugins/maestro/skills/debug-workflow/SKILL.md +16 -0
- package/plugins/maestro/skills/delegation/SKILL.md +6 -0
- package/plugins/maestro/skills/design-dialogue/SKILL.md +6 -0
- package/plugins/maestro/skills/execute/SKILL.md +16 -0
- package/plugins/maestro/skills/execution/SKILL.md +6 -0
- package/plugins/maestro/skills/implementation-planning/SKILL.md +6 -0
- package/plugins/maestro/skills/orchestrate/SKILL.md +16 -0
- package/plugins/maestro/skills/perf-check/SKILL.md +16 -0
- package/plugins/maestro/skills/resume-session/SKILL.md +16 -0
- package/plugins/maestro/skills/review-code/SKILL.md +16 -0
- package/plugins/maestro/skills/security-audit/SKILL.md +16 -0
- package/plugins/maestro/skills/seo-audit/SKILL.md +16 -0
- package/plugins/maestro/skills/session-management/SKILL.md +6 -0
- package/plugins/maestro/skills/status/SKILL.md +14 -0
- package/plugins/maestro/skills/validation/SKILL.md +6 -0
- package/plugins/maestro/src/agents/accessibility-specialist.md +163 -0
- package/plugins/maestro/src/agents/analytics-engineer.md +182 -0
- package/plugins/maestro/src/agents/api-designer.md +124 -0
- package/plugins/maestro/src/agents/architect.md +120 -0
- package/plugins/maestro/src/agents/cloud-architect.md +134 -0
- package/plugins/maestro/src/agents/cobol-engineer.md +127 -0
- package/plugins/maestro/src/agents/code-reviewer.md +123 -0
- package/plugins/maestro/src/agents/coder.md +132 -0
- package/plugins/maestro/src/agents/compliance-reviewer.md +219 -0
- package/plugins/maestro/src/agents/content-strategist.md +111 -0
- package/plugins/maestro/src/agents/copywriter.md +113 -0
- package/plugins/maestro/src/agents/data-engineer.md +130 -0
- package/plugins/maestro/src/agents/database-administrator.md +126 -0
- package/plugins/maestro/src/agents/db2-dba.md +124 -0
- package/plugins/maestro/src/agents/debugger.md +133 -0
- package/plugins/maestro/src/agents/design-system-engineer.md +258 -0
- package/plugins/maestro/src/agents/devops-engineer.md +138 -0
- package/plugins/maestro/src/agents/hlasm-assembler-specialist.md +134 -0
- package/plugins/maestro/src/agents/i18n-specialist.md +241 -0
- package/plugins/maestro/src/agents/ibm-i-specialist.md +132 -0
- package/plugins/maestro/src/agents/integration-engineer.md +133 -0
- package/plugins/maestro/src/agents/ml-engineer.md +115 -0
- package/plugins/maestro/src/agents/mlops-engineer.md +116 -0
- package/plugins/maestro/src/agents/mobile-engineer.md +115 -0
- package/plugins/maestro/src/agents/observability-engineer.md +133 -0
- package/plugins/maestro/src/agents/performance-engineer.md +139 -0
- package/plugins/maestro/src/agents/platform-engineer.md +129 -0
- package/plugins/maestro/src/agents/product-manager.md +170 -0
- package/plugins/maestro/src/agents/prompt-engineer.md +129 -0
- package/plugins/maestro/src/agents/refactor.md +138 -0
- package/plugins/maestro/src/agents/release-manager.md +132 -0
- package/plugins/maestro/src/agents/security-engineer.md +143 -0
- package/plugins/maestro/src/agents/seo-specialist.md +129 -0
- package/plugins/maestro/src/agents/site-reliability-engineer.md +131 -0
- package/plugins/maestro/src/agents/solutions-architect.md +137 -0
- package/plugins/maestro/src/agents/technical-writer.md +129 -0
- package/plugins/maestro/src/agents/tester.md +135 -0
- package/plugins/maestro/src/agents/ux-designer.md +168 -0
- package/plugins/maestro/src/agents/zos-sysprog.md +134 -0
- package/plugins/maestro/src/config/setting-resolver.js +32 -0
- package/plugins/maestro/src/core/agent-registry.js +67 -0
- package/plugins/maestro/src/core/canonical-source.js +39 -0
- package/plugins/maestro/src/core/env-file-parser.js +82 -0
- package/plugins/maestro/src/core/feature-blocks.js +34 -0
- package/plugins/maestro/src/core/logger.js +12 -0
- package/plugins/maestro/src/core/markdown-state.js +36 -0
- package/plugins/maestro/src/core/policy-rules.js +32 -0
- package/plugins/maestro/src/core/project-root-resolver.js +184 -0
- package/plugins/maestro/src/core/stdin-reader.js +77 -0
- package/plugins/maestro/src/core/version.js +50 -0
- package/plugins/maestro/src/entry-points/core-command-registry.js +37 -0
- package/plugins/maestro/src/entry-points/preamble-builders.js +54 -0
- package/plugins/maestro/src/entry-points/registry.js +199 -0
- package/plugins/maestro/src/entry-points/templates/claude-core-command.md.tmpl +38 -0
- package/plugins/maestro/src/entry-points/templates/claude-skill.md.tmpl +18 -0
- package/plugins/maestro/src/entry-points/templates/codex-core-command.md.tmpl +16 -0
- package/plugins/maestro/src/entry-points/templates/codex-skill.md.tmpl +11 -0
- package/plugins/maestro/src/entry-points/templates/gemini-command.toml.tmpl +17 -0
- package/plugins/maestro/src/entry-points/templates/gemini-core-command.toml.tmpl +30 -0
- package/plugins/maestro/src/generated/agent-registry.json +630 -0
- package/plugins/maestro/src/generated/hook-registry.json +18 -0
- package/plugins/maestro/src/generated/resource-registry.json +16 -0
- package/plugins/maestro/src/hooks/logic/after-agent-logic.js +54 -0
- package/plugins/maestro/src/hooks/logic/before-agent-logic.js +57 -0
- package/plugins/maestro/src/hooks/logic/hook-state.js +127 -0
- package/plugins/maestro/src/hooks/logic/session-end-logic.js +17 -0
- package/plugins/maestro/src/hooks/logic/session-start-logic.js +25 -0
- package/plugins/maestro/src/lib/discovery/index.js +172 -0
- package/plugins/maestro/src/lib/errors/index.js +104 -0
- package/plugins/maestro/src/lib/framework-detection.js +50 -0
- package/plugins/maestro/src/lib/frontmatter/index.js +262 -0
- package/plugins/maestro/src/lib/io/index.js +96 -0
- package/plugins/maestro/src/lib/naming/index.js +94 -0
- package/plugins/maestro/src/lib/validation/index.js +124 -0
- package/plugins/maestro/src/lib/yaml-emit.js +38 -0
- package/plugins/maestro/src/mcp/content/provider.js +68 -0
- package/plugins/maestro/src/mcp/content/runtime-content.js +188 -0
- package/plugins/maestro/src/mcp/contracts/cache-path-rejector.js +39 -0
- package/plugins/maestro/src/mcp/contracts/downstream-context.js +106 -0
- package/plugins/maestro/src/mcp/contracts/plan-schema.js +148 -0
- package/plugins/maestro/src/mcp/contracts/workspace-marker.js +61 -0
- package/plugins/maestro/src/mcp/core/create-server.js +76 -0
- package/plugins/maestro/src/mcp/core/line-reader.js +35 -0
- package/plugins/maestro/src/mcp/core/project-root-cache.js +120 -0
- package/plugins/maestro/src/mcp/core/protocol-dispatcher.js +274 -0
- package/plugins/maestro/src/mcp/core/recovery-hints.js +43 -0
- package/plugins/maestro/src/mcp/core/tool-outcome.js +77 -0
- package/plugins/maestro/src/mcp/core/tool-registry.js +82 -0
- package/plugins/maestro/src/mcp/handlers/assess-task-complexity.js +108 -0
- package/plugins/maestro/src/mcp/handlers/blocker-parser.js +34 -0
- package/plugins/maestro/src/mcp/handlers/design-gate.js +393 -0
- package/plugins/maestro/src/mcp/handlers/get-agent.js +54 -0
- package/plugins/maestro/src/mcp/handlers/get-runtime-context.js +49 -0
- package/plugins/maestro/src/mcp/handlers/get-skill-content.js +51 -0
- package/plugins/maestro/src/mcp/handlers/initialize-workspace.js +45 -0
- package/plugins/maestro/src/mcp/handlers/reconciliation.js +224 -0
- package/plugins/maestro/src/mcp/handlers/resolve-settings.js +39 -0
- package/plugins/maestro/src/mcp/handlers/session-state-core.js +108 -0
- package/plugins/maestro/src/mcp/handlers/session-state-tools.js +562 -0
- package/plugins/maestro/src/mcp/handlers/validate-plan.js +76 -0
- package/plugins/maestro/src/mcp/maestro-server.js +122 -0
- package/plugins/maestro/src/mcp/runtime/runtime-config-map.js +70 -0
- package/plugins/maestro/src/mcp/tool-packs/content/index.js +80 -0
- package/plugins/maestro/src/mcp/tool-packs/contracts.js +30 -0
- package/plugins/maestro/src/mcp/tool-packs/index.js +15 -0
- package/plugins/maestro/src/mcp/tool-packs/session/index.js +243 -0
- package/plugins/maestro/src/mcp/tool-packs/workspace/index.js +98 -0
- package/plugins/maestro/src/mcp/utils/extension-root.js +31 -0
- package/plugins/maestro/src/mcp/validation/agent-checker.js +81 -0
- package/plugins/maestro/src/mcp/validation/dag-checker.js +214 -0
- package/plugins/maestro/src/mcp/validation/file-overlap-checker.js +63 -0
- package/plugins/maestro/src/mcp/validation/schema-checker.js +108 -0
- package/plugins/maestro/src/platforms/codex/runtime-config.js +58 -0
- package/plugins/maestro/src/platforms/shared/adapters/conventions.js +29 -0
- package/plugins/maestro/src/platforms/shared/adapters/exit-codes.js +6 -0
- package/plugins/maestro/src/platforms/shared/adapters/factory.js +40 -0
- package/plugins/maestro/src/platforms/shared/agent-names.js +10 -0
- package/plugins/maestro/src/platforms/shared/hook-runner.js +52 -0
- package/plugins/maestro/src/references/architecture.md +139 -0
- package/plugins/maestro/src/references/orchestration-steps.md +193 -0
- package/plugins/maestro/src/skills/shared/code-review/SKILL.md +145 -0
- package/plugins/maestro/src/skills/shared/delegation/SKILL.md +370 -0
- package/plugins/maestro/src/skills/shared/delegation/protocols/agent-base-protocol.md +145 -0
- package/plugins/maestro/src/skills/shared/delegation/protocols/filesystem-safety-protocol.md +31 -0
- package/plugins/maestro/src/skills/shared/design-dialogue/SKILL.md +284 -0
- package/plugins/maestro/src/skills/shared/execution/SKILL.md +258 -0
- package/plugins/maestro/src/skills/shared/implementation-planning/SKILL.md +303 -0
- package/plugins/maestro/src/skills/shared/session-management/SKILL.md +314 -0
- package/plugins/maestro/src/skills/shared/validation/SKILL.md +204 -0
- package/plugins/maestro/src/state/session-state.js +113 -0
- package/plugins/maestro/src/templates/design-document.md +95 -0
- package/plugins/maestro/src/templates/implementation-plan.md +86 -0
- package/plugins/maestro/src/templates/session-state.md +68 -0
- package/plugins/maestro/src/version.json +3 -0
- package/policies/maestro.toml +44 -0
- package/qwen/agents/accessibility_specialist.md +18 -0
- package/qwen/agents/analytics_engineer.md +20 -0
- package/qwen/agents/api_designer.md +17 -0
- package/qwen/agents/architect.md +17 -0
- package/qwen/agents/cloud_architect.md +17 -0
- package/qwen/agents/cobol_engineer.md +20 -0
- package/qwen/agents/code_reviewer.md +15 -0
- package/qwen/agents/coder.md +20 -0
- package/qwen/agents/compliance_reviewer.md +17 -0
- package/qwen/agents/content_strategist.md +17 -0
- package/qwen/agents/copywriter.md +17 -0
- package/qwen/agents/data_engineer.md +20 -0
- package/qwen/agents/database_administrator.md +19 -0
- package/qwen/agents/db2_dba.md +19 -0
- package/qwen/agents/debugger.md +17 -0
- package/qwen/agents/design_system_engineer.md +20 -0
- package/qwen/agents/devops_engineer.md +21 -0
- package/qwen/agents/hlasm_assembler_specialist.md +20 -0
- package/qwen/agents/i18n_specialist.md +19 -0
- package/qwen/agents/ibm_i_specialist.md +20 -0
- package/qwen/agents/integration_engineer.md +21 -0
- package/qwen/agents/ml_engineer.md +21 -0
- package/qwen/agents/mlops_engineer.md +21 -0
- package/qwen/agents/mobile_engineer.md +21 -0
- package/qwen/agents/observability_engineer.md +21 -0
- package/qwen/agents/performance_engineer.md +19 -0
- package/qwen/agents/platform_engineer.md +22 -0
- package/qwen/agents/product_manager.md +18 -0
- package/qwen/agents/prompt_engineer.md +20 -0
- package/qwen/agents/refactor.md +20 -0
- package/qwen/agents/release_manager.md +20 -0
- package/qwen/agents/security_engineer.md +19 -0
- package/qwen/agents/seo_specialist.md +19 -0
- package/qwen/agents/site_reliability_engineer.md +19 -0
- package/qwen/agents/solutions_architect.md +17 -0
- package/qwen/agents/technical_writer.md +19 -0
- package/qwen/agents/tester.md +21 -0
- package/qwen/agents/ux_designer.md +18 -0
- package/qwen/agents/zos_sysprog.md +19 -0
- package/qwen/hooks.json +56 -0
- package/qwen-extension.json +55 -0
- package/scripts/check-layer-boundaries.js +74 -0
- package/scripts/generate.js +155 -0
- package/scripts/install-codex-plugin.js +167 -0
- package/scripts/install-git-hooks.js +43 -0
- package/scripts/npm-publish-idempotent.js +150 -0
- package/scripts/package-release-artifacts.js +156 -0
- package/scripts/release-artifact-manifest.js +378 -0
- package/scripts/release-version-metadata.js +129 -0
- package/scripts/update-versions.js +33 -0
- package/scripts/verify-npm-pack.js +85 -0
- package/scripts/verify-release-artifacts.js +95 -0
- package/src/agents/accessibility-specialist.md +163 -0
- package/src/agents/analytics-engineer.md +182 -0
- package/src/agents/api-designer.md +124 -0
- package/src/agents/architect.md +120 -0
- package/src/agents/cloud-architect.md +134 -0
- package/src/agents/cobol-engineer.md +127 -0
- package/src/agents/code-reviewer.md +123 -0
- package/src/agents/coder.md +132 -0
- package/src/agents/compliance-reviewer.md +219 -0
- package/src/agents/content-strategist.md +111 -0
- package/src/agents/copywriter.md +113 -0
- package/src/agents/data-engineer.md +130 -0
- package/src/agents/database-administrator.md +126 -0
- package/src/agents/db2-dba.md +124 -0
- package/src/agents/debugger.md +133 -0
- package/src/agents/design-system-engineer.md +258 -0
- package/src/agents/devops-engineer.md +138 -0
- package/src/agents/hlasm-assembler-specialist.md +134 -0
- package/src/agents/i18n-specialist.md +241 -0
- package/src/agents/ibm-i-specialist.md +132 -0
- package/src/agents/integration-engineer.md +133 -0
- package/src/agents/ml-engineer.md +115 -0
- package/src/agents/mlops-engineer.md +116 -0
- package/src/agents/mobile-engineer.md +115 -0
- package/src/agents/observability-engineer.md +133 -0
- package/src/agents/performance-engineer.md +139 -0
- package/src/agents/platform-engineer.md +129 -0
- package/src/agents/product-manager.md +170 -0
- package/src/agents/prompt-engineer.md +129 -0
- package/src/agents/refactor.md +138 -0
- package/src/agents/release-manager.md +132 -0
- package/src/agents/security-engineer.md +143 -0
- package/src/agents/seo-specialist.md +129 -0
- package/src/agents/site-reliability-engineer.md +131 -0
- package/src/agents/solutions-architect.md +137 -0
- package/src/agents/technical-writer.md +129 -0
- package/src/agents/tester.md +135 -0
- package/src/agents/ux-designer.md +168 -0
- package/src/agents/zos-sysprog.md +134 -0
- package/src/config/setting-resolver.js +32 -0
- package/src/core/agent-registry.js +67 -0
- package/src/core/canonical-source.js +39 -0
- package/src/core/env-file-parser.js +82 -0
- package/src/core/feature-blocks.js +34 -0
- package/src/core/logger.js +12 -0
- package/src/core/markdown-state.js +36 -0
- package/src/core/policy-rules.js +32 -0
- package/src/core/project-root-resolver.js +184 -0
- package/src/core/stdin-reader.js +77 -0
- package/src/core/version.js +50 -0
- package/src/entry-points/core-command-registry.js +37 -0
- package/src/entry-points/preamble-builders.js +54 -0
- package/src/entry-points/registry.js +199 -0
- package/src/entry-points/templates/claude-core-command.md.tmpl +38 -0
- package/src/entry-points/templates/claude-skill.md.tmpl +18 -0
- package/src/entry-points/templates/codex-core-command.md.tmpl +16 -0
- package/src/entry-points/templates/codex-skill.md.tmpl +11 -0
- package/src/entry-points/templates/gemini-command.toml.tmpl +17 -0
- package/src/entry-points/templates/gemini-core-command.toml.tmpl +30 -0
- package/src/generated/agent-registry.json +630 -0
- package/src/generated/hook-registry.json +18 -0
- package/src/generated/resource-registry.json +16 -0
- package/src/generator/entry-point-expander.js +182 -0
- package/src/generator/file-writer.js +167 -0
- package/src/generator/generation-session.js +62 -0
- package/src/generator/manifest-curator.js +31 -0
- package/src/generator/manifest-expander.js +256 -0
- package/src/generator/payload-builder.js +217 -0
- package/src/generator/registry-scanner.js +130 -0
- package/src/generator/stale-pruner.js +101 -0
- package/src/hooks/logic/after-agent-logic.js +54 -0
- package/src/hooks/logic/before-agent-logic.js +57 -0
- package/src/hooks/logic/hook-state.js +127 -0
- package/src/hooks/logic/session-end-logic.js +17 -0
- package/src/hooks/logic/session-start-logic.js +25 -0
- package/src/lib/discovery/index.js +172 -0
- package/src/lib/errors/index.js +104 -0
- package/src/lib/framework-detection.js +50 -0
- package/src/lib/frontmatter/index.js +262 -0
- package/src/lib/io/index.js +96 -0
- package/src/lib/naming/index.js +94 -0
- package/src/lib/validation/index.js +124 -0
- package/src/lib/yaml-emit.js +38 -0
- package/src/manifest.js +11 -0
- package/src/mcp/content/provider.js +68 -0
- package/src/mcp/content/runtime-content.js +188 -0
- package/src/mcp/contracts/cache-path-rejector.js +39 -0
- package/src/mcp/contracts/downstream-context.js +106 -0
- package/src/mcp/contracts/plan-schema.js +148 -0
- package/src/mcp/contracts/workspace-marker.js +61 -0
- package/src/mcp/core/create-server.js +76 -0
- package/src/mcp/core/line-reader.js +35 -0
- package/src/mcp/core/project-root-cache.js +120 -0
- package/src/mcp/core/protocol-dispatcher.js +274 -0
- package/src/mcp/core/recovery-hints.js +43 -0
- package/src/mcp/core/tool-outcome.js +77 -0
- package/src/mcp/core/tool-registry.js +82 -0
- package/src/mcp/handlers/assess-task-complexity.js +108 -0
- package/src/mcp/handlers/blocker-parser.js +34 -0
- package/src/mcp/handlers/design-gate.js +393 -0
- package/src/mcp/handlers/get-agent.js +54 -0
- package/src/mcp/handlers/get-runtime-context.js +49 -0
- package/src/mcp/handlers/get-skill-content.js +51 -0
- package/src/mcp/handlers/initialize-workspace.js +45 -0
- package/src/mcp/handlers/reconciliation.js +224 -0
- package/src/mcp/handlers/resolve-settings.js +39 -0
- package/src/mcp/handlers/session-state-core.js +108 -0
- package/src/mcp/handlers/session-state-tools.js +562 -0
- package/src/mcp/handlers/validate-plan.js +76 -0
- package/src/mcp/maestro-server.js +122 -0
- package/src/mcp/runtime/runtime-config-map.js +70 -0
- package/src/mcp/tool-packs/content/index.js +80 -0
- package/src/mcp/tool-packs/contracts.js +30 -0
- package/src/mcp/tool-packs/index.js +15 -0
- package/src/mcp/tool-packs/session/index.js +243 -0
- package/src/mcp/tool-packs/workspace/index.js +98 -0
- package/src/mcp/utils/extension-root.js +31 -0
- package/src/mcp/validation/agent-checker.js +81 -0
- package/src/mcp/validation/dag-checker.js +214 -0
- package/src/mcp/validation/file-overlap-checker.js +63 -0
- package/src/mcp/validation/schema-checker.js +108 -0
- package/src/platforms/claude/metadata.js +96 -0
- package/src/platforms/claude/runtime-config.js +60 -0
- package/src/platforms/codex/metadata.js +107 -0
- package/src/platforms/codex/runtime-config.js +58 -0
- package/src/platforms/gemini/metadata.js +27 -0
- package/src/platforms/gemini/runtime-config.js +62 -0
- package/src/platforms/metadata-shared.js +131 -0
- package/src/platforms/metadata.js +29 -0
- package/src/platforms/qwen/metadata.js +27 -0
- package/src/platforms/qwen/runtime-config.js +62 -0
- package/src/platforms/shared/adapters/claude-adapter.js +36 -0
- package/src/platforms/shared/adapters/conventions.js +29 -0
- package/src/platforms/shared/adapters/exit-codes.js +6 -0
- package/src/platforms/shared/adapters/factory.js +40 -0
- package/src/platforms/shared/adapters/gemini-adapter.js +34 -0
- package/src/platforms/shared/adapters/qwen-adapter.js +93 -0
- package/src/platforms/shared/agent-names.js +10 -0
- package/src/platforms/shared/hook-runner.js +52 -0
- package/src/references/architecture.md +139 -0
- package/src/references/orchestration-steps.md +193 -0
- package/src/scripts/ensure-workspace.js +14 -0
- package/src/scripts/read-active-session.js +26 -0
- package/src/scripts/read-setting.js +18 -0
- package/src/scripts/read-state.js +17 -0
- package/src/scripts/write-state.js +22 -0
- package/src/skills/shared/code-review/SKILL.md +145 -0
- package/src/skills/shared/delegation/SKILL.md +370 -0
- package/src/skills/shared/delegation/protocols/agent-base-protocol.md +145 -0
- package/src/skills/shared/delegation/protocols/filesystem-safety-protocol.md +31 -0
- package/src/skills/shared/design-dialogue/SKILL.md +284 -0
- package/src/skills/shared/execution/SKILL.md +258 -0
- package/src/skills/shared/implementation-planning/SKILL.md +303 -0
- package/src/skills/shared/session-management/SKILL.md +314 -0
- package/src/skills/shared/validation/SKILL.md +204 -0
- package/src/state/session-state.js +113 -0
- package/src/templates/design-document.md +95 -0
- package/src/templates/implementation-plan.md +86 -0
- package/src/templates/session-state.md +68 -0
- package/src/transforms/agent-stub.js +29 -0
- package/src/transforms/extract-examples.js +63 -0
- package/src/transforms/index.js +35 -0
- package/src/transforms/parse-frontmatter.js +23 -0
- package/src/transforms/rebuild-frontmatter.js +147 -0
- package/src/transforms/skill-discovery-stub.js +27 -0
- package/src/transforms/skill-metadata.js +14 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zos-sysprog
|
|
3
|
+
description: "z/OS systems programming specialist for JCL, USS, SMP/E, RACF, subsystem diagnostics, and batch scheduling. Use when the task requires JCL authoring or review, z/OS Unix System Services setup, SMP/E maintenance, RACF profile review, or diagnosing SYSLOG/OPERLOG issues. For example: writing a JCL restart procedure, planning an SMP/E PTF install, or reviewing RACF dataset profiles for least privilege."
|
|
4
|
+
color: slate
|
|
5
|
+
tools: [read_file, list_directory, glob, grep_search, run_shell_command, google_web_search, read_many_files, write_todos, ask_user, web_fetch]
|
|
6
|
+
tools.gemini: [read_file, list_directory, glob, grep_search, run_shell_command, google_web_search, read_many_files, write_todos, ask_user, web_fetch]
|
|
7
|
+
tools.claude: [Read, Bash, Glob, Grep, WebSearch, WebFetch, TaskCreate, TaskUpdate, TaskList]
|
|
8
|
+
max_turns: 20
|
|
9
|
+
temperature: 0.2
|
|
10
|
+
timeout_mins: 8
|
|
11
|
+
capabilities: read_shell
|
|
12
|
+
---
|
|
13
|
+
<!-- @feature exampleBlocks -->
|
|
14
|
+
<example>
|
|
15
|
+
Context: User needs JCL or job scheduling reviewed.
|
|
16
|
+
user: "Review this JCL for our nightly batch; it keeps ABENDing on step 3 with S0C4"
|
|
17
|
+
assistant: "I'll check the DCB attributes, dataset allocation, REGION size, and step conditional logic, then cross-reference the S0C4 against the compile listing to locate the failing module."
|
|
18
|
+
<commentary>
|
|
19
|
+
z/OS Sysprog is appropriate for JCL/ABEND diagnostics and resource allocation issues.
|
|
20
|
+
</commentary>
|
|
21
|
+
</example>
|
|
22
|
+
|
|
23
|
+
<example>
|
|
24
|
+
Context: User needs a RACF review for a new application.
|
|
25
|
+
user: "Review the RACF profiles for our new app's datasets and started task"
|
|
26
|
+
assistant: "I'll audit dataset profiles for least privilege, check the STC identity's OMVS segment and UID, verify generic profile coverage, and flag any UACC above NONE."
|
|
27
|
+
<commentary>
|
|
28
|
+
z/OS Sysprog handles RACF review and security posture for z/OS resources.
|
|
29
|
+
</commentary>
|
|
30
|
+
</example>
|
|
31
|
+
<!-- @end-feature -->
|
|
32
|
+
|
|
33
|
+
You are a **z/OS Systems Programmer** specializing in mainframe system services: JCL, JES, USS, SMP/E, RACF, and subsystem operations. You keep the platform stable and changes auditable.
|
|
34
|
+
|
|
35
|
+
**Methodology:**
|
|
36
|
+
- Read SYSLOG/OPERLOG messages with the explicit message ID; do not paraphrase
|
|
37
|
+
- Confirm the LPAR, sysplex, and subsystem context before suggesting actions
|
|
38
|
+
- Prefer generic RACF profiles over discrete ones; maintain least privilege
|
|
39
|
+
- Test SMP/E and JCL changes in the development LPAR with the same maintenance stream
|
|
40
|
+
- Document restart points in JCL; never assume a job runs end-to-end
|
|
41
|
+
- Treat SMF and audit logs as forensic records; never truncate or suppress
|
|
42
|
+
|
|
43
|
+
**Work Areas:**
|
|
44
|
+
- JCL authoring and review: job streams, procs, conditional (IF/THEN/ELSE, COND)
|
|
45
|
+
- JES2/JES3 job management, output classes, spool administration
|
|
46
|
+
- USS (z/OS Unix System Services): BPXPRMxx, file system management, OMVS segments
|
|
47
|
+
- SMP/E: APPLY/ACCEPT, HOLDDATA, SYSMOD lifecycle, CSI management
|
|
48
|
+
- RACF: dataset profiles, general resource classes, STARTED class, OMVS segments, UACC review
|
|
49
|
+
- Subsystem operations: CICS, IMS, DB2, MQ — start/stop, parm libraries
|
|
50
|
+
- Diagnostics: SVC dumps, SLIP traps, IPCS, SYSLOG/OPERLOG analysis
|
|
51
|
+
|
|
52
|
+
**Constraints:**
|
|
53
|
+
- Read-only + shell for diagnostics (TSO, USS); do not execute privileged commands or apply SMP/E without explicit approval
|
|
54
|
+
- Never grant RACF UACC above NONE on production datasets
|
|
55
|
+
- Never bypass SMP/E by installing maintenance outside the managed stream
|
|
56
|
+
- All JCL changes preserve restart and rerun capability
|
|
57
|
+
- Follow the shop's dataset naming and JOB card standards exactly
|
|
58
|
+
|
|
59
|
+
## Decision Frameworks
|
|
60
|
+
|
|
61
|
+
### ABEND Diagnosis Protocol
|
|
62
|
+
1. Capture the ABEND code, REASON CODE, PSW, and failing module from SYSOUT/JESJCL
|
|
63
|
+
2. For S0Cx: map to the protection exception type (S0C1 operation, S0C4 protection, S0C7 data) and locate the failing PSW in the compile listing or load module
|
|
64
|
+
3. For Sxxx with a user code: look up the application's documented abend dictionary
|
|
65
|
+
4. For SMS/VSAM abends: inspect DCB attributes, dataset allocation, and catalog state
|
|
66
|
+
5. Propose the smallest change that addresses the root cause; avoid wholesale JCL rewrites
|
|
67
|
+
|
|
68
|
+
### JCL Review Checklist
|
|
69
|
+
For every production JCL:
|
|
70
|
+
- JOB card has correct class, CLASS, MSGCLASS, REGION, NOTIFY, and accounting
|
|
71
|
+
- DD statements have complete DCB where needed; GDG generations used for mutable datasets
|
|
72
|
+
- COND / IF-THEN-ELSE guards destructive steps
|
|
73
|
+
- Restart parameter (RESTART= or step-level RD=) defined
|
|
74
|
+
- SYSOUT routed to the agreed output class
|
|
75
|
+
- No hard-coded passwords, userids, or production volume serials
|
|
76
|
+
|
|
77
|
+
### RACF Profile Review
|
|
78
|
+
For every resource:
|
|
79
|
+
1. Check UACC — must be NONE on production datasets and general resources
|
|
80
|
+
2. Check WARNING mode — should be OFF outside of a documented migration window
|
|
81
|
+
3. Check the access list — prefer groups over discrete user IDs
|
|
82
|
+
4. Generic profile coverage — every discrete profile should be justified
|
|
83
|
+
5. OMVS segment presence on IDs that use USS; UID/GID assigned by the registry, not ad-hoc
|
|
84
|
+
|
|
85
|
+
### SMP/E Change Protocol
|
|
86
|
+
1. Read the associated HOLDDATA and cover letter before RECEIVE
|
|
87
|
+
2. APPLY CHECK on the development LPAR; resolve holds and requisites
|
|
88
|
+
3. APPLY on development; validate subsystems restart cleanly
|
|
89
|
+
4. Schedule ACCEPT only after a stability window has passed
|
|
90
|
+
5. Maintain backout via SMP/E RESTORE; do not hand-edit target libraries
|
|
91
|
+
|
|
92
|
+
### Batch Restart Design
|
|
93
|
+
- Every multi-step job defines a restart point at each checkpoint
|
|
94
|
+
- Restart does not rerun completed steps that are non-idempotent
|
|
95
|
+
- Datasets that must be reset on restart are explicitly allocated on the restart step
|
|
96
|
+
- The operations runbook documents the restart procedure with JCL parameters
|
|
97
|
+
|
|
98
|
+
## Anti-Patterns
|
|
99
|
+
|
|
100
|
+
- Setting UACC(READ) or UACC(UPDATE) on production datasets
|
|
101
|
+
- Granting ALTER access on production datasets to application users
|
|
102
|
+
- Hand-editing SMP/E target libraries to apply urgent fixes
|
|
103
|
+
- Using RD=R on jobs with non-idempotent steps (data would be double-processed)
|
|
104
|
+
- Suppressing SYSOUT to reduce storage without an alternative audit trail
|
|
105
|
+
- Running destructive utilities (DFDSS DUMP with DELETE, IEHPROGM SCRATCH) without a backup
|
|
106
|
+
|
|
107
|
+
## Downstream Consumers
|
|
108
|
+
|
|
109
|
+
- `cobol-engineer`: Needs region size, dataset allocation, and JCL template for new batch programs
|
|
110
|
+
- `db2-dba`: Needs STC identity, resource-class profiles, and subsystem parm library pointers
|
|
111
|
+
- `security-engineer`: Needs RACF audit evidence and SMF record availability for external review
|
|
112
|
+
|
|
113
|
+
## Output Contract
|
|
114
|
+
|
|
115
|
+
When completing your task, conclude with a **Handoff Report** containing two parts:
|
|
116
|
+
|
|
117
|
+
## Task Report
|
|
118
|
+
- **Status**: success | partial | failure
|
|
119
|
+
- **Objective Achieved**: [One sentence restating the task objective and whether it was fully met]
|
|
120
|
+
- **Files Created**: [Absolute paths with one-line purpose each, or "none"]
|
|
121
|
+
- **Files Modified**: [Absolute paths with one-line summary of what changed and why, or "none"]
|
|
122
|
+
- **Files Deleted**: [Absolute paths with rationale, or "none"]
|
|
123
|
+
- **Decisions Made**: [Choices made that were not explicitly specified in the delegation prompt, with rationale for each, or "none"]
|
|
124
|
+
- **Validation**: pass | fail | skipped
|
|
125
|
+
- **Validation Output**: [Command output or "N/A"]
|
|
126
|
+
- **Errors**: [List with type, description, and resolution status, or "none"]
|
|
127
|
+
- **Scope Deviations**: [Anything asked but not completed, or additional necessary work discovered but not performed, or "none"]
|
|
128
|
+
|
|
129
|
+
## Downstream Context
|
|
130
|
+
- **Key Interfaces Introduced**: [Type signatures and file locations, or "none"]
|
|
131
|
+
- **Patterns Established**: [New patterns that downstream agents must follow for consistency, or "none"]
|
|
132
|
+
- **Integration Points**: [Where and how downstream work should connect to this output, or "none"]
|
|
133
|
+
- **Assumptions**: [Anything assumed that downstream agents should verify, or "none"]
|
|
134
|
+
- **Warnings**: [Gotchas, edge cases, or fragile areas downstream agents should be aware of, or "none"]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { parseEnvFile } = require('../core/env-file-parser');
|
|
5
|
+
|
|
6
|
+
function resolveSetting(varName, projectRoot) {
|
|
7
|
+
const envValue = process.env[varName];
|
|
8
|
+
if (envValue !== undefined && envValue !== '') return envValue;
|
|
9
|
+
|
|
10
|
+
if (typeof projectRoot === 'string' && projectRoot.length > 0) {
|
|
11
|
+
const projectEnv = parseEnvFile(path.join(projectRoot, '.env'));
|
|
12
|
+
if (projectEnv[varName] !== undefined && projectEnv[varName] !== '') {
|
|
13
|
+
return projectEnv[varName];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Intentionally bypasses the runtime-config abstraction: setting
|
|
18
|
+
// resolution runs before a runtime is selected, so it cannot ask a
|
|
19
|
+
// runtime-config for `env.extensionPath`. MAESTRO_EXTENSION_PATH is
|
|
20
|
+
// the documented canonical override; CLAUDE_PLUGIN_ROOT is kept as a
|
|
21
|
+
// fallback because Claude injects it automatically from the plugin
|
|
22
|
+
// loader.
|
|
23
|
+
const extensionRoot = process.env.MAESTRO_EXTENSION_PATH || process.env.CLAUDE_PLUGIN_ROOT;
|
|
24
|
+
if (extensionRoot) {
|
|
25
|
+
const extEnv = parseEnvFile(path.join(extensionRoot, '.env'));
|
|
26
|
+
if (extEnv[varName] !== undefined && extEnv[varName] !== '') return extEnv[varName];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = { resolveSetting };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { toSnakeCase } = require('../lib/naming');
|
|
4
|
+
const agentRegistryData = require('../generated/agent-registry.json');
|
|
5
|
+
|
|
6
|
+
const KNOWN_AGENTS = Object.freeze(
|
|
7
|
+
agentRegistryData.map((entry) => toSnakeCase(entry.name))
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
const AGENT_CAPABILITIES = Object.freeze(
|
|
11
|
+
Object.fromEntries(
|
|
12
|
+
agentRegistryData.map((entry) => [toSnakeCase(entry.name), entry.capabilities])
|
|
13
|
+
)
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
function normalizeAgentName(name) {
|
|
17
|
+
if (typeof name !== 'string') return '';
|
|
18
|
+
return toSnakeCase(name.toLowerCase());
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const AGENT_PATTERNS = KNOWN_AGENTS.map((agent) => {
|
|
22
|
+
const escaped = agent.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
23
|
+
const aliasPattern = escaped.replace(/_/g, '[-_]');
|
|
24
|
+
return {
|
|
25
|
+
agent,
|
|
26
|
+
patterns: [
|
|
27
|
+
new RegExp(`(?:delegate|transfer|hand\\s*off|dispatch|invoke)\\s+(?:to\\s+)?(?:the\\s+)?${aliasPattern}\\b`),
|
|
28
|
+
new RegExp(`@${aliasPattern}\\b`),
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
function detectAgentFromPrompt(prompt) {
|
|
34
|
+
if (typeof prompt === 'string') {
|
|
35
|
+
const headerMatch = prompt.match(/(?:^|\n)\s*agent:\s*([a-z0-9_-]+)/i);
|
|
36
|
+
const headerAgent = normalizeAgentName(headerMatch?.[1] || '');
|
|
37
|
+
if (headerAgent && KNOWN_AGENTS.includes(headerAgent)) {
|
|
38
|
+
return headerAgent;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const envAgent = normalizeAgentName(process.env.MAESTRO_CURRENT_AGENT);
|
|
43
|
+
if (envAgent && KNOWN_AGENTS.includes(envAgent)) return envAgent;
|
|
44
|
+
|
|
45
|
+
if (!prompt) return '';
|
|
46
|
+
|
|
47
|
+
const lower = prompt.toLowerCase();
|
|
48
|
+
for (const { agent, patterns } of AGENT_PATTERNS) {
|
|
49
|
+
if (patterns.some((p) => p.test(lower))) {
|
|
50
|
+
return agent;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return '';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function getAgentCapability(name) {
|
|
58
|
+
const normalized = normalizeAgentName(name);
|
|
59
|
+
return AGENT_CAPABILITIES[normalized] || null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function canCreateFiles(name) {
|
|
63
|
+
const cap = getAgentCapability(name);
|
|
64
|
+
return cap === 'read_write' || cap === 'full';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = { KNOWN_AGENTS, AGENT_CAPABILITIES, normalizeAgentName, detectAgentFromPrompt, getAgentCapability, canCreateFiles };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
function hasCanonicalSrcRoot(candidateRoot) {
|
|
7
|
+
return fs.existsSync(path.join(candidateRoot, 'src', 'mcp', 'maestro-server.js'));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function resolveCanonicalProjectRoot(startDir = process.cwd()) {
|
|
11
|
+
let current = path.resolve(startDir);
|
|
12
|
+
|
|
13
|
+
while (true) {
|
|
14
|
+
if (hasCanonicalSrcRoot(current)) {
|
|
15
|
+
return current;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const parent = path.dirname(current);
|
|
19
|
+
if (parent === current) {
|
|
20
|
+
throw new Error(`Unable to locate canonical src/ from "${startDir}"`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
current = parent;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function resolveCanonicalSrcRoot(startDir = process.cwd()) {
|
|
28
|
+
return path.join(resolveCanonicalProjectRoot(startDir), 'src');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function requireFromCanonicalSrc(relativePath, startDir = process.cwd()) {
|
|
32
|
+
return require(path.join(resolveCanonicalSrcRoot(startDir), relativePath));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = {
|
|
36
|
+
requireFromCanonicalSrc,
|
|
37
|
+
resolveCanonicalProjectRoot,
|
|
38
|
+
resolveCanonicalSrcRoot,
|
|
39
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { readFileSafe } = require('../lib/io');
|
|
4
|
+
|
|
5
|
+
function trimQuotes(value) {
|
|
6
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
7
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
8
|
+
return value.slice(1, -1);
|
|
9
|
+
}
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function stripInlineComment(value) {
|
|
14
|
+
let activeQuote = '';
|
|
15
|
+
for (let i = 0; i < value.length; i++) {
|
|
16
|
+
const ch = value[i];
|
|
17
|
+
if (activeQuote) {
|
|
18
|
+
if (ch === activeQuote && value[i - 1] !== '\\') {
|
|
19
|
+
activeQuote = '';
|
|
20
|
+
}
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (ch === '"' || ch === "'") {
|
|
24
|
+
activeQuote = ch;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (ch === '#' && i > 0 && /\s/.test(value[i - 1])) {
|
|
28
|
+
return value.slice(0, i).trimEnd();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function parseEnvFile(filePath) {
|
|
35
|
+
const result = {};
|
|
36
|
+
const content = readFileSafe(filePath, null);
|
|
37
|
+
if (content === null) {
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
const lines = content.split('\n');
|
|
41
|
+
let i = 0;
|
|
42
|
+
while (i < lines.length) {
|
|
43
|
+
const trimmed = lines[i].trim();
|
|
44
|
+
if (!trimmed || trimmed.startsWith('#')) { i++; continue; }
|
|
45
|
+
const stripped = trimmed.replace(/^export\s+/, '');
|
|
46
|
+
const eqIndex = stripped.indexOf('=');
|
|
47
|
+
if (eqIndex === -1) { i++; continue; }
|
|
48
|
+
const key = stripped.slice(0, eqIndex);
|
|
49
|
+
if (!key) { i++; continue; }
|
|
50
|
+
let rawValue = stripped.slice(eqIndex + 1);
|
|
51
|
+
|
|
52
|
+
// Multi-line: value starts with " but has no closing " on the same line
|
|
53
|
+
if (rawValue.startsWith('"') && rawValue.indexOf('"', 1) === -1) {
|
|
54
|
+
const valueParts = [rawValue.slice(1)];
|
|
55
|
+
i++;
|
|
56
|
+
let closed = false;
|
|
57
|
+
while (i < lines.length) {
|
|
58
|
+
const nextLine = lines[i];
|
|
59
|
+
if (nextLine.endsWith('"') && !nextLine.endsWith('\\"')) {
|
|
60
|
+
valueParts.push(nextLine.slice(0, -1));
|
|
61
|
+
closed = true;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
valueParts.push(nextLine);
|
|
65
|
+
i++;
|
|
66
|
+
}
|
|
67
|
+
if (!closed) {
|
|
68
|
+
console.warn(`env-file-parser: unclosed quote for key "${key}", treating accumulated content as value`);
|
|
69
|
+
}
|
|
70
|
+
result[key] = valueParts.join('\n');
|
|
71
|
+
i++;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
rawValue = stripInlineComment(rawValue);
|
|
76
|
+
result[key] = trimQuotes(rawValue);
|
|
77
|
+
i++;
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
module.exports = { parseEnvFile };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const FEATURE_BLOCK_REGEX =
|
|
4
|
+
/^[ \t]*<!-- @feature (\S+) -->\n([\s\S]*?)^[ \t]*<!-- @end-feature -->\n?/gm;
|
|
5
|
+
|
|
6
|
+
const COLLAPSED_NEWLINE_REGEX = /\n{3,}/g;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {string} content - Markdown content potentially containing feature blocks
|
|
10
|
+
* @param {Record<string, boolean>} features - Map of feature flag names to boolean inclusion values
|
|
11
|
+
* @param {{ mode?: 'strict' | 'lenient' }} [opts] - Configuration options
|
|
12
|
+
* @returns {string} Content with feature blocks resolved and excess newlines collapsed
|
|
13
|
+
* @throws {Error} In strict mode, when a feature flag is not present in the features object
|
|
14
|
+
*/
|
|
15
|
+
function stripFeatureBlocks(content, features, opts) {
|
|
16
|
+
const mode = (opts && opts.mode) || 'strict';
|
|
17
|
+
|
|
18
|
+
const replaced = content.replace(
|
|
19
|
+
FEATURE_BLOCK_REGEX,
|
|
20
|
+
(_match, flagName, body) => {
|
|
21
|
+
if (!(flagName in features)) {
|
|
22
|
+
if (mode === 'strict') {
|
|
23
|
+
throw new Error(`Unknown feature flag: "${flagName}"`);
|
|
24
|
+
}
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
return features[flagName] ? body : '';
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
return replaced.replace(COLLAPSED_NEWLINE_REGEX, '\n\n');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = { stripFeatureBlocks };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const FRONTMATTER_PATTERN = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Serializes structured data and a body string into the
|
|
7
|
+
* JSON-frontmatter format used by session state files.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} data - JSON-serializable data for the frontmatter block
|
|
10
|
+
* @param {string} [body] - Optional body content placed after the closing delimiter
|
|
11
|
+
* @returns {string} The formatted session state string
|
|
12
|
+
*/
|
|
13
|
+
function serialize(data, body) {
|
|
14
|
+
return `---\n${JSON.stringify(data, null, 2)}\n---\n${body || ''}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Parses a session state string containing JSON frontmatter and an optional body.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} content - Raw session state content with `---` delimiters
|
|
21
|
+
* @returns {{ data: Object, body: string }} Parsed frontmatter data and body content
|
|
22
|
+
* @throws {Error} When no frontmatter delimiters are found in the content
|
|
23
|
+
*/
|
|
24
|
+
function parse(content) {
|
|
25
|
+
const match = content.match(FRONTMATTER_PATTERN);
|
|
26
|
+
if (!match) {
|
|
27
|
+
throw new Error('No YAML frontmatter found in session state');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
data: JSON.parse(match[1]),
|
|
32
|
+
body: match[2],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = { serialize, parse };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Canonical policy rules for Maestro command safety enforcement.
|
|
5
|
+
* Used by:
|
|
6
|
+
* - claude/scripts/policy-enforcer.js (Claude Code PreToolUse hook)
|
|
7
|
+
* - policies/maestro.toml (Gemini CLI policy pack — generated separately)
|
|
8
|
+
*
|
|
9
|
+
* Rule shapes:
|
|
10
|
+
* { matchType: 'prefix' | 'regex' | 'word', pattern: string, reason: string }
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const DENY_RULES = Object.freeze([
|
|
14
|
+
{ matchType: 'prefix', pattern: 'rm -rf', reason: 'Recursive force delete' },
|
|
15
|
+
{ matchType: 'prefix', pattern: 'rm -fr', reason: 'Recursive force delete (flag reorder)' },
|
|
16
|
+
{ matchType: 'prefix', pattern: 'sudo rm -rf', reason: 'Privileged recursive force delete' },
|
|
17
|
+
{ matchType: 'prefix', pattern: 'sudo rm -fr', reason: 'Privileged recursive force delete (flag reorder)' },
|
|
18
|
+
{ matchType: 'prefix', pattern: 'git reset --hard', reason: 'Discards uncommitted changes' },
|
|
19
|
+
{ matchType: 'prefix', pattern: 'git checkout --', reason: 'Discards uncommitted file changes' },
|
|
20
|
+
{ matchType: 'prefix', pattern: 'git clean -fd', reason: 'Removes untracked files permanently' },
|
|
21
|
+
{ matchType: 'prefix', pattern: 'git clean -df', reason: 'Removes untracked files permanently (flag reorder)' },
|
|
22
|
+
{ matchType: 'prefix', pattern: 'git clean -xfd', reason: 'Removes untracked and ignored files permanently' },
|
|
23
|
+
{ matchType: 'prefix', pattern: 'git clean -xdf', reason: 'Removes untracked and ignored files permanently (flag reorder)' },
|
|
24
|
+
{ matchType: 'regex', pattern: '<<', reason: 'Heredoc corrupts structured content (YAML, Markdown, JSON) — use write_file instead' },
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
const ASK_RULES = Object.freeze([
|
|
28
|
+
{ matchType: 'word', pattern: 'tee', reason: 'Writes to file and stdout' },
|
|
29
|
+
{ matchType: 'regex', pattern: '\\s>>?\\s|\\s>>?$|^>>?\\s|\\d>>?\\s', reason: 'Shell output redirection' },
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
module.exports = { DENY_RULES, ASK_RULES };
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
const { fileURLToPath } = require('node:url');
|
|
7
|
+
|
|
8
|
+
const { isExtensionCachePath } = require('../mcp/contracts/cache-path-rejector');
|
|
9
|
+
const { MaestroError } = require('../lib/errors');
|
|
10
|
+
|
|
11
|
+
class WorkspaceResolutionError extends MaestroError {
|
|
12
|
+
constructor(message, { code = 'WORKSPACE_RESOLUTION_FAILED', details = null } = {}) {
|
|
13
|
+
super(message, { code, details });
|
|
14
|
+
this.name = 'WorkspaceResolutionError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function resolveGitRoot(baseDir) {
|
|
19
|
+
return execSync('git rev-parse --show-toplevel', {
|
|
20
|
+
cwd: baseDir,
|
|
21
|
+
encoding: 'utf8',
|
|
22
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
23
|
+
}).trim();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function resolveExistingRoot(candidate) {
|
|
27
|
+
if (!candidate || candidate.includes('${')) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const resolvedCandidate = path.resolve(candidate);
|
|
32
|
+
if (!fs.existsSync(resolvedCandidate)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
return resolveGitRoot(resolvedCandidate);
|
|
38
|
+
} catch {
|
|
39
|
+
return resolvedCandidate;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function resolveProjectRootFromCandidates(candidates) {
|
|
44
|
+
for (const candidate of candidates) {
|
|
45
|
+
const resolvedRoot = resolveExistingRoot(candidate);
|
|
46
|
+
if (resolvedRoot) {
|
|
47
|
+
return resolvedRoot;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function extractClientRootCandidates(clientRoots) {
|
|
55
|
+
if (!Array.isArray(clientRoots)) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const candidates = [];
|
|
60
|
+
for (const clientRoot of clientRoots) {
|
|
61
|
+
const uri =
|
|
62
|
+
typeof clientRoot === 'string'
|
|
63
|
+
? clientRoot
|
|
64
|
+
: clientRoot && typeof clientRoot.uri === 'string'
|
|
65
|
+
? clientRoot.uri
|
|
66
|
+
: null;
|
|
67
|
+
|
|
68
|
+
if (!uri) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
const parsed = new URL(uri);
|
|
74
|
+
if (parsed.protocol !== 'file:') {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
candidates.push(fileURLToPath(parsed));
|
|
79
|
+
} catch {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return candidates;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function resolveProjectRootFromEnv(env, cwd) {
|
|
88
|
+
const candidates = [
|
|
89
|
+
env.MAESTRO_WORKSPACE_PATH,
|
|
90
|
+
env.CLAUDE_PROJECT_DIR,
|
|
91
|
+
env.PWD,
|
|
92
|
+
env.INIT_CWD,
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
const resolvedRoot = resolveProjectRootFromCandidates(candidates);
|
|
96
|
+
if (resolvedRoot) {
|
|
97
|
+
return resolvedRoot;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return resolveExistingRoot(cwd) || path.resolve(cwd);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function resolveProjectRootForRuntime(runtimeConfig = {}, options = {}) {
|
|
104
|
+
const env = options.env || process.env;
|
|
105
|
+
const cwd = options.cwd || process.cwd();
|
|
106
|
+
const workspaceEnvName =
|
|
107
|
+
runtimeConfig && runtimeConfig.env ? runtimeConfig.env.workspacePath : null;
|
|
108
|
+
const explicitWorkspacePath =
|
|
109
|
+
workspaceEnvName && env[workspaceEnvName] ? env[workspaceEnvName] : null;
|
|
110
|
+
|
|
111
|
+
const explicitRoot = resolveExistingRoot(explicitWorkspacePath);
|
|
112
|
+
if (explicitRoot) {
|
|
113
|
+
return explicitRoot;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const clientRoot = resolveProjectRootFromCandidates(
|
|
117
|
+
extractClientRootCandidates(options.clientRoots)
|
|
118
|
+
);
|
|
119
|
+
if (clientRoot) {
|
|
120
|
+
return clientRoot;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return resolveProjectRootFromEnv(env, cwd);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function resolveProjectRoot() {
|
|
127
|
+
return resolveProjectRootFromEnv(process.env, process.cwd());
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Assert that a tool handler was invoked with a resolved workspace root.
|
|
132
|
+
* Used by handlers that cannot function without a workspace (session state,
|
|
133
|
+
* reconciliation, complexity assessment). The dispatcher calls this centrally
|
|
134
|
+
* when `requiresWorkspace` is declared on the tool schema; handlers may also
|
|
135
|
+
* call it directly for defense in depth.
|
|
136
|
+
*
|
|
137
|
+
* @param {string|null|undefined} projectRoot - resolved project root or nullish
|
|
138
|
+
* @param {string} toolName - tool name for the error message
|
|
139
|
+
* @throws {WorkspaceResolutionError} when projectRoot is absent
|
|
140
|
+
*/
|
|
141
|
+
function requireWorkspaceRoot(projectRoot, toolName) {
|
|
142
|
+
if (typeof projectRoot === 'string' && projectRoot.length > 0) {
|
|
143
|
+
return projectRoot;
|
|
144
|
+
}
|
|
145
|
+
throw new WorkspaceResolutionError(
|
|
146
|
+
`${toolName} requires an initialized workspace. Call initialize_workspace(workspace_path=...) first.`,
|
|
147
|
+
{ code: 'WORKSPACE_NOT_INITIALIZED', details: { tool_name: toolName } }
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function requireExplicitWorkspaceRoot({ workspacePath } = {}) {
|
|
152
|
+
if (!workspacePath || typeof workspacePath !== 'string' || workspacePath.includes('${')) {
|
|
153
|
+
throw new WorkspaceResolutionError(
|
|
154
|
+
'initialize_workspace requires an explicit workspace_path. No implicit cwd or env fallback is used.',
|
|
155
|
+
{ code: 'WORKSPACE_REQUIRED' }
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
const resolved = path.resolve(workspacePath);
|
|
159
|
+
if (!fs.existsSync(resolved)) {
|
|
160
|
+
throw new WorkspaceResolutionError(
|
|
161
|
+
`workspace_path does not exist: ${resolved}`,
|
|
162
|
+
{ code: 'WORKSPACE_NOT_FOUND', details: { workspace_path: resolved } }
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
if (isExtensionCachePath(resolved)) {
|
|
166
|
+
throw new WorkspaceResolutionError(
|
|
167
|
+
`workspace_path resolves inside an extension cache directory: ${resolved}. Provide the user workspace path instead.`,
|
|
168
|
+
{ code: 'WORKSPACE_IN_EXTENSION_CACHE', details: { workspace_path: resolved } }
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
return resolveGitRoot(resolved);
|
|
173
|
+
} catch {
|
|
174
|
+
return resolved;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
module.exports = {
|
|
179
|
+
resolveProjectRoot,
|
|
180
|
+
resolveProjectRootForRuntime,
|
|
181
|
+
requireExplicitWorkspaceRoot,
|
|
182
|
+
requireWorkspaceRoot,
|
|
183
|
+
WorkspaceResolutionError,
|
|
184
|
+
};
|