@polyweave/sdlc-domain (1.0.2)
Installation
@polyweave:registry=https://hub.kl1.tenere.ai/api/packages/Polyweave/npm/npm install @polyweave/sdlc-domain@1.0.2"@polyweave/sdlc-domain": "1.0.2"About this package
sdlc-domain
Software Development Lifecycle domain for htna-stream HGN/HTN/BT tripartite planning. Defines the full workflow from snow card requirements through TLA+ specification to red-green-refactor implementation, with staleness propagation and exception-driven replanning.
Published as @polyweave/sdlc-domain.
Synopsis
import {
SDLC_DOMAIN,
SDLC_TYPE_SYSTEM,
SDLC_GOALS,
SDLC_METHODS,
SDLC_PRIMITIVES,
createSdlcHarness,
createPlannerBridge
} from '@polyweave/sdlc-domain';
const harness = createSdlcHarness({
apiKey: process.env.API_KEY,
model: 'deepseek-v4-flash'
});
harness.plan('Build user authentication service', (err, plan) => {
console.log('Generated plan:', plan);
});
Install
npm install @polyweave/sdlc-domain
Description
The sdlc-domain package defines a comprehensive Software Development Lifecycle domain model for the htna-stream HGN/HTN/BT tripartite planning system. It models the entire SDLC workflow: requirements gathering (snow card format), architecture design, TLA+ formal specification, interface design, red-green-refactor iterative implementation with testing, code review, and CI/CD deployment.
The domain includes a full type system (SDLC_TYPE_SYSTEM) defining SDLC-specific types (SnowCard, TlaSpec, InterfaceDef, CodeModule, TestSuite, etc.), a goal hierarchy (SDLC_GOALS) capturing SDLC objectives at multiple granularities, method specifications (SDLC_METHODS) for achieving those goals, and primitive operations (SDLC_PRIMITIVES) that correspond to actual LLM tool calls.
The package provides a harness (createSdlcHarness) that wraps the domain into a bt-harness-compatible tool, and a planner bridge (createPlannerBridge) that connects SDLC domain planning to the htna-stream execution framework. BT enrichment utilities (enrichBtTree, createBtEnricher) augment BT trees with SDLC-specific artifacts.
API
Constants
SDLC_DOMAIN— The full SDLC domain definition object.SDLC_TYPE_SYSTEM— Type system with SDLC entity types, field definitions, and relations.SDLC_GOALS— Hierarchical goal definitions:CompleteProject→ImplementFeature→ImplementStory→{ RequirementsStory, DesignStory, CodeStory, TestStory }.SDLC_METHODS— Method specifications mapping goals to decompositions (sequences, conditionals, tasks).SDLC_PRIMITIVES— Primitive operation definitions:GenerateSnowCard,DraftTlaSpec,WriteInterfaceDef,RedPhaseCode,GreenPhaseCode,RefactorCode,WriteTest,CodeReview,RunCI, etc.SDLC_INVARIANTS— Invariant constraints that must hold across the SDLC workflow (e.g., tests pass before review, TLA+ model checking succeeds before implementation).SDLC_ABORT_SCENARIOS— Exception scenarios that trigger replanning (stale requirements, CI failure, spec contradiction).
createSdlcHarness(options)
Creates a bt-harness-based SDLC execution tool.
Parameters:
options.apiKey— API key for LLM calls.options.model— Model name.options.createAdapter— Custom adapter factory.
Returns: { source, sink, plan(task, callback) }
createPlannerBridge(options)
Creates a bridge between the SDLC domain and htna-stream planning.
Parameters:
options.domain— SDLC domain object (defaults toSDLC_DOMAIN).options.planner— htna-stream planner instance.
Returns: { plan(task, callback), decompose(goal, callback) }
createDefaultBtHarnessFactory(options)
Default factory for creating bt-harness instances from SDLC method specs.
enrichBtTree(tree, domainContext)
Enriches a raw BT tree with SDLC-specific artifact references and staleness markers.
createBtEnricher(options)
Creates a reusable BT enricher with configurable domain context.
Examples
// Full SDLC workflow planning
const harness = createSdlcHarness({ apiKey: process.env.API_KEY });
harness.plan({
project: 'API Gateway',
stories: [
{ title: 'Rate Limiting', priority: 'P1' },
{ title: 'Request Logging', priority: 'P2' }
]
}, (err, plan) => {
plan.stories.forEach(story => {
console.log(story.title, '→', story.methods.join(', '));
story.artifacts.forEach(a => console.log(' ', a.type, ':', a.id));
});
});
// BT enrichment with SDLC domain context
import { enrichBtTree } from '@polyweave/sdlc-domain';
const enrichedTree = enrichBtTree(myBtSpec, {
currentStory: 'Rate Limiting',
artifacts: { snowCard: 'sc-001', tlaSpec: 'tla-001' }
});
Tests
npm test
Tests cover domain definition integrity, type system validation, goal hierarchy decomposition, method-to-BT-spec translation, harness creation and plan generation, planner bridge integration, and staleness propagation scenarios.
Requirements
Node.js 18 or later. ESM only.
Caveats
- The SDLC domain is a planning/execution model, not a CI/CD system. It generates artifacts and tracks dependencies; actual code execution is delegated to tools.
- Method specifications define decompositions but do not guarantee optimal plans — the HTN planner selects the first applicable method.
- Staleness propagation handles dependency chains but requires accurate artifact versioning from the underlying state store.
License
MIT
Dependencies
Development Dependencies
| ID | Version |
|---|---|
| @rigor/core | * |
Peer Dependencies
| ID | Version |
|---|---|
| @polyweave/bt-harness | * |
| @polyweave/core | * |
| @polyweave/jj-provider | * |
| @polyweave/state | * |
| @polyweave/tla-runner | * |