create-agdf 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,16 +62,18 @@ For a ready `gate_approval`:
62
62
 
63
63
  1. Resolve exactly one selected run and evaluate the current gate.
64
64
  2. Confirm the required durable artefact is present and ready before presenting a question.
65
- 3. Render a separate localized Gate Transition Card immediately before any native question or exact-text fallback. It includes the deterministic human run title and `UR · PRD · SD · TP` links from the selected run. Never put the card only into the question, button description or hidden tool context.
66
- 4. Treat the operational Run Status Card as evaluation and audit input, not as the approval-time product surface. Do not paste its table, raw keys, machine statuses, evidence or diagnostic detail into the transition card.
67
- 5. Compose the transition card as one human-readable gate title with `run_id`, one ready-for-decision line, one short approval-effect block and one short next-transition block. It must answer only: where am I, what does this decision do, and what happens next.
68
- 6. Distinguish internal process steps from user decisions in natural language. For example, after `Approval: TP`, say that pre-implementation Brownfield Analysis runs next and that no further user action is required now; do not expose `next_user_gate: none` or `user_action_required: no`, and do not ask for a second approval for Brownfield Analysis.
69
- 7. Ask exactly one question that names the selected `run_id` and `current_gate`.
70
- 8. Offer options in stable order: exact `Approval: <GateName>`, localized revise and localized decline. Add explicit cancel only where supported after decline; otherwise host dismissal maps to cancel. Never preselect, skip, auto-submit or reorder an option.
71
- 9. Use the surface adapter declared in the canonical plugin definition only when it can wait for deliberate input without auto-resolution; otherwise request the same exact approval in concise text.
72
- 10. Re-run gate evaluation for the same run and expected gate after the response and immediately before persistence.
73
- 11. Reject a missing artefact, ambiguous or wrong run, wrong gate, stale expected gate, timeout/default, hook-supplied answer, agent message, technical permission outcome or plan approval.
74
- 12. Persist accepted input only through the existing control-state workflow.
65
+ 3. Build one immutable, non-authorizing presentation snapshot from the selected evaluated run and current revision identity.
66
+ 4. Compose one Approval Orientation Envelope as one immediately preceding assistant message containing two distinct blocks. Render the compact localized approval-time Run Status Card first. It contains exactly selected run, readiness status, current gate, missing exact approval, one next action and quality outlook; omit raw keys, machine statuses, evidence, diagnostics and allowed/forbidden inventories.
67
+ 5. In the same assistant message, render a separate localized Gate Transition Card second, immediately before any native question or exact-text fallback. It includes the deterministic human run title and `UR · PRD · SD · TP` links from the selected run. Never put either card only into the question, button description or hidden tool context. Do not invoke the native question tool until the complete two-card envelope is visible.
68
+ 6. Compose the transition card as one human-readable gate title with `run_id`, one ready-for-decision line, one short approval-effect block and one short next-transition block. It must answer only: where am I, what does this decision do, and what happens next. Run and gate identity may anchor both cards; do not duplicate status rows, action inventories or the native question.
69
+ 7. Distinguish internal process steps from user decisions in natural language. For example, after `Approval: TP`, say that pre-implementation Brownfield Analysis runs next and that no further user action is required now; do not expose `next_user_gate: none` or `user_action_required: no`, and do not ask for a second approval for Brownfield Analysis.
70
+ 8. Ask exactly one question that names the selected `run_id` and `current_gate`.
71
+ 9. Offer options in stable order: exact `Approval: <GateName>`, localized revise and localized decline. Add explicit cancel only where supported after decline; otherwise host dismissal maps to cancel. Never preselect, skip, auto-submit or reorder an option.
72
+ 10. Use the surface adapter declared in the canonical plugin definition only when it can wait for deliberate input without auto-resolution; otherwise request the same exact approval in concise text.
73
+ 11. Render both cards once in that single complete assistant message. If the native attempt is unavailable or not applied, continue to exact text without repeating either card.
74
+ 12. Re-run gate evaluation for the same run and expected gate after the response and immediately before persistence.
75
+ 13. Reject a missing artefact, ambiguous or wrong run, wrong gate, stale expected gate, timeout/default, hook-supplied answer, agent message, technical permission outcome or plan approval.
76
+ 14. Persist accepted input only through the existing control-state workflow.
75
77
 
76
78
  Before composing the question, resolve the configured chat locale from `.agdf/control/config.json` through `plugin/meta/agdf-interaction-locales.json`: exact complete pack, language subtag, then English fallback. German and English are initial packs, not a closed language list. Keep `Approval: <GateName>` exactly unchanged in every language, and do not mix presentation languages within one interaction. Labels and descriptions use the same resolved locale; host-owned UI chrome remains host-owned and may use a different language.
77
79
 
@@ -84,6 +86,13 @@ apply or safely return the native question on that attempt, switch immediately
84
86
  to the exact textual approval. Do not ask the user to request the buttons again
85
87
  and do not create a retry loop or simulated control.
86
88
 
89
+ State the outcome visibly: `presented`, `unavailable_before_invocation`,
90
+ `attempted_not_applied` or `unsafe_to_wait`. For every fallback, say in the
91
+ configured locale why a native control was not usable, show the exact approval
92
+ value and confirm that authority is unchanged. This transient outcome is not
93
+ approval evidence. A new explicit user request may reopen the unchanged decision
94
+ only after fresh run/gate/artefact revalidation; never retry automatically.
95
+
87
96
  Surface behavior:
88
97
 
89
98
  - Codex: invoke the native short-question/request-user-input control on the first eligible attempt when callable, ask one gate question and omit auto-resolution; if it is not rendered or applied, use exact text immediately.
@@ -184,10 +193,12 @@ Keep the result short and operational. Render the Runtime Contract's compact hum
184
193
 
185
194
  When an approval is missing, also include `Next gate after approval` and `Allowed after approval` exactly as constrained by the Runtime Contract. Keep forbidden outputs, evidence and next-skill detail in the concise surrounding text when relevant; they are not extra status-card rows.
186
195
 
187
- This operational status table is for status reporting. When the same response
188
- immediately requests a ready gate approval, replace the table in the visible
189
- approval experience with the Gate Transition Card defined above, then invoke
190
- the native question or exact-text fallback. Do not show both cards.
196
+ This complete operational status table remains the status-reporting and detail
197
+ surface. When the same response immediately requests a ready gate approval,
198
+ render its six-field compact approval-time projection first, then the Gate
199
+ Transition Card in the same immediately preceding assistant message, then
200
+ invoke exactly one native question or exact-text fallback. Both cards derive
201
+ from the same snapshot and are shown exactly once.
191
202
 
192
203
  If this skill creates or updates control artefacts, do not paste full file bodies into the chat.
193
204
  List paths, summarize the decision, name the blocker or approval needed, and keep the durable content in the files.
@@ -28,6 +28,13 @@ QA-specific `decision` is exactly `pass | revise | block`.
28
28
  `pass` is allowed only when TP coverage, Brownfield fit, solution integrity, and relevant documentation/Context Graph impact are sufficiently evidenced.
29
29
  `sot_drift` must not pass silently as a warning.
30
30
 
31
+ When post-CD+Tests review evidence exists, present the Runtime Contract's derived Quality
32
+ Readiness projection before the detailed QA report: Plan coverage, Solution integrity, Code
33
+ quality and QA decision in that order. Name `qa-gate` as the sole decision owner, show one
34
+ decisive reason and one permissible next action, and keep detailed reports as evidence links or
35
+ on-demand detail. The projection is non-authorizing and must not replace the Run Status Card,
36
+ Gate Transition Card or the durable QA report.
37
+
31
38
  ## Rules
32
39
  1. No QA pass without strong evidence.
33
40
  2. TP is the reference, not merely working code.
@@ -1,6 +1,15 @@
1
1
  const REQUIRED_GATES = ["UR", "PRD", "SD", "TP", "QA", "UAT"];
2
2
  const ARTEFACT_ORDER = ["UR", "PRD", "SD", "TP"];
3
3
  const OUTCOMES = new Set(["approve", "revise", "decline", "cancel", "no_response", "timeout", "empty", "invalid", "stale"]);
4
+ const ATTEMPT_OUTCOMES = new Set(["presented", "unavailable_before_invocation", "attempted_not_applied", "unsafe_to_wait"]);
5
+ const APPROVAL_SEQUENCE = Object.freeze(["run_status_card", "gate_transition_card", "approval_interaction"]);
6
+ const QUALITY_STATUS_RANK = { pass: 0, warn: 1, revise: 2, block: 3 };
7
+ const QUALITY_DIMENSIONS = Object.freeze([
8
+ Object.freeze({ id: "plan_coverage", owner: "task-plan-review" }),
9
+ Object.freeze({ id: "solution_integrity", owner: "clean-implementation-review" }),
10
+ Object.freeze({ id: "code_quality", owner: "code-review" }),
11
+ Object.freeze({ id: "qa_decision", owner: "qa-gate" }),
12
+ ]);
4
13
 
