@kud/ai-conventional-commit-cli 3.2.2 → 3.2.5

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.
Files changed (50) hide show
  1. package/dist/{chunk-IWJLYYKM.js → chunk-EHJXGWTJ.js} +3 -19
  2. package/dist/{chunk-OLEHSPCO.js → chunk-GVOA4OR7.js} +55 -16
  3. package/dist/index.cjs +1200 -0
  4. package/dist/index.d.cts +1 -0
  5. package/dist/index.js +60 -44
  6. package/dist/{reword-6EWRZ6WZ.js → reword-BKQ7K33J.js} +1 -1
  7. package/dist/{reword-D5YVSCPO.js → reword-QQO7UBGM.js} +3 -1
  8. package/package.json +1 -1
  9. package/dist/chunk-2WRUFO3O.js +0 -689
  10. package/dist/chunk-2X3JJVRR.js +0 -639
  11. package/dist/chunk-7FBRAH4R.js +0 -643
  12. package/dist/chunk-7U4J2ORD.js +0 -614
  13. package/dist/chunk-CC3NIT53.js +0 -650
  14. package/dist/chunk-CLQ6OPLU.js +0 -668
  15. package/dist/chunk-F3BOAVBY.js +0 -122
  16. package/dist/chunk-FYJNHXAR.js +0 -700
  17. package/dist/chunk-H4W6AMGZ.js +0 -549
  18. package/dist/chunk-HJR5M6U7.js +0 -120
  19. package/dist/chunk-HOUMTU6H.js +0 -699
  20. package/dist/chunk-KEEMHNNS.js +0 -628
  21. package/dist/chunk-RHXNXVGI.js +0 -621
  22. package/dist/chunk-SNV4RWS4.js +0 -696
  23. package/dist/chunk-W7OC77AV.js +0 -649
  24. package/dist/chunk-WFXVVHL2.js +0 -645
  25. package/dist/chunk-YIXP5EWA.js +0 -545
  26. package/dist/chunk-YRVQGOVW.js +0 -649
  27. package/dist/chunk-ZLYMV2NJ.js +0 -644
  28. package/dist/config-C3S4LWLD.js +0 -12
  29. package/dist/config-RHGCFLHQ.js +0 -12
  30. package/dist/reword-2ASH5EH5.js +0 -212
  31. package/dist/reword-3MH2DYFS.js +0 -212
  32. package/dist/reword-CZDYMQEV.js +0 -150
  33. package/dist/reword-ESY2TLBT.js +0 -212
  34. package/dist/reword-FE5N4MGV.js +0 -150
  35. package/dist/reword-IN2D2J4H.js +0 -212
  36. package/dist/reword-JRE6KAF7.js +0 -212
  37. package/dist/reword-KIR2DMTO.js +0 -212
  38. package/dist/reword-KUE3IVBE.js +0 -212
  39. package/dist/reword-LIVSGNUN.js +0 -212
  40. package/dist/reword-MCQOCOZ2.js +0 -212
  41. package/dist/reword-NGEKVTD6.js +0 -212
  42. package/dist/reword-PEOUOAT7.js +0 -212
  43. package/dist/reword-Q7MES34W.js +0 -212
  44. package/dist/reword-T44WTP5I.js +0 -212
  45. package/dist/reword-UA3EG7DK.js +0 -212
  46. package/dist/reword-UE5IP5V3.js +0 -212
  47. package/dist/reword-VKG5G6CB.js +0 -212
  48. package/dist/reword-VRH7B6BE.js +0 -205
  49. package/dist/reword-WFCNTOEU.js +0 -203
  50. package/dist/reword-XWYWVQRZ.js +0 -212
