mini-trellis 0.3.7 → 0.4.0
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.
- package/README.md +77 -202
- package/dist/cli/index.js +12 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +22 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +5 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +15 -1
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/refresh.d.ts +11 -14
- package/dist/commands/refresh.d.ts.map +1 -1
- package/dist/commands/refresh.js +78 -9
- package/dist/commands/refresh.js.map +1 -1
- package/dist/commands/uninstall.js +1 -1
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/upgrade.d.ts +4 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +51 -0
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +25 -1
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/kiro.d.ts +3 -0
- package/dist/configurators/kiro.d.ts.map +1 -0
- package/dist/configurators/kiro.js +24 -0
- package/dist/configurators/kiro.js.map +1 -0
- package/dist/configurators/pi.d.ts +1 -0
- package/dist/configurators/pi.d.ts.map +1 -1
- package/dist/configurators/pi.js +17 -7
- package/dist/configurators/pi.js.map +1 -1
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +2 -0
- package/dist/configurators/shared.js.map +1 -1
- package/dist/templates/common/bundled-skills/mini-trellis-session-insight/SKILL.md +1 -1
- package/dist/templates/common/bundled-skills/mini-trellis-session-insight/references/organize-history.md +2 -2
- package/dist/templates/common/commands/remember.md +16 -4
- package/dist/templates/common/skills/update-spec.md +8 -4
- package/dist/templates/markdown/agents.md +7 -5
- package/dist/templates/markdown/spec/guides/mini-memory.md.txt +7 -3
- package/dist/templates/shared-hooks/index.d.ts +1 -1
- package/dist/templates/shared-hooks/index.d.ts.map +1 -1
- package/dist/templates/shared-hooks/index.js +1 -0
- package/dist/templates/shared-hooks/index.js.map +1 -1
- package/dist/templates/shared-hooks/session-start.py +33 -6
- package/dist/templates/trellis/gitattributes.txt +5 -6
- package/dist/templates/trellis/scripts/add_session.py +241 -175
- package/dist/templates/trellis/scripts/common/paths.py +12 -5
- package/dist/templates/trellis/scripts/common/recording_lock.py +71 -0
- package/dist/types/ai-tools.d.ts +2 -2
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +32 -0
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/utils/kiro-hooks.d.ts +4 -0
- package/dist/utils/kiro-hooks.d.ts.map +1 -0
- package/dist/utils/kiro-hooks.js +47 -0
- package/dist/utils/kiro-hooks.js.map +1 -0
- package/dist/utils/managed-removal.d.ts.map +1 -1
- package/dist/utils/managed-removal.js +6 -0
- package/dist/utils/managed-removal.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/shared-hooks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,SAAS,YAAY,CAAC,YAAoB;IACxC,OAAO,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,YA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4B;IAE5B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpE,OAAO,oBAAoB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -75,6 +75,20 @@ MAX_CONTEXT_CHARS = 4000
|
|
|
75
75
|
RUNTIME_STATUS_VERSION = 1
|
|
76
76
|
_LAST_PROJECT_DIR: Path | None = None
|
|
77
77
|
|
|
78
|
+
|
|
79
|
+
def _resolve_project_dir(start: Path) -> Path:
|
|
80
|
+
"""Use the same nearest-project/Git boundary as recording and recall."""
|
|
81
|
+
current = start.resolve()
|
|
82
|
+
while True:
|
|
83
|
+
trellis = current / ".trellis"
|
|
84
|
+
if trellis.is_dir() and not trellis.is_symlink():
|
|
85
|
+
return current
|
|
86
|
+
if (current / ".git").exists():
|
|
87
|
+
return current
|
|
88
|
+
if current == current.parent:
|
|
89
|
+
return start.resolve()
|
|
90
|
+
current = current.parent
|
|
91
|
+
|
|
78
92
|
# Force UTF-8 on stdin/stdout/stderr on Windows. Default codepage there is
|
|
79
93
|
# cp936 / cp1252 / etc. — non-ASCII content (Chinese task names, prd snippets)
|
|
80
94
|
# both in stdin (hook payload from host CLI) and stdout (our emitted blocks)
|
|
@@ -538,6 +552,8 @@ def _write_runtime_status(trellis_dir: Path, platform: str | None, status: str,
|
|
|
538
552
|
try:
|
|
539
553
|
host = {"claude": "claude-code", "droid": "factory"}.get(platform or "", platform or "unknown")
|
|
540
554
|
target = trellis_dir / ".runtime" / "hooks" / f"{host}.json"
|
|
555
|
+
if not target.resolve().is_relative_to(trellis_dir.parent.resolve()):
|
|
556
|
+
raise OSError("hook diagnostics escape the project")
|
|
541
557
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
542
558
|
payload = {"schema": 1, "platform": host, "last_hook_at": datetime.now(timezone.utc).isoformat(), "last_status": status, "last_output_chars": max(0, int(output_chars))}
|
|
543
559
|
if error_category: payload["last_error_category"] = error_category
|
|
@@ -588,8 +604,13 @@ def _main_impl():
|
|
|
588
604
|
break
|
|
589
605
|
if project_dir is None:
|
|
590
606
|
project_dir = Path(_normalize_windows_shell_path(hook_input.get("cwd", "."))).resolve()
|
|
607
|
+
project_dir = _resolve_project_dir(project_dir)
|
|
591
608
|
|
|
592
609
|
trellis_dir = project_dir / ".trellis"
|
|
610
|
+
if not trellis_dir.is_dir() or trellis_dir.is_symlink():
|
|
611
|
+
# An independent, uninitialized project must not borrow parent state
|
|
612
|
+
# or become initialized merely because an inherited hook ran here.
|
|
613
|
+
return
|
|
593
614
|
global _LAST_PROJECT_DIR
|
|
594
615
|
_LAST_PROJECT_DIR = project_dir
|
|
595
616
|
context_key = _resolve_context_key(trellis_dir, hook_input)
|
|
@@ -609,6 +630,8 @@ def _main_impl():
|
|
|
609
630
|
platform = _detect_platform(hook_input)
|
|
610
631
|
if platform in {"codex", "zcode"}:
|
|
611
632
|
remember_command = "$mini-trellis-remember"
|
|
633
|
+
elif platform == "kiro":
|
|
634
|
+
remember_command = "/mini-trellis-remember"
|
|
612
635
|
elif platform in {"cursor", "codebuddy"}:
|
|
613
636
|
remember_command = "mini-trellis-remember"
|
|
614
637
|
else:
|
|
@@ -635,11 +658,15 @@ mini-trellis SessionStart context. Orient from journal, spec, and research.
|
|
|
635
658
|
"approaches, and project rules. If the excerpt answers the question with its "
|
|
636
659
|
"source and conditions, cite it and stop; use `mini-trellis mem read <ref>` "
|
|
637
660
|
"only for missing context. Do not repeat a sufficient lookup.\n"
|
|
638
|
-
"
|
|
639
|
-
"
|
|
640
|
-
|
|
641
|
-
"
|
|
642
|
-
"
|
|
661
|
+
"Keep one current rule in its existing document. On a confirmed or corrected rule, "
|
|
662
|
+
f"run `{remember_command}` even without an explicit remember request, unless told "
|
|
663
|
+
"not to save. Future policy is agreed, not implemented. Finish topic, verification "
|
|
664
|
+
"and journal together; reuse unchanged file contents. Preserve conditions and "
|
|
665
|
+
"negations. New notes follow the discussion language; updates keep theirs.\n"
|
|
666
|
+
"Memory-only reply: one short sentence with topic/journal Markdown links; explain "
|
|
667
|
+
"conflicts or partial writes. With implementation, update stale README/docs/spec/research "
|
|
668
|
+
"descriptions and status; no separate remember request or journal is needed. Questions, "
|
|
669
|
+
"reviews and unconfirmed proposals need no recording. Commit only when asked.\n"
|
|
643
670
|
)
|
|
644
671
|
|
|
645
672
|
if source == "compact" and platform in {"cursor", "codebuddy", "zcode"}:
|
|
@@ -688,7 +715,7 @@ Context loaded. Use journal, spec, research, and `mini-trellis mem` on demand. R
|
|
|
688
715
|
|
|
689
716
|
content_hash = hashlib.sha256(context_text.encode("utf-8")).hexdigest()[:24]
|
|
690
717
|
|
|
691
|
-
# Kiro
|
|
718
|
+
# Kiro SessionStart adds a hook's stdout directly to the
|
|
692
719
|
# conversation context — no JSON envelope. Emit the bare overview text.
|
|
693
720
|
# Conditionally isolated: all other platforms keep the JSON path below.
|
|
694
721
|
if _detect_platform(hook_input) == "kiro":
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
# Trellis:
|
|
2
|
-
#
|
|
3
|
-
#
|
|
1
|
+
# Trellis: retain appended text when journals meet across worktrees.
|
|
2
|
+
# Union is not record-aware: concurrent uncommitted writers can reuse a
|
|
3
|
+
# session number or interleave blocks. Review both records after merging.
|
|
4
4
|
#
|
|
5
5
|
# Do NOT add a rule for workspace/*/index.md here — it is fully regenerated
|
|
6
|
-
# every session
|
|
7
|
-
#
|
|
8
|
-
# .trellis/spec/cli/backend/directory-structure.md for details.
|
|
6
|
+
# every session. Resolve conflicts using both journals; picking either side
|
|
7
|
+
# can omit a history row. Preserve user-maintained index content.
|
|
9
8
|
.trellis/workspace/*/journal-*.md merge=union
|