@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,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { log } = require('../../core/logger');
|
|
4
|
+
const hookState = require('./hook-state');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* After-agent hook logic (runtime-agnostic).
|
|
8
|
+
*
|
|
9
|
+
* Field name mapping: the Gemini adapter maps ctx.promptResponse → ctx.agentResult
|
|
10
|
+
* before calling this function.
|
|
11
|
+
*
|
|
12
|
+
* @param {object} ctx - Internal context contract
|
|
13
|
+
* @param {string} ctx.sessionId
|
|
14
|
+
* @param {string|null} ctx.agentResult - the agent response text
|
|
15
|
+
* @param {boolean} ctx.stopHookActive
|
|
16
|
+
* @returns {{ action: string, message: null, reason: string|null }}
|
|
17
|
+
*/
|
|
18
|
+
function handleAfterAgent(ctx) {
|
|
19
|
+
const agentName = hookState.getActiveAgent(ctx.sessionId);
|
|
20
|
+
if (!agentName) {
|
|
21
|
+
hookState.clearActiveAgent(ctx.sessionId);
|
|
22
|
+
return { action: 'allow', message: null, reason: null };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const agentResult = ctx.agentResult || '';
|
|
26
|
+
const hasTaskReport = agentResult.includes('## Task Report') || agentResult.includes('# Task Report');
|
|
27
|
+
const hasDownstream = agentResult.includes('## Downstream Context') || agentResult.includes('# Downstream Context');
|
|
28
|
+
|
|
29
|
+
const warnings = [];
|
|
30
|
+
if (!hasTaskReport) warnings.push('Missing Task Report section (expected ## Task Report heading)');
|
|
31
|
+
if (!hasDownstream) warnings.push('Missing Downstream Context section (expected ## Downstream Context heading)');
|
|
32
|
+
|
|
33
|
+
if (warnings.length > 0) {
|
|
34
|
+
const reason = warnings.join('; ');
|
|
35
|
+
if (ctx.stopHookActive) {
|
|
36
|
+
log('WARN', `AfterAgent [${agentName}]: Retry still malformed: ${reason} — allowing to prevent infinite loop`);
|
|
37
|
+
} else {
|
|
38
|
+
log('WARN', `AfterAgent [${agentName}]: WARN: ${reason} — requesting retry`);
|
|
39
|
+
hookState.clearActiveAgent(ctx.sessionId);
|
|
40
|
+
return {
|
|
41
|
+
action: 'deny',
|
|
42
|
+
message: null,
|
|
43
|
+
reason: `Handoff report validation failed: ${reason}. Please include both a ## Task Report section and a ## Downstream Context section in your response.`,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
log('INFO', `AfterAgent [${agentName}]: Handoff report validated`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
hookState.clearActiveAgent(ctx.sessionId);
|
|
51
|
+
return { action: 'allow', message: null, reason: null };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = { handleAfterAgent };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { log } = require('../../core/logger');
|
|
4
|
+
const { detectAgentFromPrompt, normalizeAgentName } = require('../../core/agent-registry');
|
|
5
|
+
const { assertSessionId } = require('../../lib/validation');
|
|
6
|
+
const { readFileSafe } = require('../../lib/io');
|
|
7
|
+
const hookState = require('./hook-state');
|
|
8
|
+
const state = require('../../state/session-state');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Before-agent hook logic (runtime-agnostic).
|
|
12
|
+
*
|
|
13
|
+
* Field name mapping: the Gemini adapter maps ctx.prompt → ctx.agentInput
|
|
14
|
+
* before calling this function.
|
|
15
|
+
*
|
|
16
|
+
* @param {object} ctx - Internal context contract
|
|
17
|
+
* @param {string} ctx.sessionId
|
|
18
|
+
* @param {string} ctx.cwd
|
|
19
|
+
* @param {string|null} ctx.agentInput - the agent prompt text
|
|
20
|
+
* @param {string} [ctx.event] - hook event name (used in context message)
|
|
21
|
+
* @returns {{ action: string, message: string|null, reason: null }}
|
|
22
|
+
*/
|
|
23
|
+
function handleBeforeAgent(ctx) {
|
|
24
|
+
hookState.pruneStale();
|
|
25
|
+
|
|
26
|
+
const agentName = detectAgentFromPrompt(ctx.agentInput) || normalizeAgentName(ctx.agentName);
|
|
27
|
+
|
|
28
|
+
let validSession = false;
|
|
29
|
+
try { assertSessionId(ctx.sessionId); validSession = true; } catch (_) {}
|
|
30
|
+
|
|
31
|
+
if (agentName && validSession) {
|
|
32
|
+
hookState.setActiveAgent(ctx.sessionId, agentName);
|
|
33
|
+
log('INFO', `BeforeAgent: Detected agent '${agentName}' — set active agent [session=${ctx.sessionId}]`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const sessionPath = state.resolveActiveSessionPath(ctx.cwd);
|
|
37
|
+
let contextParts = '';
|
|
38
|
+
|
|
39
|
+
const content = readFileSafe(sessionPath, '');
|
|
40
|
+
if (content) {
|
|
41
|
+
const parts = [];
|
|
42
|
+
const phaseMatch = content.match(/current_phase:\s*(\S+)/);
|
|
43
|
+
if (phaseMatch) parts.push(`current_phase=${phaseMatch[1]}`);
|
|
44
|
+
const statusMatch = content.match(/status:\s*(\S+)/);
|
|
45
|
+
if (statusMatch) parts.push(`status=${statusMatch[1]}`);
|
|
46
|
+
if (parts.length > 0) {
|
|
47
|
+
contextParts = `Active session: ${parts.join(', ')}`;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (contextParts) {
|
|
52
|
+
return { action: 'allow', message: contextParts, reason: null };
|
|
53
|
+
}
|
|
54
|
+
return { action: 'allow', message: null, reason: null };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = { handleBeforeAgent };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
const { log } = require('../../core/logger');
|
|
7
|
+
const { assertSessionId } = require('../../lib/validation');
|
|
8
|
+
const { atomicWriteSync, readFileSafe } = require('../../lib/io');
|
|
9
|
+
|
|
10
|
+
const HOOK_STATE_TTL_MS = 2 * 60 * 60 * 1000;
|
|
11
|
+
|
|
12
|
+
const uid = process.getuid ? process.getuid() : 'default';
|
|
13
|
+
const DEFAULT_BASE_DIR = process.env.MAESTRO_HOOKS_DIR
|
|
14
|
+
|| path.join(os.tmpdir(), `maestro-hooks-${uid}`);
|
|
15
|
+
|
|
16
|
+
function ensureBaseDir(dir) {
|
|
17
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
18
|
+
const stats = fs.lstatSync(dir);
|
|
19
|
+
if (stats.isSymbolicLink()) {
|
|
20
|
+
throw new Error('Hook state directory must not be a symlink');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function createHookState(baseDir = DEFAULT_BASE_DIR) {
|
|
25
|
+
function getBaseDir() {
|
|
26
|
+
return baseDir;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function pruneStale() {
|
|
30
|
+
ensureBaseDir(baseDir);
|
|
31
|
+
if (!fs.existsSync(baseDir)) return;
|
|
32
|
+
|
|
33
|
+
const now = Date.now();
|
|
34
|
+
let entries;
|
|
35
|
+
try {
|
|
36
|
+
entries = fs.readdirSync(baseDir, { withFileTypes: true });
|
|
37
|
+
} catch {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
for (const entry of entries) {
|
|
42
|
+
if (!entry.isDirectory()) continue;
|
|
43
|
+
const dirPath = path.join(baseDir, entry.name);
|
|
44
|
+
try {
|
|
45
|
+
const stat = fs.lstatSync(dirPath);
|
|
46
|
+
if (now - stat.mtimeMs > HOOK_STATE_TTL_MS) {
|
|
47
|
+
fs.rmSync(dirPath, { recursive: true, force: true });
|
|
48
|
+
}
|
|
49
|
+
} catch {}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function setActiveAgent(sessionId, agentName) {
|
|
54
|
+
try {
|
|
55
|
+
assertSessionId(sessionId);
|
|
56
|
+
} catch {
|
|
57
|
+
log('ERROR', 'Invalid session_id: contains unsafe characters');
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
const agentFile = path.join(baseDir, sessionId, 'active-agent');
|
|
61
|
+
atomicWriteSync(agentFile, agentName);
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function getActiveAgent(sessionId) {
|
|
66
|
+
try {
|
|
67
|
+
assertSessionId(sessionId);
|
|
68
|
+
} catch {
|
|
69
|
+
return '';
|
|
70
|
+
}
|
|
71
|
+
const agentFile = path.join(baseDir, sessionId, 'active-agent');
|
|
72
|
+
return readFileSafe(agentFile, '').trim();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function clearActiveAgent(sessionId) {
|
|
76
|
+
try {
|
|
77
|
+
assertSessionId(sessionId);
|
|
78
|
+
} catch {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const agentFile = path.join(baseDir, sessionId, 'active-agent');
|
|
82
|
+
try {
|
|
83
|
+
fs.unlinkSync(agentFile);
|
|
84
|
+
} catch {}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function ensureSessionDir(sessionId) {
|
|
88
|
+
try {
|
|
89
|
+
assertSessionId(sessionId);
|
|
90
|
+
} catch {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
ensureBaseDir(baseDir);
|
|
94
|
+
fs.mkdirSync(path.join(baseDir, sessionId), { recursive: true, mode: 0o700 });
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function removeSessionDir(sessionId) {
|
|
99
|
+
try {
|
|
100
|
+
assertSessionId(sessionId);
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
fs.rmSync(path.join(baseDir, sessionId), { recursive: true, force: true });
|
|
106
|
+
} catch {}
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
getBaseDir,
|
|
112
|
+
pruneStale,
|
|
113
|
+
setActiveAgent,
|
|
114
|
+
getActiveAgent,
|
|
115
|
+
clearActiveAgent,
|
|
116
|
+
ensureSessionDir,
|
|
117
|
+
removeSessionDir,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const defaultInstance = createHookState();
|
|
122
|
+
|
|
123
|
+
module.exports = {
|
|
124
|
+
createHookState,
|
|
125
|
+
DEFAULT_BASE_DIR,
|
|
126
|
+
...defaultInstance,
|
|
127
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const hookState = require('./hook-state');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Session-end hook logic (runtime-agnostic).
|
|
7
|
+
*
|
|
8
|
+
* @param {object} ctx - Internal context contract
|
|
9
|
+
* @param {string} ctx.sessionId
|
|
10
|
+
* @returns {{ action: string, message: null, reason: null }}
|
|
11
|
+
*/
|
|
12
|
+
function handleSessionEnd(ctx) {
|
|
13
|
+
hookState.removeSessionDir(ctx.sessionId);
|
|
14
|
+
return { action: 'advisory', message: null, reason: null };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = { handleSessionEnd };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const hookState = require('./hook-state');
|
|
4
|
+
const state = require('../../state/session-state');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Session-start hook logic (runtime-agnostic).
|
|
8
|
+
*
|
|
9
|
+
* @param {object} ctx - Internal context contract
|
|
10
|
+
* @param {string} ctx.sessionId
|
|
11
|
+
* @param {string} ctx.cwd
|
|
12
|
+
* @returns {{ action: string, message: null, reason: null }}
|
|
13
|
+
*/
|
|
14
|
+
function handleSessionStart(ctx) {
|
|
15
|
+
hookState.pruneStale();
|
|
16
|
+
|
|
17
|
+
if (!state.hasActiveSession(ctx.cwd)) {
|
|
18
|
+
return { action: 'advisory', message: null, reason: null };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
hookState.ensureSessionDir(ctx.sessionId);
|
|
22
|
+
return { action: 'advisory', message: null, reason: null };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = { handleSessionStart };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { readFileSafe, writeIfChanged } = require('../io');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} DiscoveryEntry
|
|
9
|
+
* @property {string} id - Unique identifier derived by the identity function
|
|
10
|
+
* @property {string} path - Absolute path to the discovered file
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} DiscoverOptions
|
|
15
|
+
* @property {string} dir - Absolute path to the directory to scan
|
|
16
|
+
* @property {string} pattern - File-matching pattern (e.g., '*.js', '*-logic.js', '**\/*.md')
|
|
17
|
+
* @property {Function} identity - (filepath: string) => string — derives the entry identifier
|
|
18
|
+
* @property {Function} [metadata] - (filepath: string, content: string) => Object — extracts metadata per file
|
|
19
|
+
* @property {Function} [validate] - (entry: DiscoveryEntry) => boolean — false excludes the entry
|
|
20
|
+
* @property {boolean} [recursive=false] - Whether to recurse into subdirectories
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Convert a simple glob pattern into a RegExp for matching filenames.
|
|
25
|
+
*
|
|
26
|
+
* Supports:
|
|
27
|
+
* - `*` matches any sequence of characters except path separators
|
|
28
|
+
* - Literal characters are escaped for safe regex usage
|
|
29
|
+
* - The pattern is anchored to match the full filename
|
|
30
|
+
*
|
|
31
|
+
* @param {string} pattern - The glob pattern (filename portion only, no directory prefix)
|
|
32
|
+
* @returns {RegExp} Compiled regular expression
|
|
33
|
+
*/
|
|
34
|
+
function patternToRegex(pattern) {
|
|
35
|
+
let regex = '';
|
|
36
|
+
for (let i = 0; i < pattern.length; i++) {
|
|
37
|
+
const char = pattern[i];
|
|
38
|
+
if (char === '*') {
|
|
39
|
+
regex += '[^/]*';
|
|
40
|
+
} else if ('.+?^${}()|[]\\'.includes(char)) {
|
|
41
|
+
regex += '\\' + char;
|
|
42
|
+
} else {
|
|
43
|
+
regex += char;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return new RegExp('^' + regex + '$');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Parse a discovery pattern into its file-matching regex and whether
|
|
51
|
+
* recursive scanning is implied by a `**\/` prefix.
|
|
52
|
+
*
|
|
53
|
+
* @param {string} pattern - The discovery pattern (e.g., '*.md', '**\/*.md')
|
|
54
|
+
* @returns {{ regex: RegExp, impliedRecursive: boolean }}
|
|
55
|
+
*/
|
|
56
|
+
function parsePattern(pattern) {
|
|
57
|
+
if (pattern.startsWith('**/')) {
|
|
58
|
+
return {
|
|
59
|
+
regex: patternToRegex(pattern.slice(3)),
|
|
60
|
+
impliedRecursive: true,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
regex: patternToRegex(pattern),
|
|
65
|
+
impliedRecursive: false,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Collect file paths from a directory, optionally recursing into subdirectories.
|
|
71
|
+
*
|
|
72
|
+
* @param {string} dir - Absolute path to scan
|
|
73
|
+
* @param {boolean} recursive - Whether to descend into child directories
|
|
74
|
+
* @returns {string[]} Absolute paths of all regular files found
|
|
75
|
+
*/
|
|
76
|
+
function collectFiles(dir, recursive) {
|
|
77
|
+
const results = [];
|
|
78
|
+
|
|
79
|
+
if (!fs.existsSync(dir)) {
|
|
80
|
+
return results;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
84
|
+
|
|
85
|
+
for (const entry of entries) {
|
|
86
|
+
const fullPath = path.join(dir, entry.name);
|
|
87
|
+
|
|
88
|
+
if (entry.isDirectory() && recursive) {
|
|
89
|
+
results.push(...collectFiles(fullPath, true));
|
|
90
|
+
} else if (entry.isFile()) {
|
|
91
|
+
results.push(fullPath);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return results;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Scan a directory for files matching a pattern and produce an array of
|
|
100
|
+
* structured discovery entries.
|
|
101
|
+
*
|
|
102
|
+
* @param {DiscoverOptions} options
|
|
103
|
+
* @returns {Array<DiscoveryEntry>} Entries sorted by id
|
|
104
|
+
*/
|
|
105
|
+
function discover({ dir, pattern, identity, metadata, validate, recursive = false }) {
|
|
106
|
+
const { regex, impliedRecursive } = parsePattern(pattern);
|
|
107
|
+
const shouldRecurse = recursive || impliedRecursive;
|
|
108
|
+
|
|
109
|
+
const filePaths = collectFiles(dir, shouldRecurse);
|
|
110
|
+
|
|
111
|
+
const entries = [];
|
|
112
|
+
|
|
113
|
+
for (const filePath of filePaths) {
|
|
114
|
+
const filename = path.basename(filePath);
|
|
115
|
+
|
|
116
|
+
if (!regex.test(filename)) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const id = identity(filePath);
|
|
121
|
+
|
|
122
|
+
let extra = {};
|
|
123
|
+
if (metadata) {
|
|
124
|
+
const content = readFileSafe(filePath);
|
|
125
|
+
extra = metadata(filePath, content) || {};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const entry = { id, path: filePath, ...extra };
|
|
129
|
+
|
|
130
|
+
if (validate && !validate(entry)) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
entries.push(entry);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
entries.sort((a, b) => a.id.localeCompare(b.id));
|
|
138
|
+
|
|
139
|
+
return entries;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Serialize data as JSON and write it to a file, skipping the write when
|
|
144
|
+
* the content has not changed.
|
|
145
|
+
*
|
|
146
|
+
* @param {*} data - Any JSON-serializable value
|
|
147
|
+
* @param {string} outputPath - Absolute path to the output file
|
|
148
|
+
* @returns {boolean} True if the file was written, false if content was identical
|
|
149
|
+
*/
|
|
150
|
+
function generateRegistry(data, outputPath) {
|
|
151
|
+
const content = serializeRegistry(data);
|
|
152
|
+
return writeIfChanged(outputPath, content);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Serialize registry data to stable, newline-terminated JSON.
|
|
157
|
+
*
|
|
158
|
+
* @param {*} data - Any JSON-serializable registry value
|
|
159
|
+
* @returns {string} JSON content ready to write
|
|
160
|
+
*/
|
|
161
|
+
function serializeRegistry(data) {
|
|
162
|
+
return JSON.stringify(data, null, 2) + '\n';
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
module.exports = {
|
|
166
|
+
discover,
|
|
167
|
+
generateRegistry,
|
|
168
|
+
serializeRegistry,
|
|
169
|
+
patternToRegex,
|
|
170
|
+
parsePattern,
|
|
171
|
+
collectFiles,
|
|
172
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base error class for the Maestro platform.
|
|
5
|
+
* Provides structured error metadata via `code`, `details`, and `context` properties.
|
|
6
|
+
*
|
|
7
|
+
* @extends Error
|
|
8
|
+
*/
|
|
9
|
+
class MaestroError extends Error {
|
|
10
|
+
/**
|
|
11
|
+
* @param {string} message - Human-readable error description
|
|
12
|
+
* @param {object} [opts]
|
|
13
|
+
* @param {string} [opts.code='MAESTRO_ERROR'] - Machine-readable error code
|
|
14
|
+
* @param {*} [opts.details=null] - Structured payload describing the failure
|
|
15
|
+
* @param {*} [opts.context=null] - Ambient context at the point of failure
|
|
16
|
+
*/
|
|
17
|
+
constructor(message, { code = 'MAESTRO_ERROR', details = null, context = null } = {}) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = this.constructor.name;
|
|
20
|
+
this.code = code;
|
|
21
|
+
this.details = details;
|
|
22
|
+
this.context = context;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Raised when input data or arguments fail validation constraints.
|
|
28
|
+
*
|
|
29
|
+
* @extends MaestroError
|
|
30
|
+
*/
|
|
31
|
+
class ValidationError extends MaestroError {
|
|
32
|
+
/**
|
|
33
|
+
* @param {string} message
|
|
34
|
+
* @param {object} [opts]
|
|
35
|
+
* @param {string} [opts.code='VALIDATION_ERROR'] - Subtype code for specific failures (e.g. HANDOFF_INCOMPLETE)
|
|
36
|
+
* @param {*} [opts.details]
|
|
37
|
+
* @param {*} [opts.context]
|
|
38
|
+
*/
|
|
39
|
+
constructor(message, opts = {}) {
|
|
40
|
+
super(message, { ...opts, code: opts.code || 'VALIDATION_ERROR' });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Raised when a requested resource (agent, session, file, etc.) does not exist.
|
|
46
|
+
*
|
|
47
|
+
* @extends MaestroError
|
|
48
|
+
*/
|
|
49
|
+
class NotFoundError extends MaestroError {
|
|
50
|
+
/**
|
|
51
|
+
* @param {string} message
|
|
52
|
+
* @param {object} [opts]
|
|
53
|
+
* @param {string} [opts.code='NOT_FOUND'] - Subtype code for specific failures
|
|
54
|
+
* @param {*} [opts.details]
|
|
55
|
+
* @param {*} [opts.context]
|
|
56
|
+
*/
|
|
57
|
+
constructor(message, opts = {}) {
|
|
58
|
+
super(message, { ...opts, code: opts.code || 'NOT_FOUND' });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Raised when configuration is missing, malformed, or internally inconsistent.
|
|
64
|
+
*
|
|
65
|
+
* @extends MaestroError
|
|
66
|
+
*/
|
|
67
|
+
class ConfigError extends MaestroError {
|
|
68
|
+
/**
|
|
69
|
+
* @param {string} message
|
|
70
|
+
* @param {object} [opts]
|
|
71
|
+
* @param {string} [opts.code='CONFIG_ERROR'] - Subtype code for specific failures
|
|
72
|
+
* @param {*} [opts.details]
|
|
73
|
+
* @param {*} [opts.context]
|
|
74
|
+
*/
|
|
75
|
+
constructor(message, opts = {}) {
|
|
76
|
+
super(message, { ...opts, code: opts.code || 'CONFIG_ERROR' });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Raised when an operation is invalid for the current session or workflow state.
|
|
82
|
+
*
|
|
83
|
+
* @extends MaestroError
|
|
84
|
+
*/
|
|
85
|
+
class StateError extends MaestroError {
|
|
86
|
+
/**
|
|
87
|
+
* @param {string} message
|
|
88
|
+
* @param {object} [opts]
|
|
89
|
+
* @param {string} [opts.code='STATE_ERROR'] - Subtype code for specific failures (e.g. DESIGN_GATE_UNAPPROVED, RECONCILIATION_PENDING)
|
|
90
|
+
* @param {*} [opts.details]
|
|
91
|
+
* @param {*} [opts.context]
|
|
92
|
+
*/
|
|
93
|
+
constructor(message, opts = {}) {
|
|
94
|
+
super(message, { ...opts, code: opts.code || 'STATE_ERROR' });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
module.exports = {
|
|
99
|
+
MaestroError,
|
|
100
|
+
ValidationError,
|
|
101
|
+
NotFoundError,
|
|
102
|
+
ConfigError,
|
|
103
|
+
StateError,
|
|
104
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const CONFIG_FILES = [
|
|
4
|
+
'.eslintrc',
|
|
5
|
+
'.prettierrc',
|
|
6
|
+
'tsconfig.json',
|
|
7
|
+
'webpack.config.js',
|
|
8
|
+
'vite.config.js',
|
|
9
|
+
'next.config.js',
|
|
10
|
+
'.env',
|
|
11
|
+
'docker-compose.yml',
|
|
12
|
+
'Dockerfile',
|
|
13
|
+
'Makefile',
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const SKIP_DIRS = new Set([
|
|
17
|
+
'node_modules',
|
|
18
|
+
'.git',
|
|
19
|
+
'dist',
|
|
20
|
+
'build',
|
|
21
|
+
'.next',
|
|
22
|
+
'__pycache__',
|
|
23
|
+
'venv',
|
|
24
|
+
'.venv',
|
|
25
|
+
'target',
|
|
26
|
+
'vendor',
|
|
27
|
+
'.cache',
|
|
28
|
+
'.output',
|
|
29
|
+
'coverage',
|
|
30
|
+
'.nyc_output',
|
|
31
|
+
'.pytest_cache',
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
const FRAMEWORK_INDICATORS = {
|
|
35
|
+
react: ['react', 'react-dom'],
|
|
36
|
+
vue: ['vue'],
|
|
37
|
+
angular: ['@angular/core'],
|
|
38
|
+
next: ['next'],
|
|
39
|
+
express: ['express'],
|
|
40
|
+
fastify: ['fastify'],
|
|
41
|
+
django: ['django'],
|
|
42
|
+
flask: ['flask'],
|
|
43
|
+
rails: ['rails'],
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
module.exports = {
|
|
47
|
+
CONFIG_FILES,
|
|
48
|
+
SKIP_DIRS,
|
|
49
|
+
FRAMEWORK_INDICATORS,
|
|
50
|
+
};
|