Skip to content

Commit 72ce95e

Browse files
authored
Merge pull request #13 from bulgogi-whopper/feat/list-command
Feat/list command
2 parents 4b450bd + 52d1ca0 commit 72ce95e

21 files changed

+12462
-12
lines changed

.kiro/specs/taptik-list-command/design.md

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Requirements Document
2+
3+
## Introduction
4+
5+
The ListCommand feature provides users with the ability to query and display available configuration packages from the Taptik cloud storage. This module enables users to discover, search, and explore configurations uploaded by themselves and other users through a simple CLI interface. The feature serves as the primary discovery mechanism for the Taptik ecosystem, focusing on essential listing functionality with basic filtering and sorting capabilities.
6+
7+
## Requirements
8+
9+
### Requirement 1
10+
11+
**User Story:** As a CLI user, I want to view a list of available configuration packages from the cloud, so that I can discover and explore configurations that I might want to download and use.
12+
13+
#### Acceptance Criteria
14+
15+
1. WHEN I run `taptik list` THEN the system SHALL display a table of available public configuration packages
16+
2. WHEN displaying the list THEN the system SHALL show ID, Title, Created date, Size, and Access level for each configuration
17+
3. WHEN no configurations are available THEN the system SHALL display a helpful message indicating the empty state
18+
4. WHEN the list is long THEN the system SHALL limit results to 20 items by default
19+
5. IF I am not authenticated THEN the system SHALL only show public configurations
20+
21+
### Requirement 2
22+
23+
**User Story:** As a CLI user, I want to filter configuration packages by title, so that I can quickly find configurations relevant to my needs.
24+
25+
#### Acceptance Criteria
26+
27+
1. WHEN I use `--filter <query>` THEN the system SHALL search in configuration titles
28+
2. WHEN the filter matches configurations THEN the system SHALL display only matching results
29+
3. WHEN the filter matches no configurations THEN the system SHALL display "No configurations found matching your filter"
30+
4. WHEN I provide an empty filter THEN the system SHALL treat it as no filter applied
31+
5. IF the filter query contains special characters THEN the system SHALL handle them safely
32+
33+
### Requirement 3
34+
35+
**User Story:** As a CLI user, I want to sort configuration packages by different criteria, so that I can view them in my preferred order.
36+
37+
#### Acceptance Criteria
38+
39+
1. WHEN I use `--sort date` THEN the system SHALL sort configurations by creation date (newest first)
40+
2. WHEN I use `--sort name` THEN the system SHALL sort configurations alphabetically by title
41+
3. WHEN I don't specify sort THEN the system SHALL default to date sorting
42+
4. IF I provide an invalid sort option THEN the system SHALL show an error with valid options
43+
44+
### Requirement 4
45+
46+
**User Story:** As a CLI user, I want to control the number of results displayed, so that I can manage the output according to my needs.
47+
48+
#### Acceptance Criteria
49+
50+
1. WHEN I use `--limit <n>` THEN the system SHALL display at most n configurations
51+
2. WHEN I don't specify a limit THEN the system SHALL default to 20 results
52+
3. WHEN I specify a limit of 0 THEN the system SHALL show an error
53+
4. WHEN I specify a limit greater than 100 THEN the system SHALL cap it at 100
54+
5. IF the available configurations are fewer than the limit THEN the system SHALL show all available configurations
55+
56+
### Requirement 5
57+
58+
**User Story:** As an authenticated user, I want to view configurations that I have liked, so that I can easily access my favorite configurations.
59+
60+
#### Acceptance Criteria
61+
62+
1. WHEN I run `taptik list liked` THEN the system SHALL display configurations I have liked
63+
2. WHEN I am not authenticated THEN the system SHALL prompt me to log in first
64+
3. WHEN I have no liked configurations THEN the system SHALL display "You haven't liked any configurations yet"
65+
4. WHEN displaying liked configurations THEN the system SHALL use the same table format as regular list
66+
5. IF there's an error fetching liked configurations THEN the system SHALL show a clear error message
67+
68+
### Requirement 6
69+
70+
**User Story:** As a developer, I want the list command to handle errors gracefully and provide clear feedback, so that I can understand and resolve any issues.
71+
72+
#### Acceptance Criteria
73+
74+
1. WHEN there's a network error THEN the system SHALL display "Unable to connect to Taptik cloud. Please check your internet connection."
75+
2. WHEN there's an authentication error THEN the system SHALL display "Authentication failed. Please run 'taptik login' first."
76+
3. WHEN there's a server error THEN the system SHALL display "Taptik cloud is temporarily unavailable. Please try again later."
77+
4. WHEN an invalid option is provided THEN the system SHALL show command help with valid options
78+
5. IF any error occurs THEN the system SHALL exit with appropriate error code (non-zero)
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Implementation Plan
2+
3+
- [x] 1. Create data models and interfaces for configuration listing
4+
- Create ConfigBundle model interface with all required fields (id, title, createdAt, size, accessLevel)
5+
- Create DisplayConfiguration interface for formatted CLI display
6+
- Create ListOptions interface for command options (filter, sort, limit)
7+
- Create ConfigurationListResult interface for service responses
8+
- _Requirements: 1.2, 2.1, 3.1, 4.1_
9+
10+
- [x] 2. Implement ListService for business logic
11+
- Create ListService class in src/modules/info/services/list.service.ts
12+
- Implement listConfigurations method with filtering, sorting, and pagination
13+
- Implement listLikedConfigurations method for authenticated users
14+
- Add private helper methods for filtering by title, sorting, and validation
15+
- _Requirements: 1.1, 2.1, 2.2, 3.1, 3.2, 4.1, 4.2, 5.1_
16+
17+
- [x] 3. Create ListCommand for CLI interface
18+
- Create ListCommand class in src/modules/info/commands/list.command.ts
19+
- Implement command options parsing (--filter, --sort, --limit)
20+
- Add subcommand support for "liked" configurations
21+
- Implement table formatting for configuration display
22+
- Add proper error handling with specific error messages
23+
- _Requirements: 1.1, 1.2, 1.3, 2.1, 2.3, 3.1, 3.3, 4.1, 4.3, 4.4, 5.1, 5.3, 6.4_
24+
25+
- [x] 4. Implement Supabase database integration
26+
- Add database query methods to ListService for public configurations
27+
- Implement liked configurations query with user authentication
28+
- Add proper error handling for network, authentication, and server errors
29+
- Implement query filtering and sorting at database level
30+
- _Requirements: 1.1, 1.5, 5.1, 5.2, 6.1, 6.2, 6.3_
31+
32+
- [x] 5. Add input validation and error handling
33+
- Implement validation for sort options (date/name only)
34+
- Add limit validation (1-100 range with default 20)
35+
- Implement specific error messages for different failure scenarios
36+
- Add proper exit codes for different error types
37+
- _Requirements: 3.3, 4.3, 4.4, 4.5, 6.1, 6.2, 6.3, 6.4, 6.5_
38+
39+
- [x] 6. Implement table formatting and display logic
40+
- Create table formatter with columns: ID, Title, Created, Size, Access
41+
- Implement empty state messages for different scenarios
42+
- Add proper date formatting and size display
43+
- Implement result limiting and pagination display
44+
- _Requirements: 1.2, 1.3, 1.4, 2.3, 4.5, 5.3_
45+
46+
- [x] 7. Update InfoModule to include ListCommand and ListService
47+
- Add ListCommand and ListService to InfoModule providers
48+
- Export ListService for potential use by other modules
49+
- Ensure proper dependency injection setup
50+
- _Requirements: All requirements (module integration)_
51+
52+
- [x] 8. Write comprehensive unit tests
53+
- Create unit tests for ListService with mocked Supabase client
54+
- Create unit tests for ListCommand with mocked ListService
55+
- Test all error scenarios and edge cases
56+
- Test filtering, sorting, and pagination logic
57+
- _Requirements: All requirements (quality assurance)_
58+
59+
- [x] 9. Write integration tests
60+
- Create integration tests for end-to-end list command execution
61+
- Test authentication flow for liked configurations
62+
- Test database integration with real Supabase client
63+
- Test CLI output formatting and error handling
64+
- _Requirements: All requirements (end-to-end validation)_
65+
66+
- [x] 10. Update CLI registration and help documentation
67+
- Register ListCommand in the main CLI application
68+
- Update help text and command documentation
69+
- Ensure proper command discovery and execution
70+
- _Requirements: 6.4 (command help and options)_

CLI_GUIDE.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,78 @@ npm run cli -- --help
3737
| `build:test` | Test build functionality | `npm run build:test` |
3838
| `test:cli` | Run CLI integration tests | `npm run test:cli` |
3939

40+
## 📋 List Command Deep Dive
41+
42+
### Overview
43+
44+
The list command provides discovery and exploration of configuration packages stored in the Taptik cloud. It allows users to browse, filter, and sort available configurations through an intuitive command-line interface.
45+
46+
### Basic Usage
47+
48+
```bash
49+
# List all public configurations
50+
npm run cli -- list
51+
52+
# Filter configurations by title
53+
npm run cli -- list --filter "frontend"
54+
npm run cli -- list --filter "typescript"
55+
56+
# Sort configurations
57+
npm run cli -- list --sort date # Sort by creation date (default)
58+
npm run cli -- list --sort name # Sort alphabetically by title
59+
60+
# Limit results
61+
npm run cli -- list --limit 10 # Show 10 results
62+
npm run cli -- list --limit 50 # Show 50 results (max: 100)
63+
64+
# Combine options
65+
npm run cli -- list --filter "react" --sort name --limit 20
66+
```
67+
68+
### Subcommands
69+
70+
#### Liked Configurations
71+
72+
```bash
73+
# List configurations you've liked (requires authentication)
74+
npm run cli -- list liked
75+
npm run cli -- list liked --sort date --limit 10
76+
```
77+
78+
### Command Options
79+
80+
| Option | Description | Default | Example |
81+
|--------|-------------|---------|---------|
82+
| `--filter <query>` | Filter by configuration title | None | `--filter "frontend"` |
83+
| `--sort <field>` | Sort by date or name | `date` | `--sort name` |
84+
| `--limit <n>` | Limit results (1-100) | `20` | `--limit 50` |
85+
86+
### Output Format
87+
88+
The list command displays configurations in a table format:
89+
90+
```
91+
ID Title Created Size Access
92+
─────────────────────────────────────────────────────────────
93+
abc12345 Frontend React Setup 2 days ago 2.3MB Public
94+
def67890 TypeScript Backend 1 week ago 1.8MB Public
95+
ghi11121 Full Stack Template 3 days ago 4.1MB Public
96+
```
97+
98+
### Error Handling
99+
100+
The list command provides specific error messages for different scenarios:
101+
102+
- **Network Error**: "Unable to connect to Taptik cloud. Please check your internet connection."
103+
- **Authentication Error**: "Authentication failed. Please run 'taptik login' first."
104+
- **Server Error**: "Taptik cloud is temporarily unavailable. Please try again later."
105+
- **Invalid Options**: Shows help with valid options
106+
107+
### Authentication Requirements
108+
109+
- **Public listings**: No authentication required
110+
- **Liked configurations**: Requires authentication with `taptik login`
111+
40112
## 🏗️ Build Command Deep Dive
41113

42114
### Architecture Overview
@@ -117,6 +189,12 @@ npm run cli -- build --platform kiro --output ./dist/taptik-config --quiet
117189
npm run cli -- build --categories personal # User context only
118190
npm run cli -- build --categories project # Project context only
119191
npm run cli -- build --categories prompts # Templates only
192+
193+
# 6. List available configurations
194+
npm run cli -- list # List public configurations
195+
npm run cli -- list --filter "frontend" # Filter by title
196+
npm run cli -- list --sort name --limit 50 # Sort and limit results
197+
npm run cli -- list liked # List liked configurations (requires auth)
120198
```
121199

122200
### Advanced Options

README.md

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,16 +262,73 @@ taptik pull --latest --target cursor
262262
taptik pull --dry-run # Preview without applying
263263
```
264264

265+
### List Command
266+
267+
The `list` command helps you discover and explore configuration packages available in the Taptik cloud.
268+
269+
#### Basic Usage
270+
271+
```bash
272+
# List all public configurations
273+
taptik list
274+
275+
# Filter configurations by title
276+
taptik list --filter "frontend"
277+
taptik list --filter "typescript setup"
278+
279+
# Sort configurations
280+
taptik list --sort date # Sort by creation date (default)
281+
taptik list --sort name # Sort alphabetically by title
282+
283+
# Limit number of results
284+
taptik list --limit 10 # Show 10 results
285+
taptik list --limit 50 # Show up to 50 results (max: 100)
286+
287+
# Combine options for precise discovery
288+
taptik list --filter "react" --sort name --limit 20
289+
```
290+
291+
#### Subcommands
292+
293+
```bash
294+
# List configurations you've liked (requires authentication)
295+
taptik list liked
296+
taptik list liked --sort date --limit 10
297+
```
298+
299+
#### Command Options
300+
301+
| Option | Description | Default | Valid Values |
302+
|--------|-------------|---------|--------------|
303+
| `--filter <query>` | Filter by configuration title | None | Any string |
304+
| `--sort <field>` | Sort results | `date` | `date`, `name` |
305+
| `--limit <n>` | Limit number of results | `20` | 1-100 |
306+
307+
#### Output Format
308+
309+
Results are displayed in a clean table format showing:
310+
- **ID**: Short identifier for the configuration
311+
- **Title**: Configuration name/title
312+
- **Created**: When the configuration was created (relative time)
313+
- **Size**: File size of the configuration package
314+
- **Access**: Whether the configuration is Public or Private
315+
316+
#### Authentication
317+
318+
- **Public listings**: No authentication required
319+
- **Liked configurations**: Requires login with `taptik login`
320+
265321
### Information & Discovery
266322

267323
```bash
268324
# Show current status
269325
taptik info
270326

271327
# List available configurations
272-
taptik list
273-
taptik list --filter "typescript"
274-
taptik list --sort date --limit 10
328+
taptik list # List all public configurations
329+
taptik list --filter "typescript" # Filter by title
330+
taptik list --sort name --limit 10 # Sort alphabetically, limit results
331+
taptik list liked # List your liked configurations (requires auth)
275332

276333
# Version information
277334
taptik --version

0 commit comments

Comments
 (0)