Feb 09, 2025
I build this project as a fun way to display the tasks I need to do for the day every morning. The script generates a nice ASCI monthly calendar with the number of tasks due/done, highlights important days, and provides a motivational message at the end. If you want to use this project, you'll first need to set up a PostgreSQL database that stores your tasks with the schema found in this README. I use n8n to automate pulling my tasks from the Google Tasks API every 20 seconds and save them to the PostgreSQL database. At some point, I'll write a blog post about how I set up n8n to do this. :)
Check it out on Github here: https://github.com/LucasFerguson/morning-terminal-script
Dark+ Demo in Windows TerminalRetro Demo in Windows Terminal
⁵
, ²
).env.js
.tasks
table is provided below.git clone <repository-url>cd morning-terminal-script
npm install chalk figlet pg
env.js
file to include your PostgreSQL database credentials and other configurations:This project uses a PostgreSQL database to store tasks. The schema for the tasks
table is as follows:
CREATE TABLE tasks (kind TEXT,id TEXT PRIMARY KEY,etag TEXT,title TEXT,updated TIMESTAMP,status TEXT,due TIMESTAMP,tasklist_title TEXT);
Each task has the following fields:
kind
: Type of task (e.g., 'tasks#task'
).id
: Unique identifier for the task.etag
: Entity tag for versioning.title
: Title of the task.updated
: Timestamp of when the task was last updated.status
: Status of the task (e.g., 'needsAction'
or 'completed'
).due
: Due date of the task.tasklist_title
: Title of the task list (e.g., 'My Tasks'
).To test the script manually, run the following command in your terminal:
node morning-script.js
The project includes a PowerShell script (create-task.ps1
) that creates a scheduled task in Windows Task Scheduler to run the script daily at startup.
cd morning-terminal-script
.\create-task.ps1
MorningTerminalScript
(or the name specified in create-task.ps1
)....\morning-terminal-script\│├── generated_text_elements/ # Directory for generated text files (if applicable)├── .gitignore # Git ignore file├── create-task.ps1 # PowerShell script to create a scheduled task├── env copy.js # Example environment configuration file├── env.js # Environment configuration file (customizable)├── morning-script.js # Main JavaScript script for generating the calendar and fetching tasks from DB├── package-lock.json # Auto-generated file for npm dependencies├── package.json # Node.js project configuration file├── README.md # Project documentation (this file)├── run.bat # Batch file to execute run2.bat the script via Task Scheduler├── run2.bat # Calls morning-script.js
Dark+ Demo in Windows TerminalRetro Demo in Windows Terminal
create-task.ps1
was executed with Administrator privileges.npm install
.run.bat
points to the correct path for node.exe
and morning-script.js
.