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
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.3
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: 24.18.0
- run: npm install --global @nubjs/nub@0.7.5
- uses: jdx/mise-action@v4.2.3
- run: mise run openspec-check
- run: mise run docs-check
- run: mise run npm-check

coverage:
name: Coverage (Windows MSVC)
Expand Down
157 changes: 157 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: npm distribution

on:
release:
types: [published]
workflow_dispatch:
inputs:
release_tag:
description: Existing GitHub Release tag to verify
required: true
type: string
stage:
description: Stage the verified packages for maintainer approval
required: true
default: false
type: boolean

permissions:
contents: read

concurrency:
group: npm-${{ github.event.release.tag_name || inputs.release_tag }}
cancel-in-progress: false

jobs:
prepare:
name: Prepare verified npm tarballs
runs-on: ubuntu-22.04
timeout-minutes: 20
outputs:
version: ${{ steps.release.outputs.version }}
env:
RELEASE_TAG: ${{ github.event.release.tag_name || inputs.release_tag }}
GH_TOKEN: ${{ github.token }}
steps:
- name: Check out repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.0.3
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: 24.18.0
- name: Install Nub CLI
run: npm install --global @nubjs/nub@0.7.5
- name: Pin npm CLI
run: npm install --global npm@12.0.2 --ignore-scripts
- name: Verify toolchain
run: |
test "$(node --version)" = "v24.18.0"
nub --version | grep -Fx "v0.7.5"
test "$(npm --version)" = "12.0.2"
- name: Validate release tag
id: release
shell: bash
run: |
if [[ ! "$RELEASE_TAG" =~ ^v([0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?)$ ]]; then
echo "Invalid Cadder release tag: $RELEASE_TAG" >&2
exit 1
fi
echo "version=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
- name: Install package workspace
working-directory: npm
run: nub ci
- name: Check package sources and workflow
working-directory: npm
run: nub run check
- name: Download exact GitHub Release assets
run: gh release download "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --dir "$RUNNER_TEMP/cadder-assets"
- name: Assemble packages from attested release archives
run: >-
node npm/scripts/assemble-release.js
--assets "$RUNNER_TEMP/cadder-assets"
--output "$RUNNER_TEMP/cadder-npm-stage"
--version "${{ steps.release.outputs.version }}"
- name: Pack deterministic npm tarballs
run: >-
node npm/scripts/pack-release.js
--stage "$RUNNER_TEMP/cadder-npm-stage"
--output "$RUNNER_TEMP/cadder-npm-tarballs"
- name: Upload verified npm tarballs
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cadder-npm-${{ steps.release.outputs.version }}
path: ${{ runner.temp }}/cadder-npm-tarballs
if-no-files-found: error
retention-days: 14

verify-native:
name: Verify npm consumer (${{ matrix.target }})
needs: prepare
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- target: win32-x64
runner: windows-2022
- target: linux-x64-gnu
runner: ubuntu-22.04
- target: darwin-x64
runner: macos-15-intel
- target: darwin-arm64
runner: macos-15
runs-on: ${{ matrix.runner }}
steps:
- name: Check out repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.0.3
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: 24.18.0
- name: Pin npm CLI
run: npm install --global npm@12.0.2 --ignore-scripts
- name: Download npm tarballs
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v7.0.0
with:
name: cadder-npm-${{ needs.prepare.outputs.version }}
path: ${{ runner.temp }}/cadder-npm-tarballs
- name: Verify isolated native installation
run: node npm/scripts/verify-consumer.js --tarballs "${{ runner.temp }}/cadder-npm-tarballs"

stage:
name: Stage npm packages for 2FA approval
needs: [prepare, verify-native]
if: github.event_name == 'release' || inputs.stage == true
runs-on: ubuntu-22.04
timeout-minutes: 15
environment: npm-production
permissions:
contents: read
id-token: write
steps:
- name: Check out repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.0.3
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: 24.18.0
- name: Pin npm CLI
run: npm install --global npm@12.0.2 --ignore-scripts
- name: Download verified npm tarballs
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v7.0.0
with:
name: cadder-npm-${{ needs.prepare.outputs.version }}
path: ${{ runner.temp }}/cadder-npm-tarballs
- name: Stage platform packages and root package
run: node npm/scripts/stage-release.js --tarballs "${{ runner.temp }}/cadder-npm-tarballs"
- name: Show approval command
run: |
echo 'Review the five entries in npm Staged Packages.' >> "$GITHUB_STEP_SUMMARY"
echo 'Approve the four @maxiedev platform packages before approving cadder.' >> "$GITHUB_STEP_SUMMARY"
echo 'CLI alternative: npm stage approve <stage-id>' >> "$GITHUB_STEP_SUMMARY"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ target/
artifacts/
dist/
publish/
node_modules/
*.log
*.tmp

Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- Arcantry release baseline: 0.8.0 (2026-06-11). Earlier history is not reconstructed. -->

## [1.0.0] - 2026-09-14
## [1.0.0] - 2026-09-15

### Added

<!-- openspec: add-npm-distribution -->
#### Install Cadder through npm

Run `npx cadder` for one-off operator access or install `cadder` globally to place the version-matched `cadder`, `cadderd`, and Cadder `caddy` shim commands on PATH. npm packages use the same verified native binaries as the portable GitHub archives; the upstream Caddy server remains a separate installation.

<!-- openspec: add-operator-inspection-cli -->
#### Inspect and control the local Cadder runtime

Use focused terminal commands to inspect projects, domains, Caddyfiles, upstream ports, daemon state, diagnostics, and bounded redacted logs. Cadder can also stop a known local port owner after the process identity is explicitly supplied and revalidated. The TUI remains the overview for interactive work.

<!-- openspec: add-tui-start-daemon -->
#### Start Cadder when opening the TUI

Run `cadder tui --start-daemon` to start or attach to the Cadder daemon in the background and open the interactive operator without an additional key press. Plain `cadder tui` keeps its existing read-first behavior.

<!-- openspec: align-v1-to-core-tui -->
#### Run project Caddyfiles together

Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions arcantry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,23 @@ repository_url = "https://github.com/MrMaxie/cadder"
[[release.version_sources]]
path = "Cargo.toml"
adapter = "cargo-workspace@1"

[[release.version_sources]]
path = "npm/package.json"
adapter = "json-package@1"

[[release.version_sources]]
path = "npm/packages/win32-x64/package.json"
adapter = "json-package@1"

[[release.version_sources]]
path = "npm/packages/linux-x64-gnu/package.json"
adapter = "json-package@1"

[[release.version_sources]]
path = "npm/packages/darwin-x64/package.json"
adapter = "json-package@1"

[[release.version_sources]]
path = "npm/packages/darwin-arm64/package.json"
adapter = "json-package@1"
2 changes: 1 addition & 1 deletion crates/cadder-api/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ pub fn error_indicates_permission(error: &Error) -> bool {
}

pub fn start_guidance(_paths: &Path) -> String {
"Run `cadder tui` and press Enter to start cadderd, then retry.".to_string()
"Run `cadder tui --start-daemon` to start cadderd and open the operator, then retry.".to_string()
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion crates/cadder-api/src/error/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async fn typed_error_daemon_unavailable_maps_to_stable_exit_code() {
assert_eq!(mapped.kind, AppExit::DaemonUnavailable);
assert_eq!(
mapped.guidance.as_deref(),
Some("Run `cadder tui` and press Enter to start cadderd, then retry.")
Some("Run `cadder tui --start-daemon` to start cadderd and open the operator, then retry.")
);
}

Expand Down
3 changes: 2 additions & 1 deletion crates/cadder-api/src/service/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ async fn connected_and_unavailable_statuses_include_operator_context() {
assert_eq!(status.connection_state, ConnectionStateView::NotRunning);
assert!(status.message.contains("is not running"));
assert!(status.guidance.as_deref().is_some_and(|guidance| {
guidance == "Run `cadder tui` and press Enter to start cadderd, then retry."
guidance
== "Run `cadder tui --start-daemon` to start cadderd and open the operator, then retry."
}));

let failed = IpcClientError::Daemon(ProtocolError::new(
Expand Down
22 changes: 6 additions & 16 deletions crates/cadder-client/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub struct App {
confirmation: Option<LifecycleAction>,
notice: Option<String>,
pending_message: Option<&'static str>,
pending_frame: usize,
last_start_failed: bool,
should_quit: bool,
}
Expand Down Expand Up @@ -79,6 +80,7 @@ impl App {
confirmation: None,
notice: None,
pending_message: None,
pending_frame: 0,
last_start_failed: false,
should_quit: false,
};
Expand All @@ -88,29 +90,17 @@ impl App {
}

impl RuntimeStatus {
pub const fn daemon_label(self) -> &'static str {
if self.daemon_is_running() {
"running"
} else {
"not running"
}
}

pub const fn caddy_label(self) -> &'static str {
if self.caddy_is_running() {
"running"
} else {
"not running"
}
}

pub const fn daemon_is_running(self) -> bool {
matches!(self.connection, ConnectionStatus::Connected)
}

pub const fn caddy_is_running(self) -> bool {
self.daemon_is_running() && matches!(self.caddy_status, ProtocolRuntimeStatus::Running)
}

pub const fn daemon_is_offline(self) -> bool {
matches!(self.connection, ConnectionStatus::Offline)
}
}

impl ConnectionStatus {
Expand Down
28 changes: 26 additions & 2 deletions crates/cadder-client/src/app/lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ use crate::data::MutationTarget;

use super::*;

const PENDING_FRAMES: [&str; 10] = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];

impl App {
pub fn apply_refresh(&mut self, outcome: RefreshOutcome) {
match outcome {
RefreshOutcome::Connected { snapshot } => {
if self.last_start_failed {
self.notice = None;
}
self.last_start_failed = false;
self.runtime_status = RuntimeStatus {
connection: ConnectionStatus::Connected,
Expand Down Expand Up @@ -45,7 +50,7 @@ impl App {
return false;
}
self.last_start_failed = false;
self.begin_action("Starting Cadder...");
self.begin_action("Starting cadderd...");
true
}

Expand Down Expand Up @@ -82,13 +87,28 @@ impl App {
self.pending_message.is_some()
}

pub fn pending_marker(&self) -> Option<&'static str> {
self
.pending_message
.map(|_| PENDING_FRAMES[self.pending_frame % PENDING_FRAMES.len()])
}

pub fn advance_pending_animation(&mut self) {
if self.is_pending() {
self.pending_frame = (self.pending_frame + 1) % PENDING_FRAMES.len();
}
}

pub fn complete_daemon_start(&mut self, result: Result<(), ActionFailure>) -> bool {
if let Err(error) = &result {
self.last_start_failed = true;
self.connection_message.clone_from(&error.message);
self.connection_guidance.clone_from(&error.guidance);
}
self.finish_action(result)
self.finish_action(result.map_err(|_| ActionFailure {
message: "Could not start cadderd.".to_string(),
guidance: None,
}))
}

pub fn complete_lifecycle(&mut self, result: Result<(), ActionFailure>) -> bool {
Expand All @@ -109,6 +129,9 @@ impl App {
if let Some(notice) = &self.notice {
return Some(notice.clone());
}
if self.runtime_status.connection == ConnectionStatus::Offline {
return None;
}
if self.runtime_status.connection != ConnectionStatus::Connected {
return Some(self.connection_guidance.as_deref().map_or_else(
|| self.connection_message.clone(),
Expand All @@ -131,6 +154,7 @@ impl App {
fn begin_action(&mut self, message: &'static str) {
self.notice = None;
self.pending_message = Some(message);
self.pending_frame = 0;
}

fn finish_action(&mut self, result: Result<(), ActionFailure>) -> bool {
Expand Down
Loading