@contractspec/bundle.workspace 3.7.5 → 4.0.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.
Files changed (108) hide show
  1. package/README.md +55 -66
  2. package/dist/adapters/ai.d.ts +1 -1
  3. package/dist/adapters/factory.d.ts +1 -1
  4. package/dist/adapters/index.d.ts +5 -5
  5. package/dist/ai/agents/index.d.ts +4 -4
  6. package/dist/ai/agents/orchestrator.d.ts +1 -1
  7. package/dist/ai/agents/simple-agent.d.ts +1 -1
  8. package/dist/ai/agents/unified-adapter.d.ts +2 -2
  9. package/dist/ai/index.d.ts +1 -1
  10. package/dist/ai/providers.d.ts +1 -1
  11. package/dist/contracts/operations/init.operation.d.ts +2 -2
  12. package/dist/formatters/index.d.ts +1 -1
  13. package/dist/index.d.ts +5 -5
  14. package/dist/index.js +14194 -13988
  15. package/dist/node/index.js +14187 -13981
  16. package/dist/ports/index.d.ts +2 -2
  17. package/dist/services/action-drift/index.d.ts +1 -1
  18. package/dist/services/action-drift/types.d.ts +1 -1
  19. package/dist/services/action-pr/index.d.ts +1 -1
  20. package/dist/services/agent-guide/index.d.ts +3 -3
  21. package/dist/services/agent-guide/types.d.ts +1 -1
  22. package/dist/services/build.d.ts +1 -1
  23. package/dist/services/ci-check/checks/handlers.d.ts +1 -1
  24. package/dist/services/ci-check/checks/index.d.ts +7 -6
  25. package/dist/services/ci-check/checks/policy.d.ts +13 -0
  26. package/dist/services/ci-check/checks/policy.test.d.ts +1 -0
  27. package/dist/services/ci-check/checks/tests.d.ts +1 -1
  28. package/dist/services/ci-check/index.d.ts +1 -1
  29. package/dist/services/ci-check/types.d.ts +3 -3
  30. package/dist/services/ci-check/utils.d.ts +2 -0
  31. package/dist/services/config.d.ts +1 -1
  32. package/dist/services/create/ai-generator.d.ts +1 -1
  33. package/dist/services/create/index.d.ts +1 -1
  34. package/dist/services/doctor/checks/ai.d.ts +1 -1
  35. package/dist/services/doctor/checks/config.d.ts +1 -1
  36. package/dist/services/doctor/checks/deps.d.ts +1 -1
  37. package/dist/services/doctor/checks/index.d.ts +3 -3
  38. package/dist/services/doctor/checks/mcp.d.ts +1 -1
  39. package/dist/services/doctor/doctor-service.d.ts +24 -2
  40. package/dist/services/doctor/index.d.ts +1 -1
  41. package/dist/services/features/index.d.ts +1 -1
  42. package/dist/services/fix/fix-link-formatter.d.ts +1 -1
  43. package/dist/services/fix/fix-service.d.ts +1 -1
  44. package/dist/services/fix/format-applicator.d.ts +1 -1
  45. package/dist/services/fix/index.d.ts +2 -2
  46. package/dist/services/fix/strategies/implement-ai.d.ts +1 -1
  47. package/dist/services/fix/strategies/implement-skeleton.d.ts +1 -1
  48. package/dist/services/fix/strategies/index.d.ts +2 -2
  49. package/dist/services/fix/strategies/remove-reference.d.ts +1 -1
  50. package/dist/services/fix/types.d.ts +1 -1
  51. package/dist/services/formatter.d.ts +1 -1
  52. package/dist/services/hooks/index.d.ts +1 -1
  53. package/dist/services/impact/index.d.ts +2 -2
  54. package/dist/services/implementation/discovery.d.ts +1 -1
  55. package/dist/services/implementation/index.d.ts +1 -1
  56. package/dist/services/implementation/resolver/index.d.ts +3 -3
  57. package/dist/services/import/import-service.d.ts +2 -2
  58. package/dist/services/import/index.d.ts +3 -3
  59. package/dist/services/import/verify-service.d.ts +1 -1
  60. package/dist/services/index.d.ts +37 -37
  61. package/dist/services/layer-discovery.d.ts +1 -1
  62. package/dist/services/list.d.ts +3 -3
  63. package/dist/services/openapi/import-service.d.ts +1 -1
  64. package/dist/services/openapi/index.d.ts +3 -3
  65. package/dist/services/openapi/sync-service.d.ts +1 -1
  66. package/dist/services/quickstart/index.d.ts +1 -1
  67. package/dist/services/quickstart/quickstart-service.d.ts +1 -1
  68. package/dist/services/regenerator.d.ts +1 -1
  69. package/dist/services/rulesync.d.ts +1 -1
  70. package/dist/services/setup/index.d.ts +2 -2
  71. package/dist/services/setup/setup-service.d.ts +1 -1
  72. package/dist/services/setup/targets/agents-md.d.ts +1 -1
  73. package/dist/services/setup/targets/biome-config.d.ts +9 -0
  74. package/dist/services/setup/targets/cli-config.d.ts +1 -1
  75. package/dist/services/setup/targets/cursor-rules.d.ts +1 -1
  76. package/dist/services/setup/targets/index.d.ts +5 -4
  77. package/dist/services/setup/targets/mcp-claude.d.ts +1 -1
  78. package/dist/services/setup/targets/mcp-cursor.d.ts +1 -1
  79. package/dist/services/setup/targets/vscode-settings.d.ts +1 -1
  80. package/dist/services/setup/types.d.ts +1 -1
  81. package/dist/services/sync.d.ts +1 -1
  82. package/dist/services/test/index.d.ts +1 -1
  83. package/dist/services/test/test-generator-service.d.ts +2 -2
  84. package/dist/services/test/test-service.d.ts +1 -1
  85. package/dist/services/test-link/index.d.ts +2 -2
  86. package/dist/services/test-link/test-ref-validator.d.ts +1 -1
  87. package/dist/services/upgrade/index.d.ts +1 -1
  88. package/dist/services/upgrade/upgrade-service.d.ts +1 -1
  89. package/dist/services/validate/blueprint-validator.d.ts +1 -1
  90. package/dist/services/validate/implementation-agent-validator.d.ts +1 -1
  91. package/dist/services/validate/implementation-validator.d.ts +1 -1
  92. package/dist/services/validate/index.d.ts +3 -3
  93. package/dist/services/validate/tenant-validator.d.ts +1 -1
  94. package/dist/services/verification-cache/adapters/index.d.ts +1 -1
  95. package/dist/services/verification-cache/index.d.ts +2 -2
  96. package/dist/services/verify/index.d.ts +4 -4
  97. package/dist/services/versioning/changelog-formatter.d.ts +1 -1
  98. package/dist/services/versioning/conventional-commits.d.ts +1 -1
  99. package/dist/services/versioning/index.d.ts +3 -3
  100. package/dist/services/versioning/types.d.ts +2 -3
  101. package/dist/services/versioning/versioning-service.d.ts +1 -1
  102. package/dist/services/vibe/index.d.ts +5 -5
  103. package/dist/services/watch.d.ts +2 -2
  104. package/dist/services/workspace-info.d.ts +2 -2
  105. package/dist/templates/fix/index.d.ts +2 -2
  106. package/dist/templates/index.d.ts +9 -9
  107. package/dist/utils/index.d.ts +1 -1
  108. package/package.json +16 -14
package/README.md CHANGED
@@ -1,83 +1,72 @@
1
1
  # @contractspec/bundle.workspace
2
2
 
3
- Website: https://contractspec.io/
3
+ Website: https://contractspec.io
4
4
 
5
+ **Core workspace bundle that powers ContractSpec CLI, validation, code generation, AI workflows, and repository setup.**
5
6
 
6
- Reusable use-cases and services for ContractSpec workspace operations.
7
+ ## What It Provides
7
8
 
8
- ## Purpose
9
+ - Provides the service layer behind the CLI, editor integrations, drift detection, diagnostics, and setup flows.
10
+ - Owns workspace-oriented AI agents, prompts, templates, fixers, and validation/reporting services.
11
+ - Acts as the main orchestration bundle for repository lifecycle and codegen workflows.
12
+ - `src/adapters/` contains runtime, provider, or environment-specific adapters.
13
+ - `src/contracts/` contains contract specs, operations, entities, and registry exports.
14
+ - `src/services/` contains business logic services and workflows.
9
15
 
10
- This bundle provides platform-agnostic services that can be used by:
16
+ ## Installation
11
17
 
12
- - CLI tools (`@contractspec/app.cli-contractspec`)
13
- - Web applications
14
- - VS Code extensions
15
- - API servers
18
+ `npm install @contractspec/bundle.workspace`
16
19
 
17
- ## Architecture
20
+ or
18
21
 
19
- ```
20
- bundle.contractspec-workspace
21
- ├── services/ # Use-case implementations
22
- │ ├── build.ts # Build deterministic artifacts from specs (templates-first)
23
- │ ├── validate.ts # Validate spec structure (and, later, implementation checks)
24
- │ ├── diff.ts # Compare specs (semantic diff)
25
- │ ├── deps.ts # Analyze dependencies
26
- │ ├── list.ts # Discover specs by glob
27
- │ └── config.ts # Load + merge workspace config (.contractsrc.json)
28
- │ ├── sync.ts # Sync all specs (validate/build across a workspace)
29
- │ ├── watch.ts # Watch specs and trigger validate/build
30
- │ ├── clean.ts # Safe-by-default cleanup of generated artifacts
31
- │ ├── test.ts # Run TestSpec scenarios (pure runner wrapper)
32
- │ ├── regenerator.ts # Regenerator service wrapper (no module loading)
33
- │ ├── integrity.ts # Analyze spec/feature integrity and coverage
34
- │ ├── layer-discovery.ts # Discover features, examples, app-configs
35
- │ ├── doctor/ # Health checks and auto-fixes
36
- │ └── ci-check/ # CI/CD validation checks
37
- ├── adapters/ # Runtime adapters (Node defaults)
38
- │ ├── fs.ts # Filesystem operations
39
- │ ├── git.ts # Git operations
40
- │ ├── watcher.ts # File watching
41
- │ ├── ai.ts # AI providers
42
- │ └── logger.ts # Logging/progress
43
- └── ports/ # Adapter interfaces
44
- └── index.ts # Port type definitions
45
- ```
46
-
47
- ## Design Principles
48
-
49
- - **Adapter pattern**: All I/O goes through explicit ports/adapters
50
- - **Testable**: Services can be tested with mock adapters
51
- - **Reusable**: Same services work across CLI, web, and extensions
52
- - **No CLI dependencies**: No `chalk`, `ora`, `commander`, or `inquirer`
22
+ `bun add @contractspec/bundle.workspace`
53
23
 
54
24
  ## Usage
55
25
 
