Files
wehub-resource-sync e76d0ad892
CI / Test (macos-latest, Node 18.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (ubuntu-latest, Node 18.x, bun) (push) Has been cancelled
CI / Test (ubuntu-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (ubuntu-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (ubuntu-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (ubuntu-latest, Node 20.x, bun) (push) Has been cancelled
CI / Test (ubuntu-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (ubuntu-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (ubuntu-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, yarn) (push) Has been cancelled
CI / Test (ubuntu-latest, Node 22.x, bun) (push) Has been cancelled
CI / Test (ubuntu-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (ubuntu-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (ubuntu-latest, Node 22.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, yarn) (push) Has been cancelled
CI / Validate Components (push) Has been cancelled
CI / Python Tests (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / Lint (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:15:35 +08:00

51 lines
1.7 KiB
JavaScript

#!/usr/bin/env node
/**
* Cursor sessionStart hook — inject ECC_AGENT_DATA_HOME for the composer session.
*
* Cursor passes session-scoped env from sessionStart output to all later hooks.
* @see https://cursor.com/docs/hooks
*/
const {
getCursorSessionEnvPayload,
resolveAgentDataHome,
AGENT_DATA_HOME_ENV,
} = require('../lib/agent-data-home');
const { readStdinJson, log } = require('../lib/utils');
function main() {
readStdinJson()
.then(() => {
const envPayload = getCursorSessionEnvPayload({ preferCursorDefault: true });
const agentDataHome = envPayload[AGENT_DATA_HOME_ENV];
const payload = {
env: envPayload,
additional_context: [
'ECC memory persistence uses a dedicated agent data root for this Cursor session.',
`${AGENT_DATA_HOME_ENV}=${agentDataHome}`,
'Session summaries, learned skills, aliases, and metrics live under that directory.',
'Override via shell env, project .cursor/ecc-agent-data.json, or ECC docs (issue #2065).',
].join('\n'),
};
process.stdout.write(`${JSON.stringify(payload)}\n`);
log(`[cursor-session-env] Set ${AGENT_DATA_HOME_ENV}=${agentDataHome}`);
process.exit(0);
})
.catch(error => {
const fallbackHome = resolveAgentDataHome({ preferCursorDefault: true });
const payload = {
env: { [AGENT_DATA_HOME_ENV]: fallbackHome },
};
process.stdout.write(`${JSON.stringify(payload)}\n`);
log(`[cursor-session-env] Fallback ${AGENT_DATA_HOME_ENV}=${fallbackHome} (${error.message})`);
process.exit(0);
});
}
if (require.main === module) {
main();
}
module.exports = { main };