Skip to content

jmerelnyc/specflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

specflow

license status npm node build coverage

spec-driven workflow framework for AI-assisted development

table of contents

install

npm install specflow

usage

const { Workflow, SpecRunner } = require('specflow');

// define a spec-driven workflow
const workflow = new Workflow({
  name: 'feature-implementation',
  spec: './specs/user-auth.md'
});

// register handlers for different spec sections
workflow.on('requirement', async (req) => {
  console.log(`processing: ${req.title}`);
  return await generateImplementation(req);
});

workflow.on('test', async (test) => {
  return await runTestCase(test);
});

// execute the workflow
const result = await workflow.run();
console.log(`completed ${result.steps} steps in ${result.duration}ms`);

api

Workflow(options)

creates a new workflow instance.

options:

  • name (string): workflow identifier
  • spec (string): path to specification file
  • parallel (boolean): run steps concurrently, default false
  • timeout (number): step timeout in ms, default 30000

methods:

  • on(event, handler): register event handler
  • run(): execute workflow
  • pause(): pause execution
  • resume(): resume paused workflow

SpecRunner

parses and executes specification files.

const runner = new SpecRunner('./spec.md');
const parsed = runner.parse();
// { requirements: [...], tests: [...], metadata: {...} }

events

  • requirement: fired for each requirement in spec
  • test: fired for each test case
  • validation: fired for validation steps
  • complete: fired when workflow finishes
  • error: fired on failures

parseSpec(filepath)

standalone parser for spec files. returns structured data.

const { parseSpec } = require('specflow');
const spec = parseSpec('./docs/feature.md');

contributing

prs welcome. open an issue first for big changes.

run tests with npm test. make sure coverage doesn't drop.

license

MIT

About

spec-driven workflow framework for AI-assisted development

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors