driverge-mcp 0.0.0 → 0.0.1

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.
Files changed (81) hide show
  1. package/README.md +275 -29
  2. package/dist/codegen/esp32.d.ts +11 -3
  3. package/dist/codegen/esp32.js +221 -10
  4. package/dist/codegen/esp32.js.map +1 -1
  5. package/dist/codegen/ident.d.ts +24 -2
  6. package/dist/codegen/ident.js +37 -4
  7. package/dist/codegen/ident.js.map +1 -1
  8. package/dist/codegen/index.d.ts +12 -7
  9. package/dist/codegen/index.js +17 -14
  10. package/dist/codegen/index.js.map +1 -1
  11. package/dist/codegen/lint.js +28 -8
  12. package/dist/codegen/lint.js.map +1 -1
  13. package/dist/codegen/portable-cpp.d.ts +8 -0
  14. package/dist/codegen/portable-cpp.js +281 -0
  15. package/dist/codegen/portable-cpp.js.map +1 -0
  16. package/dist/codegen/portable.d.ts +99 -3
  17. package/dist/codegen/portable.js +419 -99
  18. package/dist/codegen/portable.js.map +1 -1
  19. package/dist/codegen/stm32.d.ts +11 -3
  20. package/dist/codegen/stm32.js +156 -11
  21. package/dist/codegen/stm32.js.map +1 -1
  22. package/dist/codegen/types.d.ts +32 -0
  23. package/dist/codegen/types.js +27 -0
  24. package/dist/codegen/types.js.map +1 -1
  25. package/dist/mcp/cache.d.ts +15 -2
  26. package/dist/mcp/cache.js +32 -4
  27. package/dist/mcp/cache.js.map +1 -1
  28. package/dist/mcp/register.d.ts +17 -0
  29. package/dist/mcp/register.js +149 -21
  30. package/dist/mcp/register.js.map +1 -1
  31. package/dist/mcp/summary.js +8 -0
  32. package/dist/mcp/summary.js.map +1 -1
  33. package/dist/pdf/address.d.ts +4 -0
  34. package/dist/pdf/address.js +28 -0
  35. package/dist/pdf/address.js.map +1 -0
  36. package/dist/pdf/command.js +87 -14
  37. package/dist/pdf/command.js.map +1 -1
  38. package/dist/pdf/extract.js +23 -2
  39. package/dist/pdf/extract.js.map +1 -1
  40. package/dist/pdf/generic-register-table.d.ts +5 -0
  41. package/dist/pdf/generic-register-table.js +125 -0
  42. package/dist/pdf/generic-register-table.js.map +1 -0
  43. package/dist/pdf/index.d.ts +2 -0
  44. package/dist/pdf/index.js +2 -0
  45. package/dist/pdf/index.js.map +1 -1
  46. package/dist/pdf/interface-kind.d.ts +11 -0
  47. package/dist/pdf/interface-kind.js +18 -0
  48. package/dist/pdf/interface-kind.js.map +1 -1
  49. package/dist/pdf/manufacturer.js +39 -0
  50. package/dist/pdf/manufacturer.js.map +1 -1
  51. package/dist/pdf/maxim-register-map.d.ts +11 -0
  52. package/dist/pdf/maxim-register-map.js +544 -0
  53. package/dist/pdf/maxim-register-map.js.map +1 -0
  54. package/dist/pdf/part.js +8 -0
  55. package/dist/pdf/part.js.map +1 -1
  56. package/dist/pdf/prose-commands.d.ts +4 -0
  57. package/dist/pdf/prose-commands.js +90 -0
  58. package/dist/pdf/prose-commands.js.map +1 -0
  59. package/dist/pdf/st-bit-layout.d.ts +3 -0
  60. package/dist/pdf/st-bit-layout.js +238 -0
  61. package/dist/pdf/st-bit-layout.js.map +1 -0
  62. package/dist/pdf/ti-field-descriptions.d.ts +10 -0
  63. package/dist/pdf/ti-field-descriptions.js +87 -0
  64. package/dist/pdf/ti-field-descriptions.js.map +1 -0
  65. package/dist/pdf/ti-register-map.d.ts +5 -0
  66. package/dist/pdf/ti-register-map.js +84 -0
  67. package/dist/pdf/ti-register-map.js.map +1 -0
  68. package/dist/pdf/types.d.ts +15 -3
  69. package/dist/pdf/types.js +4 -1
  70. package/dist/pdf/types.js.map +1 -1
  71. package/dist/schema/assemble.d.ts +35 -3
  72. package/dist/schema/assemble.js +86 -13
  73. package/dist/schema/assemble.js.map +1 -1
  74. package/dist/schema/types.d.ts +21 -1
  75. package/dist/schema/validate.js +37 -10
  76. package/dist/schema/validate.js.map +1 -1
  77. package/dist/server.d.ts +18 -0
  78. package/dist/server.js +49 -3
  79. package/dist/server.js.map +1 -1
  80. package/package.json +1 -1
  81. package/schemas/datasheet.schema.json +17 -3
@@ -1,4 +1,100 @@
1
- import type { DatasheetJson } from "../schema/types.js";
2
- import type { DriverArtifact } from "./types.js";
3
- /** Render the portable thin-HAL driver skeleton for a validated datasheet. */
1
+ import { type Register } from "../pdf/types.js";
2
+ import type { Command, DatasheetJson } from "../schema/types.js";
3
+ import type { DriverArtifact, FillInBrief, GeneratedFile } from "./types.js";
4
+ export declare const AUTOGEN: (part: string, mfr: string, busLine: string) => string;
5
+ export declare function registerConstants(prefix: string, registers: Register[]): string[];
6
+ /** Where the host AI must enumerate a register map that Driverge couldn't extract. */
7
+ export declare function registerMapTodo(prefix: string, pages: number[]): string[];
8
+ /** Where the host AI must enumerate a command set that Driverge couldn't extract. */
9
+ export declare function commandSetTodo(prefix: string, pages: number[]): string[];
10
+ /** fill_in_brief.register_map_todo text — shared by the C and cpp generators. */
11
+ export declare function registerMapTodoText(json: DatasheetJson, name: string, prefix: string): string;
12
+ /** fill_in_brief.command_set_todo text — shared by the C and cpp generators. */
13
+ export declare function commandSetTodoText(json: DatasheetJson, name: string, prefix: string): string;
14
+ export type RegisterMapBus = "I2C" | "SPI" | "UART" | "CAN";
15
+ interface BusSeam {
16
+ /** Lines appended after the "Thin-HAL seam" header comment, in order. */
17
+ decl: string[];
18
+ /** Field(s) for the driver handle typedef struct. */
19
+ handleField: string;
20
+ /** Body of <name>_read_register (dev, reg, value already in scope). Unused for UART/CAN. */
21
+ readBody: string[];
22
+ /** Body of <name>_write_register (dev, reg, value already in scope). Unused for UART/CAN. */
23
+ writeBody: string[];
24
+ }
25
+ export declare const BUS_SEAM: Record<RegisterMapBus, BusSeam>;
26
+ /** Which BUS_SEAM row a protocol.bus resolves to. "unknown" defaults to the I2C
27
+ * seam, matching the pre-existing (pre-Session-B) fallback behavior. */
28
+ export declare function seamBusFor(bus: string): RegisterMapBus;
29
+ export declare function uartFramingBody(params: string[]): string[];
30
+ export declare function canFramingBody(params: string[]): string[];
31
+ export declare const CAN_QUIRKS_NOTE = "Confirm the arbitration IDs / SDO message schema this part uses for register/command access from the datasheet; CAN device interfaces are device-specific.";
32
+ export declare function bitFieldMacros(prefix: string, registers: Register[]): string[];
33
+ /**
34
+ * Names the register_map fill_in_brief prose uses to refer to the driver's own
35
+ * init/read/write entry points. Defaults to the C free-function names
36
+ * (`<name>_init`, `read_register`/`write_register`); the cpp generator passes
37
+ * the class method names instead so the SAME brief builder produces
38
+ * language-accurate text without duplicating the quirks/framing prose (Session
39
+ * D: cpp language option).
40
+ */
41
+ export interface RegisterBriefCalls {
42
+ init: string;
43
+ readRegister: string;
44
+ writeRegister: string;
45
+ }
46
+ export declare function registerBrief(json: DatasheetJson, calls?: Partial<RegisterBriefCalls>): FillInBrief;
47
+ /**
48
+ * Names the command_set fill_in_brief prose uses for the driver's own entry
49
+ * points. Defaults to the C free-function names; the cpp generator passes the
50
+ * class method names instead (Session D: cpp language option) — see
51
+ * RegisterBriefCalls for the register_map analogue.
52
+ */
53
+ export interface CommandBriefCalls {
54
+ sendCommand: string;
55
+ readData: string;
56
+ crc8: string;
57
+ }
58
+ export declare function commandBrief(json: DatasheetJson, commands: Command[], crc: Command["crc"] | undefined, uart: boolean, can: boolean, name: string, prefix: string, calls?: Partial<CommandBriefCalls>): FillInBrief;
59
+ /**
60
+ * Static prose block shared by the C and cpp command_set init() bodies
61
+ * (mentions no function names, so there is nothing to parameterize).
62
+ */
63
+ export declare const COMMAND_INIT_TODO: readonly string[];
64
+ /** The I2C command-frame comment in send_command — no callable names, shared verbatim. */
65
+ export declare const I2C_COMMAND_FRAME_NOTE: readonly string[];
66
+ /**
67
+ * read_data's "implement the actual read framing" TODO comment. `crc8Name` is
68
+ * the bare callable name (no parens) — `<name>_crc8` for C, `crc8` for cpp.
69
+ */
70
+ export declare function commandReadDataTodo(crc8Name: string): string[];
71
+ /**
72
+ * Renders a CRC-8 stub function/method body. `qualifiedName` is the full
73
+ * callable name to emit — a free function (`sht3x_crc8`) for C or a qualified
74
+ * method (`Sht3x::crc8`) for cpp — so this single builder covers both without
75
+ * duplicating the TODO prose (Session D: cpp language option).
76
+ */
77
+ export declare function crc8Body(qualifiedName: string, crc: NonNullable<Command["crc"]>, prefix: string): string[];
78
+ /**
79
+ * register_map init()'s "implement the power-on/reset sequence" TODO comment.
80
+ * The uart/can branch mentions no callable names (just the seam functions), so
81
+ * it is identical for C and cpp; the register-access branch takes the write
82
+ * call as a parameter (`<name>_write_register()` for C, `writeRegister()` for
83
+ * cpp) so both flavors share this one builder (Session D: cpp language
84
+ * option).
85
+ */
86
+ export declare function registerInitTodo(uart: boolean, can: boolean, writeRegisterCall: string): string[];
87
+ export declare function makeFiles(name: string, header: string[], source: string[], ext?: {
88
+ header: string;
89
+ source: string;
90
+ }): GeneratedFile[];
91
+ /**
92
+ * Render the portable thin-HAL driver skeleton for a validated datasheet.
93
+ * DeviceInterface is a 2-member discriminated union, so narrowing on `kind`
94
+ * here — rather than casting inside registerDriver/commandDriver — lets both
95
+ * take an explicit, correctly-typed array with no cast. Any kind other than
96
+ * "command_set" is treated as register_map, matching buildInterface's
97
+ * register-first fallback (see schema/assemble) exactly.
98
+ */
4
99
  export declare function generatePortableDriver(json: DatasheetJson): DriverArtifact;
100
+ export {};