@everystack/mcp 0.3.2 → 0.3.3

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 (85) hide show
  1. package/dist/gates/detectors/embedded-data-bundle.d.ts +13 -0
  2. package/dist/gates/detectors/embedded-data-bundle.d.ts.map +1 -0
  3. package/dist/gates/detectors/embedded-data-bundle.js +56 -0
  4. package/dist/gates/detectors/hand-written-migration.d.ts +24 -0
  5. package/dist/gates/detectors/hand-written-migration.d.ts.map +1 -0
  6. package/dist/gates/detectors/hand-written-migration.js +54 -0
  7. package/dist/gates/detectors/secret-in-public-env.d.ts +12 -0
  8. package/dist/gates/detectors/secret-in-public-env.d.ts.map +1 -0
  9. package/dist/gates/detectors/secret-in-public-env.js +38 -0
  10. package/dist/gates/engine.d.ts +28 -0
  11. package/dist/gates/engine.d.ts.map +1 -0
  12. package/dist/gates/engine.js +74 -0
  13. package/dist/gates/registry.d.ts +14 -0
  14. package/dist/gates/registry.d.ts.map +1 -0
  15. package/dist/gates/registry.js +21 -0
  16. package/dist/gates/telemetry.d.ts +47 -0
  17. package/dist/gates/telemetry.d.ts.map +1 -0
  18. package/dist/gates/telemetry.js +121 -0
  19. package/dist/gates/types.d.ts +67 -0
  20. package/dist/gates/types.d.ts.map +1 -0
  21. package/dist/gates/types.js +14 -0
  22. package/dist/governance/cli.d.ts +57 -0
  23. package/dist/governance/cli.d.ts.map +1 -0
  24. package/dist/governance/cli.js +169 -0
  25. package/dist/governance/grounding.d.ts +78 -0
  26. package/dist/governance/grounding.d.ts.map +1 -0
  27. package/dist/governance/grounding.js +299 -0
  28. package/dist/index.cjs +11 -9
  29. package/dist/index.d.ts +2 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +94 -0
  32. package/dist/project-claude-md.md +30 -16
  33. package/dist/prompts/add-feature.d.ts +3 -0
  34. package/dist/prompts/add-feature.d.ts.map +1 -0
  35. package/dist/prompts/add-feature.js +154 -0
  36. package/dist/prompts/claude-md.d.ts +12 -0
  37. package/dist/prompts/claude-md.d.ts.map +1 -0
  38. package/dist/prompts/claude-md.js +87 -0
  39. package/dist/prompts/debug.d.ts +3 -0
  40. package/dist/prompts/debug.d.ts.map +1 -0
  41. package/dist/prompts/debug.js +129 -0
  42. package/dist/prompts/deploy.d.ts +3 -0
  43. package/dist/prompts/deploy.d.ts.map +1 -0
  44. package/dist/prompts/deploy.js +118 -0
  45. package/dist/prompts/design-schema.d.ts +3 -0
  46. package/dist/prompts/design-schema.d.ts.map +1 -0
  47. package/dist/prompts/design-schema.js +97 -0
  48. package/dist/prompts/governance-setup.d.ts +9 -0
  49. package/dist/prompts/governance-setup.d.ts.map +1 -0
  50. package/dist/prompts/governance-setup.js +76 -0
  51. package/dist/prompts/index.d.ts +3 -0
  52. package/dist/prompts/index.d.ts.map +1 -0
  53. package/dist/prompts/index.js +20 -0
  54. package/dist/prompts/new-app.d.ts +3 -0
  55. package/dist/prompts/new-app.d.ts.map +1 -0
  56. package/dist/prompts/new-app.js +203 -0
  57. package/dist/prompts/runbook.d.ts +12 -0
  58. package/dist/prompts/runbook.d.ts.map +1 -0
  59. package/dist/prompts/runbook.js +70 -0
  60. package/dist/prompts/secure.d.ts +3 -0
  61. package/dist/prompts/secure.d.ts.map +1 -0
  62. package/dist/prompts/secure.js +219 -0
  63. package/dist/resources/index.d.ts +12 -0
  64. package/dist/resources/index.d.ts.map +1 -0
  65. package/dist/resources/index.js +182 -0
  66. package/dist/tools/check-environment.d.ts +25 -0
  67. package/dist/tools/check-environment.d.ts.map +1 -0
  68. package/dist/tools/check-environment.js +281 -0
  69. package/dist/tools/index.d.ts +3 -0
  70. package/dist/tools/index.d.ts.map +1 -0
  71. package/dist/tools/index.js +18 -0
  72. package/dist/tools/project-status.d.ts +28 -0
  73. package/dist/tools/project-status.d.ts.map +1 -0
  74. package/dist/tools/project-status.js +138 -0
  75. package/dist/tools/project-validate.d.ts +19 -0
  76. package/dist/tools/project-validate.d.ts.map +1 -0
  77. package/dist/tools/project-validate.js +323 -0
  78. package/dist/tools/schema-analyze.d.ts +46 -0
  79. package/dist/tools/schema-analyze.d.ts.map +1 -0
  80. package/dist/tools/schema-analyze.js +336 -0
  81. package/package.json +3 -3
  82. package/src/gates/detectors/hand-written-migration.ts +22 -13
  83. package/src/index.ts +1 -1
  84. package/src/prompts/claude-md.ts +4 -2
  85. package/src/resources/project-claude-md.md +30 -16
