Skip to content

Commit 287de6f

Browse files
committed
docs: Update logseq-update-week command and introduce logseq-week-info-getter subagent
- Modify the logseq-update-week command to execute with zero parameters, creating the structure for the current week. - Revise documentation to clarify the command's functionality and parameters. - Introduce a new subagent, logseq-week-info-getter, to retrieve week day information for specified or current weeks, enhancing user experience and automation capabilities.
1 parent 594acc1 commit 287de6f

File tree

2 files changed

+162
-55
lines changed

2 files changed

+162
-55
lines changed

.rulesync/commands/logseq-update-week.md

Lines changed: 18 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@ This command automates the creation of a complete week structure in the Logseq g
1414

1515
## Usage
1616

17-
Execute this command with three parameters: year, trimester, and week number.
17+
Execute this command with zero parameters
1818

19-
**Command:** `/logseq-update-week <year> <trimester> <week>`
20-
21-
**Example:**
2219
```
23-
/logseq-update-week 2025 3 6
20+
/logseq-update-week
2421
```
25-
This creates the complete structure for Week 6 of Trimester 3, 2025.
22+
This creates the complete structure for the current week.
2623

2724
## What This Command Does
2825

@@ -34,14 +31,17 @@ This creates the complete structure for Week 6 of Trimester 3, 2025.
3431
6. **Creates** 7 daily pages (d1-d7) with correct navigation
3532
7. **Creates** 7 daily todo pages with proper references
3633

37-
## Parameters
34+
## Info to gather
35+
36+
use the `logseq-week-info-getter` agent to gather a report of the following data
3837

3938
- **year**: 4-digit year (e.g., 2025)
4039
- **trimester**: 1, 2, or 3
4140
- Trimester 1: Jan 1 to day before Memorial Day (last Monday in May)
4241
- Trimester 2: Memorial Day to day before Labor Day
4342
- Trimester 3: Labor Day (first Monday in September) to Dec 31
4443
- **week**: Week number within the trimester (1-52)
44+
- **day**: list of days in the week
4545

4646
## Files Created
4747

@@ -50,13 +50,12 @@ The command creates these files in the `pages/` directory:
5050
1. `YYYY___tT___wWW.md` - Main week page
5151
2. `YYYY___tT___wWW___Todos.md` - Week todos page
5252
3. `YYYY___tT___wWW___d1.md` through `YYYY___tT___wWW___d7.md` - Daily pages
53-
4. `YYYY___tT___wWW___d1___Todos.md` through `YYYY___tT___wWW___d7___Todos.md` - Daily todo pages
5453

55-
Plus updates to `Logseq___Template___Today___Link.md` with the new week's day links.
54+
Plus it updates `Logseq___Template___Today___Link.md` with the new week's day links.
5655

5756
## Implementation Details
5857

59-
The command performs these calculations and operations:
58+
The command performs relies on calculations and operations from `logseq-week-info-getter` subagent
6059

6160
1. **Date Calculation**: Determines the Monday-Sunday dates for the specified week
6261
- Week N starts (N-1) weeks after the trimester start date
@@ -70,6 +69,10 @@ The command performs these calculations and operations:
7069

7170
## Template Structure
7271

72+
In the below templates,
73+
* `tT` means to substitute T with the Trimester number. If it was trimester 3, then it should be `t3`.
74+
* `wWW` means to subsitute WW with the zero-padded week number in the trimester. if it was, 6, then it should be `w06`.
75+
7376
### Week Page Template
7477
```markdown
7578
type:: [[Type/Logseq/Week/Page]]
@@ -81,43 +84,16 @@ next:: [[YYYY/tT/wNEXT]]
8184
week-todos:: [[YYYY/tT/wWW/Todos]]
8285
banner:: "../assets/Logseq/Plugins/logseq-banners-plugin/deep_springs_cow_camp_01.jpg"
8386

84-
- # Week Notes
85-
- ## Week Start (logseq-garden ONLY)
86-
- ### DOING Week Setup
87-
:LOGBOOK:
88-
CLOCK: [YYYY-MM-DD Day HH:MM:SS]
89-
:END:
90-
- TODO update [[Logseq/Template/Today/Link]] to point to *this* week, and fill in all the days as well
91-
- TODO create a "today link" with `d1 link`, `d2 link`, etc in Week Days below
92-
- TODO book rooms for week and put on calendar
93-
- TODO book any group exercise classes and put on calendar
94-
- TODO fill in weather for each day of the week
95-
- TODO export calendar
96-
- TODO fill in day links below using cursor
97-
- TODO create week todos page
98-
- TODO open week todos page and instantiate the skeleton
99-
- TODO take a look at [[Logseq/Template/Week/Todos/Skeleton]]
100-
- TODO instantiate Week Todos Skeleton
101-
- TODO if we're in a downstream repository, fill in the content of the week todos page
102-
- TODO take a look at [[Logseq/Template/Week/Todos/Content]]
103-
- TODO instantiate Week Todos Content
104-
- TODO port over items from previous week, cutting and pasting
105-
- TODO do a git commit
106-
- ### TODO What's up this week
107-
- ## Week Days - (logseq-garden ONLY)
108-
note:: *for each day, first go to the today link for the downstream Logseq repo and fill it out, then use `Today Link` template, and inside that log entry, use [[Logseq/Template/Today/Setup Checklist]] template*
87+
- # tT wWW Week Notes
88+
- ## What's up this week?
89+
- ## Week Days
10990
- ### log [[YYYY/tT/wWW/d1]] - [[YYYY/MM/DD]] - [[YYYY-MM-DD Day]]
11091
- ### log [[YYYY/tT/wWW/d2]] - [[YYYY/MM/DD]] - [[YYYY-MM-DD Day]]
11192
- ### log [[YYYY/tT/wWW/d3]] - [[YYYY/MM/DD]] - [[YYYY-MM-DD Day]]
11293
- ### log [[YYYY/tT/wWW/d4]] - [[YYYY/MM/DD]] - [[YYYY-MM-DD Day]]
11394
- ### log [[YYYY/tT/wWW/d5]] - [[YYYY/MM/DD]] - [[YYYY-MM-DD Day]]
11495
- ### log [[YYYY/tT/wWW/d6]] - [[YYYY/MM/DD]] - [[YYYY-MM-DD Day]]
11596
- ### log [[YYYY/tT/wWW/d7]] - [[YYYY/MM/DD]] - [[YYYY-MM-DD Day]]
116-
- ## Week End - (Downstream Repos ONLY)
117-
- ### TODO Week Review
118-
- # Week Reference (Downstream Repos ONLY)
119-
- ### Music
120-
-
12197
```
12298

12399
### Day Page Template
@@ -131,25 +107,12 @@ prev:: [[YYYY/tT/wWW/dPREV]]
131107
next:: [[YYYY/tT/wWW/dNEXT]]
132108
todos:: [[YYYY/tT/wWW/dD/Todos]]
133109
week-todos:: [[YYYY/tT/wWW/Todos]]
110+
trimester-todos:: [[YYYY/tT/Todos]]
111+
134112

135113
- # log [[YYYY/MM/DD]] - [[YYYY-MM-DD Day]]
136-
- ## Agenda
137114
```
138115

139-
### Day Todos Page Template
140-
```markdown
141-
type:: [[Type/Logseq/Today/Todos]]
142-
created-by-template:: [[Logseq/Template/Today/Todos/Skeleton]]
143-
banner:: "../assets/Logseq/Template/Week/Todos/ben_franklin_almanac.jpg"
144-
icon:: 📅✅
145-
up:: [[YYYY/tT/wWW/dD]]
146-
prev:: [[YYYY/tT/wWW/dPREV/Todos]]
147-
next:: [[YYYY/tT/wWW/dNEXT/Todos]]
148-
week-todos:: [[YYYY/tT/wWW/Todos]]
149-
trimester-todos:: [[YYYY/tT/Todos]]
150-
151-
- # Todos [[YYYY/tT/wWW/dD/Todos]] - [[YYYY/MM/DD]] - [[YYYY-MM-DD Day]]
152-
```
153116

154117
### Week Todos Page Template
155118
```markdown
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
---
2+
name: logseq-week-info-getter
3+
description: Get the logseq week days for specified or current week
4+
targets: ["*"]
5+
---
6+
# Get the logseq days for this week
7+
8+
## Usage
9+
10+
Execute this command in one of two ways.
11+
12+
### 1 - Supplying a date as an argument.
13+
#### 1 - Command: `/logseq-week-info-getter <date>`
14+
#### 1 - Example Invocation `/logseq-week-info-getter 2025-11-03`
15+
This would produce a report of the data related to the days of the week in which the supplied date falls.
16+
17+
Example Output:
18+
```yaml
19+
year: 2025
20+
trimester: 3
21+
week: 10
22+
day:
23+
- d1: 2025-11-03 Mon
24+
- d2: 2025-11-04 Tue
25+
- d3: 2025-11-05 Wed
26+
- d4: 2025-11-06 Thu
27+
- d5: 2025-11-07 Fri
28+
- d6: 2025-11-08 Sat
29+
- d7: 2025-11-09 Sun
30+
```
31+
### 2 - Supplying no parameters
32+
If no parameters are supplied, assume that the user is interested only in the current week.
33+
#### 2 - Command: `/logseq-week-info-getter`
34+
This would produce a report of the data related to the days of the week in which the current date falls.
35+
36+
37+
Follow `Workflow` to get `LOGSEQ_NAMESPACED_PAGE_NAME` then `Report` the completed work.
38+
39+
40+
## Arguments
41+
42+
One argument (optional), which is the anchor day in which the week occurs
43+
44+
ANCHOR_DAY: $ARGUMENTS[0]
45+
46+
## Workflow
47+
48+
- if $ANCHOR_DAY is not defined, use the `date` CLI tool to find the current date today
49+
- `date "+%Y-%m-%d %a"`
50+
- use other tools to calculate the current week number in the trimester
51+
52+
## Report
53+
54+
The report block should be in yaml. One of the below blocks should be the entire report.
55+
Keys to include
56+
- **year**: 4-digit year (e.g., 2025)
57+
- **trimester**: 1, 2, or 3
58+
- Trimester 1: Jan 1 to day before Memorial Day (last Monday in May)
59+
- Trimester 2: Memorial Day to day before Labor Day
60+
- Trimester 3: Labor Day (first Monday in September) to Dec 31
61+
- **week**: Week number within the trimester (01-16)
62+
- **day**: yaml list of day(s) within the week, specified from d1 (monday) to d7 (sunday), in the format `dD: +%Y-%m-%d %a`
63+
64+
## Implementation
65+
66+
Python script to calculate week days:
67+
68+
```python
69+
from datetime import datetime, timedelta
70+
import calendar
71+
import sys
72+
73+
# Get anchor date from argument or use current date
74+
if len(sys.argv) > 1:
75+
anchor_date_str = sys.argv[1]
76+
else:
77+
# Get current date in format YYYY-MM-DD
78+
anchor_date_str = datetime.now().strftime('%Y-%m-%d')
79+
80+
anchor_date = datetime.strptime(anchor_date_str, '%Y-%m-%d')
81+
year = anchor_date.year
82+
83+
# Calculate Memorial Day (last Monday in May)
84+
# Start from May 31 and go backwards to find the last Monday
85+
memorial_day = None
86+
for day in range(31, 0, -1):
87+
try:
88+
date = datetime(year, 5, day)
89+
if date.weekday() == 0: # Monday
90+
memorial_day = date
91+
break
92+
except ValueError:
93+
continue
94+
95+
# Calculate Labor Day (first Monday in September)
96+
labor_day = None
97+
for day in range(1, 8):
98+
date = datetime(year, 9, day)
99+
if date.weekday() == 0: # Monday
100+
labor_day = date
101+
break
102+
103+
# Determine trimester
104+
if anchor_date < memorial_day:
105+
trimester = 1
106+
trimester_start = datetime(year, 1, 1)
107+
trimester_end = memorial_day - timedelta(days=1)
108+
elif anchor_date < labor_day:
109+
trimester = 2
110+
trimester_start = memorial_day
111+
trimester_end = labor_day - timedelta(days=1)
112+
else:
113+
trimester = 3
114+
trimester_start = labor_day
115+
trimester_end = datetime(year, 12, 31)
116+
117+
# Find the Monday of the week containing anchor_date
118+
days_since_monday = anchor_date.weekday()
119+
monday_of_week = anchor_date - timedelta(days=days_since_monday)
120+
121+
# Calculate week number within trimester
122+
# Count how many Mondays have passed since trimester start
123+
days_diff = (monday_of_week - trimester_start).days
124+
week_number = (days_diff // 7) + 1
125+
126+
# Calculate all 7 days of the week (Monday-Sunday)
127+
week_days = []
128+
for i in range(7):
129+
day_date = monday_of_week + timedelta(days=i)
130+
day_name = calendar.day_abbr[day_date.weekday()]
131+
week_days.append((f'd{i+1}', day_date.strftime('%Y-%m-%d'), day_name))
132+
133+
# Output YAML
134+
print(f'year: {year}')
135+
print(f'trimester: {trimester}')
136+
print(f'week: {week_number:02d}')
137+
print('day:')
138+
for d_num, date_str, day_abbr in week_days:
139+
print(f' - {d_num}: {date_str} {day_abbr}')
140+
```
141+
142+
Usage:
143+
- With date argument: `python3 script.py 2025-11-03`
144+
- Without argument (uses current date): `python3 script.py`

0 commit comments

Comments
 (0)