dotai-cli 0.7.0__tar.gz → 0.7.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 (83) hide show
  1. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/CHANGELOG.md +10 -0
  2. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/PKG-INFO +1 -1
  3. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/pyproject.toml +1 -1
  4. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/__init__.py +1 -1
  5. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/sync.py +57 -6
  6. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_sync.py +118 -0
  7. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/uv.lock +1 -1
  8. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/.github/workflows/ci.yml +0 -0
  9. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/.github/workflows/publish.yml +0 -0
  10. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/.gitignore +0 -0
  11. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/LICENSE +0 -0
  12. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/PRODUCT.md +0 -0
  13. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/README.md +0 -0
  14. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/rdc.yaml +0 -0
  15. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/__main__.py +0 -0
  16. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/agents.py +0 -0
  17. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/catalog.py +0 -0
  18. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/cli/__init__.py +0 -0
  19. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/cli/__main__.py +0 -0
  20. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/cli/agents_cmd.py +0 -0
  21. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/cli/insights_cmd.py +0 -0
  22. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/cli/prefs_cmd.py +0 -0
  23. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/cli/roles_cmd.py +0 -0
  24. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/cli/rules_cmd.py +0 -0
  25. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/cli/skills_cmd.py +0 -0
  26. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/cli/sync_cmd.py +0 -0
  27. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/context.py +0 -0
  28. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/converter.py +0 -0
  29. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/import_agent.py +0 -0
  30. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/insights.py +0 -0
  31. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/maintenance.py +0 -0
  32. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/models.py +0 -0
  33. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/preferences.py +0 -0
  34. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/roles.py +0 -0
  35. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/rules.py +0 -0
  36. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/scope.py +0 -0
  37. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/roles/architect.md +0 -0
  38. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/roles/debugger.md +0 -0
  39. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/roles/founder.md +0 -0
  40. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/roles/mentor.md +0 -0
  41. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/roles/product-manager.md +0 -0
  42. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/roles/qa.md +0 -0
  43. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/roles/reviewer.md +0 -0
  44. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/roles/security.md +0 -0
  45. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/roles/ship.md +0 -0
  46. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/roles/writer.md +0 -0
  47. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/skills/careful.md +0 -0
  48. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/skills/commit-helper.md +0 -0
  49. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/skills/compress.md +0 -0
  50. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/skills/context-dump.md +0 -0
  51. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/skills/investigate.md +0 -0
  52. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/skills/learn.md +0 -0
  53. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/skills/parallel-work.md +0 -0
  54. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/skills/plan.md +0 -0
  55. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/skills/review.md +0 -0
  56. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/skills/scaffold.md +0 -0
  57. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/skills/ship.md +0 -0
  58. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/skills/techdebt.md +0 -0
  59. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/seed/skills/verify.md +0 -0
  60. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/skills.py +0 -0
  61. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/store.py +0 -0
  62. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/tools/__init__.py +0 -0
  63. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/tools/base.py +0 -0
  64. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/tools/registry.py +0 -0
  65. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/utils.py +0 -0
  66. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/src/dotai/vet.py +0 -0
  67. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/__init__.py +0 -0
  68. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/conftest.py +0 -0
  69. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_agents.py +0 -0
  70. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_catalog.py +0 -0
  71. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_context.py +0 -0
  72. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_converter.py +0 -0
  73. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_import_agent.py +0 -0
  74. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_insights.py +0 -0
  75. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_maintenance.py +0 -0
  76. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_models.py +0 -0
  77. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_preferences.py +0 -0
  78. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_roles.py +0 -0
  79. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_rules.py +0 -0
  80. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_skills.py +0 -0
  81. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_store.py +0 -0
  82. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_utils.py +0 -0
  83. {dotai_cli-0.7.0 → dotai_cli-0.7.1}/tests/test_vet.py +0 -0
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.7.1 — 2026-11-06
6
+
7
+ ### Fixed
8
+
9
+ - `sync_project` no longer deletes `CLAUDE.md` content after a `# AI Context`
10
+ substring. A legacy generated block is replaced only when the heading is a
11
+ whole line, the next content is the old primer, and the block ends at a
12
+ closing sentence dotai used to write. Text outside that span stays. Any other
13
+ heading is left in place and the managed block is appended.
14
+
5
15
  ## 0.7.0 — 2026-11-04
