create-universal-ai-context 2.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 (136) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +171 -0
  3. package/bin/create-ai-context.js +337 -0
  4. package/lib/adapters/antigravity.js +160 -0
  5. package/lib/adapters/claude.js +122 -0
  6. package/lib/adapters/cline.js +111 -0
  7. package/lib/adapters/copilot.js +117 -0
  8. package/lib/adapters/index.js +69 -0
  9. package/lib/ai-context-generator.js +234 -0
  10. package/lib/ai-orchestrator.js +431 -0
  11. package/lib/call-tracer.js +444 -0
  12. package/lib/detector.js +726 -0
  13. package/lib/environment-detector.js +239 -0
  14. package/lib/index.js +310 -0
  15. package/lib/installer.js +418 -0
  16. package/lib/migrate.js +319 -0
  17. package/lib/placeholder.js +541 -0
  18. package/lib/prompts.js +287 -0
  19. package/lib/spinner.js +60 -0
  20. package/lib/static-analyzer.js +729 -0
  21. package/lib/template-populator.js +843 -0
  22. package/lib/template-renderer.js +382 -0
  23. package/lib/validate.js +155 -0
  24. package/package.json +70 -0
  25. package/templates/AI_CONTEXT.md.template +245 -0
  26. package/templates/base/README.md +257 -0
  27. package/templates/base/RPI_WORKFLOW_PLAN.md +320 -0
  28. package/templates/base/agents/api-developer.md +76 -0
  29. package/templates/base/agents/context-engineer.md +525 -0
  30. package/templates/base/agents/core-architect.md +76 -0
  31. package/templates/base/agents/database-ops.md +76 -0
  32. package/templates/base/agents/deployment-ops.md +76 -0
  33. package/templates/base/agents/integration-hub.md +76 -0
  34. package/templates/base/analytics/README.md +114 -0
  35. package/templates/base/automation/config.json +58 -0
  36. package/templates/base/automation/generators/code-mapper.js +308 -0
  37. package/templates/base/automation/generators/index-builder.js +321 -0
  38. package/templates/base/automation/hooks/post-commit.sh +83 -0
  39. package/templates/base/automation/hooks/pre-commit.sh +103 -0
  40. package/templates/base/ci-templates/README.md +108 -0
  41. package/templates/base/ci-templates/github-actions/context-check.yml +144 -0
  42. package/templates/base/ci-templates/github-actions/validate-docs.yml +105 -0
  43. package/templates/base/commands/analytics.md +238 -0
  44. package/templates/base/commands/auto-sync.md +172 -0
  45. package/templates/base/commands/collab.md +194 -0
  46. package/templates/base/commands/help.md +450 -0
  47. package/templates/base/commands/rpi-implement.md +115 -0
  48. package/templates/base/commands/rpi-plan.md +93 -0
  49. package/templates/base/commands/rpi-research.md +88 -0
  50. package/templates/base/commands/session-resume.md +144 -0
  51. package/templates/base/commands/session-save.md +112 -0
  52. package/templates/base/commands/validate-all.md +77 -0
  53. package/templates/base/commands/verify-docs-current.md +86 -0
  54. package/templates/base/config/base.json +57 -0
  55. package/templates/base/config/environments/development.json +13 -0
  56. package/templates/base/config/environments/production.json +17 -0
  57. package/templates/base/config/environments/staging.json +13 -0
  58. package/templates/base/config/local.json.example +21 -0
  59. package/templates/base/context/.meta/generated-at.json +18 -0
  60. package/templates/base/context/ARCHITECTURE_SNAPSHOT.md +156 -0
  61. package/templates/base/context/CODE_TO_WORKFLOW_MAP.md +94 -0
  62. package/templates/base/context/FILE_OWNERSHIP.md +57 -0
  63. package/templates/base/context/INTEGRATION_POINTS.md +92 -0
  64. package/templates/base/context/KNOWN_GOTCHAS.md +195 -0
  65. package/templates/base/context/TESTING_MAP.md +95 -0
  66. package/templates/base/context/WORKFLOW_INDEX.md +129 -0
  67. package/templates/base/context/workflows/WORKFLOW_TEMPLATE.md +294 -0
  68. package/templates/base/indexes/agents/CAPABILITY_MATRIX.md +255 -0
  69. package/templates/base/indexes/agents/CATEGORY_INDEX.md +44 -0
  70. package/templates/base/indexes/code/CATEGORY_INDEX.md +38 -0
  71. package/templates/base/indexes/routing/CATEGORY_INDEX.md +39 -0
  72. package/templates/base/indexes/search/CATEGORY_INDEX.md +39 -0
  73. package/templates/base/indexes/workflows/CATEGORY_INDEX.md +38 -0
  74. package/templates/base/knowledge/README.md +98 -0
  75. package/templates/base/knowledge/sessions/README.md +88 -0
  76. package/templates/base/knowledge/sessions/TEMPLATE.md +150 -0
  77. package/templates/base/knowledge/shared/decisions/0001-adopt-context-engineering.md +144 -0
  78. package/templates/base/knowledge/shared/decisions/README.md +49 -0
  79. package/templates/base/knowledge/shared/decisions/TEMPLATE.md +123 -0
  80. package/templates/base/knowledge/shared/patterns/README.md +62 -0
  81. package/templates/base/knowledge/shared/patterns/TEMPLATE.md +120 -0
  82. package/templates/base/plans/PLAN_TEMPLATE.md +250 -0
  83. package/templates/base/plans/active/.gitkeep +0 -0
  84. package/templates/base/plans/completed/.gitkeep +0 -0
  85. package/templates/base/research/RESEARCH_TEMPLATE.md +153 -0
  86. package/templates/base/research/active/.gitkeep +0 -0
  87. package/templates/base/research/completed/.gitkeep +0 -0
  88. package/templates/base/schemas/agent.schema.json +141 -0
  89. package/templates/base/schemas/anchors.schema.json +54 -0
  90. package/templates/base/schemas/automation.schema.json +93 -0
  91. package/templates/base/schemas/command.schema.json +134 -0
  92. package/templates/base/schemas/hashes.schema.json +40 -0
  93. package/templates/base/schemas/manifest.schema.json +117 -0
  94. package/templates/base/schemas/plan.schema.json +136 -0
  95. package/templates/base/schemas/research.schema.json +115 -0
  96. package/templates/base/schemas/roles.schema.json +34 -0
  97. package/templates/base/schemas/session.schema.json +77 -0
  98. package/templates/base/schemas/settings.schema.json +244 -0
  99. package/templates/base/schemas/staleness.schema.json +53 -0
  100. package/templates/base/schemas/team-config.schema.json +42 -0
  101. package/templates/base/schemas/workflow.schema.json +126 -0
  102. package/templates/base/session/checkpoints/.gitkeep +2 -0
  103. package/templates/base/session/current/state.json +20 -0
  104. package/templates/base/session/history/.gitkeep +2 -0
  105. package/templates/base/settings.json +3 -0
  106. package/templates/base/standards/COMPATIBILITY.md +219 -0
  107. package/templates/base/standards/EXTENSION_GUIDELINES.md +280 -0
  108. package/templates/base/standards/QUALITY_CHECKLIST.md +211 -0
  109. package/templates/base/standards/README.md +66 -0
  110. package/templates/base/sync/anchors.json +6 -0
  111. package/templates/base/sync/hashes.json +6 -0
  112. package/templates/base/sync/staleness.json +10 -0
  113. package/templates/base/team/README.md +168 -0
  114. package/templates/base/team/config.json +79 -0
  115. package/templates/base/team/roles.json +145 -0
  116. package/templates/base/tools/bin/claude-context.js +151 -0
  117. package/templates/base/tools/lib/anchor-resolver.js +276 -0
  118. package/templates/base/tools/lib/config-loader.js +363 -0
  119. package/templates/base/tools/lib/detector.js +350 -0
  120. package/templates/base/tools/lib/diagnose.js +206 -0
  121. package/templates/base/tools/lib/drift-detector.js +373 -0
  122. package/templates/base/tools/lib/errors.js +199 -0
  123. package/templates/base/tools/lib/index.js +36 -0
  124. package/templates/base/tools/lib/init.js +192 -0
  125. package/templates/base/tools/lib/logger.js +230 -0
  126. package/templates/base/tools/lib/placeholder.js +201 -0
  127. package/templates/base/tools/lib/session-manager.js +354 -0
  128. package/templates/base/tools/lib/validate.js +521 -0
  129. package/templates/base/tools/package.json +49 -0
  130. package/templates/handlebars/antigravity.hbs +337 -0
  131. package/templates/handlebars/claude.hbs +184 -0
  132. package/templates/handlebars/cline.hbs +63 -0
  133. package/templates/handlebars/copilot.hbs +131 -0
  134. package/templates/handlebars/partials/gotcha-list.hbs +11 -0
  135. package/templates/handlebars/partials/header.hbs +3 -0
  136. package/templates/handlebars/partials/workflow-summary.hbs +16 -0
@@ -0,0 +1,382 @@
1
+ /**
2
+ * AI Context Engineering - Template Renderer
3
+ *
4
+ * Handlebars-based template rendering engine for generating
5
+ * context files for multiple AI tools.
6
+ */
7
+
8
+ const Handlebars = require('handlebars');
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+
12
+ /**
13
+ * Templates directory
14
+ */
15
+ const TEMPLATES_DIR = path.join(__dirname, '..', 'templates', 'handlebars');
16
+
17
+ /**
18
+ * Multi-file markers for Antigravity templates
19
+ */
20
+ const FILE_START_MARKER = /\{\{\{fileStart\s+"([^"]+)"\}\}\}/g;
21
+ const FILE_END_MARKER = /\{\{\{fileEnd\}\}\}/g;
22
+
23
+ /**
24
+ * Register custom Handlebars helpers
25
+ */
26
+ function registerHelpers() {
27
+ // Join array with delimiter
28
+ Handlebars.registerHelper('join', function(array, delimiter) {
29
+ if (!Array.isArray(array)) return '';
30
+ return array.join(delimiter || ', ');
31
+ });
32
+
33
+ // Get first N items from array
34
+ Handlebars.registerHelper('first', function(array, n) {
35
+ if (!Array.isArray(array)) return [];
36
+ return array.slice(0, n);
37
+ });
38
+
39
+ // Get length of array
40
+ Handlebars.registerHelper('length', function(array) {
41
+ if (!Array.isArray(array)) return 0;
42
+ return array.length;
43
+ });
44
+
45
+ // Truncate string to max length
46
+ Handlebars.registerHelper('truncate', function(str, maxLength) {
47
+ if (typeof str !== 'string') return '';
48
+ if (str.length <= maxLength) return str;
49
+ return str.substring(0, maxLength) + '...';
50
+ });
51
+
52
+ // Slugify string for filenames
53
+ Handlebars.registerHelper('slugify', function(str) {
54
+ if (typeof str !== 'string') return '';
55
+ return str
56
+ .toLowerCase()
57
+ .replace(/[^a-z0-9]+/g, '-')
58
+ .replace(/^-|-$/g, '');
59
+ });
60
+
61
+ // Concat strings
62
+ Handlebars.registerHelper('concat', function(...args) {
63
+ // Remove the Handlebars options object from args
64
+ args.pop();
65
+ return args.join('');
66
+ });
67
+
68
+ // Uppercase string
69
+ Handlebars.registerHelper('uppercase', function(str) {
70
+ if (typeof str !== 'string') return '';
71
+ return str.toUpperCase();
72
+ });
73
+
74
+ // Lowercase string
75
+ Handlebars.registerHelper('lowercase', function(str) {
76
+ if (typeof str !== 'string') return '';
77
+ return str.toLowerCase();
78
+ });
79
+
80
+ // Check if equal
81
+ Handlebars.registerHelper('ifEquals', function(arg1, arg2, options) {
82
+ return (arg1 === arg2) ? options.fn(this) : options.inverse(this);
83
+ });
84
+
85
+ // Check if not equal
86
+ Handlebars.registerHelper('ifNotEquals', function(arg1, arg2, options) {
87
+ return (arg1 !== arg2) ? options.fn(this) : options.inverse(this);
88
+ });
89
+
90
+ // Date formatting
91
+ Handlebars.registerHelper('formatDate', function(date) {
92
+ if (!date) return new Date().toISOString();
93
+ return new Date(date).toISOString();
94
+ });
95
+
96
+ // File markers for multi-file templates (Antigravity)
97
+ Handlebars.registerHelper('fileStart', function(filename) {
98
+ return new Handlebars.SafeString(`<<<FILE_START:${filename}>>>`);
99
+ });
100
+
101
+ Handlebars.registerHelper('fileEnd', function() {
102
+ return new Handlebars.SafeString('<<<FILE_END>>>');
103
+ });
104
+ }
105
+
106
+ /**
107
+ * Register partials from the partials directory
108
+ * @param {string} partialsDir - Path to partials directory
109
+ */
110
+ function registerPartials(partialsDir) {
111
+ const defaultPartialsDir = partialsDir || path.join(TEMPLATES_DIR, 'partials');
112
+
113
+ if (!fs.existsSync(defaultPartialsDir)) {
114
+ return;
115
+ }
116
+
117
+ const files = fs.readdirSync(defaultPartialsDir)
118
+ .filter(f => f.endsWith('.hbs'));
119
+
120
+ for (const file of files) {
121
+ const name = path.basename(file, '.hbs');
122
+ const content = fs.readFileSync(path.join(defaultPartialsDir, file), 'utf-8');
123
+ Handlebars.registerPartial(name, content);
124
+ }
125
+ }
126
+
127
+ /**
128
+ * Initialize the template engine
129
+ */
130
+ function initialize() {
131
+ registerHelpers();
132
+ registerPartials();
133
+ }
134
+
135
+ /**
136
+ * Compile and render a template
137
+ * @param {string} templatePath - Path to the template file
138
+ * @param {object} context - Context data for rendering
139
+ * @returns {string} Rendered content
140
+ */
141
+ function renderTemplate(templatePath, context) {
142
+ if (!fs.existsSync(templatePath)) {
143
+ throw new Error(`Template not found: ${templatePath}`);
144
+ }
145
+
146
+ const source = fs.readFileSync(templatePath, 'utf-8');
147
+ const template = Handlebars.compile(source, { noEscape: false });
148
+ return template(context);
149
+ }
150
+
151
+ /**
152
+ * Render a template by name (looks in templates/handlebars/)
153
+ * @param {string} templateName - Template name (without .hbs extension)
154
+ * @param {object} context - Context data for rendering
155
+ * @returns {string} Rendered content
156
+ */
157
+ function renderTemplateByName(templateName, context) {
158
+ const templatePath = path.join(TEMPLATES_DIR, `${templateName}.hbs`);
159
+ return renderTemplate(templatePath, context);
160
+ }
161
+
162
+ /**
163
+ * Parse multi-file output from rendered template (for Antigravity)
164
+ * @param {string} rendered - Rendered template content with file markers
165
+ * @returns {object[]} Array of { filename, content } objects
166
+ */
167
+ function parseMultiFileOutput(rendered) {
168
+ const files = [];
169
+ const parts = rendered.split('<<<FILE_START:');
170
+
171
+ for (let i = 1; i < parts.length; i++) {
172
+ const part = parts[i];
173
+ const endMarkerIndex = part.indexOf('>>>');
174
+
175
+ if (endMarkerIndex === -1) continue;
176
+
177
+ const filename = part.substring(0, endMarkerIndex);
178
+ const rest = part.substring(endMarkerIndex + 3);
179
+
180
+ const fileEndIndex = rest.indexOf('<<<FILE_END>>>');
181
+ const content = fileEndIndex !== -1
182
+ ? rest.substring(0, fileEndIndex).trim()
183
+ : rest.trim();
184
+
185
+ files.push({ filename, content });
186
+ }
187
+
188
+ return files;
189
+ }
190
+
191
+ /**
192
+ * Render a multi-file template (for Antigravity)
193
+ * @param {string} templatePath - Path to the template file
194
+ * @param {object} context - Context data for rendering
195
+ * @returns {object[]} Array of { filename, content } objects
196
+ */
197
+ function renderMultiFileTemplate(templatePath, context) {
198
+ const rendered = renderTemplate(templatePath, context);
199
+ return parseMultiFileOutput(rendered);
200
+ }
201
+
202
+ /**
203
+ * Get available template names
204
+ * @returns {string[]} Array of template names
205
+ */
206
+ function getAvailableTemplates() {
207
+ if (!fs.existsSync(TEMPLATES_DIR)) {
208
+ return [];
209
+ }
210
+
211
+ return fs.readdirSync(TEMPLATES_DIR)
212
+ .filter(f => f.endsWith('.hbs') && !fs.statSync(path.join(TEMPLATES_DIR, f)).isDirectory())
213
+ .map(f => path.basename(f, '.hbs'));
214
+ }
215
+
216
+ /**
217
+ * Build default context from analysis results
218
+ * @param {object} analysis - Analysis results from static analyzer
219
+ * @param {object} config - Configuration from CLI
220
+ * @returns {object} Context object for templates
221
+ */
222
+ function buildContext(analysis, config) {
223
+ const projectName = config.projectName || 'project';
224
+ const techStack = analysis.techStack || config.techStack || {};
225
+
226
+ return {
227
+ // Project identity
228
+ project: {
229
+ name: projectName,
230
+ description: config.description || `${projectName} application`,
231
+ tech_stack: techStack.languages || [],
232
+ primary_language: techStack.languages?.[0] || 'unknown'
233
+ },
234
+
235
+ // Architecture (from analysis)
236
+ architecture: {
237
+ pattern: analysis.architecture?.pattern || 'layered',
238
+ layers: (analysis.architecture?.layers || []).map(l => ({
239
+ name: l.name,
240
+ path: l.directories?.[0] || l.name + '/',
241
+ purpose: l.purpose || l.name
242
+ }))
243
+ },
244
+
245
+ // Workflows (from analysis)
246
+ workflows: (analysis.workflows || []).map(wf => ({
247
+ name: wf.name,
248
+ category: wf.category || 'general',
249
+ complexity: wf.complexity || 'MEDIUM',
250
+ description: wf.description || `Handles ${wf.name} functionality`,
251
+ files: wf.files || [],
252
+ entry_points: (wf.entryPoints || []).map(ep => ({
253
+ endpoint: ep.route || ep.name || 'unknown',
254
+ file: ep.file,
255
+ line: ep.line,
256
+ method: ep.method || 'GET',
257
+ purpose: ep.purpose || 'Entry point'
258
+ }))
259
+ })),
260
+
261
+ // Gotchas (empty by default, filled by AI or manual)
262
+ gotchas: [],
263
+
264
+ // Key files (from analysis)
265
+ key_files: {
266
+ entry_points: (analysis.entryPoints || []).map(ep => ep.file),
267
+ api_routes: [],
268
+ config: [],
269
+ models: []
270
+ },
271
+
272
+ // Commands (from tech stack)
273
+ commands: {
274
+ install: techStack.commands?.install || 'npm install',
275
+ dev: techStack.commands?.dev || 'npm run dev',
276
+ test: techStack.commands?.test || 'npm test',
277
+ build: techStack.commands?.build || 'npm run build'
278
+ },
279
+
280
+ // Environment
281
+ environment: {
282
+ required: [],
283
+ optional: []
284
+ },
285
+
286
+ // Critical constraints
287
+ critical_constraints: [],
288
+
289
+ // Metadata
290
+ metadata: {
291
+ header: '<!-- Auto-generated by AI Context Engineering. Do not edit manually. -->',
292
+ timestamp: new Date().toISOString(),
293
+ generator_version: getPackageVersion(),
294
+ source_ref: projectName
295
+ },
296
+
297
+ // Registry (for federation compatibility)
298
+ registry: {
299
+ name: projectName,
300
+ submodule: projectName,
301
+ description: config.description || `${projectName} application`,
302
+ tech_stack: techStack.languages || [],
303
+ primary_language: techStack.languages?.[0] || 'unknown',
304
+ architecture: {
305
+ pattern: analysis.architecture?.pattern || 'layered',
306
+ layers: (analysis.architecture?.layers || []).map(l => l.name || l),
307
+ dependencies: {}
308
+ },
309
+ key_files: {
310
+ entry_points: (analysis.entryPoints || []).map(ep => ep.file),
311
+ api_routes: [],
312
+ core: [],
313
+ config: []
314
+ },
315
+ commands: {
316
+ install: techStack.commands?.install || 'npm install',
317
+ run: techStack.commands?.dev || 'npm run dev',
318
+ test: techStack.commands?.test || 'npm test',
319
+ build: techStack.commands?.build || 'npm run build'
320
+ },
321
+ environment: {
322
+ required: [],
323
+ optional: []
324
+ },
325
+ critical_constraints: [],
326
+ integrations: {
327
+ external: {},
328
+ internal: {}
329
+ }
330
+ },
331
+
332
+ // Submodule (for federation compatibility)
333
+ submodule: {
334
+ ports: {
335
+ default: 3000
336
+ }
337
+ },
338
+
339
+ // Cross-repo references (for federation)
340
+ cross_repos: [],
341
+
342
+ // Active task (for task dispatch)
343
+ active_task: null,
344
+
345
+ // Federation info
346
+ federation: {
347
+ is_federated: false,
348
+ subproject: null,
349
+ cross_repos: []
350
+ }
351
+ };
352
+ }
353
+
354
+ /**
355
+ * Get package version
356
+ * @returns {string} Package version
357
+ */
358
+ function getPackageVersion() {
359
+ try {
360
+ const pkgPath = path.join(__dirname, '..', 'package.json');
361
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
362
+ return pkg.version || '2.0.0';
363
+ } catch {
364
+ return '2.0.0';
365
+ }
366
+ }
367
+
368
+ // Initialize on module load
369
+ initialize();
370
+
371
+ module.exports = {
372
+ renderTemplate,
373
+ renderTemplateByName,
374
+ renderMultiFileTemplate,
375
+ parseMultiFileOutput,
376
+ buildContext,
377
+ registerPartials,
378
+ registerHelpers,
379
+ initialize,
380
+ getAvailableTemplates,
381
+ TEMPLATES_DIR
382
+ };
@@ -0,0 +1,155 @@
1
+ /**
2
+ * AI Context Engineering - Installation Validator
3
+ *
4
+ * Validates the installation was successful.
5
+ */
6
+
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+
10
+ /**
11
+ * Context directory and file names
12
+ */
13
+ const AI_CONTEXT_DIR = '.ai-context';
14
+ const AI_CONTEXT_FILE = 'AI_CONTEXT.md';
15
+
16
+ /**
17
+ * Required files and directories for a valid installation
18
+ */
19
+ const REQUIRED_STRUCTURE = {
20
+ directories: [
21
+ AI_CONTEXT_DIR,
22
+ `${AI_CONTEXT_DIR}/context`,
23
+ `${AI_CONTEXT_DIR}/research`,
24
+ `${AI_CONTEXT_DIR}/plans`,
25
+ ],
26
+ files: [
27
+ AI_CONTEXT_FILE,
28
+ `${AI_CONTEXT_DIR}/README.md`,
29
+ `${AI_CONTEXT_DIR}/settings.json`,
30
+ `${AI_CONTEXT_DIR}/context/WORKFLOW_INDEX.md`,
31
+ ],
32
+ };
33
+
34
+ /**
35
+ * Validate the installation
36
+ */
37
+ async function validateInstallation(targetDir) {
38
+ const result = {
39
+ passed: true,
40
+ warnings: 0,
41
+ errors: 0,
42
+ checks: [],
43
+ };
44
+
45
+ // Check required directories
46
+ for (const dir of REQUIRED_STRUCTURE.directories) {
47
+ const fullPath = path.join(targetDir, dir);
48
+ const exists = fs.existsSync(fullPath);
49
+
50
+ result.checks.push({
51
+ type: 'directory',
52
+ path: dir,
53
+ status: exists ? 'PASS' : 'FAIL',
54
+ });
55
+
56
+ if (!exists) {
57
+ result.errors++;
58
+ result.passed = false;
59
+ }
60
+ }
61
+
62
+ // Check required files
63
+ for (const file of REQUIRED_STRUCTURE.files) {
64
+ const fullPath = path.join(targetDir, file);
65
+ const exists = fs.existsSync(fullPath);
66
+
67
+ result.checks.push({
68
+ type: 'file',
69
+ path: file,
70
+ status: exists ? 'PASS' : 'FAIL',
71
+ });
72
+
73
+ if (!exists) {
74
+ result.errors++;
75
+ result.passed = false;
76
+ }
77
+ }
78
+
79
+ // Check for remaining placeholders in key files
80
+ const filesToCheck = [
81
+ AI_CONTEXT_FILE,
82
+ `${AI_CONTEXT_DIR}/README.md`,
83
+ `${AI_CONTEXT_DIR}/settings.json`,
84
+ ];
85
+
86
+ for (const file of filesToCheck) {
87
+ const fullPath = path.join(targetDir, file);
88
+ if (fs.existsSync(fullPath)) {
89
+ const content = fs.readFileSync(fullPath, 'utf8');
90
+ const placeholders = content.match(/\{\{[A-Z_]+\}\}/g) || [];
91
+
92
+ if (placeholders.length > 0) {
93
+ result.checks.push({
94
+ type: 'placeholders',
95
+ path: file,
96
+ status: 'WARN',
97
+ details: `${placeholders.length} placeholders remaining`,
98
+ });
99
+ result.warnings++;
100
+ }
101
+ }
102
+ }
103
+
104
+ // Validate settings.json is valid JSON
105
+ const settingsPath = path.join(targetDir, AI_CONTEXT_DIR, 'settings.json');
106
+ if (fs.existsSync(settingsPath)) {
107
+ try {
108
+ JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
109
+ result.checks.push({
110
+ type: 'json',
111
+ path: `${AI_CONTEXT_DIR}/settings.json`,
112
+ status: 'PASS',
113
+ });
114
+ } catch (e) {
115
+ result.checks.push({
116
+ type: 'json',
117
+ path: `${AI_CONTEXT_DIR}/settings.json`,
118
+ status: 'FAIL',
119
+ details: 'Invalid JSON',
120
+ });
121
+ result.errors++;
122
+ result.passed = false;
123
+ }
124
+ }
125
+
126
+ return result;
127
+ }
128
+
129
+ /**
130
+ * Count files in a directory
131
+ */
132
+ function countFiles(dir, pattern = '*') {
133
+ if (!fs.existsSync(dir)) return 0;
134
+
135
+ let count = 0;
136
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
137
+
138
+ for (const entry of entries) {
139
+ if (entry.isFile()) {
140
+ count++;
141
+ } else if (entry.isDirectory()) {
142
+ count += countFiles(path.join(dir, entry.name), pattern);
143
+ }
144
+ }
145
+
146
+ return count;
147
+ }
148
+
149
+ module.exports = {
150
+ validateInstallation,
151
+ countFiles,
152
+ REQUIRED_STRUCTURE,
153
+ AI_CONTEXT_DIR,
154
+ AI_CONTEXT_FILE,
155
+ };
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "create-universal-ai-context",
3
+ "version": "2.0.0",
4
+ "description": "Universal AI Context Engineering - Set up context for Claude, Copilot, Cline, Antigravity, and more",
5
+ "main": "lib/index.js",
6
+ "bin": {
7
+ "create-ai-context": "./bin/create-ai-context.js"
8
+ },
9
+ "type": "commonjs",
10
+ "files": [
11
+ "bin/",
12
+ "lib/",
13
+ "templates/",
14
+ "schemas/"
15
+ ],
16
+ "scripts": {
17
+ "test": "jest",
18
+ "test:watch": "jest --watch",
19
+ "test:coverage": "jest --coverage",
20
+ "lint": "eslint lib/",
21
+ "cli:help": "node bin/create-ai-context.js --help"
22
+ },
23
+ "keywords": [
24
+ "ai-context",
25
+ "context-engineering",
26
+ "claude",
27
+ "claude-code",
28
+ "copilot",
29
+ "github-copilot",
30
+ "cline",
31
+ "antigravity",
32
+ "cursor",
33
+ "windsurf",
34
+ "aider",
35
+ "ai",
36
+ "llm",
37
+ "documentation",
38
+ "cli",
39
+ "scaffolding",
40
+ "monorepo",
41
+ "federation"
42
+ ],
43
+ "author": "SireJeff",
44
+ "license": "MIT",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/SireJeff/claude-context-engineering-template.git"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/SireJeff/claude-context-engineering-template/issues"
51
+ },
52
+ "homepage": "https://github.com/SireJeff/claude-context-engineering-template#readme",
53
+ "engines": {
54
+ "node": ">=18.0.0"
55
+ },
56
+ "dependencies": {
57
+ "enquirer": "^2.4.1",
58
+ "ora": "^5.4.1",
59
+ "chalk": "^4.1.2",
60
+ "commander": "^11.1.0",
61
+ "glob": "^10.3.10",
62
+ "yaml": "^2.3.4",
63
+ "ajv": "^8.12.0",
64
+ "ajv-formats": "^2.1.1",
65
+ "handlebars": "^4.7.8"
66
+ },
67
+ "devDependencies": {
68
+ "jest": "^29.7.0"
69
+ }
70
+ }