gaslighting-engine 0.1.0

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 (89) hide show
  1. package/.codex/prompts/gaslighting.md +30 -0
  2. package/.codex/skills/gaslighting/SKILL.md +96 -0
  3. package/.codex/skills/gaslighting/agents/openai.yaml +8 -0
  4. package/.codex/skills/gaslighting/references/GASLIGHTING_TEMPLATE.md +425 -0
  5. package/.codex/skills/gaslighting/references/HARDCORE_DISCIPLINE_TEMPLATE.md +425 -0
  6. package/.codex/skills/gaslighting/references/HOSPITAL_HOMEPAGE_EXAMPLE.md +119 -0
  7. package/.codex/skills/gaslighting/references/STACK_POLICY_TEMPLATE.md +64 -0
  8. package/.codex/skills/gaslighting/scripts/generate-gaslighting-docs.ts +3 -0
  9. package/LICENSE +21 -0
  10. package/README.md +200 -0
  11. package/dist/cli.js +118 -0
  12. package/dist/commands/agents.js +10 -0
  13. package/dist/commands/codexInstall.js +60 -0
  14. package/dist/commands/doctor.js +42 -0
  15. package/dist/commands/generate.js +4 -0
  16. package/dist/commands/init.js +27 -0
  17. package/dist/commands/skill.js +10 -0
  18. package/dist/commands/update.js +35 -0
  19. package/dist/core/analyze.js +132 -0
  20. package/dist/core/classifyProjectType.js +66 -0
  21. package/dist/core/content.js +125 -0
  22. package/dist/core/detectStackHints.js +34 -0
  23. package/dist/core/generateDocs.js +58 -0
  24. package/dist/core/generateGaslightingMarkdown.js +420 -0
  25. package/dist/core/generateOtherMarkdown.js +529 -0
  26. package/dist/core/generatePrdMarkdown.js +125 -0
  27. package/dist/index.js +3 -0
  28. package/dist/types.js +1 -0
  29. package/dist/utils/banner.js +49 -0
  30. package/dist/utils/date.js +6 -0
  31. package/dist/utils/file.js +24 -0
  32. package/dist/utils/logger.js +27 -0
  33. package/dist/utils/markdown.js +6 -0
  34. package/docs/codex-usage.md +58 -0
  35. package/docs/examples.md +22 -0
  36. package/docs/philosophy.md +17 -0
  37. package/docs/research.md +54 -0
  38. package/examples/ecommerce/.codex/prompts/gaslighting.md +30 -0
  39. package/examples/ecommerce/.codex/skills/gaslighting/SKILL.md +96 -0
  40. package/examples/ecommerce/.codex/skills/gaslighting/agents/openai.yaml +8 -0
  41. package/examples/ecommerce/.codex/skills/gaslighting/references/GASLIGHTING_TEMPLATE.md +425 -0
  42. package/examples/ecommerce/.codex/skills/gaslighting/references/HARDCORE_DISCIPLINE_TEMPLATE.md +425 -0
  43. package/examples/ecommerce/.codex/skills/gaslighting/references/HOSPITAL_HOMEPAGE_EXAMPLE.md +119 -0
  44. package/examples/ecommerce/.codex/skills/gaslighting/references/STACK_POLICY_TEMPLATE.md +64 -0
  45. package/examples/ecommerce/.codex/skills/gaslighting/scripts/generate-gaslighting-docs.ts +3 -0
  46. package/examples/ecommerce/AGENTS.md +47 -0
  47. package/examples/ecommerce/ASSUMPTIONS.md +146 -0
  48. package/examples/ecommerce/CODEX_PROMPT.md +34 -0
  49. package/examples/ecommerce/DECISION_LOG.md +95 -0
  50. package/examples/ecommerce/GASLIGHTING.md +429 -0
  51. package/examples/ecommerce/MEMORY.md +63 -0
  52. package/examples/ecommerce/MISSING_INFO.md +13 -0
  53. package/examples/ecommerce/PRD.md +115 -0
  54. package/examples/ecommerce/STACK_POLICY.md +64 -0
  55. package/examples/hospital-homepage/.codex/prompts/gaslighting.md +30 -0
  56. package/examples/hospital-homepage/.codex/skills/gaslighting/SKILL.md +96 -0
  57. package/examples/hospital-homepage/.codex/skills/gaslighting/agents/openai.yaml +8 -0
  58. package/examples/hospital-homepage/.codex/skills/gaslighting/references/GASLIGHTING_TEMPLATE.md +425 -0
  59. package/examples/hospital-homepage/.codex/skills/gaslighting/references/HARDCORE_DISCIPLINE_TEMPLATE.md +425 -0
  60. package/examples/hospital-homepage/.codex/skills/gaslighting/references/HOSPITAL_HOMEPAGE_EXAMPLE.md +119 -0
  61. package/examples/hospital-homepage/.codex/skills/gaslighting/references/STACK_POLICY_TEMPLATE.md +64 -0
  62. package/examples/hospital-homepage/.codex/skills/gaslighting/scripts/generate-gaslighting-docs.ts +3 -0
  63. package/examples/hospital-homepage/AGENTS.md +47 -0
  64. package/examples/hospital-homepage/ASSUMPTIONS.md +218 -0
  65. package/examples/hospital-homepage/CODEX_PROMPT.md +34 -0
  66. package/examples/hospital-homepage/DECISION_LOG.md +95 -0
  67. package/examples/hospital-homepage/GASLIGHTING.md +432 -0
  68. package/examples/hospital-homepage/MEMORY.md +66 -0
  69. package/examples/hospital-homepage/MISSING_INFO.md +13 -0
  70. package/examples/hospital-homepage/PRD.md +119 -0
  71. package/examples/hospital-homepage/STACK_POLICY.md +64 -0
  72. package/examples/landing-page/.codex/prompts/gaslighting.md +30 -0
  73. package/examples/landing-page/.codex/skills/gaslighting/SKILL.md +96 -0
  74. package/examples/landing-page/.codex/skills/gaslighting/agents/openai.yaml +8 -0
  75. package/examples/landing-page/.codex/skills/gaslighting/references/GASLIGHTING_TEMPLATE.md +425 -0
  76. package/examples/landing-page/.codex/skills/gaslighting/references/HARDCORE_DISCIPLINE_TEMPLATE.md +425 -0
  77. package/examples/landing-page/.codex/skills/gaslighting/references/HOSPITAL_HOMEPAGE_EXAMPLE.md +119 -0
  78. package/examples/landing-page/.codex/skills/gaslighting/references/STACK_POLICY_TEMPLATE.md +64 -0
  79. package/examples/landing-page/.codex/skills/gaslighting/scripts/generate-gaslighting-docs.ts +3 -0
  80. package/examples/landing-page/AGENTS.md +47 -0
  81. package/examples/landing-page/ASSUMPTIONS.md +146 -0
  82. package/examples/landing-page/CODEX_PROMPT.md +34 -0
  83. package/examples/landing-page/DECISION_LOG.md +95 -0
  84. package/examples/landing-page/GASLIGHTING.md +424 -0
  85. package/examples/landing-page/MEMORY.md +63 -0
  86. package/examples/landing-page/MISSING_INFO.md +13 -0
  87. package/examples/landing-page/PRD.md +103 -0
  88. package/examples/landing-page/STACK_POLICY.md +64 -0
  89. package/package.json +37 -0
