claude-autopm 2.6.0 → 2.7.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/bin/autopm.js +2 -0
- package/lib/cli/commands/context.js +477 -0
- package/lib/cli/commands/pm.js +300 -1
- package/lib/services/ContextService.js +595 -0
- package/lib/services/UtilityService.js +847 -0
- package/package.json +1 -1
package/lib/cli/commands/pm.js
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
const WorkflowService = require('../../services/WorkflowService');
|
|
26
26
|
const IssueService = require('../../services/IssueService');
|
|
27
27
|
const EpicService = require('../../services/EpicService');
|
|
28
|
+
const UtilityService = require('../../services/UtilityService');
|
|
28
29
|
const fs = require('fs-extra');
|
|
29
30
|
const ora = require('ora');
|
|
30
31
|
const chalk = require('chalk');
|
|
@@ -430,6 +431,217 @@ async function pmBlocked(argv) {
|
|
|
430
431
|
}
|
|
431
432
|
}
|
|
432
433
|
|
|
434
|
+
/**
|
|
435
|
+
* PM Init - Initialize PM structure
|
|
436
|
+
* @param {Object} argv - Command arguments
|
|
437
|
+
*/
|
|
438
|
+
async function pmInit(argv) {
|
|
439
|
+
const spinner = ora('Initializing project structure...').start();
|
|
440
|
+
try {
|
|
441
|
+
const utilityService = new UtilityService();
|
|
442
|
+
const result = await utilityService.initializeProject({
|
|
443
|
+
force: argv.force,
|
|
444
|
+
template: argv.template
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
spinner.succeed(chalk.green('Project initialized'));
|
|
448
|
+
console.log(chalk.cyan('\n📁 Created:\n'));
|
|
449
|
+
result.created.forEach(item => {
|
|
450
|
+
console.log(chalk.gray(` ✓ ${item}`));
|
|
451
|
+
});
|
|
452
|
+
console.log(chalk.green('\n✅ Ready to use ClaudeAutoPM!'));
|
|
453
|
+
console.log(chalk.gray('Next steps:'));
|
|
454
|
+
console.log(chalk.gray(' 1. autopm config set provider github'));
|
|
455
|
+
console.log(chalk.gray(' 2. autopm prd create my-feature\n'));
|
|
456
|
+
} catch (error) {
|
|
457
|
+
spinner.fail(chalk.red('Failed to initialize'));
|
|
458
|
+
console.error(chalk.red(`\nError: ${error.message}\n`));
|
|
459
|
+
process.exit(1);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* PM Validate - Validate project structure
|
|
465
|
+
* @param {Object} argv - Command arguments
|
|
466
|
+
*/
|
|
467
|
+
async function pmValidate(argv) {
|
|
468
|
+
const spinner = ora('Validating project...').start();
|
|
469
|
+
try {
|
|
470
|
+
const utilityService = new UtilityService();
|
|
471
|
+
const result = await utilityService.validateProject({
|
|
472
|
+
strict: argv.strict,
|
|
473
|
+
fix: argv.fix
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
if (result.valid) {
|
|
477
|
+
spinner.succeed(chalk.green('Project is valid'));
|
|
478
|
+
} else {
|
|
479
|
+
spinner.warn(chalk.yellow('Issues found'));
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
if (result.errors.length > 0) {
|
|
483
|
+
console.log(chalk.red('\n❌ Errors:\n'));
|
|
484
|
+
result.errors.forEach(err => console.log(chalk.red(` • ${err}`)));
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
if (result.warnings.length > 0) {
|
|
488
|
+
console.log(chalk.yellow('\n⚠️ Warnings:\n'));
|
|
489
|
+
result.warnings.forEach(warn => console.log(chalk.yellow(` • ${warn}`)));
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
if (!result.valid) {
|
|
493
|
+
console.log(chalk.cyan('\n💡 Fix issues automatically:'));
|
|
494
|
+
console.log(chalk.gray(' autopm pm validate --fix\n'));
|
|
495
|
+
} else {
|
|
496
|
+
console.log(chalk.green('\n✅ Project structure is valid\n'));
|
|
497
|
+
}
|
|
498
|
+
} catch (error) {
|
|
499
|
+
spinner.fail(chalk.red('Validation failed'));
|
|
500
|
+
console.error(chalk.red(`\nError: ${error.message}\n`));
|
|
501
|
+
process.exit(1);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* PM Sync - Sync with provider
|
|
507
|
+
* @param {Object} argv - Command arguments
|
|
508
|
+
*/
|
|
509
|
+
async function pmSync(argv) {
|
|
510
|
+
const spinner = ora('Syncing with provider...').start();
|
|
511
|
+
try {
|
|
512
|
+
const utilityService = new UtilityService();
|
|
513
|
+
const result = await utilityService.syncAll({
|
|
514
|
+
type: argv.type || 'all',
|
|
515
|
+
dryRun: argv.dryRun
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
spinner.succeed(chalk.green('Sync complete'));
|
|
519
|
+
console.log(chalk.cyan('\n📊 Sync Results:\n'));
|
|
520
|
+
console.log(chalk.gray(` Epics: ${result.synced.epics || 0}`));
|
|
521
|
+
console.log(chalk.gray(` Issues: ${result.synced.issues || 0}`));
|
|
522
|
+
console.log(chalk.gray(` PRDs: ${result.synced.prds || 0}`));
|
|
523
|
+
|
|
524
|
+
if (result.errors.length > 0) {
|
|
525
|
+
console.log(chalk.red('\n❌ Errors:\n'));
|
|
526
|
+
result.errors.forEach(err => console.log(chalk.red(` • ${err}`)));
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
console.log('');
|
|
530
|
+
} catch (error) {
|
|
531
|
+
spinner.fail(chalk.red('Sync failed'));
|
|
532
|
+
console.error(chalk.red(`\nError: ${error.message}\n`));
|
|
533
|
+
process.exit(1);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* PM Clean - Clean artifacts
|
|
539
|
+
* @param {Object} argv - Command arguments
|
|
540
|
+
*/
|
|
541
|
+
async function pmClean(argv) {
|
|
542
|
+
const spinner = ora('Cleaning artifacts...').start();
|
|
543
|
+
try {
|
|
544
|
+
const utilityService = new UtilityService();
|
|
545
|
+
const result = await utilityService.cleanArtifacts({
|
|
546
|
+
archive: argv.archive,
|
|
547
|
+
dryRun: argv.dryRun
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
spinner.succeed(chalk.green('Cleanup complete'));
|
|
551
|
+
console.log(chalk.cyan('\n🧹 Cleanup Results:\n'));
|
|
552
|
+
console.log(chalk.gray(` Removed: ${result.removed.length} files`));
|
|
553
|
+
console.log(chalk.gray(` Archived: ${result.archived.length} files`));
|
|
554
|
+
|
|
555
|
+
if (argv.dryRun) {
|
|
556
|
+
console.log(chalk.yellow('\n⚠️ Dry run mode - no changes made'));
|
|
557
|
+
console.log(chalk.gray('Remove --dry-run to apply changes\n'));
|
|
558
|
+
} else {
|
|
559
|
+
console.log('');
|
|
560
|
+
}
|
|
561
|
+
} catch (error) {
|
|
562
|
+
spinner.fail(chalk.red('Cleanup failed'));
|
|
563
|
+
console.error(chalk.red(`\nError: ${error.message}\n`));
|
|
564
|
+
process.exit(1);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* PM Search - Search entities
|
|
570
|
+
* @param {Object} argv - Command arguments
|
|
571
|
+
*/
|
|
572
|
+
async function pmSearch(argv) {
|
|
573
|
+
const spinner = ora('Searching...').start();
|
|
574
|
+
try {
|
|
575
|
+
const utilityService = new UtilityService();
|
|
576
|
+
const result = await utilityService.searchEntities(argv.query, {
|
|
577
|
+
type: argv.type,
|
|
578
|
+
regex: argv.regex,
|
|
579
|
+
status: argv.status
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
spinner.succeed(chalk.green(`Found ${result.results.length} matches`));
|
|
583
|
+
|
|
584
|
+
console.log(chalk.cyan('\n🔍 Search Results:\n'));
|
|
585
|
+
|
|
586
|
+
if (result.results.length === 0) {
|
|
587
|
+
console.log(chalk.gray(' No matches found\n'));
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
// Group by type
|
|
592
|
+
const grouped = {};
|
|
593
|
+
result.results.forEach(item => {
|
|
594
|
+
if (!grouped[item.type]) grouped[item.type] = [];
|
|
595
|
+
grouped[item.type].push(item);
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
Object.entries(grouped).forEach(([type, items]) => {
|
|
599
|
+
console.log(chalk.bold(`\n${type.toUpperCase()}S:`));
|
|
600
|
+
items.forEach(item => {
|
|
601
|
+
console.log(chalk.gray(` • ${item.id}: ${item.title}`));
|
|
602
|
+
if (item.match) {
|
|
603
|
+
console.log(chalk.yellow(` "${item.match.substring(0, 80)}..."`));
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
});
|
|
607
|
+
console.log('');
|
|
608
|
+
} catch (error) {
|
|
609
|
+
spinner.fail(chalk.red('Search failed'));
|
|
610
|
+
console.error(chalk.red(`\nError: ${error.message}\n`));
|
|
611
|
+
process.exit(1);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* PM Import - Import from external source
|
|
617
|
+
* @param {Object} argv - Command arguments
|
|
618
|
+
*/
|
|
619
|
+
async function pmImport(argv) {
|
|
620
|
+
const spinner = ora('Importing...').start();
|
|
621
|
+
try {
|
|
622
|
+
const utilityService = new UtilityService();
|
|
623
|
+
const result = await utilityService.importFromProvider(argv.source, {
|
|
624
|
+
provider: argv.provider,
|
|
625
|
+
mapping: argv.mapping ? JSON.parse(argv.mapping) : null
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
spinner.succeed(chalk.green('Import complete'));
|
|
629
|
+
console.log(chalk.cyan('\n📥 Import Results:\n'));
|
|
630
|
+
console.log(chalk.gray(` Imported: ${result.imported.length} items`));
|
|
631
|
+
|
|
632
|
+
if (result.errors.length > 0) {
|
|
633
|
+
console.log(chalk.red('\n❌ Errors:\n'));
|
|
634
|
+
result.errors.forEach(err => console.log(chalk.red(` • ${err}`)));
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
console.log('');
|
|
638
|
+
} catch (error) {
|
|
639
|
+
spinner.fail(chalk.red('Import failed'));
|
|
640
|
+
console.error(chalk.red(`\nError: ${error.message}\n`));
|
|
641
|
+
process.exit(1);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
433
645
|
/**
|
|
434
646
|
* Command builder - registers all subcommands
|
|
435
647
|
* @param {Object} yargs - Yargs instance
|
|
@@ -491,6 +703,81 @@ function builder(yargs) {
|
|
|
491
703
|
},
|
|
492
704
|
pmBlocked
|
|
493
705
|
)
|
|
706
|
+
.command(
|
|
707
|
+
'init',
|
|
708
|
+
'Initialize PM structure',
|
|
709
|
+
(yargs) => {
|
|
710
|
+
return yargs
|
|
711
|
+
.option('force', { type: 'boolean', desc: 'Overwrite existing files' })
|
|
712
|
+
.option('template', { type: 'string', desc: 'Template file to use' })
|
|
713
|
+
.example('autopm pm init', 'Initialize project PM structure')
|
|
714
|
+
.example('autopm pm init --force', 'Reinitialize with overwrite');
|
|
715
|
+
},
|
|
716
|
+
pmInit
|
|
717
|
+
)
|
|
718
|
+
.command(
|
|
719
|
+
'validate',
|
|
720
|
+
'Validate project structure',
|
|
721
|
+
(yargs) => {
|
|
722
|
+
return yargs
|
|
723
|
+
.option('strict', { type: 'boolean', desc: 'Strict validation mode' })
|
|
724
|
+
.option('fix', { type: 'boolean', desc: 'Auto-fix issues' })
|
|
725
|
+
.example('autopm pm validate', 'Validate project structure')
|
|
726
|
+
.example('autopm pm validate --fix', 'Validate and auto-fix issues');
|
|
727
|
+
},
|
|
728
|
+
pmValidate
|
|
729
|
+
)
|
|
730
|
+
.command(
|
|
731
|
+
'sync',
|
|
732
|
+
'Sync with provider',
|
|
733
|
+
(yargs) => {
|
|
734
|
+
return yargs
|
|
735
|
+
.option('type', { type: 'string', choices: ['all', 'epic', 'issue', 'prd'], default: 'all', desc: 'Entity type to sync' })
|
|
736
|
+
.option('dry-run', { type: 'boolean', desc: 'Preview changes without applying' })
|
|
737
|
+
.example('autopm pm sync', 'Sync all entities')
|
|
738
|
+
.example('autopm pm sync --type epic --dry-run', 'Preview epic sync');
|
|
739
|
+
},
|
|
740
|
+
pmSync
|
|
741
|
+
)
|
|
742
|
+
.command(
|
|
743
|
+
'clean',
|
|
744
|
+
'Clean old artifacts',
|
|
745
|
+
(yargs) => {
|
|
746
|
+
return yargs
|
|
747
|
+
.option('archive', { type: 'boolean', default: true, desc: 'Archive before delete' })
|
|
748
|
+
.option('dry-run', { type: 'boolean', desc: 'Preview cleanup' })
|
|
749
|
+
.example('autopm pm clean', 'Clean stale files (with archive)')
|
|
750
|
+
.example('autopm pm clean --dry-run', 'Preview cleanup');
|
|
751
|
+
},
|
|
752
|
+
pmClean
|
|
753
|
+
)
|
|
754
|
+
.command(
|
|
755
|
+
'search <query>',
|
|
756
|
+
'Search entities',
|
|
757
|
+
(yargs) => {
|
|
758
|
+
return yargs
|
|
759
|
+
.positional('query', { type: 'string', describe: 'Search query' })
|
|
760
|
+
.option('type', { type: 'string', choices: ['all', 'epic', 'issue', 'prd'], default: 'all', desc: 'Entity type' })
|
|
761
|
+
.option('regex', { type: 'boolean', desc: 'Use regex pattern' })
|
|
762
|
+
.option('status', { type: 'string', desc: 'Filter by status' })
|
|
763
|
+
.example('autopm pm search "auth"', 'Search for "auth"')
|
|
764
|
+
.example('autopm pm search --regex "user.*api"', 'Regex search');
|
|
765
|
+
},
|
|
766
|
+
pmSearch
|
|
767
|
+
)
|
|
768
|
+
.command(
|
|
769
|
+
'import <source>',
|
|
770
|
+
'Import from external source',
|
|
771
|
+
(yargs) => {
|
|
772
|
+
return yargs
|
|
773
|
+
.positional('source', { type: 'string', describe: 'Source file path' })
|
|
774
|
+
.option('provider', { type: 'string', choices: ['github', 'azure', 'csv', 'json'], default: 'json', desc: 'Source provider' })
|
|
775
|
+
.option('mapping', { type: 'string', desc: 'Field mapping JSON' })
|
|
776
|
+
.example('autopm pm import data.json', 'Import from JSON')
|
|
777
|
+
.example('autopm pm import data.csv --provider csv', 'Import from CSV');
|
|
778
|
+
},
|
|
779
|
+
pmImport
|
|
780
|
+
)
|
|
494
781
|
.demandCommand(1, 'You must specify a pm command')
|
|
495
782
|
.strictCommands()
|
|
496
783
|
.help();
|
|
@@ -514,6 +801,12 @@ module.exports = {
|
|
|
514
801
|
console.log(' status Project status overview');
|
|
515
802
|
console.log(' in-progress Show all active tasks');
|
|
516
803
|
console.log(' blocked Show all blocked tasks');
|
|
804
|
+
console.log(' init Initialize PM structure');
|
|
805
|
+
console.log(' validate Validate project structure');
|
|
806
|
+
console.log(' sync Sync with provider');
|
|
807
|
+
console.log(' clean Clean old artifacts');
|
|
808
|
+
console.log(' search Search entities');
|
|
809
|
+
console.log(' import Import from external source');
|
|
517
810
|
console.log('\nUse: autopm pm <command> --help for more info\n');
|
|
518
811
|
}
|
|
519
812
|
},
|
|
@@ -523,6 +816,12 @@ module.exports = {
|
|
|
523
816
|
standup: pmStandup,
|
|
524
817
|
status: pmStatus,
|
|
525
818
|
inProgress: pmInProgress,
|
|
526
|
-
blocked: pmBlocked
|
|
819
|
+
blocked: pmBlocked,
|
|
820
|
+
init: pmInit,
|
|
821
|
+
validate: pmValidate,
|
|
822
|
+
sync: pmSync,
|
|
823
|
+
clean: pmClean,
|
|
824
|
+
search: pmSearch,
|
|
825
|
+
import: pmImport
|
|
527
826
|
}
|
|
528
827
|
};
|