taskninja 1.0.0 → 1.0.2
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/README.md +233 -0
- package/app.js +6 -3
- package/package.json +4 -2
package/README.md
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# TaskNinja
|
|
2
|
+
|
|
3
|
+
 <!-- Optional: Replace with actual logo if available -->
|
|
4
|
+
|
|
5
|
+
A simple Command-Line Interface (CLI) application built with JavaScript for managing your to-do tasks. It allows users to add, list, update, and delete tasks interactively, with features like status tracking, priority levels, due dates, and descriptions. Tasks are stored in a local JSON file for persistence.
|
|
6
|
+
|
|
7
|
+
This project is designed for developers and users who prefer a lightweight, terminal-based task manager without the need for complex setups or databases.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Add Tasks**: Create new tasks with title, status (todo, in-progress, done), priority (low, medium, high), due date, and optional description.
|
|
12
|
+
- **List Tasks**: View all tasks or filter by status in a tabular format.
|
|
13
|
+
- **Update Tasks**: Change the status of existing tasks via interactive selection.
|
|
14
|
+
- **Delete Tasks**: Remove tasks with confirmation to prevent accidental deletion.
|
|
15
|
+
- **Persistent Storage**: Tasks are saved to a local `todos.json` file.
|
|
16
|
+
- **Interactive Prompts**: Uses Inquirer for user-friendly input.
|
|
17
|
+
- **Validation**: Ensures valid statuses, priorities, and date formats.
|
|
18
|
+
|
|
19
|
+
## Technologies Used
|
|
20
|
+
|
|
21
|
+
- **Node.js**: Runtime environment.
|
|
22
|
+
- **Commander**: For parsing command-line arguments and defining commands.
|
|
23
|
+
- **Inquirer**: For interactive CLI prompts.
|
|
24
|
+
- **fs/promises**: For asynchronous file system operations to handle task storage.
|
|
25
|
+
- **ECMAScript Modules (ESM)**: Modern JavaScript module system.
|
|
26
|
+
|
|
27
|
+
The application is written in pure JavaScript (ES6+), with no additional frameworks or databases required.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
### From npm
|
|
32
|
+
|
|
33
|
+
TaskNinja is published on npm as `taskninja`. Install it globally to use the CLI commands from anywhere:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install -g taskninja
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
After installation, you can run the CLI using the `dotask` command (as defined in `package.json`).
|
|
40
|
+
|
|
41
|
+
### From Source
|
|
42
|
+
|
|
43
|
+
1. Clone the repository:
|
|
44
|
+
```bash
|
|
45
|
+
git clone https://github.com/yourusername/taskninja.git
|
|
46
|
+
cd taskninja
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
2. Install dependencies:
|
|
50
|
+
```bash
|
|
51
|
+
npm install
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
3. Link the CLI globally (optional, for testing):
|
|
55
|
+
```bash
|
|
56
|
+
npm link
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
4. Run the application:
|
|
60
|
+
```bash
|
|
61
|
+
npm start
|
|
62
|
+
```
|
|
63
|
+
Or directly:
|
|
64
|
+
```bash
|
|
65
|
+
node app.js
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Usage
|
|
69
|
+
|
|
70
|
+
Run the CLI with the `dotask` command (after global installation) or `node app.js` from the source.
|
|
71
|
+
|
|
72
|
+
### Commands
|
|
73
|
+
|
|
74
|
+
- **Add a Task**:
|
|
75
|
+
```bash
|
|
76
|
+
dotask add
|
|
77
|
+
```
|
|
78
|
+
- This will prompt you interactively for title, status, priority, due date, and description.
|
|
79
|
+
- Example output: "Task added successfully!"
|
|
80
|
+
|
|
81
|
+
- **List Tasks**:
|
|
82
|
+
```bash
|
|
83
|
+
dotask list
|
|
84
|
+
```
|
|
85
|
+
- Lists all tasks in a table format.
|
|
86
|
+
- Optional filter by status: `dotask list --status todo` (or `-s todo`).
|
|
87
|
+
- Aliases: `dotask ls`.
|
|
88
|
+
|
|
89
|
+
- **Update a Task**:
|
|
90
|
+
```bash
|
|
91
|
+
dotask update
|
|
92
|
+
```
|
|
93
|
+
- Prompts to select a task by ID and update its status.
|
|
94
|
+
- Displays the updated task in a table.
|
|
95
|
+
- Aliases: `dotask up`.
|
|
96
|
+
|
|
97
|
+
- **Delete a Task**:
|
|
98
|
+
```bash
|
|
99
|
+
dotask delete
|
|
100
|
+
```
|
|
101
|
+
- Prompts to select a task by ID and confirm deletion.
|
|
102
|
+
- Aliases: `dotask del`.
|
|
103
|
+
|
|
104
|
+
- **Help**:
|
|
105
|
+
```bash
|
|
106
|
+
dotask --help
|
|
107
|
+
```
|
|
108
|
+
- Shows all available commands and options.
|
|
109
|
+
|
|
110
|
+
- **Version**:
|
|
111
|
+
```bash
|
|
112
|
+
dotask --version
|
|
113
|
+
```
|
|
114
|
+
- Displays the current version (1.0.0).
|
|
115
|
+
|
|
116
|
+
### Examples
|
|
117
|
+
|
|
118
|
+
1. Adding a task:
|
|
119
|
+
```
|
|
120
|
+
dotask add
|
|
121
|
+
```
|
|
122
|
+
- Follow prompts: Enter "Buy groceries" as title, select "todo" status, "medium" priority, "2024-12-31" due date, and "Milk, eggs, bread" as description.
|
|
123
|
+
|
|
124
|
+
2. Listing tasks filtered by status:
|
|
125
|
+
```
|
|
126
|
+
dotask list -s in-progress
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
3. Updating a task:
|
|
130
|
+
```
|
|
131
|
+
dotask update
|
|
132
|
+
```
|
|
133
|
+
- Select task ID from the list and choose new status (e.g., "done").
|
|
134
|
+
|
|
135
|
+
4. Deleting a task:
|
|
136
|
+
```
|
|
137
|
+
dotask delete
|
|
138
|
+
```
|
|
139
|
+
- Select task ID and confirm.
|
|
140
|
+
|
|
141
|
+
Tasks are stored in `./todos.json` relative to where the command is run. Ensure write permissions in the directory.
|
|
142
|
+
|
|
143
|
+
## Configuration
|
|
144
|
+
|
|
145
|
+
- **Task File**: Defaults to `./todos.json`. You can modify `TASKS_FILE` in `app.js` if needed.
|
|
146
|
+
- **Statuses**: Limited to "todo", "in-progress", "done".
|
|
147
|
+
- **Priorities**: Limited to "low", "medium", "high".
|
|
148
|
+
- **Due Date Format**: YYYY-MM-DD (validated during input).
|
|
149
|
+
|
|
150
|
+
No external configuration files are required.
|
|
151
|
+
|
|
152
|
+
## Development
|
|
153
|
+
|
|
154
|
+
To run in development mode:
|
|
155
|
+
```bash
|
|
156
|
+
npm run dev
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
This executes `node app.js` for quick testing.
|
|
160
|
+
|
|
161
|
+
### Scripts
|
|
162
|
+
|
|
163
|
+
- `npm start`: Runs the app.
|
|
164
|
+
- `npm test`: Placeholder for tests (currently errors out; add tests as needed).
|
|
165
|
+
|
|
166
|
+
## Contribution Guidelines
|
|
167
|
+
|
|
168
|
+
We welcome contributions to improve TaskNinja! Whether it's bug fixes, new features, or documentation enhancements, follow these steps:
|
|
169
|
+
|
|
170
|
+
### How to Contribute
|
|
171
|
+
|
|
172
|
+
1. **Fork the Repository**:
|
|
173
|
+
- Go to the [GitHub repo](https://github.com/yourusername/taskninja) and click "Fork".
|
|
174
|
+
|
|
175
|
+
2. **Clone Your Fork**:
|
|
176
|
+
```bash
|
|
177
|
+
git clone https://github.com/yourusername/taskninja.git
|
|
178
|
+
cd taskninja
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
3. **Create a Branch**:
|
|
182
|
+
- Use a descriptive name: `git checkout -b feature/new-feature` or `git checkout -b fix/bug-fix`.
|
|
183
|
+
|
|
184
|
+
4. **Make Changes**:
|
|
185
|
+
- Follow the existing code style (ESLint can be added later for consistency).
|
|
186
|
+
- Add or update tests if applicable.
|
|
187
|
+
- Ensure your code handles errors gracefully and maintains validation logic.
|
|
188
|
+
|
|
189
|
+
5. **Commit Changes**:
|
|
190
|
+
- Use clear commit messages: e.g., "feat: add search functionality" or "fix: resolve date validation issue".
|
|
191
|
+
- Reference issues if relevant: e.g., "Closes #123".
|
|
192
|
+
|
|
193
|
+
6. **Push to Your Fork**:
|
|
194
|
+
```bash
|
|
195
|
+
git push origin feature/new-feature
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
7. **Open a Pull Request (PR)**:
|
|
199
|
+
- Go to the original repo and click "New Pull Request".
|
|
200
|
+
- Provide a detailed description of your changes, including why they're needed and any relevant screenshots.
|
|
201
|
+
- Link to any related issues.
|
|
202
|
+
|
|
203
|
+
### Guidelines
|
|
204
|
+
|
|
205
|
+
- **Code Style**: Use consistent indentation (2 spaces), semicolons, and follow ES6+ best practices.
|
|
206
|
+
- **Testing**: Add unit tests using a framework like Jest if expanding features. Currently, no tests are implemented—contributions here are encouraged!
|
|
207
|
+
- **Dependencies**: Keep them minimal. Justify any new additions.
|
|
208
|
+
- **Features**: New commands or options should align with the simple CLI philosophy. Discuss major changes in an issue first.
|
|
209
|
+
- **Documentation**: Update README.md with any new features or changes.
|
|
210
|
+
- **Issues**: Check for existing issues before creating a new one. Use labels like "bug", "enhancement", or "question".
|
|
211
|
+
|
|
212
|
+
### Code of Conduct
|
|
213
|
+
|
|
214
|
+
- Be respectful and inclusive.
|
|
215
|
+
- No harassment or discrimination.
|
|
216
|
+
- Report issues to the maintainer (Mohamed Bakr).
|
|
217
|
+
|
|
218
|
+
By contributing, you agree that your contributions will be licensed under the ISC License.
|
|
219
|
+
|
|
220
|
+
## License
|
|
221
|
+
|
|
222
|
+
This project is licensed under the ISC License.
|
|
223
|
+
|
|
224
|
+
## Author
|
|
225
|
+
|
|
226
|
+
- **Mohamed Bakr** - Just a Developer - [GitHub Profile](https://github.com/MoBMoCaffeine)
|
|
227
|
+
|
|
228
|
+
## Acknowledgments
|
|
229
|
+
|
|
230
|
+
- Inspired by simple CLI tools like Todoist CLI.
|
|
231
|
+
- Thanks to the open-source community for libraries like Commander and Inquirer.
|
|
232
|
+
|
|
233
|
+
If you encounter issues or have suggestions, open an issue on GitHub!
|
package/app.js
CHANGED
|
@@ -161,15 +161,18 @@ program
|
|
|
161
161
|
console.log('No tasks found.');
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
// map all tasks to displayable objects
|
|
165
|
+
const tableData = tasks.map(task => ({
|
|
166
166
|
ID: task.id,
|
|
167
167
|
Title: task.title,
|
|
168
168
|
Status: task.status,
|
|
169
169
|
Priority: task.priority,
|
|
170
170
|
DueDate: task.dueDate,
|
|
171
171
|
Description: task.description || ''
|
|
172
|
-
}
|
|
172
|
+
}));
|
|
173
|
+
|
|
174
|
+
// display all tasks in table format
|
|
175
|
+
console.table(tableData);
|
|
173
176
|
});
|
|
174
177
|
|
|
175
178
|
// use command 'update' with task ID and action
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taskninja",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "a simple CLI application with JS as a (To-Do Application)",
|
|
5
5
|
"main": "app.js",
|
|
6
6
|
"type" : "module",
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"dev": "node app.js"
|
|
11
11
|
},
|
|
12
12
|
"bin" : {
|
|
13
|
-
"dotask": "./app.js"
|
|
13
|
+
"dotask": "./app.js",
|
|
14
|
+
"taskninja": "./app.js",
|
|
15
|
+
"tn": "./app.js"
|
|
14
16
|
},
|
|
15
17
|
"author": "Moahmed Bakr",
|
|
16
18
|
"license": "ISC",
|