proagents 1.0.5 → 1.0.7

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.
@@ -86,6 +86,9 @@ const FRAMEWORK_FILES = [
86
86
  'PROAGENTS.md',
87
87
  'GETTING-STARTED-STORY.md',
88
88
  'slash-commands.json',
89
+ 'CLAUDE.md',
90
+ '.cursorrules',
91
+ 'AI_INSTRUCTIONS.md',
89
92
  ];
90
93
 
91
94
  /**
@@ -253,6 +256,21 @@ For detailed commands, see \`./proagents/PROAGENTS.md\`
253
256
  console.log(chalk.green('✓ Created README.md with ProAgents commands'));
254
257
  }
255
258
 
259
+ // Copy AI instruction files to project root (for AI platform recognition)
260
+ const claudeMdSource = join(sourceDir, 'CLAUDE.md');
261
+ const claudeMdTarget = join(targetDir, 'CLAUDE.md');
262
+ if (existsSync(claudeMdSource) && !existsSync(claudeMdTarget)) {
263
+ cpSync(claudeMdSource, claudeMdTarget);
264
+ console.log(chalk.green('✓ Created CLAUDE.md (for Claude AI recognition)'));
265
+ }
266
+
267
+ const cursorRulesSource = join(sourceDir, '.cursorrules');
268
+ const cursorRulesTarget = join(targetDir, '.cursorrules');
269
+ if (existsSync(cursorRulesSource) && !existsSync(cursorRulesTarget)) {
270
+ cpSync(cursorRulesSource, cursorRulesTarget);
271
+ console.log(chalk.green('✓ Created .cursorrules (for Cursor AI recognition)'));
272
+ }
273
+
256
274
  // Success message
257
275
  console.log(chalk.green('\n✓ ProAgents initialized successfully!\n'));
258
276
 
@@ -287,6 +305,21 @@ async function smartUpdate(sourceDir, targetDir) {
287
305
  }
288
306
  }
289
307
 
308
+ // Before updating, migrate any modified template files
309
+ const migrationResult = migrateModifiedTemplates(sourceDir, targetDir);
310
+ if (migrationResult.migrated.length > 0) {
311
+ console.log(chalk.green(`✓ Migrated ${migrationResult.migrated.length} modified template(s) to user files`));
312
+ for (const file of migrationResult.migrated) {
313
+ console.log(chalk.gray(` • ${file}`));
314
+ }
315
+ }
316
+ if (migrationResult.backedUp.length > 0) {
317
+ console.log(chalk.yellow(`⚠️ Backed up ${migrationResult.backedUp.length} modified template(s)`));
318
+ for (const file of migrationResult.backedUp) {
319
+ console.log(chalk.gray(` • ${file}`));
320
+ }
321
+ }
322
+
290
323
  // Update framework folders
291
324
  let updatedCount = 0;
292
325
  for (const folder of FRAMEWORK_FOLDERS) {
@@ -304,6 +337,9 @@ async function smartUpdate(sourceDir, targetDir) {
304
337
  }
305
338
  console.log(chalk.green(`✓ Updated ${updatedCount} framework folders`));
306
339
 
340
+ // Restore user files that were migrated (they were saved before folder deletion)
341
+ restoreUserFiles(targetDir, migrationResult);
342
+
307
343
  // Update framework root files
308
344
  let filesUpdated = 0;
309
345
  for (const file of FRAMEWORK_FILES) {
@@ -345,6 +381,25 @@ async function smartUpdate(sourceDir, targetDir) {
345
381
  }
346
382
  }
347
383
  }
384
+
385
+ // Copy AI instruction files to project root (for AI platform recognition)
386
+ const projectRoot = join(targetDir, '..');
387
+ const aiFiles = ['CLAUDE.md', '.cursorrules', 'AI_INSTRUCTIONS.md'];
388
+ let aiFilesUpdated = 0;
389
+
390
+ for (const file of aiFiles) {
391
+ const sourcePath = join(sourceDir, file);
392
+ const targetPath = join(projectRoot, file);
393
+
394
+ if (existsSync(sourcePath)) {
395
+ cpSync(sourcePath, targetPath, { force: true });
396
+ aiFilesUpdated++;
397
+ }
398
+ }
399
+
400
+ if (aiFilesUpdated > 0) {
401
+ console.log(chalk.green(`✓ Updated ${aiFilesUpdated} AI instruction files (CLAUDE.md, .cursorrules)`));
402
+ }
348
403
  }
349
404
 
350
405
  /**
@@ -427,3 +482,131 @@ function mergeConfigs(userConfigPath, newConfigPath) {
427
482
  return { newOptions: 0, newKeys: [] };
428
483
  }
429
484
  }
485
+
486
+ /**
487
+ * Find all template files in a directory recursively
488
+ * Template files have '.template.' in their name
489
+ */
490
+ function findTemplateFiles(dir, baseDir = dir) {
491
+ const templates = [];
492
+
493
+ if (!existsSync(dir)) return templates;
494
+
495
+ const entries = readdirSync(dir, { withFileTypes: true });
496
+
497
+ for (const entry of entries) {
498
+ const fullPath = join(dir, entry.name);
499
+ const relativePath = fullPath.replace(baseDir + '/', '');
500
+
501
+ if (entry.isDirectory()) {
502
+ templates.push(...findTemplateFiles(fullPath, baseDir));
503
+ } else if (entry.name.includes('.template.')) {
504
+ templates.push(relativePath);
505
+ }
506
+ }
507
+
508
+ return templates;
509
+ }
510
+
511
+ /**
512
+ * Get the user file path for a template file
513
+ * e.g., 'config/rules/custom-rules.template.yaml' -> 'config/rules/custom-rules.yaml'
514
+ */
515
+ function getUserFilePath(templatePath) {
516
+ return templatePath.replace('.template.', '.');
517
+ }
518
+
519
+ /**
520
+ * Check if a file has been modified by comparing with source
521
+ */
522
+ function isFileModified(sourcePath, targetPath) {
523
+ if (!existsSync(targetPath)) return false;
524
+ if (!existsSync(sourcePath)) return true; // File exists in target but not source = modified/custom
525
+
526
+ try {
527
+ const sourceContent = readFileSync(sourcePath, 'utf-8');
528
+ const targetContent = readFileSync(targetPath, 'utf-8');
529
+ return sourceContent !== targetContent;
530
+ } catch {
531
+ return false;
532
+ }
533
+ }
534
+
535
+ /**
536
+ * Migrate modified template files to user files before update
537
+ * Returns info about migrated and backed up files
538
+ */
539
+ function migrateModifiedTemplates(sourceDir, targetDir) {
540
+ const result = {
541
+ migrated: [], // Templates copied to user files
542
+ backedUp: [], // Templates backed up (user file already existed)
543
+ userFiles: {} // Map of user file paths to their content (for restoration)
544
+ };
545
+
546
+ // Find all template files in target directory
547
+ const templateFiles = findTemplateFiles(targetDir);
548
+
549
+ for (const templateRelPath of templateFiles) {
550
+ const templateTargetPath = join(targetDir, templateRelPath);
551
+ const templateSourcePath = join(sourceDir, templateRelPath);
552
+ const userFileRelPath = getUserFilePath(templateRelPath);
553
+ const userFilePath = join(targetDir, userFileRelPath);
554
+
555
+ // Check if template was modified by user
556
+ if (isFileModified(templateSourcePath, templateTargetPath)) {
557
+ try {
558
+ const modifiedContent = readFileSync(templateTargetPath, 'utf-8');
559
+
560
+ if (existsSync(userFilePath)) {
561
+ // User file already exists - backup the modified template
562
+ const backupPath = templateTargetPath + '.backup';
563
+ writeFileSync(backupPath, modifiedContent);
564
+ result.backedUp.push(templateRelPath);
565
+ // Save backup content for restoration after folder deletion
566
+ result.userFiles[templateRelPath + '.backup'] = modifiedContent;
567
+ } else {
568
+ // No user file - migrate template to user file
569
+ result.userFiles[userFileRelPath] = modifiedContent;
570
+ result.migrated.push(`${templateRelPath} → ${userFileRelPath}`);
571
+ }
572
+ } catch (error) {
573
+ // Skip files that can't be read
574
+ continue;
575
+ }
576
+ }
577
+
578
+ // Also preserve existing user files (non-template versions)
579
+ if (existsSync(userFilePath)) {
580
+ try {
581
+ const userContent = readFileSync(userFilePath, 'utf-8');
582
+ result.userFiles[userFileRelPath] = userContent;
583
+ } catch {
584
+ // Skip files that can't be read
585
+ }
586
+ }
587
+ }
588
+
589
+ return result;
590
+ }
591
+
592
+ /**
593
+ * Restore user files after framework folders have been updated
594
+ */
595
+ function restoreUserFiles(targetDir, migrationResult) {
596
+ for (const [relativePath, content] of Object.entries(migrationResult.userFiles)) {
597
+ const fullPath = join(targetDir, relativePath);
598
+ const dirPath = dirname(fullPath);
599
+
600
+ try {
601
+ // Ensure directory exists
602
+ if (!existsSync(dirPath)) {
603
+ mkdirSync(dirPath, { recursive: true });
604
+ }
605
+
606
+ // Write the user file
607
+ writeFileSync(fullPath, content);
608
+ } catch (error) {
609
+ console.log(chalk.yellow(`⚠️ Could not restore ${relativePath}: ${error.message}`));
610
+ }
611
+ }
612
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proagents",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "AI-agnostic development workflow framework that automates the full software development lifecycle",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -0,0 +1,33 @@
1
+ # ProAgents Rules for Cursor
2
+
3
+ This project uses ProAgents workflow framework.
4
+
5
+ ## Command Recognition
6
+
7
+ Recognize commands starting with `pa:` prefix:
8
+
9
+ - `pa:help` - Show all commands
10
+ - `pa:feature "name"` - Start feature workflow (see ./proagents/WORKFLOW.md)
11
+ - `pa:fix "bug"` - Bug fix mode (see ./proagents/workflow-modes/entry-modes.md)
12
+ - `pa:status` - Show progress
13
+ - `pa:doc` - Documentation options
14
+ - `pa:doc-full` - Generate full documentation (see ./proagents/prompts/07-documentation.md)
15
+ - `pa:doc-moderate` - Balanced documentation
16
+ - `pa:doc-lite` - Quick reference
17
+ - `pa:qa` - Quality checks (see ./proagents/checklists/code-quality.md)
18
+ - `pa:test` - Test workflow (see ./proagents/prompts/06-testing.md)
19
+ - `pa:deploy` - Deployment workflow (see ./proagents/prompts/08-deployment.md)
20
+ - `pa:release` - Generate release notes
21
+
22
+ ## Workflow
23
+
24
+ When user types `pa:` command:
25
+ 1. Read corresponding prompt from ./proagents/prompts/
26
+ 2. Follow the defined workflow
27
+ 3. Respect settings in ./proagents/proagents.config.yaml
28
+
29
+ ## Key References
30
+
31
+ - Workflow: ./proagents/WORKFLOW.md
32
+ - Commands: ./proagents/PROAGENTS.md
33
+ - Prompts: ./proagents/prompts/
@@ -0,0 +1,71 @@
1
+ # AI Instructions for ProAgents
2
+
3
+ This project uses ProAgents - an AI-agnostic development workflow framework.
4
+
5
+ ## Command Recognition
6
+
7
+ When the user types commands starting with `pa:`, recognize and execute them:
8
+
9
+ ### Core Commands
10
+ | Command | Action |
11
+ |---------|--------|
12
+ | `pa:help` | Show all available commands |
13
+ | `pa:feature "name"` | Start new feature workflow |
14
+ | `pa:fix "description"` | Quick bug fix mode |
15
+ | `pa:status` | Show current progress |
16
+
17
+ ### Documentation Commands
18
+ | Command | Action |
19
+ |---------|--------|
20
+ | `pa:doc` | Show documentation options |
21
+ | `pa:doc-full` | Generate full project documentation |
22
+ | `pa:doc-moderate` | Generate balanced documentation |
23
+ | `pa:doc-lite` | Generate quick reference |
24
+ | `pa:doc-module [name]` | Document specific module |
25
+ | `pa:doc-file [path]` | Document specific file |
26
+ | `pa:doc-api` | Generate API documentation |
27
+ | `pa:readme` | Generate/update README |
28
+ | `pa:changelog` | Update CHANGELOG.md |
29
+ | `pa:release` | Generate release notes |
30
+ | `pa:release [version]` | Version-specific release notes |
31
+
32
+ ### Quality Commands
33
+ | Command | Action |
34
+ |---------|--------|
35
+ | `pa:qa` | Run quality assurance checks |
36
+ | `pa:test` | Run test workflow |
37
+ | `pa:review` | Code review workflow |
38
+
39
+ ### Deployment Commands
40
+ | Command | Action |
41
+ |---------|--------|
42
+ | `pa:deploy` | Deployment preparation |
43
+ | `pa:rollback` | Rollback procedures |
44
+
45
+ ## How to Execute Commands
46
+
47
+ When user types a `pa:` command:
48
+
49
+ 1. **Read the corresponding prompt file** from `./proagents/prompts/`
50
+ 2. **Follow the workflow** defined in that prompt
51
+ 3. **Use project context** from `./proagents/` folder
52
+
53
+ ### Prompt File Mapping
54
+ - `pa:feature` → `./proagents/prompts/00-init.md` + workflow
55
+ - `pa:fix` → `./proagents/workflow-modes/entry-modes.md` (Bug Fix section)
56
+ - `pa:doc*` → `./proagents/prompts/07-documentation.md`
57
+ - `pa:qa` → `./proagents/checklists/code-quality.md`
58
+ - `pa:test` → `./proagents/prompts/06-testing.md`
59
+ - `pa:deploy` → `./proagents/prompts/08-deployment.md`
60
+ - `pa:release` → `./proagents/prompts/07-documentation.md` (Release Notes section)
61
+
62
+ ## Workflow Reference
63
+
64
+ Full workflow documentation: `./proagents/WORKFLOW.md`
65
+ Quick command reference: `./proagents/PROAGENTS.md`
66
+
67
+ ## Important
68
+
69
+ - Always check `./proagents/` folder for project-specific configurations
70
+ - Preserve user's `proagents.config.yaml` settings
71
+ - Follow existing code patterns found in the project
@@ -0,0 +1,33 @@
1
+ # ProAgents Commands for Claude
2
+
3
+ This project uses ProAgents. Recognize `pa:` commands:
4
+
5
+ ## Commands
6
+
7
+ ```
8
+ pa:help → Show all commands
9
+ pa:feature "name" → Start feature (read ./proagents/WORKFLOW.md)
10
+ pa:fix "bug" → Bug fix mode (read ./proagents/workflow-modes/entry-modes.md)
11
+ pa:status → Show progress
12
+ pa:doc → Documentation options
13
+ pa:doc-full → Full docs (read ./proagents/prompts/07-documentation.md)
14
+ pa:doc-moderate → Balanced docs
15
+ pa:doc-lite → Quick reference
16
+ pa:qa → Quality checks (read ./proagents/checklists/code-quality.md)
17
+ pa:test → Test workflow (read ./proagents/prompts/06-testing.md)
18
+ pa:deploy → Deployment (read ./proagents/prompts/08-deployment.md)
19
+ pa:release → Release notes
20
+ pa:release [ver] → Version-specific notes
21
+ ```
22
+
23
+ ## On `pa:` command
24
+
25
+ 1. Read the corresponding file in `./proagents/prompts/` or `./proagents/workflow-modes/`
26
+ 2. Follow the workflow instructions
27
+ 3. Use project config from `./proagents/proagents.config.yaml`
28
+
29
+ ## Key Files
30
+
31
+ - `./proagents/WORKFLOW.md` - Full 10-phase workflow
32
+ - `./proagents/PROAGENTS.md` - Quick command reference
33
+ - `./proagents/prompts/` - Phase-specific prompts