ocomment 0.1.0

Fast, byte-preserving comment checker and remover
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ocomment.dev/schema/config-v1.json",
  "title": "OComment configuration v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["version"],
  "properties": {
    "version": { "const": 1 },
    "files": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "max_size": { "type": "integer", "minimum": 1, "default": 33554432 },
        "hidden": { "type": "boolean", "default": false },
        "follow_symlinks": { "type": "boolean", "default": false },
        "ignore": { "type": "boolean", "default": true },
        "include": { "$ref": "#/$defs/strings" },
        "exclude": { "$ref": "#/$defs/strings" }
      }
    },
    "policy": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "mode": { "$ref": "#/$defs/policy" },
        "layout": { "enum": ["lines", "columns", "compact"], "default": "lines" },
        "keep_kind": { "$ref": "#/$defs/kinds" },
        "remove_kind": { "$ref": "#/$defs/kinds" },
        "keep_regex": { "$ref": "#/$defs/strings" },
        "remove_regex": { "$ref": "#/$defs/strings" },
        "force_invalid": { "type": "boolean", "default": false },
        "force_protected": { "type": "boolean", "default": false }
      }
    },
    "git": {
      "type": "object", "additionalProperties": false,
      "properties": { "staged": { "type": "boolean" }, "index_only": { "type": "boolean" } }
    },
    "lsp": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "on_save": { "type": "boolean", "default": false },
        "diagnostics": { "type": "boolean", "default": true },
        "code_lens": { "type": "boolean", "default": true }
      }
    },
    "languages": {
      "type": "object", "additionalProperties": { "$ref": "#/$defs/languageConfig" }
    },
    "profiles": {
      "type": "object", "additionalProperties": { "$ref": "#/$defs/profile" }
    },
    "plugins": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "enabled": { "$ref": "#/$defs/strings" },
        "routes": {
          "type": "object",
          "additionalProperties": { "type": "string", "minLength": 1 },
          "default": {}
        },
        "memory_mib": { "type": "integer", "minimum": 1, "maximum": 4096 },
        "instances": { "type": "integer", "minimum": 1, "maximum": 1024 },
        "fuel_per_byte": { "type": "integer", "minimum": 1, "maximum": 1000000 }
      }
    },
    "overrides": {
      "type": "array", "items": { "$ref": "#/$defs/pathOverride" }
    }
  },
  "$defs": {
    "strings": { "type": "array", "items": { "type": "string" }, "default": [] },
    "policy": { "enum": ["safe", "legal", "all"], "default": "safe" },
    "language": { "enum": ["rust", "ocaml", "c", "cpp", "go", "java", "javascript", "typescript", "python", "shell", "html", "css", "jsonc", "sql", "kotlin", "toml", "lua", "yaml", "php", "ruby", "zig", "r", "dart", "swift", "csharp", "scala", "vue", "svelte", "markdown", "perl"] },
    "kind": { "enum": ["line", "block", "doc-line", "doc-block", "directive", "license", "html-comment", "shebang", "encoding", "optimizer-hint", "version-comment"] },
    "kinds": { "type": "array", "items": { "$ref": "#/$defs/kind" }, "default": [] },
    "languageConfig": {
      "type": "object", "additionalProperties": false,
      "properties": {
        "enabled": { "type": "boolean" }, "dialect": { "$ref": "#/$defs/dialect" },
        "policy": { "$ref": "#/$defs/policy" }, "layout": { "enum": ["lines", "columns", "compact"] },
        "keep_kind": { "$ref": "#/$defs/kinds" }, "remove_kind": { "$ref": "#/$defs/kinds" },
        "keep_regex": { "$ref": "#/$defs/strings" }, "remove_regex": { "$ref": "#/$defs/strings" }
      }
    },
    "pathOverride": {
      "type": "object", "additionalProperties": false, "required": ["paths"],
      "properties": {
        "paths": { "$ref": "#/$defs/nonEmptyStrings" },
        "language": { "$ref": "#/$defs/language" },
        "dialect": { "$ref": "#/$defs/dialect" },
        "policy": { "$ref": "#/$defs/policy" },
        "layout": { "enum": ["lines", "columns", "compact"] },
        "keep_kind": { "$ref": "#/$defs/kinds" },
        "remove_kind": { "$ref": "#/$defs/kinds" },
        "keep_regex": { "$ref": "#/$defs/strings" },
        "remove_regex": { "$ref": "#/$defs/strings" }
      }
    },
    "dialect": {
      "enum": ["standard", "jsx", "tsx", "objective-c", "objective-cpp", "gnu-c", "gnu-cpp", "cuda", "posix-sh", "bash53", "zsh", "postgresql", "mysql", "sqlite", "t-sql", "oracle", "scss", "sass"]
    },
    "nonEmptyStrings": {
      "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 }
    },
    "profile": {
      "type": "object", "additionalProperties": false,
      "anyOf": [
        { "required": ["line_comments"], "properties": { "line_comments": { "minItems": 1 } } },
        { "required": ["block_comments"], "properties": { "block_comments": { "minItems": 1 } } }
      ],
      "properties": {
        "name": { "type": "string", "minLength": 1 }, "extensions": { "$ref": "#/$defs/strings" },
        "line_comments": { "type": "array", "items": { "$ref": "#/$defs/lineDelimiter" } },
        "block_comments": { "type": "array", "items": { "$ref": "#/$defs/blockDelimiter" } },
        "strings": { "type": "array", "items": { "$ref": "#/$defs/stringDelimiter" } },
        "protected_patterns": { "type": "array", "items": { "$ref": "#/$defs/protectedPattern" } }
      }
    },
    "lineDelimiter": {
      "type": "object", "additionalProperties": false, "required": ["start"],
      "properties": {
        "start": { "type": "string", "minLength": 1 },
        "requires_boundary": { "type": "boolean", "default": false },
        "kind": { "$ref": "#/$defs/kind" }
      }
    },
    "blockDelimiter": {
      "type": "object", "additionalProperties": false, "required": ["start", "end"],
      "properties": {
        "start": { "type": "string", "minLength": 1 },
        "end": { "type": "string", "minLength": 1 },
        "nested": { "type": "boolean", "default": false },
        "kind": { "$ref": "#/$defs/kind" }
      }
    },
    "stringDelimiter": {
      "type": "object", "additionalProperties": false, "required": ["start", "end"],
      "properties": {
        "start": { "type": "string", "minLength": 1 },
        "end": { "type": "string", "minLength": 1 },
        "escape": { "type": "string", "minLength": 1 },
        "multiline": { "type": "boolean", "default": false }
      }
    },
    "protectedPattern": {
      "type": "object", "additionalProperties": false, "required": ["contains", "reason"],
      "properties": {
        "contains": { "type": "string", "minLength": 1 },
        "reason": { "type": "string", "minLength": 1 }
      }
    }
  }
}