Skip to content

Commit c7de71a

Browse files
committed
updates for agents
1 parent 5db4d59 commit c7de71a

3 files changed

Lines changed: 33 additions & 9 deletions

File tree

src/prj/Eigenverft.Manifested.Package.Test/Eigenverft.Manifested.Package.Package.ExportsAndState.Tests.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ Invoke-TestPackageDescribe -Name 'Eigenverft.Manifested.Package Package - export
178178
'Before making any JSON edit',
179179
'eigenverft-module-package-definition-1.9.schema.json',
180180
'x-eigenverftAgentHint',
181+
'nested `description` and `$comment` fields',
182+
'Treat schema `description` and `$comment` text as authoring instructions',
181183
'Do not skim',
182184
'Start Here',
183185
'Runtime endpoint status',
@@ -206,6 +208,8 @@ Invoke-TestPackageDescribe -Name 'Eigenverft.Manifested.Package Package - export
206208
'git status --short',
207209
'validation, signing, and trust verification',
208210
'Test-PackageDefinitionCatalog',
211+
'raw JSON Schema validation',
212+
'Test-Json',
209213
'Get-PackageSigningProfile',
210214
'Sign-PackageDefinition',
211215
'Resign-PackageDefinition',
@@ -215,6 +219,7 @@ Invoke-TestPackageDescribe -Name 'Eigenverft.Manifested.Package Package - export
215219
'Agent Completion At A Valid Endpoint',
216220
'definitionSignature.kind = unsigned',
217221
'signatureValue',
222+
'installerKind` is descriptive metadata',
218223
'.cer',
219224
'.pem'
220225
)

src/prj/Eigenverft.Manifested.Package/AgentSkills/PackageDefinitionAuthoring.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ Before making any JSON edit, ground the work in the user's task, the prepended r
4141

4242
**Read fully (required):**
4343

44-
- The prepended **Task**, **Authoring mode**, and **Runtime endpoint status** (when present), plus this guide
45-
- `Schema/PackageDefinition/eigenverft-module-package-definition-1.9.schema.json` on the machine where the module is installed. Resolve the folder with `(Get-Module Eigenverft.Manifested.Package).ModuleBase` after import, or `Get-Module -ListAvailable Eigenverft.Manifested.Package` if import fails. Read the complete schema, including the root `description` and `x-eigenverftAgentHint`.
44+
- The prepended **Task**, **Authoring mode**, and **Runtime endpoint status** (when present), plus this guide from top to bottom.
45+
- `Schema/PackageDefinition/eigenverft-module-package-definition-1.9.schema.json` on the machine where the module is installed. Resolve the folder with `(Get-Module Eigenverft.Manifested.Package).ModuleBase` after import, or `Get-Module -ListAvailable Eigenverft.Manifested.Package` if import fails. Read the complete schema, including the root `description`, `x-eigenverftAgentHint`, and the relevant nested `description` and `$comment` fields for every object shape you edit.
4646
- Any extra instructions the user gave in chat (publisher, scope, installer kind, draft vs signed, and so on)
4747

48-
For normal authoring, these inputs are enough: the skill explains workflow, endpoints, validation, and signing; the schema defines shape, acquisition, dependencies, and materialization. Follow the schema first.
48+
For normal authoring, these inputs are enough: the skill explains workflow, endpoints, validation, and signing; the schema defines shape, acquisition, dependencies, and materialization. Follow the schema first. Treat schema `description` and `$comment` text as authoring instructions, not decoration.
4949

5050
**Read only when needed:**
5151

@@ -57,7 +57,9 @@ For normal authoring, these inputs are enough: the skill explains workflow, endp
5757

5858
- PowerShell module source, engine implementation, dependency planner, trust model, or installer runtime code. Authoring is declarative JSON work.
5959

60-
Do not skim the required inputs or infer missing rules from example JSON alone. If the user's task, schema, and an example disagree - or if the schema cannot be read fully - stop and ask the user before editing.
60+
Do not skim the required inputs or infer missing rules from example JSON alone. If the user's task, this guide, schema comments/descriptions, and an example disagree - or if this guide or the schema cannot be read fully - stop and ask the user before editing.
61+
62+
Every property you write must be allowed by the JSON Schema for the selected object shape. Do not add "helpful" extra properties because they seem useful to the engine or appear in a guessed installer command. If the schema cannot express the package behavior, stop and report the schema/authoring mismatch instead of forcing JSON through a looser validator.
6163

6264
## Authoring Targets And Endpoints
6365

@@ -226,6 +228,8 @@ When the installer kind, silent arguments, extraction behavior, or package forma
226228

227229
Discover whether the vendor ships multiple artifact kinds for the same product, such as portable archives, user installers, machine/admin installers, MSI packages, app-store packages, or architecture-specific builds. Prefer a vendor-published portable archive when it fits the package intent. Otherwise prefer a user-scoped installer over a machine/admin installer. Use admin or machine-wide installers only when the user's intent and documentation explicitly require that scope - not because an elevated trial install was run.
228230

231+
Choose the install operation shape from the schema, not from a guessed product-specific label. Prefer the dedicated schema adapters when they fit (`nsisInstaller`, `innoSetupInstaller`, `msiInstaller`, `powershellModuleInstaller`, `expandArchive`, and so on). Use generic `runInstaller` only when the schema's `assignRunInstaller` shape exactly fits the package. `runInstaller.installerKind` is descriptive metadata for logging; it does not create a new adapter and it does not permit extra properties outside the schema. If a custom installer needs a target-directory property that the selected schema shape does not allow, stop and ask for a schema/runtime decision instead of adding an unsupported property.
232+
229233
Do not mix artifact kinds by accident. If the existing definition is for a user installer, update from the user-installer source. If it is for a portable/runtime package, update from the matching portable/runtime source. If intent is unclear, stop and ask the user before switching installer kind.
230234

231235
Non-executing inspection of a downloaded file (for example format identification from headers or static metadata) is a last resort after documentation and examples, and must not launch or install the payload. If the installer format or silent switches still cannot be established confidently, stop and ask the user instead of guessing or installing.
@@ -256,6 +260,7 @@ Stop if the latest version cannot be proven from official sources, an artifact f
256260
- Dependencies use `dependency.requires[]`.
257261
- Coexistence policy uses `dependency.policy.conflictsWith[]` or `dependency.policy.requiresAbsent[]` only when the user's intent is explicit.
258262
- Download URLs, checksums, installer arguments, and materialization paths are reviewable.
263+
- `packageOperations.assigned.install` uses one exact schema-defined operation shape; no extra fields are added to make a custom installer work.
259264
- No credentials, tokens, local private paths, or machine-specific secrets are embedded.
260265
- `definitionSignature.kind` is `unsigned` only while drafting or when explicitly requested.
261266

@@ -275,6 +280,16 @@ Test-PackageDefinitionCatalog -Path '<endpoint-root>' -RequireTrusted -ErrorOnFa
275280

276281
Treat validation issues as blockers until the user says otherwise. Do not use `Verify-PackageDefinitionCatalog` as a replacement for schema and reference validation; it checks signature and trust summary, while `Test-PackageDefinitionCatalog` checks parse, schema, signature/trust status, duplicate identities, and static dependency references.
277282

283+
Also run raw JSON Schema validation when the current host supports `Test-Json`; PowerShell 7 usually does. This catches schema-shape errors before signing:
284+
285+
```powershell
286+
$moduleBase = (Get-Module Eigenverft.Manifested.Package).ModuleBase
287+
$schemaPath = Join-Path $moduleBase 'Schema\PackageDefinition\eigenverft-module-package-definition-1.9.schema.json'
288+
Test-Json -Json (Get-Content -Raw -LiteralPath '<definition.json>') -Schema (Get-Content -Raw -LiteralPath $schemaPath) -ErrorAction Stop
289+
```
290+
291+
If `Test-Json` is unavailable in the current shell, try the other PowerShell host described in **PowerShell Host Check**. If raw schema validation cannot be run, say so in the handoff; do not claim that schema-file validation passed. If `Test-PackageDefinitionCatalog` passes but raw schema validation fails, treat the raw schema failure as a blocker and fix the JSON or ask for a schema/runtime decision.
292+
278293
## Signing And Signing-Profile Discovery
279294

280295
Use `Sign-PackageDefinition` for first signing and `Resign-PackageDefinition` for changed signed definitions. Use `-KeepSchemaVersion` when re-signing a stable schema version.
@@ -322,9 +337,10 @@ When **Runtime endpoint status** shows `Selection` with status `Ready`:
322337

323338
1. Write the JSON under the **Selection** path (`definitionId` usually from the **Task** line). Prefer `<publisherId>\<definitionId>.json`; use `<definitionId>.json` directly under **Selection** when that matches the endpoint convention or user instruction.
324339
2. Run `Test-PackageDefinitionCatalog` on that file.
325-
3. Unless **Authoring mode** is `draft-only`, complete **Publication finalization** (sign with an approved profile when appropriate, then verify signature and trust).
340+
3. Run raw JSON Schema validation with `Test-Json` when available, or state clearly that raw schema validation could not be run.
341+
4. Unless **Authoring mode** is `draft-only`, complete **Publication finalization** (sign with an approved profile when appropriate, then verify signature and trust).
326342

