Skip to content

feat: Add base44 logs command - #193

Closed
ozsay wants to merge 14 commits into
mainfrom
logs-commands
Closed

feat: Add base44 logs command#193
ozsay wants to merge 14 commits into
mainfrom
logs-commands

Conversation

@ozsay

@ozsay ozsay commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Note

Description

Adds a unified base44 logs command that fetches and displays both app audit logs (workspace events like entity changes, deployments, user actions) and function runtime logs (console output from Deno Deploy) in a single time-sorted view. Supports filtering by function name, log level, time range, with pagination and JSON output for scripting.

Related Issue

None

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Added src/core/logs/ module with fetchAuditLogs() API and Zod schemas for workspace audit events
  • Extended src/core/resources/function/ with fetchFunctionLogs() to retrieve runtime console logs via Deno Deploy proxy
  • Implemented base44 logs CLI command with filtering options: --function, --level, --since, --until, -n/--limit, --order, --json
  • Smart message formatting for 15+ audit event types (entities, functions, users, auth, access, automation, integrations, agents)
  • Automatic function discovery from project config when --function not specified
  • Human-readable table output with color-coded log levels, timestamps, and line wrapping
  • Added comprehensive test suite (13 test cases) covering all filtering scenarios and error cases
  • Extended testkit with mockAppInfo, mockAuditLogs, mockFunctionLogs API mocks

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated AGENTS.md if I made architectural changes

Additional Notes

Tests are currently pending in CI. The implementation follows existing patterns for commands (factory functions with CLIContext), API clients (authenticated base44Client), and resource modules. Level filtering uses semantic mapping: info maps to successful audit events, error to failures, while debug/warn skip audit logs entirely and only show function logs at those levels.


🤖 Generated by Claude | 2026-02-08 20:15 UTC

@github-actions

github-actions Bot commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.28-pr.193.5a0ab06

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.0.28-pr.193.5a0ab06"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.28-pr.193.5a0ab06"
  }
}

Preview published to npm registry — try new features instantly!

@claude

claude Bot commented Feb 4, 2026

Copy link
Copy Markdown

Code review

Found 1 issue to address:

CLAUDE.md Documentation Missing

The PR adds a new logs/ module under src/core/ with schema, API, and core functionality, but CLAUDE.md is not updated to document this architectural change.

CLAUDE.md Rule (line 659):

"Keep AGENTS.md updated - Update this file when architecture changes"

What needs updating:

  1. Folder structure section (lines 32-140) should include the new logs/ module:

    ├── core/
    │   ├── logs/                 # Audit logs (NEW)
    │   │   ├── schema.ts         # Zod schemas for audit log types
    │   │   ├── api.ts            # API functions for fetching logs
    │   │   └── index.ts
    
  2. Module documentation - Consider adding a "Logs Module" section similar to the Site Module documentation that explains:

    • Architecture overview
    • Key functions (fetchAuditLogs(), getWorkspaceId())
    • Workspace-level vs app-level logs
    • CLI command usage

This documentation helps AI agents understand the logs architecture when working on related features.

@ozsay ozsay changed the title Add base44 logs command feat: Add base44 logs command Feb 4, 2026
@claude

claude Bot commented Feb 4, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@claude

claude Bot commented Feb 4, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

The PR correctly implements the base44 logs command following all established patterns in the codebase.

@ozsay
ozsay marked this pull request as draft February 5, 2026 08:06
ozsay and others added 12 commits February 8, 2026 17:10
- Shorten timestamp to readable format (YYYY-MM-DD HH:MM:SS)
- Adjust column widths for better alignment
- Dim the timestamp for visual hierarchy

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@ozsay
ozsay marked this pull request as ready for review February 8, 2026 15:28
);

// Filter by level if specified (API doesn't support level filtering)
const filteredLogs = filters.level

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass this to the API

}

// Sort by time (respecting order option)
const order = options.order?.toUpperCase() === "ASC" ? 1 : -1;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLI should be stupid as possible, if we can get this form BE its best

@dor-chaouat dor-chaouat moved this from Backlog to In review in CLI Development Feb 9, 2026
@dor-chaouat dor-chaouat moved this from In review to In progress in CLI Development Feb 9, 2026
@ozsay ozsay added the invalid This doesn't seem right label Feb 11, 2026
@kfirstri

Copy link
Copy Markdown
Collaborator

Newer PR #225

@kfirstri kfirstri closed this Feb 12, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Done in CLI Development Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This doesn't seem right

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants