@event4u/agent-config 1.13.0 → 1.15.0
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/.agent-src/commands/agent-handoff.md +4 -1
- package/.agent-src/commands/agent-status.md +3 -0
- package/.agent-src/commands/agents-audit.md +4 -0
- package/.agent-src/commands/agents-cleanup.md +6 -1
- package/.agent-src/commands/agents-prepare.md +3 -0
- package/.agent-src/commands/analyze-reference-repo.md +4 -0
- package/.agent-src/commands/bug-fix.md +7 -3
- package/.agent-src/commands/bug-investigate.md +4 -0
- package/.agent-src/commands/chat-history-checkpoint.md +126 -0
- package/.agent-src/commands/chat-history-clear.md +6 -1
- package/.agent-src/commands/chat-history-resume.md +7 -2
- package/.agent-src/commands/chat-history.md +7 -2
- package/.agent-src/commands/check-current-md.md +137 -0
- package/.agent-src/commands/commit-in-chunks.md +118 -0
- package/.agent-src/commands/commit.md +4 -0
- package/.agent-src/commands/compress.md +37 -2
- package/.agent-src/commands/context-create.md +4 -0
- package/.agent-src/commands/context-refactor.md +4 -0
- package/.agent-src/commands/copilot-agents-init.md +3 -0
- package/.agent-src/commands/copilot-agents-optimize.md +3 -0
- package/.agent-src/commands/create-pr-description.md +4 -0
- package/.agent-src/commands/create-pr.md +4 -0
- package/.agent-src/commands/do-and-judge.md +4 -1
- package/.agent-src/commands/do-in-steps.md +3 -0
- package/.agent-src/commands/e2e-heal.md +4 -0
- package/.agent-src/commands/e2e-plan.md +4 -0
- package/.agent-src/commands/estimate-ticket.md +4 -1
- package/.agent-src/commands/feature-dev.md +4 -0
- package/.agent-src/commands/feature-explore.md +4 -0
- package/.agent-src/commands/feature-plan.md +4 -0
- package/.agent-src/commands/feature-refactor.md +4 -0
- package/.agent-src/commands/feature-roadmap.md +6 -0
- package/.agent-src/commands/fix-ci.md +4 -0
- package/.agent-src/commands/fix-portability.md +5 -2
- package/.agent-src/commands/fix-pr-bot-comments.md +4 -0
- package/.agent-src/commands/fix-pr-comments.md +4 -0
- package/.agent-src/commands/fix-pr-developer-comments.md +4 -0
- package/.agent-src/commands/fix-references.md +3 -0
- package/.agent-src/commands/fix-seeder.md +4 -0
- package/.agent-src/commands/implement-ticket.md +39 -13
- package/.agent-src/commands/jira-ticket.md +4 -0
- package/.agent-src/commands/judge.md +3 -0
- package/.agent-src/commands/memory-add.md +5 -3
- package/.agent-src/commands/memory-full.md +5 -2
- package/.agent-src/commands/memory-promote.md +7 -6
- package/.agent-src/commands/mode.md +3 -0
- package/.agent-src/commands/module-create.md +4 -0
- package/.agent-src/commands/module-explore.md +4 -0
- package/.agent-src/commands/onboard.md +33 -0
- package/.agent-src/commands/optimize-agents.md +4 -0
- package/.agent-src/commands/optimize-augmentignore.md +12 -0
- package/.agent-src/commands/optimize-rtk-filters.md +3 -0
- package/.agent-src/commands/optimize-skills.md +4 -0
- package/.agent-src/commands/override-create.md +4 -0
- package/.agent-src/commands/override-manage.md +4 -0
- package/.agent-src/commands/package-reset.md +3 -0
- package/.agent-src/commands/package-test.md +3 -0
- package/.agent-src/commands/prepare-for-review.md +4 -0
- package/.agent-src/commands/project-analyze.md +4 -0
- package/.agent-src/commands/project-health.md +4 -0
- package/.agent-src/commands/propose-memory.md +6 -8
- package/.agent-src/commands/quality-fix.md +4 -0
- package/.agent-src/commands/refine-ticket.md +12 -7
- package/.agent-src/commands/review-changes.md +39 -8
- package/.agent-src/commands/review-routing.md +4 -0
- package/.agent-src/commands/roadmap-create.md +18 -0
- package/.agent-src/commands/roadmap-execute.md +14 -1
- package/.agent-src/commands/rule-compliance-audit.md +4 -0
- package/.agent-src/commands/set-cost-profile.md +11 -0
- package/.agent-src/commands/sync-agent-settings.md +12 -0
- package/.agent-src/commands/sync-gitignore.md +3 -0
- package/.agent-src/commands/tests-create.md +4 -0
- package/.agent-src/commands/tests-execute.md +6 -3
- package/.agent-src/commands/threat-model.md +4 -0
- package/.agent-src/commands/update-form-request-messages.md +4 -0
- package/.agent-src/commands/upstream-contribute.md +4 -0
- package/.agent-src/commands/work.md +161 -0
- package/.agent-src/guidelines/agent-infra/engineering-memory-data-format.md +2 -6
- package/.agent-src/guidelines/agent-infra/layered-settings.md +0 -1
- package/.agent-src/guidelines/agent-infra/memory-access.md +0 -7
- package/.agent-src/guidelines/agent-infra/role-contracts.md +2 -4
- package/.agent-src/guidelines/agent-infra/self-improvement-pipeline.md +0 -1
- package/.agent-src/guidelines/php/patterns/strategy.md +180 -2
- package/.agent-src/personas/README.md +0 -1
- package/.agent-src/rules/artifact-drafting-protocol.md +7 -2
- package/.agent-src/rules/artifact-engagement-recording.md +133 -0
- package/.agent-src/rules/ask-when-uncertain.md +18 -13
- package/.agent-src/rules/augment-portability.md +64 -37
- package/.agent-src/rules/autonomous-execution.md +158 -0
- package/.agent-src/rules/chat-history-cadence.md +109 -0
- package/.agent-src/rules/chat-history-ownership.md +123 -0
- package/.agent-src/rules/chat-history-visibility.md +96 -0
- package/.agent-src/rules/cli-output-handling.md +27 -4
- package/.agent-src/rules/command-suggestion.md +134 -0
- package/.agent-src/rules/commit-policy.md +109 -0
- package/.agent-src/rules/direct-answers.md +114 -0
- package/.agent-src/rules/docs-sync.md +36 -0
- package/.agent-src/rules/downstream-changes.md +10 -9
- package/.agent-src/rules/improve-before-implement.md +9 -6
- package/.agent-src/rules/language-and-tone.md +85 -6
- package/.agent-src/rules/non-destructive-by-default.md +117 -0
- package/.agent-src/rules/package-ci-checks.md +4 -0
- package/.agent-src/rules/preservation-guard.md +20 -0
- package/.agent-src/rules/roadmap-progress-sync.md +159 -27
- package/.agent-src/rules/role-mode-adherence.md +1 -1
- package/.agent-src/rules/scope-control.md +42 -1
- package/.agent-src/rules/size-enforcement.md +2 -3
- package/.agent-src/rules/skill-quality.md +3 -8
- package/.agent-src/rules/ui-audit-before-build.md +106 -0
- package/.agent-src/rules/user-interaction.md +107 -51
- package/.agent-src/scripts/update_roadmap_progress.py +73 -9
- package/.agent-src/skills/blade-ui/SKILL.md +47 -3
- package/.agent-src/skills/command-routing/SKILL.md +32 -0
- package/.agent-src/skills/command-writing/SKILL.md +52 -2
- package/.agent-src/skills/description-assist/SKILL.md +21 -0
- package/.agent-src/skills/estimate-ticket/SKILL.md +0 -1
- package/.agent-src/skills/existing-ui-audit/SKILL.md +202 -0
- package/.agent-src/skills/fe-design/SKILL.md +78 -61
- package/.agent-src/skills/file-editor/SKILL.md +9 -0
- package/.agent-src/skills/finishing-a-development-branch/SKILL.md +4 -0
- package/.agent-src/skills/flux/SKILL.md +31 -4
- package/.agent-src/skills/guideline-writing/SKILL.md +24 -2
- package/.agent-src/skills/learning-to-rule-or-skill/SKILL.md +51 -9
- package/.agent-src/skills/livewire/SKILL.md +49 -4
- package/.agent-src/skills/md-language-check/SKILL.md +103 -0
- package/.agent-src/skills/php-coder/SKILL.md +24 -0
- package/.agent-src/skills/react-shadcn-ui/SKILL.md +121 -0
- package/.agent-src/skills/refine-prompt/SKILL.md +220 -0
- package/.agent-src/skills/refine-ticket/SKILL.md +32 -28
- package/.agent-src/skills/roadmap-management/SKILL.md +24 -11
- package/.agent-src/skills/rule-writing/SKILL.md +23 -1
- package/.agent-src/skills/skill-writing/SKILL.md +3 -5
- package/.agent-src/skills/upstream-contribute/SKILL.md +3 -3
- package/.agent-src/skills/using-git-worktrees/SKILL.md +3 -1
- package/.agent-src/templates/AGENTS.md +24 -6
- package/.agent-src/templates/agent-settings.md +149 -0
- package/.agent-src/templates/roadmaps.md +11 -4
- package/.agent-src/templates/scripts/implement_ticket/__init__.py +63 -26
- package/.agent-src/templates/scripts/implement_ticket/__main__.py +8 -2
- package/.agent-src/templates/scripts/memory_lookup.py +1 -1
- package/.agent-src/templates/scripts/telemetry/__init__.py +42 -0
- package/.agent-src/templates/scripts/telemetry/aggregator.py +154 -0
- package/.agent-src/templates/scripts/telemetry/boundary.py +171 -0
- package/.agent-src/templates/scripts/telemetry/engagement.py +238 -0
- package/.agent-src/templates/scripts/telemetry/report_renderer.py +170 -0
- package/.agent-src/templates/scripts/telemetry/settings.py +112 -0
- package/.agent-src/templates/scripts/telemetry_record.py +166 -0
- package/.agent-src/templates/scripts/telemetry_report.py +161 -0
- package/.agent-src/templates/scripts/telemetry_status.py +142 -0
- package/.agent-src/templates/scripts/work_engine/__init__.py +58 -0
- package/.agent-src/templates/scripts/work_engine/__main__.py +9 -0
- package/.agent-src/templates/scripts/work_engine/cli.py +195 -0
- package/.agent-src/templates/scripts/work_engine/cli_args.py +116 -0
- package/.agent-src/templates/scripts/{implement_ticket → work_engine}/delivery_state.py +10 -3
- package/.agent-src/templates/scripts/work_engine/directives/__init__.py +33 -0
- package/.agent-src/templates/scripts/work_engine/directives/backend/__init__.py +98 -0
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/analyze.py +1 -1
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/implement.py +3 -3
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/memory.py +2 -2
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/plan.py +2 -2
- package/.agent-src/templates/scripts/work_engine/directives/backend/refine.py +396 -0
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/report.py +37 -5
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/test.py +2 -2
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/verify.py +2 -2
- package/.agent-src/templates/scripts/work_engine/directives/mixed/__init__.py +116 -0
- package/.agent-src/templates/scripts/work_engine/directives/mixed/contract.py +254 -0
- package/.agent-src/templates/scripts/work_engine/directives/mixed/stitch.py +229 -0
- package/.agent-src/templates/scripts/work_engine/directives/mixed/ui.py +231 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/__init__.py +113 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/_passthrough.py +44 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/apply.py +241 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/audit.py +414 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/design.py +335 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/polish.py +510 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui/review.py +468 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui_trivial/__init__.py +119 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui_trivial/_skipped.py +37 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui_trivial/apply.py +165 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui_trivial/refine.py +66 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui_trivial/report.py +62 -0
- package/.agent-src/templates/scripts/work_engine/directives/ui_trivial/test.py +115 -0
- package/.agent-src/templates/scripts/work_engine/dispatcher.py +331 -0
- package/.agent-src/templates/scripts/work_engine/emitters.py +43 -0
- package/.agent-src/templates/scripts/work_engine/errors.py +19 -0
- package/.agent-src/templates/scripts/work_engine/hook_bootstrap.py +76 -0
- package/.agent-src/templates/scripts/work_engine/hooks/__init__.py +54 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/__init__.py +32 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/_chat_history_base.py +103 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_append.py +44 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_halt_append.py +42 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_heartbeat.py +50 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_turn_check.py +49 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/directive_set_guard.py +53 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/halt_surface_audit.py +50 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/state_shape_validation.py +52 -0
- package/.agent-src/templates/scripts/work_engine/hooks/builtin/trace.py +84 -0
- package/.agent-src/templates/scripts/work_engine/hooks/context.py +66 -0
- package/.agent-src/templates/scripts/work_engine/hooks/events.py +44 -0
- package/.agent-src/templates/scripts/work_engine/hooks/exceptions.py +79 -0
- package/.agent-src/templates/scripts/work_engine/hooks/registry.py +60 -0
- package/.agent-src/templates/scripts/work_engine/hooks/runner.py +73 -0
- package/.agent-src/templates/scripts/work_engine/hooks/settings.py +141 -0
- package/.agent-src/templates/scripts/work_engine/input_builders.py +163 -0
- package/.agent-src/templates/scripts/work_engine/intent/__init__.py +47 -0
- package/.agent-src/templates/scripts/work_engine/intent/classify.py +280 -0
- package/.agent-src/templates/scripts/work_engine/migration/__init__.py +8 -0
- package/.agent-src/templates/scripts/work_engine/migration/v0_to_v1.py +231 -0
- package/.agent-src/templates/scripts/{implement_ticket → work_engine}/persona_policy.py +1 -1
- package/.agent-src/templates/scripts/work_engine/resolvers/__init__.py +22 -0
- package/.agent-src/templates/scripts/work_engine/resolvers/diff.py +106 -0
- package/.agent-src/templates/scripts/work_engine/resolvers/file.py +113 -0
- package/.agent-src/templates/scripts/work_engine/resolvers/prompt.py +90 -0
- package/.agent-src/templates/scripts/work_engine/scoring/__init__.py +14 -0
- package/.agent-src/templates/scripts/work_engine/scoring/confidence.py +300 -0
- package/.agent-src/templates/scripts/work_engine/stack/__init__.py +31 -0
- package/.agent-src/templates/scripts/work_engine/stack/detect.py +187 -0
- package/.agent-src/templates/scripts/work_engine/state.py +641 -0
- package/.agent-src/templates/scripts/work_engine/state_io.py +202 -0
- package/.claude-plugin/marketplace.json +105 -2
- package/AGENTS.md +38 -8
- package/CHANGELOG.md +609 -0
- package/README.md +136 -14
- package/config/agent-settings.template.yml +45 -0
- package/config/gitignore-block.txt +4 -0
- package/docs/MIGRATION.md +122 -0
- package/docs/architecture.md +111 -35
- package/docs/contracts/STABILITY.md +95 -0
- package/docs/contracts/adr-chat-history-split.md +132 -0
- package/docs/contracts/adr-command-suggestion.md +146 -0
- package/docs/contracts/adr-implement-ticket-runtime.md +122 -0
- package/docs/contracts/adr-product-ui-track.md +384 -0
- package/docs/contracts/adr-prompt-driven-execution.md +187 -0
- package/docs/contracts/agent-memory-contract.md +149 -0
- package/docs/contracts/artifact-engagement-flow.md +262 -0
- package/docs/contracts/command-clusters.md +126 -0
- package/docs/contracts/command-suggestion-flow.md +148 -0
- package/docs/contracts/implement-ticket-flow.md +628 -0
- package/docs/contracts/linear-ai-rules-inclusion.md +143 -0
- package/docs/contracts/linear-ai-three-layers.md +131 -0
- package/docs/contracts/rule-interactions.md +107 -0
- package/docs/contracts/rule-interactions.yml +142 -0
- package/docs/contracts/ui-stack-extension.md +236 -0
- package/docs/contracts/ui-track-flow.md +338 -0
- package/docs/development.md +1 -1
- package/docs/getting-started.md +3 -3
- package/docs/installation.md +124 -2
- package/docs/migrations/commands-1.15.0.md +112 -0
- package/docs/showcase.md +204 -0
- package/docs/ui-track-mental-model.md +121 -0
- package/package.json +1 -1
- package/scripts/agent-config +199 -0
- package/scripts/audit_cloud_compatibility.py +288 -0
- package/scripts/build_cloud_bundle.py +458 -0
- package/scripts/build_linear_digest.py +263 -0
- package/scripts/chat_history.py +796 -7
- package/scripts/check_compression.py +139 -0
- package/scripts/check_iron_law_prominence.py +143 -0
- package/scripts/check_md_language.py +159 -0
- package/scripts/check_portability.py +38 -0
- package/scripts/check_public_links.py +185 -0
- package/scripts/check_references.py +1 -0
- package/scripts/check_reply_consistency.py +140 -0
- package/scripts/command_suggester/__init__.py +51 -0
- package/scripts/command_suggester/cooldown.py +132 -0
- package/scripts/command_suggester/loader.py +70 -0
- package/scripts/command_suggester/match.py +180 -0
- package/scripts/command_suggester/rank.py +120 -0
- package/scripts/command_suggester/render.py +86 -0
- package/scripts/command_suggester/sanitize.py +113 -0
- package/scripts/command_suggester/settings.py +125 -0
- package/scripts/command_suggester/types.py +78 -0
- package/scripts/hooks/augment-chat-history.sh +56 -0
- package/scripts/install-hooks.sh +67 -0
- package/scripts/install.py +150 -33
- package/scripts/lint_marketplace.py +27 -0
- package/scripts/lint_no_new_atomic_commands.py +179 -0
- package/scripts/lint_rule_interactions.py +149 -0
- package/scripts/memory_lookup.py +1 -1
- package/scripts/migrate_command_suggestions.py +151 -0
- package/scripts/release.py +297 -64
- package/scripts/schemas/command.schema.json +41 -0
- package/scripts/skill_linter.py +81 -0
- package/scripts/sync_agent_settings.py +42 -12
- package/scripts/update_counts.py +10 -0
- package/templates/consumer-settings/augment-cli-hooks.json +54 -0
- package/templates/consumer-settings/claude-settings.json +55 -1
- package/.agent-src/rules/chat-history.md +0 -171
- package/.agent-src/templates/scripts/implement_ticket/cli.py +0 -171
- package/.agent-src/templates/scripts/implement_ticket/dispatcher.py +0 -134
- package/.agent-src/templates/scripts/implement_ticket/steps/__init__.py +0 -49
- package/.agent-src/templates/scripts/implement_ticket/steps/refine.py +0 -140
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"""Linear step dispatcher for ``/implement-ticket``.
|
|
2
|
-
|
|
3
|
-
The dispatcher holds no business logic. It walks the fixed eight-step
|
|
4
|
-
order declared in ``agents/contexts/implement-ticket-flow.md``, hands
|
|
5
|
-
each step a live ``DeliveryState``, and honours the three terminal
|
|
6
|
-
outcomes:
|
|
7
|
-
|
|
8
|
-
- ``SUCCESS`` — record and advance.
|
|
9
|
-
- ``BLOCKED`` — record, copy questions onto the state, halt.
|
|
10
|
-
- ``PARTIAL`` — record, copy questions onto the state, halt.
|
|
11
|
-
|
|
12
|
-
Resumption semantics (Option A, flow contract §agent-directives):
|
|
13
|
-
steps whose name is already marked ``success`` in
|
|
14
|
-
``state.outcomes`` are **skipped**. This lets a caller re-invoke the
|
|
15
|
-
dispatcher after executing an agent-directive (the ``implement``,
|
|
16
|
-
``test``, ``verify`` steps cannot run from pure Python), update the
|
|
17
|
-
relevant slice of ``DeliveryState``, record ``success`` on the
|
|
18
|
-
resumed step, and continue without replaying earlier work.
|
|
19
|
-
|
|
20
|
-
Step handlers are injected by the caller rather than discovered at
|
|
21
|
-
import time. Phase 1 shipped the dispatcher with mock handlers;
|
|
22
|
-
Phase 2 wires the real ones under ``steps/``. Keeping injection
|
|
23
|
-
explicit means the dispatcher is trivially testable and never
|
|
24
|
-
depends on handler import order.
|
|
25
|
-
"""
|
|
26
|
-
from __future__ import annotations
|
|
27
|
-
|
|
28
|
-
from collections.abc import Mapping
|
|
29
|
-
|
|
30
|
-
from .delivery_state import DeliveryState, Outcome, Step, StepResult
|
|
31
|
-
|
|
32
|
-
STEP_ORDER: tuple[str, ...] = (
|
|
33
|
-
"refine",
|
|
34
|
-
"memory",
|
|
35
|
-
"analyze",
|
|
36
|
-
"plan",
|
|
37
|
-
"implement",
|
|
38
|
-
"test",
|
|
39
|
-
"verify",
|
|
40
|
-
"report",
|
|
41
|
-
)
|
|
42
|
-
"""Canonical execution order. Eight steps, fixed, no branching.
|
|
43
|
-
|
|
44
|
-
Changing this order is a roadmap-level decision — not a PR rider — per
|
|
45
|
-
the surface-growth guardrails in
|
|
46
|
-
``agents/roadmaps/road-to-implement-ticket.md``.
|
|
47
|
-
"""
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def dispatch(
|
|
51
|
-
state: DeliveryState,
|
|
52
|
-
steps: Mapping[str, Step],
|
|
53
|
-
) -> tuple[Outcome, str | None]:
|
|
54
|
-
"""Run the eight steps linearly against ``state``.
|
|
55
|
-
|
|
56
|
-
Returns a ``(final_outcome, halting_step)`` tuple. ``halting_step``
|
|
57
|
-
is ``None`` when every step succeeded; otherwise it carries the
|
|
58
|
-
name of the step whose result halted the flow.
|
|
59
|
-
|
|
60
|
-
Parameters
|
|
61
|
-
----------
|
|
62
|
-
state:
|
|
63
|
-
Live ``DeliveryState``. Mutated in place: each step's outcome
|
|
64
|
-
is recorded in ``state.outcomes`` under the step name, and
|
|
65
|
-
any surfaced questions land on ``state.questions``.
|
|
66
|
-
steps:
|
|
67
|
-
Mapping from step name to handler. Every entry in
|
|
68
|
-
:data:`STEP_ORDER` must be present; missing entries raise
|
|
69
|
-
``KeyError`` at dispatch time rather than silently skipping,
|
|
70
|
-
so incomplete wiring surfaces as a hard failure.
|
|
71
|
-
|
|
72
|
-
Raises
|
|
73
|
-
------
|
|
74
|
-
KeyError
|
|
75
|
-
If ``steps`` does not cover every entry in
|
|
76
|
-
:data:`STEP_ORDER`.
|
|
77
|
-
"""
|
|
78
|
-
_assert_all_steps_present(steps)
|
|
79
|
-
|
|
80
|
-
# Clear stale questions from a previous halt before we resume so
|
|
81
|
-
# the caller never mistakes old options for fresh ones.
|
|
82
|
-
state.questions = []
|
|
83
|
-
|
|
84
|
-
for name in STEP_ORDER:
|
|
85
|
-
if state.outcomes.get(name) == Outcome.SUCCESS.value:
|
|
86
|
-
# Already completed on an earlier invocation — skip per the
|
|
87
|
-
# resume contract. The caller is responsible for keeping
|
|
88
|
-
# ``state.outcomes`` and the matching slice in sync.
|
|
89
|
-
continue
|
|
90
|
-
|
|
91
|
-
handler = steps[name]
|
|
92
|
-
result = handler(state)
|
|
93
|
-
_validate_step_result(name, result)
|
|
94
|
-
|
|
95
|
-
state.outcomes[name] = result.outcome.value
|
|
96
|
-
|
|
97
|
-
if result.outcome is Outcome.BLOCKED:
|
|
98
|
-
state.questions = list(result.questions)
|
|
99
|
-
return Outcome.BLOCKED, name
|
|
100
|
-
|
|
101
|
-
if result.outcome is Outcome.PARTIAL:
|
|
102
|
-
state.questions = list(result.questions)
|
|
103
|
-
return Outcome.PARTIAL, name
|
|
104
|
-
|
|
105
|
-
return Outcome.SUCCESS, None
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
def _assert_all_steps_present(steps: Mapping[str, Step]) -> None:
|
|
109
|
-
"""Reject an incomplete step mapping up front.
|
|
110
|
-
|
|
111
|
-
We deliberately fail loudly here: a missing step would otherwise
|
|
112
|
-
raise deep inside the dispatch loop after partial state mutation,
|
|
113
|
-
which makes debugging the wiring harder than it needs to be.
|
|
114
|
-
"""
|
|
115
|
-
missing = [name for name in STEP_ORDER if name not in steps]
|
|
116
|
-
if missing:
|
|
117
|
-
raise KeyError(
|
|
118
|
-
"Step mapping is missing handlers for: " + ", ".join(missing),
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
def _validate_step_result(name: str, result: StepResult) -> None:
|
|
123
|
-
"""Enforce the blocked/partial invariant: questions must be set.
|
|
124
|
-
|
|
125
|
-
A step that blocks without surfacing a question is a bug — there
|
|
126
|
-
is nothing for the user to answer. We raise ``ValueError`` instead
|
|
127
|
-
of silently recording the outcome so the defect is visible at the
|
|
128
|
-
earliest possible point.
|
|
129
|
-
"""
|
|
130
|
-
if result.outcome in (Outcome.BLOCKED, Outcome.PARTIAL) and not result.questions:
|
|
131
|
-
raise ValueError(
|
|
132
|
-
f"Step {name!r} returned {result.outcome.value} with no questions; "
|
|
133
|
-
"blocked and partial outcomes must surface at least one numbered option.",
|
|
134
|
-
)
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"""Step handlers for the ``/implement-ticket`` dispatcher.
|
|
2
|
-
|
|
3
|
-
Each module exposes a single ``run`` callable that matches the
|
|
4
|
-
``Step`` protocol defined in ``..delivery_state``. The dispatcher
|
|
5
|
-
wires them into the ``STEP_ORDER`` mapping at call time; nothing in
|
|
6
|
-
this package imports handlers eagerly, so a partial wiring during
|
|
7
|
-
development is caught by the dispatcher's missing-step check rather
|
|
8
|
-
than by an import-time failure.
|
|
9
|
-
|
|
10
|
-
Phase 2 ships all eight step handlers. The deterministic gates
|
|
11
|
-
(``refine``, ``memory``, ``analyze``) validate upstream state; the
|
|
12
|
-
delegation gates (``plan``, ``implement``, ``test``, ``verify``)
|
|
13
|
-
halt with ``@agent-directive:`` markers so the orchestrator can
|
|
14
|
-
invoke the matching skill and resume. ``report`` renders the
|
|
15
|
-
delivery Markdown once everything else has succeeded. See
|
|
16
|
-
``agents/roadmaps/road-to-implement-ticket.md`` for the shipping
|
|
17
|
-
order and ``agents/contexts/implement-ticket-flow.md`` for the
|
|
18
|
-
slice contracts each handler writes to.
|
|
19
|
-
"""
|
|
20
|
-
from __future__ import annotations
|
|
21
|
-
|
|
22
|
-
from . import analyze, implement, memory, plan, refine, report, test, verify
|
|
23
|
-
|
|
24
|
-
_STEPS = (refine, memory, analyze, plan, implement, test, verify, report)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def all_ambiguities() -> dict[str, tuple[dict[str, str], ...]]:
|
|
28
|
-
"""Return `{step_name: AMBIGUITIES}` for every step in flow order.
|
|
29
|
-
|
|
30
|
-
Used by documentation generators and the ``test_ambiguity_coverage``
|
|
31
|
-
suite to prove every step explicitly declares what can surface a
|
|
32
|
-
``BLOCKED`` outcome. Steps that always succeed (``memory``,
|
|
33
|
-
``report``) return an empty tuple — declared intent, not an
|
|
34
|
-
omission.
|
|
35
|
-
"""
|
|
36
|
-
return {step.__name__.rsplit(".", 1)[-1]: step.AMBIGUITIES for step in _STEPS}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
__all__ = [
|
|
40
|
-
"all_ambiguities",
|
|
41
|
-
"analyze",
|
|
42
|
-
"implement",
|
|
43
|
-
"memory",
|
|
44
|
-
"plan",
|
|
45
|
-
"refine",
|
|
46
|
-
"report",
|
|
47
|
-
"test",
|
|
48
|
-
"verify",
|
|
49
|
-
]
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
"""``refine`` step — deterministic gate in front of the ``refine-ticket`` skill.
|
|
2
|
-
|
|
3
|
-
The step never calls an LLM. It inspects ``state.ticket`` for the
|
|
4
|
-
minimum viable shape (an identifier, a non-trivial title, and at
|
|
5
|
-
least one sufficiently concrete acceptance criterion) and either:
|
|
6
|
-
|
|
7
|
-
- returns ``SUCCESS`` — the ticket is already refined enough for the
|
|
8
|
-
downstream steps to plan against, or
|
|
9
|
-
- returns ``BLOCKED`` — the deficiencies are listed as numbered
|
|
10
|
-
options per the ``user-interaction`` rule, and the flow halts so
|
|
11
|
-
the user can run ``/refine-ticket`` (or provide the missing data)
|
|
12
|
-
and re-invoke ``/implement-ticket``.
|
|
13
|
-
|
|
14
|
-
The checks live here (rather than inside the ``refine-ticket`` skill)
|
|
15
|
-
because the dispatcher is synchronous Python: it cannot "delegate"
|
|
16
|
-
to an agent skill mid-loop. Making the gate deterministic keeps the
|
|
17
|
-
contract "block on ambiguity, never guess" enforceable from code,
|
|
18
|
-
and leaves the harder judgement calls (is an AC measurable? testable?)
|
|
19
|
-
to the human-run ``/refine-ticket`` flow on the rebound.
|
|
20
|
-
"""
|
|
21
|
-
from __future__ import annotations
|
|
22
|
-
|
|
23
|
-
from typing import Any
|
|
24
|
-
|
|
25
|
-
from ..delivery_state import DeliveryState, Outcome, StepResult
|
|
26
|
-
|
|
27
|
-
_MIN_TITLE_LEN = 3
|
|
28
|
-
_MIN_AC_LEN = 10
|
|
29
|
-
|
|
30
|
-
AMBIGUITIES: tuple[dict[str, str], ...] = (
|
|
31
|
-
{
|
|
32
|
-
"code": "missing_id",
|
|
33
|
-
"trigger": "ticket has no `id` field (or only whitespace)",
|
|
34
|
-
"resolution": "run `/refine-ticket` or paste the ticket id in chat",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"code": "trivial_title",
|
|
38
|
-
"trigger": f"title missing or shorter than {_MIN_TITLE_LEN} chars",
|
|
39
|
-
"resolution": "run `/refine-ticket` to rewrite the title",
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"code": "missing_or_vague_ac",
|
|
43
|
-
"trigger": (
|
|
44
|
-
f"acceptance_criteria empty, non-list, or any item under "
|
|
45
|
-
f"{_MIN_AC_LEN} chars"
|
|
46
|
-
),
|
|
47
|
-
"resolution": "run `/refine-ticket` to add concrete acceptance criteria",
|
|
48
|
-
},
|
|
49
|
-
)
|
|
50
|
-
"""Declared ambiguity surfaces. Every BLOCKED return maps to one code."""
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def run(state: DeliveryState) -> StepResult:
|
|
54
|
-
"""Return SUCCESS when the ticket is refined, BLOCKED otherwise."""
|
|
55
|
-
deficiencies = _diagnose(state.ticket)
|
|
56
|
-
if not deficiencies:
|
|
57
|
-
return StepResult(outcome=Outcome.SUCCESS)
|
|
58
|
-
|
|
59
|
-
ticket_id = state.ticket.get("id") or "(no id)"
|
|
60
|
-
questions = _format_questions(ticket_id, deficiencies)
|
|
61
|
-
return StepResult(
|
|
62
|
-
outcome=Outcome.BLOCKED,
|
|
63
|
-
questions=questions,
|
|
64
|
-
message=(
|
|
65
|
-
f"Ticket {ticket_id} is not refined enough to plan against: "
|
|
66
|
-
+ "; ".join(deficiencies)
|
|
67
|
-
),
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def _diagnose(ticket: dict[str, Any]) -> list[str]:
|
|
72
|
-
"""Return a human-readable list of what's missing from the ticket.
|
|
73
|
-
|
|
74
|
-
Order matches what a reader needs first (identity → summary →
|
|
75
|
-
acceptance criteria) so the surfaced questions read naturally.
|
|
76
|
-
"""
|
|
77
|
-
issues: list[str] = []
|
|
78
|
-
|
|
79
|
-
ticket_id = ticket.get("id")
|
|
80
|
-
if not isinstance(ticket_id, str) or not ticket_id.strip():
|
|
81
|
-
issues.append("missing ticket id")
|
|
82
|
-
|
|
83
|
-
title = ticket.get("title")
|
|
84
|
-
if not isinstance(title, str) or len(title.strip()) < _MIN_TITLE_LEN:
|
|
85
|
-
issues.append("missing or trivial title")
|
|
86
|
-
|
|
87
|
-
ac = ticket.get("acceptance_criteria")
|
|
88
|
-
if not isinstance(ac, list) or not ac:
|
|
89
|
-
issues.append("no acceptance criteria")
|
|
90
|
-
else:
|
|
91
|
-
weak_indices = [
|
|
92
|
-
idx + 1
|
|
93
|
-
for idx, item in enumerate(ac)
|
|
94
|
-
if not _is_concrete_ac(item)
|
|
95
|
-
]
|
|
96
|
-
if weak_indices:
|
|
97
|
-
issues.append(
|
|
98
|
-
"vague acceptance criteria at position(s) "
|
|
99
|
-
+ ", ".join(str(i) for i in weak_indices),
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
return issues
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def _is_concrete_ac(item: Any) -> bool:
|
|
106
|
-
"""An AC is concrete when it is a non-empty string above the length floor.
|
|
107
|
-
|
|
108
|
-
The floor is deliberately loose: refine is a gate, not a style
|
|
109
|
-
judge. The heavy lifting (measurability, testability, tone) is
|
|
110
|
-
owned by the ``refine-ticket`` skill on the rebound.
|
|
111
|
-
"""
|
|
112
|
-
if not isinstance(item, str):
|
|
113
|
-
return False
|
|
114
|
-
return len(item.strip()) >= _MIN_AC_LEN
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
def _format_questions(ticket_id: str, deficiencies: list[str]) -> list[str]:
|
|
118
|
-
"""Render the numbered options shown to the user when BLOCKED.
|
|
119
|
-
|
|
120
|
-
Three options, ordered by likely next action: run the existing
|
|
121
|
-
refinement skill, paste the missing data in chat, or abandon the
|
|
122
|
-
ticket entirely. ``user-interaction`` requires numbered, prose-
|
|
123
|
-
free options; the deficiency list is rendered as a headnote.
|
|
124
|
-
"""
|
|
125
|
-
headnote = (
|
|
126
|
-
"> Ticket "
|
|
127
|
-
+ ticket_id
|
|
128
|
-
+ " is missing: "
|
|
129
|
-
+ "; ".join(deficiencies)
|
|
130
|
-
+ "."
|
|
131
|
-
)
|
|
132
|
-
return [
|
|
133
|
-
headnote,
|
|
134
|
-
f"> 1. Run `/refine-ticket {ticket_id}` and re-invoke `/implement-ticket`",
|
|
135
|
-
"> 2. Provide the missing details in chat — I'll merge them into the ticket",
|
|
136
|
-
"> 3. Abandon this ticket — too vague to implement",
|
|
137
|
-
]
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
__all__ = ["AMBIGUITIES", "run"]
|