@contractspec/module.workspace 3.7.6 → 4.0.3

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/README.md CHANGED
@@ -1,50 +1,67 @@
1
1
  # @contractspec/module.workspace
2
2
 
3
- Website: https://contractspec.io/
3
+ Website: https://contractspec.io
4
4
 
5
+ **Workspace discovery and management module.**
5
6
 
6
- Pure, deterministic domain logic and static analysis utilities for ContractSpec workspace operations.
7
+ ## What It Provides
7
8
 
8
- ## Purpose
9
+ - **Layer**: module.
10
+ - **Consumers**: bundles (contractspec-studio), apps (cli-contractspec, vscode-contractspec).
11
+ - Related ContractSpec packages include `@contractspec/lib.contracts-integrations`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.schema`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
12
+ - Related ContractSpec packages include `@contractspec/lib.contracts-integrations`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.schema`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
9
13
 
10
- This module contains platform-agnostic logic used by ContractSpec tooling:
14
+ ## Installation
11
15
 
12
- - **Types**: Shared type definitions for specs, templates, and analysis results
13
- - **Analysis**: Static code analysis (spec scanning, dependency graphs, semantic diff)
14
- - **Templates**: Code generation templates for specs and handlers
15
- - **AI Prompts**: Prompt builders for AI-assisted spec creation and code generation
16
+ `npm install @contractspec/module.workspace`
16
17
 
17
- ## Design Principles
18
+ or
18
19
 
19
- - **No side effects**: All functions are pure and deterministic
20
- - **No CLI dependencies**: No `chalk`, `ora`, `commander`, or `inquirer`
21
- - **No filesystem access**: Operations take code/data as input, return results
22
- - **Reusable**: Can be used by CLI, web apps, VS Code extensions, etc.
20
+ `bun add @contractspec/module.workspace`
23
21
 
24
22
  ## Usage
25
23
 
26
- ```typescript
27
- import {
28
- scanSpecSource,
29
- computeSemanticDiff,
30
- buildDependencyGraph,
31
- validateSpecStructure,
32
- generateOperationSpec,
33
- } from '@contractspec/module.workspace';
34
- ```
24
+ Import the root entrypoint from `@contractspec/module.workspace`, or choose a documented subpath when you only need one part of the package surface.
35
25
 
36
- ## Exports
37
-
38
- - `analysis/` - Static analysis utilities
39
- - `templates/` - Code generation templates
40
- - `ai/` - AI prompt builders
41
- - `types/` - Shared type definitions
26
+ ## Architecture
42
27
 
28
+ - `src/ai` is part of the package's public or composition surface.
29
+ - `src/analysis` is part of the package's public or composition surface.
30
+ - `src/formatter.ts` is part of the package's public or composition surface.
31
+ - `src/formatters` is part of the package's public or composition surface.
32
+ - `src/index.ts` is the root public barrel and package entrypoint.
33
+ - `src/templates` is part of the package's public or composition surface.
34
+ - `src/types` is part of the package's public or composition surface.
43
35
 
36
+ ## Public Entry Points
44
37
 
38
+ - Export `.` resolves through `./src/index.ts`.
45
39
 
40
+ ## Local Commands
46
41
 
