crobe-sdk
v0.5.0
Published
Crobe (Compliance Probe) is a CLI tool for running compliance checks through flexible playbooks. This package contains the TypeScript type definitions to facilitate playbook authoring and integration.
Readme
crobe-sdk 🛡️
TypeScript type definitions for Crobe, a CLI tool written in Go for running compliance checks on a system.
This package provides types for three separate stages of the compliance lifecycle:
- Playbook Inline JS/TS Development: Types for writing script logic (Generators, Evaluators, Gatherers) inlined in a playbook.
- Playbook Definition: Types for defining the entire playbook structure.
- Report Consumption: Types for parsing and validating the JSON reports generated by the agent.
📥 Installation
npm install crobe-sdk🚀 Usage
1. Playbook Script Logic (crobe-sdk/func)
Use these types when writing external .ts or .js scripts that will be baked into a playbook.
import { ScriptContext } from 'crobe-sdk/func';
/**
* Generate a dynamic shell command based on the environment.
*/
export default ({ os }: ScriptContext) => {
return os === 'windows' ? 'dir' : 'ls -la';
};2. Full Playbook Definition (crobe-sdk/playbook)
Use these types if you are generating playbooks dynamically (e.g., via a web app or server-side script).
import { Playbook } from 'crobe-sdk/playbook';
const playbook: Playbook = {
title: "Cloud Security Hygiene",
sections: [
{
title: "Identity & Access",
description: ["Verify IAM best practices"],
assertions: [
/* ... */
]
}
]
};3. Result Consumption (crobe-sdk/submission)
Use these types when building a "Central Hub" or dashboard that parses the reports submitted by agents.
import { FinalReport, RemoteSubmission } from 'crobe-sdk/submission';
function handleSubmission(payload: RemoteSubmission) {
const report: FinalReport = JSON.parse(atob(payload.json));
console.log(`Report from ${report.username} on ${report.os}`);
}📝 JSON Schema Validation
For the best developer experience when writing playbooks manually in YAML or JSON, you can use the JSON schema included in this package.
Alternatively, you can use the schema from latest release https://github.com/benedictjohannes/crobe/releases/latest/download/playbook.schema.json.
VS Code (YAML Extension)
Add the following line to the top of your playbook.yaml file:
# yaml-language-server: $schema=node_modules/crobe-sdk/playbook.schema.json
title: My Playbook
...This will enable auto-completion, hover documentation, and real-time validation for your playbook structure.
⚖️ License
MIT
