chasqui 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.
@@ -0,0 +1,20 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.11", "3.13"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: astral-sh/setup-uv@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - run: uv sync
20
+ - run: uv run pytest
@@ -0,0 +1,21 @@
1
+ name: Publish to PyPI
2
+
3
+ # Trusted publishing (no API tokens): configure this repo + workflow as a
4
+ # trusted publisher for the `chasqui` project on PyPI.
5
+ on:
6
+ push:
7
+ tags: ["v*"]
8
+
9
+ jobs:
10
+ publish:
11
+ runs-on: ubuntu-latest
12
+ environment: pypi
13
+ permissions:
14
+ id-token: write
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: astral-sh/setup-uv@v5
18
+ - run: uv sync
19
+ - run: uv run pytest
20
+ - run: uv build
21
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ dist/
5
+ .pytest_cache/
6
+ .DS_Store
7
+ uv.lock
@@ -0,0 +1,57 @@
1
+ # AGENTS.md — Chasqui CLI
2
+
3
+ The **stack generator**: `uvx chasqui new <name>` scaffolds a configured
4
+ Chasqui project; `chasqui generate module <name>` scaffolds a Tool Module.
5
+ Part of [`chasqui-stack`](https://github.com/chasqui-stack/chasqui) — design
6
+ locked in the parent's `docs/design/adr-005-cli-generator.md`. **Read it
7
+ before changing behavior.**
8
+
9
+ ## Stack & structure
10
+
11
+ Python ≥3.11 · `typer` (commands) · `questionary` (wizard) · `httpx`
12
+ (fetch) · `uv` · pytest. PyPI package: `chasqui`.
13
+
14
+ - `stack.py` — the pinned stack tag + repo map. **Bumped with every CLI
15
+ release** (CLI vX.Y.Z scaffolds services vX.Y.Z).
16
+ - `wizard.py` — prompts + the `Answers` dataclass (defaults ARE the
17
+ `--defaults` run).
18
+ - `envfiles.py` — pure renderers: answers → `.env` text (golden-testable).
19
+ - `fetch.py` — codeload tarballs, degit-style; `--source` copies a local
20
+ checkout (dev escape hatch — codeload needs public repos).
21
+ - `rename.py` — explicit branding manifest. Never a blind sed.
22
+ - `provision.py` — best-effort steps; a failure prints its manual command
23
+ and disables only its dependents.
24
+ - `module_gen.py` — the Tool Module templates (parent ARCHITECTURE §8;
25
+ reference implementation `core/app/modules/faq/`).
26
+
27
+ ## Key rules
28
+
29
+ - **The wizard asks only what is a `.env` variable** in a service
30
+ `.env.example` (ADR-005). New question ⇒ the service grows the variable
31
+ first, in its own PR.
32
+ - `.env`s are written **before** the first migrate — `EMBEDDING_DIM` is
33
+ provision-time (ADR-001). Don't reorder the scaffold.
34
+ - `INTERNAL_API_KEY` is generated once and written into BOTH core and
35
+ gateway `.env`s — byte-identical.
36
+ - The CLI must never import service code (it runs in uvx's ephemeral venv).
37
+ - Generated projects are ONE plain repo — no submodules.
38
+ - English-only code and output (the wizard's `locale` question only
39
+ configures the generated agent, not this CLI).
40
+
41
+ ## Dev
42
+
43
+ ```bash
44
+ uv sync && uv run pytest
45
+ uv run chasqui new demo --defaults --skip-provision --source ~/path/to/chasqui
46
+ ```
47
+
48
+ ## Planning
49
+
50
+ PRPs and the sprint plan live in the parent repo (`chasqui/PRPs`,
51
+ `chasqui/docs`).
52
+
53
+ ## Don't
54
+
55
+ - Add a template engine — the service repos ARE the template.
56
+ - Ask wizard questions that aren't `.env` vars.
57
+ - Blind-replace "chasqui" across the tree (it appears in code identifiers).
@@ -0,0 +1 @@
1
+ AGENTS.md
chasqui-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Chasqui contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
chasqui-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,73 @@
1
+ Metadata-Version: 2.4
2
+ Name: chasqui
3
+ Version: 0.1.0
4
+ Summary: Chasqui stack generator — `uvx chasqui new <name>`: zero to a running WhatsApp AI agent in one command
5
+ Project-URL: Homepage, https://github.com/chasqui-stack/chasqui
6
+ Project-URL: Repository, https://github.com/chasqui-stack/cli
7
+ Author-email: William Wong Garay <willywg@gmail.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: ai-agent,generator,langgraph,scaffold,whatsapp
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development :: Code Generators
18
+ Requires-Python: >=3.11
19
+ Requires-Dist: httpx>=0.27
20
+ Requires-Dist: questionary>=2.0
21
+ Requires-Dist: typer>=0.15
22
+ Description-Content-Type: text/markdown
23
+
24
+ # chasqui — the stack generator
25
+
26
+ ```bash
27
+ uvx chasqui new mi-agente
28
+ ```
29
+
30
+ Zero to a configured, locally-running WhatsApp AI agent in one command — the
31
+ `rails new` of the [Chasqui stack](https://github.com/chasqui-stack/chasqui).
32
+
33
+ The wizard asks only what becomes a `.env` variable (LLM provider/model,
34
+ embeddings + dimension, where your Postgres is, WhatsApp credentials, default
35
+ language, first admin, optional media bucket / handoff notifications / deploy
36
+ params) — then downloads the three services at a pinned release tag
37
+ (degit-style, no git history), brands them, writes the `.env`s, generates the
38
+ shared secrets, and provisions: `uv sync` + `npm install` + `createdb` +
39
+ migrations + admin seed. Every step that can't run prints its manual command
40
+ and the scaffold continues.
41
+
42
+ Nothing is locked in: everything the wizard wrote lives in the generated
43
+ `.env`s and can be changed any time (the LLM applies on the next message).
44
+ The only provision-time choice is `EMBEDDING_DIM` — baked into the schema on
45
+ the first migrate.
46
+
47
+ ## Commands
48
+
49
+ ```bash
50
+ uvx chasqui new <name> # the wizard
51
+ uvx chasqui new <name> --defaults # non-interactive (CI-friendly placeholders)
52
+ uvx chasqui new <name> --skip-provision # write files only
53
+ uvx chasqui new <name> --ref main # scaffold an unreleased stack ref
54
+ uvx chasqui new <name> --source ~/path # copy a local stack checkout (dev)
55
+
56
+ chasqui generate module <name> # scaffold a Tool Module (run inside a project)
57
+ chasqui generate module <name> --with-models --with-admin
58
+ ```
59
+
60
+ ## Development
61
+
62
+ ```bash
63
+ uv sync && uv run pytest
64
+ uv run chasqui new demo --defaults --skip-provision --source ~/path/to/chasqui
65
+ ```
66
+
67
+ Design: [ADR-005](https://github.com/chasqui-stack/chasqui/blob/main/docs/design/adr-005-cli-generator.md).
68
+ Releases pin the stack tag (`src/chasqui/stack.py`): CLI `vX.Y.Z` scaffolds
69
+ services `vX.Y.Z`.
70
+
71
+ ## License
72
+
73
+ Apache-2.0
@@ -0,0 +1,50 @@
1
+ # chasqui — the stack generator
2
+
3
+ ```bash
4
+ uvx chasqui new mi-agente
5
+ ```
6
+
7
+ Zero to a configured, locally-running WhatsApp AI agent in one command — the
8
+ `rails new` of the [Chasqui stack](https://github.com/chasqui-stack/chasqui).
9
+
10
+ The wizard asks only what becomes a `.env` variable (LLM provider/model,
11
+ embeddings + dimension, where your Postgres is, WhatsApp credentials, default
12
+ language, first admin, optional media bucket / handoff notifications / deploy
13
+ params) — then downloads the three services at a pinned release tag
14
+ (degit-style, no git history), brands them, writes the `.env`s, generates the
15
+ shared secrets, and provisions: `uv sync` + `npm install` + `createdb` +
16
+ migrations + admin seed. Every step that can't run prints its manual command
17
+ and the scaffold continues.
18
+
19
+ Nothing is locked in: everything the wizard wrote lives in the generated
20
+ `.env`s and can be changed any time (the LLM applies on the next message).
21
+ The only provision-time choice is `EMBEDDING_DIM` — baked into the schema on
22
+ the first migrate.
23
+
24
+ ## Commands
25
+
26
+ ```bash
27
+ uvx chasqui new <name> # the wizard
28
+ uvx chasqui new <name> --defaults # non-interactive (CI-friendly placeholders)
29
+ uvx chasqui new <name> --skip-provision # write files only
30
+ uvx chasqui new <name> --ref main # scaffold an unreleased stack ref
31
+ uvx chasqui new <name> --source ~/path # copy a local stack checkout (dev)
32
+
33
+ chasqui generate module <name> # scaffold a Tool Module (run inside a project)
34
+ chasqui generate module <name> --with-models --with-admin
35
+ ```
36
+
37
+ ## Development
38
+
39
+ ```bash
40
+ uv sync && uv run pytest
41
+ uv run chasqui new demo --defaults --skip-provision --source ~/path/to/chasqui
42
+ ```
43
+
44
+ Design: [ADR-005](https://github.com/chasqui-stack/chasqui/blob/main/docs/design/adr-005-cli-generator.md).
45
+ Releases pin the stack tag (`src/chasqui/stack.py`): CLI `vX.Y.Z` scaffolds
46
+ services `vX.Y.Z`.
47
+
48
+ ## License
49
+
50
+ Apache-2.0
@@ -0,0 +1,44 @@
1
+ [project]
2
+ name = "chasqui"
3
+ version = "0.1.0"
4
+ description = "Chasqui stack generator — `uvx chasqui new <name>`: zero to a running WhatsApp AI agent in one command"
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ license-files = ["LICENSE"]
8
+ authors = [{ name = "William Wong Garay", email = "willywg@gmail.com" }]
9
+ requires-python = ">=3.11"
10
+ keywords = ["whatsapp", "ai-agent", "langgraph", "scaffold", "generator"]
11
+ classifiers = [
12
+ "Development Status :: 4 - Beta",
13
+ "Environment :: Console",
14
+ "Intended Audience :: Developers",
15
+ "Programming Language :: Python :: 3.11",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Programming Language :: Python :: 3.13",
18
+ "Topic :: Software Development :: Code Generators",
19
+ ]
20
+ dependencies = [
21
+ "typer>=0.15",
22
+ "questionary>=2.0",
23
+ "httpx>=0.27",
24
+ ]
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/chasqui-stack/chasqui"
28
+ Repository = "https://github.com/chasqui-stack/cli"
29
+
30
+ [project.scripts]
31
+ chasqui = "chasqui.cli:app"
32
+
33
+ [build-system]
34
+ requires = ["hatchling"]
35
+ build-backend = "hatchling.build"
36
+
37
+ [tool.hatch.build.targets.wheel]
38
+ packages = ["src/chasqui"]
39
+
40
+ [dependency-groups]
41
+ dev = ["pytest>=8.0"]
42
+
43
+ [tool.pytest.ini_options]
44
+ testpaths = ["tests"]
@@ -0,0 +1,3 @@
1
+ """Chasqui stack generator — `uvx chasqui new <name>`."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,108 @@
1
+ """Chasqui CLI — `uvx chasqui new <name>` / `chasqui generate module <name>`."""
2
+
3
+ from pathlib import Path
4
+ from typing import Optional
5
+
6
+ import typer
7
+
8
+ from chasqui import __version__, module_gen, preflight, scaffold, stack, wizard
9
+
10
+ app = typer.Typer(
11
+ name="chasqui",
12
+ help="The Chasqui stack generator — WhatsApp AI agents, omakase.",
13
+ no_args_is_help=True,
14
+ )
15
+ generate_app = typer.Typer(help="Code generators (à la `rails generate`).", no_args_is_help=True)
16
+ app.add_typer(generate_app, name="generate")
17
+
18
+
19
+ def _version_callback(value: bool) -> None:
20
+ if value:
21
+ typer.echo(f"chasqui {__version__} (stack {stack.STACK_TAG})")
22
+ raise typer.Exit()
23
+
24
+
25
+ @app.callback()
26
+ def main(
27
+ version: bool = typer.Option(
28
+ False, "--version", callback=_version_callback, is_eager=True,
29
+ help="Show the CLI and pinned stack versions.",
30
+ ),
31
+ ) -> None:
32
+ pass
33
+
34
+
35
+ @app.command()
36
+ def new(
37
+ name: str = typer.Argument(..., help="Project name (lowercase, dashes)"),
38
+ defaults: bool = typer.Option(
39
+ False, "--defaults", help="Skip the wizard — placeholder config, CI-friendly."
40
+ ),
41
+ skip_provision: bool = typer.Option(
42
+ False, "--skip-provision", help="Write files only; no uv/npm/createdb/migrate."
43
+ ),
44
+ ref: str = typer.Option(
45
+ stack.STACK_TAG, "--ref", help="Stack tag/branch to scaffold (default: pinned tag)."
46
+ ),
47
+ source: Optional[Path] = typer.Option(
48
+ None, "--source", help="Local stack checkout to copy instead of downloading (dev)."
49
+ ),
50
+ ) -> None:
51
+ """Scaffold a configured Chasqui project: wizard → .envs → provision."""
52
+ try:
53
+ slug = scaffold.validate_name(name)
54
+
55
+ typer.echo("🔎 Preflight:")
56
+ for check in preflight.run_checks():
57
+ mark = "✅" if check.found else "⚠️ "
58
+ hint = "" if check.found else f" ({check.hint})"
59
+ typer.echo(f" {mark} {check.name}: {check.detail}{hint}")
60
+ typer.echo("")
61
+
62
+ answers = (
63
+ wizard.default_answers(slug) if defaults else wizard.run_wizard(slug)
64
+ )
65
+ scaffold.run_new(
66
+ answers,
67
+ target_parent=Path.cwd(),
68
+ ref=ref,
69
+ source=source,
70
+ skip_provision=skip_provision,
71
+ echo=typer.echo,
72
+ )
73
+ except (scaffold.ScaffoldError, Exception) as exc:
74
+ if isinstance(exc, typer.Exit):
75
+ raise
76
+ typer.secho(f"error: {exc}", fg=typer.colors.RED, err=True)
77
+ raise typer.Exit(code=1) from exc
78
+
79
+
80
+ @generate_app.command("module")
81
+ def gen_module(
82
+ name: str = typer.Argument(..., help="Module name (snake_case)"),
83
+ with_models: bool = typer.Option(
84
+ False, "--with-models", help="Add a SQLModel table registered via register_models()."
85
+ ),
86
+ with_admin: bool = typer.Option(
87
+ False, "--with-admin", help="Add admin routes under /admin/modules/<name>."
88
+ ),
89
+ ) -> None:
90
+ """Scaffold a Tool Module (ARCHITECTURE §8) inside a Chasqui project."""
91
+ try:
92
+ created = module_gen.generate(
93
+ name, cwd=Path.cwd(), with_models=with_models, with_admin=with_admin
94
+ )
95
+ except module_gen.ModuleGenError as exc:
96
+ typer.secho(f"error: {exc}", fg=typer.colors.RED, err=True)
97
+ raise typer.Exit(code=1) from exc
98
+
99
+ for path in created:
100
+ typer.echo(f" create {path}")
101
+ typer.echo("\nNext steps:")
102
+ if with_models:
103
+ typer.echo(' cd core && make makemigrations m="add ' + name + ' tables" && make migrate')
104
+ typer.echo(" enable the tool in the admin panel (/tools) and write the real logic")
105
+
106
+
107
+ if __name__ == "__main__":
108
+ app()