@monosmith/plugin-sdk 0.6.0 → 2.0.0-beta.10
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.
|
@@ -38,6 +38,33 @@ export declare const ERROR_CODES: {
|
|
|
38
38
|
readonly RequestCancelled: -32800;
|
|
39
39
|
};
|
|
40
40
|
export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
|
|
41
|
+
/** APISurfaceParams asks a plugin for the public API names of one project. */
|
|
42
|
+
export interface APISurfaceParams {
|
|
43
|
+
project: Project;
|
|
44
|
+
/**
|
|
45
|
+
* Ref is the git revision to read the project at (the tag of its last release). Empty means the
|
|
46
|
+
* working tree.
|
|
47
|
+
*/
|
|
48
|
+
ref?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* APISurfaceResult is the public API of a project: the names its entry points export. A host
|
|
52
|
+
* compares the names of two revisions; it never reads their meaning, so a plugin chooses its own
|
|
53
|
+
* spelling and keeps it stable.
|
|
54
|
+
*/
|
|
55
|
+
export interface APISurfaceResult {
|
|
56
|
+
/**
|
|
57
|
+
* Names are the exported names, sorted. A name an entry point other than the main one exports is
|
|
58
|
+
* prefixed with that entry point and a colon ("./cli:run"). An empty list is an answer: the
|
|
59
|
+
* project exports nothing.
|
|
60
|
+
*/
|
|
61
|
+
names: string[];
|
|
62
|
+
/**
|
|
63
|
+
* Unreadable says why the API could not be listed (no entry point, no source at the revision).
|
|
64
|
+
* When set, Names is empty and the host skips the project without a warning.
|
|
65
|
+
*/
|
|
66
|
+
unreadable?: string;
|
|
67
|
+
}
|
|
41
68
|
/**
|
|
42
69
|
* ActionStep is a provider-native step: a GitHub action or an Azure task, with its inputs in the
|
|
43
70
|
* order they are written.
|
|
@@ -150,6 +177,13 @@ export interface Capabilities {
|
|
|
150
177
|
published?: boolean;
|
|
151
178
|
/** Dependencies installs and uninstalls packages in its projects. */
|
|
152
179
|
dependencies?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Link makes a project depend on a library of the same workspace in the ecosystem's own form (a
|
|
182
|
+
* workspace dependency, a path dependency, a project reference), and takes it out again. A plugin
|
|
183
|
+
* without it is refused by the host with one sentence that tells the user to add the dependency
|
|
184
|
+
* by hand.
|
|
185
|
+
*/
|
|
186
|
+
link?: boolean;
|
|
153
187
|
/** Declarations lists and rewrites declared dependency specs (sync, up). */
|
|
154
188
|
declarations?: boolean;
|
|
155
189
|
/** Latest reports the newest releases of dependencies and pinned tools. */
|
|
@@ -162,6 +196,28 @@ export interface Capabilities {
|
|
|
162
196
|
cancel?: boolean;
|
|
163
197
|
/** Components lists a project's dependencies for its SBOM. */
|
|
164
198
|
components?: boolean;
|
|
199
|
+
/** Derive says which files the plugin derives from facts and the project graph (smith derive). */
|
|
200
|
+
derive?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* APISurface lists the names a project exports, at a git revision, so a release can warn when the
|
|
203
|
+
* commits ask for a smaller bump than the API change needs.
|
|
204
|
+
*/
|
|
205
|
+
apiSurface?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Channels says a prerelease version the plugin publishes never takes the place of the stable
|
|
208
|
+
* one: the plugin publishes under PublishParams.Tag, a release channel's name, without moving the
|
|
209
|
+
* registry's stable pointer (npm's latest), or its registry orders a prerelease below the release
|
|
210
|
+
* (PyPI, NuGet) and needs no tag. A host does not publish a package of a release channel with a
|
|
211
|
+
* plugin that lacks it.
|
|
212
|
+
*/
|
|
213
|
+
channels?: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Declared says the plugin describes the projects smith.toml declares for its language
|
|
216
|
+
* (DiscoverParams.declared): folders with no manifest of their own. A plugin without it finds a
|
|
217
|
+
* project by its manifest only, and the host refuses a declaration for its language with a
|
|
218
|
+
* message that says so.
|
|
219
|
+
*/
|
|
220
|
+
declared?: boolean;
|
|
165
221
|
}
|
|
166
222
|
/**
|
|
167
223
|
* ChangeKindParams asks a plugin what changing a project's kind edits. The plugin writes nothing:
|
|
@@ -205,6 +261,68 @@ export interface ChangeKindResult {
|
|
|
205
261
|
*/
|
|
206
262
|
warnings?: string[];
|
|
207
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* Choice is one option on an axis of a project's make-up: a framework, a test runner, a style
|
|
266
|
+
* library. A plugin publishes the choices it owns in InitializeResult.Choices; the host checks a
|
|
267
|
+
* selection of them (smith add --with react,vitest,bootstrap) and turns it into a stack. What a
|
|
268
|
+
* choice writes (dependencies, tasks, files) stays with the plugin: the host never sees it.
|
|
269
|
+
*/
|
|
270
|
+
export interface Choice {
|
|
271
|
+
/**
|
|
272
|
+
* Axis is the question the choice answers: "framework", "test", "style", "lint". The plugins
|
|
273
|
+
* agree on the name; the host only compares it.
|
|
274
|
+
*/
|
|
275
|
+
axis: string;
|
|
276
|
+
/**
|
|
277
|
+
* Name identifies the choice in a selection and is unique among the choices of all loaded
|
|
278
|
+
* plugins.
|
|
279
|
+
*/
|
|
280
|
+
name: string;
|
|
281
|
+
description?: string;
|
|
282
|
+
/** Title is the name shown to a person ("Electron" for electron). Without it the name is shown. */
|
|
283
|
+
title?: string;
|
|
284
|
+
/**
|
|
285
|
+
* Aliases are words that find the choice when a person searches the catalogue (smith compose):
|
|
286
|
+
* "desktop", "serverless", "web".
|
|
287
|
+
*/
|
|
288
|
+
aliases?: string[];
|
|
289
|
+
/**
|
|
290
|
+
* Layer is where the choice sits in the stack of a project: "framework", "shell" (a desktop
|
|
291
|
+
* shell), "host" (where cloud code runs), "test", "lint", "style" or a layer of the plugin's own.
|
|
292
|
+
* Without it the layer is the axis. It is for display and grouping: the axis decides conflicts.
|
|
293
|
+
*/
|
|
294
|
+
layer?: string;
|
|
295
|
+
/** Language is the language plugin the choice applies to ("node"). */
|
|
296
|
+
language: string;
|
|
297
|
+
/**
|
|
298
|
+
* Roles are the roles the choice's plugin plays in a stack built from it: scaffold (it writes the
|
|
299
|
+
* project) and/or toolchain (it joins the toolchain). Empty means it only adds to what a plugin
|
|
300
|
+
* of the selection already writes, as a style does.
|
|
301
|
+
*/
|
|
302
|
+
roles?: Role[];
|
|
303
|
+
/**
|
|
304
|
+
* Needs are axes that the selection must have a choice on. An axis the person leaves out is
|
|
305
|
+
* filled with the default of the axis.
|
|
306
|
+
*/
|
|
307
|
+
needs?: string[];
|
|
308
|
+
/** Default marks the choice the host adds when a selection needs its axis and has no choice on it. */
|
|
309
|
+
default?: boolean;
|
|
310
|
+
/**
|
|
311
|
+
* Suggested marks the choice an asker pre-selects on its axis. The solver never adds it by
|
|
312
|
+
* itself: an axis that a choice needs and that has no Default is asked, and the person answers
|
|
313
|
+
* (ADR 0072).
|
|
314
|
+
*/
|
|
315
|
+
suggested?: boolean;
|
|
316
|
+
/**
|
|
317
|
+
* Many allows the choice next to other choices of its axis that are Many too. By default a
|
|
318
|
+
* selection has one choice per axis.
|
|
319
|
+
*/
|
|
320
|
+
many?: boolean;
|
|
321
|
+
/** Requires are choices that must be in the selection. */
|
|
322
|
+
requires?: string[];
|
|
323
|
+
/** Conflicts are choices that must not be in the selection. */
|
|
324
|
+
conflicts?: string[];
|
|
325
|
+
}
|
|
208
326
|
/** Component is one dependency of a project. */
|
|
209
327
|
export interface Component {
|
|
210
328
|
name: string;
|
|
@@ -266,6 +384,13 @@ export interface Contribution {
|
|
|
266
384
|
* sets wins.
|
|
267
385
|
*/
|
|
268
386
|
release?: ReleaseDefaults;
|
|
387
|
+
/**
|
|
388
|
+
* Facts are the plugin's default facts for the project: typed values under namespaced keys
|
|
389
|
+
* ({"source.roots": ["src"]}) that other settings and plugins read through the merged
|
|
390
|
+
* Project.Facts. They are the lowest scope: a [facts] table in smith.toml wins over them, and two
|
|
391
|
+
* plugins that publish different values for one key are an error that names both.
|
|
392
|
+
*/
|
|
393
|
+
facts?: Record<string, unknown>;
|
|
269
394
|
}
|
|
270
395
|
/** Credential is a secret the release phase needs. */
|
|
271
396
|
export interface Credential {
|
|
@@ -314,6 +439,15 @@ export interface Declaration {
|
|
|
314
439
|
export interface DeclaredParams {
|
|
315
440
|
projects: Project[];
|
|
316
441
|
}
|
|
442
|
+
/** DeclaredProject is a project smith.toml declares: a folder with no manifest. */
|
|
443
|
+
export interface DeclaredProject {
|
|
444
|
+
/** Name is the project's name, the key of its [projects.<name>] table. */
|
|
445
|
+
name: string;
|
|
446
|
+
/** Root is the workspace-relative folder. */
|
|
447
|
+
root: string;
|
|
448
|
+
/** Kind is "app", "lib" or "package", or empty for the plugin's choice. */
|
|
449
|
+
kind?: ProjectKind;
|
|
450
|
+
}
|
|
317
451
|
/**
|
|
318
452
|
* DeclaredResult is every declaration, and the version installed of each name where the plugin can
|
|
319
453
|
* tell.
|
|
@@ -327,6 +461,77 @@ export interface DependencyResult {
|
|
|
327
461
|
files?: string[];
|
|
328
462
|
notes?: string[];
|
|
329
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* DeriveParams asks a plugin for the files it can derive from facts and the project graph. The
|
|
466
|
+
* plugin writes nothing: it answers with the content, and the host decides, from its ownership
|
|
467
|
+
* record, whether to write it.
|
|
468
|
+
*/
|
|
469
|
+
export interface DeriveParams {
|
|
470
|
+
/** Projects are the projects the plugin serves. */
|
|
471
|
+
projects: Project[];
|
|
472
|
+
/**
|
|
473
|
+
* Graph maps a project name to the names of the projects it depends on inside the workspace,
|
|
474
|
+
* sorted. The host resolved these edges: a plugin does not repeat that work.
|
|
475
|
+
*/
|
|
476
|
+
graph?: Record<string, string[]>;
|
|
477
|
+
/**
|
|
478
|
+
* Owned are the workspace-relative paths the host's ownership record says smith owns. A plugin
|
|
479
|
+
* proposes such a file again even when it is missing on disk, so deleting a derived file and
|
|
480
|
+
* deriving restores it. A file that is not owned and not on disk is not proposed.
|
|
481
|
+
*/
|
|
482
|
+
owned?: string[];
|
|
483
|
+
}
|
|
484
|
+
/** DeriveResult carries the files a plugin derives. */
|
|
485
|
+
export interface DeriveResult {
|
|
486
|
+
files: DerivedFile[];
|
|
487
|
+
/**
|
|
488
|
+
* Diverging are files a renderer looked at and left alone because they differ from the shape
|
|
489
|
+
* their siblings share. They are not drift: the project owns them. The host shows them in `smith
|
|
490
|
+
* derive --explain` and in the doctor, and never writes them.
|
|
491
|
+
*/
|
|
492
|
+
diverging?: DivergentFile[];
|
|
493
|
+
}
|
|
494
|
+
/** DerivedFile is the content one renderer derives for one file. */
|
|
495
|
+
export interface DerivedFile {
|
|
496
|
+
/** Project is the project the file belongs to. */
|
|
497
|
+
project: string;
|
|
498
|
+
/** Path is workspace-relative, with forward slashes. */
|
|
499
|
+
path: string;
|
|
500
|
+
/** Mode is DeriveFile, DeriveRegion or DeriveKeys. */
|
|
501
|
+
mode: string;
|
|
502
|
+
/**
|
|
503
|
+
* Renderer is the stable id of the renderer, for example "node.tsconfig.references". It names the
|
|
504
|
+
* region markers.
|
|
505
|
+
*/
|
|
506
|
+
renderer: string;
|
|
507
|
+
/**
|
|
508
|
+
* Version is the renderer's version. A new version means new output for the same inputs, so the
|
|
509
|
+
* host rewrites an unedited file.
|
|
510
|
+
*/
|
|
511
|
+
version: number;
|
|
512
|
+
/**
|
|
513
|
+
* Content is the whole file (DeriveFile) or the lines of the region (DeriveRegion), without the
|
|
514
|
+
* markers. Unused for DeriveKeys.
|
|
515
|
+
*/
|
|
516
|
+
content?: string;
|
|
517
|
+
/**
|
|
518
|
+
* Comment is the line comment leader of the file ("//", "#"): the host writes a generated header
|
|
519
|
+
* after it in a DeriveFile. Empty for a format without comments, then the file has no header.
|
|
520
|
+
*/
|
|
521
|
+
comment?: string;
|
|
522
|
+
/** Format is "json" or "toml" for DeriveKeys. */
|
|
523
|
+
format?: string;
|
|
524
|
+
/**
|
|
525
|
+
* Table is the TOML table that holds the keys ("tool.smith"); required for "toml", unused for
|
|
526
|
+
* "json", whose keys are the top-level ones.
|
|
527
|
+
*/
|
|
528
|
+
table?: string;
|
|
529
|
+
/**
|
|
530
|
+
* Keys are the owned keys and their values (DeriveKeys). A TOML value is a string, a number, a
|
|
531
|
+
* boolean or an array of those.
|
|
532
|
+
*/
|
|
533
|
+
keys?: Record<string, unknown>;
|
|
534
|
+
}
|
|
330
535
|
/** DevcontainerFeature is a dev container feature and its options (https://containers.dev/features). */
|
|
331
536
|
export interface DevcontainerFeature {
|
|
332
537
|
/** ID is the feature reference, e.g. "ghcr.io/devcontainers/features/go:1". */
|
|
@@ -339,6 +544,20 @@ export interface DevcontainerFeature {
|
|
|
339
544
|
*/
|
|
340
545
|
export interface DiscoverParams {
|
|
341
546
|
manifests: string[];
|
|
547
|
+
/**
|
|
548
|
+
* Declared are the projects smith.toml declares for this plugin's language ([projects.<name>]
|
|
549
|
+
* with a root and a language): folders with no manifest of their own, such as a program that is a
|
|
550
|
+
* package of the Go module above it. The plugin describes each one in its result, or answers with
|
|
551
|
+
* an error saying why it cannot.
|
|
552
|
+
*/
|
|
553
|
+
declared?: DeclaredProject[];
|
|
554
|
+
/**
|
|
555
|
+
* Settings are this plugin's settings for projects, by project name, from smith.toml
|
|
556
|
+
* [projects.<project>.settings.<plugin>]. They reach the plugin here because the tasks it
|
|
557
|
+
* describes may depend on them (the Go plugin's build tags). A project with no settings is
|
|
558
|
+
* absent.
|
|
559
|
+
*/
|
|
560
|
+
settings?: Record<string, Record<string, unknown>>;
|
|
342
561
|
}
|
|
343
562
|
/**
|
|
344
563
|
* DiscoverResult describes every manifest that is a project of this plugin. A manifest the plugin
|
|
@@ -347,6 +566,20 @@ export interface DiscoverParams {
|
|
|
347
566
|
export interface DiscoverResult {
|
|
348
567
|
projects: Project[];
|
|
349
568
|
}
|
|
569
|
+
/**
|
|
570
|
+
* DivergentFile is a file a renderer does not derive because the project made it differ from its
|
|
571
|
+
* siblings.
|
|
572
|
+
*/
|
|
573
|
+
export interface DivergentFile {
|
|
574
|
+
/** Project is the project the file belongs to. */
|
|
575
|
+
project: string;
|
|
576
|
+
/** Path is workspace-relative, with forward slashes. */
|
|
577
|
+
path: string;
|
|
578
|
+
/** Renderer is the stable id of the renderer that compared the file. */
|
|
579
|
+
renderer: string;
|
|
580
|
+
/** Detail says in a sentence how the file differs from its siblings. */
|
|
581
|
+
detail: string;
|
|
582
|
+
}
|
|
350
583
|
/** DoctorParams gives the plugin its projects to check. */
|
|
351
584
|
export interface DoctorParams {
|
|
352
585
|
projects: Project[];
|
|
@@ -464,6 +697,25 @@ export interface GenerateParams {
|
|
|
464
697
|
* Project.Settings. Nil when there are none.
|
|
465
698
|
*/
|
|
466
699
|
settings?: Record<string, unknown>;
|
|
700
|
+
/**
|
|
701
|
+
* Facts are the shared facts that hold for the new project, from smith.toml:
|
|
702
|
+
* [projects.<name>.facts] over [facts]. A key that is absent was set by no one: the plugin
|
|
703
|
+
* scaffolds its own default. Set by the host; read only.
|
|
704
|
+
*/
|
|
705
|
+
facts?: Record<string, unknown>;
|
|
706
|
+
/**
|
|
707
|
+
* Shape is the dialect the new project should have: the facts (see Project.Shape) that most
|
|
708
|
+
* projects of its kind and language agree on, as the host counted them. A plugin applies the keys
|
|
709
|
+
* it follows (see InitializeResult.Follows) and ignores the rest. Nil when there is nothing to
|
|
710
|
+
* follow, or the person asked for a fresh project.
|
|
711
|
+
*/
|
|
712
|
+
shape?: Record<string, string>;
|
|
713
|
+
/**
|
|
714
|
+
* Choices are the choices (see Choice) the new project is built from, the stack's Choices, in the
|
|
715
|
+
* order they apply: a choice comes after those it requires. A plugin applies the choices it owns
|
|
716
|
+
* and ignores the rest. Absent when the stack is not a selection. Set by the host; read only.
|
|
717
|
+
*/
|
|
718
|
+
choices?: string[];
|
|
467
719
|
}
|
|
468
720
|
/** GenerateResult lists what the plugin wrote, workspace-relative. */
|
|
469
721
|
export interface GenerateResult {
|
|
@@ -535,6 +787,24 @@ export interface InitializeResult {
|
|
|
535
787
|
* just those.
|
|
536
788
|
*/
|
|
537
789
|
kinds?: ProjectKind[];
|
|
790
|
+
/**
|
|
791
|
+
* Follows are the shape keys (see Project.Shape) the plugin applies when it generates a project
|
|
792
|
+
* with GenerateParams.Shape. Where siblings split on a key, the host asks the person only for a
|
|
793
|
+
* key that a plugin of the stack follows. Absent means the plugin follows none.
|
|
794
|
+
*/
|
|
795
|
+
follows?: string[];
|
|
796
|
+
/**
|
|
797
|
+
* Choices are the options on an axis (framework, test, style) the plugin owns. The host lists
|
|
798
|
+
* them (smith choices) and checks a selection of them (smith add --with). Absent means the plugin
|
|
799
|
+
* owns none.
|
|
800
|
+
*/
|
|
801
|
+
choices?: Choice[];
|
|
802
|
+
/**
|
|
803
|
+
* Tools are the programs the plugin needs on the person's machine. The host detects them and,
|
|
804
|
+
* when one is missing, presents the ways to get it (smith tools). Absent means the plugin
|
|
805
|
+
* declares none.
|
|
806
|
+
*/
|
|
807
|
+
tools?: ToolNeed[];
|
|
538
808
|
}
|
|
539
809
|
/**
|
|
540
810
|
* Input is one input of an ActionStep. Values are written as quoted YAML strings, except true and
|
|
@@ -587,6 +857,62 @@ export interface LatestResult {
|
|
|
587
857
|
unreachable?: Record<string, string>;
|
|
588
858
|
tools?: ToolPin[];
|
|
589
859
|
}
|
|
860
|
+
/**
|
|
861
|
+
* LinkOption is one way to write the dependency, with its consequence in words a person who read no
|
|
862
|
+
* manual can follow.
|
|
863
|
+
*/
|
|
864
|
+
export interface LinkOption {
|
|
865
|
+
/** Spec is the value passed back in LinkParams.Spec. */
|
|
866
|
+
spec: string;
|
|
867
|
+
/** Label is the option in a few words. */
|
|
868
|
+
label: string;
|
|
869
|
+
/** Meaning says what happens with this option. */
|
|
870
|
+
meaning: string;
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* LinkParams asks a plugin to make Project depend on Library, a lib or package of the same
|
|
874
|
+
* workspace and language, in the ecosystem's own form, and to install or lock as that needs. The
|
|
875
|
+
* host has checked that both exist, that the languages match, that Library is not an app, and that
|
|
876
|
+
* the link makes no cycle; the plugin answers with an error that names the file when it cannot
|
|
877
|
+
* write the dependency.
|
|
878
|
+
*/
|
|
879
|
+
export interface LinkParams {
|
|
880
|
+
/** Project is the project that gains the dependency. */
|
|
881
|
+
project: Project;
|
|
882
|
+
/** Library is the project it depends on. */
|
|
883
|
+
library: Project;
|
|
884
|
+
/** Quiet keeps the package manager's output unless it fails. */
|
|
885
|
+
quiet?: boolean;
|
|
886
|
+
/**
|
|
887
|
+
* Plan asks for the plan only: the plugin writes nothing and answers with the manifest, the line
|
|
888
|
+
* it would write and the choices the user has.
|
|
889
|
+
*/
|
|
890
|
+
plan?: boolean;
|
|
891
|
+
/**
|
|
892
|
+
* Spec is the version range the user chose from LinkResult.Options; empty means the plugin's
|
|
893
|
+
* default, or the form the workspace already uses.
|
|
894
|
+
*/
|
|
895
|
+
spec?: string;
|
|
896
|
+
}
|
|
897
|
+
/** LinkResult is what a link wrote, or with LinkParams.Plan would write. */
|
|
898
|
+
export interface LinkResult {
|
|
899
|
+
/** Files are the workspace-relative files changed (or to be changed). */
|
|
900
|
+
files?: string[];
|
|
901
|
+
/** Notes are for the user. */
|
|
902
|
+
notes?: string[];
|
|
903
|
+
/** Manifest is the file the dependency goes into, workspace-relative. */
|
|
904
|
+
manifest?: string;
|
|
905
|
+
/**
|
|
906
|
+
* Line is the dependency as it is written there, for the plan shown before anything is written
|
|
907
|
+
* ("@acme/core": "*").
|
|
908
|
+
*/
|
|
909
|
+
line?: string;
|
|
910
|
+
/**
|
|
911
|
+
* Options are the real choices of the range written, with the default first. Empty when the
|
|
912
|
+
* ecosystem has none, or the workspace already follows a convention (then Line shows it).
|
|
913
|
+
*/
|
|
914
|
+
options?: LinkOption[];
|
|
915
|
+
}
|
|
590
916
|
/**
|
|
591
917
|
* PackageStore is where a package manager keeps what it downloaded (npm's ~/.npm, Go's module
|
|
592
918
|
* cache). A generated pipeline restores it before setup and saves it after a run, keyed on Files,
|
|
@@ -694,6 +1020,14 @@ export interface Project {
|
|
|
694
1020
|
* [projects.<project>.<name>] on top. Set by the host; a plugin reads its own entry.
|
|
695
1021
|
*/
|
|
696
1022
|
settings?: Record<string, Record<string, unknown>>;
|
|
1023
|
+
/**
|
|
1024
|
+
* Shape is the dialect of the project: named facts about how it is made ("build.tool": "esbuild",
|
|
1025
|
+
* "test.runner": "@swc/jest", "exports.target": "dist"), each a short string, read from the
|
|
1026
|
+
* manifest and files the plugin already reads in discovery. The host counts the shapes of the
|
|
1027
|
+
* projects of one kind and language to let a new project follow what they do, and knows no key
|
|
1028
|
+
* itself. Nil when the plugin does not describe shapes.
|
|
1029
|
+
*/
|
|
1030
|
+
shape?: Record<string, string>;
|
|
697
1031
|
/**
|
|
698
1032
|
* Registries are the private registries the project installs from and publishes to, from
|
|
699
1033
|
* smith.toml [registries]; nil means the public ones. Set by the host.
|
|
@@ -705,6 +1039,14 @@ export interface Project {
|
|
|
705
1039
|
* a project that has no release files. Set by the host.
|
|
706
1040
|
*/
|
|
707
1041
|
releaseAssets?: AssetSpec;
|
|
1042
|
+
/**
|
|
1043
|
+
* Facts are the shared facts that hold for the project, merged by the host, narrowest scope
|
|
1044
|
+
* first: [projects.<name>.facts], then [facts], then the defaults plugins published through
|
|
1045
|
+
* Contribution.Facts. A key that is absent was set by no one: the plugin uses its own default. A
|
|
1046
|
+
* request made before every plugin has contributed carries the smith.toml facts and the defaults
|
|
1047
|
+
* published so far. Set by the host; read only.
|
|
1048
|
+
*/
|
|
1049
|
+
facts?: Record<string, unknown>;
|
|
708
1050
|
}
|
|
709
1051
|
/**
|
|
710
1052
|
* ProjectKind is the universal kind vocabulary.
|
|
@@ -742,6 +1084,25 @@ export interface PublishParams {
|
|
|
742
1084
|
*/
|
|
743
1085
|
commit?: string;
|
|
744
1086
|
branch?: string;
|
|
1087
|
+
/**
|
|
1088
|
+
* Tag is the name of the release channel the version belongs to (npm's dist-tag "beta"). When
|
|
1089
|
+
* set, the plugin publishes under it and leaves the registry's stable pointer where it is, or
|
|
1090
|
+
* ignores it when its registry has no such pointer. Only sent to a plugin with the channels
|
|
1091
|
+
* capability.
|
|
1092
|
+
*/
|
|
1093
|
+
tag?: string;
|
|
1094
|
+
/**
|
|
1095
|
+
* PropagationWait is the longest time a plugin waits, in a Finalize call, for the packages of the
|
|
1096
|
+
* release to be fetchable from the registry: a duration such as "15m", "0" to not wait. Empty
|
|
1097
|
+
* means the default. Only npm has such a wait. A publish never waits.
|
|
1098
|
+
*/
|
|
1099
|
+
propagationWait?: string;
|
|
1100
|
+
/**
|
|
1101
|
+
* Finalize turns the call into the last phase of a release: nothing is published; for each move
|
|
1102
|
+
* the plugin waits until its packages are fetchable, then moves the dist-tag. The host sends it
|
|
1103
|
+
* after every project has published, so a wait never blocks another publish.
|
|
1104
|
+
*/
|
|
1105
|
+
finalize?: TagMove[];
|
|
745
1106
|
}
|
|
746
1107
|
/**
|
|
747
1108
|
* PublishResult reports what happened. Skipped with a reason is a success: an already-published
|
|
@@ -751,6 +1112,20 @@ export interface PublishResult {
|
|
|
751
1112
|
published: boolean;
|
|
752
1113
|
skipped?: string;
|
|
753
1114
|
registry?: string;
|
|
1115
|
+
/**
|
|
1116
|
+
* Notes are things the person must know about a publish that succeeded, such as a dist-tag that
|
|
1117
|
+
* was not moved; the host prints them and the report keeps them.
|
|
1118
|
+
*/
|
|
1119
|
+
notes?: string[];
|
|
1120
|
+
/**
|
|
1121
|
+
* PendingMoves are the dist-tags the call did not move, because the packages the release needs
|
|
1122
|
+
* were not fetchable yet. A publish returns them for the host to move at the end of the release;
|
|
1123
|
+
* a Finalize call returns the ones still waiting when its time ran out. The release then ends
|
|
1124
|
+
* with a warning, never silently.
|
|
1125
|
+
*/
|
|
1126
|
+
pendingMoves?: TagMove[];
|
|
1127
|
+
/** Moved names the dist-tags a Finalize call moved ("name@version tag"). */
|
|
1128
|
+
moved?: string[];
|
|
754
1129
|
/**
|
|
755
1130
|
* Assets are the workspace-relative files built for the release, in upload order; in a dry run,
|
|
756
1131
|
* the files that would be built.
|
|
@@ -931,6 +1306,12 @@ export interface Stack {
|
|
|
931
1306
|
/** Scaffold generates new projects; empty means the language plugin does. */
|
|
932
1307
|
scaffold?: string;
|
|
933
1308
|
deploy?: string[];
|
|
1309
|
+
/**
|
|
1310
|
+
* Choices make the stack a saved selection (see Choice). When they are set, the host derives the
|
|
1311
|
+
* language, the scaffold and the toolchain from them, and Toolchain lists only the plugins to add
|
|
1312
|
+
* after those. The plugins of the stack get the choices in GenerateParams.Choices.
|
|
1313
|
+
*/
|
|
1314
|
+
choices?: string[];
|
|
934
1315
|
}
|
|
935
1316
|
/** Step is one command a CI phase runs. */
|
|
936
1317
|
export interface Step {
|
|
@@ -948,6 +1329,19 @@ export interface Step {
|
|
|
948
1329
|
*/
|
|
949
1330
|
cacheFiles?: string[];
|
|
950
1331
|
}
|
|
1332
|
+
/**
|
|
1333
|
+
* TagMove is a dist-tag a publish left where it was, because the packages the release needs were
|
|
1334
|
+
* not fetchable yet.
|
|
1335
|
+
*/
|
|
1336
|
+
export interface TagMove {
|
|
1337
|
+
/** Package and Version name the package that carries the tag. */
|
|
1338
|
+
package: string;
|
|
1339
|
+
version: string;
|
|
1340
|
+
/** Tag is the dist-tag to move to Version. */
|
|
1341
|
+
tag: string;
|
|
1342
|
+
/** Awaits are the packages that must be fetchable first. */
|
|
1343
|
+
awaits: string[];
|
|
1344
|
+
}
|
|
951
1345
|
/** Task is a command the host can run, hash and cache. */
|
|
952
1346
|
export interface Task {
|
|
953
1347
|
/** Command is an argv array; it is never passed through a shell. */
|
|
@@ -991,6 +1385,94 @@ export interface Task {
|
|
|
991
1385
|
/** ServeTimeout is how long to wait for ServeURL, as a Go duration ("60s"); empty means 60s. */
|
|
992
1386
|
serveTimeout?: string;
|
|
993
1387
|
}
|
|
1388
|
+
/**
|
|
1389
|
+
* ToolInstall is one way to get a tool with a package manager. Manager is one of: "winget", "brew",
|
|
1390
|
+
* "brew-cask", "apt", "dnf", "pacman", "npm", "uv", "fnm", "rustup" and "cargo". The host builds
|
|
1391
|
+
* the exact command from the manager and Package; Package may hold {major} and {major.minor}, which
|
|
1392
|
+
* the pinned or suggested version fills. The language's own installers (uv, fnm, rustup, cargo) are
|
|
1393
|
+
* offered only when they are already on the machine.
|
|
1394
|
+
*/
|
|
1395
|
+
export interface ToolInstall {
|
|
1396
|
+
manager: string;
|
|
1397
|
+
package: string;
|
|
1398
|
+
/** Note adds a sentence the person needs before choosing ("a new terminal is needed"). */
|
|
1399
|
+
note?: string;
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* ToolNeed is a program on the person's machine that a plugin needs to build, test or run its
|
|
1403
|
+
* projects (Python, the .NET SDK, Docker). A plugin publishes the tools it needs in
|
|
1404
|
+
* InitializeResult.Tools. The host detects them, and when one is missing it presents the ways to
|
|
1405
|
+
* get it (ADR 0077): it never installs in silence. The plugin writes facts only (what the tool is,
|
|
1406
|
+
* how to detect it, how each system gets it); the host decides how to ask.
|
|
1407
|
+
*/
|
|
1408
|
+
export interface ToolNeed {
|
|
1409
|
+
/**
|
|
1410
|
+
* Name identifies the tool across plugins and in commands (smith tools install python). Two
|
|
1411
|
+
* plugins that need the same tool use the same Name.
|
|
1412
|
+
*/
|
|
1413
|
+
name: string;
|
|
1414
|
+
/**
|
|
1415
|
+
* Title is what the tool is called in text: "Python", "the .NET SDK". Doctor words the check
|
|
1416
|
+
* "<Title> is installed".
|
|
1417
|
+
*/
|
|
1418
|
+
title: string;
|
|
1419
|
+
/** Why says in plain words what smith needs the tool for. */
|
|
1420
|
+
why: string;
|
|
1421
|
+
/**
|
|
1422
|
+
* Consequence says what stops working while the tool is missing, as the end of a sentence that
|
|
1423
|
+
* starts "If you skip it, ": "smith test and smith build fail for the python projects".
|
|
1424
|
+
*/
|
|
1425
|
+
consequence: string;
|
|
1426
|
+
/** Program is the program that carries the tool on PATH ("python3"). */
|
|
1427
|
+
program: string;
|
|
1428
|
+
/** Alternatives are other programs that also count ("python", "py"). */
|
|
1429
|
+
alternatives?: string[];
|
|
1430
|
+
/** VersionArgs are the arguments that make Program print its version. Absent means --version. */
|
|
1431
|
+
versionArgs?: string[];
|
|
1432
|
+
/**
|
|
1433
|
+
* Pins are the files where a workspace pins the version it wants. The first pin the host finds
|
|
1434
|
+
* gives the version range. Absent means any version counts.
|
|
1435
|
+
*/
|
|
1436
|
+
pins?: ToolVersionPin[];
|
|
1437
|
+
/**
|
|
1438
|
+
* Choice limits the tool to stacks that have this choice ("azure-functions"): the tool is not
|
|
1439
|
+
* needed by a project built without it. Absent means every project of the plugin needs it.
|
|
1440
|
+
*/
|
|
1441
|
+
choice?: string;
|
|
1442
|
+
/**
|
|
1443
|
+
* Files limit the tool to projects that hold one of these files in their folder
|
|
1444
|
+
* ("build.gradle.kts"): a Gradle build needs gradle, a Maven build does not. A tool that the
|
|
1445
|
+
* tasks of a project run (gradle, mvn) is declared this way. Absent means every project of the
|
|
1446
|
+
* plugin needs it.
|
|
1447
|
+
*/
|
|
1448
|
+
files?: string[];
|
|
1449
|
+
/**
|
|
1450
|
+
* Systems limits the tool to these systems, named as Go names them ("windows", "darwin",
|
|
1451
|
+
* "linux"): the Xcode Command Line Tools exist only on "darwin". Absent means every system.
|
|
1452
|
+
*/
|
|
1453
|
+
systems?: string[];
|
|
1454
|
+
/**
|
|
1455
|
+
* Suggested is the version smith installs when no pin says one: "3.13". It fills {major} and
|
|
1456
|
+
* {major.minor} in the install entries.
|
|
1457
|
+
*/
|
|
1458
|
+
suggested?: string;
|
|
1459
|
+
/**
|
|
1460
|
+
* Optional marks a tool whose absence only costs a feature (running a function app locally).
|
|
1461
|
+
* Doctor reports it as a warning, not a failure.
|
|
1462
|
+
*/
|
|
1463
|
+
optional?: boolean;
|
|
1464
|
+
/** Install are the ways to get the tool, per package manager and system. */
|
|
1465
|
+
install?: ToolInstall[];
|
|
1466
|
+
/**
|
|
1467
|
+
* Download is the official page of the tool, for the person who installs it by hand or has no
|
|
1468
|
+
* package manager.
|
|
1469
|
+
*/
|
|
1470
|
+
download: string;
|
|
1471
|
+
/** Source is the address of the page the Install entries were checked against. */
|
|
1472
|
+
source: string;
|
|
1473
|
+
/** Checked is the date (YYYY-MM-DD) the entries were last checked. */
|
|
1474
|
+
checked: string;
|
|
1475
|
+
}
|
|
994
1476
|
/**
|
|
995
1477
|
* ToolPin is a tool the plugin installs at a pinned version (in CI, the dev container, the venv)
|
|
996
1478
|
* against the newest release; informational.
|
|
@@ -1003,6 +1485,20 @@ export interface ToolPin {
|
|
|
1003
1485
|
/** Newer is true when Latest is a release the pin does not cover. */
|
|
1004
1486
|
newer?: boolean;
|
|
1005
1487
|
}
|
|
1488
|
+
/**
|
|
1489
|
+
* ToolVersionPin names a file that pins the version of a tool and how to read it. Format is one of:
|
|
1490
|
+
* "text" (the first word of the file, as in .nvmrc and .python-version), "go-mod" (the toolchain
|
|
1491
|
+
* line, else the go line), "pyproject" (requires-python), "global-json" (sdk.version) and
|
|
1492
|
+
* "rust-toolchain" (the channel).
|
|
1493
|
+
*/
|
|
1494
|
+
export interface ToolVersionPin {
|
|
1495
|
+
/**
|
|
1496
|
+
* File is the base name of the file, looked up at the workspace root and in the folders of the
|
|
1497
|
+
* projects that use the tool.
|
|
1498
|
+
*/
|
|
1499
|
+
file: string;
|
|
1500
|
+
format: string;
|
|
1501
|
+
}
|
|
1006
1502
|
/**
|
|
1007
1503
|
* Toolchain is a runtime the pipeline must install, and how. Plugins asking for the same name share
|
|
1008
1504
|
* one setup step (the first plugin's).
|
|
@@ -1030,6 +1526,14 @@ export interface UninstallParams {
|
|
|
1030
1526
|
project: Project;
|
|
1031
1527
|
packages: string[];
|
|
1032
1528
|
}
|
|
1529
|
+
/**
|
|
1530
|
+
* UnlinkParams asks a plugin to remove the dependency of Project on Library. Notes of the result
|
|
1531
|
+
* say so when the manifest held no such dependency.
|
|
1532
|
+
*/
|
|
1533
|
+
export interface UnlinkParams {
|
|
1534
|
+
project: Project;
|
|
1535
|
+
library: Project;
|
|
1536
|
+
}
|
|
1033
1537
|
/** VersionParams asks a plugin to record a new version in a project manifest. */
|
|
1034
1538
|
export interface VersionParams {
|
|
1035
1539
|
project: Project;
|
|
@@ -1166,6 +1670,21 @@ export interface ProtocolMethods {
|
|
|
1166
1670
|
result: DependencyResult;
|
|
1167
1671
|
capability: 'dependencies';
|
|
1168
1672
|
};
|
|
1673
|
+
/**
|
|
1674
|
+
* Makes a project depend on a library of the same workspace and language, in the ecosystem's own
|
|
1675
|
+
* form, then installs or locks as that needs.
|
|
1676
|
+
*/
|
|
1677
|
+
'dependencies/link': {
|
|
1678
|
+
params: LinkParams;
|
|
1679
|
+
result: LinkResult;
|
|
1680
|
+
capability: 'link';
|
|
1681
|
+
};
|
|
1682
|
+
/** Removes the dependency of a project on a library of the same workspace. */
|
|
1683
|
+
'dependencies/unlink': {
|
|
1684
|
+
params: UnlinkParams;
|
|
1685
|
+
result: DependencyResult;
|
|
1686
|
+
capability: 'link';
|
|
1687
|
+
};
|
|
1169
1688
|
/** Lists the dependencies the manifests of the plugin's projects declare. */
|
|
1170
1689
|
'dependencies/declared': {
|
|
1171
1690
|
params: DeclaredParams;
|
|
@@ -1197,6 +1716,25 @@ export interface ProtocolMethods {
|
|
|
1197
1716
|
result: ComponentsResult;
|
|
1198
1717
|
capability: 'components';
|
|
1199
1718
|
};
|
|
1719
|
+
/**
|
|
1720
|
+
* Asks which files a plugin derives from facts and the project graph (a tsconfig's references, a
|
|
1721
|
+
* test config's display name). The plugin writes nothing: it answers with the content, and the
|
|
1722
|
+
* host rewrites a file only when its ownership record allows.
|
|
1723
|
+
*/
|
|
1724
|
+
derive: {
|
|
1725
|
+
params: DeriveParams;
|
|
1726
|
+
result: DeriveResult;
|
|
1727
|
+
capability: 'derive';
|
|
1728
|
+
};
|
|
1729
|
+
/**
|
|
1730
|
+
* Asks for the public API names of a project, at the working tree or at a git revision (its last
|
|
1731
|
+
* release tag), so a release can compare them and say what bump the change needs.
|
|
1732
|
+
*/
|
|
1733
|
+
'api/surface': {
|
|
1734
|
+
params: APISurfaceParams;
|
|
1735
|
+
result: APISurfaceResult;
|
|
1736
|
+
capability: 'apiSurface';
|
|
1737
|
+
};
|
|
1200
1738
|
}
|
|
1201
1739
|
export type MethodName = keyof ProtocolMethods;
|
|
1202
1740
|
export type ParamsOf<M extends MethodName> = ProtocolMethods[M]['params'];
|