ngpt 2.14.0__py3-none-any.whl → 2.14.1__py3-none-any.whl

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.
ngpt/cli/args.py CHANGED
@@ -94,8 +94,8 @@ def setup_argument_parser():
94
94
  help='Context to guide AI generation (e.g., file types, commit type)')
95
95
  gitcommsg_group.add_argument('-r', '--recursive-chunk', action='store_true',
96
96
  help='Process large diffs in chunks with recursive analysis if needed')
97
- gitcommsg_group.add_argument('--diff', metavar='FILE',
98
- help='Use diff from specified file instead of staged changes')
97
+ gitcommsg_group.add_argument('--diff', metavar='FILE', nargs='?', const=True,
98
+ help='Use diff from specified file instead of staged changes. If used without a path, uses the path from CLI config.')
99
99
  gitcommsg_group.add_argument('--chunk-size', type=int, default=200,
100
100
  help='Number of lines per chunk when chunking is enabled (default: 200)')
101
101
  gitcommsg_group.add_argument('--max-depth', type=int, default=3,
ngpt/cli/main.py CHANGED
@@ -46,7 +46,8 @@ def show_cli_config_help():
46
46
  "code": [],
47
47
  "interactive": [],
48
48
  "text": [],
49
- "shell": []
49
+ "shell": [],
50
+ "gitcommsg": [] # Add gitcommsg context
50
51
  }
51
52
 
52
53
  for option, meta in CLI_CONFIG_OPTIONS.items():
@@ -71,7 +72,8 @@ def show_cli_config_help():
71
72
  ("code", "Code generation mode"),
72
73
  ("interactive", "Interactive mode"),
73
74
  ("text", "Text mode"),
74
- ("shell", "Shell mode")
75
+ ("shell", "Shell mode"),
76
+ ("gitcommsg", "Git commit message mode") # Add gitcommsg mode
75
77
  ]:
76
78
  if context_groups[mode]:
77
79
  print(f"\n {COLORS['yellow']}Options for {options}:{COLORS['reset']}")
@@ -88,6 +90,8 @@ def show_cli_config_help():
88
90
  print(f" {COLORS['yellow']}ngpt --cli-config set language java{COLORS['reset']} - Set default language to java for code generation")
89
91
  print(f" {COLORS['yellow']}ngpt --cli-config set temperature 0.9{COLORS['reset']} - Set default temperature to 0.9")
90
92
  print(f" {COLORS['yellow']}ngpt --cli-config set no-stream true{COLORS['reset']} - Disable streaming by default")
93
+ print(f" {COLORS['yellow']}ngpt --cli-config set recursive-chunk true{COLORS['reset']} - Enable recursive chunking for git commit messages")
94
+ print(f" {COLORS['yellow']}ngpt --cli-config set diff /path/to/file.diff{COLORS['reset']} - Set default diff file for git commit messages")
91
95
  print(f" {COLORS['yellow']}ngpt --cli-config get temperature{COLORS['reset']} - Check the current temperature setting")
92
96
  print(f" {COLORS['yellow']}ngpt --cli-config get{COLORS['reset']} - Show all current CLI settings")
93
97
  print(f" {COLORS['yellow']}ngpt --cli-config unset language{COLORS['reset']} - Remove language setting")
@@ -562,7 +566,7 @@ def main():
562
566
 
563
567
  elif args.gitcommsg:
564
568
  # Apply CLI config for gitcommsg mode
565
- args = apply_cli_config(args, "all")
569
+ args = apply_cli_config(args, "gitcommsg")
566
570
 
567
571
  # Git commit message generation mode
568
572
  gitcommsg_mode(client, args, logger=logger)
@@ -8,6 +8,7 @@ from datetime import datetime
8
8
  import logging
9
9
  from ..formatters import COLORS
10
10
  from ...utils.log import create_gitcommsg_logger
11
+ from ...utils.cli_config import get_cli_config_option
11
12
 
12
13
  def get_diff_content(diff_file=None):
