stigmergy 1.3.77-beta.1 → 1.3.77-beta.2
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/package.json
CHANGED
|
@@ -725,6 +725,88 @@ class ResumeSessionCommand {
|
|
|
725
725
|
return 1;
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
|
+
|
|
729
|
+
// Execute resume command with enhanced functionality
|
|
730
|
+
executeEnhanced(args) {
|
|
731
|
+
try {
|
|
732
|
+
const options = this.parseOptions(args);
|
|
733
|
+
|
|
734
|
+
// For default mode (no specific options), use the enhanced independent-resume.js
|
|
735
|
+
// This provides the improved filtering and formatting we added
|
|
736
|
+
if (!options.cli && !options.limit && !options.showAll && !options.search &&
|
|
737
|
+
!options.timeRange && !options.format && args.length === 0) {
|
|
738
|
+
// Call the enhanced independent-resume.js script directly
|
|
739
|
+
const { spawnSync } = require('child_process');
|
|
740
|
+
const path = require('path');
|
|
741
|
+
|
|
742
|
+
const scriptPath = path.join(__dirname, '../../../..', 'skills', 'resumesession', 'independent-resume.js');
|
|
743
|
+
const result = spawnSync('node', [scriptPath], {
|
|
744
|
+
stdio: 'pipe',
|
|
745
|
+
encoding: 'utf-8',
|
|
746
|
+
cwd: process.cwd()
|
|
747
|
+
});
|
|
748
|
+
|
|
749
|
+
if (result.status === 0) {
|
|
750
|
+
console.log(result.stdout);
|
|
751
|
+
return 0;
|
|
752
|
+
} else {
|
|
753
|
+
// If the enhanced version fails, fall back to the original implementation
|
|
754
|
+
console.error('Enhanced resumesession failed, falling back to original implementation');
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// Fall back to original implementation
|
|
759
|
+
const allSessions = this.scanAllCLISessions(this.projectPath);
|
|
760
|
+
const filteredSessions = this.applyFilters(allSessions, options, this.projectPath);
|
|
761
|
+
|
|
762
|
+
let response;
|
|
763
|
+
|
|
764
|
+
// 默认模式:显示最近的会话上下文
|
|
765
|
+
if (options.format === 'context' && !options.limit && !options.showAll) {
|
|
766
|
+
// 找到最近的会话
|
|
767
|
+
let session = filteredSessions[0] || null;
|
|
768
|
+
|
|
769
|
+
// 如果最近的会话内容为空,尝试上一个会话
|
|
770
|
+
if (session && !this.hasContent(session) && filteredSessions.length > 1) {
|
|
771
|
+
for (let i = 1; i < filteredSessions.length; i++) {
|
|
772
|
+
if (this.hasContent(filteredSessions[i])) {
|
|
773
|
+
session = filteredSessions[i];
|
|
774
|
+
break;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
if (!session) {
|
|
780
|
+
response = ` sorell ${options.showAll ? '暂无会话记录' : '当前项目暂无会话记录'}\n\n💡 **提示:** 尝试: stigmergy resume --all 查看所有项目的会话`;
|
|
781
|
+
} else {
|
|
782
|
+
response = this.formatContext(session, options.full);
|
|
783
|
+
}
|
|
784
|
+
} else {
|
|
785
|
+
// 列表模式或其他格式
|
|
786
|
+
switch (options.format) {
|
|
787
|
+
case 'timeline':
|
|
788
|
+
response = this.formatTimeline(filteredSessions);
|
|
789
|
+
break;
|
|
790
|
+
case 'detailed':
|
|
791
|
+
response = this.formatDetailed(filteredSessions);
|
|
792
|
+
break;
|
|
793
|
+
case 'context':
|
|
794
|
+
response = this.formatContext(filteredSessions[0] || null, options.full);
|
|
795
|
+
break;
|
|
796
|
+
case 'summary':
|
|
797
|
+
default:
|
|
798
|
+
response = this.formatSummary(filteredSessions);
|
|
799
|
+
break;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
console.log(response);
|
|
804
|
+
return 0;
|
|
805
|
+
} catch (error) {
|
|
806
|
+
console.error(`❌ 历史查询失败: ${error.message}`);
|
|
807
|
+
return 1;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
728
810
|
}
|
|
729
811
|
|
|
730
812
|
// Export for use as module
|
|
@@ -733,7 +815,7 @@ module.exports = ResumeSessionCommand;
|
|
|
733
815
|
// Export handler function for router
|
|
734
816
|
module.exports.handleResumeCommand = async function(args, options) {
|
|
735
817
|
const command = new ResumeSessionCommand();
|
|
736
|
-
return command.
|
|
818
|
+
return command.executeEnhanced(args);
|
|
737
819
|
};
|
|
738
820
|
|
|
739
821
|
// Export help function
|