@pennixrv/trellis 0.7.2-beta.25 → 0.7.2-beta.27
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/dist/migrations/manifests/0.7.2-beta.26.json +8 -0
- package/dist/migrations/manifests/0.7.2-beta.27.json +8 -0
- package/dist/templates/codex/hooks/turn-guard.py +67 -0
- package/dist/templates/codex/hooks.json +63 -0
- package/dist/templates/common/bundled-skills/trellis-decision-space-construction-and-merging/workflow.md +6 -2
- package/dist/templates/common/bundled-skills/trellis-delivery-review-and-closeout/workflow.md +13 -9
- package/dist/templates/common/bundled-skills/trellis-goal-exploration-and-requirements/workflow.md +3 -1
- package/dist/templates/common/bundled-skills/trellis-solution-design-and-convergence/workflow.md +9 -1
- package/dist/templates/common/bundled-skills/trellis-task-implementation/workflow.md +2 -2
- package/dist/templates/common/commands/continue.md +9 -2
- package/dist/templates/common/skills/request-intake.md +2 -0
- package/dist/templates/omp/extensions/trellis/index.ts.txt +16 -9
- package/dist/templates/opencode/plugins/inject-workflow-state.js +15 -7
- package/dist/templates/pi/extensions/trellis/index.ts.txt +9 -4
- 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/inject-shell-session-context.py +27 -1
- package/dist/templates/shared-hooks/inject-workflow-state.py +44 -27
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +1 -0
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/common/task_move.py +9 -3
- package/dist/templates/trellis/scripts/common/task_turn.py +514 -0
- package/dist/templates/trellis/scripts/common/task_workflow.py +289 -68
- package/dist/templates/trellis/scripts/common/workflow_selection.py +23 -38
- package/dist/templates/trellis/scripts/task.py +25 -4
- package/dist/templates/trellis/workflow.md +12 -2
- package/package.json +2 -2
|
@@ -17,8 +17,8 @@ falls through when unset, invalid, or pointing at a missing file:
|
|
|
17
17
|
3. Team default - config.yaml `default_workflow` (git-tracked, shared).
|
|
18
18
|
Silent on miss.
|
|
19
19
|
4. Global - `.trellis/workflow.md`.
|
|
20
|
-
With neither a per-task pin nor the personal/team keys set, this
|
|
21
|
-
|
|
20
|
+
With neither a per-task pin nor the personal/team keys set, this reads
|
|
21
|
+
the global `.trellis/workflow.md`. A present rejected source is not a miss.
|
|
22
22
|
|
|
23
23
|
Provides:
|
|
24
24
|
workflow_md_for_task - Full precedence for an already-resolved task dir
|
|
@@ -57,12 +57,12 @@ def _current_workflow(candidate: Path) -> Path:
|
|
|
57
57
|
return candidate
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
def
|
|
60
|
+
def workflow_variant(repo_root: Path, workflow_id: str | None) -> Path | None:
|
|
61
61
|
"""Map a workflow id to its library file if valid and present, else None.
|
|
62
62
|
|
|
63
63
|
Shared by every layer (per-task pin, personal, team). An id with path
|
|
64
64
|
separators/dots/blanks, or one whose `.trellis/workflows/<id>.md` file does
|
|
65
|
-
not exist, returns None so the caller falls through.
|
|
65
|
+
not exist, returns None so the caller falls through. A present source is checked.
|
|
66
66
|
"""
|
|
67
67
|
if not isinstance(workflow_id, str) or not workflow_id:
|
|
68
68
|
return None
|
|
@@ -102,7 +102,7 @@ def _default_workflow_md(repo_root: Path) -> Path:
|
|
|
102
102
|
choice — a per-turn warning would be noise).
|
|
103
103
|
"""
|
|
104
104
|
for get_id in (_developer_workflow_id, _config_default_id):
|
|
105
|
-
variant =
|
|
105
|
+
variant = workflow_variant(repo_root, get_id(repo_root))
|
|
106
106
|
if variant is not None:
|
|
107
107
|
return variant
|
|
108
108
|
return _global_workflow_md(repo_root)
|
|
@@ -111,43 +111,29 @@ def _default_workflow_md(repo_root: Path) -> Path:
|
|
|
111
111
|
def _task_pin_variant(repo_root: Path, task_dir: Path | None) -> Path | None:
|
|
112
112
|
"""Return the per-task pinned variant path, or None to fall through.
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
resolution continues with the personal/team defaults. Never raises.
|
|
114
|
+
Warns on an invalid id or missing file and falls through. A present
|
|
115
|
+
but retired or unreadable variant must be diagnosed, not replaced.
|
|
117
116
|
"""
|
|
118
117
|
if task_dir is None:
|
|
119
118
|
return None
|
|
120
119
|
|
|
121
120
|
try:
|
|
122
121
|
raw = json.loads((task_dir / FILE_TASK_JSON).read_text(encoding="utf-8"))
|
|
123
|
-
|
|
124
|
-
return None
|
|
125
|
-
|
|
126
|
-
workflow_id = raw.get("workflow")
|
|
127
|
-
if not isinstance(workflow_id, str) or not workflow_id:
|
|
128
|
-
return None
|
|
129
|
-
|
|
130
|
-
if not WORKFLOW_ID_RE.match(workflow_id):
|
|
131
|
-
print(
|
|
132
|
-
f"Warning: task '{task_dir.name}' has invalid workflow id "
|
|
133
|
-
f"{workflow_id!r}; using default workflow resolution",
|
|
134
|
-
file=sys.stderr,
|
|
135
|
-
)
|
|
136
|
-
return None
|
|
137
|
-
|
|
138
|
-
variant = _library_variant(repo_root, workflow_id)
|
|
139
|
-
if variant is not None:
|
|
140
|
-
return variant
|
|
141
|
-
|
|
142
|
-
print(
|
|
143
|
-
f"Warning: task '{task_dir.name}' selects workflow '{workflow_id}' but "
|
|
144
|
-
f"{DIR_WORKFLOW}/{DIR_WORKFLOWS}/{workflow_id}.md is missing; "
|
|
145
|
-
f"using default workflow resolution",
|
|
146
|
-
file=sys.stderr,
|
|
147
|
-
)
|
|
122
|
+
except (OSError, ValueError):
|
|
148
123
|
return None
|
|
149
|
-
|
|
124
|
+
if not isinstance(raw, dict):
|
|
125
|
+
return None
|
|
126
|
+
workflow_id = raw.get("workflow")
|
|
127
|
+
if not isinstance(workflow_id, str) or not workflow_id:
|
|
128
|
+
return None
|
|
129
|
+
if not WORKFLOW_ID_RE.match(workflow_id):
|
|
130
|
+
print(f"Warning: task '{task_dir.name}' has invalid workflow id {workflow_id!r}; using default workflow resolution", file=sys.stderr)
|
|
150
131
|
return None
|
|
132
|
+
variant = workflow_variant(repo_root, workflow_id)
|
|
133
|
+
if variant is None:
|
|
134
|
+
print(f"Warning: task '{task_dir.name}' selects workflow '{workflow_id}' but "
|
|
135
|
+
f"{DIR_WORKFLOW}/{DIR_WORKFLOWS}/{workflow_id}.md is missing; using default workflow resolution", file=sys.stderr)
|
|
136
|
+
return variant
|
|
151
137
|
|
|
152
138
|
|
|
153
139
|
def workflow_md_for_task(repo_root: Path, task_dir: Path | None) -> Path:
|
|
@@ -155,7 +141,7 @@ def workflow_md_for_task(repo_root: Path, task_dir: Path | None) -> Path:
|
|
|
155
141
|
|
|
156
142
|
Applies the full precedence documented in the module docstring:
|
|
157
143
|
per-task pin -> personal (.developer) -> team (config.yaml) -> global.
|
|
158
|
-
|
|
144
|
+
A present rejected source raises instead of loading a different policy.
|
|
159
145
|
"""
|
|
160
146
|
pin = _task_pin_variant(repo_root, task_dir)
|
|
161
147
|
if pin is not None:
|
|
@@ -172,8 +158,7 @@ def resolve_workflow_md(
|
|
|
172
158
|
|
|
173
159
|
``input_data`` is the raw hook payload (session/conversation identity);
|
|
174
160
|
CLI callers may omit it — the active-task resolver then falls back to
|
|
175
|
-
environment context.
|
|
176
|
-
`.trellis/workflow.md`.
|
|
161
|
+
environment context. Workflow source rejections propagate to the caller.
|
|
177
162
|
"""
|
|
178
163
|
try:
|
|
179
164
|
from .active_task import resolve_active_task, resolve_task_ref
|
|
@@ -182,6 +167,6 @@ def resolve_workflow_md(
|
|
|
182
167
|
task_dir: Path | None = None
|
|
183
168
|
if active.task_path:
|
|
184
169
|
task_dir = resolve_task_ref(active.task_path, repo_root)
|
|
185
|
-
return workflow_md_for_task(repo_root, task_dir)
|
|
186
170
|
except Exception:
|
|
187
171
|
return _global_workflow_md(repo_root)
|
|
172
|
+
return workflow_md_for_task(repo_root, task_dir)
|
|
@@ -60,7 +60,7 @@ from common.io import (
|
|
|
60
60
|
)
|
|
61
61
|
from common.task_utils import resolve_task_dir, run_task_hooks
|
|
62
62
|
from common.tasks import iter_active_tasks, children_progress
|
|
63
|
-
from common.workflow_selection import WORKFLOW_ID_RE, workflow_md_for_task
|
|
63
|
+
from common.workflow_selection import WORKFLOW_ID_RE, workflow_md_for_task, workflow_variant
|
|
64
64
|
|
|
65
65
|
# Import command handlers from split modules (also re-exports for plan.py compatibility)
|
|
66
66
|
from common.task_store import (
|
|
@@ -96,6 +96,7 @@ from common.task_continuity import (
|
|
|
96
96
|
continuity_show,
|
|
97
97
|
transfer_task_ownership,
|
|
98
98
|
)
|
|
99
|
+
from common.task_turn import TurnError, add_turn_commands, cli as turn_cli
|
|
99
100
|
|
|
100
101
|
|
|
101
102
|
# =============================================================================
|
|
@@ -284,7 +285,7 @@ def cmd_start(args: argparse.Namespace) -> int:
|
|
|
284
285
|
print(colored(f"✓ Current task set to: {task_json_path.parent.relative_to(repo_root).as_posix()}", Colors.GREEN))
|
|
285
286
|
print(f"Source: {active.source}")
|
|
286
287
|
print()
|
|
287
|
-
print(colored("
|
|
288
|
+
print(colored("Read the current lifecycle and phase to distinguish binding from implementation start.", Colors.BLUE))
|
|
288
289
|
|
|
289
290
|
run_task_hooks("after_start", task_json_path, repo_root)
|
|
290
291
|
return 0
|
|
@@ -445,6 +446,11 @@ def cmd_workflow(args: argparse.Namespace) -> int:
|
|
|
445
446
|
Colors.RED,
|
|
446
447
|
))
|
|
447
448
|
return 1
|
|
449
|
+
try:
|
|
450
|
+
workflow_variant(repo_root, workflow_id)
|
|
451
|
+
except (OSError, ValueError) as error:
|
|
452
|
+
print(f"TASK_WORKFLOW_SOURCE_REJECTED: {error}", file=sys.stderr)
|
|
453
|
+
return 1
|
|
448
454
|
data["workflow"] = workflow_id
|
|
449
455
|
if not write_json(task_json_path, data):
|
|
450
456
|
print(colored("Error: failed to update task.json", Colors.RED))
|
|
@@ -453,7 +459,11 @@ def cmd_workflow(args: argparse.Namespace) -> int:
|
|
|
453
459
|
|
|
454
460
|
# workflow_md_for_task warns on stderr itself when the selected variant
|
|
455
461
|
# file is missing (it can be saved later via `trellis workflow --save`).
|
|
456
|
-
|
|
462
|
+
try:
|
|
463
|
+
effective = workflow_md_for_task(repo_root, task_dir)
|
|
464
|
+
except (OSError, ValueError) as error:
|
|
465
|
+
print(f"Warning: workflow selection saved, but the effective source is unavailable: {error}", file=sys.stderr)
|
|
466
|
+
return 0
|
|
457
467
|
try:
|
|
458
468
|
effective_display = effective.relative_to(repo_root).as_posix()
|
|
459
469
|
except ValueError:
|
|
@@ -778,7 +788,7 @@ def main() -> int:
|
|
|
778
788
|
p_phase = subparsers.add_parser("phase", help="Read or update task phase state")
|
|
779
789
|
p_phase.add_argument(
|
|
780
790
|
"phase_action",
|
|
781
|
-
choices=("init", "show", "artifact", "accept", "skip", "wait", "block", "resume", "return", "route", "authorize", "admission"),
|
|
791
|
+
choices=("init", "show", "preflight", "artifact", "accept", "skip", "wait", "block", "resume", "return", "route", "authorize", "admission"),
|
|
782
792
|
)
|
|
783
793
|
p_phase.add_argument("task_dir", help="Task directory or task name")
|
|
784
794
|
p_phase.add_argument("--expected-route-revision", help="Current task_route_revision required for mutation")
|
|
@@ -789,6 +799,7 @@ def main() -> int:
|
|
|
789
799
|
p_phase.add_argument("--route-reason", help="Reason when initialization omits one or more phases")
|
|
790
800
|
p_phase.add_argument("--route-evidence-ref", action="append", help="Evidence supporting an abbreviated initial route")
|
|
791
801
|
p_phase.add_argument("--target-phase", help="Earlier phase to revisit, or first affected phase for route change")
|
|
802
|
+
p_phase.add_argument("--enable-coverage", action="store_true", help="Opt an existing task in by returning to requirements during phase route")
|
|
792
803
|
p_phase.add_argument("--return-kind", choices=("contract_change", "execution_rework", "withdrawal"), default="contract_change", help="Classify a return or explicitly record user withdrawal")
|
|
793
804
|
p_phase.add_argument("--artifact-ref", action="append", help="Task-relative file in the current phase output")
|
|
794
805
|
p_phase.add_argument("--artifact-revision", help="Current artifact_revision required for acceptance")
|
|
@@ -904,6 +915,7 @@ def main() -> int:
|
|
|
904
915
|
p_runtime.add_argument("dir", nargs="?", help="Optional existing task scope")
|
|
905
916
|
p_runtime.add_argument("--confirm", help="Exact digest from a fresh native preview")
|
|
906
917
|
|
|
918
|
+
add_turn_commands(subparsers)
|
|
907
919
|
args = parser.parse_args()
|
|
908
920
|
|
|
909
921
|
if os.environ.get("TRELLIS_DELEGATION_CONTEXT") and args.command not in {"current", "list", "list-context", "validate"}:
|
|
@@ -956,6 +968,12 @@ def main() -> int:
|
|
|
956
968
|
return continuity_show(args) if args.continuity_action == "show" else continuity_capture(args)
|
|
957
969
|
if args.command == "transfer":
|
|
958
970
|
return transfer_task_ownership(args)
|
|
971
|
+
if args.command == "turn":
|
|
972
|
+
turn_argv = sys.argv[2:]
|
|
973
|
+
if len(turn_argv) >= 2 and turn_argv[-2] == "--invocation-ticket":
|
|
974
|
+
turn_argv = turn_argv[:-2]
|
|
975
|
+
print(json.dumps(turn_cli(get_repo_root(), args, turn_argv), ensure_ascii=False))
|
|
976
|
+
return 0
|
|
959
977
|
if args.command in commands:
|
|
960
978
|
if args.command.startswith("delegate-"):
|
|
961
979
|
from common.worktree_delegation import run, runtime_path
|
|
@@ -968,6 +986,9 @@ def main() -> int:
|
|
|
968
986
|
return run(args)
|
|
969
987
|
show_usage()
|
|
970
988
|
return 1
|
|
989
|
+
except TurnError as error:
|
|
990
|
+
print(str(error), file=sys.stderr)
|
|
991
|
+
return 1
|
|
971
992
|
except TaskWorkflowError as error:
|
|
972
993
|
print(f"{error.code}: {error}", file=sys.stderr)
|
|
973
994
|
return 1
|
|
@@ -50,7 +50,9 @@ python3 ./.trellis/scripts/task.py cancel <task> --reason "<reason>" --evidence-
|
|
|
50
50
|
python3 ./.trellis/scripts/task.py reopen <task> --reason "<reason>" --evidence-ref <reference>
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
使用 `phase artifact`、`accept`、`skip`、`wait`、`block`、`resume`、`return`、`route` 和 `authorize`
|
|
53
|
+
使用 `phase artifact`、`preflight`、`accept`、`skip`、`wait`、`block`、`resume`、`return`、`route` 和 `authorize` 核验或执行阶段操作。准确参数以 `task.py --help` 为准。只有决策空间构造与归并阶段、解决方案设计与收敛阶段可以有据省略;实施路线仍须通过任务实施与测试验证阶段,所有路线都须通过交付审查与现场收尾阶段。明确撤回仍使用原生取消路线,不假装已经实施。
|
|
54
|
+
|
|
55
|
+
任务阶段、当前请求及依赖动作的停点不同。可查事实和独立且已授权的动作继续;必要未决事项在就绪时直接用宿主允许的同步入口提问,只有依赖该答案的动作暂停。必须用普通文本时直接说明问题;有独立工作先完成。请求已核验、用户明确要求停止,或具体外部依赖阻断全部剩余已授权动作时才结束回合。宿主权限和业务决定分别取得,进度、空答、Hook 纠偏或交付审查接受都不是任务终态。Codex 原生回合证据用 `task.py turn record`,有界维护用 `bounded_reply --scope maintenance`,无可继续工作的外部阻断用 `external_block --no-independent-work --blocker <具体阻断>`;两者都须核对实际动作及证据,不授予额外权限。
|
|
54
56
|
|
|
55
57
|
只有阶段路线已到达获准的实施入口时,`task.py start` 才会将任务从 `planning` 改为 `in_progress`。分析任务可在交付审查与现场收尾阶段后仍处于 `planning` 时完成。`complete` 将任务移入 `completed/YYYY-MM/<task>`,`cancel` 将任务移入 `cancelled/<task>`,并在同一事务中清除任务的运行时会话指针。
|
|
56
58
|
|
|
@@ -102,7 +104,11 @@ flowchart LR
|
|
|
102
104
|
task_implementation -->|"交付候选"| delivery_review_and_closeout
|
|
103
105
|
```
|
|
104
106
|
|
|
105
|
-
|
|
107
|
+
图示表达常见阶段转换,不是固定路线矩阵。决策空间构造与归并阶段关注尚待查清的实质取舍,解决方案设计与收敛阶段关注所选方案尚未处置的交付风险;两者不必同时展开。已经证实可复用与尚未查明不同。待接受的 `analysis_conclusion` 或 `no_go` 不得进入实施路线;发现不应实施时,按原生 `phase route` 更正至交付路线,再接受结果。正式会话交接是独立附加操作,只有用户明确要求时才执行,也不是任务推进或收尾的前置条件。
|
|
108
|
+
|
|
109
|
+
新初始化的复杂路线在需求的 `## Acceptance Criteria`、`## 验收条件` 或 `## 验收标准` 中给每条清单项唯一编号,如 `A1`。决策空间构造与归并阶段和解决方案设计与收敛阶段的覆盖表据此核对缺项;现有未启用合同和有据短路线不额外补表。`## 省略依据` 表列为 `适用对象 | 省略理由 | 依据 | 重入条件`,适用对象写阶段标识,依据指向任务内文件。省略解决方案设计与收敛阶段但仍须实施时,证据须含当前实施合同;运行中 `phase skip` 用 `--contract-ref` 指明合同。
|
|
110
|
+
|
|
111
|
+
实际排除原复杂因素时,填写 `## 降级依据` 表,列为 `适用对象 | 不再适用的理由 | 依据 | 重入条件`,对象为 `complexity_reduction`,在理由中指出受影响阶段。当前证据及其前提失效时先由原生路线入口重核,不靠改标签绕过。未启用的既有任务仅在明确选择时用 `phase route --enable-coverage` 回到目标探索与需求核对阶段启用,不批量改变历史接受。
|
|
106
112
|
|
|
107
113
|
<!-- 宿主 Hook 从以下区块读取每轮工作流提示。 -->
|
|
108
114
|
|
|
@@ -114,6 +120,10 @@ flowchart LR
|
|
|
114
120
|
活动任务记录无法读取。停止修改任务状态,依据现有任务资产修复该记录后再继续。
|
|
115
121
|
[/workflow-state:task_error]
|
|
116
122
|
|
|
123
|
+
[workflow-state:closeout_pending]
|
|
124
|
+
交付审查与现场收尾阶段已接受,任务尚未终结。用 `task.py phase show <task>` 核对收尾处置;继续可执行的归档前置,不把阶段接受当成任务完成。
|
|
125
|
+
[/workflow-state:closeout_pending]
|
|
126
|
+
|
|
117
127
|
[workflow-state:planning]
|
|
118
128
|
任务尚未初始化阶段路线。核对需求后,按适用性选择有序阶段,并为省略阶段记录理由和证据,再使用 `task.py phase init`。解决方案设计与收敛阶段的实施合同获接受且另行取得实施授权前,不得开始实施。
|
|
119
129
|
[/workflow-state:planning]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pennixrv/trellis",
|
|
3
|
-
"version": "0.7.2-beta.
|
|
3
|
+
"version": "0.7.2-beta.27",
|
|
4
4
|
"description": "AI capabilities grow like ivy — Trellis provides the structure to guide them along a disciplined path",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"inquirer": "^9.3.7",
|
|
36
36
|
"undici": "^6.21.0",
|
|
37
37
|
"zod": "^4.4.2",
|
|
38
|
-
"@pennixrv/trellis-core": "0.7.2-beta.
|
|
38
|
+
"@pennixrv/trellis-core": "0.7.2-beta.27"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@eslint/js": "^9.18.0",
|