agents-templated 1.2.11 → 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.
package/README.md CHANGED
@@ -100,7 +100,7 @@ Your AI assistant will auto-load the configurations and follow enterprise patter
100
100
  |---------|-------------|
101
101
  | 🚀 **Quick Start Presets** | 5 popular tech stack presets (Next.js, Express, Django, FastAPI, Go) |
102
102
  | 🧙 **Interactive Wizard** | Guided setup with personalized recommendations |
103
- | 🤖 **4 AI Agents Supported** | Cursor, GitHub Copilot, Claude, Google Gemini (auto-discovery) |
103
+ | 🤖 **AI Agents Supported** | Cursor, GitHub Copilot, Claude, and generic agents via `AGENTS.MD` |
104
104
  | 🧭 **Deterministic Commands** | Slash-command contracts with strict structured outputs |
105
105
  | 💬 **Auto Intent Routing** | Non-slash prompts can map to command contracts (`slash-command-auto`) |
106
106
  | 🔒 **Security-First** | OWASP Top 10 protection patterns built-in |
@@ -115,14 +115,14 @@ Your AI assistant will auto-load the configurations and follow enterprise patter
115
115
 
116
116
  ## 🤖 AI Agent Support
117
117
 
118
- Agents Templated automatically configures 4 major AI coding assistants:
118
+ Agents Templated automatically configures compatible wrappers for major AI coding assistants:
119
119
 
120
120
  | AI Agent | Config File | Auto-Discovery |
121
121
  |----------|-------------|----------------|
122
122
  | **Cursor** | `.cursorrules` | ✅ Auto-loads in Cursor IDE |
123
- | **GitHub Copilot** | `.github/instructions/copilot-instructions.md` (+ shim `.github/copilot-instructions.md`) | ✅ Auto-loads in VS Code |
124
- | **Claude** | `.github/instructions/CLAUDE.md` (+ shim `CLAUDE.md`) | ✅ Compatible |
125
- | **Gemini** | `.github/instructions/GEMINI.md` (+ shim `GEMINI.md`) | ✅ Compatible |
123
+ | **GitHub Copilot** | `.github/copilot-instructions.md` | ✅ Auto-loads in VS Code |
124
+ | **Claude** | `CLAUDE.md` | ✅ Compatible |
125
+ | **Generic agents** | `AGENTS.MD` | ✅ Compatible |
126
126
 
127
127
  **Single source of truth:** `instructions/source/core.md` drives generated tool-compatible instruction files.
128
128
 
@@ -143,11 +143,8 @@ your-project/
143
143
  │ └── README.md # Human-readable setup guide
144
144
 
145
145
  ├── .github/
146
- │ ├── instructions/ # Canonical generated instructions
146
+ │ ├── instructions/ # Generated compatibility wrappers + rules
147
147
  │ │ ├── AGENTS.md
148
- │ │ ├── copilot-instructions.md
149
- │ │ ├── CLAUDE.md
150
- │ │ ├── GEMINI.md
151
148
  │ │ └── rules/
152
149
  │ │ ├── core.mdc # Core development principles
153
150
  │ │ ├── security.mdc # Security patterns (CRITICAL)
@@ -181,8 +178,7 @@ your-project/
181
178
 
182
179
  ├── AGENTS.MD # Compatibility shim for generic agents
183
180
  ├── CLAUDE.md # Compatibility shim for Claude tooling
184
- ├── GEMINI.md # Compatibility shim for Gemini tooling
185
- ├── .cursorrules # Cursor IDE config
181
+ ├── .cursorrules # Compatibility shim for Cursor
186
182
  ├── .gitignore # Pre-configured Git ignore
187
183
  └── README.md # Project documentation
188
184
  ```
@@ -262,7 +258,7 @@ Open your AI assistant and it will automatically load the appropriate config:
262
258
  - **Cursor**: Opens `.cursorrules` automatically
263
259
  - **GitHub Copilot**: Reads `.github/copilot-instructions.md`
264
260
  - **Claude**: Reads `CLAUDE.md`
265
- - **Gemini**: Reads `GEMINI.md`
261
+ - **Generic/other tools**: Read `AGENTS.MD`
266
262
 
267
263
  ### 3. Create Custom Skills (Optional)
268
264
 
@@ -270,13 +266,13 @@ Extend your AI agents with domain-specific skills for your project:
270
266
 
271
267
  ```bash
272
268
  # View the skills guide
273
- cat agents/skills/README.md
269
+ cat .github/skills/README.md
274
270
  ```
275
271
 
276
- Create a new skill folder in `agents/skills/`:
272
+ Create a new skill folder in `.github/skills/`:
277
273
 
278
274
  ```markdown
279
- agents/skills/my-custom-skill/SKILL.md
275
+ .github/skills/my-custom-skill/SKILL.md
280
276
  ---
281
277
  name: my-custom-skill
282
278
  description: Custom patterns for my project domain
@@ -296,15 +292,15 @@ Use this skill when working with [your domain].
296
292
  Code and examples...
297
293
  ```
298
294
 
299
- Skills define *how to execute specific tasks*, complementing rules that define *how to behave*. See [agents/skills/README.md](agents/skills/README.md) for detailed guidance.
295
+ Skills define *how to execute specific tasks*, complementing rules that define *how to behave*. See [.github/skills/README.md](.github/skills/README.md) for detailed guidance.
300
296
 
301
297
  ### 4. Read the Documentation
302
298
 
303
299
  - **[AGENTS.MD](AGENTS.MD)** – AI assistant guide
304
300
  - **[agent-docs/ARCHITECTURE.md](agent-docs/ARCHITECTURE.md)** – Project architecture & tech stack guidance
305
- - **[agents/skills/README.md](agents/skills/README.md)** – Custom skills guide
306
- - **[agents/rules/security.mdc](agents/rules/security.mdc)** – Security patterns (CRITICAL)
307
- - **[agents/rules/testing.mdc](agents/rules/testing.mdc)** – Testing strategy
301
+ - **[.github/skills/README.md](.github/skills/README.md)** – Custom skills guide
302
+ - **[.github/instructions/rules/security.mdc](.github/instructions/rules/security.mdc)** – Security patterns (CRITICAL)
303
+ - **[.github/instructions/rules/testing.mdc](.github/instructions/rules/testing.mdc)** – Testing strategy
308
304
 
309
305
  ### 5. Start Building
310
306
 
@@ -330,7 +326,7 @@ Your AI will follow the enterprise patterns automatically!
330
326
  ✅ Sanitize outputs to prevent injection attacks
331
327
  ✅ Never expose sensitive data in error messages or logs
332
328
 
333
- **Reference**: [agents/rules/security.mdc](agents/rules/security.mdc)
329
+ **Reference**: [.github/instructions/rules/security.mdc](.github/instructions/rules/security.mdc)
334
330
 
335
331
  ### Testing Strategy
336
332
 
@@ -338,7 +334,7 @@ Your AI will follow the enterprise patterns automatically!
338
334
  - **15% Integration Tests** – API endpoints, database operations
339
335
  - **5% E2E Tests** – Critical user journeys
340
336
 
341
- **Reference**: [agents/rules/testing.mdc](agents/rules/testing.mdc)
337
+ **Reference**: [.github/instructions/rules/testing.mdc](.github/instructions/rules/testing.mdc)
342
338
 
343
339
  ### Agent-Based Architecture
344
340
 
package/bin/cli.js CHANGED
@@ -16,6 +16,7 @@ const {
16
16
  const {
17
17
  CORE_SOURCE_REL_PATH,
18
18
  GENERATED_INSTRUCTION_PATHS,
19
+ KNOWN_ORPHAN_PATHS,
19
20
  writeGeneratedInstructions,
20
21
  validateInstructionDrift
21
22
  } = require('../lib/instructions');
@@ -119,7 +120,7 @@ program
119
120
  { name: 'Documentation files (agent-docs/)', value: 'docs' },
120
121
  { name: 'Agent rules (.github/instructions/rules/*.mdc)', value: 'rules' },
121
122
  { name: 'Skills (.github/skills/*)', value: 'skills' },
122
- { name: 'AI Agent instructions (Cursor, Copilot, VSCode, Gemini)', value: 'github' }
123
+ { name: 'AI Agent instructions (Cursor, Copilot, Claude, Generic AGENTS)', value: 'github' }
123
124
  ],
124
125
  default: ['all']
125
126
  },
@@ -177,16 +178,15 @@ program
177
178
  );
178
179
  }
179
180
 
180
- // Install AI Agent instructions (Cursor, Copilot, Claude, Gemini)
181
+ // Install AI Agent instructions (Cursor, Copilot, Claude, Generic AGENTS)
181
182
  if (installAll || choices.includes('github')) {
182
183
  console.log(chalk.yellow('Installing AI agent instructions...'));
183
184
  await fs.ensureDir(path.join(targetDir, '.github', 'instructions'));
184
- await copyFiles(templateDir, targetDir, ['.cursorrules'], options.force);
185
185
  await writeGeneratedInstructions(targetDir, templateDir, options.force);
186
186
  console.log(chalk.gray(' ✓ Cursor (.cursorrules)'));
187
- console.log(chalk.gray(' ✓ GitHub Copilot (.github/instructions/copilot-instructions.md + compat shim)'));
188
- console.log(chalk.gray(' ✓ Claude (.github/instructions/CLAUDE.md + compat shim)'));
189
- console.log(chalk.gray(' ✓ Google Gemini (.github/instructions/GEMINI.md + compat shim)'));
187
+ console.log(chalk.gray(' ✓ GitHub Copilot (.github/copilot-instructions.md shim)'));
188
+ console.log(chalk.gray(' ✓ Claude (CLAUDE.md shim)'));
189
+ console.log(chalk.gray(' ✓ Generic AGENTS (AGENTS.MD shim + canonical .github/instructions/AGENTS.md)'));
190
190
  }
191
191
 
192
192
  console.log(chalk.green.bold('\nInstallation complete!\n'));
@@ -241,7 +241,7 @@ program
241
241
  { name: 'Documentation (agent-docs/)', value: 'docs' },
242
242
  { name: 'Agent Rules (security, testing, database, etc.)', value: 'rules' },
243
243
  { name: 'Skills (reusable agent capabilities)', value: 'skills' },
244
- { name: 'AI Agent instructions (Cursor, Copilot, VSCode, Gemini)', value: 'github' }
244
+ { name: 'AI Agent instructions (Cursor, Copilot, Claude, Generic AGENTS)', value: 'github' }
245
245
  ],
246
246
  validate: (answer) => {
247
247
  if (answer.length === 0) {
@@ -277,7 +277,7 @@ program
277
277
  { name: 'Documentation (agent-docs/)', value: 'docs', checked: true },
278
278
  { name: 'Agent Rules (security, testing, database, etc.)', value: 'rules', checked: true },
279
279
  { name: 'Skills (reusable agent capabilities)', value: 'skills', checked: true },
280
- { name: 'AI Agent instructions (Cursor, Copilot, VSCode, Gemini)', value: 'github', checked: true }
280
+ { name: 'AI Agent instructions (Cursor, Copilot, Claude, Generic AGENTS)', value: 'github', checked: true }
281
281
  ],
282
282
  validate: (answer) => {
283
283
  if (answer.length === 0) {
@@ -337,17 +337,15 @@ program
337
337
  );
338
338
  }
339
339
 
340
- // Install AI Agent instructions (Cursor, Copilot, VSCode, Gemini)
340
+ // Install AI Agent instructions (Cursor, Copilot, Claude, Generic AGENTS)
341
341
  if (options.github) {
342
342
  console.log(chalk.yellow('Installing AI agent instructions...'));
343
343
  await fs.ensureDir(path.join(targetDir, '.github', 'instructions'));
344
- await copyFiles(templateDir, targetDir, ['.cursorrules'], options.force);
345
344
  await writeGeneratedInstructions(targetDir, templateDir, options.force);
346
345
  console.log(chalk.gray(' ✓ Cursor (.cursorrules)'));
347
- console.log(chalk.gray(' ✓ GitHub Copilot (.github/instructions/copilot-instructions.md + compat shim)'));
348
- console.log(chalk.gray(' ✓ Generic AI (.github/instructions/AGENTS.md + compat shim)'));
349
- console.log(chalk.gray(' ✓ Claude (.github/instructions/CLAUDE.md + compat shim)'));
350
- console.log(chalk.gray(' ✓ Google Gemini (.github/instructions/GEMINI.md + compat shim)'));
346
+ console.log(chalk.gray(' ✓ GitHub Copilot (.github/copilot-instructions.md shim)'));
347
+ console.log(chalk.gray(' ✓ Claude (CLAUDE.md shim)'));
348
+ console.log(chalk.gray(' ✓ Generic AGENTS (AGENTS.MD shim + canonical .github/instructions/AGENTS.md)'));
351
349
  }
352
350
 
353
351
  // Show summary and next steps
@@ -379,7 +377,7 @@ program
379
377
  console.log(chalk.yellow('docs') + ' - Documentation files (agent-docs/ directory)');
380
378
  console.log(chalk.yellow('rules') + ' - Agent rules (.github/instructions/rules/*.mdc)');
381
379
  console.log(chalk.yellow('skills') + ' - Agent skills (.github/skills/*)');
382
- console.log(chalk.yellow('github') + ' - AI Agent instructions (Cursor, Copilot, VSCode, Gemini)');
380
+ console.log(chalk.yellow('github') + ' - AI Agent instructions (Cursor, Copilot, Claude, Generic AGENTS)');
383
381
  console.log(chalk.yellow('all') + ' - All components');
384
382
 
385
383
  console.log(chalk.blue.bold('\n\nAvailable Presets:\n'));
@@ -470,26 +468,29 @@ program
470
468
  // Check generated instruction files and drift
471
469
  const hasInstructionFootprint =
472
470
  await fs.pathExists(path.join(targetDir, '.github', 'instructions')) ||
473
- await fs.pathExists(path.join(targetDir, '.claude', 'rules')) ||
474
- await fs.pathExists(path.join(targetDir, GENERATED_INSTRUCTION_PATHS.compatibility.copilot)) ||
475
471
  await fs.pathExists(path.join(targetDir, GENERATED_INSTRUCTION_PATHS.compatibility.claude)) ||
476
- await fs.pathExists(path.join(targetDir, GENERATED_INSTRUCTION_PATHS.compatibility.gemini)) ||
472
+ await fs.pathExists(path.join(targetDir, GENERATED_INSTRUCTION_PATHS.compatibility.copilot)) ||
477
473
  await fs.pathExists(path.join(targetDir, GENERATED_INSTRUCTION_PATHS.compatibility.generic));
478
474
 
479
475
  if (hasInstructionFootprint) {
480
476
  const instructionDrift = await validateInstructionDrift(targetDir);
481
477
  if (instructionDrift.missingCore) {
482
478
  issues.push(`✗ Canonical instruction source missing - run 'agents-templated init --docs --github'`);
483
- } else if (!instructionDrift.ok) {
479
+ } else if (instructionDrift.driftFiles.length > 0) {
484
480
  issues.push(`✗ Generated instruction files are out of sync: ${instructionDrift.driftFiles.join(', ')}`);
485
481
  } else {
486
482
  passed.push('✓ Generated instruction files are in sync with canonical source');
487
483
  }
484
+ if (instructionDrift.orphanedPolicyFiles && instructionDrift.orphanedPolicyFiles.length > 0) {
485
+ issues.push(
486
+ `✗ Orphaned policy files detected (contain duplicated content, should be deleted): ` +
487
+ `${instructionDrift.orphanedPolicyFiles.join(', ')} — run 'agents-templated update --github' to remove`
488
+ );
489
+ }
488
490
  }
489
491
 
490
- const canonicalCopilotFile = path.join(targetDir, GENERATED_INSTRUCTION_PATHS.canonical.copilot);
491
492
  const compatCopilotFile = path.join(targetDir, GENERATED_INSTRUCTION_PATHS.compatibility.copilot);
492
- if (await fs.pathExists(canonicalCopilotFile) || await fs.pathExists(compatCopilotFile)) {
493
+ if (await fs.pathExists(compatCopilotFile)) {
493
494
  passed.push(`✓ GitHub Copilot configuration found`);
494
495
  } else {
495
496
  warnings.push(`⚠ GitHub Copilot configuration missing - run 'agents-templated init --github'`);
@@ -631,6 +632,24 @@ async function hasInstalledTemplates(targetDir) {
631
632
  await fs.pathExists(path.join(targetDir, GENERATED_INSTRUCTION_PATHS.compatibility.generic));
632
633
  }
633
634
 
635
+ async function cleanupLegacyInstructionFiles(targetDir) {
636
+ // Files removed in v2.0.0: orphaned wrappers that contained duplicated policy
637
+ // content and were not managed/validated by the generator.
638
+ const legacyFiles = [
639
+ ...KNOWN_ORPHAN_PATHS,
640
+ // Pre-v1.2.13 paths
641
+ '.claude/CLAUDE.md'
642
+ ];
643
+
644
+ for (const file of legacyFiles) {
645
+ const filePath = path.join(targetDir, file);
646
+ if (await fs.pathExists(filePath)) {
647
+ await fs.remove(filePath);
648
+ console.log(chalk.green(` ✓ Removed legacy file: ${file}`));
649
+ }
650
+ }
651
+ }
652
+
634
653
  async function updateSelectedComponents(targetDir, templateDir, selectedComponents, overwrite = true) {
635
654
  const components = selectedComponents.includes('all')
636
655
  ? ['docs', 'rules', 'skills', 'github']
@@ -670,8 +689,8 @@ async function updateSelectedComponents(targetDir, templateDir, selectedComponen
670
689
  if (components.includes('github')) {
671
690
  console.log(chalk.yellow('Updating AI agent instructions...'));
672
691
  await fs.ensureDir(path.join(targetDir, '.github', 'instructions'));
673
- await copyFiles(templateDir, targetDir, ['.cursorrules'], overwrite);
674
692
  await writeGeneratedInstructions(targetDir, templateDir, overwrite);
693
+ await cleanupLegacyInstructionFiles(targetDir);
675
694
  }
676
695
 
677
696
  if ((components.includes('docs') || components.includes('github')) && !components.includes('github')) {
@@ -786,8 +805,7 @@ program
786
805
  { targetFile: `${LAYOUT.canonical.rulesDir}/core.mdc`, templateFile: 'agents/rules/core.mdc', component: 'rules' },
787
806
  { targetFile: `${LAYOUT.canonical.skillsDir}/README.md`, templateFile: 'agents/skills/README.md', component: 'skills' },
788
807
  { targetFile: `${LAYOUT.canonical.skillsDir}/find-skills/SKILL.md`, templateFile: 'agents/skills/find-skills/SKILL.md', component: 'skills' },
789
- { targetFile: `${LAYOUT.canonical.skillsDir}/ui-ux-pro-max/SKILL.md`, templateFile: 'agents/skills/ui-ux-pro-max/SKILL.md', component: 'skills' },
790
- { targetFile: '.cursorrules', templateFile: '.cursorrules', component: 'github' }
808
+ { targetFile: `${LAYOUT.canonical.skillsDir}/ui-ux-pro-max/SKILL.md`, templateFile: 'agents/skills/ui-ux-pro-max/SKILL.md', component: 'skills' }
791
809
  ];
792
810
 
793
811
  for (const {targetFile, templateFile, component} of checkFiles) {
@@ -854,6 +872,7 @@ program
854
872
 
855
873
  await writeGeneratedInstructions(targetDir, templateDir, true);
856
874
  console.log(chalk.green(' ✓ Regenerated instruction compatibility files'));
875
+ await cleanupLegacyInstructionFiles(targetDir);
857
876
 
858
877
  console.log(chalk.green.bold('\n✅ Updates applied successfully!\n'));
859
878
  console.log(chalk.gray('Backup files created with .backup extension\n'));
package/index.js CHANGED
@@ -69,16 +69,9 @@ async function install(targetDir, options = {}) {
69
69
  );
70
70
  }
71
71
 
72
- // AI Agent instructions (Cursor, Copilot, Claude, Gemini)
72
+ // AI Agent instructions (Cursor, Copilot, Claude)
73
73
  if (installAll || options.github) {
74
74
  await fs.ensureDir(path.join(targetDir, '.github', 'instructions'));
75
-
76
- const cursorSource = path.join(templateDir, '.cursorrules');
77
- const cursorTarget = path.join(targetDir, '.cursorrules');
78
- if (await fs.pathExists(cursorSource)) {
79
- await fs.copy(cursorSource, cursorTarget, { overwrite: options.force });
80
- }
81
-
82
75
  await writeGeneratedInstructions(targetDir, templateDir, options.force);
83
76
  }
84
77
  }
@@ -5,23 +5,27 @@ const CORE_SOURCE_REL_PATH = 'instructions/source/core.md';
5
5
 
6
6
  const GENERATED_INSTRUCTION_PATHS = {
7
7
  canonical: {
8
- generic: '.github/instructions/AGENTS.md',
9
- copilot: '.github/instructions/copilot-instructions.md',
10
- claude: '.github/instructions/CLAUDE.md',
11
- gemini: '.github/instructions/GEMINI.md'
12
- },
13
- styleCompat: {
14
- githubInstructions: '.github/instructions/agents.instructions.md',
15
- claudeRules: '.claude/rules/claude.instructions.md'
8
+ generic: '.github/instructions/AGENTS.md'
16
9
  },
17
10
  compatibility: {
18
11
  generic: 'AGENTS.MD',
19
12
  copilot: '.github/copilot-instructions.md',
20
13
  claude: 'CLAUDE.md',
21
- gemini: 'GEMINI.md'
14
+ cursor: '.cursorrules'
22
15
  }
23
16
  };
24
17
 
18
+ // Files that MUST NOT exist — legacy/orphaned files that contain or may contain
19
+ // duplicated policy content. Their presence is reported as a violation by validateInstructionDrift.
20
+ const KNOWN_ORPHAN_PATHS = [
21
+ '.github/instructions/CLAUDE.md',
22
+ '.github/instructions/GEMINI.md',
23
+ '.github/instructions/agents.instructions.md',
24
+ '.github/instructions/copilot-instructions.md',
25
+ '.claude/rules/claude.instructions.md',
26
+ 'GEMINI.md'
27
+ ];
28
+
25
29
  function getLegacyCoreCandidates() {
26
30
  return ['AGENTS.MD', 'AGENTS.md'];
27
31
  }
@@ -40,40 +44,29 @@ function buildCompatInstruction(toolName, corePath) {
40
44
  generic: '# AGENTS Instructions',
41
45
  copilot: '# GitHub Copilot Instructions',
42
46
  claude: '# Claude Instructions',
43
- gemini: '# Gemini Instructions'
47
+ cursor: '# Cursor Rules'
44
48
  };
45
49
 
46
50
  return [
47
51
  `${titles[toolName]}`,
48
52
  '',
49
53
  `Primary policy source: \`${corePath}\`.`,
50
- '',
51
- 'Always apply these mandatory rules:',
52
- '- Security-first implementation (validate inputs, authz/authn, rate limiting).',
53
- '- Testing-first delivery with unit + integration coverage for changed logic.',
54
- '- Strong typing and runtime boundary validation.',
55
- '- Do not expose secrets or sensitive data in logs/errors.',
56
- '',
57
- 'Use the canonical source for full policy and architecture guidance.',
54
+ 'Load policy only from the canonical source file above.',
55
+ 'Do not duplicate, summarize, or inline rules in this file.',
56
+ 'If this file and the canonical source conflict, the canonical source wins.',
58
57
  ''
59
58
  ].join('\n');
60
59
  }
61
60
 
62
- function buildGeneratedArtifacts(coreContent) {
61
+ function buildGeneratedArtifacts() {
63
62
  const corePath = CORE_SOURCE_REL_PATH;
64
63
  const files = {};
65
64
 
66
- files[GENERATED_INSTRUCTION_PATHS.canonical.generic] = `${buildHeaders('generic')}${coreContent.trim()}\n`;
67
- files[GENERATED_INSTRUCTION_PATHS.canonical.copilot] = `${buildHeaders('copilot')}${buildCompatInstruction('copilot', corePath)}`;
68
- files[GENERATED_INSTRUCTION_PATHS.canonical.claude] = `${buildHeaders('claude')}${buildCompatInstruction('claude', corePath)}`;
69
- files[GENERATED_INSTRUCTION_PATHS.canonical.gemini] = `${buildHeaders('gemini')}${buildCompatInstruction('gemini', corePath)}`;
70
- files[GENERATED_INSTRUCTION_PATHS.styleCompat.githubInstructions] = `${buildHeaders('github-instructions-style')}${buildCompatInstruction('generic', corePath)}`;
71
- files[GENERATED_INSTRUCTION_PATHS.styleCompat.claudeRules] = `${buildHeaders('claude-rules-style')}${buildCompatInstruction('claude', corePath)}`;
72
-
65
+ files[GENERATED_INSTRUCTION_PATHS.canonical.generic] = `${buildHeaders('generic-wrapper')}${buildCompatInstruction('generic', corePath)}`;
73
66
  files[GENERATED_INSTRUCTION_PATHS.compatibility.generic] = `${buildHeaders('generic-compat')}${buildCompatInstruction('generic', corePath)}`;
74
67
  files[GENERATED_INSTRUCTION_PATHS.compatibility.copilot] = `${buildHeaders('copilot-compat')}${buildCompatInstruction('copilot', corePath)}`;
75
68
  files[GENERATED_INSTRUCTION_PATHS.compatibility.claude] = `${buildHeaders('claude-compat')}${buildCompatInstruction('claude', corePath)}`;
76
- files[GENERATED_INSTRUCTION_PATHS.compatibility.gemini] = `${buildHeaders('gemini-compat')}${buildCompatInstruction('gemini', corePath)}`;
69
+ files[GENERATED_INSTRUCTION_PATHS.compatibility.cursor] = `${buildHeaders('cursor-compat')}${buildCompatInstruction('cursor', corePath)}`;
77
70
 
78
71
  return files;
79
72
  }
@@ -87,7 +80,14 @@ async function resolveCoreContent(targetDir, templateDir) {
87
80
  for (const legacyFile of getLegacyCoreCandidates()) {
88
81
  const legacyPath = path.join(targetDir, legacyFile);
89
82
  if (await fs.pathExists(legacyPath)) {
90
- return fs.readFile(legacyPath, 'utf8');
83
+ const legacyContent = await fs.readFile(legacyPath, 'utf8');
84
+ const isWrapper =
85
+ legacyContent.includes(`Source of truth: ${CORE_SOURCE_REL_PATH}`) ||
86
+ legacyContent.includes('Primary policy source: `instructions/source/core.md`.');
87
+
88
+ if (!isWrapper) {
89
+ return legacyContent;
90
+ }
91
91
  }
92
92
  }
93
93
 
@@ -109,9 +109,7 @@ async function ensureCoreSource(targetDir, templateDir, force = false) {
109
109
 
110
110
  async function writeGeneratedInstructions(targetDir, templateDir, force = false) {
111
111
  await ensureCoreSource(targetDir, templateDir, force);
112
- const corePath = path.join(targetDir, CORE_SOURCE_REL_PATH);
113
- const coreContent = await fs.readFile(corePath, 'utf8');
114
- const artifacts = buildGeneratedArtifacts(coreContent);
112
+ const artifacts = buildGeneratedArtifacts();
115
113
 
116
114
  for (const [relPath, content] of Object.entries(artifacts)) {
117
115
  const targetPath = path.join(targetDir, relPath);
@@ -131,12 +129,12 @@ async function validateInstructionDrift(targetDir) {
131
129
  return {
132
130
  ok: false,
133
131
  missingCore: true,
134
- driftFiles: []
132
+ driftFiles: [],
133
+ orphanedPolicyFiles: []
135
134
  };
136
135
  }
137
136
 
138
- const coreContent = await fs.readFile(corePath, 'utf8');
139
- const expected = buildGeneratedArtifacts(coreContent);
137
+ const expected = buildGeneratedArtifacts();
140
138
  const driftFiles = [];
141
139
 
142
140
  for (const [relPath, expectedContent] of Object.entries(expected)) {
@@ -152,16 +150,26 @@ async function validateInstructionDrift(targetDir) {
152
150
  }
153
151
  }
154
152
 
153
+ // Detect orphaned policy files that must not exist
154
+ const orphanedPolicyFiles = [];
155
+ for (const relPath of KNOWN_ORPHAN_PATHS) {
156
+ if (await fs.pathExists(path.join(targetDir, relPath))) {
157
+ orphanedPolicyFiles.push(relPath);
158
+ }
159
+ }
160
+
155
161
  return {
156
- ok: driftFiles.length === 0,
162
+ ok: driftFiles.length === 0 && orphanedPolicyFiles.length === 0,
157
163
  missingCore: false,
158
- driftFiles
164
+ driftFiles,
165
+ orphanedPolicyFiles
159
166
  };
160
167
  }
161
168
 
162
169
  module.exports = {
163
170
  CORE_SOURCE_REL_PATH,
164
171
  GENERATED_INSTRUCTION_PATHS,
172
+ KNOWN_ORPHAN_PATHS,
165
173
  writeGeneratedInstructions,
166
174
  validateInstructionDrift
167
175
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-templated",
3
- "version": "1.2.11",
3
+ "version": "2.0.0",
4
4
  "description": "Technology-agnostic development template with multi-AI agent support (Cursor, Copilot, VSCode, Gemini), security-first patterns, and comprehensive testing guidelines",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,70 +1,9 @@
1
- # Cursor Rules - Technology-Agnostic Development Template
2
- # This is a flexible development template that adapts to any technology stack with enterprise-grade patterns.
3
- # Detailed rules are in agents/rules/*.mdc files - refer to those for implementation patterns.
4
-
5
- ## Developer Identity & Communication
6
- - AI assistant should provide clear, step-by-step solutions with actionable examples
7
- - Focus on security, performance, and maintainability in all recommendations
8
- - Adapt patterns to the chosen technology stack
9
-
10
- ## Core Principles
11
- - **Security-first development**: Always validate inputs, authenticate users, implement appropriate rate limiting
12
- - **Type safety**: Use strong typing systems available in chosen language/framework
13
- - **Performance optimization**: Monitor resource usage, implement caching, optimize assets
14
- - **Testing strategy**: Comprehensive testing at unit, integration, and E2E levels
15
- - **Accessibility**: WCAG 2.1 AA compliance for all user-facing interfaces
16
- - **Documentation**: Keep project documentation updated and comprehensive
17
-
18
- ## Architecture Principles
19
- - **Technology-agnostic**: This template adapts to your chosen stack
20
- - **Security patterns**: Input validation, authentication, authorization, rate limiting
21
- - **Performance patterns**: Caching, lazy loading, bundle optimization
22
- - **Testing patterns**: Unit (80%), Integration (15%), E2E (5%) coverage target
23
- - **Feature-oriented structure**: Group by domain/feature, not just technical layer
24
-
25
- ## Security Requirements (CRITICAL)
26
- - **Input validation**: All user inputs MUST be validated with appropriate schema validation
27
- - **Authentication**: Implement secure authentication flows with session management
28
- - **Rate limiting**: Public endpoints MUST have rate limiting protection
29
- - **Authorization**: Role-based access control with proper middleware
30
- - **Error handling**: Never expose sensitive data in error responses
31
- - **Database access**: Use ORM/ODM patterns, avoid raw queries unless performance-critical
32
-
33
- ## Code Quality Standards
34
- - **Type Safety**: Use strict typing, avoid loose type usage
35
- - **Performance**: Monitor bundle/binary size, implement lazy loading patterns
36
- - **Accessibility**: WCAG 2.1 AA compliance for user-facing components
37
- - **Testing**: All business logic and user flows must have appropriate tests
38
- - **Documentation**: Keep README, agent-docs/ARCHITECTURE.md, and AGENTS.md updated
39
-
40
- ## Technology Stack Adaptation
41
- Choose your stack and apply these patterns consistently:
42
-
43
- ### Frontend Options
44
- - **React/Next.js/Vue/Svelte**: Component-based with proper state management
45
- - **Angular**: Component + service architecture with TypeScript
46
- - **Traditional**: Server-side rendering with progressive enhancement
47
-
48
- ### Backend Options
49
- - **Node.js**: Express, Fastify, or framework API routes
50
- - **Python**: Django, FastAPI, Flask with proper ORM patterns
51
- - **Other**: Adapt patterns to your chosen backend technology
52
-
53
- ### Database Options
54
- - **SQL**: PostgreSQL, MySQL with ORM (Prisma, TypeORM, SQLAlchemy)
55
- - **NoSQL**: MongoDB, DynamoDB with ODM patterns
56
- - **Cloud**: Supabase, Firebase, managed database services
57
-
58
- ## Agent Delegation (See AGENTS.md for details)
59
- - **UI/Design work** → FrontendAgent
60
- - **API/Business logic** → BackendAgent
61
- - **Database/Schema** → DatabaseAgent
62
- - **Testing implementation** → TestAgent
63
- - **Security reviews** → SecurityAgent
64
- - **Code quality** → ReviewerAgent
65
-
66
- ## Usage Instructions
67
- 1. Choose your technology stack
68
- 2. Adapt the patterns in agents/rules/*.mdc to your chosen technologies
69
- 3. Update this .cursorrules file with stack-specific details
70
- 4. Begin development following the established patterns
1
+ <!-- GENERATED FILE - DO NOT EDIT DIRECTLY -->
2
+ <!-- Source of truth: instructions/source/core.md -->
3
+ <!-- Tool profile: cursor-compat -->
4
+ # Cursor Rules
5
+
6
+ Primary policy source: `instructions/source/core.md`.
7
+ Load policy only from the canonical source file above.
8
+ Do not duplicate, summarize, or inline rules in this file.
9
+ If this file and the canonical source conflict, the canonical source wins.
@@ -1,64 +1,9 @@
1
+ <!-- GENERATED FILE - DO NOT EDIT DIRECTLY -->
2
+ <!-- Source of truth: instructions/source/core.md -->
3
+ <!-- Tool profile: copilot-compat -->
1
4
  # GitHub Copilot Instructions
2
5
 
3
- This project follows enterprise-grade, technology-agnostic development patterns.
4
-
5
- ## Quick Start
6
-
7
- - **AI Guide**: See `AGENTS.md` for comprehensive instructions
8
- - **Architecture**: See `agent-docs/ARCHITECTURE.md` for project guidelines
9
- - **Custom Skills**: See `agents/skills/` directory for domain-specific extensions
10
- - **Detailed Rules**: See `agents/rules/*.mdc` files
11
-
12
- ## Always Apply
13
-
14
- 1. **Security-first**: Validate inputs, authenticate endpoints, rate limit public APIs
15
- - Reference: `agents/rules/security.mdc`
16
-
17
- 2. **Testing**: Unit (80%), Integration (15%), E2E (5%) coverage
18
- - Reference: `agents/rules/testing.mdc`
19
-
20
- 3. **Type Safety**: Strong typing with runtime validation at boundaries
21
- - Reference: `agents/rules/core.mdc`
22
-
23
- ## Agent Delegation
24
-
25
- When implementing features, follow agent patterns from `AGENTS.MD`:
26
- - **UI/Design** → FrontendAgent patterns (`agents/rules/frontend.mdc`)
27
- - **API/Logic** → BackendAgent patterns (`agents/rules/security.mdc`)
28
- - **Database** → DatabaseAgent patterns (`agents/rules/database.mdc`)
29
- - **Testing** → TestAgent patterns (`agents/rules/testing.mdc`)
30
- - **Security** → SecurityAgent patterns (`agents/rules/security.mdc`)
31
-
32
- ## Deterministic Slash Commands
33
-
34
- - Slash command protocol is defined in `AGENTS.MD` under `Deterministic Slash Command System Standard`.
35
- - Modular command contracts are stored in `agents/commands/`.
36
- - Command mode is strict: unknown or malformed slash commands must return structured error output and stop.
37
- - No conversational fallback is allowed once slash-command mode is entered.
38
- - Destructive actions require explicit confirmation token format: `CONFIRM-DESTRUCTIVE:<target>`.
39
-
40
- ## Critical Rules
41
-
42
- - Validate ALL user inputs with schema validation
43
- - Authenticate and authorize protected endpoints
44
- - Rate limit public endpoints
45
- - Write tests for all business logic
46
- - Ensure WCAG 2.1 AA accessibility compliance
47
- - Use ORM/ODM patterns, avoid raw queries
48
- - Never expose sensitive data in errors/logs
49
-
50
- ## Reference Files
51
-
52
- - `AGENTS.MD` - Primary AI assistant guide
53
- - `agent-docs/ARCHITECTURE.md` - Architecture and technology stack guidance
54
- - `agents/commands/` - Deterministic slash command contracts
55
- - `agents/rules/core.mdc` - Core principles
56
- - `agents/rules/security.mdc` - Security patterns (CRITICAL)
57
- - `agents/rules/testing.mdc` - Testing strategy (CRITICAL)
58
- - `agents/rules/frontend.mdc` - Frontend patterns
59
- - `agents/rules/database.mdc` - Database patterns
60
- - `agents/rules/style.mdc` - Code style guidelines
61
-
62
- ---
63
-
64
- **Note**: This is technology-agnostic. Adapt patterns to your chosen stack while maintaining security and quality standards.
6
+ Primary policy source: `instructions/source/core.md`.
7
+ Load policy only from the canonical source file above.
8
+ Do not duplicate, summarize, or inline rules in this file.
9
+ If this file and the canonical source conflict, the canonical source wins.
@@ -0,0 +1,9 @@
1
+ <!-- GENERATED FILE - DO NOT EDIT DIRECTLY -->
2
+ <!-- Source of truth: instructions/source/core.md -->
3
+ <!-- Tool profile: generic-compat -->
4
+ # AGENTS Instructions
5
+
6
+ Primary policy source: `instructions/source/core.md`.
7
+ Load policy only from the canonical source file above.
8
+ Do not duplicate, summarize, or inline rules in this file.
9
+ If this file and the canonical source conflict, the canonical source wins.