Skip to content

M0 foundation: module skeleton, build tooling, tests, CI and governance - #2

Merged
t11z merged 4 commits into
mainfrom
claude/admiring-tesla-r738sg
Sep 19, 2026
Merged

t11z merged 4 commits into
mainfrom
claude/admiring-tesla-r738sg

Conversation

@t11z

@t11z t11z commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Milestone M0 (Fundament) of docs/implementation-plan.md: the repository becomes a buildable, analysed and tested module skeleton with CI and the governance documents the SDK tiering policy asks for. No protocol functionality yet.

  • Module skeleton (src/): ModelContextProtocol manifest (PowerShell 7.4, Core edition only, explicit exports, PSData with prerelease preview1), ModuleBuilder settings, enums McpEra and McpLoggingLevel, Suffix.ps1 that registers the engine types as type accelerators on import and removes them on Remove-Module, empty type/format files, about topic. Import is side-effect free (verified in-process and in fresh pwsh processes, also under -File).
  • Build tooling: build.ps1 (dependency bootstrap with PSGallery → NuGet.org → offline fallbacks, version ranges from requirements.psd1) and Invoke-Build tasks Clean, Build, Analyze, Test, Coverage, Help, Package, PublishLocal, Publish, Conformance (M2 placeholder), CI.
  • Analyzer: PSScriptAnalyzerSettings.psd1 with formatting rules and the custom rules Measure-McpStdoutPurity (only the transport writer may touch stdout/host) and Measure-McpNoInvokeExpression, both covered by tests.
  • Tests (Pester 6): manifest, import behaviour, type accelerators, enums against the vendored schemas, analyzer rules, schema provenance (SHA-256, definition counts, JSON-RPC envelope, 155-entry checklist), Windows PowerShell 5.1 import guard, pinned version matrix (MCP_EXPECTED_PWSH_VERSION).
  • Vendored schemas: schema.json and schema.ts for 2026-07-28, 2025-11-25 and 2025-06-18 at spec commit 24efd6e7, with manifest.json and tools/Update-SpecSchemas.ps1.
  • CI: matrix ubuntu/windows/macOS × PowerShell 7.4.20/7.5.11/7.6.6 installed from pinned GitHub release assets (.github/actions/install-pwsh), lint job with a PowerShell Gallery name check written to the job summary, 5.1 guard job, package job with a local-repository publish check. Release workflow with dry run and a gated Gallery publish (PSGALLERY_PUBLISH_ENABLED variable + psgallery environment secret). Label sync workflow, issue/PR templates, Dependabot for Actions, CODEOWNERS. All actions pinned to commit SHAs.
  • Governance/docs: README, CHANGELOG, ROADMAP, DEPENDENCY_POLICY, SECURITY, CONTRIBUTING, CODE_OF_CONDUCT, conformance-baseline.yml, docs skeleton (development, conformance, concept pages).

Notes from the sandbox run:

  • The PowerShell Gallery is unreachable from the development container, so the local run used Pester and Invoke-Build from NuGet.org (Chocolatey layout, handled by the bootstrap), PSScriptAnalyzer 1.25.0 from the PowerShellEditorServices release bundle and ModuleBuilder assembled from source. Nothing of that is checked in; CI installs from the Gallery. The Gallery name check (ModelContextProtocol vs. ModelContextProtocol.Sdk) therefore runs in the lint job.
  • PSScriptAnalyzer 1.25 occasionally fails while initialising its command-info cache and custom-rule runspace, either with The term 'Get-Command' is not recognized or with a NullReferenceException (not reproducible on demand, gone on the next run); the Analyze task warms the analyzer up first and retries such a failure up to three times per path, logging a build warning.
  • Help (PlatyPS) is a no-op until the module exports commands (M1).

CI follow-ups on this branch

The first CI run surfaced three problems that the sandbox could not show; each is fixed in its own commit:

  1. 0241d0e – the Gallery install of ModuleBuilder 3.2.5 did not bring its RequiredModules along, so Import-Module ModuleBuilder failed on every matrix cell. requirements.psd1 now declares Configuration [1.5.0,2.0) and Metadata [1.5.1,2.0) explicitly and the bootstrap installs with -SkipDependencyCheck; dependency tables in the docs updated.
  2. 6cda232 – the 5.1 guard test looked its powershell.exe command up in BeforeDiscovery only, which the run phase cannot see; on Windows the test therefore failed instead of running. It is now resolved again in BeforeAll (the test is skipped at discovery on Linux/macOS, hence unnoticed there).
  3. 7c332d7 – the analyzer retry covers the NullReferenceException failure mode as well, plus the warm-up described above.

