pixel-asset-master 0.1.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 (32) hide show
  1. pixel_asset_master-0.1.0/LICENSE +21 -0
  2. pixel_asset_master-0.1.0/PKG-INFO +200 -0
  3. pixel_asset_master-0.1.0/README.md +190 -0
  4. pixel_asset_master-0.1.0/pyproject.toml +26 -0
  5. pixel_asset_master-0.1.0/setup.cfg +4 -0
  6. pixel_asset_master-0.1.0/src/pixel_asset_master/__init__.py +3 -0
  7. pixel_asset_master-0.1.0/src/pixel_asset_master/cli.py +164 -0
  8. pixel_asset_master-0.1.0/src/pixel_asset_master/common.py +103 -0
  9. pixel_asset_master-0.1.0/src/pixel_asset_master/finalize.py +176 -0
  10. pixel_asset_master-0.1.0/src/pixel_asset_master/install_skill.py +39 -0
  11. pixel_asset_master-0.1.0/src/pixel_asset_master/palette.py +106 -0
  12. pixel_asset_master-0.1.0/src/pixel_asset_master/project.py +281 -0
  13. pixel_asset_master-0.1.0/src/pixel_asset_master/sheet.py +115 -0
  14. pixel_asset_master-0.1.0/src/pixel_asset_master/skills/pam/SKILL.md +373 -0
  15. pixel_asset_master-0.1.0/src/pixel_asset_master/skills/pam/assets/design_spec_reference.md +124 -0
  16. pixel_asset_master-0.1.0/src/pixel_asset_master/skills/pam/assets/palettes/palettes_index.json +58 -0
  17. pixel_asset_master-0.1.0/src/pixel_asset_master/skills/pam/assets/sizes/sizes_index.json +90 -0
  18. pixel_asset_master-0.1.0/src/pixel_asset_master/skills/pam/assets/spec_lock_reference.md +61 -0
  19. pixel_asset_master-0.1.0/src/pixel_asset_master/skills/pam/assets/sprites/sprites_index.json +225 -0
  20. pixel_asset_master-0.1.0/src/pixel_asset_master/skills/pam/references/executor-pixel.md +192 -0
  21. pixel_asset_master-0.1.0/src/pixel_asset_master/skills/pam/references/shared-standards.md +203 -0
  22. pixel_asset_master-0.1.0/src/pixel_asset_master/skills/pam/references/strategist.md +183 -0
  23. pixel_asset_master-0.1.0/src/pixel_asset_master/skills/pam/scripts/README.md +110 -0
  24. pixel_asset_master-0.1.0/src/pixel_asset_master/skills/pam/workflows/batch-animate.md +61 -0
  25. pixel_asset_master-0.1.0/src/pixel_asset_master/skills/pam/workflows/create-palette.md +45 -0
  26. pixel_asset_master-0.1.0/src/pixel_asset_master/validate.py +123 -0
  27. pixel_asset_master-0.1.0/src/pixel_asset_master.egg-info/PKG-INFO +200 -0
  28. pixel_asset_master-0.1.0/src/pixel_asset_master.egg-info/SOURCES.txt +30 -0
  29. pixel_asset_master-0.1.0/src/pixel_asset_master.egg-info/dependency_links.txt +1 -0
  30. pixel_asset_master-0.1.0/src/pixel_asset_master.egg-info/entry_points.txt +3 -0
  31. pixel_asset_master-0.1.0/src/pixel_asset_master.egg-info/requires.txt +1 -0
  32. pixel_asset_master-0.1.0/src/pixel_asset_master.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pixel Asset Master Contributors
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,200 @@
1
+ Metadata-Version: 2.4
2
+ Name: pixel-asset-master
3
+ Version: 0.1.0
4
+ Summary: AI-driven 2D pixel game asset generation toolkit
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: Pillow>=10.0.0
9
+ Dynamic: license-file
10
+
11
+ # Pixel Asset Master — AI generates 2D pixel game assets from game design briefs
12
+
13
+ [![Version](https://img.shields.io/badge/version-v0.1.0-blue.svg)](#)
14
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
15
+ [![Python](https://img.shields.io/badge/Python-3.8%2B-3776AB.svg)](https://www.python.org/)
16
+
17
+ English | [中文](./README_CN.md)
18
+
19
+ Drop in a game concept, art direction, or reference images — get back a structured pixel asset project with sprites, tiles, items, UI, effects, backgrounds, animation frames, sprite sheets, and export metadata.
20
+
21
+ 我是一名对游戏独立开发感兴趣的大学生,这个项目的灵感来自 PPT-master。它尝试把“用结构化流程辅助创作”的思路迁移到 2D 游戏像素素材生成中,让独立开发者可以更快整理美术方向、生成素材,并保留可复用的项目规范。
22
+
23
+ ## Project Example
24
+
25
+ 下面是一个水墨工笔像素风项目示例,包含两种树与竹子的动画展示。
26
+
27
+ | Asset | Preview | Frames |
28
+ |-------|---------|--------|
29
+ | Cherry Blossom Tree | ![Cherry Blossom Tree Animation](./sakura_preview.gif) | 6-frame sprite sheet |
30
+ | Willow Tree | ![Willow Tree Animation](./tree_willow_preview.gif) | 6-frame sprite sheet |
31
+ | Bamboo | ![Bamboo Animation](./bamboo_preview.gif) | 4-frame sprite sheet |
32
+
33
+ > **How it works** — Pixel Asset Master is a workflow skill for AI IDEs. You chat with an AI agent, confirm the style constraints, and the skill guides the agent through project setup, asset planning, generation, validation, and export.
34
+
35
+ > **Local-first workflow** — Project files and generated assets are stored locally under `projects/`. API usage only depends on whatever AI tool or image provider you choose to connect.
36
+
37
+ Pixel Asset Master focuses on:
38
+
39
+ - **Game-ready structure** — assets are grouped by `characters`, `tiles`, `items`, `ui`, `effects`, and `backgrounds`.
40
+ - **Strict visual contract** — `spec_lock.md` records canvas size, palette, style, color budget, and forbidden rendering patterns.
41
+ - **Reusable templates** — built-in palettes, size presets, and sprite layout references.
42
+ - **Validation tools** — scripts help check palette compliance, color budget, image format, and sprite sheet export.
43
+ - **Agent-friendly process** — staged confirmations reduce vague prompts and keep long asset runs consistent.
44
+
45
+ ---
46
+
47
+ ## Quick Start
48
+
49
+ ### 1. Prerequisites
50
+
51
+ | Dependency | Required? | What it does |
52
+ |------------|:---------:|--------------|
53
+ | Python 3.8+ | ✅ Yes | Runs the helper scripts |
54
+ | Pillow | ✅ Yes | Image analysis, validation, quantization, and sprite sheet packing |
55
+
56
+ Install the CLI tool with [uv](https://docs.astral.sh/uv/):
57
+
58
+ ```bash
59
+ uv tool install .
60
+ ```
61
+
62
+ This installs the `pam` (and `pixel-asset-master`) command globally. If you prefer to run without installing, use `uv run pam ...` from the repository root.
63
+
64
+ ### 2. Set Up
65
+
66
+ **Option A — Download ZIP**: download the repository ZIP from GitHub and unzip it.
67
+
68
+ **Option B — Git clone**:
69
+
70
+ ```bash
71
+ git clone <your-repository-url>
72
+ cd pixel-asset-master-skills
73
+ uv tool install .
74
+ ```
75
+
76
+ ### 3. Put It Into Your AI Coding IDE
77
+
78
+ After downloading or unzipping the repository, open the **entire `pixel-asset-master-skills/` folder** as a workspace in your AI coding IDE.
79
+
80
+ | IDE | How to use |
81
+ |-----|------------|
82
+ | **Cursor** | `File → Open Folder...` and select `pixel-asset-master-skills/`. Ask the chat agent to read `skills/pixel-asset-master/SKILL.md`. |
83
+ | **Trae** | Open the folder as a project/workspace. Then mention `skills/pixel-asset-master/SKILL.md` in chat before asking for assets. |
84
+ | **Windsurf** | Open the folder in Windsurf. Use Cascade chat and reference `skills/pixel-asset-master/SKILL.md` when starting a pixel asset task. |
85
+ | **Other AI coding IDEs** | Open the repository root as the workspace and point the agent to `skills/pixel-asset-master/SKILL.md`. |
86
+
87
+ Recommended first prompt:
88
+
89
+ ```text
90
+ Read skills/pixel-asset-master/SKILL.md and help me create a pixel art asset project.
91
+ ```
92
+
93
+ ### 4. Create a Pixel Asset Project
94
+
95
+ ```bash
96
+ pam init demo --size 32x32 --palette DB32
97
+ ```
98
+
99
+ The generated project is saved under `projects/` and is ignored by Git by default.
100
+
101
+ ### 5. Choose Your Generation Mode
102
+
103
+ #### Mode A — Without Reference Images
104
+
105
+ Use this when you only have a text idea, game design brief, or art direction.
106
+
107
+ Example prompt:
108
+
109
+ ```text
110
+ Read skills/pixel-asset-master/SKILL.md.
111
+ Create a 64x64 4-direction RPG character sprite sheet.
112
+ Style: ink-wash gongbi pixel art.
113
+ Actions: idle and walk.
114
+ No reference image.
115
+ ```
116
+
117
+ The agent should:
118
+
119
+ 1. Confirm style, size, palette, facing direction, action list, and frame count.
120
+ 2. Create or update `projects/<project_name>/design_spec.md`.
121
+ 3. Create or update `projects/<project_name>/spec_lock.md`.
122
+ 4. Generate PNG assets, animation frames, sprite sheets, and manifests.
123
+
124
+ #### Mode B — With Reference Images
125
+
126
+ Use this when you already have character art, tiles, UI mockups, moodboards, or screenshots that should guide the generated pixel art.
127
+
128
+ First, import reference images:
129
+
130
+ ```bash
131
+ pam import-sources projects/demo_32x32_YYYYMMDD path/to/reference.png
132
+ ```
133
+
134
+ Then prompt the AI agent:
135
+
136
+ ```text
137
+ Read skills/pixel-asset-master/SKILL.md.
138
+ Use the images under projects/demo_32x32_YYYYMMDD/images/ as visual references.
139
+ Generate matching pixel art assets and keep the same silhouette, palette mood, and style constraints.
140
+ ```
141
+
142
+ The agent should analyze the reference images, derive style and palette constraints, then continue through the same spec lock, generation, validation, and export pipeline.
143
+
144
+ ### 6. Validate and Export
145
+
146
+ ```bash
147
+ pam validate-project projects/demo_32x32_YYYYMMDD
148
+ pam validate-assets projects/demo_32x32_YYYYMMDD
149
+ pam finalize projects/demo_32x32_YYYYMMDD --all
150
+ pam sheet projects/demo_32x32_YYYYMMDD --by-category
151
+ ```
152
+
153
+ > **AI lost context?** Ask it to read `skills/pixel-asset-master/SKILL.md`.
154
+
155
+ ---
156
+
157
+ ## Repository Layout
158
+
159
+ ```text
160
+ .
161
+ ├── pyproject.toml
162
+ ├── uv.lock
163
+ ├── src/
164
+ │ └── pixel_asset_master/ # Installable Python package / CLI
165
+ ├── skills/
166
+ │ └── pixel-asset-master/
167
+ │ ├── SKILL.md
168
+ │ ├── references/
169
+ │ ├── scripts/
170
+ │ │ └── README.md # CLI command reference
171
+ │ ├── templates/
172
+ │ └── workflows/
173
+ └── projects/ # Generated asset projects (ignored by Git)
174
+ ```
175
+
176
+ ## Documentation
177
+
178
+ | | Document | Description |
179
+ |---|----------|-------------|
180
+ | 📖 | [SKILL.md](./skills/pixel-asset-master/SKILL.md) | Core workflow and execution rules |
181
+ | 🛠️ | [CLI Reference](./skills/pixel-asset-master/scripts/README.md) | `pam` command usage and examples |
182
+ | 🏗️ | [Project Structure](./docs/PROJECT_STRUCTURE.md) | Repository structure and generated-content boundaries |
183
+ | 🤝 | [Contributing](./CONTRIBUTING.md) | Contribution scope and workflow |
184
+ | 🔐 | [Security](./SECURITY.md) | Vulnerability reporting and scope |
185
+
186
+ ## What Should Not Be Committed
187
+
188
+ - **Generated projects**: `projects/`
189
+ - **Export packages**: `exports/`, `*.zip`, `*.tar.gz`
190
+ - **Secrets**: `.env`, real API keys, tokens, private account data
191
+
192
+ ## Contributing
193
+
194
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for how to get involved.
195
+
196
+ ## License
197
+
198
+ [MIT](LICENSE)
199
+
200
+ [⬆ Back to Top](#pixel-asset-master--ai-generates-2d-pixel-game-assets-from-game-design-briefs)
@@ -0,0 +1,190 @@
1
+ # Pixel Asset Master — AI generates 2D pixel game assets from game design briefs
2
+
3
+ [![Version](https://img.shields.io/badge/version-v0.1.0-blue.svg)](#)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Python](https://img.shields.io/badge/Python-3.8%2B-3776AB.svg)](https://www.python.org/)
6
+
7
+ English | [中文](./README_CN.md)
8
+
9
+ Drop in a game concept, art direction, or reference images — get back a structured pixel asset project with sprites, tiles, items, UI, effects, backgrounds, animation frames, sprite sheets, and export metadata.
10
+
11
+ 我是一名对游戏独立开发感兴趣的大学生,这个项目的灵感来自 PPT-master。它尝试把“用结构化流程辅助创作”的思路迁移到 2D 游戏像素素材生成中,让独立开发者可以更快整理美术方向、生成素材,并保留可复用的项目规范。
12
+
13
+ ## Project Example
14
+
15
+ 下面是一个水墨工笔像素风项目示例,包含两种树与竹子的动画展示。
16
+
17
+ | Asset | Preview | Frames |
18
+ |-------|---------|--------|
19
+ | Cherry Blossom Tree | ![Cherry Blossom Tree Animation](./sakura_preview.gif) | 6-frame sprite sheet |
20
+ | Willow Tree | ![Willow Tree Animation](./tree_willow_preview.gif) | 6-frame sprite sheet |
21
+ | Bamboo | ![Bamboo Animation](./bamboo_preview.gif) | 4-frame sprite sheet |
22
+
23
+ > **How it works** — Pixel Asset Master is a workflow skill for AI IDEs. You chat with an AI agent, confirm the style constraints, and the skill guides the agent through project setup, asset planning, generation, validation, and export.
24
+
25
+ > **Local-first workflow** — Project files and generated assets are stored locally under `projects/`. API usage only depends on whatever AI tool or image provider you choose to connect.
26
+
27
+ Pixel Asset Master focuses on:
28
+
29
+ - **Game-ready structure** — assets are grouped by `characters`, `tiles`, `items`, `ui`, `effects`, and `backgrounds`.
30
+ - **Strict visual contract** — `spec_lock.md` records canvas size, palette, style, color budget, and forbidden rendering patterns.
31
+ - **Reusable templates** — built-in palettes, size presets, and sprite layout references.
32
+ - **Validation tools** — scripts help check palette compliance, color budget, image format, and sprite sheet export.
33
+ - **Agent-friendly process** — staged confirmations reduce vague prompts and keep long asset runs consistent.
34
+
35
+ ---
36
+
37
+ ## Quick Start
38
+
39
+ ### 1. Prerequisites
40
+
41
+ | Dependency | Required? | What it does |
42
+ |------------|:---------:|--------------|
43
+ | Python 3.8+ | ✅ Yes | Runs the helper scripts |
44
+ | Pillow | ✅ Yes | Image analysis, validation, quantization, and sprite sheet packing |
45
+
46
+ Install the CLI tool with [uv](https://docs.astral.sh/uv/):
47
+
48
+ ```bash
49
+ uv tool install .
50
+ ```
51
+
52
+ This installs the `pam` (and `pixel-asset-master`) command globally. If you prefer to run without installing, use `uv run pam ...` from the repository root.
53
+
54
+ ### 2. Set Up
55
+
56
+ **Option A — Download ZIP**: download the repository ZIP from GitHub and unzip it.
57
+
58
+ **Option B — Git clone**:
59
+
60
+ ```bash
61
+ git clone <your-repository-url>
62
+ cd pixel-asset-master-skills
63
+ uv tool install .
64
+ ```
65
+
66
+ ### 3. Put It Into Your AI Coding IDE
67
+
68
+ After downloading or unzipping the repository, open the **entire `pixel-asset-master-skills/` folder** as a workspace in your AI coding IDE.
69
+
70
+ | IDE | How to use |
71
+ |-----|------------|
72
+ | **Cursor** | `File → Open Folder...` and select `pixel-asset-master-skills/`. Ask the chat agent to read `skills/pixel-asset-master/SKILL.md`. |
73
+ | **Trae** | Open the folder as a project/workspace. Then mention `skills/pixel-asset-master/SKILL.md` in chat before asking for assets. |
74
+ | **Windsurf** | Open the folder in Windsurf. Use Cascade chat and reference `skills/pixel-asset-master/SKILL.md` when starting a pixel asset task. |
75
+ | **Other AI coding IDEs** | Open the repository root as the workspace and point the agent to `skills/pixel-asset-master/SKILL.md`. |
76
+
77
+ Recommended first prompt:
78
+
79
+ ```text
80
+ Read skills/pixel-asset-master/SKILL.md and help me create a pixel art asset project.
81
+ ```
82
+
83
+ ### 4. Create a Pixel Asset Project
84
+
85
+ ```bash
86
+ pam init demo --size 32x32 --palette DB32
87
+ ```
88
+
89
+ The generated project is saved under `projects/` and is ignored by Git by default.
90
+
91
+ ### 5. Choose Your Generation Mode
92
+
93
+ #### Mode A — Without Reference Images
94
+
95
+ Use this when you only have a text idea, game design brief, or art direction.
96
+
97
+ Example prompt:
98
+
99
+ ```text
100
+ Read skills/pixel-asset-master/SKILL.md.
101
+ Create a 64x64 4-direction RPG character sprite sheet.
102
+ Style: ink-wash gongbi pixel art.
103
+ Actions: idle and walk.
104
+ No reference image.
105
+ ```
106
+
107
+ The agent should:
108
+
109
+ 1. Confirm style, size, palette, facing direction, action list, and frame count.
110
+ 2. Create or update `projects/<project_name>/design_spec.md`.
111
+ 3. Create or update `projects/<project_name>/spec_lock.md`.
112
+ 4. Generate PNG assets, animation frames, sprite sheets, and manifests.
113
+
114
+ #### Mode B — With Reference Images
115
+
116
+ Use this when you already have character art, tiles, UI mockups, moodboards, or screenshots that should guide the generated pixel art.
117
+
118
+ First, import reference images:
119
+
120
+ ```bash
121
+ pam import-sources projects/demo_32x32_YYYYMMDD path/to/reference.png
122
+ ```
123
+
124
+ Then prompt the AI agent:
125
+
126
+ ```text
127
+ Read skills/pixel-asset-master/SKILL.md.
128
+ Use the images under projects/demo_32x32_YYYYMMDD/images/ as visual references.
129
+ Generate matching pixel art assets and keep the same silhouette, palette mood, and style constraints.
130
+ ```
131
+
132
+ The agent should analyze the reference images, derive style and palette constraints, then continue through the same spec lock, generation, validation, and export pipeline.
133
+
134
+ ### 6. Validate and Export
135
+
136
+ ```bash
137
+ pam validate-project projects/demo_32x32_YYYYMMDD
138
+ pam validate-assets projects/demo_32x32_YYYYMMDD
139
+ pam finalize projects/demo_32x32_YYYYMMDD --all
140
+ pam sheet projects/demo_32x32_YYYYMMDD --by-category
141
+ ```
142
+
143
+ > **AI lost context?** Ask it to read `skills/pixel-asset-master/SKILL.md`.
144
+
145
+ ---
146
+
147
+ ## Repository Layout
148
+
149
+ ```text
150
+ .
151
+ ├── pyproject.toml
152
+ ├── uv.lock
153
+ ├── src/
154
+ │ └── pixel_asset_master/ # Installable Python package / CLI
155
+ ├── skills/
156
+ │ └── pixel-asset-master/
157
+ │ ├── SKILL.md
158
+ │ ├── references/
159
+ │ ├── scripts/
160
+ │ │ └── README.md # CLI command reference
161
+ │ ├── templates/
162
+ │ └── workflows/
163
+ └── projects/ # Generated asset projects (ignored by Git)
164
+ ```
165
+
166
+ ## Documentation
167
+
168
+ | | Document | Description |
169
+ |---|----------|-------------|
170
+ | 📖 | [SKILL.md](./skills/pixel-asset-master/SKILL.md) | Core workflow and execution rules |
171
+ | 🛠️ | [CLI Reference](./skills/pixel-asset-master/scripts/README.md) | `pam` command usage and examples |
172
+ | 🏗️ | [Project Structure](./docs/PROJECT_STRUCTURE.md) | Repository structure and generated-content boundaries |
173
+ | 🤝 | [Contributing](./CONTRIBUTING.md) | Contribution scope and workflow |
174
+ | 🔐 | [Security](./SECURITY.md) | Vulnerability reporting and scope |
175
+
176
+ ## What Should Not Be Committed
177
+
178
+ - **Generated projects**: `projects/`
179
+ - **Export packages**: `exports/`, `*.zip`, `*.tar.gz`
180
+ - **Secrets**: `.env`, real API keys, tokens, private account data
181
+
182
+ ## Contributing
183
+
184
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for how to get involved.
185
+
186
+ ## License
187
+
188
+ [MIT](LICENSE)
189
+
190
+ [⬆ Back to Top](#pixel-asset-master--ai-generates-2d-pixel-game-assets-from-game-design-briefs)
@@ -0,0 +1,26 @@
1
+ [project]
2
+ name = "pixel-asset-master"
3
+ version = "0.1.0"
4
+ description = "AI-driven 2D pixel game asset generation toolkit"
5
+ readme = "README.md"
6
+ requires-python = ">=3.8"
7
+ dependencies = [
8
+ "Pillow>=10.0.0",
9
+ ]
10
+
11
+ [project.scripts]
12
+ pam = "pixel_asset_master.cli:main"
13
+ pixel-asset-master = "pixel_asset_master.cli:main"
14
+
15
+ [build-system]
16
+ requires = ["setuptools>=61.0"]
17
+ build-backend = "setuptools.build_meta"
18
+
19
+ [tool.setuptools.packages.find]
20
+ where = ["src"]
21
+
22
+ [tool.setuptools.package-data]
23
+ pixel_asset_master = ["skills/pam/**/*"]
24
+
25
+ [tool.uv]
26
+ package = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """Pixel Asset Master — AI-driven 2D pixel game asset toolkit."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,164 @@
1
+ """Unified CLI entry point for Pixel Asset Master."""
2
+
3
+ import argparse
4
+ import sys
5
+
6
+ from pixel_asset_master import __version__
7
+ from pixel_asset_master.common import resolve_root
8
+ from pixel_asset_master.finalize import cmd_clean, cmd_index, cmd_quantize
9
+ from pixel_asset_master.install_skill import cmd_install_skills
10
+ from pixel_asset_master.palette import cmd_distance, cmd_extract, cmd_validate as cmd_validate_palette
11
+ from pixel_asset_master.project import cmd_import_sources, cmd_init, cmd_validate_project
12
+ from pixel_asset_master.sheet import cmd_sheet
13
+ from pixel_asset_master.validate import cmd_validate_assets
14
+
15
+
16
+ def _add_root_argument(parser: argparse.ArgumentParser) -> None:
17
+ parser.add_argument(
18
+ "--root",
19
+ default=None,
20
+ help="Workspace root directory (default: current directory; override with PAM_PROJECTS_ROOT env var)",
21
+ )
22
+
23
+
24
+ def main(argv: list[str] | None = None) -> int:
25
+ parser = argparse.ArgumentParser(
26
+ prog="pam",
27
+ description="Pixel Asset Master — AI-driven 2D pixel game asset toolkit",
28
+ )
29
+ parser.add_argument(
30
+ "--version", action="version", version=f"%(prog)s {__version__}"
31
+ )
32
+ _add_root_argument(parser)
33
+
34
+ sub = parser.add_subparsers(dest="command", help="Available commands")
35
+
36
+ # ── init ───────────────────────────────────────────────────────────────
37
+ p_init = sub.add_parser("init", help="Initialize a new project")
38
+ p_init.add_argument("project_name", help="Project name")
39
+ p_init.add_argument("--size", default="32x32", help="Base sprite size (e.g. 32x32)")
40
+ p_init.add_argument("--palette", default="DB32", help="Palette name (resolved from workspace palettes_index.json if available)")
41
+ p_init.add_argument("--palette-file", default=None, help="Path to a JSON palette file")
42
+ p_init.add_argument("--palette-colors", default=None, help="Comma-separated hex colors (e.g. '#FF0000,#00FF00')")
43
+
44
+ # ── import-sources ─────────────────────────────────────────────────────
45
+ p_import = sub.add_parser("import-sources", help="Import reference images into a project")
46
+ p_import.add_argument("project_path", help="Project directory path")
47
+ p_import.add_argument("files", nargs="+", help="Files to import")
48
+ p_import.add_argument("--move", action="store_true", help="Move instead of copy")
49
+
50
+ # ── validate-project ───────────────────────────────────────────────────
51
+ p_validate = sub.add_parser("validate-project", help="Validate project structure")
52
+ p_validate.add_argument("project_path", help="Project directory path")
53
+
54
+ # ── validate-assets ────────────────────────────────────────────────────
55
+ p_validate_assets = sub.add_parser("validate-assets", help="Validate pixel art assets against spec_lock")
56
+ p_validate_assets.add_argument("project_path", help="Project directory path")
57
+
58
+ # ── palette ────────────────────────────────────────────────────────────
59
+ p_palette = sub.add_parser("palette", help="Palette extraction and validation")
60
+ pal_sub = p_palette.add_subparsers(dest="palette_command", help="Palette commands")
61
+
62
+ p_pal_extract = pal_sub.add_parser("extract", help="Extract palette from image")
63
+ p_pal_extract.add_argument("image_path", help="Path to reference image")
64
+ p_pal_extract.add_argument("--count", type=int, default=16, help="Number of colors")
65
+
66
+ p_pal_validate = pal_sub.add_parser("validate", help="Validate assets against project palette")
67
+ p_pal_validate.add_argument("project_path", help="Project directory path")
68
+
69
+ p_pal_distance = pal_sub.add_parser("distance", help="Distance between two colors")
70
+ p_pal_distance.add_argument("color1", help="First color (#RRGGBB)")
71
+ p_pal_distance.add_argument("color2", help="Second color (#RRGGBB)")
72
+
73
+ # ── finalize ───────────────────────────────────────────────────────────
74
+ p_finalize = sub.add_parser("finalize", help="Post-process pixel art assets")
75
+ p_finalize.add_argument("project_path", help="Project directory path")
76
+ p_finalize.add_argument("--quantize", action="store_true", help="Quantize to declared palette")
77
+ p_finalize.add_argument("--clean", action="store_true", help="Remove stray isolated pixels")
78
+ p_finalize.add_argument("--index", action="store_true", help="Convert to indexed PNG")
79
+ p_finalize.add_argument("--all", action="store_true", help="Run all steps")
80
+
81
+ # ── sheet ──────────────────────────────────────────────────────────────
82
+ p_sheet = sub.add_parser("sheet", help="Pack sprite sheets")
83
+ p_sheet.add_argument("project_path", help="Project directory path")
84
+ p_sheet.add_argument("--by-category", action="store_true", default=True, help="Pack by category/animation")
85
+
86
+ # ── install-skills ─────────────────────────────────────────────────────
87
+ p_install = sub.add_parser("install-skills", help="Install the bundled pam Agent Skill")
88
+ p_install.add_argument("--target", default=None, help="Destination directory (default: ~/.agents/skills/pam)")
89
+ p_install.add_argument("--dry-run", action="store_true", help="Print what would be installed without copying")
90
+
91
+ args = parser.parse_args(argv)
92
+
93
+ if args.command is None:
94
+ parser.print_help()
95
+ return 1
96
+
97
+ # Resolve root for commands that need it. Most commands use explicit project_path.
98
+ _ = resolve_root(args.root)
99
+
100
+ if args.command == "init":
101
+ palette_colors = None
102
+ if args.palette_colors:
103
+ palette_colors = [c.strip() for c in args.palette_colors.split(",")]
104
+ cmd_init(
105
+ args.project_name,
106
+ args.size,
107
+ args.palette,
108
+ palette_file=args.palette_file,
109
+ palette_colors=palette_colors,
110
+ root=args.root,
111
+ )
112
+ return 0
113
+
114
+ if args.command == "import-sources":
115
+ cmd_import_sources(args.project_path, args.files, move=args.move)
116
+ return 0
117
+
118
+ if args.command == "validate-project":
119
+ ok = cmd_validate_project(args.project_path)
120
+ return 0 if ok else 1
121
+
122
+ if args.command == "validate-assets":
123
+ ok = cmd_validate_assets(args.project_path)
124
+ return 0 if ok else 1
125
+
126
+ if args.command == "palette":
127
+ if args.palette_command == "extract":
128
+ cmd_extract(args.image_path, count=args.count)
129
+ return 0
130
+ if args.palette_command == "validate":
131
+ cmd_validate_palette(args.project_path)
132
+ return 0
133
+ if args.palette_command == "distance":
134
+ cmd_distance(args.color1, args.color2)
135
+ return 0
136
+ p_palette.print_help()
137
+ return 1
138
+
139
+ if args.command == "finalize":
140
+ if args.all or args.quantize:
141
+ cmd_quantize(args.project_path)
142
+ if args.all or args.clean:
143
+ cmd_clean(args.project_path)
144
+ if args.all or args.index:
145
+ cmd_index(args.project_path)
146
+ if not (args.quantize or args.clean or args.index or args.all):
147
+ p_finalize.print_help()
148
+ return 1
149
+ return 0
150
+
151
+ if args.command == "sheet":
152
+ cmd_sheet(args.project_path, by_category=args.by_category)
153
+ return 0
154
+
155
+ if args.command == "install-skills":
156
+ ok = cmd_install_skills(target=args.target, dry_run=args.dry_run)
157
+ return 0 if ok else 1
158
+
159
+ parser.print_help()
160
+ return 1
161
+
162
+
163
+ if __name__ == "__main__":
164
+ sys.exit(main())