@turingcode/cli 0.3.16 → 0.3.18

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.
@@ -3,13 +3,13 @@ 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 one line each: name, then the first line of its description.
6
+ * Formats tools as a `# \`<name>\`` heading each, then the first line of its description.
7
7
  *
8
8
  * @param {ToolInfo[]} tools - Tools from the gateway.
9
9
  * @returns {string} The text, ending in a newline (empty for no tools).
10
10
  *
11
11
  * @example
12
- * formatToolSummaries([{ name: "read_file", description: "Reads a file.\nMore." }]); // "read_file Reads a file.\n"
12
+ * formatToolSummaries([{ name: "read_file", description: "Reads a file.\nMore." }]); // "# `read_file`\nReads a file.\n"
13
13
  */
14
14
  export declare function formatToolSummaries(tools: ToolInfo[]): string;
15
15
  /**
@@ -27,19 +27,20 @@ function schemaType(schema) {
27
27
  return [schema.type ?? 'any'].flat().join(' | ');
28
28
  }
29
29
  /**
30
- * Formats tools as one line each: name, then the first line of its description.
30
+ * Formats tools as a `# \`<name>\`` heading each, then the first line of its description.
31
31
  *
32
32
  * @param {ToolInfo[]} tools - Tools from the gateway.
33
33
  * @returns {string} The text, ending in a newline (empty for no tools).
34
34
  *
35
35
  * @example
36
- * formatToolSummaries([{ name: "read_file", description: "Reads a file.\nMore." }]); // "read_file Reads a file.\n"
36
+ * formatToolSummaries([{ name: "read_file", description: "Reads a file.\nMore." }]); // "# `read_file`\nReads a file.\n"
37
37
  */
38
38
  export function formatToolSummaries(tools) {
39
- const width = Math.max(0, ...tools.map((t) => t.name.length));
40
39
  return tools
41
- .map((t) => `${t.name.padEnd(width)} ${t.description?.trim().split('\n')[0] ?? ''}`.trimEnd() +
42
- '\n')
40
+ .map((t) => {
41
+ const summary = t.description?.trim().split('\n')[0];
42
+ return `# \`${t.name}\`\n` + (summary ? summary + '\n' : '');
43
+ })
43
44
  .join('');
44
45
  }
45
46
  /**
@@ -136,14 +137,24 @@ async function runToolCall(name, args, full) {
136
137
  const list = {
137
138
  command: 'list',
138
139
  describe: 'List the server tools your gateway token can call, one line each',
139
- builder: (cli) => cli.epilogue([
140
+ builder: (cli) => cli
141
+ .options({
142
+ search: {
143
+ type: 'string',
144
+ describe: 'Only show tools whose name contains this text (case-insensitive)',
145
+ },
146
+ })
147
+ .example('$0 tool list --search pin', 'only tools with "pin" in their name')
148
+ .epilogue([
140
149
  'Prints the tool list of the Turing Code server.',
141
150
  "\n- `tool describe <name>` shows a tool's full description and arguments, use before `tool call`.",
142
151
  TOKEN_HELP,
143
152
  ].join('\n')),
144
- handler: async () => {
153
+ handler: async (args) => {
145
154
  const { token, url } = getGatewayConfig();
146
- process.stdout.write(formatToolSummaries(await listTools(token, url)));
155
+ const search = args.search?.toLowerCase() ?? '';
156
+ const tools = (await listTools(token, url)).filter((t) => t.name.toLowerCase().includes(search));
157
+ process.stdout.write(formatToolSummaries(tools));
147
158
  },
148
159
  };
149
160
  const describe = {
@@ -15,6 +15,7 @@ description: Coding rules for embedded C/C++ firmware on STM32. Use whenever wri
15
15
 
16
16
  | Read | When changing or making |
17
17
  |---|---|
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 |
18
19
  | `references/driver/driver.md` | a driver for an external IC or bus protocol |
19
20
  | `references/registers-and-units.md` | datasheet registers, bit fields, signedness, units, conversions |
20
21
  | `references/tasks-and-interrupts.md` | ISRs, HAL callbacks, the main loop, RTOS tasks and their wakeups, DMA, shared data |
@@ -0,0 +1,25 @@
1
+ # Initializing pins
2
+
3
+ - used when a new project is created or a user asks about where and how to connect the board pins.
4
+ - Sometimes a pin requirement will be given to you, if not you should use the auto router to determine the pins yourself.
5
+
6
+ ## Schematic Files
7
+ - if there are any schematic files of the project present in the project folder you should read them and use the pins in the schematic.
8
+ - if the user project requirements that was given to you differs from the found schematics stop and ask the user which one should be used.
9
+
10
+ ## Turingcode auto router
11
+
12
+ - turingcode cli support pin auto routing so we can tell it what peripherals we need enabled and based on our MCU, see `turingcode tool list --search pin` to get started
13
+ - user did not specify any pin requirements: use any pin the auto router suggested.
14
+ - user has pin requirements: pass them to the auto router and see if they can be satisfied.
15
+
16
+ Finally you must include a consice report of the routed pins (wether you could satisfy the requirements or if there were no requirements what pins were chosen) to the user on your final message.
17
+
18
+
19
+ ## Help the user for connections
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).
22
+
23
+ ### Safety Rules if connections need changing
24
+
25
+ - Warn the user: disconnect all power when changing connection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turingcode/cli",
3
- "version": "0.3.16",
3
+ "version": "0.3.18",
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": {
@@ -10,7 +10,8 @@
10
10
  }
11
11
  },
12
12
  "bin": {
13
- "turingcode": "dist/cli/index.js"
13
+ "turingcode": "dist/cli/index.js",
14
+ "tcode": "dist/cli/index.js"
14
15
  },
15
16
  "files": [
16
17
  "dist",