Skip to content

Merge develop into main (v0.6.0) - #38

Closed
caomengxuan666 wants to merge 115 commits into
mainfrom
develop
Closed

caomengxuan666 wants to merge 115 commits into
mainfrom
develop

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Merge develop branch with latest changes for v0.6.0 release.

Changes:

  • feat(json): integrate nlohmann/json and add standalone release preset
  • feat(commands): add 13 new Linux utilities
  • Feature/winux shell integration improvements
  • chore: remove large files from git history (autoComplete.mp4, auto.gif)
  • chore: bump version to 0.6.0

caomengxuan666 and others added 30 commits February 2, 2026 18:20
… support

1. Add universal C++23 import std support for CMake 3.30+
2. Implement MSVC/Ninja cross-compilation for x64 (native) and ARM64 (cross)
3. Fix architecture-specific build issues (remove invalid _AMD64_ macro)
4. Configure CPack to package 7Z/ZIP independently with high compression
5. Set up automatic GitHub Release on version tag (v*) with unique artifacts
6. Clean up build workflow: fix paths, remove redundant steps, resolve name conflicts
…ecution

- Introduce a standalone initialization script to avoid modifying system or user PATH.
- The script is now integrated into the user profile for seamless command execution.
- This change improves flexibility and reduces potential conflicts with existing environment configurations.
- Automatically finds latest WinuxCmd installation
- No hardcoded paths, supports multiple versions
- Users don't need to re-run after updates
- Enable default testing functionality
- Remove MSVC exception handling configuration
- Adjust source file path structure
- Add precompiled header support
- Rename test directory from 'test' to 'tests'

refactor(tests): Implement custom test logic and remove catch2 dependency

- Implemented custom test logic
- Removed dependency on catch2 for testing framework

feat(main): Create main entry point and implement command dispatching

- Create program main entry at src/Main/main.cpp
- Implement command-line argument parsing, wildcard expansion, command dispatching functionality
- Add help information display

feat(utils): Add wildcard processing module

- Create src/Main/wildcard_handler.cppm module
- Implement wildcard expansion functionality for command-line arguments

fix(cat): Replace standard output functions with safe print functions

- Replace printf/fprintf/wprintf functions in cat command with safePrint family functions
- Ensure correct output in both console and pipe modes

refactor(cp): Update cp command implementation and fix error output

- Update cp command option definitions and error message output methods
- Use safePrint function family to replace traditional fprintf/wprintf functions
- Improve error handling and user interaction

docs(cp): Update cp command documentation comment format

- Standardize contributor comment format
- Optimize option description line break layout
- Improve code readability
- Implemented complete echo command with support for --upper and --repeat options
- Extended CommandMeta system to support different option types (bool, int, string)
- Added blank line formatting to option documentation for various command modules
- Introduced CommandContext struct for unified command parameter handling
- Refactored command metadata registration mechanism to support runtime type erasure
- Introduce modern way to this project
- The extra code would be adjust later(Next commit)
This commit refactors all command modules to adopt the new pipeline architecture. The changes include:

## Command Module Restructuring
- Unified all command modules to follow the `cmd:<command>` naming convention
- Replaced legacy option parsing with the new type-safe `CommandContext` system
- Implemented pipeline component separation for validation and processing logic
- Removed deprecated `auto_flags.h` and migrated to the new option handling system

## Build System Updates
- Raised CMake minimum version requirement to 3.30.0
- Updated module dependencies and compilation targets
- Enhanced build configuration for better module isolation

## Documentation Improvements
- Added comprehensive management command documentation (`activate`, `deactivate`, `status`, `list`, `help`)
- Updated architecture design documentation to reflect the pipeline approach
- Rewrote option handling guide for the new type-safe system
- Improved scaffold and DSL documentation for command creation
- Synchronized content between English and Chinese documentation versions

## Key Architectural Changes
1. **Pipeline Pattern**: Each command now follows a clear pipeline structure with separate components for input validation, processing, and output generation
2. **Type Safety**: The new `CommandContext` provides compile-time type checking for option access
3. **Module Consistency**: All commands now share a consistent module structure and interface
4. **Improved Error Handling**: Better separation of validation errors from processing logic

## Breaking Changes
- The `auto_flags.h` header is no longer available - migrate to the new option system
- Command module imports must now use the `cmd:` prefix (e.g., `import cmd:ls`)
- Minimum CMake version requirement is now 3.30.0

The refactor improves maintainability, provides better type safety, and establishes a clear architectural pattern for future command development.
refactor(cmd): restructure command modules and update documentation
- Add CMake policy settings to suppress warnings
- Add GENERATE_MAP_INFO option for generating map information
- Bump project version from 0.1.4 to 0.2.0
- Update command source file collection from .cppm to .cpp
- Add static CRT compilation option configuration
- Configure link options to generate map files

docs: add contribution guidelines and test framework documentation

- Create CONTRIBUTING.md containing development workflow and code style guidelines
- Add test framework documentation (English and Chinese versions)
- Update documentation links in README to point to new documents

chore: update .gitignore and clean up Linux help documentation

- Add /testing directory to ignore list
- Remove help documentation files for multiple Linux commands
- Update supported parameter list for ls command (-n, --color)
…g handling across all commands

- Add complete safePrint overload set in utils:console module:
  * safePrint(const wchar_t*) - zero-cost wide string output
  * safePrint(char) - single character output
  * safePrint(const char*) - C string output
  * safePrint(std::string_view) - zero-copy string view output
  * safePrint(int/unsigned/long/long long) - integer formatting output
  * safePrint(bool) - boolean output
  * safePrint(const void*) - pointer output
  * Corresponding overloads for safeErrorPrint
  * Corresponding overloads for safePrintLn/safeErrorPrintLn

- Completely eliminate high-cost operations in all commands:
  * Remove all std::wostringstream instantiations (save 8.6KB each)
  * Remove all std::wstring(1, c) constructions (save 1.2KB each)
  * Remove all L"^" + std::wstring concatenations (save 2.4KB each)
  * Remove all std::string(a + b + c) chained concatenations
  * Replace with snprintf + std::string_view stack formatting

- Optimize specific command implementations:
  * cat.cppm: completely rewrite character processing logic, STL overhead 38KB → 20KB
  * ls.cppm: permission string wstring → string, size formatting wostringstream → snprintf
  * cp.cppm/mv.cppm: remove operator+ path concatenation, use operator+=
  * echo.cppm: simplify output logic, remove temporary wstring
  * rm.cppm/wc.cppm/mkdir.cppm: unify to use safePrint overload set

- Infrastructure improvements:
  * Add src/pch/string_instances.h/cpp for explicit std::string/std::wstring instantiations
  * Add string_instances.cpp to CMakeLists.txt for both winuxcmd and command macro
  * Include string_instances.h in pch.h for shared instantiation declarations across all modules

- Documentation:
  * Add "High-Performance C++23 Coding Guidelines" section in CONTRIBUTING.md
  * Add Chinese version CONTRIBUTING_ZH.MD with detailed string handling best practices
  * Provide string type selection guide with recommended/cautious/prohibited categories
  * Add code templates for file size formatting, time formatting, path building
  * Add cost comparison table for different string operations
  * Update website links in README-zh.md and README.md to product links

Performance improvements:
  * Total executable size: 477KB → 428KB (↓49KB)
  * ls.cpp.obj: 53.75KB → 38.95KB (↓14.8KB)
  * cat.cpp.obj: 35.11KB → 28.44KB (↓6.67KB)
  * echo.cpp.obj: 19.80KB → 14.03KB (↓5.77KB)
  * cp.cpp.obj: 25.04KB → 22.76KB (↓2.28KB)
  * rm.cpp.obj: 16.43KB → 14.41KB (↓2.02KB)
  * stl_string overhead: 146KB → 129KB (↓17KB)
  * string_instances.cpp.obj: 15.07KB → 12.53KB (↓2.54KB)
  - add head implementation with -n/-c/-q/--silent/-v/-z options plus tests
  - add tail implementation with -n/-c/-z parsing; follow/pid/retry marked [NOT SUPPORT]; tests
  - add find with name/iname/type/mindepth/maxdepth/print/print0/P/quit; unsupported exec/delete/etc; tests
  - add grep with E/F/G regex modes, files/includes/excludes, context and counting flags; mark -P unsupported; tests
  - add cut supporting -d/-f/-s/-z; mark -b/-c/output-delimiter unsupported; tests
  - add which with PATH/PATHEXT search, -a flag; skip/show dot/tilde parsed as [NOT SUPPORT]; tests
  - add env with -i/-u/-0 and NAME=VALUE handling; command exec/chdir/split-string marked [NOT SUPPORT]; tests
  - add touch, rmdir, sort, uniq implementations and corresponding unit tests
  - update pipeline env block handling and shared utils (opt, console, pch) for new commands
  - update bilingual README to list all implemented commands and supported flags
