Skip to content

feat: add @deprecated item decorator - #644

Merged
theoephraim merged 6 commits into
mainfrom
copilot/add-deprecated-decorator
May 1, 2026
Merged

theoephraim merged 6 commits into
mainfrom
copilot/add-deprecated-decorator

Conversation

Copilot AI commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Adds a @deprecated decorator for env-spec config items that shows visual deprecation in CLI output and annotates generated TypeScript types with @deprecated JSDoc so IDEs show strikethrough on access.

Decorator behavior

# @deprecated                          # marks item as deprecated
# @deprecated="Use NEW_API_KEY instead" # with deprecation message
# @deprecated=false                    # explicit opt-out
OLD_API_KEY=
  • Item resolves normally — no errors or warnings emitted
  • Pretty output shows strikethrough on the key name + 😵deprecated label
  • @deprecated=false allows opt-out (useful for override scenarios)

Changes

  • decorators.ts — registers deprecated in builtInItemDecorators (no-op processor, purely declarative)
  • config-item.ts — adds isDeprecated and deprecationMessage getters
  • type-generation.ts — emits @deprecated [message] JSDoc tag when info.isDeprecated is true
  • formatting.ts — shows strikethrough key name + 😵deprecated label in pretty CLI output
  • deprecated-decorator.test.ts — tests for resolution, opt-out, getter values, and type gen info

Copilot AI linked an issue Apr 22, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add @deprecated decorator for marking deprecated variables Add @deprecated item decorator Apr 22, 2026
Copilot AI requested a review from philmillman April 22, 2026 18:37
@philmillman
philmillman marked this pull request as ready for review April 22, 2026 18:39
@bumpy-bot

bumpy-bot commented Apr 22, 2026 •

Copy link
Copy Markdown
Collaborator

bumpy-frog

The changes in this PR will be included in the next version bump.

minor Minor releases

  • varlock 1.0.0 → 1.1.0

Bump files in this PR

Click here if you want to add another bump file to this PR


This comment is maintained by bumpy.

@philmillman
philmillman requested a review from theoephraim April 22, 2026 18:44
const msgPart = decVal.isStatic && _.isString(decVal.staticValue)
? `: ${decVal.staticValue}`
: '';
throw new SchemaError(`This config item is deprecated${msgPart}`, { isWarning: true });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Im not sure about having a warning here. I thought it would just add it to the generated ts types?
The user knows it's likely still set, or else they would remove it from the schema altogether.

We could potentially still mark it somehow in the varlock load output, but the warning may be a bit too agressive?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah I'm on the fence there too. I could see a case for warning, especially in CI, but maybe we put it behind a flag?

expect(g.configSchema.ALSO_NOT_DEPRECATED.isDeprecated).toBe(false);
});

it('@deprecated is included in type gen info', async () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

prob want one too checking the type output with just the @deprecated and no custom message

Comment thread .bumpy/add-deprecated-decorator.md Resolved
@pkg-pr-new

pkg-pr-new Bot commented Apr 22, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/varlock@644

commit: c161adb

Copilot AI and others added 5 commits May 1, 2026 15:09
Agent-Logs-Url: https://github.com/dmno-dev/varlock/sessions/86c3a61d-4c29-49b1-b072-fecf43de4aef

Co-authored-by: philmillman <3722211+philmillman@users.noreply.github.com>
Co-authored-by: Theo Ephraim <theo@dmno.dev>
…el in pretty output

Instead of emitting a SchemaError warning, deprecated items now show
a strikethrough key name and a 😵deprecated label in the pretty output.
@theoephraim
theoephraim force-pushed the copilot/add-deprecated-decorator branch from 744aa2b to 507773e Compare May 1, 2026 22:30
@theoephraim theoephraim changed the title Add @deprecated item decorator feat: add @deprecated item decorator May 1, 2026
@theoephraim
theoephraim merged commit 30b3217 into main May 1, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add @deprecated decorator

4 participants