@@ -1,122 +0,0 @@
1
- // src/config.ts
2
- import { cosmiconfig } from "cosmiconfig";
3
- import { resolve, dirname, join } from "path";
4
- import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
5
- import { homedir } from "os";
6
- var DEFAULTS = {
7
- model: process.env.AICC_MODEL || "github-copilot/gpt-4.1",
8
- privacy: process.env.AICC_PRIVACY || "low",
9
- style: process.env.AICC_STYLE || "standard",
10
- styleSamples: parseInt(process.env.AICC_STYLE_SAMPLES || "120", 10),
11
- maxTokens: parseInt(process.env.AICC_MAX_TOKENS || "512", 10),
12
- maxFileLines: parseInt(process.env.AICC_MAX_FILE_LINES || "1000", 10),
13
- skipFilePatterns: [
14
- "**/package-lock.json",
15
- "**/yarn.lock",
16
- "**/pnpm-lock.yaml",
17
- "**/bun.lockb",
18
- "**/composer.lock",
19
- "**/Gemfile.lock",
20
- "**/Cargo.lock",
21
- "**/poetry.lock",
22
- "**/*.d.ts",
23
- "**/dist/**",
24
- "**/build/**",
25
- "**/.next/**",
26
- "**/out/**",
27
- "**/coverage/**",
28
- "**/*.min.js",
29
- "**/*.min.css",
30
- "**/*.map"
31
- ],
32
- cacheDir: ".git/.aicc-cache",
33
- plugins: [],
34
- verbose: process.env.AICC_VERBOSE === "true",
35
- yes: process.env.AICC_YES === "true"
36
- };
37
- function getGlobalConfigPath() {
38
- const base = process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
39
- return resolve(base, "ai-conventional-commit-cli", "aicc.json");
40
- }
41
- function saveGlobalConfig(partial) {
42
- const filePath = getGlobalConfigPath();
43
- const dir = dirname(filePath);
44
- if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
45
- let existing = {};
46
- if (existsSync(filePath)) {
47
- try {
48
- existing = JSON.parse(readFileSync(filePath, "utf8")) || {};
49
- } catch (e) {
50
- if (process.env.AICC_VERBOSE === "true") {
51
- console.error("[ai-cc] Failed to parse existing global config, overwriting.");
52
- }
53
- }
54
- }
55
- const merged = { ...existing, ...partial };
56
- writeFileSync(filePath, JSON.stringify(merged, null, 2) + "\n", "utf8");
57
- return filePath;
58
- }
59
- async function loadConfig(cwd = process.cwd()) {
60
- return (await loadConfigDetailed(cwd)).config;
61
- }
62
- async function loadConfigDetailed(cwd = process.cwd()) {
63
- let globalCfg = {};
64
- const globalPath = getGlobalConfigPath();
65
- if (existsSync(globalPath)) {
66
- try {
67
- globalCfg = JSON.parse(readFileSync(globalPath, "utf8")) || {};
68
- } catch (e) {
69
- if (process.env.AICC_VERBOSE === "true") {
70
- console.error("[ai-cc] Failed to parse global config, ignoring.");
71
- }
72
- }
73
- }
74
- const explorer = cosmiconfig("aicc");
75
- const result = await explorer.search(cwd);
76
- const projectCfg = result?.config || {};
77
- const envCfg = {};
78
- if (process.env.AICC_MODEL) envCfg.model = process.env.AICC_MODEL;
79
- if (process.env.AICC_PRIVACY) envCfg.privacy = process.env.AICC_PRIVACY;
80
- if (process.env.AICC_STYLE) envCfg.style = process.env.AICC_STYLE;
81
- if (process.env.AICC_STYLE_SAMPLES)
82
- envCfg.styleSamples = parseInt(process.env.AICC_STYLE_SAMPLES, 10);
83
- if (process.env.AICC_MAX_TOKENS) envCfg.maxTokens = parseInt(process.env.AICC_MAX_TOKENS, 10);
84
- if (process.env.AICC_MAX_FILE_LINES)
85
- envCfg.maxFileLines = parseInt(process.env.AICC_MAX_FILE_LINES, 10);
86
- if (process.env.AICC_VERBOSE) envCfg.verbose = process.env.AICC_VERBOSE === "true";
87
- if (process.env.AICC_YES) envCfg.yes = process.env.AICC_YES === "true";
88
- const merged = {
89
- ...DEFAULTS,
90
- ...globalCfg,
91
- ...projectCfg,
92
- ...envCfg
93
- };
94
- merged.plugins = (merged.plugins || []).filter((p) => {
95
- const abs = resolve(cwd, p);
96
- return existsSync(abs);
97
- });
98
- if (!merged.skipFilePatterns) {
99
- merged.skipFilePatterns = DEFAULTS.skipFilePatterns;
100
- }
101
- const sources = Object.keys(merged).reduce((acc, key) => {
102
- const k = key;
103
- let src = "default";
104
- if (k in globalCfg) src = "global";
105
- if (k in projectCfg) src = "project";
106
- if (k in envCfg) src = "env";
107
- acc[k] = src;
108
- return acc;
109
- }, {});
110
- const withMeta = Object.assign(merged, { _sources: sources });
111
- return {
112
- config: withMeta,
113
- raw: { defaults: DEFAULTS, global: globalCfg, project: projectCfg, env: envCfg }
114
- };
115
- }
116
-
117
- export {
118
- getGlobalConfigPath,
119
- saveGlobalConfig,
120
- loadConfig,
121
- loadConfigDetailed
122
- };