Skip to content

Commit a1b5ce2

Browse files
HeyItsGilbertclaude
andcommitted
docs: add CONTEXT.md with PSDepend domain lexicon
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 parents 68a574e + 3a94f04 commit a1b5ce2

2 files changed

Lines changed: 88 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# CLAUDE.md
2+
3+
## Build and Test
4+
5+
Bootstrap: `.\build.ps1 -Bootstrap`
6+
7+
Always run `.\build.ps1 StageFiles` before running tests — tests import from `Output\`, not source.
8+
9+
## Architecture
10+
11+
No compilation; files are staged verbatim to `Output\` — do not edit files under `Output\`.
12+
13+
### Extending with new dependency types
14+
15+
Two files must be updated together:
16+
17+
1. **`PSDepend/PSDependScripts/<Type>.ps1`** — handler script. Must include comment-based help and a `PSDependAction` parameter accepting `Install`, `Test`, and `Import` values.
18+
2. **`PSDepend/PSDependMap.psd1`** — registers the type, maps it to the script, and sets `Supports` to control platform filtering (`windows`, `core`, `macos`, `linux`).
19+
20+
See `Git.ps1` and `PSGalleryModule.ps1` as reference implementations.
21+
22+
`PSDepend/PSDepend.Config` — path variables (`NuGetPath`, etc.) resolved at module load.

CONTEXT.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# PSDepend
2+
3+
A PowerShell dependency handler that resolves, installs, imports, and tests dependencies declared in `.psd1` files using a pluggable set of DependencyScripts.
4+
5+
## Language
6+
7+
**Dependency**:
8+
The unit of work — a named, versioned item to be resolved, with a DependencyType, Target, Tags, and optional Prerequisites.
9+
_Avoid_: package, module, requirement
10+
11+
**DependencyFile**:
12+
A `.psd1` file that declares one or more Dependencies. Filename is arbitrary; `requirements.psd1` is conventional, not canonical.
13+
_Avoid_: requirements file, depend file, manifest
14+
15+
**DependencyType**:
16+
The registered identifier that selects which DependencyScript handles a Dependency (e.g., `PSGalleryModule`, `Git`, `Chocolatey`).
17+
_Avoid_: type, provider, handler type
18+
19+
**DependencyScript**:
20+
A `PSDependScripts/<Type>.ps1` file that implements a DependencyType. Receives a typed Dependency object and a set of PSDependAction flags.
21+
_Avoid_: handler, plugin, provider
22+
23+
**PSDependAction**:
24+
A set of flags (`Install`, `Test`, `Import`) passed to a DependencyScript. Flags are combinable; DependencyScripts must handle each valid combination.
25+
_Avoid_: mode, command, operation
26+
27+
**Target**:
28+
A Dependency field with dual semantics: a scope keyword (`AllUsers`, `CurrentUser`) or a filesystem path. DependencyScripts branch explicitly on which it is.
29+
_Avoid_: destination, scope, path (use Target regardless of which semantic applies)
30+
31+
**PSDependOptions**:
32+
A reserved key in a DependencyFile that sets default field values applied to all Dependencies in that file.
33+
_Avoid_: defaults, global options, file options
34+
35+
**Prerequisite**:
36+
A declared ordering constraint between Dependencies. Expressed via the `DependsOn` field; resolved into topological execution order before dispatch.
37+
_Avoid_: dependency (to avoid confusion with the Dependency concept), requirement
38+
39+
**Tag**:
40+
A label on a Dependency that controls inclusion when `Invoke-PSDepend` is called with `-Tags`.
41+
_Avoid_: filter, category, label
42+
43+
## Relationships
44+
45+
- A **DependencyFile** contains one or more **Dependencies** and at most one **PSDependOptions** block
46+
- A **Dependency** has exactly one **DependencyType**, which selects exactly one **DependencyScript**
47+
- A **Dependency** may declare zero or more **Prerequisites** (other Dependencies that must resolve first)
48+
- A **Dependency** may carry zero or more **Tags**
49+
- A **DependencyScript** receives a **Dependency** and a set of **PSDependAction** flags on each invocation
50+
- **Target** is a field on a **Dependency** interpreted differently by each **DependencyScript**
51+
52+
## Example dialogue
53+
54+
> **Dev:** "Should I add the new module as a dependency or a requirement?"
55+
> **Domain expert:** "It's a **Dependency** — declared in a **DependencyFile** with `DependencyType = 'PSGalleryModule'`."
56+
57+
> **Dev:** "Where does it get installed — do I set the path or the scope?"
58+
> **Domain expert:** "Both are **Target**. If you want `CurrentUser`, set `Target = 'CurrentUser'`. If you want a specific folder, set `Target = 'C:\MyModules'`. The **DependencyScript** branches on which one it sees."
59+
60+
> **Dev:** "I need psake to install before PowerShellBuild. How do I express that?"
61+
> **Domain expert:** "Declare a **Prerequisite** on PowerShellBuild: `DependsOn = 'psake'`. The engine resolves all **Prerequisites** into topological order before dispatching any **DependencyScript**."
62+
63+
## Flagged ambiguities
64+
65+
- "dependency" collides with **Prerequisite** in natural speech ("psake is a dependency of PowerShellBuild") — resolved: use **Prerequisite** for the ordering relationship, **Dependency** only for a declared entry in a DependencyFile.
66+
- "handler" was used in early CLAUDE.md — resolved: canonical term is **DependencyScript**.

0 commit comments

Comments
 (0)