invar-tools 1.15.2__py3-none-any.whl → 1.15.3__py3-none-any.whl

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.
@@ -69,18 +69,24 @@ const factory: CustomToolFactory = (pi) => {
69
69
  const cmd = await resolveInvarCommand();
70
70
  const args = [...cmd.args, "guard"];
71
71
 
72
+ // Handle optional parameters with defaults
73
+ const changed = params.changed ?? true;
74
+ const contractsOnly = params.contracts_only ?? false;
75
+ const coverage = params.coverage ?? false;
76
+ const strict = params.strict ?? false;
77
+
72
78
  // Default is --changed (check modified files)
73
- if (params.changed === false) {
79
+ if (changed === false) {
74
80
  args.push("--all");
75
81
  }
76
82
 
77
- if (params.contracts_only) {
83
+ if (contractsOnly) {
78
84
  args.push("-c");
79
85
  }
80
- if (params.coverage) {
86
+ if (coverage) {
81
87
  args.push("--coverage");
82
88
  }
83
- if (params.strict) {
89
+ if (strict) {
84
90
  args.push("--strict");
85
91
  }
86
92
 
@@ -117,6 +123,11 @@ const factory: CustomToolFactory = (pi) => {
117
123
  async execute(toolCallId, params, onUpdate, ctx, signal) {
118
124
  const cmd = await resolveInvarCommand();
119
125
 
126
+ // Validate required parameter
127
+ if (!params.target) {
128
+ throw new Error("Missing required parameter: target (file path or file::symbol)");
129
+ }
130
+
120
131
  if (!isValidPath(params.target)) {
121
132
  throw new Error("Invalid target path: contains unsafe characters or path traversal");
122
133
  }
@@ -163,19 +174,21 @@ const factory: CustomToolFactory = (pi) => {
163
174
  async execute(toolCallId, params, onUpdate, ctx, signal) {
164
175
  const cmd = await resolveInvarCommand();
165
176
 
166
- if (params.path && params.path !== "." && !isValidPath(params.path)) {
177
+ // Handle optional parameters with defaults
178
+ const targetPath = params.path ?? ".";
179
+ const topN = params.top ?? 10;
180
+
181
+ if (targetPath !== "." && !isValidPath(targetPath)) {
167
182
  throw new Error("Invalid path: contains unsafe characters or path traversal");
168
183
  }
169
184
 
170
185
  const args = [...cmd.args, "map"];
171
186
 
172
- if (params.path && params.path !== ".") {
173
- args.push(params.path);
187
+ if (targetPath !== ".") {
188
+ args.push(targetPath);
174
189
  }
175
190
 
176
- if (params.top) {
177
- args.push("--top", params.top.toString());
178
- }
191
+ args.push("--top", topN.toString());
179
192
 
180
193
  const result = await pi.exec(cmd.command, args, {
181
194
  cwd: pi.cwd,
@@ -193,8 +206,8 @@ const factory: CustomToolFactory = (pi) => {
193
206
  return {
194
207
  content: [{ type: "text", text: result.stdout }],
195
208
  details: {
196
- path: params.path || ".",
197
- top: params.top || 10,
209
+ path: targetPath,
210
+ top: topN,
198
211
  },
199
212
  };
200
213
  },
@@ -221,14 +234,22 @@ const factory: CustomToolFactory = (pi) => {
221
234
  async execute(toolCallId, params, onUpdate, ctx, signal) {
222
235
  const cmd = await resolveInvarCommand();
223
236
 
237
+ // Validate required parameter
238
+ if (!params.file) {
239
+ throw new Error("Missing required parameter: file (markdown file path)");
240
+ }
241
+
224
242
  if (!isValidPath(params.file)) {
225
243
  throw new Error("Invalid file path: contains unsafe characters or path traversal");
226
244
  }
227
245
 
246
+ // Handle optional parameter with default
247
+ const maxDepth = params.depth ?? 6;
248
+
228
249
  const args = [...cmd.args, "doc", "toc", params.file];
229
250
 
230
- if (params.depth && params.depth !== 6) {
231
- args.push("--depth", params.depth.toString());
251
+ if (maxDepth !== 6) {
252
+ args.push("--depth", maxDepth.toString());
232
253
  }
233
254
 
234
255
  const result = await pi.exec(cmd.command, args, {
@@ -248,7 +269,7 @@ const factory: CustomToolFactory = (pi) => {
248
269
  content: [{ type: "text", text: result.stdout }],
249
270
  details: {
250
271
  file: params.file,
251
- depth: params.depth || 6,
272
+ depth: maxDepth,
252
273
  },
253
274
  };
254
275
  },
@@ -276,13 +297,24 @@ const factory: CustomToolFactory = (pi) => {
276
297
  async execute(toolCallId, params, onUpdate, ctx, signal) {
277
298
  const cmd = await resolveInvarCommand();
278
299
 
300
+ // Validate required parameters
301
+ if (!params.file) {
302
+ throw new Error("Missing required parameter: file (markdown file path)");
303
+ }
304
+ if (!params.section) {
305
+ throw new Error("Missing required parameter: section (section path or identifier)");
306
+ }
307
+
279
308
  if (!isValidPath(params.file) || !isValidPath(params.section)) {
280
309
  throw new Error("Invalid file or section path: contains unsafe characters or path traversal");
281
310
  }
282
311
 
312
+ // Handle optional parameter with default
313
+ const includeChildren = params.children ?? true;
314
+
283
315
  const args = [...cmd.args, "doc", "read", params.file, params.section, "--json"];
284
316
 
285
- if (params.children === false) {
317
+ if (includeChildren === false) {
286
318
  args.push("--no-children");
287
319
  }
288
320
 
@@ -335,12 +367,21 @@ const factory: CustomToolFactory = (pi) => {
335
367
  async execute(toolCallId, params, onUpdate, ctx, signal) {
336
368
  const cmd = await resolveInvarCommand();
337
369
 
370
+ // Validate required parameters
371
+ if (!params.file) {
372
+ throw new Error("Missing required parameter: file (markdown file path)");
373
+ }
374
+ if (!params.pattern) {
375
+ throw new Error("Missing required parameter: pattern (glob pattern for section titles)");
376
+ }
377
+
338
378
  if (!isValidPath(params.file)) {
339
379
  throw new Error("Invalid file path: contains unsafe characters or path traversal");
340
380
  }
341
381
 
342
382
  const args = [...cmd.args, "doc", "find", params.pattern, params.file, "--json"];
343
383
 
384
+ // Handle optional parameters
344
385
  if (params.content) {
345
386
  args.push("--content", params.content);
346
387
  }
@@ -397,10 +438,24 @@ const factory: CustomToolFactory = (pi) => {
397
438
  async execute(toolCallId, params, onUpdate, ctx, signal) {
398
439
  const cmd = await resolveInvarCommand();
399
440
 
441
+ // Validate required parameters
442
+ if (!params.file) {
443
+ throw new Error("Missing required parameter: file (markdown file path)");
444
+ }
445
+ if (!params.section) {
446
+ throw new Error("Missing required parameter: section (section path or identifier)");
447
+ }
448
+ if (!params.content) {
449
+ throw new Error("Missing required parameter: content (new content for section)");
450
+ }
451
+
400
452
  if (!isValidPath(params.file) || !isValidPath(params.section)) {
401
453
  throw new Error("Invalid file or section path: contains unsafe characters or path traversal");
402
454
  }
403
455
 
456
+ // Handle optional parameter with default
457
+ const keepHeading = params.keep_heading ?? true;
458
+
404
459
  // Write content to temporary file to avoid shell injection
405
460
  const tmpFile = path.join(pi.cwd, `.invar-tmp-${Date.now()}.txt`);
406
461
 
@@ -417,7 +472,7 @@ const factory: CustomToolFactory = (pi) => {
417
472
  tmpFile,
418
473
  ];
419
474
 
420
- if (params.keep_heading === false) {
475
+ if (keepHeading === false) {
421
476
  args.push("--no-keep-heading");
422
477
  }
423
478
 
@@ -478,10 +533,24 @@ const factory: CustomToolFactory = (pi) => {
478
533
  async execute(toolCallId, params, onUpdate, ctx, signal) {
479
534
  const cmd = await resolveInvarCommand();
480
535
 
536
+ // Validate required parameters
537
+ if (!params.file) {
538
+ throw new Error("Missing required parameter: file (markdown file path)");
539
+ }
540
+ if (!params.anchor) {
541
+ throw new Error("Missing required parameter: anchor (section path for insertion point)");
542
+ }
543
+ if (!params.content) {
544
+ throw new Error("Missing required parameter: content (content to insert)");
545
+ }
546
+
481
547
  if (!isValidPath(params.file) || !isValidPath(params.anchor)) {
482
548
  throw new Error("Invalid file or anchor path: contains unsafe characters or path traversal");
483
549
  }
484
550
 
551
+ // Handle optional parameter with default
552
+ const position = params.position ?? "after";
553
+
485
554
  // Write content to temporary file
486
555
  const tmpFile = path.join(pi.cwd, `.invar-tmp-${Date.now()}.txt`);
487
556
 
@@ -498,8 +567,8 @@ const factory: CustomToolFactory = (pi) => {
498
567
  tmpFile,
499
568
  ];
500
569
 
501
- if (params.position && params.position !== "after") {
502
- args.push("--position", params.position);
570
+ if (position !== "after") {
571
+ args.push("--position", position);
503
572
  }
504
573
 
505
574
  const result = await pi.exec(cmd.command, args, {
@@ -556,13 +625,24 @@ const factory: CustomToolFactory = (pi) => {
556
625
  async execute(toolCallId, params, onUpdate, ctx, signal) {
557
626
  const cmd = await resolveInvarCommand();
558
627
 
628
+ // Validate required parameters
629
+ if (!params.file) {
630
+ throw new Error("Missing required parameter: file (markdown file path)");
631
+ }
632
+ if (!params.section) {
633
+ throw new Error("Missing required parameter: section (section path or identifier)");
634
+ }
635
+
559
636
  if (!isValidPath(params.file) || !isValidPath(params.section)) {
560
637
  throw new Error("Invalid file or section path: contains unsafe characters or path traversal");
561
638
  }
562
639
 
640
+ // Handle optional parameter with default
641
+ const includeChildren = params.children ?? true;
642
+
563
643
  const args = [...cmd.args, "doc", "delete", params.file, params.section];
564
644
 
565
- if (params.children === false) {
645
+ if (includeChildren === false) {
566
646
  args.push("--no-children");
567
647
  }
568
648
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: invar-tools
3
- Version: 1.15.2
3
+ Version: 1.15.3
4
4
  Summary: AI-native software engineering tools with design-by-contract verification
5
5
  Project-URL: Homepage, https://github.com/tefx/invar
6
6
  Project-URL: Documentation, https://github.com/tefx/invar#readme
@@ -143,7 +143,7 @@ invar/templates/onboard/assessment.md.jinja,sha256=EzqF0VUcxJZG2bVJLxTOyQlAERRbh
143
143
  invar/templates/onboard/roadmap.md.jinja,sha256=gmvZk4Hdwe0l3qSFV15QGcsr-OPMhsc6-1K9F2SFSIQ,3939
144
144
  invar/templates/onboard/patterns/python.md,sha256=3wwucAcQz0DlggtpqYo-ZCnmrXgBQ0aBgUHN_EZ1VW0,8681
145
145
  invar/templates/onboard/patterns/typescript.md,sha256=yOVfHtdAdjKkWNh66_dR7z2xEA4sggbIcCKthW-fqac,11983
146
- invar/templates/pi-tools/invar/index.ts,sha256=tl2SZsbfYcTq7Zpk5T9gFxRtCE_PaFYVWi_GNHiaKzY,19722
146
+ invar/templates/pi-tools/invar/index.ts,sha256=7xonqiDDUtY09gjRzxet-Xr7_Dxl1AfB0xqiUmBFeKE,22581
147
147
  invar/templates/protocol/INVAR.md.jinja,sha256=t2ZIQZJvzDTJMrRw_ijUo6ScZmeNK0-nV-H7ztTIyQQ,1464
148
148
  invar/templates/protocol/python/architecture-examples.md,sha256=O96LH9WFpk7G9MrhSbifLS5pyibTIDG-_EGFF7g3V4M,1175
149
149
  invar/templates/protocol/python/contracts-syntax.md,sha256=Q6supTQ3tChVrlN7xhcdb3Q8VGIESxQLA-mQvrNIZmo,1162
@@ -181,10 +181,10 @@ invar/templates/skills/invar-reflect/template.md,sha256=Rr5hvbllvmd8jSLf_0ZjyKt6
181
181
  invar/templates/skills/investigate/SKILL.md.jinja,sha256=cp6TBEixBYh1rLeeHOR1yqEnFqv1NZYePORMnavLkQI,3231
182
182
  invar/templates/skills/propose/SKILL.md.jinja,sha256=6BuKiCqO1AEu3VtzMHy1QWGqr_xqG9eJlhbsKT4jev4,3463
183
183
  invar/templates/skills/review/SKILL.md.jinja,sha256=ET5mbdSe_eKgJbi2LbgFC-z1aviKcHOBw7J5Q28fr4U,14105
184
- invar_tools-1.15.2.dist-info/METADATA,sha256=hv_0ypXK9ZqotnGr7Ndo191bIKmZw-bA4sGeXpTgmwI,28595
185
- invar_tools-1.15.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
186
- invar_tools-1.15.2.dist-info/entry_points.txt,sha256=RwH_EhqgtFPsnO6RcrwrAb70Zyfb8Mh6uUtztWnUxGk,102
187
- invar_tools-1.15.2.dist-info/licenses/LICENSE,sha256=qeFksp4H4kfTgQxPCIu3OdagXyiZcgBlVfsQ6M5oFyk,10767
188
- invar_tools-1.15.2.dist-info/licenses/LICENSE-GPL,sha256=IvZfC6ZbP7CLjytoHVzvpDZpD-Z3R_qa1GdMdWlWQ6Q,35157
189
- invar_tools-1.15.2.dist-info/licenses/NOTICE,sha256=joEyMyFhFY8Vd8tTJ-a3SirI0m2Sd0WjzqYt3sdcglc,2561
190
- invar_tools-1.15.2.dist-info/RECORD,,
184
+ invar_tools-1.15.3.dist-info/METADATA,sha256=8cn5xZHmi9QvgHc1iPzFdol25Q302gRncWutGH6_ZgQ,28595
185
+ invar_tools-1.15.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
186
+ invar_tools-1.15.3.dist-info/entry_points.txt,sha256=RwH_EhqgtFPsnO6RcrwrAb70Zyfb8Mh6uUtztWnUxGk,102
187
+ invar_tools-1.15.3.dist-info/licenses/LICENSE,sha256=qeFksp4H4kfTgQxPCIu3OdagXyiZcgBlVfsQ6M5oFyk,10767
188
+ invar_tools-1.15.3.dist-info/licenses/LICENSE-GPL,sha256=IvZfC6ZbP7CLjytoHVzvpDZpD-Z3R_qa1GdMdWlWQ6Q,35157
189
+ invar_tools-1.15.3.dist-info/licenses/NOTICE,sha256=joEyMyFhFY8Vd8tTJ-a3SirI0m2Sd0WjzqYt3sdcglc,2561
190
+ invar_tools-1.15.3.dist-info/RECORD,,