@nutrient-sdk/dws-client-typescript
Version:
Node.js TypeScript client library for Nutrient Document Web Services (DWS) API
33 lines (28 loc) • 1.26 kB
JavaScript
const fs = require('fs');
const path = require('path');
const docPath = path.join(__dirname, '..', 'LLM_DOC.md');
const documentation = fs.readFileSync(docPath, 'utf8');
const typePath = path.join(__dirname, '../dist', 'index.d.ts');
// Use process.cwd() as the actual root of the user's project
const userProjectRoot = process.cwd();
const outputDirectory = path.join(userProjectRoot, '.windsurf/rules');
const outputFile = path.join(outputDirectory, 'nutrient-dws-doc.md');
const relativeTypePath = path.relative(userProjectRoot, typePath);
try {
const rule = `
---
description: This rule explains how to use the Nutrient DWS TypeScript Client for operations with document processing operations including conversion, merging, compression, watermarking, signage, and text extraction.
trigger: model_decision
---
> The TypeScript Type Definitions can be found at: ${relativeTypePath}
${documentation}
`
if (!fs.existsSync(outputDirectory)) {
fs.mkdirSync(outputDirectory, { recursive: true });
}
fs.writeFileSync(outputFile, `${rule}`);
console.log(`📄 Updated Windsurf Rules to point to Nutrient DWS documentation at \`${outputFile}\`.`);
} catch (err) {
console.error('Failed to update Windsurf Rule:', err.message);
}