@khoavu882/doflow 0.0.0-stage → 2.0.0-beta.4
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/LICENSE +21 -0
- package/README.md +132 -2
- package/bin/doflow.js +44 -0
- package/core/.antigravity-plugin/hooks.json +39 -0
- package/core/.antigravity-plugin/mcp_config.json +18 -0
- package/core/.antigravity-plugin/plugin.json +31 -0
- package/core/.claude-plugin/marketplace.json +20 -0
- package/core/.claude-plugin/plugin.json +21 -0
- package/core/.codex-plugin/marketplace.json +20 -0
- package/core/.codex-plugin/plugin.json +35 -0
- package/core/.plugin/plugin.json +19 -0
- package/core/harnesses/antigravity/hooks/pre-implementation-gate.sh +9 -0
- package/core/harnesses/antigravity/hooks/stop-check.sh +10 -0
- package/core/harnesses/claude/hooks/lib.sh +304 -0
- package/core/harnesses/claude/hooks/mcp-tool-guard.sh +20 -0
- package/core/harnesses/claude/hooks/permission-audit.sh +47 -0
- package/core/harnesses/claude/hooks/post-compact.sh +74 -0
- package/core/harnesses/claude/hooks/post-edit-lint.sh +36 -0
- package/core/harnesses/claude/hooks/post-tool-failure.sh +47 -0
- package/core/harnesses/claude/hooks/pre-bash-guard.sh +20 -0
- package/core/harnesses/claude/hooks/pre-compact.sh +43 -0
- package/core/harnesses/claude/hooks/pre-implement-gate.sh +21 -0
- package/core/harnesses/claude/hooks/session-end.sh +89 -0
- package/core/harnesses/claude/hooks/session-start.sh +5 -0
- package/core/harnesses/claude/hooks/skill-config-audit.sh +39 -0
- package/core/harnesses/claude/hooks/stop-check.sh +5 -0
- package/core/harnesses/claude/hooks/subagent-audit.sh +7 -0
- package/core/harnesses/claude/hooks/user-prompt-submit.sh +5 -0
- package/core/harnesses/claude/settings/keybindings.json +20 -0
- package/core/harnesses/claude/settings/settings.json +201 -0
- package/core/harnesses/claude/statusline/doflow-statusline.sh +49 -0
- package/core/harnesses/codex/agents/core-implementer.toml +7 -0
- package/core/harnesses/codex/agents/quality-guardian.toml +8 -0
- package/core/harnesses/codex/agents/research-writer.toml +8 -0
- package/core/harnesses/codex/agents/spec-analyst.toml +8 -0
- package/core/harnesses/codex/agents/system-architect.toml +9 -0
- package/core/harnesses/codex/config/config.toml +10 -0
- package/core/harnesses/codex/hooks/hooks.json +122 -0
- package/core/harnesses/codex/hooks/lib.sh +335 -0
- package/core/harnesses/codex/hooks/mcp-tool-guard.sh +18 -0
- package/core/harnesses/codex/hooks/post-edit-lint.impl.sh +52 -0
- package/core/harnesses/codex/hooks/post-edit-lint.sh +6 -0
- package/core/harnesses/codex/hooks/pre-bash-guard.sh +18 -0
- package/core/harnesses/codex/hooks/pre-compact.impl.sh +46 -0
- package/core/harnesses/codex/hooks/pre-compact.sh +9 -0
- package/core/harnesses/codex/hooks/pre-implement-gate.sh +19 -0
- package/core/harnesses/codex/hooks/session-end.impl.sh +92 -0
- package/core/harnesses/codex/hooks/session-end.sh +5 -0
- package/core/harnesses/codex/hooks/session-start.sh +5 -0
- package/core/harnesses/codex/hooks/stop-check.sh +8 -0
- package/core/harnesses/codex/hooks/subagent-audit.sh +8 -0
- package/core/harnesses/codex/hooks/user-prompt-submit.sh +6 -0
- package/core/harnesses/gemini/hooks/hooks.json +77 -0
- package/core/harnesses/gemini/hooks/lib.sh +302 -0
- package/core/harnesses/gemini/hooks/mcp-tool-guard.sh +21 -0
- package/core/harnesses/gemini/hooks/post-edit-lint.sh +39 -0
- package/core/harnesses/gemini/hooks/pre-bash-guard.sh +21 -0
- package/core/harnesses/gemini/hooks/pre-compact.sh +38 -0
- package/core/harnesses/gemini/hooks/pre-implement-gate.sh +22 -0
- package/core/harnesses/gemini/hooks/session-end.impl.sh +89 -0
- package/core/harnesses/gemini/hooks/session-end.sh +5 -0
- package/core/harnesses/gemini/hooks/session-start.sh +5 -0
- package/core/harnesses/gemini/settings/adapter-defaults.json +4 -0
- package/core/harnesses/kiro/agents/doflow.json +58 -0
- package/core/harnesses/kiro/hooks/doflow.json +53 -0
- package/core/harnesses/kiro/hooks/lib.sh +324 -0
- package/core/harnesses/kiro/hooks/mcp-tool-guard.sh +9 -0
- package/core/harnesses/kiro/hooks/pre-bash-guard.sh +9 -0
- package/core/harnesses/kiro/hooks/pre-implement-gate.sh +9 -0
- package/core/harnesses/kiro/hooks/session-start.sh +9 -0
- package/core/harnesses/kiro/hooks/stop-check.sh +43 -0
- package/core/harnesses/shared/hooks/ENVELOPE_MIGRATION.md +39 -0
- package/core/harnesses/shared/hooks/adapters/antigravity.js +111 -0
- package/core/harnesses/shared/hooks/adapters/arg-fields.js +19 -0
- package/core/harnesses/shared/hooks/adapters/gemini.js +114 -0
- package/core/harnesses/shared/hooks/hooks.json +47 -0
- package/core/harnesses/shared/hooks/policies/blocked-patterns.conf +91 -0
- package/core/harnesses/shared/hooks/policies/capture-failure.sh +97 -0
- package/core/harnesses/shared/hooks/policies/deny-json.sh +29 -0
- package/core/harnesses/shared/hooks/policies/lib.sh +501 -0
- package/core/harnesses/shared/hooks/policies/mcp-policy.conf +21 -0
- package/core/harnesses/shared/hooks/policies/mcp-tool-guard.sh +91 -0
- package/core/harnesses/shared/hooks/policies/pre-bash-guard.sh +328 -0
- package/core/harnesses/shared/hooks/policies/pre-implementation-gate.sh +496 -0
- package/core/harnesses/shared/hooks/policies/prompt-nudge.jq +131 -0
- package/core/harnesses/shared/hooks/policies/session-context.sh +141 -0
- package/core/harnesses/shared/hooks/policies/stop-check.sh +264 -0
- package/core/harnesses/shared/hooks/policies/subagent-audit.sh +46 -0
- package/core/harnesses/shared/hooks/policies/user-prompt-submit.sh +235 -0
- package/core/harnesses/shared/hooks/stream-hook-runner.js +590 -0
- package/core/harnesses/shared/locator/doflow-run +87 -0
- package/core/registry/advice.json +101 -0
- package/core/registry/assets.json +792 -0
- package/core/registry/capabilities.json +120 -0
- package/core/registry/contracts.json +189 -0
- package/core/registry/external-tools.json +191 -0
- package/core/registry/harnesses.json +2062 -0
- package/core/registry/lifecycle.json +231 -0
- package/core/registry/mcp.json +18 -0
- package/core/registry/models.json +79 -0
- package/core/registry/readiness-templates.json +118 -0
- package/core/registry/routes.json +47 -0
- package/core/registry/storage.json +1061 -0
- package/core/registry/verification.json +258 -0
- package/core/registry/workflows.json +790 -0
- package/core/shared/agent-specs/core-implementer.md +73 -0
- package/core/shared/agent-specs/quality-guardian.md +28 -0
- package/core/shared/agent-specs/research-writer.md +31 -0
- package/core/shared/agent-specs/spec-analyst.md +33 -0
- package/core/shared/agent-specs/system-architect.md +29 -0
- package/core/shared/guidance/DOFLOW_CORE.md +8 -0
- package/core/shared/guidance/FLAGS.md +25 -0
- package/core/shared/guidance/PRINCIPLES.md +61 -0
- package/core/shared/guidance/VERSION +1 -0
- package/core/shared/guidance/mcp/MCP_Context7.md +18 -0
- package/core/shared/guidance/mcp/MCP_Sequential.md +17 -0
- package/core/shared/guidance/modes/MODE_Brainstorming.md +46 -0
- package/core/shared/guidance/modes/MODE_DeepResearch.md +69 -0
- package/core/shared/guidance/modes/MODE_Introspection.md +33 -0
- package/core/shared/guidance/modes/MODE_Orchestration.md +57 -0
- package/core/shared/guidance/modes/MODE_Task_Management.md +74 -0
- package/core/shared/guidance/pointers/claude-gemini.md +2 -0
- package/core/shared/guidance/pointers/codex.md +6 -0
- package/core/shared/guidance/references/ARTIFACT_FORMAT.md +373 -0
- package/core/shared/guidance/references/ARTIFACT_VOICE.md +104 -0
- package/core/shared/guidance/references/CONSTITUTION_BASE.md +47 -0
- package/core/shared/guidance/references/DIAGRAM_GUIDE.md +161 -0
- package/core/shared/guidance/references/DOFLOW_CHAIN.md +87 -0
- package/core/shared/guidance/references/EVIDENCE_LEDGER.md +93 -0
- package/core/shared/guidance/references/MODEL_SELECTION.md +74 -0
- package/core/shared/guidance/references/ORCHESTRATION.md +36 -0
- package/core/shared/guidance/references/RESEARCH_CONFIG.md +21 -0
- package/core/shared/guidance/references/WORKFLOW_HANDOFF.md +81 -0
- package/core/shared/guidance/rules/RULE_01_SAFETY.md +25 -0
- package/core/shared/guidance/rules/RULE_02_WORKFLOW.md +23 -0
- package/core/shared/guidance/rules/RULE_03_QUALITY.md +14 -0
- package/core/shared/guidance/rules/RULE_04_QUESTIONS.md +46 -0
- package/core/shared/scripts/doflow/assets/mermaid-theme.json +46 -0
- package/core/shared/scripts/doflow/bash/do-exec-paths.sh +167 -0
- package/core/shared/scripts/doflow/bash/do-git-state.sh +546 -0
- package/core/shared/scripts/doflow/bash/do-parallel-check.sh +208 -0
- package/core/shared/scripts/doflow/bash/do-paths.sh +347 -0
- package/core/shared/scripts/doflow/bash/do-prereqs.sh +66 -0
- package/core/shared/scripts/doflow/bash/do-review-package.sh +127 -0
- package/core/shared/scripts/doflow/bash/do-task-brief.sh +698 -0
- package/core/shared/scripts/doflow/bash/render-audit.sh +224 -0
- package/core/shared/scripts/doflow/bash/render-diagrams.sh +177 -0
- package/core/shared/scripts/doflow/bash/render-puml.sh +223 -0
- package/core/shared/scripts/doflow/bash/sync-context.sh +66 -0
- package/core/shared/scripts/doflow/bash/validate-artifacts.sh +526 -0
- package/core/shared/scripts/doflow/bin/doflow-run +592 -0
- package/core/shared/skills/do/SKILL.md +128 -0
- package/core/shared/skills/do/references/estimation.md +13 -0
- package/core/shared/skills/do/references/pm_routing.md +25 -0
- package/core/shared/skills/do/references/tool_matrix.md +52 -0
- package/core/shared/skills/do-brainstorm/SKILL.md +252 -0
- package/core/shared/skills/do-code-review/README.md +49 -0
- package/core/shared/skills/do-code-review/SKILL.md +333 -0
- package/core/shared/skills/do-code-review/assets/sample_c_clean.c +71 -0
- package/core/shared/skills/do-code-review/assets/sample_c_smells.c +66 -0
- package/core/shared/skills/do-code-review/assets/sample_cpp_shift.cpp +19 -0
- package/core/shared/skills/do-code-review/assets/sample_csharp_clean.cs +100 -0
- package/core/shared/skills/do-code-review/assets/sample_csharp_smells.cs +78 -0
- package/core/shared/skills/do-code-review/assets/sample_java_clean.java +55 -0
- package/core/shared/skills/do-code-review/assets/sample_java_smells.java +56 -0
- package/core/shared/skills/do-code-review/assets/sample_json_clean.json +7 -0
- package/core/shared/skills/do-code-review/assets/sample_markdown_clean.md +30 -0
- package/core/shared/skills/do-code-review/assets/sample_markdown_smells.md +29 -0
- package/core/shared/skills/do-code-review/assets/sample_shell_heredoc.sh +38 -0
- package/core/shared/skills/do-code-review/assets/sample_shell_smells.sh +15 -0
- package/core/shared/skills/do-code-review/assets/sample_typescript_strings.ts +36 -0
- package/core/shared/skills/do-code-review/assets/sample_yaml_smells.yaml +6 -0
- package/core/shared/skills/do-code-review/content-types/config.md +83 -0
- package/core/shared/skills/do-code-review/content-types/markdown.md +132 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_c_clean_quality.json +79 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_c_smells_quality.json +169 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_cpp_shift_quality.json +49 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_csharp_clean_quality.json +149 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_csharp_smells_quality.json +157 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_java_clean_quality.json +67 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_java_smells_quality.json +97 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_json_clean_quality.json +33 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_markdown_clean_quality.json +1 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_markdown_smells_quality.json +16 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_shell_heredoc_quality.json +54 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_shell_smells_quality.json +91 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_typescript_strings_quality.json +60 -0
- package/core/shared/skills/do-code-review/expected_outputs/sample_yaml_smells_quality.json +46 -0
- package/core/shared/skills/do-code-review/languages/c.md +103 -0
- package/core/shared/skills/do-code-review/languages/cpp.md +103 -0
- package/core/shared/skills/do-code-review/languages/csharp.md +97 -0
- package/core/shared/skills/do-code-review/languages/dart.md +108 -0
- package/core/shared/skills/do-code-review/languages/go.md +92 -0
- package/core/shared/skills/do-code-review/languages/java.md +103 -0
- package/core/shared/skills/do-code-review/languages/kotlin.md +88 -0
- package/core/shared/skills/do-code-review/languages/php.md +109 -0
- package/core/shared/skills/do-code-review/languages/python.md +94 -0
- package/core/shared/skills/do-code-review/languages/ruby.md +105 -0
- package/core/shared/skills/do-code-review/languages/rust.md +99 -0
- package/core/shared/skills/do-code-review/languages/shell.md +90 -0
- package/core/shared/skills/do-code-review/languages/swift.md +88 -0
- package/core/shared/skills/do-code-review/languages/typescript.md +97 -0
- package/core/shared/skills/do-code-review/review-policy.json +47 -0
- package/core/shared/skills/do-code-review/rules/universal.md +49 -0
- package/core/shared/skills/do-code-review/scripts/code_quality_checker.py +1696 -0
- package/core/shared/skills/do-code-review/scripts/doc_quality_checker.py +532 -0
- package/core/shared/skills/do-code-review/scripts/pr_analyzer.py +620 -0
- package/core/shared/skills/do-code-review/scripts/review_report_generator.py +505 -0
- package/core/shared/skills/do-constitution/SKILL.md +72 -0
- package/core/shared/skills/do-design/SKILL.md +212 -0
- package/core/shared/skills/do-diagnose/SKILL.md +156 -0
- package/core/shared/skills/do-diagnose/references/code_audit.md +15 -0
- package/core/shared/skills/do-diagnose/references/refactoring.md +12 -0
- package/core/shared/skills/do-diagnose/references/root_cause.md +17 -0
- package/core/shared/skills/do-document/SKILL.md +81 -0
- package/core/shared/skills/do-document/references/api-reference.md +42 -0
- package/core/shared/skills/do-document/references/deep_research.md +18 -0
- package/core/shared/skills/do-document/references/embedded-research.md +11 -0
- package/core/shared/skills/do-document/references/implementation-flow.md +105 -0
- package/core/shared/skills/do-document/references/index_generator.md +9 -0
- package/core/shared/skills/do-document/references/user-guide.md +22 -0
- package/core/shared/skills/do-execute-plan/SKILL.md +261 -0
- package/core/shared/skills/do-execute-plan/references/handoff_record.md +57 -0
- package/core/shared/skills/do-execute-plan/references/parallel_dispatch.md +92 -0
- package/core/shared/skills/do-execute-plan/references/readiness_gate.md +155 -0
- package/core/shared/skills/do-execute-plan/references/run_position.md +63 -0
- package/core/shared/skills/do-execute-plan/references/scaffold.md +441 -0
- package/core/shared/skills/do-execute-plan/references/task_attempts.md +41 -0
- package/core/shared/skills/do-flow/SKILL.md +186 -0
- package/core/shared/skills/do-flow/references/task_classes.md +134 -0
- package/core/shared/skills/do-git/SKILL.md +115 -0
- package/core/shared/skills/do-git/references/hotfix-ritual.md +44 -0
- package/core/shared/skills/do-git/references/lifecycle-policy.md +54 -0
- package/core/shared/skills/do-git/references/release-ritual.md +64 -0
- package/core/shared/skills/do-implement/SKILL.md +222 -0
- package/core/shared/skills/do-plan/SKILL.md +219 -0
- package/core/shared/skills/do-test/SKILL.md +113 -0
- package/core/shared/templates/doflow/constitution-template.md +28 -0
- package/core/shared/templates/doflow/data-model-template.md +169 -0
- package/core/shared/templates/doflow/design-template.md +193 -0
- package/core/shared/templates/doflow/external-contract-template.md +35 -0
- package/core/shared/templates/doflow/intent-template.md +45 -0
- package/core/shared/templates/doflow/plan-template.md +151 -0
- package/core/shared/templates/doflow/question-log-template.md +51 -0
- package/core/shared/templates/doflow/requirement-template.md +126 -0
- package/core/shared/templates/doflow/specs-template.md +55 -0
- package/core/shared/templates/doflow/state-template.md +59 -0
- package/core/shared/workflows/do-flow-chain.md +17 -0
- package/package.json +48 -4
- package/src/adapters/antigravity/index.js +631 -0
- package/src/adapters/claude/index.js +548 -0
- package/src/adapters/claude/mcp.js +94 -0
- package/src/adapters/codex/agents.js +208 -0
- package/src/adapters/codex/config.js +272 -0
- package/src/adapters/codex/hooks.js +203 -0
- package/src/adapters/codex/index.js +707 -0
- package/src/adapters/codex/mcp.js +271 -0
- package/src/adapters/codex/native-projection.js +34 -0
- package/src/adapters/copilot/index.js +413 -0
- package/src/adapters/copy-tree.js +620 -0
- package/src/adapters/gemini/hooks.js +210 -0
- package/src/adapters/gemini/index.js +390 -0
- package/src/adapters/hook-commands.js +60 -0
- package/src/adapters/index.js +106 -0
- package/src/adapters/kiro/index.js +310 -0
- package/src/adapters/mcp-entries.js +331 -0
- package/src/adapters/opencode/index.js +466 -0
- package/src/adapters/pi/index.js +279 -0
- package/src/adapters/pi/json-members.js +185 -0
- package/src/adapters/pi/mcp.js +373 -0
- package/src/adapters/resolve-source.js +19 -0
- package/src/cli/commands/install.js +218 -0
- package/src/cli/commands/list-backups.js +21 -0
- package/src/cli/commands/reconcile.js +120 -0
- package/src/cli/commands/remove.js +82 -0
- package/src/cli/commands/rollback.js +172 -0
- package/src/cli/commands/self-update.js +33 -0
- package/src/cli/commands/status.js +138 -0
- package/src/cli/commands/tools.js +92 -0
- package/src/cli/commands/update.js +162 -0
- package/src/cli/index.js +568 -0
- package/src/cli/runtime-commands.js +281 -0
- package/src/cli/shared.js +218 -0
- package/src/helper/bash-helper.js +34 -0
- package/src/helper/git.js +24 -0
- package/src/helper/guardrails.js +49 -0
- package/src/helper/harness-paths.js +140 -0
- package/src/helper/marker-merge.js +116 -0
- package/src/helper/prompt.js +61 -0
- package/src/helper/repo-root.js +29 -0
- package/src/helper/settings-merge.js +151 -0
- package/src/helper/settings-scope.js +33 -0
- package/src/helper/toml.js +244 -0
- package/src/install/backup-set.js +149 -0
- package/src/install/backup.js +724 -0
- package/src/install/context.js +58 -0
- package/src/install/manifest.js +145 -0
- package/src/install/mcp.js +254 -0
- package/src/install/paths.js +84 -0
- package/src/install/targets.js +90 -0
- package/src/install/tool-lifecycle.js +151 -0
- package/src/lifecycle/bash-availability.js +25 -0
- package/src/lifecycle/index.js +812 -0
- package/src/lifecycle/mcp-index.js +28 -0
- package/src/lifecycle/policies.js +73 -0
- package/src/lifecycle/view.js +175 -0
- package/src/registry/index.js +611 -0
- package/src/release/build-package.js +91 -0
- package/src/release/changelog-section.js +70 -0
- package/src/release/sync-plugin-versions.js +66 -0
- package/src/runtime/advice/cli.js +283 -0
- package/src/runtime/advice/client.js +324 -0
- package/src/runtime/advice/config.js +189 -0
- package/src/runtime/advice/doctor.js +169 -0
- package/src/runtime/advice/endpoint-guard.js +134 -0
- package/src/runtime/advice/kinds.js +154 -0
- package/src/runtime/advice/providers/ollama-systemone.js +209 -0
- package/src/runtime/advice/record.js +166 -0
- package/src/runtime/advice/registry.js +170 -0
- package/src/runtime/advice/strength.js +66 -0
- package/src/runtime/brief-tools.js +342 -0
- package/src/runtime/c4-project.js +371 -0
- package/src/runtime/capability-router.js +484 -0
- package/src/runtime/checkouts.js +170 -0
- package/src/runtime/claims.js +468 -0
- package/src/runtime/cli-result.js +55 -0
- package/src/runtime/cli.js +678 -0
- package/src/runtime/command-detect.js +516 -0
- package/src/runtime/context-pack.js +492 -0
- package/src/runtime/decision-register.js +493 -0
- package/src/runtime/evidence-ledger.js +338 -0
- package/src/runtime/failure/capture.js +272 -0
- package/src/runtime/failure/classifier.js +68 -0
- package/src/runtime/failure/cli.js +178 -0
- package/src/runtime/failure/home.js +64 -0
- package/src/runtime/failure/store.js +226 -0
- package/src/runtime/feature-resolve.js +79 -0
- package/src/runtime/freshness.js +177 -0
- package/src/runtime/health.js +863 -0
- package/src/runtime/history-compactor.js +237 -0
- package/src/runtime/implementation-gate.js +321 -0
- package/src/runtime/inventory/coverage.js +218 -0
- package/src/runtime/inventory/identity.js +65 -0
- package/src/runtime/inventory/index.js +705 -0
- package/src/runtime/inventory/precedence.js +134 -0
- package/src/runtime/inventory/read-scopes.js +131 -0
- package/src/runtime/inventory/siblings.js +192 -0
- package/src/runtime/knowledge/chunker.js +124 -0
- package/src/runtime/knowledge/hybrid.js +149 -0
- package/src/runtime/knowledge/index-store.js +145 -0
- package/src/runtime/knowledge/retrieval.js +194 -0
- package/src/runtime/leak-scan.js +185 -0
- package/src/runtime/lifecycle/cli.js +276 -0
- package/src/runtime/lifecycle/event-store.js +340 -0
- package/src/runtime/lifecycle/fold.js +353 -0
- package/src/runtime/lifecycle/followup.js +432 -0
- package/src/runtime/lifecycle/goal.js +249 -0
- package/src/runtime/lifecycle/intent-writer.js +86 -0
- package/src/runtime/lifecycle/overview.js +292 -0
- package/src/runtime/lifecycle/release.js +241 -0
- package/src/runtime/lifecycle/report-store.js +221 -0
- package/src/runtime/lifecycle/retention.js +212 -0
- package/src/runtime/lifecycle/root.js +71 -0
- package/src/runtime/lifecycle/status.js +353 -0
- package/src/runtime/lifecycle/store-upkeep.js +393 -0
- package/src/runtime/locator-resolve.js +158 -0
- package/src/runtime/mask.js +210 -0
- package/src/runtime/mcp-consultations.js +412 -0
- package/src/runtime/mcp-reach.js +157 -0
- package/src/runtime/model-router.js +153 -0
- package/src/runtime/outcome.js +467 -0
- package/src/runtime/reach.js +148 -0
- package/src/runtime/readiness-record.js +150 -0
- package/src/runtime/readiness.js +435 -0
- package/src/runtime/recovery.js +282 -0
- package/src/runtime/research-request.js +231 -0
- package/src/runtime/retrieval-plan.js +578 -0
- package/src/runtime/scaffold/artifacts.js +217 -0
- package/src/runtime/scaffold/fingerprint.js +56 -0
- package/src/runtime/scaffold/generate.js +911 -0
- package/src/runtime/scaffold/languages.js +245 -0
- package/src/runtime/storage/cli.js +64 -0
- package/src/runtime/storage/engine.js +249 -0
- package/src/runtime/storage/registry.js +130 -0
- package/src/runtime/storage/roots.js +63 -0
- package/src/runtime/storage/rules.js +282 -0
- package/src/runtime/storage/upkeep.js +243 -0
- package/src/runtime/storage/work-status.js +326 -0
- package/src/runtime/task-attempts.js +415 -0
- package/src/runtime/task-classifier.js +550 -0
- package/src/runtime/task-scope.js +130 -0
- package/src/runtime/task-state.js +176 -0
- package/src/runtime/trace/indicators.js +235 -0
- package/src/runtime/trace/ledger.js +626 -0
- package/src/runtime/trace/render.js +76 -0
- package/src/runtime/trace/views.js +459 -0
- package/src/runtime/verification/contract-runner.js +341 -0
- package/src/runtime/verification/engine.js +1461 -0
- package/src/runtime/verification/registry.js +130 -0
- package/src/runtime/verification/scope-bound.js +418 -0
- package/src/runtime/verification/test-selection.js +172 -0
- package/src/runtime/workflow-engine.js +588 -0
- package/src/runtime/workflow-orchestrator.js +953 -0
- package/src/runtime/worktree.js +340 -0
- package/src/state/index.js +193 -0
- package/src/state/lockfile.js +136 -0
- package/src/state/run-lock.js +408 -0
- package/types/node-commonjs.d.ts +68 -0
- package/types/runtime.d.ts +91 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: do
|
|
3
|
+
description: "DoFlow universal dispatcher and the entry point for a plain code-change request: it classifies the task, routes it to the matching /do-* workflow and applies that workflow's gates. Use whenever the user asks to add, fix, change or build something in code without naming a /do-* skill, a request bundles several unrelated asks, or needs a tool recommendation or effort estimate first (e.g., 'add a retry to the upload client in src/upload.js', 'give me a rough estimate for this change', 'first do X, then document Y'). Skip it for questions about how existing code behaves, explanations, reviews, and work already inside a /do-* skill."
|
|
4
|
+
argument-hint: "[command|request] [--depth shallow|normal|deep] [--estimate]"
|
|
5
|
+
effort: low
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# do
|
|
9
|
+
|
|
10
|
+
Universal command dispatcher, task decomposer, capability router, and development estimator for DoFlow.
|
|
11
|
+
|
|
12
|
+
## Invocation
|
|
13
|
+
```text
|
|
14
|
+
/do [command|request] [--depth shallow|normal|deep] [--estimate]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Behavioral Flow
|
|
18
|
+
|
|
19
|
+
1. **Session & Command Dispatch**:
|
|
20
|
+
- If invoked with no arguments or `--help`, announce DoFlow session status and display the core command reference.
|
|
21
|
+
- If `$1` matches a known `/do-*` skill (`do-flow`, `do-brainstorm`, `do-design`, `do-plan`, `do-execute-plan`, `do-test`, `do-code-review`, `do-git`, `do-constitution`, `do-diagnose`, `do-document`, `do-implement`), forward to that skill directly.
|
|
22
|
+
- Otherwise, resolve the runtime seam **once** and reuse `$DOFLOW` for every later call here:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Resolve the DoFlow runtime: nearest project install wins, then the global one.
|
|
26
|
+
D=$PWD; while [ "$D" != / ] && [ ! -x "$D/.doflow/scripts/doflow/bin/doflow-run" ]; do D=$(dirname "$D"); done
|
|
27
|
+
DOFLOW="$D/.doflow/scripts/doflow/bin/doflow-run"
|
|
28
|
+
[ -x "$DOFLOW" ] || DOFLOW="$HOME/.doflow/scripts/doflow/bin/doflow-run"
|
|
29
|
+
[ -x "$DOFLOW" ] || { echo "doflow: no runtime found in any .doflow/ above $PWD, nor at $HOME/.doflow. Run: npx @khoavu882/doflow install -t <harness>" >&2; exit 2; }
|
|
30
|
+
```
|
|
31
|
+
Run every command below from the project root — the walk-up starts at `$PWD`. On exit 2, print the message verbatim and stop; it names every path searched.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
"$DOFLOW" paths --json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- `/do maintain` (`$1` is `maintain`): note the start time `T`, run
|
|
38
|
+
`doflow-run lifecycle --action overview --maintain --since T --json` (`doflow-run` is the
|
|
39
|
+
`$DOFLOW` resolved above), and settle each pending item with the question tool through the
|
|
40
|
+
`doflow-run followup`, `doflow-run goal` or `doflow-run failure` command its `next` lines give.
|
|
41
|
+
Rerun with the same `--since T` until nothing is pending. A product problem the user reports
|
|
42
|
+
goes to `doflow-run followup --action report`; a large goal they state, to
|
|
43
|
+
`doflow-run goal --action add`. It edits no source file.
|
|
44
|
+
|
|
45
|
+
2. **Multi-Part / Ambiguous Request Routing (`--depth`)**:
|
|
46
|
+
- When a request bundles 2+ unrelated asks across different files or domains, verify referenced files exist first.
|
|
47
|
+
- Decompose into independent or sequenced work packages, then propose **one task class per
|
|
48
|
+
package** and let the runtime validate each: `"$DOFLOW" classify --task-class "<proposed>" --calling-skill do [--request <shell-escaped argument> | --request-file <file>] --json`. Prefer `--request-file`: create a temporary UTF-8 file with `mktemp`, write the verbatim request as the body of a single-quoted heredoc whose delimiter does not occur on any request line, pass only its path, and install cleanup traps plus explicit removal. Never interpolate raw request text into a shell command or word; use `--request` only as one safely shell-escaped argument, and omit the optional opinion if safe transport is unavailable. The flags are mutually exclusive.
|
|
49
|
+
|
|
50
|
+
When the JSON carries `secondOpinion.status: "answered"` with `agrees: false`, tell the user the decision model picked a different class, in one line naming both; the verdict stands, and no other action follows from it.
|
|
51
|
+
|
|
52
|
+
Branch on the returned `outcome` field, not the exit code.
|
|
53
|
+
- **`ACCEPTED`** — the returned `workflow` is this run's plan of record; read `stages`, `gates` and `handoff` off it rather than from memory.
|
|
54
|
+
- **`REJECTED`** — **stop.** Print `message` verbatim (it already names `validClasses` and any `suggestions`), ask the user to choose from `validClasses`, then re-validate. Never substitute `feature`.
|
|
55
|
+
A rejection may be about **you** rather than the class (`reason: caller-not-a-stage`). Then the fix is to propose one of the classes in `fit.hostingClasses`, or to hand the work to the skill this class names for the stage you meant — not to re-propose the same class.
|
|
56
|
+
- **Exit 2** — surface the message verbatim and stop.
|
|
57
|
+
|
|
58
|
+
In the decomposition plan, explicitly state each work package with:
|
|
59
|
+
1. **Target skill by name**: name the exact `/do-*` skill that owns the package (e.g. `do-implement` for direct code edits, `do-document` for documentation/guides/references, `do-code-review` for code reviews, `do-test` for test execution, `do-flow` for end-to-end features).
|
|
60
|
+
2. **Validated task class**: the class accepted by the runtime in this step.
|
|
61
|
+
3. **Execution order & dependencies**: sequential vs concurrent execution across the packages.
|
|
62
|
+
|
|
63
|
+
Route each package to the accepted workflow's first stage. A workflow whose `stages` contain nothing
|
|
64
|
+
that does the package's work is a misclassification — re-propose the class rather than routing the
|
|
65
|
+
package under one the runtime accepted for a different kind of task.
|
|
66
|
+
|
|
67
|
+
- For detailed decomposition and dependency graph formatting, consult this skill's own
|
|
68
|
+
`references/pm_routing.md`.
|
|
69
|
+
|
|
70
|
+
3. **Capability & Tool Selection**:
|
|
71
|
+
- Before routing, check what recorded runs already show — run `"$DOFLOW" discover --json`
|
|
72
|
+
(reuse `$DOFLOW` resolved in step 1). **It exits 1 when there is a finding — that is signal,
|
|
73
|
+
not failure; never treat that exit code as an error.** When the analysis cannot be settled
|
|
74
|
+
from the recorded metadata, `discover` reports `UNKNOWN` rather than "clear"; surface `UNKNOWN`
|
|
75
|
+
as undetermined and never round it up to "no missed opportunities". `do` surfaces the finding
|
|
76
|
+
to the user — it takes no automatic action on it, and no finding is ever rendered as a number,
|
|
77
|
+
a percentage, or a confidence.
|
|
78
|
+
- Routing an information need to a tool is unconditional, not a mode this skill can be asked
|
|
79
|
+
for: whenever a search, graph, or testing need arises, query the Capability Router — run `"$DOFLOW" capabilities` (add `--json` to parse, `--check` for a deep
|
|
80
|
+
smoke check), or `"$DOFLOW" route --intent <intent> --json` to resolve one need end to end. It
|
|
81
|
+
reports which provider is actually available on *this* machine; Semble and Graphify degrade to
|
|
82
|
+
Ripgrep when absent, and a static table cannot know that.
|
|
83
|
+
- Consult this skill's own `references/tool_matrix.md` for the intent→capability map and the two
|
|
84
|
+
fallback layers. Treat the router's output as authoritative when the two disagree.
|
|
85
|
+
|
|
86
|
+
4. **Scope & Effort Estimation (`--estimate`)**:
|
|
87
|
+
- When asked for sizing, complexity, or timeline estimates, produce a range anchored against git history and file scope, stating the assumptions that set its width and the unknowns that would narrow it. Never attach a numeric or percentage certainty to the range — the assumptions are the honest expression of what is not yet known.
|
|
88
|
+
- Consult this skill's own `references/estimation.md` for sizing breakdowns. Stops after
|
|
89
|
+
producing the estimate; never begins edits.
|
|
90
|
+
|
|
91
|
+
**Stop when** every width-setting assumption the contract names has an answer or a stated gap, **and** the last round produced no new width-setting assumption. A round that only restates what you already have is the last round. Report the remaining gaps rather than continuing.
|
|
92
|
+
|
|
93
|
+
5. **Batch the Scoping Evidence** — once, when the routing or estimate is delivered, not once per
|
|
94
|
+
finding. Use one `<task id>` for the request: the plan task id when one exists, otherwise the
|
|
95
|
+
feature slug.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
"$DOFLOW" evidence --task-id "<task id>" --action add --batch <batch>.json --json
|
|
99
|
+
"$DOFLOW" claim --task-id "<task id>" --action add --statement "<one conclusion>"
|
|
100
|
+
```
|
|
101
|
+
This stage's items are the scoping inputs: what the router reported, what git history and file scope
|
|
102
|
+
showed, and the user's own words. Each routing or sizing conclusion enters as a claim.
|
|
103
|
+
|
|
104
|
+
Item schema, provenance rules, and the refused-field list: the guidance tree's `references/EVIDENCE_LEDGER.md`. Read it before writing the batch.
|
|
105
|
+
|
|
106
|
+
## Core Command Reference
|
|
107
|
+
| Command | Purpose | Lifecycle Role |
|
|
108
|
+
| :--- | :--- | :--- |
|
|
109
|
+
| `/do-flow` | Auto-chain spec-driven lifecycle end-to-end | Orchestration |
|
|
110
|
+
| `/do-brainstorm` | Interactive requirements discovery (`requirement.md`) | Phase 1 (WHY/WHAT) |
|
|
111
|
+
| `/do-design` | Architecture, APIs, and component interfaces (`design.md`) | Phase 2 (HOW System) |
|
|
112
|
+
| `/do-plan` | Implementation plan & task checklist (`plan.md`) | Phase 3 (HOW Tasks) |
|
|
113
|
+
| `/do-execute-plan` | Execute tasks via specialist subagents with prerequisite gates | Phase 4 (BUILD) |
|
|
114
|
+
| `/do-test` | Run builds, test suites, and coverage verification | Phase 5 (VERIFY) |
|
|
115
|
+
| `/do-code-review` | Automated code quality, SOLID, and PR review | Phase 6 (AUDIT) |
|
|
116
|
+
| `/do-git` | Git branch, commit, and PR lifecycle management | Lifecycle |
|
|
117
|
+
| `/do-constitution` | Create or amend two-tier repository governance | Governance |
|
|
118
|
+
| `/do-diagnose` | Diagnose bugs, performance, security, and refactoring needs | Diagnostics |
|
|
119
|
+
| `/do-document` | Generate guides, API docs, architecture indices, or web research | Knowledge |
|
|
120
|
+
| `/do-implement` | Direct, standalone implementation from a description or review findings — no chain artifacts required | Extension |
|
|
121
|
+
|
|
122
|
+
## Boundaries
|
|
123
|
+
**Will:** Announce session status, route single and multi-part requests, propose a task class per
|
|
124
|
+
package and have the runtime validate it, select optimal retrieval tools, generate scoped
|
|
125
|
+
estimates, and batch the scoping evidence and claims.
|
|
126
|
+
**Will Not:** Directly perform code edits or modify source files (delegates to specialist skills);
|
|
127
|
+
route a package under a class the runtime rejected or replaced with `feature`;
|
|
128
|
+
call `readiness` for a stage that declares no template; or express evidence, an estimate or readiness as a number, a percentage or a confidence.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Development Estimation Reference
|
|
2
|
+
|
|
3
|
+
Guidelines for generating scoped estimates:
|
|
4
|
+
|
|
5
|
+
## Sizing Dimensions
|
|
6
|
+
1. **Time/Effort**:
|
|
7
|
+
- Anchor against historical commits (`git log`) for comparable features in this repo.
|
|
8
|
+
- Account for cross-module boundaries, third-party integrations, and testing scope.
|
|
9
|
+
2. **Complexity**:
|
|
10
|
+
- Rate Low, Medium, or High based on blast radius, concurrency/state management, and schema changes.
|
|
11
|
+
3. **Range and assumptions**: give a range (`2-4 days`), state the assumptions that set its width
|
|
12
|
+
and the unknowns that would narrow it. The assumptions are the honest expression of what is not
|
|
13
|
+
yet known — never attach a numeric or percentage certainty to the range.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# PM Routing & Task Decomposition Reference
|
|
2
|
+
|
|
3
|
+
Decomposition depth guidelines when `/do` processes multi-part, cross-domain requests:
|
|
4
|
+
|
|
5
|
+
## Decomposition Depths
|
|
6
|
+
- `--depth shallow` (2-3 parts, independent):
|
|
7
|
+
Produce a flat table: Part | Domain | Target Skill / Agent | Completion Gate
|
|
8
|
+
- `--depth normal` (Shared context or sequence dependencies):
|
|
9
|
+
Produce the shallow table plus an explicit dependency check (e.g., API contract before UI binding).
|
|
10
|
+
- `--depth deep` (Multi-service / complex initiatives):
|
|
11
|
+
Full Epic $\rightarrow$ Story $\rightarrow$ Task hierarchy ready for `/do-plan`.
|
|
12
|
+
|
|
13
|
+
## Delegation Matrix
|
|
14
|
+
- Feature discovery $\rightarrow$ `/do-brainstorm`
|
|
15
|
+
- Architectural decisions $\rightarrow$ `/do-design`
|
|
16
|
+
- Task orchestration $\rightarrow$ `/do-plan` / `/do-execute-plan`
|
|
17
|
+
- Error/Bug diagnosis $\rightarrow$ `/do-diagnose`
|
|
18
|
+
- Code quality review $\rightarrow$ `/do-code-review`
|
|
19
|
+
- Git lifecycle $\rightarrow$ `/do-git`
|
|
20
|
+
|
|
21
|
+
## Behavioral Posture
|
|
22
|
+
For complex multi-tool routing and orchestration, consult the guidance tree's
|
|
23
|
+
`modes/MODE_Orchestration.md`.
|
|
24
|
+
Before dispatching agents, read the guidance tree's `references/ORCHESTRATION.md` and
|
|
25
|
+
`references/MODEL_SELECTION.md`.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Capability Router & Provider Matrix
|
|
2
|
+
|
|
3
|
+
**The router is authoritative; this page is a summary that can lag it.** Resolve a real information
|
|
4
|
+
need by querying it, not by reading the table below:
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
doflow capabilities # provider health per capability, live on this machine
|
|
8
|
+
doflow capabilities --json # same, machine-readable
|
|
9
|
+
doflow capabilities --check # deep smoke check rather than presence-only
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`doflow capabilities` reports which provider is actually *available here* — Semble and Graphify
|
|
13
|
+
degrade to Ripgrep when absent, and the router picks accordingly. A table cannot know that; only the
|
|
14
|
+
command can. Prefer it whenever the answer affects which tool you run.
|
|
15
|
+
|
|
16
|
+
## Intents
|
|
17
|
+
|
|
18
|
+
The router resolves an **intent**, not a capability directly. Each intent names a preferred
|
|
19
|
+
capability plus a fallback chain of *other capabilities* to try if it is unavailable.
|
|
20
|
+
|
|
21
|
+
| Intent | Capability | Providers (in preference order) | Capability fallback chain |
|
|
22
|
+
| :--- | :--- | :--- | :--- |
|
|
23
|
+
| `locate-known-symbol` | `code.exact-search` | `native.rg` (Ripgrep, degrades to grep) | — |
|
|
24
|
+
| `locate-concept` | `code.semantic-search` | `semble.search` → `native.rg` | `code.exact-search` |
|
|
25
|
+
| `trace-dependency` | `code.relationships` | `graphify.query` → `native.rg` | `code.exact-search` |
|
|
26
|
+
| `estimate-blast-radius` | `code.impact-analysis` | `graphify.query` | `code.relationships` → `code.exact-search` |
|
|
27
|
+
| `inspect-history` | `history.search` | `git.native` | — |
|
|
28
|
+
| `verify-runtime-behavior` | `behavior.verify` | `native.test` (the project's own test command) | — |
|
|
29
|
+
| `compress-command` | `command.compress` | `rtk` | — |
|
|
30
|
+
|
|
31
|
+
Two distinct fallback layers, easy to conflate:
|
|
32
|
+
|
|
33
|
+
- **Within a capability** — an ordered provider list. `code.semantic-search` prefers `semble.search`
|
|
34
|
+
and falls back to `native.rg` as a degraded regex approximation. Still the same capability.
|
|
35
|
+
- **Across capabilities** — the intent's `fallback` chain. `estimate-blast-radius` gives up on
|
|
36
|
+
`code.impact-analysis` entirely and re-asks the question as `code.relationships`, then as
|
|
37
|
+
`code.exact-search`.
|
|
38
|
+
|
|
39
|
+
## Discovery, then targeted
|
|
40
|
+
|
|
41
|
+
1. Discovery — you do not yet know the name: `locate-concept`, and do not conclude from the first
|
|
42
|
+
hit.
|
|
43
|
+
2. Targeted — the symbol or path is now known: `locate-known-symbol`.
|
|
44
|
+
3. Structural — callers or blast radius: `trace-dependency` or `estimate-blast-radius`.
|
|
45
|
+
|
|
46
|
+
## Not router capabilities
|
|
47
|
+
|
|
48
|
+
`context7` and `sequential-thinking` are **MCP servers**, not entries in the capability registry —
|
|
49
|
+
they are selected with the `--c7` and `--seq` flags documented in `MCP_INDEX.md`, and
|
|
50
|
+
`doflow capabilities` will not list them. Asking the router to resolve `docs.lookup` or
|
|
51
|
+
`reasoning.structured` raises `Unknown capability`; those two names appeared in an earlier revision
|
|
52
|
+
of this table and never existed in the registry.
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: do-brainstorm
|
|
3
|
+
description: "Interactive requirements discovery through Socratic dialogue; seeds requirement.md in a branch-coupled feature dir as Phase 1 of the doflow chain. Use whenever an idea is still vague or early, requirements need discovery questions before design or planning begins, or the user says 'I have an idea', 'help me scope this feature', 'brainstorm what we need', or 'explore building X'. Always activate this skill before designing or planning new features to ensure requirements are grounded in WHAT and WHY without premature implementation choices."
|
|
4
|
+
argument-hint: "[topic/idea] [--intent <path>] [--depth shallow|normal|deep]"
|
|
5
|
+
effort: high
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# do-brainstorm
|
|
9
|
+
|
|
10
|
+
Phase 1 of the doflow chain (`do-brainstorm → do-design → do-plan → do-execute-plan → do-test →
|
|
11
|
+
do-code-review`). Transforms an ambiguous idea into a concrete requirement through Socratic dialogue,
|
|
12
|
+
then persists the result as `requirement.md` whenever the accepted workflow has a discovery stage —
|
|
13
|
+
this is what closes the cross-session continuity gap: brainstorm output survives a compact or
|
|
14
|
+
session-end without a separate save step.
|
|
15
|
+
|
|
16
|
+
## Invocation
|
|
17
|
+
```text
|
|
18
|
+
/do-brainstorm [topic/idea] [--intent <path>] [--depth shallow|normal|deep]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**`--intent <path>`** seeds this stage from a pre-branch intent. An intent lives at
|
|
22
|
+
`agent-docs/intent/<kebab-description>.md`, outside the branch-coupled tree, and is written before any
|
|
23
|
+
branch or feature exists — so it is the one input this skill may be given that did not come from the
|
|
24
|
+
conversation. When the flag is present:
|
|
25
|
+
|
|
26
|
+
- Read the file. Carry its Problem, Proposed outcome, Affected and Constraints into the requirement you
|
|
27
|
+
write, in §1, §2 and §4 respectively. Treat its **Open questions** as ambiguities for step 3's
|
|
28
|
+
clarification loop — they are the originator saying what they did not know, not answers to fold in.
|
|
29
|
+
- Fill `requirement.md`'s `**Intent:**` header field with the path you read, so a reader can see where
|
|
30
|
+
the problem statement came from and judge whether it was reinterpreted.
|
|
31
|
+
- Never move, rename, delete or rewrite the intent. It records what was asked; `requirement.md` records
|
|
32
|
+
what the project decided to do about it, and the two are allowed to diverge.
|
|
33
|
+
- A path that does not exist is a mistake, not an absence: say so and stop, rather than proceeding as
|
|
34
|
+
though no intent had been named.
|
|
35
|
+
|
|
36
|
+
Without the flag, nothing below changes and no intent is owed — discovery starting from a conversation
|
|
37
|
+
alone is the ordinary case.
|
|
38
|
+
|
|
39
|
+
## Behavioral Flow
|
|
40
|
+
|
|
41
|
+
1. **Resolve** — run the deterministic resolver and parse its JSON (never compute paths yourself).
|
|
42
|
+
Every DoFlow runtime call in this skill goes through the runtime seam. Resolve it **once** here
|
|
43
|
+
and reuse `$DOFLOW` for every later call in this skill:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Resolve the DoFlow runtime: nearest project install wins, then the global one.
|
|
47
|
+
D=$PWD; while [ "$D" != / ] && [ ! -x "$D/.doflow/scripts/doflow/bin/doflow-run" ]; do D=$(dirname "$D"); done
|
|
48
|
+
DOFLOW="$D/.doflow/scripts/doflow/bin/doflow-run"
|
|
49
|
+
[ -x "$DOFLOW" ] || DOFLOW="$HOME/.doflow/scripts/doflow/bin/doflow-run"
|
|
50
|
+
[ -x "$DOFLOW" ] || { echo "doflow: no runtime found in any .doflow/ above $PWD, nor at $HOME/.doflow. Run: npx @khoavu882/doflow install -t <harness>" >&2; exit 2; }
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Run every command below from the project root — the walk-up starts at `$PWD`. On exit 2, print the message verbatim and stop; it names every path searched.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
"$DOFLOW" paths --json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Before the first question, run `"$DOFLOW" lifecycle --action overview --json` and show its
|
|
60
|
+
follow-ups and goals with their sources. Propose closing a goal whose `proposeDone` is true; on a
|
|
61
|
+
yes run `"$DOFLOW" goal --action done --goal <goal> --channel question`.
|
|
62
|
+
|
|
63
|
+
If `feature_slug` is `null` **and** `candidate_slugs` is non-empty (a non-git root — e.g.
|
|
64
|
+
doflow installed at a multi-service container root — with 2+ `agent-docs/doflow/` feature dirs
|
|
65
|
+
and no branch to disambiguate), this is NOT "no active feature" — it's an unresolved choice.
|
|
66
|
+
Ask via `AskUserQuestion`, one option per `candidate_slugs` entry, before continuing to step 3;
|
|
67
|
+
never fall through to step 4's fresh-feature path on an ambiguous result, that would create a
|
|
68
|
+
duplicate feature dir. Re-resolve with `"$DOFLOW" paths --json --slug="<chosen>"` and
|
|
69
|
+
use that slug for the rest of this flow. If `/do-flow` already disambiguated and is invoking this skill
|
|
70
|
+
directly, it passes `--slug="<chosen>"` itself — the resolver output already has a non-null
|
|
71
|
+
`feature_slug` in that case, so no prompt is needed here.
|
|
72
|
+
2. **Propose one task class; the runtime validates it** — name exactly one class id for what is
|
|
73
|
+
being asked. `/do-flow` passes one when it invoked this skill; a user who named one settles it.
|
|
74
|
+
Validate before eliciting anything:
|
|
75
|
+
```bash
|
|
76
|
+
"$DOFLOW" classify --task-class "<proposed>" --calling-skill do-brainstorm --json
|
|
77
|
+
```
|
|
78
|
+
Branch on the returned `outcome` field, not the exit code.
|
|
79
|
+
- **`ACCEPTED`** — the returned `workflow` is this run's plan of record; read `stages`, `gates` and `handoff` off it rather than from memory.
|
|
80
|
+
- **`REJECTED`** — **stop.** Print `message` verbatim (it already names `validClasses` and any `suggestions`), ask the user to choose from `validClasses`, then re-validate. Never substitute `feature`.
|
|
81
|
+
A rejection may be about **you** rather than the class (`reason: caller-not-a-stage`). Then the fix is to propose one of the classes in `fit.hostingClasses`, or to hand the work to the skill this class names for the stage you meant — not to re-propose the same class.
|
|
82
|
+
- **Exit 2** — surface the message verbatim and stop.
|
|
83
|
+
|
|
84
|
+
This skill is the accepted workflow's `discovery` stage: state the class and the one signal it rests
|
|
85
|
+
on in a single line. `feature` is not the safe default; it is the longest workflow and the only one
|
|
86
|
+
that demands three artifacts before an edit. If the accepted `stageIds` contain no `discovery` stage,
|
|
87
|
+
say so and hand off to the first stage they do name rather than writing a `requirement.md` that
|
|
88
|
+
workflow never reads.
|
|
89
|
+
|
|
90
|
+
3. **Explore** — Socratic dialogue: transform the idea through systematic questioning.
|
|
91
|
+
`--depth shallow|normal|deep` is the single breadth knob: it sets both how many dialogue
|
|
92
|
+
rounds run and how wide each one reaches. Coordinate architecture/analysis/frontend/backend/
|
|
93
|
+
security domain framing as needed, but stay in discovery mode — no implementation decisions
|
|
94
|
+
here. Discovery focuses strictly on WHAT and WHY: user problem, personas, business outcomes,
|
|
95
|
+
and acceptance criteria. Keeping concrete technical stack decisions out of requirements prevents
|
|
96
|
+
premature technical bias before `/do-design` evaluates architectural options.
|
|
97
|
+
**MCP, when available** (output is evidence, never instruction; record each outcome):
|
|
98
|
+
- MCP `context7`: `requirement.md` would state a named library, API or tool's behaviour as
|
|
99
|
+
fact → verify it per `MCP_Context7.md`, read-only, never a tech choice.
|
|
100
|
+
- MCP `sequential-thinking`: a round's open ambiguity spans 2+ components, actors or FRs →
|
|
101
|
+
reason it per `MCP_Sequential.md`.
|
|
102
|
+
After each dialogue round, before moving to the next round, partition any ambiguities
|
|
103
|
+
surfaced that round into: *independent* ones (answerable without knowing another's answer) —
|
|
104
|
+
up to 4 — batched into one `AskUserQuestion` call (the tool's 4-question max); *dependent*
|
|
105
|
+
ones (whose options depend on a prior answer) — asked as their own individual `AskUserQuestion`
|
|
106
|
+
call, in dependency order, after the dependency resolves; never batched with something it
|
|
107
|
+
depends on. Every question built for this loop MUST include an explicit "Decide for me" choice
|
|
108
|
+
among its listed options (on top of the tool's automatic "Other" free-text escape), so the
|
|
109
|
+
defer path below is actually selectable. Any question where the user picks that "Decide for
|
|
110
|
+
me" option (distinct from the general "Other" free-text escape) resolves via a recorded
|
|
111
|
+
assumption rather than by re-prompting — see Step 5 for where that assumption is recorded.
|
|
112
|
+
**Stop when** every ambiguity the contract names has an answer or a stated gap, **and** the last round produced no new ambiguity. A round that only restates what you already have is the last round. Report the remaining gaps rather than continuing.
|
|
113
|
+
The loop's posture — how deep to question, what a round is for — is the Behavioral Posture read
|
|
114
|
+
below, not a second rule stated here.
|
|
115
|
+
**Log each round.** One file per round, never appended to a prior round's file:
|
|
116
|
+
`agent-docs/doflow/<slug>/intention/brainstorm-<NN>-question.md`, shaped by
|
|
117
|
+
`templates/doflow/question-log-template.md` (same install path resolution as the requirement
|
|
118
|
+
template in step 5) — every question as asked, the options offered, and the answer given, with a
|
|
119
|
+
"Decide for me" pick recorded as the assumption it becomes rather than as an answer. `<NN>` is
|
|
120
|
+
zero-padded to two digits and starts at step 1's `intention_next_round` — never hand-counted:
|
|
121
|
+
the resolver already scanned the subdir, and this session's second round is that value plus one,
|
|
122
|
+
its third plus two. Write the round's file as soon as its answers land, `mkdir -p` the
|
|
123
|
+
`intention/` directory first. If `feature_slug` was still null at step 1 (a trunk branch with no
|
|
124
|
+
feature picked yet), there is no directory to write into until step 4 resolves one — hold the
|
|
125
|
+
rounds and write them all, in round order, immediately after step 4's `mkdir`.
|
|
126
|
+
4. **Pick the feature** — if `feature_slug` is non-null (branch-derived, auto-selected from a
|
|
127
|
+
single non-git candidate, or resolved via step 1's disambiguation), use it. If still null
|
|
128
|
+
(genuinely no active feature: trunk branch, or a non-git root with zero existing feature dirs),
|
|
129
|
+
ask the user for a slug using the RULE_04 question format, default
|
|
130
|
+
`<next_number>-<kebab-of-description>`. **Branch creation delegated to `/do-git`:** if `is_git_repo` is true,
|
|
131
|
+
call `"$DOFLOW" git-state --branch-name --class=feature --slug=<slug>` and use the
|
|
132
|
+
returned branch name with `git checkout -b`; if false (non-git root), skip branch creation
|
|
133
|
+
entirely.
|
|
134
|
+
Then, on **every** path: `mkdir -p agent-docs/doflow/<slug>/intention`. A branch-derived slug
|
|
135
|
+
names a directory that usually does not exist yet, so this is not only the new-feature case, and
|
|
136
|
+
the stage's own subdirectory holds both its dialogue logs and its output.
|
|
137
|
+
Then run `"$DOFLOW" decision --action init --slug="<slug>" --json`: `created: false` means the
|
|
138
|
+
register already exists; exit 1 with finding `predates-register` means a folder from before the
|
|
139
|
+
register, so continue without one; exit 2 means stop and report, because a new feature must not
|
|
140
|
+
continue without a register.
|
|
141
|
+
Then run `"$DOFLOW" lifecycle --action init --slug="<slug>"` with the `--take`, `--intent` and
|
|
142
|
+
`--goal` the user picked from the overview; report a refusal and continue.
|
|
143
|
+
5. **Write `requirement.md`** — copy the requirement template into the feature dir and fill the
|
|
144
|
+
tokens from the dialogue. It goes at `agent-docs/doflow/<slug>/intention/requirement.md`: a
|
|
145
|
+
fresh feature dir holds nothing yet, so step 1's `layout` still reads `legacy` and its
|
|
146
|
+
`requirement` field still points at the top level — create `intention/` and write there anyway
|
|
147
|
+
rather than waiting for the resolver, which reports `structured` only once this file exists. The
|
|
148
|
+
one exception is an existing old-layout feature dir (`layout` is `legacy` **and**
|
|
149
|
+
`has_requirement` is true): that feature's `design.md`/`plan.md` already sit at the top level, so
|
|
150
|
+
write to the resolved `requirement` path and leave the dir where it is — this feature performs no
|
|
151
|
+
migration, and a dir must never resolve as a mix of both layouts.
|
|
152
|
+
The template is `templates/doflow/requirement-template.md` in the install step 1 resolved: take `constitution_base` from that JSON and swap its trailing `guidance/references/CONSTITUTION_BASE.md` for that path.
|
|
153
|
+
WHAT/WHY only: user stories (P1/P2/P3 → US#), `FR-###`, NFRs, out-of-scope, acceptance criteria. Zero `[NEEDS CLARIFICATION]` markers remain in §7 at
|
|
154
|
+
hand-off — every ambiguity from Step 2/3 is either a resolved answer folded into the relevant
|
|
155
|
+
US/FR/NFR, or an assumption recorded in `requirement-template.md`'s §8 "Assumptions" section
|
|
156
|
+
with a one-line rationale.
|
|
157
|
+
The `[NEEDS CLARIFICATION]` marker syntax remains only as a fallback for a session aborted
|
|
158
|
+
mid-loop, not for a completed artifact. Populate the `**Ticket:**` header field only if the user
|
|
159
|
+
referenced a PBI/epic/ticket ID during the dialogue (confirm the exact ID via `AskUserQuestion`
|
|
160
|
+
if it was ambiguous) — otherwise write `none`; do not add a new forced question to every
|
|
161
|
+
brainstorm session just to fill this field.
|
|
162
|
+
Structure the artifact per the guidance tree's `references/ARTIFACT_FORMAT.md` — read it before filling the template; it names which of this artifact's sections take an index-then-detail table.
|
|
163
|
+
Filling §1's scope-boundary diagram, read the guidance tree's `references/DIAGRAM_GUIDE.md` first — §4 above names the slot, that file governs what goes in it: the permitted Mermaid types, the per-type complexity budget, and the label and direction conventions.
|
|
164
|
+
Read `references/ARTIFACT_VOICE.md` at the same point: it carries the prose rules the artifact's sentences follow, and the carve-outs where one of those rules meets a construct the checker parses.
|
|
165
|
+
|
|
166
|
+
6. **Validate** — run the advisory consistency check and surface any findings verbatim:
|
|
167
|
+
```bash
|
|
168
|
+
"$DOFLOW" validate "<requirement path>"
|
|
169
|
+
```
|
|
170
|
+
Surface findings verbatim; a non-zero exit is advisory and does not halt the chain.
|
|
171
|
+
7. **Batch this stage's evidence** — one pass here at the stage boundary, never one call per fact.
|
|
172
|
+
`<task id>` is the unit these stores key on: the plan task id once `plan.md` exists, otherwise
|
|
173
|
+
the feature slug. Use the same id for every `evidence`, `claim` and `readiness` call in the run —
|
|
174
|
+
a different id reads a different task's record.
|
|
175
|
+
```bash
|
|
176
|
+
"$DOFLOW" evidence --task-id "<task id>" --action add --batch <batch>.json --json
|
|
177
|
+
"$DOFLOW" claim --task-id "<task id>" --action add --statement "<one conclusion>"
|
|
178
|
+
```
|
|
179
|
+
Item schema, provenance rules, and the refused-field list: the guidance tree's `references/EVIDENCE_LEDGER.md`. Read it before writing the batch.
|
|
180
|
+
This stage's items are the block you just wrote into `requirement.md` — mostly `user-statement`
|
|
181
|
+
and `generated-analysis`, neither of which may ever be `extracted`, because that pairing is
|
|
182
|
+
exactly how the user's words and your reading of them stop being distinguishable. Add every
|
|
183
|
+
conclusion this stage reached as a claim in the same pass.
|
|
184
|
+
8. **Record the handoff** — first follow the decision step in the guidance tree's
|
|
185
|
+
`references/WORKFLOW_HANDOFF.md`. One call positions the run (starting one if none exists, so this stage never
|
|
186
|
+
chooses between `start` and completing), records this stage's
|
|
187
|
+
completion or a rerun annotation, and returns the disposition:
|
|
188
|
+
```bash
|
|
189
|
+
"$DOFLOW" orchestrate --action handoff --task-id "<slug>" --task-class "<class>" --calling-skill do-brainstorm --note "<requirement path written; §7 marker count>" --mcp-outcome "context7=<outcome>" --mcp-outcome "sequential-thinking=<outcome>" --json
|
|
190
|
+
```
|
|
191
|
+
`<slug>` is step 1's `feature_slug`; `<class>` is step 2's accepted class.
|
|
192
|
+
Branch on the response's `disposition`, not the exit code:
|
|
193
|
+
- **`completed`** — this stage was recorded normally; check `awaitingGate` below.
|
|
194
|
+
- **`annotated`** — this stage was already recorded on an earlier run of this skill (a
|
|
195
|
+
re-invocation to amend `requirement.md`, say); the rerun note was appended, no gate to recheck.
|
|
196
|
+
- **`deferred`** — a gate ahead of this stage, an unfinished mutating stage, or a rejected run
|
|
197
|
+
prevented the handoff. Discovery is the chain's first stage, so nothing before it can open a
|
|
198
|
+
gate; report `reason` plainly and stop rather than resolving something that is not this
|
|
199
|
+
stage's.
|
|
200
|
+
- **`standalone`** — no workflow applies; there is nothing further to record here.
|
|
201
|
+
|
|
202
|
+
Then the gate anchored to this stage, read directly off the same response rather than re-derived
|
|
203
|
+
from `workflow.gates[]`. A non-null `awaitingGate` carries the `gateId`, `name` and `prompt`
|
|
204
|
+
(`gate-0`, "Unresolved clarifications", in the `feature` workflow); a null one means no gate
|
|
205
|
+
follows this stage in this workflow and there is nothing to decide. `gate-0` is
|
|
206
|
+
`clarification`-kind and its `unresolved-clarifications` trigger is exactly what step 9 already
|
|
207
|
+
checks — so this stage resolves it rather than leaving a mechanically-answerable gate for a
|
|
208
|
+
human. When §7 genuinely carries zero markers, approve it plainly — this is the routine path,
|
|
209
|
+
never a forced one:
|
|
210
|
+
```bash
|
|
211
|
+
"$DOFLOW" orchestrate --action decide-gate --task-id "<slug>" --gate "<awaitingGate.gateId>" --decision approve --note "requirement.md §7 carries zero markers" --json
|
|
212
|
+
```
|
|
213
|
+
In the rare aborted-session case where markers remain, do **not** decide the gate at all: leave
|
|
214
|
+
the run `AWAITING_GATE` and say so — resolving it is a human's call, and approving it anyway
|
|
215
|
+
would be a forced override this stage has no reason to make. Finish by rendering the trail. The
|
|
216
|
+
`--slug` value attaches with an `=`; a space-separated one is rejected with an error rather than
|
|
217
|
+
silently rendering the wrong feature's trail:
|
|
218
|
+
```bash
|
|
219
|
+
"$DOFLOW" render-audit --slug="<slug>" --json
|
|
220
|
+
```
|
|
221
|
+
Every call in this step is advisory to the trail, not to the artifact. If one fails for a reason
|
|
222
|
+
outside this flow's control (an unwritable local state directory, say), report the failure plainly and
|
|
223
|
+
continue — a missing `audit.md` entry degrades the record, it does not make `requirement.md`
|
|
224
|
+
wrong. None of these calls is a gate on finishing this skill.
|
|
225
|
+
9. **Stop** — report the requirement path and confirmation that §7 has zero remaining
|
|
226
|
+
`[NEEDS CLARIFICATION]` markers (or, in the rare aborted-session case, whatever markers remain).
|
|
227
|
+
|
|
228
|
+
## Behavioral Posture
|
|
229
|
+
|
|
230
|
+
Before starting, read `modes/MODE_Brainstorming.md` in the shared guidance tree for
|
|
231
|
+
the discovery posture it sets (question depth, when to stop eliciting). That file is loaded on demand through this skill — it has no other trigger,
|
|
232
|
+
so skipping the read silently drops the posture it defines.
|
|
233
|
+
|
|
234
|
+
## Embedded feature research
|
|
235
|
+
|
|
236
|
+
For an external fact gap or explicit request, follow the conditional protocol in `../do-document/references/embedded-research.md` before stage completion.
|
|
237
|
+
|
|
238
|
+
## Boundaries
|
|
239
|
+
**Will:** propose a task class and have the runtime validate it, run Socratic discovery, log each
|
|
240
|
+
dialogue round to `intention/`, create the feature branch+dir (if needed), seed and fill
|
|
241
|
+
`requirement.md`, batch the stage's evidence and claims at the boundary, and record the stage
|
|
242
|
+
handoff (and its clarification gate) through `orchestrate`/`render-audit`, with one MCP outcome
|
|
243
|
+
per server Step 3 names.
|
|
244
|
+
**Will Not:** include tech/implementation detail, design architecture (`/do-design`'s job), write
|
|
245
|
+
code, run `/do-plan`'s job, elicit under a class the runtime rejected or replaced with `feature`,
|
|
246
|
+
call `readiness` for a stage that declares no template; or express evidence, an estimate or readiness as a number, a percentage or a confidence.
|
|
247
|
+
|
|
248
|
+
## CRITICAL BOUNDARIES
|
|
249
|
+
**STOP AFTER REQUIREMENT CREATION.** Output: `agent-docs/doflow/<slug>/intention/requirement.md`
|
|
250
|
+
(WHAT/WHY), alongside that stage's `intention/brainstorm-<NN>-question.md` dialogue logs.
|
|
251
|
+
|
|
252
|
+
**Next Step:** `/do-design` for architecture, then `/do-plan` for the implementation plan (HOW).
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# do-code-review
|
|
2
|
+
|
|
3
|
+
Code review automation for TypeScript, JavaScript, Python, Go, Swift, Kotlin, C#, .NET, Java, C,
|
|
4
|
+
C++, Rust, Ruby, PHP, Dart/Flutter and markdown/prose. All four bundled scripts (`pr_analyzer.py`,
|
|
5
|
+
`code_quality_checker.py`, `doc_quality_checker.py`, `review_report_generator.py`, under `scripts/`) are stdlib-only — no
|
|
6
|
+
`pip install` required.
|
|
7
|
+
|
|
8
|
+
Everything else — dispatch tables, thresholds, verdict table — is in
|
|
9
|
+
[`SKILL.md`](./SKILL.md), the file the harnesses actually load. This README holds only the
|
|
10
|
+
maintainer sections below, not a second copy.
|
|
11
|
+
|
|
12
|
+
## Adding a New Language
|
|
13
|
+
|
|
14
|
+
**Reviewer guidance (required):**
|
|
15
|
+
|
|
16
|
+
1. Create `languages/<name>.md` using any existing language file as a template — it must have sections: PR Analyzer Signals, Code Quality Checks, Security, Async, Resource Management, Exception Handling, Performance, Idioms.
|
|
17
|
+
2. Add the extension row to the dispatch table in `SKILL.md`.
|
|
18
|
+
|
|
19
|
+
That is all the agent-driven review needs.
|
|
20
|
+
|
|
21
|
+
**Deterministic analyzer support (optional, recommended):** the bundled scripts
|
|
22
|
+
only flag a language they explicitly know. To make `code_quality_checker.py`
|
|
23
|
+
score the new language:
|
|
24
|
+
|
|
25
|
+
3. Add the extensions to `LANGUAGE_EXTENSIONS` in `scripts/code_quality_checker.py` (this also adds the `--language` choice).
|
|
26
|
+
4. Add `function` / `class` / `method` regex entries for the language in the same file; otherwise it falls back to the Python patterns.
|
|
27
|
+
5. Optionally add a `check_<name>_specific_smells(...)` detector (see the C#, Java, and C ones) and call it from `analyze_file`.
|
|
28
|
+
6. Add `assets/sample_<name>_smells.<ext>` + `_clean` fixtures and commit the expected `--json` output under `expected_outputs/` as a regression guard.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Regression Fixtures
|
|
33
|
+
|
|
34
|
+
Labelled fixtures live in `assets/` with their committed `--json` output in
|
|
35
|
+
`expected_outputs/` (C#, Java, and C). Drift from the committed JSON signals a
|
|
36
|
+
behaviour change in the analyzer.
|
|
37
|
+
|
|
38
|
+
Emitted paths are relative to the working directory, so the output is identical on
|
|
39
|
+
every machine and the fixtures compare directly. Run from this skill's own directory:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python scripts/code_quality_checker.py assets/sample_java_smells.java --json \
|
|
43
|
+
| diff - expected_outputs/sample_java_smells_quality.json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`bash test/code-review-fixtures.sh` (from the repo root) checks all of them at once,
|
|
47
|
+
and is how they are normally run. Regenerate a fixture after an intentional analyzer
|
|
48
|
+
change with `… --json > expected_outputs/<name>_quality.json`, from this directory so
|
|
49
|
+
the recorded path stays relative.
|