@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,6 @@
|
|
|
1
|
+
export { auditBlocks, auditEnabled } from './audit-settings.policy.js';
|
|
2
|
+
export { isManifest } from './manifest-match.algorithm.js';
|
|
3
|
+
export { projectKindDirectory, resolveProjectKind } from './project-kind.policy.js';
|
|
4
|
+
export { publishes } from './publishes.policy.js';
|
|
5
|
+
export { setToolchain } from './set-toolchain.algorithm.js';
|
|
6
|
+
export { stackPlugins } from './stack-plugins.algorithm.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a file's base name is one of a plugin's manifests: equal to a name,
|
|
3
|
+
* or matching a pattern (`*.csproj`). A pattern is Go's `path.Match`: `*`
|
|
4
|
+
* matches any run of characters, `?` one, `[a-z]` and `[^a-z]` a class, `\`
|
|
5
|
+
* escapes. A malformed pattern matches nothing.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isManifest(manifests: readonly string[], base: string): boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** One element of a pattern: an escaped character, a class, a wildcard, or any other character. */
|
|
2
|
+
const PART = /\\(.)|\[([^\]]+)\]|([*?])|(.)/gsu;
|
|
3
|
+
/**
|
|
4
|
+
* Whether a file's base name is one of a plugin's manifests: equal to a name,
|
|
5
|
+
* or matching a pattern (`*.csproj`). A pattern is Go's `path.Match`: `*`
|
|
6
|
+
* matches any run of characters, `?` one, `[a-z]` and `[^a-z]` a class, `\`
|
|
7
|
+
* escapes. A malformed pattern matches nothing.
|
|
8
|
+
*/
|
|
9
|
+
export function isManifest(manifests, base) {
|
|
10
|
+
return manifests.some(manifest => manifest === base || toRegExp(manifest)?.test(base) === true);
|
|
11
|
+
}
|
|
12
|
+
function toRegExp(pattern) {
|
|
13
|
+
let source = '^';
|
|
14
|
+
for (const [, escaped, characters, wildcard, literal] of pattern.matchAll(PART)) {
|
|
15
|
+
if (escaped !== undefined)
|
|
16
|
+
source += escape(escaped);
|
|
17
|
+
else if (characters !== undefined)
|
|
18
|
+
source += `[${characters.replaceAll('\\', String.raw `\\`)}]`;
|
|
19
|
+
else if (wildcard === '*')
|
|
20
|
+
source += '[^/]*';
|
|
21
|
+
else if (wildcard === '?')
|
|
22
|
+
source += '[^/]';
|
|
23
|
+
// A bracket or backslash that did not make an escape or a class is a malformed pattern.
|
|
24
|
+
else if (literal === '[' || literal === '\\')
|
|
25
|
+
return undefined;
|
|
26
|
+
else
|
|
27
|
+
source += escape(literal);
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
return new RegExp(`${source}$`, 'u');
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function escape(character) {
|
|
37
|
+
return character.replaceAll(/[.*+?^${}()|[\]\\/]/g, String.raw `\$&`);
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ProjectKind } from '../protocol/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* A project's kind when its manifest may declare none: the declared kind when
|
|
4
|
+
* it is valid; otherwise the directory convention (`apps/` is an app, `libs/`
|
|
5
|
+
* a lib, `packages/` a package); and finally `fallback`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveProjectKind(declared: string | undefined, root: string, fallback: ProjectKind): ProjectKind;
|
|
8
|
+
/** The conventional parent directory of a kind: `apps`, `libs` or `packages`. */
|
|
9
|
+
export declare function projectKindDirectory(kind: ProjectKind): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const KINDS = new Set(['app', 'lib', 'package']);
|
|
2
|
+
const DIRECTORY_KIND = { apps: 'app', libs: 'lib', packages: 'package' };
|
|
3
|
+
/**
|
|
4
|
+
* A project's kind when its manifest may declare none: the declared kind when
|
|
5
|
+
* it is valid; otherwise the directory convention (`apps/` is an app, `libs/`
|
|
6
|
+
* a lib, `packages/` a package); and finally `fallback`.
|
|
7
|
+
*/
|
|
8
|
+
export function resolveProjectKind(declared, root, fallback) {
|
|
9
|
+
const kind = (declared ?? '').trim();
|
|
10
|
+
if (KINDS.has(kind))
|
|
11
|
+
return kind;
|
|
12
|
+
const top = root.split('/', 1)[0] ?? '';
|
|
13
|
+
return Object.hasOwn(DIRECTORY_KIND, top) ? DIRECTORY_KIND[top] : fallback;
|
|
14
|
+
}
|
|
15
|
+
/** The conventional parent directory of a kind: `apps`, `libs` or `packages`. */
|
|
16
|
+
export function projectKindDirectory(kind) {
|
|
17
|
+
switch (kind) {
|
|
18
|
+
case 'app': {
|
|
19
|
+
return 'apps';
|
|
20
|
+
}
|
|
21
|
+
case 'lib': {
|
|
22
|
+
return 'libs';
|
|
23
|
+
}
|
|
24
|
+
default: {
|
|
25
|
+
return 'packages';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Project } from '../protocol/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a release publishes the project to a registry: a package, unless
|
|
4
|
+
* `smith.toml` says `registry = "none"`. Plugins list the credentials a
|
|
5
|
+
* release needs only for such projects.
|
|
6
|
+
*/
|
|
7
|
+
export declare function publishes(project: Pick<Project, 'kind' | 'registries'>): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a release publishes the project to a registry: a package, unless
|
|
3
|
+
* `smith.toml` says `registry = "none"`. Plugins list the credentials a
|
|
4
|
+
* release needs only for such projects.
|
|
5
|
+
*/
|
|
6
|
+
export function publishes(project) {
|
|
7
|
+
return project.kind === 'package' && project.registries?.noPublish !== true;
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DiscoverResult } from '../protocol/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Records the toolchain on every discovered project. The probe (`node
|
|
4
|
+
* --version` and the like) runs only when there is a project, and once.
|
|
5
|
+
* Returns the result it was given.
|
|
6
|
+
*/
|
|
7
|
+
export declare function setToolchain(result: DiscoverResult, probe: () => string): DiscoverResult;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Records the toolchain on every discovered project. The probe (`node
|
|
3
|
+
* --version` and the like) runs only when there is a project, and once.
|
|
4
|
+
* Returns the result it was given.
|
|
5
|
+
*/
|
|
6
|
+
export function setToolchain(result, probe) {
|
|
7
|
+
if (result.projects.length === 0)
|
|
8
|
+
return result;
|
|
9
|
+
const toolchain = probe();
|
|
10
|
+
for (const project of result.projects)
|
|
11
|
+
project.toolchain = toolchain;
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Stack } from '../protocol/index.ts';
|
|
2
|
+
/** The stack's plugins other than its language and scaffold, in the order they apply: toolchain, structure, deploy. */
|
|
3
|
+
export declare function stackPlugins(stack: Pick<Stack, 'toolchain' | 'structure' | 'deploy'>): string[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from './protocol-types.contract.ts';
|
|
2
|
+
export { protocolSchema } from './protocol-schema.contract.ts';
|
|
3
|
+
export type { ErrorCodeRow, MethodRow, RoleRow, SchemaDocument, SchemaNode } from './schema-document.contract.ts';
|
|
4
|
+
export { RpcError } from './rpc-error.error.ts';
|