@turingcode/cli 0.3.17 → 0.3.19
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.
- package/dist/features/tool/command.d.ts +6 -3
- package/dist/features/tool/command.js +26 -11
- package/mods/claude/turingcode-skills/skills/turingcode-cli/SKILL.md +0 -1
- package/mods/claude/turingcode-skills/skills/turingcode-firmware-code/SKILL.md +1 -0
- package/mods/claude/turingcode-skills/skills/turingcode-firmware-code/references/init-pins.md +29 -0
- package/package.json +3 -2
|
@@ -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
|
|
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
|
|
10
|
+
* @returns {string} The text, ending in a newline.
|
|
10
11
|
*
|
|
11
12
|
* @example
|
|
12
|
-
* formatToolSummaries([{ name: "read_file", description: "Reads a file.\nMore." }]);
|
|
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,21 +27,26 @@ function schemaType(schema) {
|
|
|
27
27
|
return [schema.type ?? 'any'].flat().join(' | ');
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* Formats tools as
|
|
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
|
|
34
|
+
* @returns {string} The text, ending in a newline.
|
|
34
35
|
*
|
|
35
36
|
* @example
|
|
36
|
-
* formatToolSummaries([{ name: "read_file", description: "Reads a file.\nMore." }]);
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
'\n')
|
|
43
|
-
.
|
|
41
|
+
if (tools.length === 0)
|
|
42
|
+
return 'No tools found.\n';
|
|
43
|
+
const items = tools.map((t) => {
|
|
44
|
+
const summary = t.description?.trim().split('\n')[0];
|
|
45
|
+
return `- ${t.name}\n` + (summary ? summary + '\n' : '');
|
|
46
|
+
});
|
|
47
|
+
return `Tools:\n${items.join('\n')}\n---\n${TOOL_LIST_HINT}\n`;
|
|
44
48
|
}
|
|
49
|
+
export const TOOL_LIST_HINT = 'Hint: use "turingcode tool describe <tool_name>" to get its full description and parameters.';
|
|
45
50
|
/**
|
|
46
51
|
* Formats tools with their full description and arguments, one `## <name>` section per tool.
|
|
47
52
|
*
|
|
@@ -136,14 +141,24 @@ async function runToolCall(name, args, full) {
|
|
|
136
141
|
const list = {
|
|
137
142
|
command: 'list',
|
|
138
143
|
describe: 'List the server tools your gateway token can call, one line each',
|
|
139
|
-
builder: (cli) => cli
|
|
144
|
+
builder: (cli) => cli
|
|
145
|
+
.options({
|
|
146
|
+
search: {
|
|
147
|
+
type: 'string',
|
|
148
|
+
describe: 'Only show tools whose name contains this text (case-insensitive)',
|
|
149
|
+
},
|
|
150
|
+
})
|
|
151
|
+
.example('$0 tool list --search pin', 'only tools with "pin" in their name')
|
|
152
|
+
.epilogue([
|
|
140
153
|
'Prints the tool list of the Turing Code server.',
|
|
141
154
|
"\n- `tool describe <name>` shows a tool's full description and arguments, use before `tool call`.",
|
|
142
155
|
TOKEN_HELP,
|
|
143
156
|
].join('\n')),
|
|
144
|
-
handler: async () => {
|
|
157
|
+
handler: async (args) => {
|
|
145
158
|
const { token, url } = getGatewayConfig();
|
|
146
|
-
|
|
159
|
+
const search = args.search?.toLowerCase() ?? '';
|
|
160
|
+
const tools = (await listTools(token, url)).filter((t) => t.name.toLowerCase().includes(search));
|
|
161
|
+
process.stdout.write(formatToolSummaries(tools));
|
|
147
162
|
},
|
|
148
163
|
};
|
|
149
164
|
const describe = {
|
|
@@ -28,7 +28,6 @@ Pins, clocks, `.ioc` edits, register lookup and the datasheet knowledge base (MC
|
|
|
28
28
|
- `turingcode tool call <name> --args '<json>' > result.md` runs one.
|
|
29
29
|
- On Windows PowerShell or cmd, inline JSON loses its quotes: write the JSON to a `.json` file and pass `--args args.json`.
|
|
30
30
|
|
|
31
|
-
|
|
32
31
|
## New project
|
|
33
32
|
|
|
34
33
|
Only when the user asks for a new project: follow [references/newproject.md](references/newproject.md).
|
|
@@ -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,29 @@
|
|
|
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
|
+
- 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 |
|
|
26
|
+
|
|
27
|
+
### Safety Rules if connections need changing
|
|
28
|
+
|
|
29
|
+
- 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.
|
|
3
|
+
"version": "0.3.19",
|
|
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",
|