contractspec 3.7.6 → 3.7.7

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.
Files changed (3) hide show
  1. package/README.md +26 -636
  2. package/bin/contractspec.mjs +14 -11
  3. package/package.json +32 -32
package/README.md CHANGED
@@ -1,657 +1,47 @@
1
- # ContractSpec
1
+ # contractspec
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/contractspec)](https://www.npmjs.com/package/contractspec)
4
- [![npm downloads](https://img.shields.io/npm/dt/contractspec)](https://www.npmjs.com/package/contractspec)
5
- [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/lssm-tech/contractspec)
3
+ Website: https://contractspec.io
6
4
 
7
- Website: https://contractspec.io/
5
+ **npm-published CLI entry point for ContractSpec. Thin wrapper that delegates to `@contractspec/app.cli-contractspec` via `bin/contractspec.mjs`.**
8
6
 
9
- **Stabilize your AI-generated code** — Define contracts once, generate consistent code across API, DB, UI, and events. Safe regeneration. No lock-in.
7
+ ## What It Does
10
8
 
11
- CLI tool for creating, building, and validating contract specifications.
9
+ - **Layer**: apps-registry
10
+ - **Consumers**: end-users installing `npx contractspec` or `bun x contractspec`
12
11
 
13
12
  ## Installation
14
13
 
15
- ```bash
16
- bun add -D contractspec
17
- ```
18
-
19
- ## Quick Start
20
-
21
- ```bash
22
- # Create a new contract spec interactively
23
- contractspec create
24
-
25
- # Create with AI assistance
26
- contractspec create --ai
27
-
28
- # Build implementation from spec
29
- contractspec build src/contracts/mySpec.ts
30
-
31
- # Validate a spec
32
- contractspec validate src/contracts/mySpec.ts
33
- ```
34
-
35
- ## Commands
36
-
37
- ### `contractspec list`
38
-
39
- List all contract specifications in the project with filtering options.
40
-
41
- **Options:**
42
-
43
- - `--pattern <pattern>` - File pattern to search (glob)
44
- - `--deep` - Load spec modules to extract richer metadata (executes spec modules)
45
- - `--type <type>` - Filter by spec type (operation, event, presentation, etc.)
46
- - `--owner <owner>` - Filter by owner
47
- - `--tag <tag>` - Filter by tag
48
- - `--stability <level>` - Filter by stability (experimental, beta, stable, deprecated)
49
- - `--json` - Output as JSON for scripting
50
-
51
- **Examples:**
52
-
53
- ```bash
54
- # List all specs
55
- contractspec list
56
-
57
- # Filter by type and stability
58
- contractspec list --type operation --stability stable
59
-
60
- # Find specs by owner
61
- contractspec list --owner @team-platform
62
-
63
- # JSON output for scripting
64
- contractspec list --json
65
- ```
66
-
67
- ### `contractspec watch`
68
-
69
- Watch contract specifications and auto-regenerate on changes.
70
-
71
- **Options:**
72
-
73
- - `--pattern <pattern>` - File pattern to watch (default: `**/*.contracts.ts`)
74
- - `--build` - Auto-run build command on changes
75
- - `--validate` - Auto-run validate command on changes
76
- - `--on-start <mode>` - Run action on startup: none|validate|build|both (default: none)
77
- - `--continue-on-error` - Do not exit on build/validate errors
78
- - `--debounce <ms>` - Debounce delay in milliseconds (default: 500)
79
-
80
- **Examples:**
81
-
82
- ```bash
83
- # Watch for changes and auto-build
84
- contractspec watch --build
85
-
86
- # Watch and auto-validate
87
- contractspec watch --validate
88
-
89
- # Custom pattern and debounce
90
- contractspec watch --pattern 'src/**/*.ts' --debounce 1000
91
- ```
92
-
93
- ### `contractspec sync`
94
-
95
- Sync contracts by building all discovered specs.
96
-
97
- **Options:**
98
-
99
- - `--pattern <pattern>` - File pattern to search (glob)
100
- - `--buckets <buckets>` - Optional output buckets (comma-separated). Builds repeat into `./generated/<bucket>/`
101
- - `--surfaces <surfaces>` - (deprecated) Alias for `--buckets`
102
- - `--validate` - Validate each spec before building (spec-only)
103
- - `--dry-run` - Show what would be synced without making changes
104
-
105
- **Examples:**
106
-
107
- ```bash
108
- # Sync all surfaces
109
- contractspec sync
110
-
111
- # Sync specific surfaces
112
- contractspec sync --surfaces api,ui
113
-
114
- # Preview changes
115
- contractspec sync --dry-run
116
- ```
117
-
118
- ### `contractspec clean`
119
-
120
- Clean generated files and build artifacts.
121
-
122
- **Options:**
123
-
124
- - `--dry-run` - Show what would be deleted without deleting
125
- - `--generated-only` - Only clean generated directories (generated/, dist/, .turbo/, outputDir artifacts)
126
- - `--older-than <days>` - Only clean files older than specified days
127
- - `--force` - Skip confirmation prompts
128
- - `--git-clean` - Use `git clean -fdx` for comprehensive cleanup (requires confirmation or `--force`)
129
-
130
- **Examples:**
131
-
132
- ```bash
133
- # Clean all generated files
134
- contractspec clean
135
-
136
- # Preview cleanup
137
- contractspec clean --dry-run
138
-
139
- # Clean only old files
140
- contractspec clean --older-than 30
141
-
142
- # Use git clean
143
- contractspec clean --git-clean
144
- ```
145
-
146
- ### `contractspec deps`
147
-
148
- Analyze contract dependencies and relationships.
149
-
150
- **Options:**
151
-
152
- - `--pattern <pattern>` - File pattern to search (glob)
153
- - `--entry <name>` - Focus on a specific contract name
154
- - `--format <format>` - text|json|dot (default: text)
155
- - `--graph` - (deprecated) Same as `--format dot`
156
- - `--circular` - Find circular dependencies
157
- - `--missing` - Find missing dependencies
158
- - `--json` - (deprecated) Same as `--format json`
159
-
160
- **Examples:**
161
-
162
- ```bash
163
- # Show dependency overview
164
- contractspec deps
165
-
166
- # Analyze specific contract
167
- contractspec deps --entry user.signup
168
-
169
- # Find circular dependencies
170
- contractspec deps --circular
171
-
172
- # Generate graphviz graph
173
- contractspec deps --format dot > deps.dot
174
- ```
175
-
176
- ### `contractspec diff`
177
-
178
- Compare contract specifications and show differences.
179
-
180
- **Arguments:**
181
-
182
- - `<spec1> <spec2>` - Two spec files to compare
183
-
184
- **Options:**
185
-
186
- - `--breaking` - Only show breaking changes
187
- - `--semantic` - Show semantic differences (not just text)
188
- - `--json` - Output as JSON for scripting
189
- - `--baseline <ref>` - Compare with git reference (branch/commit)
190
-
191
- **Examples:**
192
-
193
- ```bash
194
- # Compare two specs
195
- contractspec diff spec1.ts spec2.ts
196
-
197
- # Compare with git branch
198
- contractspec diff spec.ts spec.ts --baseline main
199
-
200
- # Show only breaking changes
201
- contractspec diff spec1.ts spec2.ts --breaking
202
-
203
- # Semantic comparison
204
- contractspec diff spec1.ts spec2.ts --semantic
205
- ```
206
-
207
- ### `contractspec create`
208
-
209
- Interactive wizard to create contract specifications.
210
-
211
- **Options:**
212
-
213
- - `--type <type>` - Spec type: operation, event, presentation, form, feature
214
- - `--ai` - Use AI to generate spec from description
215
- - `--provider <provider>` - AI provider: claude, openai, ollama, custom
216
- - `--model <model>` - AI model to use
217
-
218
- **Examples:**
219
-
220
- ```bash
221
- # Interactive wizard
222
- contractspec create
223
-
224
- # Create operation spec with AI
225
- contractspec create --type operation --ai
226
-
227
- # Use local Ollama model
228
- contractspec create --ai --provider ollama --model codellama
229
- ```
230
-
231
- ### `contractspec build`
232
-
233
- Generate implementation code from contract specs using AI agents with automatic fallbacks.
234
-
235
- **Options:**
236
-
237
- - `--output-dir <dir>` - Output directory (default: ./generated)
238
- - `--provider <provider>` - AI provider: claude, openai, ollama, custom
239
- - `--model <model>` - AI model to use
240
- - `--agent-mode <mode>` - Agent mode: simple, cursor, claude-code, openai-codex, opencode
241
- - `--no-tests` - Skip test generation
242
- - `--no-agent` - Disable AI (use basic templates)
243
-
244
- > ℹ️ The build command automatically orchestrates between the selected agent and lightweight templates. If an agent becomes unavailable (missing API key, Cursor not running, etc.) the CLI falls back to deterministic templates so the build never blocks.
245
-
246
- **Examples:**
247
-
248
- ```bash
249
- # Generate handler from operation spec (default: simple agent)
250
- contractspec build src/contracts/signup.contracts.ts
251
-
252
- # Use Claude Code agent for high-quality production code
253
- contractspec build src/contracts/signup.contracts.ts --agent-mode claude-code
254
-
255
- # Use OpenAI Codex for algorithmic implementations
256
- contractspec build src/contracts/optimizer.contracts.ts --agent-mode openai-codex
257
-
258
- # Generate without AI (basic templates only)
259
- contractspec build src/contracts/simple.contracts.ts --no-agent
260
- ```
261
-
262
- ### `contractspec validate`
263
-
264
- Validate contract specifications and optionally verify implementations against specs using AI.
265
-
266
- **Options:**
267
-
268
- - `--check-implementation` - Validate implementation against spec using AI
269
- - `--implementation-path <path>` - Path to implementation (auto-detected if not specified)
270
- - `--agent-mode <mode>` - Agent mode for validation: simple, claude-code, openai-codex, opencode
271
- - `--check-handlers` - Verify handler implementations exist
272
- - `--check-tests` - Verify test coverage
273
- - `-i, --interactive` - Interactive mode - prompt for what to validate
274
-
275
- > ℹ️ When no validation scope is provided, the CLI prompts you to choose between spec-only validation or full spec + implementation validation. In non-interactive environments it defaults to spec-only. Use `--check-implementation` to skip the prompt.
276
-
277
- **Examples:**
278
-
279
- ```bash
280
- # Validate spec structure only
281
- contractspec validate src/contracts/signup.contracts.ts
282
-
283
- # Validate implementation against spec with AI
284
- contractspec validate src/contracts/signup.contracts.ts --check-implementation
285
-
286
- # Interactive validation with Claude Code agent
287
- contractspec validate src/contracts/signup.contracts.ts -i --agent-mode claude-code
288
-
289
- # Validate specific implementation file
290
- contractspec validate src/contracts/signup.contracts.ts \
291
- --check-implementation \
292
- --implementation-path src/handlers/signup.handler.ts \
293
- --agent-mode claude-code
294
- ```
295
-
296
- ### `contractspec ci`
297
-
298
- Run all validation checks for CI/CD pipelines with machine-readable output formats.
299
-
300
- **Options:**
301
-
302
- - `--pattern <glob>` - Glob pattern for spec discovery
303
- - `--format <format>` - Output format: text, json, sarif (default: text)
304
- - `--output <file>` - Write results to file
305
- - `--fail-on-warnings` - Exit with code 2 on warnings
306
- - `--skip <checks>` - Skip specific checks (comma-separated)
307
- - `--checks <checks>` - Only run specific checks (comma-separated)
308
- - `--check-handlers` - Include handler implementation checks
309
- - `--check-tests` - Include test coverage checks
310
- - `--verbose` - Verbose output
311
-
312
- **Available Checks:**
313
-
314
- - `structure` - Spec structure validation (meta, io, policy)
315
- - `integrity` - Contract integrity (orphaned specs, broken refs)
316
- - `deps` - Dependency analysis (circular deps, missing refs)
317
- - `doctor` - Installation health (skips AI in CI)
318
- - `handlers` - Handler implementation existence
319
- - `tests` - Test file existence
14
+ `npm install contractspec`
320
15
 
321
- **Exit Codes:**
16
+ or
322
17
 
323
- - `0` - All checks passed
324
- - `1` - Errors found
325
- - `2` - Warnings found (with `--fail-on-warnings`)
18
+ `bun add contractspec`
326
19
 
327
- **Examples:**
20
+ ## Usage
328
21
 
329
22
  ```bash
330
- # Run all CI checks
331
- contractspec ci
332
-
333
- # Output as JSON for parsing
334
- contractspec ci --format json
335
-
336
- # Output SARIF for GitHub Code Scanning
337
- contractspec ci --format sarif --output results.sarif
338
-
339
- # Skip doctor checks
340
- contractspec ci
341
-
342
- # Run only structure and integrity checks
343
- contractspec ci --checks structure,integrity
344
-
345
- # Fail on warnings
346
- contractspec ci --fail-on-warnings
347
- ```
348
-
349
- For comprehensive CI/CD integration guides (GitHub Actions, GitLab CI, Jenkins, AWS CodeBuild, etc.), see [docs/ci-cd.md](./docs/ci-cd.md).
350
-
351
- ## Configuration
352
-
353
- Create a `.contractsrc.json` file in your project root:
354
-
355
- ```json
356
- {
357
- "aiProvider": "claude",
358
- "aiModel": "claude-3-7-sonnet-20250219",
359
- "agentMode": "claude-code",
360
- "outputDir": "./src",
361
- "conventions": {
362
- "operations": "interactions/commands|queries",
363
- "events": "events",
364
- "presentations": "presentations",
365
- "forms": "forms"
366
- },
367
- "defaultOwners": ["@team"],
368
- "defaultTags": ["auto-generated"]
369
- }
370
- ```
371
-
372
- ### Agent Modes
373
-
374
- The CLI supports multiple AI agent modes for different use cases:
375
-
376
- - **simple** (default) - Direct LLM API calls, fast and straightforward
377
- - **cursor** - Leverages Windsurf/Cursor agentic capabilities (requires Cursor environment)
378
- - **claude-code** - Uses Claude with extended thinking, best for production code and validation
379
- - **openai-codex** - Uses GPT-4o/o1 models, excellent for algorithms and optimization
380
- - **opencode** (alias for opencode-sdk) - Uses OpenCode SDK for self-hosted backends (requires `@opencode-ai/sdk`)
381
-
382
- See [AGENT_MODES.md](./AGENT_MODES.md) for detailed comparison and usage guide.
383
-
384
- ### AI Providers
385
-
386
- #### Claude (Anthropic)
387
-
388
- ```bash
389
- export ANTHROPIC_API_KEY=your-key-here
390
- contractspec create --ai --provider claude
391
- ```
392
-
393
- #### OpenAI
394
-
395
- ```bash
396
- export OPENAI_API_KEY=your-key-here
397
- contractspec create --ai --provider openai --model gpt-4o
398
- ```
399
-
400
- #### Ollama (Local)
401
-
402
- Install Ollama and pull a model:
403
-
404
- ```bash
405
- ollama pull codellama
406
- contractspec create --ai --provider ollama --model codellama
407
- ```
408
-
409
- #### Custom OpenAI-Compatible Endpoint
410
-
411
- ```bash
412
- contractspec create --ai --provider custom \
413
- --endpoint https://your-llm.com/v1 \
414
- --model your-model-name
415
- ```
416
-
417
- Set via environment:
418
-
419
- ```bash
420
- export CONTRACTSPEC_LLM_ENDPOINT=https://your-llm.com/v1
421
- export CONTRACTSPEC_LLM_API_KEY=your-key
422
- export CONTRACTSPEC_LLM_MODEL=your-model
423
- ```
424
-
425
- ### Supported Local Models (Ollama)
426
-
427
- - `codellama` - Code generation (recommended)
428
- - `llama3.1` - General purpose
429
- - `mistral` - Fast, good quality
430
- - `deepseek-coder` - Specialized for code
431
-
432
- ## Examples
433
-
434
- ### Create a Command Spec
435
-
436
- ```bash
437
- contractspec create --type operation
438
- # Follow prompts:
439
- # - Name: user.signup
440
- # - Kind: command
441
- # - Description: Start user signup flow
442
- # etc.
443
- ```
444
-
445
- ### Build Handler from Spec
446
-
447
- Given a spec file `src/contracts/signup.contracts.ts`:
448
-
449
- ```bash
450
- contractspec build src/contracts/signup.contracts.ts
451
- # Generates:
452
- # - src/handlers/signup.handler.ts
453
- # - src/handlers/signup.handler.test.ts
454
- ```
455
-
456
- ### Multi-Provider Workflow
457
-
458
- ```bash
459
- # Draft with free local model
460
- contractspec create --ai --provider ollama
461
-
462
- # Refine with Claude for production
463
- contractspec build src/contracts/draft.ts --provider claude
464
- ```
465
-
466
- ## Advanced Usage
467
-
468
- ### Multi-Provider and Multi-Agent Workflows
469
-
470
- Combine different providers and agents for optimal results:
471
-
472
- ```bash
473
- # Draft specs with free local model
474
- contractspec create --ai --provider ollama --model codellama
475
-
476
- # Generate production code with Claude Code agent
477
- contractspec build src/contracts/user-signup.contracts.ts \
478
- --agent-mode claude-code
479
-
480
- # Validate implementation with AI
481
- contractspec validate src/contracts/user-signup.contracts.ts \
482
- --check-implementation \
483
- --agent-mode claude-code
484
-
485
- # Use OpenAI for algorithmic code
486
- contractspec build src/contracts/search-algorithm.contracts.ts \
487
- --agent-mode openai-codex
488
- ```
489
-
490
- ### Environment Variables
491
-
492
- ```bash
493
- # API Keys
494
- export ANTHROPIC_API_KEY=your-key-here
495
- export OPENAI_API_KEY=your-key-here
496
-
497
- # Agent configuration
498
- export CONTRACTSPEC_AGENT_MODE=claude-code
499
- export CONTRACTSPEC_AI_PROVIDER=claude
500
- export CONTRACTSPEC_AI_MODEL=claude-3-7-sonnet-20250219
501
-
502
- # Custom provider
503
- export CONTRACTSPEC_LLM_ENDPOINT=https://your-llm.com/v1
504
- export CONTRACTSPEC_LLM_API_KEY=your-api-key
505
- ```
506
-
507
- ### CI/CD Integration
508
-
509
- ```yaml
510
- # .github/workflows/contracts.yml
511
- name: Validate Contracts
512
-
513
- on: [push, pull_request]
514
-
515
- jobs:
516
- validate:
517
- runs-on: ubuntu-latest
518
- steps:
519
- - uses: actions/checkout@v6
520
- - uses: oven-sh/setup-bun@v2
521
- - run: bun install
522
- - run: contractspec validate 'src/contracts/**/*.ts'
523
- ```
524
-
525
- ### Project Structure
526
-
527
- Recommended organization:
528
-
529
- ```
530
- src/
531
- ├── contracts/ # Contract specs
532
- │ ├── events/
533
- │ │ └── user-created.event.ts
534
- │ ├── interactions/
535
- │ │ ├── commands/
536
- │ │ │ └── user-signup.contracts.ts
537
- │ │ └── queries/
538
- │ │ └── user-get-profile.contracts.ts
539
- │ └── presentations/
540
- │ └── user-profile-card.presentation.ts
541
- ├── handlers/ # Generated handlers
542
- ├── components/ # Generated components
543
- └── forms/ # Generated forms
544
- ```
545
-
546
- ## Troubleshooting
547
-
548
- ### "Provider not available" error
549
-
550
- **Claude:**
551
-
552
- ```bash
553
- export ANTHROPIC_API_KEY=sk-ant-...
554
- ```
555
-
556
- **OpenAI:**
557
-
558
- ```bash
559
- export OPENAI_API_KEY=sk-...
560
- ```
561
-
562
- **Ollama:**
563
-
564
- ```bash
565
- # Install Ollama from https://ollama.ai
566
- ollama serve
567
- ollama pull codellama
23
+ npx contractspec --help
24
+ # or
25
+ bunx contractspec --help
568
26
  ```
569
27
 
570
- ### Slow generation
571
-
572
- For faster local generation, use smaller models:
573
-
574
- ```bash
575
- contractspec create --ai --provider ollama --model codellama:7b
576
- ```
577
-
578
- For cloud, use faster models:
579
-
580
- ```bash
581
- contractspec build spec.ts --provider openai --model gpt-3.5-turbo
582
- ```
583
-
584
- ### Import errors in generated code
585
-
586
- Make sure `@contractspec/lib.contracts-spec` and `@contractspec/lib.schema` are installed:
587
-
588
- ```bash
589
- bun add @contractspec/lib.contracts-spec @contractspec/lib.schema
590
- ```
591
-
592
- ## Contributing
593
-
594
- Contributions welcome! Please:
595
-
596
- 1. Follow existing code style
597
- 2. Add tests for new features
598
- 3. Update documentation
599
- 4. Ensure all tests pass: `bun test`
600
-
601
- ## Agent Modes Deep Dive
602
-
603
- ### When to Use Each Mode
604
-
605
- **Simple Mode** - Default, good for:
606
-
607
- - Rapid prototyping
608
- - Basic implementations
609
- - Quick iterations
610
- - CI/CD pipelines (fast)
611
-
612
- **Cursor Mode** - Best for:
613
-
614
- - Working in Windsurf/Cursor IDE
615
- - Complex, iterative development
616
- - Context-aware code generation
617
-
618
- **Claude Code Mode** - Best for:
619
-
620
- - Production-quality implementations
621
- - Critical business logic
622
- - Comprehensive code validation
623
- - Detailed code reviews
28
+ ## Public Entry Points
624
29
 
625
- **OpenAI Codex Mode** - Best for:
30
+ - `contractspec` -> `./bin/contractspec.mjs`
626
31
 
627
- - Algorithmic problems
628
- - Performance optimization
629
- - Mathematical computations
630
- - Complex data transformations
32
+ ## Local Commands
631
33
 
632
- For more details, see [AGENT_MODES.md](./AGENT_MODES.md).
34
+ - `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
35
+ - `bun run publish:pkg:canary` — bun publish:pkg --tag canary
633
36
 
634
- ## Roadmap
37
+ ## Recent Updates
635
38
 
636
- - [x] AI-powered code generation
637
- - [x] Multiple agent modes (simple, cursor, claude-code, openai-codex, opencode)
638
- - [x] AI-powered implementation validation
639
- - [x] Contract listing and discovery (`contractspec list`)
640
- - [x] Watch mode for auto-regeneration (`contractspec watch`)
641
- - [x] Multi-surface synchronization (`contractspec sync`)
642
- - [x] Cleanup utilities (`contractspec clean`)
643
- - [x] Dependency analysis (`contractspec deps`)
644
- - [x] Contract diffing and comparison (`contractspec diff`)
645
- - [x] CI/CD integration (`contractspec ci`) with SARIF/JSON output
646
- - [x] GitHub Action for CI/CD
647
- - [ ] Form spec generation
648
- - [ ] Feature spec bundling
649
- - [ ] Handler signature checking in validation
650
- - [ ] Test coverage validation
651
- - [ ] Interactive spec editing
652
- - [ ] GraphQL schema generation
653
- - [ ] OpenAPI/Swagger export
39
+ - Replace eslint+prettier by biomejs to optimize speed
40
+ - Stability
41
+ - Refactor contracts libs to split them reducing bundle size and load
654
42
 
655
- ## License
43
+ ## Notes
656
44
 
657
- MIT
45
+ - This package is a shim; all logic lives in `@contractspec/app.cli-contractspec`
46
+ - Do not add dependencies beyond the CLI app workspace reference
47
+ - Changes to `bin/contractspec.mjs` affect every user -- test locally before publishing
@@ -6,20 +6,23 @@ import { fileURLToPath } from 'node:url';
6
6
 
7
7
  const currentDir = dirname(fileURLToPath(import.meta.url));
8
8
  const packageJsonCandidates = [
9
- resolve(currentDir, '../package.json'),
10
- resolve(currentDir, '../contractspec/package.json'),
9
+ resolve(currentDir, '../package.json'),
10
+ resolve(currentDir, '../contractspec/package.json'),
11
11
  ];
12
12
 
13
13
  for (const packageJsonPath of packageJsonCandidates) {
14
- try {
15
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
16
- if (typeof packageJson.version === 'string' && packageJson.version.length > 0) {
17
- process.env.CONTRACTSPEC_CLI_VERSION ??= packageJson.version;
18
- break;
19
- }
20
- } catch {
21
- // Try the next candidate path.
22
- }
14
+ try {
15
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
16
+ if (
17
+ typeof packageJson.version === 'string' &&
18
+ packageJson.version.length > 0
19
+ ) {
20
+ process.env.CONTRACTSPEC_CLI_VERSION ??= packageJson.version;
21
+ break;
22
+ }
23
+ } catch {
24
+ // Try the next candidate path.
25
+ }
23
26
  }
24
27
 
25
28
  await import('@contractspec/app.cli-contractspec/run');
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
1
  {
2
- "name": "contractspec",
3
- "version": "3.7.6",
4
- "description": "CLI tool for creating, building, and validating contract specifications",
5
- "bin": {
6
- "contractspec": "./bin/contractspec.mjs"
7
- },
8
- "dependencies": {
9
- "@contractspec/app.cli-contractspec": "3.7.6"
10
- },
11
- "scripts": {
12
- "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
13
- "publish:pkg:canary": "bun publish:pkg --tag canary"
14
- },
15
- "keywords": [
16
- "cli",
17
- "contracts",
18
- "code-generation",
19
- "ai",
20
- "typescript"
21
- ],
22
- "publishConfig": {
23
- "name": "contractspec",
24
- "access": "public",
25
- "registry": "https://registry.npmjs.org/"
26
- },
27
- "license": "MIT",
28
- "homepage": "https://contractspec.io",
29
- "repository": {
30
- "type": "git",
31
- "url": "https://github.com/lssm-tech/contractspec.git",
32
- "directory": "packages/apps-registry/contractspec"
33
- }
2
+ "name": "contractspec",
3
+ "version": "3.7.7",
4
+ "description": "CLI tool for creating, building, and validating contract specifications",
5
+ "bin": {
6
+ "contractspec": "./bin/contractspec.mjs"
7
+ },
8
+ "dependencies": {
9
+ "@contractspec/app.cli-contractspec": "4.0.0"
10
+ },
11
+ "scripts": {
12
+ "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
13
+ "publish:pkg:canary": "bun publish:pkg --tag canary"
14
+ },
15
+ "keywords": [
16
+ "cli",
17
+ "contracts",
18
+ "code-generation",
19
+ "ai",
20
+ "typescript"
21
+ ],
22
+ "publishConfig": {
23
+ "name": "contractspec",
24
+ "access": "public",
25
+ "registry": "https://registry.npmjs.org/"
26
+ },
27
+ "license": "MIT",
28
+ "homepage": "https://contractspec.io",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/lssm-tech/contractspec.git",
32
+ "directory": "packages/apps-registry/contractspec"
33
+ }
34
34
  }