42
+ - `bun run dev` — contractspec-bun-build dev
43
+ - `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
44
+ - `bun run test` — bun test
45
+ - `bun run lint` — bun lint:fix
46
+ - `bun run lint:check` — biome check .
47
+ - `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
48
+ - `bun run typecheck` — tsc --noEmit
49
+ - `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
50
+ - `bun run publish:pkg:canary` — bun publish:pkg --tag canary
51
+ - `bun run clean` — rimraf dist .turbo
52
+ - `bun run build:bundle` — contractspec-bun-build transpile
53
+ - `bun run build:types` — contractspec-bun-build types
54
+ - `bun run prebuild` — contractspec-bun-build prebuild
47
55
 
56
+ ## Recent Updates
48
57
 
58
+ - Replace eslint+prettier by biomejs to optimize speed.
59
+ - Stability.
60
+ - Add changesets and apply pending fixes.
61
+ - Add ai-native messaging channel runtime.
49
62
 
63
+ ## Notes
50
64
 
65
+ - Uses `ts-morph` for AST analysis and `compare-versions` for semver checks -- version bumps may affect parsing behavior.
66
+ - Workspace detection is file-system-dependent; always use the provided abstractions, never raw `fs` calls.
67
+ - Changes here affect CLI, VSCode extension, and studio workspace initialization flows.
@@ -1,2 +1,2 @@
1
- export * from './spec-creation';
2
1
  export * from './code-generation';
2
+ export * from './spec-creation';
@@ -2,8 +2,8 @@
2
2
  * Contract dependency graph utilities.
3
3
  * Extracted from cli-contractspec/src/commands/deps/graph.ts
4
4
  */
5
- import type { ContractNode, ContractGraph } from '../../types/analysis-types';
6
- export type { ContractNode, ContractGraph };
5
+ import type { ContractGraph, ContractNode } from '../../types/analysis-types';
6
+ export type { ContractGraph, ContractNode };
7
7
  /**
8
8
  * Build reverse edges (dependents) for all nodes in the graph.
9
9
  */
@@ -4,8 +4,8 @@
4
4
  * Compares input/output schemas field-by-field to detect
5
5
  * breaking and non-breaking changes.
6
6
  */
7
- import type { FieldSnapshot, IoSnapshot } from '../snapshot/types';
8
7
  import type { SemanticDiffItem } from '../../types/analysis-types';
8
+ import type { FieldSnapshot, IoSnapshot } from '../snapshot/types';
9
9
  /**
10
10
  * Deep diff options.
11
11
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Semantic diff utilities for comparing specs.
3
3
  */
4
- export * from './semantic';
5
4
  export * from './deep-diff';
5
+ export * from './semantic';
@@ -3,6 +3,6 @@
3
3
  *
4
4
  * Provides classification of contract changes as breaking or non-breaking.
5
5
  */
6
- export * from './types';
7
- export { DEFAULT_RULES, BREAKING_RULES, NON_BREAKING_RULES, INFO_RULES, findMatchingRule, getRulesBySeverity, } from './rules';
8
6
  export { classifyImpact } from './classifier';
7
+ export { BREAKING_RULES, DEFAULT_RULES, findMatchingRule, getRulesBySeverity, INFO_RULES, NON_BREAKING_RULES, } from './rules';
8
+ export * from './types';
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * Static analysis utilities for ContractSpec.
3
3
  */
4
- export * from './spec-scan';
5
- export * from './feature-scan';
4
+ export * from './deps/index';
5
+ export * from './diff/index';
6
6
  export * from './example-scan';
7
+ export * from './feature-scan';
7
8
  export * from './grouping';
8
- export * from './diff/index';
9
- export * from './deps/index';
10
- export * from './validate/index';
11
- export * from './snapshot/index';
12
9
  export * from './impact/index';
10
+ export * from './snapshot/index';
13
11
  export * from './spec-parser';
12
+ export * from './spec-scan';
13
+ export * from './validate/index';
@@ -3,6 +3,6 @@
3
3
  *
4
4
  * Provides deterministic snapshot generation for contract comparison.
5
5
  */
6
- export * from './types';
7
- export { normalizeValue, toCanonicalJson, computeHash, sortSpecs, sortFields, } from './normalizer';
6
+ export { computeHash, normalizeValue, sortFields, sortSpecs, toCanonicalJson, } from './normalizer';
8
7
  export { generateSnapshot } from './snapshot';
8
+ export * from './types';
@@ -4,7 +4,7 @@
4
4
  * Scans source code to extract spec definitions and metadata without execution.
5
5
  */
6
6
  import type { AnalyzedOperationKind, AnalyzedSpecType, SpecScanResult } from '../types/analysis-types';
7
- export { extractTestTarget, extractTestCoverage } from './spec-parsing-utils';
7
+ export { extractTestCoverage, extractTestTarget } from './spec-parsing-utils';
8
8
  /**
9
9
  * Scan all specs from a single source file.
10
10
  */
@@ -1,5 +1,5 @@
1
- import type { ParsedSpec } from '../types/llm-types';
2
1
  import type { DocBlock } from '@contractspec/lib.contracts-spec/docs';
2
+ import type { ParsedSpec } from '../types/llm-types';
3
3
  /**
4
4
  * Convert a parsed spec to a DocBlock for documentation generation.
5
5
  */
package/dist/index.d.ts CHANGED
@@ -4,9 +4,9 @@
4
4
  * Pure, deterministic domain logic and static analysis utilities
5
5
  * for ContractSpec workspace operations.
6
6
  */
7
- export * from './types/index';
8
- export * from './analysis/index';
9
- export * from './templates/index';
10
7
  export * from './ai/index';
8
+ export * from './analysis/index';
11
9
  export * from './formatter';
12
10
  export * from './formatters/index';
11
+ export * from './templates/index';
12
+ export * from './types/index';