@monosmith/plugin-sdk 0.0.0-stage → 0.2.0
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/README.md +90 -2
- package/build-dir/build-dir.algorithm.d.ts +16 -0
- package/build-dir/build-dir.algorithm.js +26 -0
- package/build-dir/index.d.ts +1 -0
- package/build-dir/index.js +1 -0
- package/ci/ci-contribution.algorithm.d.ts +28 -0
- package/ci/ci-contribution.algorithm.js +19 -0
- package/ci/index.d.ts +2 -0
- package/ci/index.js +1 -0
- package/codec/encode-by-schema.algorithm.d.ts +12 -0
- package/codec/encode-by-schema.algorithm.js +105 -0
- package/codec/encode-error.error.d.ts +4 -0
- package/codec/encode-error.error.js +7 -0
- package/codec/encode-json-value.algorithm.d.ts +13 -0
- package/codec/encode-json-value.algorithm.js +51 -0
- package/codec/index.d.ts +6 -0
- package/codec/index.js +5 -0
- package/codec/message-parse.error.d.ts +4 -0
- package/codec/message-parse.error.js +7 -0
- package/codec/method-codec.algorithm.d.ts +8 -0
- package/codec/method-codec.algorithm.js +31 -0
- package/codec/normalize-by-schema.algorithm.d.ts +14 -0
- package/codec/normalize-by-schema.algorithm.js +103 -0
- package/codec/params-error.error.d.ts +4 -0
- package/codec/params-error.error.js +7 -0
- package/codec/schema-lookup.algorithm.d.ts +13 -0
- package/codec/schema-lookup.algorithm.js +56 -0
- package/codec/wire-message.mapper.d.ts +27 -0
- package/codec/wire-message.mapper.js +62 -0
- package/concurrency/concurrency.policy.d.ts +21 -0
- package/concurrency/concurrency.policy.js +30 -0
- package/concurrency/index.d.ts +1 -0
- package/concurrency/index.js +1 -0
- package/conformance/check-generation.use-case.d.ts +12 -0
- package/conformance/check-generation.use-case.js +91 -0
- package/conformance/check-plugin.use-case.d.ts +25 -0
- package/conformance/check-plugin.use-case.js +81 -0
- package/conformance/check-scheduling.use-case.d.ts +11 -0
- package/conformance/check-scheduling.use-case.js +98 -0
- package/conformance/conformance-report.model.d.ts +22 -0
- package/conformance/conformance-report.model.js +23 -0
- package/conformance/find-manifests.algorithm.d.ts +7 -0
- package/conformance/find-manifests.algorithm.js +34 -0
- package/conformance/go-list.mapper.d.ts +4 -0
- package/conformance/go-list.mapper.js +8 -0
- package/conformance/index.d.ts +5 -0
- package/conformance/index.js +3 -0
- package/framing/frame-message.algorithm.d.ts +5 -0
- package/framing/frame-message.algorithm.js +8 -0
- package/framing/frame-reader.store.d.ts +15 -0
- package/framing/frame-reader.store.js +59 -0
- package/framing/framing.error.d.ts +4 -0
- package/framing/framing.error.js +7 -0
- package/framing/index.d.ts +3 -0
- package/framing/index.js +3 -0
- package/host/call-interrupted.error.d.ts +16 -0
- package/host/call-interrupted.error.js +20 -0
- package/host/connect-plugin.use-case.d.ts +26 -0
- package/host/connect-plugin.use-case.js +44 -0
- package/host/host-options.contract.d.ts +34 -0
- package/host/host-options.contract.js +4 -0
- package/host/index.d.ts +9 -0
- package/host/index.js +5 -0
- package/host/plugin-client.client.d.ts +61 -0
- package/host/plugin-client.client.js +297 -0
- package/host/start-plugin.use-case.d.ts +10 -0
- package/host/start-plugin.use-case.js +57 -0
- package/index.d.ts +16 -0
- package/index.js +21 -0
- package/jsondoc/indent-raw-json.algorithm.d.ts +8 -0
- package/jsondoc/indent-raw-json.algorithm.js +60 -0
- package/jsondoc/index.d.ts +2 -0
- package/jsondoc/index.js +2 -0
- package/jsondoc/json-document.error.d.ts +4 -0
- package/jsondoc/json-document.error.js +7 -0
- package/jsondoc/json-document.model.d.ts +38 -0
- package/jsondoc/json-document.model.js +113 -0
- package/jsondoc/scan-json-object.algorithm.d.ts +17 -0
- package/jsondoc/scan-json-object.algorithm.js +132 -0
- package/package.json +34 -4
- package/plugin-refs/index.d.ts +1 -0
- package/plugin-refs/index.js +1 -0
- package/plugin-refs/plugin-ref.policy.d.ts +9 -0
- package/plugin-refs/plugin-ref.policy.js +22 -0
- package/plugin-roles/index.d.ts +1 -0
- package/plugin-roles/index.js +1 -0
- package/plugin-roles/plugin-role.policy.d.ts +16 -0
- package/plugin-roles/plugin-role.policy.js +30 -0
- package/projects/audit-settings.policy.d.ts +5 -0
- package/projects/audit-settings.policy.js +8 -0
- package/projects/index.d.ts +6 -0
- package/projects/index.js +6 -0
- package/projects/manifest-match.algorithm.d.ts +7 -0
- package/projects/manifest-match.algorithm.js +38 -0
- package/projects/project-kind.policy.d.ts +9 -0
- package/projects/project-kind.policy.js +28 -0
- package/projects/publishes.policy.d.ts +7 -0
- package/projects/publishes.policy.js +8 -0
- package/projects/set-toolchain.algorithm.d.ts +7 -0
- package/projects/set-toolchain.algorithm.js +13 -0
- package/projects/stack-plugins.algorithm.d.ts +3 -0
- package/projects/stack-plugins.algorithm.js +4 -0
- package/protocol/index.d.ts +4 -0
- package/protocol/index.js +3 -0
- package/protocol/protocol-schema.contract.d.ts +3 -0
- package/protocol/protocol-schema.contract.js +1976 -0
- package/protocol/protocol-types.contract.d.ts +1057 -0
- package/protocol/protocol-types.contract.js +43 -0
- package/protocol/rpc-error.error.d.ts +9 -0
- package/protocol/rpc-error.error.js +13 -0
- package/protocol/schema-document.contract.d.ts +58 -0
- package/protocol/schema-document.contract.js +1 -0
- package/scaffold/index.d.ts +3 -0
- package/scaffold/index.js +2 -0
- package/scaffold/scaffold-data.mapper.d.ts +15 -0
- package/scaffold/scaffold-data.mapper.js +24 -0
- package/scaffold/scaffold-project.use-case.d.ts +20 -0
- package/scaffold/scaffold-project.use-case.js +13 -0
- package/serve/capabilities-of.algorithm.d.ts +14 -0
- package/serve/capabilities-of.algorithm.js +31 -0
- package/serve/claim-stdout.use-case.d.ts +10 -0
- package/serve/claim-stdout.use-case.js +14 -0
- package/serve/dispatch-request.use-case.d.ts +15 -0
- package/serve/dispatch-request.use-case.js +57 -0
- package/serve/index.d.ts +4 -0
- package/serve/index.js +2 -0
- package/serve/initialize-plugin.use-case.d.ts +9 -0
- package/serve/initialize-plugin.use-case.js +16 -0
- package/serve/plugin-members.config.d.ts +16 -0
- package/serve/plugin-members.config.js +25 -0
- package/serve/plugin.contract.d.ts +80 -0
- package/serve/plugin.contract.js +1 -0
- package/serve/protocol-streams.contract.d.ts +13 -0
- package/serve/protocol-streams.contract.js +1 -0
- package/serve/request-outcome.contract.d.ts +9 -0
- package/serve/request-outcome.contract.js +1 -0
- package/serve/request-pool.store.d.ts +49 -0
- package/serve/request-pool.store.js +110 -0
- package/serve/serve.use-case.d.ts +31 -0
- package/serve/serve.use-case.js +180 -0
- package/tasks/contribute-tasks.algorithm.d.ts +15 -0
- package/tasks/contribute-tasks.algorithm.js +22 -0
- package/tasks/index.d.ts +2 -0
- package/tasks/index.js +2 -0
- package/tasks/task.algorithm.d.ts +18 -0
- package/tasks/task.algorithm.js +23 -0
- package/templating/file-exists.error.d.ts +6 -0
- package/templating/file-exists.error.js +10 -0
- package/templating/index.d.ts +4 -0
- package/templating/index.js +4 -0
- package/templating/parse-template.algorithm.d.ts +11 -0
- package/templating/parse-template.algorithm.js +197 -0
- package/templating/render-template.algorithm.d.ts +7 -0
- package/templating/render-template.algorithm.js +87 -0
- package/templating/template-functions.algorithm.d.ts +10 -0
- package/templating/template-functions.algorithm.js +104 -0
- package/templating/template-syntax.contract.d.ts +33 -0
- package/templating/template-syntax.contract.js +1 -0
- package/templating/template.error.d.ts +4 -0
- package/templating/template.error.js +7 -0
- package/templating/tokenize-action.algorithm.d.ts +20 -0
- package/templating/tokenize-action.algorithm.js +57 -0
- package/templating/write-templates.use-case.d.ts +11 -0
- package/templating/write-templates.use-case.js +44 -0
|
@@ -0,0 +1,1057 @@
|
|
|
1
|
+
/** The protocol major version this SDK speaks. A breaking change to the protocol raises it. */
|
|
2
|
+
export declare const PROTOCOL_VERSION = 1;
|
|
3
|
+
/** The largest message the framing accepts, in bytes. */
|
|
4
|
+
export declare const MAX_MESSAGE_BYTES = 67108864;
|
|
5
|
+
/** The error codes of the protocol: the JSON-RPC 2.0 ones, and `PluginFailure` for a failure the user must act on. */
|
|
6
|
+
export declare const ERROR_CODES: {
|
|
7
|
+
/** The message was not valid JSON. The response has a null id. */
|
|
8
|
+
readonly ParseError: -32700;
|
|
9
|
+
/**
|
|
10
|
+
* The request is not valid, or arrived out of order: every request before initialize is refused
|
|
11
|
+
* with this code.
|
|
12
|
+
*/
|
|
13
|
+
readonly InvalidRequest: -32600;
|
|
14
|
+
/**
|
|
15
|
+
* The plugin does not implement the method, or did not advertise the capability. The message is
|
|
16
|
+
* "method not supported: <method>".
|
|
17
|
+
*/
|
|
18
|
+
readonly MethodNotFound: -32601;
|
|
19
|
+
/** The params do not have the shape the method expects. */
|
|
20
|
+
readonly InvalidParams: -32602;
|
|
21
|
+
/**
|
|
22
|
+
* The plugin failed in a way that is not the user's to act on, for example a result that could
|
|
23
|
+
* not be encoded.
|
|
24
|
+
*/
|
|
25
|
+
readonly InternalError: -32603;
|
|
26
|
+
/**
|
|
27
|
+
* The method ran and failed for a reason the user must act on (a missing toolchain, a bad
|
|
28
|
+
* manifest). The message is shown to the user as it is, so it should say what to do. An error a
|
|
29
|
+
* method of the Go SDK returns becomes this code.
|
|
30
|
+
*/
|
|
31
|
+
readonly PluginFailure: -32000;
|
|
32
|
+
/**
|
|
33
|
+
* The plugin stopped the request because the host sent a cancel notification for its id. A plugin
|
|
34
|
+
* that had finished answers with the result instead. Only a plugin that advertised the cancel
|
|
35
|
+
* capability sends it; when a cancelled request fails with any error, the SDKs answer with this
|
|
36
|
+
* code.
|
|
37
|
+
*/
|
|
38
|
+
readonly RequestCancelled: -32800;
|
|
39
|
+
};
|
|
40
|
+
export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
|
|
41
|
+
/**
|
|
42
|
+
* ActionStep is a provider-native step: a GitHub action or an Azure task, with its inputs in the
|
|
43
|
+
* order they are written.
|
|
44
|
+
*/
|
|
45
|
+
export interface ActionStep {
|
|
46
|
+
/** Uses is the action ("actions/setup-go@v7") or task ("GoTool@0"). */
|
|
47
|
+
uses: string;
|
|
48
|
+
inputs?: Input[];
|
|
49
|
+
}
|
|
50
|
+
/** AssetSpec describes the release files of an app. */
|
|
51
|
+
export interface AssetSpec {
|
|
52
|
+
/** Name is the file name pattern; placeholders are {product}, {version}, {os}, {arch} and {ext}. */
|
|
53
|
+
name: string;
|
|
54
|
+
/** Product fills {product}; it defaults to the project name. */
|
|
55
|
+
product?: string;
|
|
56
|
+
/** Platforms are "os/arch" pairs in the language's own spelling. */
|
|
57
|
+
platforms: string[];
|
|
58
|
+
/** OSAlias and ArchAlias rename an os or arch in file names only. */
|
|
59
|
+
osAlias?: Record<string, string>;
|
|
60
|
+
archAlias?: Record<string, string>;
|
|
61
|
+
/**
|
|
62
|
+
* VersionVariable is the symbol the version is stamped into, for languages that stamp at link
|
|
63
|
+
* time (Go: main.version).
|
|
64
|
+
*/
|
|
65
|
+
versionVariable?: string;
|
|
66
|
+
/** OutDir is the workspace-relative directory the files go to. */
|
|
67
|
+
outDir: string;
|
|
68
|
+
}
|
|
69
|
+
/** AuditSettings are the workspace's audit policy choices ([ci] audit_*). */
|
|
70
|
+
export interface AuditSettings {
|
|
71
|
+
/**
|
|
72
|
+
* Policies are the ecosystems ("node", "go", "python", "rust") whose policy checks run in `smith
|
|
73
|
+
* ci audit`, as extra Audit steps.
|
|
74
|
+
*/
|
|
75
|
+
policies?: string[];
|
|
76
|
+
/** Warn are the policies whose checks only warn instead of blocking. */
|
|
77
|
+
warn?: string[];
|
|
78
|
+
/** AllowInstallScripts names npm packages whose install scripts the node policy accepts. */
|
|
79
|
+
allowInstallScripts?: string[];
|
|
80
|
+
/** MaxUnsafe is the number of unsafe blocks the rust policy accepts in all (zero: none). */
|
|
81
|
+
maxUnsafe?: number;
|
|
82
|
+
}
|
|
83
|
+
/** CIParams gives the plugin the projects it owns so it can describe what CI needs for them. */
|
|
84
|
+
export interface CIParams {
|
|
85
|
+
projects: Project[];
|
|
86
|
+
/**
|
|
87
|
+
* Audit is the workspace's opt-in to policy checks beyond the vulnerability scan; the zero value
|
|
88
|
+
* asks for none.
|
|
89
|
+
*/
|
|
90
|
+
audit?: AuditSettings;
|
|
91
|
+
}
|
|
92
|
+
/** CIResult is the plugin's contribution to every generated pipeline. */
|
|
93
|
+
export interface CIResult {
|
|
94
|
+
/**
|
|
95
|
+
* Stores are the package managers' download stores the pipeline caches between runs, keyed on the
|
|
96
|
+
* lockfiles that decide what is in them.
|
|
97
|
+
*/
|
|
98
|
+
stores?: PackageStore[];
|
|
99
|
+
/** Toolchains are rendered as provider-native setup steps. */
|
|
100
|
+
toolchains?: Toolchain[];
|
|
101
|
+
/** Setup steps run in `smith ci setup`, in order, from the workspace root. */
|
|
102
|
+
setup?: Step[];
|
|
103
|
+
/** Audit steps run in `smith ci audit`. */
|
|
104
|
+
audit?: Step[];
|
|
105
|
+
/**
|
|
106
|
+
* PostRelease steps run at the end of `smith ci release`, whether or not anything was released,
|
|
107
|
+
* with the release's credentials: work that must follow every push to the release branch (setting
|
|
108
|
+
* a registry description from a file). They run only after a release that did not fail, from the
|
|
109
|
+
* workspace root, and a step that is not Blocking only warns.
|
|
110
|
+
*/
|
|
111
|
+
postRelease?: Step[];
|
|
112
|
+
/** Credentials names the environment variables `smith ci release` needs. */
|
|
113
|
+
credentials?: Credential[];
|
|
114
|
+
/**
|
|
115
|
+
* Permissions are the GitHub Actions token permissions the release needs beyond the defaults
|
|
116
|
+
* ("packages: write" to push to ghcr.io). Other providers have no such permissions and ignore
|
|
117
|
+
* them.
|
|
118
|
+
*/
|
|
119
|
+
permissions?: string[];
|
|
120
|
+
/**
|
|
121
|
+
* Authenticate are provider-native steps that sign in to a private registry before setup (Azure
|
|
122
|
+
* Pipelines' npmAuthenticate@0, say). A provider the plugin gives no step for gets none: its
|
|
123
|
+
* credentials come from the environment instead.
|
|
124
|
+
*/
|
|
125
|
+
authenticate?: Toolchain[];
|
|
126
|
+
}
|
|
127
|
+
/** CancelParams are the params of the cancel notification. */
|
|
128
|
+
export interface CancelParams {
|
|
129
|
+
/**
|
|
130
|
+
* ID is the id of the in-flight request to stop. An id the plugin does not know, or whose request
|
|
131
|
+
* is already answered, is ignored.
|
|
132
|
+
*/
|
|
133
|
+
id: number;
|
|
134
|
+
}
|
|
135
|
+
/** Capabilities are the optional methods a plugin implements. */
|
|
136
|
+
export interface Capabilities {
|
|
137
|
+
discover?: boolean;
|
|
138
|
+
generate?: boolean;
|
|
139
|
+
version?: boolean;
|
|
140
|
+
publish?: boolean;
|
|
141
|
+
ci?: boolean;
|
|
142
|
+
doctor?: boolean;
|
|
143
|
+
/** Contribute is a convention plugin's: it adds tasks to projects other plugins discovered. */
|
|
144
|
+
contribute?: boolean;
|
|
145
|
+
/** Remove cleans up a removed project's traces outside its directory. */
|
|
146
|
+
remove?: boolean;
|
|
147
|
+
/** Published reports what a registry has of a project. */
|
|
148
|
+
published?: boolean;
|
|
149
|
+
/** Dependencies installs and uninstalls packages in its projects. */
|
|
150
|
+
dependencies?: boolean;
|
|
151
|
+
/** Declarations lists and rewrites declared dependency specs (sync, up). */
|
|
152
|
+
declarations?: boolean;
|
|
153
|
+
/** Latest reports the newest releases of dependencies and pinned tools. */
|
|
154
|
+
latest?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Cancel says the plugin stops the work of a request when the host sends a cancel notification
|
|
157
|
+
* with its id, then answers that request with its result (if the work was already done) or the
|
|
158
|
+
* request-cancelled error. A host never sends the notification to a plugin without it.
|
|
159
|
+
*/
|
|
160
|
+
cancel?: boolean;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* ContributeParams hands a plugin the projects it applies to: those whose stack includes it, or,
|
|
164
|
+
* for a workspace-wide convention, those of the languages it supports that smith.toml enables it
|
|
165
|
+
* for.
|
|
166
|
+
*/
|
|
167
|
+
export interface ContributeParams {
|
|
168
|
+
projects: Project[];
|
|
169
|
+
}
|
|
170
|
+
/** ContributeResult is what a convention adds, by project name. */
|
|
171
|
+
export interface ContributeResult {
|
|
172
|
+
projects?: Record<string, Contribution>;
|
|
173
|
+
}
|
|
174
|
+
/** Contribution is a convention's addition to one project. */
|
|
175
|
+
export interface Contribution {
|
|
176
|
+
/** Tasks are new tasks. A task the project already has is kept as it is. */
|
|
177
|
+
tasks?: Record<string, Task>;
|
|
178
|
+
/**
|
|
179
|
+
* Replace are tasks that replace the project's task of the same name, or are added when it has
|
|
180
|
+
* none.
|
|
181
|
+
*/
|
|
182
|
+
replace?: Record<string, Task>;
|
|
183
|
+
/**
|
|
184
|
+
* DependsOn adds dependencies to tasks the project already has, by task name ({"lint":
|
|
185
|
+
* ["slice-check"]}).
|
|
186
|
+
*/
|
|
187
|
+
dependsOn?: Record<string, string[]>;
|
|
188
|
+
}
|
|
189
|
+
/** Credential is a secret the release phase needs. */
|
|
190
|
+
export interface Credential {
|
|
191
|
+
env: string;
|
|
192
|
+
description: string;
|
|
193
|
+
/** Required false means release works without it (e.g. a dry run target). */
|
|
194
|
+
required: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Setup gives it to `smith ci setup` (and the native job's setup) as well: installs from a
|
|
197
|
+
* private registry need it, not only the release.
|
|
198
|
+
*/
|
|
199
|
+
setup?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Tasks gives it to every step that runs tasks (verify, pack, native) as well: the remote cache's
|
|
202
|
+
* key and credentials are read there, not only by the release.
|
|
203
|
+
*/
|
|
204
|
+
tasks?: boolean;
|
|
205
|
+
}
|
|
206
|
+
/** Declaration is one dependency one manifest declares. */
|
|
207
|
+
export interface Declaration {
|
|
208
|
+
/** Project is the declaring project's name, "" for the root manifest. */
|
|
209
|
+
project?: string;
|
|
210
|
+
/** File is the manifest, workspace-relative. */
|
|
211
|
+
file: string;
|
|
212
|
+
/** Name is the dependency's name as the ecosystem compares names. */
|
|
213
|
+
name: string;
|
|
214
|
+
/** Spec is the declared range or version (^1.2.3, >=2.31), "" when the manifest gives none. */
|
|
215
|
+
spec: string;
|
|
216
|
+
/** Section is where it is declared: dependencies, devDependencies, dev... */
|
|
217
|
+
section: string;
|
|
218
|
+
/**
|
|
219
|
+
* Peer declarations state what a package works with, not what is installed: sync and up leave
|
|
220
|
+
* them alone.
|
|
221
|
+
*/
|
|
222
|
+
peer?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Rewritable is false for a spec smith must not rewrite: a URL, a git ref, a workspace alias, a
|
|
225
|
+
* compound range, environment markers.
|
|
226
|
+
*/
|
|
227
|
+
rewritable: boolean;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* DeclaredParams asks for the dependencies the plugin's projects declare (and the workspace root's
|
|
231
|
+
* manifest, when the ecosystem has one).
|
|
232
|
+
*/
|
|
233
|
+
export interface DeclaredParams {
|
|
234
|
+
projects: Project[];
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* DeclaredResult is every declaration, and the version installed of each name where the plugin can
|
|
238
|
+
* tell.
|
|
239
|
+
*/
|
|
240
|
+
export interface DeclaredResult {
|
|
241
|
+
declarations: Declaration[];
|
|
242
|
+
installed?: Record<string, string>;
|
|
243
|
+
}
|
|
244
|
+
/** DependencyResult lists the workspace-relative files the plugin changed and notes for the user. */
|
|
245
|
+
export interface DependencyResult {
|
|
246
|
+
files?: string[];
|
|
247
|
+
notes?: string[];
|
|
248
|
+
}
|
|
249
|
+
/** DevcontainerFeature is a dev container feature and its options (https://containers.dev/features). */
|
|
250
|
+
export interface DevcontainerFeature {
|
|
251
|
+
/** ID is the feature reference, e.g. "ghcr.io/devcontainers/features/go:1". */
|
|
252
|
+
id: string;
|
|
253
|
+
options?: Record<string, string>;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* DiscoverParams asks a plugin to describe the projects behind manifests the host found. Paths are
|
|
257
|
+
* workspace-relative and use forward slashes.
|
|
258
|
+
*/
|
|
259
|
+
export interface DiscoverParams {
|
|
260
|
+
manifests: string[];
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* DiscoverResult describes every manifest that is a project of this plugin. A manifest the plugin
|
|
264
|
+
* does not own is simply left out.
|
|
265
|
+
*/
|
|
266
|
+
export interface DiscoverResult {
|
|
267
|
+
projects: Project[];
|
|
268
|
+
}
|
|
269
|
+
/** DoctorParams gives the plugin its projects to check. */
|
|
270
|
+
export interface DoctorParams {
|
|
271
|
+
projects: Project[];
|
|
272
|
+
}
|
|
273
|
+
/** DoctorResult carries the plugin's findings. */
|
|
274
|
+
export interface DoctorResult {
|
|
275
|
+
findings: Finding[];
|
|
276
|
+
}
|
|
277
|
+
/** An object with no members. */
|
|
278
|
+
export type Empty = Record<string, never>;
|
|
279
|
+
/** FileEdit is one file's new content, workspace-relative; Delete removes it. */
|
|
280
|
+
export interface FileEdit {
|
|
281
|
+
path: string;
|
|
282
|
+
content?: string;
|
|
283
|
+
delete?: boolean;
|
|
284
|
+
}
|
|
285
|
+
/** Finding is one check. Every failed finding names its remedy. */
|
|
286
|
+
export interface Finding {
|
|
287
|
+
check: string;
|
|
288
|
+
ok: boolean;
|
|
289
|
+
detail?: string;
|
|
290
|
+
remedy?: string;
|
|
291
|
+
/** Warning true reports a problem without failing doctor. */
|
|
292
|
+
warning?: boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Fix is the change that clears a failed finding, when the plugin can write it; smith doctor
|
|
295
|
+
* --fix shows it as a diff before applying it.
|
|
296
|
+
*/
|
|
297
|
+
fix?: Fix;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Fix is a change that clears a failed finding: files' new contents, then commands to run, and
|
|
301
|
+
* questions the user answers first. Every part is optional; the host shows all of it before
|
|
302
|
+
* applying anything.
|
|
303
|
+
*
|
|
304
|
+
* A host that does not know Steps or Choices ignores them, so a plugin marks a fix Safe only when
|
|
305
|
+
* its Files alone are sound.
|
|
306
|
+
*/
|
|
307
|
+
export interface Fix {
|
|
308
|
+
description: string;
|
|
309
|
+
/**
|
|
310
|
+
* Safe marks a fix that only restores what smith or the plugin owns and loses nothing of the
|
|
311
|
+
* user's; doctor --fix --yes applies only safe fixes with no Choices. Any other fix is asked
|
|
312
|
+
* about before it runs.
|
|
313
|
+
*/
|
|
314
|
+
safe: boolean;
|
|
315
|
+
/** Files are written first, as whole new contents. */
|
|
316
|
+
files?: FileEdit[];
|
|
317
|
+
/**
|
|
318
|
+
* Steps run after the files, in order, from the workspace root; the first one that fails stops
|
|
319
|
+
* the rest.
|
|
320
|
+
*/
|
|
321
|
+
steps?: FixStep[];
|
|
322
|
+
/**
|
|
323
|
+
* Choices are questions the user answers before the fix applies, in order. The answer's Fix is
|
|
324
|
+
* added to this one: its files and steps come after this fix's own. A fix with Choices is never
|
|
325
|
+
* applied unasked.
|
|
326
|
+
*/
|
|
327
|
+
choices?: FixChoice[];
|
|
328
|
+
/**
|
|
329
|
+
* AppliesTo names the projects the fix is for. The host folds fixes that share a Description and
|
|
330
|
+
* name projects into one ("applies to 22 projects"), so give the same Description to the same
|
|
331
|
+
* kind of fix on every project. A fix that edits one shared file for many projects lists them all
|
|
332
|
+
* here.
|
|
333
|
+
*/
|
|
334
|
+
applies_to?: string[];
|
|
335
|
+
}
|
|
336
|
+
/** FixChoice is a question with options, one wizard step. */
|
|
337
|
+
export interface FixChoice {
|
|
338
|
+
question: string;
|
|
339
|
+
options: FixChoiceOption[];
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* FixChoiceOption is one answer: a label, and the Fix it adds when picked. The first option is the
|
|
343
|
+
* suggested one.
|
|
344
|
+
*/
|
|
345
|
+
export interface FixChoiceOption {
|
|
346
|
+
label: string;
|
|
347
|
+
fix: Fix;
|
|
348
|
+
}
|
|
349
|
+
/** FixStep is a command to run in the workspace. */
|
|
350
|
+
export interface FixStep {
|
|
351
|
+
/** Description says in words what the command does. */
|
|
352
|
+
description: string;
|
|
353
|
+
/** Argv is the program and its arguments; no shell is involved. */
|
|
354
|
+
argv: string[];
|
|
355
|
+
/** Dir is where it runs, workspace-relative; empty is the workspace root. */
|
|
356
|
+
dir?: string;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* GenerateParams asks a plugin to scaffold a project. The host chooses the directory from the kind
|
|
360
|
+
* (apps/, libs/, packages/).
|
|
361
|
+
*/
|
|
362
|
+
export interface GenerateParams {
|
|
363
|
+
kind: ProjectKind;
|
|
364
|
+
name: string;
|
|
365
|
+
/** Directory is workspace-relative, forward slashes; it does not exist yet. */
|
|
366
|
+
directory: string;
|
|
367
|
+
/** Workspace carries what a template needs to know about the monorepo. */
|
|
368
|
+
workspace: WorkspaceInfo;
|
|
369
|
+
/**
|
|
370
|
+
* Stack is the stack the project is created with. The plugin that writes the manifest records it
|
|
371
|
+
* there, so discovery reports it back.
|
|
372
|
+
*/
|
|
373
|
+
stack?: string;
|
|
374
|
+
/**
|
|
375
|
+
* Convention is true when the plugin is asked as a workspace convention ([conventions.<name>]
|
|
376
|
+
* applying to the new project), not as one of the stack's plugins. A plugin adds only what every
|
|
377
|
+
* matching project needs then: a suite or starter files belong to the stack that names it.
|
|
378
|
+
*/
|
|
379
|
+
convention?: boolean;
|
|
380
|
+
/**
|
|
381
|
+
* Settings are this plugin's own settings for the new project, from the recipe the project is
|
|
382
|
+
* created from (its settings.<plugin> table); the same table is later the plugin's entry in
|
|
383
|
+
* Project.Settings. Nil when there are none.
|
|
384
|
+
*/
|
|
385
|
+
settings?: Record<string, unknown>;
|
|
386
|
+
}
|
|
387
|
+
/** GenerateResult lists what the plugin wrote, workspace-relative. */
|
|
388
|
+
export interface GenerateResult {
|
|
389
|
+
files: string[];
|
|
390
|
+
/** Notes are printed to the user after generation. */
|
|
391
|
+
notes?: string[];
|
|
392
|
+
}
|
|
393
|
+
/** InitializeParams is sent once, first, by the host. */
|
|
394
|
+
export interface InitializeParams {
|
|
395
|
+
/** ProtocolVersions lists every major version the host can speak. */
|
|
396
|
+
protocolVersions: number[];
|
|
397
|
+
host: Peer;
|
|
398
|
+
/** WorkspaceRoot is an absolute path using the host OS separators. */
|
|
399
|
+
workspaceRoot: string;
|
|
400
|
+
}
|
|
401
|
+
/** InitializeResult tells the host who the plugin is and what it can do. */
|
|
402
|
+
export interface InitializeResult {
|
|
403
|
+
/** ProtocolVersion is the version the plugin chose from the host's list. */
|
|
404
|
+
protocolVersion: number;
|
|
405
|
+
plugin: Peer;
|
|
406
|
+
kind: PluginKind;
|
|
407
|
+
capabilities: Capabilities;
|
|
408
|
+
/**
|
|
409
|
+
* Concurrency is how many requests the plugin can work on at the same time; the host never has
|
|
410
|
+
* more in flight. Absent or 0 means 1, which is what every plugin that says nothing does: the
|
|
411
|
+
* host sends the next request only after the previous one is answered. N above 1 allows that
|
|
412
|
+
* many, and ConcurrencyUnlimited (-1) leaves the number to the host. Any other negative value is
|
|
413
|
+
* invalid and read as 1.
|
|
414
|
+
*/
|
|
415
|
+
concurrency?: number;
|
|
416
|
+
/** Languages are the values a user passes to --lang to reach this plugin. */
|
|
417
|
+
languages?: string[];
|
|
418
|
+
/**
|
|
419
|
+
* Manifests are file base names (package.json, go.mod), or patterns of them (*.csproj), whose
|
|
420
|
+
* presence in a directory may make it a project of this plugin.
|
|
421
|
+
*/
|
|
422
|
+
manifests?: string[];
|
|
423
|
+
/**
|
|
424
|
+
* Roles are the levels the plugin can be chosen for in a project's make-up (a stack, a recipe).
|
|
425
|
+
* Empty means the default of its kind (see DefaultRoles). A role is a level: there is no separate
|
|
426
|
+
* level field, because one plugin can play several (a scaffold that is also a toolchain).
|
|
427
|
+
*/
|
|
428
|
+
roles?: Role[];
|
|
429
|
+
/**
|
|
430
|
+
* Provides are the slots a toolchain plugin fills: the task names it owns ("test" for a test
|
|
431
|
+
* runner). A slot is exclusive: two plugins of one project may not provide the same task.
|
|
432
|
+
*/
|
|
433
|
+
provides?: string[];
|
|
434
|
+
/**
|
|
435
|
+
* Requires are plugins that must also be in the project for this one to work: a Node toolchain
|
|
436
|
+
* requires the node language plugin.
|
|
437
|
+
*/
|
|
438
|
+
requires?: PluginRef[];
|
|
439
|
+
/** Conflicts are plugins that must not be in the same project. */
|
|
440
|
+
conflicts?: PluginRef[];
|
|
441
|
+
/** Stacks are ready-made stacks the plugin publishes. */
|
|
442
|
+
stacks?: Stack[];
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Input is one input of an ActionStep. Values are written as quoted YAML strings, except true and
|
|
446
|
+
* false.
|
|
447
|
+
*/
|
|
448
|
+
export interface Input {
|
|
449
|
+
name: string;
|
|
450
|
+
value: string;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* InstallParams asks a plugin to add packages to one of its projects with the ecosystem's own
|
|
454
|
+
* toolchain, or, with no project, to install every dependency of the projects it serves (a fresh
|
|
455
|
+
* clone's first step).
|
|
456
|
+
*/
|
|
457
|
+
export interface InstallParams {
|
|
458
|
+
/** Project is the project the packages go into; nil installs everything. */
|
|
459
|
+
project?: Project;
|
|
460
|
+
/** Projects are the projects the plugin serves, when Project is nil. */
|
|
461
|
+
projects?: Project[];
|
|
462
|
+
/**
|
|
463
|
+
* Packages are names or pinned specs as the ecosystem writes them (left-pad, requests>=2.31,
|
|
464
|
+
* github.com/pkg/errors@v0.9.1).
|
|
465
|
+
*/
|
|
466
|
+
packages?: string[];
|
|
467
|
+
/**
|
|
468
|
+
* Dev adds them as development dependencies where the ecosystem has such a thing; a plugin
|
|
469
|
+
* without one says so in a note.
|
|
470
|
+
*/
|
|
471
|
+
dev?: boolean;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* LatestParams asks for the newest stable release of each dependency, and, with Tools, how the
|
|
475
|
+
* tools the plugin pins compare with their latest.
|
|
476
|
+
*/
|
|
477
|
+
export interface LatestParams {
|
|
478
|
+
names?: string[];
|
|
479
|
+
tools?: boolean;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* LatestResult maps each name to its newest stable version. A name the registry could not be asked
|
|
483
|
+
* about is in Unreachable, with the reason; a name the registry does not have is in neither.
|
|
484
|
+
*/
|
|
485
|
+
export interface LatestResult {
|
|
486
|
+
latest?: Record<string, string>;
|
|
487
|
+
unreachable?: Record<string, string>;
|
|
488
|
+
tools?: ToolPin[];
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* PackageStore is where a package manager keeps what it downloaded (npm's ~/.npm, Go's module
|
|
492
|
+
* cache). A generated pipeline restores it before setup and saves it after a run, keyed on Files,
|
|
493
|
+
* so `npm ci` or `go mod download` fetches only what changed. A pull request from a fork restores
|
|
494
|
+
* it and never writes the base repository's cache.
|
|
495
|
+
*/
|
|
496
|
+
export interface PackageStore {
|
|
497
|
+
/** Name identifies the store ("npm", "go") and is part of its cache key. */
|
|
498
|
+
name: string;
|
|
499
|
+
/** Path is the store's default location, which GitHub Actions caches as it is ("~/.npm"). */
|
|
500
|
+
path: string;
|
|
501
|
+
/**
|
|
502
|
+
* Env is the environment variable that moves the store (NPM_CONFIG_CACHE, GOMODCACHE). Azure
|
|
503
|
+
* Pipelines and GitLab CI cache only directories under their own workspace, so they set it to one
|
|
504
|
+
* and cache that instead.
|
|
505
|
+
*/
|
|
506
|
+
env: string;
|
|
507
|
+
/**
|
|
508
|
+
* Files are the lockfiles that key the store: workspace-relative paths or globs. GitLab CI keys
|
|
509
|
+
* on the first two.
|
|
510
|
+
*/
|
|
511
|
+
files: string[];
|
|
512
|
+
}
|
|
513
|
+
/** Peer names one side of the connection. */
|
|
514
|
+
export interface Peer {
|
|
515
|
+
name: string;
|
|
516
|
+
version: string;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* PluginKind separates plugins that understand a language from plugins that add to projects a
|
|
520
|
+
* language plugin discovered (toolchains, structure rules, scaffolds, deploy targets), which are
|
|
521
|
+
* all of kind convention.
|
|
522
|
+
*
|
|
523
|
+
* Plugin kinds.
|
|
524
|
+
*/
|
|
525
|
+
export type PluginKind = 'language' | 'convention';
|
|
526
|
+
/**
|
|
527
|
+
* PluginRef names the plugins a requirement or a conflict is about. Every field set must match; at
|
|
528
|
+
* least one must be set.
|
|
529
|
+
*/
|
|
530
|
+
export interface PluginRef {
|
|
531
|
+
/** Level is the role the plugin is chosen for in the project. */
|
|
532
|
+
level?: Role;
|
|
533
|
+
/**
|
|
534
|
+
* Name is the plugin's name, or for a language plugin one of its languages ("node",
|
|
535
|
+
* "javascript").
|
|
536
|
+
*/
|
|
537
|
+
name?: string;
|
|
538
|
+
/** Slot is a task the plugin provides ("test"). */
|
|
539
|
+
slot?: string;
|
|
540
|
+
}
|
|
541
|
+
/** Project is one unit of the monorepo as a plugin sees it. */
|
|
542
|
+
export interface Project {
|
|
543
|
+
/** Name is unique across the workspace; it is what users type. */
|
|
544
|
+
name: string;
|
|
545
|
+
/** Root is the workspace-relative directory, forward slashes. */
|
|
546
|
+
root: string;
|
|
547
|
+
language: string;
|
|
548
|
+
kind: ProjectKind;
|
|
549
|
+
/**
|
|
550
|
+
* Exports are the identifiers other projects import this one by: an npm package name, a Go module
|
|
551
|
+
* path, a Python import name.
|
|
552
|
+
*/
|
|
553
|
+
exports?: string[];
|
|
554
|
+
/**
|
|
555
|
+
* Imports are identifiers this project's sources import. The host keeps the ones another project
|
|
556
|
+
* exports and turns them into graph edges.
|
|
557
|
+
*/
|
|
558
|
+
imports?: string[];
|
|
559
|
+
/** Version is the version recorded in the manifest, if it has one. */
|
|
560
|
+
version?: string;
|
|
561
|
+
/**
|
|
562
|
+
* Toolchain is the version of the compiler or runtime the project's tasks run with ("node
|
|
563
|
+
* 20.11.0", "go 1.23.4"), as the plugin probed it. It goes into every task's cache key, so a
|
|
564
|
+
* result from another version is a miss. Empty when the plugin cannot tell, and then it is left
|
|
565
|
+
* out.
|
|
566
|
+
*/
|
|
567
|
+
toolchain?: string;
|
|
568
|
+
/**
|
|
569
|
+
* PublishTo is where a package publishes, when its manifest says: "pub.dev" for the public
|
|
570
|
+
* registry that takes a package only from a run on its tag (so a release does not publish it
|
|
571
|
+
* itself), "none" for a package that is never published, or a repository URL. Empty when the
|
|
572
|
+
* plugin does not say.
|
|
573
|
+
*/
|
|
574
|
+
publishTo?: string;
|
|
575
|
+
/**
|
|
576
|
+
* Description is the one-line description the manifest records (package.json description,
|
|
577
|
+
* pyproject.toml project.description, the pom's <description>), if it has one. Conventions use it
|
|
578
|
+
* where a registry asks for a summary.
|
|
579
|
+
*/
|
|
580
|
+
description?: string;
|
|
581
|
+
/**
|
|
582
|
+
* TagPrefix overrides the release tag prefix; empty means "<name>@". Go modules use "<root>/v" so
|
|
583
|
+
* `go get` can resolve the tag.
|
|
584
|
+
*/
|
|
585
|
+
tagPrefix?: string;
|
|
586
|
+
tasks?: Record<string, Task>;
|
|
587
|
+
tags?: string[];
|
|
588
|
+
/** Stack is the stack recorded in the project's manifest, if any. */
|
|
589
|
+
stack?: string;
|
|
590
|
+
/**
|
|
591
|
+
* Settings are plugins' settings for this project from smith.toml, by plugin name:
|
|
592
|
+
* [projects.<project>.settings.<name>] (what a recipe's settings became when it created the
|
|
593
|
+
* project), and for a convention its [conventions.<name>] settings and the project's
|
|
594
|
+
* [projects.<project>.<name>] on top. Set by the host; a plugin reads its own entry.
|
|
595
|
+
*/
|
|
596
|
+
settings?: Record<string, Record<string, unknown>>;
|
|
597
|
+
/**
|
|
598
|
+
* Registries are the private registries the project installs from and publishes to, from
|
|
599
|
+
* smith.toml [registries]; nil means the public ones. Set by the host.
|
|
600
|
+
*/
|
|
601
|
+
registries?: Registries;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* ProjectKind is the universal kind vocabulary.
|
|
605
|
+
*
|
|
606
|
+
* Project kinds. An app is deployed, never published; a lib is internal and never published; a
|
|
607
|
+
* package is published.
|
|
608
|
+
*/
|
|
609
|
+
export type ProjectKind = 'app' | 'lib' | 'package';
|
|
610
|
+
/** PublishParams asks a plugin to publish one project at one version. */
|
|
611
|
+
export interface PublishParams {
|
|
612
|
+
project: Project;
|
|
613
|
+
version: string;
|
|
614
|
+
dryRun?: boolean;
|
|
615
|
+
/**
|
|
616
|
+
* Assets, when set, asks the plugin to build the files attached to the release (an app's
|
|
617
|
+
* per-platform binaries) instead of publishing to a registry.
|
|
618
|
+
*/
|
|
619
|
+
assets?: AssetSpec;
|
|
620
|
+
/**
|
|
621
|
+
* Platform, when set, is the "os/arch" (Go's spelling) of the runner a native project is
|
|
622
|
+
* published from: each native job publishes its own platform's build (a VS Code extension's
|
|
623
|
+
* target) and nothing else.
|
|
624
|
+
*/
|
|
625
|
+
platform?: string;
|
|
626
|
+
/**
|
|
627
|
+
* Tagged says the publish runs on the project's own tag, in the run the registry trusts
|
|
628
|
+
* (pub.dev's automated publishing); a registry that takes a package only from such a run is
|
|
629
|
+
* published to only then.
|
|
630
|
+
*/
|
|
631
|
+
tagged?: boolean;
|
|
632
|
+
/**
|
|
633
|
+
* Commit is the full hash of the commit being released, and Branch the release branch, for a
|
|
634
|
+
* plugin that tags what it publishes with them (a container image's sha-<short> and branch tags).
|
|
635
|
+
* Empty when unknown.
|
|
636
|
+
*/
|
|
637
|
+
commit?: string;
|
|
638
|
+
branch?: string;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* PublishResult reports what happened. Skipped with a reason is a success: an already-published
|
|
642
|
+
* version makes a re-run safe.
|
|
643
|
+
*/
|
|
644
|
+
export interface PublishResult {
|
|
645
|
+
published: boolean;
|
|
646
|
+
skipped?: string;
|
|
647
|
+
registry?: string;
|
|
648
|
+
/**
|
|
649
|
+
* Assets are the workspace-relative files built for the release, in upload order; in a dry run,
|
|
650
|
+
* the files that would be built.
|
|
651
|
+
*/
|
|
652
|
+
assets?: string[];
|
|
653
|
+
/**
|
|
654
|
+
* AssetPlatforms maps each archive among Assets to the "os/arch" it was built for, so the host
|
|
655
|
+
* can describe them (package manager manifests).
|
|
656
|
+
*/
|
|
657
|
+
assetPlatforms?: Record<string, string>;
|
|
658
|
+
/** Binary is the executable's name inside each archive, without ".exe". */
|
|
659
|
+
binary?: string;
|
|
660
|
+
/**
|
|
661
|
+
* Images are the container images pushed, one per registry, for a deploy step or a GitOps
|
|
662
|
+
* manifest to refer to by digest.
|
|
663
|
+
*/
|
|
664
|
+
images?: PublishedImage[];
|
|
665
|
+
}
|
|
666
|
+
/** PublishedImage is one container image a release pushed. */
|
|
667
|
+
export interface PublishedImage {
|
|
668
|
+
/** Reference is the image without a tag: ghcr.io/acme/api. */
|
|
669
|
+
reference: string;
|
|
670
|
+
/** Tags are the tags pushed, in the order they were. */
|
|
671
|
+
tags: string[];
|
|
672
|
+
/**
|
|
673
|
+
* Digest is the manifest digest the registry holds ("sha256:..."); empty when it could not be
|
|
674
|
+
* read.
|
|
675
|
+
*/
|
|
676
|
+
digest?: string;
|
|
677
|
+
}
|
|
678
|
+
/** PublishedParams asks which version of a project its registry has. */
|
|
679
|
+
export interface PublishedParams {
|
|
680
|
+
project: Project;
|
|
681
|
+
}
|
|
682
|
+
/** PublishedResult is the newest version the registry has of a project. */
|
|
683
|
+
export interface PublishedResult {
|
|
684
|
+
/**
|
|
685
|
+
* Version is empty when the registry does not know the project: its first release is still to
|
|
686
|
+
* come.
|
|
687
|
+
*/
|
|
688
|
+
version?: string;
|
|
689
|
+
/** Registry names where the plugin looked, for messages. */
|
|
690
|
+
registry?: string;
|
|
691
|
+
/**
|
|
692
|
+
* Unreachable is true when the registry could not be asked (offline, an error), so nothing can be
|
|
693
|
+
* concluded; Detail says why.
|
|
694
|
+
*/
|
|
695
|
+
unreachable?: boolean;
|
|
696
|
+
detail?: string;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Registries are the registries a project uses, set by the host from smith.toml: Install is where
|
|
700
|
+
* the workspace installs packages from, Publish where the project is published. Nil, or a nil
|
|
701
|
+
* member, means the public registry, as before.
|
|
702
|
+
*/
|
|
703
|
+
export interface Registries {
|
|
704
|
+
install?: Registry;
|
|
705
|
+
publish?: Registry;
|
|
706
|
+
/**
|
|
707
|
+
* NoPublish means smith.toml says registry = "none": the release versions and tags the project
|
|
708
|
+
* and publishes it to no registry (a registry that builds from the tag, such as JitPack, does the
|
|
709
|
+
* rest).
|
|
710
|
+
*/
|
|
711
|
+
noPublish?: boolean;
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Registry is a package registry smith.toml names in [registries.<name>]: a private feed (Azure
|
|
715
|
+
* Artifacts, GitHub Packages, any token-protected registry) a language plugin installs from or
|
|
716
|
+
* publishes to. Each URL is optional; a plugin reads the one for its ecosystem.
|
|
717
|
+
*/
|
|
718
|
+
export interface Registry {
|
|
719
|
+
name: string;
|
|
720
|
+
/** Auth is how the registry is signed in to: AuthAzureArtifacts, AuthGitHubPackages or AuthToken. */
|
|
721
|
+
auth: string;
|
|
722
|
+
/** TokenEnv is the environment variable holding the token, for AuthToken. */
|
|
723
|
+
tokenEnv?: string;
|
|
724
|
+
/** NPM is the npm registry URL. */
|
|
725
|
+
npm?: string;
|
|
726
|
+
/** PyPI is the simple index pip installs from; PyPIUpload is where twine uploads. */
|
|
727
|
+
pypi?: string;
|
|
728
|
+
pypiUpload?: string;
|
|
729
|
+
/** NuGet is the NuGet v3 service index. */
|
|
730
|
+
nuget?: string;
|
|
731
|
+
/**
|
|
732
|
+
* Maven is the Maven repository packages deploy to: an https URL, or MavenGitHub for the GitHub
|
|
733
|
+
* Packages repository of the repository the release runs in.
|
|
734
|
+
*/
|
|
735
|
+
maven?: string;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* RemoveParams tells a plugin a project is being removed. The host deletes the project's directory
|
|
739
|
+
* first; the plugin cleans what it owns outside it (a go.work entry, a lockfile, an installed
|
|
740
|
+
* package).
|
|
741
|
+
*/
|
|
742
|
+
export interface RemoveParams {
|
|
743
|
+
project: Project;
|
|
744
|
+
/** DryRun asks what would change, without changing it. */
|
|
745
|
+
dryRun?: boolean;
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* RemoveResult lists the workspace-relative files the plugin changed (or, in a dry run, would
|
|
749
|
+
* change), and notes for the user.
|
|
750
|
+
*/
|
|
751
|
+
export interface RemoveResult {
|
|
752
|
+
files?: string[];
|
|
753
|
+
notes?: string[];
|
|
754
|
+
}
|
|
755
|
+
/** Request is a JSON-RPC 2.0 request, or a notification when ID is nil. */
|
|
756
|
+
export interface Request {
|
|
757
|
+
jsonrpc: string;
|
|
758
|
+
id?: number;
|
|
759
|
+
method: string;
|
|
760
|
+
params?: unknown;
|
|
761
|
+
}
|
|
762
|
+
/** Response is a JSON-RPC 2.0 response. Exactly one of Result and Error is set. */
|
|
763
|
+
export interface Response {
|
|
764
|
+
jsonrpc: string;
|
|
765
|
+
id: number | null;
|
|
766
|
+
result?: unknown;
|
|
767
|
+
error?: ResponseError;
|
|
768
|
+
}
|
|
769
|
+
/** ResponseError is a JSON-RPC 2.0 error object. */
|
|
770
|
+
export interface ResponseError {
|
|
771
|
+
code: number;
|
|
772
|
+
message: string;
|
|
773
|
+
}
|
|
774
|
+
/** Rewrite changes one declaration's spec. */
|
|
775
|
+
export interface Rewrite {
|
|
776
|
+
declaration: Declaration;
|
|
777
|
+
spec: string;
|
|
778
|
+
}
|
|
779
|
+
/** RewriteParams asks a plugin to change declared specs in place. */
|
|
780
|
+
export interface RewriteParams {
|
|
781
|
+
changes: Rewrite[];
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Role is a part a plugin plays in a project's make-up: its level. Some levels are exclusive (one
|
|
785
|
+
* plugin per project, or per slot) and the others additive (any number, and they only add).
|
|
786
|
+
*/
|
|
787
|
+
export type Role = 'language' | 'toolchain' | 'structure' | 'scaffold' | 'deploy';
|
|
788
|
+
/**
|
|
789
|
+
* Stack is a named set of plugins a project is built with: one language plugin, and the toolchain,
|
|
790
|
+
* structure, scaffold and deploy plugins on top. Plugins are named, never assumed to be built in.
|
|
791
|
+
*/
|
|
792
|
+
export interface Stack {
|
|
793
|
+
name: string;
|
|
794
|
+
description?: string;
|
|
795
|
+
/** Language is the language plugin that discovers the stack's projects. */
|
|
796
|
+
language: string;
|
|
797
|
+
/**
|
|
798
|
+
* Toolchain plugins decide how projects build, test and lint, in order: a later one may replace a
|
|
799
|
+
* task an earlier one added.
|
|
800
|
+
*/
|
|
801
|
+
toolchain?: string[];
|
|
802
|
+
structure?: string[];
|
|
803
|
+
/** Scaffold generates new projects; empty means the language plugin does. */
|
|
804
|
+
scaffold?: string;
|
|
805
|
+
deploy?: string[];
|
|
806
|
+
}
|
|
807
|
+
/** Step is one command a CI phase runs. */
|
|
808
|
+
export interface Step {
|
|
809
|
+
name: string;
|
|
810
|
+
command: string[];
|
|
811
|
+
/** Dir is the workspace-relative directory to run in; empty means the workspace root. */
|
|
812
|
+
dir?: string;
|
|
813
|
+
/** Blocking false makes a failure a warning instead of an error. */
|
|
814
|
+
blocking: boolean;
|
|
815
|
+
/**
|
|
816
|
+
* CacheFiles are workspace-relative files whose content decides what an audit step finds (a
|
|
817
|
+
* lockfile). When any exists, smith remembers a passing run per content of these files and per
|
|
818
|
+
* day, in the task cache, and skips the step while both are unchanged; a failing run is always
|
|
819
|
+
* repeated. Only the audit phase reads it.
|
|
820
|
+
*/
|
|
821
|
+
cacheFiles?: string[];
|
|
822
|
+
}
|
|
823
|
+
/** Task is a command the host can run, hash and cache. */
|
|
824
|
+
export interface Task {
|
|
825
|
+
/** Command is an argv array; it is never passed through a shell. */
|
|
826
|
+
command: string[];
|
|
827
|
+
/** Cwd is workspace-relative; empty means the project root. */
|
|
828
|
+
cwd?: string;
|
|
829
|
+
env?: Record<string, string>;
|
|
830
|
+
/**
|
|
831
|
+
* Inputs are globs relative to the project root. Empty means every tracked or
|
|
832
|
+
* untracked-but-not-ignored file of the project.
|
|
833
|
+
*/
|
|
834
|
+
inputs?: string[];
|
|
835
|
+
/** Outputs are directories relative to the project root, restored on a cache hit. */
|
|
836
|
+
outputs?: string[];
|
|
837
|
+
/**
|
|
838
|
+
* DependsOn lists task names: "build" runs this project's build first, "^build" runs the build of
|
|
839
|
+
* every project this one imports first.
|
|
840
|
+
*/
|
|
841
|
+
dependsOn?: string[];
|
|
842
|
+
cache?: boolean;
|
|
843
|
+
/** Description is shown by `smith explain` and the TUI. */
|
|
844
|
+
description?: string;
|
|
845
|
+
/**
|
|
846
|
+
* Verify asks CI's verify phase (smith ci verify) to run the task too, after lint, typecheck,
|
|
847
|
+
* test and build, for the affected projects that have it: an app's container image, so a broken
|
|
848
|
+
* Dockerfile fails the pull request, not the release. It is skipped, with a warning, where its
|
|
849
|
+
* program is not installed.
|
|
850
|
+
*/
|
|
851
|
+
verify?: boolean;
|
|
852
|
+
/**
|
|
853
|
+
* Serve names a task ("web:start", or "start" in the same project) that smith starts before this
|
|
854
|
+
* one and stops after it, whatever the result: the app an end-to-end suite tests. Its own
|
|
855
|
+
* dependsOn run first.
|
|
856
|
+
*/
|
|
857
|
+
serve?: string;
|
|
858
|
+
/**
|
|
859
|
+
* ServeURL is what smith waits for (an HTTP 2xx) before it runs the task, and passes to it as
|
|
860
|
+
* E2E_BASE_URL. Empty: the task starts at once.
|
|
861
|
+
*/
|
|
862
|
+
serveUrl?: string;
|
|
863
|
+
/** ServeTimeout is how long to wait for ServeURL, as a Go duration ("60s"); empty means 60s. */
|
|
864
|
+
serveTimeout?: string;
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* ToolPin is a tool the plugin installs at a pinned version (in CI, the dev container, the venv)
|
|
868
|
+
* against the newest release; informational.
|
|
869
|
+
*/
|
|
870
|
+
export interface ToolPin {
|
|
871
|
+
name: string;
|
|
872
|
+
pinned: string;
|
|
873
|
+
/** Latest is empty when its release feed could not be reached. */
|
|
874
|
+
latest?: string;
|
|
875
|
+
/** Newer is true when Latest is a release the pin does not cover. */
|
|
876
|
+
newer?: boolean;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Toolchain is a runtime the pipeline must install, and how. Plugins asking for the same name share
|
|
880
|
+
* one setup step (the first plugin's).
|
|
881
|
+
*/
|
|
882
|
+
export interface Toolchain {
|
|
883
|
+
name: string;
|
|
884
|
+
version: string;
|
|
885
|
+
/** GitHub is the GitHub Actions step that installs it (an action). */
|
|
886
|
+
github?: ActionStep;
|
|
887
|
+
/** Azure is the Azure Pipelines step that installs it (a task). */
|
|
888
|
+
azure?: ActionStep;
|
|
889
|
+
/**
|
|
890
|
+
* Install is a shell command that installs it, run on a provider the plugin gives no native step
|
|
891
|
+
* for.
|
|
892
|
+
*/
|
|
893
|
+
install?: string;
|
|
894
|
+
/**
|
|
895
|
+
* Devcontainer is the dev container feature that installs it at the same version, so the editor's
|
|
896
|
+
* container matches CI.
|
|
897
|
+
*/
|
|
898
|
+
devcontainer?: DevcontainerFeature;
|
|
899
|
+
}
|
|
900
|
+
/** UninstallParams asks a plugin to remove packages from one of its projects. */
|
|
901
|
+
export interface UninstallParams {
|
|
902
|
+
project: Project;
|
|
903
|
+
packages: string[];
|
|
904
|
+
}
|
|
905
|
+
/** VersionParams asks a plugin to record a new version in a project manifest. */
|
|
906
|
+
export interface VersionParams {
|
|
907
|
+
project: Project;
|
|
908
|
+
version: string;
|
|
909
|
+
/**
|
|
910
|
+
* Dependencies maps exported identifiers of other workspace projects to their new versions, so
|
|
911
|
+
* the plugin can update dependency ranges.
|
|
912
|
+
*/
|
|
913
|
+
dependencies?: Record<string, string>;
|
|
914
|
+
dryRun?: boolean;
|
|
915
|
+
}
|
|
916
|
+
/** VersionResult lists the files that were (or, in a dry run, would be) changed. */
|
|
917
|
+
export interface VersionResult {
|
|
918
|
+
files: string[];
|
|
919
|
+
}
|
|
920
|
+
/** WorkspaceInfo is the subset of workspace settings plugins may use. */
|
|
921
|
+
export interface WorkspaceInfo {
|
|
922
|
+
name: string;
|
|
923
|
+
/** Scope is the npm scope for packages, with its @ (e.g. "@acme"). */
|
|
924
|
+
scope?: string;
|
|
925
|
+
/** ModulePrefix is the Go module path prefix, e.g. github.com/acme/repo. */
|
|
926
|
+
modulePrefix?: string;
|
|
927
|
+
}
|
|
928
|
+
/** Every method of the protocol with its params, its result and the capability a plugin advertises to be asked it. */
|
|
929
|
+
export interface ProtocolMethods {
|
|
930
|
+
/**
|
|
931
|
+
* The first request, sent once by the host. The plugin picks a protocol version from the host's
|
|
932
|
+
* list and answers who it is and what it can do.
|
|
933
|
+
*/
|
|
934
|
+
initialize: {
|
|
935
|
+
params: InitializeParams;
|
|
936
|
+
result: InitializeResult;
|
|
937
|
+
capability: null;
|
|
938
|
+
};
|
|
939
|
+
/** The last request. The plugin answers an empty object and exits. */
|
|
940
|
+
shutdown: {
|
|
941
|
+
params: Empty;
|
|
942
|
+
result: Empty;
|
|
943
|
+
capability: null;
|
|
944
|
+
};
|
|
945
|
+
/**
|
|
946
|
+
* A notification, so it gets no response: the host asks the plugin to stop the in-flight request
|
|
947
|
+
* with the given id. The plugin then answers that request, with its result if the work was
|
|
948
|
+
* already done or with the request-cancelled error. An id that is unknown or already answered is
|
|
949
|
+
* ignored. The host sends it only to a plugin that advertised the capability.
|
|
950
|
+
*/
|
|
951
|
+
cancel: {
|
|
952
|
+
params: CancelParams;
|
|
953
|
+
result: null;
|
|
954
|
+
capability: 'cancel';
|
|
955
|
+
};
|
|
956
|
+
/**
|
|
957
|
+
* Describes the projects behind manifests the host found; a language plugin's way into the
|
|
958
|
+
* workspace.
|
|
959
|
+
*/
|
|
960
|
+
discover: {
|
|
961
|
+
params: DiscoverParams;
|
|
962
|
+
result: DiscoverResult;
|
|
963
|
+
capability: 'discover';
|
|
964
|
+
};
|
|
965
|
+
/** Writes the starter files of a new project. */
|
|
966
|
+
generate: {
|
|
967
|
+
params: GenerateParams;
|
|
968
|
+
result: GenerateResult;
|
|
969
|
+
capability: 'generate';
|
|
970
|
+
};
|
|
971
|
+
/** Records a release version in a project's manifest. */
|
|
972
|
+
'version/write': {
|
|
973
|
+
params: VersionParams;
|
|
974
|
+
result: VersionResult;
|
|
975
|
+
capability: 'version';
|
|
976
|
+
};
|
|
977
|
+
/** Publishes one project at one version, or builds the files attached to a release. */
|
|
978
|
+
publish: {
|
|
979
|
+
params: PublishParams;
|
|
980
|
+
result: PublishResult;
|
|
981
|
+
capability: 'publish';
|
|
982
|
+
};
|
|
983
|
+
/** Describes what a generated pipeline needs for the plugin's projects. */
|
|
984
|
+
ci: {
|
|
985
|
+
params: CIParams;
|
|
986
|
+
result: CIResult;
|
|
987
|
+
capability: 'ci';
|
|
988
|
+
};
|
|
989
|
+
/** Checks the plugin's projects and reports findings, each with its remedy and, optionally, a fix. */
|
|
990
|
+
doctor: {
|
|
991
|
+
params: DoctorParams;
|
|
992
|
+
result: DoctorResult;
|
|
993
|
+
capability: 'doctor';
|
|
994
|
+
};
|
|
995
|
+
/**
|
|
996
|
+
* Asks a convention (toolchain, structure, deploy) for the tasks and dependencies it adds to
|
|
997
|
+
* projects other plugins discovered.
|
|
998
|
+
*/
|
|
999
|
+
contribute: {
|
|
1000
|
+
params: ContributeParams;
|
|
1001
|
+
result: ContributeResult;
|
|
1002
|
+
capability: 'contribute';
|
|
1003
|
+
};
|
|
1004
|
+
/** Lets a plugin clean up what it owns outside a project's directory after the project is removed. */
|
|
1005
|
+
remove: {
|
|
1006
|
+
params: RemoveParams;
|
|
1007
|
+
result: RemoveResult;
|
|
1008
|
+
capability: 'remove';
|
|
1009
|
+
};
|
|
1010
|
+
/** Asks which version of a project its registry has, so a release can check its tags against it. */
|
|
1011
|
+
published: {
|
|
1012
|
+
params: PublishedParams;
|
|
1013
|
+
result: PublishedResult;
|
|
1014
|
+
capability: 'published';
|
|
1015
|
+
};
|
|
1016
|
+
/**
|
|
1017
|
+
* Adds packages to a project with the ecosystem's own toolchain, or, with no project, installs
|
|
1018
|
+
* every dependency of the projects the plugin serves.
|
|
1019
|
+
*/
|
|
1020
|
+
'dependencies/install': {
|
|
1021
|
+
params: InstallParams;
|
|
1022
|
+
result: DependencyResult;
|
|
1023
|
+
capability: 'dependencies';
|
|
1024
|
+
};
|
|
1025
|
+
/** Removes packages from a project. */
|
|
1026
|
+
'dependencies/uninstall': {
|
|
1027
|
+
params: UninstallParams;
|
|
1028
|
+
result: DependencyResult;
|
|
1029
|
+
capability: 'dependencies';
|
|
1030
|
+
};
|
|
1031
|
+
/** Lists the dependencies the manifests of the plugin's projects declare. */
|
|
1032
|
+
'dependencies/declared': {
|
|
1033
|
+
params: DeclaredParams;
|
|
1034
|
+
result: DeclaredResult;
|
|
1035
|
+
capability: 'declarations';
|
|
1036
|
+
};
|
|
1037
|
+
/** Changes declared dependency specs in place. */
|
|
1038
|
+
'dependencies/rewrite': {
|
|
1039
|
+
params: RewriteParams;
|
|
1040
|
+
result: DependencyResult;
|
|
1041
|
+
capability: 'declarations';
|
|
1042
|
+
};
|
|
1043
|
+
/**
|
|
1044
|
+
* Asks registries for the newest releases of dependencies, and how the tools the plugin pins
|
|
1045
|
+
* compare with theirs.
|
|
1046
|
+
*/
|
|
1047
|
+
'dependencies/latest': {
|
|
1048
|
+
params: LatestParams;
|
|
1049
|
+
result: LatestResult;
|
|
1050
|
+
capability: 'latest';
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
export type MethodName = keyof ProtocolMethods;
|
|
1054
|
+
export type ParamsOf<M extends MethodName> = ProtocolMethods[M]['params'];
|
|
1055
|
+
export type ResultOf<M extends MethodName> = ProtocolMethods[M]['result'];
|
|
1056
|
+
/** The names of the capability flags: the optional methods a plugin implements. */
|
|
1057
|
+
export type CapabilityName = keyof Capabilities;
|