Checklist

  • ./build.ps1 -Task CI passes locally (Analyze, Test, Package, PublishLocal) on PowerShell 7.4.20 / Linux: no analyzer findings, 91 tests passed, 5 skipped (5.1 guard off Windows, version pin without CI variable, .ts entries)
  • CI green on all 12 jobs (lint, 9 matrix cells, 5.1 guard, package) for head 7c332d7
  • New behaviour is covered by tests (unit, integration or spec)
  • CHANGELOG.md has an entry under [Unreleased] for user-visible changes
  • conformance-baseline.yml is unchanged or shrank (empty; conformance runs start in M2)
  • Documentation updated where behaviour or public API changed

🤖 Generated with Claude Code

https://claude.ai/code/session_01BQgAZXnNBuZ3VREXtrWa82


Generated by Claude Code

…rnance

Milestone M0 of docs/implementation-plan.md.

- src/: ModelContextProtocol manifest (PowerShell 7.4, Core edition,
  explicit exports, PSData with prerelease), ModuleBuilder settings, enums
  McpEra and McpLoggingLevel, Suffix.ps1 registering and removing type
  accelerators, empty type/format files, about topic.
- build.ps1 and ModelContextProtocol.build.ps1: dependency bootstrap with
  PSGallery, NuGet.org (Chocolatey layout) and offline sources; Invoke-Build
  tasks Clean, Build, Analyze, Test, Coverage, Help, Package, PublishLocal,
  Publish, Conformance (M2 placeholder) and CI. requirements.psd1 pins the
  version ranges and the conformance alpha.
- PSScriptAnalyzerSettings.psd1 with formatting rules; custom rules
  Measure-McpStdoutPurity and Measure-McpNoInvokeExpression with tests.
- tests/: Pester 6 skeleton (manifest, silent import in-process and in fresh
  pwsh processes, type accelerators, enums against the schema, analyzer
  rules, vendored schema provenance, Windows PowerShell 5.1 guard, pinned
  version matrix).
- tests/Spec: schema.json and schema.ts for 2026-07-28, 2025-11-25 and
  2025-06-18 at spec commit 24efd6e7, manifest with SHA-256 hashes,
  definitions checklist (155 entries), tools/Update-SpecSchemas.ps1.
- .github: CI matrix (ubuntu, windows, macos x PowerShell 7.4.20, 7.5.11,
  7.6.6 installed from pinned release assets), lint with gallery name check,
  5.1 guard, package with local-repository publish; release workflow (dry
  run, gated gallery publish); label sync; issue and PR templates;
  Dependabot; CODEOWNERS.
- Governance and docs: README, CHANGELOG, ROADMAP, DEPENDENCY_POLICY,
  SECURITY, CONTRIBUTING, CODE_OF_CONDUCT, conformance-baseline.yml, docs
  skeleton.

Verified locally on PowerShell 7.4.20 (Linux): Analyze clean, 91 tests
passed, package built and installed from a local file-share repository.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQgAZXnNBuZ3VREXtrWa82
@t11z t11z self-assigned this Sep 18, 2026
@t11z t11z added the enhancement Type: new feature or request label Sep 18, 2026
CI failed in the Build task on every matrix cell: `Import-Module ModuleBuilder`
stopped with "The required module 'Configuration' is not loaded" because the
Gallery install of ModuleBuilder 3.2.5 did not bring its RequiredModules
(Configuration, which in turn requires Metadata) along.

requirements.psd1 now lists Configuration [1.5.0,2.0) and Metadata [1.5.1,2.0)
explicitly, so the bootstrap installs and verifies them like every other build
dependency, and Install-PSResource runs with -SkipDependencyCheck: all versions
are pinned in one place and no source's dependency resolution is relied upon.
The dependency tables in DEPENDENCY_POLICY.md, README.md, docs/development.md
and tools/README.md (offline Save-PSResource list) are updated accordingly.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQgAZXnNBuZ3VREXtrWa82
On Windows the guard test failed with "The variable '$script:windowsPowerShell'
cannot be retrieved because it has not been set": the command lookup lived in
BeforeDiscovery, whose variables are only visible while Pester discovers tests,
but the test body runs in the run phase. On Linux and macOS the test is skipped
at discovery, so the defect never surfaced there.

The discovery-time value is now a boolean used only for -Skip, and BeforeAll
looks powershell.exe up again for the run phase.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQgAZXnNBuZ3VREXtrWa82
The Lint job failed once with "Object reference not set to an instance of an
object" thrown by Invoke-ScriptAnalyzer on the first analysed path, after the
same inputs had passed twice before and pass locally. Like the "'Get-Command'
is not recognized" failure the Analyze task already retries, it comes from the
analyzer's lazy initialisation of its command-info cache and custom-rule
runspace and is not reproducible on demand.

The retry now covers both failure modes, and the Analyze task warms the
analyzer up on a trivial script before the real runs so that the
initialisation happens outside the measured analysis; the warm-up's own
outcome is ignored.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQgAZXnNBuZ3VREXtrWa82
@t11z
t11z merged commit 93dad5c into main Sep 19, 2026
12 checks passed
@t11z
t11z deleted the claude/admiring-tesla-r738sg branch September 19, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Type: new feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants