Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ pipx install git-draft[openai]
* Mechanism for reporting feedback from a bot, and possibly allowing user to
interactively respond.
* Add MCP bot.
* Store configuration in `gitconfig` as `draft.*` entries. This can be used for
example to set a unique repo ID, and default bot to use per repo (or more
widely via shared `gitconfig` files).
10 changes: 2 additions & 8 deletions docs/git-draft.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ IMPORTANT: `git-draft` is WIP.

[verse]
git draft [options] [--generate] [--accept... | --no-accept] [--bot BOT]
[--edit] [--reset | --no-reset] [--sync | --no-sync]
[TEMPLATE [VARIABLE...]]
git draft [options] --finalize [--delete] [--sync | --no-sync]
[--edit] [--reset | --no-reset] [TEMPLATE [VARIABLE...]]
git draft [options] --finalize [--delete]
git draft [options] --show-drafts [--json]
git draft [options] --show-prompts [--json] [PROMPT]
git draft [options] --show-templates [--json | [--edit] TEMPLATE]
Expand Down Expand Up @@ -96,11 +95,6 @@ git draft [options] --show-templates [--json | [--edit] TEMPLATE]
Lists available templates.
With an template name argument, displays the corresponding template's contents or, if the `--edit` option is set, opens an interactive editor.

-s::
--sync::
--no-sync::
Create a sync commit with any changes.

-t TIMEOUT::
--timeout=TIMEOUT::
Action timeout.
Expand Down
50 changes: 2 additions & 48 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ readme = "README.md"
dynamic = ["version"]
requires-python = ">=3.12"
dependencies = [
"gitpython (>=3.1.44,<4)",
"jinja2 (>=3.1.5,<4)",
"prettytable (>=3.15.1,<4)",
"xdg-base-dirs (>=6.0.2,<7)",
Expand Down
20 changes: 2 additions & 18 deletions src/git_draft/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ def callback(
help="use JSON for table output",
action="store_true",
)
parser.add_option(
"-s",
"--sync",
help="commit prior worktree changes separately",
action="store_true",
)

parser.add_option(
"--no-accept",
Expand All @@ -114,12 +108,6 @@ def callback(
dest="reset",
action="store_false",
)
parser.add_option(
"--no-sync",
help="do not commit intermediate worktree changes",
dest="sync",
action="store_false",
)
parser.add_option(
"--reset",
help="reset index before generating a new draft",
Expand Down Expand Up @@ -160,7 +148,7 @@ def on_rename_file(
self,
src_path: PurePosixPath,
dst_path: PurePosixPath,
_reason: str | None
_reason: str | None,
) -> None:
print(f"Renamed {src_path} to {dst_path}.")

Expand Down Expand Up @@ -233,7 +221,6 @@ def main() -> None: # noqa: PLR0912 PLR0915
prompt_transform=open_editor if editable else None,
tool_visitors=[ToolPrinter()],
reset=config.reset if opts.reset is None else opts.reset,
sync=config.sync if opts.sync is None else opts.sync,
)
match accept:
case Accept.MANUAL:
Expand All @@ -245,10 +232,7 @@ def main() -> None: # noqa: PLR0912 PLR0915
case _:
raise UnreachableError()
case "finalize":
draft = drafter.finalize_draft(
delete=opts.delete,
sync=config.sync if opts.sync is None else opts.sync,
)
draft = drafter.finalize_draft(delete=opts.delete)
print(f"Finalized {draft.branch_name}.")
case "show-drafts":
table = drafter.history_table(args[0] if args else None)
Expand Down
12 changes: 11 additions & 1 deletion src/git_draft/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class Config:
bots: Sequence[BotConfig] = dataclasses.field(default_factory=lambda: [])
log_level: int = logging.INFO
reset: bool = True
sync: bool = False

@staticmethod
def folder_path() -> Path:
Expand Down Expand Up @@ -74,6 +73,17 @@ class BotConfig:
pythonpath: str | None = None


type RepoID = str


@dataclasses.dataclass(frozen=True)
class RepoConfig: # TODO: Use
"""Repository-specific config"""

repo_id: str
bot_name: str | None = None


def config_string(arg: str) -> str:
"""Dereferences environment value if the input starts with `$`"""
return os.environ[arg[1:]] if arg and arg.startswith("$") else arg
Expand Down
Loading