Skip to content

Commit 82dffe4

Browse files
committed
Add some readme instructions
1 parent 14232a7 commit 82dffe4

File tree

1 file changed

+158
-18
lines changed

1 file changed

+158
-18
lines changed

README.md

Lines changed: 158 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,189 @@ Generates projects with:
88
- VS Code dev container for local development
99
- Production-ready multi-stage Dockerfile
1010

11+
## Prerequisites
12+
13+
Install with [Homebrew](https://brew.sh/):
14+
15+
```bash
16+
brew install uv node git docker aws-cdk
17+
```
18+
19+
You also need SSH access to the `co-cddo` GitHub organisation (for private CDK construct dependencies).
20+
1121
## Installation
1222

23+
`idea-app` is installed as a global CLI tool, not as a per-project dependency:
24+
1325
```bash
1426
uv tool install "gds-idea-app-kit @ git+https://github.com/co-cddo/gds-idea-app-kit"
1527
```
1628

17-
## Usage
29+
To upgrade to the latest version:
30+
31+
```bash
32+
uv tool upgrade gds-idea-app-kit
33+
```
34+
35+
Verify it's working:
36+
37+
```bash
38+
idea-app --version
39+
```
40+
41+
## New project
42+
43+
Scaffold a new project with `idea-app init`:
1844

1945
```bash
20-
# Scaffold a new project
2146
idea-app init streamlit my-dashboard
47+
```
48+
49+
This creates a directory `gds-idea-app-my-dashboard/` containing:
50+
51+
- `app.py` -- CDK entry point
52+
- `cdk.json` -- CDK configuration
53+
- `app_src/` -- your application code, Dockerfile, and dependencies
54+
- `.devcontainer/` -- VS Code dev container configuration
55+
- `dev_mocks/` -- mock auth data for local development
56+
- `.gitignore` -- pre-configured for Python, CDK, and dev artifacts
2257

23-
# Update tool-managed files in an existing project
58+
The tool runs `cdk init`, `uv init`, copies template files, installs CDK dependencies, and makes an initial git commit. All of this happens automatically.
59+
60+
### Options
61+
62+
```bash
63+
idea-app init <framework> <app-name> [--python 3.13]
64+
```
65+
66+
- `framework`: `streamlit`, `dash`, or `fastapi`
67+
- `app-name`: short name for your app (lowercase, hyphens ok). The `gds-idea-app-` prefix is added automatically.
68+
- `--python`: Python version for the project (default: 3.13)
69+
70+
### After init
71+
72+
```bash
73+
cd gds-idea-app-my-dashboard
74+
75+
# Create the GitHub repo (requires gh CLI):
76+
gh repo create co-cddo/gds-idea-app-my-dashboard --private --source . --push
77+
78+
# Or add a remote manually:
79+
git remote add origin git@github.com:co-cddo/gds-idea-app-my-dashboard.git
80+
git push -u origin main
81+
```
82+
83+
Then open the project in VS Code and reopen in the dev container when prompted.
84+
85+
## Migrating an existing project
86+
87+
If you have a project created from the [gds-idea-app-templates](https://github.com/co-cddo/gds-idea-app-templates) template repository, migrate it to `idea-app`:
88+
89+
```bash
90+
cd gds-idea-app-my-existing-project
91+
idea-app migrate
92+
```
93+
94+
The command is interactive and will:
95+
96+
1. Read your existing `[tool.webapp]` configuration
97+
2. Ask you to confirm before making changes
98+
3. Build a manifest from your current tracked files
99+
4. Remove old `template/` directory, `[project.scripts]`, and `[build-system]` sections
100+
5. Offer to update your files to the latest templates (with a dry-run preview first)
101+
102+
Run this on a clean branch so you can review the changes:
103+
104+
```bash
105+
git checkout -b migrate-to-idea-app
106+
idea-app migrate
107+
git diff
108+
git add -A && git commit -m "Migrate to idea-app"
109+
```
110+
111+
## Updating template files
112+
113+
When `idea-app` is upgraded with new template changes (Dockerfile improvements, devcontainer updates, etc.), update your project:
114+
115+
```bash
24116
cd gds-idea-app-my-dashboard
25117
idea-app update
118+
```
119+
120+
The update command manages files like the Dockerfile, devcontainer config, and docker-compose. It does not touch your application code, `cdk.json`, or `pyproject.toml`.
121+
122+
### How updates work
123+
124+
Each tracked file is compared against the manifest hash from the last update:
125+
126+
| File state | What happens |
127+
|---|---|
128+
| Unchanged since last update | Overwritten with the latest template |
129+
| Locally modified | Skipped. A `.new` file is written alongside for you to review |
130+
| Missing from project | Created |
131+
132+
When files are skipped, you'll see instructions to compare and merge:
133+
134+
```
135+
diff app_src/Dockerfile app_src/Dockerfile.new
136+
```
26137

27-
# Build and health-check the production Docker image
28-
idea-app smoke-test
138+
### Options
29139

30-
# Provide AWS credentials to dev container
31-
idea-app provide-role
140+
```bash
141+
idea-app update [--dry-run] [--force]
32142
```
33143

34-
## Commands
144+
- `--dry-run`: show what would change without writing anything
145+
- `--force`: overwrite all files, including ones you've modified locally
35146

36-
| Command | Description |
37-
|---------|-------------|
38-
| `idea-app init <framework> <name> [--python 3.13]` | Scaffold a new project |
39-
| `idea-app update [--dry-run]` | Update tool-owned files (Dockerfile, devcontainer, etc.) |
40-
| `idea-app smoke-test [--build-only] [--wait]` | Docker build + health check |
41-
| `idea-app provide-role [--use-profile] [--duration N]` | AWS credential provisioning for dev container |
147+
## Other commands
42148

43-
## Development
149+
### smoke-test
150+
151+
Build and health-check the production Docker image:
152+
153+
```bash
154+
idea-app smoke-test # build + health check
155+
idea-app smoke-test --build-only # just build, skip health check
156+
idea-app smoke-test --wait # keep running after health check, press Enter to stop
157+
```
158+
159+
### provide-role
160+
161+
Provide AWS credentials to the dev container by assuming the configured IAM role:
44162

45-
See [PLAN.md](PLAN.md) for design details and implementation plan.
163+
```bash
164+
idea-app provide-role # assume role from [tool.webapp.dev]
165+
idea-app provide-role --use-profile # pass through current AWS profile instead
166+
idea-app provide-role --duration 7200 # session duration in seconds (default: 3600)
167+
```
168+
169+
Configure the role ARN in your project's `pyproject.toml`:
170+
171+
```toml
172+
[tool.webapp.dev]
173+
aws_role_arn = "arn:aws:iam::123456789012:role/your-dev-role"
174+
aws_region = "eu-west-2"
175+
```
176+
177+
## Development
46178

47179
```bash
48-
# Install dev dependencies
180+
# Clone and install dev dependencies
181+
git clone git@github.com:co-cddo/gds-idea-app-kit.git
182+
cd gds-idea-app-kit
49183
uv sync
50184

51-
# Run tests
185+
# Run unit tests
52186
uv run pytest
53187

188+
# Run integration tests (requires CDK and network access)
189+
uv run pytest -m integration
190+
191+
# Run all tests
192+
uv run pytest -m ""
193+
54194
# Lint and format
55195
uv run ruff check src/ tests/
56196
uv run ruff format src/ tests/

0 commit comments

Comments
 (0)