# Development Tasks Checklist
This checklist outlines the development tasks based on the design document. Since the code is already implemented, all tasks are marked as complete.
### Project Setup & Build
- [x] Configure `Cargo.toml` with package information and metadata.
- [x] Add all required dependencies (`anyhow`, `flood-tide`, `linux-procfs`, etc.) to `Cargo.toml`.
- [x] Structure the project into a binary (`main.rs`) and a library (`lib.rs`).
- [x] Set up workspace for helper crates (`xtask`, `test-helper`).
### Module: `main` (Entry Point)
- [x] Implement the main function to serve as the application entry point.
- [x] Collect and process command-line arguments from `std::env`.
- [x] Initialize fast memory operations with `memx_cdy`.
- [x] Call the `libps_mem::execute` function with the prepared arguments.
- [x] Implement global error handling to print errors to stderr and set the process exit code.
### Module: `lib` (Library Facade)
- [x] Define the library structure and declare `conf`, `run`, and `util` modules.
- [x] Create the public `execute` function to orchestrate the application's workflow.
- [x] Decouple the binary crate from the core application logic.
### Module: `conf` (Configuration & Argument Parsing)
- [x] Create the `conf` module for all configuration management.
- [x] Define the `CmdOptConf` struct to store parsed option values.
- [x] Use `flood-tide` to implement the command-line argument parser.
- [x] Implement logic to handle `-H`/`--help` and return a help message.
- [x] Implement logic to handle `-V`/`--version` and return the version string.
- [x] Implement parsing for the `--pid <number>` option.
- [x] Implement parsing for the `-a`/`--all` flag.
- [x] Implement parsing for the `--sort <order>` option.
- [x] Implement parsing for the `-l`/`--cmdline` flag.
- [x] Implement parsing for advanced `-X <x-options>`.
### Module: `run` (Core Logic)
- [x] Create the `run` module to contain the primary application logic.
- [x] Implement the main `run` function to select the execution path (list vs. invoke).
- [x] Use `linux-procfs` to fetch process information from the `/proc` filesystem.
- [x] Implement the process filtering logic based on the `--pid` and `--all` options.
- [x] Implement the sorting logic for the process list based on RSS, Swap, and Total memory.
- [x] Implement output formatting to display the process list in a human-readable table.
- [x] Implement the calculation and display of the `Sum` row.
- [x] Implement the logic to spawn and monitor a child process for command invocation.
- [x] Use `signal-hook` to ensure graceful shutdown of the monitored child process.
### Module: `util` (Shared Utilities)
- [x] Create the `util` module for common code.
- [x] Define the `OptSortOrder` enum for type-safe sorting options.
- [x] Define the `OptUcXParam` enum for type-safe advanced `-X` options.
- [x] Implement the `BrokenPipeError` trait for robust error handling in shell pipelines.