Skip to content

Generate policy data as JSON#272018

Merged
pwang347 merged 12 commits into
mainfrom
pawang/policies
Oct 20, 2025
Merged

Generate policy data as JSON#272018
pwang347 merged 12 commits into
mainfrom
pawang/policies

Conversation

@pwang347
Copy link
Copy Markdown
Member

@pwang347 pwang347 commented Oct 17, 2025

Follow-ups

  1. Localization: introduce utility to make creation less verbose
  2. Terminal configuration changes: remove hacks
  3. Refactor script into smaller pieces in the folder and add tests
  4. Linux support

Behaviour Changes

  • All categories and policies are now sorted (policies sorted by category first)
  • ChatMCP and TelemetryLevel now use enums instead of string

Comment thread src/vs/workbench/contrib/policyExport/test/node/policyExport.integrationTest.ts Outdated
Comment thread build/lib/policies/copyPolicyDto.js
Comment thread build/package.json
@pwang347 pwang347 marked this pull request as ready for review October 20, 2025 16:11
Copilot AI review requested due to automatic review settings October 20, 2025 16:11
@vs-code-engineering
Copy link
Copy Markdown
Contributor

vs-code-engineering Bot commented Oct 20, 2025

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/platform/environment/common/argv.ts
  • src/vs/platform/environment/common/environment.ts
  • src/vs/platform/environment/common/environmentService.ts
  • src/vs/platform/environment/node/argv.ts

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new system for generating policy data as JSON. Instead of parsing TypeScript source files at build time using tree-sitter, the system now exports policy definitions at runtime and uses the resulting JSON file as input for policy generation.

Key changes:

  • Added a new --export-policy-data command-line flag that exports policy definitions to JSON
  • Introduced new data types (PolicyCategory, LocalizedValue, ExportedPolicyDataDto) to standardize policy representation
  • Refactored the policy generator to consume JSON instead of parsing TypeScript AST
  • Updated all policy definitions to include required category and localization properties

Reviewed Changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/vs/workbench/contrib/policyExport/electron-browser/policyExport.contribution.ts New contribution that handles policy data export on startup when flag is present
src/vs/workbench/contrib/policyExport/test/node/policyExport.integrationTest.ts Integration test verifying exported data matches checked-in file
src/vs/base/common/policyDto.ts New DTO types for serializing policy data to JSON
src/vs/base/common/policy.ts Added PolicyCategory enum and localization structures to IPolicy interface
build/lib/policies/policyGenerator.ts Refactored to parse JSON instead of TypeScript AST
build/lib/policies/policyData.jsonc Generated JSON file containing all policy definitions
build/lib/policies/copyPolicyDto.ts Build script to copy DTO types from src to build folder
Test files (multiple) Updated mock policy definitions with required category and localization fields
Configuration files (multiple) Added category and localization to all production policy definitions

Comment thread src/vs/workbench/contrib/chat/browser/chat.contribution.ts
Comment thread build/lib/policies/policyGenerator.ts
Comment thread build/lib/policies/policyGenerator.ts Outdated
@vs-code-engineering vs-code-engineering Bot added this to the October 2025 milestone Oct 20, 2025
pwang347 and others added 4 commits October 20, 2025 09:17
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread src/vs/workbench/contrib/policyExport/common/policyDto.ts
@loku777

This comment was marked as off-topic.

@pwang347 pwang347 merged commit 99c299e into main Oct 20, 2025
54 checks passed
@pwang347 pwang347 deleted the pawang/policies branch October 20, 2025 21:38
pwang347 added a commit that referenced this pull request Oct 20, 2025
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Dec 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants