@mindfoldhq/trellis 0.4.0-beta.7 → 0.4.0-beta.9

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 (121) hide show
  1. package/README.md +10 -5
  2. package/dist/cli/index.js +2 -0
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/init.d.ts +2 -0
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +34 -10
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/update.d.ts.map +1 -1
  9. package/dist/commands/update.js +33 -2
  10. package/dist/commands/update.js.map +1 -1
  11. package/dist/configurators/codex.d.ts +7 -4
  12. package/dist/configurators/codex.d.ts.map +1 -1
  13. package/dist/configurators/codex.js +40 -10
  14. package/dist/configurators/codex.js.map +1 -1
  15. package/dist/configurators/copilot.d.ts +9 -0
  16. package/dist/configurators/copilot.d.ts.map +1 -0
  17. package/dist/configurators/copilot.js +34 -0
  18. package/dist/configurators/copilot.js.map +1 -0
  19. package/dist/configurators/index.d.ts +11 -1
  20. package/dist/configurators/index.d.ts.map +1 -1
  21. package/dist/configurators/index.js +59 -4
  22. package/dist/configurators/index.js.map +1 -1
  23. package/dist/configurators/windsurf.d.ts +8 -0
  24. package/dist/configurators/windsurf.d.ts.map +1 -0
  25. package/dist/configurators/windsurf.js +18 -0
  26. package/dist/configurators/windsurf.js.map +1 -0
  27. package/dist/migrations/manifests/0.4.0-beta.8.json +34 -0
  28. package/dist/migrations/manifests/0.4.0-beta.9.json +9 -0
  29. package/dist/templates/claude/commands/trellis/record-session.md +2 -1
  30. package/dist/templates/claude/hooks/inject-subagent-context.py +8 -1
  31. package/dist/templates/claude/hooks/ralph-loop.py +8 -1
  32. package/dist/templates/claude/hooks/session-start.py +31 -7
  33. package/dist/templates/claude/hooks/statusline.py +211 -0
  34. package/dist/templates/claude/settings.json +4 -0
  35. package/dist/templates/codex/agents/check.toml +23 -0
  36. package/dist/templates/codex/agents/implement.toml +19 -0
  37. package/dist/templates/codex/agents/research.toml +26 -0
  38. package/dist/templates/codex/codex-skills/parallel/SKILL.md +194 -0
  39. package/dist/templates/codex/config.toml +5 -0
  40. package/dist/templates/codex/hooks/session-start.py +228 -0
  41. package/dist/templates/codex/hooks.json +16 -0
  42. package/dist/templates/codex/index.d.ts +27 -5
  43. package/dist/templates/codex/index.d.ts.map +1 -1
  44. package/dist/templates/codex/index.js +60 -8
  45. package/dist/templates/codex/index.js.map +1 -1
  46. package/dist/templates/codex/skills/improve-ut/SKILL.md +69 -0
  47. package/dist/templates/codex/skills/record-session/SKILL.md +2 -1
  48. package/dist/templates/copilot/hooks/session-start.py +218 -0
  49. package/dist/templates/copilot/hooks.json +11 -0
  50. package/dist/templates/copilot/index.d.ts +23 -0
  51. package/dist/templates/copilot/index.d.ts.map +1 -0
  52. package/dist/templates/copilot/index.js +54 -0
  53. package/dist/templates/copilot/index.js.map +1 -0
  54. package/dist/templates/copilot/prompts/before-dev.prompt.md +33 -0
  55. package/dist/templates/copilot/prompts/brainstorm.prompt.md +491 -0
  56. package/dist/templates/copilot/prompts/break-loop.prompt.md +129 -0
  57. package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +157 -0
  58. package/dist/templates/copilot/prompts/check.prompt.md +29 -0
  59. package/dist/templates/copilot/prompts/create-command.prompt.md +116 -0
  60. package/dist/templates/copilot/prompts/finish-work.prompt.md +157 -0
  61. package/dist/templates/copilot/prompts/integrate-skill.prompt.md +223 -0
  62. package/dist/templates/copilot/prompts/onboard.prompt.md +362 -0
  63. package/dist/templates/copilot/prompts/parallel.prompt.md +196 -0
  64. package/dist/templates/copilot/prompts/record-session.prompt.md +66 -0
  65. package/dist/templates/copilot/prompts/start.prompt.md +397 -0
  66. package/dist/templates/copilot/prompts/update-spec.prompt.md +358 -0
  67. package/dist/templates/cursor/commands/trellis-record-session.md +2 -1
  68. package/dist/templates/extract.d.ts +29 -0
  69. package/dist/templates/extract.d.ts.map +1 -1
  70. package/dist/templates/extract.js +51 -0
  71. package/dist/templates/extract.js.map +1 -1
  72. package/dist/templates/gemini/commands/trellis/record-session.toml +2 -1
  73. package/dist/templates/iflow/commands/trellis/record-session.md +2 -1
  74. package/dist/templates/iflow/hooks/inject-subagent-context.py +8 -1
  75. package/dist/templates/iflow/hooks/ralph-loop.py +8 -1
  76. package/dist/templates/iflow/hooks/session-start.py +31 -7
  77. package/dist/templates/kilo/workflows/record-session.md +2 -1
  78. package/dist/templates/kiro/skills/record-session/SKILL.md +2 -1
  79. package/dist/templates/markdown/agents.md +4 -0
  80. package/dist/templates/markdown/spec/backend/directory-structure.md +1 -1
  81. package/dist/templates/markdown/workspace-index.md +2 -0
  82. package/dist/templates/opencode/agents/dispatch.md +20 -19
  83. package/dist/templates/opencode/commands/trellis/record-session.md +2 -1
  84. package/dist/templates/opencode/lib/trellis-context.js +42 -2
  85. package/dist/templates/opencode/plugins/session-start.js +7 -27
  86. package/dist/templates/qoder/skills/record-session/SKILL.md +2 -1
  87. package/dist/templates/trellis/scripts/add_session.py +69 -16
  88. package/dist/templates/trellis/scripts/common/__init__.py +2 -0
  89. package/dist/templates/trellis/scripts/common/cli_adapter.py +108 -16
  90. package/dist/templates/trellis/scripts/common/developer.py +2 -2
  91. package/dist/templates/trellis/scripts/common/paths.py +57 -6
  92. package/dist/templates/trellis/scripts/common/task_store.py +6 -4
  93. package/dist/templates/trellis/scripts/common/task_utils.py +14 -8
  94. package/dist/templates/trellis/scripts/multi_agent/plan.py +7 -6
  95. package/dist/templates/trellis/scripts/multi_agent/start.py +16 -11
  96. package/dist/templates/trellis/scripts/task.py +1 -1
  97. package/dist/templates/windsurf/index.d.ts +21 -0
  98. package/dist/templates/windsurf/index.d.ts.map +1 -0
  99. package/dist/templates/windsurf/index.js +44 -0
  100. package/dist/templates/windsurf/index.js.map +1 -0
  101. package/dist/templates/windsurf/workflows/trellis-before-dev.md +31 -0
  102. package/dist/templates/windsurf/workflows/trellis-brainstorm.md +491 -0
  103. package/dist/templates/windsurf/workflows/trellis-break-loop.md +111 -0
  104. package/dist/templates/windsurf/workflows/trellis-check-cross-layer.md +157 -0
  105. package/dist/templates/windsurf/workflows/trellis-check.md +27 -0
  106. package/dist/templates/windsurf/workflows/trellis-create-command.md +154 -0
  107. package/dist/templates/windsurf/workflows/trellis-finish-work.md +147 -0
  108. package/dist/templates/windsurf/workflows/trellis-integrate-skill.md +220 -0
  109. package/dist/templates/windsurf/workflows/trellis-onboard.md +362 -0
  110. package/dist/templates/windsurf/workflows/trellis-record-session.md +66 -0
  111. package/dist/templates/windsurf/workflows/trellis-start.md +373 -0
  112. package/dist/templates/windsurf/workflows/trellis-update-spec.md +358 -0
  113. package/dist/types/ai-tools.d.ts +15 -3
  114. package/dist/types/ai-tools.d.ts.map +1 -1
  115. package/dist/types/ai-tools.js +34 -2
  116. package/dist/types/ai-tools.js.map +1 -1
  117. package/dist/utils/template-fetcher.d.ts +17 -4
  118. package/dist/utils/template-fetcher.d.ts.map +1 -1
  119. package/dist/utils/template-fetcher.js +94 -12
  120. package/dist/utils/template-fetcher.js.map +1 -1
  121. package/package.json +1 -1