13
14
  """Get git diff content from file or git staged changes.
@@ -638,8 +639,35 @@ def gitcommsg_mode(client, args, logger=None):
638
639
  active_logger.debug(f"Args: {args}")
639
640
 
640
641
  try:
642
+ # Check if --diff was explicitly passed on the command line
643
+ diff_option_provided = '--diff' in sys.argv
644
+ diff_path_provided = diff_option_provided and args.diff is not None and args.diff is not True
645
+
646
+ # If --diff wasn't explicitly provided on the command line, don't use the config value
647
+ if not diff_option_provided:
648
+ # Even if diff is in CLI config, don't use it unless --diff flag is provided
649
+ diff_file = None
650
+ if active_logger:
651
+ active_logger.info("Not using diff file from CLI config because --diff flag was not provided")
652
+ else:
653
+ # --diff flag was provided on command line
654
+ if args.diff is True:
655
+ # --diff flag was used without a path, use the value from CLI config
656
+ success, config_diff = get_cli_config_option("diff")
657
+ diff_file = config_diff if success and config_diff else None
658
+ if active_logger:
659
+ if diff_file:
660
+ active_logger.info(f"Using diff file from CLI config: {diff_file}")
661
+ else:
662
+ active_logger.info("No diff file found in CLI config")
663
+ else:
664
+ # --diff flag was used with an explicit path
665
+ diff_file = args.diff
666
+ if active_logger:
667
+ active_logger.info(f"Using explicitly provided diff file: {diff_file}")
668
+
641
669
  # Get diff content
642
- diff_content = get_diff_content(args.diff)
670
+ diff_content = get_diff_content(diff_file)
643
671
 
644
672
  if not diff_content:
645
673
  print(f"{COLORS['red']}No diff content available. Exiting.{COLORS['reset']}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngpt
3
- Version: 2.14.0
3
+ Version: 2.14.1
4
4
  Summary: A lightweight Python CLI and library for interacting with OpenAI-compatible APIs, supporting both official and self-hosted LLM endpoints.
5
5
  Project-URL: Homepage, https://github.com/nazdridoy/ngpt
6
6
  Project-URL: Repository, https://github.com/nazdridoy/ngpt
@@ -2,17 +2,17 @@ ngpt/__init__.py,sha256=kpKhViLakwMdHZkuLht2vWcjt0uD_5gR33gvMhfXr6w,664
2
2
  ngpt/__main__.py,sha256=j3eFYPOtCCFBOGh7NK5IWEnADnTMMSEB9GLyIDoW724,66
3
3
  ngpt/client.py,sha256=rLgDPmJe8_yi13-XUiHJ45z54rJVrupxWmeb-fQZGF4,15129
4
4
  ngpt/cli/__init__.py,sha256=hebbDSMGiOd43YNnQP67uzr67Ue6rZPwm2czynr5iZY,43
5
- ngpt/cli/args.py,sha256=87b35nG7LFWPwewiICQrgilGIdD_uwqpkgo1DN3xOZY,11073
5
+ ngpt/cli/args.py,sha256=fTX3ozqMT5fCcxlyrPQEEHeWxSpgDvdWSM4AtdIAIE8,11152
6
6
  ngpt/cli/config_manager.py,sha256=NQQcWnjUppAAd0s0p9YAf8EyKS1ex5-0EB4DvKdB4dk,3662
7
7
  ngpt/cli/formatters.py,sha256=HBYGlx_7eoAKyzfy0Vq5L0yn8yVKjngqYBukMmXCcz0,9401
8
8
  ngpt/cli/interactive.py,sha256=DZFbExcXd7RylkpBiZBhiI6N8FBaT0m_lBes0Pvhi48,10894
9
- ngpt/cli/main.py,sha256=hFX7Nn9NaRwa6uRp09fnPDzfmbkbbWZNczSLCUZPtLU,28488
9
+ ngpt/cli/main.py,sha256=6GO4r9e9su7FFukj9JeVmJt1bJsqPOJBj6xo3iyMZXU,28911
10
10
  ngpt/cli/renderers.py,sha256=gJ3WdVvCGkNxrLEkLCh6gk9HBFMK8y7an6CsEkqt2Z8,10535
11
11
  ngpt/cli/ui.py,sha256=iMinm_QdsmwrEUpb7CBRexyyBqf4sviFI9M3E8D-hhA,5303
12
12
  ngpt/cli/modes/__init__.py,sha256=R3aO662RIzWEOvr3moTrEI8Tpg0zDDyMGGh1-OxiRgM,285
13
13
  ngpt/cli/modes/chat.py,sha256=4a5EgM_5A1zCSrLrjgQMDnBwIHd1Rnu5_BjSKSm7p24,4255
14
14
  ngpt/cli/modes/code.py,sha256=RjOAj7BDO5vLUdIPkUfPtyIkI_W6qEHsZvYh-sIdVaM,4293
15
- ngpt/cli/modes/gitcommsg.py,sha256=Su7-e2w5_3-ilgjfo_x055HFC7HROwiyT_jkb667gCM,26637
15
+ ngpt/cli/modes/gitcommsg.py,sha256=eme_E1JFOndh1yWP90ryYcrsx6K5VLQqPoTIJDKwCsQ,28164
16
16
  ngpt/cli/modes/rewrite.py,sha256=Zb0PFvWRKXs4xJCF3GEdYc-LSmy6qRszz8-QJuldHc0,8595
17
17
  ngpt/cli/modes/shell.py,sha256=lF9f7w-0bl_FdZl-WJnZuV736BKrWQtrwoKr3ejPXFE,2682
18
18
  ngpt/cli/modes/text.py,sha256=ncYnfLFMdTPuHiOvAaHNiOWhox6GF6S-2fTwMIrAz-g,3140
@@ -20,8 +20,8 @@ ngpt/utils/__init__.py,sha256=E46suk2-QgYBI0Qrs6WXOajOUOebF3ETAFY7ah8DTWs,942
20
20
  ngpt/utils/cli_config.py,sha256=b7cXTxbRA-tQWgaehP_uRm_L8-677elPUXk290uzsTs,11110
21
21
  ngpt/utils/config.py,sha256=WYOk_b1eiYjo6hpV3pfXr2RjqhOnmKqwZwKid1T41I4,10363
22
22
  ngpt/utils/log.py,sha256=f1jg2iFo35PAmsarH8FVL_62plq4VXH0Mu2QiP6RJGw,15934
23
- ngpt-2.14.0.dist-info/METADATA,sha256=kvuDMT94vqncE_r5Nlw75ijljRMOBtdWRZ_p3bDsP8k,22573
24
- ngpt-2.14.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
- ngpt-2.14.0.dist-info/entry_points.txt,sha256=SqAAvLhMrsEpkIr4YFRdUeyuXQ9o0IBCeYgE6AVojoI,44
26
- ngpt-2.14.0.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
27
- ngpt-2.14.0.dist-info/RECORD,,
23
+ ngpt-2.14.1.dist-info/METADATA,sha256=MRsUrLvG2mRWtZ7ZxhbTzf1GQ43gY9E_LjVIPIr_NSU,22573
24
+ ngpt-2.14.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
+ ngpt-2.14.1.dist-info/entry_points.txt,sha256=SqAAvLhMrsEpkIr4YFRdUeyuXQ9o0IBCeYgE6AVojoI,44
26
+ ngpt-2.14.1.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
27
+ ngpt-2.14.1.dist-info/RECORD,,
File without changes