carrick 0.3.102 → 0.3.104

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 (45) hide show
  1. package/package.json +6 -6
  2. package/plugin/.claude-plugin/plugin.json +1 -1
  3. package/sidecar/dist/src/bundler.d.ts +3 -92
  4. package/sidecar/dist/src/bundler.js +5 -265
  5. package/sidecar/dist/src/capture/anchors.js +113 -8
  6. package/sidecar/dist/src/capture/api.d.ts +6 -0
  7. package/sidecar/dist/src/capture/check-classify.js +27 -0
  8. package/sidecar/dist/src/capture/check-fields.js +19 -5
  9. package/sidecar/dist/src/capture/check-probe.d.ts +6 -1
  10. package/sidecar/dist/src/capture/check-probe.js +45 -2
  11. package/sidecar/dist/src/capture/check-workspace.d.ts +3 -0
  12. package/sidecar/dist/src/capture/check-workspace.js +13 -16
  13. package/sidecar/dist/src/capture/check.js +5 -5
  14. package/sidecar/dist/src/capture/deep-walk.js +45 -12
  15. package/sidecar/dist/src/capture/deno-project.d.ts +2 -1
  16. package/sidecar/dist/src/capture/deno-project.js +22 -18
  17. package/sidecar/dist/src/capture/guarded-fs.d.ts +76 -0
  18. package/sidecar/dist/src/capture/guarded-fs.js +182 -0
  19. package/sidecar/dist/src/capture/index.d.ts +1 -0
  20. package/sidecar/dist/src/capture/index.js +65 -27
  21. package/sidecar/dist/src/capture/outside-root.d.ts +41 -0
  22. package/sidecar/dist/src/capture/outside-root.js +101 -0
  23. package/sidecar/dist/src/capture/paths-rewrite.d.ts +8 -0
  24. package/sidecar/dist/src/capture/paths-rewrite.js +9 -7
  25. package/sidecar/dist/src/capture/repair-dangling.d.ts +11 -1
  26. package/sidecar/dist/src/capture/repair-dangling.js +15 -4
  27. package/sidecar/dist/src/capture/self-check.d.ts +3 -0
  28. package/sidecar/dist/src/capture/self-check.js +3 -3
  29. package/sidecar/dist/src/capture/service-config.d.ts +19 -0
  30. package/sidecar/dist/src/capture/service-config.js +57 -0
  31. package/sidecar/dist/src/index.d.ts +1 -1
  32. package/sidecar/dist/src/index.js +4 -115
  33. package/sidecar/dist/src/origin.d.ts +49 -8
  34. package/sidecar/dist/src/origin.js +81 -8
  35. package/sidecar/dist/src/project-loader.d.ts +10 -2
  36. package/sidecar/dist/src/project-loader.js +22 -21
  37. package/sidecar/dist/src/type-inferrer.d.ts +72 -0
  38. package/sidecar/dist/src/type-inferrer.js +248 -8
  39. package/sidecar/dist/src/type-structural-expander.d.ts +5 -1
  40. package/sidecar/dist/src/type-structural-expander.js +1 -1
  41. package/sidecar/dist/src/types.d.ts +39 -178
  42. package/sidecar/dist/src/validators.d.ts +70 -914
  43. package/sidecar/dist/src/validators.js +2 -55
  44. package/sidecar/dist/src/monorepo-builder.d.ts +0 -129
  45. package/sidecar/dist/src/monorepo-builder.js +0 -584
