- Refactor monolithic index.js (2646 lines) into src/{webex,integrations,
cards,flows,commands,services} modules; replace node-fetch/form-data
with native fetch/FormData; move all secrets to .env via dotenv
- Add dockerized remote SIW agent (docker/remote-agent/) with cross-arch
buildx packaging (arm64 Mac -> linux/amd64), idempotent install.sh
deploy bundle, and docker-free ZIP inspector for arch verification
- Bot hosts a WebSocket server; agent proxies SIW requests with a
per-request insecure:true flag, replacing the process-wide
NODE_TLS_REJECT_UNAUTHORIZED bypass
- Add ESLint flat config + Prettier, rewrite Dockerfile as non-root
multi-stage node:22-alpine build, README covering setup / deploy /
remote agent workflow
- Fix parseStoreArg to read trigger.prompt correctly (was indexing past
the framework's post-match slice); register /help as regex (string
matcher only compares the first token); switch catch-all to /.+/
(previous /.*/gim was stateful due to the g flag); remove
/fixDisplayNames command and its flow/card
Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
705 B
JavaScript
25 lines
705 B
JavaScript
const LEVELS = { debug: 10, info: 20, warn: 30, error: 40 };
|
|
|
|
function currentLevel() {
|
|
const raw = (process.env.LOG_LEVEL ?? 'info').toLowerCase();
|
|
return LEVELS[raw] ?? LEVELS.info;
|
|
}
|
|
|
|
function timestamp() {
|
|
return new Date().toISOString();
|
|
}
|
|
|
|
function log(level, ...args) {
|
|
if (LEVELS[level] < currentLevel()) return;
|
|
const stream = level === 'error' || level === 'warn' ? console.error : console.log;
|
|
stream(`[${timestamp()}] [${level.toUpperCase()}]`, ...args);
|
|
}
|
|
|
|
export const logger = {
|
|
debug: (...a) => log('debug', ...a),
|
|
info: (...a) => log('info', ...a),
|
|
warn: (...a) => log('warn', ...a),
|
|
error: (...a) => log('error', ...a),
|
|
};
|
|
|
|
export default logger;
|