@monosmith/plugin-sdk 2.0.0-beta.1 → 2.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monosmith/plugin-sdk",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.0-beta.11",
4
4
  "description": "The TypeScript SDK for writing smith plugins: the protocol's types, the serve loop, a test host, the conformance checks, templating and key-order-keeping JSON editing. No runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -175,6 +175,28 @@ export const protocolSchema = {
175
175
  "capability": "dependencies",
176
176
  "notification": false
177
177
  },
178
+ "dependencies/link": {
179
+ "description": "Makes a project depend on a library of the same workspace and language, in the ecosystem's own form, then installs or locks as that needs.",
180
+ "params": {
181
+ "$ref": "#/$defs/LinkParams"
182
+ },
183
+ "result": {
184
+ "$ref": "#/$defs/LinkResult"
185
+ },
186
+ "capability": "link",
187
+ "notification": false
188
+ },
189
+ "dependencies/unlink": {
190
+ "description": "Removes the dependency of a project on a library of the same workspace.",
191
+ "params": {
192
+ "$ref": "#/$defs/UnlinkParams"
193
+ },
194
+ "result": {
195
+ "$ref": "#/$defs/DependencyResult"
196
+ },
197
+ "capability": "link",
198
+ "notification": false
199
+ },
178
200
  "dependencies/declared": {
179
201
  "description": "Lists the dependencies the manifests of the plugin's projects declare.",
180
202
  "params": {
@@ -589,6 +611,10 @@ export const protocolSchema = {
589
611
  "type": "boolean",
590
612
  "description": "Dependencies installs and uninstalls packages in its projects."
591
613
  },
614
+ "link": {
615
+ "type": "boolean",
616
+ "description": "Link makes a project depend on a library of the same workspace in the ecosystem's own form (a workspace dependency, a path dependency, a project reference), and takes it out again. A plugin without it is refused by the host with one sentence that tells the user to add the dependency by hand."
617
+ },
592
618
  "declarations": {
593
619
  "type": "boolean",
594
620
  "description": "Declarations lists and rewrites declared dependency specs (sync, up)."
@@ -616,6 +642,10 @@ export const protocolSchema = {
616
642
  "channels": {
617
643
  "type": "boolean",
618
644
  "description": "Channels says a prerelease version the plugin publishes never takes the place of the stable one: the plugin publishes under PublishParams.Tag, a release channel's name, without moving the registry's stable pointer (npm's latest), or its registry orders a prerelease below the release (PyPI, NuGet) and needs no tag. A host does not publish a package of a release channel with a plugin that lacks it."
645
+ },
646
+ "declared": {
647
+ "type": "boolean",
648
+ "description": "Declared says the plugin describes the projects smith.toml declares for its language (DiscoverParams.declared): folders with no manifest of their own. A plugin without it finds a project by its manifest only, and the host refuses a declaration for its language with a message that says so."
619
649
  }
620
650
  }
621
651
  },
@@ -688,6 +718,21 @@ export const protocolSchema = {
688
718
  "description": {
689
719
  "type": "string"
690
720
  },
721
+ "title": {
722
+ "type": "string",
723
+ "description": "Title is the name shown to a person (\"Electron\" for electron). Without it the name is shown."
724
+ },
725
+ "aliases": {
726
+ "type": "array",
727
+ "items": {
728
+ "type": "string"
729
+ },
730
+ "description": "Aliases are words that find the choice when a person searches the catalogue (smith compose): \"desktop\", \"serverless\", \"web\"."
731
+ },
732
+ "layer": {
733
+ "type": "string",
734
+ "description": "Layer is where the choice sits in the stack of a project: \"framework\", \"shell\" (a desktop shell), \"host\" (where cloud code runs), \"test\", \"lint\", \"style\" or a layer of the plugin's own. Without it the layer is the axis. It is for display and grouping: the axis decides conflicts."
735
+ },
691
736
  "language": {
692
737
  "type": "string",
693
738
  "description": "Language is the language plugin the choice applies to (\"node\")."
@@ -710,6 +755,10 @@ export const protocolSchema = {
710
755
  "type": "boolean",
711
756
  "description": "Default marks the choice the host adds when a selection needs its axis and has no choice on it."
712
757
  },
758
+ "suggested": {
759
+ "type": "boolean",
760
+ "description": "Suggested marks the choice an asker pre-selects on its axis. The solver never adds it by itself: an axis that a choice needs and that has no Default is asked, and the person answers (ADR 0072)."
761
+ },
713
762
  "many": {
714
763
  "type": "boolean",
715
764
  "description": "Many allows the choice next to other choices of its axis that are Many too. By default a selection has one choice per axis."
@@ -941,6 +990,28 @@ export const protocolSchema = {
941
990
  "projects"
942
991
  ]
943
992
  },
993
+ "DeclaredProject": {
994
+ "description": "DeclaredProject is a project smith.toml declares: a folder with no manifest.",
995
+ "type": "object",
996
+ "properties": {
997
+ "name": {
998
+ "type": "string",
999
+ "description": "Name is the project's name, the key of its [projects.<name>] table."
1000
+ },
1001
+ "root": {
1002
+ "type": "string",
1003
+ "description": "Root is the workspace-relative folder."
1004
+ },
1005
+ "kind": {
1006
+ "$ref": "#/$defs/ProjectKind",
1007
+ "description": "Kind is \"app\", \"lib\" or \"package\", or empty for the plugin's choice."
1008
+ }
1009
+ },
1010
+ "required": [
1011
+ "name",
1012
+ "root"
1013
+ ]
1014
+ },
944
1015
  "DeclaredResult": {
945
1016
  "description": "DeclaredResult is every declaration, and the version installed of each name where the plugin can tell.",
946
1017
  "type": "object",
@@ -1116,6 +1187,20 @@ export const protocolSchema = {
1116
1187
  "items": {
1117
1188
  "type": "string"
1118
1189
  }
1190
+ },
1191
+ "declared": {
1192
+ "type": "array",
1193
+ "items": {
1194
+ "$ref": "#/$defs/DeclaredProject"
1195
+ },
1196
+ "description": "Declared are the projects smith.toml declares for this plugin's language ([projects.<name>] with a root and a language): folders with no manifest of their own, such as a program that is a package of the Go module above it. The plugin describes each one in its result, or answers with an error saying why it cannot."
1197
+ },
1198
+ "settings": {
1199
+ "type": "object",
1200
+ "additionalProperties": {
1201
+ "type": "object"
1202
+ },
1203
+ "description": "Settings are this plugin's settings for projects, by project name, from smith.toml [projects.<project>.settings.<plugin>]. They reach the plugin here because the tasks it describes may depend on them (the Go plugin's build tags). A project with no settings is absent."
1119
1204
  }
1120
1205
  },
1121
1206
  "required": [
@@ -1345,6 +1430,13 @@ export const protocolSchema = {
1345
1430
  "dir": {
1346
1431
  "type": "string",
1347
1432
  "description": "Dir is where it runs, workspace-relative; empty is the workspace root."
1433
+ },
1434
+ "env": {
1435
+ "type": "array",
1436
+ "items": {
1437
+ "type": "string"
1438
+ },
1439
+ "description": "Env are KEY=VALUE entries added to the environment of the command (GOBIN=<folder> makes go install write there). Absent adds none."
1348
1440
  }
1349
1441
  },
1350
1442
  "required": [
@@ -1549,6 +1641,13 @@ export const protocolSchema = {
1549
1641
  "$ref": "#/$defs/Choice"
1550
1642
  },
1551
1643
  "description": "Choices are the options on an axis (framework, test, style) the plugin owns. The host lists them (smith choices) and checks a selection of them (smith add --with). Absent means the plugin owns none."
1644
+ },
1645
+ "tools": {
1646
+ "type": "array",
1647
+ "items": {
1648
+ "$ref": "#/$defs/ToolNeed"
1649
+ },
1650
+ "description": "Tools are the programs the plugin needs on the person's machine. The host detects them and, when one is missing, presents the ways to get it (smith tools). Absent means the plugin declares none."
1552
1651
  }
1553
1652
  },
1554
1653
  "required": [
@@ -1645,6 +1744,94 @@ export const protocolSchema = {
1645
1744
  }
1646
1745
  }
1647
1746
  },
1747
+ "LinkOption": {
1748
+ "description": "LinkOption is one way to write the dependency, with its consequence in words a person who read no manual can follow.",
1749
+ "type": "object",
1750
+ "properties": {
1751
+ "spec": {
1752
+ "type": "string",
1753
+ "description": "Spec is the value passed back in LinkParams.Spec."
1754
+ },
1755
+ "label": {
1756
+ "type": "string",
1757
+ "description": "Label is the option in a few words."
1758
+ },
1759
+ "meaning": {
1760
+ "type": "string",
1761
+ "description": "Meaning says what happens with this option."
1762
+ }
1763
+ },
1764
+ "required": [
1765
+ "spec",
1766
+ "label",
1767
+ "meaning"
1768
+ ]
1769
+ },
1770
+ "LinkParams": {
1771
+ "description": "LinkParams asks a plugin to make Project depend on Library, a lib or package of the same workspace and language, in the ecosystem's own form, and to install or lock as that needs. The host has checked that both exist, that the languages match, that Library is not an app, and that the link makes no cycle; the plugin answers with an error that names the file when it cannot write the dependency.",
1772
+ "type": "object",
1773
+ "properties": {
1774
+ "project": {
1775
+ "$ref": "#/$defs/Project",
1776
+ "description": "Project is the project that gains the dependency."
1777
+ },
1778
+ "library": {
1779
+ "$ref": "#/$defs/Project",
1780
+ "description": "Library is the project it depends on."
1781
+ },
1782
+ "quiet": {
1783
+ "type": "boolean",
1784
+ "description": "Quiet keeps the package manager's output unless it fails."
1785
+ },
1786
+ "plan": {
1787
+ "type": "boolean",
1788
+ "description": "Plan asks for the plan only: the plugin writes nothing and answers with the manifest, the line it would write and the choices the user has."
1789
+ },
1790
+ "spec": {
1791
+ "type": "string",
1792
+ "description": "Spec is the version range the user chose from LinkResult.Options; empty means the plugin's default, or the form the workspace already uses."
1793
+ }
1794
+ },
1795
+ "required": [
1796
+ "project",
1797
+ "library"
1798
+ ]
1799
+ },
1800
+ "LinkResult": {
1801
+ "description": "LinkResult is what a link wrote, or with LinkParams.Plan would write.",
1802
+ "type": "object",
1803
+ "properties": {
1804
+ "files": {
1805
+ "type": "array",
1806
+ "items": {
1807
+ "type": "string"
1808
+ },
1809
+ "description": "Files are the workspace-relative files changed (or to be changed)."
1810
+ },
1811
+ "notes": {
1812
+ "type": "array",
1813
+ "items": {
1814
+ "type": "string"
1815
+ },
1816
+ "description": "Notes are for the user."
1817
+ },
1818
+ "manifest": {
1819
+ "type": "string",
1820
+ "description": "Manifest is the file the dependency goes into, workspace-relative."
1821
+ },
1822
+ "line": {
1823
+ "type": "string",
1824
+ "description": "Line is the dependency as it is written there, for the plan shown before anything is written (\"@acme/core\": \"*\")."
1825
+ },
1826
+ "options": {
1827
+ "type": "array",
1828
+ "items": {
1829
+ "$ref": "#/$defs/LinkOption"
1830
+ },
1831
+ "description": "Options are the real choices of the range written, with the default first. Empty when the ecosystem has none, or the workspace already follows a convention (then Line shows it)."
1832
+ }
1833
+ }
1834
+ },
1648
1835
  "PackageStore": {
1649
1836
  "description": "PackageStore is where a package manager keeps what it downloaded (npm's ~/.npm, Go's module cache). A generated pipeline restores it before setup and saves it after a run, keyed on Files, so `npm ci` or `go mod download` fetches only what changed. A pull request from a fork restores it and never writes the base repository's cache.",
1650
1837
  "type": "object",
@@ -1864,6 +2051,17 @@ export const protocolSchema = {
1864
2051
  "tag": {
1865
2052
  "type": "string",
1866
2053
  "description": "Tag is the name of the release channel the version belongs to (npm's dist-tag \"beta\"). When set, the plugin publishes under it and leaves the registry's stable pointer where it is, or ignores it when its registry has no such pointer. Only sent to a plugin with the channels capability."
2054
+ },
2055
+ "propagationWait": {
2056
+ "type": "string",
2057
+ "description": "PropagationWait is the longest time a plugin waits, in a Finalize call, for the packages of the release to be fetchable from the registry: a duration such as \"15m\", \"0\" to not wait. Empty means the default. Only npm has such a wait. A publish never waits."
2058
+ },
2059
+ "finalize": {
2060
+ "type": "array",
2061
+ "items": {
2062
+ "$ref": "#/$defs/TagMove"
2063
+ },
2064
+ "description": "Finalize turns the call into the last phase of a release: nothing is published; for each move the plugin waits until its packages are fetchable, then moves the dist-tag. The host sends it after every project has published, so a wait never blocks another publish."
1867
2065
  }
1868
2066
  },
1869
2067
  "required": [
@@ -1884,6 +2082,27 @@ export const protocolSchema = {
1884
2082
  "registry": {
1885
2083
  "type": "string"
1886
2084
  },
2085
+ "notes": {
2086
+ "type": "array",
2087
+ "items": {
2088
+ "type": "string"
2089
+ },
2090
+ "description": "Notes are things the person must know about a publish that succeeded, such as a dist-tag that was not moved; the host prints them and the report keeps them."
2091
+ },
2092
+ "pendingMoves": {
2093
+ "type": "array",
2094
+ "items": {
2095
+ "$ref": "#/$defs/TagMove"
2096
+ },
2097
+ "description": "PendingMoves are the dist-tags the call did not move, because the packages the release needs were not fetchable yet. A publish returns them for the host to move at the end of the release; a Finalize call returns the ones still waiting when its time ran out. The release then ends with a warning, never silently."
2098
+ },
2099
+ "moved": {
2100
+ "type": "array",
2101
+ "items": {
2102
+ "type": "string"
2103
+ },
2104
+ "description": "Moved names the dist-tags a Finalize call moved (\"name@version tag\")."
2105
+ },
1887
2106
  "assets": {
1888
2107
  "type": "array",
1889
2108
  "items": {
@@ -2292,6 +2511,36 @@ export const protocolSchema = {
2292
2511
  "blocking"
2293
2512
  ]
2294
2513
  },
2514
+ "TagMove": {
2515
+ "description": "TagMove is a dist-tag a publish left where it was, because the packages the release needs were not fetchable yet.",
2516
+ "type": "object",
2517
+ "properties": {
2518
+ "package": {
2519
+ "type": "string",
2520
+ "description": "Package and Version name the package that carries the tag."
2521
+ },
2522
+ "version": {
2523
+ "type": "string"
2524
+ },
2525
+ "tag": {
2526
+ "type": "string",
2527
+ "description": "Tag is the dist-tag to move to Version."
2528
+ },
2529
+ "awaits": {
2530
+ "type": "array",
2531
+ "items": {
2532
+ "type": "string"
2533
+ },
2534
+ "description": "Awaits are the packages that must be fetchable first."
2535
+ }
2536
+ },
2537
+ "required": [
2538
+ "package",
2539
+ "version",
2540
+ "tag",
2541
+ "awaits"
2542
+ ]
2543
+ },
2295
2544
  "Task": {
2296
2545
  "description": "Task is a command the host can run, hash and cache.",
2297
2546
  "type": "object",
@@ -2362,6 +2611,132 @@ export const protocolSchema = {
2362
2611
  "command"
2363
2612
  ]
2364
2613
  },
2614
+ "ToolInstall": {
2615
+ "description": "ToolInstall is one way to get a tool with a package manager. Manager is one of: \"winget\", \"brew\", \"brew-cask\", \"apt\", \"dnf\", \"pacman\", \"npm\", \"uv\", \"fnm\", \"rustup\", \"cargo\" and \"go\" (go install, for a tool published as a Go module). The host builds the exact command from the manager and Package; Package may hold {major}, {major.minor} and {version} (the whole version), which the pinned or suggested version fills. The language's own installers (uv, fnm, rustup, cargo) are offered only when they are already on the machine.",
2616
+ "type": "object",
2617
+ "properties": {
2618
+ "manager": {
2619
+ "type": "string"
2620
+ },
2621
+ "package": {
2622
+ "type": "string"
2623
+ },
2624
+ "note": {
2625
+ "type": "string",
2626
+ "description": "Note adds a sentence the person needs before choosing (\"a new terminal is needed\")."
2627
+ }
2628
+ },
2629
+ "required": [
2630
+ "manager",
2631
+ "package"
2632
+ ]
2633
+ },
2634
+ "ToolNeed": {
2635
+ "description": "ToolNeed is a program on the person's machine that a plugin needs to build, test or run its projects (Python, the .NET SDK, Docker). A plugin publishes the tools it needs in InitializeResult.Tools. The host detects them, and when one is missing it presents the ways to get it (ADR 0077): it never installs in silence. The plugin writes facts only (what the tool is, how to detect it, how each system gets it); the host decides how to ask.",
2636
+ "type": "object",
2637
+ "properties": {
2638
+ "name": {
2639
+ "type": "string",
2640
+ "description": "Name identifies the tool across plugins and in commands (smith tools install python). Two plugins that need the same tool use the same Name."
2641
+ },
2642
+ "title": {
2643
+ "type": "string",
2644
+ "description": "Title is what the tool is called in text: \"Python\", \"the .NET SDK\". Doctor words the check \"<Title> is installed\"."
2645
+ },
2646
+ "why": {
2647
+ "type": "string",
2648
+ "description": "Why says in plain words what smith needs the tool for."
2649
+ },
2650
+ "consequence": {
2651
+ "type": "string",
2652
+ "description": "Consequence says what stops working while the tool is missing, as the end of a sentence that starts \"If you skip it, \": \"smith test and smith build fail for the python projects\"."
2653
+ },
2654
+ "program": {
2655
+ "type": "string",
2656
+ "description": "Program is the program that carries the tool on PATH (\"python3\")."
2657
+ },
2658
+ "alternatives": {
2659
+ "type": "array",
2660
+ "items": {
2661
+ "type": "string"
2662
+ },
2663
+ "description": "Alternatives are other programs that also count (\"python\", \"py\")."
2664
+ },
2665
+ "versionArgs": {
2666
+ "type": "array",
2667
+ "items": {
2668
+ "type": "string"
2669
+ },
2670
+ "description": "VersionArgs are the arguments that make Program print its version. Absent means --version."
2671
+ },
2672
+ "pins": {
2673
+ "type": "array",
2674
+ "items": {
2675
+ "$ref": "#/$defs/ToolVersionPin"
2676
+ },
2677
+ "description": "Pins are the files where a workspace pins the version it wants. The first pin the host finds gives the version range. Absent means any version counts."
2678
+ },
2679
+ "choice": {
2680
+ "type": "string",
2681
+ "description": "Choice limits the tool to stacks that have this choice (\"azure-functions\"): the tool is not needed by a project built without it. Absent means every project of the plugin needs it."
2682
+ },
2683
+ "files": {
2684
+ "type": "array",
2685
+ "items": {
2686
+ "type": "string"
2687
+ },
2688
+ "description": "Files limit the tool to projects that hold one of these files in their folder (\"build.gradle.kts\"): a Gradle build needs gradle, a Maven build does not. A tool that the tasks of a project run (gradle, mvn) is declared this way. Absent means every project of the plugin needs it."
2689
+ },
2690
+ "systems": {
2691
+ "type": "array",
2692
+ "items": {
2693
+ "type": "string"
2694
+ },
2695
+ "description": "Systems limits the tool to these systems, named as Go names them (\"windows\", \"darwin\", \"linux\"): the Xcode Command Line Tools exist only on \"darwin\". Absent means every system."
2696
+ },
2697
+ "suggested": {
2698
+ "type": "string",
2699
+ "description": "Suggested is the version smith installs when no pin says one: \"3.13\". It fills {major} and {major.minor} in the install entries."
2700
+ },
2701
+ "optional": {
2702
+ "type": "boolean",
2703
+ "description": "Optional marks a tool whose absence only costs a feature (running a function app locally). Doctor reports it as a warning, not a failure."
2704
+ },
2705
+ "exact": {
2706
+ "type": "boolean",
2707
+ "description": "Exact says Suggested is the one version the workspace wants, such as the version CI pins: an installed version that differs, older or newer, is reported as different, and an install fetches that version."
2708
+ },
2709
+ "install": {
2710
+ "type": "array",
2711
+ "items": {
2712
+ "$ref": "#/$defs/ToolInstall"
2713
+ },
2714
+ "description": "Install are the ways to get the tool, per package manager and system."
2715
+ },
2716
+ "download": {
2717
+ "type": "string",
2718
+ "description": "Download is the official page of the tool, for the person who installs it by hand or has no package manager."
2719
+ },
2720
+ "source": {
2721
+ "type": "string",
2722
+ "description": "Source is the address of the page the Install entries were checked against."
2723
+ },
2724
+ "checked": {
2725
+ "type": "string",
2726
+ "description": "Checked is the date (YYYY-MM-DD) the entries were last checked."
2727
+ }
2728
+ },
2729
+ "required": [
2730
+ "name",
2731
+ "title",
2732
+ "why",
2733
+ "consequence",
2734
+ "program",
2735
+ "download",
2736
+ "source",
2737
+ "checked"
2738
+ ]
2739
+ },
2365
2740
  "ToolPin": {
2366
2741
  "description": "ToolPin is a tool the plugin installs at a pinned version (in CI, the dev container, the venv) against the newest release; informational.",
2367
2742
  "type": "object",
@@ -2386,6 +2761,23 @@ export const protocolSchema = {
2386
2761
  "pinned"
2387
2762
  ]
2388
2763
  },
2764
+ "ToolVersionPin": {
2765
+ "description": "ToolVersionPin names a file that pins the version of a tool and how to read it. Format is one of: \"text\" (the first word of the file, as in .nvmrc and .python-version), \"go-mod\" (the toolchain line, else the go line), \"pyproject\" (requires-python), \"global-json\" (sdk.version) and \"rust-toolchain\" (the channel).",
2766
+ "type": "object",
2767
+ "properties": {
2768
+ "file": {
2769
+ "type": "string",
2770
+ "description": "File is the base name of the file, looked up at the workspace root and in the folders of the projects that use the tool."
2771
+ },
2772
+ "format": {
2773
+ "type": "string"
2774
+ }
2775
+ },
2776
+ "required": [
2777
+ "file",
2778
+ "format"
2779
+ ]
2780
+ },
2389
2781
  "Toolchain": {
2390
2782
  "description": "Toolchain is a runtime the pipeline must install, and how. Plugins asking for the same name share one setup step (the first plugin's).",
2391
2783
  "type": "object",
@@ -2437,6 +2829,22 @@ export const protocolSchema = {
2437
2829
  "packages"
2438
2830
  ]
2439
2831
  },
2832
+ "UnlinkParams": {
2833
+ "description": "UnlinkParams asks a plugin to remove the dependency of Project on Library. Notes of the result say so when the manifest held no such dependency.",
2834
+ "type": "object",
2835
+ "properties": {
2836
+ "project": {
2837
+ "$ref": "#/$defs/Project"
2838
+ },
2839
+ "library": {
2840
+ "$ref": "#/$defs/Project"
2841
+ }
2842
+ },
2843
+ "required": [
2844
+ "project",
2845
+ "library"
2846
+ ]
2847
+ },
2440
2848
  "VersionParams": {
2441
2849
  "description": "VersionParams asks a plugin to record a new version in a project manifest.",
2442
2850
  "type": "object",
@@ -177,6 +177,13 @@ export interface Capabilities {
177
177
  published?: boolean;
178
178
  /** Dependencies installs and uninstalls packages in its projects. */
179
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;
180
187
  /** Declarations lists and rewrites declared dependency specs (sync, up). */
181
188
  declarations?: boolean;
182
189
  /** Latest reports the newest releases of dependencies and pinned tools. */
@@ -204,6 +211,13 @@ export interface Capabilities {
204
211
  * plugin that lacks it.
205
212
  */
206
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;
207
221
  }
208
222
  /**
209
223
  * ChangeKindParams asks a plugin what changing a project's kind edits. The plugin writes nothing:
@@ -265,6 +279,19 @@ export interface Choice {
265
279
  */
266
280
  name: string;
267
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;
268
295
  /** Language is the language plugin the choice applies to ("node"). */
269
296
  language: string;
270
297
  /**
@@ -280,6 +307,12 @@ export interface Choice {
280
307
  needs?: string[];
281
308
  /** Default marks the choice the host adds when a selection needs its axis and has no choice on it. */
282
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;
283
316
  /**
284
317
  * Many allows the choice next to other choices of its axis that are Many too. By default a
285
318
  * selection has one choice per axis.
@@ -406,6 +439,15 @@ export interface Declaration {
406
439
  export interface DeclaredParams {
407
440
  projects: Project[];
408
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
+ }
409
451
  /**
410
452
  * DeclaredResult is every declaration, and the version installed of each name where the plugin can
411
453
  * tell.
@@ -502,6 +544,20 @@ export interface DevcontainerFeature {
502
544
  */
503
545
  export interface DiscoverParams {
504
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>>;
505
561
  }
506
562
  /**
507
563
  * DiscoverResult describes every manifest that is a project of this plugin. A manifest the plugin
@@ -612,6 +668,11 @@ export interface FixStep {
612
668
  argv: string[];
613
669
  /** Dir is where it runs, workspace-relative; empty is the workspace root. */
614
670
  dir?: string;
671
+ /**
672
+ * Env are KEY=VALUE entries added to the environment of the command (GOBIN=<folder> makes go
673
+ * install write there). Absent adds none.
674
+ */
675
+ env?: string[];
615
676
  }
616
677
  /**
617
678
  * GenerateParams asks a plugin to scaffold a project. The host chooses the directory from the kind
@@ -743,6 +804,12 @@ export interface InitializeResult {
743
804
  * owns none.
744
805
  */
745
806
  choices?: Choice[];
807
+ /**
808
+ * Tools are the programs the plugin needs on the person's machine. The host detects them and,
809
+ * when one is missing, presents the ways to get it (smith tools). Absent means the plugin
810
+ * declares none.
811
+ */
812
+ tools?: ToolNeed[];
746
813
  }
747
814
  /**
748
815
  * Input is one input of an ActionStep. Values are written as quoted YAML strings, except true and
@@ -795,6 +862,62 @@ export interface LatestResult {
795
862
  unreachable?: Record<string, string>;
796
863
  tools?: ToolPin[];
797
864
  }
865
+ /**
866
+ * LinkOption is one way to write the dependency, with its consequence in words a person who read no
867
+ * manual can follow.
868
+ */
869
+ export interface LinkOption {
870
+ /** Spec is the value passed back in LinkParams.Spec. */
871
+ spec: string;
872
+ /** Label is the option in a few words. */
873
+ label: string;
874
+ /** Meaning says what happens with this option. */
875
+ meaning: string;
876
+ }
877
+ /**
878
+ * LinkParams asks a plugin to make Project depend on Library, a lib or package of the same
879
+ * workspace and language, in the ecosystem's own form, and to install or lock as that needs. The
880
+ * host has checked that both exist, that the languages match, that Library is not an app, and that
881
+ * the link makes no cycle; the plugin answers with an error that names the file when it cannot
882
+ * write the dependency.
883
+ */
884
+ export interface LinkParams {
885
+ /** Project is the project that gains the dependency. */
886
+ project: Project;
887
+ /** Library is the project it depends on. */
888
+ library: Project;
889
+ /** Quiet keeps the package manager's output unless it fails. */
890
+ quiet?: boolean;
891
+ /**
892
+ * Plan asks for the plan only: the plugin writes nothing and answers with the manifest, the line
893
+ * it would write and the choices the user has.
894
+ */
895
+ plan?: boolean;
896
+ /**
897
+ * Spec is the version range the user chose from LinkResult.Options; empty means the plugin's
898
+ * default, or the form the workspace already uses.
899
+ */
900
+ spec?: string;
901
+ }
902
+ /** LinkResult is what a link wrote, or with LinkParams.Plan would write. */
903
+ export interface LinkResult {
904
+ /** Files are the workspace-relative files changed (or to be changed). */
905
+ files?: string[];
906
+ /** Notes are for the user. */
907
+ notes?: string[];
908
+ /** Manifest is the file the dependency goes into, workspace-relative. */
909
+ manifest?: string;
910
+ /**
911
+ * Line is the dependency as it is written there, for the plan shown before anything is written
912
+ * ("@acme/core": "*").
913
+ */
914
+ line?: string;
915
+ /**
916
+ * Options are the real choices of the range written, with the default first. Empty when the
917
+ * ecosystem has none, or the workspace already follows a convention (then Line shows it).
918
+ */
919
+ options?: LinkOption[];
920
+ }
798
921
  /**
799
922
  * PackageStore is where a package manager keeps what it downloaded (npm's ~/.npm, Go's module
800
923
  * cache). A generated pipeline restores it before setup and saves it after a run, keyed on Files,
@@ -973,6 +1096,18 @@ export interface PublishParams {
973
1096
  * capability.
974
1097
  */
975
1098
  tag?: string;
1099
+ /**
1100
+ * PropagationWait is the longest time a plugin waits, in a Finalize call, for the packages of the
1101
+ * release to be fetchable from the registry: a duration such as "15m", "0" to not wait. Empty
1102
+ * means the default. Only npm has such a wait. A publish never waits.
1103
+ */
1104
+ propagationWait?: string;
1105
+ /**
1106
+ * Finalize turns the call into the last phase of a release: nothing is published; for each move
1107
+ * the plugin waits until its packages are fetchable, then moves the dist-tag. The host sends it
1108
+ * after every project has published, so a wait never blocks another publish.
1109
+ */
1110
+ finalize?: TagMove[];
976
1111
  }
977
1112
  /**
978
1113
  * PublishResult reports what happened. Skipped with a reason is a success: an already-published
@@ -982,6 +1117,20 @@ export interface PublishResult {
982
1117
  published: boolean;
983
1118
  skipped?: string;
984
1119
  registry?: string;
1120
+ /**
1121
+ * Notes are things the person must know about a publish that succeeded, such as a dist-tag that
1122
+ * was not moved; the host prints them and the report keeps them.
1123
+ */
1124
+ notes?: string[];
1125
+ /**
1126
+ * PendingMoves are the dist-tags the call did not move, because the packages the release needs
1127
+ * were not fetchable yet. A publish returns them for the host to move at the end of the release;
1128
+ * a Finalize call returns the ones still waiting when its time ran out. The release then ends
1129
+ * with a warning, never silently.
1130
+ */
1131
+ pendingMoves?: TagMove[];
1132
+ /** Moved names the dist-tags a Finalize call moved ("name@version tag"). */
1133
+ moved?: string[];
985
1134
  /**
986
1135
  * Assets are the workspace-relative files built for the release, in upload order; in a dry run,
987
1136
  * the files that would be built.
@@ -1185,6 +1334,19 @@ export interface Step {
1185
1334
  */
1186
1335
  cacheFiles?: string[];
1187
1336
  }
1337
+ /**
1338
+ * TagMove is a dist-tag a publish left where it was, because the packages the release needs were
1339
+ * not fetchable yet.
1340
+ */
1341
+ export interface TagMove {
1342
+ /** Package and Version name the package that carries the tag. */
1343
+ package: string;
1344
+ version: string;
1345
+ /** Tag is the dist-tag to move to Version. */
1346
+ tag: string;
1347
+ /** Awaits are the packages that must be fetchable first. */
1348
+ awaits: string[];
1349
+ }
1188
1350
  /** Task is a command the host can run, hash and cache. */
1189
1351
  export interface Task {
1190
1352
  /** Command is an argv array; it is never passed through a shell. */
@@ -1228,6 +1390,101 @@ export interface Task {
1228
1390
  /** ServeTimeout is how long to wait for ServeURL, as a Go duration ("60s"); empty means 60s. */
1229
1391
  serveTimeout?: string;
1230
1392
  }
1393
+ /**
1394
+ * ToolInstall is one way to get a tool with a package manager. Manager is one of: "winget", "brew",
1395
+ * "brew-cask", "apt", "dnf", "pacman", "npm", "uv", "fnm", "rustup", "cargo" and "go" (go install,
1396
+ * for a tool published as a Go module). The host builds the exact command from the manager and
1397
+ * Package; Package may hold {major}, {major.minor} and {version} (the whole version), which the
1398
+ * pinned or suggested version fills. The language's own installers (uv, fnm, rustup, cargo) are
1399
+ * offered only when they are already on the machine.
1400
+ */
1401
+ export interface ToolInstall {
1402
+ manager: string;
1403
+ package: string;
1404
+ /** Note adds a sentence the person needs before choosing ("a new terminal is needed"). */
1405
+ note?: string;
1406
+ }
1407
+ /**
1408
+ * ToolNeed is a program on the person's machine that a plugin needs to build, test or run its
1409
+ * projects (Python, the .NET SDK, Docker). A plugin publishes the tools it needs in
1410
+ * InitializeResult.Tools. The host detects them, and when one is missing it presents the ways to
1411
+ * get it (ADR 0077): it never installs in silence. The plugin writes facts only (what the tool is,
1412
+ * how to detect it, how each system gets it); the host decides how to ask.
1413
+ */
1414
+ export interface ToolNeed {
1415
+ /**
1416
+ * Name identifies the tool across plugins and in commands (smith tools install python). Two
1417
+ * plugins that need the same tool use the same Name.
1418
+ */
1419
+ name: string;
1420
+ /**
1421
+ * Title is what the tool is called in text: "Python", "the .NET SDK". Doctor words the check
1422
+ * "<Title> is installed".
1423
+ */
1424
+ title: string;
1425
+ /** Why says in plain words what smith needs the tool for. */
1426
+ why: string;
1427
+ /**
1428
+ * Consequence says what stops working while the tool is missing, as the end of a sentence that
1429
+ * starts "If you skip it, ": "smith test and smith build fail for the python projects".
1430
+ */
1431
+ consequence: string;
1432
+ /** Program is the program that carries the tool on PATH ("python3"). */
1433
+ program: string;
1434
+ /** Alternatives are other programs that also count ("python", "py"). */
1435
+ alternatives?: string[];
1436
+ /** VersionArgs are the arguments that make Program print its version. Absent means --version. */
1437
+ versionArgs?: string[];
1438
+ /**
1439
+ * Pins are the files where a workspace pins the version it wants. The first pin the host finds
1440
+ * gives the version range. Absent means any version counts.
1441
+ */
1442
+ pins?: ToolVersionPin[];
1443
+ /**
1444
+ * Choice limits the tool to stacks that have this choice ("azure-functions"): the tool is not
1445
+ * needed by a project built without it. Absent means every project of the plugin needs it.
1446
+ */
1447
+ choice?: string;
1448
+ /**
1449
+ * Files limit the tool to projects that hold one of these files in their folder
1450
+ * ("build.gradle.kts"): a Gradle build needs gradle, a Maven build does not. A tool that the
1451
+ * tasks of a project run (gradle, mvn) is declared this way. Absent means every project of the
1452
+ * plugin needs it.
1453
+ */
1454
+ files?: string[];
1455
+ /**
1456
+ * Systems limits the tool to these systems, named as Go names them ("windows", "darwin",
1457
+ * "linux"): the Xcode Command Line Tools exist only on "darwin". Absent means every system.
1458
+ */
1459
+ systems?: string[];
1460
+ /**
1461
+ * Suggested is the version smith installs when no pin says one: "3.13". It fills {major} and
1462
+ * {major.minor} in the install entries.
1463
+ */
1464
+ suggested?: string;
1465
+ /**
1466
+ * Optional marks a tool whose absence only costs a feature (running a function app locally).
1467
+ * Doctor reports it as a warning, not a failure.
1468
+ */
1469
+ optional?: boolean;
1470
+ /**
1471
+ * Exact says Suggested is the one version the workspace wants, such as the version CI pins: an
1472
+ * installed version that differs, older or newer, is reported as different, and an install
1473
+ * fetches that version.
1474
+ */
1475
+ exact?: boolean;
1476
+ /** Install are the ways to get the tool, per package manager and system. */
1477
+ install?: ToolInstall[];
1478
+ /**
1479
+ * Download is the official page of the tool, for the person who installs it by hand or has no
1480
+ * package manager.
1481
+ */
1482
+ download: string;
1483
+ /** Source is the address of the page the Install entries were checked against. */
1484
+ source: string;
1485
+ /** Checked is the date (YYYY-MM-DD) the entries were last checked. */
1486
+ checked: string;
1487
+ }
1231
1488
  /**
1232
1489
  * ToolPin is a tool the plugin installs at a pinned version (in CI, the dev container, the venv)
1233
1490
  * against the newest release; informational.
@@ -1240,6 +1497,20 @@ export interface ToolPin {
1240
1497
  /** Newer is true when Latest is a release the pin does not cover. */
1241
1498
  newer?: boolean;
1242
1499
  }
1500
+ /**
1501
+ * ToolVersionPin names a file that pins the version of a tool and how to read it. Format is one of:
1502
+ * "text" (the first word of the file, as in .nvmrc and .python-version), "go-mod" (the toolchain
1503
+ * line, else the go line), "pyproject" (requires-python), "global-json" (sdk.version) and
1504
+ * "rust-toolchain" (the channel).
1505
+ */
1506
+ export interface ToolVersionPin {
1507
+ /**
1508
+ * File is the base name of the file, looked up at the workspace root and in the folders of the
1509
+ * projects that use the tool.
1510
+ */
1511
+ file: string;
1512
+ format: string;
1513
+ }
1243
1514
  /**
1244
1515
  * Toolchain is a runtime the pipeline must install, and how. Plugins asking for the same name share
1245
1516
  * one setup step (the first plugin's).
@@ -1267,6 +1538,14 @@ export interface UninstallParams {
1267
1538
  project: Project;
1268
1539
  packages: string[];
1269
1540
  }
1541
+ /**
1542
+ * UnlinkParams asks a plugin to remove the dependency of Project on Library. Notes of the result
1543
+ * say so when the manifest held no such dependency.
1544
+ */
1545
+ export interface UnlinkParams {
1546
+ project: Project;
1547
+ library: Project;
1548
+ }
1270
1549
  /** VersionParams asks a plugin to record a new version in a project manifest. */
1271
1550
  export interface VersionParams {
1272
1551
  project: Project;
@@ -1403,6 +1682,21 @@ export interface ProtocolMethods {
1403
1682
  result: DependencyResult;
1404
1683
  capability: 'dependencies';
1405
1684
  };
1685
+ /**
1686
+ * Makes a project depend on a library of the same workspace and language, in the ecosystem's own
1687
+ * form, then installs or locks as that needs.
1688
+ */
1689
+ 'dependencies/link': {
1690
+ params: LinkParams;
1691
+ result: LinkResult;
1692
+ capability: 'link';
1693
+ };
1694
+ /** Removes the dependency of a project on a library of the same workspace. */
1695
+ 'dependencies/unlink': {
1696
+ params: UnlinkParams;
1697
+ result: DependencyResult;
1698
+ capability: 'link';
1699
+ };
1406
1700
  /** Lists the dependencies the manifests of the plugin's projects declare. */
1407
1701
  'dependencies/declared': {
1408
1702
  params: DeclaredParams;
package/serve/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { serve, serveStreams } from './serve.use-case.ts';
2
2
  export { capabilitiesOf, implementsMethod } from './capabilities-of.algorithm.ts';
3
- export type { APISurfaceReader, Awaitable, Cancellable, CIContributor, ComponentLister, Contributor, DeclarationEditor, DependencyManager, Deriver, Discoverer, DoctorContributor, Generator, KindChanger, LatestReader, Plugin, PluginDescription, Publisher, RegistryReader, Remover, SmithPlugin, Versioner, } from './plugin.contract.ts';
3
+ export type { APISurfaceReader, Awaitable, Cancellable, CIContributor, ComponentLister, Contributor, DeclarationEditor, DependencyManager, Deriver, Discoverer, DoctorContributor, Generator, KindChanger, LatestReader, Linker, Plugin, PluginDescription, Publisher, RegistryReader, Remover, SmithPlugin, Versioner, } from './plugin.contract.ts';
4
4
  export type { FrameSink, ServeStreams } from './protocol-streams.contract.ts';
@@ -20,6 +20,8 @@ export const PLUGIN_MEMBERS = {
20
20
  'published': { member: 'published', requires: ['published'] },
21
21
  'dependencies/install': { member: 'install', requires: ['install', 'uninstall'] },
22
22
  'dependencies/uninstall': { member: 'uninstall', requires: ['install', 'uninstall'] },
23
+ 'dependencies/link': { member: 'link', requires: ['link', 'unlink'] },
24
+ 'dependencies/unlink': { member: 'unlink', requires: ['link', 'unlink'] },
23
25
  'dependencies/declared': { member: 'declared', requires: ['declared', 'rewrite'] },
24
26
  'dependencies/rewrite': { member: 'rewrite', requires: ['declared', 'rewrite'] },
25
27
  'dependencies/latest': { member: 'latest', requires: ['latest'] },
@@ -1,4 +1,4 @@
1
- import type { DeriveParams, DeriveResult, APISurfaceParams, APISurfaceResult, ChangeKindParams, ChangeKindResult, CIParams, CIResult, ComponentsParams, ComponentsResult, ContributeParams, ContributeResult, DeclaredParams, DeclaredResult, DependencyResult, DiscoverParams, DiscoverResult, DoctorParams, DoctorResult, GenerateParams, GenerateResult, InitializeParams, InitializeResult, InstallParams, LatestParams, LatestResult, PublishedParams, PublishedResult, PublishParams, PublishResult, RemoveParams, RemoveResult, RewriteParams, UninstallParams, VersionParams, VersionResult } from '../protocol/index.ts';
1
+ import type { DeriveParams, DeriveResult, APISurfaceParams, APISurfaceResult, ChangeKindParams, ChangeKindResult, CIParams, CIResult, ComponentsParams, ComponentsResult, ContributeParams, ContributeResult, DeclaredParams, DeclaredResult, DependencyResult, DiscoverParams, DiscoverResult, DoctorParams, DoctorResult, GenerateParams, GenerateResult, InitializeParams, InitializeResult, InstallParams, LatestParams, LatestResult, LinkParams, LinkResult, PublishedParams, PublishedResult, PublishParams, PublishResult, RemoveParams, RemoveResult, RewriteParams, UninstallParams, UnlinkParams, VersionParams, VersionResult } from '../protocol/index.ts';
2
2
  /** A result now or later: every method of a plugin may be `async`. */
3
3
  export type Awaitable<T> = T | Promise<T>;
4
4
  /** What a plugin says about itself. The serve loop fills in `protocolVersion` and `capabilities`. */
@@ -61,6 +61,11 @@ export interface DependencyManager {
61
61
  install: (params: InstallParams, signal: AbortSignal) => Awaitable<DependencyResult>;
62
62
  uninstall: (params: UninstallParams, signal: AbortSignal) => Awaitable<DependencyResult>;
63
63
  }
64
+ /** `dependencies/link` and `dependencies/unlink`: both, or the capability is not advertised. */
65
+ export interface Linker {
66
+ link: (params: LinkParams, signal: AbortSignal) => Awaitable<LinkResult>;
67
+ unlink: (params: UnlinkParams, signal: AbortSignal) => Awaitable<DependencyResult>;
68
+ }
64
69
  /** `dependencies/declared` and `dependencies/rewrite`: both, or the capability is not advertised. */
65
70
  export interface DeclarationEditor {
66
71
  declared: (params: DeclaredParams, signal: AbortSignal) => Awaitable<DeclaredResult>;
@@ -93,4 +98,4 @@ export interface Cancellable {
93
98
  * from `cancellable`. How many requests it can work on at once is declared in
94
99
  * `describe`'s `concurrency`: omit it for one at a time, in order.
95
100
  */
96
- export type SmithPlugin = Plugin & Partial<Discoverer & Generator & Versioner & Publisher & RegistryReader & CIContributor & DoctorContributor & Remover & KindChanger & ComponentLister & Deriver & APISurfaceReader & DependencyManager & DeclarationEditor & LatestReader & Contributor & Cancellable>;
101
+ export type SmithPlugin = Plugin & Partial<Discoverer & Generator & Versioner & Publisher & RegistryReader & CIContributor & DoctorContributor & Remover & KindChanger & ComponentLister & Deriver & APISurfaceReader & DependencyManager & Linker & DeclarationEditor & LatestReader & Contributor & Cancellable>;