Polyweave

@polyweave/sdlc-domain (1.0.3)

Published 2026-07-11 00:46:20 +00:00 by Dvorak

Installation

@polyweave:registry=https://hub.kl1.tenere.ai/api/packages/Polyweave/npm/
npm install @polyweave/sdlc-domain@1.0.3
"@polyweave/sdlc-domain": "1.0.3"

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: CompleteProjectImplementFeatureImplementStory{ 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 to SDLC_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 *

Keywords

polyweave sdlc htna-stream hgn bt-harness software-development tla-plus
Details
npm
2026-07-11 00:46:20 +00:00
4
John Dvorak
SEE LICENSE IN LICENSE
14 KiB
Assets (1)
Versions (3) View all
1.0.6 2026-07-11
1.0.3 2026-07-11
1.0.2 2026-07-10