@promptlens/sdk
v0.1.0
Published
Terminal-ready SDK and CLI for PromptLens explainable prompt analysis.
Maintainers
Readme
PromptLens SDK
Terminal-ready SDK and CLI for PromptLens explainable prompt analysis.
Install Locally
cd sdk
npm linkAfter linking, the promptlens command is available in your terminal.
Publish To npm
The package is prepared for public npm release.
cd sdk
npm run check
npm publish --access public --otp=123456Full maintainer steps are in sdk/PUBLISHING.md.
CLI Usage
promptlens health --api-url http://127.0.0.1:8000
promptlens analyse "A cinematic lab at night with reflective glass" --mode text
promptlens analyse "A cinematic lab at night with reflective glass" --mode both --json
promptlens metricsThe CLI stores its anonymous session state in ~/.promptlens/sdk-config.json so repeat runs reuse the same PromptLens session.
JavaScript Usage
import { PromptLensClient } from "@promptlens/sdk";
const client = new PromptLensClient({
apiUrl: "http://127.0.0.1:8000",
});
const result = await client.analyse("A cinematic lab at night", {
mode: "text",
});
console.log(result.segments);
console.log(result.text?.output);Included Commands
promptlens analysesegments a prompt and returns explainable generation output.promptlens healthchecks that the backend is reachable.promptlens metricsprints the backend summary metrics.
Notes
- Node
18+is required because the SDK uses nativefetch. - Before public release, the CLI works immediately via
npm link.
