@brainfile/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +277 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +58 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/add.d.ts +11 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +120 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/lint.d.ts +8 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +306 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/list.d.ts +8 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +136 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/move.d.ts +8 -0
- package/dist/commands/move.d.ts.map +1 -0
- package/dist/commands/move.js +133 -0
- package/dist/commands/move.js.map +1 -0
- package/dist/commands/template.d.ts +11 -0
- package/dist/commands/template.d.ts.map +1 -0
- package/dist/commands/template.js +167 -0
- package/dist/commands/template.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@brainfile/cli` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial CLI implementation
|
|
12
|
+
- `brainfile template` command
|
|
13
|
+
- `brainfile add` command
|
|
14
|
+
- `brainfile move` command
|
|
15
|
+
- `brainfile list` command
|
|
16
|
+
- `brainfile lint` command
|
|
17
|
+
- Colored terminal output
|
|
18
|
+
- Full test coverage
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
### Deprecated
|
|
23
|
+
|
|
24
|
+
### Removed
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
### Security
|
|
29
|
+
|
|
30
|
+
## [0.1.0] - TBD
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
- Initial public release
|
|
34
|
+
- Command-line interface for Brainfile management
|
|
35
|
+
- Integration with @brainfile/core
|
|
36
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# @brainfile/cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for Brainfile task management. Manage your tasks from the terminal with ease.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @brainfile/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or use directly from the repo:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cd packages/brainfile-cli
|
|
15
|
+
npm install
|
|
16
|
+
npm run build
|
|
17
|
+
node dist/cli.js --help
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### List Tasks
|
|
23
|
+
|
|
24
|
+
Display all tasks from your brainfile.md file with colored output:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
brainfile list
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Options:**
|
|
31
|
+
- `-f, --file <path>` - Path to brainfile.md file (default: `brainfile.md`)
|
|
32
|
+
- `-c, --column <name>` - Filter by column (e.g., `todo`, `in-progress`, `done`)
|
|
33
|
+
- `-t, --tag <name>` - Filter by tag
|
|
34
|
+
|
|
35
|
+
**Examples:**
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# List all tasks
|
|
39
|
+
brainfile list
|
|
40
|
+
|
|
41
|
+
# List tasks from a specific file
|
|
42
|
+
brainfile list --file ./project/brainfile.md
|
|
43
|
+
|
|
44
|
+
# List only tasks in the "in-progress" column
|
|
45
|
+
brainfile list --column in-progress
|
|
46
|
+
|
|
47
|
+
# List tasks with a specific tag
|
|
48
|
+
brainfile list --tag bug
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Add Task
|
|
52
|
+
|
|
53
|
+
Create a new task and add it to a column:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
brainfile add --title "Task title"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Options:**
|
|
60
|
+
- `-f, --file <path>` - Path to brainfile.md file (default: `brainfile.md`)
|
|
61
|
+
- `-c, --column <name>` - Column to add task to (default: `todo`)
|
|
62
|
+
- `-t, --title <text>` - Task title (required)
|
|
63
|
+
- `-d, --description <text>` - Task description
|
|
64
|
+
- `-p, --priority <level>` - Priority level (`low`, `medium`, `high`)
|
|
65
|
+
- `--tags <tags>` - Comma-separated tags
|
|
66
|
+
|
|
67
|
+
**Examples:**
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Add a simple task
|
|
71
|
+
brainfile add --title "Fix login bug"
|
|
72
|
+
|
|
73
|
+
# Add a task with full details
|
|
74
|
+
brainfile add \
|
|
75
|
+
--title "Implement user authentication" \
|
|
76
|
+
--description "Add JWT-based auth to the API" \
|
|
77
|
+
--priority high \
|
|
78
|
+
--tags "backend,security" \
|
|
79
|
+
--column in-progress
|
|
80
|
+
|
|
81
|
+
# Add to a specific column
|
|
82
|
+
brainfile add --title "Review PR #123" --column review
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Move Task
|
|
86
|
+
|
|
87
|
+
Move a task from one column to another:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
brainfile move --task <task-id> --column <target-column>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Options:**
|
|
94
|
+
- `-f, --file <path>` - Path to brainfile.md file (default: `brainfile.md`)
|
|
95
|
+
- `-t, --task <id>` - Task ID to move (required)
|
|
96
|
+
- `-c, --column <name>` - Target column name or ID (required)
|
|
97
|
+
|
|
98
|
+
**Examples:**
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Move task to in-progress
|
|
102
|
+
brainfile move --task task-4 --column in-progress
|
|
103
|
+
|
|
104
|
+
# Move task to done
|
|
105
|
+
brainfile move --task task-123 --column done
|
|
106
|
+
|
|
107
|
+
# Move using column ID
|
|
108
|
+
brainfile move --task task-456 --column review
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Lint and Auto-fix
|
|
112
|
+
|
|
113
|
+
Validate your brainfile.md syntax and automatically fix common issues:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
brainfile lint
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Options:**
|
|
120
|
+
- `-f, --file <path>` - Path to brainfile.md file (default: `brainfile.md`)
|
|
121
|
+
- `--fix` - Automatically fix issues when possible
|
|
122
|
+
- `--check` - Exit with error code if issues found (useful for CI/CD)
|
|
123
|
+
|
|
124
|
+
**What it checks:**
|
|
125
|
+
- YAML syntax errors
|
|
126
|
+
- Unquoted strings containing colons
|
|
127
|
+
- Duplicate column IDs
|
|
128
|
+
- Board structure validation
|
|
129
|
+
- Missing required fields
|
|
130
|
+
|
|
131
|
+
**Examples:**
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Check for issues
|
|
135
|
+
brainfile lint
|
|
136
|
+
|
|
137
|
+
# Check and automatically fix issues
|
|
138
|
+
brainfile lint --fix
|
|
139
|
+
|
|
140
|
+
# Use in CI/CD (exits with error code if issues found)
|
|
141
|
+
brainfile lint --check
|
|
142
|
+
|
|
143
|
+
# Check a specific file
|
|
144
|
+
brainfile lint --file ./project/brainfile.md --fix
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Auto-fixable issues:**
|
|
148
|
+
- Unquoted strings with colons (adds quotes automatically)
|
|
149
|
+
|
|
150
|
+
**Detection-only issues:**
|
|
151
|
+
- Duplicate column IDs
|
|
152
|
+
- Structural validation errors
|
|
153
|
+
- YAML syntax errors
|
|
154
|
+
|
|
155
|
+
### Template Management
|
|
156
|
+
|
|
157
|
+
List available templates and create tasks from templates:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# List all available templates
|
|
161
|
+
brainfile template --list
|
|
162
|
+
|
|
163
|
+
# Create task from template
|
|
164
|
+
brainfile template --use <template-id> --title "Task title"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Options:**
|
|
168
|
+
- `-f, --file <path>` - Path to brainfile.md file (default: `brainfile.md`)
|
|
169
|
+
- `-l, --list` - List all available templates
|
|
170
|
+
- `-u, --use <template-id>` - Create task from template
|
|
171
|
+
- `--title <text>` - Task title (required when using template)
|
|
172
|
+
- `--description <text>` - Task description (optional)
|
|
173
|
+
- `-c, --column <name>` - Column to add task to (default: `todo`)
|
|
174
|
+
|
|
175
|
+
**Built-in Templates:**
|
|
176
|
+
- `bug-report` - Bug tracking with steps to reproduce, environment details
|
|
177
|
+
- `feature-request` - Feature proposals with requirements and acceptance criteria
|
|
178
|
+
- `refactor` - Code refactoring tasks with analysis and testing steps
|
|
179
|
+
|
|
180
|
+
**Examples:**
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# List all templates
|
|
184
|
+
brainfile template --list
|
|
185
|
+
|
|
186
|
+
# Create a bug report
|
|
187
|
+
brainfile template --use bug-report --title "Login timeout on mobile"
|
|
188
|
+
|
|
189
|
+
# Create a feature request
|
|
190
|
+
brainfile template --use feature-request \
|
|
191
|
+
--title "Add dark mode support" \
|
|
192
|
+
--description "Users want dark mode" \
|
|
193
|
+
--column todo
|
|
194
|
+
|
|
195
|
+
# Create a refactor task
|
|
196
|
+
brainfile template --use refactor \
|
|
197
|
+
--title "Refactor authentication module" \
|
|
198
|
+
--column in-progress
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Features
|
|
202
|
+
|
|
203
|
+
### Colored Output
|
|
204
|
+
|
|
205
|
+
The CLI provides colorful, easy-to-read output:
|
|
206
|
+
- **Task IDs** - Gray
|
|
207
|
+
- **Titles** - White
|
|
208
|
+
- **High Priority** - Red
|
|
209
|
+
- **Medium Priority** - Yellow
|
|
210
|
+
- **Low Priority** - Blue
|
|
211
|
+
- **Tags** - Cyan
|
|
212
|
+
- **Templates** - Magenta
|
|
213
|
+
- **Subtask Progress** - Green (complete) or Yellow (incomplete)
|
|
214
|
+
|
|
215
|
+
### Smart Task IDs
|
|
216
|
+
|
|
217
|
+
Task IDs are automatically generated with a timestamp and random string to ensure uniqueness.
|
|
218
|
+
|
|
219
|
+
## Roadmap
|
|
220
|
+
|
|
221
|
+
### Completed ✓
|
|
222
|
+
- `brainfile list` - List and filter tasks
|
|
223
|
+
- `brainfile add` - Create new tasks
|
|
224
|
+
- `brainfile move` - Move tasks between columns
|
|
225
|
+
- `brainfile template` - Template management
|
|
226
|
+
- `brainfile lint` - Validate and auto-fix syntax
|
|
227
|
+
- Colored output and pretty-printing
|
|
228
|
+
- Binary compilation for distribution
|
|
229
|
+
|
|
230
|
+
### Future Enhancements
|
|
231
|
+
- `brainfile update` - Update existing tasks
|
|
232
|
+
- `brainfile delete` - Remove tasks
|
|
233
|
+
- Interactive mode for task creation
|
|
234
|
+
- Advanced filtering and search
|
|
235
|
+
- Task completion tracking
|
|
236
|
+
- Subtask management
|
|
237
|
+
|
|
238
|
+
## Development
|
|
239
|
+
|
|
240
|
+
### Using Make (Recommended)
|
|
241
|
+
|
|
242
|
+
From the project root:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Build the CLI (includes core library)
|
|
246
|
+
make build-cli
|
|
247
|
+
|
|
248
|
+
# Run the CLI with automatic build (fast dev shortcut)
|
|
249
|
+
make cli ARGS="list --file brainfile.md"
|
|
250
|
+
make cli ARGS="add --title 'New task' --priority high"
|
|
251
|
+
make cli ARGS="--help"
|
|
252
|
+
|
|
253
|
+
# Create standalone binaries for distribution
|
|
254
|
+
make build-cli-bin
|
|
255
|
+
|
|
256
|
+
# Clean all build artifacts
|
|
257
|
+
make clean
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Using npm directly
|
|
261
|
+
|
|
262
|
+
From the `packages/brainfile-cli` directory:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Install dependencies
|
|
266
|
+
npm install
|
|
267
|
+
|
|
268
|
+
# Build
|
|
269
|
+
npm run build
|
|
270
|
+
|
|
271
|
+
# Watch mode
|
|
272
|
+
npm run dev
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## License
|
|
276
|
+
|
|
277
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const list_1 = require("./commands/list");
|
|
6
|
+
const add_1 = require("./commands/add");
|
|
7
|
+
const move_1 = require("./commands/move");
|
|
8
|
+
const template_1 = require("./commands/template");
|
|
9
|
+
const lint_1 = require("./commands/lint");
|
|
10
|
+
const program = new commander_1.Command();
|
|
11
|
+
program
|
|
12
|
+
.name('brainfile')
|
|
13
|
+
.description('Command-line interface for Brainfile task management')
|
|
14
|
+
.version('0.1.0');
|
|
15
|
+
// Register commands
|
|
16
|
+
program
|
|
17
|
+
.command('list')
|
|
18
|
+
.description('List all tasks from brainfile.md')
|
|
19
|
+
.option('-f, --file <path>', 'Path to brainfile.md file', 'brainfile.md')
|
|
20
|
+
.option('-c, --column <name>', 'Filter by column')
|
|
21
|
+
.option('-t, --tag <name>', 'Filter by tag')
|
|
22
|
+
.action(list_1.listCommand);
|
|
23
|
+
program
|
|
24
|
+
.command('add')
|
|
25
|
+
.description('Add a new task')
|
|
26
|
+
.option('-f, --file <path>', 'Path to brainfile.md file', 'brainfile.md')
|
|
27
|
+
.option('-c, --column <name>', 'Column to add task to', 'todo')
|
|
28
|
+
.option('-t, --title <text>', 'Task title (required)')
|
|
29
|
+
.option('-d, --description <text>', 'Task description')
|
|
30
|
+
.option('-p, --priority <level>', 'Priority level (low, medium, high)')
|
|
31
|
+
.option('--tags <tags>', 'Comma-separated tags')
|
|
32
|
+
.action(add_1.addCommand);
|
|
33
|
+
program
|
|
34
|
+
.command('move')
|
|
35
|
+
.description('Move a task to a different column')
|
|
36
|
+
.option('-f, --file <path>', 'Path to brainfile.md file', 'brainfile.md')
|
|
37
|
+
.option('-t, --task <id>', 'Task ID to move (required)')
|
|
38
|
+
.option('-c, --column <name>', 'Target column name or ID (required)')
|
|
39
|
+
.action(move_1.moveCommand);
|
|
40
|
+
program
|
|
41
|
+
.command('template')
|
|
42
|
+
.description('Manage and use task templates')
|
|
43
|
+
.option('-f, --file <path>', 'Path to brainfile.md file', 'brainfile.md')
|
|
44
|
+
.option('-l, --list', 'List all available templates')
|
|
45
|
+
.option('-u, --use <template-id>', 'Create task from template')
|
|
46
|
+
.option('--title <text>', 'Task title (for template usage)')
|
|
47
|
+
.option('--description <text>', 'Task description (for template usage)')
|
|
48
|
+
.option('-c, --column <name>', 'Column to add task to', 'todo')
|
|
49
|
+
.action(template_1.templateCommand);
|
|
50
|
+
program
|
|
51
|
+
.command('lint')
|
|
52
|
+
.description('Validate and auto-fix brainfile.md syntax')
|
|
53
|
+
.option('-f, --file <path>', 'Path to brainfile.md file', 'brainfile.md')
|
|
54
|
+
.option('--fix', 'Automatically fix issues when possible')
|
|
55
|
+
.option('--check', 'Exit with error code if issues found (for CI/CD)')
|
|
56
|
+
.action(lint_1.lintCommand);
|
|
57
|
+
program.parse();
|
|
58
|
+
//# sourceMapp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,iBAAiB,EAAE,4BAA4B,CAAC;KACvD,MAAM,CAAC,qBAAqB,EAAE,qCAAqC,CAAC;KACpE,MAAM,CAAC,kBAAW,CAAC,CAAC;AAEvB,OAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,+BAA+B,CAAC;KAC5C,MAAM,CAAC,mBAAmB,EAAE,2BAA2B,EAAE,cAAc,CAAC;KACxE,MAAM,CAAC,YAAY,EAAE,8BAA8B,CAAC;KACpD,MAAM,CAAC,yBAAyB,EAAE,2BAA2B,CAAC;KAC9D,MAAM,CAAC,gBAAgB,EAAE,iCAAiC,CAAC;KAC3D,MAAM,CAAC,sBAAsB,EAAE,uCAAuC,CAAC;KACvE,MAAM,CAAC,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,CAAC;KAC9D,MAAM,CAAC,0BAAe,CAAC,CAAC;AAE3B,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,2CAA2C,CAAC;KACxD,MAAM,CAAC,mBAAmB,EAAE,2BAA2B,EAAE,cAAc,CAAC;KACxE,MAAM,CAAC,OAAO,EAAE,wCAAwC,CAAC;KACzD,MAAM,CAAC,SAAS,EAAE,kDAAkD,CAAC;KACrE,MAAM,CAAC,kBAAW,CAAC,CAAC;AAEvB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface AddOptions {
|
|
2
|
+
file: string;
|
|
3
|
+
column: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
priority?: 'low' | 'medium' | 'high';
|
|
7
|
+
tags?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function addCommand(options: AddOptions): void;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAKA,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,QA4F7C"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.addCommand = addCommand;
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const core_1 = require("@brainfile/core");
|
|
43
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
44
|
+
function addCommand(options) {
|
|
45
|
+
try {
|
|
46
|
+
// Validate required options
|
|
47
|
+
if (!options.title) {
|
|
48
|
+
console.error(chalk_1.default.red('Error: --title is required'));
|
|
49
|
+
console.log(chalk_1.default.gray('Usage: bangbang add --title "Task title" [options]'));
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
// Resolve file path
|
|
53
|
+
const filePath = path.resolve(options.file);
|
|
54
|
+
// Check if file exists
|
|
55
|
+
if (!fs.existsSync(filePath)) {
|
|
56
|
+
console.error(chalk_1.default.red(`Error: File not found: ${filePath}`));
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
// Read and parse the file
|
|
60
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
61
|
+
const result = core_1.Brainfile.parseWithErrors(content);
|
|
62
|
+
if (!result.board) {
|
|
63
|
+
console.error(chalk_1.default.red('Error: Failed to parse bangbang.md'));
|
|
64
|
+
if (result.error) {
|
|
65
|
+
console.error(chalk_1.default.red(result.error));
|
|
66
|
+
}
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
const board = result.board;
|
|
70
|
+
// Find the target column
|
|
71
|
+
const targetColumn = board.columns.find(col => col.id === options.column || col.title.toLowerCase() === options.column.toLowerCase());
|
|
72
|
+
if (!targetColumn) {
|
|
73
|
+
console.error(chalk_1.default.red(`Error: Column not found: ${options.column}`));
|
|
74
|
+
console.log(chalk_1.default.gray('Available columns:'));
|
|
75
|
+
board.columns.forEach(col => {
|
|
76
|
+
console.log(chalk_1.default.gray(` - ${col.id} (${col.title})`));
|
|
77
|
+
});
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
// Generate new task ID
|
|
81
|
+
const newTaskId = (0, core_1.generateTaskId)();
|
|
82
|
+
// Create new task
|
|
83
|
+
const newTask = {
|
|
84
|
+
id: newTaskId,
|
|
85
|
+
title: options.title,
|
|
86
|
+
};
|
|
87
|
+
// Add optional fields
|
|
88
|
+
if (options.description) {
|
|
89
|
+
newTask.description = options.description;
|
|
90
|
+
}
|
|
91
|
+
if (options.priority) {
|
|
92
|
+
newTask.priority = options.priority;
|
|
93
|
+
}
|
|
94
|
+
if (options.tags) {
|
|
95
|
+
newTask.tags = options.tags.split(',').map(t => t.trim());
|
|
96
|
+
}
|
|
97
|
+
// Add task to column
|
|
98
|
+
targetColumn.tasks.push(newTask);
|
|
99
|
+
// Serialize and write back
|
|
100
|
+
const updatedContent = core_1.Brainfile.serialize(board);
|
|
101
|
+
fs.writeFileSync(filePath, updatedContent, 'utf-8');
|
|
102
|
+
// Success message
|
|
103
|
+
console.log(chalk_1.default.green('✓ Task added successfully!'));
|
|
104
|
+
console.log('');
|
|
105
|
+
console.log(chalk_1.default.gray(` ID: ${newTaskId}`));
|
|
106
|
+
console.log(chalk_1.default.gray(` Title: ${options.title}`));
|
|
107
|
+
console.log(chalk_1.default.gray(` Column: ${targetColumn.title}`));
|
|
108
|
+
if (options.priority) {
|
|
109
|
+
console.log(chalk_1.default.gray(` Priority: ${options.priority}`));
|
|
110
|
+
}
|
|
111
|
+
if (options.tags) {
|
|
112
|
+
console.log(chalk_1.default.gray(` Tags: ${options.tags}`));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error(chalk_1.default.red('Error:'), error instanceof Error ? error.message : String(error));
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,gCA4FC;AA1GD,uCAAyB;AACzB,2CAA6B;AAC7B,0CAAkE;AAClE,kDAA0B;AAW1B,SAAgB,UAAU,CAAC,OAAmB;IAC5C,IAAI,CAAC;QACH,4BAA4B;QAC5B,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACnB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CAAC;YACvD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC,CAAC;YAC9E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,oBAAoB;QACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAE5C,uBAAuB;QACvB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,0BAA0B,QAAQ,EAAE,CAAC,CAAC,CAAC;YAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,0BAA0B;QAC1B,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,gBAAS,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;Q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