-
-
Notifications
You must be signed in to change notification settings - Fork 0
release: v2.11.0 #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
release: v2.11.0 #72
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Fixed Object.assign merging in decisions.mjs to merge objects instead of overwriting - addApi now properly merges content when called multiple times on same API path - Multiple addApi calls to same path (e.g. 'config') now accumulate functions correctly - Test shows second addApi call properly merges with first call results Internal single-folder conflicts still need fixing: - Root-level config.mjs + config/config.mjs conflict within single addApi call - Subdirectory flattening still overwrites root-level file during initial load - Rule 7 implementation needs adjustment to handle this case
- Fixed issue where multiple addApi calls were overwriting previous content instead of merging - Root cause: lazy mode module loading was corrupting bound API state before content preservation - Solution: capture existing API content before module loading (super early capture) - Added object reference isolation to prevent contamination during merge operations - Lazy mode now matches eager mode behavior for root-level file + subdirectory conflicts - Both test-addapi-conflict.mjs and test-lazy-mode-conflict.mjs now pass - All 8 expected functions preserved across multiple addApi calls
- Fixed test expectations to match Rule 1 flattening behavior (filename matches folder name) - Corrected config/config.mjs scenarios to expect flattening at root level - Updated services/services/services.mjs tests for proper Rule 1 flattening - Fixed autoFlatten=false tests to understand Rule 1 applies regardless of setting - Added lazy mode materialization support with isValidFolderType() helper - Fixed lazy mode typeof assertions to accept functions as valid folder types - Added proper materialization triggers by accessing nested properties before checks - All eager/lazy modes across async/live runtimes and hook configurations now pass
- Enhanced API-FLATTENING.md with 3-tier navigation system (F01-F07) - Updated API-RULES.md with verified examples and cross-references (Rules 1-12) - Corrected API-RULES-CONDITIONS.md with accurate source code verification (C01-C18) - Added complete cross-reference system linking all documentation levels - Verified all technical details against current source code implementation - Improved user experience with clear navigation and enhanced examples - All content preserved while significantly improving accuracy and usability
…tion - Fixed addApi multiple calls content preservation with early capture mechanism - Added comprehensive 168-scenario test coverage for smart flattening behaviors - Enhanced precommit validation pipeline with automatic build artifact cleanup - Improved TypeScript definition generation with JSDoc typedef patterns - Resolved 140+ lint errors for improved code quality standards Technical improvements: - Object reference isolation prevents content contamination during merge operations - Super early content capture before module loading in lazy mode - Enhanced merge logic in decisions.mjs for proper content accumulation - Comprehensive validation across async/live runtimes and hook configurations API behavior discoveries: - Single file mixed exports: api.mixed() callable with api.mixed.methods() - Root-level mixed exports: api.volume() callable with api.volume.up() methods - Identified callable namespace gap for subfolder multiple-file scenarios Documentation updates: - Enhanced API documentation suite with 3-tier navigation system - Updated changelog and README for v2.11.0 release preparation - Verified examples and cross-references across all documentation levels This enhances module loading reliability and provides comprehensive validation for complex API structures while maintaining backward compatibility.
…addApi context
This commit adds two new API generation features that extend slothlet's
flattening capabilities to the addApi() runtime extension system:
Feature 1: Rule 11 - AddApi Special File Pattern
- Files named addapi.mjs loaded via addApi() method always flatten
- Behavior independent of autoFlatten setting
- Designed for seamless API namespace extensions
- Implementation in src/lib/helpers/api_builder/add_api.mjs
Feature 2: Rule 1 Extended to AddApi Context
- Filename-matches-container flattening now works with addApi()
- When folder name matches filename in addApi context, content flattens to category level
- Example: plugins/plugins.mjs via addApi("plugins", "./plugins") results in api.plugins.method()
- Prevents redundant nesting (api.plugins.plugins.method) in dynamic API extensions
Implementation Details:
- Added special case handling for addapi.mjs files in addApiFromFolder()
- Extended getFlatteningDecision() to recognize container-matching in addApi context
- Unified construction architecture ensures consistent behavior across eager/lazy modes
- Added callable namespace pattern constraint (single module only) to prevent circular references
Test Coverage:
- api_tests/api_smart_flatten_addapi/: Rule 11 verification
- tests/debug-slothlet.mjs: API structure validation
- All precommit tests pass (7/7 steps)
Related Documentation:
- docs/API-RULES.md: Rule 11 and Rule 1 extended documentation
- docs/API-FLATTENING-v2.md: F06 pattern documentation
- docs/changelog/v2.11.md: Feature changelog entry
These features enable cleaner API extensions via addApi() while maintaining
predictable structure and preventing common pitfalls like circular references
and redundant nesting in dynamically loaded modules.
…all MD files - API-RULES-CONDITIONS.md: Added comprehensive C33 condition section * Implementation details from add_api.mjs lines 266-310 * Code examples showing always-flatten behavior * Use cases for plugin systems and runtime extensions - README.md: Updated v2.11.0 highlights * Added Rule 11 feature to what's new section * Added Rule 1 extension (filename-matches-container in addApi) - AGENT-USAGE.md: Added Pattern 5 for AddApi Special File Pattern * Complete code example for addapi.mjs usage * Use cases: plugin systems, hot reloading, modular extensions * Cross-references to API-RULES.md Rule 11 Related commits: efd2020, f173ca7
- Add missing pathToFileURL import for ESM module detection - Fix config validation test to properly test enableModuleOwnership requirement * Added moduleId parameter so test reaches enableModuleOwnership check * Previously was failing on missing moduleId check first - Fix allowApiOverwrite interaction test expectations * Changed from expecting error throw to verifying API reference unchanged * Aligns with non-breaking design: warns and skips instead of throwing - All 17 test configurations now pass (100% success rate) - Precommit validation passes all steps
…to find actual caller Previous algorithm would give up at the first internal file after slothlet.mjs, causing path resolution to fall back incorrectly in CI where runtime files appear between slothlet.mjs and user code in the stack trace. Now loops through all frames after slothlet.mjs, skipping: - All internal files (src/lib/*, helpers/*) - All index files (index.mjs, index.cjs, index.js) Until it finds the actual user code that called addApi. This fixes CI path resolution errors where ../api_tests/* was resolving from the wrong directory level (one level too high). Changes: - resolve-from-caller.mjs: Replace single-check logic with while loop - Added comprehensive path resolution tests - Fixed test runner to exclude helper utilities properly
… node:internal Previous fix only filtered node:internal/* but CI was finding node:async_hooks and other built-in modules (node:fs, node:path, etc.) in the stack trace. When resolving paths from node:async_hooks, ../api_tests/* would resolve to the wrong directory level. Now filters ALL node:* modules in three places: - pickPrimaryBaseFile initial stack filtering - Candidate checking loop after slothlet.mjs - pickFallbackBaseFile stack filtering This ensures we only resolve paths from actual user code files, never from Node.js built-in modules.
…ression - Update minimum Node.js version from 16.4.0 to 16.20.2 - Reason: Node.js 16.4-16.19 has stack trace API regression affecting path resolution - Regression causes stack traces to omit user code frames in async contexts with AsyncLocalStorage - Node.js 16.20.2+ fixes this issue and provides consistent behavior Changes: - package.json: engines.node >=16.20.2 - CI workflows: min_node_version 16.20.2, max_node_major 24 - README.md: Updated requirements and runtime documentation - docs/CONTEXT-PROPAGATION.md: Updated performance note - docs/changelog/v2.11.md: Added breaking changes section Impact: - Users on Node.js 16.4-16.19 must upgrade to 16.20.2+ or use slothlet@2.10.0 - CI will now test against Node.js 16.20.2, 17.x, 18.x, 20.x, 22.x, 24.x - Local testing confirmed 16.20.2 works correctly (100% test pass rate) Closes path resolution failures in Node.js 16.4.2 CI environment
…in permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ation
- Remove unused 'reference' imports from api_adb_test files
- inputHelpers.mjs, device.mjs, helpers.mjs, power.mjs, metadata.mjs, state.mjs
- Files only import what they actually use (self and context)
- Exclude api_tests directory from TypeScript type generation
- Added '../api_tests' to tsconfig.dts.jsonc exclude list
- Test files don't need type definitions
- Removes type-check warnings for test-only code
- Remove unnecessary || {} fallbacks in debug logging
- Variables guaranteed to be objects don't need fallback
- Fixes Copilot warnings about always-true conditions
- Affected: superEarlyExistingTargetContent, superEarlyExistingBoundContent, newModules
Changes improve code clarity and reduce noise from linter/Copilot warnings
…nto release/v2.11.0
Shinrai
approved these changes
Jan 5, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 What's Changed
💥 Breaking Changes
No breaking changes
✨ Features
🐛 Bug Fixes
🔧 Other Changes
👥 Contributors