Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# AGENTS.md

This file provides guidance to WARP (warp.dev) when working with code in this repository.

## Project Overview

OpenHue is an OpenAPI 3.0.3 specification for the Philips Hue CLIP (Connected Lighting Interface Protocol) API v2. This repository does not contain application code—it consists entirely of YAML files defining the API specification.

## Build & Development Commands

```bash
make setup # Install Redocly CLI globally via npm
make verify # Lint and validate the OpenAPI specification
make build # Bundle specification into build/openhue.yaml
make docs # Generate static HTML documentation in build/
make clean # Remove the build/ directory
make help # List all available make targets
```

Alternatively, use Redocly CLI directly:
```bash
redocly lint # Validate specification
redocly bundle src/main.yaml -o out.yaml # Bundle to single file
redocly build-docs -o out.html # Generate docs
```

## Architecture

### Entry Point
- `src/main.yaml` - Root OpenAPI specification defining paths, tags, servers, and security schemes

### Directory Structure
Each Hue API resource has its own directory under `src/`:
```
src/{resource}/
├── {resource}.yaml # Collection endpoint (GET all, POST)
├── {resource}_{id}.yaml # Item endpoint (GET/PUT/DELETE by ID)
└── schemas/ # Resource-specific schemas
```

Resources: `auth`, `bridge`, `bridge_home`, `device`, `device_power`, `grouped_light`, `light`, `light_level`, `motion`, `resource`, `room`, `scene`, `smart_scene`, `temperature`, `zone`

### Shared Components
- `src/common/` - Reusable schemas (ApiResponse, error responses, Brightness, Color, Dimming, etc.)

### Testing
- `http/` - IntelliJ HTTP Client files for manual endpoint testing
- Requires `http/http-client.private.env.json` with your bridge's apiKey and baseUrl

## Specification Conventions

- OpenAPI version: 3.0.3
- Authentication: `hue-application-key` header (API key)
- All paths reference external YAML files via `$ref`
- Error responses defined in `src/common/error.yaml` and reused across endpoints

## Code Style

