acedatacloud-cli 2026.4.5.0__tar.gz

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.
Files changed (29) hide show
  1. acedatacloud_cli-2026.4.5.0/.env.example +9 -0
  2. acedatacloud_cli-2026.4.5.0/CHANGELOG.md +18 -0
  3. acedatacloud_cli-2026.4.5.0/LICENSE +21 -0
  4. acedatacloud_cli-2026.4.5.0/PKG-INFO +192 -0
  5. acedatacloud_cli-2026.4.5.0/README.md +146 -0
  6. acedatacloud_cli-2026.4.5.0/adc_cli/__init__.py +1 -0
  7. acedatacloud_cli-2026.4.5.0/adc_cli/__main__.py +5 -0
  8. acedatacloud_cli-2026.4.5.0/adc_cli/commands/__init__.py +0 -0
  9. acedatacloud_cli-2026.4.5.0/adc_cli/commands/auth.py +55 -0
  10. acedatacloud_cli-2026.4.5.0/adc_cli/commands/image.py +84 -0
  11. acedatacloud_cli-2026.4.5.0/adc_cli/commands/info.py +31 -0
  12. acedatacloud_cli-2026.4.5.0/adc_cli/commands/music.py +45 -0
  13. acedatacloud_cli-2026.4.5.0/adc_cli/commands/search.py +64 -0
  14. acedatacloud_cli-2026.4.5.0/adc_cli/commands/task.py +122 -0
  15. acedatacloud_cli-2026.4.5.0/adc_cli/commands/video.py +65 -0
  16. acedatacloud_cli-2026.4.5.0/adc_cli/core/__init__.py +0 -0
  17. acedatacloud_cli-2026.4.5.0/adc_cli/core/client.py +130 -0
  18. acedatacloud_cli-2026.4.5.0/adc_cli/core/config.py +68 -0
  19. acedatacloud_cli-2026.4.5.0/adc_cli/core/exceptions.py +37 -0
  20. acedatacloud_cli-2026.4.5.0/adc_cli/core/output.py +159 -0
  21. acedatacloud_cli-2026.4.5.0/adc_cli/main.py +81 -0
  22. acedatacloud_cli-2026.4.5.0/pyproject.toml +120 -0
  23. acedatacloud_cli-2026.4.5.0/tests/__init__.py +0 -0
  24. acedatacloud_cli-2026.4.5.0/tests/conftest.py +129 -0
  25. acedatacloud_cli-2026.4.5.0/tests/test_client.py +202 -0
  26. acedatacloud_cli-2026.4.5.0/tests/test_commands.py +343 -0
  27. acedatacloud_cli-2026.4.5.0/tests/test_config.py +87 -0
  28. acedatacloud_cli-2026.4.5.0/tests/test_integration.py +31 -0
  29. acedatacloud_cli-2026.4.5.0/tests/test_output.py +103 -0
@@ -0,0 +1,9 @@
1
+ # AceDataCloud API Token (required)
2
+ # Get your token at https://platform.acedata.cloud
3
+ ACEDATACLOUD_API_TOKEN=
4
+
5
+ # API Base URL (optional, defaults to https://api.acedata.cloud)
6
+ # ACEDATACLOUD_API_BASE_URL=https://api.acedata.cloud
7
+
8
+ # Request timeout in seconds (optional, defaults to 1800)
9
+ # ADC_REQUEST_TIMEOUT=1800
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.1.0] - 2025-01-21
6
+
7
+ ### Added
8
+ - Initial release of AceDataCloud unified CLI
9
+ - `adc image` — Generate images via Flux, Midjourney, Seedream, NanoBanana
10
+ - `adc video` — Generate videos via Luma, Sora, Veo, Seedance
11
+ - `adc music` — Generate music via Suno
12
+ - `adc search` — Google search via SERP API
13
+ - `adc task` / `adc wait` — Task status polling for all services
14
+ - `adc auth login` / `adc auth status` — Token management
15
+ - `adc services` — List all available services
16
+ - `adc config` — Show current configuration
17
+ - `--json` flag on all commands for machine-readable output
18
+ - Config file persistence at `~/.config/adc/config`
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 AceDataCloud
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,192 @@
1
+ Metadata-Version: 2.1
2
+ Name: acedatacloud-cli
3
+ Version: 2026.4.5.0
4
+ Summary: Unified CLI for AceDataCloud AI services - images, videos, music, search, and chat
5
+ Project-URL: Homepage, https://github.com/AceDataCloud/AdcCli
6
+ Project-URL: Repository, https://github.com/AceDataCloud/AdcCli
7
+ Project-URL: Issues, https://github.com/AceDataCloud/AdcCli/issues
8
+ Project-URL: Changelog, https://github.com/AceDataCloud/AdcCli/blob/main/CHANGELOG.md
9
+ Author-email: AceDataCloud <support@acedata.cloud>
10
+ Maintainer-email: AceDataCloud <support@acedata.cloud>
11
+ License: MIT
12
+ License-File: LICENSE
13
+ Keywords: acedata,ai,chat,cli,command-line,image-generation,music-generation,search,video-generation
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Multimedia
24
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: click>=8.1.0
27
+ Requires-Dist: httpx>=0.27.0
28
+ Requires-Dist: pydantic>=2.0.0
29
+ Requires-Dist: python-dotenv>=1.0.0
30
+ Requires-Dist: rich>=13.0.0
31
+ Provides-Extra: all
32
+ Requires-Dist: acedatacloud-cli[dev,release,test]; extra == 'all'
33
+ Provides-Extra: dev
34
+ Requires-Dist: mypy>=1.10.0; extra == 'dev'
35
+ Requires-Dist: pre-commit>=3.7.0; extra == 'dev'
36
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
37
+ Provides-Extra: release
38
+ Requires-Dist: build>=1.2.0; extra == 'release'
39
+ Requires-Dist: twine>=6.1.0; extra == 'release'
40
+ Provides-Extra: test
41
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'test'
42
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'test'
43
+ Requires-Dist: pytest>=8.0.0; extra == 'test'
44
+ Requires-Dist: respx>=0.21.0; extra == 'test'
45
+ Description-Content-Type: text/markdown
46
+
47
+ # AceDataCloud CLI
48
+
49
+ Unified command-line interface for all AceDataCloud AI services — images, videos, music, and search.
50
+
51
+ ## Installation
52
+
53
+ ```bash
54
+ pip install acedatacloud-cli
55
+ ```
56
+
57
+ ## Quick Start
58
+
59
+ ```bash
60
+ # Save your API token
61
+ adc auth login
62
+
63
+ # Generate an image
64
+ adc image "A sunset over mountains, photorealistic"
65
+
66
+ # Generate a video
67
+ adc video "A cinematic ocean scene"
68
+
69
+ # Generate music
70
+ adc music "Upbeat electronic dance track"
71
+
72
+ # Search the web
73
+ adc search "artificial intelligence"
74
+
75
+ # Check task status
76
+ adc task abc123 -s flux
77
+
78
+ # Wait for completion
79
+ adc wait abc123 -s flux
80
+ ```
81
+
82
+ ## Configuration
83
+
84
+ Get your API token at [platform.acedata.cloud](https://platform.acedata.cloud).
85
+
86
+ ```bash
87
+ # Option 1: Login command (saves to ~/.config/adc/config)
88
+ adc auth login
89
+
90
+ # Option 2: Environment variable
91
+ export ACEDATACLOUD_API_TOKEN=your_token
92
+
93
+ # Option 3: Per-command flag
94
+ adc --token your_token image "A sunset"
95
+ ```
96
+
97
+ ## Commands
98
+
99
+ ### Image Generation
100
+
101
+ ```bash
102
+ adc image "A sunset over mountains" # Flux (default)
103
+ adc image "Cyberpunk city" --service midjourney # Midjourney
104
+ adc image "Logo design" --service seedream # Seedream
105
+ adc image "Add sunglasses" --image-url https://... # Edit with Flux
106
+ adc image "A landscape" -m flux-pro-1.1-ultra -s 16:9 # Custom model & size
107
+ ```
108
+
109
+ ### Video Generation
110
+
111
+ ```bash
112
+ adc video "A cinematic sunset" # Luma (default)
113
+ adc video "A rocket launching" --service sora # Sora
114
+ adc video "Clouds moving" --service veo # Veo
115
+ adc video "Dance scene" --service seedance # Seedance
116
+ adc video "Cat playing" --loop -a 16:9 # Loop + aspect ratio
117
+ ```
118
+
119
+ ### Music Generation
120
+
121
+ ```bash
122
+ adc music "An upbeat electronic dance track"
123
+ adc music "Calm piano jazz" --instrumental
124
+ ```
125
+
126
+ ### Web Search
127
+
128
+ ```bash
129
+ adc search "artificial intelligence"
130
+ adc search "tech news" -t news --time-range qdr:d
131
+ adc search "sunset photos" -t images -c us
132
+ ```
133
+
134
+ ### Task Management
135
+
136
+ ```bash
137
+ adc task abc123 -s flux # Check task status
138
+ adc task def456 -s luma --json # JSON output
139
+ adc wait abc123 -s flux # Wait for completion
140
+ adc wait def456 -s suno --interval 10 --timeout 300
141
+ ```
142
+
143
+ ### Info & Auth
144
+
145
+ ```bash
146
+ adc services # List all available services
147
+ adc config # Show configuration
148
+ adc auth login # Save API token
149
+ adc auth status # Check auth status
150
+ ```
151
+
152
+ ## JSON Output
153
+
154
+ All commands support `--json` for machine-readable output:
155
+
156
+ ```bash
157
+ adc image "A sunset" --json | jq '.task_id'
158
+ adc search "test query" --json | jq '.organic[].title'
159
+ ```
160
+
161
+ ## Supported Services
162
+
163
+ | Service | Type | Command |
164
+ | ------------ | ------ | -------------------------- |
165
+ | Flux | Image | `adc image --service flux` |
166
+ | Midjourney | Image | `adc image --service midjourney` |
167
+ | Seedream | Image | `adc image --service seedream` |
168
+ | NanoBanana | Image | `adc image --service nanobanana` |
169
+ | Suno | Music | `adc music` |
170
+ | Luma | Video | `adc video --service luma` |
171
+ | Sora | Video | `adc video --service sora` |
172
+ | Veo | Video | `adc video --service veo` |
173
+ | Seedance | Video | `adc video --service seedance` |
174
+ | SERP | Search | `adc search` |
175
+
176
+ ## Development
177
+
178
+ ```bash
179
+ # Install with dev dependencies
180
+ pip install -e ".[all]"
181
+
182
+ # Run tests
183
+ pytest
184
+
185
+ # Lint
186
+ ruff check .
187
+ ruff format --check .
188
+ ```
189
+
190
+ ## License
191
+
192
+ MIT
@@ -0,0 +1,146 @@
1
+ # AceDataCloud CLI
2
+
3
+ Unified command-line interface for all AceDataCloud AI services — images, videos, music, and search.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install acedatacloud-cli
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ # Save your API token
15
+ adc auth login
16
+
17
+ # Generate an image
18
+ adc image "A sunset over mountains, photorealistic"
19
+
20
+ # Generate a video
21
+ adc video "A cinematic ocean scene"
22
+
23
+ # Generate music
24
+ adc music "Upbeat electronic dance track"
25
+
26
+ # Search the web
27
+ adc search "artificial intelligence"
28
+
29
+ # Check task status
30
+ adc task abc123 -s flux
31
+
32
+ # Wait for completion
33
+ adc wait abc123 -s flux
34
+ ```
35
+
36
+ ## Configuration
37
+
38
+ Get your API token at [platform.acedata.cloud](https://platform.acedata.cloud).
39
+
40
+ ```bash
41
+ # Option 1: Login command (saves to ~/.config/adc/config)
42
+ adc auth login
43
+
44
+ # Option 2: Environment variable
45
+ export ACEDATACLOUD_API_TOKEN=your_token
46
+
47
+ # Option 3: Per-command flag
48
+ adc --token your_token image "A sunset"
49
+ ```
50
+
51
+ ## Commands
52
+
53
+ ### Image Generation
54
+
55
+ ```bash
56
+ adc image "A sunset over mountains" # Flux (default)
57
+ adc image "Cyberpunk city" --service midjourney # Midjourney
58
+ adc image "Logo design" --service seedream # Seedream
59
+ adc image "Add sunglasses" --image-url https://... # Edit with Flux
60
+ adc image "A landscape" -m flux-pro-1.1-ultra -s 16:9 # Custom model & size
61
+ ```
62
+
63
+ ### Video Generation
64
+
65
+ ```bash
66
+ adc video "A cinematic sunset" # Luma (default)
67
+ adc video "A rocket launching" --service sora # Sora
68
+ adc video "Clouds moving" --service veo # Veo
69
+ adc video "Dance scene" --service seedance # Seedance
70
+ adc video "Cat playing" --loop -a 16:9 # Loop + aspect ratio
71
+ ```
72
+
73
+ ### Music Generation
74
+
75
+ ```bash
76
+ adc music "An upbeat electronic dance track"
77
+ adc music "Calm piano jazz" --instrumental
78
+ ```
79
+
80
+ ### Web Search
81
+
82
+ ```bash
83
+ adc search "artificial intelligence"
84
+ adc search "tech news" -t news --time-range qdr:d
85
+ adc search "sunset photos" -t images -c us
86
+ ```
87
+
88
+ ### Task Management
89
+
90
+ ```bash
91
+ adc task abc123 -s flux # Check task status
92
+ adc task def456 -s luma --json # JSON output
93
+ adc wait abc123 -s flux # Wait for completion
94
+ adc wait def456 -s suno --interval 10 --timeout 300
95
+ ```
96
+
97
+ ### Info & Auth
98
+
99
+ ```bash
100
+ adc services # List all available services
101
+ adc config # Show configuration
102
+ adc auth login # Save API token
103
+ adc auth status # Check auth status
104
+ ```
105
+
106
+ ## JSON Output
107
+
108
+ All commands support `--json` for machine-readable output:
109
+
110
+ ```bash
111
+ adc image "A sunset" --json | jq '.task_id'
112
+ adc search "test query" --json | jq '.organic[].title'
113
+ ```
114
+
115
+ ## Supported Services
116
+
117
+ | Service | Type | Command |
118
+ | ------------ | ------ | -------------------------- |
119
+ | Flux | Image | `adc image --service flux` |
120
+ | Midjourney | Image | `adc image --service midjourney` |
121
+ | Seedream | Image | `adc image --service seedream` |
122
+ | NanoBanana | Image | `adc image --service nanobanana` |
123
+ | Suno | Music | `adc music` |
124
+ | Luma | Video | `adc video --service luma` |
125
+ | Sora | Video | `adc video --service sora` |
126
+ | Veo | Video | `adc video --service veo` |
127
+ | Seedance | Video | `adc video --service seedance` |
128
+ | SERP | Search | `adc search` |
129
+
130
+ ## Development
131
+
132
+ ```bash
133
+ # Install with dev dependencies
134
+ pip install -e ".[all]"
135
+
136
+ # Run tests
137
+ pytest
138
+
139
+ # Lint
140
+ ruff check .
141
+ ruff format --check .
142
+ ```
143
+
144
+ ## License
145
+
146
+ MIT
@@ -0,0 +1 @@
1
+ """AceDataCloud CLI - Unified CLI for AI services."""
@@ -0,0 +1,5 @@
1
+ """Allow running as python -m adc_cli."""
2
+
3
+ from adc_cli.main import cli
4
+
5
+ cli()
@@ -0,0 +1,55 @@
1
+ """Auth commands for token management."""
2
+
3
+ import click
4
+
5
+ from adc_cli.core.config import save_token_to_config, settings
6
+ from adc_cli.core.output import console, print_success
7
+
8
+
9
+ @click.group()
10
+ def auth() -> None:
11
+ """Manage API authentication.
12
+
13
+ \b
14
+ Examples:
15
+ adc auth login
16
+ adc auth status
17
+ """
18
+
19
+
20
+ @auth.command()
21
+ @click.option("--token", prompt="API Token", hide_input=True, help="Your AceDataCloud API token.")
22
+ def login(token: str) -> None:
23
+ """Save your API token for future use.
24
+
25
+ Get your token at https://platform.acedata.cloud
26
+
27
+ Examples:
28
+
29
+ adc auth login
30
+ """
31
+ save_token_to_config(token)
32
+ print_success("Token saved successfully!")
33
+ console.print("[dim]Token stored in ~/.config/adc/config[/dim]")
34
+
35
+
36
+ @auth.command()
37
+ def status() -> None:
38
+ """Check current authentication status."""
39
+ from rich.table import Table
40
+
41
+ table = Table(title="Auth Status")
42
+ table.add_column("Setting", style="bold cyan")
43
+ table.add_column("Value")
44
+
45
+ table.add_row("API Base URL", settings.api_base_url)
46
+ table.add_row(
47
+ "API Token",
48
+ f"{settings.api_token[:8]}..." if settings.api_token else "[red]Not configured[/red]",
49
+ )
50
+ table.add_row(
51
+ "Status",
52
+ "[green]Configured[/green]" if settings.is_configured else "[red]Not configured[/red]",
53
+ )
54
+
55
+ console.print(table)
@@ -0,0 +1,84 @@
1
+ """Image generation commands."""
2
+
3
+ import click
4
+
5
+ from adc_cli.core.client import get_client
6
+ from adc_cli.core.exceptions import AdcError
7
+ from adc_cli.core.output import print_error, print_json, print_result
8
+
9
+
10
+ @click.command()
11
+ @click.argument("prompt")
12
+ @click.option(
13
+ "--service",
14
+ type=click.Choice(["flux", "midjourney", "seedream", "nanobanana"]),
15
+ default="flux",
16
+ help="Image generation service to use.",
17
+ )
18
+ @click.option("-m", "--model", default=None, help="Model name (service-specific).")
19
+ @click.option("-s", "--size", default=None, help="Image size or aspect ratio.")
20
+ @click.option("-n", "--count", default=None, type=int, help="Number of images.")
21
+ @click.option("--image-url", default=None, help="Source image URL (for editing).")
22
+ @click.option("--json", "output_json", is_flag=True, help="Output raw JSON.")
23
+ @click.pass_context
24
+ def image(
25
+ ctx: click.Context,
26
+ prompt: str,
27
+ service: str,
28
+ model: str | None,
29
+ size: str | None,
30
+ count: int | None,
31
+ image_url: str | None,
32
+ output_json: bool,
33
+ ) -> None:
34
+ """Generate or edit an image using AI.
35
+
36
+ PROMPT describes the image to generate or changes to make.
37
+
38
+ \b
39
+ Examples:
40
+ adc image "A sunset over mountains, photorealistic"
41
+ adc image "Cyberpunk city" --service midjourney
42
+ adc image "Add sunglasses" --image-url https://example.com/photo.jpg
43
+ adc image "Logo design" --service flux -m flux-pro-1.1-ultra -s 16:9
44
+ """
45
+ client = get_client(ctx.obj.get("token"))
46
+ try:
47
+ if service == "flux":
48
+ action = "edit" if image_url else "generate"
49
+ payload: dict[str, object] = {
50
+ "action": action,
51
+ "prompt": prompt,
52
+ "model": model or ("flux-kontext-pro" if image_url else "flux-dev"),
53
+ "size": size,
54
+ "count": count,
55
+ "image_url": image_url,
56
+ }
57
+ result = client.flux_image(**payload) # type: ignore[arg-type]
58
+ elif service == "midjourney":
59
+ payload = {
60
+ "prompt": prompt,
61
+ "size": size,
62
+ "version": model,
63
+ }
64
+ result = client.midjourney_imagine(**payload) # type: ignore[arg-type]
65
+ else:
66
+ # seedream, nanobanana — generic image endpoint
67
+ payload = {
68
+ "action": "generate",
69
+ "prompt": prompt,
70
+ "model": model,
71
+ "size": size,
72
+ }
73
+ result = client.request(
74
+ f"/{service}/images",
75
+ client._with_async_callback(payload), # noqa: SLF001
76
+ )
77
+
78
+ if output_json:
79
+ print_json(result)
80
+ else:
81
+ print_result(result, "Image Result")
82
+ except AdcError as e:
83
+ print_error(e.message)
84
+ raise SystemExit(1) from e
@@ -0,0 +1,31 @@
1
+ """Info and utility commands."""
2
+
3
+ import click
4
+
5
+ from adc_cli.core.config import settings
6
+ from adc_cli.core.output import console, print_services
7
+
8
+
9
+ @click.command()
10
+ def services() -> None:
11
+ """List all available AceDataCloud services."""
12
+ print_services()
13
+
14
+
15
+ @click.command()
16
+ def config() -> None:
17
+ """Show current configuration."""
18
+ from rich.table import Table
19
+
20
+ table = Table(title="AceDataCloud CLI Configuration")
21
+ table.add_column("Setting", style="bold cyan")
22
+ table.add_column("Value")
23
+
24
+ table.add_row("API Base URL", settings.api_base_url)
25
+ table.add_row(
26
+ "API Token",
27
+ f"{settings.api_token[:8]}..." if settings.api_token else "[red]Not set[/red]",
28
+ )
29
+ table.add_row("Request Timeout", f"{settings.request_timeout}s")
30
+
31
+ console.print(table)
@@ -0,0 +1,45 @@
1
+ """Music generation commands."""
2
+
3
+ import click
4
+
5
+ from adc_cli.core.client import get_client
6
+ from adc_cli.core.exceptions import AdcError
7
+ from adc_cli.core.output import print_error, print_json, print_result
8
+
9
+
10
+ @click.command()
11
+ @click.argument("prompt")
12
+ @click.option("--instrumental", is_flag=True, default=False, help="Generate instrumental only.")
13
+ @click.option("--json", "output_json", is_flag=True, help="Output raw JSON.")
14
+ @click.pass_context
15
+ def music(
16
+ ctx: click.Context,
17
+ prompt: str,
18
+ instrumental: bool,
19
+ output_json: bool,
20
+ ) -> None:
21
+ """Generate music using Suno AI.
22
+
23
+ PROMPT describes the music to generate.
24
+
25
+ \b
26
+ Examples:
27
+ adc music "An upbeat electronic dance track"
28
+ adc music "Calm piano jazz" --instrumental
29
+ """
30
+ client = get_client(ctx.obj.get("token"))
31
+ try:
32
+ payload: dict[str, object] = {
33
+ "action": "generate",
34
+ "prompt": prompt,
35
+ "instrumental": instrumental,
36
+ }
37
+
38
+ result = client.suno_music(**payload) # type: ignore[arg-type]
39
+ if output_json:
40
+ print_json(result)
41
+ else:
42
+ print_result(result, "Music Result")
43
+ except AdcError as e:
44
+ print_error(e.message)
45
+ raise SystemExit(1) from e
@@ -0,0 +1,64 @@
1
+ """Search commands."""
2
+
3
+ import click
4
+
5
+ from adc_cli.core.client import get_client
6
+ from adc_cli.core.exceptions import AdcError
7
+ from adc_cli.core.output import print_error, print_json, print_search_result
8
+
9
+
10
+ @click.command()
11
+ @click.argument("query")
12
+ @click.option(
13
+ "-t",
14
+ "--type",
15
+ "search_type",
16
+ type=click.Choice(["search", "images", "news", "maps", "places", "videos"]),
17
+ default="search",
18
+ help="Type of search.",
19
+ )
20
+ @click.option("-c", "--country", default=None, help="Country code (e.g. us, cn, uk).")
21
+ @click.option("-l", "--language", default=None, help="Language code (e.g. en, zh-cn).")
22
+ @click.option("--time-range", default=None, help="Time filter: qdr:h, qdr:d, qdr:w, qdr:m.")
23
+ @click.option("-n", "--number", default=None, type=int, help="Number of results.")
24
+ @click.option("--json", "output_json", is_flag=True, help="Output raw JSON.")
25
+ @click.pass_context
26
+ def search(
27
+ ctx: click.Context,
28
+ query: str,
29
+ search_type: str,
30
+ country: str | None,
31
+ language: str | None,
32
+ time_range: str | None,
33
+ number: int | None,
34
+ output_json: bool,
35
+ ) -> None:
36
+ """Search Google using SERP API.
37
+
38
+ QUERY is the search query.
39
+
40
+ \b
41
+ Examples:
42
+ adc search "artificial intelligence"
43
+ adc search "tech news" -t news --time-range qdr:d
44
+ adc search "sunset photos" -t images -c us
45
+ """
46
+ client = get_client(ctx.obj.get("token"))
47
+ try:
48
+ payload: dict[str, object] = {
49
+ "query": query,
50
+ "type": search_type,
51
+ "country": country,
52
+ "language": language,
53
+ "range": time_range,
54
+ "number": number,
55
+ }
56
+
57
+ result = client.serp_search(**payload) # type: ignore[arg-type]
58
+ if output_json:
59
+ print_json(result)
60
+ else:
61
+ print_search_result(result)
62
+ except AdcError as e:
63
+ print_error(e.message)
64
+ raise SystemExit(1) from e