@@ -0,0 +1,529 @@
1
+ import { bullets, decisionDate, missingInfoTable, stackSummary } from "./content.js";
2
+ import { generateGaslightingMarkdown } from "./generateGaslightingMarkdown.js";
3
+ import { generatePrdMarkdown } from "./generatePrdMarkdown.js";
4
+ export function generateAssumptionsMarkdown(analysis) {
5
+ return `# ASSUMPTIONS.md
6
+
7
+ ${analysis.assumptions
8
+ .map((assumption, index) => `## Assumption: ${titleFromAssumption(assumption, index)}
9
+
10
+ Status: Active
11
+ Confidence: ${analysis.confidence === "high" ? "High" : analysis.confidence === "medium" ? "Medium" : "Low"}
12
+ Impact: ${index === 0 ? "High" : "Medium"}
13
+
14
+ ### Why this assumption was made
15
+
16
+ ${assumption}
17
+
18
+ The user did not provide enough confirmed detail to treat this as fact.
19
+
20
+ ### What could make this wrong
21
+
22
+ The user provides a different business model, vertical, stack, audience, market, or production constraint.
23
+
24
+ ### What changes if this assumption is wrong
25
+
26
+ The PRD, page list, data model, implementation priorities, and copy may need to change.
27
+
28
+ ### How to replace this assumption
29
+
30
+ Provide confirmed information and run \`gaslighting update "new information here"\`.
31
+ `)
32
+ .join("\n")}
33
+ `;
34
+ }
35
+ export function generateMissingInfoMarkdown(analysis) {
36
+ return `# MISSING_INFO.md
37
+
38
+ Missing information must be classified honestly.
39
+
40
+ Most missing information is not blocking.
41
+
42
+ If information is missing but implementation can proceed with a practical assumption, document it and continue.
43
+
44
+ ${missingInfoTable(analysis.missingInfo)}
45
+ `;
46
+ }
47
+ export function generateDecisionLogMarkdown(input, analysis) {
48
+ return `# DECISION_LOG.md
49
+
50
+ ## Decision: Initialize Gaslighting documents
51
+
52
+ Date: ${decisionDate()}
53
+
54
+ ### Decision
55
+
56
+ Generate strict Gaslighting-engine project-control documents for the request:
57
+
58
+ > ${input.rawUserRequest}
59
+
60
+ ### Reason
61
+
62
+ The project needs AI-agent discipline before implementation so the agent does not drift, shrink scope, leave TODOs, or fake completion.
63
+
64
+ ### Alternatives Considered
65
+
66
+ - Start coding without discipline documents.
67
+ - Ask the user a long list of questions before making progress.
68
+ - Use an LLM API to generate custom documents.
69
+
70
+ ### Why Alternatives Were Not Chosen
71
+
72
+ - Coding without control documents increases fake-completion risk.
73
+ - Most missing information can be assumed and documented.
74
+ - MVP must be deterministic and must not call an LLM API.
75
+
76
+ ### Risk
77
+
78
+ The initial project type or assumptions may be wrong.
79
+
80
+ ### Revisit When
81
+
82
+ The user provides confirmed business details, stack choices, scope changes, or production constraints.
83
+
84
+ ## Decision: Project type classification
85
+
86
+ Date: ${decisionDate()}
87
+
88
+ ### Decision
89
+
90
+ Classified project type as \`${analysis.projectType}\` with \`${analysis.confidence}\` confidence.
91
+
92
+ ### Reason
93
+
94
+ Keyword-based classification is deterministic and enough for MVP.
95
+
96
+ ### Alternatives Considered
97
+
98
+ - Ask the user to classify the project manually.
99
+ - Use an external LLM API.
100
+
101
+ ### Why Alternatives Were Not Chosen
102
+
103
+ - Manual classification slows progress.
104
+ - External LLM APIs are excluded from MVP.
105
+
106
+ ### Risk
107
+
108
+ Low-confidence classification can create the wrong project-specific template.
109
+
110
+ ### Revisit When
111
+
112
+ The user says the project type is different or adds a clearer project description.
113
+
114
+ ## Decision: Stack policy
115
+
116
+ Date: ${decisionDate()}
117
+
118
+ ### Decision
119
+
120
+ ${stackSummary(analysis)}
121
+
122
+ ### Reason
123
+
124
+ Technology must serve the product purpose and avoid over-engineering.
125
+
126
+ ### Alternatives Considered
127
+
128
+ - Introduce advanced infrastructure up front.
129
+ - Leave stack completely undefined.
130
+
131
+ ### Why Alternatives Were Not Chosen
132
+
133
+ - Advanced infrastructure is forbidden by default.
134
+ - Undefined stack choices allow drift and inconsistent agent behavior.
135
+
136
+ ### Risk
137
+
138
+ Production needs may require a provider change later.
139
+
140
+ ### Revisit When
141
+
142
+ Deployment provider, database provider, storage, analytics, email, or payment requirements are confirmed.
143
+ `;
144
+ }
145
+ export function generateStackPolicyMarkdown(analysis) {
146
+ return `# STACK_POLICY.md
147
+
148
+ ## Detected Stack Hints
149
+
150
+ ${analysis.detectedStackHints.length ? bullets(analysis.detectedStackHints) : "- No stack hints detected."}
151
+
152
+ If detected stack hints conflict with the project purpose, the project purpose wins.
153
+
154
+ ## Default Web Stack
155
+
156
+ - Framework: Next.js latest stable version
157
+ - Language: TypeScript
158
+ - Styling: Tailwind CSS
159
+ - UI: shadcn/ui
160
+ - Database: PostgreSQL
161
+ - DB Provider: NeonDB first, Supabase alternative
162
+ - Hosting: Vercel
163
+ - File Storage: Vercel Blob or Cloudflare R2
164
+ - Analytics: GA4 + Google Tag Manager
165
+ - Email: Resend or equivalent
166
+ - ORM: Prisma or Drizzle
167
+
168
+ ## Stack Selection Rules
169
+
170
+ ### Choose NeonDB when
171
+
172
+ - The project needs PostgreSQL.
173
+ - The project is deployed on Vercel.
174
+ - Serverless-friendly PostgreSQL is useful.
175
+ - A clean MVP database is enough.
176
+
177
+ ### Choose Supabase when
178
+
179
+ - Auth, DB, and storage should be bundled.
180
+ - Admin/user accounts are likely.
181
+ - The project benefits from Supabase dashboard operations.
182
+ - Storage and database need to live together.
183
+
184
+ ### Choose Vercel Blob when
185
+
186
+ - The project is Vercel-centered.
187
+ - File uploads are simple.
188
+ - Operational simplicity matters.
189
+
190
+ ### Choose Cloudflare R2 when
191
+
192
+ - Storage volume may grow.
193
+ - CDN/cost strategy matters.
194
+ - Cloudflare DNS/cache is already part of the plan.
195
+
196
+ ## Forbidden by Default
197
+
198
+ Do not introduce the following unless explicitly required:
199
+
200
+ - Kubernetes
201
+ - Kafka
202
+ - RabbitMQ
203
+ - Microservices
204
+ - GraphQL Federation
205
+ - Redis Cluster
206
+ - Terraform-heavy infrastructure
207
+ - Event sourcing
208
+ - Multi-region deployment
209
+ - Complex distributed systems
210
+ `;
211
+ }
212
+ export function generateAgentsMarkdown() {
213
+ return `# AGENTS.md
214
+
215
+ This repository uses Gaslighting-engine.
216
+
217
+ Before doing any work, read these files in order:
218
+
219
+ 1. \`GASLIGHTING.md\`
220
+ 2. \`PRD.md\`
221
+ 3. \`STACK_POLICY.md\`
222
+ 4. \`MISSING_INFO.md\`
223
+ 5. \`ASSUMPTIONS.md\`
224
+ 6. \`DECISION_LOG.md\`
225
+ 7. \`MEMORY.md\`
226
+
227
+ ## Prime Directive
228
+
229
+ Do not forget the project purpose.
230
+
231
+ Do not reduce the requested scope.
232
+
233
+ Do not pretend partial work is complete.
234
+
235
+ Do not use TODO comments as fake implementation.
236
+
237
+ Do not create representative examples when the user requested full coverage.
238
+
239
+ Do not say "the rest follows the same pattern."
240
+
241
+ If information is missing, make a reasonable assumption, document it, and continue unless the missing information is truly blocking.
242
+
243
+ ## Completion Standard
244
+
245
+ A task is complete only when:
246
+
247
+ - The requested scope is fully handled.
248
+ - No required item is silently skipped.
249
+ - No placeholder is pretending to be implementation.
250
+ - No TODO is used as a substitute for work.
251
+ - The output can actually be used.
252
+ - New assumptions are documented.
253
+ - New technical decisions are recorded.
254
+ - Stable project facts are recorded in \`MEMORY.md\`.
255
+ - The result does not contradict \`GASLIGHTING.md\`.
256
+
257
+ If the task is incomplete, say it is incomplete.
258
+
259
+ Do not fake completion.
260
+ `;
261
+ }
262
+ export function generateMemoryMarkdown(input, analysis) {
263
+ return `# MEMORY.md
264
+
265
+ This is the local project memory for Gaslighting-engine.
266
+
267
+ It is inspired by agent memory systems, but it is not a vague diary.
268
+
269
+ It records stable project facts, recurring workflow rules, known failure patterns, and decisions that future AI-agent sessions must not forget.
270
+
271
+ Keep required rules in \`AGENTS.md\`, \`GASLIGHTING.md\`, and checked-in documents. Treat this file as a compact recall layer, not the only source of truth.
272
+
273
+ ## Stable Project Facts
274
+
275
+ - Original request: ${input.rawUserRequest}
276
+ - Project type: ${analysis.projectType}
277
+ - Classification confidence: ${analysis.confidence}
278
+ - Stack hints: ${analysis.detectedStackHints.length ? analysis.detectedStackHints.join(", ") : "none"}
279
+
280
+ ## Working Preferences
281
+
282
+ - Prefer the shortest useful command: \`gaslighting "project request"\`.
283
+ - Default discipline mode is hardcore.
284
+ - Full-scope enforcement is default.
285
+ - No-TODO escape prevention is default.
286
+ - No-shortcut enforcement is default.
287
+ - Missing information should be assumed, documented, and carried forward unless truly blocking.
288
+
289
+ ## Known Agent Failure Patterns
290
+
291
+ - Summarizing remaining work instead of doing it.
292
+ - Treating representative examples as full implementation.
293
+ - Using TODO comments as a substitute for requested work.
294
+ - Creating placeholders and calling them structure.
295
+ - Forgetting the project purpose after the first implementation pass.
296
+ - Over-engineering instead of delivering the concrete MVP.
297
+
298
+ ## Hades-Style Audit Rules
299
+
300
+ These are cleanup and verification rules:
301
+
302
+ - Zero fake completion.
303
+ - Zero TODO escape.
304
+ - Zero dead placeholder files pretending to be implementation.
305
+ - Zero unexplained scope reductions.
306
+ - Zero unverified success claims.
307
+ - Every destructive cleanup must be intentional and explainable.
308
+ - If code or files are removed, record why in \`DECISION_LOG.md\`.
309
+
310
+ ## Memory Write Rules
311
+
312
+ Add to this file only when a fact is stable and useful across future sessions.
313
+
314
+ Do not store secrets, API keys, credentials, private tokens, or sensitive personal data.
315
+
316
+ When a memory becomes wrong, do not silently delete it. Mark it outdated and append the corrected fact.
317
+
318
+ ## Current Assumptions To Remember
319
+
320
+ ${bullets(analysis.assumptions)}
321
+ `;
322
+ }
323
+ export function generateSkillMarkdown() {
324
+ return `---
325
+ name: gaslighting
326
+ description: Generate or update strict project discipline documents for Codex and AI coding agents. Use when a user asks to initialize Gaslighting, create GASLIGHTING.md/PRD.md/AGENTS.md discipline files, preserve full project scope, prevent TODO escape, prevent fake completion, or turn vague project intent into actionable control documents.
327
+ ---
328
+
329
+ # Gaslighting-engine Skill
330
+
331
+ You are a project-discipline generator for AI coding agents.
332
+
333
+ When a user gives a vague project request, do not stop and ask a long list of questions.
334
+
335
+ Instead:
336
+
337
+ 1. Infer the project type.
338
+ 2. Identify the project's core purpose.
339
+ 3. Make reasonable assumptions.
340
+ 4. Document assumptions clearly.
341
+ 5. Mark missing information clearly.
342
+ 6. Generate \`GASLIGHTING.md\`.
343
+ 7. Generate \`PRD.md\`.
344
+ 8. Generate \`ASSUMPTIONS.md\`.
345
+ 9. Generate \`MISSING_INFO.md\`.
346
+ 10. Generate \`DECISION_LOG.md\`.
347
+ 11. Generate \`STACK_POLICY.md\`.
348
+ 12. Generate or update \`AGENTS.md\`.
349
+
350
+ ## Hardcore Discipline Rule
351
+
352
+ The generated documents must prevent escape behavior.
353
+
354
+ Explicitly forbid:
355
+
356
+ - implementing only representative examples
357
+ - leaving TODOs instead of implementation
358
+ - saying "the rest can be done similarly"
359
+ - silently reducing requested scope
360
+ - pretending the task is complete
361
+ - replacing implementation with explanation
362
+ - creating empty placeholders
363
+ - skipping repetitive items because they are repetitive
364
+ - treating structure as completion
365
+ - treating direction as delivery
366
+
367
+ The agent must either:
368
+
369
+ 1. complete the full requested scope, or
370
+ 2. clearly declare what is incomplete.
371
+
372
+ Never allow fake completion.
373
+
374
+ Never allow scope shrinkage.
375
+
376
+ Never allow TODO-based escape.
377
+
378
+ ## Missing Information Rule
379
+
380
+ Missing information is not a free excuse to stop.
381
+
382
+ Classify missing information as:
383
+
384
+ - Confirmed
385
+ - Assumed
386
+ - Missing but non-blocking
387
+ - Missing and risky
388
+ - Missing and blocking
389
+
390
+ Only truly blocking information may stop implementation.
391
+
392
+ ## Default Tech Policy
393
+
394
+ For web projects, prefer:
395
+
396
+ - Next.js
397
+ - TypeScript
398
+ - Tailwind CSS
399
+ - shadcn/ui
400
+ - PostgreSQL
401
+ - NeonDB or Supabase
402
+ - Vercel
403
+ - Vercel Blob or Cloudflare R2
404
+ - GA4 + Google Tag Manager when analytics are needed
405
+ - Resend or equivalent when email is needed
406
+
407
+ Avoid over-engineering.
408
+
409
+ ## Output Rule
410
+
411
+ Create real markdown files.
412
+
413
+ Do not only explain.
414
+
415
+ Do not produce a plan without files.
416
+
417
+ Do not say what should be done.
418
+
419
+ Generate the actual project discipline documents.
420
+ `;
421
+ }
422
+ export function generateSkillOpenAiYaml() {
423
+ return `interface:
424
+ display_name: "Gaslighting-engine"
425
+ short_description: "Generate strict Codex project discipline docs"
426
+ brand_color: "#111827"
427
+ default_prompt: "Use $gaslighting to generate Gaslighting-engine discipline documents before implementation."
428
+
429
+ policy:
430
+ allow_implicit_invocation: true
431
+ `;
432
+ }
433
+ export function generateCodexPromptMarkdown() {
434
+ return `# CODEX_PROMPT.md
435
+
436
+ Copy and paste this into Codex:
437
+
438
+ ---
439
+
440
+ Read the following files before doing any work:
441
+
442
+ 1. \`GASLIGHTING.md\`
443
+ 2. \`PRD.md\`
444
+ 3. \`STACK_POLICY.md\`
445
+ 4. \`MISSING_INFO.md\`
446
+ 5. \`ASSUMPTIONS.md\`
447
+ 6. \`DECISION_LOG.md\`
448
+ 7. \`AGENTS.md\`
449
+ 8. \`MEMORY.md\`
450
+
451
+ Then implement the project MVP.
452
+
453
+ Rules:
454
+
455
+ - Do not shrink the scope.
456
+ - Do not leave TODOs instead of implementation.
457
+ - Do not implement only representative examples.
458
+ - Do not say "the rest follows the same pattern."
459
+ - Do not call scaffolding completion.
460
+ - Do not call placeholders implementation.
461
+ - Do not over-engineer.
462
+ - Do not forget the project purpose.
463
+ - If something is incomplete, declare it explicitly.
464
+
465
+ Before claiming completion, perform the self-audit in \`GASLIGHTING.md\`.
466
+
467
+ Proceed.
468
+ `;
469
+ }
470
+ export function generateCodexSlashPromptMarkdown() {
471
+ return `# /gaslighting
472
+
473
+ Read the Gaslighting-engine project-control files before doing any work:
474
+
475
+ 1. \`GASLIGHTING.md\`
476
+ 2. \`PRD.md\`
477
+ 3. \`STACK_POLICY.md\`
478
+ 4. \`MISSING_INFO.md\`
479
+ 5. \`ASSUMPTIONS.md\`
480
+ 6. \`DECISION_LOG.md\`
481
+ 7. \`AGENTS.md\`
482
+ 8. \`MEMORY.md\`
483
+
484
+ Then execute the user's requested implementation.
485
+
486
+ Rules:
487
+
488
+ - Preserve the full requested scope.
489
+ - Make reasonable assumptions and document them.
490
+ - Do not use TODO comments as fake implementation.
491
+ - Do not implement only representative examples.
492
+ - Do not say "the rest follows the same pattern."
493
+ - Do not call scaffolding completion.
494
+ - Do not call placeholders implementation.
495
+ - Do not over-engineer.
496
+ - Record stable project facts in \`MEMORY.md\`.
497
+ - Record product and technical decisions in \`DECISION_LOG.md\`.
498
+ - If something is incomplete, declare it explicitly.
499
+
500
+ Before claiming completion, perform the self-audit in \`GASLIGHTING.md\`.
501
+ `;
502
+ }
503
+ export function generateSkillReferenceDocs() {
504
+ const referenceInput = {
505
+ rawUserRequest: "I want to build a hospital website.",
506
+ projectType: "hospital_homepage",
507
+ mode: "hardcore",
508
+ fullScope: true,
509
+ noTodo: true,
510
+ noShortcut: true,
511
+ };
512
+ const referenceAnalysis = {
513
+ projectType: "hospital_homepage",
514
+ confidence: "high",
515
+ detectedStackHints: [],
516
+ assumptions: ["Hospital name: Sample Clinic.", "Hospital type: dermatology/aesthetic clinic."],
517
+ missingInfo: [],
518
+ };
519
+ return [
520
+ { filename: ".codex/skills/gaslighting/references/GASLIGHTING_TEMPLATE.md", content: generateGaslightingMarkdown(referenceInput, referenceAnalysis) },
521
+ { filename: ".codex/skills/gaslighting/references/HARDCORE_DISCIPLINE_TEMPLATE.md", content: generateGaslightingMarkdown(referenceInput, referenceAnalysis) },
522
+ { filename: ".codex/skills/gaslighting/references/STACK_POLICY_TEMPLATE.md", content: generateStackPolicyMarkdown(referenceAnalysis) },
523
+ { filename: ".codex/skills/gaslighting/references/HOSPITAL_HOMEPAGE_EXAMPLE.md", content: generatePrdMarkdown(referenceInput, referenceAnalysis) },
524
+ { filename: ".codex/skills/gaslighting/scripts/generate-gaslighting-docs.ts", content: `// Generated placeholder script for skill users.\n// Prefer the gaslighting CLI for full document generation.\nconsole.log("Run: gaslighting \\"I want to build a hospital website.\\"");\n` },
525
+ ];
526
+ }
527
+ function titleFromAssumption(assumption, index) {
528
+ return assumption.split(".")[0]?.replace(/[:`]/g, "").slice(0, 80) || `Assumption ${index + 1}`;
529
+ }
@@ -0,0 +1,125 @@
1
+ import { bullets, featureList, pageList, projectPurpose, stackSummary } from "./content.js";
2
+ export function generatePrdMarkdown(input, analysis) {
3
+ return `# PRD.md
4
+
5
+ ## 1. Product Overview
6
+
7
+ Build an MVP for this request:
8
+
9
+ > ${input.rawUserRequest}
10
+
11
+ Classified project type: \`${analysis.projectType}\`
12
+
13
+ The product must preserve the user's actual scope and must not become a decorative shell.
14
+
15
+ ## 2. Business Purpose
16
+
17
+ ${bullets(projectPurpose(analysis.projectType))}
18
+
19
+ ## 3. Target Users
20
+
21
+ ${targetUsers(analysis.projectType)}
22
+
23
+ ## 4. User Flows
24
+
25
+ ${userFlows(analysis.projectType)}
26
+
27
+ ## 5. Page List
28
+
29
+ ${bullets(pageList(analysis.projectType))}
30
+
31
+ ## 6. Feature List
32
+
33
+ ${bullets(featureList(analysis.projectType))}
34
+
35
+ ## 7. Data Model Draft
36
+
37
+ ${dataModel(analysis.projectType)}
38
+
39
+ ## 8. MVP Scope
40
+
41
+ - Implement all pages, flows, and features listed above.
42
+ - Include responsive behavior.
43
+ - Include useful empty, loading, success, and error states where applicable.
44
+ - Include SEO metadata where public pages exist.
45
+ - Include analytics-ready structure where conversion matters.
46
+ - Document every assumption that affects implementation.
47
+
48
+ ## 9. Out of Scope
49
+
50
+ ${outOfScope(analysis.projectType)}
51
+
52
+ ## 10. Non-Functional Requirements
53
+
54
+ - Mobile-first where users are likely to arrive from search or ads.
55
+ - Accessible semantic HTML.
56
+ - Fast initial load for public pages.
57
+ - Safe form validation and clear error messages.
58
+ - Maintainable TypeScript structure.
59
+ - No unnecessary distributed systems.
60
+
61
+ ## 11. Tech Stack
62
+
63
+ ${stackSummary(analysis)}
64
+
65
+ See \`STACK_POLICY.md\` for defaults and forbidden-by-default technology.
66
+
67
+ ## 12. Risks
68
+
69
+ - Vague source requirements can cause wrong vertical assumptions.
70
+ - Placeholder copy can look real if not reviewed.
71
+ - Missing production credentials can block deployment.
72
+ - AI agents may reduce scope unless \`GASLIGHTING.md\` is enforced.
73
+
74
+ ## 13. Missing Information
75
+
76
+ See \`MISSING_INFO.md\`.
77
+
78
+ ## 14. Success Criteria
79
+
80
+ - The project purpose is visible in the implemented product.
81
+ - The core pages and features are implemented, not merely described.
82
+ - No required scope is replaced by representative examples.
83
+ - No TODO is used as a substitute for implementation.
84
+ - Assumptions and decisions remain documented.
85
+ - The output can actually be used for the MVP purpose.
86
+ `;
87
+ }
88
+ function targetUsers(type) {
89
+ if (type === "hospital_homepage")
90
+ return bullets(["Potential patients searching on mobile", "Patients comparing hospitals", "Users looking for treatment information", "Users who want to call, reserve, or ask questions", "Hospital staff receiving inquiries"]);
91
+ if (type === "ecommerce")
92
+ return bullets(["Shoppers browsing products", "Returning customers checking orders", "Store operators managing products and orders"]);
93
+ if (type === "landing_page")
94
+ return bullets(["Ad traffic visitors", "Qualified leads", "Operators reviewing submitted leads"]);
95
+ if (type === "admin_dashboard")
96
+ return bullets(["Internal operators", "Managers", "Admins reviewing and editing records"]);
97
+ return bullets(["Primary end users", "Project operators", "Stakeholders evaluating the MVP"]);
98
+ }
99
+ function userFlows(type) {
100
+ if (type === "ecommerce")
101
+ return bullets(["Browse products -> view detail -> add to cart -> checkout -> order complete", "Admin -> create/edit product -> review orders"]);
102
+ if (type === "hospital_homepage")
103
+ return bullets(["Search/mobile visitor -> home -> treatment/doctor trust -> contact or reservation CTA", "Visitor -> location/contact -> call or submit inquiry"]);
104
+ if (type === "landing_page")
105
+ return bullets(["Visitor -> understand offer -> compare benefits -> submit lead form", "Visitor -> FAQ/social proof -> final CTA"]);
106
+ if (type === "admin_dashboard")
107
+ return bullets(["Operator -> search/filter records -> inspect detail -> edit safely -> confirm result", "Manager -> review status -> handle exceptions"]);
108
+ return bullets(["Visitor/user enters primary page", "User completes the main conversion or workflow", "Operator can review submitted or operational data where applicable"]);
109
+ }
110
+ function dataModel(type) {
111
+ const models = {
112
+ hospital_homepage: ["Inquiry: name, phone, category, message, privacyConsent, status, createdAt", "Treatment: title, summary, body, image, order", "Doctor: name, specialty, bio, credentials, image", "Location: address, phone, hours, mapUrl"],
113
+ ecommerce: ["Product: title, slug, description, price, images, stockStatus", "CartItem: productId, quantity, priceSnapshot", "Order: customer, items, total, status, createdAt", "AdminUser: email, role"],
114
+ landing_page: ["Lead: name, emailOrPhone, source, message, consent, createdAt", "Offer: headline, benefits, proof, CTA"],
115
+ admin_dashboard: ["User: email, role, status", "Record: searchable fields, status, timestamps", "AuditLog: actor, action, target, createdAt"],
116
+ };
117
+ return bullets(models[type] ?? ["PrimaryEntity: title, status, description, timestamps", "SubmissionOrContact: name, contact, message, status, createdAt"]);
118
+ }
119
+ function outOfScope(type) {
120
+ if (type === "hospital_homepage")
121
+ return bullets(["full admin dashboard", "payment", "complex reservation calendar", "EMR integration", "user login", "multilingual content", "automated medical diagnosis"]);
122
+ if (type === "ecommerce")
123
+ return bullets(["warehouse automation", "multi-vendor marketplace", "subscription billing unless requested", "complex ERP integration"]);
124
+ return bullets(["LLM API integration unless explicitly requested", "complex infrastructure", "unrequested authentication", "unrequested payments", "native mobile apps"]);
125
+ }
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { buildCli, normalizeDefaultInitArgv } from "./cli.js";
3
+ buildCli().parse(normalizeDefaultInitArgv(process.argv));
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};