Repository: microsoft/ApplicationInspector
File: AppInspector/Commands/PackRulesCommand.cs (C#)

Code before:
﻿// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using Microsoft.ApplicationInspector.Common;
using Microsoft.ApplicationInspector.RulesEngine;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;

namespace Microsoft.ApplicationInspector.Commands;

public class PackRulesOptions
{
    public string? CustomRulesPath { get; set; }
    public bool PackEmbeddedRules { get; set; }
    public string? CustomCommentsPath { get; set; }
    public string? CustomLanguagesPath { get; set; }
    public bool DisableRequireUniqueIds { get; set; }
    public bool RequireMustMatch { get; set; }
    public bool RequireMustNotMatch { get; set; }

    public bool EnableNonBacktrackingRegex { get; set; }
}

public class PackRulesResult : Result
{
    public enum ExitCode
    {
        Success = 0,
        Error = 1,
        CriticalError = Utils.ExitCode.CriticalError //ensure common value for final exit log mention
    }

    [JsonPropertyName("resultCode")] // Order 2
    public ExitCode ResultCode { get; set; }

    /// <summary>
    ///     List of Rules to pack as specified in pack command
    /// </summary>
    [JsonPropertyName("rules")] // Order 3
    public List<Rule>? Rules { get; set; }
}

/// <summary>
///     Used to combine validated rules into one json
/// </summary>
public class PackRulesCommand

Review comment (suggestion):
I'm not sure we should add this parameter to the PackRules command. This would cause the exported rules to potentially differ from the input rules by serializing the `nb` parameter that gets added. I think it should remain a parameter just for the analysis/tagdiff/verify commands, but I'm willing to hear an argument that it does belong here.

Code after:
﻿// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using Microsoft.ApplicationInspector.Common;
using Microsoft.ApplicationInspector.RulesEngine;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;

namespace Microsoft.ApplicationInspector.Commands;

public class PackRulesOptions
{
    public string? CustomRulesPath { get; set; }
    public bool PackEmbeddedRules { get; set; }
    public string? CustomCommentsPath { get; set; }
    public string? CustomLanguagesPath { get; set; }
    public bool DisableRequireUniqueIds { get; set; }
    public bool RequireMustMatch { get; set; }
    public bool RequireMustNotMatch { get; set; }
}

public class PackRulesResult : Result
{
    public enum ExitCode
    {
        Success = 0,
        Error = 1,
        CriticalError = Utils.ExitCode.CriticalError //ensure common value for final exit log mention
    }

    [JsonPropertyName("resultCode")] // Order 2
    public ExitCode ResultCode { get; set; }

    /// <summary>
    ///     List of Rules to pack as specified in pack command
    /// </summary>
    [JsonPropertyName("rules")] // Order 3
    public List<Rule>? Rules { get; set; }
}

/// <summary>
///     Used to combine validated rules into one json
/// </summary>
public class PackRulesCommand
{
    private readonly ILogger<PackRulesCommand> _logger;