@@ -0,0 +1,228 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ Codex Session Start Hook - Inject Trellis context into Codex sessions.
5
+
6
+ Output format follows Codex hook protocol:
7
+ stdout JSON → { hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: "..." } }
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import json
13
+ import os
14
+ import subprocess
15
+ import sys
16
+ import warnings
17
+ from io import StringIO
18
+ from pathlib import Path
19
+
20
+ warnings.filterwarnings("ignore")
21
+
22
+
23
+ def should_skip_injection() -> bool:
24
+ return os.environ.get("CODEX_NON_INTERACTIVE") == "1"
25
+
26
+
27
+ def read_file(path: Path, fallback: str = "") -> str:
28
+ try:
29
+ return path.read_text(encoding="utf-8")
30
+ except (FileNotFoundError, PermissionError):
31
+ return fallback
32
+
33
+
34
+ def run_script(script_path: Path) -> str:
35
+ try:
36
+ env = os.environ.copy()
37
+ env["PYTHONIOENCODING"] = "utf-8"
38
+ cmd = [sys.executable, "-W", "ignore", str(script_path)]
39
+ result = subprocess.run(
40
+ cmd,
41
+ capture_output=True,
42
+ text=True,
43
+ encoding="utf-8",
44
+ errors="replace",
45
+ timeout=5,
46
+ cwd=str(script_path.parent.parent.parent),
47
+ env=env,
48
+ )
49
+ return result.stdout if result.returncode == 0 else "No context available"
50
+ except (subprocess.TimeoutExpired, FileNotFoundError, PermissionError):
51
+ return "No context available"
52
+
53
+
54
+ def _normalize_task_ref(task_ref: str) -> str:
55
+ normalized = task_ref.strip()
56
+ if not normalized:
57
+ return ""
58
+
59
+ path_obj = Path(normalized)
60
+ if path_obj.is_absolute():
61
+ return str(path_obj)
62
+
63
+ normalized = normalized.replace("\\", "/")
64
+ while normalized.startswith("./"):
65
+ normalized = normalized[2:]
66
+
67
+ if normalized.startswith("tasks/"):
68
+ return f".trellis/{normalized}"
69
+
70
+ return normalized
71
+
72
+
73
+ def _resolve_task_dir(trellis_dir: Path, task_ref: str) -> Path:
74
+ normalized = _normalize_task_ref(task_ref)
75
+ path_obj = Path(normalized)
76
+ if path_obj.is_absolute():
77
+ return path_obj
78
+ if normalized.startswith(".trellis/"):
79
+ return trellis_dir.parent / path_obj
80
+ return trellis_dir / "tasks" / path_obj
81
+
82
+
83
+ def _get_task_status(trellis_dir: Path) -> str:
84
+ current_task_file = trellis_dir / ".current-task"
85
+ if not current_task_file.is_file():
86
+ return "Status: NO ACTIVE TASK\nNext: Describe what you want to work on"
87
+
88
+ task_ref = _normalize_task_ref(current_task_file.read_text(encoding="utf-8").strip())
89
+ if not task_ref:
90
+ return "Status: NO ACTIVE TASK\nNext: Describe what you want to work on"
91
+
92
+ task_dir = _resolve_task_dir(trellis_dir, task_ref)
93
+ if not task_dir.is_dir():
94
+ return f"Status: STALE POINTER\nTask: {task_ref}\nNext: Task directory not found. Run: python3 ./.trellis/scripts/task.py finish"
95
+
96
+ task_json_path = task_dir / "task.json"
97
+ task_data: dict = {}
98
+ if task_json_path.is_file():
99
+ try:
100
+ task_data = json.loads(task_json_path.read_text(encoding="utf-8"))
101
+ except (json.JSONDecodeError, PermissionError):
102
+ pass
103
+
104
+ task_title = task_data.get("title", task_ref)
105
+ task_status = task_data.get("status", "unknown")
106
+
107
+ if task_status == "completed":
108
+ return f"Status: COMPLETED\nTask: {task_title}\nNext: Archive with `python3 ./.trellis/scripts/task.py archive {task_dir.name}` or start a new task"
109
+
110
+ has_context = False
111
+ for jsonl_name in ("implement.jsonl", "check.jsonl", "spec.jsonl"):
112
+ jsonl_path = task_dir / jsonl_name
113
+ if jsonl_path.is_file() and jsonl_path.stat().st_size > 0:
114
+ has_context = True
115
+ break
116
+
117
+ has_prd = (task_dir / "prd.md").is_file()
118
+
119
+ if not has_prd:
120
+ return f"Status: NOT READY\nTask: {task_title}\nMissing: prd.md not created\nNext: Write PRD, then research → init-context → start"
121
+
122
+ if not has_context:
123
+ return f"Status: NOT READY\nTask: {task_title}\nMissing: Context not configured (no jsonl files)\nNext: Complete Phase 2 (research → init-context → start) before implementing"
124
+
125
+ return f"Status: READY\nTask: {task_title}\nNext: Continue with implement or check"
126
+
127
+
128
+ def main() -> None:
129
+ if should_skip_injection():
130
+ sys.exit(0)
131
+
132
+ # Read hook input from stdin
133
+ try:
134
+ hook_input = json.loads(sys.stdin.read())
135
+ project_dir = Path(hook_input.get("cwd", ".")).resolve()
136
+ except (json.JSONDecodeError, KeyError):
137
+ project_dir = Path(".").resolve()
138
+
139
+ trellis_dir = project_dir / ".trellis"
140
+ codex_dir = project_dir / ".codex"
141
+
142
+ output = StringIO()
143
+
144
+ output.write("""<session-context>
145
+ You are starting a new session in a Trellis-managed project.
146
+ Read and follow all instructions below carefully.
147
+ </session-context>
148
+
149
+ """)
150
+
151
+ output.write("<current-state>\n")
152
+ context_script = trellis_dir / "scripts" / "get_context.py"
153
+ output.write(run_script(context_script))
154
+ output.write("\n</current-state>\n\n")
155
+
156
+ output.write("<workflow>\n")
157
+ workflow_content = read_file(trellis_dir / "workflow.md", "No workflow.md found")
158
+ output.write(workflow_content)
159
+ output.write("\n</workflow>\n\n")
160
+
161
+ output.write("<guidelines>\n")
162
+ output.write("**Note**: The guidelines below are index files — they list available guideline documents and their locations.\n")
163
+ output.write("During actual development, you MUST read the specific guideline files listed in each index's Pre-Development Checklist.\n\n")
164
+
165
+ spec_dir = trellis_dir / "spec"
166
+ if spec_dir.is_dir():
167
+ for sub in sorted(spec_dir.iterdir()):
168
+ if not sub.is_dir() or sub.name.startswith("."):
169
+ continue
170
+
171
+ if sub.name == "guides":
172
+ index_file = sub / "index.md"
173
+ if index_file.is_file():
174
+ output.write(f"## {sub.name}\n")
175
+ output.write(read_file(index_file))
176
+ output.write("\n\n")
177
+ continue
178
+
179
+ index_file = sub / "index.md"
180
+ if index_file.is_file():
181
+ output.write(f"## {sub.name}\n")
182
+ output.write(read_file(index_file))
183
+ output.write("\n\n")
184
+ else:
185
+ for nested in sorted(sub.iterdir()):
186
+ if not nested.is_dir():
187
+ continue
188
+ nested_index = nested / "index.md"
189
+ if nested_index.is_file():
190
+ output.write(f"## {sub.name}/{nested.name}\n")
191
+ output.write(read_file(nested_index))
192
+ output.write("\n\n")
193
+
194
+ output.write("</guidelines>\n\n")
195
+
196
+ # Inject start skill as instructions (Codex uses skills, not slash commands)
197
+ start_skill = codex_dir / "skills" / "start" / "SKILL.md"
198
+ if not start_skill.is_file():
199
+ start_skill = project_dir / ".agents" / "skills" / "start" / "SKILL.md"
200
+ if start_skill.is_file():
201
+ output.write("<instructions>\n")
202
+ output.write(read_file(start_skill))
203
+ output.write("\n</instructions>\n\n")
204
+
205
+ task_status = _get_task_status(trellis_dir)
206
+ output.write(f"<task-status>\n{task_status}\n</task-status>\n\n")
207
+
208
+ output.write("""<ready>
209
+ Context loaded. Steps 1-3 (workflow, context, guidelines) are already injected above — do NOT re-read them.
210
+ Start from Step 4. Wait for user's first message, then follow <instructions> to handle their request.
211
+ If there is an active task, ask whether to continue it.
212
+ </ready>""")
213
+
214
+ context = output.getvalue()
215
+ result = {
216
+ "suppressOutput": True,
217
+ "systemMessage": f"Trellis context injected ({len(context)} chars)",
218
+ "hookSpecificOutput": {
219
+ "hookEventName": "SessionStart",
220
+ "additionalContext": context,
221
+ },
222
+ }
223
+
224
+ print(json.dumps(result, ensure_ascii=False), flush=True)
225
+
226
+
227
+ if __name__ == "__main__":
228
+ main()
@@ -0,0 +1,16 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "{{PYTHON_CMD}} .codex/hooks/session-start.py",
9
+ "timeout": 15,
10
+ "statusMessage": "Loading Trellis context..."
11
+ }
12
+ ]
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -1,18 +1,40 @@
1
1
  /**
2
- * Codex skill templates
2
+ * Codex templates
3
3
  *
4
4
  * These are GENERIC templates for user projects.
5
- * Do NOT use Trellis project's own .agents/skills directory (which may be customized).
5
+ * Do NOT use Trellis project's own .agents/skills or .codex directories
6
+ * (which may be customized).
6
7
  *
7
8
  * Directory structure:
8
9
  * codex/
9
- * └── skills/
10
- * └── <skill-name>/
11
- * └── SKILL.md
10
+ * ├── agents/ # Project-scoped Codex custom agents (.toml)
11
+ * ├── codex-skills/ # Codex-specific skills → .codex/skills/
12
+ * ├── skills/ # Shared skills → .agents/skills/
13
+ * └── config.toml # Project-scoped Codex config
12
14
  */
