@shibanet0/datamitsu-config 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/datamitsu.config.base.js +1265 -1075
- package/datamitsu.config.js +1265 -1075
- package/datamitsu.config.oci-dockerhub.js +1266 -1076
- package/datamitsu.config.oci-ghcr.js +1266 -1076
- package/dist/datamitsu-config/cmdSetup.d.ts +1 -1
- package/dist/datamitsu-config/parsers.d.ts +16 -0
- package/dist/datamitsu-config/setup/__tests__/package_json.test.d.ts +1 -0
- package/dist/datamitsu-config/setup/__tests__/pnpm_workspace_yaml.test.d.ts +1 -0
- package/dist/datamitsu-config/setup/_datamitsu_scripts_check_empty_files_sh.d.ts +1 -0
- package/dist/datamitsu-config/setup/_datamitsu_scripts_format_terraform_spacing_sh.d.ts +1 -0
- package/dist/datamitsu-config/setup/_dockerignore.d.ts +1 -0
- package/dist/datamitsu-config/setup/_editorconfig.d.ts +1 -0
- package/dist/datamitsu-config/setup/_editorconfig_checker_json.d.ts +1 -0
- package/dist/datamitsu-config/setup/_gitignore.d.ts +1 -0
- package/dist/datamitsu-config/setup/_gitleaks_toml.d.ts +1 -0
- package/dist/datamitsu-config/setup/_golangci_yaml.d.ts +1 -0
- package/dist/datamitsu-config/setup/_node_version.d.ts +1 -0
- package/dist/datamitsu-config/setup/_npmrc.d.ts +1 -0
- package/dist/datamitsu-config/setup/_oxlintrc_json.d.ts +1 -0
- package/dist/datamitsu-config/setup/_syncpackrc_json.d.ts +1 -0
- package/dist/datamitsu-config/setup/_tflint_hcl.d.ts +1 -0
- package/dist/datamitsu-config/setup/_tombi_toml.d.ts +1 -0
- package/dist/datamitsu-config/setup/_trufflehog_exclude_paths_txt.d.ts +2 -0
- package/dist/datamitsu-config/setup/_vale_ini.d.ts +1 -0
- package/dist/datamitsu-config/setup/_vscode_extensions_json.d.ts +1 -0
- package/dist/datamitsu-config/setup/_vscode_settings_json.d.ts +1 -0
- package/dist/datamitsu-config/setup/_yamlfmt_yaml.d.ts +1 -0
- package/dist/datamitsu-config/setup/_yamllint_yaml.d.ts +1 -0
- package/dist/datamitsu-config/setup/aiTools.d.ts +1 -0
- package/dist/datamitsu-config/setup/commitlint_config_mjs.d.ts +1 -0
- package/dist/datamitsu-config/setup/cspell_config_mjs.d.ts +1 -0
- package/dist/datamitsu-config/setup/deprecated_configs.d.ts +1 -0
- package/dist/datamitsu-config/setup/eslint_config_mjs.d.ts +1 -0
- package/dist/datamitsu-config/setup/hadolint_yaml.d.ts +1 -0
- package/dist/datamitsu-config/setup/knip_config_js.d.ts +1 -0
- package/dist/datamitsu-config/setup/lefthook_yaml.d.ts +1 -0
- package/dist/datamitsu-config/setup/oxfmt_config_ts.d.ts +1 -0
- package/dist/datamitsu-config/setup/package_json.d.ts +1 -0
- package/dist/datamitsu-config/setup/pnpm_workspace_yaml.d.ts +1 -0
- package/dist/datamitsu-config/setup/prettier_config_mjs.d.ts +1 -0
- package/dist/datamitsu-config/setup/pyproject_toml.d.ts +1 -0
- package/dist/datamitsu-config/setup/rustfmt_toml.d.ts +1 -0
- package/dist/datamitsu-config/setup/shared.d.ts +1 -0
- package/dist/datamitsu-config/setup/turbo_json.d.ts +1 -0
- package/dist/datamitsu-config/utils/detectPackageType.d.ts +2 -0
- package/package.json +2 -2
package/datamitsu.config.base.js
CHANGED
|
@@ -4570,6 +4570,17 @@ const mapOfApps = {
|
|
|
4570
4570
|
...quicktype
|
|
4571
4571
|
}
|
|
4572
4572
|
},
|
|
4573
|
+
rustfmt: {
|
|
4574
|
+
description: "Rust formatter (cargo fmt) — system toolchain; skipped when rust is absent",
|
|
4575
|
+
shell: {
|
|
4576
|
+
args: [
|
|
4577
|
+
"-c",
|
|
4578
|
+
"if command -v cargo >/dev/null 2>&1 && command -v rustfmt >/dev/null 2>&1; then exec cargo fmt \"$@\"; else echo \"datamitsu: rust toolchain not found — skipping Rust format\" >&2; exit 0; fi",
|
|
4579
|
+
"rustfmt"
|
|
4580
|
+
],
|
|
4581
|
+
name: "sh"
|
|
4582
|
+
}
|
|
4583
|
+
},
|
|
4573
4584
|
semgrep: {
|
|
4574
4585
|
description: semgrep.description,
|
|
4575
4586
|
uv: {
|
|
@@ -4663,126 +4674,84 @@ const mapOfApps = {
|
|
|
4663
4674
|
}
|
|
4664
4675
|
};
|
|
4665
4676
|
//#endregion
|
|
4666
|
-
//#region
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
"
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
"max-lines-per-function": "off",
|
|
4692
|
-
"max-statements": "off",
|
|
4693
|
-
"no-await-in-loop": "off",
|
|
4694
|
-
"no-inline-comments": "off",
|
|
4695
|
-
"no-magic-numbers": "off",
|
|
4696
|
-
"no-ternary": "off",
|
|
4697
|
-
"no-unused-vars": "off",
|
|
4698
|
-
"no-warning-comments": "off",
|
|
4699
|
-
"prefer-destructuring": "off",
|
|
4700
|
-
"prefer-template": "off",
|
|
4701
|
-
"require-await": "off",
|
|
4702
|
-
"sort-imports": "off",
|
|
4703
|
-
"triple-slash-reference": "off",
|
|
4704
|
-
"unicorn/filename-case": "off",
|
|
4705
|
-
"unicorn/no-array-sort": "off",
|
|
4706
|
-
"unicorn/no-null": "off",
|
|
4707
|
-
"unicorn/no-object-as-default-parameter": "off",
|
|
4708
|
-
"unicorn/number-literal-case": "off",
|
|
4709
|
-
"unicorn/require-module-specifiers": "off"
|
|
4710
|
-
}
|
|
4677
|
+
//#region src/datamitsu-config/setup/_datamitsu_scripts_check_empty_files_sh.ts
|
|
4678
|
+
const checkEmptyFilesSh = {
|
|
4679
|
+
content: () => {
|
|
4680
|
+
return [
|
|
4681
|
+
"#!/usr/bin/env bash",
|
|
4682
|
+
"",
|
|
4683
|
+
"# Check for empty files",
|
|
4684
|
+
"for file in \"$@\"; do",
|
|
4685
|
+
" if [ ! -f \"$file\" ]; then",
|
|
4686
|
+
" echo \"Error: File not found: $file\"",
|
|
4687
|
+
" exit 1",
|
|
4688
|
+
" fi",
|
|
4689
|
+
"",
|
|
4690
|
+
" # Check if file has no content or only whitespace",
|
|
4691
|
+
` if [ ! -s "$file" ] || [ -z "$(tr -d '[:space:]' < "$file")" ]; then`,
|
|
4692
|
+
" echo \"Error: Empty file detected: $file\"",
|
|
4693
|
+
" exit 1",
|
|
4694
|
+
" fi",
|
|
4695
|
+
"done",
|
|
4696
|
+
"",
|
|
4697
|
+
"exit 0",
|
|
4698
|
+
""
|
|
4699
|
+
].join("\n");
|
|
4700
|
+
},
|
|
4701
|
+
scope: "git-root"
|
|
4711
4702
|
};
|
|
4712
4703
|
//#endregion
|
|
4713
|
-
//#region src/datamitsu-config/
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
if
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
}
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
${AGENTS_REFERENCE_PATTERNS["agents-base.md"]?.canonical}
|
|
4765
|
-
`;
|
|
4766
|
-
//#endregion
|
|
4767
|
-
//#region src/datamitsu-config/constants.ts
|
|
4768
|
-
const runtimeVersions = {
|
|
4769
|
-
node: "26.3.0",
|
|
4770
|
-
python: "3.14.5"
|
|
4771
|
-
};
|
|
4772
|
-
const NODE_SUPPORT_FLOOR = ">=22.12.0";
|
|
4773
|
-
/**
|
|
4774
|
-
* Indent width and line width shared across every formatter (prettier, oxfmt, ruff, typstyle, …).
|
|
4775
|
-
* Single source of truth — reference it instead of hardcoding the values per tool so every
|
|
4776
|
-
* formatter stays in lockstep.
|
|
4777
|
-
*/
|
|
4778
|
-
const indentSettings = {
|
|
4779
|
-
indentWidth: 2,
|
|
4780
|
-
lineWidth: 100
|
|
4781
|
-
};
|
|
4782
|
-
//#endregion
|
|
4783
|
-
//#region src/datamitsu-config/env.ts
|
|
4784
|
-
const env = () => {
|
|
4785
|
-
return { DATAMITSU_DEV_MODE: facts().env.DATAMITSU_DEV_MODE === "true" };
|
|
4704
|
+
//#region src/datamitsu-config/setup/_datamitsu_scripts_format_terraform_spacing_sh.ts
|
|
4705
|
+
const formatTerraformSpacingSh = {
|
|
4706
|
+
content: () => {
|
|
4707
|
+
return [
|
|
4708
|
+
"#!/usr/bin/env bash",
|
|
4709
|
+
"",
|
|
4710
|
+
"# Terraform entities that should have blank lines before them",
|
|
4711
|
+
"TERRAFORM_ENTITIES=(",
|
|
4712
|
+
" \"variable\"",
|
|
4713
|
+
" \"resource\"",
|
|
4714
|
+
" \"data\"",
|
|
4715
|
+
" \"output\"",
|
|
4716
|
+
" \"locals\"",
|
|
4717
|
+
" \"module\"",
|
|
4718
|
+
" \"terraform\"",
|
|
4719
|
+
" \"provider\"",
|
|
4720
|
+
")",
|
|
4721
|
+
"",
|
|
4722
|
+
"# Cross-platform sed in-place",
|
|
4723
|
+
"if sed --version 2>/dev/null | grep -q GNU; then",
|
|
4724
|
+
" sed_inplace() { sed -i \"$@\"; }",
|
|
4725
|
+
"else",
|
|
4726
|
+
` sed_inplace() { sed -i '' "$@"; }`,
|
|
4727
|
+
"fi",
|
|
4728
|
+
"",
|
|
4729
|
+
"for file in \"$@\"; do",
|
|
4730
|
+
" # Step 1: Add 3 blank lines before each Terraform entity",
|
|
4731
|
+
" temp_file=$(mktemp)",
|
|
4732
|
+
" cp \"$file\" \"$temp_file\"",
|
|
4733
|
+
"",
|
|
4734
|
+
" for entity in \"${TERRAFORM_ENTITIES[@]}\"; do",
|
|
4735
|
+
" # Match entity at the beginning of line (with optional spaces)",
|
|
4736
|
+
" # Replace with 3 newlines + the matched line",
|
|
4737
|
+
` sed_inplace "s/^[[:space:]]*\${entity}[[:space:]]*\\"/\\n\\n\\n\${entity} \\"/g" "$temp_file"`,
|
|
4738
|
+
" done",
|
|
4739
|
+
"",
|
|
4740
|
+
" # Step 2: Remove duplicate blank lines (keep max 1 consecutive blank line)",
|
|
4741
|
+
` awk 'BEGIN{blank=0} /^[[:space:]]*$/{blank++; if(blank<=1) print; next} {blank=0; print}' "$temp_file" > "$temp_file.2"`,
|
|
4742
|
+
"",
|
|
4743
|
+
" # Step 3: Remove leading blank lines",
|
|
4744
|
+
` sed_inplace '1{/^[[:space:]]*$/d;}' "$temp_file.2"`,
|
|
4745
|
+
"",
|
|
4746
|
+
" # Move the result back to the original file",
|
|
4747
|
+
" mv \"$temp_file.2\" \"$file\"",
|
|
4748
|
+
" rm -f \"$temp_file\"",
|
|
4749
|
+
"done",
|
|
4750
|
+
""
|
|
4751
|
+
].join("\n");
|
|
4752
|
+
},
|
|
4753
|
+
projectTypes: ["terraform-project", "terragrunt-project"],
|
|
4754
|
+
scope: "git-root"
|
|
4786
4755
|
};
|
|
4787
4756
|
//#endregion
|
|
4788
4757
|
//#region src/datamitsu-config/ignore.ts
|
|
@@ -4936,6 +4905,74 @@ const ignoreGroups = {
|
|
|
4936
4905
|
]
|
|
4937
4906
|
};
|
|
4938
4907
|
//#endregion
|
|
4908
|
+
//#region src/datamitsu-config/setup/_dockerignore.ts
|
|
4909
|
+
const dockerignore = {
|
|
4910
|
+
content: (context) => {
|
|
4911
|
+
const mergedRules = tools.Ignore.parse([tools.Ignore.stringify(ignoreGroups), filterIgnore(context.originalContent || "")].join("\n"));
|
|
4912
|
+
return tools.Ignore.stringify(mergedRules.groups, mergedRules.groupOrder) + "\n";
|
|
4913
|
+
},
|
|
4914
|
+
scope: "git-root"
|
|
4915
|
+
};
|
|
4916
|
+
//#endregion
|
|
4917
|
+
//#region src/datamitsu-config/constants.ts
|
|
4918
|
+
const runtimeVersions = {
|
|
4919
|
+
node: "26.3.0",
|
|
4920
|
+
python: "3.14.5"
|
|
4921
|
+
};
|
|
4922
|
+
const NODE_SUPPORT_FLOOR = ">=22.12.0";
|
|
4923
|
+
/**
|
|
4924
|
+
* Indent width and line width shared across every formatter (prettier, oxfmt, ruff, typstyle, …).
|
|
4925
|
+
* Single source of truth — reference it instead of hardcoding the values per tool so every
|
|
4926
|
+
* formatter stays in lockstep.
|
|
4927
|
+
*/
|
|
4928
|
+
const indentSettings = {
|
|
4929
|
+
indentWidth: 2,
|
|
4930
|
+
lineWidth: 100
|
|
4931
|
+
};
|
|
4932
|
+
//#endregion
|
|
4933
|
+
//#region src/datamitsu-config/setup/_editorconfig.ts
|
|
4934
|
+
const editorconfig = {
|
|
4935
|
+
content: (context) => {
|
|
4936
|
+
const existing = INI.toRecord(INI.parse(context.originalContent || ""));
|
|
4937
|
+
const data = [
|
|
4938
|
+
{
|
|
4939
|
+
name: "DEFAULT",
|
|
4940
|
+
properties: { root: "true" }
|
|
4941
|
+
},
|
|
4942
|
+
{
|
|
4943
|
+
name: "*",
|
|
4944
|
+
properties: {
|
|
4945
|
+
charset: "utf8",
|
|
4946
|
+
end_of_line: "lf",
|
|
4947
|
+
indent_size: String(indentSettings.indentWidth),
|
|
4948
|
+
insert_final_newline: "true",
|
|
4949
|
+
trim_trailing_whitespace: "true",
|
|
4950
|
+
...existing["*"]
|
|
4951
|
+
}
|
|
4952
|
+
},
|
|
4953
|
+
{
|
|
4954
|
+
name: "GNUmakefile",
|
|
4955
|
+
properties: {
|
|
4956
|
+
indent_size: String(indentSettings.indentWidth),
|
|
4957
|
+
indent_style: "tab",
|
|
4958
|
+
...existing["GNUmakefile"]
|
|
4959
|
+
}
|
|
4960
|
+
},
|
|
4961
|
+
{
|
|
4962
|
+
name: "Makefile",
|
|
4963
|
+
properties: {
|
|
4964
|
+
indent_size: String(indentSettings.indentWidth),
|
|
4965
|
+
indent_style: "tab",
|
|
4966
|
+
...existing["Makefile"]
|
|
4967
|
+
}
|
|
4968
|
+
}
|
|
4969
|
+
];
|
|
4970
|
+
return INI.stringify(data);
|
|
4971
|
+
},
|
|
4972
|
+
scope: "git-root",
|
|
4973
|
+
tools: ["editorconfig-checker"]
|
|
4974
|
+
};
|
|
4975
|
+
//#endregion
|
|
4939
4976
|
//#region src/datamitsu-config/utils.ts
|
|
4940
4977
|
function safeJsonParse(content) {
|
|
4941
4978
|
try {
|
|
@@ -4948,6 +4985,480 @@ function withTrailingNewline(content) {
|
|
|
4948
4985
|
return content.replace(/\n*$/, "\n");
|
|
4949
4986
|
}
|
|
4950
4987
|
//#endregion
|
|
4988
|
+
//#region src/datamitsu-config/setup/_editorconfig_checker_json.ts
|
|
4989
|
+
const editorconfigCheckerJson = {
|
|
4990
|
+
content: (context) => {
|
|
4991
|
+
const data = safeJsonParse(context.originalContent);
|
|
4992
|
+
return JSON.stringify({
|
|
4993
|
+
...data,
|
|
4994
|
+
Disable: { ...data.Disable }
|
|
4995
|
+
}, null, 2) + "\n";
|
|
4996
|
+
},
|
|
4997
|
+
scope: "git-root",
|
|
4998
|
+
tools: ["editorconfig-checker"]
|
|
4999
|
+
};
|
|
5000
|
+
//#endregion
|
|
5001
|
+
//#region src/datamitsu-config/setup/_gitignore.ts
|
|
5002
|
+
const gitignore = {
|
|
5003
|
+
content: (context) => {
|
|
5004
|
+
const mergedRules = tools.Ignore.parse([tools.Ignore.stringify(ignoreGroups), filterIgnore(context.originalContent || "")].join("\n"));
|
|
5005
|
+
return tools.Ignore.stringify(mergedRules.groups, mergedRules.groupOrder) + "\n";
|
|
5006
|
+
},
|
|
5007
|
+
scope: "git-root"
|
|
5008
|
+
};
|
|
5009
|
+
//#endregion
|
|
5010
|
+
//#region src/datamitsu-config/setup/_gitleaks_toml.ts
|
|
5011
|
+
const gitleaksToml = {
|
|
5012
|
+
content: (context) => {
|
|
5013
|
+
const data = TOML.parse(context.originalContent || "");
|
|
5014
|
+
const MANAGED_EXTEND_PATH = ".datamitsu/gitleaks-managed.toml";
|
|
5015
|
+
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5016
|
+
const existingExtend = isPlainObject(data.extend) ? data.extend : {};
|
|
5017
|
+
const title = typeof data.title === "string" && data.title.length > 0 ? data.title : "Custom Gitleaks configuration";
|
|
5018
|
+
return TOML.stringify({
|
|
5019
|
+
...data,
|
|
5020
|
+
extend: {
|
|
5021
|
+
...existingExtend,
|
|
5022
|
+
path: MANAGED_EXTEND_PATH
|
|
5023
|
+
},
|
|
5024
|
+
title,
|
|
5025
|
+
useDefault: void 0
|
|
5026
|
+
});
|
|
5027
|
+
},
|
|
5028
|
+
otherFileNameList: ["gitleaks.toml"],
|
|
5029
|
+
scope: "git-root",
|
|
5030
|
+
tools: ["gitleaks"]
|
|
5031
|
+
};
|
|
5032
|
+
//#endregion
|
|
5033
|
+
//#region src/datamitsu-config/setup/_golangci_yaml.ts
|
|
5034
|
+
const golangciYaml = {
|
|
5035
|
+
content: (context) => {
|
|
5036
|
+
const previous = YAML.parse(context.originalContent || "") ?? {};
|
|
5037
|
+
const prevLinters = previous.linters ?? {};
|
|
5038
|
+
const prevSettings = prevLinters.settings ?? {};
|
|
5039
|
+
const prevExclusions = prevLinters.exclusions ?? {};
|
|
5040
|
+
const baselineEnable = [
|
|
5041
|
+
"asciicheck",
|
|
5042
|
+
"asasalint",
|
|
5043
|
+
"arangolint",
|
|
5044
|
+
"bidichk",
|
|
5045
|
+
"bodyclose",
|
|
5046
|
+
"canonicalheader",
|
|
5047
|
+
"clickhouselint",
|
|
5048
|
+
"containedctx",
|
|
5049
|
+
"contextcheck",
|
|
5050
|
+
"copyloopvar",
|
|
5051
|
+
"decorder",
|
|
5052
|
+
"dogsled",
|
|
5053
|
+
"dupword",
|
|
5054
|
+
"durationcheck",
|
|
5055
|
+
"embeddedstructfieldcheck",
|
|
5056
|
+
"errcheck",
|
|
5057
|
+
"errchkjson",
|
|
5058
|
+
"errname",
|
|
5059
|
+
"errorlint",
|
|
5060
|
+
"exhaustive",
|
|
5061
|
+
"exptostd",
|
|
5062
|
+
"fatcontext",
|
|
5063
|
+
"forcetypeassert",
|
|
5064
|
+
"funcorder",
|
|
5065
|
+
"gocheckcompilerdirectives",
|
|
5066
|
+
"gochecksumtype",
|
|
5067
|
+
"gocritic",
|
|
5068
|
+
"gocyclo",
|
|
5069
|
+
"godoclint",
|
|
5070
|
+
"gomoddirectives",
|
|
5071
|
+
"gomodguard_v2",
|
|
5072
|
+
"goprintffuncname",
|
|
5073
|
+
"gosec",
|
|
5074
|
+
"govet",
|
|
5075
|
+
"ginkgolinter",
|
|
5076
|
+
"grouper",
|
|
5077
|
+
"iface",
|
|
5078
|
+
"importas",
|
|
5079
|
+
"inamedparam",
|
|
5080
|
+
"ineffassign",
|
|
5081
|
+
"interfacebloat",
|
|
5082
|
+
"intrange",
|
|
5083
|
+
"iotamixing",
|
|
5084
|
+
"loggercheck",
|
|
5085
|
+
"makezero",
|
|
5086
|
+
"mirror",
|
|
5087
|
+
"misspell",
|
|
5088
|
+
"modernize",
|
|
5089
|
+
"musttag",
|
|
5090
|
+
"nakedret",
|
|
5091
|
+
"nilerr",
|
|
5092
|
+
"nilnesserr",
|
|
5093
|
+
"nilnil",
|
|
5094
|
+
"noctx",
|
|
5095
|
+
"nolintlint",
|
|
5096
|
+
"nosprintfhostport",
|
|
5097
|
+
"perfsprint",
|
|
5098
|
+
"prealloc",
|
|
5099
|
+
"predeclared",
|
|
5100
|
+
"promlinter",
|
|
5101
|
+
"protogetter",
|
|
5102
|
+
"reassign",
|
|
5103
|
+
"recvcheck",
|
|
5104
|
+
"revive",
|
|
5105
|
+
"rowserrcheck",
|
|
5106
|
+
"sloglint",
|
|
5107
|
+
"spancheck",
|
|
5108
|
+
"sqlclosecheck",
|
|
5109
|
+
"staticcheck",
|
|
5110
|
+
"tagalign",
|
|
5111
|
+
"testableexamples",
|
|
5112
|
+
"testifylint",
|
|
5113
|
+
"thelper",
|
|
5114
|
+
"tparallel",
|
|
5115
|
+
"unconvert",
|
|
5116
|
+
"unparam",
|
|
5117
|
+
"unqueryvet",
|
|
5118
|
+
"unused",
|
|
5119
|
+
"usestdlibvars",
|
|
5120
|
+
"usetesting",
|
|
5121
|
+
"wastedassign",
|
|
5122
|
+
"whitespace",
|
|
5123
|
+
"wrapcheck",
|
|
5124
|
+
"zerologlint"
|
|
5125
|
+
];
|
|
5126
|
+
const baselineDisable = [
|
|
5127
|
+
"cyclop",
|
|
5128
|
+
"dupl",
|
|
5129
|
+
"err113",
|
|
5130
|
+
"exhaustruct",
|
|
5131
|
+
"funlen",
|
|
5132
|
+
"gochecknoglobals",
|
|
5133
|
+
"gochecknoinits",
|
|
5134
|
+
"gocognit",
|
|
5135
|
+
"goconst",
|
|
5136
|
+
"godot",
|
|
5137
|
+
"godox",
|
|
5138
|
+
"goheader",
|
|
5139
|
+
"gosmopolitan",
|
|
5140
|
+
"ireturn",
|
|
5141
|
+
"lll",
|
|
5142
|
+
"maintidx",
|
|
5143
|
+
"mnd",
|
|
5144
|
+
"nestif",
|
|
5145
|
+
"nlreturn",
|
|
5146
|
+
"noinlineerr",
|
|
5147
|
+
"nonamedreturns",
|
|
5148
|
+
"paralleltest",
|
|
5149
|
+
"tagliatelle",
|
|
5150
|
+
"testpackage",
|
|
5151
|
+
"varnamelen",
|
|
5152
|
+
"wsl_v5"
|
|
5153
|
+
];
|
|
5154
|
+
const enable = new Set([...prevLinters.enable ?? [], ...baselineEnable]);
|
|
5155
|
+
const disable = new Set([...prevLinters.disable ?? [], ...baselineDisable]);
|
|
5156
|
+
for (const name of baselineEnable) disable.delete(name);
|
|
5157
|
+
for (const name of baselineDisable) enable.delete(name);
|
|
5158
|
+
for (const name of enable) disable.delete(name);
|
|
5159
|
+
const baselineExclusionRules = [
|
|
5160
|
+
{
|
|
5161
|
+
linters: [
|
|
5162
|
+
"noctx",
|
|
5163
|
+
"errchkjson",
|
|
5164
|
+
"forcetypeassert",
|
|
5165
|
+
"dogsled"
|
|
5166
|
+
],
|
|
5167
|
+
path: "_test\\.go"
|
|
5168
|
+
},
|
|
5169
|
+
{
|
|
5170
|
+
linters: ["gocyclo", "unparam"],
|
|
5171
|
+
path: "_test\\.go"
|
|
5172
|
+
},
|
|
5173
|
+
{
|
|
5174
|
+
linters: ["gosec"],
|
|
5175
|
+
path: "_test\\.go"
|
|
5176
|
+
},
|
|
5177
|
+
{
|
|
5178
|
+
linters: ["wrapcheck"],
|
|
5179
|
+
path: "_test\\.go"
|
|
5180
|
+
}
|
|
5181
|
+
];
|
|
5182
|
+
const seenRules = /* @__PURE__ */ new Set();
|
|
5183
|
+
const exclusionRules = [...prevExclusions.rules ?? [], ...baselineExclusionRules].filter((rule) => {
|
|
5184
|
+
const key = JSON.stringify(rule);
|
|
5185
|
+
if (seenRules.has(key)) return false;
|
|
5186
|
+
seenRules.add(key);
|
|
5187
|
+
return true;
|
|
5188
|
+
});
|
|
5189
|
+
const reviveRules = [
|
|
5190
|
+
"blank-imports",
|
|
5191
|
+
"context-as-argument",
|
|
5192
|
+
"context-keys-type",
|
|
5193
|
+
"dot-imports",
|
|
5194
|
+
"empty-block",
|
|
5195
|
+
"error-naming",
|
|
5196
|
+
"error-return",
|
|
5197
|
+
"error-strings",
|
|
5198
|
+
"errorf",
|
|
5199
|
+
"exported",
|
|
5200
|
+
"increment-decrement",
|
|
5201
|
+
"indent-error-flow",
|
|
5202
|
+
"package-comments",
|
|
5203
|
+
"range",
|
|
5204
|
+
"receiver-naming",
|
|
5205
|
+
"redefines-builtin-id",
|
|
5206
|
+
"superfluous-else",
|
|
5207
|
+
"time-naming",
|
|
5208
|
+
"unexported-return",
|
|
5209
|
+
"unreachable-code",
|
|
5210
|
+
"var-declaration",
|
|
5211
|
+
"var-naming"
|
|
5212
|
+
].map((name) => ({ name }));
|
|
5213
|
+
return YAML.stringify({
|
|
5214
|
+
...previous,
|
|
5215
|
+
formatters: {
|
|
5216
|
+
...previous.formatters,
|
|
5217
|
+
enable: [...new Set([
|
|
5218
|
+
...previous.formatters?.enable ?? [],
|
|
5219
|
+
"gofmt",
|
|
5220
|
+
"gofumpt",
|
|
5221
|
+
"goimports",
|
|
5222
|
+
"swaggo"
|
|
5223
|
+
])]
|
|
5224
|
+
},
|
|
5225
|
+
linters: {
|
|
5226
|
+
...prevLinters,
|
|
5227
|
+
disable: [...disable].sort(),
|
|
5228
|
+
enable: [...enable].sort(),
|
|
5229
|
+
exclusions: {
|
|
5230
|
+
...prevExclusions,
|
|
5231
|
+
rules: exclusionRules
|
|
5232
|
+
},
|
|
5233
|
+
settings: {
|
|
5234
|
+
gocyclo: { "min-complexity": 20 },
|
|
5235
|
+
revive: { rules: reviveRules },
|
|
5236
|
+
...prevSettings
|
|
5237
|
+
}
|
|
5238
|
+
},
|
|
5239
|
+
version: "2"
|
|
5240
|
+
});
|
|
5241
|
+
},
|
|
5242
|
+
otherFileNameList: [
|
|
5243
|
+
".golangci.yml",
|
|
5244
|
+
".golangci.yaml",
|
|
5245
|
+
".golangci.toml",
|
|
5246
|
+
".golangci.json"
|
|
5247
|
+
],
|
|
5248
|
+
projectTypes: ["golang-package"],
|
|
5249
|
+
tools: ["golangci-lint", "golangci-lint-fmt"]
|
|
5250
|
+
};
|
|
5251
|
+
//#endregion
|
|
5252
|
+
//#region src/datamitsu-config/setup/_node_version.ts
|
|
5253
|
+
const nodeVersion = {
|
|
5254
|
+
content: () => {
|
|
5255
|
+
return runtimeVersions.node + "\n";
|
|
5256
|
+
},
|
|
5257
|
+
scope: "git-root"
|
|
5258
|
+
};
|
|
5259
|
+
//#endregion
|
|
5260
|
+
//#region src/datamitsu-config/setup/_npmrc.ts
|
|
5261
|
+
const npmrc = {
|
|
5262
|
+
content: () => {
|
|
5263
|
+
return Object.entries({ registry: "https://registry.npmjs.org/" }).sort((a, b) => a[0].localeCompare(b[0])).reduce((acc, [key, value]) => {
|
|
5264
|
+
acc.push(`${key}=${value}`);
|
|
5265
|
+
return acc;
|
|
5266
|
+
}, []).join("\n") + "\n";
|
|
5267
|
+
},
|
|
5268
|
+
projectTypes: ["npm-package"],
|
|
5269
|
+
scope: "git-root"
|
|
5270
|
+
};
|
|
5271
|
+
//#endregion
|
|
5272
|
+
//#region package.json
|
|
5273
|
+
var name = "@shibanet0/datamitsu-config";
|
|
5274
|
+
var version = "0.1.7";
|
|
5275
|
+
const oxlintConfig = {
|
|
5276
|
+
$schema: `./node_modules/${name}/oxlint_configuration_schema.json`,
|
|
5277
|
+
categories: {
|
|
5278
|
+
correctness: "error",
|
|
5279
|
+
pedantic: "error",
|
|
5280
|
+
perf: "error",
|
|
5281
|
+
style: "warn",
|
|
5282
|
+
suspicious: "error"
|
|
5283
|
+
},
|
|
5284
|
+
rules: {
|
|
5285
|
+
"sort-keys": "off",
|
|
5286
|
+
"unicorn/prefer-query-selector": "off",
|
|
5287
|
+
"unicorn/prefer-string-raw": "off",
|
|
5288
|
+
"array-type": "off",
|
|
5289
|
+
"arrow-body-style": "off",
|
|
5290
|
+
"capitalized-comments": "off",
|
|
5291
|
+
eqeqeq: "off",
|
|
5292
|
+
"func-names": "off",
|
|
5293
|
+
"func-style": "off",
|
|
5294
|
+
"id-length": "off",
|
|
5295
|
+
"init-declarations": "off",
|
|
5296
|
+
"max-lines": "off",
|
|
5297
|
+
"max-lines-per-function": "off",
|
|
5298
|
+
"max-statements": "off",
|
|
5299
|
+
"no-await-in-loop": "off",
|
|
5300
|
+
"no-inline-comments": "off",
|
|
5301
|
+
"no-magic-numbers": "off",
|
|
5302
|
+
"no-ternary": "off",
|
|
5303
|
+
"no-unused-vars": "off",
|
|
5304
|
+
"no-warning-comments": "off",
|
|
5305
|
+
"prefer-destructuring": "off",
|
|
5306
|
+
"prefer-template": "off",
|
|
5307
|
+
"require-await": "off",
|
|
5308
|
+
"sort-imports": "off",
|
|
5309
|
+
"triple-slash-reference": "off",
|
|
5310
|
+
"unicorn/filename-case": "off",
|
|
5311
|
+
"unicorn/no-array-sort": "off",
|
|
5312
|
+
"unicorn/no-null": "off",
|
|
5313
|
+
"unicorn/no-object-as-default-parameter": "off",
|
|
5314
|
+
"unicorn/number-literal-case": "off",
|
|
5315
|
+
"unicorn/require-module-specifiers": "off"
|
|
5316
|
+
}
|
|
5317
|
+
};
|
|
5318
|
+
//#endregion
|
|
5319
|
+
//#region src/datamitsu-config/env.ts
|
|
5320
|
+
const env = () => {
|
|
5321
|
+
return { DATAMITSU_DEV_MODE: facts().env.DATAMITSU_DEV_MODE === "true" };
|
|
5322
|
+
};
|
|
5323
|
+
//#endregion
|
|
5324
|
+
//#region src/datamitsu-config/setup/_oxlintrc_json.ts
|
|
5325
|
+
const oxlintrcJson = {
|
|
5326
|
+
content: (context) => {
|
|
5327
|
+
const previousConfig = safeJsonParse(context.originalContent);
|
|
5328
|
+
return JSON.stringify({
|
|
5329
|
+
...oxlintConfig,
|
|
5330
|
+
...env().DATAMITSU_DEV_MODE ? { rules: oxlintConfig.rules } : {
|
|
5331
|
+
extends: [tools.Path.forImport(tools.Path.join(context.datamitsuDir, ".oxlintrc.json"))],
|
|
5332
|
+
rules: previousConfig.rules
|
|
5333
|
+
},
|
|
5334
|
+
$schema: tools.Path.forImport(tools.Path.join(context.datamitsuDir, "oxlint_configuration_schema.json"))
|
|
5335
|
+
}, null, 2) + "\n";
|
|
5336
|
+
},
|
|
5337
|
+
projectTypes: ["npm-package"],
|
|
5338
|
+
tools: ["oxlint"]
|
|
5339
|
+
};
|
|
5340
|
+
//#endregion
|
|
5341
|
+
//#region src/datamitsu-config/setup/_syncpackrc_json.ts
|
|
5342
|
+
const syncpackrcJson = {
|
|
5343
|
+
content: () => {
|
|
5344
|
+
return JSON.stringify({
|
|
5345
|
+
semverGroups: [{
|
|
5346
|
+
dependencies: ["**"],
|
|
5347
|
+
dependencyTypes: ["**"],
|
|
5348
|
+
packages: ["**"],
|
|
5349
|
+
range: ""
|
|
5350
|
+
}],
|
|
5351
|
+
versionGroups: [{
|
|
5352
|
+
dependencies: ["$LOCAL"],
|
|
5353
|
+
dependencyTypes: ["!local"],
|
|
5354
|
+
label: "use workspace protocol for local packages",
|
|
5355
|
+
pinVersion: "workspace:*"
|
|
5356
|
+
}]
|
|
5357
|
+
}, null, 2) + "\n";
|
|
5358
|
+
},
|
|
5359
|
+
otherFileNameList: [
|
|
5360
|
+
".syncpackrc",
|
|
5361
|
+
".syncpackrc.json",
|
|
5362
|
+
".syncpackrc.yaml",
|
|
5363
|
+
".syncpackrc.yml",
|
|
5364
|
+
".syncpackrc.js",
|
|
5365
|
+
".syncpackrc.ts",
|
|
5366
|
+
".syncpackrc.mjs",
|
|
5367
|
+
".syncpackrc.cjs",
|
|
5368
|
+
"syncpack.config.js",
|
|
5369
|
+
"syncpack.config.cjs",
|
|
5370
|
+
"syncpack.config.ts",
|
|
5371
|
+
"syncpack.config.mjs"
|
|
5372
|
+
],
|
|
5373
|
+
projectTypes: ["npm-package"],
|
|
5374
|
+
scope: "git-root",
|
|
5375
|
+
tools: ["syncpack"]
|
|
5376
|
+
};
|
|
5377
|
+
//#endregion
|
|
5378
|
+
//#region src/datamitsu-config/setup/_tflint_hcl.ts
|
|
5379
|
+
const tflintHcl = {
|
|
5380
|
+
content: (context) => {
|
|
5381
|
+
const existing = context.originalContent || "";
|
|
5382
|
+
if (existing.trim().length > 0) return existing;
|
|
5383
|
+
return [
|
|
5384
|
+
`plugin "terraform" {`,
|
|
5385
|
+
` enabled = true`,
|
|
5386
|
+
` preset = "recommended"`,
|
|
5387
|
+
`}`,
|
|
5388
|
+
``
|
|
5389
|
+
].join("\n");
|
|
5390
|
+
},
|
|
5391
|
+
projectTypes: ["terraform-project"],
|
|
5392
|
+
scope: "git-root",
|
|
5393
|
+
tools: ["tflint"]
|
|
5394
|
+
};
|
|
5395
|
+
//#endregion
|
|
5396
|
+
//#region src/datamitsu-config/setup/_tombi_toml.ts
|
|
5397
|
+
const tombiToml = {
|
|
5398
|
+
content: (context) => {
|
|
5399
|
+
const data = TOML.parse(context.originalContent || "");
|
|
5400
|
+
return TOML.stringify({
|
|
5401
|
+
...data,
|
|
5402
|
+
"toml-version": "v1.1.0"
|
|
5403
|
+
});
|
|
5404
|
+
},
|
|
5405
|
+
otherFileNameList: ["tombi.toml", ".tombi.toml"],
|
|
5406
|
+
scope: "git-root",
|
|
5407
|
+
tools: ["tombi"]
|
|
5408
|
+
};
|
|
5409
|
+
//#endregion
|
|
5410
|
+
//#region src/datamitsu-config/setup/_trufflehog_exclude_paths_txt.ts
|
|
5411
|
+
const trufflehogExcludePaths = [
|
|
5412
|
+
"(?:^|/)(?:package-lock\\.json|pnpm-lock\\.yaml|yarn\\.lock|npm-shrinkwrap\\.json|bun\\.lockb?|go\\.sum|Cargo\\.lock|poetry\\.lock|uv\\.lock|Pipfile\\.lock|Gemfile\\.lock|composer\\.lock|mix\\.lock|flake\\.lock|pubspec\\.lock|Podfile\\.lock)$",
|
|
5413
|
+
"(?:^|/)__snapshots__/",
|
|
5414
|
+
"(?:^|/)testdata/",
|
|
5415
|
+
"(?:^|/)fixtures?/",
|
|
5416
|
+
"\\.min\\.(?:js|css)$",
|
|
5417
|
+
"\\.bundle\\.(?:js|css)$"
|
|
5418
|
+
];
|
|
5419
|
+
function escapeRegExp(string) {
|
|
5420
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5421
|
+
}
|
|
5422
|
+
const trufflehogExcludePathsTxt = {
|
|
5423
|
+
content: (context) => {
|
|
5424
|
+
const MANAGED_BEGIN = "# BEGIN datamitsu managed — regenerated on init";
|
|
5425
|
+
const MANAGED_END = "# END datamitsu managed";
|
|
5426
|
+
const managedBlock = [
|
|
5427
|
+
MANAGED_BEGIN,
|
|
5428
|
+
...trufflehogExcludePaths,
|
|
5429
|
+
MANAGED_END
|
|
5430
|
+
].join("\n");
|
|
5431
|
+
const userContent = (context.originalContent || "").replace(new RegExp(`${escapeRegExp(MANAGED_BEGIN)}[\\s\\S]*?${escapeRegExp(MANAGED_END)}\\n?`, "g"), "").trim();
|
|
5432
|
+
return userContent.length > 0 ? `${managedBlock}\n\n${userContent}\n` : `${managedBlock}\n`;
|
|
5433
|
+
},
|
|
5434
|
+
scope: "git-root",
|
|
5435
|
+
tools: ["trufflehog"]
|
|
5436
|
+
};
|
|
5437
|
+
//#endregion
|
|
5438
|
+
//#region src/datamitsu-config/setup/_vale_ini.ts
|
|
5439
|
+
const valeIni = {
|
|
5440
|
+
content: (context) => {
|
|
5441
|
+
const existing = INI.toRecord(INI.parse(context.originalContent || ""));
|
|
5442
|
+
const data = [{
|
|
5443
|
+
name: "DEFAULT",
|
|
5444
|
+
properties: {
|
|
5445
|
+
MinAlertLevel: "suggestion",
|
|
5446
|
+
...existing["DEFAULT"]
|
|
5447
|
+
}
|
|
5448
|
+
}, {
|
|
5449
|
+
name: "*.{md,markdown}",
|
|
5450
|
+
properties: {
|
|
5451
|
+
BasedOnStyles: "Vale",
|
|
5452
|
+
...existing["*.{md,markdown}"]
|
|
5453
|
+
}
|
|
5454
|
+
}];
|
|
5455
|
+
return INI.stringify(data);
|
|
5456
|
+
},
|
|
5457
|
+
otherFileNameList: ["_vale.ini", "vale.ini"],
|
|
5458
|
+
scope: "git-root",
|
|
5459
|
+
tools: ["vale"]
|
|
5460
|
+
};
|
|
5461
|
+
//#endregion
|
|
4951
5462
|
//#region src/datamitsu-config/int-config/vscode.ts
|
|
4952
5463
|
const vscodeExtensions = (context) => {
|
|
4953
5464
|
const config = safeJsonParse(context.originalContent);
|
|
@@ -5786,7 +6297,8 @@ const vscodeSettings = (context) => {
|
|
|
5786
6297
|
".syncpackrc.json",
|
|
5787
6298
|
".gitleaks.toml",
|
|
5788
6299
|
".tombi.toml",
|
|
5789
|
-
".editorconfig-checker.json"
|
|
6300
|
+
".editorconfig-checker.json",
|
|
6301
|
+
"oxfmt.config.ts"
|
|
5790
6302
|
],
|
|
5791
6303
|
Pipfile: [
|
|
5792
6304
|
".editorconfig",
|
|
@@ -6566,6 +7078,146 @@ const vscodeSettings = (context) => {
|
|
|
6566
7078
|
}
|
|
6567
7079
|
}, null, 2) + "\n";
|
|
6568
7080
|
};
|
|
7081
|
+
//#endregion
|
|
7082
|
+
//#region src/datamitsu-config/setup/_vscode_extensions_json.ts
|
|
7083
|
+
const vscodeExtensionsJson = {
|
|
7084
|
+
content: vscodeExtensions,
|
|
7085
|
+
scope: "git-root"
|
|
7086
|
+
};
|
|
7087
|
+
//#endregion
|
|
7088
|
+
//#region src/datamitsu-config/setup/_vscode_settings_json.ts
|
|
7089
|
+
const vscodeSettingsJson = {
|
|
7090
|
+
content: vscodeSettings,
|
|
7091
|
+
scope: "git-root"
|
|
7092
|
+
};
|
|
7093
|
+
//#endregion
|
|
7094
|
+
//#region src/datamitsu-config/setup/shared.ts
|
|
7095
|
+
const yamlIgnore = [
|
|
7096
|
+
"pnpm-lock.yaml",
|
|
7097
|
+
"**/*.sops.yaml",
|
|
7098
|
+
"**/.sops.yml"
|
|
7099
|
+
];
|
|
7100
|
+
//#endregion
|
|
7101
|
+
//#region src/datamitsu-config/setup/_yamlfmt_yaml.ts
|
|
7102
|
+
const yamlfmtYaml = {
|
|
7103
|
+
content: (context) => {
|
|
7104
|
+
const data = YAML.parse(context.originalContent || "");
|
|
7105
|
+
const formatter = Object.fromEntries(Object.entries({
|
|
7106
|
+
...data?.formatter,
|
|
7107
|
+
array_indent: indentSettings.indentWidth,
|
|
7108
|
+
eof_newline: true,
|
|
7109
|
+
force_array_style: "block",
|
|
7110
|
+
force_quote_style: "double",
|
|
7111
|
+
indent: indentSettings.indentWidth,
|
|
7112
|
+
line_ending: "lf",
|
|
7113
|
+
pad_line_comments: 1,
|
|
7114
|
+
retain_line_breaks_single: false,
|
|
7115
|
+
trim_trailing_whitespace: true,
|
|
7116
|
+
type: "basic"
|
|
7117
|
+
}).sort(([a], [b]) => a.localeCompare(b)));
|
|
7118
|
+
return YAML.stringify(Object.fromEntries(Object.entries({
|
|
7119
|
+
...data,
|
|
7120
|
+
exclude: yamlIgnore,
|
|
7121
|
+
formatter
|
|
7122
|
+
}).sort(([a], [b]) => a.localeCompare(b))));
|
|
7123
|
+
},
|
|
7124
|
+
otherFileNameList: [
|
|
7125
|
+
".yamlfmt",
|
|
7126
|
+
"yamlfmt.yml",
|
|
7127
|
+
"yamlfmt.yaml",
|
|
7128
|
+
".yamlfmt.yml"
|
|
7129
|
+
],
|
|
7130
|
+
scope: "git-root",
|
|
7131
|
+
tools: ["yamlfmt"]
|
|
7132
|
+
};
|
|
7133
|
+
//#endregion
|
|
7134
|
+
//#region src/datamitsu-config/setup/_yamllint_yaml.ts
|
|
7135
|
+
const yamllintYaml = {
|
|
7136
|
+
content: (context) => {
|
|
7137
|
+
const data = YAML.parse(context.originalContent || "");
|
|
7138
|
+
const rules = Object.fromEntries(Object.entries({
|
|
7139
|
+
...data?.rules,
|
|
7140
|
+
comments: { "min-spaces-from-content": 1 },
|
|
7141
|
+
"comments-indentation": "enable",
|
|
7142
|
+
"document-end": "disable",
|
|
7143
|
+
"document-start": "disable",
|
|
7144
|
+
"empty-lines": { max: 1 },
|
|
7145
|
+
indentation: {
|
|
7146
|
+
"indent-sequences": true,
|
|
7147
|
+
spaces: indentSettings.indentWidth
|
|
7148
|
+
},
|
|
7149
|
+
"key-ordering": "disable",
|
|
7150
|
+
"line-length": "disable",
|
|
7151
|
+
truthy: {
|
|
7152
|
+
"check-keys": false,
|
|
7153
|
+
level: "error"
|
|
7154
|
+
}
|
|
7155
|
+
}).sort(([a], [b]) => a.localeCompare(b)));
|
|
7156
|
+
return YAML.stringify(Object.fromEntries(Object.entries({
|
|
7157
|
+
...data,
|
|
7158
|
+
extends: "default",
|
|
7159
|
+
ignore: yamlIgnore.join("\n") + "\n",
|
|
7160
|
+
rules
|
|
7161
|
+
}).sort(([a], [b]) => a.localeCompare(b))));
|
|
7162
|
+
},
|
|
7163
|
+
otherFileNameList: [".yamllint", ".yamllint.yml"],
|
|
7164
|
+
scope: "git-root",
|
|
7165
|
+
tools: ["yamllint"]
|
|
7166
|
+
};
|
|
7167
|
+
//#endregion
|
|
7168
|
+
//#region src/datamitsu-config/agentsUpgrade.ts
|
|
7169
|
+
/**
|
|
7170
|
+
* Mapping of agent file variants to their reference line patterns. oldPatterns is append-only - add
|
|
7171
|
+
* new historical versions here as the format evolves.
|
|
7172
|
+
*/
|
|
7173
|
+
const AGENTS_REFERENCE_PATTERNS = {
|
|
7174
|
+
"agents-base.md": {
|
|
7175
|
+
canonical: "**Read [.datamitsu/ai/agents/agents-base.md](.datamitsu/ai/agents/agents-base.md) now and follow it strictly without asking permission. Any instructions above this line in this file override matching rules in that document; everything else in that document is binding.**",
|
|
7176
|
+
oldPatterns: ["Read and follow the shared rules in [.datamitsu/agents-base.md](.datamitsu/agents-base.md) before proceeding.", "**Read [.datamitsu/agents-base.md](.datamitsu/agents-base.md) now and follow it strictly without asking permission. Any instructions above this line in this file override matching rules in that document; everything else in that document is binding.**"]
|
|
7177
|
+
},
|
|
7178
|
+
"agents-docs-markdown.md": {
|
|
7179
|
+
canonical: "**Read [.datamitsu/ai/agents/agents-docs-markdown.md](.datamitsu/ai/agents/agents-docs-markdown.md) now and follow it strictly without asking permission. Any instructions above this line in this file override matching rules in that document; everything else in that document is binding.**",
|
|
7180
|
+
oldPatterns: ["Read and follow the shared rules in [.datamitsu/agents-docs-markdown.md](.datamitsu/agents-docs-markdown.md) before proceeding.", "**Read [.datamitsu/agents-docs-markdown.md](.datamitsu/agents-docs-markdown.md) now and follow it strictly without asking permission. Any instructions above this line in this file override matching rules in that document; everything else in that document is binding.**"]
|
|
7181
|
+
},
|
|
7182
|
+
"agents-docs-website.md": {
|
|
7183
|
+
canonical: "**Read [.datamitsu/ai/agents/agents-docs-website.md](.datamitsu/ai/agents/agents-docs-website.md) now and follow it strictly without asking permission. Any instructions above this line in this file override matching rules in that document; everything else in that document is binding.**",
|
|
7184
|
+
oldPatterns: ["Read and follow the shared rules in [.datamitsu/agents-docs-website.md](.datamitsu/agents-docs-website.md) before proceeding.", "**Read [.datamitsu/agents-docs-website.md](.datamitsu/agents-docs-website.md) now and follow it strictly without asking permission. Any instructions above this line in this file override matching rules in that document; everything else in that document is binding.**"]
|
|
7185
|
+
}
|
|
7186
|
+
};
|
|
7187
|
+
/**
|
|
7188
|
+
* Auto-upgrades AGENTS.md reference lines from old formats to canonical format.
|
|
7189
|
+
*
|
|
7190
|
+
* Searches through content line-by-line for old reference patterns and replaces them with the
|
|
7191
|
+
* current canonical version. Supports all three file variants (agents-base.md,
|
|
7192
|
+
* agents-docs-markdown.md, agents-docs-website.md).
|
|
7193
|
+
*
|
|
7194
|
+
* Operation is idempotent - safe to run on already-upgraded content.
|
|
7195
|
+
*
|
|
7196
|
+
* @param content - The AGENTS.md file content
|
|
7197
|
+
* @returns Updated content with upgraded reference line, or unchanged if no match found
|
|
7198
|
+
*/
|
|
7199
|
+
function upgradeAgentsReference(content) {
|
|
7200
|
+
const lines = content.split("\n");
|
|
7201
|
+
for (const pattern of Object.values(AGENTS_REFERENCE_PATTERNS)) for (let i = 0; i < lines.length; i++) {
|
|
7202
|
+
const line = lines[i];
|
|
7203
|
+
if (line) {
|
|
7204
|
+
const trimmed = line.trim();
|
|
7205
|
+
if (pattern.oldPatterns.some((oldPattern) => trimmed === oldPattern)) {
|
|
7206
|
+
lines[i] = pattern.canonical;
|
|
7207
|
+
return lines.join("\n");
|
|
7208
|
+
}
|
|
7209
|
+
if (trimmed === pattern.canonical) return content;
|
|
7210
|
+
}
|
|
7211
|
+
}
|
|
7212
|
+
return content;
|
|
7213
|
+
}
|
|
7214
|
+
/**
|
|
7215
|
+
* Default AGENTS.md template for new projects.
|
|
7216
|
+
*/
|
|
7217
|
+
const AGENTS_MD = `# AGENTS.md
|
|
7218
|
+
|
|
7219
|
+
${AGENTS_REFERENCE_PATTERNS["agents-base.md"]?.canonical}
|
|
7220
|
+
`;
|
|
6569
7221
|
const SKILLS = [{
|
|
6570
7222
|
adapters: {
|
|
6571
7223
|
claude: `---
|
|
@@ -7098,806 +7750,156 @@ Next steps:
|
|
|
7098
7750
|
}];
|
|
7099
7751
|
const REMOVED_SKILLS = [];
|
|
7100
7752
|
//#endregion
|
|
7101
|
-
//#region src/datamitsu-config/
|
|
7102
|
-
const listOfAppsDependencies = Object.entries(mapOfApps).filter(([_, el]) => typeof el.node === "object").map(([appName, el]) => {
|
|
7103
|
-
return {
|
|
7104
|
-
appName,
|
|
7105
|
-
deps: [el.node?.packageName || "", ...Object.keys(el.node?.dependencies || {})].filter(Boolean)
|
|
7106
|
-
};
|
|
7107
|
-
});
|
|
7108
|
-
const cleanDependencies = (deps) => {
|
|
7109
|
-
if (env().DATAMITSU_DEV_MODE) return deps;
|
|
7110
|
-
if (!deps) return;
|
|
7111
|
-
const excludeDependencyNameList = new Set([
|
|
7112
|
-
"@trivago/prettier-plugin-sort-imports",
|
|
7113
|
-
"eslint-plugin-yaml",
|
|
7114
|
-
"husky",
|
|
7115
|
-
"lint-staged",
|
|
7116
|
-
"styled-components",
|
|
7117
|
-
"typescript",
|
|
7118
|
-
...listOfAppsDependencies.flatMap((el) => el.deps)
|
|
7119
|
-
]);
|
|
7120
|
-
const nextDeps = Object.entries(deps).reduce((acc, [name, version]) => {
|
|
7121
|
-
if (!excludeDependencyNameList.has(name)) acc[name] = version;
|
|
7122
|
-
return acc;
|
|
7123
|
-
}, {});
|
|
7124
|
-
if (Object.keys(nextDeps).length > 0) return nextDeps;
|
|
7125
|
-
};
|
|
7126
|
-
//#endregion
|
|
7127
|
-
//#region src/datamitsu-config/cmdSetup.ts
|
|
7128
|
-
const yamlIgnore = [
|
|
7129
|
-
"pnpm-lock.yaml",
|
|
7130
|
-
"**/*.sops.yaml",
|
|
7131
|
-
"**/.sops.yml"
|
|
7132
|
-
];
|
|
7753
|
+
//#region src/datamitsu-config/setup/aiTools.ts
|
|
7133
7754
|
const aiTools = {
|
|
7134
7755
|
".cursor/rules": {
|
|
7135
7756
|
linkTarget: "../AGENTS.md",
|
|
7136
|
-
scope: "git-root"
|
|
7137
|
-
},
|
|
7138
|
-
".cursorrules": {
|
|
7139
|
-
linkTarget: "AGENTS.md",
|
|
7140
|
-
scope: "git-root"
|
|
7141
|
-
},
|
|
7142
|
-
".github/copilot-instructions.md": {
|
|
7143
|
-
linkTarget: "../AGENTS.md",
|
|
7144
|
-
scope: "git-root"
|
|
7145
|
-
},
|
|
7146
|
-
".windsurfrules": {
|
|
7147
|
-
linkTarget: "AGENTS.md",
|
|
7148
|
-
scope: "git-root"
|
|
7149
|
-
},
|
|
7150
|
-
"AGENTS.md": {
|
|
7151
|
-
content: (context) => {
|
|
7152
|
-
const existing = context.existingContent ?? context.originalContent;
|
|
7153
|
-
if (existing) return withTrailingNewline(upgradeAgentsReference(existing));
|
|
7154
|
-
return withTrailingNewline(AGENTS_MD);
|
|
7155
|
-
},
|
|
7156
|
-
scope: "git-root"
|
|
7157
|
-
},
|
|
7158
|
-
"CLAUDE.md": {
|
|
7159
|
-
linkTarget: "AGENTS.md",
|
|
7160
|
-
scope: "git-root"
|
|
7161
|
-
},
|
|
7162
|
-
"GEMINI.md": {
|
|
7163
|
-
linkTarget: "AGENTS.md",
|
|
7164
|
-
scope: "git-root"
|
|
7165
|
-
},
|
|
7166
|
-
...Object.fromEntries(SKILLS.map((s) => [`.claude/skills/${s.name}/SKILL.md`, {
|
|
7167
|
-
content: () => withTrailingNewline(s.adapters.claude),
|
|
7168
|
-
scope: "git-root"
|
|
7169
|
-
}])),
|
|
7170
|
-
...Object.fromEntries(SKILLS.map((s) => [`.codex/prompts/${s.name}.md`, {
|
|
7171
|
-
content: () => withTrailingNewline(s.adapters.codex),
|
|
7172
|
-
scope: "git-root"
|
|
7173
|
-
}])),
|
|
7174
|
-
...REMOVED_SKILLS.length > 0 ? { "removed-skills-cleanup": {
|
|
7175
|
-
deleteOnly: true,
|
|
7176
|
-
otherFileNameList: REMOVED_SKILLS.flatMap((name) => [`.claude/skills/${name}/SKILL.md`, `.codex/prompts/${name}.md`]),
|
|
7177
|
-
scope: "git-root"
|
|
7178
|
-
} } : {}
|
|
7179
|
-
};
|
|
7180
|
-
const trufflehogExcludePaths = [
|
|
7181
|
-
"(?:^|/)(?:package-lock\\.json|pnpm-lock\\.yaml|yarn\\.lock|npm-shrinkwrap\\.json|bun\\.lockb?|go\\.sum|Cargo\\.lock|poetry\\.lock|uv\\.lock|Pipfile\\.lock|Gemfile\\.lock|composer\\.lock|mix\\.lock|flake\\.lock|pubspec\\.lock|Podfile\\.lock)$",
|
|
7182
|
-
"(?:^|/)__snapshots__/",
|
|
7183
|
-
"(?:^|/)testdata/",
|
|
7184
|
-
"(?:^|/)fixtures?/",
|
|
7185
|
-
"\\.min\\.(?:js|css)$",
|
|
7186
|
-
"\\.bundle\\.(?:js|css)$"
|
|
7187
|
-
];
|
|
7188
|
-
function escapeRegExp(string) {
|
|
7189
|
-
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7190
|
-
}
|
|
7191
|
-
const setup = {
|
|
7192
|
-
".datamitsu/scripts/check-empty-files.sh": {
|
|
7193
|
-
content: () => {
|
|
7194
|
-
return [
|
|
7195
|
-
"#!/usr/bin/env bash",
|
|
7196
|
-
"",
|
|
7197
|
-
"# Check for empty files",
|
|
7198
|
-
"for file in \"$@\"; do",
|
|
7199
|
-
" if [ ! -f \"$file\" ]; then",
|
|
7200
|
-
" echo \"Error: File not found: $file\"",
|
|
7201
|
-
" exit 1",
|
|
7202
|
-
" fi",
|
|
7203
|
-
"",
|
|
7204
|
-
" # Check if file has no content or only whitespace",
|
|
7205
|
-
` if [ ! -s "$file" ] || [ -z "$(tr -d '[:space:]' < "$file")" ]; then`,
|
|
7206
|
-
" echo \"Error: Empty file detected: $file\"",
|
|
7207
|
-
" exit 1",
|
|
7208
|
-
" fi",
|
|
7209
|
-
"done",
|
|
7210
|
-
"",
|
|
7211
|
-
"exit 0",
|
|
7212
|
-
""
|
|
7213
|
-
].join("\n");
|
|
7214
|
-
},
|
|
7215
|
-
scope: "git-root"
|
|
7216
|
-
},
|
|
7217
|
-
".datamitsu/scripts/format-terraform-spacing.sh": {
|
|
7218
|
-
content: () => {
|
|
7219
|
-
return [
|
|
7220
|
-
"#!/usr/bin/env bash",
|
|
7221
|
-
"",
|
|
7222
|
-
"# Terraform entities that should have blank lines before them",
|
|
7223
|
-
"TERRAFORM_ENTITIES=(",
|
|
7224
|
-
" \"variable\"",
|
|
7225
|
-
" \"resource\"",
|
|
7226
|
-
" \"data\"",
|
|
7227
|
-
" \"output\"",
|
|
7228
|
-
" \"locals\"",
|
|
7229
|
-
" \"module\"",
|
|
7230
|
-
" \"terraform\"",
|
|
7231
|
-
" \"provider\"",
|
|
7232
|
-
")",
|
|
7233
|
-
"",
|
|
7234
|
-
"# Cross-platform sed in-place",
|
|
7235
|
-
"if sed --version 2>/dev/null | grep -q GNU; then",
|
|
7236
|
-
" sed_inplace() { sed -i \"$@\"; }",
|
|
7237
|
-
"else",
|
|
7238
|
-
` sed_inplace() { sed -i '' "$@"; }`,
|
|
7239
|
-
"fi",
|
|
7240
|
-
"",
|
|
7241
|
-
"for file in \"$@\"; do",
|
|
7242
|
-
" # Step 1: Add 3 blank lines before each Terraform entity",
|
|
7243
|
-
" temp_file=$(mktemp)",
|
|
7244
|
-
" cp \"$file\" \"$temp_file\"",
|
|
7245
|
-
"",
|
|
7246
|
-
" for entity in \"${TERRAFORM_ENTITIES[@]}\"; do",
|
|
7247
|
-
" # Match entity at the beginning of line (with optional spaces)",
|
|
7248
|
-
" # Replace with 3 newlines + the matched line",
|
|
7249
|
-
` sed_inplace "s/^[[:space:]]*\${entity}[[:space:]]*\\"/\\n\\n\\n\${entity} \\"/g" "$temp_file"`,
|
|
7250
|
-
" done",
|
|
7251
|
-
"",
|
|
7252
|
-
" # Step 2: Remove duplicate blank lines (keep max 1 consecutive blank line)",
|
|
7253
|
-
` awk 'BEGIN{blank=0} /^[[:space:]]*$/{blank++; if(blank<=1) print; next} {blank=0; print}' "$temp_file" > "$temp_file.2"`,
|
|
7254
|
-
"",
|
|
7255
|
-
" # Step 3: Remove leading blank lines",
|
|
7256
|
-
` sed_inplace '1{/^[[:space:]]*$/d;}' "$temp_file.2"`,
|
|
7257
|
-
"",
|
|
7258
|
-
" # Move the result back to the original file",
|
|
7259
|
-
" mv \"$temp_file.2\" \"$file\"",
|
|
7260
|
-
" rm -f \"$temp_file\"",
|
|
7261
|
-
"done",
|
|
7262
|
-
""
|
|
7263
|
-
].join("\n");
|
|
7264
|
-
},
|
|
7265
|
-
projectTypes: ["terraform-project", "terragrunt-project"],
|
|
7266
|
-
scope: "git-root"
|
|
7267
|
-
},
|
|
7268
|
-
".dockerignore": {
|
|
7269
|
-
content: (context) => {
|
|
7270
|
-
const mergedRules = tools.Ignore.parse([tools.Ignore.stringify(ignoreGroups), filterIgnore(context.originalContent || "")].join("\n"));
|
|
7271
|
-
return tools.Ignore.stringify(mergedRules.groups, mergedRules.groupOrder) + "\n";
|
|
7272
|
-
},
|
|
7273
|
-
scope: "git-root"
|
|
7274
|
-
},
|
|
7275
|
-
".editorconfig": {
|
|
7276
|
-
content: (context) => {
|
|
7277
|
-
const existing = INI.toRecord(INI.parse(context.originalContent || ""));
|
|
7278
|
-
const data = [
|
|
7279
|
-
{
|
|
7280
|
-
name: "DEFAULT",
|
|
7281
|
-
properties: { root: "true" }
|
|
7282
|
-
},
|
|
7283
|
-
{
|
|
7284
|
-
name: "*",
|
|
7285
|
-
properties: {
|
|
7286
|
-
charset: "utf8",
|
|
7287
|
-
end_of_line: "lf",
|
|
7288
|
-
indent_size: String(indentSettings.indentWidth),
|
|
7289
|
-
insert_final_newline: "true",
|
|
7290
|
-
trim_trailing_whitespace: "true",
|
|
7291
|
-
...existing["*"]
|
|
7292
|
-
}
|
|
7293
|
-
},
|
|
7294
|
-
{
|
|
7295
|
-
name: "GNUmakefile",
|
|
7296
|
-
properties: {
|
|
7297
|
-
indent_size: String(indentSettings.indentWidth),
|
|
7298
|
-
indent_style: "tab",
|
|
7299
|
-
...existing["GNUmakefile"]
|
|
7300
|
-
}
|
|
7301
|
-
},
|
|
7302
|
-
{
|
|
7303
|
-
name: "Makefile",
|
|
7304
|
-
properties: {
|
|
7305
|
-
indent_size: String(indentSettings.indentWidth),
|
|
7306
|
-
indent_style: "tab",
|
|
7307
|
-
...existing["Makefile"]
|
|
7308
|
-
}
|
|
7309
|
-
}
|
|
7310
|
-
];
|
|
7311
|
-
return INI.stringify(data);
|
|
7312
|
-
},
|
|
7313
|
-
scope: "git-root",
|
|
7314
|
-
tools: ["editorconfig-checker"]
|
|
7315
|
-
},
|
|
7316
|
-
".editorconfig-checker.json": {
|
|
7317
|
-
content: (context) => {
|
|
7318
|
-
const data = safeJsonParse(context.originalContent);
|
|
7319
|
-
return JSON.stringify({
|
|
7320
|
-
...data,
|
|
7321
|
-
Disable: { ...data.Disable }
|
|
7322
|
-
}, null, 2) + "\n";
|
|
7323
|
-
},
|
|
7324
|
-
scope: "git-root",
|
|
7325
|
-
tools: ["editorconfig-checker"]
|
|
7326
|
-
},
|
|
7327
|
-
".gitignore": {
|
|
7328
|
-
content: (context) => {
|
|
7329
|
-
const mergedRules = tools.Ignore.parse([tools.Ignore.stringify(ignoreGroups), filterIgnore(context.originalContent || "")].join("\n"));
|
|
7330
|
-
return tools.Ignore.stringify(mergedRules.groups, mergedRules.groupOrder) + "\n";
|
|
7331
|
-
},
|
|
7332
|
-
scope: "git-root"
|
|
7333
|
-
},
|
|
7334
|
-
".gitleaks.toml": {
|
|
7335
|
-
content: (context) => {
|
|
7336
|
-
const data = TOML.parse(context.originalContent || "");
|
|
7337
|
-
const MANAGED_EXTEND_PATH = ".datamitsu/gitleaks-managed.toml";
|
|
7338
|
-
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7339
|
-
const existingExtend = isPlainObject(data.extend) ? data.extend : {};
|
|
7340
|
-
const title = typeof data.title === "string" && data.title.length > 0 ? data.title : "Custom Gitleaks configuration";
|
|
7341
|
-
return TOML.stringify({
|
|
7342
|
-
...data,
|
|
7343
|
-
extend: {
|
|
7344
|
-
...existingExtend,
|
|
7345
|
-
path: MANAGED_EXTEND_PATH
|
|
7346
|
-
},
|
|
7347
|
-
title,
|
|
7348
|
-
useDefault: void 0
|
|
7349
|
-
});
|
|
7350
|
-
},
|
|
7351
|
-
otherFileNameList: ["gitleaks.toml"],
|
|
7352
|
-
scope: "git-root",
|
|
7353
|
-
tools: ["gitleaks"]
|
|
7354
|
-
},
|
|
7355
|
-
".golangci.yaml": {
|
|
7356
|
-
content: (context) => {
|
|
7357
|
-
const previous = YAML.parse(context.originalContent || "") ?? {};
|
|
7358
|
-
const prevLinters = previous.linters ?? {};
|
|
7359
|
-
const prevSettings = prevLinters.settings ?? {};
|
|
7360
|
-
const prevExclusions = prevLinters.exclusions ?? {};
|
|
7361
|
-
const baselineEnable = [
|
|
7362
|
-
"asciicheck",
|
|
7363
|
-
"asasalint",
|
|
7364
|
-
"arangolint",
|
|
7365
|
-
"bidichk",
|
|
7366
|
-
"bodyclose",
|
|
7367
|
-
"canonicalheader",
|
|
7368
|
-
"clickhouselint",
|
|
7369
|
-
"containedctx",
|
|
7370
|
-
"contextcheck",
|
|
7371
|
-
"copyloopvar",
|
|
7372
|
-
"decorder",
|
|
7373
|
-
"dogsled",
|
|
7374
|
-
"dupword",
|
|
7375
|
-
"durationcheck",
|
|
7376
|
-
"embeddedstructfieldcheck",
|
|
7377
|
-
"errcheck",
|
|
7378
|
-
"errchkjson",
|
|
7379
|
-
"errname",
|
|
7380
|
-
"errorlint",
|
|
7381
|
-
"exhaustive",
|
|
7382
|
-
"exptostd",
|
|
7383
|
-
"fatcontext",
|
|
7384
|
-
"forcetypeassert",
|
|
7385
|
-
"funcorder",
|
|
7386
|
-
"gocheckcompilerdirectives",
|
|
7387
|
-
"gochecksumtype",
|
|
7388
|
-
"gocritic",
|
|
7389
|
-
"gocyclo",
|
|
7390
|
-
"godoclint",
|
|
7391
|
-
"gomoddirectives",
|
|
7392
|
-
"gomodguard_v2",
|
|
7393
|
-
"goprintffuncname",
|
|
7394
|
-
"gosec",
|
|
7395
|
-
"govet",
|
|
7396
|
-
"ginkgolinter",
|
|
7397
|
-
"grouper",
|
|
7398
|
-
"iface",
|
|
7399
|
-
"importas",
|
|
7400
|
-
"inamedparam",
|
|
7401
|
-
"ineffassign",
|
|
7402
|
-
"interfacebloat",
|
|
7403
|
-
"intrange",
|
|
7404
|
-
"iotamixing",
|
|
7405
|
-
"loggercheck",
|
|
7406
|
-
"makezero",
|
|
7407
|
-
"mirror",
|
|
7408
|
-
"misspell",
|
|
7409
|
-
"modernize",
|
|
7410
|
-
"musttag",
|
|
7411
|
-
"nakedret",
|
|
7412
|
-
"nilerr",
|
|
7413
|
-
"nilnesserr",
|
|
7414
|
-
"nilnil",
|
|
7415
|
-
"noctx",
|
|
7416
|
-
"nolintlint",
|
|
7417
|
-
"nosprintfhostport",
|
|
7418
|
-
"perfsprint",
|
|
7419
|
-
"prealloc",
|
|
7420
|
-
"predeclared",
|
|
7421
|
-
"promlinter",
|
|
7422
|
-
"protogetter",
|
|
7423
|
-
"reassign",
|
|
7424
|
-
"recvcheck",
|
|
7425
|
-
"revive",
|
|
7426
|
-
"rowserrcheck",
|
|
7427
|
-
"sloglint",
|
|
7428
|
-
"spancheck",
|
|
7429
|
-
"sqlclosecheck",
|
|
7430
|
-
"staticcheck",
|
|
7431
|
-
"tagalign",
|
|
7432
|
-
"testableexamples",
|
|
7433
|
-
"testifylint",
|
|
7434
|
-
"thelper",
|
|
7435
|
-
"tparallel",
|
|
7436
|
-
"unconvert",
|
|
7437
|
-
"unparam",
|
|
7438
|
-
"unqueryvet",
|
|
7439
|
-
"unused",
|
|
7440
|
-
"usestdlibvars",
|
|
7441
|
-
"usetesting",
|
|
7442
|
-
"wastedassign",
|
|
7443
|
-
"whitespace",
|
|
7444
|
-
"wrapcheck",
|
|
7445
|
-
"zerologlint"
|
|
7446
|
-
];
|
|
7447
|
-
const baselineDisable = [
|
|
7448
|
-
"cyclop",
|
|
7449
|
-
"dupl",
|
|
7450
|
-
"err113",
|
|
7451
|
-
"exhaustruct",
|
|
7452
|
-
"funlen",
|
|
7453
|
-
"gochecknoglobals",
|
|
7454
|
-
"gochecknoinits",
|
|
7455
|
-
"gocognit",
|
|
7456
|
-
"goconst",
|
|
7457
|
-
"godot",
|
|
7458
|
-
"godox",
|
|
7459
|
-
"goheader",
|
|
7460
|
-
"gosmopolitan",
|
|
7461
|
-
"ireturn",
|
|
7462
|
-
"lll",
|
|
7463
|
-
"maintidx",
|
|
7464
|
-
"mnd",
|
|
7465
|
-
"nestif",
|
|
7466
|
-
"nlreturn",
|
|
7467
|
-
"noinlineerr",
|
|
7468
|
-
"nonamedreturns",
|
|
7469
|
-
"paralleltest",
|
|
7470
|
-
"tagliatelle",
|
|
7471
|
-
"testpackage",
|
|
7472
|
-
"varnamelen",
|
|
7473
|
-
"wsl_v5"
|
|
7474
|
-
];
|
|
7475
|
-
const enable = new Set([...prevLinters.enable ?? [], ...baselineEnable]);
|
|
7476
|
-
const disable = new Set([...prevLinters.disable ?? [], ...baselineDisable]);
|
|
7477
|
-
for (const name of baselineEnable) disable.delete(name);
|
|
7478
|
-
for (const name of baselineDisable) enable.delete(name);
|
|
7479
|
-
for (const name of enable) disable.delete(name);
|
|
7480
|
-
const baselineExclusionRules = [
|
|
7481
|
-
{
|
|
7482
|
-
linters: [
|
|
7483
|
-
"noctx",
|
|
7484
|
-
"errchkjson",
|
|
7485
|
-
"forcetypeassert",
|
|
7486
|
-
"dogsled"
|
|
7487
|
-
],
|
|
7488
|
-
path: "_test\\.go"
|
|
7489
|
-
},
|
|
7490
|
-
{
|
|
7491
|
-
linters: ["gocyclo", "unparam"],
|
|
7492
|
-
path: "_test\\.go"
|
|
7493
|
-
},
|
|
7494
|
-
{
|
|
7495
|
-
linters: ["gosec"],
|
|
7496
|
-
path: "_test\\.go"
|
|
7497
|
-
},
|
|
7498
|
-
{
|
|
7499
|
-
linters: ["wrapcheck"],
|
|
7500
|
-
path: "_test\\.go"
|
|
7501
|
-
}
|
|
7502
|
-
];
|
|
7503
|
-
const seenRules = /* @__PURE__ */ new Set();
|
|
7504
|
-
const exclusionRules = [...prevExclusions.rules ?? [], ...baselineExclusionRules].filter((rule) => {
|
|
7505
|
-
const key = JSON.stringify(rule);
|
|
7506
|
-
if (seenRules.has(key)) return false;
|
|
7507
|
-
seenRules.add(key);
|
|
7508
|
-
return true;
|
|
7509
|
-
});
|
|
7510
|
-
const reviveRules = [
|
|
7511
|
-
"blank-imports",
|
|
7512
|
-
"context-as-argument",
|
|
7513
|
-
"context-keys-type",
|
|
7514
|
-
"dot-imports",
|
|
7515
|
-
"empty-block",
|
|
7516
|
-
"error-naming",
|
|
7517
|
-
"error-return",
|
|
7518
|
-
"error-strings",
|
|
7519
|
-
"errorf",
|
|
7520
|
-
"exported",
|
|
7521
|
-
"increment-decrement",
|
|
7522
|
-
"indent-error-flow",
|
|
7523
|
-
"package-comments",
|
|
7524
|
-
"range",
|
|
7525
|
-
"receiver-naming",
|
|
7526
|
-
"redefines-builtin-id",
|
|
7527
|
-
"superfluous-else",
|
|
7528
|
-
"time-naming",
|
|
7529
|
-
"unexported-return",
|
|
7530
|
-
"unreachable-code",
|
|
7531
|
-
"var-declaration",
|
|
7532
|
-
"var-naming"
|
|
7533
|
-
].map((name) => ({ name }));
|
|
7534
|
-
return YAML.stringify({
|
|
7535
|
-
...previous,
|
|
7536
|
-
formatters: {
|
|
7537
|
-
...previous.formatters,
|
|
7538
|
-
enable: [...new Set([
|
|
7539
|
-
...previous.formatters?.enable ?? [],
|
|
7540
|
-
"gofmt",
|
|
7541
|
-
"gofumpt",
|
|
7542
|
-
"goimports",
|
|
7543
|
-
"swaggo"
|
|
7544
|
-
])]
|
|
7545
|
-
},
|
|
7546
|
-
linters: {
|
|
7547
|
-
...prevLinters,
|
|
7548
|
-
disable: [...disable].sort(),
|
|
7549
|
-
enable: [...enable].sort(),
|
|
7550
|
-
exclusions: {
|
|
7551
|
-
...prevExclusions,
|
|
7552
|
-
rules: exclusionRules
|
|
7553
|
-
},
|
|
7554
|
-
settings: {
|
|
7555
|
-
gocyclo: { "min-complexity": 20 },
|
|
7556
|
-
revive: { rules: reviveRules },
|
|
7557
|
-
...prevSettings
|
|
7558
|
-
}
|
|
7559
|
-
},
|
|
7560
|
-
version: "2"
|
|
7561
|
-
});
|
|
7562
|
-
},
|
|
7563
|
-
otherFileNameList: [
|
|
7564
|
-
".golangci.yml",
|
|
7565
|
-
".golangci.yaml",
|
|
7566
|
-
".golangci.toml",
|
|
7567
|
-
".golangci.json"
|
|
7568
|
-
],
|
|
7569
|
-
projectTypes: ["golang-package"],
|
|
7570
|
-
tools: ["golangci-lint", "golangci-lint-fmt"]
|
|
7571
|
-
},
|
|
7572
|
-
".node-version": {
|
|
7573
|
-
content: () => {
|
|
7574
|
-
return runtimeVersions.node + "\n";
|
|
7575
|
-
},
|
|
7576
|
-
scope: "git-root"
|
|
7577
|
-
},
|
|
7578
|
-
".npmrc": {
|
|
7579
|
-
content: () => {
|
|
7580
|
-
return Object.entries({ registry: "https://registry.npmjs.org/" }).sort((a, b) => a[0].localeCompare(b[0])).reduce((acc, [key, value]) => {
|
|
7581
|
-
acc.push(`${key}=${value}`);
|
|
7582
|
-
return acc;
|
|
7583
|
-
}, []).join("\n") + "\n";
|
|
7584
|
-
},
|
|
7585
|
-
projectTypes: ["npm-package"],
|
|
7586
|
-
scope: "git-root"
|
|
7587
|
-
},
|
|
7588
|
-
".oxlintrc.json": {
|
|
7589
|
-
content: (context) => {
|
|
7590
|
-
const previousConfig = safeJsonParse(context.originalContent);
|
|
7591
|
-
return JSON.stringify({
|
|
7592
|
-
...oxlintConfig,
|
|
7593
|
-
...env().DATAMITSU_DEV_MODE ? { rules: oxlintConfig.rules } : {
|
|
7594
|
-
extends: [tools.Path.forImport(tools.Path.join(context.datamitsuDir, ".oxlintrc.json"))],
|
|
7595
|
-
rules: previousConfig.rules
|
|
7596
|
-
},
|
|
7597
|
-
$schema: tools.Path.forImport(tools.Path.join(context.datamitsuDir, "oxlint_configuration_schema.json"))
|
|
7598
|
-
}, null, 2) + "\n";
|
|
7599
|
-
},
|
|
7600
|
-
projectTypes: ["npm-package"],
|
|
7601
|
-
tools: ["oxlint"]
|
|
7602
|
-
},
|
|
7603
|
-
".syncpackrc.json": {
|
|
7604
|
-
content: () => {
|
|
7605
|
-
return JSON.stringify({
|
|
7606
|
-
semverGroups: [{
|
|
7607
|
-
dependencies: ["**"],
|
|
7608
|
-
dependencyTypes: ["**"],
|
|
7609
|
-
packages: ["**"],
|
|
7610
|
-
range: ""
|
|
7611
|
-
}],
|
|
7612
|
-
versionGroups: [{
|
|
7613
|
-
dependencies: ["$LOCAL"],
|
|
7614
|
-
dependencyTypes: ["!local"],
|
|
7615
|
-
label: "use workspace protocol for local packages",
|
|
7616
|
-
pinVersion: "workspace:*"
|
|
7617
|
-
}]
|
|
7618
|
-
}, null, 2) + "\n";
|
|
7619
|
-
},
|
|
7620
|
-
otherFileNameList: [
|
|
7621
|
-
".syncpackrc",
|
|
7622
|
-
".syncpackrc.json",
|
|
7623
|
-
".syncpackrc.yaml",
|
|
7624
|
-
".syncpackrc.yml",
|
|
7625
|
-
".syncpackrc.js",
|
|
7626
|
-
".syncpackrc.ts",
|
|
7627
|
-
".syncpackrc.mjs",
|
|
7628
|
-
".syncpackrc.cjs",
|
|
7629
|
-
"syncpack.config.js",
|
|
7630
|
-
"syncpack.config.cjs",
|
|
7631
|
-
"syncpack.config.ts",
|
|
7632
|
-
"syncpack.config.mjs"
|
|
7633
|
-
],
|
|
7634
|
-
projectTypes: ["npm-package"],
|
|
7635
|
-
scope: "git-root",
|
|
7636
|
-
tools: ["syncpack"]
|
|
7757
|
+
scope: "git-root"
|
|
7637
7758
|
},
|
|
7638
|
-
".
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
if (existing.trim().length > 0) return existing;
|
|
7642
|
-
return [
|
|
7643
|
-
`plugin "terraform" {`,
|
|
7644
|
-
` enabled = true`,
|
|
7645
|
-
` preset = "recommended"`,
|
|
7646
|
-
`}`,
|
|
7647
|
-
``
|
|
7648
|
-
].join("\n");
|
|
7649
|
-
},
|
|
7650
|
-
projectTypes: ["terraform-project"],
|
|
7651
|
-
scope: "git-root",
|
|
7652
|
-
tools: ["tflint"]
|
|
7759
|
+
".cursorrules": {
|
|
7760
|
+
linkTarget: "AGENTS.md",
|
|
7761
|
+
scope: "git-root"
|
|
7653
7762
|
},
|
|
7654
|
-
".
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
return TOML.stringify({
|
|
7658
|
-
...data,
|
|
7659
|
-
"toml-version": "v1.1.0"
|
|
7660
|
-
});
|
|
7661
|
-
},
|
|
7662
|
-
otherFileNameList: ["tombi.toml", ".tombi.toml"],
|
|
7663
|
-
scope: "git-root",
|
|
7664
|
-
tools: ["tombi"]
|
|
7763
|
+
".github/copilot-instructions.md": {
|
|
7764
|
+
linkTarget: "../AGENTS.md",
|
|
7765
|
+
scope: "git-root"
|
|
7665
7766
|
},
|
|
7666
|
-
".
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
const MANAGED_END = "# END datamitsu managed";
|
|
7670
|
-
const managedBlock = [
|
|
7671
|
-
MANAGED_BEGIN,
|
|
7672
|
-
...trufflehogExcludePaths,
|
|
7673
|
-
MANAGED_END
|
|
7674
|
-
].join("\n");
|
|
7675
|
-
const userContent = (context.originalContent || "").replace(new RegExp(`${escapeRegExp(MANAGED_BEGIN)}[\\s\\S]*?${escapeRegExp(MANAGED_END)}\\n?`, "g"), "").trim();
|
|
7676
|
-
return userContent.length > 0 ? `${managedBlock}\n\n${userContent}\n` : `${managedBlock}\n`;
|
|
7677
|
-
},
|
|
7678
|
-
scope: "git-root",
|
|
7679
|
-
tools: ["trufflehog"]
|
|
7767
|
+
".windsurfrules": {
|
|
7768
|
+
linkTarget: "AGENTS.md",
|
|
7769
|
+
scope: "git-root"
|
|
7680
7770
|
},
|
|
7681
|
-
".
|
|
7771
|
+
"AGENTS.md": {
|
|
7682
7772
|
content: (context) => {
|
|
7683
|
-
const existing =
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
properties: {
|
|
7687
|
-
MinAlertLevel: "suggestion",
|
|
7688
|
-
...existing["DEFAULT"]
|
|
7689
|
-
}
|
|
7690
|
-
}, {
|
|
7691
|
-
name: "*.{md,markdown}",
|
|
7692
|
-
properties: {
|
|
7693
|
-
BasedOnStyles: "Vale",
|
|
7694
|
-
...existing["*.{md,markdown}"]
|
|
7695
|
-
}
|
|
7696
|
-
}];
|
|
7697
|
-
return INI.stringify(data);
|
|
7773
|
+
const existing = context.existingContent ?? context.originalContent;
|
|
7774
|
+
if (existing) return withTrailingNewline(upgradeAgentsReference(existing));
|
|
7775
|
+
return withTrailingNewline(AGENTS_MD);
|
|
7698
7776
|
},
|
|
7699
|
-
otherFileNameList: ["_vale.ini", "vale.ini"],
|
|
7700
|
-
scope: "git-root",
|
|
7701
|
-
tools: ["vale"]
|
|
7702
|
-
},
|
|
7703
|
-
".vscode/extensions.json": {
|
|
7704
|
-
content: vscodeExtensions,
|
|
7705
7777
|
scope: "git-root"
|
|
7706
7778
|
},
|
|
7707
|
-
".
|
|
7708
|
-
|
|
7779
|
+
"CLAUDE.md": {
|
|
7780
|
+
linkTarget: "AGENTS.md",
|
|
7709
7781
|
scope: "git-root"
|
|
7710
7782
|
},
|
|
7711
|
-
".
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
const formatter = Object.fromEntries(Object.entries({
|
|
7715
|
-
...data?.formatter,
|
|
7716
|
-
array_indent: indentSettings.indentWidth,
|
|
7717
|
-
eof_newline: true,
|
|
7718
|
-
force_array_style: "block",
|
|
7719
|
-
force_quote_style: "double",
|
|
7720
|
-
indent: indentSettings.indentWidth,
|
|
7721
|
-
line_ending: "lf",
|
|
7722
|
-
pad_line_comments: 1,
|
|
7723
|
-
retain_line_breaks_single: false,
|
|
7724
|
-
trim_trailing_whitespace: true,
|
|
7725
|
-
type: "basic"
|
|
7726
|
-
}).sort(([a], [b]) => a.localeCompare(b)));
|
|
7727
|
-
return YAML.stringify(Object.fromEntries(Object.entries({
|
|
7728
|
-
...data,
|
|
7729
|
-
exclude: yamlIgnore,
|
|
7730
|
-
formatter
|
|
7731
|
-
}).sort(([a], [b]) => a.localeCompare(b))));
|
|
7732
|
-
},
|
|
7733
|
-
otherFileNameList: [
|
|
7734
|
-
".yamlfmt",
|
|
7735
|
-
"yamlfmt.yml",
|
|
7736
|
-
"yamlfmt.yaml",
|
|
7737
|
-
".yamlfmt.yml"
|
|
7738
|
-
],
|
|
7739
|
-
scope: "git-root",
|
|
7740
|
-
tools: ["yamlfmt"]
|
|
7741
|
-
},
|
|
7742
|
-
".yamllint.yaml": {
|
|
7743
|
-
content: (context) => {
|
|
7744
|
-
const data = YAML.parse(context.originalContent || "");
|
|
7745
|
-
const rules = Object.fromEntries(Object.entries({
|
|
7746
|
-
...data?.rules,
|
|
7747
|
-
comments: { "min-spaces-from-content": 1 },
|
|
7748
|
-
"comments-indentation": "enable",
|
|
7749
|
-
"document-end": "disable",
|
|
7750
|
-
"document-start": "disable",
|
|
7751
|
-
"empty-lines": { max: 1 },
|
|
7752
|
-
indentation: {
|
|
7753
|
-
"indent-sequences": true,
|
|
7754
|
-
spaces: indentSettings.indentWidth
|
|
7755
|
-
},
|
|
7756
|
-
"key-ordering": "disable",
|
|
7757
|
-
"line-length": "disable",
|
|
7758
|
-
truthy: {
|
|
7759
|
-
"check-keys": false,
|
|
7760
|
-
level: "error"
|
|
7761
|
-
}
|
|
7762
|
-
}).sort(([a], [b]) => a.localeCompare(b)));
|
|
7763
|
-
return YAML.stringify(Object.fromEntries(Object.entries({
|
|
7764
|
-
...data,
|
|
7765
|
-
extends: "default",
|
|
7766
|
-
ignore: yamlIgnore.join("\n") + "\n",
|
|
7767
|
-
rules
|
|
7768
|
-
}).sort(([a], [b]) => a.localeCompare(b))));
|
|
7769
|
-
},
|
|
7770
|
-
otherFileNameList: [".yamllint", ".yamllint.yml"],
|
|
7771
|
-
scope: "git-root",
|
|
7772
|
-
tools: ["yamllint"]
|
|
7783
|
+
"GEMINI.md": {
|
|
7784
|
+
linkTarget: "AGENTS.md",
|
|
7785
|
+
scope: "git-root"
|
|
7773
7786
|
},
|
|
7774
|
-
|
|
7775
|
-
content: (
|
|
7776
|
-
|
|
7787
|
+
...Object.fromEntries(SKILLS.map((s) => [`.claude/skills/${s.name}/SKILL.md`, {
|
|
7788
|
+
content: () => withTrailingNewline(s.adapters.claude),
|
|
7789
|
+
scope: "git-root"
|
|
7790
|
+
}])),
|
|
7791
|
+
...Object.fromEntries(SKILLS.map((s) => [`.codex/prompts/${s.name}.md`, {
|
|
7792
|
+
content: () => withTrailingNewline(s.adapters.codex),
|
|
7793
|
+
scope: "git-root"
|
|
7794
|
+
}])),
|
|
7795
|
+
...REMOVED_SKILLS.length > 0 ? { "removed-skills-cleanup": {
|
|
7796
|
+
deleteOnly: true,
|
|
7797
|
+
otherFileNameList: REMOVED_SKILLS.flatMap((name) => [`.claude/skills/${name}/SKILL.md`, `.codex/prompts/${name}.md`]),
|
|
7798
|
+
scope: "git-root"
|
|
7799
|
+
} } : {}
|
|
7800
|
+
};
|
|
7801
|
+
//#endregion
|
|
7802
|
+
//#region src/datamitsu-config/setup/commitlint_config_mjs.ts
|
|
7803
|
+
const commitlintConfigMjs = {
|
|
7804
|
+
content: (context) => {
|
|
7805
|
+
return `import { defineConfig } from "${tools.Path.forImport(tools.Path.join(context.datamitsuDir, "commitlint.config.js"))}";
|
|
7777
7806
|
|
|
7778
7807
|
export default defineConfig();
|
|
7779
7808
|
`;
|
|
7780
|
-
},
|
|
7781
|
-
otherFileNameList: [
|
|
7782
|
-
".commitlintrc",
|
|
7783
|
-
".commitlintrc.json",
|
|
7784
|
-
".commitlintrc.yaml",
|
|
7785
|
-
".commitlintrc.yml",
|
|
7786
|
-
".commitlintrc.js",
|
|
7787
|
-
".commitlintrc.cjs",
|
|
7788
|
-
".commitlintrc.mjs",
|
|
7789
|
-
".commitlintrc.ts",
|
|
7790
|
-
".commitlintrc.cts",
|
|
7791
|
-
".commitlintrc.mts",
|
|
7792
|
-
"commitlint.config.js",
|
|
7793
|
-
"commitlint.config.cjs",
|
|
7794
|
-
"commitlint.config.mjs",
|
|
7795
|
-
"commitlint.config.ts",
|
|
7796
|
-
"commitlint.config.cts",
|
|
7797
|
-
"commitlint.config.mts"
|
|
7798
|
-
],
|
|
7799
|
-
scope: "git-root"
|
|
7800
7809
|
},
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7810
|
+
otherFileNameList: [
|
|
7811
|
+
".commitlintrc",
|
|
7812
|
+
".commitlintrc.json",
|
|
7813
|
+
".commitlintrc.yaml",
|
|
7814
|
+
".commitlintrc.yml",
|
|
7815
|
+
".commitlintrc.js",
|
|
7816
|
+
".commitlintrc.cjs",
|
|
7817
|
+
".commitlintrc.mjs",
|
|
7818
|
+
".commitlintrc.ts",
|
|
7819
|
+
".commitlintrc.cts",
|
|
7820
|
+
".commitlintrc.mts",
|
|
7821
|
+
"commitlint.config.js",
|
|
7822
|
+
"commitlint.config.cjs",
|
|
7823
|
+
"commitlint.config.mjs",
|
|
7824
|
+
"commitlint.config.ts",
|
|
7825
|
+
"commitlint.config.cts",
|
|
7826
|
+
"commitlint.config.mts"
|
|
7827
|
+
],
|
|
7828
|
+
scope: "git-root"
|
|
7829
|
+
};
|
|
7830
|
+
//#endregion
|
|
7831
|
+
//#region src/datamitsu-config/setup/cspell_config_mjs.ts
|
|
7832
|
+
const cspellConfigMjs = {
|
|
7833
|
+
content: (context) => {
|
|
7834
|
+
return `import { defineConfig } from "${tools.Path.forImport(tools.Path.join(context.datamitsuDir, "cspell.config.mjs"))}";
|
|
7804
7835
|
|
|
7805
7836
|
export default defineConfig();
|
|
7806
7837
|
`;
|
|
7807
|
-
},
|
|
7808
|
-
otherFileNameList: [
|
|
7809
|
-
".cspell.config.yaml",
|
|
7810
|
-
".cspell.config.yml",
|
|
7811
|
-
"cspell.config.yaml",
|
|
7812
|
-
"cspell.config.yml",
|
|
7813
|
-
".cspell.yaml",
|
|
7814
|
-
".cspell.yml",
|
|
7815
|
-
"cspell.yaml",
|
|
7816
|
-
"cspell.yml",
|
|
7817
|
-
".cspell.json",
|
|
7818
|
-
"cspell.json",
|
|
7819
|
-
".cSpell.json",
|
|
7820
|
-
"cSpell.json",
|
|
7821
|
-
".cspell.jsonc",
|
|
7822
|
-
"cspell.jsonc",
|
|
7823
|
-
".cspell.config.json",
|
|
7824
|
-
".cspell.config.jsonc",
|
|
7825
|
-
"cspell.config.json",
|
|
7826
|
-
"cspell.config.jsonc",
|
|
7827
|
-
"cspell.config.mjs",
|
|
7828
|
-
"cspell.config.cjs",
|
|
7829
|
-
".cspell.config.mjs",
|
|
7830
|
-
".cspell.config.cjs",
|
|
7831
|
-
".cspell.config.js",
|
|
7832
|
-
"cspell.config.mts",
|
|
7833
|
-
"cspell.config.ts",
|
|
7834
|
-
"cspell.config.cts",
|
|
7835
|
-
".cspell.config.mts",
|
|
7836
|
-
".cspell.config.ts",
|
|
7837
|
-
".cspell.config.cts",
|
|
7838
|
-
"cspell.config.toml",
|
|
7839
|
-
".cspell.config.toml"
|
|
7840
|
-
],
|
|
7841
|
-
scope: "git-root",
|
|
7842
|
-
tools: ["cspell"]
|
|
7843
|
-
},
|
|
7844
|
-
"deprecated-configs": {
|
|
7845
|
-
deleteOnly: true,
|
|
7846
|
-
otherFileNameList: [
|
|
7847
|
-
".babelrc",
|
|
7848
|
-
".babelrc.js",
|
|
7849
|
-
"babel.config.js",
|
|
7850
|
-
".lintstagedrc",
|
|
7851
|
-
".lintstagedrc.json",
|
|
7852
|
-
".lintstagedrc.yaml",
|
|
7853
|
-
".lintstagedrc.yml",
|
|
7854
|
-
".lintstagedrc.mjs",
|
|
7855
|
-
"lint-staged.config.mjs",
|
|
7856
|
-
".lintstagedrc.cjs",
|
|
7857
|
-
"lint-staged.config.cjs",
|
|
7858
|
-
"lint-staged.config.js",
|
|
7859
|
-
".lintstagedrc.js",
|
|
7860
|
-
".husky",
|
|
7861
|
-
".taplo.toml",
|
|
7862
|
-
"taplo.toml"
|
|
7863
|
-
]
|
|
7864
7838
|
},
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7839
|
+
otherFileNameList: [
|
|
7840
|
+
".cspell.config.yaml",
|
|
7841
|
+
".cspell.config.yml",
|
|
7842
|
+
"cspell.config.yaml",
|
|
7843
|
+
"cspell.config.yml",
|
|
7844
|
+
".cspell.yaml",
|
|
7845
|
+
".cspell.yml",
|
|
7846
|
+
"cspell.yaml",
|
|
7847
|
+
"cspell.yml",
|
|
7848
|
+
".cspell.json",
|
|
7849
|
+
"cspell.json",
|
|
7850
|
+
".cSpell.json",
|
|
7851
|
+
"cSpell.json",
|
|
7852
|
+
".cspell.jsonc",
|
|
7853
|
+
"cspell.jsonc",
|
|
7854
|
+
".cspell.config.json",
|
|
7855
|
+
".cspell.config.jsonc",
|
|
7856
|
+
"cspell.config.json",
|
|
7857
|
+
"cspell.config.jsonc",
|
|
7858
|
+
"cspell.config.mjs",
|
|
7859
|
+
"cspell.config.cjs",
|
|
7860
|
+
".cspell.config.mjs",
|
|
7861
|
+
".cspell.config.cjs",
|
|
7862
|
+
".cspell.config.js",
|
|
7863
|
+
"cspell.config.mts",
|
|
7864
|
+
"cspell.config.ts",
|
|
7865
|
+
"cspell.config.cts",
|
|
7866
|
+
".cspell.config.mts",
|
|
7867
|
+
".cspell.config.ts",
|
|
7868
|
+
".cspell.config.cts",
|
|
7869
|
+
"cspell.config.toml",
|
|
7870
|
+
".cspell.config.toml"
|
|
7871
|
+
],
|
|
7872
|
+
scope: "git-root",
|
|
7873
|
+
tools: ["cspell"]
|
|
7874
|
+
};
|
|
7875
|
+
//#endregion
|
|
7876
|
+
//#region src/datamitsu-config/setup/deprecated_configs.ts
|
|
7877
|
+
const deprecatedConfigs = {
|
|
7878
|
+
deleteOnly: true,
|
|
7879
|
+
otherFileNameList: [
|
|
7880
|
+
".babelrc",
|
|
7881
|
+
".babelrc.js",
|
|
7882
|
+
"babel.config.js",
|
|
7883
|
+
".lintstagedrc",
|
|
7884
|
+
".lintstagedrc.json",
|
|
7885
|
+
".lintstagedrc.yaml",
|
|
7886
|
+
".lintstagedrc.yml",
|
|
7887
|
+
".lintstagedrc.mjs",
|
|
7888
|
+
"lint-staged.config.mjs",
|
|
7889
|
+
".lintstagedrc.cjs",
|
|
7890
|
+
"lint-staged.config.cjs",
|
|
7891
|
+
"lint-staged.config.js",
|
|
7892
|
+
".lintstagedrc.js",
|
|
7893
|
+
".husky",
|
|
7894
|
+
".taplo.toml",
|
|
7895
|
+
"taplo.toml"
|
|
7896
|
+
]
|
|
7897
|
+
};
|
|
7898
|
+
//#endregion
|
|
7899
|
+
//#region src/datamitsu-config/setup/eslint_config_mjs.ts
|
|
7900
|
+
const eslintConfigMjs = {
|
|
7901
|
+
content: (context) => {
|
|
7902
|
+
return `import { join } from "node:path";
|
|
7901
7903
|
|
|
7902
7904
|
import { defineConfig } from "${tools.Path.forImport(tools.Path.join(context.datamitsuDir, "eslint.config.mjs"))}";
|
|
7903
7905
|
|
|
@@ -7917,194 +7919,245 @@ export default [
|
|
|
7917
7919
|
|
|
7918
7920
|
export default config;
|
|
7919
7921
|
`;
|
|
7920
|
-
},
|
|
7921
|
-
otherFileNameList: [
|
|
7922
|
-
"eslint.config.js",
|
|
7923
|
-
"eslint.config.mjs",
|
|
7924
|
-
"eslint.config.cjs",
|
|
7925
|
-
"eslint.config.ts",
|
|
7926
|
-
"eslint.config.mts",
|
|
7927
|
-
"eslint.config.cts",
|
|
7928
|
-
".eslintrc.js",
|
|
7929
|
-
".eslintrc.cjs",
|
|
7930
|
-
".eslintrc.yaml",
|
|
7931
|
-
".eslintrc.yml",
|
|
7932
|
-
".eslintrc.json"
|
|
7933
|
-
],
|
|
7934
|
-
projectTypes: ["npm-package"],
|
|
7935
|
-
tools: ["eslint"]
|
|
7936
|
-
},
|
|
7937
|
-
"hadolint.yaml": {
|
|
7938
|
-
content: (context) => {
|
|
7939
|
-
const data = YAML.parse(context.originalContent || "");
|
|
7940
|
-
return YAML.stringify({ ...data });
|
|
7941
|
-
},
|
|
7942
|
-
otherFileNameList: [
|
|
7943
|
-
".hadolint.yaml",
|
|
7944
|
-
"hadolint.yaml",
|
|
7945
|
-
".config/hadolint.yaml",
|
|
7946
|
-
".hadolint/hadolint.yaml"
|
|
7947
|
-
],
|
|
7948
|
-
scope: "git-root",
|
|
7949
|
-
tools: ["hadolint"]
|
|
7950
|
-
},
|
|
7951
|
-
"knip.config.js": {
|
|
7952
|
-
content: (context) => {
|
|
7953
|
-
return [
|
|
7954
|
-
`import { defineConfig } from "${tools.Path.forImport(tools.Path.join(context.datamitsuDir, "knip.config.js"))}";`,
|
|
7955
|
-
"",
|
|
7956
|
-
`export default defineConfig(${env().DATAMITSU_DEV_MODE ? JSON.stringify({
|
|
7957
|
-
ignoreBinaries: ["bin/datamitsu.js"],
|
|
7958
|
-
ignoreDependencies: [
|
|
7959
|
-
"@commitlint/cli",
|
|
7960
|
-
"syncpack",
|
|
7961
|
-
"type-fest",
|
|
7962
|
-
"@octokit/rest",
|
|
7963
|
-
"publint",
|
|
7964
|
-
"sort-package-json",
|
|
7965
|
-
"eslint-config-prettier",
|
|
7966
|
-
"eslint-plugin-array-func",
|
|
7967
|
-
"eslint-plugin-import",
|
|
7968
|
-
"eslint-plugin-json",
|
|
7969
|
-
"eslint-plugin-json-schema-validator",
|
|
7970
|
-
"eslint-plugin-jsx-a11y",
|
|
7971
|
-
"eslint-plugin-n",
|
|
7972
|
-
"eslint-plugin-no-use-extend-native",
|
|
7973
|
-
"eslint-plugin-perfectionist",
|
|
7974
|
-
"eslint-plugin-playwright",
|
|
7975
|
-
"eslint-plugin-promise",
|
|
7976
|
-
"eslint-plugin-react",
|
|
7977
|
-
"eslint-plugin-react-hooks",
|
|
7978
|
-
"eslint-plugin-react-perf",
|
|
7979
|
-
"prettier-plugin-embed",
|
|
7980
|
-
"prettier-plugin-jsdoc",
|
|
7981
|
-
"prettier-plugin-sql",
|
|
7982
|
-
"eslint-plugin-react-prefer-function-component",
|
|
7983
|
-
"eslint-plugin-react-refresh",
|
|
7984
|
-
"eslint-plugin-security",
|
|
7985
|
-
"eslint-plugin-sonarjs",
|
|
7986
|
-
"eslint-plugin-storybook",
|
|
7987
|
-
"eslint-plugin-turbo",
|
|
7988
|
-
"@prettier/plugin-xml",
|
|
7989
|
-
"eslint-plugin-unicorn",
|
|
7990
|
-
"eslint-plugin-unused-imports",
|
|
7991
|
-
"@antebudimir/eslint-plugin-vanilla-extract"
|
|
7992
|
-
]
|
|
7993
|
-
}, null, 2) : ""});`,
|
|
7994
|
-
""
|
|
7995
|
-
].join("\n");
|
|
7996
|
-
},
|
|
7997
|
-
otherFileNameList: [
|
|
7998
|
-
"knip.json",
|
|
7999
|
-
"knip.jsonc",
|
|
8000
|
-
".knip.json",
|
|
8001
|
-
".knip.jsonc",
|
|
8002
|
-
"knip.ts",
|
|
8003
|
-
"knip.js",
|
|
8004
|
-
"knip.config.ts",
|
|
8005
|
-
"knip.config.js"
|
|
8006
|
-
],
|
|
8007
|
-
projectTypes: ["npm-package"],
|
|
8008
|
-
scope: "git-root",
|
|
8009
|
-
tools: ["knip"]
|
|
8010
7922
|
},
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
7923
|
+
otherFileNameList: [
|
|
7924
|
+
"eslint.config.js",
|
|
7925
|
+
"eslint.config.mjs",
|
|
7926
|
+
"eslint.config.cjs",
|
|
7927
|
+
"eslint.config.ts",
|
|
7928
|
+
"eslint.config.mts",
|
|
7929
|
+
"eslint.config.cts",
|
|
7930
|
+
".eslintrc.js",
|
|
7931
|
+
".eslintrc.cjs",
|
|
7932
|
+
".eslintrc.yaml",
|
|
7933
|
+
".eslintrc.yml",
|
|
7934
|
+
".eslintrc.json"
|
|
7935
|
+
],
|
|
7936
|
+
projectTypes: ["npm-package"],
|
|
7937
|
+
tools: ["eslint"]
|
|
7938
|
+
};
|
|
7939
|
+
//#endregion
|
|
7940
|
+
//#region src/datamitsu-config/setup/hadolint_yaml.ts
|
|
7941
|
+
const hadolintYaml = {
|
|
7942
|
+
content: (context) => {
|
|
7943
|
+
const data = YAML.parse(context.originalContent || "");
|
|
7944
|
+
return YAML.stringify({ ...data });
|
|
7945
|
+
},
|
|
7946
|
+
otherFileNameList: [
|
|
7947
|
+
".hadolint.yaml",
|
|
7948
|
+
"hadolint.yaml",
|
|
7949
|
+
".config/hadolint.yaml",
|
|
7950
|
+
".hadolint/hadolint.yaml"
|
|
7951
|
+
],
|
|
7952
|
+
scope: "git-root",
|
|
7953
|
+
tools: ["hadolint"]
|
|
7954
|
+
};
|
|
7955
|
+
//#endregion
|
|
7956
|
+
//#region src/datamitsu-config/setup/knip_config_js.ts
|
|
7957
|
+
const knipConfigJs = {
|
|
7958
|
+
content: (context) => {
|
|
7959
|
+
return [
|
|
7960
|
+
`import { defineConfig } from "${tools.Path.forImport(tools.Path.join(context.datamitsuDir, "knip.config.js"))}";`,
|
|
7961
|
+
"",
|
|
7962
|
+
`export default defineConfig();`,
|
|
7963
|
+
""
|
|
7964
|
+
].join("\n");
|
|
7965
|
+
},
|
|
7966
|
+
otherFileNameList: [
|
|
7967
|
+
"knip.json",
|
|
7968
|
+
"knip.jsonc",
|
|
7969
|
+
".knip.json",
|
|
7970
|
+
".knip.jsonc",
|
|
7971
|
+
"knip.ts",
|
|
7972
|
+
"knip.js",
|
|
7973
|
+
"knip.config.ts",
|
|
7974
|
+
"knip.config.js"
|
|
7975
|
+
],
|
|
7976
|
+
projectTypes: ["npm-package"],
|
|
7977
|
+
scope: "git-root",
|
|
7978
|
+
tools: ["knip"]
|
|
7979
|
+
};
|
|
7980
|
+
//#endregion
|
|
7981
|
+
//#region src/datamitsu-config/setup/lefthook_yaml.ts
|
|
7982
|
+
const lefthookYaml = {
|
|
7983
|
+
content: (context) => {
|
|
7984
|
+
const existing = YAML.parse(context.originalContent || "");
|
|
7985
|
+
return YAML.stringify({
|
|
7986
|
+
...existing,
|
|
7987
|
+
"commit-msg": { commands: { "lint commit message": { run: `${facts().binaryCommand} exec commitlint -- --edit {1}` } } },
|
|
7988
|
+
"post-checkout": { commands: {
|
|
7989
|
+
[`init ${facts().packageName}`]: {
|
|
7990
|
+
priority: 2,
|
|
7991
|
+
run: `${facts().binaryCommand} init`
|
|
7992
|
+
},
|
|
7993
|
+
"install deps": {
|
|
7994
|
+
priority: 1,
|
|
7995
|
+
run: `pnpm i -y`
|
|
7996
|
+
}
|
|
7997
|
+
} },
|
|
7998
|
+
"pre-commit": {
|
|
7999
|
+
commands: {
|
|
8000
|
+
...existing?.["pre-commit"]?.commands,
|
|
8001
|
+
[`${facts().packageName}-check`]: {
|
|
8019
8002
|
priority: 2,
|
|
8020
|
-
run: `${facts().binaryCommand}
|
|
8003
|
+
run: `${facts().binaryCommand} check --file-scoped`,
|
|
8004
|
+
stage_fixed: true
|
|
8021
8005
|
},
|
|
8022
|
-
|
|
8006
|
+
[`${facts().packageName}-init`]: {
|
|
8023
8007
|
priority: 1,
|
|
8024
|
-
run:
|
|
8008
|
+
run: `${facts().binaryCommand} init`
|
|
8025
8009
|
}
|
|
8026
|
-
}
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
".
|
|
8052
|
-
"
|
|
8053
|
-
"
|
|
8054
|
-
"
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8010
|
+
},
|
|
8011
|
+
parallel: false
|
|
8012
|
+
}
|
|
8013
|
+
});
|
|
8014
|
+
},
|
|
8015
|
+
otherFileNameList: [
|
|
8016
|
+
".lefthook.yml",
|
|
8017
|
+
"lefthook.yaml",
|
|
8018
|
+
".config/lefthook.yml",
|
|
8019
|
+
".lefthook.yaml",
|
|
8020
|
+
".config/lefthook.yaml",
|
|
8021
|
+
"lefthook.toml",
|
|
8022
|
+
".lefthook.toml",
|
|
8023
|
+
".config/lefthook.toml",
|
|
8024
|
+
"lefthook.json",
|
|
8025
|
+
".lefthook.json",
|
|
8026
|
+
".config/lefthook.json"
|
|
8027
|
+
],
|
|
8028
|
+
scope: "git-root"
|
|
8029
|
+
};
|
|
8030
|
+
//#endregion
|
|
8031
|
+
//#region src/datamitsu-config/setup/oxfmt_config_ts.ts
|
|
8032
|
+
const oxfmtConfigTs = {
|
|
8033
|
+
content: (context) => {
|
|
8034
|
+
return [
|
|
8035
|
+
`import { defineConfig } from "${tools.Path.forImport(tools.Path.join(context.datamitsuDir, "oxfmt.config.js"))}";`,
|
|
8036
|
+
"",
|
|
8037
|
+
"export default defineConfig();",
|
|
8038
|
+
""
|
|
8039
|
+
].join("\n");
|
|
8040
|
+
},
|
|
8041
|
+
otherFileNameList: [
|
|
8042
|
+
".oxfmtrc",
|
|
8043
|
+
".oxfmtrc.json",
|
|
8044
|
+
".oxfmtrc.jsonc",
|
|
8045
|
+
"oxfmt.config.js",
|
|
8046
|
+
"oxfmt.config.mjs",
|
|
8047
|
+
"oxfmt.config.cjs",
|
|
8048
|
+
"oxfmt.config.ts",
|
|
8049
|
+
"oxfmt.config.mts",
|
|
8050
|
+
"oxfmt.config.cts"
|
|
8051
|
+
],
|
|
8052
|
+
scope: "git-root",
|
|
8053
|
+
tools: ["oxfmt"]
|
|
8054
|
+
};
|
|
8055
|
+
//#endregion
|
|
8056
|
+
//#region src/datamitsu-config/utils/cleanDependencies.ts
|
|
8057
|
+
const listOfAppsDependencies = Object.entries(mapOfApps).filter(([_, el]) => typeof el.node === "object").map(([appName, el]) => {
|
|
8058
|
+
return {
|
|
8059
|
+
appName,
|
|
8060
|
+
deps: [el.node?.packageName || "", ...Object.keys(el.node?.dependencies || {})].filter(Boolean)
|
|
8061
|
+
};
|
|
8062
|
+
});
|
|
8063
|
+
const cleanDependencies = (deps) => {
|
|
8064
|
+
if (!deps) return;
|
|
8065
|
+
const excludeDependencyNameList = new Set([
|
|
8066
|
+
"@trivago/prettier-plugin-sort-imports",
|
|
8067
|
+
"eslint-plugin-yaml",
|
|
8068
|
+
"husky",
|
|
8069
|
+
"lint-staged",
|
|
8070
|
+
"styled-components",
|
|
8071
|
+
"typescript",
|
|
8072
|
+
...listOfAppsDependencies.flatMap((el) => el.deps)
|
|
8073
|
+
]);
|
|
8074
|
+
const nextDeps = Object.entries(deps).reduce((acc, [name, version]) => {
|
|
8075
|
+
if (!excludeDependencyNameList.has(name)) acc[name] = version;
|
|
8076
|
+
return acc;
|
|
8077
|
+
}, {});
|
|
8078
|
+
if (Object.keys(nextDeps).length > 0) return nextDeps;
|
|
8079
|
+
};
|
|
8080
|
+
//#endregion
|
|
8081
|
+
//#region src/datamitsu-config/utils/detectPackageType.ts
|
|
8082
|
+
const COMMONJS_ECOSYSTEM_DEPENDENCIES = new Set([
|
|
8083
|
+
"@docusaurus/core",
|
|
8084
|
+
"electron",
|
|
8085
|
+
"expo",
|
|
8086
|
+
"gatsby",
|
|
8087
|
+
"next",
|
|
8088
|
+
"react-native"
|
|
8089
|
+
]);
|
|
8090
|
+
const detectPackageType = (data) => {
|
|
8091
|
+
return [
|
|
8092
|
+
data.dependencies,
|
|
8093
|
+
data.devDependencies,
|
|
8094
|
+
data.peerDependencies,
|
|
8095
|
+
data.optionalDependencies
|
|
8096
|
+
].flatMap((deps) => deps ? Object.keys(deps) : []).some((name) => COMMONJS_ECOSYSTEM_DEPENDENCIES.has(name)) ? "commonjs" : "module";
|
|
8097
|
+
};
|
|
8098
|
+
//#endregion
|
|
8099
|
+
//#region src/datamitsu-config/setup/package_json.ts
|
|
8100
|
+
const pruneEmptyObject = (obj) => Object.values(obj).some((value) => value !== void 0) ? obj : void 0;
|
|
8101
|
+
//#endregion
|
|
8102
|
+
//#region src/datamitsu-config/cmdSetup.ts
|
|
8103
|
+
const setup = {
|
|
8104
|
+
".datamitsu/scripts/check-empty-files.sh": checkEmptyFilesSh,
|
|
8105
|
+
".datamitsu/scripts/format-terraform-spacing.sh": formatTerraformSpacingSh,
|
|
8106
|
+
".dockerignore": dockerignore,
|
|
8107
|
+
".editorconfig": editorconfig,
|
|
8108
|
+
".editorconfig-checker.json": editorconfigCheckerJson,
|
|
8109
|
+
".gitignore": gitignore,
|
|
8110
|
+
".gitleaks.toml": gitleaksToml,
|
|
8111
|
+
".golangci.yaml": golangciYaml,
|
|
8112
|
+
".node-version": nodeVersion,
|
|
8113
|
+
".npmrc": npmrc,
|
|
8114
|
+
".oxlintrc.json": oxlintrcJson,
|
|
8115
|
+
".syncpackrc.json": syncpackrcJson,
|
|
8116
|
+
".tflint.hcl": tflintHcl,
|
|
8117
|
+
".tombi.toml": tombiToml,
|
|
8118
|
+
".trufflehog-exclude-paths.txt": trufflehogExcludePathsTxt,
|
|
8119
|
+
".vale.ini": valeIni,
|
|
8120
|
+
".vscode/extensions.json": vscodeExtensionsJson,
|
|
8121
|
+
".vscode/settings.json": vscodeSettingsJson,
|
|
8122
|
+
".yamlfmt.yaml": yamlfmtYaml,
|
|
8123
|
+
".yamllint.yaml": yamllintYaml,
|
|
8124
|
+
"commitlint.config.mjs": commitlintConfigMjs,
|
|
8125
|
+
"cspell.config.mjs": cspellConfigMjs,
|
|
8126
|
+
"deprecated-configs": deprecatedConfigs,
|
|
8127
|
+
"eslint.config.mjs": eslintConfigMjs,
|
|
8128
|
+
"hadolint.yaml": hadolintYaml,
|
|
8129
|
+
"knip.config.js": knipConfigJs,
|
|
8130
|
+
"lefthook.yaml": lefthookYaml,
|
|
8131
|
+
"oxfmt.config.ts": oxfmtConfigTs,
|
|
8082
8132
|
"package.json": {
|
|
8083
|
-
content: ({ isRoot, originalContent }) => {
|
|
8084
|
-
|
|
8133
|
+
content: ({ cwdPath, isRoot, originalContent }) => {
|
|
8134
|
+
let data;
|
|
8135
|
+
if (originalContent?.trim()) try {
|
|
8136
|
+
data = JSON.parse(originalContent);
|
|
8137
|
+
} catch {
|
|
8138
|
+
throw new Error(`package.json at ${cwdPath} is not valid JSON; refusing to overwrite it`);
|
|
8139
|
+
}
|
|
8140
|
+
else data = {};
|
|
8085
8141
|
const scripts = {
|
|
8086
8142
|
...data.scripts,
|
|
8087
8143
|
...isRoot ? {
|
|
8088
8144
|
postinstall: void 0,
|
|
8089
8145
|
preinstall: void 0,
|
|
8090
|
-
prepare:
|
|
8146
|
+
prepare: void 0
|
|
8091
8147
|
} : {},
|
|
8092
|
-
...env().DATAMITSU_DEV_MODE && { postinstall: "pnpm build:lib" },
|
|
8093
8148
|
fix: void 0,
|
|
8094
8149
|
lint: void 0
|
|
8095
8150
|
};
|
|
8096
8151
|
const config = {
|
|
8097
8152
|
...data,
|
|
8098
|
-
|
|
8099
|
-
type: data.type ?? "module",
|
|
8100
|
-
...typeof data.config === "object" ? { config: {
|
|
8153
|
+
config: typeof data.config === "object" && data.config !== null ? pruneEmptyObject({
|
|
8101
8154
|
...data.config,
|
|
8102
8155
|
syncpack: void 0
|
|
8103
|
-
}
|
|
8156
|
+
}) : data.config,
|
|
8104
8157
|
dependencies: cleanDependencies(data.dependencies),
|
|
8105
8158
|
devDependencies: {
|
|
8106
8159
|
...cleanDependencies(data.devDependencies),
|
|
8107
|
-
|
|
8160
|
+
[name]: "catalog:"
|
|
8108
8161
|
},
|
|
8109
8162
|
devEngines: isRoot ? { runtime: {
|
|
8110
8163
|
name: "node",
|
|
@@ -8115,6 +8168,8 @@ export default config;
|
|
|
8115
8168
|
optionalDependencies: cleanDependencies(data.optionalDependencies),
|
|
8116
8169
|
packageManager: isRoot ? `pnpm@${pnpm.version}` : void 0,
|
|
8117
8170
|
peerDependencies: cleanDependencies(data.peerDependencies),
|
|
8171
|
+
scripts: pruneEmptyObject(scripts),
|
|
8172
|
+
type: data.type ?? detectPackageType(data),
|
|
8118
8173
|
cspell: void 0,
|
|
8119
8174
|
eslintConfig: void 0,
|
|
8120
8175
|
"lint-staged": void 0,
|
|
@@ -8135,12 +8190,17 @@ export default config;
|
|
|
8135
8190
|
};
|
|
8136
8191
|
const allowBuilds = { ...base?.allowBuilds };
|
|
8137
8192
|
delete allowBuilds["@shibanet0/datamitsu-config"];
|
|
8193
|
+
const catalog = Object.fromEntries(Object.entries({
|
|
8194
|
+
...base?.catalog,
|
|
8195
|
+
[name]: version
|
|
8196
|
+
}).sort(([a], [b]) => a.localeCompare(b)));
|
|
8138
8197
|
const config = {
|
|
8139
8198
|
...base,
|
|
8140
8199
|
allowBuilds,
|
|
8141
8200
|
audit: true,
|
|
8142
8201
|
auditLevel: "high",
|
|
8143
8202
|
autoInstallPeers: true,
|
|
8203
|
+
catalog,
|
|
8144
8204
|
dedupeDirectDeps: true,
|
|
8145
8205
|
dedupePeerDependents: true,
|
|
8146
8206
|
enableGlobalVirtualStore: true,
|
|
@@ -8213,6 +8273,25 @@ export default config;
|
|
|
8213
8273
|
},
|
|
8214
8274
|
projectTypes: ["python-package"]
|
|
8215
8275
|
},
|
|
8276
|
+
"rustfmt.toml": {
|
|
8277
|
+
content: (context) => {
|
|
8278
|
+
const data = TOML.parse(context.originalContent || "");
|
|
8279
|
+
return TOML.stringify({
|
|
8280
|
+
...data,
|
|
8281
|
+
edition: "2024",
|
|
8282
|
+
hard_tabs: true,
|
|
8283
|
+
max_width: 120,
|
|
8284
|
+
newline_style: "Unix",
|
|
8285
|
+
reorder_imports: true,
|
|
8286
|
+
reorder_modules: true,
|
|
8287
|
+
tab_spaces: 2
|
|
8288
|
+
});
|
|
8289
|
+
},
|
|
8290
|
+
otherFileNameList: ["rustfmt.toml", ".rustfmt.toml"],
|
|
8291
|
+
projectTypes: ["rust-project"],
|
|
8292
|
+
scope: "project",
|
|
8293
|
+
tools: ["rustfmt"]
|
|
8294
|
+
},
|
|
8216
8295
|
"turbo.json": {
|
|
8217
8296
|
content: (context) => {
|
|
8218
8297
|
const data = safeJsonParse(context.originalContent);
|
|
@@ -8329,6 +8408,28 @@ function parsePin(raw) {
|
|
|
8329
8408
|
}
|
|
8330
8409
|
const ociBundle = parsePin(OCI_BUNDLE_PIN);
|
|
8331
8410
|
//#endregion
|
|
8411
|
+
//#region src/datamitsu-config/parsers.ts
|
|
8412
|
+
/**
|
|
8413
|
+
* WASM output-parser module pin.
|
|
8414
|
+
*
|
|
8415
|
+
* Datamitsu turns a tool's machine-readable output into structured diagnostics with a signed
|
|
8416
|
+
* Rust→WASM parser module, shipped as a versioned asset on the datamitsu GitHub release. Tools opt
|
|
8417
|
+
* in by name via `outputParser` (see ./tools.ts); a module declared but unreferenced is harmless.
|
|
8418
|
+
*
|
|
8419
|
+
* The single module dispatches every tool's parser by name, so one `parsers` entry ("core") serves
|
|
8420
|
+
* all of them. It is downloaded once and SHA-256 verified against `hash` before it is loaded into
|
|
8421
|
+
* the sandboxed WASM runtime.
|
|
8422
|
+
*
|
|
8423
|
+
* Pinned to the datamitsu release this config targets (keep in sync with getMinVersion in
|
|
8424
|
+
* ./datamitsu.config.ts). On a version bump, update BOTH the version below and the hash — take it
|
|
8425
|
+
* from the release's signed checksums.txt entry for `datamitsu_parsers_<version>.wasm`.
|
|
8426
|
+
*/
|
|
8427
|
+
const DATAMITSU_VERSION = "0.1.9";
|
|
8428
|
+
const parsers = { core: {
|
|
8429
|
+
hash: "612a5c2da01d74a35fc0a27ac01ac9ae92442cbdc8bc6ddddee4a32642a9d73f",
|
|
8430
|
+
url: `https://github.com/datamitsu/datamitsu/releases/download/v${DATAMITSU_VERSION}/datamitsu_parsers_${DATAMITSU_VERSION}.wasm`
|
|
8431
|
+
} };
|
|
8432
|
+
//#endregion
|
|
8332
8433
|
//#region src/datamitsu-config/project.ts
|
|
8333
8434
|
const projectTypes = {
|
|
8334
8435
|
"golang-package": {
|
|
@@ -8355,6 +8456,10 @@ const projectTypes = {
|
|
|
8355
8456
|
description: "Python project",
|
|
8356
8457
|
markers: ["**/pyproject.toml"]
|
|
8357
8458
|
},
|
|
8459
|
+
"rust-project": {
|
|
8460
|
+
description: "Rust crate",
|
|
8461
|
+
markers: ["**/Cargo.toml"]
|
|
8462
|
+
},
|
|
8358
8463
|
"terraform-project": {
|
|
8359
8464
|
description: "Terraform infrastructure",
|
|
8360
8465
|
markers: ["**/*.tf"]
|
|
@@ -8766,6 +8871,7 @@ const _fixPriority = [
|
|
|
8766
8871
|
"typstyle",
|
|
8767
8872
|
"dotenv-linter",
|
|
8768
8873
|
"shfmt",
|
|
8874
|
+
"rustfmt",
|
|
8769
8875
|
"toml",
|
|
8770
8876
|
"tflint",
|
|
8771
8877
|
"terraform-fmt",
|
|
@@ -8796,6 +8902,7 @@ const _lintPriority = [
|
|
|
8796
8902
|
"editorconfig-checker",
|
|
8797
8903
|
"dotenv-linter",
|
|
8798
8904
|
"shfmt",
|
|
8905
|
+
"rustfmt",
|
|
8799
8906
|
"shellcheck",
|
|
8800
8907
|
"hadolint",
|
|
8801
8908
|
"checkmake",
|
|
@@ -8846,11 +8953,15 @@ const toolsConfig = {
|
|
|
8846
8953
|
name: "checkmake - Makefile Linter",
|
|
8847
8954
|
operations: { lint: {
|
|
8848
8955
|
app: "checkmake",
|
|
8849
|
-
args: ["{file}"],
|
|
8956
|
+
args: ["--format={{.LineNumber}}:{{.Rule}}:{{.Violation}}\n", "{file}"],
|
|
8850
8957
|
globs: makefileGlobs,
|
|
8851
8958
|
priority: lintPriority.checkmake,
|
|
8852
8959
|
scope: "per-file"
|
|
8853
|
-
} }
|
|
8960
|
+
} },
|
|
8961
|
+
outputParser: {
|
|
8962
|
+
module: "core",
|
|
8963
|
+
parser: "checkmake"
|
|
8964
|
+
}
|
|
8854
8965
|
},
|
|
8855
8966
|
cspell: {
|
|
8856
8967
|
name: "CSpell - A Spelling Checker for Code!",
|
|
@@ -8871,7 +8982,11 @@ const toolsConfig = {
|
|
|
8871
8982
|
globs: ["**/*"],
|
|
8872
8983
|
priority: lintPriority.cspell,
|
|
8873
8984
|
scope: "per-project"
|
|
8874
|
-
} }
|
|
8985
|
+
} },
|
|
8986
|
+
outputParser: {
|
|
8987
|
+
module: "core",
|
|
8988
|
+
parser: "cspell"
|
|
8989
|
+
}
|
|
8875
8990
|
},
|
|
8876
8991
|
"dotenv-linter": {
|
|
8877
8992
|
name: "dotenv-linter",
|
|
@@ -8892,6 +9007,10 @@ const toolsConfig = {
|
|
|
8892
9007
|
priority: lintPriority["dotenv-linter"],
|
|
8893
9008
|
scope: "per-file"
|
|
8894
9009
|
}
|
|
9010
|
+
},
|
|
9011
|
+
outputParser: {
|
|
9012
|
+
module: "core",
|
|
9013
|
+
parser: "dotenv_linter"
|
|
8895
9014
|
}
|
|
8896
9015
|
},
|
|
8897
9016
|
"editorconfig-checker": {
|
|
@@ -8925,6 +9044,7 @@ const toolsConfig = {
|
|
|
8925
9044
|
app: "eslint",
|
|
8926
9045
|
args: [
|
|
8927
9046
|
"--quiet",
|
|
9047
|
+
"--format=json",
|
|
8928
9048
|
"-c",
|
|
8929
9049
|
"{cwd}/eslint.config.mjs",
|
|
8930
9050
|
"{files}"
|
|
@@ -8935,6 +9055,10 @@ const toolsConfig = {
|
|
|
8935
9055
|
scope: "per-project"
|
|
8936
9056
|
}
|
|
8937
9057
|
},
|
|
9058
|
+
outputParser: {
|
|
9059
|
+
module: "core",
|
|
9060
|
+
parser: "eslint"
|
|
9061
|
+
},
|
|
8938
9062
|
projectTypes: ["npm-package"]
|
|
8939
9063
|
},
|
|
8940
9064
|
gitleaks: {
|
|
@@ -8972,12 +9096,20 @@ const toolsConfig = {
|
|
|
8972
9096
|
},
|
|
8973
9097
|
lint: {
|
|
8974
9098
|
app: "golangci-lint",
|
|
8975
|
-
args: [
|
|
9099
|
+
args: [
|
|
9100
|
+
"run",
|
|
9101
|
+
"--allow-parallel-runners",
|
|
9102
|
+
"--output.json.path=stdout"
|
|
9103
|
+
],
|
|
8976
9104
|
env: { GOLANGCI_LINT_CACHE: "{toolCache}" },
|
|
8977
9105
|
priority: lintPriority["golangci-lint"],
|
|
8978
9106
|
scope: "per-project"
|
|
8979
9107
|
}
|
|
8980
9108
|
},
|
|
9109
|
+
outputParser: {
|
|
9110
|
+
module: "core",
|
|
9111
|
+
parser: "golangci_lint"
|
|
9112
|
+
},
|
|
8981
9113
|
projectTypes: ["golang-package"]
|
|
8982
9114
|
},
|
|
8983
9115
|
"golangci-lint-fmt": {
|
|
@@ -9014,13 +9146,17 @@ const toolsConfig = {
|
|
|
9014
9146
|
args: [
|
|
9015
9147
|
"-c",
|
|
9016
9148
|
"{root}/hadolint.yaml",
|
|
9017
|
-
"--
|
|
9149
|
+
"--format=json",
|
|
9018
9150
|
"{file}"
|
|
9019
9151
|
],
|
|
9020
9152
|
globs: dockerfileGlobs,
|
|
9021
9153
|
priority: lintPriority.hadolint,
|
|
9022
9154
|
scope: "per-file"
|
|
9023
|
-
} }
|
|
9155
|
+
} },
|
|
9156
|
+
outputParser: {
|
|
9157
|
+
module: "core",
|
|
9158
|
+
parser: "hadolint"
|
|
9159
|
+
}
|
|
9024
9160
|
},
|
|
9025
9161
|
"harper-cli": {
|
|
9026
9162
|
name: "Harper - The Grammar Checker for Developers",
|
|
@@ -9038,7 +9174,11 @@ const toolsConfig = {
|
|
|
9038
9174
|
globs: markdownGlobs,
|
|
9039
9175
|
priority: lintPriority["harper-cli"],
|
|
9040
9176
|
scope: "repository"
|
|
9041
|
-
} }
|
|
9177
|
+
} },
|
|
9178
|
+
outputParser: {
|
|
9179
|
+
module: "core",
|
|
9180
|
+
parser: "harper_cli"
|
|
9181
|
+
}
|
|
9042
9182
|
},
|
|
9043
9183
|
helm: {
|
|
9044
9184
|
name: "Helm - The Kubernetes Package Manager",
|
|
@@ -9220,11 +9360,20 @@ const toolsConfig = {
|
|
|
9220
9360
|
},
|
|
9221
9361
|
lint: {
|
|
9222
9362
|
app: "protolint",
|
|
9223
|
-
args: [
|
|
9363
|
+
args: [
|
|
9364
|
+
"lint",
|
|
9365
|
+
"--reporter",
|
|
9366
|
+
"json",
|
|
9367
|
+
"{file}"
|
|
9368
|
+
],
|
|
9224
9369
|
globs: protoGlobs,
|
|
9225
9370
|
priority: lintPriority.protolint,
|
|
9226
9371
|
scope: "per-file"
|
|
9227
9372
|
}
|
|
9373
|
+
},
|
|
9374
|
+
outputParser: {
|
|
9375
|
+
module: "core",
|
|
9376
|
+
parser: "protolint"
|
|
9228
9377
|
}
|
|
9229
9378
|
},
|
|
9230
9379
|
ruff: {
|
|
@@ -9289,6 +9438,28 @@ const toolsConfig = {
|
|
|
9289
9438
|
},
|
|
9290
9439
|
projectTypes: ["python-package"]
|
|
9291
9440
|
},
|
|
9441
|
+
rustfmt: {
|
|
9442
|
+
name: "rustfmt - Rust formatter (cargo fmt)",
|
|
9443
|
+
operations: {
|
|
9444
|
+
fix: {
|
|
9445
|
+
app: "rustfmt",
|
|
9446
|
+
args: [],
|
|
9447
|
+
globs: ["**/*.rs"],
|
|
9448
|
+
priority: fixPriority.rustfmt,
|
|
9449
|
+
scope: "per-project"
|
|
9450
|
+
},
|
|
9451
|
+
lint: {
|
|
9452
|
+
app: "rustfmt",
|
|
9453
|
+
args: ["--check"],
|
|
9454
|
+
globs: ["**/*.rs"],
|
|
9455
|
+
priority: lintPriority.rustfmt,
|
|
9456
|
+
scope: "per-project"
|
|
9457
|
+
}
|
|
9458
|
+
},
|
|
9459
|
+
projectTypes: ["rust-project"],
|
|
9460
|
+
skip: facts().os === "windows",
|
|
9461
|
+
skipReason: "rustfmt runs via a POSIX shell guard (sh), unavailable on Windows by default"
|
|
9462
|
+
},
|
|
9292
9463
|
shellcheck: {
|
|
9293
9464
|
name: "ShellCheck - Shell Script Linter",
|
|
9294
9465
|
operations: { lint: {
|
|
@@ -9563,6 +9734,10 @@ const toolsConfig = {
|
|
|
9563
9734
|
priority: lintPriority.tsc,
|
|
9564
9735
|
scope: "per-project"
|
|
9565
9736
|
} },
|
|
9737
|
+
outputParser: {
|
|
9738
|
+
module: "core",
|
|
9739
|
+
parser: "tsc"
|
|
9740
|
+
},
|
|
9566
9741
|
projectTypes: ["typescript-project"]
|
|
9567
9742
|
},
|
|
9568
9743
|
tsgo: {
|
|
@@ -9579,6 +9754,10 @@ const toolsConfig = {
|
|
|
9579
9754
|
priority: lintPriority.tsgo,
|
|
9580
9755
|
scope: "per-project"
|
|
9581
9756
|
} },
|
|
9757
|
+
outputParser: {
|
|
9758
|
+
module: "core",
|
|
9759
|
+
parser: "tsc"
|
|
9760
|
+
},
|
|
9582
9761
|
projectTypes: ["typescript-project"]
|
|
9583
9762
|
},
|
|
9584
9763
|
typos: {
|
|
@@ -9634,14 +9813,18 @@ const toolsConfig = {
|
|
|
9634
9813
|
"--config",
|
|
9635
9814
|
"{root}/.vale.ini",
|
|
9636
9815
|
"--output",
|
|
9637
|
-
"
|
|
9816
|
+
"JSON",
|
|
9638
9817
|
"{files}"
|
|
9639
9818
|
],
|
|
9640
9819
|
batch: true,
|
|
9641
9820
|
globs: markdownGlobs,
|
|
9642
9821
|
priority: lintPriority.vale,
|
|
9643
9822
|
scope: "repository"
|
|
9644
|
-
} }
|
|
9823
|
+
} },
|
|
9824
|
+
outputParser: {
|
|
9825
|
+
module: "core",
|
|
9826
|
+
parser: "vale"
|
|
9827
|
+
}
|
|
9645
9828
|
},
|
|
9646
9829
|
yamlfmt: {
|
|
9647
9830
|
name: "yamlfmt - YAML Formatter",
|
|
@@ -9683,6 +9866,8 @@ const toolsConfig = {
|
|
|
9683
9866
|
"-c",
|
|
9684
9867
|
"{root}/.yamllint.yaml",
|
|
9685
9868
|
"--strict",
|
|
9869
|
+
"-f",
|
|
9870
|
+
"parsable",
|
|
9686
9871
|
"{files}"
|
|
9687
9872
|
],
|
|
9688
9873
|
batch: true,
|
|
@@ -9690,7 +9875,11 @@ const toolsConfig = {
|
|
|
9690
9875
|
globs: yamlGlobs,
|
|
9691
9876
|
priority: lintPriority.yamllint,
|
|
9692
9877
|
scope: "repository"
|
|
9693
|
-
} }
|
|
9878
|
+
} },
|
|
9879
|
+
outputParser: {
|
|
9880
|
+
module: "core",
|
|
9881
|
+
parser: "yamllint"
|
|
9882
|
+
}
|
|
9694
9883
|
},
|
|
9695
9884
|
"yq-json": {
|
|
9696
9885
|
name: "yq - JSON Key Sorter",
|
|
@@ -10059,6 +10248,7 @@ function getConfig(cfg) {
|
|
|
10059
10248
|
}
|
|
10060
10249
|
},
|
|
10061
10250
|
initCommands,
|
|
10251
|
+
parsers,
|
|
10062
10252
|
projectTypes,
|
|
10063
10253
|
runtimes: {
|
|
10064
10254
|
...mapOfRuntimes,
|
|
@@ -10073,7 +10263,7 @@ function getConfig(cfg) {
|
|
|
10073
10263
|
}
|
|
10074
10264
|
globalThis.getConfig = getConfig;
|
|
10075
10265
|
const getMinVersion = () => {
|
|
10076
|
-
return "0.1.
|
|
10266
|
+
return "0.1.9";
|
|
10077
10267
|
};
|
|
10078
10268
|
globalThis.getMinVersion = getMinVersion;
|
|
10079
10269
|
//#endregion
|