Skip to content

Commit c3d7008

Browse files
kevinelliottclaude
andcommitted
Wire up ADS submodule, codegen, runtime path aliases (no behavioral swap yet)
Sets the foundation for the cross-language Airframes Decoder Spec (ADS) unification by integrating airframes-decoder into this repo as a git submodule, without yet replacing any hand-written plugins. Behavior is identical to master after this PR. What this PR does: - Add `vendor/airframes-decoder` as a git submodule (pinned to its init/ads-v1 branch). - Add tsconfig path aliases (`@airframes/ads-runtime-ts` and friends) resolving into the submodule's runtimes/typescript/. - Add npm scripts: npm run ads:codegen-build — build the codegen tool npm run ads:generate — emit lib/plugins/generated/*.ts from spec npm run ads:check — fail if generated tree is out-of-date - Generate the 68 plugins into lib/plugins/generated/ and commit them (avoids requiring the codegen toolchain in every contributor's env). - Exclude vendor/ and lib/plugins/generated/ from ESLint. - Exclude vendor/ from Jest test discovery. - Add .github/workflows/ads-check.yml that calls the central reusable `codegen-check.yml` workflow (single source of CI logic across repos). What this PR does NOT do (intentionally — separate Stage 2.5 PR): - Does NOT register generated plugins in MessageDecoder.ts. The current emitter double-bookkeeps `raw` fields (field assignments + formatter writes), which would diverge from existing test expectations. Resolving this needs an emitter design pass (track which raw keys the formatter owns, suppress auto-emit in those cases) before a behavioral swap is safe. - Does NOT remove the original lib/utils/*.ts helpers yet. The runtime is duplicated between this repo and the submodule until Stage 2.5 swaps imports. Verification: - All 407 existing tests pass. - `npm run ads:generate` produces 68 .ts files with no diff vs committed. - Generated files compile against `@airframes/ads-runtime-ts` path aliases (resolution verified via tsc paths). See airframesio/acars-decoder#1 for the central spec, codegen, runtimes, docs, and 288-sample corpus this submodule references. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1748860 commit c3d7008

75 files changed

Lines changed: 1942 additions & 6 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ads-check.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: ADS check
2+
3+
on:
4+
push:
5+
branches: [master, dsl/adopt-v1]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
ads-generated-up-to-date:
11+
uses: airframesio/acars-decoder/.github/workflows/codegen-check.yml@init/ads-v1
12+
with:
13+
language: ts
14+
generated-path: lib/plugins/generated
15+
spec-path: vendor/airframes-decoder/spec
16+
codegen-path: vendor/airframes-decoder/codegen

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "vendor/airframes-decoder"]
2+
path = vendor/airframes-decoder
3+
url = https://github.com/airframesio/acars-decoder.git

eslint.config.mts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import importPlugin from 'eslint-plugin-import';
66
import stylistic from '@stylistic/eslint-plugin';
77

88
export default [
9+
{
10+
// Skip the vendored submodule and the auto-generated plugins from linting.
11+
ignores: ['vendor/**', 'lib/plugins/generated/**'],
12+
},
913
{
1014
files: ['**/*.ts'],
1115