@@ -61,16 +61,6 @@ const TsconfigSnapshotSchema = z.object({
61
61
  // ============================================================================
62
62
  const PinnedDependencySnapshotSchema = z.record(z.string());
63
63
  // ============================================================================
64
- // Repo Metadata Schema
65
- // ============================================================================
66
- const RepoMetadataSchema = z.object({
67
- repoName: z.string().min(1, 'Repo name cannot be empty'),
68
- dependencies: PinnedDependencySnapshotSchema,
69
- tsconfig: TsconfigSnapshotSchema,
70
- extractionConfig: ExtractionConfigSchema.optional(),
71
- surfaceContent: z.string().optional(),
72
- });
73
- // ============================================================================
74
64
  // Symbol Request Schema
75
65
  // ============================================================================
76
66
  export const SymbolRequestSchema = z.object({
@@ -137,32 +127,6 @@ export function validateInferRequestItem(item) {
137
127
  return null;
138
128
  }
139
129
  // ============================================================================
140
- // Payload Definition Schema (New)
141
- // ============================================================================
142
- const SourceLocationSchema = z.object({
143
- file_path: z.string(),
144
- start_line: z.number(),
145
- end_line: z.number(),
146
- start_column: z.number().optional(),
147
- end_column: z.number().optional(),
148
- });
149
- const PayloadDefinitionSchema = z.object({
150
- alias: z.string().min(1, 'Alias cannot be empty'),
151
- type_string: z.string().min(1, 'Type string cannot be empty'),
152
- source_file: z.string().optional(),
153
- source_location: SourceLocationSchema.optional(),
154
- });
155
- // ============================================================================
156
- // Compatibility Check Schema (New)
157
- // ============================================================================
158
- const CompatibilityCheckSchema = z.object({
159
- source_repo: z.string().min(1, 'Source repo cannot be empty'),
160
- source_alias: z.string().min(1, 'Source alias cannot be empty'),
161
- target_repo: z.string().min(1, 'Target repo cannot be empty'),
162
- target_alias: z.string().min(1, 'Target alias cannot be empty'),
163
- direction: z.enum(['source_extends_target', 'target_extends_source', 'bidirectional']),
164
- });
165
- // ============================================================================
166
130
  // Action-specific Request Schemas
167
131
  // ============================================================================
168
132
  const BaseRequestSchema = z.object({
@@ -172,6 +136,7 @@ export const InitRequestSchema = BaseRequestSchema.extend({
172
136
  action: z.literal('init'),
173
137
  repo_root: z.string().min(1, 'Repo root cannot be empty'),
174
138
  tsconfig_path: z.string().optional(),
139
+ scan_root: z.string().min(1).optional(),
175
140
  tsconfig_snapshot: TsconfigSnapshotSchema.optional(),
176
141
  pinned_dependencies: PinnedDependencySnapshotSchema.optional(),
177
142
  });
@@ -179,12 +144,6 @@ export const BundleRequestSchema = BaseRequestSchema.extend({
179
144
  action: z.literal('bundle'),
180
145
  symbols: z.array(SymbolRequestSchema).min(1, 'At least one symbol is required'),
181
146
  });
182
- export const EmitSurfaceRequestSchema = BaseRequestSchema.extend({
183
- action: z.literal('emit_surface'),
184
- repo_name: z.string().min(1, 'Repo name cannot be empty'),
185
- payloads: z.array(PayloadDefinitionSchema).min(1, 'At least one payload is required'),
186
- output_path: z.string().min(1, 'Output path cannot be empty'),
187
- });
188
147
  /** v2 "tsc as serializer" capture (contract in ./capture/api.ts). */
189
148
  const AnchorOriginSchema = z.enum([
190
149
  'llm-symbol',
@@ -234,6 +193,7 @@ export const CaptureV2RequestSchema = BaseRequestSchema.extend({
234
193
  anchors: z.array(CaptureAnchorRequestSchema).min(1, 'At least one anchor is required'),
235
194
  out_dir: z.string().min(1, 'Output dir cannot be empty'),
236
195
  tsconfig_path: z.string().optional(),
196
+ scan_root: z.string().min(1).optional(),
237
197
  });
238
198
  const CheckStubInputSchema = z.object({
239
199
  service_name: z.string().min(1),
@@ -262,16 +222,6 @@ export const InferRequestSchema = BaseRequestSchema.extend({
262
222
  requests: z.array(InferRequestItemSchema).min(1, 'At least one infer request is required'),
263
223
  extraction_config: ExtractionConfigSchema.optional(),
264
224
  });
265
- export const BuildWorkspaceRequestSchema = BaseRequestSchema.extend({
266
- action: z.literal('build_workspace'),
267
- repos: z.array(RepoMetadataSchema).min(1, 'At least one repo is required'),
268
- workspace_root: z.string().optional(),
269
- });
270
- export const CheckCompatibilityRequestSchema = BaseRequestSchema.extend({
271
- action: z.literal('check_compatibility'),
272
- workspace_root: z.string().min(1, 'Workspace root cannot be empty'),
273
- checks: z.array(CompatibilityCheckSchema).min(1, 'At least one check is required'),
274
- });
275
225
  export const HealthRequestSchema = BaseRequestSchema.extend({
276
226
  action: z.literal('health'),
277
227
  });
@@ -472,12 +422,9 @@ export const ListLibrarySurfaceRequestSchema = BaseRequestSchema.extend({
472
422
  export const SidecarRequestSchema = z.discriminatedUnion('action', [
473
423
  InitRequestSchema,
474
424
  BundleRequestSchema,
475
- EmitSurfaceRequestSchema,
476
425
  CaptureV2RequestSchema,
477
426
  CheckV2RequestSchema,
478
427
  InferRequestSchema,
479
- BuildWorkspaceRequestSchema,
480
- CheckCompatibilityRequestSchema,
481
428
  ResolveDefinitionsRequestSchema,
482
429
  RetypeCheckRequestSchema,
483
430
  VerifyClientSemanticsRequestSchema,
@@ -1,129 +0,0 @@
1
- /**
2
- * Monorepo Builder - Builds synthetic monorepo workspaces for type compatibility checking
3
- *
4
- * This module implements the "Synthetic Monorepo (Stub Snapshot)" architecture:
5
- * - Creates a workspace with stub packages for each repo
6
- * - Each stub package has its own isolated node_modules with pinned dependencies
7
- * - Generates path mappings so @carrick/{repoName}/{spec} resolves correctly
8
- * - Creates a checker package that imports surfaces and asserts type compatibility
9
- *
10
- * Key design decisions:
11
- * - Uses pnpm for better isolation between packages
12
- * - Does NOT copy full repos - only uses captured artifacts
13
- * - Deterministic: uses pinned dependency snapshots
14
- */
15
- import type { RepoMetadata, WorkspaceBuildResult, CompatibilityCheck, CompatibilityCheckResult } from './types.js';
16
- /**
17
- * MonorepoBuilder - Creates synthetic workspaces for cross-repo type checking
18
- *
19
- * Usage:
20
- * const builder = new MonorepoBuilder();
21
- * const result = builder.build(repos);
22
- * const checkResult = builder.checkCompatibility(workspacePath, checks);
23
- */
24
- export declare class MonorepoBuilder {
25
- /**
26
- * Build the synthetic monorepo workspace
27
- *
28
- * @param repos - Metadata for each repository to include
29
- * @param workspaceRoot - Root directory for the workspace (defaults to .carrick/workspace)
30
- * @returns WorkspaceBuildResult
31
- */
32
- build(repos: RepoMetadata[], workspaceRoot?: string): WorkspaceBuildResult;
33
- /**
34
- * Run type compatibility checks in the workspace
35
- *
36
- * @param workspaceRoot - Path to the workspace root
37
- * @param checks - Compatibility checks to run
38
- * @returns CompatibilityCheckResult
39
- */
40
- checkCompatibility(workspaceRoot: string, checks: CompatibilityCheck[]): CompatibilityCheckResult;
41
- /**
42
- * Ensure a clean directory exists at the given path
43
- */
44
- private ensureCleanDirectory;
45
- /**
46
- * Create the root package.json for the workspace
47
- */
48
- private createRootPackageJson;
49
- /**
50
- * Create pnpm-workspace.yaml
51
- */
52
- private createPnpmWorkspaceYaml;
53
- /**
54
- * Create .npmrc to prevent hoisting that would blur package boundaries
55
- */
56
- private createNpmrc;
57
- /**
58
- * Create a stub package for a repository
59
- *
60
- * @returns Path to the created package
61
- */
62
- private createStubPackage;
63
- /**
64
- * Create package.json for a stub package
65
- */
66
- private createStubPackageJson;
67
- /**
68
- * Create tsconfig.json for a stub package from the snapshot
69
- */
70
- private createStubTsconfig;
71
- /**
72
- * Create the surface.d.ts file
73
- */
74
- private createSurfaceFile;
75
- /**
76
- * Create a placeholder surface file
77
- */
78
- private createPlaceholderSurface;
79
- /**
80
- * Get default tsconfig snapshot
81
- */
82
- private getDefaultTsconfigSnapshot;
83
- /**
84
- * Create the checker package that runs type compatibility checks
85
- *
86
- * @returns Path to the checker package
87
- */
88
- private createCheckerPackage;
89
- /**
90
- * Create package.json for the checker package
91
- */
92
- private createCheckerPackageJson;
93
- /**
94
- * Create tsconfig.json for the checker package with path mappings
95
- */
96
- private createCheckerTsconfig;
97
- /**
98
- * Create initial checks.ts file
99
- */
100
- private createInitialChecksFile;
101
- /**
102
- * Install dependencies using pnpm
103
- */
104
- private installDependencies;
105
- /**
106
- * Fallback: Install dependencies using npm
107
- */
108
- private installWithNpm;
109
- /**
110
- * Generate the checks.ts file with type assertions
111
- */
112
- private generateCheckFile;
113
- /**
114
- * Create a unique import name for a repo/alias combination
115
- */
116
- private makeImportName;
117
- /**
118
- * Run TypeScript type checking on the checker package
119
- *
120
- * @returns Object with success status and any error output
121
- */
122
- private runTypeCheck;
123
- /**
124
- * Parse the result of a type check for a specific compatibility check
125
- */
126
- private parseCheckResult;
127
- private log;
128
- private logError;
129
- }