@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
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"""``apply`` step — single-file edit path for the ``ui-trivial`` set.
|
|
2
|
+
|
|
3
|
+
Phase 2 Step 6 of ``agents/roadmaps/road-to-product-ui-track.md``: the
|
|
4
|
+
short-circuit path for micro UI edits that provably cannot warrant the
|
|
5
|
+
full audit / design / review / polish loop. Hard preconditions enforced
|
|
6
|
+
on every rebound:
|
|
7
|
+
|
|
8
|
+
- edit surface **≤ 1 file**
|
|
9
|
+
- **≤ 5 changed lines**
|
|
10
|
+
- **no new component**
|
|
11
|
+
- **no new state** (no new Livewire props, React hooks, Vue refs)
|
|
12
|
+
- **no new dependency** (no Composer/npm package added)
|
|
13
|
+
|
|
14
|
+
Any precondition violation BLOCKS with an ``@agent-directive:
|
|
15
|
+
reclassify-to-ui-improve`` halt; the orchestrator promotes
|
|
16
|
+
``state.directive_set`` to ``"ui-improve"`` (the audit-gated path) and
|
|
17
|
+
re-invokes the engine. The audit gate is **not** weakened — it is
|
|
18
|
+
bypassed only for cases that mathematically cannot need it.
|
|
19
|
+
|
|
20
|
+
On first pass ``state.ticket["trivial_edit"]`` is unset; the step
|
|
21
|
+
delegates to the agent via ``@agent-directive: trivial-apply``. The
|
|
22
|
+
agent inspects the request, performs the edit, and writes the envelope
|
|
23
|
+
back so the rebound runs the deterministic checks.
|
|
24
|
+
"""
|
|
25
|
+
from __future__ import annotations
|
|
26
|
+
|
|
27
|
+
from typing import Any
|
|
28
|
+
|
|
29
|
+
from ...delivery_state import (
|
|
30
|
+
DeliveryState,
|
|
31
|
+
Outcome,
|
|
32
|
+
StepResult,
|
|
33
|
+
agent_directive,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
MAX_FILES: int = 1
|
|
37
|
+
"""Edit-surface ceiling — single-file edits only."""
|
|
38
|
+
|
|
39
|
+
MAX_LINES_CHANGED: int = 5
|
|
40
|
+
"""Changed-line ceiling — anything larger is structural, not trivial."""
|
|
41
|
+
|
|
42
|
+
AMBIGUITIES: tuple[dict[str, str], ...] = (
|
|
43
|
+
{
|
|
44
|
+
"code": "trivial_envelope_missing",
|
|
45
|
+
"trigger": "state.ticket['trivial_edit'] unset — first pass",
|
|
46
|
+
"resolution": "agent directive `trivial-apply` → agent performs "
|
|
47
|
+
"the single-file edit and writes the envelope back",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"code": "trivial_preconditions_violated",
|
|
51
|
+
"trigger": "edit touches >1 file, >5 lines, adds component/state/dependency",
|
|
52
|
+
"resolution": "agent directive `reclassify-to-ui-improve` → "
|
|
53
|
+
"orchestrator promotes directive_set='ui-improve' and re-runs "
|
|
54
|
+
"through the full audit gate",
|
|
55
|
+
},
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def run(state: DeliveryState) -> StepResult:
|
|
60
|
+
"""Apply the trivial-edit gate."""
|
|
61
|
+
envelope = _trivial_envelope(state)
|
|
62
|
+
if envelope is None:
|
|
63
|
+
return _delegate_to_agent(state)
|
|
64
|
+
|
|
65
|
+
violations = _check_preconditions(envelope)
|
|
66
|
+
if violations:
|
|
67
|
+
return _halt_reclassify(state, violations)
|
|
68
|
+
|
|
69
|
+
_record_change(state, envelope)
|
|
70
|
+
return StepResult(outcome=Outcome.SUCCESS)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _trivial_envelope(state: DeliveryState) -> dict[str, Any] | None:
|
|
74
|
+
"""Return the agent-written ``trivial_edit`` envelope, or ``None``."""
|
|
75
|
+
data = state.ticket or {}
|
|
76
|
+
envelope = data.get("trivial_edit")
|
|
77
|
+
if isinstance(envelope, dict) and envelope:
|
|
78
|
+
return envelope
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _check_preconditions(envelope: dict[str, Any]) -> list[str]:
|
|
83
|
+
"""Return a list of violation codes; empty when all preconditions pass."""
|
|
84
|
+
violations: list[str] = []
|
|
85
|
+
|
|
86
|
+
files = envelope.get("files")
|
|
87
|
+
if not isinstance(files, list) or len(files) == 0:
|
|
88
|
+
violations.append("files_missing")
|
|
89
|
+
elif len(files) > MAX_FILES:
|
|
90
|
+
violations.append(f"files_exceeded:{len(files)}>{MAX_FILES}")
|
|
91
|
+
|
|
92
|
+
lines = envelope.get("lines_changed")
|
|
93
|
+
try:
|
|
94
|
+
lines_int = int(lines) # type: ignore[arg-type]
|
|
95
|
+
except (TypeError, ValueError):
|
|
96
|
+
violations.append("lines_changed_missing")
|
|
97
|
+
else:
|
|
98
|
+
if lines_int > MAX_LINES_CHANGED:
|
|
99
|
+
violations.append(f"lines_exceeded:{lines_int}>{MAX_LINES_CHANGED}")
|
|
100
|
+
if lines_int < 0:
|
|
101
|
+
violations.append("lines_changed_negative")
|
|
102
|
+
|
|
103
|
+
if envelope.get("new_component"):
|
|
104
|
+
violations.append("new_component")
|
|
105
|
+
if envelope.get("new_state"):
|
|
106
|
+
violations.append("new_state")
|
|
107
|
+
if envelope.get("new_dependency"):
|
|
108
|
+
violations.append("new_dependency")
|
|
109
|
+
|
|
110
|
+
return violations
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def _delegate_to_agent(state: DeliveryState) -> StepResult:
|
|
114
|
+
"""First-pass halt — delegate to the agent for the single-file edit."""
|
|
115
|
+
return StepResult(
|
|
116
|
+
outcome=Outcome.BLOCKED,
|
|
117
|
+
questions=[
|
|
118
|
+
agent_directive("trivial-apply"),
|
|
119
|
+
"> Trivial UI edit path \u2014 audit / design / review skipped.",
|
|
120
|
+
"> 1. Continue \u2014 perform the single-file edit, then "
|
|
121
|
+
"write a `trivial_edit` envelope back into state.ticket "
|
|
122
|
+
"(files, lines_changed, new_component, new_state, new_dependency)",
|
|
123
|
+
"> 2. Abort \u2014 drop this trivial edit",
|
|
124
|
+
],
|
|
125
|
+
message="Trivial UI edit pending; delegating to agent for single-file edit.",
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _halt_reclassify(state: DeliveryState, violations: list[str]) -> StepResult:
|
|
130
|
+
"""BLOCKED halt \u2014 orchestrator must reclassify to ``ui-improve``."""
|
|
131
|
+
state.ticket["__reclassify_to__"] = "ui-improve"
|
|
132
|
+
state.ticket.pop("trivial_edit", None)
|
|
133
|
+
return StepResult(
|
|
134
|
+
outcome=Outcome.BLOCKED,
|
|
135
|
+
questions=[
|
|
136
|
+
agent_directive("reclassify-to-ui-improve"),
|
|
137
|
+
"> Trivial-edit preconditions violated; this work needs the "
|
|
138
|
+
"full audit gate.",
|
|
139
|
+
f"> Violations: {', '.join(violations)}.",
|
|
140
|
+
"> 1. Reclassify \u2014 orchestrator sets "
|
|
141
|
+
"`state.directive_set = \"ui-improve\"` and re-runs the engine",
|
|
142
|
+
"> 2. Abort \u2014 drop this UI request",
|
|
143
|
+
],
|
|
144
|
+
message=(
|
|
145
|
+
"Trivial-edit preconditions failed "
|
|
146
|
+
f"({', '.join(violations)}); reclassification required."
|
|
147
|
+
),
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def _record_change(state: DeliveryState, envelope: dict[str, Any]) -> None:
|
|
152
|
+
"""Write a single ``state.changes`` entry summarising the trivial edit."""
|
|
153
|
+
files = envelope.get("files") or []
|
|
154
|
+
lines = envelope.get("lines_changed", 0)
|
|
155
|
+
state.changes.append(
|
|
156
|
+
{
|
|
157
|
+
"kind": "ui-trivial",
|
|
158
|
+
"files": list(files),
|
|
159
|
+
"lines_changed": lines,
|
|
160
|
+
"summary": envelope.get("summary") or "trivial UI edit",
|
|
161
|
+
},
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
__all__ = ["AMBIGUITIES", "MAX_FILES", "MAX_LINES_CHANGED", "run"]
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""``refine`` step — intent gate for the ``ui-trivial`` directive set.
|
|
2
|
+
|
|
3
|
+
Phase 2 Step 6 of ``agents/roadmaps/road-to-product-ui-track.md``:
|
|
4
|
+
``ui-trivial`` is reachable only when Phase 1's intent classifier (or
|
|
5
|
+
an explicit user override) labelled the work as ``ui-trivial``. Reaching
|
|
6
|
+
this slot through any other route is a routing error, not a user-facing
|
|
7
|
+
ambiguity.
|
|
8
|
+
|
|
9
|
+
The handler is deterministic and tiny: confirm the ticket carries the
|
|
10
|
+
expected intent label (or accept the default when ``directive_set`` is
|
|
11
|
+
already pinned), and return ``SUCCESS``. The hard safety floor lives at
|
|
12
|
+
the ``implement`` slot (``apply.py``); the audit-bypass decision is
|
|
13
|
+
re-validated there against the actual edit surface, not the prompt.
|
|
14
|
+
"""
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from ...delivery_state import DeliveryState, Outcome, StepResult
|
|
18
|
+
|
|
19
|
+
EXPECTED_INTENT: str = "ui-trivial"
|
|
20
|
+
"""Intent label that gates entry into this directive set."""
|
|
21
|
+
|
|
22
|
+
AMBIGUITIES: tuple[dict[str, str], ...] = (
|
|
23
|
+
{
|
|
24
|
+
"code": "wrong_intent_for_trivial",
|
|
25
|
+
"trigger": (
|
|
26
|
+
"state.ticket['intent'] is set and not equal to 'ui-trivial' "
|
|
27
|
+
"— routing landed on this set by mistake"
|
|
28
|
+
),
|
|
29
|
+
"resolution": (
|
|
30
|
+
"abort and re-run with the correct directive_set "
|
|
31
|
+
"(populate_routing should select 'ui' or 'backend' instead)"
|
|
32
|
+
),
|
|
33
|
+
},
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def run(state: DeliveryState) -> StepResult:
|
|
38
|
+
"""Confirm the ticket's intent matches the trivial path.
|
|
39
|
+
|
|
40
|
+
The ticket's ``intent`` is optional on v0 callers; absence is
|
|
41
|
+
treated as a silent pass since the v0 path predates intent
|
|
42
|
+
classification. v1 callers always carry an intent — a mismatch
|
|
43
|
+
means the dispatcher routed incorrectly and we halt loudly so
|
|
44
|
+
the wiring bug surfaces before any edit happens.
|
|
45
|
+
"""
|
|
46
|
+
intent = (state.ticket or {}).get("intent")
|
|
47
|
+
if intent is None or intent == EXPECTED_INTENT:
|
|
48
|
+
return StepResult(outcome=Outcome.SUCCESS)
|
|
49
|
+
|
|
50
|
+
return StepResult(
|
|
51
|
+
outcome=Outcome.BLOCKED,
|
|
52
|
+
questions=[
|
|
53
|
+
"> Routing error \u2014 the ``ui-trivial`` directive set was "
|
|
54
|
+
f"selected but the ticket's intent is `{intent}`.",
|
|
55
|
+
"> 1. Reclassify \u2014 set `state.directive_set` from the "
|
|
56
|
+
"intent label and re-invoke the engine",
|
|
57
|
+
"> 2. Abort \u2014 drop this run",
|
|
58
|
+
],
|
|
59
|
+
message=(
|
|
60
|
+
f"intent={intent!r} but directive_set='ui-trivial'; "
|
|
61
|
+
"routing must be reclassified before any edit"
|
|
62
|
+
),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
__all__ = ["AMBIGUITIES", "EXPECTED_INTENT", "run"]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""``report`` step — one-line delivery summary for the trivial path.
|
|
2
|
+
|
|
3
|
+
Phase 2 Step 6 of ``agents/roadmaps/road-to-product-ui-track.md``:
|
|
4
|
+
"Trivial path emits a one-line delivery summary, not the full report."
|
|
5
|
+
|
|
6
|
+
Rationale: the full backend report has nine sections — overkill for a
|
|
7
|
+
single-file, ≤5-line edit. The trivial summary captures what the
|
|
8
|
+
operator needs to see: which file, how many lines, what the edit did,
|
|
9
|
+
and the smoke verdict. Anything richer means the work was not
|
|
10
|
+
trivial, in which case ``apply`` should have reclassified to
|
|
11
|
+
``ui-improve`` and run the full UI track instead.
|
|
12
|
+
|
|
13
|
+
The step is pure and deterministic: reads :class:`DeliveryState`,
|
|
14
|
+
writes ``state.report``, always returns ``SUCCESS``.
|
|
15
|
+
"""
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
from ...delivery_state import DeliveryState, Outcome, StepResult
|
|
21
|
+
|
|
22
|
+
AMBIGUITIES: tuple[dict[str, str], ...] = ()
|
|
23
|
+
"""Pure render \u2014 no blocked paths."""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def run(state: DeliveryState) -> StepResult:
|
|
27
|
+
"""Render the one-line trivial summary into ``state.report``."""
|
|
28
|
+
state.report = _render(state)
|
|
29
|
+
return StepResult(outcome=Outcome.SUCCESS)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _render(state: DeliveryState) -> str:
|
|
33
|
+
change = _last_trivial_change(state)
|
|
34
|
+
if change is None:
|
|
35
|
+
return "_(trivial UI edit \u2014 no change recorded)_"
|
|
36
|
+
|
|
37
|
+
files = change.get("files") or []
|
|
38
|
+
lines = change.get("lines_changed", 0)
|
|
39
|
+
summary = (change.get("summary") or "trivial UI edit").strip()
|
|
40
|
+
file_str = files[0] if len(files) == 1 else f"{len(files)} files"
|
|
41
|
+
verdict = _smoke_verdict(state)
|
|
42
|
+
verdict_str = f" \u2014 smoke: **{verdict}**" if verdict else ""
|
|
43
|
+
return f"**Trivial edit:** {summary} (`{file_str}`, {lines} lines){verdict_str}"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _last_trivial_change(state: DeliveryState) -> dict[str, Any] | None:
|
|
47
|
+
for change in reversed(state.changes or []):
|
|
48
|
+
if isinstance(change, dict) and change.get("kind") == "ui-trivial":
|
|
49
|
+
return change
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _smoke_verdict(state: DeliveryState) -> str:
|
|
54
|
+
tests = state.tests
|
|
55
|
+
if isinstance(tests, dict):
|
|
56
|
+
verdict = tests.get("verdict")
|
|
57
|
+
if isinstance(verdict, str):
|
|
58
|
+
return verdict
|
|
59
|
+
return ""
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
__all__ = ["AMBIGUITIES", "run"]
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"""``test`` step — smoke-test delegate for the ``ui-trivial`` set.
|
|
2
|
+
|
|
3
|
+
Phase 2 Step 6 of ``agents/roadmaps/road-to-product-ui-track.md``:
|
|
4
|
+
the trivial path runs "apply + smoke-test only". Smoke scope means
|
|
5
|
+
the agent runs the narrowest test layer that proves the edit didn't
|
|
6
|
+
visibly break the touched surface — render-test for a Blade partial,
|
|
7
|
+
unit-test for the touched component, or a single-file pytest scope —
|
|
8
|
+
not the full project suite.
|
|
9
|
+
|
|
10
|
+
The handler is the smaller cousin of
|
|
11
|
+
:mod:`work_engine.directives.backend.test`: same verdict contract on
|
|
12
|
+
``state.tests``, narrower scope on the agent directive. ``failed`` /
|
|
13
|
+
``mixed`` verdicts halt with the verdict echoed back; ``success``
|
|
14
|
+
flows through.
|
|
15
|
+
"""
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
from ...delivery_state import (
|
|
21
|
+
DeliveryState,
|
|
22
|
+
Outcome,
|
|
23
|
+
StepResult,
|
|
24
|
+
agent_directive,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
_ALLOWED_VERDICTS: tuple[str, ...] = ("success", "failed", "mixed")
|
|
28
|
+
|
|
29
|
+
AMBIGUITIES: tuple[dict[str, str], ...] = (
|
|
30
|
+
{
|
|
31
|
+
"code": "empty_tests_delegate",
|
|
32
|
+
"trigger": "`state.tests` empty \u2014 smoke runner not invoked yet",
|
|
33
|
+
"resolution": (
|
|
34
|
+
"agent directive `run-tests scope=smoke` \u2192 "
|
|
35
|
+
"`/tests-execute` (narrowest layer covering the touched file)"
|
|
36
|
+
),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"code": "malformed_tests",
|
|
40
|
+
"trigger": (
|
|
41
|
+
"`state.tests` is not a dict or `verdict` is not one of "
|
|
42
|
+
"success / failed / mixed"
|
|
43
|
+
),
|
|
44
|
+
"resolution": "re-run smoke and record a clean verdict",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"code": "bad_test_verdict",
|
|
48
|
+
"trigger": "`state.tests['verdict']` is `failed` or `mixed`",
|
|
49
|
+
"resolution": "fix the regression and re-run, or abort",
|
|
50
|
+
},
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def run(state: DeliveryState) -> StepResult:
|
|
55
|
+
"""Gate the smoke verdict; delegate when ``state.tests`` is empty."""
|
|
56
|
+
tests = state.tests
|
|
57
|
+
if not tests:
|
|
58
|
+
return _delegate()
|
|
59
|
+
|
|
60
|
+
if not isinstance(tests, dict):
|
|
61
|
+
return _malformed(f"state.tests is {type(tests).__name__}, expected dict")
|
|
62
|
+
|
|
63
|
+
verdict = tests.get("verdict")
|
|
64
|
+
if verdict not in _ALLOWED_VERDICTS:
|
|
65
|
+
return _malformed(
|
|
66
|
+
f"state.tests['verdict']={verdict!r} not in {_ALLOWED_VERDICTS}",
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
if verdict == "success":
|
|
70
|
+
return StepResult(outcome=Outcome.SUCCESS)
|
|
71
|
+
|
|
72
|
+
return StepResult(
|
|
73
|
+
outcome=Outcome.BLOCKED,
|
|
74
|
+
questions=[
|
|
75
|
+
f"> Smoke test verdict: **{verdict}** \u2014 trivial edit may "
|
|
76
|
+
"have regressed the touched surface.",
|
|
77
|
+
"> 1. Investigate \u2014 read failures, fix, re-run smoke",
|
|
78
|
+
"> 2. Reclassify \u2014 promote to `ui-improve` if the regression "
|
|
79
|
+
"indicates the edit was less trivial than assumed",
|
|
80
|
+
"> 3. Abort \u2014 revert the edit",
|
|
81
|
+
],
|
|
82
|
+
message=f"smoke verdict={verdict} on trivial edit",
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _delegate() -> StepResult:
|
|
87
|
+
return StepResult(
|
|
88
|
+
outcome=Outcome.BLOCKED,
|
|
89
|
+
questions=[
|
|
90
|
+
agent_directive("run-tests", scope="smoke"),
|
|
91
|
+
"> Trivial edit applied; run the smoke test layer covering "
|
|
92
|
+
"the touched file.",
|
|
93
|
+
"> 1. Continue \u2014 invoke `/tests-execute` with smoke scope, "
|
|
94
|
+
"then write the verdict back to `state.tests`",
|
|
95
|
+
"> 2. Skip \u2014 record `state.tests = {\"verdict\": \"success\", "
|
|
96
|
+
"\"scope\": \"none\"}` (logged as a deferred verification)",
|
|
97
|
+
"> 3. Abort \u2014 drop this run",
|
|
98
|
+
],
|
|
99
|
+
message="smoke run not yet invoked",
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def _malformed(detail: str) -> StepResult:
|
|
104
|
+
return StepResult(
|
|
105
|
+
outcome=Outcome.BLOCKED,
|
|
106
|
+
questions=[
|
|
107
|
+
f"> Malformed test envelope: {detail}.",
|
|
108
|
+
"> 1. Re-run smoke \u2014 produce a clean verdict",
|
|
109
|
+
"> 2. Abort \u2014 drop this run",
|
|
110
|
+
],
|
|
111
|
+
message=detail,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
__all__ = ["AMBIGUITIES", "run"]
|