nb1

command module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

nb1

nb1 mascot

简体中文

Control blink(1) from a CLI, local HTTP, MCP or an embedded Web workbench. High-level Actions compile into low-level Sequences and use the same per-device worker.

Install nb1 v0.1.2: download and verify the executable, start the local server, and open its embedded workbench. MCP and the Skill are optional matching downloads. Development candidates have a separate installation contract. The public Homebrew tap builds the currently published Formula with brew install b1ug/tap/nb1; check nb1 version for its actual version. Read the bilingual documentation for setup and examples.

nb1 implements API v1. Source validation and the version installed on a machine are tracked separately. Start an ordinary foreground daemon using the same executable as the CLI:

nb1 server --devices DEVICE_SERIAL

Open http://127.0.0.1:8931/demo/ to use the bilingual Nightlab workbench. It is embedded in nb1: no Node server, separate Web installation or browser WebHID permission is required. Play validates and sends the current draft directly; Preview is optional. Opening the page does not start playback. Use the actual listening port if you configured another one.

For CLI playback, put an expression in action.json:

{"action":{"kind":"pulse","color":"lime","cycles":2}}

Then use another terminal:

nb1 control devices
nb1 control run DEVICE_SERIAL action.json --wait

Use nb1 control preview action.json separately when you want to inspect the compiled plan without playback.

control defaults to http://127.0.0.1:8931; use --endpoint for another loopback port. The daemon owns USB while these clients communicate over HTTP. Standalone on, off, blink, fade, play, read and write access hardware directly and require the device to be available.

For a foreground Action, Sequence or saved Pattern run without a daemon:

nb1 control --direct run DEVICE_SERIAL action.json

Direct mode validates and resolves the local input before opening USB, always waits, and shares the device ownership lock with the daemon. It requires an explicitly selected device and never follows a failed HTTP submission automatically. Each invocation is new playback; --id is unavailable. An explicit --timeout bounds execution, followed by a separate cleanup wait. engine_closed confirms teardown only; check the Job status and command result for success. Direct lifecycle and limits

Starting server does not install a startup service. Run it in a terminal, manage it as an ordinary background process, or explicitly configure the platform's user-service mode. Inspect nb1 service --help for available operations. No keyboard or input-monitoring permission is needed to control the lamp.

On macOS/Linux, use nb1 service install --devices DEVICE_SERIAL --start for explicit login-service installation. It selects the running nb1 executable by default; use --binary /absolute/path/to/nb1 to choose another executable. See daemon platform validation for the scope of installation, upgrade and reboot evidence. Windows automatic service management remains unimplemented.

Use nb1 version --json for the executable's build identity, Go toolchain and pinned hardware dependencies without contacting a daemon or USB device. Plain source builds report their commit; unknown identity is reported as development.

CLI help and diagnostics use English across language environments. Terminal colors follow each output stream; a nonempty NO_COLOR disables them. Pipes and TERM=dumb use plain text unless CLICOLOR_FORCE explicitly requests color. Command results go to stdout; diagnostic logging, including --debug, goes to stderr so JSON results remain readable by other tools. JSON output remains unstyled. The Web workbench provides English and Chinese.

Configuration and storage

On macOS and Linux, configuration and the local color/Pattern library use $XDG_CONFIG_HOME/nb1, defaulting to ~/.config/nb1 when the variable is empty or unset. A nonempty XDG root must be absolute. Windows keeps the native %APPDATA%\nb1 location. Use nb1 config path and nb1 config show to inspect this process's selected file and resolved settings.

Device locks follow the established native OS coordination policy. On macOS they remain in ~/Library/Application Support/nb1/device-locks, so controllers coordinate through the same default lease. Changing --config alone moves neither this lock directory nor the default library. Existing files are not moved automatically. Managed macOS/Linux service startup also preserves the selected XDG root for its profile and default library. Configuration and device selection

Interfaces

Actions are set, off, fade, blink, breathe, pulse, alternate, orbit and rainbow. Colors accept names, Hex, RGB8, HSV/HSB and local @name references. Patterns are saved on the computer. Device-native sequence APIs remain separate planned work; the current HTTP v1 and MCP adapter do not deploy host Patterns to device storage. Device-native draft

MCP provides 12 tools for this contract. The bilingual Web workbench is embedded at /demo/; opening or previewing does not play a Job. Building the CLI or separate MCP module from source requires Go 1.25.8 or newer; release artifacts record the actual build toolchain and fixed dependencies. Prebuilt executables need no Go installation. The source floor reflects the selected dependencies; the device protocol and foundation libraries' own Go requirements are unchanged. The nb1 Embedded Workbench supplies a verified static bundle embedded at /demo/. The nb1 Documentation repository supplies the English/Chinese documentation website, which does not request device access. Separate nb1 Browser Tools use WebHID directly; their workbench is a development preview and the Chrome reminder extension remains experimental. They require explicit device ownership handoff and are not installed by nb1. Web components and build boundaries

Software, physical USB and optical checks are distinct. Local MK2 results do not establish MK3, Linux/Windows USB or nonvolatile storage. A development commit does not imply a tag or Release.

Continuous integration

The native CI matrix builds the CLI, runs software tests with the race detector, and runs go vet on Ubuntu 24.04 (amd64/arm64), macOS 15 (arm64/Intel), and Windows Server 2022 (amd64), using Go 1.26.x and 1.27.x. Separate Go 1.25.x CI checks source with CGO disabled on Ubuntu 22.04. Locked module versions are used with GOWORK=off and -mod=readonly.