13
15
  export interface SkillTemplate {
14
16
  name: string;
15
17
  content: string;
16
18
  }
19
+ export interface AgentTemplate {
20
+ name: string;
21
+ content: string;
22
+ }
23
+ export interface ConfigTemplate {
24
+ targetPath: string;
25
+ content: string;
26
+ }
17
27
  export declare function getAllSkills(): SkillTemplate[];
28
+ export declare function getAllAgents(): AgentTemplate[];
29
+ /**
30
+ * Get Codex-specific skills (installed to .codex/skills/, not shared .agents/skills/).
31
+ */
32
+ export declare function getAllCodexSkills(): SkillTemplate[];
33
+ export interface HookTemplate {
34
+ name: string;
35
+ content: string;
36
+ }
37
+ export declare function getAllHooks(): HookTemplate[];
38
+ export declare function getHooksConfig(): string;
39
+ export declare function getConfigTemplate(): ConfigTemplate;
18
40
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/codex/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwBH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,YAAY,IAAI,aAAa,EAAE,CAS9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/codex/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAgCH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,YAAY,IAAI,aAAa,EAAE,CAS9C;AAED,wBAAgB,YAAY,IAAI,aAAa,EAAE,CAc9C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,EAAE,CASnD;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,WAAW,IAAI,YAAY,EAAE,CAW5C;AAED,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,wBAAgB,iBAAiB,IAAI,cAAc,CAKlD"}
@@ -1,14 +1,16 @@
1
1
  /**
2
- * Codex skill templates
2
+ * Codex templates
3
3
  *
4
4
  * These are GENERIC templates for user projects.
5
- * Do NOT use Trellis project's own .agents/skills directory (which may be customized).
5
+ * Do NOT use Trellis project's own .agents/skills or .codex directories
6
+ * (which may be customized).
6
7
  *
7
8
  * Directory structure:
8
9
  * codex/
9
- * └── skills/
10
- * └── <skill-name>/
11
- * └── SKILL.md
10
+ * ├── agents/ # Project-scoped Codex custom agents (.toml)
11
+ * ├── codex-skills/ # Codex-specific skills → .codex/skills/
12
+ * ├── skills/ # Shared skills → .agents/skills/
13
+ * └── config.toml # Project-scoped Codex config
12
14
  */
13
15
  import { readdirSync, readFileSync } from "node:fs";
14
16
  import { dirname, join } from "node:path";
@@ -18,9 +20,9 @@ const __dirname = dirname(__filename);
18
20
  function readTemplate(relativePath) {
19
21
  return readFileSync(join(__dirname, relativePath), "utf-8");
20
22
  }
21
- function listSkillNames() {
23
+ function listDirectories(dir) {
22
24
  try {
23
- return readdirSync(join(__dirname, "skills"), { withFileTypes: true })
25
+ return readdirSync(join(__dirname, dir), { withFileTypes: true })
24
26
  .filter((entry) => entry.isDirectory())
25
27
  .map((entry) => entry.name)
26
28
  .sort();
@@ -29,12 +31,62 @@ function listSkillNames() {
29
31
  return [];
30
32
  }
31
33
  }
34
+ function listFiles(dir) {
35
+ try {
36
+ return readdirSync(join(__dirname, dir)).sort();
37
+ }
38
+ catch {
39
+ return [];
40
+ }
41
+ }
32
42
  export function getAllSkills() {
33
43
  const skills = [];
34
- for (const name of listSkillNames()) {
44
+ for (const name of listDirectories("skills")) {
35
45
  const content = readTemplate(`skills/${name}/SKILL.md`);
36
46
  skills.push({ name, content });
37
47
  }
38
48
  return skills;
39
49
  }
50
+ export function getAllAgents() {
51
+ const agents = [];
52
+ for (const file of listFiles("agents")) {
53
+ if (!file.endsWith(".toml")) {
54
+ continue;
55
+ }
56
+ const name = file.replace(".toml", "");
57
+ const content = readTemplate(`agents/${file}`);
58
+ agents.push({ name, content });
59
+ }
60
+ return agents;
61
+ }
62
+ /**
63
+ * Get Codex-specific skills (installed to .codex/skills/, not shared .agents/skills/).
64
+ */
65
+ export function getAllCodexSkills() {
66
+ const skills = [];
67
+ for (const name of listDirectories("codex-skills")) {
68
+ const content = readTemplate(`codex-skills/${name}/SKILL.md`);
69
+ skills.push({ name, content });
70
+ }
71
+ return skills;
72
+ }
73
+ export function getAllHooks() {
74
+ const hooks = [];
75
+ for (const file of listFiles("hooks")) {
76
+ if (!file.endsWith(".py")) {
77
+ continue;
78
+ }
79
+ hooks.push({ name: file, content: readTemplate(`hooks/${file}`) });
80
+ }
81
+ return hooks;
82
+ }
83
+ export function getHooksConfig() {
84
+ return readTemplate("hooks.json");
85
+ }
86
+ export function getConfigTemplate() {
87
+ return {
88
+ targetPath: "config.toml",
89
+ content: readTemplate("config.toml"),
90
+ };
91
+ }
40
92
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/codex/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;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,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,cAAc;IACrB,IAAI,CAAC;QACH,OAAO,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;aACnE,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,K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EG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,MAAM,GAAoB,EAAE,CAAC;IAEnC,KAAK,MAAM,IAAI,IAAI,eAAe,CAAC,cAAc,CAAC,EAAE,CAAC;QACnD,MAAM,OAAO,GAAG,YAAY,CAAC,gBAAgB,IAAI,WAAW,CAAC,CAAC;QAC9D,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAOD,MAAM,UAAU,WAAW;IACzB,MAAM,KAAK,GAAmB,EAAE,CAAC;IAEjC,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,SAAS;QACX,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO;QACL,UAAU,EAAE,aAAa;QACzB,OAAO,EAAE,YAAY,CAAC,aAAa,CAAC;KACrC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: improve-ut
3
+ description: "Analyzes changed files and improves unit test coverage using project-specific testing conventions from .trellis/spec/ unit-test specs. Determines test scope (unit vs integration vs regression), adds or updates tests following existing patterns, and runs validation. Use when code changes need test coverage, after implementing a feature, after fixing a bug, or when test gaps are identified."
4
+ ---
5
+
6
+ # Improve Unit Tests (UT)
7
+
8
+ Use this skill to improve test coverage after code changes.
9
+
10
+ ## Usage
11
+
12
+ ```text
13
+ $improve-ut
14
+ ```
15
+
16
+ ## Source of Truth
17
+
18
+ Discover and read unit-test specs dynamically:
19
+
20
+ ```bash
21
+ # Discover available packages and their spec layers
22
+ python3 ./.trellis/scripts/get_context.py --mode packages
23
+ ```
24
+
25
+ Look for packages with `unit-test` spec layer in the output. For each discovered `unit-test/` directory, read all relevant spec files inside it (for example `index.md`, `conventions.md`, `integration-patterns.md`, `mock-strategies.md`).
26
+
27
+ > If this skill conflicts with the unit-test specs, the specs win.
28
+
29
+ ---
30
+
31
+ ## Execution Flow
32
+
33
+ 1. Inspect changed files:
34
+ - `git diff --name-only`
35
+ 2. Decide test scope using unit-test specs:
36
+ - unit vs integration vs regression
37
+ - mock vs real filesystem flow
38
+ 3. Add/update tests using existing project test patterns
39
+ 4. Run validation:
40
+
41
+ ```bash
42
+ pnpm lint
43
+ pnpm typecheck
44
+ pnpm test
45
+ ```
46
+
47
+ 5. Summarize decisions, updates, and remaining test gaps.
48
+
49
+ ---
50
+
51
+ ## Output Format
52
+
53
+ ```markdown
54
+ ## UT Coverage Plan
55
+ - Changed areas: ...
56
+ - Test scope (unit/integration/regression): ...
57
+
58
+ ## Test Updates
59
+ - Added: ...
60
+ - Updated: ...
61
+
62
+ ## Validation
63
+ - pnpm lint: pass/fail
64
+ - pnpm typecheck: pass/fail
65
+ - pnpm test: pass/fail
66
+
67
+ ## Gaps / Follow-ups
68
+ - <none or explicit rationale>
69
+ ```
@@ -51,6 +51,7 @@ EOF
51
51
  **Auto-completes**:
52
52
  - [OK] Appends session to journal-N.md
53
53
  - [OK] Auto-detects line count, creates new file if >2000 lines
54
+ - [OK] Auto-detects Branch context (`--branch` override; otherwise Branch = task.json -> current git branch; missing values are omitted gracefully)
54
55
  - [OK] Updates index.md (Total Sessions +1, Last Active, line stats, history)
55
56
  - [OK] Auto-commits .trellis/workspace and .trellis/tasks changes
56
57
 
@@ -61,6 +62,6 @@ EOF
61
62
  | Command | Purpose |
62
63
  |---------|---------|
63
64
  | `python3 ./.trellis/scripts/get_context.py --mode record` | Get context for record-session |
64
- | `python3 ./.trellis/scripts/add_session.py --title "..." --commit "..."` | **One-click add session (recommended)** |
65
+ | `python3 ./.trellis/scripts/add_session.py --title "..." --commit "..."` | **One-click add session (recommended, branch auto-complete)** |
65
66
  | `python3 ./.trellis/scripts/task.py archive <name>` | Archive completed task (auto-commits) |
66
67
  | `python3 ./.trellis/scripts/task.py list` | List active tasks |