327-
Success means the JSON exists on the catalog root with validation (and signing/trust when required). Proof is catalog commands - not installing the product.
343+
Success means the JSON exists on the catalog root with catalog validation, raw schema validation when available, and signing/trust when required. Proof is validation/signature output - not installing the product.
328344

329345
**Draft-only:** when **Authoring mode** shows `draft-only`, stop after unsigned JSON and schema validation; skip signing and `-RequireTrusted` steps.
330346

src/prj/Eigenverft.Manifested.Package/Schema/PackageDefinition/eigenverft-module-package-definition-1.9.schema.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"title": "Eigenverft module package definition document (wire format 1.9)",
55
"$comment": "META: JSON Schema for INSTANCE package-definition documents (one file per definition). Runtime validates with DefinitionSchema.ps1 + DefinitionSchema.Wire1_9.ps1, signature assertions, and 1.9 acquisition vocabulary assertions. definitionPublication.definitionSignature is required; kind=unsigned is valid for draft authoring, kind=signed after Sign-PackageDefinition. Endpoints are discovery-only. Recommended layout under an endpoint root: <publisherId>/<definitionId>.json.",
66
"description": "AUTHOR TASK - Produce or edit one complete package-definition JSON object for Eigenverft.Manifested.Package. Required top-level order: schemaVersion, definitionPublication, display, dependency, artifacts, discovery, packageOperations. Use schemaVersion exactly 1.9.\n\nAUTHORING VS SIGNING: Design semantic package content first (dependency, artifacts, discovery, packageOperations). A valid embedded signature is not required while drafting. Always include definitionPublication.definitionSignature: for drafts use kind=unsigned with format and signedContent only; do not invent keyThumbprint, signedAtUtc, certificatePem, or signatureValue. Never hand-edit signatureValue base64. After the JSON content is final, signing is a separate maintainer step.\n\nSIGNING WORKFLOW: If no catalog-signing certificate exists, run New-PackageSigningCertificate (creates a password-protected PFX, public CER, and adjacent DPAPI password descriptor; keep the private key off endpoints). Prefer friendly metadata fields such as -CommonName, -Organization, -OrganizationalUnit, -Country, and -SignerDisplayName over raw -Subject unless advanced X.509 control is required. Inject or refresh the embedded signature with Sign-PackageDefinition -Path <file> -Cert <friendly-name-or-pfx> -KeepSchemaVersion and optionally -Password <secure> for CI. Sign-PackageDefinition embeds the public certificate so clients can verify before trusting. Verify with Verify-PackageDefinitionSignature or Verify-PackageDefinitionCatalog before replacing published copies. Admins can preseed public trust with the CER via Import-PackageTrust or Trust-PackageSigningCertificate. Re-run Sign-PackageDefinition after any meaningful definition change and bump definitionRevision.\n\nDEPLOYMENT (neutral): Whether an embedded signature is required depends on client catalogTrust.policy and how trust is delivered-not on this schema alone. Synced file-share or NAS endpoint roots used with strict policy need kind=signed definitions and either trusted keys in PackageTrustInventory.json or a valid embedded certificate that local policy allows the user to trust. Unsigned catalogs may run only where catalogTrust.policy=allowUnsigned and publisher policy explicitly allows unsigned definitions.\n\nPUBLICATION: definitionPublication.publisherId is the maintainer namespace (shipped: Eigenverft; teams: e.g. My Team). definitionPublication.definitionId is the id used by Invoke-Package. Increment definitionPublication.definitionRevision for every meaningful JSON change. publishedAtUtc is audit metadata only.\n\nCATALOG TRUST: Production strict clients expect kind=signed with RSA/SHA-256 signatureValue over canonical JSON excluding signatureValue. certificatePem is public verification material, not a trust decision. kind=unsigned is explicit draft/migration shape and does not prove authorship under strict policy.\n\nDEPENDENCY: dependency is required. dependency.requires is required but may be []. dependency.policy is optional and contains peer policy such as conflictsWith and requiresAbsent. dependency.requires[].publisherId is optional.\n\nCOMMON TRAPS: root repositoryId and root definitionId are retired; top-level dependencies and dependencyPolicy are retired in 1.9; vendorDownload candidates need sourceId+sourcePath or direct url/urlTemplate; GitHub release sources need real assets and releaseTag; packageDepot is the only prepared artifact acquisition candidate; package-definition filesystem acquisition is retired; NSIS and Inno Setup differ; choose package-managed shims vs installer PATH deliberately.",
7-
"x-eigenverftAgentHint": "LLM/agent: edit INSTANCE JSON conforming to this schema and DefinitionSchema.Wire1_9.ps1 plus 1.9 signature rules. Author drafts with definitionPublication.definitionSignature.kind=unsigned (no signatureValue). Do not fabricate signatures. After content is stable, a human or automation runs Sign-PackageDefinition -KeepSchemaVersion or Resign-PackageDefinition -KeepSchemaVersion; use New-PackageSigningCertificate when no key exists yet. Shipped examples: Endpoint/Defaults/Eigenverft (signed). Layout: <publisherId>/<definitionId>.json under endpoint roots. Bump definitionRevision on every definition change. Embedded signatures are required for strict file-based catalogs; web or centrally trusted endpoints may use other trust delivery-check deployment policy before assuming unsigned JSON is runnable.",
7+
"x-eigenverftAgentHint": "LLM/agent: first read the complete PackageDefinitionAuthoring guide that delivered this task, then read this complete schema. Treat root description, this hint, nested description fields, and $comment fields as authoring requirements. Edit INSTANCE JSON conforming to this schema and DefinitionSchema.Wire1_9.ps1 plus 1.9 signature rules. Author drafts with definitionPublication.definitionSignature.kind=unsigned (no signatureValue). Do not fabricate signatures. After content is stable, a human or automation runs Sign-PackageDefinition -KeepSchemaVersion or Resign-PackageDefinition -KeepSchemaVersion; use New-PackageSigningCertificate when no key exists yet. Shipped examples: Endpoint/Defaults/Eigenverft (signed). Layout: <publisherId>/<definitionId>.json under endpoint roots. Bump definitionRevision on every definition change. Embedded signatures are required for strict file-based catalogs; web or centrally trusted endpoints may use other trust delivery-check deployment policy before assuming unsigned JSON is runnable. Raw JSON Schema validation must pass; do not add extra properties that only a looser runtime validator accepts.",
88
"type": "object",
99
"additionalProperties": false,
1010
"required": [
@@ -1278,7 +1278,7 @@
12781278
},
12791279
"packageOperations": {
12801280
"type": "object",
1281-
"$comment": "AUTHOR FOCUS: assigned chooses install engine (expandArchive, npmMaterializedInstallGlobalPackage, powershellModuleInstaller, nsisInstaller, innoSetupInstaller, msiInstaller, runInstaller, placePackageFile) and must agree with discovery.presence. removed must undo ownership safely (inventory row, shims, delete directory or installer uninstaller). policy sets compatibility and ownership rules before install.",
1281+
"$comment": "AUTHOR FOCUS: assigned chooses exactly one schema-defined install engine (expandArchive, npmMaterializedInstallGlobalPackage, powershellModuleInstaller, nsisInstaller, innoSetupInstaller, msiInstaller, runInstaller, placePackageFile) and must agree with discovery.presence. Do not mix fields from another install shape; additionalProperties=false is intentional. Use dedicated adapters for NSIS, Inno Setup, and MSI when their target-directory handling fits. Generic runInstaller is only a raw process launch shape and does not allow installDirectory. removed must undo ownership safely (inventory row, shims, delete directory or installer uninstaller). policy sets compatibility and ownership rules before install.",
12821282
"additionalProperties": false,
12831283
"required": [
12841284
"policy",
@@ -1640,6 +1640,7 @@
16401640
"assignRunInstaller": {
16411641
"type": "object",
16421642
"additionalProperties": false,
1643+
"$comment": "Generic raw installer process launch. This shape intentionally does not own installDirectory. Do not add installDirectory or target-directory helper fields here; choose nsisInstaller, innoSetupInstaller, msiInstaller, expandArchive, or another schema-defined operation when the engine must manage an install directory. installerKind is descriptive/logging metadata only and does not create product-specific behavior.",
16431644
"required": [
16441645
"kind",
16451646
"targetKind",
@@ -1657,13 +1658,15 @@
16571658
},
16581659
"targetKind": {
16591660
"type": "string",
1661+
"description": "directory means the launched installer is expected to place payload under its own documented arguments, but this shape does not accept installDirectory. machinePrerequisite is for prerequisite installers where readiness can skip acquisition/install when already satisfied.",
16601662
"enum": [
16611663
"directory",
16621664
"machinePrerequisite"
16631665
]
16641666
},
16651667
"installerKind": {
1666-
"type": "string"
1668+
"type": "string",
1669+
"description": "Descriptive/logging label such as burn. It is not an adapter selector and does not permit properties outside assignRunInstaller."
16671670
},
16681671
"uiMode": {
16691672
"type": "string"

0 commit comments

Comments
 (0)