The separate candidate workflow builds matching CLI and MCP binaries, verifies their source identity and archives, checks MCP discovery, and exercises a foreground daemon with an absent configured device. CI artifacts are development candidates, not tagged Releases or installed services. Software checks do not establish physical hardware, mk3, or optical qualification.

Documentation

Overview

Package main is the entry point of the application.

Directories

Path Synopsis
ci
systemd-user-fixture command
systemd-user-fixture is a stdlib-only, USB-free lifecycle test executable.
systemd-user-fixture is a stdlib-only, USB-free lifecycle test executable.
Package cmd contains all the commands and subcommands of the application.
Package cmd contains all the commands and subcommands of the application.
Package config provides the build information, configuration for the application.
Package config provides the build information, configuration for the application.
Package exchange contains functions for converting between different formats.
Package exchange contains functions for converting between different formats.
Package hdwr provides functions that needs access to the hardware.
Package hdwr provides functions that needs access to the hardware.
internal
actionv1
Package actionv1 compiles a v1 light action to a host sequence.
Package actionv1 compiles a v1 light action to a host sequence.
appconfig
Package appconfig reads the current CLI and daemon's per-user configuration.
Package appconfig reads the current CLI and daemon's per-user configuration.
colorinput
Package colorinput resolves a bounded, versioned color grammar to raw RGB.
Package colorinput resolves a bounded, versioned color grammar to raw RGB.
control
Package control owns device execution independently of HTTP, CLI and agents.
Package control owns device execution independently of HTTP, CLI and agents.
daemonclient
Package daemonclient communicates with the local HTTP service; it never opens USB.
Package daemonclient communicates with the local HTTP service; it never opens USB.
devicebackend
Package devicebackend adapts the verified blink SDK path to the executor.
Package devicebackend adapts the verified blink SDK path to the executor.
devicesequence
Package devicesequence models the draft device-native row language.
Package devicesequence models the draft device-native row language.
doctor
Package doctor reports build metadata and existing daemon snapshots.
Package doctor reports build metadata and existing daemon snapshots.
httpapi
Package httpapi exposes the local device service without opening USB handles.
Package httpapi exposes the local device service without opening USB handles.
jsoninput
Package jsoninput validates canonical, unambiguous JSON request objects.
Package jsoninput validates canonical, unambiguous JSON request objects.
libraryv1
Package libraryv1 persists the current local color and Sequence library.
Package libraryv1 persists the current local color and Sequence library.
lightaction
Package lightaction compiles a versioned authoring language into the existing finite Program contract.
Package lightaction compiles a versioned authoring language into the existing finite Program contract.
lightactionv2
Package lightactionv2 compiles experimental high-level actions into explicit frame programs.
Package lightactionv2 compiles experimental high-level actions into explicit frame programs.
nativeinspection
Package nativeinspection collects explicit native read observations without playback, storage, retries, device discovery or handle ownership of its own.
Package nativeinspection collects explicit native read observations without playback, storage, retries, device discovery or handle ownership of its own.
nativeinspection/testfixturegen command
Command testfixturegen emits synthetic protocol vectors.
Command testfixturegen emits synthetic protocol vectors.
ownership
Package ownership coordinates device ownership between cooperating local controllers.
Package ownership coordinates device ownership between cooperating local controllers.
patternidentity
Package patternidentity defines bounded Pattern identity and a fixed hash domain only.
Package patternidentity defines bounded Pattern identity and a fixed hash domain only.
patternresolver
Package patternresolver connects an explicitly selected verified Pattern v2 store to control's source-bound admission.
Package patternresolver connects an explicitly selected verified Pattern v2 store to control's source-bound admission.
patterns
Package patterns implements bounded, pure Pattern package and record codecs.
Package patterns implements bounded, pure Pattern package and record codecs.
patternstore
Package patternstore manages one bounded, create-only local Pattern library.
Package patternstore manages one bounded, create-only local Pattern library.
patternsv2
Package patternsv2 implements experimental, bounded Pattern records only.
Package patternsv2 implements experimental, bounded Pattern records only.
sequence
Package sequence defines the validated host playback model for nb1.
Package sequence defines the validated host playback model for nb1.
service
Package service renders reviewable per-user startup configurations and manages explicitly requested macOS user agents.
Package service renders reviewable per-user startup configurations and manages explicitly requested macOS user agents.
service/systemduser
Package systemduser manages one explicitly requested current-user unit.
Package systemduser manages one explicitly requested current-user unit.
service/taskquery
Package taskquery reads one fixed current-user Task Scheduler registration.
Package taskquery reads one fixed current-user Task Scheduler registration.
service/taskuser
Package taskuser verifies only the current Windows process's read-only identity.
Package taskuser verifies only the current Windows process's read-only identity.
textfmt
Package textfmt preserves nb1's established help and configuration formatting.
Package textfmt preserves nb1's established help and configuration formatting.
transporttrace
Package transporttrace is opt-in, bounded diagnostic storage.
Package transporttrace is opt-in, bounded diagnostic storage.
userconfig
Package userconfig resolves per-user application storage without touching the filesystem.
Package userconfig resolves per-user application storage without touching the filesystem.
webui
Package webui serves a verified static build of the independent nb1 Web UI.
Package webui serves a verified static build of the independent nb1 Web UI.
Package schema provides the data structures for internal use of nb1 app.
Package schema provides the data structures for internal use of nb1 app.
tools
api-v1-openapi-runtime command
Command api-v1-openapi-runtime checks documentation requests against the real v1 HTTP handler using a software-only device and a temporary local library.
Command api-v1-openapi-runtime checks documentation requests against the real v1 HTTP handler using a software-only device and a temporary local library.
Package util provides some utility functions specific to this application.
Package util provides some utility functions specific to this application.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL