kk-git 0.2.6 → 0.2.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.
- checksums.yaml +4 -4
- data/exe/kk-git +1 -1
- data/lib/kk/git/auto_format.rb +11 -2
- data/lib/kk/git/git_ops.rb +20 -7
- data/lib/kk/git/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 02b01e1d1b95887bc25d0063757a68ef24b8fb50f726822522cd34623063d381
|
|
4
|
+
data.tar.gz: 2682460aca56a009107f79be35f60dd9746eeb691c1449be1ff361268734ad3f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fe0d795b321f3457a0da6391c03ec86669f632c18a851b830f30e1ce765edbf01e14160bcb5dd2960bd9ef87a47a3540a0e7ecbcce6bac45992475492bcd6ea1
|
|
7
|
+
data.tar.gz: f54fa6384570117be64f4b72038f0699027d331e1ef69a31491e20aa798b5e6c0a72325b580b36f58e847317a92ad8234c7763b5f56f6484dc33f1eed9ea1797
|
data/exe/kk-git
CHANGED
|
@@ -165,7 +165,7 @@ def main_help
|
|
|
165
165
|
KK_GIT_SKIP_PUSH=1 skip push step
|
|
166
166
|
KK_GIT_AMEND=1 amend last commit instead of creating new one
|
|
167
167
|
KK_GIT_CONFIRM=1 print message and require KK_GIT_YES=1
|
|
168
|
-
|
|
168
|
+
KK_GIT_BLOCK_SENSITIVE=1 block committing .env/credentials paths (off by default)
|
|
169
169
|
KK_GIT_DEFAULT_TYPE default type for code edits (default: chore)
|
|
170
170
|
KK_GIT_PUSH_URL push to explicit URL (bypass SSH remote)
|
|
171
171
|
KK_GIT_PULL_URL pull from explicit URL (bypass SSH remote)
|
data/lib/kk/git/auto_format.rb
CHANGED
|
@@ -52,9 +52,18 @@ module KKGit
|
|
|
52
52
|
]
|
|
53
53
|
),
|
|
54
54
|
Language.new(
|
|
55
|
-
id: :
|
|
55
|
+
id: :js,
|
|
56
56
|
label: 'JS/TS/Node',
|
|
57
|
-
extensions: %w[.js .jsx .mjs .cjs .ts .tsx .json .
|
|
57
|
+
extensions: %w[.js .jsx .mjs .cjs .ts .tsx .json .jsonc .css],
|
|
58
|
+
tools: [
|
|
59
|
+
Tool.new(name: 'biome', bin: 'biome', argv: ['format', '--write', '%{files}']),
|
|
60
|
+
Tool.new(name: 'prettier', bin: 'prettier', argv: ['--write', '%{files}'])
|
|
61
|
+
]
|
|
62
|
+
),
|
|
63
|
+
Language.new(
|
|
64
|
+
id: :prettier_docs,
|
|
65
|
+
label: 'Prettier (markup/docs)',
|
|
66
|
+
extensions: %w[.scss .less .html .md .mdx .yaml .yml],
|
|
58
67
|
tools: [
|
|
59
68
|
Tool.new(name: 'prettier', bin: 'prettier', argv: ['--write', '%{files}'])
|
|
60
69
|
]
|
data/lib/kk/git/git_ops.rb
CHANGED
|
@@ -22,6 +22,12 @@ module KKGit
|
|
|
22
22
|
|
|
23
23
|
SAFE_ENV_TEMPLATE_SUFFIXES = %w[example sample template dist].freeze
|
|
24
24
|
|
|
25
|
+
# Application source that manages credentials in-repo (not secret payloads).
|
|
26
|
+
SAFE_CREDENTIALS_CODE_PATTERNS = [
|
|
27
|
+
%r{(?:^|/)[a-z0-9_]+_credentials\.go\z}i,
|
|
28
|
+
%r{(?:^|/)[a-z0-9_]+_credentials\.(ts|tsx|js|jsx)\z}i
|
|
29
|
+
].freeze
|
|
30
|
+
|
|
25
31
|
# 仓库同步状态快照
|
|
26
32
|
Status = Struct.new(
|
|
27
33
|
:branch, :remote, :clean, :ahead, :behind,
|
|
@@ -261,10 +267,15 @@ module KKGit
|
|
|
261
267
|
|
|
262
268
|
def sensitive_path?(path)
|
|
263
269
|
return false if safe_env_template?(path)
|
|
270
|
+
return false if safe_credentials_code?(path)
|
|
264
271
|
|
|
265
272
|
SENSITIVE_PATH_PATTERNS.any? { |pattern| path.match?(pattern) }
|
|
266
273
|
end
|
|
267
274
|
|
|
275
|
+
def safe_credentials_code?(path)
|
|
276
|
+
SAFE_CREDENTIALS_CODE_PATTERNS.any? { |pattern| path.match?(pattern) }
|
|
277
|
+
end
|
|
278
|
+
|
|
268
279
|
def safe_env_template?(path)
|
|
269
280
|
SAFE_ENV_TEMPLATE_SUFFIXES.any? do |suffix|
|
|
270
281
|
path.match?(/\A\.env\.#{suffix}\z/i)
|
|
@@ -279,16 +290,18 @@ module KKGit
|
|
|
279
290
|
end
|
|
280
291
|
|
|
281
292
|
def ensure_no_sensitive_staged!(repo_dir: '.')
|
|
293
|
+
return unless sensitive_check_enabled?
|
|
294
|
+
|
|
282
295
|
paths = sensitive_staged_paths(repo_dir: repo_dir)
|
|
283
296
|
return if paths.empty?
|
|
284
297
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
298
|
+
raise Error,
|
|
299
|
+
"Refusing to commit sensitive paths: #{paths.join(', ')}. " \
|
|
300
|
+
'Unset KK_GIT_BLOCK_SENSITIVE or unstage these files.'
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
def sensitive_check_enabled?
|
|
304
|
+
ENV['KK_GIT_BLOCK_SENSITIVE'] == '1'
|
|
292
305
|
end
|
|
293
306
|
|
|
294
307
|
def confirm_commit!(message)
|
data/lib/kk/git/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kk-git
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kk
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Generate Conventional Commits commit messages from current git changes
|
|
14
14
|
(staged/worktree), designed for Rake/script usage.
|