string-le 0.1.0

Extract every string value from a codebase so a person can read them
[
	{
		"name": "a json document",
		"file": "strings.json",
		"arguments": {
			"format": "json"
		},
		"expected": {
			"ok": true,
			"data": {
				"strings": [
					"Welcome Home",
					"https://example.com/path?query=1",
					"usr_8f3k2j4h5g6",
					"line one\nline two",
					"trimmed value",
					"Nested message",
					"first item",
					"second item"
				],
				"fileType": "json"
			},
			"diagnostics": [],
			"meta": {
				"tool": "extract_strings",
				"count": 8,
				"truncated": false
			}
		}
	},
	{
		"name": "format inferred from the filename",
		"file": "strings.toml",
		"arguments": {
			"filename": "strings.toml"
		},
		"expected": {
			"ok": true,
			"data": {
				"strings": [
					"TOML Example",
					"literal string",
					"Tom Preston-Werner",
					"Multi-line\nbasic string",
					"alpha",
					"beta",
					"value with # hash"
				],
				"fileType": "toml"
			},
			"diagnostics": [],
			"meta": {
				"tool": "extract_strings",
				"count": 7,
				"truncated": false
			}
		}
	},
	{
		"name": "an alias resolves",
		"file": "strings.yaml",
		"arguments": {
			"format": "yml"
		},
		"expected": {
			"ok": true,
			"data": {
				"strings": [
					"Unquoted plain scalar",
					"Double quoted value",
					"Single quoted value",
					"plain item",
					"quoted item",
					"Block scalar line one\nBlock scalar line two",
					"Folded scalar text",
					"inline quoted",
					"bare"
				],
				"fileType": "yaml"
			},
			"diagnostics": [],
			"meta": {
				"tool": "extract_strings",
				"count": 9,
				"truncated": false
			}
		}
	},
	{
		"name": "a dotenv document",
		"file": "strings.env",
		"arguments": {
			"format": "env"
		},
		"expected": {
			"ok": true,
			"data": {
				"strings": [
					"https://api.example.com",
					"quoted value",
					"single value",
					"value",
					"value # not a comment",
					"padded value",
					"12345"
				],
				"fileType": "env"
			},
			"diagnostics": [],
			"meta": {
				"tool": "extract_strings",
				"count": 7,
				"truncated": false
			}
		}
	},
	{
		"name": "an unknown format falls back rather than failing",
		"file": "messages.ts",
		"arguments": {
			"format": "typescript"
		},
		"expected": {
			"ok": true,
			"data": {
				"strings": [
					"Delete this permanently?",
					"This can't be undone",
					"Removing ${count} items",
					"It\\'s fine",
					"quoted text"
				],
				"fileType": "fallback"
			},
			"diagnostics": [],
			"meta": {
				"tool": "extract_strings",
				"count": 5,
				"truncated": false
			}
		}
	},
	{
		"name": "no format at all falls back",
		"file": "messages.ts",
		"arguments": {},
		"expected": {
			"ok": true,
			"data": {
				"strings": [
					"Delete this permanently?",
					"This can't be undone",
					"Removing ${count} items",
					"It\\'s fine",
					"quoted text"
				],
				"fileType": "fallback"
			},
			"diagnostics": [],
			"meta": {
				"tool": "extract_strings",
				"count": 5,
				"truncated": false
			}
		}
	},
	{
		"name": "deduped",
		"file": "escapes.json",
		"arguments": {
			"format": "json",
			"dedupe": true
		},
		"expected": {
			"ok": true,
			"data": {
				"strings": [
					"readable",
					"first\nsecond",
					"she said \"hi\"",
					"café"
				],
				"fileType": "json"
			},
			"diagnostics": [],
			"meta": {
				"tool": "extract_strings",
				"count": 4,
				"truncated": false
			}
		}
	},
	{
		"name": "capped and flagged",
		"file": "strings.csv",
		"arguments": {
			"format": "csv",
			"maxResults": 3
		},
		"expected": {
			"ok": true,
			"data": {
				"strings": [
					"name",
					"message",
					"count"
				],
				"fileType": "csv"
			},
			"diagnostics": [],
			"meta": {
				"tool": "extract_strings",
				"count": 3,
				"truncated": true
			}
		}
	},
	{
		"name": "nothing to find",
		"content": "",
		"arguments": {
			"format": "json"
		},
		"expected": {
			"ok": true,
			"data": {
				"strings": [],
				"fileType": "json"
			},
			"diagnostics": [],
			"meta": {
				"tool": "extract_strings",
				"count": 0,
				"truncated": false
			}
		}
	},
	{
		"name": "content must be a string",
		"arguments": {
			"format": "json"
		},
		"expectedError": "content is required and must be a string"
	},
	{
		"name": "a nonsensical cap is rejected",
		"content": "x",
		"arguments": {
			"maxResults": 0
		},
		"expectedError": "maxResults must be a positive integer"
	}
]