sessionmemory 0.3.0__tar.gz → 0.3.1__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.
Files changed (35) hide show
  1. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/PKG-INFO +1 -1
  2. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/pyproject.toml +1 -1
  3. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/pyproject.toml.orig +1 -1
  4. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/field.py +30 -2
  5. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/log.py +1 -5
  6. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/README.md +0 -0
  7. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/__init__.py +0 -0
  8. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/cli.py +0 -0
  9. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/commands/__init__.py +0 -0
  10. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/commands/_common.py +0 -0
  11. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/commands/delete.py +0 -0
  12. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/commands/doctor.py +0 -0
  13. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/commands/export.py +0 -0
  14. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/commands/init.py +0 -0
  15. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/commands/inject.py +0 -0
  16. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/commands/log.py +0 -0
  17. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/commands/new.py +0 -0
  18. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/commands/project.py +0 -0
  19. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/commands/reindex.py +0 -0
  20. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/commands/search.py +0 -0
  21. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/__init__.py +0 -0
  22. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/atomic.py +0 -0
  23. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/bootstrap.py +0 -0
  24. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/config.py +0 -0
  25. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/doctor.py +0 -0
  26. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/embed.py +0 -0
  27. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/export.py +0 -0
  28. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/fieldindex.py +0 -0
  29. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/frontmatter.py +0 -0
  30. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/gitinfo.py +0 -0
  31. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/ids.py +0 -0
  32. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/inject.py +0 -0
  33. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/paths.py +0 -0
  34. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/registry.py +0 -0
  35. {sessionmemory-0.3.0 → sessionmemory-0.3.1}/src/sessionmemory/lib/resolve.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sessionmemory
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Durable memory for coding agents, one folder of searchable pages per project.
5
5
  Author: Nathaniel Landau
6
6
  Author-email: Nathaniel Landau <github@natelandau.com>
@@ -11,7 +11,7 @@ description = "Durable memory for coding agents, one folder of searchable pages
11
11
  name = "sessionmemory"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.13,<3.15"
14
- version = "0.3.0"
14
+ version = "0.3.1"
15
15
 
16
16
  [[project.authors]]
17
17
  name = "Nathaniel Landau"
@@ -12,7 +12,7 @@
12
12
  name = "sessionmemory"
13
13
  readme = "README.md"
14
14
  requires-python = ">=3.13,<3.15"
15
- version = "0.3.0"
15
+ version = "0.3.1"
16
16
 
17
17
  [project.scripts]
18
18
  sessionmemory = "sessionmemory.cli:main"
@@ -15,7 +15,13 @@ from typing import TYPE_CHECKING, Any
15
15
 
16
16
  from sessionmemory.lib import atomic
17
17
  from sessionmemory.lib.frontmatter import FrontmatterError, parse, serialize
18
- from sessionmemory.lib.ids import id_candidates, slugify
18
+ from sessionmemory.lib.ids import (
19
+ DATE_PREFIX_WIDTH,
20
+ MAX_ID_LENGTH,
21
+ id_candidates,
22
+ slugify,
23
+ strip_date,
24
+ )
19
25
 
20
26
  if TYPE_CHECKING:
21
27
  from collections.abc import Mapping
@@ -176,6 +182,28 @@ def new_page(directory: Path, *, title: str, summary: str, body: str, now: str)
176
182
  def new_document(
177
183
  directory: Path, *, title: str, body: str, now: str, stem: str | None = None
178
184
  ) -> Path:
179
- """Create a spec, plan, or log: a titled, dated file that is not a memory page."""
185
+ """Create a spec, plan, or log: a titled, dated file that is not a memory page.
186
+
187
+ The filename leads with the creation date unless the caller fixes the stem, so a
188
+ directory listing reads in the order the documents were written.
189
+
190
+ Raises:
191
+ PageError: If the title yields no slug or no name is free.
192
+ """
193
+ if stem is None:
194
+ stem = dated_stem(title, now[: len("2026-01-01")])
180
195
  meta = {"title": title, "created": now, "updated": now}
181
196
  return _create(directory, meta, body, stem=stem)
197
+
198
+
199
+ def dated_stem(title: str, day: str) -> str:
200
+ """Return `<day>-<slug>`, with the slug shortened so the whole stem fits the id limit.
201
+
202
+ Raises:
203
+ PageError: If the title yields no slug.
204
+ """
205
+ try:
206
+ slug = slugify(strip_date(title, day), max_length=MAX_ID_LENGTH - DATE_PREFIX_WIDTH)
207
+ except ValueError as error:
208
+ raise PageError(str(error)) from error
209
+ return f"{day}-{slug}"
@@ -13,7 +13,6 @@ from dataclasses import dataclass
13
13
  from typing import TYPE_CHECKING
14
14
 
15
15
  from sessionmemory.lib import field, paths
16
- from sessionmemory.lib.ids import slugify, strip_date
17
16
 
18
17
  if TYPE_CHECKING:
19
18
  from pathlib import Path
@@ -85,10 +84,7 @@ def upsert_log( # noqa: PLR0913
85
84
  return Upserted(path=existing, created=False)
86
85
 
87
86
  day = log_date(title, today)
88
- try:
89
- stem = f"{day}-{slugify(strip_date(title, day))}"
90
- except ValueError as error:
91
- raise field.PageError(str(error)) from error
87
+ stem = field.dated_stem(title, day)
92
88
  path = field.claim_filename(paths.logs_dir(vault, slug), title, stem=stem)
93
89
  meta = {
94
90
  "title": title,
File without changes