Implements a comprehensive suite of AI SDK v6 tools across multiple categories: - Research (5): page-brief, compare-pages, source-credibility, claim-checklist, timeline-from-text - Web (10): fetch-text, links-catalog, extract-meta, extract-json-ld, redirect-trace, sitemap-read, rss-read, table-extract, robots-policy, url-normalize - Data (15): csv-parse, csv-stringify, json-repair, json-schema-validate, yaml-parse, yaml-stringify, text-chunk, normalize-whitespace, dedupe-by-key, pivot, rows-filter, rows-sort, rows-group-aggregate, rows-join, schema-infer - Doc (12): toc-generate, glossary-build, faq-from-text, executive-brief, decision-record-adr, prd-outline, acceptance-criteria, style-rewrite - Eng (12): diff-text-unified, env-var-docs-generate, dependency-audit-lite, conventional-commit-suggest, markdown-lint-basic, test-case-generate, stacktrace-parse, release-notes, changelog-entry, release-checklist - Security (7): redact-secrets, secret-scan-text, url-risk-heuristic, csp-compose, hardening-checklist-web, access-control-matrix, data-classification-heuristic - Stats (9): effect-size-suite, bootstrap-ci, permutation-test, multiple-testing-adjust, linear-regression-ols, logistic-regression, time-series-decompose-lite, anomaly-detect-mad - Ops (7): slo-draft, runbook-draft, postmortem-draft, postmortem-action-extractor, error-log-triage, coverage-tracker, monitoring-gap-analysis - Agent (15): prompt-to-workflow-skeleton, workflow-validate-io, workflow-explain, workflow-cost-estimate, tool-call-accuracy-score, eval-fixture-build, guardrail-policy-draft, workflow-auto-repair, tool-selection-plan, novelty-score-workflow, workflow-variant-generate, config-normalize, recipe-* - Utility (8): base64-encode, base64-decode, hash-text, regex-extract, template-render, date-parse, json-path-query, url-parse - HTML (3): html-sanitize, html-to-markdown, markdown-to-html All tools follow AI SDK v6 pattern with tool() and jsonSchema<T>(). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2.6 KiB
2.6 KiB
@tpmjs/tools-yaml-stringify
Convert JavaScript objects to YAML strings with formatting options.
Installation
npm install @tpmjs/tools-yaml-stringify
Usage
import { yamlStringifyTool } from '@tpmjs/tools-yaml-stringify';
// Use with AI SDK
const result = await yamlStringifyTool.execute({
data: {
name: 'John Doe',
age: 30,
hobbies: ['reading', 'coding', 'hiking']
},
indent: 2
});
console.log(result.yaml);
// name: John Doe
// age: 30
// hobbies:
// - reading
// - coding
// - hiking
Features
- Configurable Indentation: Control spacing with indent parameter (1-8 spaces)
- Metadata: Returns line count, character count, and indent level
- Type Support: Handles objects, arrays, strings, numbers, booleans, and null
- Standards Compliant: Uses
js-yamllibrary for YAML 1.2 output - Clean Output: No anchors/references, preserves key order
Input Schema
| Parameter | Type | Required | Description |
|---|---|---|---|
| data | any | Yes | The JavaScript data to convert to YAML |
| indent | number | No | Spaces for indentation (default: 2, range: 1-8) |
Output Schema
interface YamlStringifyResult {
yaml: string; // The YAML string output
metadata: {
lines: number; // Number of lines in the output
characters: number; // Total character count
indent: number; // Indentation level used
};
}
Examples
Stringify Object with Default Indent
const result = await yamlStringifyTool.execute({
data: { name: 'Alice', role: 'Developer' }
});
console.log(result.yaml);
// name: Alice
// role: Developer
Stringify Array with Custom Indent
const result = await yamlStringifyTool.execute({
data: ['apple', 'banana', 'cherry'],
indent: 4
});
console.log(result.yaml);
// - apple
// - banana
// - cherry
Stringify Nested Object
const result = await yamlStringifyTool.execute({
data: {
server: {
host: 'localhost',
port: 8080,
options: {
ssl: true,
timeout: 3000
}
}
}
});
console.log(result.yaml);
// server:
// host: localhost
// port: 8080
// options:
// ssl: true
// timeout: 3000
Get Metadata
const result = await yamlStringifyTool.execute({
data: { config: { debug: true } }
});
console.log(result.metadata);
// { lines: 2, characters: 25, indent: 2 }
License
MIT