feat: add staged property to custom variables for re-staging support#163
Merged
alirezanet merged 3 commits intomasterfrom Mar 11, 2026
Merged
feat: add staged property to custom variables for re-staging support#163alirezanet merged 3 commits intomasterfrom
staged property to custom variables for re-staging support#163alirezanet merged 3 commits intomasterfrom
Conversation
Copilot
AI
changed the title
[WIP] Add Csharpier pre commit hook with custom variable
feat: add Mar 11, 2026
staged property to custom variables for re-staging support
alirezanet
requested changes
Mar 11, 2026
Owner
alirezanet
left a comment
There was a problem hiding this comment.
we need more Unit tests and Integration tests to make sure this would work as expected.
also we should test the existing behavior if it is not provided.
…integration tests
Contributor
Author
Added in commit
|
11 tasks
This was referenced Mar 11, 2026
This was referenced Mar 16, 2026
This was referenced Mar 24, 2026
WarperSan
pushed a commit
to WarperSan/ThunderPipe
that referenced
this pull request
Mar 30, 2026
Updated [husky](https://github.com/alirezanet/husky.net) from 0.8.0 to 0.9.1. <details> <summary>Release notes</summary> _Sourced from [husky's releases](https://github.com/alirezanet/husky.net/releases)._ ## 0.9.1 ## What's Changed * Fix install command race condition on first run with parallel MSBuild nodes by @MattKotsenas in alirezanet/Husky.Net#168 **Full Changelog**: alirezanet/Husky.Net@v0.9.0...v0.9.1 ## 0.9.0 ## What's Changed * remove net6.0/net7.0 since out of support by @WeihanLi in alirezanet/Husky.Net#135 * fix: update regex pattern to allow breaking commits by @joaoopereira in alirezanet/Husky.Net#153 * Fix parallel install mutex bug and support incremental build by @MattKotsenas in alirezanet/Husky.Net#159 * fix: handle file paths with spaces in git commands in alirezanet/Husky.Net#156 * feat: add `staged` property to custom variables for re-staging support in alirezanet/Husky.Net#163 * feat: support variables in include/exclude glob patterns in alirezanet/Husky.Net#161 * fix: use AfterTargets="Restore" to support NuGet credential helpers for private feeds in alirezanet/Husky.Net#162 ## New Contributors * @joaoopereira made their first contribution in alirezanet/Husky.Net#153 * @MattKotsenas made their first contribution in alirezanet/Husky.Net#159 **Full Changelog**: alirezanet/Husky.Net@v0.8.0...v0.9.0 Commits viewable in [compare view](alirezanet/Husky.Net@v0.8.0...v0.9.1). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This was referenced Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Custom variables in
task-runner.jsondon't re-stage formatted files after a task runs in a pre-commit hook — unlike the built-in${staged}variable. This is because custom variable files are taggedArgumentTypes.CustomVariable, causing a plainExecutableTaskto be created instead of aStagedTask.Description
A new
stagedboolean property has been added to custom variable definitions. When set totrue, files returned by the custom variable are treated as staged files, enabling the same re-staging behavior as the built-in${staged}variable (including partial staging support).The
stagedproperty is scoped exclusively to a new dedicatedHuskyVariablemodel — it is not part of the generalHuskyTaskmodel used for task definitions — keeping the API clean and purpose-specific.Changes
HuskyVariable(new model) — Dedicated class for custom variable definitions (Name,Command,Args,Cwd,Staged). Replaces the use ofHuskyTaskfor variable loading inArgumentParser.ArgumentParser.AddCustomVariable()— When the variable hasstaged: true, tags output files asArgumentTypes.StagedFileinstead ofArgumentTypes.CustomVariable, triggering the existingStagedTaskmachinery (re-staging, partial staging, etc.).Utils.GetTaskCwdAsync()— Added overload acceptingHuskyVariable.schema.json— Addedstaged(boolean, default:false) andcwdproperties to thevariableTaskdefinition.docs/guide/task-configuration.md— Documents the newstagedproperty with a CSharpier-style example.ArgumentParserTests) — 4 tests coveringstaged: true→StagedFileargument type,staged: false→CustomVariabletype, nostagedproperty (default) →CustomVariabletype, and unknown variable → empty args.StagedCustomVariableTests) — 4 Docker-based tests verifying real behavior: staged variable with matching files executes and re-stages, non-staged variable works normally, and both skip correctly when no matching files are staged.Usage
{ "variables": [ { "name": "staged-diff-files", "command": "git", "args": ["diff", "--cached", "--name-only", "--no-ext-diff", "--diff-filter=ACMRTUXB"], "staged": true } ], "tasks": [ { "name": "Run csharpier", "group": "pre-commit", "command": "dotnet", "args": ["csharpier", "${staged-diff-files}"], "include": ["**/*.cs"] } ] }Non-breaking — existing custom variables without
"staged": trueare unaffected.Type of change
Checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.