fito-tui 0.6.0 → 0.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fito-tui",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Fito for pi: case-based practice for software engineers, in your terminal.",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -333,7 +333,7 @@ criteria:
333
333
  achieved: "<score 2 — met; this rung defines the award>"
334
334
  exemplary: "<score 3 — met well, at the same depth>"
335
335
  evaluation_method:
336
- type: automated # automated | ai | human | hybrid
336
+ type: automated # automated | ai
337
337
  command: "<a real gate command on reuse runs>"
338
338
  ```
339
339
 
@@ -92,8 +92,8 @@ unless marked optional:
92
92
  post-source re-generate.
93
93
  - `quiz.yaml` (optional) — only when the proposal has quiz items: give each
94
94
  question an `id`; `multiple_choice` gets `choices` and a single `answer`
95
- choice id; `short_answer`/`code_snippet` get an `evaluation` (`ai` or
96
- `human`).
95
+ choice id; `short_answer`/`code_snippet` get an `evaluation` with method
96
+ `ai`.
97
97
  - `situation/situation.yaml` + `situation/01_intro.md` — the narrative the
98
98
  learner lands in, authored from the proposal's Scope; add further documents
99
99
  (ticket, email, log output…) when the scope calls for them, each listed in
@@ -16,9 +16,9 @@ import { z } from "zod";
16
16
  * `.case/` files on disk and feeds the parsed content here.
17
17
  */
18
18
  /** Stamped into every attestation; bump when the validator implementation changes. */
19
- export const VALIDATOR_VERSION = "0.1.8";
19
+ export const VALIDATOR_VERSION = "0.1.9";
20
20
  /** Stamped into every attestation; bump when the ruleset (the rules below) changes (ADR-005 §4). */
21
- export const RULESET_VERSION = "1.8.0";
21
+ export const RULESET_VERSION = "1.9.0";
22
22
  // ── Shared building blocks ────────────────────────────────────────────────────
23
23
  /**
24
24
  * 3-level Fito Bloom taxonomy (SPEC deviation #4) — used in rubric/learning_objectives/prerequisites/quiz.
@@ -147,18 +147,14 @@ export const prerequisitesSchema = z.object({
147
147
  mandatory: z.boolean(),
148
148
  })),
149
149
  });
150
- /** `rubric.yaml` evaluation methods (automated/ai/human/hybrid). */
150
+ /**
151
+ * `rubric.yaml` evaluation methods: `automated` and `ai`. `human` and `hybrid` left at ruleset 1.9.0
152
+ * (Task 17.24): no one can score a `human` criterion yet, and a `hybrid` one can fall through to
153
+ * `human`. The evaluator still names all four (`skills/fito-evaluator/rubric.ts`).
154
+ */
151
155
  export const evaluationMethodSchema = z.discriminatedUnion("type", [
152
156
  z.object({ type: z.literal("automated"), command: z.string().min(1), passing_condition: z.string().min(1) }),
153
157
  z.object({ type: z.literal("ai"), prompt_hint: z.string().min(1) }),
154
- z.object({ type: z.literal("human"), guidance: z.string().optional() }),
155
- z.object({
156
- type: z.literal("hybrid"),
157
- automated: z.object({ command: z.string().min(1), passing_condition: z.string().min(1) }),
158
- on_pass: z.string().min(1),
159
- on_fail: z.enum(["ai", "human"]),
160
- fallback_prompt_hint: z.string().optional(),
161
- }),
162
158
  ]);
163
159
  export const rubricLevelSchema = z.object({
164
160
  score: z.number().int(),
@@ -284,9 +280,8 @@ export const quizSchema = z
284
280
  answer: z
285
281
  .string("a multiple_choice answer must be a single choice id; multiple answers are not supported for MVP")
286
282
  .optional(),
287
- evaluation: z
288
- .object({ method: z.enum(["ai", "human"]), prompt_hint: z.string().optional() })
289
- .optional(),
283
+ // `human` left at ruleset 1.9.0, as it did from the rubric (Task 17.24).
284
+ evaluation: z.object({ method: z.enum(["ai"]), prompt_hint: z.string().optional() }).optional(),
290
285
  }))
291
286
  .min(1),
292
287
  })
@@ -322,7 +317,7 @@ export const quizSchema = z
322
317
  ctx.addIssue({
323
318
  code: "custom",
324
319
  path: ["questions", i, "evaluation"],
325
- message: `${question.type} question "${question.id}" must define an evaluation (ai or human)`,
320
+ message: `${question.type} question "${question.id}" must define an evaluation (ai)`,
326
321
  });
327
322
  }
328
323
  });
@@ -573,8 +568,8 @@ function discriminatorKey(branches) {
573
568
  }
574
569
  /**
575
570
  * The union branch the value actually uses, labelled by its discriminator value (rule B) —
576
- * never by array index, which would label a report `evaluation_method.<3>` instead of
577
- * `evaluation_method(hybrid)`. A union with no discriminator (a plain `z.union`, rendered as
571
+ * never by array index, which would label a report `evaluation_method.<1>` instead of
572
+ * `evaluation_method(ai)`. A union with no discriminator (a plain `z.union`, rendered as
578
573
  * `anyOf`) has no branch label to give and is skipped.
579
574
  */
580
575
  function matchingBranch(branches, value) {
@@ -640,10 +635,10 @@ function collectOptionalPaths(node, value, prefix, empty, filled) {
640
635
  * **An array's verdict is every-empty minus any-filled, not a per-element intersection.** A
641
636
  * field is used the moment one element fills it — three deliverables and one `path` between
642
637
  * them is a case that uses `path`. But intersecting the elements' *empty* sets would also
643
- * silence a field the other elements cannot possibly fill: under rule B an `ai` rubric
644
- * criterion reports nothing about `evaluation_method(hybrid).fallback_prompt_hint`, and
645
- * treating that silence as agreement hid the one `hybrid` criterion's empty field entirely
646
- * (caught by the Task 11.10 mutation sweep). Subtracting the filled paths asks only the
638
+ * silence a field the other elements cannot possibly fill: under rule B an element on one union
639
+ * branch reports nothing about another branch's field, and treating that silence as agreement
640
+ * once hid a `hybrid` criterion's empty `fallback_prompt_hint` entirely (caught by the Task 11.10
641
+ * mutation sweep, before Task 17.24 removed `hybrid`). Subtracting the filled paths asks only the
647
642
  * elements the field actually reaches.
648
643
  */
649
644
  export function unusedOptionalPaths(schema, value) {
@@ -18,9 +18,9 @@ import { z } from "zod";
18
18
  */
19
19
 
20
20
  /** Stamped into every attestation; bump when the validator implementation changes. */
21
- export const VALIDATOR_VERSION = "0.1.8";
21
+ export const VALIDATOR_VERSION = "0.1.9";
22
22
  /** Stamped into every attestation; bump when the ruleset (the rules below) changes (ADR-005 §4). */
23
- export const RULESET_VERSION = "1.8.0";
23
+ export const RULESET_VERSION = "1.9.0";
24
24
 
25
25
  // ── Shared building blocks ────────────────────────────────────────────────────
26
26
 
@@ -175,18 +175,14 @@ export const prerequisitesSchema = z.object({
175
175
  ),
176
176
  });
177
177
 
178
- /** `rubric.yaml` evaluation methods (automated/ai/human/hybrid). */
178
+ /**
179
+ * `rubric.yaml` evaluation methods: `automated` and `ai`. `human` and `hybrid` left at ruleset 1.9.0
180
+ * (Task 17.24): no one can score a `human` criterion yet, and a `hybrid` one can fall through to
181
+ * `human`. The evaluator still names all four (`skills/fito-evaluator/rubric.ts`).
182
+ */
179
183
  export const evaluationMethodSchema = z.discriminatedUnion("type", [
180
184
  z.object({ type: z.literal("automated"), command: z.string().min(1), passing_condition: z.string().min(1) }),
181
185
  z.object({ type: z.literal("ai"), prompt_hint: z.string().min(1) }),
182
- z.object({ type: z.literal("human"), guidance: z.string().optional() }),
183
- z.object({
184
- type: z.literal("hybrid"),
185
- automated: z.object({ command: z.string().min(1), passing_condition: z.string().min(1) }),
186
- on_pass: z.string().min(1),
187
- on_fail: z.enum(["ai", "human"]),
188
- fallback_prompt_hint: z.string().optional(),
189
- }),
190
186
  ]);
191
187
 
192
188
  export const rubricLevelSchema = z.object({
@@ -324,9 +320,8 @@ export const quizSchema = z
324
320
  answer: z
325
321
  .string("a multiple_choice answer must be a single choice id; multiple answers are not supported for MVP")
326
322
  .optional(),
327
- evaluation: z
328
- .object({ method: z.enum(["ai", "human"]), prompt_hint: z.string().optional() })
329
- .optional(),
323
+ // `human` left at ruleset 1.9.0, as it did from the rubric (Task 17.24).
324
+ evaluation: z.object({ method: z.enum(["ai"]), prompt_hint: z.string().optional() }).optional(),
330
325
  }),
331
326
  )
332
327
  .min(1),
@@ -361,7 +356,7 @@ export const quizSchema = z
361
356
  ctx.addIssue({
362
357
  code: "custom",
363
358
  path: ["questions", i, "evaluation"],
364
- message: `${question.type} question "${question.id}" must define an evaluation (ai or human)`,
359
+ message: `${question.type} question "${question.id}" must define an evaluation (ai)`,
365
360
  });
366
361
  }
367
362
  });
@@ -724,8 +719,8 @@ function discriminatorKey(branches: JsonSchemaNode[]): string | undefined {
724
719
 
725
720
  /**
726
721
  * The union branch the value actually uses, labelled by its discriminator value (rule B) —
727
- * never by array index, which would label a report `evaluation_method.<3>` instead of
728
- * `evaluation_method(hybrid)`. A union with no discriminator (a plain `z.union`, rendered as
722
+ * never by array index, which would label a report `evaluation_method.<1>` instead of
723
+ * `evaluation_method(ai)`. A union with no discriminator (a plain `z.union`, rendered as
729
724
  * `anyOf`) has no branch label to give and is skipped.
730
725
  */
731
726
  function matchingBranch(
@@ -798,10 +793,10 @@ function collectOptionalPaths(
798
793
  * **An array's verdict is every-empty minus any-filled, not a per-element intersection.** A
799
794
  * field is used the moment one element fills it — three deliverables and one `path` between
800
795
  * them is a case that uses `path`. But intersecting the elements' *empty* sets would also
801
- * silence a field the other elements cannot possibly fill: under rule B an `ai` rubric
802
- * criterion reports nothing about `evaluation_method(hybrid).fallback_prompt_hint`, and
803
- * treating that silence as agreement hid the one `hybrid` criterion's empty field entirely
804
- * (caught by the Task 11.10 mutation sweep). Subtracting the filled paths asks only the
796
+ * silence a field the other elements cannot possibly fill: under rule B an element on one union
797
+ * branch reports nothing about another branch's field, and treating that silence as agreement
798
+ * once hid a `hybrid` criterion's empty `fallback_prompt_hint` entirely (caught by the Task 11.10
799
+ * mutation sweep, before Task 17.24 removed `hybrid`). Subtracting the filled paths asks only the
805
800
  * elements the field actually reaches.
806
801
  */
807
802
  export function unusedOptionalPaths(schema: z.ZodType, value: unknown): string[] {
@@ -16,8 +16,33 @@ import { rubricSchema } from "../../shared/case-validation/case-schema.ts";
16
16
  * canonical `.case/` reader + `rubricSchema` from `shared/case-validation/` rather than re-parsing YAML.
17
17
  */
18
18
 
19
+ /** A rubric as the validator accepts it: `automated` and `ai` criteria only, since ruleset 1.9.0. */
19
20
  export type Rubric = z.infer<typeof rubricSchema>;
20
21
 
22
+ type ValidatedCriterion = Rubric["criteria"][number];
23
+
24
+ /**
25
+ * A rubric as the evaluator reads it, where a criterion may also be `human` or `hybrid`. The
26
+ * validator rejects both since Task 17.24, so {@link loadRubric} never returns one; the evaluator
27
+ * keeps their handling for when a person can score a criterion.
28
+ */
29
+ export type EvaluatorRubric = {
30
+ criteria: Array<
31
+ Omit<ValidatedCriterion, "evaluation_method"> & {
32
+ evaluation_method:
33
+ | ValidatedCriterion["evaluation_method"]
34
+ | { type: "human"; guidance?: string }
35
+ | {
36
+ type: "hybrid";
37
+ automated: { command: string; passing_condition: string };
38
+ on_pass: string;
39
+ on_fail: "ai" | "human";
40
+ fallback_prompt_hint?: string;
41
+ };
42
+ }
43
+ >;
44
+ };
45
+
21
46
  export interface RubricLevel {
22
47
  score: number;
23
48
  label: string;
@@ -39,7 +64,7 @@ export interface AutomatedCriterion {
39
64
  }
40
65
 
41
66
  /** Keep only the `automated` criteria, flattened to {@link AutomatedCriterion}; preserves rubric order. */
42
- export function selectAutomatedCriteria(rubric: Rubric): AutomatedCriterion[] {
67
+ export function selectAutomatedCriteria(rubric: EvaluatorRubric): AutomatedCriterion[] {
43
68
  const automated: AutomatedCriterion[] = [];
44
69
  for (const criterion of rubric.criteria) {
45
70
  if (criterion.evaluation_method.type !== "automated") continue;
@@ -69,7 +94,7 @@ export interface AICriterion {
69
94
  }
70
95
 
71
96
  /** Keep only the `ai` criteria, flattened to {@link AICriterion}; preserves rubric order. */
72
- export function selectAICriteria(rubric: Rubric): AICriterion[] {
97
+ export function selectAICriteria(rubric: EvaluatorRubric): AICriterion[] {
73
98
  const ai: AICriterion[] = [];
74
99
  for (const criterion of rubric.criteria) {
75
100
  if (criterion.evaluation_method.type !== "ai") continue;
@@ -106,7 +131,7 @@ export interface HybridCriterion {
106
131
  }
107
132
 
108
133
  /** Keep only the `hybrid` criteria, flattened to {@link HybridCriterion}; preserves rubric order. */
109
- export function selectHybridCriteria(rubric: Rubric): HybridCriterion[] {
134
+ export function selectHybridCriteria(rubric: EvaluatorRubric): HybridCriterion[] {
110
135
  const hybrid: HybridCriterion[] = [];
111
136
  for (const criterion of rubric.criteria) {
112
137
  const method = criterion.evaluation_method;
@@ -138,7 +163,7 @@ export interface SkippedCriterion {
138
163
  }
139
164
 
140
165
  /** The `human`-only criteria, so the preview can tell the learner which criteria need manual review. */
141
- export function selectSkippedCriteria(rubric: Rubric): SkippedCriterion[] {
166
+ export function selectSkippedCriteria(rubric: EvaluatorRubric): SkippedCriterion[] {
142
167
  const skipped: SkippedCriterion[] = [];
143
168
  for (const criterion of rubric.criteria) {
144
169
  if (criterion.evaluation_method.type !== "human") continue;