nightytidy 0.3.7 → 0.3.9

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.
Files changed (37) hide show
  1. package/bin/nightytidy.js +1 -1
  2. package/package.json +1 -1
  3. package/src/agent/git-integration.js +4 -1
  4. package/src/claude.js +1 -1
  5. package/src/prompts/manifest.json +138 -138
  6. package/src/prompts/steps/02-test-coverage.md +181 -181
  7. package/src/prompts/steps/03-test-hardening.md +181 -181
  8. package/src/prompts/steps/04-test-architecture.md +130 -130
  9. package/src/prompts/steps/05-test-consolidation.md +165 -165
  10. package/src/prompts/steps/06-test-quality.md +211 -211
  11. package/src/prompts/steps/07-api-design.md +165 -165
  12. package/src/prompts/steps/08-security-sweep.md +207 -207
  13. package/src/prompts/steps/09-dependency-health.md +217 -217
  14. package/src/prompts/steps/10-codebase-cleanup.md +189 -189
  15. package/src/prompts/steps/11-crosscutting-concerns.md +196 -196
  16. package/src/prompts/steps/12-file-decomposition.md +263 -263
  17. package/src/prompts/steps/13-code-elegance.md +329 -329
  18. package/src/prompts/steps/14-architectural-complexity.md +297 -297
  19. package/src/prompts/steps/15-type-safety.md +192 -192
  20. package/src/prompts/steps/16-logging-error-message.md +173 -173
  21. package/src/prompts/steps/17-data-integrity.md +139 -139
  22. package/src/prompts/steps/18-performance.md +183 -183
  23. package/src/prompts/steps/19-cost-resource-optimization.md +136 -136
  24. package/src/prompts/steps/20-error-recovery.md +145 -145
  25. package/src/prompts/steps/21-race-condition-audit.md +178 -178
  26. package/src/prompts/steps/22-bug-hunt.md +229 -229
  27. package/src/prompts/steps/23-frontend-quality.md +210 -210
  28. package/src/prompts/steps/24-uiux-audit.md +284 -284
  29. package/src/prompts/steps/25-state-management.md +170 -170
  30. package/src/prompts/steps/26-perceived-performance.md +190 -190
  31. package/src/prompts/steps/27-devops.md +165 -165
  32. package/src/prompts/steps/28-scheduled-job-chron-jobs.md +141 -141
  33. package/src/prompts/steps/29-observability.md +152 -152
  34. package/src/prompts/steps/30-backup-check.md +155 -155
  35. package/src/prompts/steps/31-product-polish-ux-friction.md +122 -122
  36. package/src/prompts/steps/32-feature-discovery-opportunity.md +128 -128
  37. package/src/prompts/steps/33-strategic-opportunities.md +217 -217
@@ -1,217 +1,217 @@
1
- # Strategic Discovery Night
2
-
3
- ## Prompt
4
-
5
- ```
6
- You are running an overnight strategic analysis of this codebase. You have several hours. Unlike the other overnight runs, this one is less about fixing things and more about discovering opportunities — competitive gaps, feature ideas, and architectural possibilities the team may not have considered.
7
-
8
- This is a read-only analysis. Do not create a branch or modify any code.
9
-
10
- ## Your Mission
11
-
12
- ### Phase 1: Product Understanding
13
-
14
- Before you can identify opportunities, you need to deeply understand what this product does and who it serves.
15
-
16
- **Step 1: Reverse-engineer the product**
17
- By reading the codebase, answer:
18
- - What is this product? What problem does it solve?
19
- - Who are the target users? (Infer from UI copy, feature set, data models, onboarding flows)
20
- - What are the core features? List every distinct capability.
21
- - What is the current user journey? (Sign up → onboarding → core usage → retention/engagement loops)
22
- - What data does the product collect and how is it used?
23
- - What integrations exist? (Third-party services, APIs, webhooks)
24
- - What is the monetization model? (Infer from billing code, subscription logic, feature gating)
25
- - What features are gated behind plans/tiers? What's free vs. paid?
26
-
27
- **Step 2: Identify the product's strengths**
28
- Based on the codebase:
29
- - What features appear most mature and well-built?
30
- - Where has the most engineering investment gone?
31
- - What seems to be the core differentiator?
32
-
33
- **Step 3: Identify the product's weaknesses**
34
- Based on the codebase:
35
- - What features feel half-built or abandoned? (Incomplete code, unused models, feature flags that are off)
36
- - Where is the UX weakest?
37
- - What capabilities are missing that users would likely expect?
38
- - What data is collected but not used to provide value back to users?
39
-
40
- ### Phase 2: Competitive & Market Research
41
-
42
- **Step 1: Identify competitors**
43
- Based on your understanding of the product:
44
- - Search the web for direct competitors (products solving the same problem)
45
- - Search for indirect competitors (different approaches to the same underlying need)
46
- - Search for adjacent products (solve a related problem, might expand into this space)
47
-
48
- **Step 2: Analyze competitor features**
49
- For the top 5-8 competitors:
50
- - What features do they offer that this product doesn't?
51
- - What features does this product have that they don't?
52
- - How do they position themselves? (Read their marketing pages, pricing pages)
53
- - What do their users complain about? (Search for reviews, Reddit threads, G2/Capterra reviews, Twitter complaints)
54
- - What are they charging? How does their pricing model compare?
55
- - What recent features have they launched? (Check their changelogs, blogs, social media)
56
-
57
- **Step 3: Identify market trends**
58
- - Search for recent industry analysis, trend reports, or thought leadership in this product's space
59
- - What capabilities are becoming table stakes?
60
- - What emerging technologies are competitors adopting?
61
- - What are users in this space increasingly expecting?
62
-
63
- ### Phase 3: Feature Opportunity Analysis
64
-
65
- **Step 1: Gap analysis**
66
- Based on Phases 1 and 2, identify features this product is missing:
67
-
68
- For each missing feature:
69
- - What is it?
70
- - Which competitors have it?
71
- - How important is it to users? (Based on competitor reviews, user complaints, market trends)
72
- - How hard would it be to build? (Based on the existing codebase architecture — is the foundation there, or would it require significant new infrastructure?)
73
- - Priority recommendation: critical / high / medium / nice-to-have
74
-
75
- **Step 2: Untapped data opportunities**
76
- Look at the data the product already collects:
77
- - What analytics or insights could be derived from existing data that aren't being surfaced to users?
78
- - What personalization opportunities exist based on user behavior data?
79
- - What automation could be triggered by patterns in the data?
80
- - What reporting/dashboards could be built from existing data?
81
-
82
- **Step 3: Integration opportunities**
83
- - What third-party services would complement this product?
84
- - What integration points exist in the codebase that aren't being used to their full potential?
85
- - What workflows would benefit from connecting to other tools (Slack, email, calendar, CRM, etc.)?
86
-
87
- **Step 4: UX improvement opportunities**
88
- Based on your codebase analysis:
89
- - Where are users likely experiencing friction? (Complex forms, multi-step processes, confusing navigation)
90
- - What tasks take too many steps that could be simplified?
91
- - Where could AI/automation reduce manual work for users?
92
- - What onboarding improvements would help new users get value faster?
93
-
94
- ### Phase 4: Architectural Opportunity Analysis
95
-
96
- **Step 1: Scalability assessment**
97
- - What would break first if the user base 10x'd?
98
- - Are there architectural bottlenecks that would need to be addressed?
99
- - What's the current approach to background jobs, queuing, caching?
100
- - Is the database schema ready for growth? (Missing indexes, inefficient queries, tables that would get too large)
101
-
102
- **Step 2: Platform/extensibility opportunities**
103
- - Could this product benefit from a plugin/extension system?
104
- - Could parts of this product be exposed as an API for third-party developers?
105
- - Is there a marketplace or ecosystem opportunity?
106
- - Could the product support white-labeling or multi-tenancy?
107
-
108
- **Step 3: AI integration opportunities**
109
- Look at the codebase through an AI lens:
110
- - What manual processes could be augmented or automated with AI?
111
- - Where could AI improve the user experience? (Smart defaults, auto-categorization, natural language search, recommendations, content generation)
112
- - What data does the product have that could train useful models?
113
- - What would an "AI-first" version of this product look like?
114
-
115
- ## Output Requirements
116
-
117
- Create the `audit-reports/` directory in the project root if it doesn't already exist. Save the report as `audit-reports/33_STRATEGIC_DISCOVERY_REPORT_[run-number]_[date]_[time in user's local time].md` (e.g., `33_STRATEGIC_DISCOVERY_REPORT_01_2026-02-16_2129.md`). Increment the run number based on any existing reports with the same name prefix in that folder.
118
-
119
- ### Report Structure
120
-
121
- 1. **Product Profile**
122
- - What the product is and does (as understood from the codebase)
123
- - Target users
124
- - Core features inventory
125
- - Strengths and weaknesses
126
- - Current monetization model
127
-
128
- 2. **Competitive Landscape**
129
- - Competitor matrix: table with | Competitor | Overlap | Unique Strengths | Weaknesses | Pricing |
130
- - What competitors are doing that this product isn't
131
- - What this product does better than competitors
132
- - Market trends affecting this space
133
-
134
- 3. **Feature Opportunities**
135
- Prioritized list, for each:
136
- - Feature description
137
- - User need it addresses
138
- - Competitive context (who has it, is it table stakes?)
139
- - Implementation complexity (based on current architecture)
140
- - Priority: Critical / High / Medium / Nice-to-have
141
- - Estimated effort: Small (days) / Medium (weeks) / Large (months)
142
-
143
- 4. **Untapped Data & Intelligence**
144
- - Data currently collected but underutilized
145
- - Analytics/insights that could be surfaced
146
- - Personalization opportunities
147
- - Automation triggers
148
-
149
- 5. **Integration & Ecosystem Opportunities**
150
- - Third-party integrations worth building
151
- - API/platform possibilities
152
- - Ecosystem plays
153
-
154
- 6. **AI Integration Roadmap**
155
- - AI opportunities ranked by impact and feasibility
156
- - What data assets exist to support AI features
157
- - Quick AI wins vs. larger AI initiatives
158
-
159
- 7. **Architectural Recommendations**
160
- - Scalability concerns and suggested remediation
161
- - Platform/extensibility opportunities
162
- - Technical investments that would unlock future product capabilities
163
-
164
- 8. **Recommended Roadmap**
165
- - Synthesize all findings into a suggested priority order
166
- - Group into: This quarter / Next quarter / Future
167
- - Note dependencies between items
168
-
169
- ## Rules
170
- - This is READ-ONLY. Do not modify any code.
171
- - Use web search to research competitors, market trends, and user feedback
172
- - Be honest about uncertainty — mark items as "needs validation" when you're inferring rather than knowing
173
- - Don't just list every possible feature — prioritize ruthlessly based on user impact and implementation feasibility
174
- - When assessing implementation complexity, be specific about what exists in the codebase vs. what would need to be built
175
- - Ground your recommendations in evidence (competitor data, user feedback, market trends, codebase analysis) — not just opinions
176
- - Consider both quick wins and strategic bets
177
- - Think like a product manager AND an engineer — the best opportunities are at the intersection of user value and technical feasibility
178
- - You have all night. Do thorough research.
179
- ```
180
-
181
- ## Chat Output Requirement
182
-
183
- In addition to writing the full report file, you MUST print a summary directly in the conversation when you finish. Do not make the user open the report to get the highlights. The chat summary should include:
184
-
185
- ### 1. Status Line
186
- One sentence: what you did, how long it took, and whether all tests still pass.
187
-
188
- ### 2. Key Findings
189
- The most important things discovered — bugs, risks, wins, or surprises. Each bullet should be specific and actionable, not vague. Lead with severity or impact.
190
-
191
- **Good:** "CRITICAL: No backup configuration found for the primary Postgres database — total data loss risk."
192
- **Bad:** "Found some issues with backups."
193
-
194
- ### 3. Changes Made (if applicable)
195
- Bullet list of what was actually modified, added, or removed. Skip this section for read-only analysis runs.
196
-
197
- ### 4. Recommendations
198
-
199
- If there are legitimately beneficial recommendations worth pursuing right now, present them in a table. Do **not** force recommendations — if the audit surfaced no actionable improvements, simply state that no recommendations are warranted at this time and move on.
200
-
201
- When recommendations exist, use this table format:
202
-
203
- | # | Recommendation | Impact | Risk if Ignored | Worth Doing? | Details |
204
- |---|---|---|---|---|---|
205
- | *Sequential number* | *Short description (≤10 words)* | *What improves if addressed* | *Low / Medium / High / Critical* | *Yes / Probably / Only if time allows* | *1–3 sentences explaining the reasoning, context, or implementation guidance* |
206
-
207
- Order rows by risk descending (Critical → High → Medium → Low). Be honest in the "Worth Doing?" column — not everything flagged is worth the engineering time. If a recommendation is marginal, say so.
208
-
209
- ### 5. Report Location
210
- State the full path to the detailed report file for deeper review.
211
-
212
- ---
213
-
214
- **Formatting rules for chat output:**
215
- - Use markdown headers, bold for severity labels, and bullet points for scannability.
216
- - Do not duplicate the full report contents — just the highlights and recommendations.
217
- - If you made zero findings in a phase, say so in one line rather than omitting it silently.
1
+ # Strategic Discovery Night
2
+
3
+ ## Prompt
4
+
5
+ ```
6
+ You are running an overnight strategic analysis of this codebase. You have several hours. Unlike the other overnight runs, this one is less about fixing things and more about discovering opportunities — competitive gaps, feature ideas, and architectural possibilities the team may not have considered.
7
+
8
+ This is a read-only analysis. Do not create a branch or modify any code.
9
+
10
+ ## Your Mission
11
+
12
+ ### Phase 1: Product Understanding
13
+
14
+ Before you can identify opportunities, you need to deeply understand what this product does and who it serves.
15
+
16
+ **Step 1: Reverse-engineer the product**
17
+ By reading the codebase, answer:
18
+ - What is this product? What problem does it solve?
19
+ - Who are the target users? (Infer from UI copy, feature set, data models, onboarding flows)
20
+ - What are the core features? List every distinct capability.
21
+ - What is the current user journey? (Sign up → onboarding → core usage → retention/engagement loops)
22
+ - What data does the product collect and how is it used?
23
+ - What integrations exist? (Third-party services, APIs, webhooks)
24
+ - What is the monetization model? (Infer from billing code, subscription logic, feature gating)
25
+ - What features are gated behind plans/tiers? What's free vs. paid?
26
+
27
+ **Step 2: Identify the product's strengths**
28
+ Based on the codebase:
29
+ - What features appear most mature and well-built?
30
+ - Where has the most engineering investment gone?
31
+ - What seems to be the core differentiator?
32
+
33
+ **Step 3: Identify the product's weaknesses**
34
+ Based on the codebase:
35
+ - What features feel half-built or abandoned? (Incomplete code, unused models, feature flags that are off)
36
+ - Where is the UX weakest?
37
+ - What capabilities are missing that users would likely expect?
38
+ - What data is collected but not used to provide value back to users?
39
+
40
+ ### Phase 2: Competitive & Market Research
41
+
42
+ **Step 1: Identify competitors**
43
+ Based on your understanding of the product:
44
+ - Search the web for direct competitors (products solving the same problem)
45
+ - Search for indirect competitors (different approaches to the same underlying need)
46
+ - Search for adjacent products (solve a related problem, might expand into this space)
47
+
48
+ **Step 2: Analyze competitor features**
49
+ For the top 5-8 competitors:
50
+ - What features do they offer that this product doesn't?
51
+ - What features does this product have that they don't?
52
+ - How do they position themselves? (Read their marketing pages, pricing pages)
53
+ - What do their users complain about? (Search for reviews, Reddit threads, G2/Capterra reviews, Twitter complaints)
54
+ - What are they charging? How does their pricing model compare?
55
+ - What recent features have they launched? (Check their changelogs, blogs, social media)
56
+
57
+ **Step 3: Identify market trends**
58
+ - Search for recent industry analysis, trend reports, or thought leadership in this product's space
59
+ - What capabilities are becoming table stakes?
60
+ - What emerging technologies are competitors adopting?
61
+ - What are users in this space increasingly expecting?
62
+
63
+ ### Phase 3: Feature Opportunity Analysis
64
+
65
+ **Step 1: Gap analysis**
66
+ Based on Phases 1 and 2, identify features this product is missing:
67
+
68
+ For each missing feature:
69
+ - What is it?
70
+ - Which competitors have it?
71
+ - How important is it to users? (Based on competitor reviews, user complaints, market trends)
72
+ - How hard would it be to build? (Based on the existing codebase architecture — is the foundation there, or would it require significant new infrastructure?)
73
+ - Priority recommendation: critical / high / medium / nice-to-have
74
+
75
+ **Step 2: Untapped data opportunities**
76
+ Look at the data the product already collects:
77
+ - What analytics or insights could be derived from existing data that aren't being surfaced to users?
78
+ - What personalization opportunities exist based on user behavior data?
79
+ - What automation could be triggered by patterns in the data?
80
+ - What reporting/dashboards could be built from existing data?
81
+
82
+ **Step 3: Integration opportunities**
83
+ - What third-party services would complement this product?
84
+ - What integration points exist in the codebase that aren't being used to their full potential?
85
+ - What workflows would benefit from connecting to other tools (Slack, email, calendar, CRM, etc.)?
86
+
87
+ **Step 4: UX improvement opportunities**
88
+ Based on your codebase analysis:
89
+ - Where are users likely experiencing friction? (Complex forms, multi-step processes, confusing navigation)
90
+ - What tasks take too many steps that could be simplified?
91
+ - Where could AI/automation reduce manual work for users?
92
+ - What onboarding improvements would help new users get value faster?
93
+
94
+ ### Phase 4: Architectural Opportunity Analysis
95
+
96
+ **Step 1: Scalability assessment**
97
+ - What would break first if the user base 10x'd?
98
+ - Are there architectural bottlenecks that would need to be addressed?
99
+ - What's the current approach to background jobs, queuing, caching?
100
+ - Is the database schema ready for growth? (Missing indexes, inefficient queries, tables that would get too large)
101
+
102
+ **Step 2: Platform/extensibility opportunities**
103
+ - Could this product benefit from a plugin/extension system?
104
+ - Could parts of this product be exposed as an API for third-party developers?
105
+ - Is there a marketplace or ecosystem opportunity?
106
+ - Could the product support white-labeling or multi-tenancy?
107
+
108
+ **Step 3: AI integration opportunities**
109
+ Look at the codebase through an AI lens:
110
+ - What manual processes could be augmented or automated with AI?
111
+ - Where could AI improve the user experience? (Smart defaults, auto-categorization, natural language search, recommendations, content generation)
112
+ - What data does the product have that could train useful models?
113
+ - What would an "AI-first" version of this product look like?
114
+
115
+ ## Output Requirements
116
+
117
+ Create the `audit-reports/` directory in the project root if it doesn't already exist. Save the report as `audit-reports/33_STRATEGIC_DISCOVERY_REPORT_[run-number]_[date]_[time in user's local time].md` (e.g., `33_STRATEGIC_DISCOVERY_REPORT_01_2026-02-16_2129.md`). Increment the run number based on any existing reports with the same name prefix in that folder.
118
+
119
+ ### Report Structure
120
+
121
+ 1. **Product Profile**
122
+ - What the product is and does (as understood from the codebase)
123
+ - Target users
124
+ - Core features inventory
125
+ - Strengths and weaknesses
126
+ - Current monetization model
127
+
128
+ 2. **Competitive Landscape**
129
+ - Competitor matrix: table with | Competitor | Overlap | Unique Strengths | Weaknesses | Pricing |
130
+ - What competitors are doing that this product isn't
131
+ - What this product does better than competitors
132
+ - Market trends affecting this space
133
+
134
+ 3. **Feature Opportunities**
135
+ Prioritized list, for each:
136
+ - Feature description
137
+ - User need it addresses
138
+ - Competitive context (who has it, is it table stakes?)
139
+ - Implementation complexity (based on current architecture)
140
+ - Priority: Critical / High / Medium / Nice-to-have
141
+ - Estimated effort: Small (days) / Medium (weeks) / Large (months)
142
+
143
+ 4. **Untapped Data & Intelligence**
144
+ - Data currently collected but underutilized
145
+ - Analytics/insights that could be surfaced
146
+ - Personalization opportunities
147
+ - Automation triggers
148
+
149
+ 5. **Integration & Ecosystem Opportunities**
150
+ - Third-party integrations worth building
151
+ - API/platform possibilities
152
+ - Ecosystem plays
153
+
154
+ 6. **AI Integration Roadmap**
155
+ - AI opportunities ranked by impact and feasibility
156
+ - What data assets exist to support AI features
157
+ - Quick AI wins vs. larger AI initiatives
158
+
159
+ 7. **Architectural Recommendations**
160
+ - Scalability concerns and suggested remediation
161
+ - Platform/extensibility opportunities
162
+ - Technical investments that would unlock future product capabilities
163
+
164
+ 8. **Recommended Roadmap**
165
+ - Synthesize all findings into a suggested priority order
166
+ - Group into: This quarter / Next quarter / Future
167
+ - Note dependencies between items
168
+
169
+ ## Rules
170
+ - This is READ-ONLY. Do not modify any code.
171
+ - Use web search to research competitors, market trends, and user feedback
172
+ - Be honest about uncertainty — mark items as "needs validation" when you're inferring rather than knowing
173
+ - Don't just list every possible feature — prioritize ruthlessly based on user impact and implementation feasibility
174
+ - When assessing implementation complexity, be specific about what exists in the codebase vs. what would need to be built
175
+ - Ground your recommendations in evidence (competitor data, user feedback, market trends, codebase analysis) — not just opinions
176
+ - Consider both quick wins and strategic bets
177
+ - Think like a product manager AND an engineer — the best opportunities are at the intersection of user value and technical feasibility
178
+ - You have all night. Do thorough research.
179
+ ```
180
+
181
+ ## Chat Output Requirement
182
+
183
+ In addition to writing the full report file, you MUST print a summary directly in the conversation when you finish. Do not make the user open the report to get the highlights. The chat summary should include:
184
+
185
+ ### 1. Status Line
186
+ One sentence: what you did, how long it took, and whether all tests still pass.
187
+
188
+ ### 2. Key Findings
189
+ The most important things discovered — bugs, risks, wins, or surprises. Each bullet should be specific and actionable, not vague. Lead with severity or impact.
190
+
191
+ **Good:** "CRITICAL: No backup configuration found for the primary Postgres database — total data loss risk."
192
+ **Bad:** "Found some issues with backups."
193
+
194
+ ### 3. Changes Made (if applicable)
195
+ Bullet list of what was actually modified, added, or removed. Skip this section for read-only analysis runs.
196
+
197
+ ### 4. Recommendations
198
+
199
+ If there are legitimately beneficial recommendations worth pursuing right now, present them in a table. Do **not** force recommendations — if the audit surfaced no actionable improvements, simply state that no recommendations are warranted at this time and move on.
200
+
201
+ When recommendations exist, use this table format:
202
+
203
+ | # | Recommendation | Impact | Risk if Ignored | Worth Doing? | Details |
204
+ |---|---|---|---|---|---|
205
+ | *Sequential number* | *Short description (≤10 words)* | *What improves if addressed* | *Low / Medium / High / Critical* | *Yes / Probably / Only if time allows* | *1–3 sentences explaining the reasoning, context, or implementation guidance* |
206
+
207
+ Order rows by risk descending (Critical → High → Medium → Low). Be honest in the "Worth Doing?" column — not everything flagged is worth the engineering time. If a recommendation is marginal, say so.
208
+
209
+ ### 5. Report Location
210
+ State the full path to the detailed report file for deeper review.
211
+
212
+ ---
213
+
214
+ **Formatting rules for chat output:**
215
+ - Use markdown headers, bold for severity labels, and bullet points for scannability.
216
+ - Do not duplicate the full report contents — just the highlights and recommendations.
217
+ - If you made zero findings in a phase, say so in one line rather than omitting it silently.