Skip to content

feat: add APort VS Code policy extension#72

Open
brawliscool wants to merge 2 commits into
aporthq:mainfrom
brawliscool:codex/aport-vscode-extension
Open

feat: add APort VS Code policy extension#72
brawliscool wants to merge 2 commits into
aporthq:mainfrom
brawliscool:codex/aport-vscode-extension

Conversation

@brawliscool
Copy link
Copy Markdown

Summary

Closes #10.

Adds a VS Code extension under tools/vscode-extension for APort policy pack development.

What changed

  • Adds JSON schema IntelliSense for *.aport-policy.json and *.aport.json
  • Adds JSON/YAML policy diagnostics through APort: Validate Current Policy Pack
  • Adds TextMate syntax highlighting for APort policy ids, rule effects, and policy keys
  • Adds JSON and YAML snippets for policy packs and rules
  • Adds example policy packs for refund and data export workflows
  • Adds README, package metadata, VSCE packaging config, and focused validation tests
  • Marks the VS Code Extension developer tool as active in the root README

Verification

From tools/vscode-extension:

  • npm test
  • npm run package

Bounty

This PR is for the $50 USD bounty in #10.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread tools/vscode-extension/package.json Outdated
Comment on lines +58 to +65
"id": "aport-policy-json",
"aliases": [
"APort Policy JSON",
"aport-policy-json"
],
"extensions": [
".aport-policy.json",
".aport.json"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Hacktoberfest] VS Code Extension for Policy Development

1 participant