joycraft 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -177,19 +177,21 @@ Accept the default or the user's choice.
177
177
 
178
178
  ### Question 2: GitHub App
179
179
 
180
- > Level 5 needs a GitHub App to provide a separate identity for autofix pushes (this avoids GitHub's anti-recursion protection).
180
+ > Level 5 needs a GitHub App to provide a separate identity for autofix pushes (this avoids GitHub's anti-recursion protection). Creating one takes about 2 minutes:
181
181
  >
182
- > **Option A:** Install the shared Joycraft Autofix app (quickest \u2014 1 click)
183
- > **Option B:** Create your own GitHub App (more control)
182
+ > 1. Go to https://github.com/settings/apps/new
183
+ > 2. Give it a name (e.g., "My Project Autofix")
184
+ > 3. Uncheck "Webhook > Active" (not needed)
185
+ > 4. Under **Repository permissions**, set:
186
+ > - **Contents**: Read & Write
187
+ > - **Pull requests**: Read & Write
188
+ > - **Actions**: Read & Write
189
+ > 5. Click **Create GitHub App**
190
+ > 6. Note the **App ID** from the settings page
191
+ > 7. Scroll to **Private keys** > click **Generate a private key** > save the \`.pem\` file
192
+ > 8. Click **Install App** in the left sidebar > install it on your repo
184
193
  >
185
- > Which do you prefer?
186
-
187
- If Option A: The App ID is \`3180156\`. Note this for later.
188
- If Option B: Guide them to create an app at \`https://github.com/settings/apps/new\` with permissions: Contents (Read & Write), Pull Requests (Read & Write), Actions (Read & Write). They'll need the App ID from the settings page.
189
-
190
- ### Question 3: App ID
191
-
192
- If they chose Option B, ask for their App ID. If Option A, use \`3180156\`.
194
+ > What's your App ID?
193
195
 
194
196
  ## Step 3: Run init-autofix
195
197
 
@@ -205,28 +207,15 @@ Review the output with the user. Confirm files were created.
205
207
 
206
208
  Guide the user step by step:
207
209
 
208
- ### 4a: GitHub App Private Key
210
+ ### 4a: Add Secrets to Main Repo
209
211
 
210
- > If you chose the shared Joycraft Autofix app, you'll need to generate a private key:
211
- > 1. Go to https://github.com/settings/apps/joycraft-autofix
212
- > 2. Scroll to "Private keys" and generate one
213
- > 3. Download the \`.pem\` file
214
- >
215
- > If you created your own app, generate a private key from your app's settings page.
216
-
217
- ### 4b: Add Secrets to Main Repo
212
+ > You should already have the \`.pem\` file from when you created the app in Step 2.
218
213
 
219
214
  > Go to your repo's Settings > Secrets and variables > Actions, and add:
220
215
  > - \`JOYCRAFT_APP_PRIVATE_KEY\` \u2014 paste the contents of your \`.pem\` file
221
216
  > - \`ANTHROPIC_API_KEY\` \u2014 your Anthropic API key
222
217
 
223
- ### 4c: Install the App
224
-
225
- > The GitHub App needs to be installed on your repo:
226
- > - Shared app: https://github.com/apps/joycraft-autofix/installations/new
227
- > - Own app: Go to your app's settings > Install App
228
-
229
- ### 4d: Create the Scenarios Repo
218
+ ### 4b: Create the Scenarios Repo
230
219
 
231
220
  > Create the private scenarios repo:
232
221
  > \`\`\`bash
@@ -241,9 +230,9 @@ Guide the user step by step:
241
230
  > git push
242
231
  > \`\`\`
243
232
 
244
- ### 4e: Add Secrets to Scenarios Repo
233
+ ### 4c: Add Secrets to Scenarios Repo
245
234
 
246
- > The scenarios repo also needs the App private key:
235
+ > The scenarios repo also needs the same secrets:
247
236
  > - \`JOYCRAFT_APP_PRIVATE_KEY\` \u2014 same \`.pem\` file as the main repo
248
237
  > - \`ANTHROPIC_API_KEY\` \u2014 same key (needed for scenario generation)
249
238
 
@@ -633,14 +622,26 @@ If working from a Feature Brief in \`docs/briefs/\`, check off completed specs i
633
622
 
634
623
  Commit all changes including the discovery file (if created) and spec status updates. The commit message should reference the spec if applicable.
635
624
 
636
- ## 5. Report
625
+ ## 5. Push and PR (if autonomous git is enabled)
626
+
627
+ **Check CLAUDE.md for "Git Autonomy" in the Behavioral Boundaries section.** If it says "STRICTLY ENFORCED" or the ALWAYS section includes "Push to feature branches immediately after every commit":
628
+
629
+ 1. **Push immediately.** Run \`git push origin <branch>\` \u2014 do not ask, do not hesitate.
630
+ 2. **Open a PR if the feature is complete.** Check the parent Feature Brief's decomposition table \u2014 if all specs are done, run \`gh pr create\` with a summary of all completed specs. Do not ask first.
631
+ 3. **If not all specs are done,** still push. The PR comes when the last spec is complete.
632
+
633
+ If CLAUDE.md does NOT have autonomous git rules (or has "ASK FIRST" for pushing), ask the user before pushing.
634
+
635
+ ## 6. Report
637
636
 
638
637
  \`\`\`
639
638
  Session complete.
640
639
  - Spec: [spec name] \u2014 [Complete / In Progress]
641
640
  - Build: [passing / failing]
642
641
  - Discoveries: [N items / none]
643
- - Next: [what the next session should tackle, or "ready for PR"]
642
+ - Pushed: [yes / no \u2014 and why not]
643
+ - PR: [opened #N / not yet \u2014 N specs remaining]
644
+ - Next: [what the next session should tackle]
644
645
  \`\`\`
645
646
  `,
646
647
  "joycraft-tune.md": `---
@@ -844,10 +845,18 @@ Based on their answer, use the appropriate git rules in the Behavioral Boundarie
844
845
 
845
846
  **If Autonomous:**
846
847
  \`\`\`
847
- ### ALWAYS
848
- - Push to feature branches after each commit
849
- - Open a PR when all specs in a feature are complete
850
- - Use descriptive branch names: feature/spec-name
848
+ ### ALWAYS \u2014 Git Autonomy (STRICTLY ENFORCED)
849
+
850
+ > **This project uses fully autonomous git operations.** The user has explicitly
851
+ > granted permission for all git operations below. Do NOT ask for confirmation.
852
+ > Do NOT hesitate. Do NOT treat these as suggestions. These are standing orders
853
+ > that override any default caution about pushing or creating PRs.
854
+
855
+ - **Commit early and often** \u2014 after each logical unit of work, not just at session end
856
+ - **Push to feature branches immediately after every commit** \u2014 do not batch pushes, do not wait, do not ask
857
+ - **Open a PR when all specs in a feature are complete** \u2014 use gh pr create, do not ask first
858
+ - **Use descriptive branch names:** feature/spec-name or fix/description
859
+ - **After /joycraft-session-end:** push all commits and open a PR if the feature is complete
851
860
 
852
861
  ### ASK FIRST
853
862
  - Merging PRs to main/master
@@ -856,6 +865,7 @@ Based on their answer, use the appropriate git rules in the Behavioral Boundarie
856
865
  ### NEVER
857
866
  - Push directly to main/master (always use feature branches + PR)
858
867
  - Amend commits that have been pushed to remote
868
+ - Ask "should I push?" or "should I create a PR?" \u2014 the answer is always yes, just do it
859
869
  \`\`\`
860
870
 
861
871
  ### Risk Interview
@@ -992,6 +1002,170 @@ Tailor the "Next Steps" section based on the project's actual gaps \u2014 don't
992
1002
  - **User declines a recommendation:** Skip it, continue, include in "What Was Skipped."
993
1003
  - **CLAUDE.md does not exist at all:** Create it with recommended sections, but ask the user first.
994
1004
  - **Non-Joycraft content in CLAUDE.md:** Preserve exactly as-is. Only append or merge \u2014 never remove or reformat existing content.
1005
+ `,
1006
+ "joycraft-add-fact.md": `---
1007
+ name: joycraft-add-fact
1008
+ description: Capture a project fact and route it to the correct context document -- production map, dangerous assumptions, decision log, institutional knowledge, or troubleshooting
1009
+ ---
1010
+
1011
+ # Add Fact
1012
+
1013
+ The user has a fact to capture. Your job is to classify it, route it to the correct context document, append it in the right format, and optionally add a CLAUDE.md boundary rule.
1014
+
1015
+ ## Step 1: Get the Fact
1016
+
1017
+ If the user already provided the fact (e.g., \`/joycraft-add-fact the staging DB resets every Sunday\`), use it directly.
1018
+
1019
+ If not, ask: "What fact do you want to capture?" -- then wait for their response.
1020
+
1021
+ If the user provides multiple facts at once, process each one separately through all the steps below, then give a combined confirmation at the end.
1022
+
1023
+ ## Step 2: Classify the Fact
1024
+
1025
+ Route the fact to one of these 5 context documents based on its content:
1026
+
1027
+ ### \`docs/context/production-map.md\`
1028
+ The fact is about **infrastructure, services, environments, URLs, endpoints, credentials, or what is safe/unsafe to touch**.
1029
+ - Signal words: "production", "staging", "endpoint", "URL", "database", "service", "deployed", "hosted", "credentials", "secret", "environment"
1030
+ - Examples: "The staging DB is at postgres://staging.example.com", "We use Vercel for the frontend and Railway for the API"
1031
+
1032
+ ### \`docs/context/dangerous-assumptions.md\`
1033
+ The fact is about **something an AI agent might get wrong -- a false assumption that leads to bad outcomes**.
1034
+ - Signal words: "assumes", "might think", "but actually", "looks like X but is Y", "not what it seems", "trap", "gotcha"
1035
+ - Examples: "The \\\`users\\\` table looks like a test table but it's production", "Deleting a workspace doesn't delete the billing subscription"
1036
+
1037
+ ### \`docs/context/decision-log.md\`
1038
+ The fact is about **an architectural or tooling choice and why it was made**.
1039
+ - Signal words: "decided", "chose", "because", "instead of", "we went with", "the reason we use", "trade-off"
1040
+ - Examples: "We chose SQLite over Postgres because this runs on embedded devices", "We use pnpm instead of npm for workspace support"
1041
+
1042
+ ### \`docs/context/institutional-knowledge.md\`
1043
+ The fact is about **team conventions, unwritten rules, organizational context, or who owns what**.
1044
+ - Signal words: "convention", "rule", "always", "never", "team", "process", "review", "approval", "owns", "responsible"
1045
+ - Examples: "The design team reviews all color changes", "We never deploy on Fridays", "PR titles must start with the ticket number"
1046
+
1047
+ ### \`docs/context/troubleshooting.md\`
1048
+ The fact is about **diagnostic knowledge -- when X happens, do Y (or don't do Z)**.
1049
+ - Signal words: "when", "fails", "error", "if you see", "stuck", "broken", "fix", "workaround", "before trying", "reboot", "restart", "reset"
1050
+ - Examples: "If Wi-Fi disconnects during flash, wait and retry -- don't switch networks", "When tests fail with ECONNREFUSED, check if Docker is running"
1051
+
1052
+ ### Ambiguous Facts
1053
+
1054
+ If the fact fits multiple categories, pick the **best fit** based on the primary intent. You will mention the alternative in your confirmation message so the user can correct you.
1055
+
1056
+ ## Step 3: Ensure the Target Document Exists
1057
+
1058
+ 1. If \`docs/context/\` does not exist, create the directory.
1059
+ 2. If the target document does not exist, create it from the template structure. Check \`docs/templates/\` for the matching template. If no template exists, use this minimal structure:
1060
+
1061
+ For **production-map.md**:
1062
+ \`\`\`markdown
1063
+ # Production Map
1064
+
1065
+ > What's real, what's staging, what's safe to touch.
1066
+
1067
+ ## Services
1068
+
1069
+ | Service | Environment | URL/Endpoint | Impact if Corrupted |
1070
+ |---------|-------------|-------------|-------------------|
1071
+ \`\`\`
1072
+
1073
+ For **dangerous-assumptions.md**:
1074
+ \`\`\`markdown
1075
+ # Dangerous Assumptions
1076
+
1077
+ > Things the AI agent might assume that are wrong in this project.
1078
+
1079
+ ## Assumptions
1080
+
1081
+ | Agent Might Assume | But Actually | Impact If Wrong |
1082
+ |-------------------|-------------|----------------|
1083
+ \`\`\`
1084
+
1085
+ For **decision-log.md**:
1086
+ \`\`\`markdown
1087
+ # Decision Log
1088
+
1089
+ > Why choices were made, not just what was chosen.
1090
+
1091
+ ## Decisions
1092
+
1093
+ | Date | Decision | Why | Alternatives Rejected | Revisit When |
1094
+ |------|----------|-----|----------------------|-------------|
1095
+ \`\`\`
1096
+
1097
+ For **institutional-knowledge.md**:
1098
+ \`\`\`markdown
1099
+ # Institutional Knowledge
1100
+
1101
+ > Unwritten rules, team conventions, and organizational context.
1102
+
1103
+ ## Team Conventions
1104
+
1105
+ - (none yet)
1106
+ \`\`\`
1107
+
1108
+ For **troubleshooting.md**:
1109
+ \`\`\`markdown
1110
+ # Troubleshooting
1111
+
1112
+ > What to do when things go wrong for non-code reasons.
1113
+
1114
+ ## Common Failures
1115
+
1116
+ | When This Happens | Do This | Don't Do This |
1117
+ |-------------------|---------|---------------|
1118
+ \`\`\`
1119
+
1120
+ ## Step 4: Read the Target Document
1121
+
1122
+ Read the target document to understand its current structure. Note:
1123
+ - Which section to append to
1124
+ - Whether it uses tables or lists
1125
+ - The column format if it's a table
1126
+
1127
+ ## Step 5: Append the Fact
1128
+
1129
+ Add the fact to the appropriate section of the target document. Match the existing format exactly:
1130
+
1131
+ - **Table-based documents** (production-map, dangerous-assumptions, decision-log, troubleshooting): Add a new table row in the correct columns. Use today's date where a date column exists.
1132
+ - **List-based documents** (institutional-knowledge): Add a new list item (\`- \`) to the most appropriate section.
1133
+
1134
+ Remove any italic example rows (rows where all cells start with \`_\`) before appending, so the document transitions from template to real content. Only remove examples from the specific table you are appending to.
1135
+
1136
+ **Append only. Never modify or remove existing real content.**
1137
+
1138
+ ## Step 6: Evaluate CLAUDE.md Boundary Rule
1139
+
1140
+ Decide whether the fact also warrants a rule in CLAUDE.md's behavioral boundaries:
1141
+
1142
+ **Add a CLAUDE.md rule if the fact:**
1143
+ - Describes something that should ALWAYS or NEVER be done
1144
+ - Could cause real damage if violated (data loss, broken deployments, security issues)
1145
+ - Is a hard constraint that applies across all work, not just a one-time note
1146
+
1147
+ **Do NOT add a CLAUDE.md rule if the fact is:**
1148
+ - Purely informational (e.g., "staging DB is at this URL")
1149
+ - A one-time decision that's already captured
1150
+ - A diagnostic tip rather than a prohibition
1151
+
1152
+ If a rule is warranted, read CLAUDE.md, find the appropriate section (ALWAYS, ASK FIRST, or NEVER under Behavioral Boundaries), and append the rule. If no Behavioral Boundaries section exists, append one.
1153
+
1154
+ ## Step 7: Confirm
1155
+
1156
+ Report what you did in this format:
1157
+
1158
+ \`\`\`
1159
+ Added to [document name]:
1160
+ [summary of what was added]
1161
+
1162
+ [If CLAUDE.md was also updated:]
1163
+ Added CLAUDE.md rule:
1164
+ [ALWAYS/ASK FIRST/NEVER]: [rule text]
1165
+
1166
+ [If the fact was ambiguous:]
1167
+ Routed to [chosen doc] -- move to [alternative doc] if this is more about [alternative category description].
1168
+ \`\`\`
995
1169
  `
996
1170
  };
997
1171
  var TEMPLATES = {
@@ -1097,6 +1271,47 @@ _Who owns what, who to ask, who cares about what._
1097
1271
  - [ ] Production database
1098
1272
  - [ ] Live API endpoints
1099
1273
  - [ ] User-facing infrastructure
1274
+ `,
1275
+ "context/troubleshooting.md": `# Troubleshooting
1276
+
1277
+ > What to do when things go wrong for non-code reasons.
1278
+ > Environment issues, flaky dependencies, hardware quirks, and diagnostic steps.
1279
+ > Update when you discover new failure modes and their fixes.
1280
+
1281
+ ## Common Failures
1282
+
1283
+ | When This Happens | Do This | Don't Do This |
1284
+ |-------------------|---------|---------------|
1285
+ | _Example: Tests fail with ECONNREFUSED_ | _Check if the dev database is running_ | _Don't rewrite the test or mock the connection_ |
1286
+ | _Example: Build fails with out-of-memory_ | _Increase Node heap size or close other processes_ | _Don't simplify the code to reduce bundle size_ |
1287
+ | _Example: Lint passes locally but fails in CI_ | _Check Node/tool version mismatch between local and CI_ | _Don't disable the lint rule_ |
1288
+
1289
+ ## Environment Issues
1290
+
1291
+ | Symptom | Likely Cause | Fix |
1292
+ |---------|-------------|-----|
1293
+ | _Example: "Module not found" after branch switch_ | _Dependencies changed on the new branch_ | _Run the package manager install command_ |
1294
+ | _Example: Port already in use_ | _Previous dev server didn't shut down cleanly_ | _Kill the process on that port or use a different one_ |
1295
+ | _Example: Permission denied on file/directory_ | _File ownership or permission mismatch_ | _Check and fix file permissions, don't run as root_ |
1296
+
1297
+ ## Diagnostic Steps
1298
+
1299
+ _When something fails unexpectedly, follow this sequence before trying to fix the code:_
1300
+
1301
+ 1. **Check the error message literally** -- don't assume what it means, read it
1302
+ 2. **Check environment prerequisites** -- are all services running? Correct versions?
1303
+ 3. **Check recent changes** -- did a config file, dependency, or environment variable change?
1304
+ 4. **Check network/connectivity** -- is the internet up? Are external services reachable?
1305
+ 5. **Search project docs first** -- check this file and \`docs/discoveries/\` before web searching
1306
+
1307
+ ## "Stop and Ask" Scenarios
1308
+
1309
+ _Situations where the AI agent should stop and ask the human instead of trying to fix things._
1310
+
1311
+ - _Example: Hardware device not responding -- the human may need to physically reconnect it_
1312
+ - _Example: Authentication token expired -- the human needs to re-authenticate manually_
1313
+ - _Example: CI pipeline blocked by a required approval -- a human needs to approve it_
1314
+ - _Example: Error messages referencing infrastructure the agent doesn't have access to_
1100
1315
  `,
1101
1316
  "examples/example-brief.md": `# Add User Notifications \u2014 Feature Brief
1102
1317
 
@@ -2294,4 +2509,4 @@ export {
2294
2509
  SKILLS,
2295
2510
  TEMPLATES
2296
2511
  };
2297
- //# sourceMappingURL=chunk-HHW4Q2UC.js.map
2512
+ //# sourceMappingURL=chunk-5BZUWHEY.js.map