59 Commits

Author SHA1 Message Date
Catty Steve df5026cdbe refactor(notify): extract handler, rule, util
CI / ${{ matrix.crate }} (workshop-engine) (push) Failing after 3m54s
CI / ${{ matrix.crate }} (workshop-baker) (push) Failing after 27m50s
Split the monolithic notify module into three submodules:
- `handler`: async bucket dispatch with cooldown, retry, escalation
- `rule`: rule parsing from YAML config, template merging, overrides
- `util`: validation, event timing, helper functions
  `NotificationTemplateDef` replaces `AddAssign` with `apply()` for
  non-destructive merging (self wins, other fills gaps).
  `insitenotify` logs instead of panicking.
2026-05-22 00:16:28 +08:00
Catty Steve d1ad08ef3a feat: add workshop-baker-params for config layering
Implement a priority-based merge system for pipeline configuration.
Parameters carry their source (Base, Courier, Bakerd) and only
higher-priority writers override. Migrate notification, prebake, bake,
and finalize config to use ParamVal wrappers. Remove hardcoded
constants and the InteractiveServer component.

BREAKING CHANGE: Remove NotAvailable variant from MethodStatus enum
2026-05-21 20:04:47 +08:00
Catty Steve cf2968e720 refactor: update AGENTS.md and remove osbolete modules
Archive 7 deprecated crates. Add Resource model documentation.
Remove internal fetch module from workshop-baker.
2026-05-20 16:30:50 +08:00
Catty Steve 28abc5d207 refactor: replace internal fetch utilities with ResourceRegistry
Remove the monolithic utils::fetch module (HTTP download, git clone,
checksum, extraction) and utils::fetch_plugin module from the baker.
Introduce a ResourceRegistry type to centrally track pipeline
resources by name and path.

The actual fetching logic is now delegated to the workshop-getterurl
crate, which gains optional md5 and sha1 hash support behind default
features. Also flatten the builtin module in workshop-getterurl.
2026-05-19 23:22:59 +08:00
Catty Steve 6e7b96cd66 refactor: remove unused crates, refactor fetch
- Move fetch_plugin from finalize::plugin::fetch to utils::fetch_plugin
- Delete unused crates: workshop-cert, workshop-deviceid, workshop-vault
- Remove parser benchmarks and empty daemon/socket modules
- Add new workshop-getterurl crate for resource fetching
2026-05-19 21:53:41 +08:00
Catty Steve 3e80825d58 refactor(plugin)!: remove dedicated plugin fetch subsystem
Drop the entire plugin fetch module (HTTP, git, checksums, extraction).
Simplify mail notification plugin to a bare stub.
Remove outdated metadata tests.

BREAKING CHANGE: Not a buildable version!
2026-05-19 16:24:19 +08:00
Catty Steve c97eafab29 refactor(baker): Restructure CLI, drop legacy tests
- Remove Python-based test framework, Dockerfiles, and runner scripts
- Add bare subcommand for standalone pipeline stage execution
- Implement unified worker mode and error module
- Refactor NotificationConfig to support YAML string keys
- Add dummy internal plugin and clean up mail template
2026-05-19 16:19:28 +08:00
Catty Steve f737b6a24d feat(baker): add axum HTTP server and refactor plugin fetching
Refactor plugin imports to use workshop_engine types, consolidate
resource fetching into utils/fetch module with checksum verification,
and add interactive notification server using axum.
2026-05-18 10:01:55 +08:00
Catty Steve 681b7d1333 style: format all code to comply with cargo fmt check
CI / ${{ matrix.crate }} (workshop-engine) (push) Failing after 36m14s
CI / ${{ matrix.crate }} (workshop-baker) (push) Successful in 1h35m51s
2026-04-28 19:17:56 +08:00
Catty Steve f07588a716 test: add Go UPM system tests for bare prebake 2026-04-28 19:12:53 +08:00
Catty Steve b0530fb858 feat(upm): add Python and Go package manager support 2026-04-28 16:56:53 +08:00
Catty Steve fd18b547e5 feat(upm): implement Rust user package manager
Adds the `user.rust` UPM to workshop-engine for managing Rust
toolchains,
components, cross-compilation targets, and cargo operations:

