Skip to content

Commit 12ab325

Browse files
Merge branch 'main' into docs/61-readme-standard
2 parents e4c1751 + 13b5e74 commit 12ab325

12 files changed

Lines changed: 195 additions & 121 deletions

File tree

.github/actions/update-index/src/Helper.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ $moduleTableRows</table>
229229
230230
"@
231231

232-
Update-MDSection -Path '.\src\docs\PowerShell\Modules\index.md' -Name 'MODULE_LIST' -Content $moduleTable
232+
Update-MDSection -Path '.\src\docs\Modules\Catalog\index.md' -Name 'MODULE_CATALOG' -Content $moduleTable
233233
}
234234

235235
function Update-FunctionAppList {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Import-Module -Name (Join-Path $PSScriptRoot 'Helper.psm1')
22

33
Show-RepoList
4-
Update-ActionList
5-
Update-FunctionAppList
4+
# Update-ActionList
5+
# Update-FunctionAppList
66
Update-ModuleList

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Follow the instructions in [AGENTS.md](../AGENTS.md).

.github/linters/.markdown-lint.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@
88
###############
99
# Rules by id #
1010
###############
11-
MD004: false # Unordered list style
11+
MD004: false # Unordered list style
1212
MD007:
13-
indent: 2 # Unordered list indentation
13+
indent: 2 # Unordered list indentation
1414
MD013:
15-
line_length: 3000 # Line length
15+
line_length: 3000 # Line length
16+
MD025: false # Allow front-matter title + visible H1 on docs pages
1617
MD026:
17-
punctuation: ".,;:!。,;:" # List of not allowed
18-
MD029: false # Ordered list item prefix
19-
MD033: false # Allow inline HTML
20-
MD036: false # Emphasis used instead of a heading
21-
MD041: false # First line in file should be a top level heading, PULL_REQUEST_TEMPLATE.md is an exception
18+
punctuation: '.,;:!。,;:' # List of not allowed
19+
MD029: false # Ordered list item prefix
20+
MD033: false # Allow inline HTML
21+
MD036: false # Emphasis used instead of a heading
22+
MD041: false # First line in file should be a top level heading, PULL_REQUEST_TEMPLATE.md is an exception
2223

2324
#################
2425
# Rules by tags #
2526
#################
26-
blank_lines: false # Error on blank lines
27+
blank_lines: false # Error on blank lines

AGENTS.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Agents
2+
3+
## Main directive
4+
5+
Everything is a work in progress and can be updated and improved.
6+
If you find a problem, fix it if it's small; otherwise, register it as an issue in the respective repo.
7+
8+
## Install the ecosystem
9+
10+
1. Create a folder in the home directory called `.msx/PSModule`:
11+
2. Clone the ecosystem locally:
12+
1. <https://github.com/PSModule/docs> — requires PRs to be updated.
13+
- Clone as bare and use worktrees.
14+
- Create a worktree for all branches - worktree = name of the branch.
15+
2. <https://github.com/PSModule/memory> — work directly towards main.
16+
- Simple clone, only main.
17+
18+
To install:
19+
Clone the repos in the users home folder under a sub-folder named `.msx/PSModule`.
20+
- Set configs locally to each of these repos using the GitHub username and email.
21+
22+
## Working with the ecosystem
23+
24+
1. Get to know this repo first:
25+
- [README](README.md) for what this repository is and how it builds.
26+
- [CONTRIBUTING](CONTRIBUTING.md) for how to contribute and the review process.
27+
2. Read the `.msx/PSModule/main/docs` - start with the index to get an overview of what is here.
28+
3. Read the `.msx/PSModule/memory` - start with the index to get an overview of what is here. Use this while working - commit your memories here for work inside the PSModule organization.
29+
4. While working with the code, do small micro commits and push on every commit. This will make it easier to review and merge your changes.

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md

src/docs/Modules/Module-Types.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Module types
2+
3+
Most PSModule modules fall into one of a few archetypes. The general rules in
4+
[PowerShell module standard](Standards.md) and [PowerShell Standards](../PowerShell/Standard/index.md) always apply; this
5+
page adds the conventions that are specific to a module's type so that modules of the same kind feel
6+
the same to use.
7+
8+
Two archetypes have enough shared shape to standardize:
9+
10+
- **Integration (API) modules** wrap an external service's REST or GraphQL API.
11+
- **Data modules** convert or manage a data format or in-memory structure.
12+
13+
A module can be both (for example, an integration module that also exposes conversion helpers).
14+
Apply each relevant section.
15+
16+
## Integration (API) modules
17+
18+
Integration modules are the PowerShell face of an external service. `GitHub`, and the
19+
service-client modules such as `Anthropic`, `OpenAI`, `Bluesky`, and `Domeneshop`, are integration
20+
modules.
21+
22+
### Command naming maps to the resource, not the HTTP method
23+
24+
Name commands after the resource and the intent, using approved verbs. Never name a command after
25+
the HTTP method or the endpoint path. Map REST methods to verbs:
26+
27+
| REST method | PowerShell verb | Example |
28+
| ----------- | --------------- | ------- |
29+
| `GET` | `Get-` | `Get-GitHubRepository` |
30+
| `POST` (create) | `New-` / `Add-` | `New-GitHubRepository` |
31+
| `PUT` / `PATCH` (update) | `Set-` / `Update-` | `Set-GitHubRepository` |
32+
| `DELETE` | `Remove-` | `Remove-GitHubRepository` |
33+
| Non-CRUD action | Approved verb for the intent | `Invoke-`, `Start-`, `Stop-`, `Enable-`, ... |
34+
35+
Prefix the noun with the service's term of art (`GitHubRepository`, not `Repository`).
36+
37+
### Transport abstraction
38+
39+
Lower-level helpers own the concrete `Invoke-RestMethod` / GraphQL / HTTP calls. How you expose
40+
or hide this abstraction is a design choice:
41+
42+
- **Private transport** (common): Keep REST, GraphQL, and HTTP helpers private. Public functions
43+
accept resolved inputs and typed objects. This follows the Dependency Inversion rule from
44+
[Standards](Standards.md#solid-applied) applied to the network boundary.
45+
- **Public transport**: Expose REST or GraphQL functions publicly for power users or module
46+
composition.
47+
- **Public Context**: Expose the `Context` module as public so users can configure and manage
48+
module state, secrets, and settings directly.
49+
50+
Choose the strategy that best serves your module's audience.
51+
52+
### Use Context for user and module settings
53+
54+
Integration modules persist state with the [`Context`](https://github.com/PSModule/Context) module
55+
rather than inventing bespoke storage. Context provides on-disk storage for user data and secrets,
56+
organized by context and environment. Two kinds of state are both standard:
57+
58+
- **User settings and secrets**: accounts, tokens, sessions, and per-user configuration. Store these
59+
in a per-user context. `Context` encrypts secrets at rest (via `Sodium`), so a user can resume work
60+
without reconfiguring or logging in again when the service supports session refresh.
61+
- **Module settings**: module-wide defaults, endpoints, and feature flags that are not tied to a
62+
single user. Store these in a module-scoped context.
63+
64+
Your module must expose functions and object types so users can target specific contexts and
65+
environments. Users need to be able to read from, write to, and manage contexts programmatically,
66+
selecting which environment or context their functions operate against. Persisting both through
67+
`Context` gives every integration module the same, discoverable settings model and keeps secrets
68+
out of source, logs, and plain files.
69+
70+
## Data modules
71+
72+
Data modules convert between representations or manage an in-memory structure. `Hashtable` is the
73+
reference shape; `Base64`, `Json`, `Lua`, `Hcl`, `Sodium`, and `Uri` follow the same pattern.
74+
75+
### The neutral object is the pivot
76+
77+
Every conversion goes through the neutral PowerShell object model
78+
(`[PSCustomObject]` / `[hashtable]` / `[PSObject]`). `ConvertFrom-<Format>` parses a
79+
format-specific representation into an object; `ConvertTo-<Format>` renders an object into the
80+
format. Converting through the object as a common pivot means any format interoperates with any
81+
other, instead of writing a direct converter for every pair.
82+
83+
Always ship both directions so data can round-trip between the format and the object model.
84+
85+
### Verb vocabulary
86+
87+
| Verb pattern | Purpose |
88+
| ------------ | ------- |
89+
| `ConvertFrom-<Format>` | Format-specific text/representation → `[PSCustomObject]` / `[hashtable]` |
90+
| `ConvertTo-<Format>` | `[PSCustomObject]` / `[hashtable]` → format-specific text/representation |
91+
| `Import-<Noun>` | Read from a file or store into objects |
92+
| `Export-<Noun>` | Write objects to a file or store |
93+
| `Format-<Noun>` | Produce a normalized or pretty rendering |
94+
| `Merge-<Noun>` | Combine two structures |
95+
| `Compare-<Noun>` | Diff two structures |
96+
| `Test-<Noun>` | Validate a value or structure |
97+
| `Remove-<Noun>Entry` | Remove elements by criteria |
98+
99+
The `Hashtable` module demonstrates the full set: `ConvertFrom-Hashtable`, `ConvertTo-Hashtable`,
100+
`Import-Hashtable`, `Export-Hashtable`, `Format-Hashtable`, `Merge-Hashtable`, and
101+
`Remove-HashtableEntry`.
102+
103+
## Where this connects
104+
105+
- [PowerShell module standard](Standards.md): layout, private functions, and the mandatory context parameter.
106+
- [Repository Defaults](Repository-Defaults.md): repository files, README shape, and agent onboarding.

src/docs/Modules/Repository-Defaults.md

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This page defines the default repository contract for PowerShell module repositories in the PSModule organization. It describes what a newly created or maintained module repository should look like before module-specific code, tests, documentation, and managed repository files are considered.
44

5-
The implementation standard still lives in [PowerShell module standard](Standards.md). This page covers repository defaults: files, metadata, README shape, release integration, placeholder handling, shared community files, and managed-file distribution.
5+
The implementation standard still lives in [PowerShell module standard](Standards.md). Type-specific conventions for integration (API) and data modules live in [Module types](Module-Types.md). This page covers repository defaults: files, metadata, README shape, release integration, placeholder handling, shared community files, and managed-file distribution.
66

77
## Scope
88

@@ -15,6 +15,8 @@ They do not apply directly to:
1515
- Template repositories other than `Template-PSModule`.
1616
- Test, archive, service, or infrastructure repositories that are not published as module artifacts.
1717

18+
Two baseline expectations still apply to every PSModule repository, including the types listed above. Each repository stands on its own: it carries its own governance and community files instead of relying on the organization `.github` fallback, and each repository ships the [agent onboarding files](#agent-onboarding-files) so an agent can work in it without prior context. What differs by type is the concrete file set and layout: the required files, README shape, and framework wiring on the rest of this page are module defaults, and non-module repositories keep only the equivalent baseline appropriate to their own type. This repository, `PSModule/docs`, follows those two baseline expectations itself.
19+
1820
Each initiative should keep its own repository standards in its central documentation repository. For the PSModule organization, this repository is the source of truth.
1921

2022
## Repository creation
@@ -62,10 +64,13 @@ Module repositories use the PSModule framework layout:
6264
| ---- | --------------- |
6365
| `README.md` | Concise start page for the module. |
6466
| `LICENSE` | Repository license. PSModule module repositories default to MIT unless a different license is explicitly decided. |
65-
| `CONTRIBUTING.md` | Contribution workflow or a repository-level pointer to the organization contribution guide. |
67+
| `CONTRIBUTING.md` | Self-contained contribution workflow for this repository. Does not rely on an organization-level fallback. |
6668
| `SECURITY.md` | Security support policy and private vulnerability reporting instructions. |
6769
| `SUPPORT.md` | Support expectations and where users ask for help. |
6870
| `CODE_OF_CONDUCT.md` | Community conduct expectations. |
71+
| `AGENTS.md` | Agent onboarding entry point. Points agents to the canonical guidance in `PSModule/docs`. |
72+
| `CLAUDE.md` | Claude Code entry point. Imports `AGENTS.md` so Claude reads the same instructions. |
73+
| `.github/copilot-instructions.md` | VS Code and GitHub Copilot repository instructions. Points to the same documentation. |
6974
| `.github/PSModule.yml` | Module workflow configuration overrides. |
7075
| `.github/workflows/workflow.yml` | Reusable Process-PSModule workflow entry point. |
7176
| `.github/dependabot.yml` | Dependency and supply-chain update configuration. |
@@ -102,10 +107,13 @@ Required baseline files for module repositories:
102107
| ---- | ------------------ |
103108
| `README.md` | Repository landing page and evergreen context for humans and agents. |
104109
| `LICENSE` | Clear legal terms for reuse, packaging, and redistribution. |
105-
| `CONTRIBUTING.md` | Shared contribution workflow and expectations. |
110+
| `CONTRIBUTING.md` | Self-contained contribution workflow and expectations for this repository. |
106111
| `SECURITY.md` | Private vulnerability reporting and latest-version support policy. |
107112
| `SUPPORT.md` | Support channel and issue-routing expectations. |
108113
| `CODE_OF_CONDUCT.md` | Community participation rules. |
114+
| `AGENTS.md` | Cross-tool agent instructions pointing to the canonical guidance in `PSModule/docs`. |
115+
| `CLAUDE.md` | Claude Code entry point that imports `AGENTS.md`. |
116+
| `.github/copilot-instructions.md` | VS Code and GitHub Copilot repository instructions pointing to the documentation. |
109117
| `.github/dependabot.yml` | Supply-chain maintenance for GitHub Actions and PowerShell dependencies. |
110118
| `.github/CODEOWNERS` | Review routing for source, docs, and GitHub workflow files. |
111119
| `.github/pull_request_template.md` | Consistent PR Manager-style PR descriptions and change classification. |
@@ -118,24 +126,44 @@ Required baseline files for module repositories:
118126

119127
Repositories can add local files, but they should not remove these baseline files unless the repository is explicitly outside the module standard.
120128

129+
Each repository must stand on its own. It carries its own copy of every file above and does not depend on the organization `.github` fallback: that fallback is only surfaced in GitHub's web UI, and agents, linters, and local tooling do not read it.
130+
131+
## Agent onboarding files
132+
133+
Every repository must be usable by an agent that has never seen it before, without special configuration. Each repository carries its own agent entry points that point to the authoritative documentation instead of restating it:
134+
135+
- `AGENTS.md`: the cross-tool entry point, read by the GitHub Copilot coding agent, VS Code, and other AGENTS.md-aware tools. It names what the repository is in a line or two and points to the canonical agent guidance in [`PSModule/docs`](https://github.com/PSModule/docs).
136+
- `CLAUDE.md`: a thin file that imports `AGENTS.md` with `@AGENTS.md` so Claude Code reads the same instructions. Claude-specific notes, if any, go below the import.
137+
- `.github/copilot-instructions.md`: repository instructions for VS Code and GitHub Copilot that point to the same documentation.
138+
139+
These files are the agent equivalent of the README: pointers, not copies. Keep them short so the linked documentation stays the single source of truth. Like the other governance files, they live in the repository itself so it can stand on its own.
140+
121141
## Managed file distribution
122142

123-
Shared files should be treated as managed files. The current distribution service is [`PSModule/Distributor`](https://github.com/PSModule/Distributor). It keeps source file sets under `Repos/{Type}/{Selection}/` and syncs those files into repositories through pull requests.
143+
Shared repository files are managed through [`PSModule/Distributor`](https://github.com/PSModule/Distributor). Distributor is the source of truth for managed file content and file-set membership.
144+
145+
Managed-file distribution follows this contract:
146+
147+
- `Type` maps a repository to its file-set root (for example `Module` or `Action`).
148+
- `SubscribeTo` declares which optional managed file sets the repository receives.
149+
- Organization-wide mandatory file sets define non-optional governance and supply-chain files for each applicable repository type.
150+
- Distributor delivers changes through a `managed-files/update` branch and a `⚙️ [Maintenance]: Sync managed files` pull request.
151+
- Receiving repositories treat managed files as generated artifacts from Distributor. Local edits in the receiving repository are replaced on the next sync and must be made in Distributor instead.
152+
- Removing a file from a file set does not implicitly delete previously synced copies; deletion is an explicit managed change.
124153

125-
The current Distributor model is subscription-based:
154+
This page defines what files must exist in repositories. Distributor defines how those files are distributed and kept aligned.
126155

127-
- `Type` is an organization repository custom property that maps a repository to a type folder such as `Module` or `Action`.
128-
- `SubscribeTo` is an organization repository custom property that selects file sets such as `dependabot.yml`, `Linter Settings`, `PSModule Settings`, `CODEOWNERS`, `License`, `.gitattributes`, and `.gitignore`.
129-
- Sync changes are delivered through a `managed-files/update` branch and a `⚙️ [Maintenance]: Sync managed files` pull request.
130-
- Managed files are overwritten by the source file set. Local edits to managed files should be made in Distributor, not directly in the receiving repository.
131-
- Removing a file from a Distributor file set does not delete the previously distributed file from target repositories; cleanup is explicit.
156+
### Migration for existing repositories
132157

133-
Two follow-up Distributor capabilities define the desired direction:
158+
Repositories that still reflect older distribution behavior should be aligned to this contract:
134159

135-
- **Global file sets** should allow common file sets such as `.gitattributes`, `.gitignore`, and `License` to be defined once and made available to all repository types while still requiring subscription.
136-
- **Mandatory file sets** should allow organization-critical files such as `SECURITY.md`, `CODE_OF_CONDUCT.md`, `CONTRIBUTING.md`, and supply-chain configuration to be pushed to applicable repositories without each repository having to subscribe manually.
160+
1. Set or correct repository `Type` and `SubscribeTo` properties.
161+
2. Ensure mandatory governance and supply-chain files from this standard exist in the repository.
162+
3. Move any intended local edits in managed files into Distributor source file sets.
163+
4. Sync from Distributor and merge the `managed-files/update` pull request.
164+
5. Remove unmanaged duplicates or stale files explicitly when they are no longer part of an active file set.
137165

138-
Until mandatory file sets exist, repository owners are still responsible for ensuring the required common files exist. Distributor is the preferred implementation mechanism; this document is the standard that says what must exist and why.
166+
After migration, the repository keeps the required files from this standard, and managed-file content changes are made through Distributor-first updates.
139167

140168
## Supply-chain defaults
141169

src/docs/Modules/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This section is the local source of truth for:
1313

1414
- [Repository Defaults](Repository-Defaults.md)
1515
- [Standards](Standards.md)
16+
- [Module types](Module-Types.md)
1617
- [Test Specification](Test-Specification.md)
1718
- [Versioning](Versioning.md)
1819
- [Catalog](Catalog/index.md)

src/docs/Style-Guides/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Coding style guidelines for PSModule repositories.
55

66
# Style Guides (Moved)
77

8-
Style-guide content is now canonical in MSXOrg/docs.
8+
Style guide content is now canonical in MSXOrg/docs.
99

1010
Use:
1111

0 commit comments

Comments
 (0)