@f5xc-salesdemos/xcsh 18.2.0 → 18.2.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@f5xc-salesdemos/xcsh",
4
- "version": "18.2.0",
4
+ "version": "18.2.1",
5
5
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://github.com/f5xc-salesdemos/xcsh",
7
7
  "author": "Can Boluk",
@@ -47,12 +47,12 @@
47
47
  "dependencies": {
48
48
  "@agentclientprotocol/sdk": "0.16.1",
49
49
  "@mozilla/readability": "^0.6",
50
- "@f5xc-salesdemos/xcsh-stats": "18.2.0",
51
- "@f5xc-salesdemos/pi-agent-core": "18.2.0",
52
- "@f5xc-salesdemos/pi-ai": "18.2.0",
53
- "@f5xc-salesdemos/pi-natives": "18.2.0",
54
- "@f5xc-salesdemos/pi-tui": "18.2.0",
55
- "@f5xc-salesdemos/pi-utils": "18.2.0",
50
+ "@f5xc-salesdemos/xcsh-stats": "18.2.1",
51
+ "@f5xc-salesdemos/pi-agent-core": "18.2.1",
52
+ "@f5xc-salesdemos/pi-ai": "18.2.1",
53
+ "@f5xc-salesdemos/pi-natives": "18.2.1",
54
+ "@f5xc-salesdemos/pi-tui": "18.2.1",
55
+ "@f5xc-salesdemos/pi-utils": "18.2.1",
56
56
  "@sinclair/typebox": "^0.34",
57
57
  "@xterm/headless": "^6.0",
58
58
  "ajv": "^8.18",
@@ -23,14 +23,6 @@ export interface PromptTemplate {
23
23
  source: string; // e.g., "(user)", "(project)", "(project:frontend)"
24
24
  }
25
25
 
26
- prompt.registerHelper("jtdToTypeScript", (schema: unknown): string => {
27
- try {
28
- return jtdToTypeScript(schema);
29
- } catch {
30
- return "unknown";
31
- }
32
- });
33
-
34
26
  /**
35
27
  * Renders a section separator:
36
28
  *
@@ -42,8 +34,6 @@ export function sectionSeparator(name: string): string {
42
34
  return `\n\n═══════════${name}═══════════\n`;
43
35
  }
44
36
 
45
- prompt.registerHelper("SECTION_SEPERATOR", (name: unknown): string => sectionSeparator(String(name)));
46
-
47
37
  function formatHashlineRef(lineNum: unknown, content: unknown): { num: number; text: string; ref: string } {
48
38
  const num = typeof lineNum === "number" ? lineNum : Number.parseInt(String(lineNum), 10);
49
39
  const raw = typeof content === "string" ? content : String(content ?? "");
@@ -53,51 +43,77 @@ function formatHashlineRef(lineNum: unknown, content: unknown): { num: number; t
53
43
  }
54
44
 
55
45
  /**
56
- * {{href lineNum "content"}} compute a real hashline ref for prompt examples.
57
- * Returns `"lineNum#hash"` using the actual hash algorithm.
58
- */
59
- prompt.registerHelper("href", (lineNum: unknown, content: unknown): string => {
60
- const { ref } = formatHashlineRef(lineNum, content);
61
- return JSON.stringify(ref);
62
- });
63
-
64
- /**
65
- * {{hline lineNum "content"}} — format a full read-style line with prefix.
66
- * Returns `"lineNum#hash:content"`.
67
- */
68
- prompt.registerHelper("hline", (lineNum: unknown, content: unknown): string => {
69
- const { ref, text } = formatHashlineRef(lineNum, content);
70
- return `${ref}:${text}`;
71
- });
72
-
73
- /**
74
- * {{anchor name checksum}} — render a branch anchor tag using the current anchor style.
75
- * Style is resolved from the template context (`anchorStyle`) or defaults to "full".
46
+ * Registers all coding-agent-specific Handlebars helpers on the shared prompt engine.
47
+ *
48
+ * Called at module load for production (bottom of this file). Tests that render
49
+ * prompt templates directly via `prompt.render(...)` without going through
50
+ * `buildSystemPrompt()` MUST call this in `beforeAll` — see Issue #175.
51
+ *
52
+ * Handlebars `registerHelper` is idempotent (overwrites), so calling this more
53
+ * than once is safe.
76
54
  */
77
- prompt.registerHelper("anchor", function (this: prompt.TemplateContext, name: string, checksum: string): string {
78
- const style = (this.anchorStyle as ChunkAnchorStyle) ?? "full";
79
- return formatAnchor(name, checksum, style);
80
- });
55
+ export function registerCodingAgentPromptHelpers(): void {
56
+ prompt.registerHelper("jtdToTypeScript", (schema: unknown): string => {
57
+ try {
58
+ return jtdToTypeScript(schema);
59
+ } catch {
60
+ return "unknown";
61
+ }
62
+ });
63
+
64
+ prompt.registerHelper("SECTION_SEPERATOR", (name: unknown): string => sectionSeparator(String(name)));
65
+
66
+ /**
67
+ * {{href lineNum "content"}} — compute a real hashline ref for prompt examples.
68
+ * Returns `"lineNum#hash"` using the actual hash algorithm.
69
+ */
70
+ prompt.registerHelper("href", (lineNum: unknown, content: unknown): string => {
71
+ const { ref } = formatHashlineRef(lineNum, content);
72
+ return JSON.stringify(ref);
73
+ });
74
+
75
+ /**
76
+ * {{hline lineNum "content"}} — format a full read-style line with prefix.
77
+ * Returns `"lineNum#hash:content"`.
78
+ */
79
+ prompt.registerHelper("hline", (lineNum: unknown, content: unknown): string => {
80
+ const { ref, text } = formatHashlineRef(lineNum, content);
81
+ return `${ref}:${text}`;
82
+ });
83
+
84
+ /**
85
+ * {{anchor name checksum}} — render a branch anchor tag using the current anchor style.
86
+ * Style is resolved from the template context (`anchorStyle`) or defaults to "full".
87
+ */
88
+ prompt.registerHelper("anchor", function (this: prompt.TemplateContext, name: string, checksum: string): string {
89
+ const style = (this.anchorStyle as ChunkAnchorStyle) ?? "full";
90
+ return formatAnchor(name, checksum, style);
91
+ });
92
+
93
+ /**
94
+ * {{sel "parent_Name.child_Name"}} — render a chunk path for `sel` fields in examples.
95
+ * In `full` style the path is returned as-is (`class_Server.fn_start`).
96
+ * In `kind` style each segment is trimmed to its kind prefix (`class.fn`).
97
+ * In `bare` style the path is omitted (the model uses only `crc` to identify chunks).
98
+ */
99
+ prompt.registerHelper("sel", function (this: prompt.TemplateContext, chunkPath: string): string {
100
+ const style = (this.anchorStyle as ChunkAnchorStyle) ?? "full";
101
+ if (style === "full") return chunkPath;
102
+ if (style === "bare") return "";
103
+ // kind: trim each segment to its kind prefix (before the first `_`)
104
+ return chunkPath
105
+ .split(".")
106
+ .map(seg => {
107
+ const idx = seg.indexOf("_");
108
+ return idx === -1 ? seg : seg.slice(0, idx);
109
+ })
110
+ .join(".");
111
+ });
112
+ }
81
113
 
82
- /**
83
- * {{sel "parent_Name.child_Name"}} render a chunk path for `sel` fields in examples.
84
- * In `full` style the path is returned as-is (`class_Server.fn_start`).
85
- * In `kind` style each segment is trimmed to its kind prefix (`class.fn`).
86
- * In `bare` style the path is omitted (the model uses only `crc` to identify chunks).
87
- */
88
- prompt.registerHelper("sel", function (this: prompt.TemplateContext, chunkPath: string): string {
89
- const style = (this.anchorStyle as ChunkAnchorStyle) ?? "full";
90
- if (style === "full") return chunkPath;
91
- if (style === "bare") return "";
92
- // kind: trim each segment to its kind prefix (before the first `_`)
93
- return chunkPath
94
- .split(".")
95
- .map(seg => {
96
- const idx = seg.indexOf("_");
97
- return idx === -1 ? seg : seg.slice(0, idx);
98
- })
99
- .join(".");
100
- });
114
+ // Preserve original module-load behavior so existing importers continue to work
115
+ // unchanged. See `registerCodingAgentPromptHelpers` docblock.
116
+ registerCodingAgentPromptHelpers();
101
117
 
102
118
  const INLINE_ARG_SHELL_PATTERN = /\$(?:ARGUMENTS|@(?:\[\d+(?::\d*)?\])?|\d+)/;
103
119
  const INLINE_ARG_TEMPLATE_PATTERN = /\{\{[\s\S]*?(?:\b(?:arguments|ARGUMENTS|args)\b|\barg\s+[^}]+)[\s\S]*?\}\}/;
