|
| 1 | +--- |
| 2 | +description: Interactive project configurator. Interviews for app name, domain, repo, Signed-off-by identity, and accent color, then rewrites <app>/<domain>/[EMAIL] placeholders across the harness. Idempotent — re-runnable to update values. |
| 3 | +agent: build |
| 4 | +--- |
| 5 | + |
| 6 | +Replace template placeholders (`<app>`, `<domain>`, `[EMAIL]`, `kyaulabs/template`, |
| 7 | +`kyau <[EMAIL]>`) across the harness with real project values. Stores the |
| 8 | +answers in `.opencode/setup.json` for idempotent re-runs. |
| 9 | + |
| 10 | +## 1. Check for existing manifest |
| 11 | + |
| 12 | +If `.opencode/setup.json` exists, read it to pre-fill the interview with |
| 13 | +current values and enter re-run mode (old-value → new-value substitution). |
| 14 | +If absent, enter first-run mode (placeholder → value substitution). |
| 15 | + |
| 16 | +## 2. Interview |
| 17 | + |
| 18 | +Ask one question at a time. Only re-ask if the answer is empty. |
| 19 | + |
| 20 | +1. **App name** — the public webroot directory name (e.g. `myapp`). Replaces |
| 21 | + `<app>` in the harness. Used in `<app>.<domain>` for the full URL. |
| 22 | +2. **Domain** — the production domain (e.g. `example.com`). Replaces `<domain>`. |
| 23 | + The full site URL is `<app>.<domain>`. |
| 24 | +3. **GitHub org/repo** — replaces `kyaulabs/template` (e.g. `myorg/myapp`). |
| 25 | + Used in `cliff.toml`, `composer.json`, `package.json`, and README. |
| 26 | +4. **Signed-off-by name** — committer name for the DCO footer (e.g. `kyau` or |
| 27 | + your name). Replaces `kyau` in Signed-off-by contexts. Must not be empty. |
| 28 | +5. **Signed-off-by email** — email for the DCO footer. Replaces `[EMAIL]`. |
| 29 | + Used in Signed-off-by, CODE_OF_CONDUCT, and SECURITY. |
| 30 | +6. **Accent color** — `sky-blue` or `light-purple`. Toggles the default |
| 31 | + design tokens in `cdn/sass/_tokens.scss`. See the `frontend-design` skill. |
| 32 | + |
| 33 | +When the user selects an accent color, show the palette: |
| 34 | + |
| 35 | +- **sky-blue:** accent `#38bdf8`, soft `#87ceeb`, hover `#0ea5e9` |
| 36 | +- **light-purple:** accent `#a78bfa`, soft `#c4b5fd`, hover `#8b5cf6` |
| 37 | + |
| 38 | +## 3. Build the token map |
| 39 | + |
| 40 | +Construct the find/replace pairs in order (longest match first to avoid |
| 41 | +substring collisions): |
| 42 | + |
| 43 | +| # | Find (exact string) | Replace with | |
| 44 | +|---|---|---| |
| 45 | +| 1 | `kyau <[EMAIL]>` | `{name} <{email}>` | |
| 46 | +| 2 | `kyaulabs/template` | `{org}/{repo}` | |
| 47 | +| 3 | `<app>` | `{app}` | |
| 48 | +| 4 | `<domain>` | `{domain}` | |
| 49 | +| 5 | `<username>` | `{name}` | |
| 50 | +| 6 | `[EMAIL]` | `{email}` | |
| 51 | + |
| 52 | +Token #1 must precede #6 — if `[EMAIL]` fires first, `kyau <[EMAIL]>` won't |
| 53 | +match. |
| 54 | + |
| 55 | +In **re-run mode**, use the values from the existing manifest as the find |
| 56 | +strings instead of the literal placeholder tokens. For example, if a prior run |
| 57 | +set app to `myapp`, the find string for token #3 is `myapp`, not `<app>`. |
| 58 | + |
| 59 | +## 4. Verify |
| 60 | + |
| 61 | +Print the interview answers as a table: |
| 62 | + |
| 63 | +```text |
| 64 | +Token Current New |
| 65 | +--------------------------- --------------------- --------------------- |
| 66 | +<app> <app> myapp |
| 67 | +<domain> <domain> example.com |
| 68 | +kyaulabs/template kyaulabs/template myorg/myapp |
| 69 | +kyau <[EMAIL]> kyau <[EMAIL]> kyau <kyau@example.com> |
| 70 | +[EMAIL] [EMAIL] kyau@example.com |
| 71 | +<username> <username> kyau |
| 72 | +accent sky-blue (active) light-purple |
| 73 | +
|
| 74 | +Files to sweep (19 files; aurora/ excluded): |
| 75 | + AGENTS.md, .env.example, README.md, CODE_OF_CONDUCT.md, SECURITY.md, |
| 76 | + cliff.toml, composer.json, package.json, |
| 77 | + .opencode/commands/deploy.md, .opencode/commands/prime.md, |
| 78 | + .opencode/agents/debug.md, .opencode/agents/tdd.md, |
| 79 | + .opencode/skills/aurora-page/SKILL.md, .opencode/skills/database/SKILL.md, |
| 80 | + .opencode/skills/conventional-commits/SKILL.md, |
| 81 | + .opencode/skills/writing-plans/SKILL.md, |
| 82 | + .opencode/skills/finishing-a-development-branch/SKILL.md, |
| 83 | + .opencode/docs/build-pipeline.md, cdn/sass/_tokens.scss |
| 84 | +``` |
| 85 | + |
| 86 | +Ask: "Proceed with rewrites? (y/n)" |
| 87 | + |
| 88 | +## 5. Apply |
| 89 | + |
| 90 | +For each file in the sweep list: |
| 91 | + |
| 92 | +1. Skip if the file does not exist (some may not apply to every project). |
| 93 | +2. Read the file. |
| 94 | +3. Apply token map substitutions in order (tokens #1 through #6 — always apply |
| 95 | + #1 before #6 to preserve the `kyau <[EMAIL]>` composite match). |
| 96 | +4. For `cdn/sass/_tokens.scss` only: apply the accent toggle (see below). |
| 97 | +5. Write the file back. |
| 98 | +6. Count per-file replacements. |
| 99 | + |
| 100 | +**Accent toggle** (`cdn/sass/_tokens.scss`): |
| 101 | + |
| 102 | +The file has two accent palettes as comment-toggle lines. For each accent |
| 103 | +choice, ensure the correct lines are uncommented and the other is commented. |
| 104 | + |
| 105 | +For **sky-blue:** |
| 106 | +- `--accent: #38bdf8;` — uncommented (ensure no leading `// `) |
| 107 | +- `--accent-soft: #87ceeb;` — uncommented |
| 108 | +- `// --accent: #a78bfa;` — commented |
| 109 | +- `// --accent-soft: #c4b5fd;` — commented |
| 110 | +- `--accent-hover: #0ea5e9;` — uncommented, value `#0ea5e9` |
| 111 | + |
| 112 | +For **light-purple:** |
| 113 | +- `// --accent: #38bdf8;` — commented |
| 114 | +- `// --accent-soft: #87ceeb;` — commented |
| 115 | +- `--accent: #a78bfa;` — uncommented |
| 116 | +- `--accent-soft: #c4b5fd;` — uncommented |
| 117 | +- `--accent-hover: #8b5cf6;` — uncommented, value `#8b5cf6` |
| 118 | + |
| 119 | +Use the Edit tool for the accent toggle — it is a small targeted change. |
| 120 | +For the token substitutions, use Edit with `replaceAll` for each token or |
| 121 | +`sed -i` when Edit would require many calls. |
| 122 | + |
| 123 | +**Use `sed` for bulk token substitution:** |
| 124 | + |
| 125 | +```bash |
| 126 | +# Token #1 (longest composite first) |
| 127 | +sed -i "s|kyau <[EMAIL]>|{name} <{email}>|g" <file> |
| 128 | +# Token #2 |
| 129 | +sed -i "s|kyaulabs/template|{org}/{repo}|g" <file> |
| 130 | +# Token #3 |
| 131 | +sed -i 's|<app>|{app}|g' <file> |
| 132 | +# Token #4 |
| 133 | +sed -i 's|<domain>|{domain}|g' <file> |
| 134 | +# Token #5 |
| 135 | +sed -i 's|<username>|{name}|g' <file> |
| 136 | +# Token #6 (after token #1 has already consumed the composite matches) |
| 137 | +sed -i 's|\[EMAIL\]|{email}|g' <file> |
| 138 | +``` |
| 139 | + |
| 140 | +Replace `{name}`, `{email}`, `{app}`, `{domain}`, `{org}`, `{repo}` with the |
| 141 | +actual interview values. |
| 142 | + |
| 143 | +## 6. Save manifest |
| 144 | + |
| 145 | +Write `.opencode/setup.json`: |
| 146 | + |
| 147 | +```json |
| 148 | +{ |
| 149 | + "setup_version": 1, |
| 150 | + "setup_date": "<ISO 8601 timestamp>", |
| 151 | + "app": "<app>", |
| 152 | + "domain": "<domain>", |
| 153 | + "repo": "<org>/<repo>", |
| 154 | + "signed_off_by_name": "<name>", |
| 155 | + "signed_off_by_email": "<email>", |
| 156 | + "accent": "<sky-blue | light-purple>" |
| 157 | +} |
| 158 | +``` |
| 159 | + |
| 160 | +## 7. Report |
| 161 | + |
| 162 | +```text |
| 163 | +File Replacements |
| 164 | +-------------------------------------- ------------ |
| 165 | +AGENTS.md 8 |
| 166 | +.env.example 2 |
| 167 | +README.md 12 |
| 168 | +CODE_OF_CONDUCT.md 1 |
| 169 | +SECURITY.md 1 |
| 170 | +cliff.toml 2 |
| 171 | +composer.json 1 |
| 172 | +package.json 1 |
| 173 | +.opencode/commands/deploy.md 8 |
| 174 | +.opencode/commands/prime.md 2 |
| 175 | +.opencode/agents/debug.md 6 |
| 176 | +.opencode/agents/tdd.md 1 |
| 177 | +.opencode/skills/aurora-page/SKILL.md 4 |
| 178 | +.opencode/skills/database/SKILL.md 3 |
| 179 | +.opencode/skills/conventional-commits/SKILL.md 4 |
| 180 | +.opencode/skills/writing-plans/SKILL.md 1 |
| 181 | +.opencode/skills/finishing-a-development-branch/SKILL.md 1 |
| 182 | +.opencode/docs/build-pipeline.md 1 |
| 183 | +cdn/sass/_tokens.scss accent: light-purple |
| 184 | +-------------------------------------- ------------ |
| 185 | +TOTAL 59 replacements across 19 files |
| 186 | +``` |
| 187 | + |
| 188 | +Remind the user: |
| 189 | + |
| 190 | +- Review changes with `git diff`. |
| 191 | +- Run `/prime` if `CONTEXT.md` needs domain content (glossary, entities). |
| 192 | +- The aurora/ submodule was NOT touched — it maintains its own copy of |
| 193 | + harness files. |
| 194 | +- Re-run `/setup` to change values; the manifest enables idempotent updates. |
| 195 | + |
| 196 | +## Rules |
| 197 | + |
| 198 | +- Never touch the `aurora/` directory — it is a git submodule with its own |
| 199 | + copies of AGENTS.md, CODE_OF_CONDUCT.md, SECURITY.md. |
| 200 | +- Never touch `.semgrep/kyaulabs.yml` or semgrep rule names (`kyaulabs-*`) — |
| 201 | + these are rule identifiers, not placeholders. |
| 202 | +- Never touch `kyaulabs/aarch`, `kyaulabs/aurora`, `kyaulabs-bot` — these are |
| 203 | + real external resource references. |
| 204 | +- Apply token #1 (`kyau <[EMAIL]>`) before token #6 (`[EMAIL]`) — the |
| 205 | + composite match must fire before the substring. |
| 206 | +- Skip missing files silently — not all projects will have every file in the |
| 207 | + sweep list. |
| 208 | +- After successful rewrites, print the report. Do not commit or push anything. |
| 209 | +- If a file contains no matches for any token, skip it (do not write it back |
| 210 | + unchanged — the Edit/sed approach inherently leaves it alone). |
0 commit comments