Skip to content

Improve config format 8b7#16

Merged
mkholt merged 4 commits into
mainfrom
improve-config-format-8b7
Jun 29, 2026
Merged

Improve config format 8b7#16
mkholt merged 4 commits into
mainfrom
improve-config-format-8b7

Conversation

@mkholt

@mkholt mkholt commented Jun 26, 2026

Copy link
Copy Markdown
Member

Allow profile-level AssemblyPath and per-item SolutionName
Profiles can now declare a shared AssemblyPath reused by every
assembly-based sync item (Plugin, PluginAnalysis, Identity), and each
sync item can override the profile-level SolutionName and AssemblyPath.

Effective-value resolution precedence is CLI override -> sync-item value
-> profile-level value, centralized in ProfileConfiguration's
ResolveAssemblyPath/ResolveSolutionName helpers and used by the config
builder, validator, root command and standalone commands. Validation now
checks effective per-item values instead of requiring a profile-level
solution name unconditionally.

Factor out duplicated CLI/profile merge scaffolding in commands
Extract three shared helpers to remove copy-pasted logic across the
plugin, webresource, analyze and identity commands:

  • XrmSyncCommandBase.ResolveCommandProfile: standalone-vs-profile
    detection, profile loading and error messaging. Collapses each
    command's two-branch merge into a single path (CLI value wins via
    GetValueOrDefault, with a null profile standing in for standalone).
  • XrmSyncCommandBase.ReadExecutionOverrides: reads the shared
    --dry-run/--ci-mode/--log-level/--profile values into a deconstructable
    record struct.
  • ServiceCollectionExtensions.AddOptions(dryRun, ciMode, logLevel):
    applies the standard execution-override block when registering config.

Co-Authored-By: Claude [email protected] via Conducktor [email protected]

mkholt and others added 3 commits June 26, 2026 14:11
Profiles can now declare a shared AssemblyPath reused by every
assembly-based sync item (Plugin, PluginAnalysis, Identity), and each
sync item can override the profile-level SolutionName and AssemblyPath.

Effective-value resolution precedence is CLI override -> sync-item value
-> profile-level value, centralized in ProfileConfiguration's
ResolveAssemblyPath/ResolveSolutionName helpers and used by the config
builder, validator, root command and standalone commands. Validation now
checks effective per-item values instead of requiring a profile-level
solution name unconditionally.

Co-Authored-By: Claude <[email protected]> via Conducktor <[email protected]>
# Conflicts:
#	Model/XrmSyncOptions.cs
#	XrmSync/Commands/PluginSyncCommand.cs
#	XrmSync/Commands/XrmSyncRootCommand.cs
Extract three shared helpers to remove copy-pasted logic across the
plugin, webresource, analyze and identity commands:

- XrmSyncCommandBase.ResolveCommandProfile: standalone-vs-profile
  detection, profile loading and error messaging. Collapses each
  command's two-branch merge into a single path (CLI value wins via
  GetValueOrDefault, with a null profile standing in for standalone).
- XrmSyncCommandBase.ReadExecutionOverrides: reads the shared
  --dry-run/--ci-mode/--log-level/--profile values into a deconstructable
  record struct.
- ServiceCollectionExtensions.AddOptions(dryRun, ciMode, logLevel):
  applies the standard execution-override block when registering config.

No behavior change; all unit tests pass.

Co-Authored-By: Claude <[email protected]> via Conducktor <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Enables profile-level defaults for AssemblyPath and per-sync-item overrides for SolutionName/AssemblyPath, with a unified “effective value” precedence (CLI override → item override → profile default) applied consistently across config building, validation, and command execution. Also refactors repeated CLI/profile merge logic into shared helpers in the command base and DI registration.

Changes:

  • Add profile-level AssemblyPath and per-item SolutionName override support; centralize effective-value resolution in ProfileConfiguration.
  • Update configuration builder/validator and root + standalone commands to use effective values (including per-item overrides) and validate accordingly.
  • Factor shared command scaffolding (profile resolution + execution overrides) and add a DI helper for applying execution-level overrides.

Reviewed changes

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

Show a summary per file
File Description
XrmSync/Options/XrmSyncConfigurationValidator.cs Validates per-item effective SolutionName/AssemblyPath instead of requiring profile-level solution unconditionally.
XrmSync/Options/XrmSyncConfigurationBuilder.cs Reads profile-level AssemblyPath, allows null per-item assembly paths, and applies per-item SolutionName overrides.
XrmSync/Options/ConfigValidationOutput.cs Displays/validates sync items using effective (resolved) assembly path and solution name.
XrmSync/Extensions/ServiceCollectionExtensions.cs Adds AddOptions(dryRun, ciMode, logLevel) convenience overload for standard execution overrides.
XrmSync/Commands/XrmSyncRootCommand.cs Resolves and bakes effective per-item values (CLI → item → profile) before validating/executing.
XrmSync/Commands/XrmSyncCommandBase.cs Introduces shared helpers for reading execution overrides and resolving standalone vs profile execution.
XrmSync/Commands/WebresourceSyncCommand.cs Refactors CLI/profile merge via shared helpers; uses effective solution name resolution.
XrmSync/Commands/PluginSyncCommand.cs Refactors CLI/profile merge via shared helpers; uses effective assembly/solution resolution.
XrmSync/Commands/PluginAnalyzeCommand.cs Refactors standalone vs profile logic; uses effective assembly path resolution.
XrmSync/Commands/IdentityCommand.cs Refactors CLI/profile merge via shared helpers; uses effective assembly/solution resolution.
Model/XrmSyncOptions.cs Adds profile-level AssemblyPath, per-item SolutionName, and resolution helpers.
Tests/Config/OptionsValidationTests.cs Adds validator tests for profile-level assembly path and per-item solution name behavior.
Tests/Config/NamedConfigurationTests.cs Adds config-builder tests covering shared profile assembly path and per-item overrides.
README.md Documents new config format and override precedence, plus updated schema/examples.
CLAUDE.md Updates internal documentation to describe new config resolution behavior.
XrmSync/appsettings.example.json Updates example config to demonstrate shared profile AssemblyPath and per-item overrides.
appsettings.example.json Updates root example config similarly.
CHANGELOG.md Records the new config capabilities in the release notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Model/XrmSyncOptions.cs Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread CLAUDE.md Outdated
* ResolveAssemblyPath now returns null when neither the sync item nor
  the profile provides a non-whitespace AssemblyPath, matching its
  documented contract (no more leaking empty/whitespace profile values)
* Clarify in README/CLAUDE that the profile-level SolutionName is
  optional — required only when a solution-targeting item (Plugin,
  Webresource, Identity) needs it and doesn't override it; analysis-only
  profiles can omit it

Co-Authored-By: Claude <[email protected]> via Conducktor <[email protected]>
@mkholt mkholt merged commit 34c3535 into main Jun 29, 2026
1 check passed
@mkholt mkholt deleted the improve-config-format-8b7 branch June 29, 2026 13:36
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.

2 participants