@turingcode/cli 0.3.22 → 0.3.23

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.
@@ -36,8 +36,8 @@ export declare function callTool(name: string, args: Record<string, unknown>, to
36
36
  */
37
37
  export declare function callToolText(name: string, args: object, token: string, url?: string, timeoutMs?: number): Promise<string>;
38
38
  /**
39
- * A tool reply without the server's trailing footer lines (`Credits: ...`), for replies that are parsed
40
- * (a link, JSON) rather than shown.
39
+ * A tool reply without the server's trailing footer lines (`Credits: ...`); every tool result goes through
40
+ * it so agents never see them.
41
41
  *
42
42
  * @param {string} text - Tool reply.
43
43
  * @returns {string} The reply body, trimmed.
package/dist/core/mcp.js CHANGED
@@ -89,8 +89,8 @@ export async function callToolText(name, args, token, url = DEFAULT_URL, timeout
89
89
  return result.text;
90
90
  }
91
91
  /**
92
- * A tool reply without the server's trailing footer lines (`Credits: ...`), for replies that are parsed
93
- * (a link, JSON) rather than shown.
92
+ * A tool reply without the server's trailing footer lines (`Credits: ...`); every tool result goes through
93
+ * it so agents never see them.
94
94
  *
95
95
  * @param {string} text - Tool reply.
96
96
  * @returns {string} The reply body, trimmed.
@@ -141,7 +141,7 @@ export function parseRpcReply(body) {
141
141
  export function toToolResult(result) {
142
142
  const content = result?.content ?? [];
143
143
  return {
144
- text: content.filter(c => c.type === "text").map(c => c.text).join("\n"),
144
+ text: replyBody(content.filter(c => c.type === "text").map(c => c.text).join("\n")),
145
145
  isError: Boolean(result?.isError),
146
146
  };
147
147
  }
@@ -130,12 +130,13 @@ async function runToolCall(name, args, full) {
130
130
  process.exitCode = 1;
131
131
  return;
132
132
  }
133
- const bytes = Buffer.byteLength(result.text);
133
+ const text = result.text;
134
+ const bytes = Buffer.byteLength(text);
134
135
  if (full || bytes <= SAVE_ABOVE_BYTES) {
135
- process.stdout.write(result.text + '\n');
136
+ process.stdout.write(text + '\n');
136
137
  return;
137
138
  }
138
- const file = relative(process.cwd(), await saveToolResult(name, result.text)).replace(/\\/g, '/');
139
+ const file = relative(process.cwd(), await saveToolResult(name, text)).replace(/\\/g, '/');
139
140
  process.stdout.write(`Result was too long (${(bytes / 1024).toFixed(1)} KB), saved to ${file}. Don't read all of it, grep what you need.\n`);
140
141
  }
141
142
  const list = {
@@ -18,7 +18,7 @@ export interface BuildResult {
18
18
  export declare function downloadElf(call: ServerCall, project: Project, text: string): Promise<string>;
19
19
  /**
20
20
  * Shortens a successful build reply for agents: the result line, warnings outside Drivers/ (ST's code, counted
21
- * instead), sizes, the clock audit summary and findings, and the credits line. Compiler, map file, stack usage,
21
+ * instead), sizes, the clock audit summary and findings. Compiler, map file, stack usage,
22
22
  * build log and clock tables are left out.
23
23
  * @param text server build reply
24
24
  * @returns the short reply
@@ -26,7 +26,7 @@ export async function downloadElf(call, project, text) {
26
26
  }
27
27
  /**
28
28
  * Shortens a successful build reply for agents: the result line, warnings outside Drivers/ (ST's code, counted
29
- * instead), sizes, the clock audit summary and findings, and the credits line. Compiler, map file, stack usage,
29
+ * instead), sizes, the clock audit summary and findings. Compiler, map file, stack usage,
30
30
  * build log and clock tables are left out.
31
31
  * @param text server build reply
32
32
  * @returns the short reply
@@ -36,7 +36,7 @@ export function compactBuildReply(text) {
36
36
  let driverWarnings = 0;
37
37
  for (const section of text.trim().split(/\r?\n(?=#{1,2} )/)) {
38
38
  const [head, ...body] = section.split(/\r?\n/);
39
- const lines = body.filter((l) => l.trim() && !l.startsWith('Credits:'));
39
+ const lines = body.filter((l) => l.trim());
40
40
  if (!head.startsWith('#'))
41
41
  out.push(head);
42
42
  else if (head === '## Warnings') {
@@ -54,8 +54,7 @@ export function compactBuildReply(text) {
54
54
  }
55
55
  if (driverWarnings)
56
56
  out.splice(1, 0, `${driverWarnings} warning(s) in Drivers/ (ST code) not shown; --verbose shows the full reply`);
57
- const credits = text.match(/^Credits:.*$/m)?.[0];
58
- return [...out, ...(credits ? [credits] : [])].join('\n');
57
+ return out.join('\n');
59
58
  }
60
59
  /**
61
60
  * Builds the server copy of the project and, when the build succeeds, downloads its ELF into build/<preset>/.
@@ -19,7 +19,7 @@ description: STM32 firmware with the turingcode CLI: writing or reviewing C/C++
19
19
 
20
20
  ### Read the matching references
21
21
 
22
- | Read | When changing or making |
22
+ | Read | When to read |
23
23
  |---|---|
24
24
  | `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 |
25
25
  | `references/newproject.md` | Only when the user asks for a new project |
@@ -18,11 +18,17 @@ 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
- - 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).
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.
22
+ - also mention power pins (GND, VCC) connections for the ICs.
23
+ - Example output table:
22
24
 
23
25
  | MCU PIN | SENSOR_X PIN |
24
26
  | --- | --- |
25
- | pin B12 | sensor pin Y |
27
+ | pin B12 | sensor pin A |
28
+
29
+ | MCU PIN | SENSOR_Y PIN |
30
+ | --- | --- |
31
+ | pin B12 | sensor pin B |
26
32
 
27
33
  ### Safety Rules if connections need changing
28
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turingcode/cli",
3
- "version": "0.3.22",
3
+ "version": "0.3.23",
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": {