# BBS SDK

This package provides the types and interfaces needed to build apps for the TT-BBS system. It's placed at the root level of the repository to allow it to be used by multiple projects.

## Installation

For local development within this repository:

```bash
# From a project in this repository:
npm install file:../bbs-sdk

# From an external project:
npm install file:/path/to/tt/bbs-sdk
```

For published versions:

```bash
npm install bbs-sdk
```

## Usage

To create a BBS app, import the interfaces from this package and implement them:

```typescript
import { BbsApp, CommandResult, BbsSession } from 'bbs-sdk';

const MyApp: BbsApp = {
  id: 'my_app',
  name: 'My App',
  version: '1.0.0',
  description: 'A simple BBS app',
  author: 'Your Name',
  
  getWelcomeScreen(): string {
    return `
Welcome to My App!

Type HELP for commands.
`;
  },
  
  handleCommand(screenId: string | null, command: string, session: BbsSession): CommandResult {
    // Handle commands and return a response
    return {
      screen: screenId, // Keep on the same screen
      response: `You typed: ${command}`,
      refresh: false
    };
  },
  
  getHelp(screenId: string | null): string {
    return `
Available commands:
HELP - Show this help text
BACK - Return to main menu
`;
  }
};

// Export your app
export default MyApp;
```

## Types

The package includes the following main interfaces:

- `BbsApp`: The main interface for BBS apps
- `CommandResult`: Returned by the `handleCommand` method
- `BbsSession`: Represents a user's session
- `BbsUser`: Represents a BBS user
- `BbsStorage`: Interface for data persistence
- `BbsUtils`: Utility functions for BBS apps

## Documentation

For detailed API documentation, see the JSDoc comments in the source code.

## Publishing

When ready to publish this SDK to npm, run:

```bash
cd /path/to/tt/bbs-sdk
npm publish
```

## License

MIT 