@khoavu882/doflow 0.0.0-stage → 2.0.0-beta.3
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 +1057 -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 +46 -4
- package/src/adapters/antigravity/index.ts +631 -0
- package/src/adapters/claude/index.ts +548 -0
- package/src/adapters/claude/mcp.ts +94 -0
- package/src/adapters/codex/agents.ts +208 -0
- package/src/adapters/codex/config.ts +272 -0
- package/src/adapters/codex/hooks.ts +203 -0
- package/src/adapters/codex/index.ts +707 -0
- package/src/adapters/codex/mcp.ts +271 -0
- package/src/adapters/codex/native-projection.ts +34 -0
- package/src/adapters/copilot/index.ts +413 -0
- package/src/adapters/copy-tree.ts +620 -0
- package/src/adapters/gemini/hooks.ts +210 -0
- package/src/adapters/gemini/index.ts +390 -0
- package/src/adapters/hook-commands.ts +60 -0
- package/src/adapters/index.ts +106 -0
- package/src/adapters/kiro/index.ts +310 -0
- package/src/adapters/mcp-entries.ts +331 -0
- package/src/adapters/opencode/index.ts +466 -0
- package/src/adapters/pi/index.ts +279 -0
- package/src/adapters/pi/json-members.ts +185 -0
- package/src/adapters/pi/mcp.ts +373 -0
- package/src/adapters/resolve-source.ts +19 -0
- package/src/cli/commands/install.ts +218 -0
- package/src/cli/commands/list-backups.ts +21 -0
- package/src/cli/commands/reconcile.ts +120 -0
- package/src/cli/commands/remove.ts +82 -0
- package/src/cli/commands/rollback.ts +172 -0
- package/src/cli/commands/self-update.ts +33 -0
- package/src/cli/commands/status.ts +138 -0
- package/src/cli/commands/tools.ts +92 -0
- package/src/cli/commands/update.ts +162 -0
- package/src/cli/index.ts +568 -0
- package/src/cli/runtime-commands.ts +281 -0
- package/src/cli/shared.ts +218 -0
- package/src/helper/bash-helper.ts +34 -0
- package/src/helper/git.ts +24 -0
- package/src/helper/guardrails.ts +49 -0
- package/src/helper/harness-paths.ts +140 -0
- package/src/helper/marker-merge.ts +116 -0
- package/src/helper/prompt.ts +61 -0
- package/src/helper/repo-root.ts +29 -0
- package/src/helper/settings-merge.ts +151 -0
- package/src/helper/settings-scope.ts +33 -0
- package/src/helper/toml.ts +244 -0
- package/src/install/backup-set.ts +149 -0
- package/src/install/backup.ts +724 -0
- package/src/install/context.ts +58 -0
- package/src/install/manifest.ts +145 -0
- package/src/install/mcp.ts +254 -0
- package/src/install/paths.ts +84 -0
- package/src/install/targets.ts +90 -0
- package/src/install/tool-lifecycle.ts +151 -0
- package/src/lifecycle/bash-availability.ts +25 -0
- package/src/lifecycle/index.ts +812 -0
- package/src/lifecycle/mcp-index.ts +28 -0
- package/src/lifecycle/policies.ts +73 -0
- package/src/lifecycle/view.ts +175 -0
- package/src/registry/index.ts +611 -0
- package/src/release/sync-plugin-versions.ts +66 -0
- package/src/runtime/advice/cli.ts +283 -0
- package/src/runtime/advice/client.ts +324 -0
- package/src/runtime/advice/config.ts +189 -0
- package/src/runtime/advice/doctor.ts +169 -0
- package/src/runtime/advice/endpoint-guard.ts +134 -0
- package/src/runtime/advice/kinds.ts +154 -0
- package/src/runtime/advice/providers/ollama-systemone.ts +209 -0
- package/src/runtime/advice/record.ts +166 -0
- package/src/runtime/advice/registry.ts +170 -0
- package/src/runtime/advice/strength.ts +66 -0
- package/src/runtime/brief-tools.ts +342 -0
- package/src/runtime/c4-project.ts +371 -0
- package/src/runtime/capability-router.ts +484 -0
- package/src/runtime/checkouts.ts +170 -0
- package/src/runtime/claims.ts +468 -0
- package/src/runtime/cli-result.ts +55 -0
- package/src/runtime/cli.ts +678 -0
- package/src/runtime/command-detect.ts +516 -0
- package/src/runtime/context-pack.ts +492 -0
- package/src/runtime/decision-register.ts +493 -0
- package/src/runtime/evidence-ledger.ts +338 -0
- package/src/runtime/failure/capture.ts +272 -0
- package/src/runtime/failure/classifier.ts +68 -0
- package/src/runtime/failure/cli.ts +178 -0
- package/src/runtime/failure/home.ts +64 -0
- package/src/runtime/failure/store.ts +226 -0
- package/src/runtime/feature-resolve.ts +79 -0
- package/src/runtime/freshness.ts +177 -0
- package/src/runtime/health.ts +863 -0
- package/src/runtime/history-compactor.ts +237 -0
- package/src/runtime/implementation-gate.ts +321 -0
- package/src/runtime/inventory/coverage.ts +218 -0
- package/src/runtime/inventory/identity.ts +65 -0
- package/src/runtime/inventory/index.ts +705 -0
- package/src/runtime/inventory/precedence.ts +134 -0
- package/src/runtime/inventory/read-scopes.ts +131 -0
- package/src/runtime/inventory/siblings.ts +192 -0
- package/src/runtime/knowledge/chunker.ts +124 -0
- package/src/runtime/knowledge/hybrid.ts +149 -0
- package/src/runtime/knowledge/index-store.ts +145 -0
- package/src/runtime/knowledge/retrieval.ts +194 -0
- package/src/runtime/leak-scan.ts +185 -0
- package/src/runtime/lifecycle/cli.ts +276 -0
- package/src/runtime/lifecycle/event-store.ts +340 -0
- package/src/runtime/lifecycle/fold.ts +353 -0
- package/src/runtime/lifecycle/followup.ts +432 -0
- package/src/runtime/lifecycle/goal.ts +249 -0
- package/src/runtime/lifecycle/intent-writer.ts +86 -0
- package/src/runtime/lifecycle/overview.ts +292 -0
- package/src/runtime/lifecycle/release.ts +241 -0
- package/src/runtime/lifecycle/report-store.ts +221 -0
- package/src/runtime/lifecycle/retention.ts +212 -0
- package/src/runtime/lifecycle/root.ts +71 -0
- package/src/runtime/lifecycle/status.ts +353 -0
- package/src/runtime/lifecycle/store-upkeep.ts +393 -0
- package/src/runtime/locator-resolve.ts +158 -0
- package/src/runtime/mask.ts +210 -0
- package/src/runtime/mcp-consultations.ts +412 -0
- package/src/runtime/mcp-reach.ts +157 -0
- package/src/runtime/model-router.ts +153 -0
- package/src/runtime/outcome.ts +467 -0
- package/src/runtime/reach.ts +148 -0
- package/src/runtime/readiness-record.ts +150 -0
- package/src/runtime/readiness.ts +435 -0
- package/src/runtime/recovery.ts +282 -0
- package/src/runtime/research-request.ts +231 -0
- package/src/runtime/retrieval-plan.ts +578 -0
- package/src/runtime/scaffold/artifacts.ts +217 -0
- package/src/runtime/scaffold/fingerprint.ts +56 -0
- package/src/runtime/scaffold/generate.ts +911 -0
- package/src/runtime/scaffold/languages.ts +245 -0
- package/src/runtime/storage/cli.ts +64 -0
- package/src/runtime/storage/engine.ts +249 -0
- package/src/runtime/storage/registry.ts +130 -0
- package/src/runtime/storage/roots.ts +63 -0
- package/src/runtime/storage/rules.ts +282 -0
- package/src/runtime/storage/upkeep.ts +243 -0
- package/src/runtime/storage/work-status.ts +326 -0
- package/src/runtime/task-attempts.ts +415 -0
- package/src/runtime/task-classifier.ts +550 -0
- package/src/runtime/task-scope.ts +130 -0
- package/src/runtime/task-state.ts +176 -0
- package/src/runtime/trace/indicators.ts +235 -0
- package/src/runtime/trace/ledger.ts +626 -0
- package/src/runtime/trace/render.ts +76 -0
- package/src/runtime/trace/views.ts +459 -0
- package/src/runtime/verification/contract-runner.ts +341 -0
- package/src/runtime/verification/engine.ts +1461 -0
- package/src/runtime/verification/registry.ts +130 -0
- package/src/runtime/verification/scope-bound.ts +418 -0
- package/src/runtime/verification/test-selection.ts +172 -0
- package/src/runtime/workflow-engine.ts +588 -0
- package/src/runtime/workflow-orchestrator.ts +953 -0
- package/src/runtime/worktree.ts +340 -0
- package/src/state/index.ts +193 -0
- package/src/state/lockfile.ts +136 -0
- package/src/state/run-lock.ts +408 -0
- package/types/node-commonjs.d.ts +68 -0
- package/types/runtime.d.ts +91 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Sample Java file showing the fixed version of sample_java_smells.java.
|
|
2
|
+
// Same shape, but every smell has been resolved per the patterns documented
|
|
3
|
+
// in rules/universal.md and languages/java.md.
|
|
4
|
+
//
|
|
5
|
+
// Run:
|
|
6
|
+
// python scripts/code_quality_checker.py assets/sample_java_clean.java
|
|
7
|
+
//
|
|
8
|
+
// Expected: no HIGH Java-specific smells flagged.
|
|
9
|
+
|
|
10
|
+
package sample;
|
|
11
|
+
|
|
12
|
+
import java.io.FileInputStream;
|
|
13
|
+
import java.io.InputStream;
|
|
14
|
+
import java.sql.Connection;
|
|
15
|
+
import java.sql.PreparedStatement;
|
|
16
|
+
import java.sql.ResultSet;
|
|
17
|
+
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
18
|
+
|
|
19
|
+
public class UserService {
|
|
20
|
+
|
|
21
|
+
// FIX: heavy object shared as a singleton instead of constructed per call.
|
|
22
|
+
private static final ObjectMapper MAPPER = new ObjectMapper();
|
|
23
|
+
|
|
24
|
+
// FIX: connection string injected from configuration, never inlined.
|
|
25
|
+
private final String connectionString;
|
|
26
|
+
|
|
27
|
+
public UserService(String connectionString) {
|
|
28
|
+
this.connectionString = connectionString;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public String getName(Connection conn, int id) {
|
|
32
|
+
// FIX: try-with-resources guarantees the stream and statement close.
|
|
33
|
+
try (InputStream config = new FileInputStream("/etc/config");
|
|
34
|
+
// FIX: parameterized query, no string concatenation.
|
|
35
|
+
PreparedStatement stmt =
|
|
36
|
+
conn.prepareStatement("SELECT name FROM users WHERE id = ?")) {
|
|
37
|
+
stmt.setInt(1, id);
|
|
38
|
+
try (ResultSet rs = stmt.executeQuery()) {
|
|
39
|
+
return rs.next() ? rs.getString("name") : null;
|
|
40
|
+
}
|
|
41
|
+
} catch (Exception e) {
|
|
42
|
+
// FIX: rethrow with context instead of swallowing.
|
|
43
|
+
throw new IllegalStateException("Failed to load user " + id, e);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public void process() {
|
|
48
|
+
try {
|
|
49
|
+
Thread.sleep(1000);
|
|
50
|
+
} catch (InterruptedException e) {
|
|
51
|
+
// FIX: restore the interrupt flag so cancellation still propagates.
|
|
52
|
+
Thread.currentThread().interrupt();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Sample Java file demonstrating the Java-specific patterns the code-reviewer
|
|
2
|
+
// skill detects. Each smell is labelled inline. This file is NOT meant to
|
|
3
|
+
// compile cleanly — it is a fixture for code_quality_checker.py and
|
|
4
|
+
// pr_analyzer.py.
|
|
5
|
+
//
|
|
6
|
+
// Run:
|
|
7
|
+
// python scripts/code_quality_checker.py assets/sample_java_smells.java
|
|
8
|
+
//
|
|
9
|
+
// Expected output: see expected_outputs/sample_java_smells_quality.json
|
|
10
|
+
|
|
11
|
+
package sample;
|
|
12
|
+
|
|
13
|
+
import java.io.FileInputStream;
|
|
14
|
+
import java.sql.Connection;
|
|
15
|
+
import java.sql.Statement;
|
|
16
|
+
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
17
|
+
|
|
18
|
+
public class UserService {
|
|
19
|
+
|
|
20
|
+
// [hardcoded_secrets] hardcoded JDBC URL with password
|
|
21
|
+
public String connectionString = "jdbc:postgresql://prod/app?user=app&password=hunter2";
|
|
22
|
+
|
|
23
|
+
// [analyzer_disable] @SuppressWarnings without justification
|
|
24
|
+
@SuppressWarnings("unchecked")
|
|
25
|
+
public String getName(Connection conn, int id) throws Exception {
|
|
26
|
+
// [java_unclosed_resource] FileInputStream not in try-with-resources
|
|
27
|
+
FileInputStream fis = new FileInputStream("/etc/config");
|
|
28
|
+
|
|
29
|
+
// [java_per_use_heavy_object] new ObjectMapper() constructed per call
|
|
30
|
+
ObjectMapper mapper = new ObjectMapper();
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
Statement stmt = conn.createStatement();
|
|
34
|
+
// [sql_concatenation] string concatenation builds SQL with user input
|
|
35
|
+
return stmt.executeQuery("SELECT name FROM users WHERE id = " + id).toString();
|
|
36
|
+
} catch (Exception e) {
|
|
37
|
+
// [java_empty_catch] empty catch swallows the exception
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public void process() {
|
|
43
|
+
try {
|
|
44
|
+
Thread.sleep(1000);
|
|
45
|
+
} catch (InterruptedException e) {
|
|
46
|
+
// [java_swallowed_interrupt] interrupt flag not restored
|
|
47
|
+
// [console_log] printStackTrace used as error handling
|
|
48
|
+
e.printStackTrace();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public void log(String message) {
|
|
53
|
+
// [console_log] System.out.println left in production code
|
|
54
|
+
System.out.println(message);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sample-markdown-clean
|
|
3
|
+
description: >
|
|
4
|
+
Reviews markdown and prose content for structural health. Use when checking a SKILL.md or
|
|
5
|
+
agent-spec file for a missing Boundaries section, a weak triggering description, dangling
|
|
6
|
+
references/ or modes/ cross-references, or leftover staleness language such as "deprecated".
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Sample Markdown Skill (Clean Fixture)
|
|
10
|
+
|
|
11
|
+
This is a synthetic fixture for `doc_quality_checker.py` — a well-formed document with a
|
|
12
|
+
strong triggering description, an explicit Boundaries section, and no dangling references or
|
|
13
|
+
stale language, so it should produce zero findings.
|
|
14
|
+
|
|
15
|
+
Run:
|
|
16
|
+
python scripts/doc_quality_checker.py assets/sample_markdown_clean.md
|
|
17
|
+
|
|
18
|
+
Expected output: see expected_outputs/sample_markdown_clean_quality.json
|
|
19
|
+
|
|
20
|
+
## Boundaries
|
|
21
|
+
|
|
22
|
+
**Will:** analyze markdown and prose files for structural health issues — missing Boundaries
|
|
23
|
+
sections, weak triggering descriptions, dangling cross-references, and staleness markers.
|
|
24
|
+
|
|
25
|
+
**Will Not:** compute a code-smell quality score for prose, or judge subjective writing quality
|
|
26
|
+
beyond the deterministic patterns listed above.
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
Run the tool against a target file or directory and read the findings it prints.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sample-markdown-smells
|
|
3
|
+
description: Helps with markdown stuff sometimes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sample Markdown Skill (Smells Fixture)
|
|
7
|
+
|
|
8
|
+
This is a synthetic fixture for `doc_quality_checker.py` — NOT a real skill, just a document
|
|
9
|
+
shaped like a `SKILL.md` (frontmatter, a short description, a body) so the checker's
|
|
10
|
+
content-agnostic checks (dangling references, staleness markers) have real prose to exercise.
|
|
11
|
+
It intentionally omits a `## Boundaries` section and uses a weak, un-triggering description,
|
|
12
|
+
mirroring the structural gaps `doc_quality_checker.py` is built to catch on a real SKILL.md.
|
|
13
|
+
|
|
14
|
+
Run:
|
|
15
|
+
python scripts/doc_quality_checker.py assets/sample_markdown_smells.md
|
|
16
|
+
|
|
17
|
+
Expected output: see expected_outputs/sample_markdown_smells_quality.json
|
|
18
|
+
|
|
19
|
+
## Overview
|
|
20
|
+
|
|
21
|
+
For the full background on this pattern, see `references/does-not-exist.md`, which was never
|
|
22
|
+
written.
|
|
23
|
+
|
|
24
|
+
This approach is deprecated and should not be used anymore — teams should migrate away from it
|
|
25
|
+
entirely before relying on any of the examples below.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Run the tool against a target file or directory and read the findings it prints.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Fixture for _blank_heredocs. Guards three behaviours at once; see code_quality_checker.py.
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
# 1. Heredoc body is prose only. Real complexity is 1; every keyword below is text.
|
|
6
|
+
usage() {
|
|
7
|
+
cat <<'EOF'
|
|
8
|
+
Usage: tool [options]
|
|
9
|
+
Pick one or the other and then decide if you want more.
|
|
10
|
+
If the file exists and the flag is set or the mode is auto, it will run.
|
|
11
|
+
Use for each item, while any remain, and case by case.
|
|
12
|
+
EOF
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
# 2. Real branches around a heredoc are still counted: if + while + case.
|
|
16
|
+
emit() {
|
|
17
|
+
if [ -n "${1:-}" ]; then
|
|
18
|
+
cat <<-INDENTED
|
|
19
|
+
this or that and if for while case
|
|
20
|
+
INDENTED
|
|
21
|
+
fi
|
|
22
|
+
while read -r line; do
|
|
23
|
+
case "$line" in a) ;; *) ;; esac
|
|
24
|
+
done
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# 3. An opener whose terminator never appears is not a heredoc, so the branches
|
|
28
|
+
# below it must stay visible rather than being blanked to end-of-file.
|
|
29
|
+
unterminated() {
|
|
30
|
+
echo "<<NEVERCLOSED is only mentioned, never opened"
|
|
31
|
+
if [ -f /tmp/x ] && [ -d /tmp ]; then
|
|
32
|
+
for i in 1 2 3; do echo "$i"; done
|
|
33
|
+
fi
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
usage
|
|
37
|
+
emit
|
|
38
|
+
unterminated
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# A script with the failure modes shell review exists to catch.
|
|
3
|
+
|
|
4
|
+
deploy_release() {
|
|
5
|
+
cd $RELEASE_DIR
|
|
6
|
+
rm $STALE_ARTIFACT
|
|
7
|
+
cp $SOURCE $DEST
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function rollback {
|
|
11
|
+
cd /var/tmp
|
|
12
|
+
cat $LOGFILE
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
deploy_release
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Regression asset for string-literal handling in cyclomatic complexity.
|
|
2
|
+
//
|
|
3
|
+
// Before strip_string_literals, every "or"/"and"/"if"/"for" inside these strings counted as a
|
|
4
|
+
// branch. This function has exactly two real branches; the prose in its messages has many more
|
|
5
|
+
// words that the keyword scan used to charge it for.
|
|
6
|
+
|
|
7
|
+
export function describeOutcome(state: string, retries: number): string {
|
|
8
|
+
const messages = {
|
|
9
|
+
blocked: "evidence disagrees and a human must reconcile it, or the gate stays shut",
|
|
10
|
+
ready: "every prerequisite is verified and no claim is conflicted",
|
|
11
|
+
waiting: "waiting for a build or a test or a review, and then for approval",
|
|
12
|
+
failed: "the run failed and the cause was not classified for a retry",
|
|
13
|
+
unknown: "no outcome was recorded, if indeed the task ever started",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
if (state in messages) {
|
|
17
|
+
return messages[state as keyof typeof messages];
|
|
18
|
+
}
|
|
19
|
+
return retries > 0 ? "retrying after a transient error" : "no state and no retries";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const BANNER = `report generated for review — pass or fail, and every skipped file named`;
|
|
23
|
+
|
|
24
|
+
// Multi-line template literal. Before the spanning pass, every keyword in this prose counted as a
|
|
25
|
+
// branch on whichever function the slice attributed it to.
|
|
26
|
+
export const REPORT_TEMPLATE = `
|
|
27
|
+
Coverage was partial and the verdict describes the analysed files only.
|
|
28
|
+
If a file could not be read it is named here, and if a check could not run
|
|
29
|
+
it is reported as not run — for every file in the set, or the report is
|
|
30
|
+
incomplete and the score means less than it appears to.
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
export function pick(kind: string): number {
|
|
34
|
+
if (kind === "wide") { return 2; }
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
content-type: config
|
|
3
|
+
extensions: [".yaml", ".yml", ".json"]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Declarative Config — Content-Specific Review Notes
|
|
7
|
+
|
|
8
|
+
YAML and JSON are not `languages/*.md` entries. The language template's required sections
|
|
9
|
+
(Async/Concurrency, Resource Management, Exception Handling, Performance) describe code-execution
|
|
10
|
+
concerns that do not exist for declarative data. Forcing config through that template would produce
|
|
11
|
+
empty or fabricated sections — the same reasoning that puts markdown in `content-types/`.
|
|
12
|
+
|
|
13
|
+
More concretely: a cyclomatic complexity, a function count, or a SOLID verdict for a YAML file is a
|
|
14
|
+
number with nothing behind it. Reporting one is precisely the false-confidence defect that adding
|
|
15
|
+
these analysers was meant to remove, so the analyser reports none of them and this file names no
|
|
16
|
+
rule that would need one.
|
|
17
|
+
|
|
18
|
+
Load this file **instead of** `rules/universal.md` plus a language file. It has no universal
|
|
19
|
+
counterpart, same as `content-types/markdown.md`.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## What the analyser checks deterministically
|
|
24
|
+
|
|
25
|
+
`scripts/code_quality_checker.py` routes these extensions to its declarative path and reports:
|
|
26
|
+
|
|
27
|
+
| Check | Why it matters |
|
|
28
|
+
|---|---|
|
|
29
|
+
| Parse validity | A JSON file that does not parse is a deploy-time failure, not a review comment |
|
|
30
|
+
| Duplicate keys at one level | The later value silently wins; the earlier one looks live but is dead |
|
|
31
|
+
| Nesting depth | Past a point, an indentation mistake is undetectable by reading |
|
|
32
|
+
| Credential-shaped literals | A `password:`/`token:`/`api_key:` with a literal value in a committed file |
|
|
33
|
+
|
|
34
|
+
Everything below is for the reviewer, not the analyser.
|
|
35
|
+
|
|
36
|
+
## Correctness
|
|
37
|
+
|
|
38
|
+
- **Duplicate keys** — YAML permits them and resolves to the last; most parsers do not warn. Check
|
|
39
|
+
merged or templated files especially, where a key can be introduced twice from different sources.
|
|
40
|
+
- **Type coercion** — unquoted `yes`, `no`, `on`, `off`, `true`, `false` become booleans in YAML 1.1;
|
|
41
|
+
`NO` as a country code and `on` as a key have both caused real outages. Quote strings that could
|
|
42
|
+
be read as another type.
|
|
43
|
+
- **Sexagesimal and octal** — an unquoted `1:30` can parse as 90, and a leading zero can mean octal.
|
|
44
|
+
Version strings and identifiers are quoted.
|
|
45
|
+
- **Anchors and aliases** — `&anchor` / `*alias` save repetition but move the definition away from
|
|
46
|
+
the use. Deep anchor chains are a readability finding; an alias that overrides only some keys via
|
|
47
|
+
merge (`<<:`) is a correctness one, since merge order is not obvious.
|
|
48
|
+
- **Empty vs absent** — `key:` with no value is null, which is not the same as the key being absent.
|
|
49
|
+
Confirm the consumer treats them the same way if the file relies on it.
|
|
50
|
+
|
|
51
|
+
## Security
|
|
52
|
+
|
|
53
|
+
- No credential literals: passwords, tokens, API keys, private keys, connection strings with
|
|
54
|
+
embedded auth. A value that looks like a placeholder still ships if nothing replaces it.
|
|
55
|
+
- A permissive default is a finding: `allowAll`, `verify: false`, `insecureSkipTLSVerify`,
|
|
56
|
+
`0.0.0.0/0`, a wildcard CORS origin. Each needs a comment saying why.
|
|
57
|
+
- Check that a config claiming to reference a secret store actually does, rather than naming one in
|
|
58
|
+
a comment beside a literal.
|
|
59
|
+
|
|
60
|
+
## Structure and Maintainability
|
|
61
|
+
|
|
62
|
+
- **Depth** — deeply nested config is hard to review and easy to mis-indent. Prefer a flatter shape
|
|
63
|
+
or a split file over another level.
|
|
64
|
+
- **Duplication across environments** — three near-identical env files drift. Look for the one key
|
|
65
|
+
that differs by accident rather than by intent.
|
|
66
|
+
- **Ordering and grouping** — related keys adjacent, and a consistent order across sibling files, so
|
|
67
|
+
a diff between two environments is readable.
|
|
68
|
+
- **Comments** — a non-obvious value (a timeout, a magic port, a feature flag) carries a comment
|
|
69
|
+
saying what it is for. A config file has no other place to put the reasoning.
|
|
70
|
+
|
|
71
|
+
## API Specifications (OpenAPI, JSON Schema)
|
|
72
|
+
|
|
73
|
+
Treated as config here rather than as a separate content type — the checks above all apply, plus:
|
|
74
|
+
|
|
75
|
+
- Every operation has an `operationId`, and it is unique across the document.
|
|
76
|
+
- Every response the implementation can return is documented, including the error shapes.
|
|
77
|
+
- `required` is stated explicitly on request bodies; an omitted `required` reads as optional.
|
|
78
|
+
- `additionalProperties` is decided rather than defaulted, since the default is permissive.
|
|
79
|
+
- `$ref` targets resolve within the document or to a file that ships with it.
|
|
80
|
+
- Examples parse against their own schema — an example that contradicts its schema is worse than
|
|
81
|
+
none, because tooling generates from it.
|
|
82
|
+
- No DoFlow-internal identifiers in `description` or `summary` fields — run
|
|
83
|
+
`doflow leak-scan --path <spec>`; see the skill's Review Contract.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
content-type: markdown
|
|
3
|
+
extensions: [".md"]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Markdown / Prose — Content-Specific Review Notes
|
|
7
|
+
|
|
8
|
+
Markdown is not treated as a `languages/*.md` entry. The language files' required sections
|
|
9
|
+
(Security, Async, Resource Management, Exception Handling, Performance) describe code-execution
|
|
10
|
+
concerns that do not translate to prose — forcing markdown through that template would produce
|
|
11
|
+
empty or fabricated sections, which is exactly the "invented metrics" problem that
|
|
12
|
+
the guidance tree's `rules/RULE_03_QUALITY.md` warns against under "Professional Honesty". This file documents a
|
|
13
|
+
content-type-specific set of checks instead, run by `scripts/doc_quality_checker.py`.
|
|
14
|
+
|
|
15
|
+
Load this file when the reviewed path is a `.md` file. There is no `rules/universal.md`
|
|
16
|
+
equivalent for prose — every check below is either skill-specific or guidance-tree-wide, as
|
|
17
|
+
noted per check.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Tool
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Analyze a single file or a directory of .md files
|
|
25
|
+
python scripts/doc_quality_checker.py <path>
|
|
26
|
+
|
|
27
|
+
# JSON output — same finding-list shape as code_quality_checker.py --json
|
|
28
|
+
python scripts/doc_quality_checker.py <path> --json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Every check below is deterministic and cite-the-match: a finding names the exact line, phrase,
|
|
32
|
+
or reference that triggered it. There is no aggregate "quality score" — per "Professional Honesty"
|
|
33
|
+
in the guidance tree's `rules/RULE_03_QUALITY.md`, an invented single-number score would claim more
|
|
34
|
+
precision than a pattern match can support. Treat every finding as "here is the specific thing to
|
|
35
|
+
look at," not as a verdict; confirm it against the actual file before editing (the same
|
|
36
|
+
manual-verification discipline this feature's own audit applies to its own tooling).
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Checks
|
|
41
|
+
|
|
42
|
+
### 1. Length (SKILL.md files only)
|
|
43
|
+
|
|
44
|
+
**Applies to:** `SKILL.md` files specifically — not every `.md` file in the tree.
|
|
45
|
+
|
|
46
|
+
Flags a `SKILL.md` whose line count exceeds skill-creator's progressive-disclosure guideline of
|
|
47
|
+
roughly 500 lines. The guideline exists so a skill's main file stays a dispatch/overview surface,
|
|
48
|
+
pushing detail into `references/`, `languages/`, `modes/`, or similar sibling files rather than
|
|
49
|
+
growing one monolithic document. A finding here cites the actual line count against the ~500-line
|
|
50
|
+
threshold — it does not judge whether the content itself is good or bad, only that it has likely
|
|
51
|
+
outgrown the single-file shape.
|
|
52
|
+
|
|
53
|
+
**Interpretation:** if flagged, look for content that belongs in a sibling reference file instead
|
|
54
|
+
of `SKILL.md` itself; splitting content out (not just trimming prose) is usually the fix.
|
|
55
|
+
|
|
56
|
+
### 2. Boundaries section (SKILL.md and agent-spec files)
|
|
57
|
+
|
|
58
|
+
**Applies to:** `SKILL.md` files, and specialist agent-definition files — identified by
|
|
59
|
+
frontmatter shape (`model:` plus either `tools:` or `effort:`, with no `argument-hint:`), not by a
|
|
60
|
+
fixed path. This recognizes existing agent files that have `tools:` but no `effort:`, along with
|
|
61
|
+
the current shared shape, where `tools:` is optional and the host provides the available tool pool.
|
|
62
|
+
This repo keeps its own agent definitions under `core/shared/agent-specs/`, but every harness
|
|
63
|
+
installs them under a differently-named directory (typically `agents/`), so the check deliberately
|
|
64
|
+
does not hardcode a source-tree path — it works the same way against an installed copy in any
|
|
65
|
+
project as it does against this repo's own source.
|
|
66
|
+
|
|
67
|
+
Flags a file that lacks a `## Boundaries` section, or has one that does not frame scope with
|
|
68
|
+
explicit Will / Will Not language. This check is guidance-tree-wide in the sense that it runs
|
|
69
|
+
against both file kinds — a skill and an agent spec are held to the same expectation that scope is
|
|
70
|
+
stated, not implied.
|
|
71
|
+
|
|
72
|
+
**Interpretation:** a finding here means the file's scope is not explicit, not that it is wrong.
|
|
73
|
+
Add a `## Boundaries` section (or a Will / Will Not pair inside an existing one) describing what
|
|
74
|
+
the skill or archetype does and, as importantly, what it deliberately does not do.
|
|
75
|
+
|
|
76
|
+
### 3. Triggering description (SKILL.md frontmatter `description:` field)
|
|
77
|
+
|
|
78
|
+
**Applies to:** the `description:` field in `SKILL.md`'s YAML frontmatter only.
|
|
79
|
+
|
|
80
|
+
Flags a description that is under roughly 40 words, or that does not contain a concrete trigger
|
|
81
|
+
phrase or example (e.g., "Use when reviewing pull requests..."). This follows skill-creator's
|
|
82
|
+
"make it a little pushy" guidance: the description is what a dispatching agent reads to decide
|
|
83
|
+
whether to load the skill at all, so a vague or generic description under-triggers it.
|
|
84
|
+
|
|
85
|
+
**Interpretation:** a finding here cites the current description's word count and/or the absence
|
|
86
|
+
of a "Use when..." style clause. The fix is a more specific description naming concrete scenarios,
|
|
87
|
+
not a longer description for its own sake — length and specificity are separate signals and both
|
|
88
|
+
should hold.
|
|
89
|
+
|
|
90
|
+
### 4. Dangling cross-reference
|
|
91
|
+
|
|
92
|
+
**Applies to:** any `.md` file under the reviewed path (skills, agent specs, or guidance).
|
|
93
|
+
|
|
94
|
+
Flags any mention of a `references/<name>.md` or `modes/<name>.md` style path that does not resolve
|
|
95
|
+
to a real file on disk relative to the reviewing file's own location. This is guidance-tree-wide —
|
|
96
|
+
the same broken-link risk exists whether the dangling mention is in a skill, an agent spec, or a
|
|
97
|
+
guidance rule file.
|
|
98
|
+
|
|
99
|
+
**Interpretation:** a finding here cites the exact dangling path string and the file it appeared
|
|
100
|
+
in. Either the referenced file needs to be created, or the mention needs to be corrected/removed
|
|
101
|
+
— check which is intended before editing, since a dangling reference can indicate an unfinished
|
|
102
|
+
file just as easily as a stale one.
|
|
103
|
+
|
|
104
|
+
### 5. Staleness markers
|
|
105
|
+
|
|
106
|
+
**Applies to:** any `.md` file under the reviewed path.
|
|
107
|
+
|
|
108
|
+
Conservatively flags prose containing deprecated / legacy / no longer / outdated / obsolete
|
|
109
|
+
language. This check is deliberately conservative: it does not flag a rule or guard whose own
|
|
110
|
+
*description* quotes one of these words as the thing being detected (for example, a staleness
|
|
111
|
+
guard's own doc-comment listing "deprecated" as a pattern it searches for is not itself stale
|
|
112
|
+
prose). Only prose asserting that the surrounding content itself is deprecated/legacy/outdated is
|
|
113
|
+
flagged.
|
|
114
|
+
|
|
115
|
+
**Interpretation:** this check exists to catch false positives, not manufacture them — the
|
|
116
|
+
design-phase investigation for this feature already found that a naive keyword grep for
|
|
117
|
+
words like "deprecated" produces false positives against files that quote the word as a detection
|
|
118
|
+
target rather than describing themselves as stale. Confirm the matched sentence actually describes
|
|
119
|
+
the file's own content as outdated before treating it as a real finding; if it is a rule
|
|
120
|
+
description quoting the word, it is not a defect.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Adding a New Content Type
|
|
125
|
+
|
|
126
|
+
Follow the same two-step pattern `languages/*.md` uses for code, but do not reuse that template's
|
|
127
|
+
required sections — they are code-execution concerns and do not apply to prose:
|
|
128
|
+
|
|
129
|
+
1. Create `content-types/<name>.md` describing the checks specific to that content type, not the
|
|
130
|
+
`languages/*.md` section shape (PR Analyzer Signals, Security, Async, Resource Management,
|
|
131
|
+
Exception Handling, Performance, Idioms do not translate to non-code content).
|
|
132
|
+
2. Add the content-type row to the dispatch table in `SKILL.md`.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"file": "assets/sample_c_clean.c",
|
|
3
|
+
"language": "c",
|
|
4
|
+
"metrics": {
|
|
5
|
+
"lines": {
|
|
6
|
+
"total": 72,
|
|
7
|
+
"code": 43,
|
|
8
|
+
"blank": 17,
|
|
9
|
+
"comment": 12
|
|
10
|
+
},
|
|
11
|
+
"functions": 4,
|
|
12
|
+
"classes": 0,
|
|
13
|
+
"avg_complexity": 1.8
|
|
14
|
+
},
|
|
15
|
+
"quality_score": 100,
|
|
16
|
+
"grade": "A",
|
|
17
|
+
"smells": [
|
|
18
|
+
{
|
|
19
|
+
"type": "long_function",
|
|
20
|
+
"severity": "medium",
|
|
21
|
+
"message": "Function 'safe_input' has 60 lines (max: 50)",
|
|
22
|
+
"location": "safe_input"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"type": "magic_number",
|
|
26
|
+
"severity": "low",
|
|
27
|
+
"message": "Magic number 100 should be a named constant",
|
|
28
|
+
"location": "line 29"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"type": "magic_number",
|
|
32
|
+
"severity": "low",
|
|
33
|
+
"message": "Magic number 100 should be a named constant",
|
|
34
|
+
"location": "line 68"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"solid_violations": [],
|
|
38
|
+
"function_details": [
|
|
39
|
+
{
|
|
40
|
+
"name": "safe_input",
|
|
41
|
+
"parameters": 1,
|
|
42
|
+
"lines": 60,
|
|
43
|
+
"complexity": 3
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "checked_alloc",
|
|
47
|
+
"parameters": 1,
|
|
48
|
+
"lines": 30,
|
|
49
|
+
"complexity": 2
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "run_safe_cmd",
|
|
53
|
+
"parameters": 1,
|
|
54
|
+
"lines": 14,
|
|
55
|
+
"complexity": 1
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "main",
|
|
59
|
+
"parameters": 2,
|
|
60
|
+
"lines": 8,
|
|
61
|
+
"complexity": 1
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"class_details": [],
|
|
65
|
+
"policy": {
|
|
66
|
+
"tiers": [
|
|
67
|
+
"built-in",
|
|
68
|
+
"review-policy.json"
|
|
69
|
+
],
|
|
70
|
+
"thresholds": {
|
|
71
|
+
"long_function_lines": 50,
|
|
72
|
+
"too_many_parameters": 5,
|
|
73
|
+
"high_complexity": 10,
|
|
74
|
+
"god_class_methods": 20,
|
|
75
|
+
"max_imports": 15,
|
|
76
|
+
"max_declarative_depth": 8
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|