@blxzer/cursor-trellis 0.4.1 → 0.4.3
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/CHANGELOG.md +49 -0
- package/README.md +25 -14
- package/README.zh-CN.md +14 -10
- package/bin/smart-search.js +10 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +36 -15
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +42 -153
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/migrate.d.ts +10 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +38 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/update.d.ts +5 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +144 -41
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/cursor.d.ts +2 -1
- package/dist/configurators/cursor.d.ts.map +1 -1
- package/dist/configurators/cursor.js +4 -2
- package/dist/configurators/cursor.js.map +1 -1
- package/dist/configurators/index.js +4 -4
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/shared.d.ts +8 -0
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +27 -1
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/workflow.d.ts +0 -9
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +12 -45
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/constants/paths.d.ts +13 -0
- package/dist/constants/paths.d.ts.map +1 -1
- package/dist/constants/paths.js +17 -0
- package/dist/constants/paths.js.map +1 -1
- package/dist/migrations/manifests/0.3.0.json +1 -1
- package/dist/templates/common/bundled-skills/cstl-check/SKILL.md +1 -1
- package/dist/templates/common/bundled-skills/cstl-meta/references/platform-files/hooks-and-settings.md +2 -2
- package/dist/templates/common/bundled-skills/cstl-meta/references/platform-files/overview.md +1 -1
- package/dist/templates/common/bundled-skills/cstl-meta/references/platform-files/skills-and-commands.md +2 -4
- package/dist/templates/common/bundled-skills/cstl-skill-creator/SKILL.md +10 -7
- package/dist/templates/common/bundled-skills/cstl-skill-creator/references/authoring-rules.md +93 -19
- package/dist/templates/common/bundled-skills/cstl-skill-creator/references/general-authoring.md +189 -0
- package/dist/templates/common/bundled-skills/cstl-skill-creator/references/review-checklist.md +10 -5
- package/dist/templates/common/commands/continue.md +6 -5
- package/dist/templates/common/index.d.ts +20 -0
- package/dist/templates/common/index.d.ts.map +1 -1
- package/dist/templates/common/index.js +21 -2
- package/dist/templates/common/index.js.map +1 -1
- package/dist/templates/common/optional-skills/chrome-cdp/SKILL.md +179 -0
- package/dist/templates/common/optional-skills/chrome-cdp/examples/fetch-hook-api-capture.md +149 -0
- package/dist/templates/common/optional-skills/chrome-cdp/scripts/cdp.mjs +903 -0
- package/dist/templates/common/skills/brainstorm.md +2 -2
- package/dist/templates/cursor/agents/cstl-check.md +2 -2
- package/dist/templates/cursor/agents/cstl-implement.md +1 -1
- package/dist/templates/cursor/agents/cstl-research.md +2 -2
- package/dist/templates/cursor/fixtures/expected-rules.d.ts +1 -1
- package/dist/templates/cursor/fixtures/expected-rules.d.ts.map +1 -1
- package/dist/templates/cursor/fixtures/expected-rules.js +7 -24
- package/dist/templates/cursor/fixtures/expected-rules.js.map +1 -1
- package/dist/templates/cursor/hooks.json +4 -0
- package/dist/templates/cursor/index.d.ts +1 -1
- package/dist/templates/cursor/index.js +1 -1
- package/dist/templates/cursor/rules/cstl-bootstrap.mdc +17 -0
- package/dist/templates/markdown/agents.md +36 -3
- package/dist/templates/markdown/{spec/guides → framework}/cursor-native-modes-guide.md.txt +13 -10
- package/dist/templates/markdown/{spec/guides → framework}/cursor-subagent-policy.md.txt +63 -127
- package/dist/templates/markdown/framework/dogfood-only-surfaces.md.txt +29 -0
- package/dist/templates/markdown/{spec/guides → framework}/execution-strategy.md.txt +2 -0
- package/dist/templates/markdown/framework/index.md.txt +31 -0
- package/dist/templates/markdown/framework/internal-skills-cursor-reachability.md.txt +45 -0
- package/dist/templates/markdown/framework/middleware-protocol.md.txt +83 -0
- package/dist/templates/markdown/framework/parallel-first-execution.md.txt +78 -0
- package/dist/templates/markdown/framework/prd-grill-frontier.md.txt +83 -0
- package/dist/templates/markdown/framework/release-boundary.md.txt +30 -0
- package/dist/templates/markdown/{spec/guides → framework}/retrieval-daily-guide.md.txt +1 -1
- package/dist/templates/markdown/framework/upgrade.md.txt +15 -0
- package/dist/templates/markdown/{spec/guides → framework}/verification-strength-guide.md.txt +2 -2
- package/dist/templates/markdown/index.d.ts +26 -10
- package/dist/templates/markdown/index.d.ts.map +1 -1
- package/dist/templates/markdown/index.js +87 -11
- package/dist/templates/markdown/index.js.map +1 -1
- package/dist/templates/markdown/prompts/run-semantic-slice-12.md.txt +1 -1
- package/dist/templates/markdown/spec/guides/index.md.txt +5 -19
- package/dist/templates/markdown/spec/guides/prototype-guide.md.txt +10 -10
- package/dist/templates/markdown/spec/guides/test-discipline-guide.md.txt +1 -1
- package/dist/templates/shared-hooks/event-bridge.py +60 -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/session-start.py +19 -2
- package/dist/templates/trellis/CONTEXT.md +63 -3
- package/dist/templates/trellis/config.yaml +1 -1
- package/dist/templates/trellis/gitignore.txt +39 -39
- package/dist/templates/trellis/index.d.ts +12 -0
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +73 -15
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/pool/README.md +12 -3
- package/dist/templates/trellis/pool/plan.md +24 -5
- package/dist/templates/trellis/scripts/common/adapter_middleware.py +158 -0
- package/dist/templates/trellis/scripts/common/artifact_locale.py +12 -3
- package/dist/templates/trellis/scripts/common/cursor_retrieval_env.py +5 -2
- package/dist/templates/trellis/scripts/common/full_quality.py +237 -0
- package/dist/templates/trellis/scripts/common/git.py +6 -0
- package/dist/templates/trellis/scripts/common/git_context.py +17 -5
- package/dist/templates/trellis/scripts/common/kernel_command.py +367 -0
- package/dist/templates/trellis/scripts/common/lite_context.py +280 -0
- package/dist/templates/trellis/scripts/common/ondemand_topology.py +225 -0
- package/dist/templates/trellis/scripts/common/parent_orchestration.py +1 -1
- package/dist/templates/trellis/scripts/common/pool_store.py +16 -4
- package/dist/templates/trellis/scripts/common/retrieval_agent_instructions.py +2 -2
- package/dist/templates/trellis/scripts/common/session_context.py +28 -2
- package/dist/templates/trellis/scripts/common/task_gates.py +73 -12
- package/dist/templates/trellis/scripts/common/task_map.py +42 -9
- package/dist/templates/trellis/scripts/common/task_store.py +293 -61
- package/dist/templates/trellis/scripts/common/test_adapter_middleware.py +56 -0
- package/dist/templates/trellis/scripts/common/test_depends_mode_block.py +9 -0
- package/dist/templates/trellis/scripts/common/test_full_quality.py +197 -0
- package/dist/templates/trellis/scripts/common/test_kernel_command.py +326 -0
- package/dist/templates/trellis/scripts/common/test_lite_path.py +190 -0
- package/dist/templates/trellis/scripts/common/test_observable_defaults.py +10 -4
- package/dist/templates/trellis/scripts/common/test_ondemand_topology.py +122 -0
- package/dist/templates/trellis/scripts/common/test_pool_store.py +17 -0
- package/dist/templates/trellis/scripts/common/test_task_store_kernel_patch.py +163 -0
- package/dist/templates/trellis/scripts/common/workflow_phase.py +3 -0
- package/dist/templates/trellis/scripts/cursor_retrieval_probe_prompt.md +4 -5
- package/dist/templates/trellis/scripts/get_context.py +1 -0
- package/dist/templates/trellis/scripts/pool.py +5 -0
- package/dist/templates/trellis/scripts/task.py +83 -7
- package/dist/templates/trellis/workflow.md +109 -23
- package/dist/utils/cursor-retrieval-env.d.ts +2 -1
- package/dist/utils/cursor-retrieval-env.d.ts.map +1 -1
- package/dist/utils/cursor-retrieval-env.js +3 -2
- package/dist/utils/cursor-retrieval-env.js.map +1 -1
- package/dist/utils/cursor2plus-residue-cleanup.d.ts +38 -0
- package/dist/utils/cursor2plus-residue-cleanup.d.ts.map +1 -0
- package/dist/utils/cursor2plus-residue-cleanup.js +145 -0
- package/dist/utils/cursor2plus-residue-cleanup.js.map +1 -0
- package/dist/utils/manifest-prune.d.ts.map +1 -1
- package/dist/utils/manifest-prune.js +7 -2
- package/dist/utils/manifest-prune.js.map +1 -1
- package/dist/utils/p36-upgrade.d.ts +62 -0
- package/dist/utils/p36-upgrade.d.ts.map +1 -0
- package/dist/utils/p36-upgrade.js +160 -0
- package/dist/utils/p36-upgrade.js.map +1 -0
- package/dist/utils/project-capabilities.d.ts +1 -12
- package/dist/utils/project-capabilities.d.ts.map +1 -1
- package/dist/utils/project-capabilities.js +3 -100
- package/dist/utils/project-capabilities.js.map +1 -1
- package/dist/utils/readiness.d.ts +10 -0
- package/dist/utils/readiness.d.ts.map +1 -1
- package/dist/utils/readiness.js +58 -26
- package/dist/utils/readiness.js.map +1 -1
- package/dist/utils/retrieval-agent-instructions.js +1 -1
- package/dist/utils/retrieval-agent-instructions.js.map +1 -1
- package/dist/utils/retrieval-execution-telemetry.js +1 -1
- package/dist/utils/retrieval-execution-telemetry.js.map +1 -1
- package/dist/utils/template-hash.d.ts.map +1 -1
- package/dist/utils/template-hash.js +11 -1
- package/dist/utils/template-hash.js.map +1 -1
- package/dist/utils/uninstall-scrubbers.d.ts.map +1 -1
- package/dist/utils/uninstall-scrubbers.js +52 -14
- package/dist/utils/uninstall-scrubbers.js.map +1 -1
- package/dist/utils/update-rollout-report.d.ts +14 -0
- package/dist/utils/update-rollout-report.d.ts.map +1 -1
- package/dist/utils/update-rollout-report.js +1 -0
- package/dist/utils/update-rollout-report.js.map +1 -1
- package/dist/utils/workflow-ownership.d.ts +1 -1
- package/dist/utils/workflow-ownership.js +4 -4
- package/dist/utils/workflow-ownership.js.map +1 -1
- package/package.json +5 -4
- package/scripts/postinstall.js +6 -7
- package/dist/commands/campaign/canvas-render.d.ts +0 -68
- package/dist/commands/campaign/canvas-render.d.ts.map +0 -1
- package/dist/commands/campaign/canvas-render.js +0 -414
- package/dist/commands/campaign/canvas-render.js.map +0 -1
- package/dist/commands/campaign/compose.d.ts +0 -15
- package/dist/commands/campaign/compose.d.ts.map +0 -1
- package/dist/commands/campaign/compose.js +0 -110
- package/dist/commands/campaign/compose.js.map +0 -1
- package/dist/commands/campaign/index.d.ts +0 -13
- package/dist/commands/campaign/index.d.ts.map +0 -1
- package/dist/commands/campaign/index.js +0 -134
- package/dist/commands/campaign/index.js.map +0 -1
- package/dist/commands/campaign/kind-map.d.ts +0 -6
- package/dist/commands/campaign/kind-map.d.ts.map +0 -1
- package/dist/commands/campaign/kind-map.js +0 -21
- package/dist/commands/campaign/kind-map.js.map +0 -1
- package/dist/commands/campaign/mcp-server.d.ts +0 -6
- package/dist/commands/campaign/mcp-server.d.ts.map +0 -1
- package/dist/commands/campaign/mcp-server.js +0 -167
- package/dist/commands/campaign/mcp-server.js.map +0 -1
- package/dist/commands/campaign/render.d.ts +0 -5
- package/dist/commands/campaign/render.d.ts.map +0 -1
- package/dist/commands/campaign/render.js +0 -103
- package/dist/commands/campaign/render.js.map +0 -1
- package/dist/commands/campaign/trellis-load.d.ts +0 -13
- package/dist/commands/campaign/trellis-load.d.ts.map +0 -1
- package/dist/commands/campaign/trellis-load.js +0 -122
- package/dist/commands/campaign/trellis-load.js.map +0 -1
- package/dist/commands/campaign/types.d.ts +0 -61
- package/dist/commands/campaign/types.d.ts.map +0 -1
- package/dist/commands/campaign/types.js +0 -3
- package/dist/commands/campaign/types.js.map +0 -1
- package/dist/commands/goal/index.d.ts +0 -3
- package/dist/commands/goal/index.d.ts.map +0 -1
- package/dist/commands/goal/index.js +0 -159
- package/dist/commands/goal/index.js.map +0 -1
- package/dist/commands/goal/review.d.ts +0 -6
- package/dist/commands/goal/review.d.ts.map +0 -1
- package/dist/commands/goal/review.js +0 -28
- package/dist/commands/goal/review.js.map +0 -1
- package/dist/commands/rpc/client.d.ts +0 -51
- package/dist/commands/rpc/client.d.ts.map +0 -1
- package/dist/commands/rpc/client.js +0 -147
- package/dist/commands/rpc/client.js.map +0 -1
- package/dist/commands/rpc/index.d.ts +0 -10
- package/dist/commands/rpc/index.d.ts.map +0 -1
- package/dist/commands/rpc/index.js +0 -157
- package/dist/commands/rpc/index.js.map +0 -1
- package/dist/commands/rpc/serve.d.ts +0 -23
- package/dist/commands/rpc/serve.d.ts.map +0 -1
- package/dist/commands/rpc/serve.js +0 -60
- package/dist/commands/rpc/serve.js.map +0 -1
- package/dist/commands/rpc/smoke.d.ts +0 -16
- package/dist/commands/rpc/smoke.d.ts.map +0 -1
- package/dist/commands/rpc/smoke.js +0 -92
- package/dist/commands/rpc/smoke.js.map +0 -1
- package/dist/commands/sdk/index.d.ts +0 -9
- package/dist/commands/sdk/index.d.ts.map +0 -1
- package/dist/commands/sdk/index.js +0 -58
- package/dist/commands/sdk/index.js.map +0 -1
- package/dist/commands/sdk/run.d.ts +0 -42
- package/dist/commands/sdk/run.d.ts.map +0 -1
- package/dist/commands/sdk/run.js +0 -220
- package/dist/commands/sdk/run.js.map +0 -1
- package/dist/commands/sdk/status.d.ts +0 -14
- package/dist/commands/sdk/status.d.ts.map +0 -1
- package/dist/commands/sdk/status.js +0 -69
- package/dist/commands/sdk/status.js.map +0 -1
- package/dist/configurators/cursor2plus-local.d.ts +0 -6
- package/dist/configurators/cursor2plus-local.d.ts.map +0 -1
- package/dist/configurators/cursor2plus-local.js +0 -21
- package/dist/configurators/cursor2plus-local.js.map +0 -1
- package/dist/goal/action-packet.d.ts +0 -89
- package/dist/goal/action-packet.d.ts.map +0 -1
- package/dist/goal/action-packet.js +0 -113
- package/dist/goal/action-packet.js.map +0 -1
- package/dist/goal/audit.d.ts +0 -14
- package/dist/goal/audit.d.ts.map +0 -1
- package/dist/goal/audit.js +0 -12
- package/dist/goal/audit.js.map +0 -1
- package/dist/goal/constants.d.ts +0 -26
- package/dist/goal/constants.d.ts.map +0 -1
- package/dist/goal/constants.js +0 -24
- package/dist/goal/constants.js.map +0 -1
- package/dist/goal/paths.d.ts +0 -8
- package/dist/goal/paths.d.ts.map +0 -1
- package/dist/goal/paths.js +0 -36
- package/dist/goal/paths.js.map +0 -1
- package/dist/goal/preflight.d.ts +0 -21
- package/dist/goal/preflight.d.ts.map +0 -1
- package/dist/goal/preflight.js +0 -97
- package/dist/goal/preflight.js.map +0 -1
- package/dist/goal/review-seam.d.ts +0 -44
- package/dist/goal/review-seam.d.ts.map +0 -1
- package/dist/goal/review-seam.js +0 -153
- package/dist/goal/review-seam.js.map +0 -1
- package/dist/goal/reviewer-rules.d.ts +0 -13
- package/dist/goal/reviewer-rules.d.ts.map +0 -1
- package/dist/goal/reviewer-rules.js +0 -153
- package/dist/goal/reviewer-rules.js.map +0 -1
- package/dist/goal/reviewer.d.ts +0 -9
- package/dist/goal/reviewer.d.ts.map +0 -1
- package/dist/goal/reviewer.js +0 -54
- package/dist/goal/reviewer.js.map +0 -1
- package/dist/goal/runtime.d.ts +0 -32
- package/dist/goal/runtime.d.ts.map +0 -1
- package/dist/goal/runtime.js +0 -242
- package/dist/goal/runtime.js.map +0 -1
- package/dist/goal/sdk-client.d.ts +0 -10
- package/dist/goal/sdk-client.d.ts.map +0 -1
- package/dist/goal/sdk-client.js +0 -34
- package/dist/goal/sdk-client.js.map +0 -1
- package/dist/goal/state.d.ts +0 -40
- package/dist/goal/state.d.ts.map +0 -1
- package/dist/goal/state.js +0 -37
- package/dist/goal/state.js.map +0 -1
- package/dist/goal/task-triggers.d.ts +0 -15
- package/dist/goal/task-triggers.d.ts.map +0 -1
- package/dist/goal/task-triggers.js +0 -23
- package/dist/goal/task-triggers.js.map +0 -1
- package/dist/goal/walls.d.ts +0 -12
- package/dist/goal/walls.d.ts.map +0 -1
- package/dist/goal/walls.js +0 -65
- package/dist/goal/walls.js.map +0 -1
- package/dist/goal/worker-prompt.d.ts +0 -13
- package/dist/goal/worker-prompt.d.ts.map +0 -1
- package/dist/goal/worker-prompt.js +0 -41
- package/dist/goal/worker-prompt.js.map +0 -1
- package/dist/goal/worker.d.ts +0 -42
- package/dist/goal/worker.d.ts.map +0 -1
- package/dist/goal/worker.js +0 -180
- package/dist/goal/worker.js.map +0 -1
- package/dist/templates/common/bundled-skills/cstl-cursor2plus-setup/SKILL.md +0 -63
- package/dist/templates/cursor/commands/cursor2plus-setup.md +0 -82
- package/dist/templates/cursor/rules/cstl-cursor-modes.mdc +0 -32
- package/dist/templates/cursor/rules/cstl-session-rename.mdc +0 -31
- package/dist/templates/cursor/rules/cstl-subagent-dispatch.mdc +0 -34
- package/dist/templates/cursor/rules/cstl-triage.mdc +0 -36
- package/dist/templates/cursor/rules/retrieval-routing.mdc +0 -78
- package/dist/templates/markdown/spec/guides/cursor-trellis-release-coexistence-guide.md.txt +0 -166
- package/dist/templates/markdown/spec/guides/goal-release-regression-runbook.md.txt +0 -132
- package/dist/templates/trellis/local/README.md +0 -85
- package/dist/templates/trellis/local/config.local.json.example +0 -6
- package/dist/templates/trellis/local/index.d.ts +0 -8
- package/dist/templates/trellis/local/index.d.ts.map +0 -1
- package/dist/templates/trellis/local/index.js +0 -15
- package/dist/templates/trellis/local/index.js.map +0 -1
- package/dist/templates/trellis/local/patch_wpelc8.py +0 -421
- package/dist/templates/trellis/local/smoke.py +0 -94
- package/dist/templates/trellis/local/subagent-models.json.example +0 -4
- package/dist/templates/trellis/local/trellis-task-models.json.example +0 -10
- package/dist/templates/trellis/local/trellis-task-models.json5.example +0 -45
- package/dist/templates/trellis/local/trellis_task_models_config.py +0 -200
- package/dist/utils/cursor-sdk-gate.d.ts +0 -10
- package/dist/utils/cursor-sdk-gate.d.ts.map +0 -1
- package/dist/utils/cursor-sdk-gate.js +0 -32
- package/dist/utils/cursor-sdk-gate.js.map +0 -1
- /package/dist/templates/markdown/{spec/guides → framework}/artifact-locale-guide.md.txt +0 -0
- /package/dist/templates/markdown/{spec/guides → framework}/cursor-context-injection-guide.md.txt +0 -0
- /package/dist/templates/markdown/{spec/guides → framework}/cursor-semantic-compliance.md.txt +0 -0
- /package/dist/templates/markdown/{spec/guides → framework}/injection-budget-guide.md.txt +0 -0
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { GoalState } from "./state.js";
|
|
2
|
-
export interface GoalWorkerPromptContext {
|
|
3
|
-
cwd: string;
|
|
4
|
-
state: GoalState;
|
|
5
|
-
contractPath: string;
|
|
6
|
-
agentDefinitionPath: string;
|
|
7
|
-
turnIndex: number;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Build the authoritative prompt for cstl-goal-worker (SDK / channel runner).
|
|
11
|
-
*/
|
|
12
|
-
export declare function buildGoalWorkerPrompt(ctx: GoalWorkerPromptContext): string;
|
|
13
|
-
//# sourceMappingURL=worker-prompt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker-prompt.d.ts","sourceRoot":"","sources":["../../src/goal/worker-prompt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,uBAAuB,GAAG,MAAM,CAqC1E"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
/**
|
|
3
|
-
* Build the authoritative prompt for cstl-goal-worker (SDK / channel runner).
|
|
4
|
-
*/
|
|
5
|
-
export function buildGoalWorkerPrompt(ctx) {
|
|
6
|
-
const absoluteContract = path.resolve(ctx.contractPath);
|
|
7
|
-
const absoluteAgent = path.resolve(ctx.agentDefinitionPath);
|
|
8
|
-
const taskDir = ctx.state.task_dir ? path.resolve(ctx.state.task_dir) : "(none)";
|
|
9
|
-
const doneWhen = ctx.state.contract?.doneWhen.map((d, i) => `${i + 1}. ${d}`).join("\n") ??
|
|
10
|
-
"(contract not loaded)";
|
|
11
|
-
const evidenceHow = ctx.state.contract?.evidenceHow ?? "(unspecified)";
|
|
12
|
-
return [
|
|
13
|
-
"## Goal binding (authoritative)",
|
|
14
|
-
`- goal_id: \`${ctx.state.goal_id}\``,
|
|
15
|
-
`- mode: \`${ctx.state.mode}\``,
|
|
16
|
-
`- contract.md (absolute): \`${absoluteContract}\``,
|
|
17
|
-
`- task_dir (absolute): \`${taskDir}\``,
|
|
18
|
-
`- worker agent definition: \`${absoluteAgent}\``,
|
|
19
|
-
`- turn: ${ctx.turnIndex}`,
|
|
20
|
-
`- worker_turns: ${ctx.state.worker_turns} / ${ctx.state.walls.workerTurnLimit}`,
|
|
21
|
-
"",
|
|
22
|
-
"## done_when",
|
|
23
|
-
doneWhen,
|
|
24
|
-
"",
|
|
25
|
-
"## evidence_how",
|
|
26
|
-
evidenceHow,
|
|
27
|
-
"",
|
|
28
|
-
"## Turn instructions",
|
|
29
|
-
"You are the cstl-goal-worker subagent (G1). Advance one concrete step toward done_when.",
|
|
30
|
-
"If you need human-reviewed action (push/merge/delete/global-config class): output a single JSON code block",
|
|
31
|
-
"matching GoalActionPacket v0 (schema_version=1, goal_id, proposed_action, action_kind, axes,",
|
|
32
|
-
"hard_deny_candidates, done_when_ref, diff_or_cmd_digest). Do NOT include secrets.",
|
|
33
|
-
"Otherwise reply with a short status: progress vs done_when, next action, blockers.",
|
|
34
|
-
"",
|
|
35
|
-
"## Forbidden",
|
|
36
|
-
"- Mid-flight human approval requests (preflight already passed).",
|
|
37
|
-
"- Force-push, commit to main/release, bypass hard deny H-1…H-6.",
|
|
38
|
-
"- Raw secrets in output.",
|
|
39
|
-
].join("\n");
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=worker-prompt.js.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E;QACF,iBAAiB;QACjB,WAAW;QACX,EAAE;QACF,sBAAsB;QACtB,yFAAyF;QACzF,4GAA4G;QAC5G,8FAA8F;QAC9F,mFAAmF;QACnF,oFAAoF;QACpF,EAAE;QACF,cAAc;QACd,kEAAkE;QAClE,iEAAiE;QACjE,0BAA0B;KAC3B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/dist/goal/worker.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { GoalActionPacket } from "./action-packet.js";
|
|
2
|
-
import type { GoalState, GoalWorkerKind } from "./state.js";
|
|
3
|
-
export type { GoalWorkerKind } from "./state.js";
|
|
4
|
-
export interface WorkerTurnContext {
|
|
5
|
-
cwd: string;
|
|
6
|
-
state: GoalState;
|
|
7
|
-
contractPath: string;
|
|
8
|
-
agentDefinitionPath: string;
|
|
9
|
-
turnIndex: number;
|
|
10
|
-
timeoutMs: number;
|
|
11
|
-
}
|
|
12
|
-
export type WorkerTurnKind = "status" | "action" | "error";
|
|
13
|
-
export interface WorkerTurnResult {
|
|
14
|
-
kind: WorkerTurnKind;
|
|
15
|
-
summary: string;
|
|
16
|
-
packet?: GoalActionPacket;
|
|
17
|
-
error?: string;
|
|
18
|
-
evidencePath: string;
|
|
19
|
-
}
|
|
20
|
-
export interface GoalWorkerAdapter {
|
|
21
|
-
readonly id: GoalWorkerKind;
|
|
22
|
-
runTurn(ctx: WorkerTurnContext): Promise<WorkerTurnResult>;
|
|
23
|
-
}
|
|
24
|
-
export declare function goalWorkerTurnPath(cwd: string, goalId: string, turnIndex: number): string;
|
|
25
|
-
export declare function extractJsonBlocks(text: string): unknown[];
|
|
26
|
-
export declare function parseWorkerPacketFromText(text: string, goalId: string): GoalActionPacket | null;
|
|
27
|
-
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, label: string): Promise<T>;
|
|
28
|
-
export declare class MockWorkerAdapter implements GoalWorkerAdapter {
|
|
29
|
-
readonly id: "mock";
|
|
30
|
-
runTurn(ctx: WorkerTurnContext): Promise<WorkerTurnResult>;
|
|
31
|
-
}
|
|
32
|
-
export declare class SdkWorkerAdapter implements GoalWorkerAdapter {
|
|
33
|
-
readonly id: "sdk";
|
|
34
|
-
runTurn(ctx: WorkerTurnContext): Promise<WorkerTurnResult>;
|
|
35
|
-
}
|
|
36
|
-
export declare function resolveWorkerAdapter(opts: {
|
|
37
|
-
mockWorker?: boolean;
|
|
38
|
-
worker?: GoalWorkerKind;
|
|
39
|
-
}): GoalWorkerAdapter;
|
|
40
|
-
export declare function defaultAgentDefinitionPath(cwd: string): string;
|
|
41
|
-
export declare function buildWorkerTurnContext(cwd: string, state: GoalState, turnIndex: number): WorkerTurnContext;
|
|
42
|
-
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/goal/worker.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAM5D,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,M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,iBAAiB,CASnB"}
|
package/dist/goal/worker.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { safeParseGoalActionPacket } from "./action-packet.js";
|
|
4
|
-
import { goalContractPath, goalRunDir } from "./paths.js";
|
|
5
|
-
import { promptCursorAgent } from "./sdk-client.js";
|
|
6
|
-
import { buildGoalWorkerPrompt } from "./worker-prompt.js";
|
|
7
|
-
import { packAction } from "./review-seam.js";
|
|
8
|
-
import { hasCursorApiKey } from "../utils/cursor-sdk-gate.js";
|
|
9
|
-
import { cursorApiKeySetupGuide } from "../utils/cursor-sdk-gate.js";
|
|
10
|
-
export function goalWorkerTurnPath(cwd, goalId, turnIndex) {
|
|
11
|
-
return path.join(goalRunDir(cwd, goalId), "worker-turns", `${turnIndex}.md`);
|
|
12
|
-
}
|
|
13
|
-
export function extractJsonBlocks(text) {
|
|
14
|
-
const blocks = [];
|
|
15
|
-
const re = /```(?:json)?\s*([\s\S]*?)```/gi;
|
|
16
|
-
let match;
|
|
17
|
-
while ((match = re.exec(text)) !== null) {
|
|
18
|
-
const raw = match[1]?.trim();
|
|
19
|
-
if (!raw)
|
|
20
|
-
continue;
|
|
21
|
-
try {
|
|
22
|
-
blocks.push(JSON.parse(raw));
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
// skip invalid JSON fences
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return blocks;
|
|
29
|
-
}
|
|
30
|
-
export function parseWorkerPacketFromText(text, goalId) {
|
|
31
|
-
for (const block of extractJsonBlocks(text)) {
|
|
32
|
-
const parsed = safeParseGoalActionPacket(block);
|
|
33
|
-
if (parsed.valid && parsed.packet.goal_id === goalId) {
|
|
34
|
-
return parsed.packet;
|
|
35
|
-
}
|
|
36
|
-
if (parsed.valid && !parsed.packet.goal_id) {
|
|
37
|
-
return parsed.packet;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
function writeWorkerEvidence(evidencePath, body) {
|
|
43
|
-
fs.mkdirSync(path.dirname(evidencePath), { recursive: true });
|
|
44
|
-
const content = [
|
|
45
|
-
`# Goal worker turn ${body.turnIndex}`,
|
|
46
|
-
"",
|
|
47
|
-
`adapter: \`${body.adapter}\``,
|
|
48
|
-
`kind: \`${body.kind}\``,
|
|
49
|
-
`status: \`${body.status}\``,
|
|
50
|
-
`prompt_chars: ${body.promptChars}`,
|
|
51
|
-
"",
|
|
52
|
-
"## Result",
|
|
53
|
-
"",
|
|
54
|
-
"```text",
|
|
55
|
-
body.result.slice(0, 8000),
|
|
56
|
-
"```",
|
|
57
|
-
"",
|
|
58
|
-
body.error ? `## Error\n\n${body.error}\n` : "",
|
|
59
|
-
].join("\n");
|
|
60
|
-
fs.writeFileSync(evidencePath, content, "utf-8");
|
|
61
|
-
}
|
|
62
|
-
export function withTimeout(promise, timeoutMs, label) {
|
|
63
|
-
return new Promise((resolve, reject) => {
|
|
64
|
-
const timer = setTimeout(() => {
|
|
65
|
-
reject(new Error(`${label} timed out after ${timeoutMs}ms`));
|
|
66
|
-
}, timeoutMs);
|
|
67
|
-
promise
|
|
68
|
-
.then((value) => {
|
|
69
|
-
clearTimeout(timer);
|
|
70
|
-
resolve(value);
|
|
71
|
-
})
|
|
72
|
-
.catch((error) => {
|
|
73
|
-
clearTimeout(timer);
|
|
74
|
-
reject(error);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
export class MockWorkerAdapter {
|
|
79
|
-
id = "mock";
|
|
80
|
-
async runTurn(ctx) {
|
|
81
|
-
const evidencePath = goalWorkerTurnPath(ctx.cwd, ctx.state.goal_id, ctx.turnIndex);
|
|
82
|
-
const packet = packAction(ctx.state, {
|
|
83
|
-
summary: "Run focused validation for goal step (mock worker)",
|
|
84
|
-
kind: "shell",
|
|
85
|
-
digest: "pnpm test goal/",
|
|
86
|
-
axes: { A: false, B: false, C: true },
|
|
87
|
-
hardDenyCandidates: [],
|
|
88
|
-
});
|
|
89
|
-
writeWorkerEvidence(evidencePath, {
|
|
90
|
-
adapter: this.id,
|
|
91
|
-
turnIndex: ctx.turnIndex,
|
|
92
|
-
promptChars: 0,
|
|
93
|
-
status: "completed",
|
|
94
|
-
result: `[mock] worker turn ${ctx.turnIndex}`,
|
|
95
|
-
kind: "action",
|
|
96
|
-
});
|
|
97
|
-
return {
|
|
98
|
-
kind: "action",
|
|
99
|
-
summary: `mock worker step ${ctx.turnIndex}`,
|
|
100
|
-
packet,
|
|
101
|
-
evidencePath,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
export class SdkWorkerAdapter {
|
|
106
|
-
id = "sdk";
|
|
107
|
-
async runTurn(ctx) {
|
|
108
|
-
const evidencePath = goalWorkerTurnPath(ctx.cwd, ctx.state.goal_id, ctx.turnIndex);
|
|
109
|
-
const prompt = buildGoalWorkerPrompt(ctx);
|
|
110
|
-
try {
|
|
111
|
-
const outcome = await withTimeout(promptCursorAgent(prompt, ctx.cwd), ctx.timeoutMs, "SDK worker turn");
|
|
112
|
-
const packet = parseWorkerPacketFromText(outcome.result, ctx.state.goal_id);
|
|
113
|
-
const kind = packet ? "action" : "status";
|
|
114
|
-
writeWorkerEvidence(evidencePath, {
|
|
115
|
-
adapter: this.id,
|
|
116
|
-
turnIndex: ctx.turnIndex,
|
|
117
|
-
promptChars: prompt.length,
|
|
118
|
-
status: outcome.status,
|
|
119
|
-
result: outcome.result,
|
|
120
|
-
kind,
|
|
121
|
-
});
|
|
122
|
-
if (packet) {
|
|
123
|
-
return {
|
|
124
|
-
kind: "action",
|
|
125
|
-
summary: `sdk worker proposed action (turn ${ctx.turnIndex})`,
|
|
126
|
-
packet,
|
|
127
|
-
evidencePath,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
const summary = outcome.result.trim().slice(0, 240) ||
|
|
131
|
-
`sdk worker status (turn ${ctx.turnIndex})`;
|
|
132
|
-
return { kind: "status", summary, evidencePath };
|
|
133
|
-
}
|
|
134
|
-
catch (error) {
|
|
135
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
136
|
-
writeWorkerEvidence(evidencePath, {
|
|
137
|
-
adapter: this.id,
|
|
138
|
-
turnIndex: ctx.turnIndex,
|
|
139
|
-
promptChars: prompt.length,
|
|
140
|
-
status: "error",
|
|
141
|
-
result: "",
|
|
142
|
-
kind: "error",
|
|
143
|
-
error: message,
|
|
144
|
-
});
|
|
145
|
-
return {
|
|
146
|
-
kind: "error",
|
|
147
|
-
summary: `sdk worker error: ${message}`,
|
|
148
|
-
error: message,
|
|
149
|
-
evidencePath,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
export function resolveWorkerAdapter(opts) {
|
|
155
|
-
if (opts.mockWorker || opts.worker === "mock") {
|
|
156
|
-
return new MockWorkerAdapter();
|
|
157
|
-
}
|
|
158
|
-
if (!hasCursorApiKey()) {
|
|
159
|
-
throw new Error([
|
|
160
|
-
"Runner goal worker requires CURSOR_API_KEY for live SDK turns.",
|
|
161
|
-
"Use --mock-worker for offline/CI, or set the key per `cstl sdk status`.",
|
|
162
|
-
cursorApiKeySetupGuide(),
|
|
163
|
-
].join(" "));
|
|
164
|
-
}
|
|
165
|
-
return new SdkWorkerAdapter();
|
|
166
|
-
}
|
|
167
|
-
export function defaultAgentDefinitionPath(cwd) {
|
|
168
|
-
return path.join(cwd, ".cursor", "agents", "cstl-goal-worker.md");
|
|
169
|
-
}
|
|
170
|
-
export function buildWorkerTurnContext(cwd, state, turnIndex) {
|
|
171
|
-
return {
|
|
172
|
-
cwd,
|
|
173
|
-
state,
|
|
174
|
-
contractPath: goalContractPath(cwd, state.goal_id),
|
|
175
|
-
agentDefinitionPath: defaultAgentDefinitionPath(cwd),
|
|
176
|
-
turnIndex,
|
|
177
|
-
timeoutMs: state.walls.workerTurnTimeoutMs,
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
//# sourceMappingURL=worker.js.map
|
package/dist/goal/worker.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/goal/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AA4BrE,MAAM,UAAU,kBAAkB,CAChC,GAAW,EACX,MAAc,EACd,SAAiB;IAEjB,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,cAAc,EAAE,GAAG,SAAS,KAAK,CAAC,CAAC;AAC/E,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,MAAM,GAAc,EAAE,CAAC;IAC7B,MAAM,EAAE,GAAG,gCAAgC,CAAC;IAC5C,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,GAAG;YAAE,SAAS;QACnB,IAAI,CAAC;YACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,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AAK,CACb;YACE,gEAAgE;YAChE,yEAAyE;YACzE,sBAAsB,EAAE;SACzB,CAAC,IAAI,CAAC,GAAG,CAAC,CACZ,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,gBAAgB,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,GAAW;IACpD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,GAAW,EACX,KAAgB,EAChB,SAAiB;IAEjB,OAAO;QACL,GAAG;QACH,KAAK;QACL,YAAY,EAAE,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC;QAClD,mBAAmB,EAAE,0BAA0B,CAAC,GAAG,CAAC;QACpD,SAAS;QACT,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,mBAAmB;KAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: cstl-cursor2plus-setup
|
|
3
|
-
description: "Guides Cursor++ BYOK users through trellis-task-models.json5 setup at init or on demand. User picks models per Trellis/Cursor Task role; the agent lists providers, writes commented JSON5 with primary/fallback, runs patch_wpelc8.py. Use when cstl init just finished with Cursor selected, user asks to configure subagent models, or providers.json changed."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Trellis Cursor++ subagent model setup (agent-led)
|
|
7
|
-
|
|
8
|
-
## Who does what
|
|
9
|
-
|
|
10
|
-
| Role | Responsibility |
|
|
11
|
-
|------|----------------|
|
|
12
|
-
| **User** | Chooses which **display/api model name** they want per scene (research / implement / check / built-in Task types). May skip types they never use. |
|
|
13
|
-
| **Agent** | Lists catalog, writes `~/.ccursor/trellis-task-models.json5` with **comments per entry**, primary + fallback, runs patch, reports WARN/ERROR from resolver. |
|
|
14
|
-
|
|
15
|
-
Do **not** ask the user to hand-edit slugs (`model-xxxxx`) unless they prefer it.
|
|
16
|
-
|
|
17
|
-
## When to run
|
|
18
|
-
|
|
19
|
-
- Right after **`cstl init`** when **Cursor** was selected (CLI prints a follow-up hint).
|
|
20
|
-
- User says they use **Cursor++ BYOK** and want per–subagent-type models.
|
|
21
|
-
- After Cursor++ **providers** change: re-list, adjust fallbacks, re-patch.
|
|
22
|
-
- After **Cursor or Cursor++ upgrade**: run `python ./.cstl/local/cursor2plus/patch_wpelc8.py --check-compat` before `--apply --approve`; revert first if compat fails.
|
|
23
|
-
|
|
24
|
-
Native **Cursor API** (no Cursor++): **stop** — frontmatter `model:` works; this skill does not apply. Tell the user: **`.cstl/local/cursor2plus/` is safe to ignore or delete** unless they use Cursor++ BYOK.
|
|
25
|
-
|
|
26
|
-
## Workflow
|
|
27
|
-
|
|
28
|
-
1. Confirm Cursor++ data dir exists (`~/.ccursor/providers.json` or user path in `.cstl/local/cursor2plus/config.local.json`).
|
|
29
|
-
2. From repo root:
|
|
30
|
-
```bash
|
|
31
|
-
python ./.cstl/local/cursor2plus/patch_wpelc8.py --list-models
|
|
32
|
-
python ./.cstl/local/cursor2plus/patch_wpelc8.py --explain
|
|
33
|
-
```
|
|
34
|
-
3. Ask the user **one role at a time** (or one message with a table) which **apiModel/displayName** they want for:
|
|
35
|
-
- `cstl-research`, `cstl-implement`, `cstl-check`
|
|
36
|
-
- optional: `generalPurpose`, `shell`, `best-of-n-runner`
|
|
37
|
-
For each, ask **fallback** if they care (recommend a second choice from `--list-models`).
|
|
38
|
-
4. Write **`%USERPROFILE%\.ccursor\trellis-task-models.json5`** (or `~/.ccursor/`) using structure from `.cstl/local/trellis-task-models.json5.example`:
|
|
39
|
-
- JSON5 with `//` comments above each key explaining the Trellis/Cursor role
|
|
40
|
-
- `"models": { "<subagent_type>": { "primary": "...", "fallback": "..." } }`
|
|
41
|
-
5. Run:
|
|
42
|
-
```bash
|
|
43
|
-
python ./.cstl/local/cursor2plus/patch_wpelc8.py --print-map
|
|
44
|
-
python ./.cstl/local/cursor2plus/patch_wpelc8.py --apply --approve
|
|
45
|
-
```
|
|
46
|
-
6. Tell user: **Developer: Reload Window** in Cursor (once per patch).
|
|
47
|
-
7. If stderr shows `WARN ... using fallback`, explain that primary was missing from current `providers.json` and fallback was used — suggest updating primary/fallback names, not panicking.
|
|
48
|
-
|
|
49
|
-
## Resolver rules (for agent)
|
|
50
|
-
|
|
51
|
-
- Values match `apiModel`, `displayName`, or slug from latest `providers.json` (case-insensitive for names).
|
|
52
|
-
- **Primary** tried first; **fallback** only if primary does not resolve.
|
|
53
|
-
- **ERROR** only when **both** fail for a configured type — then fix JSON or ask user to pick another model from `--list-models`.
|
|
54
|
-
- Omit entire types the user does not use.
|
|
55
|
-
|
|
56
|
-
## Files
|
|
57
|
-
|
|
58
|
-
- User catalog: `~/.ccursor/providers.json`
|
|
59
|
-
- User routing doc: `~/.ccursor/trellis-task-models.json5` (gitignored on machine)
|
|
60
|
-
- Project override (optional): `.cstl/local/subagent-models.json5` — same shape, wins on same key
|
|
61
|
-
- Patch bundle: `.cstl/local/cursor2plus/`
|
|
62
|
-
|
|
63
|
-
Policy: `.cstl/spec/guides/cursor-subagent-policy.md` (Method 2.5 / 2.6).
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
# Trellis Cursor++ Subagent Model Setup
|
|
2
|
-
|
|
3
|
-
Configure per-subagent-type model routing for Cursor++ BYOK. Run this after `cstl init` (when Cursor++ is selected), when providers change, or whenever you want to re-map which model each Trellis Task subagent uses.
|
|
4
|
-
|
|
5
|
-
Native Cursor API (no Cursor++): stop — this does not apply; agent frontmatter `model:` works natively.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Step 1: Verify Cursor++ is configured
|
|
10
|
-
|
|
11
|
-
Confirm the Cursor++ data directory exists:
|
|
12
|
-
|
|
13
|
-
- `~/.ccursor/providers.json` (or a custom path in `.cstl/local/cursor2plus/config.local.json`)
|
|
14
|
-
|
|
15
|
-
If missing, Cursor++ is not set up — ask the user to install/configure it first.
|
|
16
|
-
|
|
17
|
-
## Step 2: List available models + roles
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
python ./.cstl/local/cursor2plus/patch_wpelc8.py --list-models
|
|
21
|
-
python ./.cstl/local/cursor2plus/patch_wpelc8.py --explain
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
`--list-models` shows the model catalog (apiModel / displayName / slug / provider) from `providers.json`.
|
|
25
|
-
`--explain` lists the subagent types you can route:
|
|
26
|
-
|
|
27
|
-
- `cstl-research`, `cstl-implement`, `cstl-check` (core Trellis roles)
|
|
28
|
-
- `generalPurpose`, `shell`, `best-of-n-runner` (built-in Cursor Task types, optional)
|
|
29
|
-
|
|
30
|
-
## Step 3: Ask the user which model per role
|
|
31
|
-
|
|
32
|
-
Ask the user (one role at a time, or a single table) which **apiModel/displayName** they want for each subagent type they use. For each, also ask a **fallback** (recommended: a second choice from `--list-models`).
|
|
33
|
-
|
|
34
|
-
The user may skip types they don't use — omit those from the map.
|
|
35
|
-
|
|
36
|
-
## Step 4: Write the routing map
|
|
37
|
-
|
|
38
|
-
Write `~/.ccursor/trellis-task-models.json5` (or `~/.ccursor/` on Unix) using the structure from `.cstl/local/trellis-task-models.json5.example`:
|
|
39
|
-
|
|
40
|
-
```json5
|
|
41
|
-
// Trellis + Cursor++ BYOK — per-subagent-type model routing
|
|
42
|
-
{
|
|
43
|
-
"models": {
|
|
44
|
-
// <role comment>
|
|
45
|
-
"cstl-research": { "primary": "<model>", "fallback": "<model>" },
|
|
46
|
-
"cstl-implement": { "primary": "<model>", "fallback": "<model>" },
|
|
47
|
-
"cstl-check": { "primary": "<model>", "fallback": "<model>" }
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Project-level override (optional, wins on same key): `.cstl/local/subagent-models.json5`.
|
|
53
|
-
|
|
54
|
-
## Step 5: Apply the patch + verify
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
python ./.cstl/local/cursor2plus/patch_wpelc8.py --print-map
|
|
58
|
-
python ./.cstl/local/cursor2plus/patch_wpelc8.py
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Then tell the user: **Developer: Reload Window** in Cursor (required once per patch for the resolver change to take effect).
|
|
62
|
-
|
|
63
|
-
## Step 6: Interpret resolver output
|
|
64
|
-
|
|
65
|
-
- `OK <type>: '<model>' → model-<slug>` — resolved successfully.
|
|
66
|
-
- `WARN ... using fallback` — primary was missing from current `providers.json`; fallback was used. Suggest updating primary/fallback names.
|
|
67
|
-
- `ERROR` — both primary and fallback failed for a configured type. Fix the JSON or pick another model from `--list-models`.
|
|
68
|
-
|
|
69
|
-
## Resolver rules
|
|
70
|
-
|
|
71
|
-
- Values match `apiModel`, `displayName`, or slug from latest `providers.json` (case-insensitive for names).
|
|
72
|
-
- Primary tried first; fallback only if primary does not resolve.
|
|
73
|
-
- ERROR only when both fail for a configured type.
|
|
74
|
-
|
|
75
|
-
## Files
|
|
76
|
-
|
|
77
|
-
- User catalog: `~/.ccursor/providers.json`
|
|
78
|
-
- User routing doc: `~/.ccursor/trellis-task-models.json5` (machine-local, gitignored)
|
|
79
|
-
- Project override (optional): `.cstl/local/subagent-models.json5`
|
|
80
|
-
- Patch bundle: `.cstl/local/cursor2plus/`
|
|
81
|
-
|
|
82
|
-
Policy: `.cstl/spec/guides/cursor-subagent-policy.md` (Method 2.5 / 2.6).
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Prefer Cursor native modes — task-driven; quiet cstl spine fallback"
|
|
3
|
-
alwaysApply: true
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Prefer Cursor native modes (P1 — orchestrate, don't replace)
|
|
7
|
-
|
|
8
|
-
cstl **prefers** Cursor native modes and maps them to Trellis Triage/phases. **Do not** replace Cursor UI or invent a parallel Plan/Ask/Debug product. Full table: `.cstl/spec/guides/cursor-native-modes-guide.md` · evidence: `{TASK}/research/modes-callability-matrix.md`.
|
|
9
|
-
|
|
10
|
-
## Quick routing
|
|
11
|
-
|
|
12
|
-
| Situation | Prefer | Trellis anchor |
|
|
13
|
-
| --- | --- | --- |
|
|
14
|
-
| Read-only explain / lookup | **Ask** when reachable; else No Task in Agent | `[Triage: No Task]` — no durable edits |
|
|
15
|
-
| Scope / design before code | **Try `SwitchMode(plan)`**; if poor, write artifacts in Agent | Phase 1 → `prd.md` / `design.md` / `implement.md`; `--check` |
|
|
16
|
-
| Approved build / verify | **Agent**; `SwitchMode(agent)` after Plan | Phase 2–3; `execution_mode` |
|
|
17
|
-
| Runtime / repeat failure | **Debug** when reachable; else verify + break-loop | Evidence → `verify.md` |
|
|
18
|
-
| Independent Parent children (post-approval) | **Multitask** / `Task` parallel when useful | Explicit `.cstl/tasks/<dir>` per worker; Parent integrates |
|
|
19
|
-
|
|
20
|
-
## Quiet fallback
|
|
21
|
-
|
|
22
|
-
When native cannot be task-driven well: continue on the **cstl spine** (Triage / Phase / artifacts / gates). Do **not** add user-facing “本版本不适配某 mode” copy. Do **not** center guidance on “please open the mode picker.”
|
|
23
|
-
|
|
24
|
-
## Hard boundaries
|
|
25
|
-
|
|
26
|
-
- Plan default save = **home dir** until Save to workspace → map into task files.
|
|
27
|
-
- Multitask/subagents: **never** rely on `selected_task`; worktrees + Parent review.
|
|
28
|
-
- Agent `SwitchMode`: **`plan` / `agent` only** (Ask/Debug not in the tool enum).
|
|
29
|
-
|
|
30
|
-
## Rollback
|
|
31
|
-
|
|
32
|
-
Delete this file + `cursor-native-modes-guide.md` (see guide Rollback).
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Rename Cursor chat to cstl task directory name after select or start-execution (cursor-app-control rename_chat)"
|
|
3
|
-
alwaysApply: true
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Trellis session rename (Cursor main session)
|
|
7
|
-
|
|
8
|
-
Encourage **one task per main Agent chat**. Subagent / Task child windows are out of scope.
|
|
9
|
-
|
|
10
|
-
## When to rename
|
|
11
|
-
|
|
12
|
-
After **you** successfully run either command in the **main** session (same turn or immediately after shell output):
|
|
13
|
-
|
|
14
|
-
- `python ./.cstl/scripts/task.py select <task-dir>`
|
|
15
|
-
- `python ./.cstl/scripts/task.py start-execution <task-dir> --approved`
|
|
16
|
-
|
|
17
|
-
Do **not** rename for `task.py create` alone (create does not bind the session).
|
|
18
|
-
|
|
19
|
-
## Title
|
|
20
|
-
|
|
21
|
-
Use the task **directory name** only (e.g. `07-04-cstl-session-rename`), not `task.json` `title`.
|
|
22
|
-
|
|
23
|
-
## How
|
|
24
|
-
|
|
25
|
-
1. If `cursor-app-control` MCP `rename_chat` is available, call it once with `title` = directory name.
|
|
26
|
-
2. If the tool is **not** available (BYOK or other environments), **skip silently** — no user prompt to rename manually.
|
|
27
|
-
3. Do not rename repeatedly for the same task in the same session unless the user switched to a different task directory.
|
|
28
|
-
|
|
29
|
-
## Native vs BYOK
|
|
30
|
-
|
|
31
|
-
Same rule for both. BYOK availability of `rename_chat` is environment-dependent; never fail the task workflow when rename is unavailable.
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Trellis subagent dispatch — generate dispatch prompt via CLI before Task tool (hook injection is broken in Cursor 3.8.22; this rule is the D-1 workaround)"
|
|
3
|
-
alwaysApply: true
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Trellis Subagent Dispatch (CLI Layer 2 — MANDATORY)
|
|
7
|
-
|
|
8
|
-
**CLI Layer 2 is the primary Cursor path.** The `preToolUse` hook does NOT fire for the Task tool in Cursor 3.8.22. Agent definition body does NOT enter subagent system prompt. The ONLY reliable context channel is the `Task` tool's `prompt` parameter.
|
|
9
|
-
|
|
10
|
-
## Rule
|
|
11
|
-
|
|
12
|
-
Before calling `Task(subagent_type="cstl-research|cstl-implement|cstl-check", ...)` you MUST:
|
|
13
|
-
|
|
14
|
-
1. Generate a complete dispatch prompt via CLI:
|
|
15
|
-
|
|
16
|
-
```powershell
|
|
17
|
-
python ./.cstl/scripts/generate_dispatch_prompt.py --agent <research|implement|check> --task "<task-path>" --repo-root "<repo-root>"
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
2. Use the CLI output as the `prompt` parameter value for `Task(...)`.
|
|
21
|
-
|
|
22
|
-
3. Append any additional user instructions AFTER the generated prompt, separated by `\n\n---\n\n`.
|
|
23
|
-
|
|
24
|
-
## Why
|
|
25
|
-
|
|
26
|
-
The generated prompt carries role identity ("You are the Trellis Research/Implement/Check Agent"), write scope constraints, recursion guard, and dynamic context (prd.md, design.md, implement.md, spec tree, jsonl files). Without this, the subagent receives only a bare user instruction with no Trellis context.
|
|
27
|
-
|
|
28
|
-
## Auto-detection
|
|
29
|
-
|
|
30
|
-
If `--task` is omitted, the script resolves the currently selected task. If `--repo-root` is omitted, it auto-detects via `.cstl` or `.git` upward search.
|
|
31
|
-
|
|
32
|
-
## Exception
|
|
33
|
-
|
|
34
|
-
This rule does NOT apply to `generalPurpose`, `explore`, `shell`, or other non-Trellis subagent types. Only `cstl-research`, `cstl-implement`, `cstl-check` require CLI-generated prompts.
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Trellis Request Triage — mandatory classification before any work (Cursor: alwaysApply rule is the per-turn reliable channel; sessionStart is session-level only)"
|
|
3
|
-
alwaysApply: true
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Trellis Request Triage (MANDATORY — hard gate, not optional)
|
|
7
|
-
|
|
8
|
-
You MUST classify every work-capable user request BEFORE acting. This is not a suggestion. If you skip classification, you are breaking the Trellis workflow contract.
|
|
9
|
-
|
|
10
|
-
## Decision tree (first match wins)
|
|
11
|
-
|
|
12
|
-
1. **No durable project change** (explanation, status, read-only lookup, one-liner Q&A) → `No Task`
|
|
13
|
-
2. **Underspecified small request, no task yet** (needs clarification before work exists) → `Micro-Grill` (load `cstl-micro-grill`)
|
|
14
|
-
3. **Low-risk durable work, single file, local validation, no contract change** → `Lite Task`
|
|
15
|
-
4. **Durable code/template/runtime/workflow change, cross-file behavior, or framework semantics** → `Full Task`
|
|
16
|
-
5. **Multiple independent deliverables, staged/parallel execution, or integration authority** → `Parent Task`
|
|
17
|
-
|
|
18
|
-
## Classification mark — REQUIRED as the FIRST line of your reply
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
[Triage: <Mode>] <one-sentence reason citing the trigger signal>
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
- `<Mode>` ∈ `No Task | Micro-Grill | Lite | Full | Parent`
|
|
25
|
-
- The reason MUST cite the trigger signal (e.g. "cross-file workflow change", "read-only explanation"). Vague reasons like "looks complex" are rejected.
|
|
26
|
-
- **`No Task` turns still require the mark** — it is how the user audits that you classified rather than skipped.
|
|
27
|
-
|
|
28
|
-
## Consent gate
|
|
29
|
-
|
|
30
|
-
After classifying into `Micro-Grill` / `Lite` / `Full` / `Parent`: **ASK the user for task-creation consent before creating any Trellis artifact.** Do NOT start implementation on your own. User consent to create a task is NOT consent to start coding — planning still happens first.
|
|
31
|
-
|
|
32
|
-
If the user declines a task for a simple request, skip Trellis for this session.
|
|
33
|
-
|
|
34
|
-
## Why this rule exists
|
|
35
|
-
|
|
36
|
-
Request Triage must be visible **on every turn**, not only at session start. `.cursor/rules` with `alwaysApply: true` is the reliable per-turn channel on Cursor. `sessionStart` `additional_context` delivers session-level orientation (dashboard, workflow summary) once per session — useful but insufficient for a per-turn hard gate. The full decision tree also lives in `.cstl/workflow.md` for on-demand loading via `get_context.py` / `cstl-continue`.
|