Skip to content

feat(cli): Phase 1 - Core task and session commands#2

Open
therichardngai-wolf wants to merge 1 commit intotherichardngai-code:mainfrom
therichardngai-wolf:feat/cli-phase1
Open

feat(cli): Phase 1 - Core task and session commands#2
therichardngai-wolf wants to merge 1 commit intotherichardngai-code:mainfrom
therichardngai-wolf:feat/cli-phase1

Conversation

@therichardngai-wolf
Copy link
Contributor

Summary

Implements core CLI commands for task and session management.

New CLI Commands

Task Management

  • notecode task list — List tasks with filters (status, assignee, project)
  • notecode task get <id> — Get task details
  • notecode task create <title> — Create new task
  • notecode task update <id> — Update task (status, priority, title, description)

Session Management

  • notecode session list — List sessions with filters
  • notecode session get <id> — Get session details

Features

  • --json flag on all commands for AI-agent-friendly output
  • Proper error handling and user-friendly formatting
  • Table output for list commands

Part of CLI Enhancement Plan

See docs/CLI_ENHANCEMENT_PLAN.md for full roadmap.

Adds a command-line interface for NoteCode management:

Task commands:
- notecode task list [--status, --priority, --project, --assignee, --search, --json]
- notecode task get <id> [--json]
- notecode task create --title '...' [--description, --priority, --assignee, --project, ...]
- notecode task update <id> [--status, --priority, --title, ...]

Session commands:
- notecode session list [--task-id, --status, --limit, --json]
- notecode session status <id> [--json]
- notecode session get <id> [--json]

Features:
- All commands support --json flag for machine-readable output
- Colored, formatted output for human readability
- Calls REST API at http://localhost:41920
- Server start preserved: 'notecode' or 'notecode serve' starts the server
- Uses Commander.js for CLI parsing
Copy link
Owner

@therichardngai-code therichardngai-code left a comment

Choose a reason for hiding this comment

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

Review: Request Changes

Thank you for this CLI enhancement PR. The feature concept is solid and API integration is correct. However, there are code standard violations that need to be addressed before merge.


❌ Must Fix

1. JavaScript → TypeScript Required

All new files are .js but our code standards require TypeScript with strict mode:

cli/notecode.js → cli/notecode.ts
cli/src/api.js → cli/src/api.ts
cli/src/commands/session.js → cli/src/commands/session.ts
cli/src/commands/task.js → cli/src/commands/task.ts
cli/src/formatters.js → cli/src/formatters.ts

Reference: docs/code-standards.md - TypeScript strict mode required

2. File Size Limit Exceeded

cli/src/formatters.js is 282 lines but our limit is < 200 LOC.

Split into:

  • cli/src/formatters/task-formatters.ts
  • cli/src/formatters/session-formatters.ts
  • cli/src/formatters/colors.ts (shared ANSI codes)

Reference: docs/code-standards.md - "Target: < 200 LOC per file"


⚠️ Should Fix

3. Add Basic Tests

No test files included. Please add at least:

  • Unit tests for formatters
  • Integration test for API client (mock fetch)

4. Add Type Definitions

When converting to TypeScript, add proper types:

interface Task {
  id: string;
  title: string;
  status: TaskStatus;
  priority: TaskPriority | null;
  // ...
}

type TaskStatus = 'not-started' | 'in-progress' | 'review' | 'done' | 'cancelled' | 'archived';

✅ What's Good

  • Backward compatibility preserved (npx notecode still starts server)
  • All API endpoints verified to exist
  • Proper error handling for connection refused
  • --json flag for AI agent integration
  • Clean separation (client CLI vs server code)

Please address the Must Fix items and resubmit. Happy to re-review once updated.

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