@@ -17,17 +17,17 @@ export interface BuildInfo {
17
17
  }
18
18
 
19
19
  export const BUILD_INFO: BuildInfo = {
20
- "version": "18.2.0",
21
- "commit": "ae35527ff04566b287ca0448ce14e9304e98b139",
22
- "shortCommit": "ae35527",
20
+ "version": "18.2.1",
21
+ "commit": "a9a7a85e9085f1327823664b584feaccf2c33527",
22
+ "shortCommit": "a9a7a85",
23
23
  "branch": "main",
24
- "tag": "v18.2.0",
25
- "commitDate": "2026-04-20T19:21:19Z",
26
- "buildDate": "2026-04-20T23:37:22.492Z",
24
+ "tag": "v18.2.1",
25
+ "commitDate": "2026-04-21T01:47:20Z",
26
+ "buildDate": "2026-04-21T02:13:22.611Z",
27
27
  "dirty": false,
28
28
  "prNumber": "",
29
29
  "repoUrl": "https://github.com/f5xc-salesdemos/xcsh",
30
30
  "repoSlug": "f5xc-salesdemos/xcsh",
31
- "commitUrl": "https://github.com/f5xc-salesdemos/xcsh/commit/ae35527ff04566b287ca0448ce14e9304e98b139",
32
- "releaseUrl": "https://github.com/f5xc-salesdemos/xcsh/releases/tag/v18.2.0"
31
+ "commitUrl": "https://github.com/f5xc-salesdemos/xcsh/commit/a9a7a85e9085f1327823664b584feaccf2c33527",
32
+ "releaseUrl": "https://github.com/f5xc-salesdemos/xcsh/releases/tag/v18.2.1"
33
33
  };