1.0.4 • Published 4 months ago

bbs-sdk v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

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:

# 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:

npm install bbs-sdk

Usage

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

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:

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

License

MIT

1.0.4

4 months ago

1.0.3

4 months ago

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago