@event4u/agent-config 1.13.0 → 1.14.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 +3 -0
- 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 +5 -1
- 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 +5 -0
- package/.agent-src/commands/chat-history-resume.md +5 -0
- package/.agent-src/commands/chat-history.md +5 -0
- package/.agent-src/commands/check-current-md.md +126 -0
- package/.agent-src/commands/commit-in-chunks.md +98 -0
- package/.agent-src/commands/commit.md +4 -0
- package/.agent-src/commands/compress.md +3 -0
- 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 +3 -0
- 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 +24 -0
- package/.agent-src/commands/optimize-agents.md +4 -0
- package/.agent-src/commands/optimize-augmentignore.md +3 -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 +4 -1
- package/.agent-src/commands/review-changes.md +4 -0
- package/.agent-src/commands/review-routing.md +4 -0
- package/.agent-src/commands/roadmap-create.md +7 -0
- package/.agent-src/commands/roadmap-execute.md +12 -1
- package/.agent-src/commands/rule-compliance-audit.md +4 -0
- package/.agent-src/commands/set-cost-profile.md +3 -0
- package/.agent-src/commands/sync-agent-settings.md +3 -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 +4 -0
- 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 +8 -0
- package/.agent-src/rules/autonomous-execution.md +158 -0
- package/.agent-src/rules/chat-history.md +147 -118
- package/.agent-src/rules/cli-output-handling.md +26 -3
- package/.agent-src/rules/command-suggestion.md +133 -0
- package/.agent-src/rules/commit-policy.md +99 -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 +81 -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 +103 -30
- package/.agent-src/rules/scope-control.md +42 -1
- package/.agent-src/rules/size-enforcement.md +1 -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 +82 -50
- package/.agent-src/scripts/update_roadmap_progress.py +17 -5
- package/.agent-src/skills/blade-ui/SKILL.md +30 -5
- package/.agent-src/skills/command-routing/SKILL.md +32 -0
- package/.agent-src/skills/command-writing/SKILL.md +41 -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 +187 -0
- package/.agent-src/skills/fe-design/SKILL.md +72 -60
- 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 +30 -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 +2 -4
- package/.agent-src/skills/roadmap-management/SKILL.md +10 -3
- package/.agent-src/skills/rule-writing/SKILL.md +23 -1
- package/.agent-src/skills/skill-writing/SKILL.md +1 -3
- package/.agent-src/skills/upstream-contribute/SKILL.md +1 -1
- 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 +8 -2
- 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/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 +592 -0
- package/.agent-src/templates/scripts/{implement_ticket → work_engine}/delivery_state.py +7 -0
- 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 +2 -2
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/memory.py +1 -1
- package/.agent-src/templates/scripts/{implement_ticket/steps → work_engine/directives/backend}/plan.py +1 -1
- 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 +36 -4
- 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/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/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 +199 -0
- 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/.claude-plugin/marketplace.json +105 -2
- package/AGENTS.md +36 -8
- package/CHANGELOG.md +534 -0
- package/README.md +125 -4
- package/config/agent-settings.template.yml +45 -0
- package/config/gitignore-block.txt +4 -0
- package/docs/architecture.md +28 -1
- package/docs/development.md +1 -1
- package/docs/getting-started.md +2 -2
- package/docs/installation.md +86 -0
- package/docs/showcase.md +204 -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 +36 -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/migrate_command_suggestions.py +151 -0
- package/scripts/schemas/command.schema.json +41 -0
- package/scripts/skill_linter.py +67 -0
- package/scripts/sync_agent_settings.py +42 -12
- package/templates/consumer-settings/augment-cli-hooks.json +54 -0
- package/templates/consumer-settings/claude-settings.json +55 -1
- 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
- /package/.agent-src/templates/scripts/{implement_ticket → work_engine}/persona_policy.py +0 -0
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"""Command-line entry point for ``/implement-ticket``.
|
|
2
|
-
|
|
3
|
-
Minimal Option-A transport: the script loads a persisted
|
|
4
|
-
``DeliveryState`` (or builds one from a ticket file), runs the
|
|
5
|
-
dispatcher once, writes the updated state back, and prints either
|
|
6
|
-
the delivery report (on SUCCESS) or the halt surface — directive
|
|
7
|
-
plus numbered questions — on BLOCKED/PARTIAL.
|
|
8
|
-
|
|
9
|
-
The script never edits code, runs tests, or opens pull requests.
|
|
10
|
-
All of that is delegated to the agent via ``@agent-directive:``
|
|
11
|
-
markers per
|
|
12
|
-
``agents/contexts/implement-ticket-flow.md#agent-directives``. The
|
|
13
|
-
agent executes the directive, writes the resulting slice back to
|
|
14
|
-
the state file, and re-invokes this script to resume.
|
|
15
|
-
|
|
16
|
-
Exit codes:
|
|
17
|
-
|
|
18
|
-
- ``0`` — flow reached SUCCESS; ``state.report`` printed.
|
|
19
|
-
- ``1`` — flow halted BLOCKED; halt surface printed on stdout, the
|
|
20
|
-
state file carries the updated ``outcomes`` and ``questions`` so
|
|
21
|
-
the agent can resume.
|
|
22
|
-
- ``2`` — argument or I/O error (ticket file missing, JSON parse
|
|
23
|
-
failure, etc.). The state file is *not* written in this case.
|
|
24
|
-
"""
|
|
25
|
-
from __future__ import annotations
|
|
26
|
-
|
|
27
|
-
import argparse
|
|
28
|
-
import json
|
|
29
|
-
import sys
|
|
30
|
-
from dataclasses import asdict
|
|
31
|
-
from pathlib import Path
|
|
32
|
-
from typing import Sequence
|
|
33
|
-
|
|
34
|
-
from .delivery_state import DeliveryState, Outcome
|
|
35
|
-
from .dispatcher import dispatch
|
|
36
|
-
from .steps import analyze, implement, memory, plan, refine, report, verify
|
|
37
|
-
from .steps import test as test_step
|
|
38
|
-
|
|
39
|
-
DEFAULT_STATE_FILE = Path(".implement-ticket-state.json")
|
|
40
|
-
"""State file used when ``--state-file`` is not passed."""
|
|
41
|
-
|
|
42
|
-
_STEPS = {
|
|
43
|
-
"refine": refine.run,
|
|
44
|
-
"memory": memory.run,
|
|
45
|
-
"analyze": analyze.run,
|
|
46
|
-
"plan": plan.run,
|
|
47
|
-
"implement": implement.run,
|
|
48
|
-
"test": test_step.run,
|
|
49
|
-
"verify": verify.run,
|
|
50
|
-
"report": report.run,
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def main(argv: Sequence[str] | None = None) -> int:
|
|
55
|
-
"""Run one dispatch cycle against the persisted state.
|
|
56
|
-
|
|
57
|
-
``argv`` is taken as-is; pass ``None`` to fall back to
|
|
58
|
-
``sys.argv[1:]`` (the usual entry-point contract).
|
|
59
|
-
"""
|
|
60
|
-
parser = _build_parser()
|
|
61
|
-
args = parser.parse_args(argv)
|
|
62
|
-
state_file: Path = args.state_file
|
|
63
|
-
|
|
64
|
-
try:
|
|
65
|
-
state = _load_or_build(state_file, args)
|
|
66
|
-
except _CLIError as exc:
|
|
67
|
-
print(f"error: {exc}", file=sys.stderr)
|
|
68
|
-
return 2
|
|
69
|
-
|
|
70
|
-
final, halting = dispatch(state, _STEPS)
|
|
71
|
-
_save(state_file, state)
|
|
72
|
-
_emit(state, final, halting)
|
|
73
|
-
return 0 if final is Outcome.SUCCESS else 1
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def _build_parser() -> argparse.ArgumentParser:
|
|
77
|
-
parser = argparse.ArgumentParser(
|
|
78
|
-
prog="implement-ticket",
|
|
79
|
-
description="Run one dispatch cycle of the /implement-ticket flow.",
|
|
80
|
-
)
|
|
81
|
-
parser.add_argument(
|
|
82
|
-
"--state-file",
|
|
83
|
-
type=Path,
|
|
84
|
-
default=DEFAULT_STATE_FILE,
|
|
85
|
-
help=f"Path to persisted state JSON (default: {DEFAULT_STATE_FILE}).",
|
|
86
|
-
)
|
|
87
|
-
parser.add_argument(
|
|
88
|
-
"--ticket-file",
|
|
89
|
-
type=Path,
|
|
90
|
-
default=None,
|
|
91
|
-
help="JSON file carrying the ticket payload; used only when the "
|
|
92
|
-
"state file does not exist yet.",
|
|
93
|
-
)
|
|
94
|
-
parser.add_argument(
|
|
95
|
-
"--persona",
|
|
96
|
-
type=str,
|
|
97
|
-
default=None,
|
|
98
|
-
help="Persona name (senior-engineer | qa | advisory). Only honoured "
|
|
99
|
-
"when the state file does not exist yet; ignored on resume so a "
|
|
100
|
-
"mid-flight persona switch cannot silently change behaviour.",
|
|
101
|
-
)
|
|
102
|
-
return parser
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def _load_or_build(state_file: Path, args: argparse.Namespace) -> DeliveryState:
|
|
106
|
-
"""Return the state to dispatch against — either loaded or freshly built."""
|
|
107
|
-
if state_file.exists():
|
|
108
|
-
return _load(state_file)
|
|
109
|
-
if args.ticket_file is None:
|
|
110
|
-
raise _CLIError(
|
|
111
|
-
f"No state file at {state_file} and no --ticket-file given; "
|
|
112
|
-
"cannot build an initial DeliveryState.",
|
|
113
|
-
)
|
|
114
|
-
ticket = _read_json(args.ticket_file)
|
|
115
|
-
if not isinstance(ticket, dict):
|
|
116
|
-
raise _CLIError(
|
|
117
|
-
f"--ticket-file must carry a JSON object; got {type(ticket).__name__}.",
|
|
118
|
-
)
|
|
119
|
-
kwargs: dict = {"ticket": ticket}
|
|
120
|
-
if args.persona:
|
|
121
|
-
kwargs["persona"] = args.persona
|
|
122
|
-
return DeliveryState(**kwargs)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
def _load(state_file: Path) -> DeliveryState:
|
|
126
|
-
data = _read_json(state_file)
|
|
127
|
-
if not isinstance(data, dict):
|
|
128
|
-
raise _CLIError(
|
|
129
|
-
f"State file {state_file} must carry a JSON object; "
|
|
130
|
-
f"got {type(data).__name__}.",
|
|
131
|
-
)
|
|
132
|
-
try:
|
|
133
|
-
return DeliveryState(**data)
|
|
134
|
-
except TypeError as exc:
|
|
135
|
-
raise _CLIError(f"State file shape is invalid: {exc}") from exc
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
def _save(state_file: Path, state: DeliveryState) -> None:
|
|
139
|
-
"""Persist ``state`` as pretty JSON for diffing + human inspection."""
|
|
140
|
-
state_file.parent.mkdir(parents=True, exist_ok=True)
|
|
141
|
-
state_file.write_text(
|
|
142
|
-
json.dumps(asdict(state), indent=2, ensure_ascii=False) + "\n",
|
|
143
|
-
encoding="utf-8",
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
def _read_json(path: Path):
|
|
148
|
-
try:
|
|
149
|
-
raw = path.read_text(encoding="utf-8")
|
|
150
|
-
except OSError as exc:
|
|
151
|
-
raise _CLIError(f"Cannot read {path}: {exc}") from exc
|
|
152
|
-
try:
|
|
153
|
-
return json.loads(raw)
|
|
154
|
-
except json.JSONDecodeError as exc:
|
|
155
|
-
raise _CLIError(f"Invalid JSON in {path}: {exc}") from exc
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
def _emit(state: DeliveryState, final: Outcome, halting: str | None) -> None:
|
|
159
|
-
if final is Outcome.SUCCESS:
|
|
160
|
-
print(state.report)
|
|
161
|
-
return
|
|
162
|
-
print(f"[halt] outcome={final.value} step={halting or '(none)'}")
|
|
163
|
-
for line in state.questions:
|
|
164
|
-
print(line)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
class _CLIError(Exception):
|
|
168
|
-
"""Raised on configuration or I/O problems. Converted to exit code 2."""
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
__all__ = ["DEFAULT_STATE_FILE", "main"]
|
|
@@ -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"]
|
|
File without changes
|