Download src/parsers/windsurf.ts from hongcoding/agentlens: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/datasets/hongcoding/agentlens/resolve/main/src/parsers/windsurf.ts
- Command line
-
hf download hf://datasets/hongcoding/agentlens/src/parsers/windsurf.ts
-
curl -L -o windsurf.ts https://huggingface.co/datasets/hongcoding/agentlens/resolve/main/src/parsers/windsurf.ts
1.36 kB
| import type { Rule } from "../core/types.js"; | |
| import type { ConfigParser } from "./base.js"; | |
| import { nextRuleId, classifyRule, extractRuleBlocks } from "./base.js"; | |
| /** | |
| * Windsurf config parser. | |
| * Reads: .windsurfrules (plain markdown, one rule per line or bullets) | |
| */ | |
| export const windsurfParser: ConfigParser = { | |
| agent: "windsurf", | |
| filePatterns: [".windsurfrules"], | |
| parse(content: string, filePath: string): Rule[] { | |
| // Plain text: each line is a rule (like .cursorrules) | |
| const lines = content | |
| .split("\n") | |
| .map((l) => l.trim()) | |
| .filter((l) => l.length > 5 && !l.startsWith("#")); | |
| if (lines.length > 0 && !content.includes("\n- ") && !content.match(/^\d+\./m)) { | |
| // Plain line-per-rule format | |
| return lines.map((line) => ({ | |
| id: nextRuleId(), | |
| category: classifyRule(line), | |
| content: line, | |
| scope: "project" as const, | |
| source: { agent: "windsurf" as const, file: filePath }, | |
| status: "active" as const, | |
| })); | |
| } | |
| // Markdown-like format | |
| const blocks = extractRuleBlocks(content); | |
| return blocks.map((block) => ({ | |
| id: nextRuleId(), | |
| category: classifyRule(block), | |
| content: block, | |
| scope: "project" as const, | |
| source: { agent: "windsurf" as const, file: filePath }, | |
| status: "active" as const, | |
| })); | |
| }, | |
| }; | |