sumulige-claude 1.0.11 → 1.1.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/.claude/commands/todos.md +41 -6
- package/.claude/hooks/session-restore.cjs +102 -0
- package/.claude/hooks/session-save.cjs +164 -0
- package/.claude/hooks/todo-manager.cjs +262 -141
- package/.claude/settings.local.json +11 -1
- package/.claude/skills/api-tester/SKILL.md +52 -23
- package/.claude/skills/test-workflow/SKILL.md +191 -0
- package/.claude/templates/tasks/develop.md +69 -0
- package/.claude/templates/tasks/research.md +64 -0
- package/.claude/templates/tasks/test.md +96 -0
- package/.claude-plugin/marketplace.json +2 -2
- package/.versionrc +25 -0
- package/AGENTS.md +7 -1
- package/CHANGELOG.md +83 -4
- package/PROJECT_STRUCTURE.md +40 -3
- package/Q&A.md +184 -0
- package/README.md +52 -2
- package/cli.js +74 -5
- package/config/official-skills.json +183 -0
- package/development/todos/.state.json +4 -0
- package/development/todos/INDEX.md +64 -38
- package/docs/RELEASE.md +93 -0
- package/lib/commands.js +1657 -39
- package/lib/utils.js +102 -14
- package/lib/version-check.js +169 -0
- package/package.json +7 -2
- package/template/.claude/hooks/project-kickoff.cjs +190 -1
- package/template/.claude/hooks/session-restore.cjs +102 -0
- package/template/.claude/hooks/session-save.cjs +164 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Session Save Hook - Save conversation context to file
|
|
4
|
+
*
|
|
5
|
+
* Triggered after each conversation turn
|
|
6
|
+
* Saves conversation history, context, and state
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
const PROJECT_DIR = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
13
|
+
const SESSIONS_DIR = path.join(PROJECT_DIR, '.claude', 'sessions');
|
|
14
|
+
const MEMORY_FILE = path.join(PROJECT_DIR, '.claude', 'MEMORY.md');
|
|
15
|
+
|
|
16
|
+
// Ensure sessions directory exists
|
|
17
|
+
if (!fs.existsSync(SESSIONS_DIR)) {
|
|
18
|
+
fs.mkdirSync(SESSIONS_DIR, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Generate session filename
|
|
23
|
+
*/
|
|
24
|
+
function getSessionFilename() {
|
|
25
|
+
const now = new Date();
|
|
26
|
+
const date = now.toISOString().split('T')[0];
|
|
27
|
+
const time = now.toTimeString().split(' ')[0].replace(/:/g, '-');
|
|
28
|
+
return `session_${date}_${time}.md`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Save session context
|
|
33
|
+
*/
|
|
34
|
+
function saveSession(context) {
|
|
35
|
+
const filename = getSessionFilename();
|
|
36
|
+
const filepath = path.join(SESSIONS_DIR, filename);
|
|
37
|
+
|
|
38
|
+
const content = `# Session - ${new Date().toISOString()}
|
|
39
|
+
|
|
40
|
+
> Type: ${context.type || 'chat'}
|
|
41
|
+
> Model: ${context.model || 'unknown'}
|
|
42
|
+
> Duration: ${context.duration || 'unknown'}
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Summary
|
|
47
|
+
|
|
48
|
+
${context.summary || 'No summary provided'}
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Context
|
|
53
|
+
|
|
54
|
+
\`\`\`json
|
|
55
|
+
${JSON.stringify(context.metadata || {}, null, 2)}
|
|
56
|
+
\`\`\`
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Key Points
|
|
61
|
+
|
|
62
|
+
${(context.keyPoints || []).map((p, i) => `${i + 1}. ${p}`).join('\n')}
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Artifacts
|
|
67
|
+
|
|
68
|
+
${(context.artifacts || []).map(a => `- ${a}`).join('\n') || 'None'}
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Next Steps
|
|
73
|
+
|
|
74
|
+
${context.nextSteps || 'None'}
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
*Session saved at: ${new Date().toISOString()}*
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
fs.writeFileSync(filepath, content, 'utf-8');
|
|
82
|
+
|
|
83
|
+
// Update sessions index
|
|
84
|
+
updateSessionsIndex();
|
|
85
|
+
|
|
86
|
+
return filename;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Update sessions index
|
|
91
|
+
*/
|
|
92
|
+
function updateSessionsIndex() {
|
|
93
|
+
const files = fs.readdirSync(SESSIONS_DIR)
|
|
94
|
+
.filter(f => f.endsWith('.md'))
|
|
95
|
+
.sort()
|
|
96
|
+
.reverse();
|
|
97
|
+
|
|
98
|
+
const indexPath = path.join(SESSIONS_DIR, 'INDEX.md');
|
|
99
|
+
|
|
100
|
+
let content = `# Sessions Index
|
|
101
|
+
|
|
102
|
+
> Total sessions: ${files.length}
|
|
103
|
+
> Last updated: ${new Date().toISOString()}
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Recent Sessions
|
|
108
|
+
|
|
109
|
+
${files.slice(0, 20).map(f => {
|
|
110
|
+
const filepath = path.join(SESSIONS_DIR, f);
|
|
111
|
+
const stat = fs.statSync(filepath);
|
|
112
|
+
return `- [${f}](${f}) - ${stat.mtime.toISOString()}`;
|
|
113
|
+
}).join('\n')}
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
`;
|
|
117
|
+
|
|
118
|
+
fs.writeFileSync(indexPath, content, 'utf-8');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Update MEMORY.md with latest context
|
|
123
|
+
*/
|
|
124
|
+
function updateMemory(context) {
|
|
125
|
+
const timestamp = new Date().toISOString();
|
|
126
|
+
|
|
127
|
+
let content = '';
|
|
128
|
+
|
|
129
|
+
if (fs.existsSync(MEMORY_FILE)) {
|
|
130
|
+
content = fs.readFileSync(MEMORY_FILE, 'utf-8');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Check if we need to add a new entry
|
|
134
|
+
const newEntry = `\n## ${timestamp.split('T')[0]}\n\n${
|
|
135
|
+
context.summary || context.keyPoints?.join('\n') || 'No details'
|
|
136
|
+
}\n`;
|
|
137
|
+
|
|
138
|
+
// Keep only last 7 days
|
|
139
|
+
const entries = content.split('## ').slice(1, 8);
|
|
140
|
+
content = '# Memory\n\n<!-- Project memory updated by AI -->\n' +
|
|
141
|
+
'## ' + entries.join('## ') + newEntry;
|
|
142
|
+
|
|
143
|
+
fs.writeFileSync(MEMORY_FILE, content, 'utf-8');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Main execution
|
|
147
|
+
if (require.main === module) {
|
|
148
|
+
const args = process.argv.slice(2);
|
|
149
|
+
|
|
150
|
+
if (args[0] === '--save' && args[1]) {
|
|
151
|
+
const contextData = JSON.parse(fs.readFileSync(args[1], 'utf-8'));
|
|
152
|
+
const filename = saveSession(contextData);
|
|
153
|
+
console.log(`✅ Session saved: ${filename}`);
|
|
154
|
+
|
|
155
|
+
if (contextData.addToMemory !== false) {
|
|
156
|
+
updateMemory(contextData);
|
|
157
|
+
console.log(`✅ Memory updated`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
exports.saveSession = saveSession;
|
|
163
|
+
exports.updateMemory = updateMemory;
|
|
164
|
+
exports.updateSessionsIndex = updateSessionsIndex;
|