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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae39abac1e3638de958917ebc2fcbbffdace00c23e13fdd53929cec3e416930f
4
- data.tar.gz: eb7191f382ae86ff2c25aac1ce6f7af7a1288be5a25c503641416bcb321ba234
3
+ metadata.gz: 02b01e1d1b95887bc25d0063757a68ef24b8fb50f726822522cd34623063d381
4
+ data.tar.gz: 2682460aca56a009107f79be35f60dd9746eeb691c1449be1ff361268734ad3f
5
5
  SHA512:
6
- metadata.gz: df09df41cb4383f3654dc161b33703798e069cd16be48dd160162076eca1d03417c7272bb6dc80cdfb7a06c2a46e8a8029597e94c40e6fe5d79e5be9a2f1c6a4
7
- data.tar.gz: a52d189d3bf6606506e9fb06f3ff8289926d9f62864e9a2e3628a0657813a009e32840cfda0b2d4e414f3a8b768e940211566f247c06a998db4c9732d29471a9
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
- KK_GIT_ALLOW_SENSITIVE=1 allow committing .env/credentials paths
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)
@@ -52,9 +52,18 @@ module KKGit
52
52
  ]
53
53
  ),
54
54
  Language.new(
55
- id: :prettier,
55
+ id: :js,
56
56
  label: 'JS/TS/Node',
57
- extensions: %w[.js .jsx .mjs .cjs .ts .tsx .json .css .scss .less .html .md .yaml .yml],
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
  ]
@@ -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
- if ENV['KK_GIT_ALLOW_SENSITIVE'] == '1'
286
- warn "Warning: committing sensitive paths: #{paths.join(', ')}"
287
- else
288
- raise Error,
289
- "Refusing to commit sensitive paths: #{paths.join(', ')}. " \
290
- 'Set KK_GIT_ALLOW_SENSITIVE=1 to override.'
291
- end
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KKGit
4
- VERSION = '0.2.6'
4
+ VERSION = '0.2.7'
5
5
  end
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.6
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-07 00:00:00.000000000 Z
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.