• feat: add head/tail/find/grep/cut/which/env and doc updates
- sed is now supported.
- Fix up cut bugs.
- grep optimize,more args support.
- which is more strong.

Feat(FrameWork):Fix env bugs.
- Fix the build_env_block function in the pipeline.cpp so that the framework would not crash.
feat(Command):Add new command,optimize and fix command bugs. 
- sed is now supported. 
- Fix up cut bugs. 
- grep optimize,more args support. 
- which.exe is more strong.
feat(docs):Update En and Zh README
feat(docs):Update the docs

feat(workflow):Pass new options to the workflow.

feat(build):Using unity build when CICD,create some presets.
refactor(scripts):Add more commands to winux.ps1
- Implement pipeline input handling in PowerShell wrapper function
- Add [Parameter(ValueFromPipeline)] attribute to receive pipeline objects
- Configure ProcessStartInfo for proper stdin/stdout redirection
- Set UTF8 encoding for cross-platform compatibility
- Optimize string concatenation for parameter building
- Maintain sub-20ms performance with pipeline support (21.3ms avg)
feat(pipeline): Add pipeline input support for all WinuxCmd commands
caomengxuan666 and others added 27 commits March 17, 2026 21:45
fix: implement proper version handling with PROJECT_VERSION file
…l-integration

Feature/winux shell integrationfix(repl): make cd and drive switching persistent in interactive mode
- Add completions_dirty flag: recompute completions only when buffer
  changes (insert, backspace, tab, history nav), not on every event
- Avoid double UTF-8 conversion in redraw(): convert buffer to wstring
  once and reuse in both step 3 (render) and step 5 (cursor restore);
  use MultiByteToWideChar() to compute wchar cursor offset in-place
- Replace FillConsoleOutputAttribute + WriteConsoleOutputCharacterW
  with a single WriteConsoleOutputW call in writeAt(), halving Win32
  syscalls for each completion row drawn
- Replace per-char while-loop padding with wstring::append(n, L' ')
  and add reserve(W) to avoid reallocation when building each row
…fallback

- add REPL sudo rewrite: `sudo <builtin> ...` -> `sudo "<winuxcmd.exe>" <builtin> ...`
- ensure Windows native sudo can elevate and execute WinuxCmd built-ins (e.g. lsof)
- route shell meta commands (`|`, `>`, `<`, `&`) to native fallback in REPL
- keep direct built-in dispatch for normal single commands unchanged
…l-integration

perf(readline): optimize per-keystroke rendering and completion latency
- Fix garbled text in README.md (including Chinese link text and section headers)
- Replace broken symbols (for example corrupted dashes/icons) with readable text
- Normalize malformed markers in examples and benchmark table
- Correct copyright line character rendering
- Keep file encoded as UTF-8
- Refactor README.md to match README-zh style (concise landing page)

- Move long technical details to DOCS/en links

- Keep quick start, command overview, FAQ, and contribution entry

- Improve readability and navigation for English users
…l-integration

fix(readme): resolve garbled text and broken symbols in README.md
- rewrite `sudo <builtin> ...` to `sudo <winuxcmd.exe> <builtin> ...`
- rewrite pipeline segments that start with built-ins to `<winuxcmd.exe> <cmd>`
- preserve normal dispatch for single non-shell-meta commands
- fix executable path quoting strategy for cmd pipeline compatibility
…l-integration

