@mindfoldhq/trellis 0.6.7 → 0.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +38 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/channel/adapters/codex.d.ts +7 -1
- package/dist/commands/channel/adapters/codex.d.ts.map +1 -1
- package/dist/commands/channel/adapters/codex.js +19 -2
- package/dist/commands/channel/adapters/codex.js.map +1 -1
- package/dist/commands/channel/adapters/index.d.ts +3 -1
- package/dist/commands/channel/adapters/index.d.ts.map +1 -1
- package/dist/commands/channel/adapters/index.js +1 -1
- package/dist/commands/channel/adapters/index.js.map +1 -1
- package/dist/commands/channel/agent-loader.d.ts +2 -2
- package/dist/commands/channel/agent-loader.d.ts.map +1 -1
- package/dist/commands/channel/agent-loader.js +9 -5
- package/dist/commands/channel/agent-loader.js.map +1 -1
- package/dist/commands/channel/context-loader.d.ts +1 -1
- package/dist/commands/channel/context-loader.d.ts.map +1 -1
- package/dist/commands/channel/context-loader.js +36 -15
- package/dist/commands/channel/context-loader.js.map +1 -1
- package/dist/commands/channel/context-trust.d.ts +31 -0
- package/dist/commands/channel/context-trust.d.ts.map +1 -0
- package/dist/commands/channel/context-trust.js +139 -0
- package/dist/commands/channel/context-trust.js.map +1 -0
- package/dist/commands/channel/index.d.ts.map +1 -1
- package/dist/commands/channel/index.js +4 -0
- package/dist/commands/channel/index.js.map +1 -1
- package/dist/commands/channel/spawn.d.ts +3 -0
- package/dist/commands/channel/spawn.d.ts.map +1 -1
- package/dist/commands/channel/spawn.js +5 -2
- package/dist/commands/channel/spawn.js.map +1 -1
- package/dist/commands/channel/supervisor.d.ts +3 -0
- package/dist/commands/channel/supervisor.d.ts.map +1 -1
- package/dist/commands/channel/supervisor.js +1 -0
- package/dist/commands/channel/supervisor.js.map +1 -1
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mem.d.ts.map +1 -1
- package/dist/commands/mem.js +30 -9
- package/dist/commands/mem.js.map +1 -1
- package/dist/commands/update.d.ts +12 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +75 -7
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/codex.d.ts +36 -0
- package/dist/configurators/codex.d.ts.map +1 -1
- package/dist/configurators/codex.js +111 -13
- package/dist/configurators/codex.js.map +1 -1
- package/dist/configurators/grok.d.ts +22 -0
- package/dist/configurators/grok.d.ts.map +1 -0
- package/dist/configurators/grok.js +58 -0
- package/dist/configurators/grok.js.map +1 -0
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +17 -2
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/kimi.d.ts +29 -0
- package/dist/configurators/kimi.d.ts.map +1 -0
- package/dist/configurators/kimi.js +81 -0
- package/dist/configurators/kimi.js.map +1 -0
- package/dist/configurators/pi.js +9 -9
- package/dist/configurators/pi.js.map +1 -1
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +12 -4
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/snow.d.ts +31 -0
- package/dist/configurators/snow.d.ts.map +1 -0
- package/dist/configurators/snow.js +95 -0
- package/dist/configurators/snow.js.map +1 -0
- package/dist/configurators/workflow.d.ts +14 -0
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +37 -1
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/configurators/zcode.d.ts +9 -4
- package/dist/configurators/zcode.d.ts.map +1 -1
- package/dist/configurators/zcode.js +41 -12
- package/dist/configurators/zcode.js.map +1 -1
- package/dist/migrations/manifests/0.5.0-beta.0.json +1 -1
- package/dist/migrations/manifests/0.6.8.json +17 -0
- package/dist/migrations/manifests/0.6.9.json +9 -0
- package/dist/templates/codex/agents/trellis-check.toml +7 -12
- package/dist/templates/codex/agents/trellis-implement.toml +7 -12
- package/dist/templates/codex/agents/trellis-research.toml +15 -15
- package/dist/templates/codex/config.toml +11 -0
- package/dist/templates/codex/hooks/session-start.py +9 -3
- package/dist/templates/codex/hooks.json +12 -0
- package/dist/templates/codex/skills/brainstorm/SKILL.md +40 -13
- package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +2 -2
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +1 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +10 -4
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +2 -1
- package/dist/templates/common/bundled-skills/trellis-session-insight/SKILL.md +1 -1
- package/dist/templates/common/skills/brainstorm.md +40 -13
- package/dist/templates/copilot/prompts/brainstorm.prompt.md +40 -13
- package/dist/templates/grok/agents/trellis-check.md +105 -0
- package/dist/templates/grok/agents/trellis-implement.md +116 -0
- package/dist/templates/grok/agents/trellis-research.md +146 -0
- package/dist/templates/grok/index.d.ts +16 -0
- package/dist/templates/grok/index.d.ts.map +1 -0
- package/dist/templates/grok/index.js +19 -0
- package/dist/templates/grok/index.js.map +1 -0
- package/dist/templates/kimi/agents/trellis-check.md +103 -0
- package/dist/templates/kimi/agents/trellis-implement.md +114 -0
- package/dist/templates/kimi/agents/trellis-research.md +144 -0
- package/dist/templates/kimi/index.d.ts +19 -0
- package/dist/templates/kimi/index.d.ts.map +1 -0
- package/dist/templates/kimi/index.js +22 -0
- package/dist/templates/kimi/index.js.map +1 -0
- package/dist/templates/omp/extensions/trellis/index.ts.txt +133 -9
- package/dist/templates/opencode/lib/session-utils.js +8 -2
- package/dist/templates/opencode/lib/trellis-context.js +263 -43
- package/dist/templates/opencode/plugins/inject-subagent-context.js +89 -35
- package/dist/templates/opencode/plugins/inject-workflow-state.js +90 -5
- package/dist/templates/pi/extensions/trellis/index.ts.txt +278 -24
- package/dist/templates/pi/settings.json +0 -3
- package/dist/templates/shared-hooks/index.d.ts +11 -5
- package/dist/templates/shared-hooks/index.d.ts.map +1 -1
- package/dist/templates/shared-hooks/index.js +16 -5
- package/dist/templates/shared-hooks/index.js.map +1 -1
- package/dist/templates/shared-hooks/inject-subagent-context.py +466 -104
- package/dist/templates/shared-hooks/inject-workflow-state.py +86 -29
- package/dist/templates/shared-hooks/session-start.py +26 -6
- package/dist/templates/snow/SNOW.md +86 -0
- package/dist/templates/snow/agents/trellis-check.md +135 -0
- package/dist/templates/snow/agents/trellis-implement.md +153 -0
- package/dist/templates/snow/agents/trellis-research.md +114 -0
- package/dist/templates/snow/hooks/beforeSubAgentStart.json +15 -0
- package/dist/templates/snow/hooks/onSessionStart.json +15 -0
- package/dist/templates/snow/hooks/onUserMessage.json +15 -0
- package/dist/templates/snow/hooks/write-trellis-context.py +644 -0
- package/dist/templates/snow/index.d.ts +26 -0
- package/dist/templates/snow/index.d.ts.map +1 -0
- package/dist/templates/snow/index.js +36 -0
- package/dist/templates/snow/index.js.map +1 -0
- package/dist/templates/template-utils.d.ts.map +1 -1
- package/dist/templates/template-utils.js +5 -1
- package/dist/templates/template-utils.js.map +1 -1
- package/dist/templates/trellis/config.yaml +55 -7
- package/dist/templates/trellis/gitattributes.txt +9 -0
- package/dist/templates/trellis/index.d.ts +3 -1
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +3 -1
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/add_session.py +94 -28
- package/dist/templates/trellis/scripts/common/active_task.py +44 -13
- package/dist/templates/trellis/scripts/common/cli_adapter.py +69 -5
- package/dist/templates/trellis/scripts/common/config.py +105 -10
- package/dist/templates/trellis/scripts/common/git.py +36 -0
- package/dist/templates/trellis/scripts/common/io.py +16 -9
- package/dist/templates/trellis/scripts/common/task_context.py +101 -7
- package/dist/templates/trellis/scripts/common/task_store.py +149 -22
- package/dist/templates/trellis/scripts/common/task_utils.py +3 -1
- package/dist/templates/trellis/scripts/common/trellis_config.py +2 -1
- package/dist/templates/trellis/scripts/common/workflow_phase.py +19 -12
- package/dist/templates/trellis/scripts/task.py +106 -10
- package/dist/templates/trellis/workflow.md +20 -19
- package/dist/templates/zcode/agents/trellis-check.md +7 -0
- package/dist/templates/zcode/agents/trellis-implement.md +13 -4
- package/dist/templates/zcode/config.json +42 -0
- package/dist/templates/zcode/index.d.ts +10 -1
- package/dist/templates/zcode/index.d.ts.map +1 -1
- package/dist/templates/zcode/index.js +12 -2
- package/dist/templates/zcode/index.js.map +1 -1
- package/dist/types/ai-tools.d.ts +4 -4
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +114 -2
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/utils/template-fetcher.d.ts.map +1 -1
- package/dist/utils/template-fetcher.js +0 -3
- package/dist/utils/template-fetcher.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snow CLI configurator.
|
|
3
|
+
*
|
|
4
|
+
* Snow CLI is a class-1 platform (agentCapable + auto context inject +
|
|
5
|
+
* project agent discovery + beforeSubAgentStart), same capability class as
|
|
6
|
+
* Claude Code / OMP — host protocol differs, workflow surface matches.
|
|
7
|
+
*
|
|
8
|
+
* Output paths:
|
|
9
|
+
* - `.snow/skills/` — workflow + bundled skills (Claude Code Skills layout)
|
|
10
|
+
* - `.snow/commands/trellis-*.json` — custom prompt slash commands (no trellis-start)
|
|
11
|
+
* - `.snow/agents/` — project sub-agents (auto-discovered by Snow; primary path)
|
|
12
|
+
* - `.snow/hooks/` — inject hooks (session / user / beforeSubAgentStart)
|
|
13
|
+
* - `.snow/SNOW.md` — operator guide
|
|
14
|
+
*
|
|
15
|
+
* Modern Snow does NOT ship `.snow/sub-agents.trellis.json` (legacy merge
|
|
16
|
+
* fragment for older hosts without project-agent discovery).
|
|
17
|
+
*
|
|
18
|
+
* hasHooks=true → filterCommands drops `start`; SessionStart injects context.
|
|
19
|
+
* Agents are written without class-2 pull-based prelude (hook inject is primary).
|
|
20
|
+
*/
|
|
21
|
+
import path from "node:path";
|
|
22
|
+
import { AI_TOOLS } from "../types/ai-tools.js";
|
|
23
|
+
import { ensureDir, writeFile } from "../utils/file-writer.js";
|
|
24
|
+
import { getAllAgents, getAllHooks, getSnowGuide, } from "../templates/snow/index.js";
|
|
25
|
+
import { collectSkillTemplates, resolveAllAsSkills, resolveBundledSkills, resolveCommands, writeSkills, writeAgents, replacePythonCommandLiterals, } from "./shared.js";
|
|
26
|
+
function buildSnowCommandJson(name, content) {
|
|
27
|
+
const description = name === "continue"
|
|
28
|
+
? "Resume the current Trellis task at the right workflow phase."
|
|
29
|
+
: name === "finish-work"
|
|
30
|
+
? "Wrap up the current Trellis session: archive tasks and record journal."
|
|
31
|
+
: `Trellis: ${name}`;
|
|
32
|
+
return (JSON.stringify({
|
|
33
|
+
type: "prompt",
|
|
34
|
+
description,
|
|
35
|
+
command: content,
|
|
36
|
+
location: "project",
|
|
37
|
+
}, null, 2) + "\n");
|
|
38
|
+
}
|
|
39
|
+
function collectSnowStaticFiles() {
|
|
40
|
+
const files = new Map();
|
|
41
|
+
for (const hook of getAllHooks()) {
|
|
42
|
+
files.set(`.snow/hooks/${hook.targetPath}`, hook.content);
|
|
43
|
+
}
|
|
44
|
+
files.set(".snow/SNOW.md", getSnowGuide());
|
|
45
|
+
return files;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Collect all Snow template files for `trellis update` diff tracking.
|
|
49
|
+
* Must stay in sync with `configureSnow`.
|
|
50
|
+
*/
|
|
51
|
+
export function collectSnowTemplates() {
|
|
52
|
+
const config = AI_TOOLS.snow;
|
|
53
|
+
const ctx = config.templateContext;
|
|
54
|
+
const files = new Map();
|
|
55
|
+
// hasHooks=true → resolveAllAsSkills drops trellis-start.
|
|
56
|
+
for (const [filePath, content] of collectSkillTemplates(".snow/skills", resolveAllAsSkills(ctx), resolveBundledSkills(ctx))) {
|
|
57
|
+
files.set(filePath, content);
|
|
58
|
+
}
|
|
59
|
+
for (const cmd of resolveCommands(ctx)) {
|
|
60
|
+
const body = replacePythonCommandLiterals(cmd.content);
|
|
61
|
+
files.set(`.snow/commands/trellis-${cmd.name}.json`, buildSnowCommandJson(cmd.name, body));
|
|
62
|
+
}
|
|
63
|
+
// class-1: no applyPullBasedPreludeMarkdown (hook inject is primary)
|
|
64
|
+
for (const agent of getAllAgents()) {
|
|
65
|
+
files.set(`.snow/agents/${agent.name}.md`, agent.content);
|
|
66
|
+
}
|
|
67
|
+
for (const [filePath, content] of collectSnowStaticFiles()) {
|
|
68
|
+
files.set(filePath, content);
|
|
69
|
+
}
|
|
70
|
+
return files;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Configure Snow CLI at init time: write skills, prompt commands, agents,
|
|
74
|
+
* inject hooks, and operator guide.
|
|
75
|
+
*/
|
|
76
|
+
export async function configureSnow(cwd) {
|
|
77
|
+
const config = AI_TOOLS.snow;
|
|
78
|
+
const ctx = config.templateContext;
|
|
79
|
+
await writeSkills(path.join(cwd, ".snow", "skills"), resolveAllAsSkills(ctx), resolveBundledSkills(ctx));
|
|
80
|
+
const commandsDir = path.join(cwd, ".snow", "commands");
|
|
81
|
+
ensureDir(commandsDir);
|
|
82
|
+
for (const cmd of resolveCommands(ctx)) {
|
|
83
|
+
const body = replacePythonCommandLiterals(cmd.content);
|
|
84
|
+
await writeFile(path.join(commandsDir, `trellis-${cmd.name}.json`), buildSnowCommandJson(cmd.name, body));
|
|
85
|
+
}
|
|
86
|
+
// class-1: no applyPullBasedPreludeMarkdown (hook inject is primary)
|
|
87
|
+
await writeAgents(path.join(cwd, ".snow", "agents"), getAllAgents());
|
|
88
|
+
const hooksDir = path.join(cwd, ".snow", "hooks");
|
|
89
|
+
ensureDir(hooksDir);
|
|
90
|
+
for (const hook of getAllHooks()) {
|
|
91
|
+
await writeFile(path.join(hooksDir, hook.targetPath), replacePythonCommandLiterals(hook.content));
|
|
92
|
+
}
|
|
93
|
+
await writeFile(path.join(cwd, ".snow", "SNOW.md"), getSnowGuide());
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=snow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snow.js","sourceRoot":"","sources":["../../src/configurators/snow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EACL,YAAY,EACZ,WAAW,EACX,YAAY,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,WAAW,EACX,WAAW,EACX,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AAErB,SAAS,oBAAoB,CAAC,IAAY,EAAE,OAAe;IACzD,MAAM,WAAW,GACf,IAAI,KAAK,UAAU;QACjB,CAAC,CAAC,8DAA8D;QAChE,CAAC,CAAC,IAAI,KAAK,aAAa;YACtB,CAAC,CAAC,wEAAwE;YAC1E,CAAC,CAAC,YAAY,IAAI,EAAE,CAAC;IAE3B,OAAO,CACL,IAAI,CAAC,SAAS,CACZ;QACE,IAAI,EAAE,QAAQ;QACd,WAAW;QACX,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE,SAAS;KACpB,EACD,IAAI,EACJ,CAAC,CACF,GAAG,IAAI,CACT,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB;IAC7B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC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Q,EAAE,IAAI,CAAC,UAAU,CAAC,EACpC,4BAA4B,CAAC,IAAI,CAAC,OAAO,CAAC,CAC3C,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -20,6 +20,20 @@ export interface WorkflowOptions {
|
|
|
20
20
|
*/
|
|
21
21
|
workflowMdOverride?: string;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Ensure the project-root `.gitattributes` carries the journal `merge=union`
|
|
25
|
+
* rule, without ever overwriting a user's existing file wholesale.
|
|
26
|
+
*
|
|
27
|
+
* - No `.gitattributes` yet: write the bundled template directly.
|
|
28
|
+
* - Existing file that already has a `journal-*.md merge=union` rule (user's
|
|
29
|
+
* own or from a previous `trellis init`/`update`): no-op, avoids duplicates.
|
|
30
|
+
* - Existing file without that rule: append the bundled template content.
|
|
31
|
+
*
|
|
32
|
+
* Intentionally does NOT go through the standard `writeFile` conflict-prompt
|
|
33
|
+
* flow — this file is additive-only and never a candidate for whole-file
|
|
34
|
+
* overwrite.
|
|
35
|
+
*/
|
|
36
|
+
export declare function ensureGitattributes(cwd: string): void;
|
|
23
37
|
/**
|
|
24
38
|
* Create workflow structure based on project type
|
|
25
39
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/configurators/workflow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/configurators/workflow.ts"],"names":[],"mappings":"AAyCA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,8BAA8B,CAAC;AAOtC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,yCAAyC;IACzC,WAAW,EAAE,WAAW,CAAC;IACzB,yFAAyF;IACzF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kEAAkE;IAClE,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;IAC7B,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACjC;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AASD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAerD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,IAAI,CAAC,CAmEf"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { DIR_NAMES, PATHS } from "../constants/paths.js";
|
|
3
4
|
import { copyTrellisDir } from "../templates/extract.js";
|
|
4
5
|
// Import trellis templates (generic, not project-specific)
|
|
5
|
-
import { workflowMdTemplate, configYamlTemplate, gitignoreTemplate, getAllAgents, } from "../templates/trellis/index.js";
|
|
6
|
+
import { workflowMdTemplate, configYamlTemplate, gitignoreTemplate, gitattributesTemplate, getAllAgents, } from "../templates/trellis/index.js";
|
|
6
7
|
// Import markdown templates
|
|
7
8
|
import { agentProgressIndexContent,
|
|
8
9
|
// Backend structure (multi-doc)
|
|
@@ -14,6 +15,38 @@ guidesIndexContent, guidesCrossLayerThinkingGuideContent, guidesCodeReuseThinkin
|
|
|
14
15
|
import { writeFile, ensureDir } from "../utils/file-writer.js";
|
|
15
16
|
import { replacePythonCommandLiterals } from "./shared.js";
|
|
16
17
|
import { sanitizePkgName, } from "../utils/project-detector.js";
|
|
18
|
+
/**
|
|
19
|
+
* Regex used to detect an existing `journal-*.md merge=union` gitattributes
|
|
20
|
+
* rule (any whitespace variant), so `ensureGitattributes` never appends a
|
|
21
|
+
* duplicate entry to a project's pre-existing `.gitattributes`.
|
|
22
|
+
*/
|
|
23
|
+
const JOURNAL_MERGE_UNION_PATTERN = /journal-\*\.md\s+merge=union/;
|
|
24
|
+
/**
|
|
25
|
+
* Ensure the project-root `.gitattributes` carries the journal `merge=union`
|
|
26
|
+
* rule, without ever overwriting a user's existing file wholesale.
|
|
27
|
+
*
|
|
28
|
+
* - No `.gitattributes` yet: write the bundled template directly.
|
|
29
|
+
* - Existing file that already has a `journal-*.md merge=union` rule (user's
|
|
30
|
+
* own or from a previous `trellis init`/`update`): no-op, avoids duplicates.
|
|
31
|
+
* - Existing file without that rule: append the bundled template content.
|
|
32
|
+
*
|
|
33
|
+
* Intentionally does NOT go through the standard `writeFile` conflict-prompt
|
|
34
|
+
* flow — this file is additive-only and never a candidate for whole-file
|
|
35
|
+
* overwrite.
|
|
36
|
+
*/
|
|
37
|
+
export function ensureGitattributes(cwd) {
|
|
38
|
+
const targetPath = path.join(cwd, ".gitattributes");
|
|
39
|
+
if (!fs.existsSync(targetPath)) {
|
|
40
|
+
fs.writeFileSync(targetPath, gitattributesTemplate);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const existing = fs.readFileSync(targetPath, "utf-8");
|
|
44
|
+
if (JOURNAL_MERGE_UNION_PATTERN.test(existing)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const separator = existing.endsWith("\n") ? "\n" : "\n\n";
|
|
48
|
+
fs.writeFileSync(targetPath, existing + separator + gitattributesTemplate);
|
|
49
|
+
}
|
|
17
50
|
/**
|
|
18
51
|
* Create workflow structure based on project type
|
|
19
52
|
*
|
|
@@ -45,6 +78,9 @@ export async function createWorkflowStructure(cwd, options) {
|
|
|
45
78
|
await writeFile(path.join(cwd, DIR_NAMES.WORKFLOW, ".gitignore"), gitignoreTemplate);
|
|
46
79
|
// Copy config.yaml from templates
|
|
47
80
|
await writeFile(path.join(cwd, DIR_NAMES.WORKFLOW, "config.yaml"), configYamlTemplate);
|
|
81
|
+
// Ensure project-root .gitattributes carries the journal merge=union rule
|
|
82
|
+
// (additive-only — never overwrites a user's existing file wholesale).
|
|
83
|
+
ensureGitattributes(cwd);
|
|
48
84
|
// Dispatch channel runtime agent definitions. These are platform-agnostic
|
|
49
85
|
// Trellis runtime files consumed by `trellis channel spawn --agent <name>`
|
|
50
86
|
// through `packages/cli/src/commands/channel/agent-loader.ts`. They are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../src/configurators/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,2DAA2D;AAC3D,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,GACb,MAAM,+BAA+B,CAAC;AAEvC,4BAA4B;AAC5B,OAAO,EACL,yBAAyB;AACzB,gCAAgC;AAChC,mBAAmB,EACnB,gCAAgC,EAChC,gCAAgC,EAChC,+BAA+B,EAC/B,+BAA+B,EAC/B,2BAA2B;AAC3B,iCAAiC;AACjC,oBAAoB,EACpB,iCAAiC,EACjC,yBAAyB,EACzB,6BAA6B,EAC7B,kCAAkC,EAClC,gCAAgC,EAChC,8BAA8B;AAC9B,mBAAmB;AACnB,kBAAkB,EAClB,oCAAoC,EACpC,mCAAmC,GACpC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,eAAe,GAGhB,MAAM,8BAA8B,CAAC;AA6BtC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,GAAW,EACX,OAAyB;IAEzB,MAAM,WAAW,GAAG,OAAO,EAA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AC,GAAG,EAAE,GAAG,KAAK,CAAC,IAAI,IAAI,OAAO,EAAE,CAAC,CAAC;YAC/D,SAAS,CAAC,WAAW,CAAC,CAAC;YACvB,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;YAChE,MAAM,gBAAgB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;SAAM,CAAC;QACN,mBAAmB;QACnB,MAAM,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;IAClE,CAAC;AACH,CAAC"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ZCode configurator.
|
|
3
3
|
*
|
|
4
|
-
* ZCode (智谱) is
|
|
5
|
-
*
|
|
4
|
+
* ZCode (智谱) is an agentCapable class-1 platform. Since ZCode 3.x it exposes
|
|
5
|
+
* a workspace hook config at `.zcode/config.json` (SessionStart,
|
|
6
|
+
* UserPromptSubmit, and PreToolUse for Agent/Task), so `hasHooks` is true.
|
|
7
|
+
* Four output paths:
|
|
6
8
|
* - `.zcode/skills/` — ZCode-private workflow and bundled skills
|
|
7
9
|
* - `.zcode/commands/trellis/` — slash commands (invoked as /trellis:<name>)
|
|
8
|
-
* - `.zcode/agents/` — sub-agent definitions with
|
|
10
|
+
* - `.zcode/agents/` — sub-agent definitions with hook-injection fallback
|
|
11
|
+
* - `.zcode/hooks/` + `.zcode/config.json` — shared Python hook scripts and
|
|
12
|
+
* the workspace hook registration
|
|
9
13
|
*/
|
|
10
14
|
/**
|
|
11
15
|
* Collect all ZCode template files for `trellis update` diff tracking.
|
|
@@ -13,7 +17,8 @@
|
|
|
13
17
|
*/
|
|
14
18
|
export declare function collectZcodeTemplates(): Map<string, string>;
|
|
15
19
|
/**
|
|
16
|
-
* Configure ZCode at init time: write private skills, commands,
|
|
20
|
+
* Configure ZCode at init time: write private skills, commands, sub-agents,
|
|
21
|
+
* shared hooks, and the workspace hook config.
|
|
17
22
|
*/
|
|
18
23
|
export declare function configureZcode(cwd: string): Promise<void>;
|
|
19
24
|
//# sourceMappingURL=zcode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zcode.d.ts","sourceRoot":"","sources":["../../src/configurators/zcode.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"zcode.d.ts","sourceRoot":"","sources":["../../src/configurators/zcode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAqBH;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAsC3D;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyC/D"}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ZCode configurator.
|
|
3
3
|
*
|
|
4
|
-
* ZCode (智谱) is
|
|
5
|
-
*
|
|
4
|
+
* ZCode (智谱) is an agentCapable class-1 platform. Since ZCode 3.x it exposes
|
|
5
|
+
* a workspace hook config at `.zcode/config.json` (SessionStart,
|
|
6
|
+
* UserPromptSubmit, and PreToolUse for Agent/Task), so `hasHooks` is true.
|
|
7
|
+
* Four output paths:
|
|
6
8
|
* - `.zcode/skills/` — ZCode-private workflow and bundled skills
|
|
7
9
|
* - `.zcode/commands/trellis/` — slash commands (invoked as /trellis:<name>)
|
|
8
|
-
* - `.zcode/agents/` — sub-agent definitions with
|
|
10
|
+
* - `.zcode/agents/` — sub-agent definitions with hook-injection fallback
|
|
11
|
+
* - `.zcode/hooks/` + `.zcode/config.json` — shared Python hook scripts and
|
|
12
|
+
* the workspace hook registration
|
|
9
13
|
*/
|
|
10
14
|
import path from "node:path";
|
|
11
15
|
import { AI_TOOLS } from "../types/ai-tools.js";
|
|
12
16
|
import { ensureDir, writeFile } from "../utils/file-writer.js";
|
|
13
|
-
import { getAllAgents } from "../templates/zcode/index.js";
|
|
14
|
-
import {
|
|
17
|
+
import { getAllAgents, getHooksConfig } from "../templates/zcode/index.js";
|
|
18
|
+
import { getSharedHookScriptsForPlatform } from "../templates/shared-hooks/index.js";
|
|
19
|
+
import { collectSkillTemplates, resolveBundledSkills, resolveCommands, resolvePlaceholders, resolveSkills, writeSkills, writeAgents, writeSharedHooks, } from "./shared.js";
|
|
20
|
+
/** Shared hooks directory written for ZCode (mirrors the configure path). */
|
|
21
|
+
const ZCODE_HOOKS_DIR = ".zcode/hooks";
|
|
15
22
|
/**
|
|
16
23
|
* Collect all ZCode template files for `trellis update` diff tracking.
|
|
17
24
|
* Must stay in sync with `configureZcode`.
|
|
@@ -28,27 +35,49 @@ export function collectZcodeTemplates() {
|
|
|
28
35
|
for (const cmd of resolveCommands(ctx)) {
|
|
29
36
|
files.set(`.zcode/commands/trellis/${cmd.name}.md`, cmd.content);
|
|
30
37
|
}
|
|
31
|
-
// 3. Sub-agents → .zcode/agents/ (
|
|
32
|
-
for (const agent of
|
|
38
|
+
// 3. Sub-agents → .zcode/agents/ (hook-inject; templates carry fallback).
|
|
39
|
+
for (const agent of getAllAgents()) {
|
|
33
40
|
files.set(`.zcode/agents/${agent.name}.md`, agent.content);
|
|
34
41
|
}
|
|
42
|
+
// 4. Shared hook scripts → .zcode/hooks/.
|
|
43
|
+
// Content is platform-independent (no placeholders), written as-is so the
|
|
44
|
+
// hash matches what writeSharedHooks installs.
|
|
45
|
+
for (const hook of getSharedHookScriptsForPlatform("zcode")) {
|
|
46
|
+
files.set(`${ZCODE_HOOKS_DIR}/${hook.name}`, hook.content);
|
|
47
|
+
}
|
|
48
|
+
// 5. Workspace hook registration → .zcode/config.json
|
|
49
|
+
files.set(".zcode/config.json", resolvePlaceholders(getHooksConfig().content));
|
|
35
50
|
return files;
|
|
36
51
|
}
|
|
37
52
|
/**
|
|
38
|
-
* Configure ZCode at init time: write private skills, commands,
|
|
53
|
+
* Configure ZCode at init time: write private skills, commands, sub-agents,
|
|
54
|
+
* shared hooks, and the workspace hook config.
|
|
39
55
|
*/
|
|
40
56
|
export async function configureZcode(cwd) {
|
|
41
57
|
const config = AI_TOOLS.zcode;
|
|
42
58
|
const ctx = config.templateContext;
|
|
59
|
+
const zcodeRoot = path.join(cwd, ".zcode");
|
|
43
60
|
// 1. ZCode-private workflow and bundled skills → .zcode/skills/.
|
|
44
|
-
await writeSkills(path.join(
|
|
61
|
+
await writeSkills(path.join(zcodeRoot, "skills"), resolveSkills(ctx), resolveBundledSkills(ctx));
|
|
45
62
|
// 2. Commands → .zcode/commands/trellis/
|
|
46
|
-
const commandsDir = path.join(
|
|
63
|
+
const commandsDir = path.join(zcodeRoot, "commands", "trellis");
|
|
47
64
|
ensureDir(commandsDir);
|
|
48
65
|
for (const cmd of resolveCommands(ctx)) {
|
|
49
66
|
await writeFile(path.join(commandsDir, `${cmd.name}.md`), cmd.content);
|
|
50
67
|
}
|
|
51
|
-
// 3. Sub-agents → .zcode/agents/ (
|
|
52
|
-
await writeAgents(path.join(
|
|
68
|
+
// 3. Sub-agents → .zcode/agents/ (hook-inject; templates carry fallback).
|
|
69
|
+
await writeAgents(path.join(zcodeRoot, "agents"), getAllAgents());
|
|
70
|
+
// 4. Shared hooks → .zcode/hooks/
|
|
71
|
+
await writeSharedHooks(path.join(zcodeRoot, "hooks"), "zcode");
|
|
72
|
+
// 5. Workspace hook config → .zcode/config.json
|
|
73
|
+
await writeFile(path.join(zcodeRoot, "config.json"), resolvePlaceholders(getHooksConfig().content));
|
|
74
|
+
// ZCode loads hook config at session start and does NOT hot-reload it, so
|
|
75
|
+
// users must open a new session for these hooks to fire. Mirrors the Codex
|
|
76
|
+
// one-shot hint pattern; silent under test/quiet environments.
|
|
77
|
+
if (!process.env.VITEST && !process.env.TRELLIS_QUIET) {
|
|
78
|
+
process.stderr.write("ℹ️ ZCode loads hooks at session start (no hot-reload). " +
|
|
79
|
+
"Open a NEW ZCode session for the Trellis SessionStart / " +
|
|
80
|
+
"UserPromptSubmit / PreToolUse hooks in .zcode/config.json to take effect.\n");
|
|
81
|
+
}
|
|
53
82
|
}
|
|
54
83
|
//# sourceMappingURL=zcode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zcode.js","sourceRoot":"","sources":["../../src/configurators/zcode.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"zcode.js","sourceRoot":"","sources":["../../src/configurators/zcode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,WAAW,EACX,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,6EAA6E;AAC7E,MAAM,eAAe,GAAG,cAAc,CAAC;AAEvC;;;GAGG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC;IAC9B,MAAM,GAAG,GAAG,MAAM,CAAC,eAAe,CAAC;IACnC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAExC,iEAAiE;IACjE,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,qBAAqB,CACrD,eAAe,EACf,aAAa,CAAC,GAAG,CAAC,EAClB,oBAAoB,CAAC,GAAG,CAAC,CAC1B,EAAE,CAAC;QACF,K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,yCAAyC;IACzC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IAChE,SAAS,CAAC,WAAW,CAAC,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACzE,CAAC;IAED,0EAA0E;IAC1E,MAAM,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;IAElE,kCAAkC;IAClC,MAAM,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;IAE/D,gDAAgD;IAChD,MAAM,SAAS,CACb,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,EACnC,mBAAmB,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,CAC9C,CAAC;IAEF,0EAA0E;IAC1E,2EAA2E;IAC3E,+DAA+D;IAC/D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QACtD,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,0DAA0D;YACxD,0DAA0D;YAC1D,6EAA6E,CAChF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1613,7 +1613,7 @@
|
|
|
1613
1613
|
{
|
|
1614
1614
|
"type": "safe-file-delete",
|
|
1615
1615
|
"from": ".opencode/commands/trellis/start.md",
|
|
1616
|
-
"description": "
|
|
1616
|
+
"description": "Historical hash from a pre-v0.5.0 template variant. OpenCode has no session-start hook (hasHooks: false), so /start remains the live entry point and is still generated today — current-template ownership (see collectSafeFileDeletes) keeps this migration from deleting it.",
|
|
1617
1617
|
"allowed_hashes": [
|
|
1618
1618
|
"84e76dea69542515e234f8b551491ca6bb31fe441ef702a43ff12c3b8397d5fe"
|
|
1619
1619
|
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.6.8",
|
|
3
|
+
"description": "Two new platforms (Grok Build, Kimi Code), Codex native subagent dispatch, machine-readable platform/task state, and the Pi shared-skills migration to `.agents/skills/`.",
|
|
4
|
+
"breaking": false,
|
|
5
|
+
"recommendMigrate": false,
|
|
6
|
+
"changelog": "**Enhancements:**\n- feat(cli): add Grok Build platform support — `trellis init --grok` (#433)\n- feat(cli): add Kimi Code platform support — `trellis init --kimi` (#452)\n- feat(zcode): hooks + mem session support (#411)\n- feat(codex): enable native subagent dispatch (#445)\n- feat(cli): `trellis platforms --json` machine-readable platform state (#396)\n- feat(scripts): `task.py list/current --json` output (#395)\n- feat(channel): `--sandbox` override for Codex workers (#413)\n- feat(scripts): stamp base_branch from repo default + `--base-branch` override (#399)\n\n**Bug Fixes:**\n- fix(pi): write shared skills to `.agents/skills/` instead of a private `.pi/skills/` root (#447)\n- fix(update): rename-dir merge must not clobber canonical target with stale source bytes (#447)\n- fix(update): preserve reintroduced templates (#425)\n- fix(cli): drop preferOffline for registry template downloads (#383)\n- fix(omp): bridge session context into bash env (#424)\n- fix(configurators): quote YAML frontmatter descriptions to survive embedded colons (#437)\n- fix(hooks): adapt SessionStart acknowledgment language (#439)\n- fix(brainstorm): require explicit planning approval before task creation (#416)\n- fix(codex): pin agents.max_depth=1 in project config.toml (#445)\n- fix: 0.6.7 fleet review batch — task boundary, atomic write, activation diagnostics, OpenCode start.md (#438)",
|
|
7
|
+
"migrations": [
|
|
8
|
+
{
|
|
9
|
+
"type": "rename-dir",
|
|
10
|
+
"from": ".pi/skills",
|
|
11
|
+
"to": ".agents/skills",
|
|
12
|
+
"description": "Pi Agent: move installed skills from the private `.pi/skills/` root to the shared `.agents/skills/` root also used by Codex and Gemini CLI.",
|
|
13
|
+
"reason": "Pi already discovers `.agents/skills/` natively, so keeping a separate `.pi/skills/` copy of the same Trellis skills caused Pi to see the same skill twice (once from each root) when Codex or Gemini was also installed (#447)."
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"notes": "Pi Agent users: skills moved from .pi/skills/ to the shared .agents/skills/ root. Run `trellis update --migrate` to move existing installs (optional but recommended)."
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.6.9",
|
|
3
|
+
"description": "Snow CLI platform, sub-agent context injection caps (Python/Pi/OpenCode) with binary-file handling, no-trellis skip keyword, durable Codex sub-agent model config, channel trusted context dirs, and journal merge conflict relief.",
|
|
4
|
+
"breaking": false,
|
|
5
|
+
"recommendMigrate": false,
|
|
6
|
+
"changelog": "**Enhancements:**\n- feat(cli): add Snow CLI as class-1 Trellis platform — `trellis init --snow` (#443)\n- feat(hooks): cap sub-agent context injection with configurable limits across the Python hook, Pi extension, and OpenCode plugin — `context_injection` in config.yaml (#441, #456)\n- fix(cli): sub-agent context injection now detects binary referenced files and emits a reference-only notice instead of corrupting output (#471)\n- feat(hooks): `no-trellis` keyword in a prompt mutes per-turn workflow-state injection for that turn — `prompt_injection.skip_keyword` in config.yaml (#427)\n- feat(codex): user-set `model` / `model_reasoning_effort` in `.codex/agents/trellis-*.toml` now survive `trellis update` regeneration; templates ship commented hints (#459)\n- feat(channel): `channel.trusted_context_dirs` config plus narrow auto-trust of symlinked `.trellis/tasks` / `.trellis/workspace` for context loading (#414)\n- feat(scripts): `add_session.py` gains repeatable `--change` / `--test` / `--next-step` flags; empty sections are omitted instead of rendering placeholder text (#394)\n- feat(scripts): `task.py list` renders a dangling parent reference flat instead of hiding the task (#402)\n- feat(scripts): `task.py create --meta key=value` (repeatable) and `task.py set-meta` expose the task.json `meta` field\n\n**Bug Fixes:**\n- fix(kimi): `trellis-research` now persists findings through the writable built-in `coder` sub-agent instead of losing them (#457)\n- feat(workspace): `.gitattributes` ships `journal-*.md merge=union` so parallel-worktree session merges no longer conflict on append-only journal content; `index.md` conflicts are documented as expected and safe to resolve by picking either side (#415)",
|
|
7
|
+
"migrations": [],
|
|
8
|
+
"notes": "Pi Agent users on 0.6.8: skills already moved to .agents/skills/. Codex users: agent model config now persists across update — edit .codex/agents/trellis-*.toml directly."
|
|
9
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
name = "trellis-check"
|
|
2
2
|
description = "Workspace-write Trellis reviewer that self-fixes spec drift, lint/type-check failures, and missing tests."
|
|
3
3
|
sandbox_mode = "workspace-write"
|
|
4
|
+
# model = "gpt-5.6-terra"
|
|
5
|
+
# model_reasoning_effort = "high"
|
|
4
6
|
|
|
5
7
|
developer_instructions = """
|
|
6
8
|
You are running as the `trellis-check` sub-agent. The main session has dispatched you to review and self-fix.
|
|
@@ -14,6 +16,11 @@ CRITICAL — Recursion guard (read first):
|
|
|
14
16
|
|
|
15
17
|
You are the Trellis reviewer agent.
|
|
16
18
|
|
|
19
|
+
Trellis Context Loading Protocol:
|
|
20
|
+
- Look for the `<!-- trellis-hook-injected -->` marker in your input above.
|
|
21
|
+
- If the marker is present, the native `SubagentStart` hook has already loaded the role-specific task artifacts and spec context. Proceed directly with the check work.
|
|
22
|
+
- If the marker is absent, find `Active task: <path>` in your dispatch prompt. Read `<path>/check.jsonl`, each file listed there, `<path>/prd.md`, `<path>/design.md` if present, and `<path>/implement.md` if present before checking. If the dispatch prompt has no active-task path, ask the main session; do not guess or use another session's task.
|
|
23
|
+
|
|
17
24
|
Your job is to review code changes against specs AND fix issues directly — not just report them. You have write access; use it.
|
|
18
25
|
|
|
19
26
|
Review checklist:
|
|
@@ -45,15 +52,3 @@ Only list issues you could not self-fix (e.g. missing product decision, out-of-s
|
|
|
45
52
|
|
|
46
53
|
If no issues are found, say so explicitly after verifying lint/type-check pass.
|
|
47
54
|
"""
|
|
48
|
-
|
|
49
|
-
# Disable Codex collab tools entirely for this sub-agent. With both
|
|
50
|
-
# multi_agent and multi_agent_v2 off, `spawn_agent` / `wait_agent` /
|
|
51
|
-
# `list_agents` / `close_agent` are not registered in the sub-agent's tool
|
|
52
|
-
# list at all — the model literally cannot call them. This is the structural
|
|
53
|
-
# fix for the wait_agent self-deadlock when the parent inherits its
|
|
54
|
-
# transcript via Codex's default `fork_turns="all"` (#240 follow-up, #241).
|
|
55
|
-
[features]
|
|
56
|
-
multi_agent = false
|
|
57
|
-
|
|
58
|
-
[features.multi_agent_v2]
|
|
59
|
-
enabled = false
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
name = "trellis-implement"
|
|
2
2
|
description = "Workspace-write Trellis implementer that follows specs and keeps generated templates in sync."
|
|
3
3
|
sandbox_mode = "workspace-write"
|
|
4
|
+
# model = "gpt-5.6-terra"
|
|
5
|
+
# model_reasoning_effort = "high"
|
|
4
6
|
|
|
5
7
|
developer_instructions = """
|
|
6
8
|
You are running as the `trellis-implement` sub-agent. The main session has dispatched you to do the work.
|
|
@@ -14,6 +16,11 @@ CRITICAL — Recursion guard (read first):
|
|
|
14
16
|
|
|
15
17
|
You are the Trellis implementer agent.
|
|
16
18
|
|
|
19
|
+
Trellis Context Loading Protocol:
|
|
20
|
+
- Look for the `<!-- trellis-hook-injected -->` marker in your input above.
|
|
21
|
+
- If the marker is present, the native `SubagentStart` hook has already loaded the role-specific task artifacts and spec context. Proceed directly with the implementation work.
|
|
22
|
+
- If the marker is absent, find `Active task: <path>` in your dispatch prompt. Read `<path>/implement.jsonl`, each file listed there, `<path>/prd.md`, `<path>/design.md` if present, and `<path>/implement.md` if present before doing the work. If the dispatch prompt has no active-task path, ask the main session; do not guess or use another session's task.
|
|
23
|
+
|
|
17
24
|
Rules:
|
|
18
25
|
- Read before write. Follow `.trellis/spec/` guidance relevant to the task.
|
|
19
26
|
- Keep changes focused on the requested scope.
|
|
@@ -26,15 +33,3 @@ Before finishing, summarize:
|
|
|
26
33
|
- Tests/checks run
|
|
27
34
|
- Remaining risks or follow-ups
|
|
28
35
|
"""
|
|
29
|
-
|
|
30
|
-
# Disable Codex collab tools entirely for this sub-agent. With both
|
|
31
|
-
# multi_agent and multi_agent_v2 off, `spawn_agent` / `wait_agent` /
|
|
32
|
-
# `list_agents` / `close_agent` are not registered in the sub-agent's tool
|
|
33
|
-
# list at all — the model literally cannot call them. This is the structural
|
|
34
|
-
# fix for the wait_agent self-deadlock when the parent inherits its
|
|
35
|
-
# transcript via Codex's default `fork_turns="all"` (#240 follow-up, #241).
|
|
36
|
-
[features]
|
|
37
|
-
multi_agent = false
|
|
38
|
-
|
|
39
|
-
[features.multi_agent_v2]
|
|
40
|
-
enabled = false
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
name = "trellis-research"
|
|
2
2
|
description = "Trellis researcher for specs, code patterns, and affected files. Writes findings into {TASK_DIR}/research/ — read-only elsewhere."
|
|
3
3
|
sandbox_mode = "workspace-write"
|
|
4
|
+
# model = "gpt-5.6-terra"
|
|
5
|
+
# model_reasoning_effort = "high"
|
|
4
6
|
|
|
5
7
|
developer_instructions = """
|
|
6
8
|
You are the Trellis researcher agent.
|
|
@@ -11,11 +13,21 @@ Conversations get compacted; files don't. Every research topic MUST be
|
|
|
11
13
|
persisted to `{TASK_DIR}/research/<topic>.md`. Returning findings only
|
|
12
14
|
through the chat reply is a failure.
|
|
13
15
|
|
|
16
|
+
## Trellis Context Loading Protocol
|
|
17
|
+
|
|
18
|
+
Look for the `<!-- trellis-hook-injected -->` marker in your input above.
|
|
19
|
+
|
|
20
|
+
- If the marker is present, the native `SubagentStart` hook has supplied the
|
|
21
|
+
`Active task: <path>` header and research-only context. Use that task path.
|
|
22
|
+
- If the marker is absent, find `Active task: <path>` in your dispatch prompt.
|
|
23
|
+
If it is absent too, ask the main session for the path; do not run
|
|
24
|
+
`task.py current`, guess, or use another session's task.
|
|
25
|
+
- Do not load `implement.jsonl` or `check.jsonl`; research is role-isolated.
|
|
26
|
+
|
|
14
27
|
## Workflow
|
|
15
28
|
|
|
16
|
-
1.
|
|
17
|
-
|
|
18
|
-
where to write output; do not guess.
|
|
29
|
+
1. Use the active task path supplied by the context-loading protocol. If no
|
|
30
|
+
path is supplied, ask the user where to write output; do not guess.
|
|
19
31
|
2. Run `mkdir -p <TASK_DIR>/research` to ensure the directory exists.
|
|
20
32
|
3. Read `.trellis/workflow.md`, relevant `.trellis/spec/` files, and
|
|
21
33
|
target code before forming an opinion.
|
|
@@ -59,15 +71,3 @@ If the user asks you to edit code, decline and tell them to spawn the
|
|
|
59
71
|
...
|
|
60
72
|
```
|
|
61
73
|
"""
|
|
62
|
-
|
|
63
|
-
# Disable Codex collab tools entirely for this sub-agent. With both
|
|
64
|
-
# multi_agent and multi_agent_v2 off, `spawn_agent` / `wait_agent` /
|
|
65
|
-
# `list_agents` / `close_agent` are not registered in the sub-agent's tool
|
|
66
|
-
# list at all — the model literally cannot call them. This is the structural
|
|
67
|
-
# fix for the wait_agent self-deadlock when the parent inherits its
|
|
68
|
-
# transcript via Codex's default `fork_turns="all"` (#240 follow-up, #241).
|
|
69
|
-
[features]
|
|
70
|
-
multi_agent = false
|
|
71
|
-
|
|
72
|
-
[features.multi_agent_v2]
|
|
73
|
-
enabled = false
|
|
@@ -26,3 +26,14 @@ project_doc_fallback_filenames = ["AGENTS.md"]
|
|
|
26
26
|
# aborts the entire config load and blocks Codex from starting. Codex's own
|
|
27
27
|
# default for multi_agent_v2 is used instead; tune it in your user-level
|
|
28
28
|
# config if needed.
|
|
29
|
+
|
|
30
|
+
# Pin the subagent recursion depth explicitly instead of relying on Codex's
|
|
31
|
+
# default. #445 removed the per-agent `[features] multi_agent = false` guard
|
|
32
|
+
# (the #240/#241 wait_agent-deadlock structural fix) because native subagent
|
|
33
|
+
# dispatch already caps recursion via `agents.max_depth` — but that key is
|
|
34
|
+
# global/user-level, not settable inside an individual agent's .toml. Pinning
|
|
35
|
+
# it here means an upstream default change, or a user's own global override,
|
|
36
|
+
# can't silently reopen the recursion the #240/#241 fix closed. Project config
|
|
37
|
+
# (this file) takes precedence over user-level `~/.codex/config.toml`.
|
|
38
|
+
[agents]
|
|
39
|
+
max_depth = 1
|
|
@@ -92,11 +92,17 @@ def _normalize_windows_shell_path(path_str: str) -> str:
|
|
|
92
92
|
warnings.filterwarnings("ignore")
|
|
93
93
|
|
|
94
94
|
FIRST_REPLY_NOTICE = """<first-reply-notice>
|
|
95
|
-
On the first visible assistant reply in this session,
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
On the first visible assistant reply in this session, briefly acknowledge that Trellis SessionStart context loaded.
|
|
96
|
+
Choose the acknowledgment language in this order:
|
|
97
|
+
1. Use the language of the user's current request (the user message that triggered this reply).
|
|
98
|
+
2. If that request has no clear natural language, use an explicitly established project communication language.
|
|
99
|
+
3. If neither provides a language, output the language-neutral fallback exactly: `Trellis SessionStart ✓`.
|
|
100
|
+
Continue directly with the user's request after the acknowledgment.
|
|
101
|
+
The acknowledgment must not alter the language used for the remainder of the response.
|
|
102
|
+
This notice is one-shot: do not repeat it after the first visible assistant reply in this session.
|
|
98
103
|
</first-reply-notice>"""
|
|
99
104
|
|
|
105
|
+
|
|
100
106
|
def should_skip_injection() -> bool:
|
|
101
107
|
if os.environ.get("TRELLIS_HOOKS") == "0":
|
|
102
108
|
return True
|
|
@@ -10,6 +10,18 @@
|
|
|
10
10
|
}
|
|
11
11
|
]
|
|
12
12
|
}
|
|
13
|
+
],
|
|
14
|
+
"SubagentStart": [
|
|
15
|
+
{
|
|
16
|
+
"matcher": "^(?:trellis-implement|trellis-check|trellis-research)$",
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "{{PYTHON_CMD}} -X utf8 .codex/hooks/inject-subagent-context.py",
|
|
21
|
+
"timeout": 15
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
13
25
|
]
|
|
14
26
|
}
|
|
15
27
|
}
|