- Introduced coding standards for TypeScript and React in SKILL.md. - Added continuous learning skill with configuration and evaluation scripts. - Created detail layout guidelines for read-only pages. - Established form layout rules for data-entry forms. - Documented project guidelines for the frontend monorepo. - Implemented security review checklist for frontend/Electron applications. - Developed a verification loop skill for comprehensive session checks. This commit enhances the skill set available for developers, ensuring adherence to best practices and improving code quality.
49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* PreCompact Hook - Save state before context compaction
|
|
*
|
|
* Cross-platform (Windows, macOS, Linux)
|
|
*
|
|
* Runs before Cursor compacts context, giving you a chance to
|
|
* preserve important state that might get lost in summarization.
|
|
*/
|
|
|
|
const path = require('path');
|
|
const {
|
|
getSessionsDir,
|
|
getDateTimeString,
|
|
getTimeString,
|
|
findFiles,
|
|
ensureDir,
|
|
appendFile,
|
|
log
|
|
} = require('../lib/utils');
|
|
|
|
async function main() {
|
|
const sessionsDir = getSessionsDir();
|
|
const compactionLog = path.join(sessionsDir, 'compaction-log.txt');
|
|
|
|
ensureDir(sessionsDir);
|
|
|
|
// Log compaction event with timestamp
|
|
const timestamp = getDateTimeString();
|
|
appendFile(compactionLog, `[${timestamp}] Context compaction triggered\n`);
|
|
|
|
// If there's an active session file, note the compaction
|
|
const sessions = findFiles(sessionsDir, '*.tmp');
|
|
|
|
if (sessions.length > 0) {
|
|
const activeSession = sessions[0].path;
|
|
const timeStr = getTimeString();
|
|
appendFile(activeSession, `\n---\n**[Compaction occurred at ${timeStr}]** - Context was summarized\n`);
|
|
}
|
|
|
|
log('[PreCompact] State saved before compaction');
|
|
process.exit(0);
|
|
}
|
|
|
|
main().catch(err => {
|
|
console.error('[PreCompact] Error:', err.message);
|
|
process.exit(0);
|
|
});
|