feat: add APort VS Code policy extension#72
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 064edf780e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "id": "aport-policy-json", | ||
| "aliases": [ | ||
| "APort Policy JSON", | ||
| "aport-policy-json" | ||
| ], | ||
| "extensions": [ | ||
| ".aport-policy.json", | ||
| ".aport.json" |
There was a problem hiding this comment.
Keep .aport.json associated with JSON mode
Do not map *.aport-policy.json and *.aport.json to a custom language id if you want schema IntelliSense/validation to work reliably. These files are currently assigned to aport-policy-json, so they are no longer opened in VS Code’s JSON language mode, which is where jsonValidation schema features are applied; users can lose schema-driven completions and diagnostics even though the extension advertises them.
Useful? React with 👍 / 👎.
| ); | ||
| } | ||
|
|
||
| for (const match of text.matchAll(/effect:\s*["']?([^"'\s#]+)["']?/g)) { |
There was a problem hiding this comment.
Anchor YAML effect matching to the effect key
The YAML validator matches effect: anywhere in a line, so keys like side_effect: or post_effect: are treated as rule effects and can incorrectly raise Rule effect must be one of ... errors. This creates false diagnostics for valid policy metadata/conditions that happen to contain that substring.
Useful? React with 👍 / 👎.
| ); | ||
| } | ||
|
|
||
| if (/^rules:\s*$/m.test(text) && !/^\s*-\s+id:/m.test(text)) { |
There was a problem hiding this comment.
Limit YAML rule-id check to the rules section
The rules presence check only looks for any - id: anywhere in the document, so an empty/invalid rules block can pass validation if another list in the file contains an id item. In that scenario, the command can incorrectly report the policy as valid despite having no actual rules.
Useful? React with 👍 / 👎.
Summary
Closes #10.
Adds a VS Code extension under
tools/vscode-extensionfor APort policy pack development.What changed
*.aport-policy.jsonand*.aport.jsonAPort: Validate Current Policy PackVerification
From
tools/vscode-extension:npm testnpm run packageBounty
This PR is for the $50 USD bounty in #10.