{"_id":"@diamondjs/primafacie","name":"@diamondjs/primafacie","dist-tags":{"latest":"2.2.2"},"versions":{"2.2.2":{"name":"@diamondjs/primafacie","version":"2.2.2","description":"Primafacie logging paradigm - typed, symbol-tagged, caller-aware Print() with pluggable sinks","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./node":{"types":"./dist/node.d.ts","import":"./dist/node.mjs","require":"./dist/node.js"}},"scripts":{"build":"tsup src/index.ts src/node.ts --format cjs,esm --dts --clean","dev":"tsup src/index.ts src/node.ts --format cjs,esm --dts --watch","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","lint":"eslint src --ext .ts","clean":"rm -rf dist"},"keywords":["logging","diamondjs","primafacie"],"repository":{"type":"git","url":"git+https://github.com/Node0/diamondjs.git","directory":"packages/primafacie"},"license":"MIT","devDependencies":{"tsup":"^8.0.0"},"publishConfig":{"access":"public"},"_id":"@diamondjs/primafacie@2.2.2","gitHead":"431d824baa7b13459f8d9431b5122432ec52f741","bugs":{"url":"https://github.com/Node0/diamondjs/issues"},"homepage":"https://github.com/Node0/diamondjs#readme","_nodeVersion":"20.18.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-LERMf0L7k458CoYerjMJE4hyw6fqT5dWw24XnCCJnPOT/y+bCaWN7q0c1r+09LVGfGxo7N2o/BRldmi05dihXw==","shasum":"62eb7433e0719f68e0fe49fe7707276ce7e7d262","tarball":"https://registry.npmjs.org/@diamondjs/primafacie/-/primafacie-2.2.2.tgz","fileCount":12,"unpackedSize":34912,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAskF1kz0NF7UV2M1QRoaNqEEc2TFNIq063mIVr4WHTYAiEA4QOU1AOKMzzmkdyIXGlWz8Yy1+6gV5c1f6k+FgP1pYg="}]},"_npmUser":{"name":"jhacobian","email":"joehacobian@gmail.com"},"directories":{},"maintainers":[{"name":"jhacobian","email":"joehacobian@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/primafacie_2.2.2_1787290309383_0.2367565608352673"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-21T05:31:49.142Z","2.2.2":"2026-08-21T05:31:49.519Z","modified":"2026-08-21T05:31:49.925Z"},"maintainers":[{"name":"jhacobian","email":"joehacobian@gmail.com"}],"description":"Primafacie logging paradigm - typed, symbol-tagged, caller-aware Print() with pluggable sinks","homepage":"https://github.com/Node0/diamondjs#readme","keywords":["logging","diamondjs","primafacie"],"repository":{"type":"git","url":"git+https://github.com/Node0/diamondjs.git","directory":"packages/primafacie"},"bugs":{"url":"https://github.com/Node0/diamondjs/issues"},"license":"MIT","readme":"# 💎 @diamondjs/primafacie\n\n**One logging vocabulary for your whole stack: `Print(logType, message)` — typed, symboled, greppable, and pluggable from browser console to datestamped server files.**\n\n---\n\n## What is this?\n\nPrimafacie is the DiamondJS logging paradigm. One call shape, everywhere — the framework's own narration (router decisions, guard outcomes, dev-mode route tables) and your application logs share a single vocabulary:\n\n```typescript\nimport { Print } from '@diamondjs/primafacie';\n\nPrint('STARTING', 'boot sequence');\nPrint('SUCCESS', 'corpus loaded: 1,204 documents');\nPrint('FAILURE', 'save rejected: version conflict');\n```\n\nEvery line carries a type, a symbol, a timestamp, and the caller — color-coded via ANSI in terminals and CSS in browser consoles, and routed to the right console method (`log`/`info`/`warn`/`error`) automatically.\n\n```bash\n# Usually installed via the app meta-package (exact-pinned constellation):\nnpm install @diamondjs/app\n\n# Or standalone:\nnpm install @diamondjs/primafacie\n```\n\n## Sinks — where lines go\n\nConsole output is the default. Add sinks for anything else:\n\n```typescript\nimport { addSink, wsSink } from '@diamondjs/primafacie';\n\n// Browser → server log relay over WebSocket\naddSink(wsSink('ws://localhost:9600/logs'));\n```\n\nOn the server side (Node), the `/node` entry point receives the relay and writes datestamped files:\n\n```typescript\nimport { fileSink, wsReceiver } from '@diamondjs/primafacie/node';\n\nconst onMessage = wsReceiver(fileSink('./logs'));\n// wire onMessage into your WebSocket server; browser Print() lines\n// land in ./logs/<date>.log with their types and callers intact\n```\n\nCustom sinks are just functions receiving a structured `LogRecord` — implement `LogSink` and `addSink` it.\n\n## Why a logging package in a frontend framework?\n\nBecause debuggability is the whole point. DiamondJS narrates its own runtime decisions — every guard allow/deny/throw/timeout, every route commit — through `Print`, so your log stream shows the framework's reasoning in the same greppable vocabulary as your own logs. In dev mode the router prints its entire resolved route table at startup, one line per route; \"where's the route map?\" is answered by your console.\n\n## Design constraints\n\n- **< 400 LOC** — currently ~75% of budget\n\n---\n\nPart of [DiamondJS](https://github.com/Node0/diamondjs) — the first JavaScript framework designed for the human-LLM collaborative development era.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-deeb0e9ddd1b9c05221304d09b90b9e7"}