Guide
Maintaining this spec
This site is documentation of a real, implemented importer — not a design proposal. The importer is always
correct; this site can go stale. There is no build step, no generator, no templating — six plain HTML
files sharing docs.css and ../styles.css. Updating it means editing HTML by hand,
the same way every other page in coach-home already works.
Where the ground truth lives
| this site's page | real Swift source (in coach-ios) |
|---|---|
| conditions.html | CoachApp/ATC/ScriptImport.swift — makeCondition, the ConditionJSON struct's CodingKeys; resolved shape in CoachApp/Pilot/ArmedTrigger.swift — TriggerCondition/HoldCondition |
| actions.html | CoachApp/ATC/ScriptImport.swift — makeAction, the ActionJSON struct; resolved shape in ArmedTrigger.swift — TriggerAction |
| grading.html | CoachApp/ATC/ScriptImport+Grading.swift — makeGradingRules, RuleJSON; resolved shape in CoachApp/Debrief/DeclarativeGradingRule.swift. Objectives: CoachApp/ATC/ScriptImport+Objectives.swift |
| lessons-and-packs.html | CoachApp/IFREssentials/RemoteLesson.swift + RemoteLesson+Codable.swift; CoachApp/Missions/RemotePack.swift |
| example.html | CoachApp/Resources/multi-engine-essentials.mission1.json (the real file, copy-pasted verbatim) + Tests/CoachCoreTests/MultiEngineEssentialsMission1Tests.swift |
When to update this site
After any coach-ios change that touches one of the files above — most commonly, a new
condition/action/grading-rule kind added for a new mission's needs. The pattern every real addition so far
has followed (verify this still holds before relying on it — grep the actual switch statement):
- A new
case "my_new_kind":arm appears inmakeCondition/makeAction/makeGradingRules's ownswitch. - Its wire fields are added to
ConditionJSON/ActionJSON/RuleJSONwith aCodingKeysentry mapping camelCase Swift to snake_case JSON. - A matching case is added to the resolved Swift type (
TriggerCondition/TriggerAction/DeclarativeGradingRule), usually with a doc comment explaining why.
To add it here:
- Add an anchor to the page's
.kind-indexchip row near the top. - Add an
<h2 id="my_new_kind">+.kind-cardblock, following an existing one on the same page exactly — copy one, don't improvise new markup. Thekind-swiftline under the name should name the real Swift case it resolves to (grep for it to get the exact signature). - Fill the
.field-tablefrom the JSON struct's own property list and its doc comments, not from guessing — every required/optional/default distinction in this site should trace to an actualguard/?? defaultinmakeCondition/makeAction/makeGradingRules. - Write one minimal, real, valid example in a
pre.code-block— ideally lifted from an actual shipped mission/grading JSON file inCoachApp/Resources/, not invented. - If this closes a gap previously listed under a page's own "Not yet supported in JSON" section, remove it from that list.
Use kind-badge kind-badge-new on the kind name span when it's new enough that most existing
lessons don't use it yet — drop the badge once it's been in a few shipped missions and is no longer novel
(a judgment call, not a hard rule).
Verifying accuracy
Before trusting (or shipping an edit to) any page here, cross-check it against the real source directly — this site has drifted stale before (that's why this rewrite happened) and will again if it's edited from memory instead of the file:
grep -n 'case "' CoachApp/ATC/ScriptImport.swift— the complete, current list of condition and action kinds. Diff that list against this site's two.kind-indexrows.grep -n 'case "' CoachApp/ATC/ScriptImport+Grading.swift— the complete, current list of grading rule kinds.- For any one kind, read its own
case "...":arm in the relevantmake*function directly — everyguard let x = a.foo else { return fail(...) }is a required field; everya.foo ?? defaultis optional with that default. - Run the real importer against this site's own example JSON if you change one —
swift testincoach-ios(the fixture/example tests will fail loudly on a real mismatch, e.g.MultiEngineEssentialsMission1Tests.swift,ScriptImportTests.swift).
Styling conventions
Everything here rides on ../styles.css's own design tokens (--av-black,
--av-panel, --av-amber, etc. — lifted from the real app's own instrument-panel
colors) plus this folder's own docs.css for the sidebar/content layout, field tables, kind
cards, and code blocks. Don't add page-specific <style> blocks for anything that's really
a shared docs-layout concern — put it in docs.css once, reused by every page, the same way
coach-home's own marketing pages all share styles.css.
Code blocks are deliberately plain preformatted text, no syntax highlighting — anyone
editing this site later just pastes raw JSON into a <pre class="code-block"><code>
block, no manual span-wrapping to keep in sync with the content. Keep it that way; a "nicer" highlighted
code block that breaks every time someone pastes new JSON is a maintenance regression, not an improvement.
Adding a whole new page
Copy an existing page's full <head>/nav/sidebar markup verbatim (every page in this
folder repeats it — there's no templating), swap the <title>/meta description/
<h1>/content, and add the new page to every other page's sidebar (search
this folder for docs-sidebar-group and add the link to each) and to index.html's
chip grid if it's a top-level reference page. Missing even one page's sidebar link is the most common way
this site goes subtly stale — there is no shared nav partial to update in one place.
What this replaced
This folder supersedes coach-home/mission-spec.agent.md, mission-spec.html, and
mission-spec-examples/ — all now stale (missing all_of/not,
vspeed-relative thresholds, RPM/runway-proximity conditions, the retry/rearm/counter system, continuous
grading curves, objectives, and the whole RemoteLesson/RemotePack outer format).
mission-spec.html now redirects here; the .agent.md file and
mission-spec-examples/ are left in place, marked deprecated, for anything that still links to
them directly, rather than deleted outright.