carrick 0.3.116 → 0.3.118

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.
Files changed (42) hide show
  1. package/dist/contract.d.ts +2 -0
  2. package/dist/contract.js.map +1 -1
  3. package/dist/render.js +2 -1
  4. package/dist/render.js.map +1 -1
  5. package/package.json +6 -6
  6. package/plugin/.claude-plugin/plugin.json +1 -1
  7. package/sidecar/dist/src/capture/anchors.d.ts +1 -0
  8. package/sidecar/dist/src/capture/anchors.js +1 -1
  9. package/sidecar/dist/src/capture/api.d.ts +6 -0
  10. package/sidecar/dist/src/capture/check-classify.js +25 -0
  11. package/sidecar/dist/src/capture/check-probe.d.ts +1 -1
  12. package/sidecar/dist/src/capture/check-probe.js +20 -0
  13. package/sidecar/dist/src/capture/checkout.d.ts +3 -0
  14. package/sidecar/dist/src/capture/checkout.js +1 -1
  15. package/sidecar/dist/src/capture/deep-walk.d.ts +10 -0
  16. package/sidecar/dist/src/capture/deep-walk.js +15 -0
  17. package/sidecar/dist/src/capture/guarded-fs.d.ts +6 -0
  18. package/sidecar/dist/src/capture/guarded-fs.js +10 -0
  19. package/sidecar/dist/src/capture/index.d.ts +5 -0
  20. package/sidecar/dist/src/capture/index.js +62 -7
  21. package/sidecar/dist/src/capture/project-references.d.ts +24 -13
  22. package/sidecar/dist/src/capture/project-references.js +53 -16
  23. package/sidecar/dist/src/capture/reference-redirect.d.ts +84 -0
  24. package/sidecar/dist/src/capture/reference-redirect.js +209 -0
  25. package/sidecar/dist/src/capture/unresolved.d.ts +8 -0
  26. package/sidecar/dist/src/capture/unresolved.js +18 -2
  27. package/sidecar/dist/src/declaration-attribution.d.ts +40 -0
  28. package/sidecar/dist/src/declaration-attribution.js +66 -0
  29. package/sidecar/dist/src/index.js +37 -0
  30. package/sidecar/dist/src/library-claims.js +234 -23
  31. package/sidecar/dist/src/module-format.d.ts +19 -1
  32. package/sidecar/dist/src/module-format.js +9 -2
  33. package/sidecar/dist/src/position-rows.d.ts +95 -0
  34. package/sidecar/dist/src/position-rows.js +844 -0
  35. package/sidecar/dist/src/project-loader.d.ts +36 -7
  36. package/sidecar/dist/src/project-loader.js +70 -28
  37. package/sidecar/dist/src/retype.js +13 -0
  38. package/sidecar/dist/src/type-inferrer.d.ts +25 -29
  39. package/sidecar/dist/src/type-inferrer.js +119 -70
  40. package/sidecar/dist/src/types.d.ts +78 -2
  41. package/sidecar/dist/src/validators.d.ts +431 -30
  42. package/sidecar/dist/src/validators.js +45 -1
@@ -219,12 +219,24 @@ const CheckPairEndpointSchema = z.object({
219
219
  service_name: z.string().min(1),
220
220
  alias: z.string().min(1),
221
221
  });
