k0ntext 3.0.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 (239) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +623 -0
  3. package/bin/k0ntext.js +12 -0
  4. package/dist/agents/cleanup-agent.d.ts +39 -0
  5. package/dist/agents/cleanup-agent.d.ts.map +1 -0
  6. package/dist/agents/cleanup-agent.js +56 -0
  7. package/dist/agents/cleanup-agent.js.map +1 -0
  8. package/dist/agents/performance-agent.d.ts +37 -0
  9. package/dist/agents/performance-agent.d.ts.map +1 -0
  10. package/dist/agents/performance-agent.js +91 -0
  11. package/dist/agents/performance-agent.js.map +1 -0
  12. package/dist/analyzer/index.d.ts +5 -0
  13. package/dist/analyzer/index.d.ts.map +1 -0
  14. package/dist/analyzer/index.js +5 -0
  15. package/dist/analyzer/index.js.map +1 -0
  16. package/dist/analyzer/intelligent-analyzer.d.ts +111 -0
  17. package/dist/analyzer/intelligent-analyzer.d.ts.map +1 -0
  18. package/dist/analyzer/intelligent-analyzer.js +537 -0
  19. package/dist/analyzer/intelligent-analyzer.js.map +1 -0
  20. package/dist/cli/commands/cleanup.d.ts +3 -0
  21. package/dist/cli/commands/cleanup.d.ts.map +1 -0
  22. package/dist/cli/commands/cleanup.js +24 -0
  23. package/dist/cli/commands/cleanup.js.map +1 -0
  24. package/dist/cli/commands/export.d.ts +9 -0
  25. package/dist/cli/commands/export.d.ts.map +1 -0
  26. package/dist/cli/commands/export.js +72 -0
  27. package/dist/cli/commands/export.js.map +1 -0
  28. package/dist/cli/commands/import.d.ts +9 -0
  29. package/dist/cli/commands/import.d.ts.map +1 -0
  30. package/dist/cli/commands/import.js +62 -0
  31. package/dist/cli/commands/import.js.map +1 -0
  32. package/dist/cli/commands/performance.d.ts +9 -0
  33. package/dist/cli/commands/performance.d.ts.map +1 -0
  34. package/dist/cli/commands/performance.js +36 -0
  35. package/dist/cli/commands/performance.js.map +1 -0
  36. package/dist/cli/commands/validate.d.ts +9 -0
  37. package/dist/cli/commands/validate.d.ts.map +1 -0
  38. package/dist/cli/commands/validate.js +82 -0
  39. package/dist/cli/commands/validate.js.map +1 -0
  40. package/dist/cli/commands/watch.d.ts +9 -0
  41. package/dist/cli/commands/watch.d.ts.map +1 -0
  42. package/dist/cli/commands/watch.js +72 -0
  43. package/dist/cli/commands/watch.js.map +1 -0
  44. package/dist/cli/generate.d.ts +3 -0
  45. package/dist/cli/generate.d.ts.map +1 -0
  46. package/dist/cli/generate.js +194 -0
  47. package/dist/cli/generate.js.map +1 -0
  48. package/dist/cli/index.d.ts +9 -0
  49. package/dist/cli/index.d.ts.map +1 -0
  50. package/dist/cli/index.js +448 -0
  51. package/dist/cli/index.js.map +1 -0
  52. package/dist/cli/sync.d.ts +26 -0
  53. package/dist/cli/sync.d.ts.map +1 -0
  54. package/dist/cli/sync.js +163 -0
  55. package/dist/cli/sync.js.map +1 -0
  56. package/dist/config/cleanup-config.d.ts +26 -0
  57. package/dist/config/cleanup-config.d.ts.map +1 -0
  58. package/dist/config/cleanup-config.js +21 -0
  59. package/dist/config/cleanup-config.js.map +1 -0
  60. package/dist/db/client.d.ts +284 -0
  61. package/dist/db/client.d.ts.map +1 -0
  62. package/dist/db/client.js +688 -0
  63. package/dist/db/client.js.map +1 -0
  64. package/dist/db/index.d.ts +6 -0
  65. package/dist/db/index.d.ts.map +1 -0
  66. package/dist/db/index.js +6 -0
  67. package/dist/db/index.js.map +1 -0
  68. package/dist/db/schema.d.ts +41 -0
  69. package/dist/db/schema.d.ts.map +1 -0
  70. package/dist/db/schema.js +226 -0
  71. package/dist/db/schema.js.map +1 -0
  72. package/dist/embeddings/index.d.ts +5 -0
  73. package/dist/embeddings/index.d.ts.map +1 -0
  74. package/dist/embeddings/index.js +5 -0
  75. package/dist/embeddings/index.js.map +1 -0
  76. package/dist/embeddings/openrouter.d.ts +133 -0
  77. package/dist/embeddings/openrouter.d.ts.map +1 -0
  78. package/dist/embeddings/openrouter.js +455 -0
  79. package/dist/embeddings/openrouter.js.map +1 -0
  80. package/dist/index.d.ts +14 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/index.js +18 -0
  83. package/dist/index.js.map +1 -0
  84. package/dist/mcp.d.ts +29 -0
  85. package/dist/mcp.d.ts.map +1 -0
  86. package/dist/mcp.js +257 -0
  87. package/dist/mcp.js.map +1 -0
  88. package/docs/ARCHIVE/MIGRATE_TO_NEW_REPO.md +222 -0
  89. package/docs/ARCHIVE/MIGRATE_TO_UNIFIED.md +220 -0
  90. package/docs/CLEANUP.md +76 -0
  91. package/docs/MCP_QUICKSTART.md +219 -0
  92. package/docs/QUICKSTART.md +119 -0
  93. package/docs/TROUBLESHOOTING.md +611 -0
  94. package/package.json +100 -0
  95. package/skills/context-optimize/SKILL.md +86 -0
  96. package/skills/implement/SKILL.md +150 -0
  97. package/skills/plan/SKILL.md +143 -0
  98. package/skills/research/SKILL.md +103 -0
  99. package/skills/validate/SKILL.md +62 -0
  100. package/skills/verify-docs/SKILL.md +77 -0
  101. package/src/agents/cleanup-agent.ts +96 -0
  102. package/src/agents/performance-agent.ts +117 -0
  103. package/src/analyzer/index.ts +10 -0
  104. package/src/analyzer/intelligent-analyzer.ts +640 -0
  105. package/src/cli/commands/cleanup.ts +26 -0
  106. package/src/cli/commands/export.ts +82 -0
  107. package/src/cli/commands/import.ts +73 -0
  108. package/src/cli/commands/performance.ts +40 -0
  109. package/src/cli/commands/validate.ts +98 -0
  110. package/src/cli/commands/watch.ts +83 -0
  111. package/src/cli/generate.ts +219 -0
  112. package/src/cli/index.ts +510 -0
  113. package/src/cli/sync.ts +194 -0
  114. package/src/config/cleanup-config.ts +42 -0
  115. package/src/db/client.ts +949 -0
  116. package/src/db/index.ts +19 -0
  117. package/src/db/schema.ts +241 -0
  118. package/src/embeddings/index.ts +11 -0
  119. package/src/embeddings/openrouter.ts +592 -0
  120. package/src/index.ts +57 -0
  121. package/src/mcp.ts +354 -0
  122. package/templates/AI_CONTEXT.md.template +245 -0
  123. package/templates/base/README.md +260 -0
  124. package/templates/base/RPI_WORKFLOW_PLAN.md +325 -0
  125. package/templates/base/agents/api-developer.md +76 -0
  126. package/templates/base/agents/context-engineer.md +525 -0
  127. package/templates/base/agents/core-architect.md +76 -0
  128. package/templates/base/agents/database-ops.md +76 -0
  129. package/templates/base/agents/deployment-ops.md +76 -0
  130. package/templates/base/agents/integration-hub.md +76 -0
  131. package/templates/base/analytics/README.md +114 -0
  132. package/templates/base/automation/config.json +58 -0
  133. package/templates/base/automation/generators/code-mapper.js +308 -0
  134. package/templates/base/automation/generators/index-builder.js +321 -0
  135. package/templates/base/automation/hooks/post-commit.sh +83 -0
  136. package/templates/base/automation/hooks/pre-commit.sh +103 -0
  137. package/templates/base/ci-templates/README.md +108 -0
  138. package/templates/base/ci-templates/github-actions/context-check.yml +144 -0
  139. package/templates/base/ci-templates/github-actions/validate-docs.yml +105 -0
  140. package/templates/base/commands/analytics.md +238 -0
  141. package/templates/base/commands/auto-sync.md +172 -0
  142. package/templates/base/commands/collab.md +194 -0
  143. package/templates/base/commands/context-optimize.md +226 -0
  144. package/templates/base/commands/help.md +485 -0
  145. package/templates/base/commands/rpi-implement.md +164 -0
  146. package/templates/base/commands/rpi-plan.md +147 -0
  147. package/templates/base/commands/rpi-research.md +145 -0
  148. package/templates/base/commands/session-resume.md +144 -0
  149. package/templates/base/commands/session-save.md +112 -0
  150. package/templates/base/commands/validate-all.md +77 -0
  151. package/templates/base/commands/verify-docs-current.md +86 -0
  152. package/templates/base/config/base.json +57 -0
  153. package/templates/base/config/environments/development.json +13 -0
  154. package/templates/base/config/environments/production.json +17 -0
  155. package/templates/base/config/environments/staging.json +13 -0
  156. package/templates/base/config/local.json.example +21 -0
  157. package/templates/base/context/.meta/generated-at.json +18 -0
  158. package/templates/base/context/ARCHITECTURE_SNAPSHOT.md +156 -0
  159. package/templates/base/context/CODE_TO_WORKFLOW_MAP.md +94 -0
  160. package/templates/base/context/FILE_OWNERSHIP.md +57 -0
  161. package/templates/base/context/INTEGRATION_POINTS.md +92 -0
  162. package/templates/base/context/KNOWN_GOTCHAS.md +195 -0
  163. package/templates/base/context/TESTING_MAP.md +95 -0
  164. package/templates/base/context/WORKFLOW_INDEX.md +129 -0
  165. package/templates/base/context/workflows/WORKFLOW_TEMPLATE.md +294 -0
  166. package/templates/base/indexes/agents/CAPABILITY_MATRIX.md +255 -0
  167. package/templates/base/indexes/agents/CATEGORY_INDEX.md +44 -0
  168. package/templates/base/indexes/code/CATEGORY_INDEX.md +38 -0
  169. package/templates/base/indexes/routing/CATEGORY_INDEX.md +39 -0
  170. package/templates/base/indexes/search/CATEGORY_INDEX.md +39 -0
  171. package/templates/base/indexes/workflows/CATEGORY_INDEX.md +38 -0
  172. package/templates/base/knowledge/README.md +98 -0
  173. package/templates/base/knowledge/sessions/README.md +88 -0
  174. package/templates/base/knowledge/sessions/TEMPLATE.md +150 -0
  175. package/templates/base/knowledge/shared/decisions/0001-adopt-context-engineering.md +144 -0
  176. package/templates/base/knowledge/shared/decisions/README.md +49 -0
  177. package/templates/base/knowledge/shared/decisions/TEMPLATE.md +123 -0
  178. package/templates/base/knowledge/shared/patterns/README.md +62 -0
  179. package/templates/base/knowledge/shared/patterns/TEMPLATE.md +120 -0
  180. package/templates/base/plans/PLAN_TEMPLATE.md +316 -0
  181. package/templates/base/plans/active/.gitkeep +0 -0
  182. package/templates/base/plans/completed/.gitkeep +0 -0
  183. package/templates/base/research/RESEARCH_TEMPLATE.md +245 -0
  184. package/templates/base/research/active/.gitkeep +0 -0
  185. package/templates/base/research/completed/.gitkeep +0 -0
  186. package/templates/base/schemas/agent.schema.json +141 -0
  187. package/templates/base/schemas/anchors.schema.json +54 -0
  188. package/templates/base/schemas/automation.schema.json +93 -0
  189. package/templates/base/schemas/command.schema.json +134 -0
  190. package/templates/base/schemas/hashes.schema.json +40 -0
  191. package/templates/base/schemas/manifest.schema.json +117 -0
  192. package/templates/base/schemas/plan.schema.json +136 -0
  193. package/templates/base/schemas/research.schema.json +115 -0
  194. package/templates/base/schemas/roles.schema.json +34 -0
  195. package/templates/base/schemas/session.schema.json +77 -0
  196. package/templates/base/schemas/settings.schema.json +244 -0
  197. package/templates/base/schemas/staleness.schema.json +53 -0
  198. package/templates/base/schemas/team-config.schema.json +42 -0
  199. package/templates/base/schemas/workflow.schema.json +126 -0
  200. package/templates/base/session/checkpoints/.gitkeep +2 -0
  201. package/templates/base/session/current/state.json +20 -0
  202. package/templates/base/session/history/.gitkeep +2 -0
  203. package/templates/base/settings.json +3 -0
  204. package/templates/base/standards/COMPATIBILITY.md +219 -0
  205. package/templates/base/standards/EXTENSION_GUIDELINES.md +280 -0
  206. package/templates/base/standards/QUALITY_CHECKLIST.md +211 -0
  207. package/templates/base/standards/README.md +66 -0
  208. package/templates/base/sync/anchors.json +6 -0
  209. package/templates/base/sync/hashes.json +6 -0
  210. package/templates/base/sync/staleness.json +10 -0
  211. package/templates/base/team/README.md +168 -0
  212. package/templates/base/team/config.json +79 -0
  213. package/templates/base/team/roles.json +145 -0
  214. package/templates/base/tools/bin/claude-context.js +151 -0
  215. package/templates/base/tools/lib/anchor-resolver.js +276 -0
  216. package/templates/base/tools/lib/config-loader.js +363 -0
  217. package/templates/base/tools/lib/detector.js +350 -0
  218. package/templates/base/tools/lib/diagnose.js +206 -0
  219. package/templates/base/tools/lib/drift-detector.js +373 -0
  220. package/templates/base/tools/lib/errors.js +199 -0
  221. package/templates/base/tools/lib/index.js +36 -0
  222. package/templates/base/tools/lib/init.js +192 -0
  223. package/templates/base/tools/lib/logger.js +230 -0
  224. package/templates/base/tools/lib/placeholder.js +201 -0
  225. package/templates/base/tools/lib/session-manager.js +354 -0
  226. package/templates/base/tools/lib/validate.js +521 -0
  227. package/templates/base/tools/package.json +49 -0
  228. package/templates/handlebars/aider-config.hbs +146 -0
  229. package/templates/handlebars/antigravity.hbs +377 -0
  230. package/templates/handlebars/claude.hbs +183 -0
  231. package/templates/handlebars/cline.hbs +62 -0
  232. package/templates/handlebars/continue-config.hbs +116 -0
  233. package/templates/handlebars/copilot.hbs +130 -0
  234. package/templates/handlebars/partials/gotcha-list.hbs +11 -0
  235. package/templates/handlebars/partials/header.hbs +3 -0
  236. package/templates/handlebars/partials/workflow-summary.hbs +16 -0
  237. package/templates/handlebars/windsurf-rules.hbs +69 -0
  238. package/templates/hooks/post-commit.hbs +28 -0
  239. package/templates/hooks/pre-commit.hbs +46 -0
@@ -0,0 +1,116 @@
1
+ {{!-- Continue Configuration Template --}}
2
+ {
3
+ "$schema": "https://continue.dev/schema.json",
4
+ "projectTitle": "{{project.name}}",
5
+ "description": "{{project.description}}",
6
+ "techstack": "{{join project.tech_stack ", "}}",
7
+
8
+ "context": {
9
+ "providers": [
10
+ {
11
+ "name": "codebase",
12
+ "description": "Project codebase context"
13
+ }
14
+ ],
15
+ "rules": [
16
+ {
17
+ "description": "Project Communication Style",
18
+ "type": "markdown",
19
+ "content": "<communication>\n- Speak to me in a professional, technical manner\n- Provide clear explanations for code changes\n- Reference specific files and line numbers when discussing changes\n- Ask clarifying questions when requirements are ambiguous\n</communication>"
20
+ },
21
+ {
22
+ "description": "Filesystem Rules",
23
+ "type": "markdown",
24
+ "content": "<filesystem>\n{{#if key_files.entry_points}}- Key project files: {{join key_files.entry_points ", "}}\n{{/if}}- Models directory: {{#each architecture.layers}}{{#if (ifEquals name 'models')}}{{path}}{{/if}}{{/each}}\n- Migrations directory: {{#each architecture.layers}}{{#if (ifEquals name 'migrations')}}{{path}}{{/if}}{{/each}}\n- Treat node_modules, build, dist as read-only\n</filesystem>"
25
+ },
26
+ {
27
+ "description": "Coding Guidelines",
28
+ "type": "markdown",
29
+ "content": "<coding>\n- Primary language: {{project.primary_language}}\n- Framework: {{#each architecture.layers}}{{#if (ifEquals name 'framework')}}{{name}}{{/if}}{{/each}}\n- Testing framework: jest\n- Follow existing code style and patterns\n- Add type hints/annotations for all functions\n- Write tests for new functionality (target: 80% coverage)\n- Use early returns when possible\n- Avoid deep nesting (>4 levels)\n- Keep functions focused and small (<50 lines)\n</coding>"
30
+ },
31
+ {
32
+ "description": "Commands",
33
+ "type": "table",
34
+ "content": "| Command | Purpose |\n|---------|---------|\n| {{commands.install}} | Install dependencies |\n| {{commands.dev}} | Start development server |\n| {{commands.test}} | Run tests |\n| {{commands.build}} | Build for production |"
35
+ },
36
+ {
37
+ "description": "Architecture",
38
+ "type": "markdown",
39
+ "content": "<architecture>\n{{project.description}}\n\nKey patterns:\n- {{architecture.pattern}}\n{{#each architecture.layers}}\n- {{name}}: {{purpose}}\n{{/each}}\n</architecture>"
40
+ }
41
+ ]
42
+ },
43
+
44
+ "slashCommands": [
45
+ {
46
+ "name": "test",
47
+ "description": "Run tests",
48
+ "run": "{{commands.test}}"
49
+ },
50
+ {
51
+ "name": "build",
52
+ "description": "Build project",
53
+ "run": "{{commands.build}}"
54
+ },
55
+ {
56
+ "name": "dev",
57
+ "description": "Start development server",
58
+ "run": "{{commands.dev}}"
59
+ }
60
+ ],
61
+
62
+ "models": [
63
+ {
64
+ "title": "GPT-4",
65
+ "provider": "openai",
66
+ "model": "gpt-4"
67
+ },
68
+ {
69
+ "title": "Claude 3 Opus",
70
+ "provider": "anthropic",
71
+ "model": "claude-3-opus-20240229"
72
+ }
73
+ ],
74
+
75
+ "tabAutocompleteModel": {
76
+ "title": "DeepSeek V2",
77
+ "provider": "deepseek",
78
+ "model": "deepseek-coder"
79
+ },
80
+
81
+ "customCommands": [
82
+ {
83
+ "name": "explain",
84
+ "prompt": "Explain the selected code in detail, including its purpose and how it works."
85
+ },
86
+ {
87
+ "name": "refactor",
88
+ "prompt": "Refactor the selected code to improve readability and maintainability."
89
+ },
90
+ {
91
+ "name": "docs",
92
+ "prompt": "Generate JSDoc/TypeDoc documentation for the selected code."
93
+ }
94
+ ],
95
+
96
+ "allowYaml": true,
97
+
98
+ "maxContextTokens": 8000,
99
+
100
+ "temperature": 0.2,
101
+
102
+ "regexDenylist": [
103
+ ".*\\.min\\.js",
104
+ ".*\\.min\\.css",
105
+ "node_modules/.*",
106
+ "build/.*",
107
+ "dist/.*"
108
+ ],
109
+
110
+ "_comment": "Generated by create-universal-ai-context v{{metadata.generator_version}}",
111
+ "_generatedAt": "{{metadata.timestamp}}",
112
+ "_toolCoordination": {
113
+ "universalContext": ".ai-context/",
114
+ "regenerateCommand": "npx create-ai-context generate --ai continue"
115
+ }
116
+ }
@@ -0,0 +1,130 @@
1
+ {{!-- GitHub Copilot Instructions Template --}}
2
+ {{> header}}
3
+
4
+ # {{project.name}} - Copilot Instructions
5
+
6
+ ## Project Identity
7
+
8
+ - **Name:** {{project.name}}
9
+ - **Description:** {{project.description}}
10
+ - **Tech Stack:** {{join project.tech_stack ", "}}
11
+ - **Primary Language:** {{project.primary_language}}
12
+
13
+ ---
14
+
15
+ ## Architecture
16
+
17
+ **Pattern:** {{architecture.pattern}}
18
+
19
+ {{#if architecture.layers}}
20
+ **Layers:**
21
+ {{#each architecture.layers}}
22
+ - `{{path}}` - {{purpose}}
23
+ {{/each}}
24
+ {{/if}}
25
+
26
+ ---
27
+
28
+ ## Key Files
29
+
30
+ {{#if key_files.entry_points}}
31
+ ### Entry Points
32
+ {{#each key_files.entry_points}}
33
+ - `{{this}}`
34
+ {{/each}}
35
+ {{/if}}
36
+
37
+ {{#if key_files.api_routes}}
38
+ ### API Routes
39
+ {{#each key_files.api_routes}}
40
+ - `{{this}}`
41
+ {{/each}}
42
+ {{/if}}
43
+
44
+ {{#if key_files.config}}
45
+ ### Configuration
46
+ {{#each key_files.config}}
47
+ - `{{this}}`
48
+ {{/each}}
49
+ {{/if}}
50
+
51
+ ---
52
+
53
+ ## Commands
54
+
55
+ | Command | Script |
56
+ |---------|--------|
57
+ {{#each commands}}
58
+ | {{@key}} | `{{this}}` |
59
+ {{/each}}
60
+
61
+ ---
62
+
63
+ {{#if workflows}}
64
+ ## Relevant Workflows
65
+
66
+ {{#each workflows}}
67
+ ### {{name}}
68
+
69
+ **Category:** {{category}} | **Complexity:** {{complexity}}
70
+
71
+ {{description}}
72
+
73
+ {{#if entry_points}}
74
+ **Entry Points:**
75
+ {{#each entry_points}}
76
+ - `{{endpoint}}` - {{file}}:{{line}}
77
+ {{/each}}
78
+ {{/if}}
79
+
80
+ {{/each}}
81
+ {{/if}}
82
+
83
+ ---
84
+
85
+ {{#if gotchas}}
86
+ ## Critical Gotchas
87
+
88
+ {{#each gotchas}}
89
+ ### {{id}}: {{title}}
90
+
91
+ **Severity:** {{severity}}
92
+
93
+ {{symptom}}
94
+
95
+ **Fix:** {{fix}}
96
+
97
+ {{/each}}
98
+ {{/if}}
99
+
100
+ ---
101
+
102
+ {{#if critical_constraints}}
103
+ ## Critical Constraints
104
+
105
+ {{#each critical_constraints}}
106
+ - {{this}}
107
+ {{/each}}
108
+ {{/if}}
109
+
110
+ ---
111
+
112
+ {{#if environment.required}}
113
+ ## Environment Variables
114
+
115
+ **Required:**
116
+ {{#each environment.required}}
117
+ - `{{this}}`
118
+ {{/each}}
119
+
120
+ {{#if environment.optional}}
121
+ **Optional:**
122
+ {{#each environment.optional}}
123
+ - `{{this}}`
124
+ {{/each}}
125
+ {{/if}}
126
+ {{/if}}
127
+
128
+ ---
129
+
130
+ {{{coordination.footer}}}
@@ -0,0 +1,11 @@
1
+ {{!-- Reusable gotcha list partial --}}
2
+ {{#each gotchas}}
3
+ ### {{id}}: {{title}}
4
+
5
+ **Severity:** {{severity}}
6
+
7
+ {{symptom}}
8
+
9
+ **Fix:** {{truncate fix 100}}
10
+
11
+ {{/each}}
@@ -0,0 +1,3 @@
1
+ {{!-- Reusable header partial with tool coordination --}}
2
+ {{{metadata.header}}}
3
+ <!-- Generated: {{metadata.timestamp}} | Version: {{metadata.generator_version}} -->
@@ -0,0 +1,16 @@
1
+ {{!-- Reusable workflow summary partial --}}
2
+ {{#each workflows}}
3
+ ### {{name}}
4
+
5
+ **Category:** {{category}} | **Complexity:** {{complexity}}
6
+
7
+ {{description}}
8
+
9
+ {{#if entry_points}}
10
+ **Key Entry Points:**
11
+ {{#each (first entry_points 5)}}
12
+ - `{{endpoint}}` - {{file}}:{{line}}
13
+ {{/each}}
14
+ {{/if}}
15
+
16
+ {{/each}}
@@ -0,0 +1,69 @@
1
+ {{!-- Windsurf Cascade Rules Template --}}
2
+ # {{project.name}} - Windsurf Cascade Rules
3
+
4
+ **Tech Stack:** {{join project.tech_stack ", "}}
5
+ **Status:** Active
6
+
7
+ <communication>
8
+ - Speak to me in a professional, technical manner
9
+ - Provide clear explanations for code changes
10
+ - Reference specific files and line numbers when discussing changes
11
+ - Ask clarifying questions when requirements are ambiguous
12
+ </communication>
13
+
14
+ <filesystem>
15
+ {{#if key_files.entry_points}}
16
+ - Key project files: {{join key_files.entry_points ", "}}
17
+ {{/if}}
18
+ - Models directory: {{#each architecture.layers}}{{#if (ifEquals name 'models')}}{{path}}{{/if}}{{/each}}
19
+ - Migrations directory: {{#each architecture.layers}}{{#if (ifEquals name 'migrations')}}{{path}}{{/if}}{{/each}}
20
+ - Treat node_modules, build, dist as read-only
21
+ </filesystem>
22
+
23
+ <coding>
24
+ - Primary language: {{project.primary_language}}
25
+ - Framework: {{#each architecture.layers}}{{#if (ifEquals name 'framework')}}{{name}}{{/if}}{{/each}}
26
+ - Testing framework: jest
27
+ - Follow existing code style and patterns
28
+ - Add type hints/annotations for all functions
29
+ - Write tests for new functionality (target: 80% coverage)
30
+ - Use early returns when possible
31
+ - Avoid deep nesting (>4 levels)
32
+ - Keep functions focused and small (<50 lines)
33
+ </coding>
34
+
35
+ <commands>
36
+ | Command | Purpose |
37
+ |---------|---------|
38
+ | {{commands.install}} | Install dependencies |
39
+ | {{commands.dev}} | Start development server |
40
+ | {{commands.test}} | Run tests |
41
+ | {{commands.build}} | Build for production |
42
+ </commands>
43
+
44
+ <architecture>
45
+ {{project.description}}
46
+
47
+ Key patterns:
48
+ - {{architecture.pattern}}
49
+ {{#each architecture.layers}}
50
+ - {{name}}: {{purpose}}
51
+ {{/each}}
52
+ </architecture>
53
+
54
+ <testing>
55
+ - Write tests before implementing features
56
+ - Use jest for mocking
57
+ - Test edge cases and error conditions
58
+ - Keep tests independent and fast
59
+ </testing>
60
+
61
+ <security>
62
+ - Never commit secrets or API keys
63
+ - Validate all user inputs
64
+ - Use parameterized queries to prevent injection
65
+ - Follow OWASP security guidelines
66
+ </security>
67
+
68
+ ---
69
+ {{{coordination.footer}}}
@@ -0,0 +1,28 @@
1
+ #!/bin/bash
2
+ # Post-commit hook for AI context sync
3
+ # This hook updates sync state after successful commits
4
+ # Does NOT regenerate files to avoid creating uncommitted changes
5
+
6
+ # Don't block commit if this fails
7
+ set +e
8
+
9
+ # Check if k0ntext binary is available
10
+ if ! command -v create-k0ntext &> /dev/null; then
11
+ # Try npx
12
+ if command -v npx &> /dev/null; then
13
+ K0NTEXT_CMD="npx create-universal-k0ntext"
14
+ else
15
+ exit 0
16
+ fi
17
+ else
18
+ K0NTEXT_CMD="create-k0ntext"
19
+ fi
20
+
21
+ # Update sync state only (no file regeneration to avoid creating uncommitted changes)
22
+ # Use sync:state instead of sync:all to prevent the revision loop bug
23
+ (
24
+ sleep 1 # Wait a bit to not interfere with commit
25
+ $AI_CONTEXT_CMD sync:state --quiet > /dev/null 2>&1
26
+ ) &
27
+
28
+ exit 0
@@ -0,0 +1,46 @@
1
+ #!/bin/bash
2
+ # Pre-commit hook for AI context sync
3
+ # This hook checks if AI tool contexts are out of sync
4
+
5
+ set -e
6
+
7
+ # Colors for output
8
+ RED='\033[0;31m'
9
+ YELLOW='\033[1;33m'
10
+ GREEN='\033[0;32m'
11
+ NC='\033[0m' # No Color
12
+
13
+ # Check if k0ntext binary is available
14
+ if ! command -v create-k0ntext &> /dev/null; then
15
+ # Try npx
16
+ if command -v npx &> /dev/null; then
17
+ K0NTEXT_CMD="npx create-universal-k0ntext"
18
+ else
19
+ echo -e "${YELLOW}Warning: create-k0ntext not found. Skipping sync check.${NC}"
20
+ exit 0
21
+ fi
22
+ else
23
+ K0NTEXT_CMD="create-k0ntext"
24
+ fi
25
+
26
+ # Run sync check
27
+ echo -e "${GREEN}Checking AI context sync status...${NC}"
28
+
29
+ # Check for out-of-sync contexts
30
+ CHECK_OUTPUT=$($K0NTEXT_CMD sync:check 2>&1)
31
+ CHECK_EXIT_CODE=$?
32
+
33
+ if [ $CHECK_EXIT_CODE -ne 0 ]; then
34
+ echo -e "${RED}AI contexts are out of sync!${NC}"
35
+ echo ""
36
+ echo "$CHECK_OUTPUT"
37
+ echo ""
38
+ echo -e "${YELLOW}To sync all contexts, run:${NC}"
39
+ echo " $K0NTEXT_CMD sync:all"
40
+ echo ""
41
+ echo -e "${YELLOW}To skip this check, use: git commit --no-verify${NC}"
42
+ exit 1
43
+ fi
44
+
45
+ echo -e "${GREEN}AI contexts are in sync${NC}"
46
+ exit 0