@cleocode/cant 2026.4.13 → 2026.4.15

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/bundle.d.ts CHANGED
@@ -41,7 +41,15 @@ export interface ParsedCantDocument {
41
41
  /** Validation diagnostics for this document. */
42
42
  diagnostics: BundleDiagnostic[];
43
43
  }
44
- /** A normalized diagnostic combining parse errors and validation diagnostics. */
44
+ /**
45
+ * A normalized diagnostic combining parse errors and validation diagnostics.
46
+ *
47
+ * @remarks
48
+ * Position fields (`line`, `col`) are propagated from the native cant-core
49
+ * binding for both parse errors and validation diagnostics. They are optional
50
+ * because some diagnostics (e.g., file-level read failures) do not have a
51
+ * source position. Line and column are 1-based.
52
+ */
45
53
  export interface BundleDiagnostic {
46
54
  /** The rule ID (e.g., `"S01"`, `"parse"`). */
47
55
  ruleId: string;
@@ -51,6 +59,10 @@ export interface BundleDiagnostic {
51
59
  severity: string;
52
60
  /** Source file path. */
53
61
  sourcePath: string;
62
+ /** Line number (1-based) where the diagnostic occurred, or `undefined` if unavailable. */
63
+ line?: number;
64
+ /** Column number (1-based) where the diagnostic occurred, or `undefined` if unavailable. */
65
+ col?: number;
54
66
  }
55
67
  /**
56
68
  * An agent declaration extracted from a compiled `.cant` file.
package/dist/bundle.js CHANGED
@@ -237,9 +237,7 @@ function renderBundleSystemPrompt(bundle) {
237
237
  const orchestrator = typeof team.properties['orchestrator'] === 'string'
238
238
  ? team.properties['orchestrator']
239
239
  : 'unspecified';
240
- const description = typeof team.properties['description'] === 'string'
241
- ? team.properties['description']
242
- : '';
240
+ const description = typeof team.properties['description'] === 'string' ? team.properties['description'] : '';
243
241
  lines.push(`- **${team.name}** (orchestrator: ${orchestrator})`);
244
242
  if (description.length > 0) {
245
243
  lines.push(` ${description.trim()}`);
@@ -251,9 +249,7 @@ function renderBundleSystemPrompt(bundle) {
251
249
  lines.push('### Tools');
252
250
  lines.push('');
253
251
  for (const tool of bundle.tools) {
254
- const description = typeof tool.properties['description'] === 'string'
255
- ? tool.properties['description']
256
- : '';
252
+ const description = typeof tool.properties['description'] === 'string' ? tool.properties['description'] : '';
257
253
  lines.push(`- **${tool.name}**`);
258
254
  if (description.length > 0) {
259
255
  lines.push(` ${description.trim()}`);
@@ -262,7 +258,7 @@ function renderBundleSystemPrompt(bundle) {
262
258
  lines.push('');
263
259
  }
264
260
  if (!bundle.valid && bundle.diagnostics.length > 0) {
265
- const errorCount = bundle.diagnostics.filter(d => d.severity === 'error').length;
261
+ const errorCount = bundle.diagnostics.filter((d) => d.severity === 'error').length;
266
262
  if (errorCount > 0) {
267
263
  lines.push(`> **Warning**: ${errorCount} validation error(s) found across .cant files.`);
268
264
  lines.push('');
@@ -336,7 +332,7 @@ async function compileBundle(filePaths) {
336
332
  allValid = false;
337
333
  continue;
338
334
  }
339
- // Convert parse errors to bundle diagnostics
335
+ // Convert parse errors to bundle diagnostics (preserving line/col from the native binding)
340
336
  if (!parseResult.success) {
341
337
  for (const err of parseResult.errors) {
342
338
  fileDiagnostics.push({
@@ -344,6 +340,8 @@ async function compileBundle(filePaths) {
344
340
  message: err.message,
345
341
  severity: err.severity,
346
342
  sourcePath: filePath,
343
+ line: err.line,
344
+ col: err.col,
347
345
  });
348
346
  }
349
347
  allValid = false;
@@ -380,13 +378,15 @@ async function compileBundle(filePaths) {
380
378
  allValid = false;
381
379
  continue;
382
380
  }
383
- // Convert validation diagnostics
381
+ // Convert validation diagnostics (preserving line/col from the native binding)
384
382
  for (const diag of validationResult.diagnostics) {
385
383
  fileDiagnostics.push({
386
384
  ruleId: diag.ruleId,
387
385
  message: diag.message,
388
386
  severity: diag.severity,
389
387
  sourcePath: filePath,
388
+ line: diag.line,
389
+ col: diag.col,
390
390
  });
391
391
  }
392
392
  if (!validationResult.valid) {
package/dist/worktree.js CHANGED
@@ -15,8 +15,8 @@ exports.mergeWorktree = mergeWorktree;
15
15
  exports.listWorktrees = listWorktrees;
16
16
  const node_child_process_1 = require("node:child_process");
17
17
  const node_fs_1 = require("node:fs");
18
- const node_path_1 = require("node:path");
19
18
  const node_os_1 = require("node:os");
19
+ const node_path_1 = require("node:path");
20
20
  /**
21
21
  * Resolve the worktree root directory.
22
22
  *
@@ -67,7 +67,10 @@ function createWorktree(request, config) {
67
67
  }
68
68
  }
69
69
  // Create the worktree
70
- (0, node_child_process_1.execSync)(`git worktree add "${worktreePath}" -b "${branch}" "${request.baseRef}"`, { cwd: config.gitRoot, stdio: 'pipe' });
70
+ (0, node_child_process_1.execSync)(`git worktree add "${worktreePath}" -b "${branch}" "${request.baseRef}"`, {
71
+ cwd: config.gitRoot,
72
+ stdio: 'pipe',
73
+ });
71
74
  return buildHandle(worktreePath, branch, request.baseRef, request.taskId, config.gitRoot);
72
75
  }
73
76
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleocode/cant",
3
- "version": "2026.4.13",
3
+ "version": "2026.4.15",
4
4
  "description": "CANT protocol parser and runtime for CLEO — wraps cant-core via napi-rs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,12 +9,12 @@
9
9
  "napi/"
10
10
  ],
11
11
  "dependencies": {
12
- "@cleocode/contracts": "2026.4.13",
13
- "@cleocode/lafs": "2026.4.13"
12
+ "@cleocode/lafs": "2026.4.15",
13
+ "@cleocode/contracts": "2026.4.15"
14
14
  },
15
15
  "devDependencies": {
16
- "typescript": "^5.0.0",
17
- "vitest": "^1.0.0"
16
+ "typescript": "^6.0.2",
17
+ "vitest": "^4.1.4"
18
18
  },
19
19
  "napi": {
20
20
  "name": "cant",