npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

graphwork-core

v2.0.1

Published

Core engine of GraphWork Framework 2.0

Downloads

211

Readme

Core

Core engine of GraphWork Framework 2.0

Overview

The Core module is the central engine of the GraphWork Framework. It provides the foundational infrastructure that coordinates all other modules, manages the knowledge base, integrates with AI services, and handles template processing.

Installation

npm install graphwork-core

Features

  • Central Coordination: Orchestrates interactions between all framework modules
  • Knowledge Management: Manages project context and knowledge base
  • AI Integration: Provides interfaces for AI model integration
  • Template Processing: Handles template-based code generation
  • Plugin Architecture: Supports extensible plugin system
  • Event System: Publish-subscribe pattern for inter-module communication

Usage

Basic Setup

import { GraphWorkCore } from 'graphwork-core';
import { KnowledgeBase } from 'graphwork-knowledge-base';
import { AIIntegration } from 'graphwork-ai-integration';
import { TemplateEngine } from 'graphwork-templates';

// Initialize components
const knowledgeBase = new KnowledgeBase();
const aiIntegration = new AIIntegration({
  provider: 'openai', // or 'anthropic', 'gemini'
  model: 'gpt-4',
  apiKey: process.env.OPENAI_API_KEY
});
const templateEngine = new TemplateEngine();

// Create core instance
const core = new GraphWorkCore({
  knowledgeBase,
  aiIntegration,
  templateEngine
});

// Initialize the core
await core.initialize();

Working with Context

import { ContextManager } from 'graphwork-core';

const contextManager = new ContextManager(core);

// Load project context
await contextManager.loadProjectContext('./work');

// Get context for a specific area
const architectureContext = contextManager.getContext('architecture');

// Update context
contextManager.updateContext('requirements', {
  functional: 'User authentication system',
  nonFunctional: 'High performance, secure'
});

Event Handling

import { EventEmitter } from 'graphwork-core';

// Subscribe to events
core.events.on('codeGenerated', (data) => {
  console.log('Code generated:', data);
});

// Emit events
core.events.emit('validationStarted', {
  component: 'user-service',
  timestamp: Date.now()
});

API

GraphWorkCore

Constructor

new GraphWorkCore(config: CoreConfig)

Methods

  • initialize(): Promise<void> - Initialize the core engine
  • getContextManager(): ContextManager - Get the context manager
  • getAIIntegration(): AIIntegration - Get the AI integration service
  • getTemplateEngine(): TemplateEngine - Get the template engine
  • getEventManager(): EventEmitter - Get the event manager

ContextManager

Methods

  • loadProjectContext(path: string): Promise<void> - Load project context from directory
  • getContext(area: string): any - Get context for a specific area
  • updateContext(area: string, data: any): void - Update context for an area
  • getAllContext(): Record<string, any> - Get all context data

EventEmitter

Methods

  • on(event: string, listener: Function): void - Subscribe to an event
  • emit(event: string, data: any): void - Emit an event
  • off(event: string, listener: Function): void - Unsubscribe from an event

Configuration

CoreConfig

interface CoreConfig {
  knowledgeBase: KnowledgeBase;
  aiIntegration: AIIntegration;
  templateEngine: TemplateEngine;
  plugins?: Plugin[];
}

Architecture

The Core module follows a modular architecture with the following components:

  1. Context Manager: Handles project context and knowledge base
  2. AI Coordinator: Manages AI model interactions
  3. Template Processor: Processes templates for code generation
  4. Plugin Manager: Manages framework plugins
  5. Event System: Facilitates communication between modules

Extending Core

Creating Plugins

import { Plugin } from 'graphwork-core';

export class CustomPlugin implements Plugin {
  name = 'CustomPlugin';
  version = '1.0.0';
  
  async initialize(core: GraphWorkCore): Promise<void> {
    // Plugin initialization logic
  }
  
  async destroy(): Promise<void> {
    // Cleanup logic
  }
}

Registering Plugins

import { CustomPlugin } from './CustomPlugin';

const core = new GraphWorkCore({
  knowledgeBase,
  aiIntegration,
  templateEngine,
  plugins: [new CustomPlugin()]
});

Contributing

See our Contributing Guide for information on how to contribute to this package.

License

This package is licensed under the MIT License. See the LICENSE file for details.