@workingdevshero/olympia-ait-adapter 0.1.5 → 1.1.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/README.md +139 -35
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/reader/cell-utils.d.ts +10 -0
- package/dist/reader/cell-utils.d.ts.map +1 -0
- package/dist/reader/cell-utils.js +40 -0
- package/dist/reader/cell-utils.js.map +1 -0
- package/dist/reader/parse-day-sheet.d.ts +0 -1
- package/dist/reader/parse-day-sheet.d.ts.map +1 -1
- package/dist/reader/parse-day-sheet.js +95 -75
- package/dist/reader/parse-day-sheet.js.map +1 -1
- package/dist/reader/parse-warmup-workbook.d.ts +13 -0
- package/dist/reader/parse-warmup-workbook.d.ts.map +1 -0
- package/dist/reader/parse-warmup-workbook.js +154 -0
- package/dist/reader/parse-warmup-workbook.js.map +1 -0
- package/dist/reader/parse-workbook.d.ts +2 -2
- package/dist/reader/parse-workbook.d.ts.map +1 -1
- package/dist/reader/parse-workbook.js +1 -6
- package/dist/reader/parse-workbook.js.map +1 -1
- package/dist/schema/program.d.ts +398 -67
- package/dist/schema/program.d.ts.map +1 -1
- package/dist/schema/program.js +135 -28
- package/dist/schema/program.js.map +1 -1
- package/dist/schema/warmup.d.ts +426 -0
- package/dist/schema/warmup.d.ts.map +1 -0
- package/dist/schema/warmup.js +100 -0
- package/dist/schema/warmup.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +51 -18
- package/dist/server.js.map +1 -1
- package/dist/tools/program-json-to-xlsx.d.ts +3 -0
- package/dist/tools/program-json-to-xlsx.d.ts.map +1 -0
- package/dist/tools/program-json-to-xlsx.js +5 -0
- package/dist/tools/program-json-to-xlsx.js.map +1 -0
- package/dist/tools/program-xlsx-to-json.d.ts +3 -0
- package/dist/tools/program-xlsx-to-json.d.ts.map +1 -0
- package/dist/tools/program-xlsx-to-json.js +5 -0
- package/dist/tools/program-xlsx-to-json.js.map +1 -0
- package/dist/tools/warmup-json-to-xlsx.d.ts +3 -0
- package/dist/tools/warmup-json-to-xlsx.d.ts.map +1 -0
- package/dist/tools/warmup-json-to-xlsx.js +5 -0
- package/dist/tools/warmup-json-to-xlsx.js.map +1 -0
- package/dist/tools/warmup-xlsx-to-json.d.ts +3 -0
- package/dist/tools/warmup-xlsx-to-json.d.ts.map +1 -0
- package/dist/tools/warmup-xlsx-to-json.js +5 -0
- package/dist/tools/warmup-xlsx-to-json.js.map +1 -0
- package/dist/writer/build-warmup-workbook.d.ts +3 -0
- package/dist/writer/build-warmup-workbook.d.ts.map +1 -0
- package/dist/writer/build-warmup-workbook.js +101 -0
- package/dist/writer/build-warmup-workbook.js.map +1 -0
- package/dist/writer/build-workbook.d.ts +2 -2
- package/dist/writer/build-workbook.d.ts.map +1 -1
- package/dist/writer/build-workbook.js +19 -23
- package/dist/writer/build-workbook.js.map +1 -1
- package/dist/writer/layout.d.ts +19 -7
- package/dist/writer/layout.d.ts.map +1 -1
- package/dist/writer/layout.js +40 -21
- package/dist/writer/layout.js.map +1 -1
- package/dist/writer/stamp-exercise.d.ts +13 -5
- package/dist/writer/stamp-exercise.d.ts.map +1 -1
- package/dist/writer/stamp-exercise.js +25 -18
- package/dist/writer/stamp-exercise.js.map +1 -1
- package/dist/writer/supplemental-template.d.ts +3 -2
- package/dist/writer/supplemental-template.d.ts.map +1 -1
- package/dist/writer/supplemental-template.js +15 -15
- package/dist/writer/supplemental-template.js.map +1 -1
- package/package.json +5 -4
- package/skills/olympia-authoring/SKILL.md +140 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/schema/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/schema/program.ts"],"names":[],"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UxB,CAAC;AAEZ,eAAO,MAAM,uBAAuB;;;;;;;;;EAKzB,CAAC;AAEZ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC5E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC9E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC5E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE9E,eAAO,MAAM,kBAAkB,IAAiB,CAAC;AAEjD,wEAAwE;AACxE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAUzD"}
|
package/dist/schema/program.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
const
|
|
2
|
+
const MIN_WEEK_COUNT = 1;
|
|
3
|
+
const MAX_WEEK_COUNT = 6;
|
|
3
4
|
/**
|
|
4
|
-
* A single prescription cell for one set in one week
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* encoded by notation in the cell text:
|
|
5
|
+
* A single prescription cell for one set in one week: the "Reps" column of
|
|
6
|
+
* that week. The unit is reps, time, or breaths, encoded by notation in the
|
|
7
|
+
* cell text:
|
|
8
8
|
*
|
|
9
9
|
* "12" → 12 reps
|
|
10
10
|
* "10E" → 10 reps each side
|
|
@@ -21,11 +21,30 @@ const WEEK_COUNT = 6;
|
|
|
21
21
|
export const Cell = z
|
|
22
22
|
.string()
|
|
23
23
|
.nullable()
|
|
24
|
-
.describe('A single prescription. Common formats: "12" (12 reps), "10E" (10 reps each side), ":20" (20-sec hold), ":20E" (20-sec hold each side), ":60" (60 seconds), "5 breaths" (5 breaths). Free-form circuit instructions like "x3 Rest :60" are allowed. Use null for empty cells.
|
|
24
|
+
.describe('A single prescription. Common formats: "12" (12 reps), "10E" (10 reps each side), ":20" (20-sec hold), ":20E" (20-sec hold each side), ":60" (60 seconds), "5 breaths" (5 breaths). Free-form circuit instructions like "x3 Rest :60" are allowed. Use null for empty cells. Loads and equipment settings go in `weights`, not here.');
|
|
25
|
+
/**
|
|
26
|
+
* The "Weight" column cell beside a prescription. Coaches use it for a load
|
|
27
|
+
* ("25"), and just as often for an equipment setting: a band colour ("Yel"),
|
|
28
|
+
* a box height ('12" + 2 Pads'), a rack position ("#10"). It is free text
|
|
29
|
+
* and is never interpreted.
|
|
30
|
+
*/
|
|
31
|
+
export const WeightCell = z
|
|
32
|
+
.string()
|
|
33
|
+
.nullable()
|
|
34
|
+
.describe('The Weight-column cell for one set in one week, as free text: a load ("25"), or an equipment setting such as a band colour ("Yel"), box height (\'12" + 2 Pads\') or rack position ("#10"). Use null for an empty cell — most cells are empty, because the client writes in what they lifted.');
|
|
35
|
+
export const WeightRow = z
|
|
36
|
+
.array(WeightCell)
|
|
37
|
+
.min(MIN_WEEK_COUNT)
|
|
38
|
+
.max(MAX_WEEK_COUNT)
|
|
39
|
+
.describe("One set's Weight-column cells across every week, in week order. Same length as the set row it sits beside.");
|
|
25
40
|
export const SetRow = z
|
|
26
41
|
.array(Cell)
|
|
27
|
-
.
|
|
28
|
-
.
|
|
42
|
+
.min(MIN_WEEK_COUNT)
|
|
43
|
+
.max(MAX_WEEK_COUNT)
|
|
44
|
+
.describe("One set's prescription across every week of the program, in week order. Its length is the program's week count (1-6; Olympia programs run 4 or 6 weeks) and must be the same for every set row in the program.");
|
|
45
|
+
// All object schemas are .strict(): unknown keys are rejected, not silently
|
|
46
|
+
// stripped, so agents authoring against a stale contract (e.g. the removed
|
|
47
|
+
// weekDates field) fail loudly at the tool boundary.
|
|
29
48
|
export const Exercise = z
|
|
30
49
|
.object({
|
|
31
50
|
name: z
|
|
@@ -44,9 +63,27 @@ export const Exercise = z
|
|
|
44
63
|
sets: z
|
|
45
64
|
.array(SetRow)
|
|
46
65
|
.min(1)
|
|
47
|
-
.describe("2-D matrix of prescriptions: sets[setIdx][weekIdx]. Outer length = number of sets for this exercise (typically 3); each inner array
|
|
66
|
+
.describe("2-D matrix of prescriptions: sets[setIdx][weekIdx]. Outer length = number of sets for this exercise (typically 3); each inner array has one entry per week of the program. Set positions are coherent across weeks — sets[0] is set 1's progression across the weeks."),
|
|
67
|
+
weights: z
|
|
68
|
+
.array(WeightRow)
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Weight-column cells, same shape as `sets`: weights[setIdx][weekIdx] sits beside sets[setIdx][weekIdx]. Omit when every Weight cell is empty."),
|
|
71
|
+
})
|
|
72
|
+
.strict()
|
|
73
|
+
.superRefine((exercise, ctx) => {
|
|
74
|
+
if (!exercise.weights)
|
|
75
|
+
return;
|
|
76
|
+
const sameShape = exercise.weights.length === exercise.sets.length &&
|
|
77
|
+
exercise.weights.every((row, i) => row.length === exercise.sets[i].length);
|
|
78
|
+
if (!sameShape) {
|
|
79
|
+
ctx.addIssue({
|
|
80
|
+
code: z.ZodIssueCode.custom,
|
|
81
|
+
message: "`weights` must have the same shape as `sets`: one row per set, one cell per week.",
|
|
82
|
+
path: ["weights"],
|
|
83
|
+
});
|
|
84
|
+
}
|
|
48
85
|
})
|
|
49
|
-
.describe("One exercise in a training day, with its
|
|
86
|
+
.describe("One exercise in a training day, with its week-by-week, set-by-set prescription.");
|
|
50
87
|
export const SectionKind = z
|
|
51
88
|
.enum(["warmup", "main", "sportSpecific", "supplemental", "conditioning"])
|
|
52
89
|
.describe("Section type within a day. Olympia day-sheets are organized into ordered sections delimited by column-C labels.");
|
|
@@ -54,6 +91,22 @@ export const Section = z
|
|
|
54
91
|
.object({
|
|
55
92
|
kind: SectionKind,
|
|
56
93
|
exercises: z.array(Exercise),
|
|
94
|
+
})
|
|
95
|
+
.strict()
|
|
96
|
+
.superRefine((section, ctx) => {
|
|
97
|
+
if (section.kind !== "warmup")
|
|
98
|
+
return;
|
|
99
|
+
// An in-sheet warm-up is identified on the sheet by its "Warmup N" label
|
|
100
|
+
// row, which takes the place of any group label.
|
|
101
|
+
section.exercises.forEach((exercise, i) => {
|
|
102
|
+
if (exercise.groupLabel !== undefined) {
|
|
103
|
+
ctx.addIssue({
|
|
104
|
+
code: z.ZodIssueCode.custom,
|
|
105
|
+
message: "A warmup exercise cannot carry a groupLabel; its label row reads \"Warmup N\".",
|
|
106
|
+
path: ["exercises", i, "groupLabel"],
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
57
110
|
})
|
|
58
111
|
.describe("An ordered group of exercises within a day.");
|
|
59
112
|
export const SupplementalNote = z
|
|
@@ -66,11 +119,12 @@ export const SupplementalNote = z
|
|
|
66
119
|
col: z
|
|
67
120
|
.string()
|
|
68
121
|
.regex(/^[A-Z]+$/)
|
|
69
|
-
.describe("Column letter where the cell sits. Use one of D, F, H, J
|
|
122
|
+
.describe("Column letter where the cell sits. Use the master cell of a week's single-row merge, one per week of the program: D, F, H, J for a 4-week program, plus L, N for a 6-week one. Column C is reserved for the static template labels (\"Sport Specific/\", \"Supplemental\") that the writer adds back and must not be written to here."),
|
|
70
123
|
value: z
|
|
71
124
|
.string()
|
|
72
|
-
.describe('A complete freeform phrase as the trainer would write it — e.g. "Rower 600M x 2", "Optional Cardio / Post Stretch", "200 Yard Shuttle". The supplemental area is NOT a structured per-week grid: do not split a single instruction into a label cell plus per-week metric cells. To make a phrase span the row visually, emit the same `value` in each week-column entry
|
|
125
|
+
.describe('A complete freeform phrase as the trainer would write it — e.g. "Rower 600M x 2", "Optional Cardio / Post Stretch", "200 Yard Shuttle". The supplemental area is NOT a structured per-week grid: do not split a single instruction into a label cell plus per-week metric cells. To make a phrase span the row visually, emit the same `value` in each week-column entry of that row.'),
|
|
73
126
|
})
|
|
127
|
+
.strict()
|
|
74
128
|
.describe("One freeform cell captured from (or written to) the trainer-managed Sport Specific / Supplemental area at the bottom of a day sheet. Each note is an independent (row, col, value) write; the convention is one full phrase per row, repeated across the week-column masters.");
|
|
75
129
|
export const Day = z
|
|
76
130
|
.object({
|
|
@@ -84,6 +138,7 @@ export const Day = z
|
|
|
84
138
|
.optional()
|
|
85
139
|
.describe("Freeform notes the trainer wrote in the Sport Specific / Supplemental area at the bottom of the day. Sparse — only populated cells appear. The schema is intentionally loose because trainers use this area for athlete-specific instructions that don't fit the structured exercise table (e.g. conditioning circuits, sport-specific drills, recovery breath work)."),
|
|
86
140
|
})
|
|
141
|
+
.strict()
|
|
87
142
|
.describe("One training day = one sheet in the output workbook.");
|
|
88
143
|
export const Program = z
|
|
89
144
|
.object({
|
|
@@ -91,37 +146,89 @@ export const Program = z
|
|
|
91
146
|
programDate: z
|
|
92
147
|
.string()
|
|
93
148
|
.describe('Program identifier date as it appears in the filename, e.g. "4.26" for April 2026. Free-form to match Olympia conventions.'),
|
|
94
|
-
weekDates: z
|
|
95
|
-
.array(z.string().nullable())
|
|
96
|
-
.length(WEEK_COUNT)
|
|
97
|
-
.optional()
|
|
98
|
-
.describe('Per-week date labels (the "Date:" header row in each sheet). 6 entries, one per week, or null where empty.'),
|
|
99
149
|
days: z.array(Day).min(1),
|
|
100
150
|
})
|
|
101
|
-
.
|
|
151
|
+
.strict()
|
|
152
|
+
.superRefine((program, ctx) => {
|
|
153
|
+
const lengths = new Set();
|
|
154
|
+
for (const day of program.days) {
|
|
155
|
+
for (const section of day.sections) {
|
|
156
|
+
for (const exercise of section.exercises) {
|
|
157
|
+
for (const row of exercise.sets)
|
|
158
|
+
lengths.add(row.length);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (lengths.size > 1) {
|
|
163
|
+
ctx.addIssue({
|
|
164
|
+
code: z.ZodIssueCode.custom,
|
|
165
|
+
message: `Every set row in a program must cover the same number of weeks; found rows of length ${[...lengths].sort().join(", ")}.`,
|
|
166
|
+
path: ["days"],
|
|
167
|
+
});
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
// Supplemental notes may only sit on a week's Reps master (D, F, H, …):
|
|
171
|
+
// past the last week the column is Notes or off the grid, and the reader
|
|
172
|
+
// would not read the value back.
|
|
173
|
+
const weekCount = programWeekCount(program);
|
|
174
|
+
const masters = new Set(Array.from({ length: weekCount }, (_, i) => String.fromCharCode(68 + 2 * i)));
|
|
175
|
+
program.days.forEach((day, dayIdx) => {
|
|
176
|
+
day.supplementalNotes?.forEach((note, noteIdx) => {
|
|
177
|
+
if (!masters.has(note.col)) {
|
|
178
|
+
ctx.addIssue({
|
|
179
|
+
code: z.ZodIssueCode.custom,
|
|
180
|
+
message: `Supplemental note column ${note.col} is not a week column of this ${weekCount}-week program; use one of ${[...masters].join(", ")}.`,
|
|
181
|
+
path: ["days", dayIdx, "supplementalNotes", noteIdx, "col"],
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
})
|
|
187
|
+
.describe('A complete Olympia training program. Programs run a fixed number of weeks (4 or 6 — match the client\'s previous program); every set row has one entry per week and the sheet is laid out with that many week columns. Maps 1:1 to one client XLSX workbook. The "Date:" cells in each sheet\'s header row are intentionally left blank — clients hand-write the week dates. A program is usually accompanied by a companion warm-up workbook for the same client and date, paired day-for-day.');
|
|
102
188
|
// --- Tool input/output schemas ---
|
|
103
|
-
export const
|
|
189
|
+
export const ProgramXlsxToJsonInput = z
|
|
190
|
+
.object({
|
|
104
191
|
xlsxPath: z
|
|
105
192
|
.string()
|
|
106
193
|
.min(1)
|
|
107
|
-
.describe("Absolute path to an Olympia .xlsx file on the local filesystem."),
|
|
108
|
-
})
|
|
109
|
-
|
|
194
|
+
.describe("Absolute path to an Olympia program .xlsx file on the local filesystem."),
|
|
195
|
+
})
|
|
196
|
+
.strict();
|
|
197
|
+
export const ProgramXlsxToJsonOutput = z
|
|
198
|
+
.object({
|
|
110
199
|
program: Program,
|
|
111
200
|
warnings: z
|
|
112
201
|
.array(z.string())
|
|
113
202
|
.describe("Structural surprises encountered while parsing (e.g. unexpected section labels, exercises without group labels where one was expected). Empty if the file parsed cleanly."),
|
|
114
|
-
})
|
|
115
|
-
|
|
203
|
+
})
|
|
204
|
+
.strict();
|
|
205
|
+
export const ProgramJsonToXlsxInput = z
|
|
206
|
+
.object({
|
|
116
207
|
program: Program,
|
|
117
208
|
outputPath: z
|
|
118
209
|
.string()
|
|
119
210
|
.min(1)
|
|
120
211
|
.describe("Absolute path where the generated .xlsx file should be written. Parent directory must exist."),
|
|
121
|
-
})
|
|
122
|
-
|
|
212
|
+
})
|
|
213
|
+
.strict();
|
|
214
|
+
export const ProgramJsonToXlsxOutput = z
|
|
215
|
+
.object({
|
|
123
216
|
outputPath: z.string(),
|
|
124
217
|
bytesWritten: z.number().int().nonnegative(),
|
|
125
|
-
})
|
|
126
|
-
|
|
218
|
+
})
|
|
219
|
+
.strict();
|
|
220
|
+
export const DEFAULT_WEEK_COUNT = MAX_WEEK_COUNT;
|
|
221
|
+
/** The number of weeks a program covers: the length of its set rows. */
|
|
222
|
+
export function programWeekCount(program) {
|
|
223
|
+
for (const day of program.days) {
|
|
224
|
+
for (const section of day.sections) {
|
|
225
|
+
for (const exercise of section.exercises) {
|
|
226
|
+
const first = exercise.sets[0];
|
|
227
|
+
if (first)
|
|
228
|
+
return first.length;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return DEFAULT_WEEK_COUNT;
|
|
233
|
+
}
|
|
127
234
|
//# sourceMappingURL=program.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../src/schema/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../src/schema/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,cA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