@mindfoldhq/trellis 0.3.10 → 0.4.0-beta.10
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 +19 -5
- package/dist/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +240 -43
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +206 -47
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/codebuddy.d.ts +11 -0
- package/dist/configurators/codebuddy.d.ts.map +1 -0
- package/dist/configurators/codebuddy.js +58 -0
- package/dist/configurators/codebuddy.js.map +1 -0
- package/dist/configurators/codex.d.ts +7 -4
- package/dist/configurators/codex.d.ts.map +1 -1
- package/dist/configurators/codex.js +40 -10
- package/dist/configurators/codex.js.map +1 -1
- package/dist/configurators/copilot.d.ts +9 -0
- package/dist/configurators/copilot.d.ts.map +1 -0
- package/dist/configurators/copilot.js +34 -0
- package/dist/configurators/copilot.js.map +1 -0
- package/dist/configurators/index.d.ts +11 -1
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +72 -4
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/opencode.d.ts +1 -1
- package/dist/configurators/opencode.js +1 -1
- package/dist/configurators/windsurf.d.ts +8 -0
- package/dist/configurators/windsurf.d.ts.map +1 -0
- package/dist/configurators/windsurf.js +18 -0
- package/dist/configurators/windsurf.js.map +1 -0
- package/dist/configurators/workflow.d.ts +6 -2
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +90 -58
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +2 -0
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/manifests/0.4.0-beta.1.json +228 -0
- package/dist/migrations/manifests/0.4.0-beta.10.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.3.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.4.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.5.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.6.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.7.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.8.json +34 -0
- package/dist/migrations/manifests/0.4.0-beta.9.json +9 -0
- package/dist/templates/claude/agents/dispatch.md +1 -2
- package/dist/templates/claude/agents/implement.md +2 -3
- package/dist/templates/claude/commands/trellis/before-dev.md +29 -0
- package/dist/templates/claude/commands/trellis/check.md +25 -0
- package/dist/templates/claude/commands/trellis/create-command.md +2 -2
- package/dist/templates/claude/commands/trellis/onboard.md +13 -13
- package/dist/templates/claude/commands/trellis/parallel.md +1 -2
- package/dist/templates/claude/commands/trellis/record-session.md +3 -2
- package/dist/templates/claude/commands/trellis/start.md +8 -4
- package/dist/templates/claude/hooks/inject-subagent-context.py +29 -14
- package/dist/templates/claude/hooks/ralph-loop.py +18 -10
- package/dist/templates/claude/hooks/session-start.py +201 -9
- package/dist/templates/claude/hooks/statusline.py +211 -0
- package/dist/templates/claude/settings.json +4 -0
- package/dist/templates/codebuddy/commands/trellis/before-dev.md +29 -0
- package/dist/templates/codebuddy/commands/trellis/brainstorm.md +487 -0
- package/dist/templates/codebuddy/commands/trellis/break-loop.md +107 -0
- package/dist/templates/codebuddy/commands/trellis/check-cross-layer.md +153 -0
- package/dist/templates/codebuddy/commands/trellis/check.md +25 -0
- package/dist/templates/codebuddy/commands/trellis/create-command.md +154 -0
- package/dist/templates/codebuddy/commands/trellis/finish-work.md +143 -0
- package/dist/templates/codebuddy/commands/trellis/integrate-skill.md +219 -0
- package/dist/templates/codebuddy/commands/trellis/onboard.md +358 -0
- package/dist/templates/codebuddy/commands/trellis/record-session.md +61 -0
- package/dist/templates/codebuddy/commands/trellis/start.md +373 -0
- package/dist/templates/codebuddy/commands/trellis/update-spec.md +354 -0
- package/dist/templates/codebuddy/index.d.ts +25 -0
- package/dist/templates/codebuddy/index.d.ts.map +1 -0
- package/dist/templates/codebuddy/index.js +45 -0
- package/dist/templates/codebuddy/index.js.map +1 -0
- package/dist/templates/codex/agents/check.toml +23 -0
- package/dist/templates/codex/agents/implement.toml +19 -0
- package/dist/templates/codex/agents/research.toml +26 -0
- package/dist/templates/codex/codex-skills/parallel/SKILL.md +194 -0
- package/dist/templates/codex/config.toml +5 -0
- package/dist/templates/codex/hooks/session-start.py +228 -0
- package/dist/templates/codex/hooks.json +16 -0
- package/dist/templates/codex/index.d.ts +27 -5
- package/dist/templates/codex/index.d.ts.map +1 -1
- package/dist/templates/codex/index.js +60 -8
- package/dist/templates/codex/index.js.map +1 -1
- package/dist/templates/codex/skills/before-dev/SKILL.md +34 -0
- package/dist/templates/codex/skills/brainstorm/SKILL.md +1 -1
- package/dist/templates/codex/skills/break-loop/SKILL.md +1 -1
- package/dist/templates/codex/skills/check/SKILL.md +30 -0
- package/dist/templates/codex/skills/check-cross-layer/SKILL.md +1 -1
- package/dist/templates/codex/skills/create-command/SKILL.md +3 -3
- package/dist/templates/codex/skills/finish-work/SKILL.md +1 -1
- package/dist/templates/codex/skills/improve-ut/SKILL.md +69 -0
- package/dist/templates/codex/skills/integrate-skill/SKILL.md +1 -1
- package/dist/templates/codex/skills/onboard/SKILL.md +12 -12
- package/dist/templates/codex/skills/record-session/SKILL.md +4 -3
- package/dist/templates/codex/skills/start/SKILL.md +9 -4
- package/dist/templates/codex/skills/update-spec/SKILL.md +1 -1
- package/dist/templates/copilot/hooks/session-start.py +218 -0
- package/dist/templates/copilot/hooks.json +11 -0
- package/dist/templates/copilot/index.d.ts +23 -0
- package/dist/templates/copilot/index.d.ts.map +1 -0
- package/dist/templates/copilot/index.js +54 -0
- package/dist/templates/copilot/index.js.map +1 -0
- package/dist/templates/copilot/prompts/before-dev.prompt.md +33 -0
- package/dist/templates/copilot/prompts/brainstorm.prompt.md +491 -0
- package/dist/templates/copilot/prompts/break-loop.prompt.md +129 -0
- package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +157 -0
- package/dist/templates/copilot/prompts/check.prompt.md +29 -0
- package/dist/templates/copilot/prompts/create-command.prompt.md +116 -0
- package/dist/templates/copilot/prompts/finish-work.prompt.md +157 -0
- package/dist/templates/copilot/prompts/integrate-skill.prompt.md +223 -0
- package/dist/templates/copilot/prompts/onboard.prompt.md +362 -0
- package/dist/templates/copilot/prompts/parallel.prompt.md +196 -0
- package/dist/templates/copilot/prompts/record-session.prompt.md +66 -0
- package/dist/templates/copilot/prompts/start.prompt.md +397 -0
- package/dist/templates/copilot/prompts/update-spec.prompt.md +358 -0
- package/dist/templates/cursor/commands/trellis-before-dev.md +29 -0
- package/dist/templates/cursor/commands/trellis-check.md +25 -0
- package/dist/templates/cursor/commands/trellis-create-command.md +2 -2
- package/dist/templates/cursor/commands/trellis-onboard.md +13 -13
- package/dist/templates/cursor/commands/trellis-record-session.md +3 -2
- package/dist/templates/cursor/commands/trellis-start.md +7 -16
- package/dist/templates/extract.d.ts +36 -0
- package/dist/templates/extract.d.ts.map +1 -1
- package/dist/templates/extract.js +64 -0
- package/dist/templates/extract.js.map +1 -1
- package/dist/templates/gemini/commands/trellis/before-dev.toml +33 -0
- package/dist/templates/gemini/commands/trellis/check.toml +29 -0
- package/dist/templates/gemini/commands/trellis/create-command.toml +2 -2
- package/dist/templates/gemini/commands/trellis/onboard.toml +2 -2
- package/dist/templates/gemini/commands/trellis/record-session.toml +3 -2
- package/dist/templates/gemini/commands/trellis/start.toml +9 -4
- package/dist/templates/iflow/agents/dispatch.md +1 -2
- package/dist/templates/iflow/agents/implement.md +2 -3
- package/dist/templates/iflow/commands/trellis/before-dev.md +29 -0
- package/dist/templates/iflow/commands/trellis/check.md +25 -0
- package/dist/templates/iflow/commands/trellis/create-command.md +2 -2
- package/dist/templates/iflow/commands/trellis/onboard.md +13 -13
- package/dist/templates/iflow/commands/trellis/parallel.md +1 -2
- package/dist/templates/iflow/commands/trellis/record-session.md +3 -2
- package/dist/templates/iflow/commands/trellis/start.md +8 -4
- package/dist/templates/iflow/hooks/inject-subagent-context.py +29 -14
- package/dist/templates/iflow/hooks/ralph-loop.py +8 -1
- package/dist/templates/iflow/hooks/session-start.py +187 -8
- package/dist/templates/kilo/workflows/before-dev.md +29 -0
- package/dist/templates/kilo/workflows/check.md +25 -0
- package/dist/templates/kilo/workflows/create-command.md +2 -2
- package/dist/templates/kilo/workflows/onboard.md +13 -13
- package/dist/templates/kilo/workflows/parallel.md +1 -2
- package/dist/templates/kilo/workflows/record-session.md +3 -2
- package/dist/templates/kilo/workflows/start.md +8 -3
- package/dist/templates/kiro/skills/before-dev/SKILL.md +34 -0
- package/dist/templates/kiro/skills/brainstorm/SKILL.md +1 -1
- package/dist/templates/kiro/skills/break-loop/SKILL.md +1 -1
- package/dist/templates/kiro/skills/check/SKILL.md +30 -0
- package/dist/templates/kiro/skills/check-cross-layer/SKILL.md +1 -1
- package/dist/templates/kiro/skills/create-command/SKILL.md +3 -3
- package/dist/templates/kiro/skills/finish-work/SKILL.md +1 -1
- package/dist/templates/kiro/skills/integrate-skill/SKILL.md +1 -1
- package/dist/templates/kiro/skills/onboard/SKILL.md +12 -12
- package/dist/templates/kiro/skills/record-session/SKILL.md +4 -3
- package/dist/templates/kiro/skills/start/SKILL.md +9 -4
- package/dist/templates/kiro/skills/update-spec/SKILL.md +1 -1
- package/dist/templates/markdown/agents.md +4 -0
- package/dist/templates/markdown/spec/backend/directory-structure.md +1 -1
- package/dist/templates/markdown/spec/backend/script-conventions.md +93 -0
- package/dist/templates/markdown/workspace-index.md +2 -0
- package/dist/templates/opencode/agents/dispatch.md +21 -21
- package/dist/templates/opencode/agents/implement.md +2 -2
- package/dist/templates/opencode/agents/research.md +1 -2
- package/dist/templates/opencode/commands/trellis/before-dev.md +29 -0
- package/dist/templates/opencode/commands/trellis/check.md +25 -0
- package/dist/templates/opencode/commands/trellis/create-command.md +2 -2
- package/dist/templates/opencode/commands/trellis/onboard.md +13 -13
- package/dist/templates/opencode/commands/trellis/parallel.md +1 -2
- package/dist/templates/opencode/commands/trellis/record-session.md +3 -2
- package/dist/templates/opencode/commands/trellis/start.md +8 -3
- package/dist/templates/opencode/lib/trellis-context.js +42 -2
- package/dist/templates/opencode/{plugin → plugins}/inject-subagent-context.js +45 -18
- package/dist/templates/opencode/{plugin → plugins}/session-start.js +156 -28
- package/dist/templates/qoder/skills/before-dev/SKILL.md +34 -0
- package/dist/templates/qoder/skills/brainstorm/SKILL.md +1 -1
- package/dist/templates/qoder/skills/break-loop/SKILL.md +1 -1
- package/dist/templates/qoder/skills/check/SKILL.md +30 -0
- package/dist/templates/qoder/skills/check-cross-layer/SKILL.md +1 -1
- package/dist/templates/qoder/skills/create-command/SKILL.md +3 -3
- package/dist/templates/qoder/skills/finish-work/SKILL.md +1 -1
- package/dist/templates/qoder/skills/integrate-skill/SKILL.md +1 -1
- package/dist/templates/qoder/skills/onboard/SKILL.md +14 -14
- package/dist/templates/qoder/skills/record-session/SKILL.md +4 -3
- package/dist/templates/qoder/skills/start/SKILL.md +9 -4
- package/dist/templates/qoder/skills/update-spec/SKILL.md +1 -1
- package/dist/templates/trellis/config.yaml +20 -0
- package/dist/templates/trellis/index.d.ts +11 -0
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +22 -0
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/add_session.py +111 -13
- package/dist/templates/trellis/scripts/common/__init__.py +2 -0
- package/dist/templates/trellis/scripts/common/cli_adapter.py +164 -64
- package/dist/templates/trellis/scripts/common/config.py +192 -0
- package/dist/templates/trellis/scripts/common/developer.py +2 -2
- package/dist/templates/trellis/scripts/common/git.py +31 -0
- package/dist/templates/trellis/scripts/common/git_context.py +23 -586
- package/dist/templates/trellis/scripts/common/io.py +37 -0
- package/dist/templates/trellis/scripts/common/log.py +45 -0
- package/dist/templates/trellis/scripts/common/packages_context.py +238 -0
- package/dist/templates/trellis/scripts/common/paths.py +103 -6
- package/dist/templates/trellis/scripts/common/phase.py +50 -49
- package/dist/templates/trellis/scripts/common/registry.py +41 -72
- package/dist/templates/trellis/scripts/common/session_context.py +562 -0
- package/dist/templates/trellis/scripts/common/task_context.py +410 -0
- package/dist/templates/trellis/scripts/common/task_queue.py +27 -98
- package/dist/templates/trellis/scripts/common/task_store.py +536 -0
- package/dist/templates/trellis/scripts/common/task_utils.py +106 -10
- package/dist/templates/trellis/scripts/common/tasks.py +109 -0
- package/dist/templates/trellis/scripts/common/types.py +112 -0
- package/dist/templates/trellis/scripts/create_bootstrap.py +32 -27
- package/dist/templates/trellis/scripts/hooks/linear_sync.py +243 -0
- package/dist/templates/trellis/scripts/multi_agent/_bootstrap.py +17 -0
- package/dist/templates/trellis/scripts/multi_agent/cleanup.py +43 -48
- package/dist/templates/trellis/scripts/multi_agent/create_pr.py +336 -45
- package/dist/templates/trellis/scripts/multi_agent/plan.py +9 -32
- package/dist/templates/trellis/scripts/multi_agent/start.py +142 -68
- package/dist/templates/trellis/scripts/multi_agent/status.py +12 -753
- package/dist/templates/trellis/scripts/multi_agent/status_display.py +542 -0
- package/dist/templates/trellis/scripts/multi_agent/status_monitor.py +225 -0
- package/dist/templates/trellis/scripts/task.py +51 -976
- package/dist/templates/trellis/scripts-shell-archive/create-bootstrap.sh +1 -1
- package/dist/templates/trellis/workflow.md +38 -38
- package/dist/templates/windsurf/index.d.ts +21 -0
- package/dist/templates/windsurf/index.d.ts.map +1 -0
- package/dist/templates/windsurf/index.js +44 -0
- package/dist/templates/windsurf/index.js.map +1 -0
- package/dist/templates/windsurf/workflows/trellis-before-dev.md +31 -0
- package/dist/templates/windsurf/workflows/trellis-brainstorm.md +491 -0
- package/dist/templates/windsurf/workflows/trellis-break-loop.md +111 -0
- package/dist/templates/windsurf/workflows/trellis-check-cross-layer.md +157 -0
- package/dist/templates/windsurf/workflows/trellis-check.md +27 -0
- package/dist/templates/windsurf/workflows/trellis-create-command.md +154 -0
- package/dist/templates/windsurf/workflows/trellis-finish-work.md +147 -0
- package/dist/templates/windsurf/workflows/trellis-integrate-skill.md +220 -0
- package/dist/templates/windsurf/workflows/trellis-onboard.md +362 -0
- package/dist/templates/windsurf/workflows/trellis-record-session.md +66 -0
- package/dist/templates/windsurf/workflows/trellis-start.md +373 -0
- package/dist/templates/windsurf/workflows/trellis-update-spec.md +358 -0
- package/dist/types/ai-tools.d.ts +15 -3
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +42 -2
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/types/migration.d.ts +3 -1
- package/dist/types/migration.d.ts.map +1 -1
- package/dist/utils/project-detector.d.ts +28 -0
- package/dist/utils/project-detector.d.ts.map +1 -1
- package/dist/utils/project-detector.js +371 -0
- package/dist/utils/project-detector.js.map +1 -1
- package/dist/utils/template-fetcher.d.ts +19 -6
- package/dist/utils/template-fetcher.d.ts.map +1 -1
- package/dist/utils/template-fetcher.js +99 -17
- package/dist/utils/template-fetcher.js.map +1 -1
- package/package.json +1 -1
- package/dist/templates/claude/commands/trellis/before-backend-dev.md +0 -13
- package/dist/templates/claude/commands/trellis/before-frontend-dev.md +0 -13
- package/dist/templates/claude/commands/trellis/check-backend.md +0 -13
- package/dist/templates/claude/commands/trellis/check-frontend.md +0 -13
- package/dist/templates/codex/skills/before-backend-dev/SKILL.md +0 -18
- package/dist/templates/codex/skills/before-frontend-dev/SKILL.md +0 -18
- package/dist/templates/codex/skills/check-backend/SKILL.md +0 -18
- package/dist/templates/codex/skills/check-frontend/SKILL.md +0 -18
- package/dist/templates/cursor/commands/trellis-before-backend-dev.md +0 -13
- package/dist/templates/cursor/commands/trellis-before-frontend-dev.md +0 -13
- package/dist/templates/cursor/commands/trellis-check-backend.md +0 -13
- package/dist/templates/cursor/commands/trellis-check-frontend.md +0 -13
- package/dist/templates/gemini/commands/trellis/before-backend-dev.toml +0 -17
- package/dist/templates/gemini/commands/trellis/before-frontend-dev.toml +0 -17
- package/dist/templates/gemini/commands/trellis/check-backend.toml +0 -17
- package/dist/templates/gemini/commands/trellis/check-frontend.toml +0 -17
- package/dist/templates/iflow/commands/trellis/before-backend-dev.md +0 -13
- package/dist/templates/iflow/commands/trellis/before-frontend-dev.md +0 -13
- package/dist/templates/iflow/commands/trellis/check-backend.md +0 -13
- package/dist/templates/iflow/commands/trellis/check-frontend.md +0 -13
- package/dist/templates/kilo/workflows/before-backend-dev.md +0 -13
- package/dist/templates/kilo/workflows/before-frontend-dev.md +0 -13
- package/dist/templates/kilo/workflows/check-backend.md +0 -13
- package/dist/templates/kilo/workflows/check-frontend.md +0 -13
- package/dist/templates/kiro/skills/before-backend-dev/SKILL.md +0 -18
- package/dist/templates/kiro/skills/before-frontend-dev/SKILL.md +0 -18
- package/dist/templates/kiro/skills/check-backend/SKILL.md +0 -18
- package/dist/templates/kiro/skills/check-frontend/SKILL.md +0 -18
- package/dist/templates/opencode/commands/trellis/before-backend-dev.md +0 -13
- package/dist/templates/opencode/commands/trellis/before-frontend-dev.md +0 -13
- package/dist/templates/opencode/commands/trellis/check-backend.md +0 -13
- package/dist/templates/opencode/commands/trellis/check-frontend.md +0 -13
- package/dist/templates/qoder/skills/before-backend-dev/SKILL.md +0 -18
- package/dist/templates/qoder/skills/before-frontend-dev/SKILL.md +0 -18
- package/dist/templates/qoder/skills/check-backend/SKILL.md +0 -18
- package/dist/templates/qoder/skills/check-frontend/SKILL.md +0 -18
|
@@ -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()
|
|
@@ -1,18 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Codex
|
|
2
|
+
* Codex templates
|
|
3
3
|
*
|
|
4
4
|
* These are GENERIC templates for user projects.
|
|
5
|
-
* Do NOT use Trellis project's own .agents/skills
|
|
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
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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
|
|
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
|
|
2
|
+
* Codex templates
|
|
3
3
|
*
|
|
4
4
|
* These are GENERIC templates for user projects.
|
|
5
|
-
* Do NOT use Trellis project's own .agents/skills
|
|
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
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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
|
|
23
|
+
function listDirectories(dir) {
|
|
22
24
|
try {
|
|
23
|
-
return readdirSync(join(__dirname,
|
|
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
|
|
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
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/codex/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: before-dev
|
|
3
|
+
description: "Discovers and injects project-specific coding guidelines from .trellis/spec/ before implementation begins. Reads spec indexes, pre-development checklists, and shared thinking guides for the target package. Use when starting a new coding task, before writing any code, switching to a different package, or needing to refresh project conventions and standards."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Read the relevant development guidelines before starting your task.
|
|
7
|
+
|
|
8
|
+
Execute these steps:
|
|
9
|
+
|
|
10
|
+
1. **Discover packages and their spec layers**:
|
|
11
|
+
```bash
|
|
12
|
+
python3 ./.trellis/scripts/get_context.py --mode packages
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. **Identify which specs apply** to your task based on:
|
|
16
|
+
- Which package you're modifying (e.g., `cli/`, `docs-site/`)
|
|
17
|
+
- What type of work (backend, frontend, unit-test, docs, etc.)
|
|
18
|
+
|
|
19
|
+
3. **Read the spec index** for each relevant module:
|
|
20
|
+
```bash
|
|
21
|
+
cat .trellis/spec/<package>/<layer>/index.md
|
|
22
|
+
```
|
|
23
|
+
Follow the **"Pre-Development Checklist"** section in the index.
|
|
24
|
+
|
|
25
|
+
4. **Read the specific guideline files** listed in the Pre-Development Checklist that are relevant to your task. The index is NOT the goal — it points you to the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`). Read those files to understand the coding standards and patterns.
|
|
26
|
+
|
|
27
|
+
5. **Always read shared guides**:
|
|
28
|
+
```bash
|
|
29
|
+
cat .trellis/spec/guides/index.md
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
6. Understand the coding standards and patterns you need to follow, then proceed with your development plan.
|
|
33
|
+
|
|
34
|
+
This step is **mandatory** before writing any code.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: brainstorm
|
|
3
|
-
description: "
|
|
3
|
+
description: "Collaborative requirements discovery session optimized for AI coding workflows. Creates task directories, seeds PRDs, runs codebase research, proposes concrete implementation approaches with trade-offs, and converges on MVP scope through structured Q&A. Use when requirements are unclear, multiple implementation paths exist, trade-offs need evaluation, or a complex feature needs scoping before development."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Brainstorm - Requirements Discovery (AI Coding Enhanced)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: break-loop
|
|
3
|
-
description: "
|
|
3
|
+
description: "Deep post-fix bug analysis across five dimensions: root cause categorization, fix failure analysis, prevention mechanisms, systematic expansion, and knowledge capture. Updates .trellis/spec/ guides with lessons learned to prevent recurring bugs. Use when a debugging session completes, after fixing a tricky bug, when the same class of bug keeps recurring, or when you want to capture debugging insights into project documentation."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Break the Loop - Deep Bug Analysis
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: check
|
|
3
|
+
description: "Validates recently written code against project-specific development guidelines from .trellis/spec/. Identifies changed files via git diff, discovers applicable spec modules, runs lint and typecheck, and reports guideline violations. Use when code is written and needs quality verification, to catch context drift during long sessions, or before committing changes."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Check if the code you just wrote follows the development guidelines.
|
|
7
|
+
|
|
8
|
+
Execute these steps:
|
|
9
|
+
|
|
10
|
+
1. **Identify changed files**:
|
|
11
|
+
```bash
|
|
12
|
+
git diff --name-only HEAD
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. **Determine which spec modules apply** based on the changed file paths:
|
|
16
|
+
```bash
|
|
17
|
+
python3 ./.trellis/scripts/get_context.py --mode packages
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
3. **Read the spec index** for each relevant module:
|
|
21
|
+
```bash
|
|
22
|
+
cat .trellis/spec/<package>/<layer>/index.md
|
|
23
|
+
```
|
|
24
|
+
Follow the **"Quality Check"** section in the index.
|
|
25
|
+
|
|
26
|
+
4. **Read the specific guideline files** referenced in the Quality Check section (e.g., `quality-guidelines.md`, `conventions.md`). The index is NOT the goal — it points you to the actual guideline files. Read those files and review your code against them.
|
|
27
|
+
|
|
28
|
+
5. **Run lint and typecheck** for the affected package.
|
|
29
|
+
|
|
30
|
+
6. **Report any violations** and fix them if found.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: check-cross-layer
|
|
3
|
-
description: "
|
|
3
|
+
description: "Post-implementation verification across multiple code dimensions: cross-layer data flow, code reuse analysis, import path validation, and same-layer consistency checks. Identifies missed update sites, type mismatches, and duplicated constants. Use when changes span 3+ architectural layers, after modifying shared constants or configs, after batch file modifications, or when creating new utility functions."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Cross-Layer Check
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-command
|
|
3
|
-
description: "
|
|
3
|
+
description: "Scaffolds a new skill file with proper naming conventions and structure. Analyzes requirements to determine skill type and generates appropriate content. Use when adding a new developer workflow skill, creating a custom skill, or extending the Trellis skill set."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Create New Skill
|
|
@@ -93,8 +93,8 @@ Description:
|
|
|
93
93
|
| Skill Type | Prefix | Example |
|
|
94
94
|
|------------|--------|---------|
|
|
95
95
|
| Session Start | `start` | `start` |
|
|
96
|
-
| Pre-development | `before-` | `before-
|
|
97
|
-
| Check | `check-` | `check
|
|
96
|
+
| Pre-development | `before-` | `before-dev` |
|
|
97
|
+
| Check | `check-` | `check` |
|
|
98
98
|
| Record | `record-` | `record-session` |
|
|
99
99
|
| Generate | `generate-` | `generate-api-doc` |
|
|
100
100
|
| Update | `update-` | `update-changelog` |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: finish-work
|
|
3
|
-
description: "
|
|
3
|
+
description: "Pre-commit quality checklist covering lint, typecheck, tests, code-spec sync, API changes, database migrations, cross-layer verification, and manual testing. Blocks commit if infra or cross-layer specs lack executable depth. Use when code is written and tested but not yet committed, before submitting changes, or as a final review before git commit."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Finish Work - Pre-Commit Checklist
|
|
@@ -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
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: integrate-skill
|
|
3
|
-
description: "
|
|
3
|
+
description: "Adapts an external skill into project-specific development guidelines in .trellis/spec/. Creates guideline sections, code example templates with .template suffix, and updates spec indexes. Use when integrating an external skill, adding a new skill's patterns to project conventions, or incorporating third-party skill best practices into .trellis/spec/ documentation."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Integrate Skill into Project Guidelines
|