コンテンツにスキップ

Project コマンド

プロジェクト管理操作。

一覧

poe cli project list

作成

poe cli project create --title "Refactor" --desc "Improve CLI layer" --status active

検索

poe cli project search refactor

取得

poe cli project get <PROJECT_ID>

更新

poe cli project update <PROJECT_ID> --title "Refactor v2" --desc "More improvements" --status on_hold

削除

poe cli project delete <PROJECT_ID>
poe cli project delete <PROJECT_ID> --force

内部ヘルパー対応表

ヘルパー 説明 Service メソッド
_get_all_projects 全件取得 get_all_projects
_create_project 作成 create_project
_get_project 単体取得 get_project_by_id
_search_projects タイトル検索 search_projects_by_title
_update_project 更新 update_project
_delete_project 削除 delete_project

API リファレンス

Project related CLI commands.

GUI層の代替として Application Service を呼び出す Typer サブコマンド群。

app = typer.Typer(help='プロジェクト CRUD / 検索 コマンド') module-attribute

console = Console() module-attribute

list_projects()

全プロジェクトを一覧表示するコマンド [AI GENERATED]

ApplicationService から全件取得し Rich Table で出力します。

ソースコード位置: src/cli/commands/project.py
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
@app.command("list", help="全プロジェクト一覧を表示")
@handle_cli_errors()
def list_projects() -> None:
    """全プロジェクトを一覧表示するコマンド [AI GENERATED]

    ApplicationService から全件取得し Rich Table で出力します。
    """
    from logic.queries.project_queries import GetAllProjectsQuery

    projects = _get_all_projects(GetAllProjectsQuery())
    table = Table(
        title="Projects",
        box=box.SIMPLE_HEAVY,
        caption=f"Total: {len(projects.result)} Elapsed: {projects.elapsed:.2f}s",
    )
    table.add_column("ID")
    table.add_column("Title")
    table.add_column("Status")
    for p in projects.result:
        table.add_row(str(p.id), p.title, p.status.value if hasattr(p.status, "value") else str(p.status))
    console.print(table)

create_project(title=typer.Option(None, '--title', '-t', help='プロジェクトタイトル'), description=typer.Option(None, '--desc', '-d', help='説明'), status=ProjectStatus.ACTIVE)

新しいプロジェクトを作成するコマンド [AI GENERATED]

引数:

名前 タイプ デスクリプション デフォルト
title str | None

プロジェクトタイトル (未指定なら対話入力)

Option(None, '--title', '-t', help='プロジェクトタイトル')
description str | None

説明 (未指定なら対話入力可)

Option(None, '--desc', '-d', help='説明')
status ProjectStatus

初期ステータス

ACTIVE
ソースコード位置: src/cli/commands/project.py
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
@app.command("create", help="新しいプロジェクトを作成")
@handle_cli_errors()
def create_project(
    title: str | None = typer.Option(None, "--title", "-t", help="プロジェクトタイトル"),
    description: str | None = typer.Option(None, "--desc", "-d", help="説明"),
    status: ProjectStatus = ProjectStatus.ACTIVE,
) -> None:  # [AI GENERATED] CLI create project
    """新しいプロジェクトを作成するコマンド [AI GENERATED]

    Args:
        title: プロジェクトタイトル (未指定なら対話入力)
        description: 説明 (未指定なら対話入力可)
        status: 初期ステータス
    """
    from logic.commands.project_commands import CreateProjectCommand

    if title is None:
        title = questionary.text("Title?").ask()
    if description is None:
        description = questionary.text("Description? (optional)").ask()

    if title is None:
        msg = "title が必要です"  # [AI GENERATED] validation message
        raise typer.BadParameter(msg)
    cmd = CreateProjectCommand(title=title, description=description or "", status=status)
    project = _create_project(cmd)
    console.print(
        f"[green]Created:[/green] {project.result.title} ({project.result.id}) Elapsed: {project.elapsed:.2f}s"
    )

get_project(project_id)

ID を指定してプロジェクトの詳細を取得するコマンド [AI GENERATED]

引数:

名前 タイプ デスクリプション デフォルト
project_id str

取得対象プロジェクト UUID 文字列

必須
ソースコード位置: src/cli/commands/project.py
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
@app.command("get", help="ID指定で取得")
@handle_cli_errors()
def get_project(project_id: str) -> None:
    """ID を指定してプロジェクトの詳細を取得するコマンド [AI GENERATED]

    Args:
        project_id: 取得対象プロジェクト UUID 文字列
    """
    from logic.queries.project_queries import GetProjectByIdQuery

    pid = uuid.UUID(project_id)
    project = _get_project(GetProjectByIdQuery(project_id=pid))
    table = Table(title="Project Detail", box=box.MINIMAL_DOUBLE_HEAD, caption=f"Elapsed: {project.elapsed:.2f}s")
    table.add_column("Field")
    table.add_column("Value")
    table.add_row("ID", str(project.result.id))
    table.add_row("Title", project.result.title)
    table.add_row(
        "Status",
        project.result.status.value if hasattr(project.result.status, "value") else str(project.result.status),
    )
    table.add_row("Description", project.result.description or "")
    console.print(table)

search_projects(query)

タイトルの部分一致でプロジェクトを検索するコマンド [AI GENERATED]

引数:

名前 タイプ デスクリプション デフォルト
query str

検索語 (部分一致)

必須
ソースコード位置: src/cli/commands/project.py
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
@app.command("search", help="タイトル部分一致検索")
@handle_cli_errors()
def search_projects(query: str) -> None:
    """タイトルの部分一致でプロジェクトを検索するコマンド [AI GENERATED]

    Args:
        query: 検索語 (部分一致)
    """
    from logic.queries.project_queries import SearchProjectsByTitleQuery

    results = _search_projects(SearchProjectsByTitleQuery(title_query=query))
    if not results.result:
        console.print("[yellow]No results[/yellow]")
        raise typer.Exit(code=0)
    table = Table(
        title=f"Search: {query}",
        box=box.SIMPLE,
        caption=f"Hits: {len(results.result)} Elapsed: {results.elapsed:.2f}s",
    )
    table.add_column("ID")
    table.add_column("Title")
    table.add_column("Status")
    for p in results.result:
        table.add_row(str(p.id), p.title, p.status.value if hasattr(p.status, "value") else str(p.status))
    console.print(table)

update_project(project_id=typer.Argument(..., help='対象プロジェクトID'), title=typer.Option(None, '--title', '-t', help='新しいタイトル'), description=typer.Option(None, '--desc', '-d', help='説明'), status=None)

既存プロジェクトのタイトル/説明/ステータスを更新するコマンド [AI GENERATED]

未指定の場合は対話入力モードに入ります。

引数:

名前 タイプ デスクリプション デフォルト
project_id str

対象プロジェクト UUID

Argument(..., help='対象プロジェクトID')
title str | None

新タイトル

Option(None, '--title', '-t', help='新しいタイトル')
description str | None

新説明

Option(None, '--desc', '-d', help='説明')
status ProjectStatus | None

新ステータス

None
ソースコード位置: src/cli/commands/project.py
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
@app.command("update", help="既存プロジェクトを更新")
@handle_cli_errors()
def update_project(
    project_id: str = typer.Argument(..., help="対象プロジェクトID"),
    title: str | None = typer.Option(None, "--title", "-t", help="新しいタイトル"),
    description: str | None = typer.Option(None, "--desc", "-d", help="説明"),
    status: ProjectStatus | None = None,
) -> None:  # [AI GENERATED] CLI update project
    """既存プロジェクトのタイトル/説明/ステータスを更新するコマンド [AI GENERATED]

    未指定の場合は対話入力モードに入ります。

    Args:
        project_id: 対象プロジェクト UUID
        title: 新タイトル
        description: 新説明
        status: 新ステータス
    """
    from logic.commands.project_commands import UpdateProjectCommand

    pid = uuid.UUID(project_id)
    if title is None and description is None and status is None:
        # interactive prompt if nothing provided
        title = questionary.text("New Title (blank=skip)").ask() or None
        description = questionary.text("New Description (blank=skip)").ask() or None
        if questionary.confirm("Change status?").ask():
            status_choice = questionary.select("Status", choices=[s.value for s in ProjectStatus]).ask()
            if status_choice:
                status = ProjectStatus(status_choice)

    cmd = UpdateProjectCommand(project_id=pid, title=title, description=description, status=status)
    updated = _update_project(cmd)
    console.print(
        f"[green]Updated:[/green] {updated.result.title} ({updated.result.id}) Elapsed: {updated.elapsed:.2f}s"
    )

delete_project(project_id, force=typer.Option(default=False, help='確認なしで削除', rich_help_panel='Danger'))

プロジェクトを削除するコマンド [AI GENERATED]

force 指定が無い場合は確認プロンプトを表示します。

引数:

名前 タイプ デスクリプション デフォルト
project_id str

削除対象 UUID

必須
force bool

確認無しで削除するか

Option(default=False, help='確認なしで削除', rich_help_panel='Danger')
ソースコード位置: src/cli/commands/project.py
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
@app.command("delete", help="プロジェクト削除")
@handle_cli_errors()
def delete_project(
    project_id: str,
    force: bool = typer.Option(
        default=False,
        help="確認なしで削除",
        rich_help_panel="Danger",
    ),
) -> None:
    """プロジェクトを削除するコマンド [AI GENERATED]

    force 指定が無い場合は確認プロンプトを表示します。

    Args:
        project_id: 削除対象 UUID
        force: 確認無しで削除するか
    """
    from logic.commands.project_commands import DeleteProjectCommand

    pid = uuid.UUID(project_id)
    if (not force) and (not questionary.confirm("Delete this project?").ask()):
        console.print("[yellow]Cancelled[/yellow]")
        raise typer.Exit(code=1)
    deleted = _delete_project(DeleteProjectCommand(project_id=pid))
    console.print(f"[red]Deleted:[/red] {pid} Elapsed: {deleted.elapsed:.2f}s")