Repository navigation
M0 foundation: module skeleton, build tooling, tests, CI and governance - #2
Merged
Merged
Conversation
…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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
src/):ModelContextProtocolmanifest (PowerShell 7.4, Core edition only, explicit exports, PSData with prereleasepreview1), ModuleBuilder settings, enumsMcpEraandMcpLoggingLevel,Suffix.ps1that registers the engine types as type accelerators on import and removes them onRemove-Module, empty type/format files, about topic. Import is side-effect free (verified in-process and in freshpwshprocesses, also under-File).build.ps1(dependency bootstrap with PSGallery → NuGet.org → offline fallbacks, version ranges fromrequirements.psd1) and Invoke-Build tasksClean,Build,Analyze,Test,Coverage,Help,Package,PublishLocal,Publish,Conformance(M2 placeholder),CI.PSScriptAnalyzerSettings.psd1with formatting rules and the custom rulesMeasure-McpStdoutPurity(only the transport writer may touch stdout/host) andMeasure-McpNoInvokeExpression, both covered by tests.MCP_EXPECTED_PWSH_VERSION).schema.jsonandschema.tsfor 2026-07-28, 2025-11-25 and 2025-06-18 at spec commit24efd6e7, withmanifest.jsonandtools/Update-SpecSchemas.ps1..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_ENABLEDvariable +psgalleryenvironment secret). Label sync workflow, issue/PR templates, Dependabot for Actions, CODEOWNERS. All actions pinned to commit SHAs.conformance-baseline.yml, docs skeleton (development, conformance, concept pages).Notes from the sandbox run:
ModelContextProtocolvs.ModelContextProtocol.Sdk) therefore runs in the lint job.The term 'Get-Command' is not recognizedor with aNullReferenceException(not reproducible on demand, gone on the next run); theAnalyzetask 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:
0241d0e– the Gallery install of ModuleBuilder 3.2.5 did not bring itsRequiredModulesalong, soImport-Module ModuleBuilderfailed on every matrix cell.requirements.psd1now 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.6cda232– the 5.1 guard test looked itspowershell.execommand up inBeforeDiscoveryonly, which the run phase cannot see; on Windows the test therefore failed instead of running. It is now resolved again inBeforeAll(the test is skipped at discovery on Linux/macOS, hence unnoticed there).7c332d7– the analyzer retry covers theNullReferenceExceptionfailure mode as well, plus the warm-up described above.Checklist
./build.ps1 -Task CIpasses 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,.tsentries)7c332d7CHANGELOG.mdhas an entry under[Unreleased]for user-visible changesconformance-baseline.ymlis unchanged or shrank (empty; conformance runs start in M2)🤖 Generated with Claude Code
https://claude.ai/code/session_01BQgAZXnNBuZ3VREXtrWa82
Generated by Claude Code