@turingcode/cli 0.3.18 → 0.3.21

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 (25) hide show
  1. package/dist/cli/create-cli.js +13 -12
  2. package/dist/features/tool/command.d.ts +6 -3
  3. package/dist/features/tool/command.js +12 -8
  4. package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/SKILL.md +19 -3
  5. package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/init-pins.md +5 -1
  6. package/mods/claude/turingcode-skills/skills/{turingcode-cli → turingcode}/references/newproject.md +2 -0
  7. package/package.json +1 -1
  8. package/mods/claude/turingcode-skills/skills/turingcode-cli/SKILL.md +0 -49
  9. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/M_StatusEnum.md +0 -0
  10. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/app-startup.md +0 -0
  11. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/code/BusMutexRegistry.hpp +0 -0
  12. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/code/COM_Driver.hpp +0 -0
  13. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/code/COM_I2C.hpp +0 -0
  14. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/code/COM_SPI.hpp +0 -0
  15. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/code/COM_USART.hpp +0 -0
  16. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/code/Util_MutexManager.hpp +0 -0
  17. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/driver/driver.md +0 -0
  18. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/driver/driver_ic.md +0 -0
  19. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/driver/driver_protocol.md +0 -0
  20. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/driver/driver_rtos.md +0 -0
  21. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/driver/driver_test.md +0 -0
  22. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/host-protocol.md +0 -0
  23. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/registers-and-units.md +0 -0
  24. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/storage.md +0 -0
  25. /package/mods/claude/turingcode-skills/skills/{turingcode-firmware-code → turingcode}/references/tasks-and-interrupts.md +0 -0
@@ -44,18 +44,19 @@ export function createCli(args) {
44
44
  .scriptName('turingcode')
45
45
  .usage("Usage: $0 <command> [options]; $0 <command> --help for each command's usage")
46
46
  .epilogue([
47
- 'Turing Code toolkit for AI agents.',
48
- '- Server tools: `tool list` to find a tool, `tool describe <name>` for its arguments,',
49
- ' `tool call <name> --args ...` to run it.',
50
- '- Tables: check Markdown or CSV tables against a contract (a JSON file of tables, columns and',
51
- ' MongoDB-style checks): `contract describe` shows the tables to write; `table check` until PASS.',
52
- ' Contract format: $0 contract --help.',
53
- '- STM32 projects: `project sync -b` to build on the server, `syntax-check [paths..]` for a clang syntax',
54
- ' check of the project or of loose files, `probe program` to flash the board,',
55
- ' `probe read` and `probe peripheral` to inspect it, `debug start` ... `debug stop` for a live debug',
56
- ' session; `status` shows the project and the installed debug tools.',
57
- '- Agent skills: `install-skills` copies them into ~/.agents/skills (Codex, OpenCode);',
58
- ' `install-mods` installs them into Claude Code as the turingcode-skills plugin.',
47
+ '`turingcode` handles project setup, building, configuration, flashing and debugging.',
48
+ '',
49
+ 'Each command group has its own `--help` with flags and examples.',
50
+ ' Read it before using commands in that area.',
51
+ '',
52
+ '- Run `turingcode status` first.',
53
+ '',
54
+ 'Most useful commands:',
55
+ '- `project sync -b` to build on the server',
56
+ '- `probe program` to flash the board',
57
+ '- `probe --help` to learn more about debugging, breakpoints, stepping, ...',
58
+ '- Server mcp tools: `tool list` to find mcp tools on the turingcode server,',
59
+ ' then `tool call <name> --args ...` to run it.',
59
60
  ].join('\n'))
60
61
  .command(commands)
61
62
  .demandCommand(1, `Name a command: ${names.slice(0, -1).join(', ')} or ${names.at(-1)}`)
@@ -3,15 +3,18 @@ import { ToolInfo } from '../../core/mcp.js';
3
3
  /** A tool result larger than this many bytes is saved to a file instead of printed. */
4
4
  export declare const SAVE_ABOVE_BYTES = 4096;
5
5
  /**
6
- * Formats tools as a `# \`<name>\`` heading each, then the first line of its description.
6
+ * Formats tools as a `Tools:` list, each `- <name>` then the first line of its description,
7
+ * followed by a hint to `tool describe`.
7
8
  *
8
9
  * @param {ToolInfo[]} tools - Tools from the gateway.
9
- * @returns {string} The text, ending in a newline (empty for no tools).
10
+ * @returns {string} The text, ending in a newline.
10
11
  *
11
12
  * @example
12
- * formatToolSummaries([{ name: "read_file", description: "Reads a file.\nMore." }]); // "# `read_file`\nReads a file.\n"
13
+ * formatToolSummaries([{ name: "read_file", description: "Reads a file.\nMore." }]);
14
+ * // "Tools:\n- read_file\nReads a file.\n\n---\nHint: ...\n"
13
15
  */
14
16
  export declare function formatToolSummaries(tools: ToolInfo[]): string;
17
+ export declare const TOOL_LIST_HINT = "Hint: use \"turingcode tool describe <tool_name>\" to get its full description and parameters.";
15
18
  /**
16
19
  * Formats tools with their full description and arguments, one `## <name>` section per tool.
17
20
  *
@@ -27,22 +27,26 @@ function schemaType(schema) {
27
27
  return [schema.type ?? 'any'].flat().join(' | ');
28
28
  }
29
29
  /**
30
- * Formats tools as a `# \`<name>\`` heading each, then the first line of its description.
30
+ * Formats tools as a `Tools:` list, each `- <name>` then the first line of its description,
31
+ * followed by a hint to `tool describe`.
31
32
  *
32
33
  * @param {ToolInfo[]} tools - Tools from the gateway.
33
- * @returns {string} The text, ending in a newline (empty for no tools).
34
+ * @returns {string} The text, ending in a newline.
34
35
  *
35
36
  * @example
36
- * formatToolSummaries([{ name: "read_file", description: "Reads a file.\nMore." }]); // "# `read_file`\nReads a file.\n"
37
+ * formatToolSummaries([{ name: "read_file", description: "Reads a file.\nMore." }]);
38
+ * // "Tools:\n- read_file\nReads a file.\n\n---\nHint: ...\n"
37
39
  */
38
40
  export function formatToolSummaries(tools) {
39
- return tools
40
- .map((t) => {
41
+ if (tools.length === 0)
42
+ return 'No tools found.\n';
43
+ const items = tools.map((t) => {
41
44
  const summary = t.description?.trim().split('\n')[0];
42
- return `# \`${t.name}\`\n` + (summary ? summary + '\n' : '');
43
- })
44
- .join('');
45
+ return `- ${t.name}\n` + (summary ? summary + '\n' : '');
46
+ });
47
+ return `Tools:\n${items.join('\n')}\n---\n${TOOL_LIST_HINT}\n`;
45
48
  }
49
+ export const TOOL_LIST_HINT = 'Hint: use "turingcode tool describe <tool_name>" to get its full description and parameters.';
46
50
  /**
47
51
  * Formats tools with their full description and arguments, one `## <name>` section per tool.
48
52
  *
@@ -1,6 +1,6 @@
1
1
  ---
2
- name: turingcode-firmware-code
3
- description: Coding rules for embedded C/C++ firmware on STM32. Use whenever writing, editing, reviewing or organizing .c, .cpp, .h or .hpp files for a microcontroller or sensor driver.
2
+ name: turingcode
3
+ description: Coding rules for embedded C/C++ firmware on STM32. Use whenever writing, editing, reviewing or organizing .c, .cpp, .h or .hpp files, or creating, building, flashing, testing a STM32 Project for a microcontroller or sensor driver.
4
4
  ---
5
5
 
6
6
  # Embedded C/C++ rules
@@ -16,6 +16,7 @@ description: Coding rules for embedded C/C++ firmware on STM32. Use whenever wri
16
16
  | Read | When changing or making |
17
17
  |---|---|
18
18
  | `references/init-pins.md` | when a new project is created and we need to decide about pin connections and what pins to use, or when a user asks about where and how to connect the board pins |
19
+ | `references/newproject.md` | Only when the user asks for a new project |
19
20
  | `references/driver/driver.md` | a driver for an external IC or bus protocol |
20
21
  | `references/registers-and-units.md` | datasheet registers, bit fields, signedness, units, conversions |
21
22
  | `references/tasks-and-interrupts.md` | ISRs, HAL callbacks, the main loop, RTOS tasks and their wakeups, DMA, shared data |
@@ -96,8 +97,23 @@ description: Coding rules for embedded C/C++ firmware on STM32. Use whenever wri
96
97
  */
97
98
  ```
98
99
 
99
- ## Safety rules
100
+ ## Typical loop
101
+
102
+ 1. Edit the code, run `turingcode project sync -b` and fix the reported errors.
103
+ - Before finishing a change, run `turingcode project sync -b -a` for static analysis.
104
+ 2. Flash with `turingcode probe program`.
105
+ 3. Verify it runs without looking at the board: read a register the program changes a few times with `turingcode probe read` and check that it changes as expected.
106
+ 4. On a crash, run `turingcode probe faults`, or `turingcode debug start` with breakpoints to find the cause.
107
+
108
+ ## Code Safety rules
100
109
 
101
110
  1. **Never drop a status.** Check or accumulate every status, `HAL_StatusTypeDef` and RTOS return. Never return `M_OK` after fallible steps; if ignoring one is safe, write in comments why.
102
111
  2. **Every wait has a timeout and an error path.** No unbounded hardware loops, no retry count where 0 means "forever"; fail visibly instead of hanging boot.
103
112
  3. **Budget memory.** No `new`/`delete` in periodic/per-transaction paths; preallocate as members or statics; keep KB-sized objects off task stacks and size each stack.
113
+
114
+ ## Tool Safety rules
115
+
116
+ - Don't ever write debug registers by hand (DHCSR, DEMCR, DCRSR, DCRDR, FPB). doing so may brick the mcu.
117
+ - Halt, step and breakpoints go through `turingcode debug`, which releases the debug state on exit.
118
+ - NEVER touch RDP without asking first.
119
+ - Level 1 → 0 mass-erases the flash, and Level 2 is permanent.
@@ -18,7 +18,11 @@ Finally you must include a consice report of the routed pins (wether you could s
18
18
 
19
19
  ## Help the user for connections
20
20
 
21
- - guide the user about how to connect the pins of the MCU to the ICs that they have on their project (if any), tell them what mcu pin to connect to which IC pin exactly (dont forget to mention power pins too).
21
+ - help the user to connect the pins of the MCU to the ICs that they have on their project (if any), tell them what mcu pin to connect to which IC pin exactly in a table (dont forget to mention power pins too).
22
+
23
+ | MCU PIN | SENSOR_X PIN |
24
+ | --- | --- |
25
+ | pin B12 | sensor pin Y |
22
26
 
23
27
  ### Safety Rules if connections need changing
24
28
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  Only when the user asks for a new project.
4
4
 
5
+ ## Workflow
6
+
5
7
  1. Run `turingcode probe info` to identify the connected chip.
6
8
  2. The package (pin count) can't be read over SWD, so ask the user
7
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turingcode/cli",
3
- "version": "0.3.18",
3
+ "version": "0.3.21",
4
4
  "description": "Turing Code toolkit for AI agents: check Markdown/CSV tables against table contracts, e.g. `turingcode table check`.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,49 +0,0 @@
1
- ---
2
- name: turingcode-cli
3
- description: use for creating, build, debug, program, flash or analyze any STM32 project
4
- ---
5
-
6
- # turingcode CLI for STM32
7
-
8
- `turingcode` handles the whole STM32 workflow: project setup, building, configuration, flashing and debugging. Use it instead of calling probe-rs or STM32_Programmer_CLI directly.
9
-
10
- ## Start here
11
-
12
- - Run `turingcode status` first. It shows the project, token, last build, debug session and installed probe tools.
13
-
14
- ## Commands
15
-
16
- Each command group has its own `--help` with flags and examples. Read it before using commands in that area.
17
-
18
- - `turingcode project --help`: sync, build, pull, regen and static analysis.
19
- - `turingcode syntax-check --help`: clang syntax check of the project, or of loose files, folders or globs.
20
- - `turingcode probe --help`: flash, reset, read memory or registers, decode faults, recover a stuck probe.
21
- - `turingcode debug --help`: breakpoints, stepping, stack, variables.
22
-
23
- ## Server tools
24
-
25
- Pins, clocks, `.ioc` edits, register lookup and the datasheet knowledge base (MCUs and components) run as server tools:
26
-
27
- - `turingcode tool list` shows the available tools.
28
- - `turingcode tool call <name> --args '<json>' > result.md` runs one.
29
- - On Windows PowerShell or cmd, inline JSON loses its quotes: write the JSON to a `.json` file and pass `--args args.json`.
30
-
31
-
32
- ## New project
33
-
34
- Only when the user asks for a new project: follow [references/newproject.md](references/newproject.md).
35
-
36
- ## Typical loop
37
-
38
- 1. Edit the code, run `turingcode project sync -b` and fix the reported errors.
39
- - Before finishing a change, run `turingcode project sync -b -a` for static analysis.
40
- 2. Flash with `turingcode probe program`.
41
- 3. Verify it runs without looking at the board: read a register the program changes a few times with `turingcode probe read` and check that it changes as expected.
42
- 4. On a crash, run `turingcode probe faults`, or `turingcode debug start` with breakpoints to find the cause.
43
-
44
- ## CRITICAL Safety rules
45
-
46
- - Don't ever write debug registers by hand (DHCSR, DEMCR, DCRSR, DCRDR, FPB). doing so may brick the mcu.
47
- - Halt, step and breakpoints go through `turingcode debug`, which releases the debug state on exit.
48
- - NEVER touch RDP without asking first.
49
- - Level 1 → 0 mass-erases the flash, and Level 2 is permanent.