@@ -0,0 +1,129 @@
1
+ import { z } from 'zod';
2
+ export function registerDebugPrompt(server) {
3
+ server.prompt('debug', 'Systematic debugging for common everystack issues. Provides diagnostic steps based on the symptom.', {
4
+ symptom: z.string().describe('Description of the problem (e.g., "401 on all API requests", "RLS blocking reads", "Lambda timeout")'),
5
+ projectPath: z.string().optional().describe('Absolute path to project root'),
6
+ }, async ({ symptom, projectPath }) => {
7
+ return {
8
+ messages: [
9
+ {
10
+ role: 'user',
11
+ content: {
12
+ type: 'text',
13
+ text: [
14
+ `Debug this issue: ${symptom}`,
15
+ '',
16
+ '## Instructions',
17
+ '',
18
+ '1. Read everystack://core for architecture context.',
19
+ projectPath ? `2. Run project_status with projectPath="${projectPath}" to understand the project.` : '',
20
+ projectPath ? `3. Run project_validate with projectPath="${projectPath}" to find configuration issues.` : '',
21
+ projectPath ? `4. Run schema_analyze with projectPath="${projectPath}" to check schema/handler alignment.` : '',
22
+ '',
23
+ '## Diagnostic Framework',
24
+ '',
25
+ 'Work through these categories systematically:',
26
+ '',
27
+ '### 1. Authentication Issues (401/403)',
28
+ '',
29
+ 'If the symptom involves authentication or authorization:',
30
+ '',
31
+ '- **Check token flow:**',
32
+ ' - Is the JWT being sent in the Authorization header?',
33
+ ' - Is the token expired? Decode at jwt.io and check `exp`',
34
+ ' - Does `auth.verifyToken` return a valid payload?',
35
+ '',
36
+ '- **Check publicRoutes:**',
37
+ ' - Is the route supposed to be public? Check `auth.publicRoutes` in handler config',
38
+ ' - Is the RPC in `auth.publicRpc`?',
39
+ '',
40
+ '- **Check pgSettings:**',
41
+ ' - Is `pgSettings` configured in the handler?',
42
+ ' - Does it set `role` and `request.jwt.claims`?',
43
+ ' - Test with: `SELECT current_setting(\'request.jwt.claims\', true);`',
44
+ '',
45
+ '### 2. RLS Issues (empty results, permission denied)',
46
+ '',
47
+ 'Read everystack://security for RLS debugging.',
48
+ '',
49
+ '- **Check RLS is enabled:**',
50
+ ' ```sql',
51
+ ' SELECT tablename, rowsecurity FROM pg_tables WHERE schemaname = \'public\';',
52
+ ' ```',
53
+ '',
54
+ '- **Check policies exist:**',
55
+ ' ```sql',
56
+ ' SELECT * FROM pg_policies WHERE schemaname = \'public\';',
57
+ ' ```',
58
+ '',
59
+ '- **Test as specific role:**',
60
+ ' ```sql',
61
+ ' SET LOCAL ROLE authenticated;',
62
+ ' SELECT set_config(\'request.jwt.claims\', \'{"sub":"user-id","role":"authenticated"}\', true);',
63
+ ' SELECT * FROM your_table;',
64
+ ' ```',
65
+ '',
66
+ '- **Common RLS mistakes:**',
67
+ ' - Policy references wrong claim path (sub vs user_id)',
68
+ ' - USING clause doesn\'t match the data (e.g., UUID vs text comparison)',
69
+ ' - Missing policy for the operation (SELECT exists but not INSERT)',
70
+ ' - Forgot `WITH CHECK` on INSERT/UPDATE policies',
71
+ '',
72
+ '### 3. Query Issues (wrong data, missing relations)',
73
+ '',
74
+ 'Read everystack://query-protocol for filter syntax.',
75
+ '',
76
+ '- **Check relations config:**',
77
+ ' - Does the handler `relations` config match the Drizzle schema relations?',
78
+ ' - Is the relation direction correct (from/to)?',
79
+ '',
80
+ '- **Check column names:**',
81
+ ' - Handler uses camelCase by default. Database uses snake_case.',
82
+ ' - Check `naming` option in handler config.',
83
+ '',
84
+ '### 4. Deployment Issues',
85
+ '',
86
+ 'Read everystack://deployment and everystack://cli.',
87
+ '',
88
+ '- **Lambda errors:**',
89
+ ' ```bash',
90
+ ' everystack logs:errors --stage dev',
91
+ ' everystack logs:tail --stage dev',
92
+ ' ```',
93
+ '',
94
+ '- **Database connection:**',
95
+ ' ```bash',
96
+ ' everystack db:psql --stage dev',
97
+ ' everystack diag --stage dev',
98
+ ' ```',
99
+ '',
100
+ '- **Common deployment issues:**',
101
+ ' - Missing secrets: `pnpm sst secret list --stage dev`',
102
+ ' - VPC configuration: Lambda can\'t reach RDS without proper VPC setup',
103
+ ' - Bundle size: Check if unnecessary packages are bundled',
104
+ '',
105
+ '### 5. Performance Issues',
106
+ '',
107
+ '- **Slow queries:**',
108
+ ' - Check for missing indexes on filtered/joined columns',
109
+ ' - Check `maxLimit` and `maxEmbedDepth` in handler config',
110
+ ' - Use `EXPLAIN ANALYZE` on slow queries',
111
+ '',
112
+ '- **Cold starts:**',
113
+ ' - Minimize Lambda bundle size',
114
+ ' - Use provisioned concurrency for production',
115
+ '',
116
+ '## Resolution',
117
+ '',
118
+ 'After diagnosing:',
119
+ '1. Identify the root cause',
120
+ '2. Propose a fix with the specific code change',
121
+ '3. Verify the fix resolves the issue',
122
+ '4. Run project_validate to ensure no new issues were introduced',
123
+ ].filter(Boolean).join('\n'),
124
+ },
125
+ },
126
+ ],
127
+ };
128
+ });
129
+ }
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerDeployPrompt(server: McpServer): void;
3
+ //# sourceMappingURL=deploy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/prompts/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA0H5D"}
@@ -0,0 +1,118 @@
1
+ import { z } from 'zod';
2
+ export function registerDeployPrompt(server) {
3
+ server.prompt('deploy', 'Step-by-step deployment walkthrough for a specific stage. Covers AWS credentials, SST deploy, migrations, and verification.', {
4
+ stage: z.enum(['dev', 'staging', 'production']).describe('Deployment stage'),
5
+ projectPath: z.string().optional().describe('Absolute path to project root'),
6
+ }, async ({ stage, projectPath }) => {
7
+ const isProduction = stage === 'production';
8
+ return {
9
+ messages: [
10
+ {
11
+ role: 'user',
12
+ content: {
13
+ type: 'text',
14
+ text: [
15
+ `Deploy to ${stage}.`,
16
+ '',
17
+ '## Instructions',
18
+ '',
19
+ '1. Read everystack://deployment for infrastructure setup.',
20
+ '2. Read everystack://security for AWS credential setup and deployment checklist.',
21
+ projectPath ? `3. Run project_validate with projectPath="${projectPath}" to check for issues before deploying.` : '',
22
+ projectPath ? `4. Run project_status with projectPath="${projectPath}" to see current deployment state.` : '',
23
+ '',
24
+ '## Pre-Deploy Checklist',
25
+ '',
26
+ '### AWS Credentials',
27
+ '',
28
+ '1. Verify the correct AWS profile is configured:',
29
+ ` - ${stage === 'dev' ? '`everystack-manage` — for development deploys and CLI operations' : ''}`,
30
+ ` - ${isProduction ? '`everystack-deploy` — for CI/CD production deploys (limited permissions)' : ''}`,
31
+ '2. Run `aws sts get-caller-identity` to verify the active profile',
32
+ '3. Ensure `everystack-create` profile is DISABLED unless first deploy',
33
+ '',
34
+ '### Secrets',
35
+ '',
36
+ 'Set required secrets for this stage:',
37
+ '```bash',
38
+ `pnpm sst secret set JwtSecret "$(openssl rand -base64 32)" --stage ${stage}`,
39
+ '```',
40
+ '',
41
+ isProduction ? [
42
+ '### Production Safety',
43
+ '',
44
+ '- [ ] All tests pass: `pnpm test`',
45
+ '- [ ] No security warnings: run project_validate',
46
+ '- [ ] RLS policies are in place for all tables',
47
+ '- [ ] pgSettings is configured in handler',
48
+ '- [ ] No hardcoded secrets in source',
49
+ '- [ ] .env files are not committed',
50
+ '',
51
+ ].join('\n') : '',
52
+ '## Deploy Steps',
53
+ '',
54
+ '### 1. Deploy Infrastructure',
55
+ '```bash',
56
+ `pnpm sst deploy --stage ${stage}`,
57
+ '```',
58
+ '',
59
+ 'This creates/updates:',
60
+ '- S3 bucket for static assets',
61
+ '- CloudFront distribution',
62
+ '- Lambda functions',
63
+ '- RDS Aurora Serverless (V2+)',
64
+ '- SQS queues (V3)',
65
+ '- IAM roles and policies',
66
+ '',
67
+ '### 3. Database Setup (V2+)',
68
+ '```bash',
69
+ `everystack db:migrate --stage ${stage}`,
70
+ stage === 'dev' ? `everystack db:seed --stage ${stage} # dev only` : '',
71
+ '```',
72
+ '',
73
+ '### 4. Verify',
74
+ '```bash',
75
+ '# Check Lambda logs',
76
+ `everystack logs:tail --stage ${stage}`,
77
+ '',
78
+ '# Test the API',
79
+ `curl https://your-domain/api/health`,
80
+ '',
81
+ `# Connect to database (${stage})`,
82
+ `everystack db:psql --stage ${stage}`,
83
+ '```',
84
+ '',
85
+ '## Post-Deploy',
86
+ '',
87
+ '### OTA Updates (no redeploy needed)',
88
+ '```bash',
89
+ `everystack update --channel ${stage === 'production' ? 'production' : stage} --message "Description"`,
90
+ '```',
91
+ '',
92
+ isProduction ? [
93
+ '### Production Monitoring',
94
+ '',
95
+ '- Check CloudWatch for Lambda errors',
96
+ '- Monitor RDS connection count',
97
+ '- Verify CDN cache hit rates',
98
+ '- Set up CloudWatch alarms for error rates',
99
+ ].join('\n') : '',
100
+ '',
101
+ '## Rollback',
102
+ '',
103
+ 'If something goes wrong:',
104
+ '```bash',
105
+ '# Revert to previous OTA update',
106
+ `everystack update --channel ${stage === 'production' ? 'production' : stage} --rollback`,
107
+ '',
108
+ '# For infrastructure changes, redeploy from a known good commit',
109
+ 'git checkout <good-commit>',
110
+ `pnpm sst deploy --stage ${stage}`,
111
+ '```',
112
+ ].filter(Boolean).join('\n'),
113
+ },
114
+ },
115
+ ],
116
+ };
117
+ });
118
+ }
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerDesignSchemaPrompt(server: McpServer): void;
3
+ //# sourceMappingURL=design-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-schema.d.ts","sourceRoot":"","sources":["../../src/prompts/design-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAoGlE"}
@@ -0,0 +1,97 @@
1
+ import { z } from 'zod';
2
+ export function registerDesignSchemaPrompt(server) {
3
+ server.prompt('design-schema', 'Interactive schema design: plain English description → Drizzle schema + migrations + RLS policies + handler config + testing checklist.', {
4
+ description: z.string().describe('Plain English description of the data model (e.g., "blog with posts, comments, and tags")'),
5
+ projectPath: z.string().optional().describe('Absolute path to project root (to analyze existing schema)'),
6
+ }, async ({ description, projectPath }) => {
7
+ return {
8
+ messages: [
9
+ {
10
+ role: 'user',
11
+ content: {
12
+ type: 'text',
13
+ text: [
14
+ `Design a database schema for: ${description}`,
15
+ '',
16
+ '## Instructions',
17
+ '',
18
+ '1. Read everystack://schema-patterns for Drizzle schema conventions.',
19
+ '2. Read everystack://security for RLS policy patterns.',
20
+ '3. Read everystack://handler-options for handler configuration.',
21
+ projectPath ? `4. Run schema_analyze with projectPath="${projectPath}" to understand the existing schema.` : '',
22
+ '',
23
+ '## Deliverables',
24
+ '',
25
+ 'Generate ALL of the following:',
26
+ '',
27
+ '### 1. Drizzle Schema (db/schema.ts)',
28
+ '',
29
+ 'Follow these conventions:',
30
+ '- UUID primary keys: `uuid(\'id\').primaryKey().defaultRandom()`',
31
+ '- Timestamps: `timestamp(\'created_at\', { withTimezone: true }).defaultNow().notNull()`',
32
+ '- Soft delete columns: `deletedAt` + `deletedBy` on user-facing tables',
33
+ '- Foreign keys with `.references(() => table.column)`',
34
+ '- Export all tables as named exports',
35
+ '- Add Drizzle `relations()` for SSR query building and API embedding',
36
+ '',
37
+ '### 2. SQL Migration with RLS',
38
+ '',
39
+ 'Generate a custom SQL migration that includes:',
40
+ '',
41
+ '```sql',
42
+ '-- For each table:',
43
+ 'ALTER TABLE table_name ENABLE ROW LEVEL SECURITY;',
44
+ '',
45
+ '-- Grant minimum required access per role:',
46
+ 'GRANT SELECT ON table_name TO anon;',
47
+ 'GRANT SELECT, INSERT, UPDATE, DELETE ON table_name TO authenticated;',
48
+ 'GRANT ALL ON table_name TO admin;',
49
+ '',
50
+ '-- Policies per access pattern:',
51
+ '-- Public read:',
52
+ 'CREATE POLICY "anon_select" ON table_name FOR SELECT TO anon USING (deleted_at IS NULL);',
53
+ '',
54
+ '-- Own rows only:',
55
+ 'CREATE POLICY "own_rows" ON table_name FOR ALL TO authenticated',
56
+ ' USING (user_id = current_setting(\'request.jwt.claims\', true)::json->>\'sub\');',
57
+ '',
58
+ '-- Admin full access:',
59
+ 'CREATE POLICY "admin_all" ON table_name FOR ALL TO admin USING (true);',
60
+ '```',
61
+ '',
62
+ 'Adapt the policies to the specific access patterns for each table.',
63
+ '',
64
+ '### 3. Handler Configuration',
65
+ '',
66
+ 'Generate the createHandler() config snippet:',
67
+ '- `exposedTables`: only tables that should be API-accessible',
68
+ '- `relations`: for embedding related data in API queries',
69
+ '- `rowOwnership`: for user-scoped tables',
70
+ '- `softDelete`: for tables with deletedAt columns',
71
+ '- `protectedFields`: fields users cannot set directly (role, deletedAt)',
72
+ '- `hiddenColumns`: sensitive columns not returned in API responses',
73
+ '',
74
+ '### 4. Testing Checklist',
75
+ '',
76
+ 'Generate a testing checklist:',
77
+ '- [ ] Anonymous users can read public data',
78
+ '- [ ] Anonymous users cannot write any data',
79
+ '- [ ] Authenticated users can only read/write their own data',
80
+ '- [ ] Soft-deleted rows are hidden from normal queries',
81
+ '- [ ] Admin users can access all data',
82
+ '- [ ] Foreign key constraints prevent orphaned rows',
83
+ '- [ ] RLS policies work with pgSettings claim injection',
84
+ '',
85
+ 'Test each RLS policy with:',
86
+ '```sql',
87
+ 'SET LOCAL ROLE authenticated;',
88
+ "SELECT set_config('request.jwt.claims', '{\"sub\": \"user-uuid\", \"role\": \"authenticated\"}', true);",
89
+ 'SELECT * FROM table_name; -- should only return own rows',
90
+ '```',
91
+ ].filter(Boolean).join('\n'),
92
+ },
93
+ },
94
+ ],
95
+ };
96
+ });
97
+ }
@@ -0,0 +1,9 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ /**
3
+ * `governance_setup` — guide the agent to wire the everystack governance hooks
4
+ * into the project's `.claude/settings.json`. The server instructions tell the
5
+ * agent that enforcement runs via hooks; this prompt produces the exact block and
6
+ * the confirm-first procedure.
7
+ */
8
+ export declare function registerGovernanceSetupPrompt(server: McpServer): void;
9
+ //# sourceMappingURL=governance-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governance-setup.d.ts","sourceRoot":"","sources":["../../src/prompts/governance-setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA2ErE"}
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * `governance_setup` — guide the agent to wire the everystack governance hooks
4
+ * into the project's `.claude/settings.json`. The server instructions tell the
5
+ * agent that enforcement runs via hooks; this prompt produces the exact block and
6
+ * the confirm-first procedure.
7
+ */
8
+ export function registerGovernanceSetupPrompt(server) {
9
+ server.prompt('governance_setup', 'Install the everystack governance hooks (grounding gate + cheat gates) into .claude/settings.json. The MCP server alone does not enforce — the hooks are the teeth.', {
10
+ projectPath: z.string().optional().describe('Absolute path to the project root'),
11
+ mode: z
12
+ .enum(['workspace', 'installed'])
13
+ .optional()
14
+ .describe('"workspace" (run from this monorepo via tsx) or "installed" (the published @everystack/mcp bin). Default: detect.'),
15
+ }, async ({ projectPath, mode }) => {
16
+ const cmd = mode === 'workspace'
17
+ ? 'npx tsx packages/mcp/src/index.ts'
18
+ : mode === 'installed'
19
+ ? 'everystack-mcp'
20
+ : 'everystack-mcp';
21
+ const hooks = {
22
+ hooks: {
23
+ SessionStart: [{ hooks: [{ type: 'command', command: `${cmd} context` }] }],
24
+ PreToolUse: [{ matcher: '*', hooks: [{ type: 'command', command: `${cmd} gate` }] }],
25
+ PostToolUse: [
26
+ { matcher: 'Read', hooks: [{ type: 'command', command: `${cmd} mark` }] },
27
+ { matcher: 'Write|Edit', hooks: [{ type: 'command', command: `${cmd} validate` }] },
28
+ ],
29
+ },
30
+ };
31
+ return {
32
+ messages: [
33
+ {
34
+ role: 'user',
35
+ content: {
36
+ type: 'text',
37
+ text: [
38
+ `Install the everystack governance hooks for ${projectPath ? 'the project at ' + projectPath : 'this project'}.`,
39
+ '',
40
+ '## Why',
41
+ '',
42
+ 'The everystack MCP server provides knowledge, but ENFORCEMENT (the grounding gate and',
43
+ 'cheat gates) runs only when these Claude Code hooks are installed. Without them, nothing',
44
+ 'catches off-script work (hand-written migrations, data bundled into the app, secrets behind',
45
+ 'EXPO_PUBLIC_*).',
46
+ '',
47
+ '## Procedure (confirm-first — never silent)',
48
+ '',
49
+ '1. Read `docs/governance-setup.md` and `hooks.example.json` from the @everystack/mcp package.',
50
+ `2. Check whether ${projectPath ? projectPath + '/.claude/settings.json' : '.claude/settings.json'} already has these hooks (commands calling \`${cmd} gate\`).`,
51
+ '3. If absent, show the human the exact block below and confirm the command form before writing:',
52
+ ' - **Workspace (this monorepo):** `npx tsx packages/mcp/src/index.ts <sub>`',
53
+ ' - **Installed package:** `everystack-mcp <sub>` (install `@everystack/mcp`; in a hook prefer',
54
+ ' `pnpm exec everystack-mcp <sub>` over bare `npx`, which re-resolves on every tool call).',
55
+ '4. Merge the `hooks` block into `.claude/settings.json` (preserve any existing `hooks`/`permissions`).',
56
+ '5. Remind the human: hooks run a shell command on every tool call. This is a deliberate,',
57
+ ' security-relevant change — it is their call, not yours to make silently.',
58
+ '',
59
+ '## The block to merge',
60
+ '',
61
+ '```json',
62
+ JSON.stringify(hooks, null, 2),
63
+ '```',
64
+ '',
65
+ '## After install',
66
+ '',
67
+ '- A fresh session denies every non-Read tool until the project contract (CLAUDE.md + its',
68
+ ' REQUIRED-READS) is read. That is the grounding gate working.',
69
+ '- `everystack-mcp report` summarizes what the agent tried (the telemetry sensor).',
70
+ ].join('\n'),
71
+ },
72
+ },
73
+ ],
74
+ };
75
+ });
76
+ }
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerPrompts(server: McpServer): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAWzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAUvD"}
@@ -0,0 +1,20 @@
1
+ import { registerNewAppPrompt } from './new-app.js';
2
+ import { registerAddFeaturePrompt } from './add-feature.js';
3
+ import { registerDesignSchemaPrompt } from './design-schema.js';
4
+ import { registerDeployPrompt } from './deploy.js';
5
+ import { registerDebugPrompt } from './debug.js';
6
+ import { registerSecurePrompt } from './secure.js';
7
+ import { registerGovernanceSetupPrompt } from './governance-setup.js';
8
+ import { registerClaudeMdPrompt } from './claude-md.js';
9
+ import { registerRunbookPrompt } from './runbook.js';
10
+ export function registerPrompts(server) {
11
+ registerNewAppPrompt(server);
12
+ registerAddFeaturePrompt(server);
13
+ registerDesignSchemaPrompt(server);
14
+ registerDeployPrompt(server);
15
+ registerDebugPrompt(server);
16
+ registerSecurePrompt(server);
17
+ registerGovernanceSetupPrompt(server);
18
+ registerClaudeMdPrompt(server);
19
+ registerRunbookPrompt(server);
20
+ }
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerNewAppPrompt(server: McpServer): void;
3
+ //# sourceMappingURL=new-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-app.d.ts","sourceRoot":"","sources":["../../src/prompts/new-app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAkN5D"}