fix(repl): make sudo/pipeline work with built-in commands on Windows
- Add CMake version file generation (version.hpp.in)
- Update import std UUID for CMake 4.3.0 compatibility
- Replace hardcoded version with VERSION_STRING from version.hpp
- Update PROJECT_VERSION to 0.5.3
- Add CMake version file generation (version.hpp.in)
- Update import std UUID for CMake 4.3.0 compatibility
- Replace hardcoded version with VERSION_STRING from version.hpp
- Update PROJECT_VERSION to 0.5.3
- detect parent shell and choose REPL fallback shell (PowerShell or cmd)
- replace PowerShell fallback `-Command` path with `-EncodedCommand` (UTF-16LE + Base64)
- prevent fallback from echoing raw text instead of executing commands
- keep cmd fallback unchanged for cmd-origin sessions
- detect parent shell in REPL startup (cmd vs powershell/pwsh)
- route native fallback by environment:
  - cmd parent -> cmd.exe /d /c
  - powershell parent -> powershell/pwsh -EncodedCommand
- use EncodedCommand for PowerShell fallback to avoid quoting/pipeline breakage
- keep sudo/pipe builtin rewrite compatible with native Windows sudo and mixed pipelines
- add built-in PowerShell command/option completion set
- expose shell-aware completion query APIs and wire them into main REPL completer
- update README / README-zh / DOCS to document:
  - shell-aware fallback behavior
  - PowerShell profile bootstrap snippet
  - completion env var (WINUXCMD_COMPLETION_FILE)
  - project status (many users, limited contributors)
Implement base64, tr, less, watch, jq, md5sum, sha256sum, basename, dirname, free, column, seq, and stat commands with full test coverage and documentation updates.

Changes:
- Add 13 new command implementations with comprehensive feature support
- Create unit tests for all new commands with proper test framework integration
- Update CMakeLists.txt to automatically generate command links for testing
- Update create_links.ps1 to include all 48 commands
- Update winux.ps1 CommandMap to support PowerShell activation
- Fix stack overflow in column command by using heap allocation
- Fix tr command squeeze logic for -ds mode and proper state management
Change WinuxCmd PowerShell fallback startup args from:
  -ExecutionPolicy Bypass
to:
  -ExecutionPolicy RemoteSigned

This avoids overriding user/system execution policy behavior and fixes
profile/script loading issues caused by forced Bypass in child sessions.
Integrate nlohmann/json library v3.12.0 via C++23 modules for improved JSON parsing performance. Refactor jq command to use nlohmann/json, enabling support for JSON comments and better performance.

Changes:
- Add nlohmann/json library (v3.12.0) as module in src/utils/
- Refactor jq command to use nlohmann::json with comment support
- Add standalone-release CMake preset for building individual command executables
- Create winuxcmd-core static library containing only core modules (core, utils, container)
- Fix create-test-links dependency to ensure winuxcmd.exe is built first
- Update CMakeLists.txt to support BUILD_STANDALONE option
- Update winux.ps1 with all 48 commands

Performance improvements:
- JSON parsing with nlohmann/json: ~20-30x faster than string-based implementation
- 50-user JSON: 16ms -> 5ms
- 10000-user JSON: 1369ms -> 20ms

Standalone build creates individual executables for each command (354-477 KB each) for size analysis and distribution.
…l-integration

Feature/winux shell integration
caomengxuan666 added a commit that referenced this pull request Nov 14, 2026
The i18n-drift orphan-key fix landed on the catalog repo's main
(#38); the PR-trigger workflow has no ready_for_review trigger, so
this empty commit re-runs the check suite against the fixed catalog.
caomengxuan666 added a commit that referenced this pull request Nov 14, 2026
…1624)

* Fix #1621: un-register retired echo -r/--repeat so it prints as data

The retired -r/--repeat extension was still declared INT_TYPE in
ECHO_OPTIONS, so the dispatcher consumed and int-validated its value
ahead of the handler: `echo -r x` and bare `echo -r` were rejected
with rc 1 while GNU coreutils 9.4 prints them as data, rc 0. The
long form was already data (echo allows no long options), so removing
the registration makes every spelling reach the handler verbatim like
every other non-[-neE] token. Sync the permissive-policy comment in
command_context.cppm and add regression pins for the three spellings
from the issue.

Refs #1621

* chore: retrigger PR checks after unixwin/winuxcmd-i18n#38 merged

The i18n-drift orphan-key fix landed on the catalog repo's main
(#38); the PR-trigger workflow has no ready_for_review trigger, so
this empty commit re-runs the check suite against the fixed catalog.

---------

Co-authored-by: 曹梦轩 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants