open-index/open-npm huggingface dataset:
npm package: @rightbrain/cli
Description: Command line interface for RightBrain AI SDK generation
Latest version: 0.2.0
Deprecated: Deprecated: This CLI has been replaced by https://npmjs.com/rightbrain. Please migrate. @rightbrain/cli is no longer maintained and may break in future.

### Generate SDK

Generates TypeScript SDK code from your RightBrain tasks:

## Installation

```bash
npm install -g @rightbrain/cli
or
pnpm add -g @rightbrain/cli
or
yarn global add @rightbrain/cli
```

## Usage

Create a configuration file (`rightbrain.config.ts`):

```typescript
import { type Config } from "@rightbrain/cli"

const config: Config = {
  orgId: "your-org-id",
  projectId: "your-project-id",
  oauthUrl: "https://oauth.rightbrain.ai",
  apiUrl: "https://api.rightbrain.ai",
  clientId: "your-client-id",
  clientSecret: "your-client-secret",
  output: "./generated",
}
export default config
```

## Commands

### Generate SDK

Generates TypeScript SDK code from your RightBrain tasks:

```bash
rightbrain generate
```

Options:

- `-o, --output <path>` - Output directory for generated code
- `-t, --task-ids <ids>` - Comma-separated list of task IDs to generate (optional)

You can also specify task IDs in your config file:

```typescript
const config: Config = {
  // ... other config options
  taskIds: ["task-id-1", "task-id-2"], // Optional: Generate only these tasks
}
```

### Create Task

Creates a new task in your RightBrain project:

```bash
rightbrain create-task \
--name "My Task" \
--description "Task description" \
--system-prompt "System prompt" \
--user-prompt "User prompt" \
--model "gpt-4" \  # Can use model name or UUID
--output-format '{"response": "string"}' \
--image-required
```

Options:

- `-n, --name` - Task name
- `-d, --description` - Task description
- `-s, --system-prompt` - System prompt
- `-u, --user-prompt` - User prompt
- `-m, --model` - LLM model name or UUID (e.g., "gpt-4" or model UUID)
- `-f, --output-format` - Output format (JSON string)
- `-i, --image-required` - Whether image is required
- `--disabled` - Create task in disabled state

## Configuration Options

| Option       | Type     | Description                               |
| ------------ | -------- | ----------------------------------------- |
| orgId        | string   | Your organization ID                      |
| projectId    | string   | Your project ID                           |
| oauthUrl     | string   | OAuth2 server URL                         |
| apiUrl       | string   | RightBrain API URL                        |
| clientId     | string   | OAuth2 client ID                          |
| clientSecret | string   | OAuth2 client secret                      |
| output       | string   | Output directory for generated code       |
| taskIds      | string[] | Optional: Generate only these tasks       |
| envFilePath  | string   | Optional: path to environment `.env` file |

## License

MIT
npm package: @rightbrain/react-implicit
Description: React components and hooks for RightBrain AI
Latest version: 0.0.8
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# @rightbrain/react-implicit

React components and hooks for setting up implicit OAuth flow and interacting with the RightBrain AI.

## Installation

```bash
npm install @rightbrain/react-implicit @rightbrain/sdk
or with yarn
yarn add @rightbrain/react-implicit @rightbrain/sdk
or with pnpm
pnpm add @rightbrain/react-implicit @rightbrain/sdk
```

## Usage

This package provides a React context provider that handles the OAuth 2.0 implicit flow and makes the access token available to your application.

```tsx
import { RightBrainProvider, useTask } from "@rightbrain/react-implicit"

function App() {
  return (
    <RightBrainProvider
      rightbrainUrl="https://api.rightbrain.ai"
      organizationId="your-org-id"
      projectId="your-project-id"
      clientId="your-client-id"
      authEndpoint="https://auth.rightbrain.ai/oauth2/auth"
    >
      <YourComponents />
    </RightBrainProvider>
  )
}
```

### OAuth Flow

The provider automatically handles the OAuth 2.0 implicit flow:

1. If no access token is present, it redirects to the auth endpoint
2. After successful authentication, captures the token from the URL hash
3. Stores the token and makes it available through the context
4. Cleans up the URL by removing the hash parameters

## Components

### RightBrainProvider

Provider component that must wrap your application to use RightBrain hooks.

#### Props

| Prop             | Type     | Description                     |
| ---------------- | -------- | ------------------------------- |
| `rightbrainUrl`  | `string` | Base URL for the RightBrain API |
| `organizationId` | `string` | Your organization ID            |
| `projectId`      | `string` | Your project ID                 |
| `clientId`       | `string` | OAuth client ID                 |
| `authEndpoint`   | `string` | OAuth authorization endpoint    |

## Hooks

### useTask

Hook for executing RightBrain tasks with the authenticated token.

```tsx
function MyComponent() {
  const { data, isLoading } = useTask("task-id", {
    // task parameters
  })
  if (isLoading) return <div>Loading...</div>
  return <div>{/ render your data /}</div>
}
```

## Security Considerations

This package implements the OAuth 2.0 implicit flow, which is designed for public clients (like browser-based applications). The access token is stored in memory and is not persisted between page reloads.