carrick 0.3.101 → 0.3.103
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 +6 -6
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/sidecar/dist/src/bundler.d.ts +3 -92
- package/sidecar/dist/src/bundler.js +5 -265
- package/sidecar/dist/src/capture/anchors.js +113 -8
- package/sidecar/dist/src/capture/check-fields.js +19 -5
- package/sidecar/dist/src/capture/check-probe.d.ts +5 -0
- package/sidecar/dist/src/capture/check-probe.js +31 -2
- package/sidecar/dist/src/capture/check-workspace.d.ts +3 -0
- package/sidecar/dist/src/capture/check-workspace.js +13 -16
- package/sidecar/dist/src/capture/check.js +5 -5
- package/sidecar/dist/src/capture/deep-walk.js +45 -12
- package/sidecar/dist/src/capture/deno-project.d.ts +2 -1
- package/sidecar/dist/src/capture/deno-project.js +22 -18
- package/sidecar/dist/src/capture/guarded-fs.d.ts +76 -0
- package/sidecar/dist/src/capture/guarded-fs.js +182 -0
- package/sidecar/dist/src/capture/index.js +60 -26
- package/sidecar/dist/src/capture/outside-root.d.ts +41 -0
- package/sidecar/dist/src/capture/outside-root.js +101 -0
- package/sidecar/dist/src/capture/paths-rewrite.d.ts +8 -0
- package/sidecar/dist/src/capture/paths-rewrite.js +9 -7
- package/sidecar/dist/src/capture/repair-dangling.d.ts +11 -1
- package/sidecar/dist/src/capture/repair-dangling.js +15 -4
- package/sidecar/dist/src/capture/self-check.d.ts +3 -0
- package/sidecar/dist/src/capture/self-check.js +3 -3
- package/sidecar/dist/src/index.d.ts +1 -1
- package/sidecar/dist/src/index.js +2 -115
- package/sidecar/dist/src/origin.d.ts +49 -8
- package/sidecar/dist/src/origin.js +81 -8
- package/sidecar/dist/src/project-loader.js +15 -5
- package/sidecar/dist/src/type-inferrer.d.ts +72 -0
- package/sidecar/dist/src/type-inferrer.js +248 -8
- package/sidecar/dist/src/type-structural-expander.d.ts +5 -1
- package/sidecar/dist/src/type-structural-expander.js +1 -1
- package/sidecar/dist/src/types.d.ts +31 -178
- package/sidecar/dist/src/validators.d.ts +58 -914
- package/sidecar/dist/src/validators.js +0 -55
- package/sidecar/dist/src/monorepo-builder.d.ts +0 -129
- 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({
|
|
@@ -179,12 +143,6 @@ export const BundleRequestSchema = BaseRequestSchema.extend({
|
|
|
179
143
|
action: z.literal('bundle'),
|
|
180
144
|
symbols: z.array(SymbolRequestSchema).min(1, 'At least one symbol is required'),
|
|
181
145
|
});
|
|
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
146
|
/** v2 "tsc as serializer" capture (contract in ./capture/api.ts). */
|
|
189
147
|
const AnchorOriginSchema = z.enum([
|
|
190
148
|
'llm-symbol',
|
|
@@ -262,16 +220,6 @@ export const InferRequestSchema = BaseRequestSchema.extend({
|
|
|
262
220
|
requests: z.array(InferRequestItemSchema).min(1, 'At least one infer request is required'),
|
|
263
221
|
extraction_config: ExtractionConfigSchema.optional(),
|
|
264
222
|
});
|
|
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
223
|
export const HealthRequestSchema = BaseRequestSchema.extend({
|
|
276
224
|
action: z.literal('health'),
|
|
277
225
|
});
|
|
@@ -472,12 +420,9 @@ export const ListLibrarySurfaceRequestSchema = BaseRequestSchema.extend({
|
|
|
472
420
|
export const SidecarRequestSchema = z.discriminatedUnion('action', [
|
|
473
421
|
InitRequestSchema,
|
|
474
422
|
BundleRequestSchema,
|
|
475
|
-
EmitSurfaceRequestSchema,
|
|
476
423
|
CaptureV2RequestSchema,
|
|
477
424
|
CheckV2RequestSchema,
|
|
478
425
|
InferRequestSchema,
|
|
479
|
-
BuildWorkspaceRequestSchema,
|
|
480
|
-
CheckCompatibilityRequestSchema,
|
|
481
426
|
ResolveDefinitionsRequestSchema,
|
|
482
427
|
RetypeCheckRequestSchema,
|
|
483
428
|
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
|
-
}
|