Package Exports
- tasksmind
Readme
tasksmind
TypeScript SDK and CLI for TasksMind — the AI Engineer for Developers On Call.
Investigate incidents, replay AI root-cause analyses, trigger automated fixes, and monitor projects from your terminal or Node.js code.
Install
npm install tasksmindQuick start
SDK
import { TasksMind } from "tasksmind";
const client = new TasksMind({ apiKey: process.env.TASKSMIND_API_KEY });
// List open incidents
const incidents = await client.incidents.list("proj-uuid", { status: "open" });
for (const inc of incidents) {
console.log(`[${inc.severity}] ${inc.title} (${inc.source})`);
}
// Get AI investigation
const investigation = await client.incidents.getInvestigation(incidents[0].id);
if (investigation?.isComplete()) {
console.log(`Confidence: ${Math.round(investigation.confidenceScore * 100)}%`);
console.log(investigation.reportMarkdown);
}
// Replay investigation
const result = await client.incidents.replay(incidents[0].id);
console.log(result.reportMarkdown);
// Create an automated fix run
const run = await client.runs.create({
repoUrl: "https://github.com/my-org/my-repo",
payload: { intent: "fix_bug", raw_text: "Fix the OOM in payment-worker" },
});
const completed = await client.runs.wait(run.id, { timeoutS: 600 });
if (completed.isSuccess()) {
console.log(`PR: ${completed.prUrl}`);
}CLI
export TASKSMIND_API_KEY=your_key
# List incidents
tasksmind incidents list <project-id>
tasksmind incidents list <project-id> --status open --limit 10
# Inspect a single incident
tasksmind incidents get <incident-id>
# View AI investigation report
tasksmind incidents investigation <incident-id>
# Replay an investigation
tasksmind replay <incident-id>
tasksmind replay <incident-id> --timeout 60 --no-wait
# Start an automated fix
tasksmind run "fix the OOM in payment-worker" --repo https://github.com/org/repo
tasksmind run "review PR" --repo https://github.com/org/repo --intent review_pr --pr 42
# Check run status
tasksmind status <run-id>
tasksmind logs <run-id>
# Watch for new incidents
tasksmind watch <project-id> --interval 30 --auto-replaySDK reference
Client
const client = new TasksMind({
apiKey: "tm_...", // or set TASKSMIND_API_KEY env var
baseUrl: "https://api.tasksmind.com", // optional override
timeout: 60000, // ms, default 60s
});Incidents
| Method | Returns | Description |
|---|---|---|
client.incidents.list(projectId, { status?, limit? }) |
Incident[] |
List incidents for a project |
client.incidents.get(incidentId) |
Incident |
Get a single incident |
client.incidents.getInvestigation(incidentId) |
IncidentInvestigation | null |
Get the AI investigation |
client.incidents.replay(incidentId, { wait?, timeoutS?, pollS? }) |
ReplayResult |
Re-run the AI investigation |
Runs
| Method | Returns | Description |
|---|---|---|
client.runs.create({ repoUrl, repoRef?, payload? }) |
Run |
Start a new run |
client.runs.get(runId) |
Run |
Fetch a run |
client.runs.list({ limit?, offset?, status? }) |
Run[] |
List runs |
client.runs.wait(runId, { timeoutS?, pollS? }) |
Run |
Poll until complete |
Models
Incident — id, projectId, source, title, severity, status, externalId, createdAt
IncidentInvestigation — id, incidentId, status, confidenceScore, reportMarkdown, analysisData, errorMessage, isComplete(), isFailed()
ReplayResult — investigationId, status, confidenceScore, reportMarkdown, isComplete(), isFailed()
Run — id, status, output, prUrl, prNumber, summary, error, isSuccess()
Errors
import { AuthError, NotFoundError, RateLimitError, APIError, TimeoutError } from "tasksmind";| Error | HTTP status | When |
|---|---|---|
AuthError |
401, 403 | Invalid or missing API key |
NotFoundError |
404 | Resource doesn't exist |
RateLimitError |
429 | Too many requests |
APIError |
4xx, 5xx | Other server errors |
TimeoutError |
— | Polling exceeded timeout |
All errors extend TasksMindError which has statusCode and body properties.
Environment variables
| Variable | Description |
|---|---|
TASKSMIND_API_KEY |
Your API key (required) |
TASKSMIND_API_BASE_URL |
Override API base URL |
TASKSMIND_REPO |
Default repo URL for run command |
Requirements
- Node.js >= 18
- Zero runtime dependencies
License
MIT