ja-CLI 0.7__tar.gz

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.
ja_cli-0.7/PKG-INFO ADDED
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.4
2
+ Name: ja-CLI
3
+ Version: 0.7
4
+ Summary: Minimal journaling CLI for raw thought capture
5
+ Author: Paul
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+
9
+ ```
10
+ _ _ ____ ___ _ _ _ _ _ _____ ___ _ _____ _____ _____ ____ _ ___ _____ _____
11
+ | | / \ | _ \ / \ \ / | | | | | \ | | ___|_ _| | |_ _| ____| ____| _ \ | | |_ _| ___| ____|
12
+ _ | |/ _ \ | |_) | / _ \ \ /\ / / | | | | \| | |_ | || | | | | _| | _| | | | | | | | || |_ | _|
13
+ | |_| / ___ \ | _ < / ___ \ V V / | |_| | |\ | _| | || |___| | | |___| |___| |_| | | |___ | || _| | |___
14
+ ____\___/_/ \_| |_| \_/_/ \_\_/\_/ \___/|_| \_|_| |___|_____|_| |_____|_____|____/ |_____|___|_| |_____|
15
+ |_____|
16
+ ᵥ.₆
17
+ ```
18
+ This is a journalling app made by me :D
19
+ Paul
20
+
21
+ It's a very simple TUI journaling app that emphazises on raw and unfiltered thoughts rather than compressed or reviewed thoughts.
22
+ All of the journaling entries are in .md though.
23
+ Also, _JA includes entry numbers like this:
24
+ ```
25
+ ---
26
+ ENTRY 1
27
+ ---
28
+ *actual entry goes here*
29
+ ---
30
+ ENTRY 2
31
+ ---
32
+ *entry 2 goes here*
33
+ ```
34
+ The new entries would automatically be generated every time you exit and open the program or when you go into idle mode and come back.
35
+
36
+ It includes basic features like:
37
+ - Automatic daily journal creation
38
+ - Markdown (*w/ terminal that supports rendering*)
39
+ But also, it includes AI features like:
40
+ - Automatic tag assigning
41
+ - Trends
42
+ - Visual graphs for most use tags _etc_
43
+
44
+ # INSTALLATION
45
+ To install this, you need to run
46
+ ```
47
+ pip install -e .
48
+ ```
ja_cli-0.7/README.md ADDED
@@ -0,0 +1,40 @@
1
+ ```
2
+ _ _ ____ ___ _ _ _ _ _ _____ ___ _ _____ _____ _____ ____ _ ___ _____ _____
3
+ | | / \ | _ \ / \ \ / | | | | | \ | | ___|_ _| | |_ _| ____| ____| _ \ | | |_ _| ___| ____|
4
+ _ | |/ _ \ | |_) | / _ \ \ /\ / / | | | | \| | |_ | || | | | | _| | _| | | | | | | | || |_ | _|
5
+ | |_| / ___ \ | _ < / ___ \ V V / | |_| | |\ | _| | || |___| | | |___| |___| |_| | | |___ | || _| | |___
6
+ ____\___/_/ \_| |_| \_/_/ \_\_/\_/ \___/|_| \_|_| |___|_____|_| |_____|_____|____/ |_____|___|_| |_____|
7
+ |_____|
8
+ ᵥ.₆
9
+ ```
10
+ This is a journalling app made by me :D
11
+ Paul
12
+
13
+ It's a very simple TUI journaling app that emphazises on raw and unfiltered thoughts rather than compressed or reviewed thoughts.
14
+ All of the journaling entries are in .md though.
15
+ Also, _JA includes entry numbers like this:
16
+ ```
17
+ ---
18
+ ENTRY 1
19
+ ---
20
+ *actual entry goes here*
21
+ ---
22
+ ENTRY 2
23
+ ---
24
+ *entry 2 goes here*
25
+ ```
26
+ The new entries would automatically be generated every time you exit and open the program or when you go into idle mode and come back.
27
+
28
+ It includes basic features like:
29
+ - Automatic daily journal creation
30
+ - Markdown (*w/ terminal that supports rendering*)
31
+ But also, it includes AI features like:
32
+ - Automatic tag assigning
33
+ - Trends
34
+ - Visual graphs for most use tags _etc_
35
+
36
+ # INSTALLATION
37
+ To install this, you need to run
38
+ ```
39
+ pip install -e .
40
+ ```
@@ -0,0 +1 @@
1
+ # __init__.py
@@ -0,0 +1,9 @@
1
+ from pathlib import Path
2
+
3
+ BASE_DIR = Path.home() / ".ja"
4
+
5
+ LOG_PATH = BASE_DIR / "logs.json"
6
+ ARCHIVE_PATH = BASE_DIR / "archive"
7
+
8
+ BASE_DIR.mkdir(exist_ok=True)
9
+ ARCHIVE_PATH.mkdir(exist_ok=True)
ja_cli-0.7/ja/idle.py ADDED
@@ -0,0 +1,50 @@
1
+ import datetime
2
+ from ja.journal import generate_journal_entry
3
+ from ja.log_utils import load_logs
4
+ from ja.config import ARCHIVE_PATH
5
+
6
+ def find_entry():
7
+ logs = load_logs()
8
+ print("Flipping through the pages...")
9
+ unique_files = {}
10
+ for item in logs["contents"]:
11
+ unique_files[item["path"]] = item["timestamp"]
12
+ files = list(unique_files.items())
13
+ files.sort(key=lambda x: x[1], reverse=True)
14
+ for i, (path, timestamp) in enumerate(files, start=1):
15
+ time_str = datetime.datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d')
16
+ print(f"[{i}] {path} | {time_str}")
17
+ print("Enter the number of the entry you want to view:")
18
+ line = input("> ").strip()
19
+ if line.isdigit():
20
+ index = int(line) - 1
21
+ if 0 <= index < len(logs["contents"]):
22
+ entry = logs["contents"][index]
23
+ print("\n=== Reading the page... ===\n")
24
+ with open(ARCHIVE_PATH / entry['path'], 'r') as f:
25
+ print(f.read())
26
+ return
27
+ print("Invalid entry number.")
28
+
29
+ def passive_idle():
30
+ while True:
31
+ logs = load_logs()
32
+ entry = logs["entry"]
33
+ print(f"""
34
+ === IDLE MODE ===
35
+
36
+ COMMANDS:
37
+ [j] Start new journal entry (current entry: {entry})
38
+ [s] View past journal entries
39
+ [q] Quit program
40
+ Enter command:
41
+ """)
42
+ cmd = input("> ").strip()
43
+ if cmd == "j":
44
+ print("Turning the pages...")
45
+ return "journal"
46
+ elif cmd == "s":
47
+ find_entry()
48
+ elif cmd == "q":
49
+ print("Hoping to see you again soon, Paul. Goodbye!")
50
+ return "exit"
@@ -0,0 +1,49 @@
1
+ import datetime
2
+ from ja.config import ARCHIVE_PATH
3
+ from ja.log_utils import load_logs, save_logs
4
+
5
+ def is_new_day(last_entry_time):
6
+ if last_entry_time == 0:
7
+ return True
8
+ last_date = datetime.datetime.fromtimestamp(last_entry_time).date()
9
+ current_date = datetime.datetime.now().date()
10
+ return current_date > last_date
11
+
12
+ def generate_journal_entry():
13
+ logs = load_logs()
14
+ logs["last_entry_time"] = datetime.datetime.now().timestamp()
15
+ save_logs(logs)
16
+ entry = logs["entry"]
17
+ date_str = datetime.datetime.today().strftime("%Y-%m-%d")
18
+ file_path = ARCHIVE_PATH / f"{date_str}.md"
19
+ print(f"""
20
+ === JOURNAL ENTRY MODE ===
21
+
22
+ Entry {entry} | {date_str}
23
+
24
+ Get your thoughts out on the page.
25
+ Long or short, it's all good.
26
+ Type 'q' on a new line to exit.
27
+ """)
28
+ file_path.touch(exist_ok=True)
29
+ first_line = True
30
+ while True:
31
+ line = input("- ").strip()
32
+ if line == "q":
33
+ print("Exiting journal entry mode.\n")
34
+ return "idle"
35
+ if not line:
36
+ continue
37
+ if first_line:
38
+ with open(file_path, 'a') as f:
39
+ f.write(f'\n---\nENTRY {entry}\n---\n\n')
40
+ logs["contents"].append({
41
+ "path": f"{date_str}.md",
42
+ "entry": entry,
43
+ "timestamp": datetime.datetime.now().timestamp()
44
+ })
45
+ logs["entry"] += 1
46
+ first_line = False
47
+ with open(file_path, 'a') as f:
48
+ f.write(line + '\n')
49
+ save_logs(logs)
@@ -0,0 +1,21 @@
1
+ import json
2
+ from ja.config import LOG_PATH, ARCHIVE_PATH
3
+
4
+ def init_logs():
5
+ ARCHIVE_PATH.mkdir(parents=True, exist_ok=True)
6
+
7
+ if not LOG_PATH.exists():
8
+ with open(LOG_PATH, 'w') as f:
9
+ json.dump({
10
+ "last_entry_time": 0,
11
+ "entry": 1,
12
+ "contents": []
13
+ }, f, indent=4)
14
+
15
+ def load_logs():
16
+ with open(LOG_PATH, 'r') as f:
17
+ return json.load(f)
18
+
19
+ def save_logs(logs):
20
+ with open(LOG_PATH, 'w') as f:
21
+ json.dump(logs, f, indent=4)
ja_cli-0.7/ja/main.py ADDED
@@ -0,0 +1,67 @@
1
+ import datetime
2
+ import random
3
+ from ja.journal import generate_journal_entry, is_new_day
4
+ from ja.idle import passive_idle
5
+ from ja.log_utils import init_logs, load_logs, save_logs
6
+ import textwrap
7
+ def main():
8
+ init_logs()
9
+ logs = load_logs()
10
+ greetings = [
11
+ "These pages are waiting.",
12
+ "This page is ready for you.",
13
+ "Your journal is open.",
14
+ "This space is yours.",
15
+ "Your thoughts belong here.",
16
+ "The page is yours now.",
17
+ "This moment is yours to write.",
18
+ "Your words have a place here.",
19
+ "The page is ready whenever you are.",
20
+ "This space is here for you.",
21
+ "Your thoughts can rest here.",
22
+ "What's on your mind belongs here.",
23
+ "This is your place to write.",
24
+ "Your thoughts have been waiting.",
25
+ "This page is yours to fill.",
26
+ "Everything you're thinking can go here.",
27
+ "The page is open.",
28
+ "Your space is ready.",
29
+ "This is where your thoughts can land.",
30
+ "You can leave your thoughts here."
31
+ ]
32
+ LOGO = """
33
+ _ _
34
+ | | / \\
35
+ _ | |/ _ \\
36
+ | |_| / ___ \\
37
+ ____\\___/_/ \\_\\
38
+ |_____|
39
+ ᵥ.₇
40
+ """ #! change the v AND change the version within setup when you update the version number. I know, it's a pain, but still, do it >:). Also only do it when there is signifigant changes, or else just do like .x.x update.
41
+
42
+ print(textwrap.dedent(LOGO))
43
+ hour = datetime.datetime.now().hour
44
+ greeting = random.choice(greetings)
45
+ if hour < 12:
46
+ print(f"Good morning, Paul. {greeting}")
47
+ elif hour < 18:
48
+ print(f"Good afternoon, Paul. {greeting}")
49
+ else:
50
+ print(f"Good evening, Paul. {greeting}")
51
+ if is_new_day(logs["last_entry_time"]):
52
+ print("A new day has begun since your last entry.")
53
+ logs["entry"] = 1
54
+ save_logs(logs)
55
+ state = "journal"
56
+ while True:
57
+ if state == "journal":
58
+ state = generate_journal_entry()
59
+
60
+ elif state == "idle":
61
+ state = passive_idle()
62
+
63
+ elif state == "exit":
64
+ break
65
+
66
+ if __name__ == "__main__":
67
+ main()
@@ -0,0 +1,82 @@
1
+ from ollama import chat, ChatResponse
2
+ import datetime
3
+
4
+ with open(f'logs\\archieve\\{datetime.datetime.today().strftime("%Y-%m-%d")}.md', 'r') as f:
5
+ journal_entry = f.read()
6
+
7
+ response: ChatResponse = chat(model='qwen2.5:7b', messages=[
8
+ {
9
+ 'role': 'user',
10
+ 'content': f"""
11
+ You MUST follow this output format EXACTLY.
12
+
13
+ OUTPUT FORMAT (NO DEVIATION ALLOWED):
14
+ First line: tags (space-separated)
15
+ Second line: ---
16
+ Then: the original input EXACTLY
17
+
18
+ If you fail to include tags, your output is WRONG.
19
+
20
+ ---
21
+
22
+ TASK:
23
+ Analyze the journal and assign tags.
24
+
25
+ INPUT:
26
+ \"\"\"{journal_entry}\"\"\"
27
+
28
+ ---
29
+
30
+ ALLOWED TAGS:
31
+ #work, #school, #learning, #technology, #creative, #hobbies, #travel,
32
+ #health, #fitness, #mental_health,
33
+ #family, #relationships, #friendships, #dating, #social,
34
+ #finance,
35
+ #goals, #productivity, #routine,
36
+ #reflection, #personal_growth, #decisions, #problems, #ideas, #events,
37
+ #emotions_positive, #emotions_negative, #emotions_conflict,
38
+ #misc
39
+
40
+ ---
41
+
42
+ CRITICAL RULE:
43
+ If the input is mostly:
44
+ - testing
45
+ - random text
46
+ - repeated phrases
47
+ - noise / filler
48
+
49
+ Then output ONLY:
50
+ #misc
51
+
52
+ ---
53
+
54
+ STRICT RULES:
55
+ - NEVER skip tags
56
+ - NEVER output only the journal
57
+ - NEVER add explanations
58
+ - ONLY use allowed tags
59
+ - 1-5 tags max
60
+
61
+ ---
62
+
63
+ EXAMPLES:
64
+
65
+ Input:
66
+ testing
67
+ hello
68
+ yay
69
+
70
+ Output:
71
+ #misc
72
+ ---
73
+ testing
74
+ hello
75
+ yay
76
+
77
+ ---
78
+
79
+ Now produce the output.
80
+ """},
81
+ ])
82
+ print(response['message']['content'])
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.4
2
+ Name: ja-CLI
3
+ Version: 0.7
4
+ Summary: Minimal journaling CLI for raw thought capture
5
+ Author: Paul
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+
9
+ ```
10
+ _ _ ____ ___ _ _ _ _ _ _____ ___ _ _____ _____ _____ ____ _ ___ _____ _____
11
+ | | / \ | _ \ / \ \ / | | | | | \ | | ___|_ _| | |_ _| ____| ____| _ \ | | |_ _| ___| ____|
12
+ _ | |/ _ \ | |_) | / _ \ \ /\ / / | | | | \| | |_ | || | | | | _| | _| | | | | | | | || |_ | _|
13
+ | |_| / ___ \ | _ < / ___ \ V V / | |_| | |\ | _| | || |___| | | |___| |___| |_| | | |___ | || _| | |___
14
+ ____\___/_/ \_| |_| \_/_/ \_\_/\_/ \___/|_| \_|_| |___|_____|_| |_____|_____|____/ |_____|___|_| |_____|
15
+ |_____|
16
+ ᵥ.₆
17
+ ```
18
+ This is a journalling app made by me :D
19
+ Paul
20
+
21
+ It's a very simple TUI journaling app that emphazises on raw and unfiltered thoughts rather than compressed or reviewed thoughts.
22
+ All of the journaling entries are in .md though.
23
+ Also, _JA includes entry numbers like this:
24
+ ```
25
+ ---
26
+ ENTRY 1
27
+ ---
28
+ *actual entry goes here*
29
+ ---
30
+ ENTRY 2
31
+ ---
32
+ *entry 2 goes here*
33
+ ```
34
+ The new entries would automatically be generated every time you exit and open the program or when you go into idle mode and come back.
35
+
36
+ It includes basic features like:
37
+ - Automatic daily journal creation
38
+ - Markdown (*w/ terminal that supports rendering*)
39
+ But also, it includes AI features like:
40
+ - Automatic tag assigning
41
+ - Trends
42
+ - Visual graphs for most use tags _etc_
43
+
44
+ # INSTALLATION
45
+ To install this, you need to run
46
+ ```
47
+ pip install -e .
48
+ ```
@@ -0,0 +1,14 @@
1
+ README.md
2
+ pyproject.toml
3
+ ja/__init__.py
4
+ ja/config.py
5
+ ja/idle.py
6
+ ja/journal.py
7
+ ja/log_utils.py
8
+ ja/main.py
9
+ ja/tag_generation.py
10
+ ja_CLI.egg-info/PKG-INFO
11
+ ja_CLI.egg-info/SOURCES.txt
12
+ ja_CLI.egg-info/dependency_links.txt
13
+ ja_CLI.egg-info/entry_points.txt
14
+ ja_CLI.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ _ja = ja.main:main
@@ -0,0 +1 @@
1
+ ja
@@ -0,0 +1,15 @@
1
+ [project]
2
+ name = "ja-CLI"
3
+ version = "0.7"
4
+ description = "Minimal journaling CLI for raw thought capture"
5
+ authors = [{name = "Paul"}]
6
+ readme = "README.md"
7
+ requires-python = ">=3.10"
8
+
9
+ dependencies = []
10
+
11
+ [project.scripts]
12
+ _ja = "ja.main:main"
13
+
14
+ [tool.setuptools]
15
+ packages = ["ja"]
ja_cli-0.7/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+