glosslint 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,120 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 onmax
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ tinyaml/js-yaml, tinyaml/js-yaml-v5, tinyaml/yaml, tinyaml/yamljs and tinyaml/std
26
+ reproduce the behaviour, messages and parts of the code of the libraries they
27
+ replace. Their licenses and copyright notices follow.
28
+
29
+ ---
30
+
31
+ js-yaml (versions 4 and 5)
32
+
33
+ (The MIT License)
34
+
35
+ Copyright (C) 2011-2015 by Vitaly Puzrin
36
+
37
+ Permission is hereby granted, free of charge, to any person obtaining a copy
38
+ of this software and associated documentation files (the "Software"), to deal
39
+ in the Software without restriction, including without limitation the rights
40
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
41
+ copies of the Software, and to permit persons to whom the Software is
42
+ furnished to do so, subject to the following conditions:
43
+
44
+ The above copyright notice and this permission notice shall be included in
45
+ all copies or substantial portions of the Software.
46
+
47
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
48
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
49
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
50
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
51
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
52
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
53
+ THE SOFTWARE.
54
+
55
+ ---
56
+
57
+ yaml
58
+
59
+ Copyright Eemeli Aro <eemeli@gmail.com>
60
+
61
+ Permission to use, copy, modify, and/or distribute this software for any purpose
62
+ with or without fee is hereby granted, provided that the above copyright notice
63
+ and this permission notice appear in all copies.
64
+
65
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
66
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
67
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
68
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
69
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
70
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
71
+ THIS SOFTWARE.
72
+
73
+ ---
74
+
75
+ yamljs
76
+
77
+ Copyright (c) 2010 Jeremy Faivre
78
+
79
+ Permission is hereby granted, free of charge, to any person obtaining a copy
80
+ of this software and associated documentation files (the "Software"), to deal
81
+ in the Software without restriction, including without limitation the rights
82
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
83
+ copies of the Software, and to permit persons to whom the Software is furnished
84
+ to do so, subject to the following conditions:
85
+
86
+ The above copyright notice and this permission notice shall be included in all
87
+ copies or substantial portions of the Software.
88
+
89
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
90
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
91
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
92
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
93
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
94
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
95
+ THE SOFTWARE.
96
+ ---
97
+
98
+ @std/yaml
99
+
100
+ MIT License
101
+
102
+ Copyright 2018-2022 the Deno authors.
103
+
104
+ Permission is hereby granted, free of charge, to any person obtaining a copy
105
+ of this software and associated documentation files (the "Software"), to deal
106
+ in the Software without restriction, including without limitation the rights
107
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
108
+ copies of the Software, and to permit persons to whom the Software is
109
+ furnished to do so, subject to the following conditions:
110
+
111
+ The above copyright notice and this permission notice shall be included in all
112
+ copies or substantial portions of the Software.
113
+
114
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
115
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
116
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
117
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
118
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
119
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
120
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,31 @@
1
+ glosslint
2
+ Copyright (c) 2026 onmax
3
+
4
+ This package includes third-party data. Its notices follow.
5
+
6
+ ---
7
+
8
+ src/presets/tech-data.ts is generated from the dictionaries of case-police
9
+ (https://github.com/antfu/case-police), version 2.2.1, under the MIT License:
10
+
11
+ MIT License
12
+
13
+ Copyright (c) 2021 Anthony Fu <https://github.com/antfu>
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ of this software and associated documentation files (the "Software"), to deal
17
+ in the Software without restriction, including without limitation the rights
18
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ copies of the Software, and to permit persons to whom the Software is
20
+ furnished to do so, subject to the following conditions:
21
+
22
+ The above copyright notice and this permission notice shall be included in all
23
+ copies or substantial portions of the Software.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,82 @@
1
- # Temporary Holding Version
1
+ <h1><img src="./.github/assets/banner.svg" alt="glosslint" width="100%"></h1>
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <!-- automd:comark-badges packages=glosslint -->
4
+
5
+ [![npm version](https://comark-ui.onmax.me/badge.svg?source=npm-version&package=glosslint&label=glosslint&icon=npm)](https://www.npmjs.com/package/glosslint)
6
+ [![npm downloads](https://comark-ui.onmax.me/badge.svg?source=npm-downloads&package=glosslint&period=month&icon=npm)](https://www.npmjs.com/package/glosslint)
7
+ [![CI](https://comark-ui.onmax.me/badge.svg?source=github-actions&repository=onmax%2Fglosslint&workflow=pkg-pr-new.yml&icon=github)](https://github.com/onmax/glosslint/actions/workflows/pkg-pr-new.yml)
8
+ [![license: MIT](https://comark-ui.onmax.me/badge.svg?label=license&value=MIT)](./LICENSE)
9
+
10
+ <!-- /automd -->
11
+
12
+ [![docs](https://comark-ui.onmax.me/badge.svg?label=docs&value=glosslint.onmax.me)](https://glosslint.onmax.me)
13
+
14
+ glosslint checks that your product's words are spelled, cased and chosen the way your glossary says. You keep one corpus of terms, each with its meaning and the words to avoid. glosslint reports problems in code through ESLint, in translations through x18n, and in Markdown docs through its CLI. Every finding carries the reason and meaning, so people and coding agents learn the vocabulary as they work.
15
+
16
+ [Docs](https://glosslint.onmax.me) · [Installation](https://glosslint.onmax.me/guide/installation) · [The corpus](https://glosslint.onmax.me/guide/corpus) · [ESLint](https://glosslint.onmax.me/integrations/eslint) · [x18n](https://glosslint.onmax.me/integrations/x18n) · [CLI](https://glosslint.onmax.me/integrations/cli) · [For agents](https://glosslint.onmax.me/guide/agents)
17
+
18
+ ## Install
19
+
20
+ ```sh
21
+ pnpm add -D glosslint
22
+ ```
23
+
24
+ glosslint needs Node 22.18 or later, because it loads `glosslint.config.ts` with Node's own `import()` and type stripping. ESLint 9.15 or later and `@x18n/core` are optional peer dependencies. Install the ones you use.
25
+
26
+ ## Example
27
+
28
+ This example comes from the bike-share app in [`examples/basic`](https://github.com/onmax/glosslint/tree/main/examples/basic).
29
+
30
+ ```diff
31
+ # locales/en.yml
32
+ - hint: Return your e-bike to any rack.
33
+ + hint: Return your eBike to any dock.
34
+ ```
35
+
36
+ Define your terms in `glosslint.config.ts`:
37
+
38
+ ```ts
39
+ import { defineCorpus } from "glosslint";
40
+
41
+ export default defineCorpus({
42
+ terms: [
43
+ {
44
+ term: "Dock",
45
+ description: "A powered stand where one bike is locked.",
46
+ nuance: "A station is a group of docks.",
47
+ avoid: [{ word: "rack", why: "Racks are unpowered." }, "bay"],
48
+ examples: { good: ["Return the bike to any dock"], bad: ["Return the bike to any rack"] },
49
+ links: [{ title: "Docks", url: "https://example.com/docs/docks" }],
50
+ },
51
+ { term: "eBike", case: "exact" },
52
+ ],
53
+ });
54
+ ```
55
+
56
+ Run the CLI on Markdown docs. Here is one finding from `examples/basic`:
57
+
58
+ ```sh
59
+ npx glosslint check docs/guide
60
+ ```
61
+
62
+ ```txt
63
+ [GLOSSLINT_AVOID] "rack" in docs/guide/riding.md:3:56
64
+ ├▶ why: Racks are unpowered.
65
+ ├▶ fix: Use "dock": "Unlock a bike at any station, then return it to a free dock when you finish."
66
+ ├▶ term: Dock, a powered stand where one bike is locked.
67
+ ╰▶ see: https://example.com/docs/docks
68
+ ```
69
+
70
+ ## Where it checks
71
+
72
+ - [ESLint](https://glosslint.onmax.me/integrations/eslint) checks strings, comments and declared identifiers in JavaScript, TypeScript and Vue, plus YAML locale values.
73
+ - [x18n](https://glosslint.onmax.me/integrations/x18n) checks the source locale's messages and hard-coded strings, and `toX18nGlossary` turns the corpus into x18n's glossary.
74
+ - [The CLI](https://glosslint.onmax.me/integrations/cli) checks Markdown, MDX and text files, tests term examples, prints the corpus and explains words.
75
+
76
+ ## For agents
77
+
78
+ Write your glossary for coding agents with `glosslint print > .agents/terms.md` and link it from `AGENTS.md`. When an agent is unsure which word to use, `glosslint explain "<word>"` prints the term, its meaning, its nuance and the words to avoid. `npx skills add https://glosslint.onmax.me/` installs the glosslint agent skill, and [For agents](https://glosslint.onmax.me/guide/agents) explains how to apply findings by `fix.kind`.
79
+
80
+ ## License
81
+
82
+ MIT. The tech preset includes data from case-police, also MIT. See [NOTICE](./NOTICE).
package/dist/cli.d.mts ADDED
@@ -0,0 +1,67 @@
1
+ import { c as Corpus, o as CliFinding, v as Matcher } from "./types-CBQGgzID.mjs";
2
+ /** Where a command reads and writes, so tests can run commands without a process. */
3
+ export interface CliIo {
4
+ /** The folder paths and the config are resolved from. */
5
+ cwd: string;
6
+ stdout: (text: string) => void;
7
+ stderr: (text: string) => void;
8
+ /** Whether stdout is a terminal that takes colors, used when `--color` is not given. */
9
+ color?: boolean;
10
+ }
11
+ /** Options every command takes. */
12
+ export interface CommandOptions {
13
+ /** The config file. Default: `glosslint.config.{ts,mts,js,mjs}` in `cwd`. */
14
+ config?: string;
15
+ /** Color the output. Default: `io.color`. */
16
+ color?: boolean;
17
+ }
18
+ /** Options of `glosslint check`. */
19
+ export interface CheckOptions extends CommandOptions {
20
+ /** `text` (default) or `json`. */
21
+ format?: string;
22
+ /** File extensions read in folders, comma-separated. Default: `md,mdx,txt`. */
23
+ ext?: string;
24
+ }
25
+ /** Options of `glosslint print`. */
26
+ export interface PrintOptions extends CommandOptions {
27
+ /** `md` (default) or `json`. */
28
+ format?: string;
29
+ }
30
+ /** Codes of the errors the CLI prints itself, next to the corpus's `GLOSSLINT_C00x`. */
31
+ export declare const CLI_ERRORS: {
32
+ readonly noConfig: "GLOSSLINT_C009";
33
+ readonly loadConfig: "GLOSSLINT_C010";
34
+ readonly notCorpus: "GLOSSLINT_C008";
35
+ readonly usage: "GLOSSLINT_USAGE";
36
+ readonly failed: "GLOSSLINT_ERROR";
37
+ };
38
+ /** Finds and imports the config, and returns its default export, which must be a corpus. */
39
+ export declare function loadCorpus(cwd: string, config?: string): Promise<{
40
+ corpus: Corpus;
41
+ file: string;
42
+ }>;
43
+ /**
44
+ * Blanks what is not prose in Markdown, keeping every offset: frontmatter, fenced code, HTML
45
+ * comments and tags, inline code, link targets and references, and the markers of headings, lists
46
+ * and quotes. In MDX, `import` and `export` lines too.
47
+ */
48
+ export declare function maskMarkdown(text: string, options?: {
49
+ mdx?: boolean;
50
+ }): string;
51
+ /** Checks one file's text. Markdown is masked first, so code and link targets are never reported. */
52
+ export declare function checkFileText(matcher: Matcher, text: string, file: string, options?: {
53
+ markdown?: boolean;
54
+ mdx?: boolean;
55
+ }): CliFinding[];
56
+ /** The files `check` reads: named files as they are, folders by extension, and glob patterns. */
57
+ export declare function collectFiles(paths: readonly string[], cwd: string, extensions?: readonly string[]): Promise<string[]>;
58
+ /** `glosslint check`: reports every finding in the files, as text or JSON. Exits 1 on findings. */
59
+ export declare function runCheck(paths: readonly string[], options: CheckOptions, io: CliIo): Promise<number>;
60
+ /** `glosslint test`: checks every term's good and bad examples. Exits 1 when one fails. */
61
+ export declare function runTest(options: CommandOptions, io: CliIo): Promise<number>;
62
+ /** `glosslint print`: writes the corpus as a Markdown glossary or as JSON. */
63
+ export declare function runPrint(options: PrintOptions, io: CliIo): Promise<number>;
64
+ /** `glosslint explain`: what the corpus says about a word or phrase. Exits 1 when no term matches. */
65
+ export declare function runExplain(query: string, options: CommandOptions, io: CliIo): Promise<number>;
66
+ /** Runs the CLI on `argv` (the arguments after the program name) and resolves to the exit code. */
67
+ export declare function main(argv: readonly string[], io?: CliIo): Promise<number>;