- `rustup default <toolchain>` / `rustup component add` / `rustup target
  add`
- `cargo fetch` for dependency pre-fetch with optional `--locked`
- `cargo install` for global crate tools with registry support

Includes 275-line test suite (`tests/upm/test_rust.py`) covering the
full
lifecycle with optional network tests.
2026-04-28 12:20:05 +08:00
Catty Steve cf317b55c6 feat(pm): add apk/dnf implementations and multi-distro test
CI / ${{ matrix.crate }} (workshop-engine) (push) Failing after 28m8s
CI / ${{ matrix.crate }} (workshop-baker) (push) Failing after 33m39s
infrastructure
2026-04-27 23:01:43 +08:00
Catty Steve 20e2ab4224 refactor: reorganize imports and add lint allows
CI / ${{ matrix.crate }} (workshop-engine) (push) Failing after 13m13s
CI / ${{ matrix.crate }} (workshop-baker) (push) Failing after 28m54s
2026-04-27 14:31:11 +08:00
Catty Steve 50b42e654c refactor(workshop-engine): replace tokio Child with ManagedChild trait
for testability

- Add `ManagedChild` trait abstracting process lifecycle (real
  `TokioChild` + `MockChild` for tests)
- Use Unix process groups (`process_group(0)` + `libc::kill(-pgid,
  SIGKILL)`) for tree-wide termination
- Remove cgroup-related code (`CgroupManager`, `ResourceUsage`,
  `cgroup_path` field)
- Update imports across test files to use `workshop-engine` crate
  directly
2026-04-27 12:02:17 +08:00
Catty Steve a64e47d772 ci(github-actions): add workshop-engine to CI matrix strategy
CI / ${{ matrix.crate }} (workshop-baker) (push) Failing after 28m8s
CI / ${{ matrix.crate }} (workshop-engine) (push) Failing after 1m27s
Expand CI to run on workshop-engine crate alongside workshop-baker using
a matrix strategy to avoid job duplication.
2026-04-26 23:27:39 +08:00
Catty Steve 8fd807f174 refactor!: extract execution engine into standalone workshop-engine
crate

BREAKING CHANGE: Moved engine/ module (cgroups, executor, pm, upm,
types) and shared types (command, repology, time) from workshop-baker to
new workshop-engine crate. All internal error types consolidated into
workshop-engine::error. Import paths changed throughout codebase.
2026-04-26 23:07:08 +08:00
Catty Steve e8ce2eec9e docs: add comprehensive documentation and tests to workshop-baker 2026-04-25 11:30:59 +08:00
Catty Steve 9e45bdbbfb refactor(notify): rename NotifyEvent to NotificationEvent
CI / Check & Lint (push) Failing after 19m30s
2026-04-24 23:10:04 +08:00
Catty Steve 5ce8b72900 refactor(notify): extract types to separate module and redesign
NotificationRule

- Move NotifyEvent, NotifyPluginMap, and related types to
  notify/types.rs
- Introduce NotificationRule struct replacing NotificationMethod fields
- Add NotificationRulesMap for priority-based notification configuration
- Comment out main event loop and add todo!() placeholders for WIP
2026-04-24 23:01:40 +08:00
Catty Steve 2c9d32e954 refactor(error): extract exit code logic into HasExitCode trait
Introduce a common HasExitCode trait for PrebakeError, BakeError,
ExecutionError, and FinalizeError. Refactor main.rs to consolidate
CLI command handling and use the trait for unified exit code resolution.
2026-04-24 21:45:57 +08:00
Catty Steve 901005639b feat(cli): add environment variable support and restructure commands
- Add HBW_USERNAME, HBW_PIPELINE, HBW_BUILD_ID, HBW_DRY_RUN env vars
- Wrap prebake/bake/finalize in Bare subcommand for cleaner hierarchy
- Remove unimplemented Monitor command
2026-04-24 21:12:10 +08:00
Catty Steve 84b3b7d8e8 test: add Docker-based system test infrastructure
Adds a complete pytest system test suite for the HoneyBiscuitWorkshop
CI/CD system:

- runner.sh: orchestrates build, Docker image creation, and test
  execution
- Dockerfile: Arch Linux-based test image with Python venv
- conftest.py: shared fixtures (baker_bin, run_baker, work_dir, llm_env)
- probes/: environment probes for checking users, files, packages,
  processes
- llm/: LLM-based log judgment system with caching for semantic test
  evaluation
- fixtures/: test configs and scripts for prebake, bake, and finalize
  stages
- test_prebake.py, test_bake.py, test_finalize.py: test suites for each
  pipeline stage

Also refactors finalize.yml.tmpl notification config to use a templates
system.
2026-04-24 15:54:56 +08:00
Catty Steve 36112c671d style: apply rustfmt and clippy fixes across codebase
CI / Check & Lint (push) Failing after 23m46s
2026-04-23 18:34:26 +08:00
Catty Steve 9d3d61ba66 ci: enable GitHub/Gitea worker
CI / Check & Lint (push) Failing after 11m51s
2026-04-23 16:30:51 +08:00
Catty Steve 117660d5c4 feat(baker/finalize): notification system and consolidate status types
- Rename types/build_status.rs to types/buildstatus.rs
- Rename StageInfo.sub_stage field to substage for consistency
- Move notification logic from finalize to dedicated notify module
- Remove notification module from finalize (moved to notify)
- Add notify module with event queuing, retry, and priority scheduling
- Add exponential backoff for temporary notification failures
- Implement plugin filtering by name list during registration
- Add fetch_plugins helper for batch plugin download
- Update finalize plugin registration to accept optional plugin filter
- Fix finalize config template indentation for notification policy
- Move all YAML templates to templates/ directory
2026-04-23 16:18:20 +08:00
Catty Steve 07d76d612d refactor!: move notification module to src/notify.rs
BREAKING CHANGE: notification system is now separate module
2026-04-22 21:21:26 +08:00
Catty Steve 2658d0ebfa feat(baker): add build status tracking and notification dispatch system
Add new `build_status` types module for tracking pipeline stage
execution
status across prebake, bake, and finalize phases. Introduce
`NotificationCore`
dispatcher that processes notification methods by priority groups with
fallback
on failure. Status files written to `/tmp/.hbwstatus` in JSON lines
format.
2026-04-22 18:45:22 +08:00
Catty Steve 40f307b471 chore: remove unused crates and add documentation
- Delete workshop-agent (HTTP server stub)
- Delete workshop-builder-native (empty stub)
- Delete workshop-helper-mac (unused)
- Delete workshop-llm-detector (moved to separate repo)
- Add AGENTS.md to bake/, engine/, finalize/, prebake/, cert/, vault/
- Fix finalize plugin validation and logging improvements
2026-04-22 12:47:48 +08:00
Catty Steve 7b3b71a4b3 feat(finalize): support multiple manifest extensions and add hook tests
- Remove underscore suffix from FINALIZE_SHELL_ENVPREFIX constant
- Split FINALIZE_PLUGIN_MANIFEST into name + extensions for flexible
  manifest discovery
- Add ManifestNotFound error variant for clearer plugin loading errors
- Add debug logging for plugin download operations
- Add integration tests for finalize hook execution
- Remove obsolete clarification.md
2026-04-21 21:40:19 +08:00
Catty Steve 0dd4a157ef feat(finalize): add standalone mode with automatic plugin fetching and
hook execution

- Add FinalizeHooks config for early/late stage hook execution
- Support plugin: prefixed commands in hooks to invoke registered
  plugins
- Implement standalone mode that auto-downloads plugins before
  registration
- Add shallow clone and checksum options to plugin config
- Normalize retention format to lowercase in template
- Refactor PathBuf to Path in plugin fetch modules for consistency
2026-04-21 18:13:24 +08:00
Catty Steve d8ba166a3b refactor: centralize ExecutionContext and event handling in main
- Lift ctx creation and event_receiver spawning to main
- Inject ctx and event_tx into prebake/bake/finalize
- Add standalone flag to ExecutionContext
- Wire up finalize command in main
2026-04-21 11:38:02 +08:00
Catty Steve e9128adfa0 feat(baker/finalize): implement plugin system with fetch and mail
support

- Add finalize plugin system with fetch logic for git/https/file sources
- Add plugin checksum verification (SHA256/SHA512, reject MD5/SHA1)
- Add tar archive extraction with gzip/zstd support
- Add git clone and checkout with tag/commit fallback
- Add internal mail plugin with SMTP support and template rendering
- Add shell plugin with YAML-to-envvar argument conversion
- Add retry and timeout configuration for plugins
- Add duration deserialization to milliseconds with human-readable
  formats
- Replace timeout fields with timeout_ms throughout codebase
- Update CustomCommand timeout_ms and hook timeout handling
- Add HBW_ARG_ prefix for shell plugin environment variables
2026-04-21 10:33:21 +08:00
Catty Steve 0c089fd634 feat(baker/finalize): add YAML to shell env var conversion 2026-04-19 09:40:05 +08:00
Catty Steve a1da093176 feat(baker/finalize): Implement plugin manifest support and typed
metadata

- Rename env vars WS_* to HBW_* for consistency
- Add PluginMetadata struct and PluginType enum for typed plugin info
- Support manifest.yml files for external plugin discovery
- Add shell/rhai/dylib plugin stubs with proper type signatures
- Implement shallow argument merge for plugin runtime arguments
2026-04-18 23:58:33 +08:00
Catty Steve a8ed935f6a feat(baker/finalize): Add finalize stage framework with plugin system
and template

Implements the finalize stage infrastructure for HoneyBiscuitWorkshop:
- New finalize module with config, error, event, plugin, stage, and
  template submodules
- Plugin system supporting internal (webhook, mail, satori, in-site) and
  external plugins
- FinalizeConfig schema with version validation for finalize.yml
- Add glob, duration-str, lettre dependencies to workshop-baker
- Expand project documentation (clarification.md, description.md)
- Update .gitignore and fix bake.rs pipeline_functions access

BREAKING CHANGE: Not a buildable version!
2026-04-16 23:33:03 +08:00
Catty Steve 73e1238e20 refactor(bake): redesign parser with state machine and improve builder
- Replace flat parser with state machine (Normal/Decorator/InFunction)
- Change parse_script to accept reference and add proper error handling
- Add Function::find_decorator helper method
- Refactor build_script to accept &Function and support @if/@export
  decorators
- Add condition code generation for @if decorator
- Add export/preexport code for environment variable capture
- Handle trivial scripts by creating Function directly
- Add constants: PIPELINE_SKIP_ERRORCODE and TRIVIAL_SCRIPT_NAME
- Temporarily disable order-based sorting assertion (see TODO)
- Add empty finalize.rs module skeleton
- Update integration tests to expect errors appropriately
2026-04-06 00:07:02 +08:00
Catty Steve 246c2b22f1 feat(bake): Add streaming execution output and Repology endpoint config
- Implement async stdout/stderr streaming with event channel
- Add Repology endpoint configuration in dependencies config
- Refactor PackageManager trait to return Vec<Command>
- Add bootstrap configuration example
- Remove temp/privdrop.rs
2026-04-04 16:59:39 +08:00
Catty Steve 418bdfb2f0 refactor!: remove workshop-pipeline crate and add repology support
BREAKING CHANGE: workshop-pipeline crate removed entirely

- Remove workshop-pipeline/ (config structures, template resolution)
- Add Repology package name resolution to workshop-baker
- Add UPM system dependency collection for cross-pm resolution
- Replace AGENTS.md with concise knowledge base format
- Add crate-specific AGENTS.md files
- Fix various clippy warnings and derive Default where applicable
2026-04-04 13:24:26 +08:00
Catty Steve 2133f8b9b3 feat(bake): implement full bake functionality with template-based script
generation and pipeline scheduling

- Add benchmark infrastructure (Criterion) for parser performance
  testing
- Enhance decorator parsing with new types: Pipe, Parallel, Daemon,
  Health, and Unknown
- Improve parser to track line numbers and handle nested braces
  correctly
- Add implicit `@after` dependencies for pipeline functions in
  topological sort
- Introduce `use_template` flag in builder to support trivial script
  execution
- Update bake function signature to accept Cli parameters and privilege
  detection
- Refactor error handling with structured `ScriptGenerationFailed`
  variant
- Extend integration tests for privilege dropping, engine execution, and
  bake phase
- Comment out daemon and apt modules temporarily for refactoring
2026-04-04 10:12:57 +08:00
Catty Steve b59a702925 feat(bake): add bake module for script execution and refactor error
handling

- Add new bake module with parser, scheduler, decorator, and builder
- Implement topological sorting for functions with @after dependencies
- Add error handling for circular dependencies and unknown dependencies
- Introduce constants module for shared path definitions
- Add BakeError type (renamed from BuilderError) with new variants
- Add PrebakeStage::Never variant for "never drop privileges"
- Simplify decorator parsing and clean up comments
- Remove RustyVault and rust-tongsuo submodules as they are unused
  (temporarily)
- Update .gitignore to include .ruff_cache
2026-04-02 19:34:21 +08:00
Catty Steve b02407a02d chore(baker/prebake): Add comprehensive documentation to prebake module
- Document prebake.rs, bootstrap.rs, and hook.rs with module-level and
  function-level docs
- Rename parse_prebake_config to parse for conciseness
- Change bootstrap() return type from ExecutionResult to ()
- Add dry-run support to bootstrap stage
- Improve test robustness with Docker availability check and unique
  container names
2026-04-01 10:54:51 +08:00
Catty Steve 15aaa6f310 feat(baker/prebake): Add configurable bootstrap stage with dynamic
script generation

The bootstrap stage now reads configuration from prebake.yml to
dynamically generate bootstrap scripts for user creation, workspace
setup, and privilege executor configuration.
Adds the `which` crate for binary detection.
2026-03-31 23:46:11 +08:00
Catty Steve 9174c4dd2a feat: rename to workshop-baker and implement stage-based prebake
workflow

- Rename crate/library/binary from workshop-executor to workshop-baker
- Remove unused modules (decorator, parser, schedule, variable) from lib
- Implement stage-based privilege dropping with prebake_drop_privilege()
- Add dry-run support in executor and CLI
- Add bootstrap.sh template script for user/workspace setup
- Add PrebakeStage::from_str() and Default impl
- Add get_drop_after() function for security config
- Fix version matching to handle "1.0" format variants
- Fix UPM all_managers() to return custom::Custom
- Add Python integration tests with Docker
- Simplify examples/prebake.yml to match template
2026-03-31 20:54:48 +08:00
Catty Steve 20919d53ad refactor(baker/bake): move relating part into separate directory 2026-03-31 13:16:14 +08:00
Catty Steve 3e8b256889 feat(baker/engine): add depsuser stage 2026-03-31 11:53:55 +08:00
Catty Steve 0f6aed6f94 feat(engine): implement UPM/UserPackageManager interface 2026-03-31 11:39:47 +08:00
Catty Steve 960f03269c feat: rename workshop-executor to workshop-baker and add comprehensive
documentation

- Rename crate from workshop-executor to workshop-baker
- Add MDBook documentation infrastructure with Chinese docs (Vol1/2/3)
- Implement engine module with cgroups resource management
- Add package manager support (apt, pacman)
- Add daemon module with Unix socket IPC and heartbeat
- Add privdrop dependency for privilege dropping
- Implement prebake stages (bootstrap, depssystem, depsuser,
  environment, hooks)
- Add new bake.sh.tmpl pipeline template for osu! project
- Add pipeline implicit parameter documentation (PIPELINE_BAREMETAL_*,
  PIPELINE_CONTAINER_*, PIPELINE_UNCOVER_SECRET)
2026-03-30 20:24:54 +08:00
Catty Steve 69056a3a4a feat: add Package Manager 2026-03-11 14:49:10 +08:00
Catty Steve c80500f6ac feat: implement docker env creation for prebake
Also we introduced opencode for code production.
2026-03-10 11:59:58 +08:00