Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "1.4.0",
"version": "1.4.1",
"commands": [
"csharpier"
],
Expand Down
7 changes: 5 additions & 2 deletions .config/purview-build-sdk.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"Skills": {
"Agents": ["universal"]
"Runner": "bun",
"Agents": [
"universal"
]
}
}
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
`NextJsAppResource` kit that declares `ProjectPath`/`ResourcePath` and writes no `BuildResource` gets
the `AddDotnetProject`/`AddViteApp`/`AddNextJsApp` registration generated from the declared path. It
is not generated when the kit writes the override or an explicit base class implements it.
- **SG0045** (Error) reports a `[ResourceGroup]` class nested inside another type, and **SG0046** (Error)
reports a group declared with a different accessibility than its host kit. Both block generation, so the
failure is one diagnostic on the declaration instead of a wall of errors in generated code: a nested group
lost its containing types (`CS0426`) while still referencing its `*Options` through them, a `public` group
under an `internal` host kit derived from a less accessible base (`CS9338`/`CS0051`), and the inverse
pairing exposed an `internal` group from the host kit's public `Groups` accessor (`CS0053`).
- **SG0044** (Info) reports a `BuildResource` override that only repeats the generated call; its code
fix removes the override, first moving the path into `ProjectPath`/`ResourcePath` when the attribute
does not declare it.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ From your `[HostKit]` and `[ResourceDefinition]` declarations, ResourceKit gener
- a host resource base class,
- typed parent/child properties and constructors for hierarchical kits,
- host + per-resource options (when enabled), including nested child options,
- typed resource groups (`[ResourceGroup]`, `[InGroup<TGroup>]`) that switch sets of resources on or off and nest them in the dashboard,
- typed resource groups (`[ResourceGroup]`, `[InGroup<TGroup>]`) that switch sets of resources on or off and nest them in the dashboard — a group is a namespace-scope partial class declared with the same accessibility as the host kit (SG0045, SG0046),
- named dashboard URLs (`[ResourceUrl]`, `[EndpointUrl]`) that options can override,
- an AppHost extension method to build/configure/register your host kit,
- typed project, app and file/directory paths (`AppHostProjects`) from `ResourceKitProject` /
Expand Down
96 changes: 96 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions docs/wiki/concepts/Groups-and-URLs.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@ foreach (var resource in HostKit.Groups.Data.Resources.Where(static r => r.IsEna
}
```

A group must be at least as accessible as the host kit, just like a resource kit.
Two placement rules apply, because the group is a second partial declaration the generator completes:

- **A group must be declared at namespace scope** (SG0045). The generator emits the group, and its nested
options class, beside the host kit, so a group nested inside another class is emitted without the
containing types its `*Options` references still use. Move the class out of the container rather than
making the container `partial`.
- **A group must have the same accessibility as its host kit** (SG0046). A `public` group paired with an
`internal` host kit derives from a less accessible base (CS9338/CS0051), and an `internal` group paired
with a `public` host kit is exposed by the host kit's public `Groups` accessor (CS0053). Declare both
`public` or both `internal`; leaving the modifier off a group makes it `internal` at namespace scope.

### Enablement

Expand All @@ -65,9 +74,9 @@ ExampleHostKit:Groups:Data:ShowInDashboard=false # data's kits move up to the p

### Parent and child kits in groups

A child kit with no `[InGroup]` inherits its ResourceKit parent's **primary** group when the host seals its
resources. A child with an explicit `[InGroup]` keeps it instead. The parent's group is registered by the
parent, so the child's registration order does not matter.
A child kit **may** declare `[InGroup]`. Without one it inherits its ResourceKit parent's **primary** group
when the host seals its resources; with one it keeps the groups it declares instead. The parent's group is
registered by the parent, so the child's registration order does not matter.

Permission to build is the intersection of every gate: the child's own groups, the parent's groups, the
host mode, and the parent/child hierarchy. A disabled parent disables descendants even when a child's own
Expand Down
10 changes: 9 additions & 1 deletion docs/wiki/project/Release-Flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ The GitHub release is created with automatically generated notes, grouped by the

## Analyzer release tracking

`src/src/SourceGeneration` ships public diagnostics (`SG0001`–`SG0020`), so it maintains the Roslyn
`src/src/SourceGeneration` ships public diagnostics (`SG0001`–`SG0046`), so it maintains the Roslyn
release tracking files:

- `AnalyzerReleases.Shipped.md` — rules that have shipped in a released version.
Expand All @@ -109,6 +109,14 @@ with `TreatWarningsAsErrors`). Add new rules to the *unshipped* file while devel
into the *shipped* file as part of a release. See [Contributing](Contributing.md) for the day-to-day
workflow.

> [!IMPORTANT]
> Roslyn parses those tables with a fixed header shape, so the separator row under
> `Rule ID | Category | Severity | Notes` must stay dashes and pipes with **no spaces**:
> `--------|----------|----------|-------`. A Markdown formatter that aligns table cells rewrites it to
> `-------- | ---------- | ---------- | ------`, and the build then fails with `RS2007` and stops
> reading every table below the first row it cannot parse. `AnalyzerReleaseTrackingTests` guards the
> shape, so a reformat fails the test suite with the offending rows named.

## Build-time dependencies

Some centrally-managed packages are build/analysis-time only (consumed with `PrivateAssets`), for
Expand Down
5 changes: 5 additions & 0 deletions docs/wiki/reference/Attributes-Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ sealed partial class PublishHostKit;

See [Enablement](../concepts/Enablement.md) for the mode list and evaluation order.

A host kit's accessibility sets what its generated members can mention. The host kit's options class and
`Groups` accessor are nested inside it, so they take its accessibility; a `[ResourceGroup]` class is emitted
beside it, so it must be declared the same way — `public` under a `public` host kit, `internal` under an
`internal` one (SG0046). See [Groups and URLs](../concepts/Groups-and-URLs.md#resource-groups).

## `ResourceDefinitionAttribute` (`[ResourceDefinition]`)

Marks a resource kit class that participates in generation.
Expand Down
7 changes: 6 additions & 1 deletion docs/wiki/reference/Diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ exiting the constructor" warning does not apply.
| SG0042 | Warning | `ProjectPath` and `ResourcePath` declare different paths; `ResourcePath` is used |
| SG0043 | Warning | `ResourcePath` is set on a resource that is not added by path, so it is ignored |
| SG0044 | Info | A `BuildResource` override only repeats the registration ResourceKit generates from the declared path; the code fix removes it, moving the path into the attribute first when needed |
| SG0045 | Error | A `[ResourceGroup]` class is nested in another type; it must be declared at namespace scope |
| SG0046 | Error | A `[ResourceGroup]` class and its host kit are declared with different accessibility |

See [Attributes Reference](Attributes-Reference.md) for the rules tied to attribute styles,
[Project Resources](../concepts/Project-Resources.md) for SG0018/SG0019/SG0041–SG0044 specifics,
[Groups and URLs](../concepts/Groups-and-URLs.md) for SG0021–SG0031, and
[Groups and URLs](../concepts/Groups-and-URLs.md) for SG0021–SG0031 and SG0045/SG0046, and
[Parent and child resource kits](../concepts/Hierarchies.md) for SG0032–SG0040.

A parent cycle is reported on one kit in the cycle and includes the full path, for example
Expand Down Expand Up @@ -165,6 +167,9 @@ and the kit's own `IResourceBuilder<TResource>` would not satisfy it.
6. If the kit declares `Parent = typeof(...)`, ensure that type is a resource kit in the same composition;
a child in a different primary group than its parent gets SG0039, and a redundant
`Parent.ResourceBuilder` gets SG0040.
7. Declare each `[ResourceGroup]` class at namespace scope (SG0045) and with the same accessibility as the
host kit (SG0046); a nested group, or a `public` group under an `internal` host kit, is reported there
instead of in generated code.

## Common fixes

Expand Down
Loading
Loading