feat(telemetry): Integrate telemetry for expand-all, aggregate results
This commit implements AI usage telemetry for the `expand-all-tasks` command/tool and refactors its CLI output for clarity and consistency. Key Changes: 1. **Telemetry Integration for `expand-all-tasks` (Subtask 77.8):**\n - The `expandAllTasks` core logic (`scripts/modules/task-manager/expand-all-tasks.js`) now calls the `expandTask` function for each eligible task and collects the individual `telemetryData` returned.\n - A new helper function `_aggregateTelemetry` (in `utils.js`) is used to sum up token counts and costs from all individual expansions into a single `telemetryData` object for the entire `expand-all` operation.\n - The `expandAllTasksDirect` wrapper (`mcp-server/src/core/direct-functions/expand-all-tasks.js`) now receives and passes this aggregated `telemetryData` in the MCP response.\n - For CLI usage, `displayAiUsageSummary` is called once with the aggregated telemetry. 2. **Improved CLI Output for `expand-all`:**\n - The `expandAllTasks` core function now handles displaying a final "Expansion Summary" box (showing Attempted, Expanded, Skipped, Failed counts) directly after the aggregated telemetry summary.\n - This consolidates all summary output within the core function for better flow and removes redundant logging from the command action in `scripts/modules/commands.js`.\n - The summary box border is green for success and red if any expansions failed. 3. **Code Refinements:**\n - Ensured `chalk` and `boxen` are imported in `expand-all-tasks.js` for the new summary box.\n - Minor adjustments to logging messages for clarity.
This commit is contained in:
@@ -42,3 +42,23 @@ Testing should verify that the refactoring maintains identical functionality whi
|
||||
4. Documentation:
|
||||
- Verify documentation is updated to reflect the new prompt organization
|
||||
- Confirm the index.js export pattern works as expected for importing prompts
|
||||
|
||||
# Subtasks:
|
||||
## 1. Create prompts directory structure [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create a centralized 'prompts' directory with appropriate subdirectories for different prompt categories
|
||||
### Details:
|
||||
Create a 'prompts' directory at the project root. Within this directory, create subdirectories based on functional categories (e.g., 'core', 'agents', 'utils'). Add an index.js file in each subdirectory to facilitate imports. Create a root index.js file that re-exports all prompts for easy access.
|
||||
|
||||
## 2. Extract prompts into individual files [pending]
|
||||
### Dependencies: 48.1
|
||||
### Description: Identify all hardcoded prompts in the codebase and extract them into individual files in the prompts directory
|
||||
### Details:
|
||||
Search through the codebase for all hardcoded prompt strings. For each prompt, create a new file in the appropriate subdirectory with a descriptive name (e.g., 'taskBreakdownPrompt.js'). Format each file to export the prompt string as a constant. Add JSDoc comments to document the purpose and expected usage of each prompt.
|
||||
|
||||
## 3. Update functions to import prompts [pending]
|
||||
### Dependencies: 48.1, 48.2
|
||||
### Description: Modify all functions that use hardcoded prompts to import them from the centralized structure
|
||||
### Details:
|
||||
For each function that previously used a hardcoded prompt, add an import statement to pull in the prompt from the centralized structure. Test each function after modification to ensure it still works correctly. Update any tests that might be affected by the refactoring. Create a pull request with the changes and document the new prompt structure in the project documentation.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user