Skip to content

Commit 13156fc

Browse files
committed
Updated hooks and steering
1 parent 9c0e594 commit 13156fc

12 files changed

Lines changed: 47 additions & 236 deletions

.kiro/hooks/auto-deploy-app.kiro.hook

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"enabled": true,
33
"name": "Auto Deploy on Code Change",
4-
"description": "Automatically deploys the SDK app to the router after Kiro finishes making code changes. Uses make.py deploy.",
4+
"description": "Automatically deploys the SDK app to the router after Kiro finishes making code changes. Uses .kiro/steering/deploy.md.",
55
"version": "1",
66
"when": {
77
"type": "agentStop"
88
},
99
"then": {
1010
"type": "askAgent",
11-
"prompt": "If you already ran a deploy this session, do nothing — the app is already deployed. Otherwise, if you created or modified any SDK app Python files during this session, read sdk_settings.ini to get the app_name, then deploy using the correct Python: if .venv exists, use '.venv/Scripts/python make.py deploy <app_name>' on Windows or '.venv/bin/python make.py deploy <app_name>' on Mac/Linux. If no .venv exists, fall back to 'python3 make.py deploy <app_name>' or 'python make.py deploy <app_name>' whichever is available. After the command completes, review the output for errors. Check that log timestamps are AFTER the deploy started. If logs show the app started successfully, report success briefly. If there are errors, diagnose and suggest fixes. If no app code was changed, do nothing."
11+
"prompt": "If you already ran a deploy this session, do nothing — the app is already deployed. Otherwise, if you created or modified any SDK app Python files during this session, read .kiro/steering/deploy.md and follow its instructions. Read sdk_settings.ini to get the app_name. If no app code was changed, do nothing."
1212
},
1313
"workspaceFolderName": "sdk-samples",
1414
"shortName": "auto-deploy-app"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "Setup Dev Environment",
33
"version": "1.0.0",
4-
"description": "Creates a Python virtual environment and installs all SDK dependencies from requirements.txt",
4+
"description": "Automatically creates a Python virtual environment and installs SDK dependencies if .venv is missing",
55
"when": {
6-
"type": "userTriggered"
6+
"type": "promptSubmit"
77
},
88
"then": {
99
"type": "runCommand",
10-
"command": "python3 make.py setup 2>/dev/null || python make.py setup"
10+
"command": "test -d .venv || (python3 make.py setup || python make.py setup)"
1111
}
1212
}

.kiro/steering/coding-standards.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Applications run on Cradlepoint routers using Python 3.8.
3434

3535
## Local Development (Running on Your Computer)
3636

37-
- **Apps can run locally** - `python3 my_app/my_app.py` runs the app on your computer. cp.py auto-detects it's not on a router and uses HTTP REST to communicate with the dev router specified in `sdk_settings.ini`
37+
- **Apps can run locally** - `.venv/bin/python my_app/my_app.py` (Mac/Linux) or `.venv\Scripts\python my_app/my_app.py` (Windows) runs the app on your computer. cp.py auto-detects it's not on a router and uses HTTP REST to communicate with the dev router specified in `sdk_settings.ini`
3838
- **cp.get/put/post/delete work locally** - all API calls route through REST to the dev router
3939
- **cp.log() prints to stdout locally** - output goes to your terminal instead of syslog
4040
- **cp.alert() does NOT work locally** - logs the alert text to console but does not send to NCM
@@ -46,8 +46,8 @@ Applications run on Cradlepoint routers using Python 3.8.
4646

4747
## Python Libraries and Dependencies
4848

49-
- **Install libraries directly to app folder**: `pip3 install -t path/to/app_folder library_name`
50-
- **Example**: `pip3 install -t gpio_modem_control requests`
49+
- **Install libraries directly to app folder**: `.venv/bin/pip install -t path/to/app_folder library_name` (Mac/Linux) or `.venv\Scripts\pip install -t path/to/app_folder library_name` (Windows)
50+
- **Example**: `.venv/bin/pip install -t gpio_modem_control requests` (Mac/Linux) or `.venv\Scripts\pip install -t gpio_modem_control requests` (Windows)
5151
- **CRITICAL: No .pyc or .so files** - routers only support pure Python (.py) files
5252
- Libraries are packaged with the app and deployed to the router
5353
- Keep dependencies minimal - routers have limited storage

.kiro/steering/deploy.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ description: "Deploy SDK app to Cradlepoint router via make.py deploy (cross-pla
66

77
Deploy the SDK app to the router:
88

9-
```bash
10-
python3 make.py deploy {app_name}
11-
```
9+
1. Read `sdk_settings.ini` to get the `app_name`
10+
2. Run the deploy command:
11+
12+
- Windows: `.venv\Scripts\python make.py deploy {app_name}`
13+
- Mac/Linux: `.venv/bin/python make.py deploy {app_name}`
1214

1315
This will:
1416
1. Purge all apps from router
@@ -18,4 +20,4 @@ This will:
1820

1921
After deployment, verify the app started successfully by checking the logs.
2022

21-
**Note:** Ensure sdk_settings.ini has correct router IP and credentials before deploying.
23+
**Note:** Before deploying, read `sdk_settings.ini` and check that `dev_client_password` is not the default `mypassword`. If it is, open `sdk_settings.ini` and tell the user to update it with their router credentials before proceeding.

.kiro/steering/learn.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ description: "Review learnings and update rules and documentation"
3535
## Explore APIs before documenting:
3636

3737
```bash
38-
python3 docs/ncos-api/explore_status.py status/wan/devices
38+
# Mac/Linux:
39+
.venv/bin/python docs/ncos-api/explore_status.py status/wan/devices
40+
# Windows:
41+
.venv\Scripts\python docs/ncos-api/explore_status.py status/wan/devices
3942
```
4043

4144
This shows the ACTUAL API response with all fields - use it to verify structures before updating docs.

.kiro/steering/rtfm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ description: "API verification workflow — read docs before writing API code"
1111
1. **STOP** - Do NOT assume fields exist
1212
2. **SEARCH docs FIRST**: `grep -r "keyword" docs/ncos-api/ --include="*.md"`
1313
3. **READ relevant docs** - Understand proper usage patterns and examples
14-
4. **CHECK DTD**: `curl -s -u admin:pass http://router/api/dtd/config/path | python3 -m json.tool`
15-
5. **TEST with curl**: `curl -s -u admin:pass http://router/api/status/path | python3 -m json.tool`
14+
4. **CHECK DTD**: `curl -s -u admin:pass http://router/api/dtd/config/path | .venv/bin/python -m json.tool` (Mac/Linux) or `curl -s -u admin:pass http://router/api/dtd/config/path | .venv\Scripts\python -m json.tool` (Windows)
15+
5. **TEST with curl**: `curl -s -u admin:pass http://router/api/status/path | .venv/bin/python -m json.tool` (Mac/Linux) or `curl -s -u admin:pass http://router/api/status/path | .venv\Scripts\python -m json.tool` (Windows)
1616
6. **VERIFY fields** - Only use fields that actually exist in the response
1717
7. **THEN code** - Write code based on verified, documented structure
1818

.kiro/steering/setup.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ inclusion: always
44

55
# Dev Environment Check
66

7-
If the user asks to build, deploy, or run an app and `.venv` does not exist in the workspace root, do NOT auto-run setup. Instead, let the user know:
7+
The `check-venv` hook automatically runs `make.py setup` if `.venv` is missing at the start of every prompt. No manual intervention needed.
88

9-
> It looks like the Python environment hasn't been set up yet. Click the Kiro ghost icon in the sidebar and run the **Setup Dev Environment** hook, then try again.
10-
11-
Do not mention this if `.venv` already exists.
9+
If setup fails, let the user know they can also run the **Setup Dev Environment** hook manually from the Kiro sidebar.

.kiro/steering/workflow.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ This prevents the "code first, debug later" cycle. Start a spec with: "Create a
1616

1717
## Python Environment
1818

19-
Use `python3` for all commands.
19+
Use the project's virtual environment for all commands:
20+
- Windows: `.venv\Scripts\python make.py ...`
21+
- Mac/Linux: `.venv/bin/python make.py ...`
2022

2123
## Saved Prompt Shortcuts
2224

@@ -28,9 +30,8 @@ Use `python3` for all commands.
2830

2931
**ALWAYS deploy after creating or modifying an app.** After any code change to an app's Python files, automatically run:
3032

31-
```bash
32-
python3 make.py deploy {app_name}
33-
```
33+
- Windows: `.venv\Scripts\python make.py deploy {app_name}`
34+
- Mac/Linux: `.venv/bin/python make.py deploy {app_name}`
3435

3536
Do NOT ask the user if they want to deploy — just do it.
3637

@@ -69,7 +70,10 @@ app_name/
6970
## Create App
7071

7172
```bash
72-
python3 make.py create {app_name}
73+
# Windows:
74+
.venv\Scripts\python make.py create {app_name}
75+
# Mac/Linux:
76+
.venv/bin/python make.py create {app_name}
7377
```
7478

7579
This generates all required files from app_template (package.ini, start.sh, cp.py, {app_name}.py, readme.md).
@@ -90,11 +94,11 @@ This generates all required files from app_template (package.ini, start.sh, cp.p
9094

9195
**NEVER overwrite package.ini, start.sh, or cp.py after creation** - these are auto-generated and correct.
9296

93-
**ALWAYS deploy after creating or modifying an app** - use `python3 make.py deploy {app_name}` immediately after code changes.
97+
**ALWAYS deploy after creating or modifying an app** - use `.venv/bin/python make.py deploy {app_name}` (Mac/Linux) or `.venv\Scripts\python make.py deploy {app_name}` (Windows) immediately after code changes.
9498

9599
## Deploy to Router
96100

97-
**ALWAYS use make.py deploy** - `python3 make.py deploy {app_name}`
101+
**ALWAYS use make.py deploy** - `.venv/bin/python make.py deploy {app_name}` (Mac/Linux) or `.venv\Scripts\python make.py deploy {app_name}` (Windows)
98102

99103
This handles:
100104
- Purging old apps
@@ -103,7 +107,7 @@ This handles:
103107
- Starting the app (auto_start=true in package.ini)
104108
- Showing status and logs
105109

106-
**Just run `python3 make.py deploy {app_name}`** - no need to run `make.py clean` or remove old tar.gz files first. It handles everything. The app auto-starts after install, so there's no need to run `make.py start` either.
110+
**Just run `make.py deploy`** - no need to run `make.py clean` or remove old tar.gz files first. It handles everything. The app auto-starts after install, so there's no need to run `make.py start` either.
107111

108112
**NEVER use make.py install directly** - always use `make.py deploy` for deployment.
109113

@@ -114,9 +118,17 @@ This handles:
114118
## Other Commands
115119

116120
```bash
117-
python3 make.py status {app_name} # Check app status
118-
python3 make.py start {app_name} # Start app
119-
python3 make.py stop {app_name} # Stop app
120-
python3 make.py uninstall {app_name} # Remove app
121-
python3 make.py clean {app_name} # Remove build artifacts
121+
# Windows:
122+
.venv\Scripts\python make.py status {app_name} # Check app status
123+
.venv\Scripts\python make.py start {app_name} # Start app
124+
.venv\Scripts\python make.py stop {app_name} # Stop app
125+
.venv\Scripts\python make.py uninstall {app_name} # Remove app
126+
.venv\Scripts\python make.py clean {app_name} # Remove build artifacts
127+
128+
# Mac/Linux:
129+
.venv/bin/python make.py status {app_name}
130+
.venv/bin/python make.py start {app_name}
131+
.venv/bin/python make.py stop {app_name}
132+
.venv/bin/python make.py uninstall {app_name}
133+
.venv/bin/python make.py clean {app_name}
122134
```

deploy.py

Lines changed: 0 additions & 83 deletions
This file was deleted.

deploy.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)