@ipation/specbridge 0.2.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/CHANGELOG.md ADDED
@@ -0,0 +1,173 @@
1
+ # Changelog
2
+
3
+ All notable changes to SpecBridge will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.1] - 2026-01-26
11
+
12
+ ### Fixed
13
+ - Fixed all failing unit tests - 100% pass rate achieved (108/108 tests)
14
+ - Created test setup helpers for .specbridge initialization
15
+ - Added Reporter and AgentContextGenerator class wrappers for test compatibility
16
+ - Fixed API mismatches in VerificationEngine, PropagationEngine, InferenceEngine
17
+ - Updated Config Loader tests for async/await and schema compliance
18
+ - Rewrote CLI integration tests to match actual implementation
19
+ - Removed unused imports in hook.ts and infer.ts
20
+
21
+ ## [0.2.0] - 2026-01-26
22
+
23
+ ### Added
24
+
25
+ #### Testing Infrastructure
26
+ - Comprehensive test suite with 150+ test cases across 8 test files
27
+ - Test fixtures: sample TypeScript project, decision files, config files
28
+ - Vitest coverage configuration with 80% thresholds (lines/functions, 75% branches)
29
+ - Coverage reporting in text, HTML, JSON, and LCOV formats
30
+ - `npm run test:coverage` and `npm run test:ui` scripts
31
+
32
+ #### CI/CD Infrastructure
33
+ - GitHub Actions workflow for continuous integration (`ci.yml`)
34
+ - Tests on Node.js 18.x, 20.x, and 22.x
35
+ - Automated test execution and coverage upload to Codecov
36
+ - Build validation and package artifact upload
37
+ - GitHub Actions security workflow (`security.yml`)
38
+ - CodeQL security scanning
39
+ - npm audit for dependency vulnerabilities
40
+ - Weekly scheduled security checks
41
+ - Dependabot configuration for automated dependency updates
42
+ - ESLint configuration with TypeScript support
43
+ - Prettier configuration for code formatting
44
+ - `npm run lint`, `npm run lint:fix`, `npm run format`, `npm run format:check` scripts
45
+
46
+ #### npm Publishing
47
+ - MIT LICENSE file
48
+ - Complete package.json metadata (repository, homepage, bugs URL, keywords)
49
+ - `.npmignore` for clean package distribution
50
+ - GitHub Actions publish workflow for automated npm releases
51
+ - Version management scripts: `version:patch`, `version:minor`, `version:major`
52
+ - `publishConfig` for public npm registry access
53
+
54
+ #### Developer Experience
55
+ - Husky pre-commit hooks for automated checks
56
+ - Pre-commit hook runs type-check and tests before commit
57
+ - GitHub issue templates:
58
+ - Bug report template
59
+ - Feature request template
60
+ - Question template
61
+ - GitHub pull request template with comprehensive checklist
62
+ - `CODE_OF_CONDUCT.md` for community guidelines
63
+ - `SECURITY.md` for security policy and vulnerability reporting
64
+ - Status badges in README (CI, npm version, license, Node.js version)
65
+
66
+ #### Documentation & Examples
67
+ - TypeDoc configuration for API documentation generation
68
+ - `npm run docs` script to generate API documentation
69
+ - **TypeScript API Example** (`examples/typescript-api/`)
70
+ - Complete Express.js REST API
71
+ - Service naming convention enforcement
72
+ - Centralized error handling pattern
73
+ - SpecBridge configuration and decision files
74
+ - **React Application Example** (`examples/react-app/`)
75
+ - React + TypeScript component structure
76
+ - Custom hook naming conventions
77
+ - Props interface patterns
78
+ - SpecBridge configuration and decision files
79
+ - Examples overview README with learning path
80
+
81
+ ### Changed
82
+ - Updated `vitest.config.ts` with coverage thresholds
83
+ - Enhanced `package.json` with new scripts and metadata
84
+ - Improved README with status badges and better formatting
85
+
86
+ ### Infrastructure
87
+ - 58+ new files created
88
+ - Production-ready project structure
89
+ - Professional open-source setup
90
+
91
+ ## [0.1.0] - 2026-01-26
92
+
93
+ ### Added
94
+
95
+ - **CLI Foundation**
96
+ - `specbridge init` - Initialize SpecBridge in a project
97
+ - `specbridge --version` and `specbridge --help`
98
+
99
+ - **Decision Registry**
100
+ - YAML-based decision file format
101
+ - Decision validation with Zod schemas
102
+ - `specbridge decision list` - List all decisions
103
+ - `specbridge decision show <id>` - Show decision details
104
+ - `specbridge decision create <id>` - Create new decision
105
+ - `specbridge decision validate` - Validate decision files
106
+ - Support for constraint types: invariant, convention, guideline
107
+ - Support for severity levels: critical, high, medium, low
108
+ - Decision lifecycle: draft, active, deprecated, superseded
109
+
110
+ - **Inference Engine**
111
+ - Codebase scanning with ts-morph
112
+ - `specbridge infer` - Detect patterns in codebase
113
+ - Built-in analyzers:
114
+ - `naming` - Naming convention detection
115
+ - `imports` - Import pattern detection
116
+ - `structure` - Directory structure detection
117
+ - `errors` - Error handling pattern detection
118
+ - Pattern confidence scoring
119
+ - Suggested constraint generation
120
+
121
+ - **Verification Engine**
122
+ - `specbridge verify` - Verify code compliance
123
+ - Verification levels: commit (5s), pr (60s), full (5min)
124
+ - Built-in verifiers:
125
+ - `naming` - Naming convention verification
126
+ - `imports` - Import pattern verification
127
+ - `errors` - Error handling verification
128
+ - `regex` - Generic regex pattern matching
129
+ - Severity-based filtering
130
+ - Exception support with expiry dates
131
+
132
+ - **Git Hook Integration**
133
+ - `specbridge hook install` - Install pre-commit hooks
134
+ - `specbridge hook run` - Run verification from hooks
135
+ - `specbridge hook uninstall` - Remove hooks
136
+ - Support for Husky and Lefthook
137
+
138
+ - **Compliance Reporting**
139
+ - `specbridge report` - Generate compliance reports
140
+ - Output formats: console, markdown, json
141
+ - Per-decision compliance tracking
142
+ - Violation summary by severity
143
+
144
+ - **Agent Interface**
145
+ - `specbridge context <file>` - Generate context for AI agents
146
+ - Output formats: markdown, json, mcp
147
+ - Applicable constraint filtering by file
148
+
149
+ - **Propagation Engine**
150
+ - Dependency graph building
151
+ - Impact analysis for decision changes
152
+ - Migration step generation
153
+
154
+ - **Configuration**
155
+ - YAML configuration in `.specbridge/config.yaml`
156
+ - Source roots and exclusion patterns
157
+ - Inference and verification settings
158
+ - Agent output customization
159
+
160
+ ### Technical
161
+
162
+ - TypeScript with strict mode
163
+ - ESM modules
164
+ - Commander.js for CLI
165
+ - ts-morph for AST analysis
166
+ - Zod for schema validation
167
+ - Vitest for testing
168
+ - tsup for building
169
+
170
+ [Unreleased]: https://github.com/nouatzi/specbridge/compare/v0.2.1...HEAD
171
+ [0.2.1]: https://github.com/nouatzi/specbridge/compare/v0.2.0...v0.2.1
172
+ [0.2.0]: https://github.com/nouatzi/specbridge/compare/v0.1.0...v0.2.0
173
+ [0.1.0]: https://github.com/nouatzi/specbridge/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SpecBridge Contributors
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.
package/README.md ADDED
@@ -0,0 +1,251 @@
1
+ # SpecBridge
2
+
3
+ [![CI](https://github.com/nouatzi/specbridge/workflows/CI/badge.svg)](https://github.com/nouatzi/specbridge/actions)
4
+ [![npm version](https://badge.fury.io/js/%40nouatzi%2Fspecbridge.svg)](https://www.npmjs.com/package/@ipation/specbridge)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Node.js Version](https://img.shields.io/node/v/%40nouatzi%2Fspecbridge)](https://nodejs.org)
7
+
8
+ **Architecture Decision Runtime** - Transform architectural decisions into executable, verifiable constraints.
9
+
10
+ SpecBridge creates a living integration layer between design intent and implementation, bridging the gap between specifications and code.
11
+
12
+ ## Features
13
+
14
+ - **Inference Engine** - Analyzes existing codebases to extract implicit patterns
15
+ - **Decision Registry** - Stores validated architectural decisions as versioned YAML files
16
+ - **Verification Engine** - Continuously verifies code compliance at multiple levels
17
+ - **Propagation Engine** - Analyzes impact when architectural decisions change
18
+ - **Compliance Reporting** - Provides dashboards and tracks conformity over time
19
+ - **Agent Interface** - Exposes decisions to code generation agents (Copilot, Claude, etc.)
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ npm install -g @ipation/specbridge
25
+ ```
26
+
27
+ Or use directly with npx:
28
+
29
+ ```bash
30
+ npx @ipation/specbridge init
31
+ ```
32
+
33
+ Once installed globally, you can use the `specbridge` command directly:
34
+
35
+ ```bash
36
+ specbridge init
37
+ ```
38
+
39
+ ## Quick Start
40
+
41
+ ### 1. Initialize SpecBridge in your project
42
+
43
+ ```bash
44
+ cd your-project
45
+ specbridge init
46
+ ```
47
+
48
+ This creates a `.specbridge/` directory with:
49
+ - `config.yaml` - Project configuration
50
+ - `decisions/` - Architectural decision files
51
+ - `verifiers/` - Custom verification logic
52
+ - `inferred/` - Auto-detected patterns
53
+ - `reports/` - Compliance reports
54
+
55
+ ### 2. Detect patterns in your codebase
56
+
57
+ ```bash
58
+ specbridge infer
59
+ ```
60
+
61
+ SpecBridge analyzes your code and suggests patterns it has detected, such as:
62
+ - Naming conventions (PascalCase classes, camelCase functions)
63
+ - Import patterns (barrel imports, path aliases)
64
+ - Code structure (directory conventions, file naming)
65
+ - Error handling patterns
66
+
67
+ ### 3. Create architectural decisions
68
+
69
+ ```bash
70
+ specbridge decision create auth-001 \
71
+ --title "Authentication Token Handling" \
72
+ --summary "All authentication tokens must be validated server-side"
73
+ ```
74
+
75
+ Or edit the YAML files directly in `.specbridge/decisions/`.
76
+
77
+ ### 4. Verify compliance
78
+
79
+ ```bash
80
+ specbridge verify
81
+ ```
82
+
83
+ Run verification at different levels:
84
+ - `--level commit` - Fast checks for pre-commit hooks (< 5s)
85
+ - `--level pr` - Full checks for pull requests
86
+ - `--level full` - Comprehensive verification
87
+
88
+ ### 5. Generate compliance reports
89
+
90
+ ```bash
91
+ specbridge report
92
+ specbridge report --format markdown --save
93
+ ```
94
+
95
+ ### 6. Integrate with AI agents
96
+
97
+ ```bash
98
+ specbridge context src/api/auth.ts
99
+ ```
100
+
101
+ Generates architectural context in Markdown format for AI code assistants.
102
+
103
+ ## Decision File Format
104
+
105
+ Decisions are stored as YAML files in `.specbridge/decisions/`:
106
+
107
+ ```yaml
108
+ kind: Decision
109
+ metadata:
110
+ id: auth-001
111
+ title: Authentication Token Handling
112
+ status: active
113
+ owners: [security-team]
114
+
115
+ decision:
116
+ summary: All authentication tokens must be validated server-side
117
+ rationale: Client-side validation can be bypassed...
118
+
119
+ constraints:
120
+ - id: server-validation
121
+ type: invariant
122
+ rule: Token validation must occur in server-side code
123
+ severity: critical
124
+ scope: src/api/**/*.ts
125
+
126
+ - id: token-expiry
127
+ type: convention
128
+ rule: Tokens should include expiry timestamps
129
+ severity: high
130
+ scope: src/auth/**/*.ts
131
+ ```
132
+
133
+ ### Constraint Types
134
+
135
+ | Type | Description | Enforcement |
136
+ |------|-------------|-------------|
137
+ | `invariant` | Never to be violated | Blocks merges |
138
+ | `convention` | Must be respected unless justified | Requires explanation |
139
+ | `guideline` | Recommended practice | Informational only |
140
+
141
+ ### Severity Levels
142
+
143
+ | Level | Description |
144
+ |-------|-------------|
145
+ | `critical` | Blocks deployment immediately |
146
+ | `high` | Must be resolved within deadline |
147
+ | `medium` | Should be addressed |
148
+ | `low` | Added to backlog |
149
+
150
+ ## Git Hook Integration
151
+
152
+ Install pre-commit hooks:
153
+
154
+ ```bash
155
+ specbridge hook install
156
+ ```
157
+
158
+ For Husky users:
159
+ ```bash
160
+ specbridge hook install --husky
161
+ ```
162
+
163
+ For Lefthook, add to `lefthook.yml`:
164
+ ```yaml
165
+ pre-commit:
166
+ commands:
167
+ specbridge:
168
+ glob: "*.{ts,tsx}"
169
+ run: npx specbridge hook run --level commit --files {staged_files}
170
+ ```
171
+
172
+ ## Configuration
173
+
174
+ Edit `.specbridge/config.yaml`:
175
+
176
+ ```yaml
177
+ version: "1.0"
178
+ project:
179
+ name: my-project
180
+ sourceRoots:
181
+ - src/**/*.ts
182
+ - src/**/*.tsx
183
+ exclude:
184
+ - "**/*.test.ts"
185
+ - "**/node_modules/**"
186
+
187
+ inference:
188
+ minConfidence: 70
189
+ analyzers: [naming, structure, imports, errors]
190
+
191
+ verification:
192
+ levels:
193
+ commit:
194
+ timeout: 5000
195
+ severity: [critical]
196
+ pr:
197
+ timeout: 60000
198
+ severity: [critical, high]
199
+ ```
200
+
201
+ ## CLI Reference
202
+
203
+ | Command | Description |
204
+ |---------|-------------|
205
+ | `specbridge init` | Initialize SpecBridge in project |
206
+ | `specbridge infer` | Detect patterns in codebase |
207
+ | `specbridge verify` | Verify code compliance |
208
+ | `specbridge decision list` | List all decisions |
209
+ | `specbridge decision show <id>` | Show decision details |
210
+ | `specbridge decision create <id>` | Create new decision |
211
+ | `specbridge decision validate` | Validate decision files |
212
+ | `specbridge report` | Generate compliance report |
213
+ | `specbridge hook install` | Install git hooks |
214
+ | `specbridge hook run` | Run verification (for hooks) |
215
+ | `specbridge context <file>` | Generate agent context |
216
+
217
+ Use `specbridge <command> --help` for detailed options.
218
+
219
+ ## Philosophy
220
+
221
+ ### What SpecBridge Is
222
+
223
+ - A runtime constraint system for architectural decisions
224
+ - A bridge between human decisions and automated enforcement
225
+ - An inference system that learns before enforcing
226
+ - A graduated constraint framework (guideline → convention → invariant)
227
+
228
+ ### What SpecBridge Is Not
229
+
230
+ - Not an architectural framework (it's architecture-agnostic)
231
+ - Not a code generator (it guides/constrains generators)
232
+ - Not a documentation tool (decisions are executable)
233
+ - Not a test replacement (verifies structure, not behavior)
234
+
235
+ ## Maturity Levels
236
+
237
+ SpecBridge supports progressive adoption:
238
+
239
+ 1. **Observation** - Infer patterns from existing code
240
+ 2. **Documentation** - Document and version decisions
241
+ 3. **Detection** - CI detects violations
242
+ 4. **Constrained Generation** - Agents receive context
243
+ 5. **Automatic Correction** - Auto-fix minor violations
244
+
245
+ ## License
246
+
247
+ MIT
248
+
249
+ ## Contributing
250
+
251
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node