@pennixrv/trellis 0.7.1 → 0.7.2-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 +10 -7
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +6 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/ablate.d.ts.map +1 -1
- package/dist/commands/ablate.js +2 -0
- package/dist/commands/ablate.js.map +1 -1
- package/dist/commands/backup.d.ts +4 -0
- package/dist/commands/backup.d.ts.map +1 -0
- package/dist/commands/backup.js +75 -0
- package/dist/commands/backup.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +705 -681
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mem.d.ts.map +1 -1
- package/dist/commands/mem.js +49 -7
- package/dist/commands/mem.js.map +1 -1
- package/dist/commands/task-progress.d.ts +1 -0
- package/dist/commands/task-progress.d.ts.map +1 -1
- package/dist/commands/task-progress.js +67 -25
- package/dist/commands/task-progress.js.map +1 -1
- package/dist/commands/teamwork/adapters/acp.d.ts +20 -0
- package/dist/commands/teamwork/adapters/acp.d.ts.map +1 -0
- package/dist/commands/teamwork/adapters/acp.js +271 -0
- package/dist/commands/teamwork/adapters/acp.js.map +1 -0
- package/dist/commands/teamwork/adapters/claude.d.ts +1 -0
- package/dist/commands/teamwork/adapters/claude.d.ts.map +1 -1
- package/dist/commands/teamwork/adapters/claude.js +5 -0
- package/dist/commands/teamwork/adapters/claude.js.map +1 -1
- package/dist/commands/teamwork/adapters/codex.d.ts +3 -2
- package/dist/commands/teamwork/adapters/codex.d.ts.map +1 -1
- package/dist/commands/teamwork/adapters/codex.js +14 -15
- package/dist/commands/teamwork/adapters/codex.js.map +1 -1
- package/dist/commands/teamwork/adapters/index.d.ts +24 -2
- package/dist/commands/teamwork/adapters/index.d.ts.map +1 -1
- package/dist/commands/teamwork/adapters/index.js +163 -24
- package/dist/commands/teamwork/adapters/index.js.map +1 -1
- package/dist/commands/teamwork/agent-loader.d.ts +2 -1
- package/dist/commands/teamwork/agent-loader.d.ts.map +1 -1
- package/dist/commands/teamwork/agent-loader.js +2 -1
- package/dist/commands/teamwork/agent-loader.js.map +1 -1
- package/dist/commands/teamwork/artifact.d.ts +42 -14
- package/dist/commands/teamwork/artifact.d.ts.map +1 -1
- package/dist/commands/teamwork/artifact.js +188 -85
- package/dist/commands/teamwork/artifact.js.map +1 -1
- package/dist/commands/teamwork/batch-reservation.d.ts +16 -0
- package/dist/commands/teamwork/batch-reservation.d.ts.map +1 -0
- package/dist/commands/teamwork/batch-reservation.js +43 -0
- package/dist/commands/teamwork/batch-reservation.js.map +1 -0
- package/dist/commands/teamwork/batch.d.ts +23 -0
- package/dist/commands/teamwork/batch.d.ts.map +1 -0
- package/dist/commands/teamwork/batch.js +415 -0
- package/dist/commands/teamwork/batch.js.map +1 -0
- package/dist/commands/teamwork/context-loader.d.ts +1 -1
- package/dist/commands/teamwork/context-loader.d.ts.map +1 -1
- package/dist/commands/teamwork/context-loader.js +19 -6
- package/dist/commands/teamwork/context-loader.js.map +1 -1
- package/dist/commands/teamwork/coordination.d.ts +88 -0
- package/dist/commands/teamwork/coordination.d.ts.map +1 -0
- package/dist/commands/teamwork/coordination.js +153 -0
- package/dist/commands/teamwork/coordination.js.map +1 -0
- package/dist/commands/teamwork/coordinator.d.ts +33 -6
- package/dist/commands/teamwork/coordinator.d.ts.map +1 -1
- package/dist/commands/teamwork/coordinator.js +948 -342
- package/dist/commands/teamwork/coordinator.js.map +1 -1
- package/dist/commands/teamwork/create.d.ts +1 -0
- package/dist/commands/teamwork/create.d.ts.map +1 -1
- package/dist/commands/teamwork/create.js +2 -1
- package/dist/commands/teamwork/create.js.map +1 -1
- package/dist/commands/teamwork/dev-parse-trace.d.ts +2 -1
- package/dist/commands/teamwork/dev-parse-trace.d.ts.map +1 -1
- package/dist/commands/teamwork/dev-parse-trace.js +2 -0
- package/dist/commands/teamwork/dev-parse-trace.js.map +1 -1
- package/dist/commands/teamwork/foreground-wait.d.ts +6 -0
- package/dist/commands/teamwork/foreground-wait.d.ts.map +1 -0
- package/dist/commands/teamwork/foreground-wait.js +65 -0
- package/dist/commands/teamwork/foreground-wait.js.map +1 -0
- package/dist/commands/teamwork/guard.d.ts +2 -2
- package/dist/commands/teamwork/guard.d.ts.map +1 -1
- package/dist/commands/teamwork/guard.js +25 -7
- package/dist/commands/teamwork/guard.js.map +1 -1
- package/dist/commands/teamwork/index.d.ts.map +1 -1
- package/dist/commands/teamwork/index.js +164 -11
- package/dist/commands/teamwork/index.js.map +1 -1
- package/dist/commands/teamwork/kill.d.ts +2 -0
- package/dist/commands/teamwork/kill.d.ts.map +1 -1
- package/dist/commands/teamwork/kill.js +79 -38
- package/dist/commands/teamwork/kill.js.map +1 -1
- package/dist/commands/teamwork/messages.d.ts.map +1 -1
- package/dist/commands/teamwork/messages.js +3 -0
- package/dist/commands/teamwork/messages.js.map +1 -1
- package/dist/commands/teamwork/plan.d.ts +22 -0
- package/dist/commands/teamwork/plan.d.ts.map +1 -0
- package/dist/commands/teamwork/plan.js +288 -0
- package/dist/commands/teamwork/plan.js.map +1 -0
- package/dist/commands/teamwork/process-identity.d.ts +3 -0
- package/dist/commands/teamwork/process-identity.d.ts.map +1 -0
- package/dist/commands/teamwork/process-identity.js +24 -0
- package/dist/commands/teamwork/process-identity.js.map +1 -0
- package/dist/commands/teamwork/profiles.d.ts +43 -6
- package/dist/commands/teamwork/profiles.d.ts.map +1 -1
- package/dist/commands/teamwork/profiles.js +138 -110
- package/dist/commands/teamwork/profiles.js.map +1 -1
- package/dist/commands/teamwork/prompt.d.ts +4 -0
- package/dist/commands/teamwork/prompt.d.ts.map +1 -0
- package/dist/commands/teamwork/prompt.js +33 -0
- package/dist/commands/teamwork/prompt.js.map +1 -0
- package/dist/commands/teamwork/result.d.ts +55 -0
- package/dist/commands/teamwork/result.d.ts.map +1 -0
- package/dist/commands/teamwork/result.js +94 -0
- package/dist/commands/teamwork/result.js.map +1 -0
- package/dist/commands/teamwork/rm.d.ts.map +1 -1
- package/dist/commands/teamwork/rm.js +64 -64
- package/dist/commands/teamwork/rm.js.map +1 -1
- package/dist/commands/teamwork/run.d.ts +5 -0
- package/dist/commands/teamwork/run.d.ts.map +1 -1
- package/dist/commands/teamwork/run.js +120 -24
- package/dist/commands/teamwork/run.js.map +1 -1
- package/dist/commands/teamwork/runtime.d.ts +9 -0
- package/dist/commands/teamwork/runtime.d.ts.map +1 -0
- package/dist/commands/teamwork/runtime.js +402 -0
- package/dist/commands/teamwork/runtime.js.map +1 -0
- package/dist/commands/teamwork/send.d.ts +1 -0
- package/dist/commands/teamwork/send.d.ts.map +1 -1
- package/dist/commands/teamwork/send.js +2 -1
- package/dist/commands/teamwork/send.js.map +1 -1
- package/dist/commands/teamwork/spawn.d.ts +10 -3
- package/dist/commands/teamwork/spawn.d.ts.map +1 -1
- package/dist/commands/teamwork/spawn.js +44 -27
- package/dist/commands/teamwork/spawn.js.map +1 -1
- package/dist/commands/teamwork/store/lock.js +28 -4
- package/dist/commands/teamwork/store/lock.js.map +1 -1
- package/dist/commands/teamwork/supervisor/inbox.d.ts +1 -0
- package/dist/commands/teamwork/supervisor/inbox.d.ts.map +1 -1
- package/dist/commands/teamwork/supervisor/inbox.js +28 -9
- package/dist/commands/teamwork/supervisor/inbox.js.map +1 -1
- package/dist/commands/teamwork/supervisor/stdout.d.ts.map +1 -1
- package/dist/commands/teamwork/supervisor/stdout.js +2 -3
- package/dist/commands/teamwork/supervisor/stdout.js.map +1 -1
- package/dist/commands/teamwork/supervisor/warning.d.ts.map +1 -1
- package/dist/commands/teamwork/supervisor/warning.js +2 -3
- package/dist/commands/teamwork/supervisor/warning.js.map +1 -1
- package/dist/commands/teamwork/supervisor.d.ts +6 -1
- package/dist/commands/teamwork/supervisor.d.ts.map +1 -1
- package/dist/commands/teamwork/supervisor.js +21 -12
- package/dist/commands/teamwork/supervisor.js.map +1 -1
- package/dist/commands/teamwork/teammate-adapters.d.ts +3 -5
- package/dist/commands/teamwork/teammate-adapters.d.ts.map +1 -1
- package/dist/commands/teamwork/teammate-adapters.js +23 -61
- package/dist/commands/teamwork/teammate-adapters.js.map +1 -1
- package/dist/commands/teamwork/teammate-config.d.ts +5 -1
- package/dist/commands/teamwork/teammate-config.d.ts.map +1 -1
- package/dist/commands/teamwork/teammate-config.js +62 -19
- package/dist/commands/teamwork/teammate-config.js.map +1 -1
- package/dist/commands/teamwork/teammate-launch.d.ts +15 -6
- package/dist/commands/teamwork/teammate-launch.d.ts.map +1 -1
- package/dist/commands/teamwork/teammate-launch.js +129 -22
- package/dist/commands/teamwork/teammate-launch.js.map +1 -1
- package/dist/commands/teamwork/wait.d.ts +2 -0
- package/dist/commands/teamwork/wait.d.ts.map +1 -1
- package/dist/commands/teamwork/wait.js +44 -3
- package/dist/commands/teamwork/wait.js.map +1 -1
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +92 -84
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +635 -592
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +94 -89
- package/dist/commands/workflow.js.map +1 -1
- package/dist/configurators/shared.js +2 -2
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +14 -32
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/constants/paths.d.ts +3 -10
- package/dist/constants/paths.d.ts.map +1 -1
- package/dist/constants/paths.js +4 -13
- package/dist/constants/paths.js.map +1 -1
- package/dist/migrations/manifests/0.7.1-beta.0.json +9 -0
- package/dist/migrations/manifests/0.7.1-beta.1.json +186 -0
- package/dist/migrations/manifests/0.7.1-beta.10.json +9 -0
- package/dist/migrations/manifests/0.7.1-beta.11.json +9 -0
- package/dist/migrations/manifests/0.7.1-beta.12.json +9 -0
- package/dist/migrations/manifests/0.7.1-beta.13.json +9 -0
- package/dist/migrations/manifests/0.7.1-beta.14.json +11 -0
- package/dist/migrations/manifests/0.7.1-beta.15.json +9 -0
- package/dist/migrations/manifests/0.7.1-beta.16.json +9 -0
- package/dist/migrations/manifests/0.7.1-beta.17.json +9 -0
- package/dist/migrations/manifests/0.7.1-beta.18.json +9 -0
- package/dist/migrations/manifests/0.7.1-beta.19.json +9 -0
- package/dist/migrations/manifests/0.7.1-beta.2.json +522 -0
- package/dist/migrations/manifests/0.7.1-beta.3.json +9 -0
- package/dist/migrations/manifests/0.7.1-beta.4.json +9 -0
- package/dist/migrations/manifests/0.7.1-beta.5.json +9 -0
- package/dist/migrations/manifests/0.7.1-beta.6.json +10 -0
- package/dist/migrations/manifests/0.7.1-beta.7.json +8 -0
- package/dist/migrations/manifests/0.7.1-beta.8.json +481 -0
- package/dist/migrations/manifests/0.7.1-beta.9.json +191 -0
- package/dist/migrations/manifests/0.7.2-beta.0.json +11 -0
- package/dist/migrations/manifests/0.7.2-beta.1.json +11 -0
- package/dist/migrations/manifests/0.7.2-beta.10.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.2.json +11 -0
- package/dist/migrations/manifests/0.7.2-beta.3.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.4.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.5.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.6.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.7.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.8.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.9.json +9 -0
- package/dist/templates/claude/hooks/statusline.py +9 -4
- package/dist/templates/codex/hooks/session-start.py +28 -11
- package/dist/templates/codex/hooks.json +10 -0
- package/dist/templates/common/bundled-skills/trellis-decision-space-construction-and-merging/SKILL.md +2 -0
- package/dist/templates/common/bundled-skills/trellis-decision-space-construction-and-merging/workflow.md +8 -2
- package/dist/templates/common/bundled-skills/trellis-delivery-review-and-closeout/SKILL.md +2 -0
- package/dist/templates/common/bundled-skills/trellis-goal-exploration-and-requirements/SKILL.md +2 -0
- package/dist/templates/common/bundled-skills/trellis-goal-exploration-and-requirements/workflow.md +2 -0
- package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/add-project-local-conventions.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +5 -5
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-task-lifecycle.md +3 -2
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/multi-agent-teamwork.md +20 -2
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +8 -2
- package/dist/templates/common/bundled-skills/trellis-session-insight/references/cli-quick-reference.md +2 -1
- package/dist/templates/common/bundled-skills/trellis-session-insight/references/triggering-patterns.md +2 -2
- package/dist/templates/common/bundled-skills/trellis-solution-design-and-convergence/SKILL.md +2 -0
- package/dist/templates/common/bundled-skills/trellis-solution-design-and-convergence/workflow.md +22 -5
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/mcp-setup.md +4 -2
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-task-planning.md +2 -2
- package/dist/templates/common/bundled-skills/trellis-task-implementation/SKILL.md +2 -0
- package/dist/templates/common/bundled-skills/trellis-task-implementation/workflow.md +6 -0
- package/dist/templates/common/bundled-skills/trellis-teamwork/SKILL.md +25 -3
- package/dist/templates/common/bundled-skills/trellis-teamwork/references/coordination-modes.md +34 -3
- package/dist/templates/common/bundled-skills/trellis-teamwork/references/teammate-configuration-matrix.md +37 -26
- package/dist/templates/common/bundled-skills/trellis-teamwork/references/teammate-processes.md +128 -14
- package/dist/templates/common/bundled-skills/trellis-teamwork/references/teamwork-plan-construction.md +152 -20
- package/dist/templates/common/bundled-skills/trellis-worktree-delegation/SKILL.md +14 -0
- package/dist/templates/common/bundled-skills/trellis-worktree-delegation/workflow.md +17 -0
- package/dist/templates/common/commands/continue.md +2 -0
- package/dist/templates/common/commands/start.md +4 -2
- package/dist/templates/common/skills/before-dev.md +1 -4
- package/dist/templates/common/skills/break-loop.md +7 -18
- package/dist/templates/common/skills/check.md +7 -11
- package/dist/templates/common/skills/request-intake.md +25 -0
- package/dist/templates/common/skills/update-spec.md +5 -7
- package/dist/templates/copilot/hooks/session-start.py +14 -11
- package/dist/templates/copilot/index.d.ts +1 -6
- package/dist/templates/copilot/index.d.ts.map +1 -1
- package/dist/templates/copilot/index.js +1 -14
- package/dist/templates/copilot/index.js.map +1 -1
- package/dist/templates/extract.js +4 -0
- package/dist/templates/extract.js.map +1 -1
- package/dist/templates/kiro/agents/trellis.json +1 -1
- package/dist/templates/markdown/spec/backend/index.md.txt +4 -35
- package/dist/templates/markdown/spec/frontend/index.md.txt +4 -36
- package/dist/templates/omp/extensions/trellis/index.ts.txt +2 -2
- package/dist/templates/opencode/lib/session-utils.js +301 -209
- package/dist/templates/pi/extensions/trellis/index.ts.txt +17 -1
- package/dist/templates/shared-hooks/guard-teamwork-wait.py +58 -0
- 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/inject-workflow-state.py +23 -3
- package/dist/templates/shared-hooks/session-start.py +16 -12
- package/dist/templates/snow/SNOW.md +1 -1
- package/dist/templates/trellis/agents/delegated-worktree-primary-agent.md +18 -11
- package/dist/templates/trellis/agents/profiles/architecture.md +9 -0
- package/dist/templates/trellis/agents/profiles/diagnosis.md +9 -0
- package/dist/templates/trellis/agents/profiles/exploration.md +9 -0
- package/dist/templates/trellis/agents/profiles/research.md +9 -0
- package/dist/templates/trellis/agents/profiles/review.md +9 -0
- package/dist/templates/trellis/agents/profiles/verification.md +9 -0
- package/dist/templates/trellis/agents/teammate-profiles.json +56 -4
- package/dist/templates/trellis/agents/teammate.md +6 -52
- package/dist/templates/trellis/agents/worktree-delegation-node.md +24 -0
- package/dist/templates/trellis/config.yaml +2 -5
- package/dist/templates/trellis/index.d.ts +4 -0
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +23 -4
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/add_session.py +1 -1
- package/dist/templates/trellis/scripts/common/active_task.py +3 -47
- package/dist/templates/trellis/scripts/common/config.py +5 -0
- package/dist/templates/trellis/scripts/common/git_context.py +10 -0
- package/dist/templates/trellis/scripts/common/io.py +2 -2
- package/dist/templates/trellis/scripts/common/paths.py +9 -25
- package/dist/templates/trellis/scripts/common/safe_commit.py +8 -8
- package/dist/templates/trellis/scripts/common/task_context.py +11 -51
- package/dist/templates/trellis/scripts/common/task_continuity.py +202 -60
- package/dist/templates/trellis/scripts/common/task_layout.py +80 -0
- package/dist/templates/trellis/scripts/common/task_move.py +345 -0
- package/dist/templates/trellis/scripts/common/task_store.py +57 -57
- package/dist/templates/trellis/scripts/common/task_utils.py +23 -19
- package/dist/templates/trellis/scripts/common/task_workflow.py +400 -50
- package/dist/templates/trellis/scripts/common/tasks.py +6 -5
- package/dist/templates/trellis/scripts/common/worktree_delegation.py +561 -0
- package/dist/templates/trellis/scripts/hooks/linear_sync.py +13 -3
- package/dist/templates/trellis/scripts/task.py +109 -24
- package/dist/templates/trellis/teamwork.json +10 -0
- package/dist/templates/trellis/workflow.md +31 -5
- package/dist/utils/ablation-store.d.ts +1 -1
- package/dist/utils/ablation-store.d.ts.map +1 -1
- package/dist/utils/ablation-store.js +58 -24
- package/dist/utils/ablation-store.js.map +1 -1
- package/dist/utils/asset-backup.d.ts +138 -0
- package/dist/utils/asset-backup.d.ts.map +1 -0
- package/dist/utils/asset-backup.js +525 -0
- package/dist/utils/asset-backup.js.map +1 -0
- package/dist/utils/atomic-write.d.ts +1 -1
- package/dist/utils/atomic-write.d.ts.map +1 -1
- package/dist/utils/atomic-write.js +6 -3
- package/dist/utils/atomic-write.js.map +1 -1
- package/dist/utils/manifest-prune.d.ts +4 -1
- package/dist/utils/manifest-prune.d.ts.map +1 -1
- package/dist/utils/manifest-prune.js +17 -6
- package/dist/utils/manifest-prune.js.map +1 -1
- package/dist/utils/template-fetcher.d.ts +4 -19
- package/dist/utils/template-fetcher.d.ts.map +1 -1
- package/dist/utils/template-fetcher.js +9 -45
- package/dist/utils/template-fetcher.js.map +1 -1
- package/dist/utils/template-hash.d.ts +5 -4
- package/dist/utils/template-hash.d.ts.map +1 -1
- package/dist/utils/template-hash.js +24 -17
- package/dist/utils/template-hash.js.map +1 -1
- package/package.json +3 -2
- package/dist/templates/common/skills/brainstorm.md +0 -21
- package/dist/templates/copilot/prompts/before-dev.prompt.md +0 -39
- package/dist/templates/copilot/prompts/brainstorm.prompt.md +0 -13
- package/dist/templates/copilot/prompts/break-loop.prompt.md +0 -129
- package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +0 -170
- package/dist/templates/copilot/prompts/check.prompt.md +0 -110
- package/dist/templates/copilot/prompts/create-command.prompt.md +0 -116
- package/dist/templates/copilot/prompts/finish-work.prompt.md +0 -22
- package/dist/templates/copilot/prompts/integrate-skill.prompt.md +0 -223
- package/dist/templates/copilot/prompts/onboard.prompt.md +0 -362
- package/dist/templates/copilot/prompts/record-session.prompt.md +0 -58
- package/dist/templates/copilot/prompts/start.prompt.md +0 -65
- package/dist/templates/copilot/prompts/update-spec.prompt.md +0 -358
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* ├── gitignore.txt # .gitignore content
|
|
19
19
|
* └── gitattributes.txt # project-root .gitattributes content
|
|
20
20
|
*/
|
|
21
|
-
import { readFileSync } from "node:fs";
|
|
21
|
+
import { readFileSync, readdirSync } from "node:fs";
|
|
22
22
|
import { dirname, join } from "node:path";
|
|
23
23
|
import { fileURLToPath } from "node:url";
|
|
24
24
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -35,6 +35,8 @@ export const commonDeveloper = readTemplate("scripts/common/developer.py");
|
|
|
35
35
|
export const commonGitContext = readTemplate("scripts/common/git_context.py");
|
|
36
36
|
export const commonTaskQueue = readTemplate("scripts/common/task_queue.py");
|
|
37
37
|
export const commonTaskUtils = readTemplate("scripts/common/task_utils.py");
|
|
38
|
+
export const commonTaskLayout = readTemplate("scripts/common/task_layout.py");
|
|
39
|
+
export const commonTaskMove = readTemplate("scripts/common/task_move.py");
|
|
38
40
|
export const commonActiveTask = readTemplate("scripts/common/active_task.py");
|
|
39
41
|
export const commonCliAdapter = readTemplate("scripts/common/cli_adapter.py");
|
|
40
42
|
export const commonConfig = readTemplate("scripts/common/config.py");
|
|
@@ -61,9 +63,11 @@ export const initDeveloperScript = readTemplate("scripts/init_developer.py");
|
|
|
61
63
|
export const taskScript = readTemplate("scripts/task.py");
|
|
62
64
|
export const getContextScript = readTemplate("scripts/get_context.py");
|
|
63
65
|
export const addSessionScript = readTemplate("scripts/add_session.py");
|
|
66
|
+
export const linearSyncScript = readTemplate("scripts/hooks/linear_sync.py");
|
|
64
67
|
// Configuration files
|
|
65
68
|
export const workflowMdTemplate = readTemplate("workflow.md");
|
|
66
69
|
export const configYamlTemplate = readTemplate("config.yaml");
|
|
70
|
+
export const teamworkConfigTemplate = readTemplate("teamwork.json");
|
|
67
71
|
export const gitignoreTemplate = readTemplate("gitignore.txt");
|
|
68
72
|
export const gitattributesTemplate = readTemplate("gitattributes.txt");
|
|
69
73
|
// Project agent roles loaded from `.trellis/agents/`.
|
|
@@ -84,6 +88,8 @@ export function getAllScripts() {
|
|
|
84
88
|
scripts.set("common/git_context.py", commonGitContext);
|
|
85
89
|
scripts.set("common/task_queue.py", commonTaskQueue);
|
|
86
90
|
scripts.set("common/task_utils.py", commonTaskUtils);
|
|
91
|
+
scripts.set("common/task_layout.py", commonTaskLayout);
|
|
92
|
+
scripts.set("common/task_move.py", commonTaskMove);
|
|
87
93
|
scripts.set("common/active_task.py", commonActiveTask);
|
|
88
94
|
scripts.set("common/cli_adapter.py", commonCliAdapter);
|
|
89
95
|
scripts.set("common/config.py", commonConfig);
|
|
@@ -96,6 +102,7 @@ export function getAllScripts() {
|
|
|
96
102
|
scripts.set("common/task_store.py", commonTaskStore);
|
|
97
103
|
scripts.set("common/task_workflow.py", commonTaskWorkflow);
|
|
98
104
|
scripts.set("common/task_continuity.py", commonTaskContinuity);
|
|
105
|
+
scripts.set("common/worktree_delegation.py", readTemplate("scripts/common/worktree_delegation.py"));
|
|
99
106
|
scripts.set("common/session_context.py", commonSessionContext);
|
|
100
107
|
scripts.set("common/packages_context.py", commonPackagesContext);
|
|
101
108
|
scripts.set("common/workflow_phase.py", commonWorkflowPhase);
|
|
@@ -110,6 +117,7 @@ export function getAllScripts() {
|
|
|
110
117
|
scripts.set("task.py", taskScript);
|
|
111
118
|
scripts.set("get_context.py", getContextScript);
|
|
112
119
|
scripts.set("add_session.py", addSessionScript);
|
|
120
|
+
scripts.set("hooks/linear_sync.py", linearSyncScript);
|
|
113
121
|
return scripts;
|
|
114
122
|
}
|
|
115
123
|
/**
|
|
@@ -122,9 +130,20 @@ export function getAllScripts() {
|
|
|
122
130
|
*/
|
|
123
131
|
export function getAllAgents() {
|
|
124
132
|
const agents = new Map();
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
133
|
+
function collect(directory) {
|
|
134
|
+
for (const entry of readdirSync(join(__dirname, "agents", directory), {
|
|
135
|
+
withFileTypes: true,
|
|
136
|
+
})) {
|
|
137
|
+
const relative = join(directory, entry.name);
|
|
138
|
+
if (entry.isDirectory())
|
|
139
|
+
collect(relative);
|
|
140
|
+
else if (entry.isFile())
|
|
141
|
+
agents.set(relative, readTemplate(join("agents", relative)));
|
|
142
|
+
else
|
|
143
|
+
throw new Error(`unsupported agent template: ${relative}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
collect("");
|
|
128
147
|
return agents;
|
|
129
148
|
}
|
|
130
149
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/trellis/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/trellis/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,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,gCAAgC;AAChC,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC;AAE/D,0BAA0B;AAC1B,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC,4BAA4B,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,yBAAyB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC,6BAA6B,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAC,+BAA+B,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAG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AC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,CAAC;IAEtD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,SAAS,OAAO,CAAC,SAAiB;QAChC,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE;YACpE,aAAa,EAAE,IAAI;SACpB,CAAC,EAAE,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAC7C,IAAI,KAAK,CAAC,WAAW,EAAE;gBAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;iBACtC,IAAI,KAAK,CAAC,MAAM,EAAE;gBACrB,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;;gBAC1D,MAAM,IAAI,KAAK,CAAC,+BAA+B,QAAQ,EAAE,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IACD,OAAO,CAAC,EAAE,CAAC,CAAC;IACZ,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1107,7 +1107,7 @@ def _auto_commit_workspace(repo_root: Path) -> str:
|
|
|
1107
1107
|
|
|
1108
1108
|
commit_msg = get_session_commit_message(repo_root)
|
|
1109
1109
|
# Resolve the current task so staging is scoped to its dir only. The ref
|
|
1110
|
-
# is ``.trellis/tasks/<
|
|
1110
|
+
# is ``.trellis/tasks/<task-dir>`` — pass the bare task name.
|
|
1111
1111
|
current = get_current_task(repo_root)
|
|
1112
1112
|
if current:
|
|
1113
1113
|
task_name = Path(current).name
|
|
@@ -201,54 +201,10 @@ def normalize_task_ref(task_ref: str) -> str:
|
|
|
201
201
|
|
|
202
202
|
|
|
203
203
|
def resolve_task_ref(task_ref: str, repo_root: Path) -> Path | None:
|
|
204
|
-
"""
|
|
204
|
+
"""Use the canonical status-layout resolver shared by all task readers."""
|
|
205
|
+
from .paths import resolve_task_ref as resolve
|
|
205
206
|
|
|
206
|
-
|
|
207
|
-
rather than imported because this module is loaded standalone — hooks add
|
|
208
|
-
it to `sys.path` directly — so it stays zero-relative-import on purpose.
|
|
209
|
-
"""
|
|
210
|
-
normalized = normalize_task_ref(task_ref)
|
|
211
|
-
if not normalized:
|
|
212
|
-
return None
|
|
213
|
-
|
|
214
|
-
try:
|
|
215
|
-
root = repo_root.resolve()
|
|
216
|
-
except OSError:
|
|
217
|
-
return None
|
|
218
|
-
|
|
219
|
-
path_obj = Path(normalized)
|
|
220
|
-
if path_obj.is_absolute():
|
|
221
|
-
candidate = path_obj
|
|
222
|
-
elif normalized.startswith(f"{DIR_WORKFLOW}/"):
|
|
223
|
-
candidate = root / path_obj
|
|
224
|
-
else:
|
|
225
|
-
candidate = root / DIR_WORKFLOW / DIR_TASKS / path_obj
|
|
226
|
-
|
|
227
|
-
# Both sides are resolved because repo_root itself may sit behind a
|
|
228
|
-
# symlink (/tmp on macOS does), and resolve() is what collapses `..`
|
|
229
|
-
# instead of leaving it for a lexical relative_to() to wave through.
|
|
230
|
-
try:
|
|
231
|
-
resolved = candidate.resolve()
|
|
232
|
-
workflow_real = (root / DIR_WORKFLOW).resolve()
|
|
233
|
-
except OSError:
|
|
234
|
-
return None
|
|
235
|
-
|
|
236
|
-
try:
|
|
237
|
-
resolved.relative_to(root)
|
|
238
|
-
return resolved
|
|
239
|
-
except ValueError:
|
|
240
|
-
pass
|
|
241
|
-
|
|
242
|
-
# `.trellis` may itself be a symlink into a store outside the repo (#567).
|
|
243
|
-
# The workflow dir's own real location is then a second legitimate
|
|
244
|
-
# containment base; a ref that escapes BOTH bases is still refused. Map
|
|
245
|
-
# back to the in-repo (lexical) form so callers store a repo-relative ref.
|
|
246
|
-
try:
|
|
247
|
-
rel = resolved.relative_to(workflow_real)
|
|
248
|
-
except ValueError:
|
|
249
|
-
return None
|
|
250
|
-
|
|
251
|
-
return root / DIR_WORKFLOW / rel
|
|
207
|
+
return resolve(task_ref, repo_root)
|
|
252
208
|
|
|
253
209
|
|
|
254
210
|
def _runtime_sessions_dir(repo_root: Path) -> Path:
|
|
@@ -301,6 +301,11 @@ def get_hooks(event: str, repo_root: Path | None = None) -> list[str]:
|
|
|
301
301
|
file=sys.stderr,
|
|
302
302
|
)
|
|
303
303
|
return []
|
|
304
|
+
if event == "after_complete" and "after_archive" in hooks:
|
|
305
|
+
print(
|
|
306
|
+
"[WARN] ignoring legacy hook `after_archive`; rename it to `after_complete` in config.yaml",
|
|
307
|
+
file=sys.stderr,
|
|
308
|
+
)
|
|
304
309
|
commands = hooks.get(event)
|
|
305
310
|
if commands is None:
|
|
306
311
|
return []
|
|
@@ -49,6 +49,16 @@ def main() -> None:
|
|
|
49
49
|
"""CLI entry point."""
|
|
50
50
|
import argparse
|
|
51
51
|
|
|
52
|
+
from .worktree_delegation import node_context
|
|
53
|
+
from .task_workflow import TaskWorkflowError
|
|
54
|
+
try:
|
|
55
|
+
delegated = node_context()
|
|
56
|
+
except (ValueError, OSError, KeyError, TaskWorkflowError) as error:
|
|
57
|
+
raise SystemExit(f"Delegated node blocked: {error}") from error
|
|
58
|
+
if delegated is not None:
|
|
59
|
+
print(json.dumps({"delegated_node": delegated, "instruction": "Read node_method_ref and current contract. Do not enter controller phases, task intake, or nested implementation delegation."}, ensure_ascii=False))
|
|
60
|
+
return
|
|
61
|
+
|
|
52
62
|
parser = argparse.ArgumentParser(description="Get Session Context for AI Agent")
|
|
53
63
|
parser.add_argument(
|
|
54
64
|
"--json",
|
|
@@ -136,7 +136,7 @@ def write_json(path: Path, data: dict) -> bool:
|
|
|
136
136
|
return write_text_atomic(path, json.dumps(data, indent=2, ensure_ascii=False))
|
|
137
137
|
|
|
138
138
|
|
|
139
|
-
def write_text_atomic(path: Path, text: str) -> bool:
|
|
139
|
+
def write_text_atomic(path: Path, text: str, *, newline: str | None = None) -> bool:
|
|
140
140
|
"""Write text to a file atomically (temp in same dir, then replace).
|
|
141
141
|
|
|
142
142
|
The same never-truncate-in-place guarantee as :func:`write_json`, for the
|
|
@@ -155,7 +155,7 @@ def write_text_atomic(path: Path, text: str) -> bool:
|
|
|
155
155
|
|
|
156
156
|
try:
|
|
157
157
|
try:
|
|
158
|
-
f = os.fdopen(fd, "w", encoding="utf-8")
|
|
158
|
+
f = os.fdopen(fd, "w", encoding="utf-8", newline=newline)
|
|
159
159
|
except OSError:
|
|
160
160
|
# fdopen never took ownership of fd; close it ourselves.
|
|
161
161
|
os.close(fd)
|
|
@@ -344,35 +344,19 @@ def resolve_task_ref(task_ref: str, repo_root: Path | None = None) -> Path | Non
|
|
|
344
344
|
else:
|
|
345
345
|
candidate = root / DIR_WORKFLOW / DIR_TASKS / path_obj
|
|
346
346
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
# repo_root itself may sit behind a symlink (/tmp on macOS does).
|
|
350
|
-
try:
|
|
351
|
-
resolved = candidate.resolve()
|
|
352
|
-
workflow_real = (root / DIR_WORKFLOW).resolve()
|
|
353
|
-
except OSError:
|
|
354
|
-
return None
|
|
347
|
+
from .task_layout import task_status_dir
|
|
348
|
+
from .task_move import require_settled_layout
|
|
355
349
|
|
|
356
350
|
try:
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
# containment base: a ref through that link never left the workflow tree.
|
|
365
|
-
# A ref that escapes BOTH bases (traversal, absolute path elsewhere, a
|
|
366
|
-
# task dir symlinked out of the tree) is still refused.
|
|
367
|
-
try:
|
|
368
|
-
rel = resolved.relative_to(workflow_real)
|
|
369
|
-
except ValueError:
|
|
351
|
+
require_settled_layout(root)
|
|
352
|
+
tasks = root / DIR_WORKFLOW / DIR_TASKS
|
|
353
|
+
if task_status_dir(candidate, tasks) is None:
|
|
354
|
+
return None
|
|
355
|
+
relative = candidate.resolve().relative_to(tasks.resolve())
|
|
356
|
+
return tasks / relative
|
|
357
|
+
except (ValueError, OSError, RuntimeError):
|
|
370
358
|
return None
|
|
371
359
|
|
|
372
|
-
# Map back to the in-repo (lexical) form so callers store the same
|
|
373
|
-
# repo-relative ref as in the non-symlinked layout.
|
|
374
|
-
return root / DIR_WORKFLOW / rel
|
|
375
|
-
|
|
376
360
|
|
|
377
361
|
def get_current_task(
|
|
378
362
|
repo_root: Path | None = None,
|
|
@@ -70,7 +70,7 @@ def safe_trellis_paths_to_add(
|
|
|
70
70
|
Included:
|
|
71
71
|
- .trellis/workspace/<developer>/journal-*.md
|
|
72
72
|
- .trellis/workspace/<developer>/index.md
|
|
73
|
-
- .trellis/tasks/<
|
|
73
|
+
- .trellis/tasks/<task-dir>/ (ONLY the current task dir when
|
|
74
74
|
``task_name`` is passed)
|
|
75
75
|
|
|
76
76
|
Excluded (intentionally — these must not be staged):
|
|
@@ -112,16 +112,16 @@ def safe_trellis_paths_to_add(
|
|
|
112
112
|
# Narrow scope — ONLY the current task directory.
|
|
113
113
|
# Never iterdir() all tasks: parallel-window dirty task dirs must not
|
|
114
114
|
# leak into the session auto-commit.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
from .task_utils import find_task_by_name
|
|
116
|
+
active_task = find_task_by_name(task_name, tasks_dir)
|
|
117
|
+
if active_task is not None and active_task.is_dir():
|
|
118
|
+
paths.append(active_task.relative_to(repo_root).as_posix())
|
|
118
119
|
return paths
|
|
119
120
|
|
|
120
121
|
# Wide scope (no task_name): each direct task directory.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
paths.append(f"{DIR_WORKFLOW}/{DIR_TASKS}/{child.name}")
|
|
122
|
+
from .task_layout import iter_task_dirs
|
|
123
|
+
for child in iter_task_dirs(tasks_dir):
|
|
124
|
+
paths.append(child.relative_to(repo_root).as_posix())
|
|
125
125
|
|
|
126
126
|
return paths
|
|
127
127
|
|
|
@@ -29,7 +29,7 @@ from .config import get_context_injection_limits
|
|
|
29
29
|
from .git import branch_exists_locally
|
|
30
30
|
from .io import read_json
|
|
31
31
|
from .log import Colors, colored
|
|
32
|
-
from .paths import
|
|
32
|
+
from .paths import FILE_TASK_JSON, get_repo_root
|
|
33
33
|
from .task_utils import resolve_task_dir
|
|
34
34
|
|
|
35
35
|
# Extensions that look like code rather than spec/research docs. Entries with
|
|
@@ -195,54 +195,6 @@ def _is_exempt_from_code_file_warning(file_path: str, task_rel: str) -> bool:
|
|
|
195
195
|
return False
|
|
196
196
|
|
|
197
197
|
|
|
198
|
-
def _resolve_context_entry_path(
|
|
199
|
-
file_path: str, repo_root: Path, task_dir: Path | None
|
|
200
|
-
) -> Path | None:
|
|
201
|
-
"""Bind historical self-references to their archive copy without fallback."""
|
|
202
|
-
repo_path = repo_root / file_path
|
|
203
|
-
if task_dir is None:
|
|
204
|
-
return repo_path
|
|
205
|
-
|
|
206
|
-
try:
|
|
207
|
-
task_parts = task_dir.resolve().relative_to(repo_root.resolve()).parts
|
|
208
|
-
except ValueError:
|
|
209
|
-
return repo_path
|
|
210
|
-
|
|
211
|
-
archive_prefix = (DIR_WORKFLOW, DIR_TASKS, "archive")
|
|
212
|
-
if len(task_parts) != 5 or task_parts[:3] != archive_prefix:
|
|
213
|
-
return repo_path
|
|
214
|
-
|
|
215
|
-
year_month = task_parts[3]
|
|
216
|
-
if (
|
|
217
|
-
len(year_month) != 7
|
|
218
|
-
or year_month[4] != "-"
|
|
219
|
-
or not year_month[:4].isdigit()
|
|
220
|
-
or not year_month[5:].isdigit()
|
|
221
|
-
):
|
|
222
|
-
return repo_path
|
|
223
|
-
|
|
224
|
-
historical_root = f"{DIR_WORKFLOW}/{DIR_TASKS}/{task_dir.name}"
|
|
225
|
-
posix_path = file_path.replace("\\", "/")
|
|
226
|
-
if posix_path == historical_root:
|
|
227
|
-
relative_parts: tuple[str, ...] = ()
|
|
228
|
-
elif posix_path.startswith(f"{historical_root}/"):
|
|
229
|
-
relative_path = posix_path[len(historical_root) + 1 :]
|
|
230
|
-
if relative_path.endswith("/"):
|
|
231
|
-
relative_path = relative_path[:-1]
|
|
232
|
-
relative_parts = tuple(relative_path.split("/")) if relative_path else ()
|
|
233
|
-
if any(part in ("", ".", "..") for part in relative_parts):
|
|
234
|
-
return None
|
|
235
|
-
else:
|
|
236
|
-
return repo_path
|
|
237
|
-
|
|
238
|
-
try:
|
|
239
|
-
archive_root = task_dir.resolve()
|
|
240
|
-
resolved_path = task_dir.joinpath(*relative_parts).resolve()
|
|
241
|
-
resolved_path.relative_to(archive_root)
|
|
242
|
-
except (OSError, RuntimeError, ValueError):
|
|
243
|
-
return None
|
|
244
|
-
return resolved_path
|
|
245
|
-
|
|
246
198
|
|
|
247
199
|
def _validate_jsonl(jsonl_file: Path, repo_root: Path, task_dir: Path | None = None) -> int:
|
|
248
200
|
"""Validate a single JSONL file.
|
|
@@ -268,7 +220,7 @@ def _validate_jsonl(jsonl_file: Path, repo_root: Path, task_dir: Path | None = N
|
|
|
268
220
|
task_rel = ""
|
|
269
221
|
if task_dir is not None:
|
|
270
222
|
try:
|
|
271
|
-
task_rel = task_dir.
|
|
223
|
+
task_rel = task_dir.absolute().relative_to(repo_root.absolute()).as_posix()
|
|
272
224
|
except ValueError:
|
|
273
225
|
task_rel = ""
|
|
274
226
|
|
|
@@ -323,7 +275,15 @@ def _validate_jsonl(jsonl_file: Path, repo_root: Path, task_dir: Path | None = N
|
|
|
323
275
|
continue
|
|
324
276
|
|
|
325
277
|
real_entries += 1
|
|
326
|
-
full_path =
|
|
278
|
+
full_path = repo_root / file_path
|
|
279
|
+
normalized = file_path.replace("\\", "/")
|
|
280
|
+
if task_dir is not None and task_rel and (normalized == task_rel or normalized.startswith(task_rel + "/")):
|
|
281
|
+
try:
|
|
282
|
+
if ".." in Path(normalized).parts:
|
|
283
|
+
raise ValueError("Traversal in task reference")
|
|
284
|
+
full_path.resolve().relative_to(task_dir.resolve())
|
|
285
|
+
except (ValueError, OSError, RuntimeError):
|
|
286
|
+
full_path = None
|
|
327
287
|
if entry_type == "directory":
|
|
328
288
|
if full_path is None or not full_path.is_dir():
|
|
329
289
|
print(f" {colored(f'{file_name}:{line_num}: Directory not found: {file_path}', Colors.RED)}")
|