You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add `defaultConfig` and `exampleConfigs` to a Codify resource.
4
+
5
+
## Instructions
6
+
7
+
The user will either pass a file path as an argument (`$ARGUMENTS`) or have a file open in the IDE. Read the resource file, then follow the rules below to add `defaultConfig` and `exampleConfigs`.
8
+
9
+
If `$ARGUMENTS` is provided, use that file path. Otherwise use the file the user has open.
10
+
11
+
### Step 1 — Read the resource
12
+
13
+
Read the resource file. Identify:
14
+
- The config interface/type (fields, which are required vs optional)
15
+
-`operatingSystems` declared in `getSettings()` — determines whether to add `os` to examples
16
+
-`dependencies` — used to decide whether to show a multi-resource example
17
+
- Any existing `defaultConfig` or `exampleConfigs` (update rather than duplicate)
18
+
19
+
If the schema is a separate JSON file, read it too.
20
+
21
+
Also check for sibling resources that are commonly used together (e.g. if this resource `dependsOn` another type, read that type's file to understand its config shape).
22
+
23
+
### Step 2 — Add `defaultConfig`
24
+
25
+
Rules:
26
+
- Type: `Partial<TheConfig>` (never include `os` — it's not on the typed config interface)
27
+
- For required fields with no sensible default: use the placeholder string `'<Replace me here!'>`
28
+
- For optional arrays that default to empty: set to `[]`
29
+
- Omit fields that are purely user-specific (paths, names, credentials)
30
+
- Use the tool's own documented defaults where applicable
31
+
32
+
### Step 3 — Add `exampleConfigs`
33
+
34
+
Rules:
35
+
- Up to two examples: `example1` and `example2`
36
+
-**No trivial examples** — every example must have meaningful configuration, not just `{ type: 'foo' }` with no parameters
37
+
-`example1`: the most common real-world use case with substantive config values
38
+
-`example2`: a more advanced variant OR a multi-resource example showing full end-to-end setup; multi-resource is preferred when the resource `dependsOn` another
39
+
- Every example needs a `title` (short noun-phrase) and a `description` (one sentence)
40
+
- Use realistic placeholder values for sensitive fields (`'<Replace me here!'>`), not real credentials
41
+
- Do not add step-numbering in descriptions
42
+
43
+
**`os` field in examples:**
44
+
- The `os` field values come from the `ResourceOs` enum in `@codifycli/schemas` (`../codify-schemas/src/types/index.ts`): `'macOS'`, `'linux'`, `'windows'`
45
+
- Add `os` to config entries inside examples only when `operatingSystems` is restricted to a single OS (e.g. Darwin-only → `os: ['macOS']`, Linux-only → `os: ['linux']`)
46
+
- Skip `os` entirely when the resource supports both Darwin and Linux
47
+
48
+
**Shared examples:**
49
+
- When a multi-resource example is used across multiple related resources (e.g. asdf + asdf-plugin + asdf-install), define it once in a shared `examples.ts` file in the resource folder and spread it in with `...exampleSharedConfigs`
50
+
51
+
### Step 4 — Import `ExampleConfig`
52
+
53
+
Add `ExampleConfig` to the existing `@codifycli/plugin-core` import if not already present.
54
+
55
+
### Step 5 — Register in `getSettings()`
56
+
57
+
Add `defaultConfig` and `exampleConfigs` fields inside the object returned by `getSettings()`, before `operatingSystems`.
58
+
59
+
## Output format
60
+
61
+
Make all edits directly to the file. Do not summarise every line changed — just briefly confirm what was added.
Copy file name to clipboardExpand all lines: CLAUDE.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -383,16 +383,17 @@ Every resource should have a `defaultConfig` and `exampleConfigs`. These are sur
383
383
- For required fields with no sensible default (e.g. `deviceId`, `plugin`, `awsAccessKeyId`), use the placeholder string `'<Replace me here!'>`
384
384
- For optional array fields that default to empty (e.g. `plugins`, `aliases`, `paths`), set them to `[]`
385
385
- Omit fields that are purely user-specific (e.g. paths, names, credentials) — don't guess
386
-
- If the resource declares `operatingSystems: [OS.Darwin]` or `operatingSystems: [OS.Linux]` (i.e. only one OS, not both), do NOT add `os` to `defaultConfig` (it's not on the typed config interface). Instead, add `os: ['darwin']` or `os: ['linux']` only to the config entries inside `exampleConfigs`. Skip entirely when the resource supports both OS.
386
+
- If the resource declares `operatingSystems: [OS.Darwin]` or `operatingSystems: [OS.Linux]` (i.e. only one OS, not both), do NOT add `os` to `defaultConfig` (it's not on the typed config interface). Instead, add the correct `os` value only to the config entries inside `exampleConfigs`. Skip entirely when the resource supports both OS.
387
+
- The `os` field values come from the `ResourceOs` enum in `@codifycli/schemas` (`../codify-schemas/src/types/index.ts`): use `'macOS'` for Darwin, `'linux'` for Linux, `'windows'` for Windows (e.g. `os: ['macOS']`, not `os: ['darwin']`).
387
388
388
389
**`exampleConfigs`** — up to two named examples (`example1`, `example2`):
389
-
-`example1`: a minimal, focused single-resource example showing the most common use case
390
+
-`example1`: a substantive example showing the most common real-world use case with meaningful configuration — not a trivial "just install it" with no parameters
390
391
-`example2`: either a more advanced single-resource variant, OR a multi-resource example that shows the full end-to-end setup (e.g. install the tool + configure it)
391
392
- Multi-resource examples (configs array with multiple types) are especially useful when the resource `dependsOn` another — show installing the dependency too
392
393
- Every example needs a `title` (short, noun-phrase) and a `description` (one sentence explaining what it does and why)
393
394
- Use realistic but obviously-placeholder values for sensitive fields (`'<Replace me here!'>`), not real credentials
394
395
- Don't add step-numbering ("Step 1 of 3") in descriptions — it doesn't make sense when viewed from a single resource page
395
-
- If the resource is OS-specific (only Darwin or only Linux), add `os: ['darwin']` or `os: ['linux']`to each config entry in the example so the editor filters it correctly
396
+
- If the resource is OS-specific (only Darwin or only Linux), add the correct `os` value to each config entry in the example so the editor filters it correctly (e.g. `os: ['macOS']`)
396
397
397
398
**Structure:**
398
399
```typescript
@@ -401,7 +402,7 @@ import { ExampleConfig } from '@codifycli/plugin-core';
401
402
const defaultConfig:Partial<MyConfig> = {
402
403
someField: 'sensible-default',
403
404
optionalArray: [],
404
-
// Add os: ['darwin'] or os: ['linux'] if operatingSystems is not [OS.Darwin, OS.Linux]
405
+
// Add os: ['macOS'] or os: ['linux'] if operatingSystems is not [OS.Darwin, OS.Linux]
0 commit comments