- 2-space indentation (YAML)
- LF line endings
- Trailing newline required
- Trim trailing whitespace
42 changes: 42 additions & 0 deletions src/behavior_instance/behavior_instance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
get:
operationId: getBehaviorInstances
summary: List behavior instance.
description: List all available behavior instance resources.
tags:
- BehaviorInstance
security:
- HueApplicationKey: [ ]
responses:
200:
description: BehaviorInstance Success Response
content:
application/json:
schema:
allOf:
- $ref: '../common/ApiResponse.yaml'
- type: object
properties:
data:
type: array
items:
$ref: './schemas/BehaviorInstanceGet.yaml'
401:
$ref: '../common/error.yaml#/components/responses/Unauthorized'
403:
$ref: '../common/error.yaml#/components/responses/Forbidden'
404:
$ref: '../common/error.yaml#/components/responses/NotFound'
405:
$ref: '../common/error.yaml#/components/responses/MethodNotAllowed'
406:
$ref: '../common/error.yaml#/components/responses/NotAcceptable'
409:
$ref: '../common/error.yaml#/components/responses/Conflict'
429:
$ref: '../common/error.yaml#/components/responses/TooManyRequests'
500:
$ref: '../common/error.yaml#/components/responses/InternalServerError'
503:
$ref: '../common/error.yaml#/components/responses/ServiceUnavailable'
507:
$ref: '../common/error.yaml#/components/responses/InsufficientStorage'
103 changes: 103 additions & 0 deletions src/behavior_instance/behavior_instance_{behaviorInstanceId}.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
get:
operationId: getBehaviorInstance
summary: Get behavior instance.
description: Get details of a single behavior instance resource from its given `{behaviorInstanceId}`.
tags:
- BehaviorInstance
security:
- HueApplicationKey: [ ]
parameters:
- name: behaviorInstanceId
in: path
schema:
type: string
required: true
description: ID of the behavior instance
responses:
200:
description: BehaviorInstance Success Response
content:
application/json:
schema:
allOf:
- $ref: '../common/ApiResponse.yaml'
- type: object
properties:
data:
type: array
items:
$ref: './schemas/BehaviorInstanceGet.yaml'
401:
$ref: '../common/error.yaml#/components/responses/Unauthorized'
403:
$ref: '../common/error.yaml#/components/responses/Forbidden'
404:
$ref: '../common/error.yaml#/components/responses/NotFound'
405:
$ref: '../common/error.yaml#/components/responses/MethodNotAllowed'
406:
$ref: '../common/error.yaml#/components/responses/NotAcceptable'
409:
$ref: '../common/error.yaml#/components/responses/Conflict'
429:
$ref: '../common/error.yaml#/components/responses/TooManyRequests'
500:
$ref: '../common/error.yaml#/components/responses/InternalServerError'
503:
$ref: '../common/error.yaml#/components/responses/ServiceUnavailable'
507:
$ref: '../common/error.yaml#/components/responses/InsufficientStorage'
put:
operationId: updateBehaviorInstance
summary: Update behavior instance.
description: Update a single behavior instance resource from its given `{behaviorInstanceId}`.
tags:
- BehaviorInstance
security:
- HueApplicationKey: [ ]
parameters:
- name: behaviorInstanceId
in: path
schema:
type: string
required: true
description: ID of the behavior instance
requestBody:
content:
application/json:
schema:
$ref: './schemas/BehaviorInstancePut.yaml'
responses:
200:
description: Success
content:
application/json:
schema:
allOf:
- $ref: '../common/ApiResponse.yaml'
- type: object
properties:
data:
type: array
items:
$ref: '../common/ResourceIdentifier.yaml'
401:
$ref: '../common/error.yaml#/components/responses/Unauthorized'
403:
$ref: '../common/error.yaml#/components/responses/Forbidden'
404:
$ref: '../common/error.yaml#/components/responses/NotFound'
405:
$ref: '../common/error.yaml#/components/responses/MethodNotAllowed'
406:
$ref: '../common/error.yaml#/components/responses/NotAcceptable'
409:
$ref: '../common/error.yaml#/components/responses/Conflict'
429:
$ref: '../common/error.yaml#/components/responses/TooManyRequests'
500:
$ref: '../common/error.yaml#/components/responses/InternalServerError'
503:
$ref: '../common/error.yaml#/components/responses/ServiceUnavailable'
507:
$ref: '../common/error.yaml#/components/responses/InsufficientStorage'
36 changes: 36 additions & 0 deletions src/behavior_instance/schemas/BehaviorInstanceGet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
type: object
allOf:
- $ref: '../../common/Resource.yaml'
- type: object
properties:
script_id:
type: string
description: ID of the behavior script this instance is running.
enabled:
type: boolean
description: True if the behavior instance is enabled.
state:
type: object
description: Current state of the behavior instance.
configuration:
type: object
description: Configuration for this behavior instance.
dependees:
type: array
items:
$ref: '../../common/ResourceIdentifier.yaml'
status:
type: string
enum:
- initializing
- running
- disabled
- errored
last_error:
type: string
description: Last error message if status is errored.
metadata:
type: object
properties:
name:
type: string
16 changes: 16 additions & 0 deletions src/behavior_instance/schemas/BehaviorInstancePut.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
type: object
properties:
type:
type: string
description: Type of the supported resources (always `behavior_instance` here)
enabled:
type: boolean
description: True to enable the behavior instance.
configuration:
type: object
description: Configuration for this behavior instance.
metadata:
type: object
properties:
name:
type: string
42 changes: 42 additions & 0 deletions src/behavior_script/behavior_script.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
get:
operationId: getBehaviorScripts
summary: List behavior script.
description: List all available behavior script resources.
tags:
- BehaviorScript
security:
- HueApplicationKey: [ ]
responses:
200:
description: BehaviorScript Success Response
content:
application/json:
schema:
allOf:
- $ref: '../common/ApiResponse.yaml'
- type: object
properties:
data:
type: array
items:
$ref: './schemas/BehaviorScriptGet.yaml'
401:
$ref: '../common/error.yaml#/components/responses/Unauthorized'
403:
$ref: '../common/error.yaml#/components/responses/Forbidden'
404:
$ref: '../common/error.yaml#/components/responses/NotFound'
405:
$ref: '../common/error.yaml#/components/responses/MethodNotAllowed'
406:
$ref: '../common/error.yaml#/components/responses/NotAcceptable'
409:
$ref: '../common/error.yaml#/components/responses/Conflict'
429:
$ref: '../common/error.yaml#/components/responses/TooManyRequests'
500:
$ref: '../common/error.yaml#/components/responses/InternalServerError'
503:
$ref: '../common/error.yaml#/components/responses/ServiceUnavailable'
507:
$ref: '../common/error.yaml#/components/responses/InsufficientStorage'
Loading