56
- ```typescript
57
- import {
58
- createNodeAdapters,
59
- loadWorkspaceConfig,
60
- buildSpec,
61
- } from '@contractspec/bundle.workspace';
62
-
63
- // Create adapters for Node.js runtime
64
- const adapters = createNodeAdapters();
26
+ Import the root entrypoint from `@contractspec/bundle.workspace`, or choose a documented subpath when you only need one part of the package surface.
65
27
 
66
- // Load workspace config (or use defaults)
67
- const config = await loadWorkspaceConfig(adapters.fs);
28
+ ## Architecture
68
29
 
69
- // Build deterministic artifacts from a spec (templates-first)
70
- const result = await buildSpec(
71
- './my-spec.operation.ts',
72
- { fs: adapters.fs, logger: adapters.logger },
73
- config
74
- );
75
- ```
30
+ - `src/services/` contains the core use-cases for build, validate, doctor, diff, setup, examples, and CI flows.
31
+ - `src/adapters/` and `src/ports/` isolate filesystem, git, AI, and workspace integration boundaries.
32
+ - `src/ai/` contains workspace-specific agent definitions, prompts, and model-aware helpers.
33
+ - `src/templates/`, `src/contracts/`, `src/formatters/`, `src.types/`, and `src.utils/` support generated outputs and reporting.
34
+ - `src/index.ts` is the root public barrel and package entrypoint.
35
+ - `src/types.ts` is shared public type definitions.
36
+
37
+ ## Public Entry Points
38
+
39
+ - Root bundle export with namespaced services, adapters, ports, formatters, templates, contracts, AI helpers, and utilities.
40
+ - Export `.` resolves through `./src/index.ts`.
41
+
42
+ ## Local Commands
43
+
44
+ - `bun run dev` — contractspec-bun-build dev
45
+ - `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
46
+ - `bun run test` — bun test
47
+ - `bun run lint` — bun lint:fix
48
+ - `bun run lint:check` — biome check .
49
+ - `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
50
+ - `bun run typecheck` — tsc --noEmit
51
+ - `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
52
+ - `bun run publish:pkg:canary` — bun publish:pkg --tag canary
53
+ - `bun run clean` — rimraf dist .turbo
54
+ - `bun run build:bundle` — contractspec-bun-build transpile
55
+ - `bun run build:types` — contractspec-bun-build types
56
+ - `bun run prebuild` — contractspec-bun-build prebuild
57
+
58
+ ## Recent Updates
59
+
60
+ - Replace eslint+prettier by biomejs to optimize speed.
61
+ - Add table capabilities.
62
+ - Stability.
63
+ - Package exports.
64
+ - Add latest models and align defaults.
65
+ - Standardize tool naming to underscore notation.
76
66
 
77
67
  ## Notes
78
68
 
79
- - `sync` / `watch` accept optional overrides so CLI (or an extension) can inject
80
- richer build/validate behavior while reusing the deterministic orchestration.
81
- - `test` and `regenerator` deliberately avoid TypeScript module loading; callers
82
- pass already-loaded specs/contexts/rules/sinks.
83
-
69
+ - Largest bundle in the monorepo (~280 source files); prefer editing existing services over adding new top-level directories.
70
+ - Adapters must implement port interfaces; no direct infrastructure calls from services.
71
+ - AI agent definitions must stay provider-agnostic via the `ai` SDK abstraction.
72
+ - Template changes affect generated code across all consumers; test thoroughly.
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Node.js AI adapter implementation using Vercel AI SDK.
3
3
  */
4
- import type { AiAdapter } from '../ports/ai';
5
4
  import type { ResolvedContractsrcConfig } from '@contractspec/lib.contracts-spec';
5
+ import type { AiAdapter } from '../ports/ai';
6
6
  /**
7
7
  * Create a Node.js AI adapter using Vercel AI SDK.
8
8
  */
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Factory for creating workspace adapters.
3
3
  */
4
- import type { WorkspaceAdapters } from '../ports/logger';
5
4
  import { type ResolvedContractsrcConfig } from '@contractspec/lib.contracts-spec/workspace-config';
5
+ import type { WorkspaceAdapters } from '../ports/logger';
6
6
  /**
7
7
  * Options for creating adapters.
8
8
  */
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Node.js adapter implementations.
3
3
  */
4
- export * from './fs.node';
5
- export * from './fs.bun';
4
+ export * from './ai';
5
+ export * from './factory';
6
6
  export * from './fs';
7
+ export * from './fs.bun';
8
+ export * from './fs.node';
7
9
  export * from './git';
8
- export * from './watcher';
9
- export * from './ai';
10
10
  export * from './logger';
11
- export * from './factory';
11
+ export * from './watcher';
12
12
  export * from './workspace';
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Agent system exports
3
3
  */
4
- export { AgentOrchestrator } from './orchestrator';
5
- export { SimpleAgent } from './simple-agent';
6
- export { CursorAgent } from './cursor-agent';
7
4
  export { ClaudeCodeAgent } from './claude-code-agent';
5
+ export { CursorAgent } from './cursor-agent';
8
6
  export { OpenAICodexAgent } from './openai-codex-agent';
9
- export type { AgentTask, AgentResult, AgentConfig } from './types';
7
+ export { AgentOrchestrator } from './orchestrator';
8
+ export { SimpleAgent } from './simple-agent';
9
+ export type { AgentConfig, AgentResult, AgentTask } from './types';
@@ -2,8 +2,8 @@
2
2
  * Agent Orchestrator - Coordinates between different AI agents
3
3
  * Selects the appropriate agent based on config and task requirements
4
4
  */
5
- import type { AgentResult, AgentTask } from './types';
6
5
  import type { AgentMode, ResolvedContractsrcConfig } from '@contractspec/lib.contracts-spec';
6
+ import type { AgentResult, AgentTask } from './types';
7
7
  export declare class AgentOrchestrator {
8
8
  private config;
9
9
  private readonly agents;
@@ -2,8 +2,8 @@
2
2
  * Simple LLM-based agent using direct API calls
3
3
  * This is the default fallback for basic code generation
4
4
  */
5
- import type { AgentProvider, AgentResult, AgentTask } from './types';
6
5
  import type { ResolvedContractsrcConfig } from '@contractspec/lib.contracts-spec';
6
+ import type { AgentProvider, AgentResult, AgentTask } from './types';
7
7
  export declare class SimpleAgent implements AgentProvider {
8
8
  private config;
9
9
  name: "simple";
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Adapter for UnifiedAgent to work with Workspace AgentOrchestrator.
3
3
  */
4
- import type { AgentProvider, AgentResult, AgentTask } from './types';
5
- import type { AgentMode } from '@contractspec/lib.contracts-spec';
6
4
  import { type UnifiedAgentConfig } from '@contractspec/lib.ai-agent/agent/unified-agent';
7
5
  import type { AgentSpec } from '@contractspec/lib.ai-agent/spec';
6
+ import type { AgentMode } from '@contractspec/lib.contracts-spec';
7
+ import type { AgentProvider, AgentResult, AgentTask } from './types';
8
8
  export declare class UnifiedAgentAdapter implements AgentProvider {
9
9
  readonly name: AgentMode;
10
10
  private agent;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * AI services for ContractSpec.
3
3
  */
4
- export * from './providers';
5
4
  export * from './agents';
6
5
  export * as prompts from './prompts';
6
+ export * from './providers';
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Re-exports from @contractspec/lib.ai-providers with workspace-specific additions.
5
5
  */
6
- import type { LanguageModel } from 'ai';
7
6
  import type { ResolvedContractsrcConfig } from '@contractspec/lib.contracts-spec';
7
+ import type { LanguageModel } from 'ai';
8
8
  /**
9
9
  * Initialize AI provider based on configuration
10
10
  *
@@ -3,8 +3,8 @@ export declare const initOperation: import("@contractspec/lib.contracts-spec").O
3
3
  yes: z.ZodDefault<z.ZodBoolean>;
4
4
  targets: z.ZodOptional<z.ZodArray<z.ZodEnum<{
5
5
  cursor: "cursor";
6
- mcp: "mcp";
7
6
  cli: "cli";
7
+ mcp: "mcp";
8
8
  vscode: "vscode";
9
9
  agents: "agents";
10
10
  github: "github";
@@ -21,8 +21,8 @@ export declare const initOperation: import("@contractspec/lib.contracts-spec").O
21
21
  filePath: z.ZodString;
22
22
  action: z.ZodEnum<{
23
23
  error: "error";
24
- skipped: "skipped";
25
24
  created: "created";
25
+ skipped: "skipped";
26
26
  merged: "merged";
27
27
  }>;
28
28
  message: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Output formatters for CI check results.
3
3
  */
4
- export * from './sarif';
5
4
  export * from './json';
5
+ export * from './sarif';
6
6
  export * from './text';
package/dist/index.d.ts CHANGED
@@ -4,12 +4,12 @@
4
4
  * Reusable use-cases and services for ContractSpec workspace operations.
5
5
  */
6
6
  export * as module from '@contractspec/module.workspace';
7
- export * from './ports/index';
8
7
  export * from './adapters/index';
9
- export * from './services/index';
10
- export type { FixStrategyType, FixableIssue } from './services/fix/types';
11
- export * from './registry';
8
+ export * from './ai';
12
9
  export * as formatters from './formatters/index';
10
+ export * from './ports/index';
11
+ export * from './registry';
12
+ export type { FixableIssue, FixStrategyType } from './services/fix/types';
13
+ export * from './services/index';
13
14
  export * as templates from './templates';
14
- export * from './ai';
15
15
  export * as utils from './utils/index';