carrick 0.3.151 → 0.3.153
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/bin/carrick.mjs +1 -0
- package/dist/contract.d.ts +35 -0
- package/dist/contract.js.map +1 -1
- package/dist/hook/bash-targets.d.ts +29 -0
- package/dist/hook/bash-targets.js +377 -0
- package/dist/hook/bash-targets.js.map +1 -0
- package/dist/hook/edit-flow.d.ts +13 -0
- package/dist/hook/edit-flow.js +170 -0
- package/dist/hook/edit-flow.js.map +1 -0
- package/dist/hook/grep-missed.d.ts +19 -0
- package/dist/hook/grep-missed.js +129 -0
- package/dist/hook/grep-missed.js.map +1 -0
- package/dist/hook/late.d.ts +1 -1
- package/dist/hook/late.js +24 -22
- package/dist/hook/late.js.map +1 -1
- package/dist/hook/lead.d.ts +13 -0
- package/dist/hook/lead.js +39 -0
- package/dist/hook/lead.js.map +1 -0
- package/dist/hook/post-bash.d.ts +2 -0
- package/dist/hook/post-bash.js +109 -0
- package/dist/hook/post-bash.js.map +1 -0
- package/dist/hook/post-edit.js +3 -136
- package/dist/hook/post-edit.js.map +1 -1
- package/dist/hook/post-read.js +3 -31
- package/dist/hook/post-read.js.map +1 -1
- package/dist/hook/read-answer.d.ts +6 -0
- package/dist/hook/read-answer.js +45 -0
- package/dist/hook/read-answer.js.map +1 -0
- package/dist/hook/reuse.d.ts +28 -0
- package/dist/hook/reuse.js +41 -0
- package/dist/hook/reuse.js.map +1 -1
- package/dist/hook/stop-wait.d.ts +2 -1
- package/dist/hook/stop-wait.js +79 -29
- package/dist/hook/stop-wait.js.map +1 -1
- package/dist/hook/stop.js +3 -5
- package/dist/hook/stop.js.map +1 -1
- package/dist/init/agents-section.js +3 -2
- package/dist/init/agents-section.js.map +1 -1
- package/dist/init/outdated.d.ts +3 -2
- package/dist/init/outdated.js +9 -2
- package/dist/init/outdated.js.map +1 -1
- package/dist/init/settings.js +6 -0
- package/dist/init/settings.js.map +1 -1
- package/dist/render.d.ts +33 -31
- package/dist/render.js +103 -90
- package/dist/render.js.map +1 -1
- package/package.json +6 -6
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/sidecar/dist/src/capture/index.d.ts +1 -1
- package/sidecar/dist/src/capture/index.js +1 -1
- package/sidecar/dist/src/capture/reference-redirect.d.ts +16 -1
- package/sidecar/dist/src/capture/reference-redirect.js +137 -3
- package/sidecar/dist/src/index.js +1 -0
- package/sidecar/dist/src/library-claims.js +76 -9
- package/sidecar/dist/src/project-loader.d.ts +8 -0
- package/sidecar/dist/src/project-loader.js +9 -2
- package/sidecar/dist/src/types.d.ts +31 -0
- package/sidecar/dist/src/validators.d.ts +6 -0
- package/sidecar/dist/src/validators.js +1 -0
- package/templates/skills/carrick-reuse.md +1 -1
|
@@ -37,9 +37,10 @@
|
|
|
37
37
|
* A package the owner does not reference stays unresolved, as in the editor.
|
|
38
38
|
* Nothing here writes, and every read goes through the host it wraps.
|
|
39
39
|
*/
|
|
40
|
+
import * as fs from 'node:fs';
|
|
40
41
|
import * as path from 'node:path';
|
|
41
42
|
import ts from 'typescript';
|
|
42
|
-
import { boundedSys, isInsideCheckout, realOf, untrustedReadBound } from './checkout.js';
|
|
43
|
+
import { boundedSys, checkoutRootOf, isInsideCheckout, realOf, untrustedReadBound } from './checkout.js';
|
|
43
44
|
import { sidecarCompilerOptions } from './compiler-options.js';
|
|
44
45
|
import { ProjectGraph } from './project-references.js';
|
|
45
46
|
const DECLARATION = /\.d\.[cm]?ts$/;
|
|
@@ -92,14 +93,19 @@ function declarationLayout(parsed, ignoreCase) {
|
|
|
92
93
|
/**
|
|
93
94
|
* The redirect for a program whose owner reaches `references` (its reference
|
|
94
95
|
* closure, from `ProjectGraph.closureOf`), or `undefined` when there are none.
|
|
96
|
+
* An output two of the projects write from different sources goes to the
|
|
97
|
+
* first one, or, with `ambiguousUnresolved`, to neither: nothing says which
|
|
98
|
+
* the entry is, so the import stays unresolved (carrick#1910).
|
|
95
99
|
*/
|
|
96
|
-
export function referenceRedirect(references, repoRoot) {
|
|
100
|
+
export function referenceRedirect(references, repoRoot, { ambiguousUnresolved = false } = {}) {
|
|
97
101
|
if (references.length === 0)
|
|
98
102
|
return undefined;
|
|
99
103
|
const realOf = realPaths();
|
|
100
104
|
const ignoreCase = !ts.sys.useCaseSensitiveFileNames;
|
|
101
105
|
/** Real path of an output -> its source. */
|
|
102
106
|
const outputs = new Map();
|
|
107
|
+
/** Outputs two projects write from different sources (`ambiguousUnresolved`). */
|
|
108
|
+
const ambiguous = new Set();
|
|
103
109
|
/** Real paths of the directories outputs sit in, up to their project's. */
|
|
104
110
|
const outputDirs = new Set();
|
|
105
111
|
/** Base names of outputs and of their directories: the cheap test first. */
|
|
@@ -124,8 +130,12 @@ export function referenceRedirect(references, repoRoot) {
|
|
|
124
130
|
if (!declaration)
|
|
125
131
|
continue;
|
|
126
132
|
const output = realOf(declaration);
|
|
127
|
-
|
|
133
|
+
const known = outputs.get(output);
|
|
134
|
+
if (known !== undefined) {
|
|
135
|
+
if (ambiguousUnresolved && known !== key)
|
|
136
|
+
ambiguous.add(output);
|
|
128
137
|
continue;
|
|
138
|
+
}
|
|
129
139
|
outputs.set(output, key);
|
|
130
140
|
names.add(path.basename(output));
|
|
131
141
|
for (let dir = path.dirname(output); !outputDirs.has(dir); dir = path.dirname(dir)) {
|
|
@@ -136,6 +146,8 @@ export function referenceRedirect(references, repoRoot) {
|
|
|
136
146
|
}
|
|
137
147
|
}
|
|
138
148
|
}
|
|
149
|
+
for (const output of ambiguous)
|
|
150
|
+
outputs.delete(output);
|
|
139
151
|
const sourceOf = (file) => DECLARATION.test(file) && names.has(path.basename(file)) ? outputs.get(realOf(file)) : undefined;
|
|
140
152
|
const isOutputDir = (dir) => names.has(path.basename(dir)) && outputDirs.has(realOf(dir));
|
|
141
153
|
return {
|
|
@@ -191,6 +203,128 @@ export function referenceRedirectOf(configPath, repoRoot) {
|
|
|
191
203
|
}
|
|
192
204
|
return referenceRedirect(graph.closureOf(graph.named), repoRoot);
|
|
193
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* The directories of the packages an install links into the checkout, as
|
|
208
|
+
* seen from `fromDir`: every `node_modules/<name>` and
|
|
209
|
+
* `node_modules/@scope/<name>` from `fromDir` up to the checkout root whose
|
|
210
|
+
* real path is inside the checkout, under no `node_modules`, and holds a
|
|
211
|
+
* `package.json`. A link that resolves to `fromDir` or above it is the
|
|
212
|
+
* service itself and is left out.
|
|
213
|
+
*/
|
|
214
|
+
function linkedWorkspacePackages(fromDir, checkoutRoot) {
|
|
215
|
+
const root = realOf(checkoutRoot);
|
|
216
|
+
const from = realOf(fromDir);
|
|
217
|
+
const found = new Set();
|
|
218
|
+
const consider = (link) => {
|
|
219
|
+
let real;
|
|
220
|
+
try {
|
|
221
|
+
if (!fs.lstatSync(link).isSymbolicLink())
|
|
222
|
+
return;
|
|
223
|
+
real = fs.realpathSync(link);
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const rel = path.relative(root, real);
|
|
229
|
+
if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel))
|
|
230
|
+
return;
|
|
231
|
+
if (rel.split(path.sep).includes('node_modules'))
|
|
232
|
+
return;
|
|
233
|
+
const toFrom = path.relative(real, from);
|
|
234
|
+
if (toFrom === '' || (!toFrom.startsWith('..') && !path.isAbsolute(toFrom)))
|
|
235
|
+
return;
|
|
236
|
+
if (fs.existsSync(path.join(real, 'package.json')))
|
|
237
|
+
found.add(real);
|
|
238
|
+
};
|
|
239
|
+
const entries = (dir) => {
|
|
240
|
+
try {
|
|
241
|
+
return fs.readdirSync(dir, { withFileTypes: true });
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
return [];
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
for (let dir = path.resolve(fromDir);; dir = path.dirname(dir)) {
|
|
248
|
+
const modules = path.join(dir, 'node_modules');
|
|
249
|
+
for (const entry of entries(modules)) {
|
|
250
|
+
if (entry.name.startsWith('.'))
|
|
251
|
+
continue;
|
|
252
|
+
const link = path.join(modules, entry.name);
|
|
253
|
+
if (entry.name.startsWith('@')) {
|
|
254
|
+
for (const scoped of entries(link))
|
|
255
|
+
consider(path.join(link, scoped.name));
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
consider(link);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (realOf(dir) === root || path.dirname(dir) === dir)
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
return [...found].sort();
|
|
265
|
+
}
|
|
266
|
+
const TSCONFIG_NAME = /^tsconfig(\..+)?\.json$/;
|
|
267
|
+
const projectsByPackage = new Map();
|
|
268
|
+
/** Every `tsconfig*.json` in `packageDir`, parsed, with the projects each references. */
|
|
269
|
+
function packageProjects(packageDir) {
|
|
270
|
+
const cached = projectsByPackage.get(packageDir);
|
|
271
|
+
if (cached)
|
|
272
|
+
return cached;
|
|
273
|
+
const projects = readPackageProjects(packageDir);
|
|
274
|
+
projectsByPackage.set(packageDir, projects);
|
|
275
|
+
return projects;
|
|
276
|
+
}
|
|
277
|
+
function readPackageProjects(packageDir) {
|
|
278
|
+
let names;
|
|
279
|
+
try {
|
|
280
|
+
names = fs.readdirSync(packageDir).filter((name) => TSCONFIG_NAME.test(name)).sort();
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return [];
|
|
284
|
+
}
|
|
285
|
+
const projects = [];
|
|
286
|
+
for (const name of names) {
|
|
287
|
+
try {
|
|
288
|
+
const graph = new ProjectGraph(path.join(packageDir, name));
|
|
289
|
+
projects.push(graph.named, ...graph.closureOf(graph.named));
|
|
290
|
+
}
|
|
291
|
+
catch {
|
|
292
|
+
// A config that cannot be read writes nothing anyone can follow.
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return projects;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* For the position rows' process only (carrick#1910): `referenceRedirectOf`,
|
|
299
|
+
* with the projects of every workspace package the install links into the
|
|
300
|
+
* checkout added to the reference closure, whether or not the config
|
|
301
|
+
* references them. A package's projects are every `tsconfig*.json` in its
|
|
302
|
+
* root. An output two of them write from different sources is followed to
|
|
303
|
+
* neither. Every other program keeps `referenceRedirectOf`: infer's text is
|
|
304
|
+
* the compat judge's anchor, so widening it would move verdicts.
|
|
305
|
+
*/
|
|
306
|
+
export function workspaceSourceRedirectOf(configPath, repoRoot) {
|
|
307
|
+
let references = [];
|
|
308
|
+
try {
|
|
309
|
+
const graph = new ProjectGraph(configPath);
|
|
310
|
+
references = graph.closureOf(graph.named);
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
// An unreadable owner config references nothing.
|
|
314
|
+
}
|
|
315
|
+
const seen = new Set([path.resolve(configPath), ...references.map((p) => path.resolve(p.configPath))]);
|
|
316
|
+
const projects = [...references];
|
|
317
|
+
for (const packageDir of linkedWorkspacePackages(path.dirname(configPath), checkoutRootOf(repoRoot))) {
|
|
318
|
+
for (const project of packageProjects(packageDir)) {
|
|
319
|
+
const key = path.resolve(project.configPath);
|
|
320
|
+
if (seen.has(key))
|
|
321
|
+
continue;
|
|
322
|
+
seen.add(key);
|
|
323
|
+
projects.push(project);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return referenceRedirect(projects, repoRoot, { ambiguousUnresolved: true });
|
|
327
|
+
}
|
|
194
328
|
/**
|
|
195
329
|
* For the capture's anchor program: `host` resolving every import through
|
|
196
330
|
* `redirect`, with the module resolution cache it uses handed to the program.
|
|
@@ -171,6 +171,7 @@ function handleInit(request) {
|
|
|
171
171
|
scanRoot: request.scan_root,
|
|
172
172
|
tsconfigSnapshot: request.tsconfig_snapshot,
|
|
173
173
|
pinnedDependencies: request.pinned_dependencies,
|
|
174
|
+
workspaceSource: request.workspace_source,
|
|
174
175
|
});
|
|
175
176
|
const result = projectLoader.load();
|
|
176
177
|
if (!result.success) {
|
|
@@ -1112,9 +1112,13 @@ export function fullSurfaceSha256(surfaces) {
|
|
|
1112
1112
|
// A member's `handlers` (carrick#2674), a signature's `result_candidates`
|
|
1113
1113
|
// (carrick#2817) and a member's `scope_receiver` (carrick#2774) are out of
|
|
1114
1114
|
// the hash at every depth, and so is a member's `runtime_events`
|
|
1115
|
-
// (carrick#3032),
|
|
1116
|
-
// learns to list them.
|
|
1117
|
-
const text = JSON.stringify(listed, (key, value) => key === 'handlers' ||
|
|
1115
|
+
// (carrick#3032), and a receiver's `properties` (carrick#3696), so a
|
|
1116
|
+
// package's key does not change when the lister learns to list them.
|
|
1117
|
+
const text = JSON.stringify(listed, (key, value) => key === 'handlers' ||
|
|
1118
|
+
key === 'result_candidates' ||
|
|
1119
|
+
key === 'scope_receiver' ||
|
|
1120
|
+
key === 'runtime_events' ||
|
|
1121
|
+
key === 'properties'
|
|
1118
1122
|
? undefined
|
|
1119
1123
|
: value);
|
|
1120
1124
|
return crypto.createHash('sha256').update(text).digest('hex');
|
|
@@ -4224,10 +4228,8 @@ class DeclarationReader {
|
|
|
4224
4228
|
if (!made)
|
|
4225
4229
|
continue;
|
|
4226
4230
|
// One level below the export, what the member builds must declare a callable member.
|
|
4227
|
-
if (maker.member &&
|
|
4228
|
-
!this.namedProperties(made).some(member => this.librarySignatures(this.checker.getTypeOfSymbol(member), 'call').length > 0)) {
|
|
4231
|
+
if (maker.member && !this.hasCallableMember(made))
|
|
4229
4232
|
continue;
|
|
4230
|
-
}
|
|
4231
4233
|
receiverOf(maker.receiver, made);
|
|
4232
4234
|
}
|
|
4233
4235
|
}
|
|
@@ -4241,16 +4243,21 @@ class DeclarationReader {
|
|
|
4241
4243
|
this.listScopeReceivers(pkg, instances, maxEntries, withHandlers, built);
|
|
4242
4244
|
surface.truncated = dropped;
|
|
4243
4245
|
this.collectTypes = false;
|
|
4246
|
+
const types = withHandlers || this.listTypes ? this.listTypeReceivers(pkg, typeExports, maxEntries) : undefined;
|
|
4247
|
+
const receiverTypes = this.listTypes ? this.receiverTypes(types ?? []) : undefined;
|
|
4248
|
+
const propertiesLeftOut = this.listReceiverProperties(pkg, instances, maxEntries, withHandlers);
|
|
4244
4249
|
if (withHandlers)
|
|
4245
4250
|
surface.handler_types = this.handlerTypes;
|
|
4246
|
-
if (
|
|
4247
|
-
surface.types =
|
|
4251
|
+
if (types !== undefined)
|
|
4252
|
+
surface.types = types;
|
|
4248
4253
|
if (withHandlers)
|
|
4249
4254
|
surface.handler_params_left_out = this.handlerParamsLeftOut;
|
|
4250
4255
|
if (this.listTypes) {
|
|
4251
4256
|
surface.types_left_out = this.typesLeftOut;
|
|
4252
|
-
surface.receiver_types =
|
|
4257
|
+
surface.receiver_types = receiverTypes;
|
|
4253
4258
|
}
|
|
4259
|
+
if (propertiesLeftOut > 0)
|
|
4260
|
+
surface.properties_left_out = propertiesLeftOut;
|
|
4254
4261
|
return surface;
|
|
4255
4262
|
}
|
|
4256
4263
|
/**
|
|
@@ -4560,6 +4567,66 @@ class DeclarationReader {
|
|
|
4560
4567
|
for (const fill of fills)
|
|
4561
4568
|
fill();
|
|
4562
4569
|
}
|
|
4570
|
+
/**
|
|
4571
|
+
* The seventh pass (carrick#3696): each own property of an instance
|
|
4572
|
+
* receiver that has no call signature, and whose type has a callable
|
|
4573
|
+
* member, is listed in the receiver's `properties` with those members,
|
|
4574
|
+
* outlined as any receiver's are, from the home an op's `path: [name]`
|
|
4575
|
+
* walks to (`walkHops`). Everything it lists draws on one budget of its
|
|
4576
|
+
* own, spent after every other pass, so `truncated`, the hash, the handler
|
|
4577
|
+
* type ids and `types` are the ones the lister gave before; it notes no
|
|
4578
|
+
* type for `types[]`. Returns what that budget left out. One level: a
|
|
4579
|
+
* property's members list no scope receiver and no properties.
|
|
4580
|
+
*/
|
|
4581
|
+
listReceiverProperties(pkg, sources, maxEntries, withHandlers) {
|
|
4582
|
+
let budget = maxEntries;
|
|
4583
|
+
let leftOut = 0;
|
|
4584
|
+
const take = () => {
|
|
4585
|
+
if (budget > 0) {
|
|
4586
|
+
budget -= 1;
|
|
4587
|
+
return true;
|
|
4588
|
+
}
|
|
4589
|
+
leftOut += 1;
|
|
4590
|
+
return false;
|
|
4591
|
+
};
|
|
4592
|
+
const names = [];
|
|
4593
|
+
const handlers = [];
|
|
4594
|
+
const fills = [];
|
|
4595
|
+
for (const source of sources) {
|
|
4596
|
+
if (this.isOpenTop(source.type))
|
|
4597
|
+
continue;
|
|
4598
|
+
const holder = this.surfaceHolder(pkg, source.type, source.home);
|
|
4599
|
+
const listed = [];
|
|
4600
|
+
for (const property of sortedByName(this.namedProperties(source.type))) {
|
|
4601
|
+
const name = property.getName();
|
|
4602
|
+
const walked = this.walkHops(holder, [name]);
|
|
4603
|
+
if ('failure' in walked)
|
|
4604
|
+
continue;
|
|
4605
|
+
const type = walked.holder.type;
|
|
4606
|
+
if (this.checker.getNonNullableType(type).getCallSignatures().length > 0)
|
|
4607
|
+
continue;
|
|
4608
|
+
if (!this.hasCallableMember(type) || !take())
|
|
4609
|
+
continue;
|
|
4610
|
+
this.typeContext = source.export;
|
|
4611
|
+
const outlined = this.outlineReceiver(pkg, source.receiver.receiver, type, walked.holder.home, take, names, handlers, fills);
|
|
4612
|
+
listed.push({ name, own: true, type: this.printed(type), members: outlined.members });
|
|
4613
|
+
}
|
|
4614
|
+
if (listed.length > 0)
|
|
4615
|
+
source.receiver.properties = listed;
|
|
4616
|
+
}
|
|
4617
|
+
for (const run of names)
|
|
4618
|
+
run();
|
|
4619
|
+
if (withHandlers)
|
|
4620
|
+
for (const run of handlers)
|
|
4621
|
+
run();
|
|
4622
|
+
for (const fill of fills)
|
|
4623
|
+
fill();
|
|
4624
|
+
return leftOut;
|
|
4625
|
+
}
|
|
4626
|
+
/** Some named property of `type` has a call signature an installed package or the default library declares. */
|
|
4627
|
+
hasCallableMember(type) {
|
|
4628
|
+
return this.namedProperties(type).some(member => this.librarySignatures(this.checker.getTypeOfSymbol(member), 'call').length > 0);
|
|
4629
|
+
}
|
|
4563
4630
|
/**
|
|
4564
4631
|
* The receivers each export of a specifier can make, by receiver id, for
|
|
4565
4632
|
* the probe statements that build them (see `LibraryClaimsVerifier.listSurface`).
|
|
@@ -29,6 +29,12 @@ export interface ProjectLoaderOptions {
|
|
|
29
29
|
tsconfigSnapshot?: TsconfigSnapshot;
|
|
30
30
|
/** Optional pinned dependencies for this repo */
|
|
31
31
|
pinnedDependencies?: PinnedDependencySnapshot;
|
|
32
|
+
/**
|
|
33
|
+
* The position rows' process only (carrick#1910): every program also reads
|
|
34
|
+
* the workspace packages the install links into the checkout from their
|
|
35
|
+
* source (`workspaceSourceRedirectOf`). Off for every other process.
|
|
36
|
+
*/
|
|
37
|
+
workspaceSource?: boolean;
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
34
40
|
* Result of project loading
|
|
@@ -92,6 +98,8 @@ export declare class ProjectLoader {
|
|
|
92
98
|
private readonly repoRoot;
|
|
93
99
|
private readonly tsconfigPath;
|
|
94
100
|
private readonly scanRoot;
|
|
101
|
+
/** `ProjectLoaderOptions.workspaceSource`. */
|
|
102
|
+
private readonly workspaceSource;
|
|
95
103
|
private readonly tsconfigSnapshot;
|
|
96
104
|
private readonly pinnedDependencies;
|
|
97
105
|
private initialized;
|
|
@@ -13,7 +13,7 @@ import { Project, getCompilerOptionsFromTsConfig } from 'ts-morph';
|
|
|
13
13
|
import * as path from 'node:path';
|
|
14
14
|
import ts from 'typescript';
|
|
15
15
|
import * as fs from 'node:fs';
|
|
16
|
-
import { DenoProject, findDenoConfig, findServiceTsconfig, GoverningConfigs, referenceRedirectOf, sidecarCompilerOptions, untrustedReadBound, } from './capture/index.js';
|
|
16
|
+
import { DenoProject, findDenoConfig, findServiceTsconfig, GoverningConfigs, referenceRedirectOf, sidecarCompilerOptions, untrustedReadBound, workspaceSourceRedirectOf, } from './capture/index.js';
|
|
17
17
|
import { moduleFormatResolutionHost } from './module-format.js';
|
|
18
18
|
import { ExternalImports, registerExternalImports } from './origin.js';
|
|
19
19
|
import { pinProgramRoots } from './program-files.js';
|
|
@@ -152,6 +152,8 @@ export class ProjectLoader {
|
|
|
152
152
|
repoRoot;
|
|
153
153
|
tsconfigPath;
|
|
154
154
|
scanRoot;
|
|
155
|
+
/** `ProjectLoaderOptions.workspaceSource`. */
|
|
156
|
+
workspaceSource;
|
|
155
157
|
tsconfigSnapshot;
|
|
156
158
|
pinnedDependencies;
|
|
157
159
|
initialized = false;
|
|
@@ -169,6 +171,7 @@ export class ProjectLoader {
|
|
|
169
171
|
: path.resolve(this.repoRoot, options.tsconfigPath);
|
|
170
172
|
}
|
|
171
173
|
this.scanRoot = options.scanRoot;
|
|
174
|
+
this.workspaceSource = options.workspaceSource === true;
|
|
172
175
|
// Store snapshot if provided
|
|
173
176
|
this.tsconfigSnapshot = options.tsconfigSnapshot;
|
|
174
177
|
this.pinnedDependencies = options.pinnedDependencies;
|
|
@@ -391,7 +394,11 @@ export class ProjectLoader {
|
|
|
391
394
|
// a referenced project's unbuilt output reads as its source, under its
|
|
392
395
|
// own options (carrick#2418), and every external-library answer is kept
|
|
393
396
|
// past the program rebuilds that drop it (carrick#1731).
|
|
394
|
-
|
|
397
|
+
// In the position rows' process, a workspace package it does not
|
|
398
|
+
// reference reads as its source too (carrick#1910).
|
|
399
|
+
resolutionHost: imports.recording(moduleFormatResolutionHost(this.workspaceSource
|
|
400
|
+
? workspaceSourceRedirectOf(configPath, this.repoRoot)
|
|
401
|
+
: referenceRedirectOf(configPath, this.repoRoot))),
|
|
395
402
|
});
|
|
396
403
|
const resolved = kind === 'listed' ? project.resolveSourceFileDependencies() : [];
|
|
397
404
|
registerExternalImports(project, imports);
|
|
@@ -125,6 +125,13 @@ export interface InitRequest extends BaseRequest {
|
|
|
125
125
|
tsconfig_snapshot?: TsconfigSnapshot;
|
|
126
126
|
/** Optional pinned dependencies for this repo */
|
|
127
127
|
pinned_dependencies?: PinnedDependencySnapshot;
|
|
128
|
+
/**
|
|
129
|
+
* Set only on the position rows' process (carrick#1910): its programs read
|
|
130
|
+
* the workspace packages the install links into the checkout from their
|
|
131
|
+
* source. Every other process leaves it unset, so infer's text, which the
|
|
132
|
+
* compat judge anchors on, never moves with it.
|
|
133
|
+
*/
|
|
134
|
+
workspace_source?: boolean;
|
|
128
135
|
}
|
|
129
136
|
/**
|
|
130
137
|
* Request to bundle explicit types from source files
|
|
@@ -1361,6 +1368,24 @@ export interface SurfaceReceiver {
|
|
|
1361
1368
|
* depth 1, sorted by name (carrick#3050). Absent when none.
|
|
1362
1369
|
*/
|
|
1363
1370
|
settable?: SurfaceSettable[];
|
|
1371
|
+
/**
|
|
1372
|
+
* Own non-callable properties of an instance receiver whose type has callable
|
|
1373
|
+
* members, each with those members (carrick#3696). Reached only as an op's
|
|
1374
|
+
* `path: [name]` on this receiver, never as `of`. Not `settable` (what a `set`
|
|
1375
|
+
* op may assign on a type receiver). One level, sorted by name, absent when
|
|
1376
|
+
* none, and outside the hash.
|
|
1377
|
+
*/
|
|
1378
|
+
properties?: SurfaceProperty[];
|
|
1379
|
+
}
|
|
1380
|
+
/** A property of an instance receiver that `properties` lists (carrick#3696). */
|
|
1381
|
+
export interface SurfaceProperty {
|
|
1382
|
+
name: string;
|
|
1383
|
+
/** As a member's `own`; only `true` is listed. */
|
|
1384
|
+
own: boolean;
|
|
1385
|
+
/** The property's type as the declarations print it, truncated. */
|
|
1386
|
+
type: string;
|
|
1387
|
+
/** Outlined as any receiver's members are; no `scope_receiver` and no `properties` of their own. */
|
|
1388
|
+
members: SurfaceMember[];
|
|
1364
1389
|
}
|
|
1365
1390
|
/** A property of a type receiver that `settable` answers `ok` for. */
|
|
1366
1391
|
export interface SurfaceSettable {
|
|
@@ -1398,6 +1423,12 @@ export interface LibrarySurface {
|
|
|
1398
1423
|
* (carrick#3050). `truncated` does not count them.
|
|
1399
1424
|
*/
|
|
1400
1425
|
types_left_out?: number;
|
|
1426
|
+
/**
|
|
1427
|
+
* Entries (properties, their members and signatures) the budget of the
|
|
1428
|
+
* receivers' `properties` left out (carrick#3696); absent when none.
|
|
1429
|
+
* `truncated` does not count them, and it is outside `surface_sha256`.
|
|
1430
|
+
*/
|
|
1431
|
+
properties_left_out?: number;
|
|
1401
1432
|
/**
|
|
1402
1433
|
* With `types: true`: per export, per receiver the surface lists, the
|
|
1403
1434
|
* `types` receiver ids its built type and base types are declared by
|
|
@@ -222,6 +222,7 @@ export declare const InitRequestSchema: z.ZodObject<{
|
|
|
222
222
|
};
|
|
223
223
|
}>>;
|
|
224
224
|
pinned_dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
225
|
+
workspace_source: z.ZodOptional<z.ZodBoolean>;
|
|
225
226
|
}, "strip", z.ZodTypeAny, {
|
|
226
227
|
request_id: string;
|
|
227
228
|
action: "init";
|
|
@@ -249,6 +250,7 @@ export declare const InitRequestSchema: z.ZodObject<{
|
|
|
249
250
|
};
|
|
250
251
|
} | undefined;
|
|
251
252
|
pinned_dependencies?: Record<string, string> | undefined;
|
|
253
|
+
workspace_source?: boolean | undefined;
|
|
252
254
|
}, {
|
|
253
255
|
request_id: string;
|
|
254
256
|
action: "init";
|
|
@@ -276,6 +278,7 @@ export declare const InitRequestSchema: z.ZodObject<{
|
|
|
276
278
|
};
|
|
277
279
|
} | undefined;
|
|
278
280
|
pinned_dependencies?: Record<string, string> | undefined;
|
|
281
|
+
workspace_source?: boolean | undefined;
|
|
279
282
|
}>;
|
|
280
283
|
export declare const BundleRequestSchema: z.ZodObject<{
|
|
281
284
|
request_id: z.ZodString;
|
|
@@ -3903,6 +3906,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
3903
3906
|
};
|
|
3904
3907
|
}>>;
|
|
3905
3908
|
pinned_dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
3909
|
+
workspace_source: z.ZodOptional<z.ZodBoolean>;
|
|
3906
3910
|
}, "strip", z.ZodTypeAny, {
|
|
3907
3911
|
request_id: string;
|
|
3908
3912
|
action: "init";
|
|
@@ -3930,6 +3934,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
3930
3934
|
};
|
|
3931
3935
|
} | undefined;
|
|
3932
3936
|
pinned_dependencies?: Record<string, string> | undefined;
|
|
3937
|
+
workspace_source?: boolean | undefined;
|
|
3933
3938
|
}, {
|
|
3934
3939
|
request_id: string;
|
|
3935
3940
|
action: "init";
|
|
@@ -3957,6 +3962,7 @@ export declare const SidecarRequestSchema: z.ZodDiscriminatedUnion<"action", [z.
|
|
|
3957
3962
|
};
|
|
3958
3963
|
} | undefined;
|
|
3959
3964
|
pinned_dependencies?: Record<string, string> | undefined;
|
|
3965
|
+
workspace_source?: boolean | undefined;
|
|
3960
3966
|
}>, z.ZodObject<{
|
|
3961
3967
|
request_id: z.ZodString;
|
|
3962
3968
|
} & {
|
|
@@ -158,6 +158,7 @@ export const InitRequestSchema = BaseRequestSchema.extend({
|
|
|
158
158
|
scan_root: z.string().min(1).optional(),
|
|
159
159
|
tsconfig_snapshot: TsconfigSnapshotSchema.optional(),
|
|
160
160
|
pinned_dependencies: PinnedDependencySnapshotSchema.optional(),
|
|
161
|
+
workspace_source: z.boolean().optional(),
|
|
161
162
|
});
|
|
162
163
|
export const BundleRequestSchema = BaseRequestSchema.extend({
|
|
163
164
|
action: z.literal('bundle'),
|
|
@@ -35,7 +35,7 @@ commit the answer states, on the default branch, so anything added on this
|
|
|
35
35
|
branch is compared against that. And the comparison is on what each function is
|
|
36
36
|
described as doing, not on its source: the index holds no body hash.
|
|
37
37
|
|
|
38
|
-
When you are done, tell the user in one line
|
|
38
|
+
When you are done, if Carrick found a problem or changed what you did, tell the user in one line. Otherwise do not mention it.
|
|
39
39
|
|
|
40
40
|
The two kinds are scored on different scales, and each result states the floor
|
|
41
41
|
it was ranked against. `vector_basis` says what the cosines are over. On
|