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,66 @@
1
+ const projectTypeKeywords = {
2
+ hospital_homepage: [
3
+ "hospital",
4
+ "clinic",
5
+ "medical",
6
+ "doctor",
7
+ "dentist",
8
+ "dermatology",
9
+ "plastic surgery",
10
+ "obgyn",
11
+ "병원",
12
+ "의원",
13
+ "클리닉",
14
+ "피부과",
15
+ "성형외과",
16
+ "치과",
17
+ "한의원",
18
+ "산부인과",
19
+ ],
20
+ ecommerce: [
21
+ "shop",
22
+ "store",
23
+ "ecommerce",
24
+ "commerce",
25
+ "product",
26
+ "cart",
27
+ "checkout",
28
+ "order",
29
+ "payment",
30
+ "쇼핑몰",
31
+ "커머스",
32
+ "상품",
33
+ "장바구니",
34
+ "결제",
35
+ "주문",
36
+ ],
37
+ landing_page: ["landing", "landing page", "ad page", "lead", "cta", "랜딩", "랜딩페이지", "광고", "문의 전환"],
38
+ admin_dashboard: ["admin", "dashboard", "backoffice", "manager", "관리자", "어드민", "대시보드", "백오피스"],
39
+ saas_mvp: ["saas", "subscription", "workspace", "tenant", "mvp"],
40
+ portfolio_site: ["portfolio", "personal site", "resume", "작품", "포트폴리오"],
41
+ blog_seo_site: ["blog", "seo", "content", "article", "블로그", "콘텐츠"],
42
+ reservation_site: ["reservation", "booking", "appointment", "예약", "부킹"],
43
+ outsourcing_platform: ["outsourcing", "marketplace", "freelancer", "외주", "매칭"],
44
+ public_bid_proposal: ["proposal", "bid", "rfp", "public procurement", "입찰", "제안서", "나라장터", "정성제안서", "정량제안서"],
45
+ legal_consulting_site: ["law", "legal", "attorney", "lawyer", "법률", "변호사", "로펌"],
46
+ education_site: ["education", "course", "academy", "school", "lesson", "교육", "강의", "학원", "학교"],
47
+ generic_web_project: [],
48
+ };
49
+ export function classifyProjectType(input, override) {
50
+ if (override)
51
+ return { projectType: override, confidence: "high" };
52
+ const lower = input.toLowerCase();
53
+ const scores = Object.entries(projectTypeKeywords)
54
+ .filter(([type]) => type !== "generic_web_project")
55
+ .map(([type, keywords]) => ({
56
+ type: type,
57
+ score: keywords.filter((keyword) => lower.includes(keyword.toLowerCase())).length,
58
+ }))
59
+ .sort((a, b) => b.score - a.score);
60
+ const best = scores[0];
61
+ if (!best || best.score === 0)
62
+ return { projectType: "generic_web_project", confidence: "low" };
63
+ if (best.score >= 2)
64
+ return { projectType: best.type, confidence: "high" };
65
+ return { projectType: best.type, confidence: "medium" };
66
+ }
@@ -0,0 +1,125 @@
1
+ import { isoDate } from "../utils/date.js";
2
+ import { list, quote } from "../utils/markdown.js";
3
+ const purposeByType = {
4
+ hospital_homepage: [
5
+ "increase trust",
6
+ "generate consultation inquiries",
7
+ "support reservation conversion",
8
+ "make departments and treatments understandable",
9
+ "make doctors and hospital credibility visible",
10
+ "help mobile visitors contact the hospital quickly",
11
+ "support local SEO",
12
+ "make location and contact information obvious",
13
+ ],
14
+ ecommerce: [
15
+ "product discovery",
16
+ "product detail clarity",
17
+ "cart flow",
18
+ "checkout flow",
19
+ "order creation",
20
+ "payment readiness",
21
+ "admin product management",
22
+ "mobile purchase experience",
23
+ ],
24
+ landing_page: [
25
+ "make the offer clear within 5 seconds",
26
+ "drive CTA clicks",
27
+ "capture leads",
28
+ "support ad traffic",
29
+ "reduce bounce",
30
+ "communicate value clearly",
31
+ "load fast on mobile",
32
+ ],
33
+ admin_dashboard: [
34
+ "make operations easier",
35
+ "make data visible",
36
+ "allow safe editing",
37
+ "prevent mistakes",
38
+ "support search/filter/sort",
39
+ "show important status clearly",
40
+ "reduce internal workflow friction",
41
+ ],
42
+ saas_mvp: ["deliver the core value loop", "support account-aware usage", "make onboarding clear", "keep operations visible"],
43
+ portfolio_site: ["show credible work", "make case studies understandable", "drive contact inquiries"],
44
+ blog_seo_site: ["publish indexable content", "support topic clusters", "make editorial operations repeatable"],
45
+ reservation_site: ["let users select a service", "let users request or reserve a time", "confirm contact details"],
46
+ outsourcing_platform: ["connect clients and providers", "make matching/search practical", "support inquiry or transaction flow"],
47
+ public_bid_proposal: ["preserve scoring criteria", "prove compliance", "connect claims to evidence"],
48
+ legal_consulting_site: ["build trust", "explain practice areas", "convert qualified consultations"],
49
+ education_site: ["explain courses", "support enrollment interest", "make curriculum and trust visible"],
50
+ generic_web_project: ["preserve the user's requested outcome", "avoid silently narrowing scope", "make the MVP usable"],
51
+ };
52
+ const pagesByType = {
53
+ hospital_homepage: ["Home", "Hospital Introduction", "Departments / Treatments", "Doctor Profiles", "Consultation / Contact", "Location", "Privacy Policy"],
54
+ ecommerce: ["Home", "Product List", "Product Detail", "Cart", "Checkout", "Order Complete", "My Orders", "Admin Products", "Admin Orders"],
55
+ landing_page: ["Single landing page with Hero, Problem, Solution, Benefits, Social Proof, Process, Offer, FAQ, Final CTA, Lead Form"],
56
+ admin_dashboard: ["Overview", "Records List", "Record Detail", "Create/Edit Form", "Settings", "Audit/Activity", "Error and Empty States"],
57
+ saas_mvp: ["Marketing Home", "Sign In", "Onboarding", "Dashboard", "Core Workflow", "Settings", "Admin"],
58
+ portfolio_site: ["Home", "Work", "Case Study", "About", "Contact"],
59
+ blog_seo_site: ["Home", "Blog Index", "Category", "Article", "About", "Contact"],
60
+ reservation_site: ["Home", "Services", "Reservation", "Confirmation", "Contact"],
61
+ outsourcing_platform: ["Home", "Provider List", "Provider Detail", "Request Form", "Dashboard", "Admin"],
62
+ public_bid_proposal: ["Executive Summary", "Requirements Matrix", "Technical Approach", "Schedule", "Budget", "Evidence Appendix"],
63
+ legal_consulting_site: ["Home", "Practice Areas", "Attorney Profile", "Consultation", "Location", "Privacy Policy"],
64
+ education_site: ["Home", "Courses", "Course Detail", "Enrollment Inquiry", "FAQ", "Contact"],
65
+ generic_web_project: ["Home", "Primary Feature", "Contact/CTA", "Privacy Policy"],
66
+ };
67
+ const featuresByType = {
68
+ hospital_homepage: ["responsive layout", "mobile-first UI", "contact CTA", "inquiry form", "treatment sections", "doctor introduction", "location section", "privacy policy", "SEO metadata", "analytics-ready structure"],
69
+ ecommerce: ["product listing", "product detail page", "cart", "checkout preparation", "order creation", "product image support", "admin product CRUD", "admin order view", "responsive UI"],
70
+ landing_page: ["responsive design", "CTA buttons", "lead form", "conversion-oriented copy", "SEO metadata", "fast loading", "analytics-ready structure"],
71
+ admin_dashboard: ["search", "filter", "sort", "CRUD forms", "empty states", "error states", "confirmation states", "safe destructive actions", "role-ready structure"],
72
+ saas_mvp: ["onboarding", "authenticated dashboard", "core workflow", "settings", "admin visibility"],
73
+ portfolio_site: ["project grid", "case studies", "contact form", "SEO metadata"],
74
+ blog_seo_site: ["article pages", "categories", "metadata", "sitemap-ready routes", "editorial content structure"],
75
+ reservation_site: ["service selection", "date/time request", "contact capture", "confirmation state"],
76
+ outsourcing_platform: ["listing/search", "profile pages", "inquiry flow", "admin review"],
77
+ public_bid_proposal: ["requirements mapping", "evidence log", "risk log", "submission checklist"],
78
+ legal_consulting_site: ["practice area pages", "consultation CTA", "attorney credibility", "compliance copy placeholders"],
79
+ education_site: ["course list", "course details", "inquiry form", "curriculum sections"],
80
+ generic_web_project: ["clear primary flow", "responsive UI", "CTA/contact path", "SEO metadata"],
81
+ };
82
+ export function projectPurpose(projectType) {
83
+ return purposeByType[projectType];
84
+ }
85
+ export function projectWarnings(projectType) {
86
+ const warnings = {
87
+ hospital_homepage: ["Do not turn this into a SaaS landing page.", "Do not ignore medical trust.", "Do not ignore consultation flow.", "Do not ignore mobile users.", "Do not ignore contact and reservation CTA."],
88
+ ecommerce: ["Do not turn this into a portfolio page.", "Do not ignore cart.", "Do not ignore checkout.", "Do not ignore order data.", "A store without purchase flow is not a store."],
89
+ landing_page: ["Do not create a decorative page with no conversion path.", "A landing page without CTA is a failure.", "A page with vague messaging is a failure."],
90
+ admin_dashboard: ["Do not create fake charts for decoration.", "Do not build a dashboard with no operational value.", "Do not ignore empty states, error states, or permissions."],
91
+ };
92
+ return warnings[projectType] ?? ["Do not drift from the user's actual request.", "Do not replace implementation with explanation."];
93
+ }
94
+ export function pageList(projectType) {
95
+ return pagesByType[projectType];
96
+ }
97
+ export function featureList(projectType) {
98
+ return featuresByType[projectType];
99
+ }
100
+ export function missingInfoTable(items) {
101
+ return [
102
+ "| Item | Current Status | Temporary Assumption | Impact | Blocking? | Recommended Action |",
103
+ "|---|---|---|---|---|---|",
104
+ ...items.map((item) => `| ${quote(item.item)} | ${quote(item.currentStatus)} | ${quote(item.temporaryAssumption)} | ${item.impact} | ${item.blocking.replaceAll("_", " ")} | ${quote(item.recommendedAction)} |`),
105
+ ].join("\n");
106
+ }
107
+ export function stackSummary(analysis) {
108
+ return analysis.detectedStackHints.length > 0
109
+ ? `Detected stack hints: ${analysis.detectedStackHints.join(", ")}. Use them where they serve the project purpose.`
110
+ : "No stack hints were provided. Use the default practical web stack unless the user later changes it.";
111
+ }
112
+ export function modeSummary(input) {
113
+ return [
114
+ input.mode === "hardcore" ? "hardcore" : "standard strict",
115
+ input.fullScope ? "full-scope enforcement enabled" : "partial-scope allowance enabled",
116
+ input.noTodo ? "no-TODO escape enabled" : "TODO allowance enabled",
117
+ input.noShortcut ? "no-shortcut enforcement enabled" : "representative-example allowance enabled",
118
+ ];
119
+ }
120
+ export function decisionDate() {
121
+ return isoDate();
122
+ }
123
+ export function bullets(items) {
124
+ return list(items);
125
+ }
@@ -0,0 +1,34 @@
1
+ const stackHints = [
2
+ "Next.js",
3
+ "React",
4
+ "Vue",
5
+ "Nuxt",
6
+ "Svelte",
7
+ "Astro",
8
+ "TypeScript",
9
+ "JavaScript",
10
+ "PostgreSQL",
11
+ "MySQL",
12
+ "SQLite",
13
+ "Prisma",
14
+ "Drizzle",
15
+ "Supabase",
16
+ "NeonDB",
17
+ "Firebase",
18
+ "Vercel",
19
+ "Netlify",
20
+ "Cloudflare",
21
+ "Cloudflare R2",
22
+ "Vercel Blob",
23
+ "AWS S3",
24
+ "Toss Payments",
25
+ "Stripe",
26
+ "Resend",
27
+ "Nodemailer",
28
+ "Tailwind CSS",
29
+ "shadcn/ui",
30
+ ];
31
+ export function detectStackHints(input) {
32
+ const lower = input.toLowerCase();
33
+ return stackHints.filter((hint) => lower.includes(hint.toLowerCase()));
34
+ }
@@ -0,0 +1,58 @@
1
+ import { analyze } from "./analyze.js";
2
+ import { generateGaslightingMarkdown } from "./generateGaslightingMarkdown.js";
3
+ import { generatePrdMarkdown } from "./generatePrdMarkdown.js";
4
+ import { generateAgentsMarkdown, generateAssumptionsMarkdown, generateCodexPromptMarkdown, generateCodexSlashPromptMarkdown, generateDecisionLogMarkdown, generateMemoryMarkdown, generateMissingInfoMarkdown, generateSkillMarkdown, generateSkillOpenAiYaml, generateSkillReferenceDocs, generateStackPolicyMarkdown, } from "./generateOtherMarkdown.js";
5
+ export function generateDocs(input) {
6
+ const normalized = {
7
+ ...input,
8
+ mode: input.mode ?? "standard",
9
+ language: input.language ?? "en",
10
+ };
11
+ const analysis = analyze(normalized);
12
+ const docs = [
13
+ { filename: "GASLIGHTING.md", content: generateGaslightingMarkdown(normalized, analysis) },
14
+ { filename: "PRD.md", content: generatePrdMarkdown(normalized, analysis) },
15
+ { filename: "ASSUMPTIONS.md", content: generateAssumptionsMarkdown(analysis) },
16
+ { filename: "MISSING_INFO.md", content: generateMissingInfoMarkdown(analysis) },
17
+ { filename: "DECISION_LOG.md", content: generateDecisionLogMarkdown(normalized, analysis) },
18
+ { filename: "MEMORY.md", content: generateMemoryMarkdown(normalized, analysis) },
19
+ { filename: "STACK_POLICY.md", content: generateStackPolicyMarkdown(analysis) },
20
+ { filename: "AGENTS.md", content: generateAgentsMarkdown() },
21
+ { filename: "CODEX_PROMPT.md", content: generateCodexPromptMarkdown() },
22
+ { filename: ".codex/prompts/gaslighting.md", content: generateCodexSlashPromptMarkdown() },
23
+ { filename: ".codex/skills/gaslighting/SKILL.md", content: generateSkillMarkdown() },
24
+ { filename: ".codex/skills/gaslighting/agents/openai.yaml", content: generateSkillOpenAiYaml() },
25
+ ...generateSkillReferenceDocs(),
26
+ ];
27
+ return { analysis, docs };
28
+ }
29
+ export function generateOnlySkillDocs() {
30
+ return [
31
+ { filename: ".codex/prompts/gaslighting.md", content: generateCodexSlashPromptMarkdown() },
32
+ { filename: ".codex/skills/gaslighting/SKILL.md", content: generateSkillMarkdown() },
33
+ { filename: ".codex/skills/gaslighting/agents/openai.yaml", content: generateSkillOpenAiYaml() },
34
+ ...generateSkillReferenceDocs(),
35
+ ];
36
+ }
37
+ export function generateCodexInstallDocs() {
38
+ const skillDocs = [
39
+ { filename: ".agents/skills/gaslighting/SKILL.md", content: generateSkillMarkdown() },
40
+ { filename: ".agents/skills/gaslighting/agents/openai.yaml", content: generateSkillOpenAiYaml() },
41
+ ...generateSkillReferenceDocs().map((doc) => ({
42
+ filename: doc.filename.replace(".codex/skills/gaslighting/", ".agents/skills/gaslighting/"),
43
+ content: doc.content,
44
+ })),
45
+ { filename: ".codex/skills/gaslighting/SKILL.md", content: generateSkillMarkdown() },
46
+ { filename: ".codex/skills/gaslighting/agents/openai.yaml", content: generateSkillOpenAiYaml() },
47
+ ...generateSkillReferenceDocs(),
48
+ ];
49
+ return [
50
+ ...skillDocs,
51
+ { filename: ".codex/prompts/gaslighting.md", content: generateCodexSlashPromptMarkdown() },
52
+ { filename: ".agents/prompts/gaslighting.md", content: generateCodexSlashPromptMarkdown() },
53
+ { filename: "CODEX_GASLIGHTING.md", content: generateCodexPromptMarkdown() },
54
+ ];
55
+ }
56
+ export function generateOnlyAgentsDoc() {
57
+ return [{ filename: "AGENTS.md", content: generateAgentsMarkdown() }];
58
+ }