5
14
  function plainObject(value) {
6
15
  return value && typeof value === "object" && !Array.isArray(value);
@@ -54,7 +63,7 @@ export function validateLocaleRegistry(registry) {
54
63
  for (const [key, value] of visibleStrings(pack)) {
55
64
  if (!value.trim()) errors.push(`empty_copy:${locale}:${key}`);
56
65
  const budget = key.startsWith("gateTitles.") ? budgets.title
57
- : key.includes("Description") || key.startsWith("primary.actions.") || key.startsWith("primary.afterApproval.") || key === "primary.quality"
66
+ : key.includes("Description") || key.includes("fallbackReasons") || key.startsWith("primary.actions.") || key.startsWith("primary.afterApproval.") || key === "primary.quality"
58
67
  ? budgets.description
59
68
  : budgets.label;
60
69
  if (Number.isInteger(budget) && value.length > budget) errors.push(`length_budget:${locale}:${key}`);
@@ -111,6 +120,45 @@ export function resolveHumanRunTitle({ currentArtefactHeading, urHeading, runCon
111
120
  return [currentArtefactHeading, urHeading, objective].map(stripMarkdown).find(Boolean) || normalizedRunTitle(runId);
112
121
  }
113
122
 
123
+ function displaySafeTitle(value, fallback) {
124
+ const title = stripMarkdown(value).replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim();
125
+ return (title || fallback).slice(0, 100);
126
+ }
127
+
128
+ export function buildRunCandidates(runs) {
129
+ return [...(runs ?? [])]
130
+ .filter((run) => run?.valid && run?.meta?.lifecycle === "active" && typeof run.run_id === "string")
131
+ .map((run) => {
132
+ const currentGate = run.control_state?.current_gate || run.meta?.current_gate || "unknown";
133
+ const title = resolveHumanRunTitle({
134
+ currentArtefactHeading: run.current_artefact_heading,
135
+ urHeading: run.ur_heading,
136
+ runContent: "",
137
+ runId: run.run_id,
138
+ });
139
+ return {
140
+ run_id: run.run_id,
141
+ display_title: displaySafeTitle(title, normalizedRunTitle(run.run_id)),
142
+ current_gate: currentGate,
143
+ next_allowed_action: String(run.control_state?.next_allowed_action ?? "").trim(),
144
+ revision_id: String(run.meta?.revision_id ?? "").trim(),
145
+ };
146
+ })
147
+ .sort((left, right) => left.display_title.localeCompare(right.display_title) || left.run_id.localeCompare(right.run_id));
148
+ }
149
+
150
+ export function buildInteractionAttempt({ interactionId, runId, currentGate, surface, attemptOutcome, expectedApproval, fallbackReason = "" }) {
151
+ if (!ATTEMPT_OUTCOMES.has(attemptOutcome)) throw new Error("invalid interaction attempt outcome");
152
+ if (!String(interactionId ?? "").trim() || !String(runId ?? "").trim() || !String(currentGate ?? "").trim())
153
+ throw new Error("interaction attempt identity missing");
154
+ return Object.freeze({
155
+ interaction_id: String(interactionId), run_id: String(runId), current_gate: String(currentGate),
156
+ surface: String(surface ?? "fallback"), attempt_outcome: attemptOutcome,
157
+ expected_approval: String(expectedApproval ?? ""), fallback_reason: String(fallbackReason ?? ""),
158
+ authorizes: false,
159
+ });
160
+ }
161
+
114
162
  function safeArtefactPath(value) {
115
163
  const path = String(value ?? "").replace(/^`|`$/g, "").trim();
116
164
  if (!path || !/^[A-Za-z0-9._/-]+$/.test(path) || /^([a-z]+:|\/)/i.test(path)) return "";
@@ -163,7 +211,111 @@ export function normalizeInteractionOutcome(value, { expectedApproval, stale = f
163
211
  return "invalid";
164
212
  }
165
213
 
214
+ export function buildApprovalOrientationSnapshot({
215
+ ready = false,
216
+ statusCard,
217
+ humanPresentation,
218
+ revisionId = "",
219
+ registry,
220
+ requestedLocale,
221
+ } = {}) {
222
+ if (!ready || !plainObject(statusCard) || !plainObject(humanPresentation)) return null;
223
+ const gate = String(statusCard.current_gate ?? "").trim();
224
+ const runId = String(statusCard.run_id ?? "").trim();
225
+ const expectedApproval = `Approval: ${gate}`;
226
+ if (!REQUIRED_GATES.includes(gate) || !runId || statusCard.status !== "open" || statusCard.missing_approval !== expectedApproval) return null;
227
+
228
+ const locale = resolvePresentationLocale(registry, requestedLocale);
229
+ const pack = localePack(registry, locale);
230
+ const runTitle = String(humanPresentation.runTitle ?? "").trim() || normalizedRunTitle(runId);
231
+ const currentGateTitle = String(humanPresentation.gateTitle ?? "").trim() || gateTitle(registry, locale, gate);
232
+ const artefactRefs = Object.freeze([...(humanPresentation.artefactRefs ?? [])].map((ref) => Object.freeze({ ...ref })));
233
+ const statusFields = Object.freeze([
234
+ Object.freeze({ id: "selected_run", label: pack.statusCard.run, value: `${runTitle} · ${runId}` }),
235
+ Object.freeze({ id: "readiness_status", label: pack.statusCard.title, value: pack.interaction.ready }),
236
+ Object.freeze({ id: "current_gate", label: pack.statusCard.gate, value: `${gate} — ${currentGateTitle}` }),
237
+ Object.freeze({ id: "missing_approval", label: pack.statusCard.missing, value: expectedApproval }),
238
+ Object.freeze({ id: "next_action", label: pack.statusCard.step, value: pack.primary.actions[gate] ?? String(statusCard.next_step ?? "") }),
239
+ Object.freeze({ id: "quality_outlook", label: pack.statusCard.quality, value: pack.primary.quality }),
240
+ ]);
241
+ const options = Object.freeze(gateOptions(registry, locale, gate).map((option) => Object.freeze({ ...option })));
242
+
243
+ return Object.freeze({
244
+ schema_version: "1",
245
+ run_id: runId,
246
+ revision_id: String(revisionId ?? "").trim(),
247
+ current_gate: gate,
248
+ presentation_language: locale,
249
+ sequence: APPROVAL_SEQUENCE,
250
+ compact_status_card: Object.freeze({ title: pack.statusCard.title, fields: statusFields }),
251
+ gate_transition_card: Object.freeze({
252
+ title: `${currentGateTitle} · ${runTitle} · ${runId}`,
253
+ artefact_refs: artefactRefs,
254
+ ready: pack.interaction.ready,
255
+ approve_heading: pack.interaction.approveHeading,
256
+ exact_approval: expectedApproval,
257
+ approval_effect: pack.primary.afterApproval[gate] ?? pack.primary.actions[gate] ?? "",
258
+ next_heading: pack.interaction.nextHeading,
259
+ next_gate: String(statusCard.next_gate_after_approval ?? "none"),
260
+ }),
261
+ approval_interaction: Object.freeze({ expected_approval: expectedApproval, options, authorizes: false }),
262
+ authorizes: false,
263
+ });
264
+ }
265
+
266
+ export function attachApprovalOrientationSnapshot(statusCard, options = {}) {
267
+ if (!plainObject(statusCard)) throw new Error("approval orientation status card missing");
268
+ const snapshot = buildApprovalOrientationSnapshot({ ...options, statusCard });
269
+ Object.defineProperty(statusCard, "approvalOrientation", {
270
+ value: snapshot,
271
+ enumerable: false,
272
+ });
273
+ return snapshot;
274
+ }
275
+
276
+ function qualityStatus(value) {
277
+ const normalized = String(value ?? "").trim().toLowerCase();
278
+ return Object.hasOwn(QUALITY_STATUS_RANK, normalized) ? normalized : "unknown";
279
+ }
280
+
281
+ export function buildQualityReadiness({
282
+ planCoverage,
283
+ solutionIntegrity,
284
+ codeQuality,
285
+ qaDecision,
286
+ decisiveReason = "",
287
+ nextAction = "",
288
+ } = {}) {
289
+ const values = [planCoverage, solutionIntegrity, codeQuality, qaDecision];
290
+ const rows = QUALITY_DIMENSIONS.map((dimension, index) => Object.freeze({
291
+ ...dimension,
292
+ status: qualityStatus(values[index]),
293
+ }));
294
+ const known = rows.filter((row) => row.status !== "unknown");
295
+ if (known.length === 0) return null;
296
+ const status = rows.some((row) => row.status === "unknown")
297
+ ? "revise"
298
+ : known.reduce((current, row) =>
299
+ QUALITY_STATUS_RANK[row.status] > QUALITY_STATUS_RANK[current] ? row.status : current,
300
+ "pass");
301
+ const decisiveRow = rows.find((row) => row.status === status && status !== "pass")
302
+ ?? rows.find((row) => row.id === "qa_decision")
303
+ ?? rows[0];
304
+ return Object.freeze({
305
+ status,
306
+ rows: Object.freeze(rows),
307
+ decisive_reason: String(decisiveReason ?? "").trim(),
308
+ decisive_dimension: decisiveRow.id,
309
+ next_action: String(nextAction ?? "").trim(),
310
+ decision_owner: "qa-gate",
311
+ authorizes: false,
312
+ });
313
+ }
314
+
166
315
  export const interactionPresentationConstants = Object.freeze({
167
316
  artefactOrder: Object.freeze([...ARTEFACT_ORDER]),
168
317
  outcomes: Object.freeze([...OUTCOMES]),
318
+ attemptOutcomes: Object.freeze([...ATTEMPT_OUTCOMES]),
319
+ approvalSequence: APPROVAL_SEQUENCE,
320
+ qualityDimensions: QUALITY_DIMENSIONS,
169
321
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-agdf",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "Bootstrap AGDF repository-local plugin files, Copilot/OpenCode instructions, skills, control files and machine-readable checks.",
5
5
  "type": "module",
6
6
  "files": [