222
- const CheckPairSpecSchema = z.object({
222
+ const CheckPairSpecSchema = z
223
+ .object({
223
224
  pair_key: z.string().min(1),
224
225
  protocol: z.enum(['http', 'graphql', 'socket', 'pubsub']),
225
226
  type_kind: z.enum(['request', 'response', 'both']),
226
227
  producer: CheckPairEndpointSchema,
227
228
  consumer: CheckPairEndpointSchema,
229
+ topic: z.string().min(1).optional(),
230
+ })
231
+ .superRefine((spec, ctx) => {
232
+ // carrick#1979: the topic is the pub/sub operation's own key. It is
233
+ // required there and refused elsewhere, so zod can never strip a stray one.
234
+ if (spec.protocol === 'pubsub' && spec.topic === undefined) {
235
+ ctx.addIssue({ code: 'custom', path: ['topic'], message: 'A pubsub pair requires a topic' });
236
+ }
237
+ if (spec.protocol !== 'pubsub' && spec.topic !== undefined) {
238
+ ctx.addIssue({ code: 'custom', path: ['topic'], message: 'Only a pubsub pair carries a topic' });
239
+ }
228
240
  });
229
241
  export const CheckV2RequestSchema = BaseRequestSchema.extend({
230
242
  action: z.literal('check_v2'),
@@ -258,6 +270,13 @@ export const AddProgramFilesRequestSchema = BaseRequestSchema.extend({
258
270
  action: z.literal('add_program_files'),
259
271
  files: z.array(z.string().min(1, 'File path cannot be empty')),
260
272
  });
273
+ export const PositionRowsRequestSchema = BaseRequestSchema.extend({
274
+ action: z.literal('position_rows'),
275
+ files: z.array(z.string().min(1, 'File path cannot be empty')),
276
+ scan_root: z.string().min(1, 'Scan root cannot be empty'),
277
+ out_path: z.string().min(1, 'Out path cannot be empty'),
278
+ service: z.string(),
279
+ });
261
280
  export const ResolveDefinitionsRequestSchema = BaseRequestSchema.extend({
262
281
  action: z.literal('resolve_definitions'),
263
282
  stub_dir: z.string().min(1, 'Stub dir cannot be empty'),
@@ -337,6 +356,25 @@ const ClaimSlotSchema = z
337
356
  })
338
357
  .strict();
339
358
  const BoundNameSchema = z.object({ bound: z.enum(['maker', 'scope']) }).strict();
359
+ /**
360
+ * Label structure v2 (carrick#2434). The schema takes the shape only: which
361
+ * method word, side or export a field names is the verifier's per-check
362
+ * verdict, since one element this schema refuses fails the whole request.
363
+ */
364
+ const RunsSlotSchema = z
365
+ .object({
366
+ arg: z.number().int().nonnegative(),
367
+ key: z.string().min(1).optional(),
368
+ bound: z.literal('maker').optional(),
369
+ })
370
+ .strict();
371
+ const YieldsSchema = z
372
+ .object({
373
+ param: z.number().int().nonnegative(),
374
+ export: z.string().min(1),
375
+ side: z.string().min(1),
376
+ })
377
+ .strict();
340
378
  const ClaimOnSchema = z.enum(['export', 'instance', 'both']);
341
379
  const MemberPathSchema = z.array(z.string().min(1));
342
380
  const KeyLabelsSchema = z.record(z.string().min(1), z.enum(['name', 'not_name']));
@@ -360,6 +398,7 @@ const LibraryClaimSchema = z.discriminatedUnion('kind', [
360
398
  prefix: ClaimSlotSchema.optional(),
361
399
  name: ClaimSlotSchema.optional(),
362
400
  handler: ClaimSlotSchema.optional(),
401
+ runs: ClaimSlotSchema.optional(),
363
402
  key_labels: KeyLabelsSchema.optional(),
364
403
  name_scope: NameScopeSchema.optional(),
365
404
  picker: z.string().optional(),
@@ -396,6 +435,10 @@ const LibraryClaimSchema = z.discriminatedUnion('kind', [
396
435
  options: ClaimSlotSchema.optional(),
397
436
  method: z.string().min(1).optional(),
398
437
  method_key: ClaimSlotSchema.optional(),
438
+ method_default: z.string().min(1).optional(),
439
+ base: ClaimSlotSchema.optional(),
440
+ runs: RunsSlotSchema.optional(),
441
+ yields: YieldsSchema.optional(),
399
442
  })
400
443
  .strict(),
401
444
  z
@@ -464,6 +507,7 @@ export const SidecarRequestSchema = z.discriminatedUnion('action', [
464
507
  ShutdownRequestSchema,
465
508
  ListProgramFilesRequestSchema,
466
509
  AddProgramFilesRequestSchema,
510
+ PositionRowsRequestSchema,
467
511
  ]);
468
512
  /**
469
513
  * Validates and parses incoming JSON into a typed SidecarRequest