jest.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,10 @@ export default {
159159
// ],
160160

161161
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
162-
// testPathIgnorePatterns: [
163-
// "/node_modules/"
164-
// ],
162+
testPathIgnorePatterns: [
163+
"/node_modules/",
164+
"/vendor/", // skip vendored airframes-decoder submodule's tests
165+
],
165166

166167
// The regexp pattern or array of patterns that Jest uses to detect test files
167168
// testRegex: [],

lib/plugins/generated/ARINC_702.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// AUTO-GENERATED from /Users/kevin/Cloud/Dropbox/work/airframes/acars-decoder-typescript/vendor/airframes-decoder/spec/wildcards/arinc_702.yaml. Do not edit.
2+
// Plugin: ARINC_702
3+
// Docs: https://github.com/airframesio/acars-message-documentation/blob/main/research/ARINC_702.md
4+
5+
import { DecoderPlugin } from "@airframes/ads-runtime-ts";
6+
import type { DecodeResult, Message, Options } from "@airframes/ads-runtime-ts";
7+
import { ResultFormatter } from "@airframes/ads-runtime-ts";
8+
import * as helpers from "@airframes/ads-runtime-ts/helpers";
9+
import * as hatches from "../escape_hatches";
10+
11+
export class ARINC_702 extends DecoderPlugin {
12+
name = "arinc-702";
13+
14+
qualifiers() {
15+
return {
16+
labels: ["*"],
17+
};
18+
}
19+
20+
decode(message: Message, options: Options = {}): DecodeResult {
21+
const result = this.initResult(message, "ARINC 702 Message");
22+
23+
return hatches.arinc_702_dispatch(this, message, result, options);
24+
}
25+
}

lib/plugins/generated/CBand.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// AUTO-GENERATED from /Users/kevin/Cloud/Dropbox/work/airframes/acars-decoder-typescript/vendor/airframes-decoder/spec/wildcards/cband.yaml. Do not edit.
2+
// Plugin: CBand
3+
4+
import { DecoderPlugin } from "@airframes/ads-runtime-ts";
5+
import type { DecodeResult, Message, Options } from "@airframes/ads-runtime-ts";
6+
import { ResultFormatter } from "@airframes/ads-runtime-ts";
7+
import * as helpers from "@airframes/ads-runtime-ts/helpers";
8+
import * as hatches from "../escape_hatches";
9+
10+
export class CBand extends DecoderPlugin {
11+
name = "cband";
12+
13+
qualifiers() {
14+
return {
15+
labels: ["*"],
16+
};
17+
}
18+
19+
decode(message: Message, options: Options = {}): DecodeResult {
20+
const result = this.initResult(message, "C-Band Message");
21+
22+
return hatches.cband_dispatch(this, message, result, options);
23+
}
24+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// AUTO-GENERATED from /Users/kevin/Cloud/Dropbox/work/airframes/acars-decoder-typescript/vendor/airframes-decoder/spec/labels/10/LDR.yaml. Do not edit.
2+
// Plugin: Label_10_LDR
3+
4+
import { DecoderPlugin } from "@airframes/ads-runtime-ts";
5+
import type { DecodeResult, Message, Options } from "@airframes/ads-runtime-ts";
6+
import { ResultFormatter } from "@airframes/ads-runtime-ts";
7+
import * as helpers from "@airframes/ads-runtime-ts/helpers";
8+
import * as hatches from "../escape_hatches";
9+
10+
export class Label_10_LDR extends DecoderPlugin {
11+
name = "label-10-ldr";
12+
13+
qualifiers() {
14+
return {
15+
labels: ["10"],
16+
preambles: ["LDR"],
17+
};
18+
}
19+
20+
decode(message: Message, options: Options = {}): DecodeResult {
21+
const result = this.initResult(message, "Position Report");
22+
23+
return hatches.label_10_ldr_decode(this, message, result, options);
24+
}
25+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// AUTO-GENERATED from /Users/kevin/Cloud/Dropbox/work/airframes/acars-decoder-typescript/vendor/airframes-decoder/spec/labels/10/POS.yaml. Do not edit.
2+
// Plugin: Label_10_POS
3+
// Docs: https://github.com/airframesio/acars-message-documentation/blob/main/research/10/POS.md
4+
5+
import { DecoderPlugin } from "@airframes/ads-runtime-ts";
6+
import type { DecodeResult, Message, Options } from "@airframes/ads-runtime-ts";
7+
import { ResultFormatter } from "@airframes/ads-runtime-ts";
8+
import * as helpers from "@airframes/ads-runtime-ts/helpers";
9+
import * as hatches from "../escape_hatches";
10+
11+
export class Label_10_POS extends DecoderPlugin {
12+
name = "label-10-pos";
13+
14+
qualifiers() {
15+
return {
16+
labels: ["10"],
17+
preambles: ["POS"],
18+
};
19+
}
20+
21+
decode(message: Message, options: Options = {}): DecodeResult {
22+
const result = this.initResult(message, "Position Report");
23+
24+
const parts = message.text.split(",");
25+
if (parts.length !== 12) {
26+
return this.failUnknown(result, message.text, options);
27+
}
28+
const latitude = helpers.coordinate(parts[1], {"style":"single_axis","axis":"latitude","prefix_chars":["N","S"],"digits":5,"divisor":100});
29+
result.raw.latitude = latitude;
30+
const longitude = helpers.coordinate(parts[2], {"style":"single_axis","axis":"longitude","prefix_chars":["E","W"],"digits":5,"divisor":100});
31+
result.raw.longitude = longitude;
32+
const altitude = helpers.integer(parts[7]);
33+
result.raw.altitude = altitude;
34+
ResultFormatter.position(result, { latitude: latitude, longitude: longitude });
35+
ResultFormatter.altitude(result, altitude);
36+
ResultFormatter.unknownArr(result, [parts[0], parts[3], parts[4], parts[5], parts[6], parts[8], parts[9], parts[10], parts[11]]);
37+
this.setDecodeLevel(result, true, 'partial');
38+
return result;
39+
}
40+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// AUTO-GENERATED from /Users/kevin/Cloud/Dropbox/work/airframes/acars-decoder-typescript/vendor/airframes-decoder/spec/labels/10/Slash.yaml. Do not edit.
2+
// Plugin: Label_10_Slash
3+
4+
import { DecoderPlugin } from "@airframes/ads-runtime-ts";
5+
import type { DecodeResult, Message, Options } from "@airframes/ads-runtime-ts";
6+
import { ResultFormatter } from "@airframes/ads-runtime-ts";
7+
import * as helpers from "@airframes/ads-runtime-ts/helpers";
8+
import * as hatches from "../escape_hatches";
9+
10+
export class Label_10_Slash extends DecoderPlugin {
11+
name = "label-10-slash";
12+
13+
qualifiers() {
14+
return {
15+
labels: ["10"],
16+
preambles: ["/"],
17+
};
18+
}
19+
20+
decode(message: Message, options: Options = {}): DecodeResult {
21+
const result = this.initResult(message, "Position Report");
22+
23+
return hatches.label_10_slash_decode(this, message, result, options);
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// AUTO-GENERATED from /Users/kevin/Cloud/Dropbox/work/airframes/acars-decoder-typescript/vendor/airframes-decoder/spec/labels/12/N_Space.yaml. Do not edit.
2+
// Plugin: Label_12_N_Space
3+
4+
import { DecoderPlugin } from "@airframes/ads-runtime-ts";
5+
import type { DecodeResult, Message, Options } from "@airframes/ads-runtime-ts";
6+
import { ResultFormatter } from "@airframes/ads-runtime-ts";
7+
import * as helpers from "@airframes/ads-runtime-ts/helpers";
8+
import * as hatches from "../escape_hatches";
9+
10+
export class Label_12_N_Space extends DecoderPlugin {
11+
name = "label-12-n-space";
12+
13+
qualifiers() {
14+
return {
15+
labels: ["12"],
16+
preambles: ["N ","S "],
17+
};
18+
}
19+
20+
decode(message: Message, options: Options = {}): DecodeResult {
21+
const result = this.initResult(message, "Position Report");
22+
23+
return hatches.label_12_n_space_decode(this, message, result, options);
24+
}
25+
}

0 commit comments

Comments
 (0)