Skip to content

Commit fbf6eee

Browse files
github-actions[bot]kevinwang5658test2
authored
feat: Add ios-emulators resource (#73)
* feat: Add ios-emulators resource (auto-generated from issue #72) * fix: naming clash * feat: changed simulators into an array, skip tests if xcode isn't already installed and add check if xcode is installed inside the create * feat: increase max turns for test jobs for generate resource action * feat: changed name to ios-simulators to reflect plural form. Removed state parameter * feat: updated completions path to JSONPath to handle more complicated matching cases (such as matching objects inside array elements) * feat: Bug fixes and additional completions * feat: add additional simulators and accept license * feat: skip fixer job if fix already exists * fix: added code to install missing runtimes * fix: refresh not working properly after deletion * fix: added ability to download older runtimes * feat: disable running the claude fixer job for manual runs * fix: update test to ios 26 * fix: ios simulators refresh * feat: bump library * chore: bump version * fix: git-lfs bug * fix: bump library version * fix: terraform errors * fix: bump library * fix: bump package version --------- Co-authored-by: kevinwang5658 <20214115+kevinwang5658@users.noreply.github.com> Co-authored-by: kevinwang <kevinwang5658@gmail.com> Co-authored-by: test2 <test2@test.com>
1 parent e1a67cc commit fbf6eee

55 files changed

Lines changed: 1051 additions & 117 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/claude-fixer.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
determine-runner:
99
runs-on: ubuntu-latest
10-
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
10+
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event == 'schedule' }}
1111
outputs:
1212
runner: ${{ steps.pick.outputs.runner }}
1313
steps:
@@ -19,8 +19,27 @@ jobs:
1919
echo "runner=ubuntu-latest" >> $GITHUB_OUTPUT
2020
fi
2121
22-
fix-on-failure:
22+
check-existing-pr:
23+
runs-on: ubuntu-latest
2324
needs: determine-runner
25+
outputs:
26+
skip: ${{ steps.check.outputs.skip }}
27+
steps:
28+
- id: check
29+
env:
30+
GH_TOKEN: ${{ github.token }}
31+
run: |
32+
BRANCH="${{ github.event.workflow_run.head_branch }}"
33+
COUNT=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "fix/claude-auto-" --base "$BRANCH" --state open --json number --jq 'length')
34+
if [ "${COUNT:-0}" -gt 0 ]; then
35+
echo "skip=true" >> $GITHUB_OUTPUT
36+
else
37+
echo "skip=false" >> $GITHUB_OUTPUT
38+
fi
39+
40+
fix-on-failure:
41+
needs: [determine-runner, check-existing-pr]
42+
if: needs.check-existing-pr.outputs.skip == 'false'
2443
runs-on: ${{ needs.determine-runner.outputs.runner }}
2544
permissions:
2645
contents: write

.github/workflows/resource-request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ jobs:
240240
uses: anthropics/claude-code-action@v1
241241
with:
242242
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
243-
claude_args: "--allowedTools Bash,Read,Edit,Write --max-turns 30"
243+
claude_args: "--allowedTools Bash,Read,Edit,Write --max-turns 120"
244244
prompt: |
245245
The integration tests for the newly generated resource failed on Linux (ubuntu-latest).
246246
@@ -343,7 +343,7 @@ jobs:
343343
uses: anthropics/claude-code-action@v1
344344
with:
345345
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
346-
claude_args: "--allowedTools Bash,Read,Edit,Write --max-turns 30"
346+
claude_args: "--allowedTools Bash,Read,Edit,Write --max-turns 120"
347347
prompt: |
348348
The integration tests for the newly generated resource failed on macOS (macos-latest).
349349

CLAUDE.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@ This is a **Codify plugin** that provides 50+ declarative system configuration r
88

99
## Build and Test Commands
1010

11+
**NEVER run integration tests on the local machine — not `npm test`, `npm run test:integration`, `npm run test:integration:dev`, nor `vitest` against anything under `test/**`.** Integration tests install and uninstall real tools/binaries (Homebrew formulae, CLIs, etc.) via the actual system package managers, and can mangle the user's local dev setup. The user runs these manually themselves inside a VM. If integration test coverage is needed, tell the user what to run and let them run it — do not run it yourself under any circumstance, even if asked to "verify" or "confirm" a fix. Unit tests (`npm run test:unit`, or `vitest` against `src/**/*.test.ts`) are safe and fine to run.
12+
1113
```bash
1214
# Build the plugin (compiles TypeScript, bundles with Rollup, generates schemas.json)
1315
npm run build
1416

15-
# Run all tests (unit + integration)
17+
# Run all tests (unit + integration) — DO NOT RUN LOCALLY, see warning above
1618
npm test
1719

18-
# Run unit tests only (fast - tests in src/**/*.test.ts)
20+
# Run unit tests only (fast - tests in src/**/*.test.ts) — safe to run locally
1921
npm run test:unit
2022

21-
# Run integration tests only (slow - full lifecycle tests in test/**/*.test.ts)
23+
# Run integration tests only (slow - full lifecycle tests in test/**/*.test.ts) — DO NOT RUN LOCALLY, user runs this in a VM
2224
npm run test:integration
2325

24-
# Run integration tests in development mode
26+
# Run integration tests in development mode — DO NOT RUN LOCALLY, user runs this in a VM
2527
npm run test:integration:dev
2628

2729
# Deploy to Cloudflare R2
@@ -199,6 +201,7 @@ Zod is preferred because types are automatically inferred from the schema, preve
199201
- Tests create → modify → destroy flow
200202
- Includes validation callbacks
201203
- **Always use `testSpawn` from `@codifycli/plugin-test` for shell commands in validation callbacks.** `testSpawn` sources the user's shell RC (`.zshrc`, `.bashrc`) before running the command, so PATH and shell aliases are available — just like a real terminal session. Never use `execSync` in integration tests.
204+
- **Claude must never execute these locally.** They install/uninstall real system packages and can corrupt the user's dev environment. The user runs these themselves in a disposable VM — Claude should only write/edit the tests and let the user run them.
202205

203206
**Integration Test Pattern:**
204207
```typescript
@@ -369,11 +372,24 @@ The Codify Editor supports auto-complete for certain resource parameters (e.g. H
369372

370373
### Adding completions for a parameter
371374

372-
1. Create `src/resources/<category>/<resource>/completions/<type>.<param>.ts`
375+
1. Create `src/resources/<category>/<resource>/completions/<resource-type>.<jsonpath>.ts`
373376
2. Export a default async function returning `Promise<string[]>` — fetch the values, return them, nothing else
374-
3. The filename determines the Supabase metadata automatically:
375-
- `homebrew.formulae.ts``resource_type=homebrew`, `parameter_path=/formulae`
376-
4. Run `npm run build:completions` to regenerate the index
377+
3. The filename encodes both the resource type and the JSONPath of the parameter:
378+
- Everything **before the first dot** = `resource_type` (e.g. `homebrew`)
379+
- Everything **after the first dot** = JSONPath expression (e.g. `$.formulae`)
380+
- Examples:
381+
- `homebrew.$.formulae.ts``resource_type=homebrew`, `parameter_path=$.formulae`
382+
- `nvm.$.nodeVersions.ts``resource_type=nvm`, `parameter_path=$.nodeVersions`
383+
- `codex.$.config.model.ts``resource_type=codex`, `parameter_path=$.config.model`
384+
4. For parameters **nested inside array items** (e.g. a property on each object in an array), use `[x]` in the filename to encode the `[*]` array wildcard — bundlers treat `[*]` as a glob pattern in import paths, so `[x]` is used as the safe filename equivalent and is translated to `[*]` by the codegen script:
385+
- `ios-simulators.$.simulators[x].deviceType.ts``parameter_path=$.simulators[*].deviceType`
386+
5. For **mirror completions** — where a parameter's suggestions should reflect the current value of a sibling parameter on the same resource — export a plain object instead of a fetch function:
387+
```typescript
388+
// xcodes.$.selected.ts — offers whatever the user typed in xcodeVersions
389+
export default { mirrorParameter: '$.xcodeVersions' } as const;
390+
```
391+
The codegen script detects the export type at build time. The cron job writes a single metadata row to Supabase (with `mirror_parameter_path` set and no `value` rows). The dashboard reads this and serves completions client-side from the resource's current config — no DB query needed.
392+
6. Run `npm run build:completions` to regenerate the index
377393

378394
```bash
379395
npm run build:completions # regenerate completions-cron/src/__generated__/completions-index.ts

0 commit comments

Comments
 (0)