6
16
 
7
17
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: dotai-cli
3
- Version: 0.7.0
3
+ Version: 0.7.1
4
4
  Summary: Portable engineering judgment for coding agents
5
5
  Project-URL: Homepage, https://github.com/dawalama/dotai
6
6
  Project-URL: Repository, https://github.com/dawalama/dotai
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "dotai-cli"
7
- version = "0.7.0"
7
+ version = "0.7.1"
8
8
  description = "Portable engineering judgment for coding agents"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -1,3 +1,3 @@
1
1
  """dotai — Portable engineering judgment for coding agents."""
2
2
 
3
- __version__ = "0.7.0"
3
+ __version__ = "0.7.1"
@@ -2,6 +2,7 @@
2
2
 
3
3
  import hashlib
4
4
  import json
5
+ import re
5
6
  import shutil
6
7
  from dataclasses import dataclass
7
8
  from datetime import datetime, timezone
@@ -493,6 +494,18 @@ def sync_claude_skills(project_path: Path, skills: list[Skill],
493
494
  DOTAI_MARKER_START = "<!-- dotai:start -->"
494
495
  DOTAI_MARKER_END = "<!-- dotai:end -->"
495
496
 
497
+ # The pre-marker generator opened with this line and closed with one of these
498
+ # sentences. Anything short of that whole span is user text.
499
+ _LEGACY_AI_CONTEXT_HEADING = re.compile(r"^# AI Context[ \t]*\r?$", re.MULTILINE)
500
+ _LEGACY_PRIMER_HEADING = re.compile(
501
+ r"^# AI Knowledge Base(?: \(~/\.ai/\))?[ \t]*\r?$",
502
+ re.MULTILINE,
503
+ )
504
+ _LEGACY_CLOSINGS = (
505
+ "Read `~/.ai/rules.md` and structured rules at the start of every conversation.",
506
+ "Read `~/.ai/rules.md` at the start of every conversation.",
507
+ )
508
+
496
509
 
497
510
  def _merge_with_markers(existing: str, generated: str) -> str:
498
511
  """Replace only the dotai-managed section, preserving everything else."""
@@ -509,6 +522,41 @@ def _merge_with_markers(existing: str, generated: str) -> str:
509
522
  return existing.rstrip() + "\n\n" + block + "\n"
510
523
 
511
524
 
525
+ def _replace_legacy_ai_context(existing: str, section: str) -> str | None:
526
+ """Replace one bounded legacy generated block. Return None when that is unsafe.
527
+
528
+ The old generator opened its managed section with a line that was exactly
529
+ `# AI Context` and closed it with a fixed sentence. Only that span is
530
+ replaced. A different heading, a longer title, or those words inside a
531
+ sentence stay put, and so does every line after the closing sentence.
532
+ """
533
+ block = f"{DOTAI_MARKER_START}\n{section.strip()}\n{DOTAI_MARKER_END}"
534
+ for heading in _LEGACY_AI_CONTEXT_HEADING.finditer(existing):
535
+ tail = existing[heading.end():]
536
+ primer = _LEGACY_PRIMER_HEADING.search(tail)
537
+ if primer is None or tail[: primer.start()].strip():
538
+ continue
539
+ end_at: int | None = None
540
+ end_len = 0
541
+ for closing in _LEGACY_CLOSINGS:
542
+ idx = tail.find(closing, primer.end())
543
+ if idx != -1 and (end_at is None or idx < end_at):
544
+ end_at = idx
545
+ end_len = len(closing)
546
+ if end_at is None:
547
+ continue
548
+ if any(
549
+ line.startswith("# ") and _LEGACY_PRIMER_HEADING.fullmatch(line) is None
550
+ for line in tail[:end_at].splitlines()
551
+ ):
552
+ continue
553
+ before = existing[: heading.start()].rstrip()
554
+ after = tail[end_at + end_len :].strip()
555
+ pieces = [piece for piece in (before, block, after) if piece]
556
+ return "\n\n".join(pieces) + "\n"
557
+ return None
558
+
559
+
512
560
  def sync_project(project_path: Path, config: GlobalConfig, project_name: str | None = None,
513
561
  agents: list[str] | None = None, full: bool = False,
514
562
  extra_prefs: list[str] | None = None) -> list[str]:
@@ -516,7 +564,9 @@ def sync_project(project_path: Path, config: GlobalConfig, project_name: str | N
516
564
 
517
565
  Preserves any existing local content in the target files. dotai-managed
518
566
  content is wrapped in marker comments so re-syncing replaces only the
519
- managed section.
567
+ managed section. A legacy `# AI Context` section is replaced only when it
568
+ is a whole line followed by the old primer and a closing sentence this
569
+ generator wrote. Other uses of that heading are preserved.
520
570
 
521
571
  Args:
522
572
  project_path: Where to write the files
@@ -549,12 +599,13 @@ def sync_project(project_path: Path, config: GlobalConfig, project_name: str | N
549
599
 
550
600
  if claude_path.exists():
551
601
  existing = claude_path.read_text()
552
- # Migrate old-style marker to new markers
553
- if "# AI Context" in existing and DOTAI_MARKER_START not in existing:
554
- before = existing.split("# AI Context")[0].rstrip()
555
- claude_path.write_text(before + "\n\n" + DOTAI_MARKER_START + "\n" + section.strip() + "\n" + DOTAI_MARKER_END + "\n")
556
- else:
602
+ migrated = None
603
+ if DOTAI_MARKER_START not in existing:
604
+ migrated = _replace_legacy_ai_context(existing, section)
605
+ if migrated is None:
557
606
  claude_path.write_text(_merge_with_markers(existing, section))
607
+ else:
608
+ claude_path.write_text(migrated)
558
609
  else:
559
610
  claude_path.write_text(DOTAI_MARKER_START + "\n" + section.strip() + "\n" + DOTAI_MARKER_END + "\n")
560
611
  written.append(str(claude_path))
@@ -11,6 +11,7 @@ from dotai.sync import (
11
11
  DOTAI_MARKER_END,
12
12
  DOTAI_MARKER_START,
13
13
  _merge_with_markers,
14
+ _replace_legacy_ai_context,
14
15
  generate_claude_skill_md,
15
16
  generate_primer,
16
17
  find_git_root,
@@ -186,6 +187,123 @@ class TestSyncProject:
186
187
  assert (project_dir / ".claude" / "skills" / "run_test" / "SKILL.md").exists()
187
188
  assert not (project_dir / ".claude" / "skills" / "run_foreign").exists()
188
189
 
190
+ def test_user_headings_are_not_truncated(self, ai_dir, project_dir, config):
191
+ claude = project_dir / "CLAUDE.md"
192
+ claude.write_text(
193
+ "# Team\n\nUse the formatter.\n\n"
194
+ "## AI Context\n\nUser notes under this heading.\n\n"
195
+ "# AI Contextual notes\n\nKeep this longer heading.\n\n"
196
+ "See the # AI Context section for background.\n\n"
197
+ "## Notes on AI Context\n\nAlso keep this.\n\n"
198
+ "# Deploy\n\nShip on Tuesdays.\n"
199
+ )
200
+
201
+ sync_project(project_dir, config, agents=["claude"])
202
+ result = claude.read_text()
203
+
204
+ assert "Use the formatter." in result
205
+ assert "## AI Context" in result
206
+ assert "User notes under this heading." in result
207
+ assert "Keep this longer heading." in result
208
+ assert "See the # AI Context section for background." in result
209
+ assert "## Notes on AI Context" in result
210
+ assert "Also keep this." in result
211
+ assert "Ship on Tuesdays." in result
212
+ assert result.index("Ship on Tuesdays.") < result.index(DOTAI_MARKER_START)
213
+
214
+ def test_own_ai_context_section_is_kept(self, ai_dir, project_dir, config):
215
+ claude = project_dir / "CLAUDE.md"
216
+ claude.write_text(
217
+ "# Guide\n\n# AI Context\n\nThese are my own notes.\n\n"
218
+ "# Later\n\nStill mine.\n"
219
+ )
220
+
221
+ sync_project(project_dir, config, agents=["claude"])
222
+ result = claude.read_text()
223
+
224
+ assert "These are my own notes." in result
225
+ assert "Still mine." in result
226
+ assert result.index("Still mine.") < result.index(DOTAI_MARKER_START)
227
+
228
+ def test_legacy_block_keeps_surrounding_sections(self, ai_dir, project_dir, config):
229
+ claude = project_dir / "CLAUDE.md"
230
+ claude.write_text(
231
+ "# Team rules\n\nUSER_BEFORE\n\n"
232
+ "# AI Context\n\n"
233
+ "# AI Knowledge Base (~/.ai/)\n\n"
234
+ "LEGACY_BODY_SENTINEL\n\n"
235
+ "Read `~/.ai/rules.md` and structured rules at the start of every conversation.\n\n"
236
+ "# After\n\nUSER_AFTER\n"
237
+ )
238
+
239
+ sync_project(project_dir, config, agents=["claude"])
240
+ result = claude.read_text()
241
+
242
+ assert "USER_BEFORE" in result
243
+ assert "USER_AFTER" in result
244
+ assert "LEGACY_BODY_SENTINEL" not in result
245
+ assert result.count(DOTAI_MARKER_START) == 1
246
+ assert result.index("USER_BEFORE") < result.index(DOTAI_MARKER_START)
247
+ assert result.index(DOTAI_MARKER_END) < result.index("USER_AFTER")
248
+
249
+ sync_project(project_dir, config, agents=["claude"])
250
+ resynced = claude.read_text()
251
+ assert "USER_BEFORE" in resynced
252
+ assert "USER_AFTER" in resynced
253
+ assert resynced.count(DOTAI_MARKER_START) == 1
254
+
255
+ def test_legacy_block_with_extra_heading_is_kept(self, ai_dir, project_dir, config):
256
+ claude = project_dir / "CLAUDE.md"
257
+ claude.write_text(
258
+ "# AI Context\n\n"
259
+ "# AI Knowledge Base (~/.ai/)\n\n"
260
+ "# Custom\n\nCUSTOM_SECTION\n\n"
261
+ "Read `~/.ai/rules.md` and structured rules at the start of every conversation.\n"
262
+ )
263
+
264
+ sync_project(project_dir, config, agents=["claude"])
265
+ result = claude.read_text()
266
+
267
+ assert "CUSTOM_SECTION" in result
268
+ assert result.index("CUSTOM_SECTION") < result.index(DOTAI_MARKER_START)
269
+
270
+
271
+ class TestLegacyAiContext:
272
+ def test_original_closing_sentence_bounds_the_block(self):
273
+ existing = (
274
+ "Preamble\n\n"
275
+ "# AI Context\n\n"
276
+ "# AI Knowledge Base (~/.ai/)\n\n"
277
+ "OLD_PRIMER\n\n"
278
+ "Read `~/.ai/rules.md` at the start of every conversation.\n\n"
279
+ "Notes added later.\n"
280
+ )
281
+ result = _replace_legacy_ai_context(existing, "NEW_SECTION")
282
+ assert result is not None
283
+ assert "Preamble" in result
284
+ assert "Notes added later." in result
285
+ assert "OLD_PRIMER" not in result
286
+ assert "NEW_SECTION" in result
287
+
288
+ def test_user_heading_before_a_real_legacy_block_stays(self):
289
+ existing = (
290
+ "# AI Context\n\nMy own section.\n\n"
291
+ "# AI Context\n\n"
292
+ "# AI Knowledge Base (~/.ai/)\n\n"
293
+ "OLD_PRIMER\n\n"
294
+ "Read `~/.ai/rules.md` and structured rules at the start of every conversation.\n\n"
295
+ "After the generated block.\n"
296
+ )
297
+ result = _replace_legacy_ai_context(existing, "NEW_SECTION")
298
+ assert result is not None
299
+ assert "My own section." in result
300
+ assert "After the generated block." in result
301
+ assert "OLD_PRIMER" not in result
302
+
303
+ def test_substring_is_not_a_legacy_block(self):
304
+ existing = "## AI Context\n\nKeep me.\n"
305
+ assert _replace_legacy_ai_context(existing, "NEW_SECTION") is None
306
+
189
307
 
190
308
  class TestLocalSync:
191
309
  def test_git_repo_defaults_to_local(self, tmp_path, monkeypatch):
@@ -58,7 +58,7 @@ wheels = [
58
58
 
59
59
  [[package]]
60
60
  name = "dotai-cli"
61
- version = "0.6.0"
61
+ version = "0.7.1"
62
62
  source = { editable = "." }
63
63
  dependencies = [
64
64
  { name = "ai-skill-audit" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes