Files Created:
-
funee-lib/core.ts(189 lines) - Core macro typesClosure<T>interfaceCanonicalNameinterfacecreateMacro<T, R>()functionClosure()runtime constructor- Full JSDoc documentation
-
funee-lib/host.ts(58 lines) - Host function declarationslog(message: string)debug(message: string)- Declared but implemented in Rust
-
funee-lib/index.ts(45 lines) - Barrel export- Main entry point for
import { ... } from "funee"
- Main entry point for
-
funee-lib/package.json- Package metadata -
funee-lib/README.md(251 lines) - User documentation -
funee-lib/FUNEE_LIB_DESIGN.md(518 lines) - Architecture docs
Total: 1,061 lines of code + documentation
Created E2E Tests (Step 1 of TDD):
Added 8 tests to tests/cli.test.ts:
- Import Closure type from "funee"
- Use Closure constructor at runtime
- Import log from "funee"
- Import multiple exports from "funee"
- Closure constructor with plain object references
- Closure constructor with Map references
- Import createMacro from "funee"
- createMacro throws at runtime if not expanded
Created 8 Fixture Files:
tests/fixtures/funee-lib/*.ts- Test cases for each scenario
Next Steps Documented:
TDD_STATUS.md- Full status and action plan
✨ Two-Phase Execution:
- Bundle-time: Macros execute during bundling
- Runtime: Host functions and Closure constructor
✨ Separation of Concerns:
core.ts= Macro system types (bundle-time)host.ts= Runtime functions (implemented in Rust)
✨ Type Safety:
- Full TypeScript types with JSDoc
- Generic
Closure<T>for type inference declarefor host functions (external implementation)
✨ Flexibility:
- Closure constructor accepts both Map and plain objects
- Safety check: createMacro throws if called at runtime
The bundler needs to:
-
Resolve "funee" imports
- Recognize "funee" as virtual module
- Point to
funee-lib/index.ts
-
Bundle funee-lib code
- Include Closure constructor in output
- Include createMacro function
- Link host functions to native ops
-
Execute macros
- Detect createMacro definitions
- Execute macro functions at bundle time
- Replace call sites with transformed AST
- funee standard library created and documented
- E2E tests written following TDD workflow
- Test fixtures created
- WIP macro implementation moved to
.wip/ - Clean commit history
- Tests cannot run yet (compilation issues with WIP code)
- Need clean Rust build
- Clean build environment (
cargo clean && cargo build --release) - Run tests to verify they fail (
cd tests && npm test) - Implement bundler support for "funee" imports
- Make tests pass one by one
- Commit after each passing test
Create funee runtime library with core types
- Add funee-lib/ directory with standard library structure
- Core types: Closure, CanonicalName, createMacro
- Host function declarations: log, debug
- Comprehensive documentation (README + design doc)
Files:
- funee-lib/core.ts
- funee-lib/host.ts
- funee-lib/index.ts
- funee-lib/package.json
- funee-lib/README.md
- funee-lib/FUNEE_LIB_DESIGN.md
Add E2E tests for funee standard library (TDD Step 1)
- Created 8 E2E tests in tests/cli.test.ts
- Created fixture files in tests/fixtures/funee-lib/
- Tests cover: type imports, Closure constructor, host functions, createMacro
- Temporarily disabled WIP macro implementation
Files:
- tests/cli.test.ts (added funee standard library test suite)
- tests/fixtures/funee-lib/*.ts (8 test fixtures)
- src/execution_request.rs (commented out WIP modules)
- src/execution_request/source_graph.rs (commented out WIP uses)
- TDD_STATUS.md (workflow documentation)
funee/
├── funee-lib/ # Standard library
│ ├── core.ts # Macro types
│ ├── host.ts # Host function declarations
│ ├── index.ts # Main export
│ ├── package.json # Package metadata
│ ├── README.md # User docs
│ └── FUNEE_LIB_DESIGN.md # Architecture
├── tests/
│ ├── cli.test.ts # E2E tests (NEW: funee lib suite)
│ └── fixtures/
│ └── funee-lib/ # Test fixtures (8 files)
├── TDD_STATUS.md # TDD workflow status
└── COMPLETION_SUMMARY.md # This file
To continue this work:
- Read TDD_STATUS.md for current state and next actions
- Build and run tests:
cd ~/clawd/agents/riff/repos/funee cargo clean cargo build --release cd tests && npm test -- --run
- Expect failures - this is correct per TDD workflow
- Implement bundler support:
- Start with
import-log.ts(simplest) - Update
load_module_declaration.rs - Make test pass
- Move to next test
- Start with
- Commit after each passing test
- Design:
funee-lib/FUNEE_LIB_DESIGN.md - TDD Status:
TDD_STATUS.md - Tests:
tests/cli.test.ts(line 323+) - Fixtures:
tests/fixtures/funee-lib/ - Reference:
PLAYBOOK.md(TDD workflow)
Summary: ✅ Library created, tests written, ready for implementation phase.