@ez-corp/ez-context 0.1.0

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,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026 ez-corp
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,198 @@
1
+ # ez-context
2
+
3
+ Extract coding conventions from any project and generate AI context files -- CLAUDE.md, AGENTS.md, Cursor rules, GitHub Copilot instructions, and more -- with built-in drift detection.
4
+
5
+ ## Why
6
+
7
+ AI coding assistants work better when they understand your project's conventions. ez-context scans your codebase, detects patterns (stack, naming, architecture, error handling, imports), and generates context files that keep your tools aligned with how you actually write code.
8
+
9
+ When your code evolves, conventions drift. ez-context detects that drift and surgically updates only the stale sections, preserving any manual edits you've made.
10
+
11
+ ## Features
12
+
13
+ - **7 output formats** -- CLAUDE.md, AGENTS.md, Cursor `.mdc`, GitHub Copilot, SKILL.md, Rulesync, Ruler
14
+ - **Multi-language extraction** -- TypeScript, Go, Rust (via package.json, go.mod, Cargo.toml, tsconfig, lockfiles, CI configs)
15
+ - **Semantic + static analysis** -- combines file-based signals with ts-morph code analysis for imports, naming patterns, error handling, and architecture layers
16
+ - **Drift detection** -- compares context files against live code and produces a health score (0-100)
17
+ - **Targeted updates** -- rewrites only drifted sections using marker-based splicing, leaving your manual content untouched
18
+ - **Confidence thresholds** -- filter conventions by confidence score before generating
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ npm install -g @ez-corp/ez-context
24
+ ```
25
+
26
+ Or with other package managers:
27
+
28
+ ```bash
29
+ pnpm add -g @ez-corp/ez-context
30
+ yarn global add @ez-corp/ez-context
31
+ ```
32
+
33
+ ## Quick Start
34
+
35
+ ### Generate context files
36
+
37
+ ```bash
38
+ # Default: generates CLAUDE.md and AGENTS.md
39
+ ez-context generate
40
+
41
+ # Pick specific formats
42
+ ez-context generate --format claude,cursor,copilot
43
+
44
+ # All 7 formats at once
45
+ ez-context generate --format claude,agents,cursor,copilot,skills,rulesync,ruler
46
+
47
+ # Preview without writing anything
48
+ ez-context generate --dry-run
49
+
50
+ # Custom output directory and confidence threshold
51
+ ez-context generate --output ./docs --threshold 0.8
52
+ ```
53
+
54
+ ### Inspect detected conventions
55
+
56
+ ```bash
57
+ # Show what ez-context found in the current project
58
+ ez-context inspect
59
+
60
+ # Lower the threshold to see more candidates
61
+ ez-context inspect --threshold 0.5
62
+ ```
63
+
64
+ ### Check for drift
65
+
66
+ ```bash
67
+ # Check all generated context files
68
+ ez-context drift
69
+
70
+ # Check a specific file
71
+ ez-context drift --file CLAUDE.md
72
+ ```
73
+
74
+ ### Update drifted sections
75
+
76
+ ```bash
77
+ # Rewrite drifted sections, preserve manual content
78
+ ez-context update
79
+
80
+ # Preview what would change
81
+ ez-context update --dry-run
82
+
83
+ # Update a specific file
84
+ ez-context update --file CLAUDE.md
85
+ ```
86
+
87
+ ## Output Formats
88
+
89
+ | `--format` value | Output path | Description |
90
+ |---|---|---|
91
+ | `claude` | `CLAUDE.md` | Claude Code project instructions |
92
+ | `agents` | `AGENTS.md` | OpenAI Agents / general agent instructions |
93
+ | `cursor` | `.cursor/rules/ez-context.mdc` | Cursor IDE rules (MDC format) |
94
+ | `copilot` | `.github/copilot-instructions.md` | GitHub Copilot workspace instructions |
95
+ | `skills` | `.skills/ez-context/SKILL.md` | Claude Code skill file |
96
+ | `rulesync` | `.rulesync/rules/ez-context.md` | Rulesync-compatible rules |
97
+ | `ruler` | `.ruler/ez-context.md` | Ruler-compatible rules |
98
+
99
+ Formats that support markers (`claude`, `agents`, `copilot`, `rulesync`) preserve your manual sections across regenerations. Content outside `<!-- ez-context:start -->` / `<!-- ez-context:end -->` markers is never touched.
100
+
101
+ ## How It Works
102
+
103
+ ez-context runs two extraction passes in parallel:
104
+
105
+ 1. **Static extractors** -- read package.json, lockfiles, tsconfig.json, Cargo.toml, go.mod, CI configs, and project structure. Fast, deterministic, no ML required.
106
+
107
+ 2. **Code/semantic extractors** -- analyze source files with ts-morph for import patterns, naming conventions (camelCase vs snake_case), architecture layers, and error-handling styles.
108
+
109
+ Each detected convention gets a confidence score between 0 and 1. Anything below `--threshold` (default `0.7`) is excluded from output. The conventions are collected into a structured registry, deduplicated, then rendered into whichever output formats you request.
110
+
111
+ ## CLI Reference
112
+
113
+ ```
114
+ ez-context generate [path]
115
+ --format <formats> Output formats, comma-separated (default: claude,agents)
116
+ --output <dir> Output directory (default: .)
117
+ --threshold <number> Confidence threshold 0-1 (default: 0.7)
118
+ --dry-run Preview without writing files
119
+ -y, --yes Non-interactive mode
120
+
121
+ ez-context inspect [path]
122
+ --threshold <number> Confidence threshold 0-1 (default: 0.7)
123
+
124
+ ez-context drift [path]
125
+ --file <contextFile> Specific context file to check
126
+
127
+ ez-context update [path]
128
+ --file <contextFile> Specific context file to update
129
+ --dry-run Preview changes without writing
130
+ -y, --yes Non-interactive mode
131
+ ```
132
+
133
+ `[path]` defaults to the current directory in all commands.
134
+
135
+ ## Programmatic API
136
+
137
+ ez-context also exports its core functions for use as a library:
138
+
139
+ ```typescript
140
+ import { extractConventions } from "@ez-corp/ez-context";
141
+ import { emit, renderClaudeMd } from "@ez-corp/ez-context";
142
+
143
+ const registry = await extractConventions("./my-project");
144
+ const result = await emit(registry, {
145
+ outputDir: ".",
146
+ formats: ["claude", "cursor"],
147
+ confidenceThreshold: 0.8,
148
+ dryRun: false,
149
+ });
150
+ ```
151
+
152
+ Individual renderers are also available: `renderClaudeMd`, `renderAgentsMd`, `renderCursorMdc`, `renderCopilotMd`, `renderSkillMd`, `renderRulesyncMd`, `renderRulerMd`.
153
+
154
+ ## Requirements
155
+
156
+ - Node.js >= 20.19.0
157
+
158
+ ## Contributing
159
+
160
+ Contributions are welcome. Please open an issue to discuss significant changes before submitting a PR.
161
+
162
+ ```bash
163
+ # Clone and install
164
+ git clone https://github.com/ez-corp/ez-context.git
165
+ cd ez-context
166
+ npm install
167
+
168
+ # Development
169
+ npm run dev -- generate # run CLI in dev mode
170
+ npm test # run tests
171
+ npm run lint # lint
172
+ npm run typecheck # type-check
173
+ ```
174
+
175
+ ### Project structure
176
+
177
+ ```
178
+ src/
179
+ cli.ts # CLI entry point (Commander.js)
180
+ commands/ # Command handlers (generate, inspect, drift, update)
181
+ core/
182
+ pipeline.ts # Extraction pipeline orchestration
183
+ schema.ts # Convention registry schema (Zod)
184
+ registry.ts # Immutable registry operations
185
+ drift/ # Drift detection (claim extraction + scoring)
186
+ updater.ts # Targeted section updates
187
+ extractors/
188
+ static/ # File-based extractors (package.json, tsconfig, CI, etc.)
189
+ code/ # AST-based extractors (imports, naming)
190
+ semantic/ # Semantic extractors (error handling, architecture)
191
+ emitters/ # Output format renderers + marker-based writer
192
+ ```
193
+
194
+ See [ARCHITECTURE.md](./ARCHITECTURE.md) for detailed design documentation.
195
+
196
+ ## License
197
+
198
+ ISC -- see [LICENSE](./LICENSE)
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { };