Skip to content

Add project baseconfig - #147

Open
Luffy2004-c wants to merge 39 commits into
Undertone0809:mainfrom
Luffy2004-c:add-project-baseconfig
Open

Add project baseconfig#147
Luffy2004-c wants to merge 39 commits into
Undertone0809:mainfrom
Luffy2004-c:add-project-baseconfig

Conversation

@Luffy2004-c

Copy link
Copy Markdown

Description

Add project baseconfig

Related Issue

#126

Type of Change

  • 📚 Examples / docs / tutorials / dependencies update
  • 🔧 Bug fix (non-breaking change which fixes an issue)
  • [] 🥂 Improvement (non-breaking change which improves an existing feature)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🔐 Security fix

Checklist

  • I've read the CODE_OF_CONDUCT.md document.
  • I've read the CONTRIBUTING.md guide.
  • I've updated the code style using make codestyle.
  • I've written tests for all new methods and classes that I created.
  • I've written the docstring in Google format for all the methods and classes that I used.

Comment thread docs/guide/commands.md Outdated
Comment thread docs/other/config-your-project-config.md Outdated
Comment thread gcop/__main__.py
Comment thread gcop/__main__.py Outdated
Comment thread gcop/prompt.py

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commmit_message_history 的功能和正常的 commit_template 你觉得是互斥的吗?

个人感觉从效果上两种模式的互斥的,会相互干扰。

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要讨论一下,得出一个结论,因为如果是互斥着,意味着这部分的逻辑和对应的单测需要更新一下 @Luffy2004-c

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

先测一下效果

@Undertone0809

Copy link
Copy Markdown
Owner
  • 还需要把主分支的更新 merge 进来,现在和主分支是有冲突的
  • 需要把那些 commit message 改成英文,不要用中文的 commit message。

Comment thread tests/test_get_config.py Outdated
Comment thread gcop/config.py Outdated
Comment thread gcop/config.py Outdated
Comment thread tests/test_get_config.py Outdated
Comment thread gcop/config.py Outdated
Comment thread gcop/config.py Outdated

def check_model_config(self) -> bool:
if (
self.model_name == "provider/name,eg openai/gpt-4o"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果你 default config 是一个 py 变量的话,而不是 json 文件,这里就可以直接用 if self.model_name == DEFAULT_CONF.model_name

Undertone0809 and others added 3 commits February 8, 2025 00:09
- Rename `default_config` to `DEFAULT_CONFIG` for consistency
- Remove JSON file handling and replace with direct dictionary definition
- Enhance documentation and structure of `GcopConfig` and `ModelConfig`
- Improve configuration loading and merging logic

These changes aim to make the configuration management system more maintainable and easier to understand, without changing its core functionality.
- Delete default_config.json file
- Remove unused configuration settings

This change is part of a cleanup effort to remove outdated or unused configuration files, simplifying the project structure and reducing potential confusion.
@gru-agent

gru-agent Bot commented Mar 12, 2025

Copy link
Copy Markdown

TestGru Assignment

Summary

Link CommitId Status Reason
Detail 3958c7b ✅ Finished

Files

File Pull Request
gcop/main.py ❌ Failure (I failed to write the unit tests for the file.)
gcop/config.py ❌ Failure (I failed to write the unit tests for the file.)
gcop/prompt.py ❌ Failure (I failed to write the unit tests for the file.)
gcop/utils/init.py ❌ Failure (I failed to write the unit tests for the file.)

Tip

You can @gru-agent and leave your feedback. TestGru will make adjustments based on your input

@Undertone0809

Copy link
Copy Markdown
Owner

@Luffy2004-c can use https://github.com/Undertone0809/conftier to refactor it.

- Implement ModelConfig class for AI model configuration
- Add GcopConfig class for overall application configuration
- Include validation method for model configuration

These classes provide a structured way to manage application
configuration with proper type hints and default values. The
ModelConfig includes validation to ensure example values are
not used in production.
Comment thread gcop/__main__.py Outdated
Comment thread docs/guide/commands.md
- Version control information (latest tag, branch count, untracked files)
- Advanced details (submodules, latest merge commit, file type statistics)

### `gcop init-project`

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems I have not found the detail use cases of project and user cases. You can create a new case of custom git commit message template when a team need to use.

It seems that I haven't found the detailed use cases of the [The advantages of project config] use cases yet.

When the team needs to use it, you can create a new custom git commit message template. --> This case can be displayed in docs.

Comment thread gcop/__main__.py
typer.echo("No project config found")


@app.command(name="set-config")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to assert schema for every key.

Luffy2004-c and others added 6 commits May 1, 2025 23:22
- Implement is_key_in_config function to check nested keys
- Validate keys in set_config command before processing
- Improve error handling for invalid config keys

This change prevents setting invalid configuration keys by
validating them against the config schema first. It handles
both dataclass attributes and dictionary keys for nested
config structures.
- Added `install-docs` target to Makefile for easier documentation setup.
- Renamed `run-docs` to `start-docs` for clarity.
- Expanded documentation on project-based configuration, including a real-world example for standardizing commit messages.
- Improved configuration display in the `show_config` function to include merged effective configuration and better error handling for missing configs.
- Updated test descriptions for clarity and consistency.
@Undertone0809
Undertone0809 force-pushed the add-project-baseconfig branch from 2412432 to 21d6173 Compare May 24, 2025 14:25
@Undertone0809
Undertone0809 force-pushed the add-project-baseconfig branch from 691a9d7 to 6d5dc9b Compare May 24, 2025 14:31

@Undertone0809 Undertone0809 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current situation: If project config is not written with model config, I will give me a default config

Ideally: project config If model config is not written, project model config should be empty, or there is no model field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants