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
33 changes: 33 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copilot Instructions For This Repository

## Design Principles

- Prefer explicit data models over loosely structured dictionaries when representing domain concepts.
- Favor Domain-Driven Design (DDD) thinking for new features and refactors when it fits the change:
- Keep domain concepts, language, and invariants clear.
- Organize code around domain behavior and boundaries, not only technical layers.
- Avoid leaking infrastructure details into core domain logic.
- Keep business rules close to domain models and domain services.
- Use modern python syntax for python 3.10 and higher, such as pattern matching, type hints, dataclasses, enums, f-strings, and more.
- Favor pathlib for file system paths and operations
- Follow pep8 and use type hints (avoid dynamically typed Any when possible, prefer more specific types)
## Command Execution

- Use `uv run` when project Python dependencies or the project environment are needed.
- This applies to tests, linting, type-checking, scripts, and local tooling commands that rely on the repository environment.
- It is acceptable to run commands without `uv run` when the `.venv` or project dependencies are not needed.
- Prefer forms like:
- `uv run pytest`
- `uv run ruff check .`
- `uv run mypy .`
- `uv run python <script>.py`

## Change Discipline

- Preserve existing behavior unless a change request explicitly asks for behavior changes.
- Keep changes minimal and focused on the requested outcome.
- Add or update tests when behavior is added or changed.

## Test driven development (TDD)
- If the change is a bug fix, first write a test that reproduces the bug. The test should fail before the fix is implemented.
- For new features, and changes this is optional but encouraged. Do it when it makes sense.
135 changes: 135 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Create New Release",
"type": "shell",
"command": "uv run --no-sync toolit create-new-release",
"problemMatcher": [],
"detail": "Create a new release for the project, by reading the version from the pyproject.toml file, and adding and pushing a new tag to the repository."
},
{
"label": "Create New Task In Devops",
"type": "shell",
"command": "uv run --no-sync toolit create-new-task-in-devops \"${input:create_new_task_in_devops_title}\" \"${input:create_new_task_in_devops_description}\" \"${input:create_new_task_in_devops_work_item_id}\" \"${input:create_new_task_in_devops_target_branch}\" --draft \"${input:create_new_task_in_devops_draft}\"",
"problemMatcher": [],
"detail": "Create a new task in Azure DevOps."
},
{
"label": "Get Change Log",
"type": "shell",
"command": "uv run --no-sync toolit get-change-log",
"problemMatcher": [],
"detail": "Mocked for now."
},
{
"label": "Task String Input With Default",
"type": "shell",
"command": "uv run --no-sync toolit task-string-input-with-default --string-input \"${input:task_string_input_with_default_string_input}\"",
"problemMatcher": [],
"detail": "A task that uses a string input with a default value."
},
{
"label": "Task Use Bool Input",
"type": "shell",
"command": "uv run --no-sync toolit task-use-bool-input \"${input:task_use_bool_input_bool_input}\"",
"problemMatcher": [],
"detail": "A task that uses a boolean input."
},
{
"label": "Task Use Enum Input",
"type": "shell",
"command": "uv run --no-sync toolit task-use-enum-input \"${input:task_use_enum_input_enum_input}\"",
"problemMatcher": [],
"detail": "A task that uses an enum input."
},
{
"label": "Dummy Clitool",
"type": "shell",
"command": "uv run --no-sync toolit dummy-clitool",
"problemMatcher": [],
"detail": "A dummy CLI tool that returns a shell command string."
},
{
"label": "Group: Task Run Both Tools",
"dependsOn": [
"Task Use Bool Input",
"Task Use Enum Input"
],
"problemMatcher": [],
"dependsOrder": "sequence",
"detail": "Run both tools in a sequential group."
},
{
"label": "Group: Task Run Both Tools Parallel",
"dependsOn": [
"Task Use Bool Input",
"Task Use Enum Input"
],
"problemMatcher": [],
"detail": "Run both tools in a parallel group."
}
],
"inputs": [
{
"id": "create_new_task_in_devops_title",
"type": "promptString",
"description": "Enter value for title (str)",
"default": ""
},
{
"id": "create_new_task_in_devops_description",
"type": "promptString",
"description": "Enter value for description (str)",
"default": ""
},
{
"id": "create_new_task_in_devops_work_item_id",
"type": "promptString",
"description": "Enter value for work_item_id (str)",
"default": ""
},
{
"id": "create_new_task_in_devops_target_branch",
"type": "promptString",
"description": "Enter value for target_branch (str)",
"default": ""
},
{
"id": "create_new_task_in_devops_draft",
"type": "pickString",
"description": "Enter value for draft (bool)",
"default": "False",
"options": [
"True",
"False"
]
},
{
"id": "task_string_input_with_default_string_input",
"type": "promptString",
"description": "Enter value for string_input (str)",
"default": "default value"
},
{
"id": "task_use_bool_input_bool_input",
"type": "pickString",
"description": "Enter value for bool_input (bool)",
"default": "False",
"options": [
"True",
"False"
]
},
{
"id": "task_use_enum_input_enum_input",
"type": "pickString",
"description": "Enter value for enum_input (DummyEnum)",
"default": "Option a",
"options": [
"Option a",
"Option b"
]
}
]
}
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ All notable changes to this project will be documented in this file.

*NOTE:* Version 0.X.X might have breaking changes in bumps of the minor version number. This is because the project is still in early development and the API is not yet stable. It will still be marked clearly in the release notes.

## [0.7.0] - Unreleased
## [0.7.0] - 03-05-2026
- Added support for the Optional and Union type hints in the CLI arguments. This allows for more flexible command definitions and better type checking.
- Improved support for list parameters in the CLI, and handled the vscode tasks generation for list parameters appropriately.
- Raise an error if a proper type hint is not provided for a parameter in a tool function.
- Make it possible to invoke the CLI using `python -m toolit` in addition to the `toolit` command, which is useful for environments where the command might not be available (or when there is a specific venv or python version you want to use).
- Add the @clitool decorator for ability to easily run CLI commands
- Better support for environment activation by using `uv run --no-sync` to fix problem of python interpreter not being correctly detected in vscode when using uv as the environment manager.

## [0.6.0] - 20-12-2025
- Abandon python 3.9 which is deprecated. Now only support python 3.10 and higher.
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ toolit --help # To see available commands
toolit my-command --to_print "Hello, Toolit!" # To run your command
```

You add a command line command with parameter as a devtool, and it will be available as a command in the CLI and in the generated `tasks.json` file for Visual Studio Code. You do this by:

```python
# devtools/my_cli_commands.py
from toolit import clitool
@clitool
def execute_cli_command(to_print: str = "Hello, World!") -> str:
"""This is a command that can be run from the CLI."""
return "python -c 'print(\"" + to_print + "\")'"
```

When this command runs from CLI or a generated VS Code task, Toolit executes the returned string in your shell.


### Customizing the DevTools Folder
By default, Toolit looks for a folder named `devtools` in the project root. You can customize this by creating a `toolit.ini` or use your `pyproject.toml` file in your project root with the following content:

Expand Down
Loading
Loading