@blxzer/cursor-trellis 0.3.0 → 0.3.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 +45 -0
- package/README.md +51 -10
- package/README.zh-CN.md +21 -7
- package/bin/cstl.js +1 -1
- package/bin/smart-search.js +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +17 -15
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/capability-smoke.js +2 -2
- package/dist/commands/capability-smoke.js.map +1 -1
- package/dist/commands/channel/agent-loader.d.ts +1 -1
- package/dist/commands/channel/agent-loader.js +4 -4
- package/dist/commands/channel/agent-loader.js.map +1 -1
- package/dist/commands/channel/guard.d.ts +2 -2
- package/dist/commands/channel/guard.js +3 -3
- package/dist/commands/channel/guard.js.map +1 -1
- package/dist/commands/channel/index.js +3 -3
- package/dist/commands/channel/index.js.map +1 -1
- package/dist/commands/channel/list.d.ts +1 -1
- package/dist/commands/channel/list.js +1 -1
- package/dist/commands/channel/rm.d.ts +1 -1
- package/dist/commands/channel/rm.js +1 -1
- package/dist/commands/channel/store/lock.d.ts +1 -1
- package/dist/commands/channel/store/lock.js +1 -1
- package/dist/commands/channel/store/paths.js +1 -1
- package/dist/commands/channel/store/paths.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +105 -59
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/uninstall.d.ts +3 -3
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +69 -15
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.d.ts +6 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +83 -28
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/workflow.d.ts +4 -4
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +10 -9
- package/dist/commands/workflow.js.map +1 -1
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +1 -1
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/shared.js +6 -6
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/workflow.d.ts +4 -4
- package/dist/configurators/workflow.js +1 -1
- package/dist/constants/paths.d.ts +24 -24
- package/dist/constants/paths.d.ts.map +1 -1
- package/dist/constants/paths.js +16 -16
- package/dist/constants/paths.js.map +1 -1
- package/dist/migrations/manifests/0.3.1.json +32 -0
- package/dist/templates/common/bundled-skills/cstl-cursor2plus-setup/SKILL.md +11 -11
- package/dist/templates/common/bundled-skills/cstl-meta/SKILL.md +15 -15
- package/dist/templates/common/bundled-skills/cstl-meta/references/customize-local/add-project-local-conventions.md +12 -12
- package/dist/templates/common/bundled-skills/cstl-meta/references/customize-local/change-agents.md +2 -2
- package/dist/templates/common/bundled-skills/cstl-meta/references/customize-local/change-context-loading.md +21 -21
- package/dist/templates/common/bundled-skills/cstl-meta/references/customize-local/change-hooks.md +9 -9
- package/dist/templates/common/bundled-skills/cstl-meta/references/customize-local/change-skills-or-commands.md +7 -7
- package/dist/templates/common/bundled-skills/cstl-meta/references/customize-local/change-spec-structure.md +15 -15
- package/dist/templates/common/bundled-skills/cstl-meta/references/customize-local/change-task-lifecycle.md +27 -27
- package/dist/templates/common/bundled-skills/cstl-meta/references/customize-local/change-workflow.md +7 -7
- package/dist/templates/common/bundled-skills/cstl-meta/references/customize-local/overview.md +11 -11
- package/dist/templates/common/bundled-skills/cstl-meta/references/local-architecture/context-injection.md +12 -12
- package/dist/templates/common/bundled-skills/cstl-meta/references/local-architecture/generated-files.md +21 -21
- package/dist/templates/common/bundled-skills/cstl-meta/references/local-architecture/overview.md +14 -14
- package/dist/templates/common/bundled-skills/cstl-meta/references/local-architecture/spec-system.md +12 -12
- package/dist/templates/common/bundled-skills/cstl-meta/references/local-architecture/task-system.md +23 -23
- package/dist/templates/common/bundled-skills/cstl-meta/references/local-architecture/workflow.md +3 -3
- package/dist/templates/common/bundled-skills/cstl-meta/references/local-architecture/workspace-memory.md +16 -16
- package/dist/templates/common/bundled-skills/cstl-meta/references/platform-files/agents.md +2 -2
- package/dist/templates/common/bundled-skills/cstl-meta/references/platform-files/hooks-and-settings.md +6 -6
- package/dist/templates/common/bundled-skills/cstl-meta/references/platform-files/overview.md +5 -5
- package/dist/templates/common/bundled-skills/cstl-meta/references/platform-files/platform-map.md +3 -3
- package/dist/templates/common/bundled-skills/cstl-meta/references/platform-files/skills-and-commands.md +5 -5
- package/dist/templates/common/bundled-skills/cstl-skill-creator/SKILL.md +2 -2
- package/dist/templates/common/bundled-skills/cstl-skill-creator/references/review-checklist.md +1 -1
- package/dist/templates/common/bundled-skills/cstl-spec-bootstrap/SKILL.md +5 -5
- package/dist/templates/common/bundled-skills/cstl-spec-bootstrap/references/repository-analysis.md +1 -1
- package/dist/templates/common/bundled-skills/cstl-spec-bootstrap/references/spec-task-planning.md +3 -3
- package/dist/templates/common/bundled-skills/cstl-spec-bootstrap/references/spec-writing.md +1 -1
- package/dist/templates/common/commands/continue.md +6 -6
- package/dist/templates/common/commands/finish-work.md +5 -5
- package/dist/templates/common/commands/start.md +8 -8
- package/dist/templates/common/skills/before-dev.md +4 -4
- package/dist/templates/common/skills/brainstorm.md +5 -5
- package/dist/templates/common/skills/break-loop.md +3 -3
- package/dist/templates/common/skills/check.md +5 -5
- package/dist/templates/common/skills/update-spec.md +4 -4
- package/dist/templates/cursor/agents/cstl-check.md +6 -6
- package/dist/templates/cursor/agents/cstl-implement.md +7 -7
- package/dist/templates/cursor/agents/cstl-research.md +9 -9
- package/dist/templates/cursor/commands/cursor2plus-setup.md +10 -10
- package/dist/templates/cursor/rules/cstl-subagent-dispatch.mdc +2 -2
- package/dist/templates/cursor/rules/cstl-triage.mdc +2 -2
- package/dist/templates/cursor/rules/retrieval-routing.mdc +4 -4
- package/dist/templates/extract.d.ts +1 -1
- package/dist/templates/extract.js +1 -1
- package/dist/templates/markdown/agents.md +11 -11
- package/dist/templates/markdown/prompts/run-semantic-slice-12.md.txt +1 -1
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +5 -5
- package/dist/templates/markdown/spec/guides/cursor-context-injection-guide.md.txt +3 -3
- package/dist/templates/markdown/spec/guides/cursor-semantic-compliance.md.txt +1 -1
- package/dist/templates/markdown/spec/guides/cursor-subagent-policy.md.txt +11 -11
- package/dist/templates/markdown/spec/guides/cursor-trellis-release-coexistence-guide.md.txt +166 -0
- package/dist/templates/markdown/spec/guides/durable-learning-decision-guide.md.txt +8 -8
- package/dist/templates/markdown/spec/guides/execution-strategy.md.txt +3 -3
- package/dist/templates/markdown/spec/guides/index.md.txt +1 -0
- package/dist/templates/markdown/spec/guides/retrieval-daily-guide.md.txt +10 -10
- package/dist/templates/markdown/workspace-index.md +3 -3
- package/dist/templates/markdown/worktree.yaml.txt +1 -1
- package/dist/templates/shared-hooks/index.d.ts +1 -1
- package/dist/templates/shared-hooks/index.js +1 -1
- package/dist/templates/shared-hooks/inject-retrieval-plan.py +3 -3
- package/dist/templates/shared-hooks/inject-shell-session-context.py +7 -7
- package/dist/templates/shared-hooks/inject-subagent-context.py +1 -1
- package/dist/templates/shared-hooks/inject-workflow-state.py +11 -11
- package/dist/templates/shared-hooks/research-end-retrieval-pack.py +1 -1
- package/dist/templates/shared-hooks/session-start.py +13 -13
- package/dist/templates/trellis/config.yaml +2 -22
- package/dist/templates/trellis/index.d.ts +2 -2
- package/dist/templates/trellis/index.js +2 -2
- package/dist/templates/trellis/local/README.md +3 -3
- package/dist/templates/trellis/local/patch_wpelc8.py +4 -4
- package/dist/templates/trellis/scripts/add_session.py +20 -20
- package/dist/templates/trellis/scripts/common/active_task.py +2 -2
- package/dist/templates/trellis/scripts/common/artifact_search.py +587 -587
- package/dist/templates/trellis/scripts/common/codebase_retrieval_router.py +6 -6
- package/dist/templates/trellis/scripts/common/config.py +3 -3
- package/dist/templates/trellis/scripts/common/developer.py +2 -2
- package/dist/templates/trellis/scripts/common/packages_context.py +23 -23
- package/dist/templates/trellis/scripts/common/parent_orchestration.py +16 -16
- package/dist/templates/trellis/scripts/common/paths.py +107 -107
- package/dist/templates/trellis/scripts/common/project_file_stats.py +1 -1
- package/dist/templates/trellis/scripts/common/retrieval_agent_instructions.py +1 -1
- package/dist/templates/trellis/scripts/common/safe_commit.py +31 -31
- package/dist/templates/trellis/scripts/common/session_memory.py +360 -360
- package/dist/templates/trellis/scripts/common/smart_search_evidence.py +514 -514
- package/dist/templates/trellis/scripts/common/smart_search_resolve.py +1 -1
- package/dist/templates/trellis/scripts/common/subagent_dispatch.py +2 -2
- package/dist/templates/trellis/scripts/common/task_context.py +1 -1
- package/dist/templates/trellis/scripts/common/task_dashboard.py +140 -140
- package/dist/templates/trellis/scripts/common/task_gates.py +23 -23
- package/dist/templates/trellis/scripts/common/task_store.py +5 -5
- package/dist/templates/trellis/scripts/common/task_utils.py +3 -3
- package/dist/templates/trellis/scripts/common/tasks.py +1 -1
- package/dist/templates/trellis/scripts/common/trellis_config.py +3 -3
- package/dist/templates/trellis/scripts/common/workflow_phase.py +1 -1
- package/dist/templates/trellis/scripts/cursor_retrieval_probe.py +3 -3
- package/dist/templates/trellis/scripts/cursor_retrieval_probe_prompt.md +11 -11
- package/dist/templates/trellis/scripts/hooks/linear_sync.py +8 -8
- package/dist/templates/trellis/scripts/init_developer.py +2 -2
- package/dist/templates/trellis/scripts/retrieval_probe_matrix_template.json +4 -4
- package/dist/templates/trellis/scripts/route_codebase_retrieval.py +1 -1
- package/dist/templates/trellis/scripts/task.py +918 -918
- package/dist/templates/trellis/tasks/templates/release-readiness/implement.md +2 -2
- package/dist/templates/trellis/workflow.md +64 -64
- package/dist/types/migration.d.ts +1 -1
- package/dist/types/migration.d.ts.map +1 -1
- package/dist/utils/agents-md.d.ts +47 -0
- package/dist/utils/agents-md.d.ts.map +1 -0
- package/dist/utils/agents-md.js +107 -0
- package/dist/utils/agents-md.js.map +1 -0
- package/dist/utils/codebase-retrieval-router.js +5 -5
- package/dist/utils/codebase-retrieval-router.js.map +1 -1
- package/dist/utils/manifest-prune.d.ts +2 -2
- package/dist/utils/manifest-prune.js +4 -4
- package/dist/utils/manifest-prune.js.map +1 -1
- package/dist/utils/mirror-check.d.ts +3 -1
- package/dist/utils/mirror-check.d.ts.map +1 -1
- package/dist/utils/mirror-check.js +22 -11
- package/dist/utils/mirror-check.js.map +1 -1
- package/dist/utils/project-capabilities.js +5 -5
- package/dist/utils/project-capabilities.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-fetcher.js +1 -1
- package/dist/utils/template-fetcher.js.map +1 -1
- package/dist/utils/template-hash.d.ts +2 -2
- package/dist/utils/template-hash.d.ts.map +1 -1
- package/dist/utils/template-hash.js +51 -18
- package/dist/utils/template-hash.js.map +1 -1
- package/dist/utils/workflow-dir.d.ts +13 -0
- package/dist/utils/workflow-dir.d.ts.map +1 -0
- package/dist/utils/workflow-dir.js +35 -0
- package/dist/utils/workflow-dir.js.map +1 -0
- package/dist/utils/workflow-ownership.d.ts +36 -0
- package/dist/utils/workflow-ownership.d.ts.map +1 -0
- package/dist/utils/workflow-ownership.js +137 -0
- package/dist/utils/workflow-ownership.js.map +1 -0
- package/dist/utils/workflow-resolver.d.ts +1 -1
- package/dist/utils/workflow-resolver.js +1 -1
- package/package.json +2 -2
|
@@ -15,13 +15,13 @@ quality_gates:
|
|
|
15
15
|
|
|
16
16
|
## Steps
|
|
17
17
|
|
|
18
|
-
1. Read product release spec (e.g. `.
|
|
18
|
+
1. Read product release spec (e.g. `.cstl/spec/**/release*.md`) and recent integrated task handoffs.
|
|
19
19
|
2. Record current versions from `package.json` (and lockstep packages).
|
|
20
20
|
3. Draft version recommendation and changelog.
|
|
21
21
|
4. Run non-mutating guards and validation (manifest, build, focused tests, typecheck, pack dry-run).
|
|
22
22
|
5. Fill `verify.md` using the evidence contract in `design.md`.
|
|
23
23
|
6. Write `handoff.md` with **Ready to publish**, **Not published**, and **Blockers** tables.
|
|
24
|
-
7. Run `python ./.
|
|
24
|
+
7. Run `python ./.cstl/scripts/task.py validate <this-task>` and `archive --check` when finishing.
|
|
25
25
|
|
|
26
26
|
## Validation
|
|
27
27
|
|
|
@@ -19,96 +19,96 @@
|
|
|
19
19
|
On first use, initialize your identity:
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
python3 ./.
|
|
22
|
+
python3 ./.cstl/scripts/init_developer.py <your-name>
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Creates `.
|
|
25
|
+
Creates `.cstl/.developer` (gitignored) + `.cstl/workspace/<your-name>/`.
|
|
26
26
|
|
|
27
27
|
### Spec System
|
|
28
28
|
|
|
29
|
-
`.
|
|
29
|
+
`.cstl/spec/` holds coding guidelines organized by package and layer.
|
|
30
30
|
|
|
31
|
-
- `.
|
|
32
|
-
- `.
|
|
31
|
+
- `.cstl/spec/<package>/<layer>/index.md` — entry point with **Pre-Development Checklist** + **Quality Check**. Actual guidelines live in the `.md` files it points to.
|
|
32
|
+
- `.cstl/spec/guides/index.md` — cross-package thinking guides.
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
python3 ./.
|
|
35
|
+
python3 ./.cstl/scripts/get_context.py --mode packages # list packages / layers
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
**When to update spec**: new pattern/convention found · bug-fix prevention to codify · new technical decision.
|
|
39
39
|
|
|
40
40
|
### Task System
|
|
41
41
|
|
|
42
|
-
Every task has its own directory under `.
|
|
42
|
+
Every task has its own directory under `.cstl/tasks/{MM-DD-name}/` holding `task.json`, `prd.md`, optional `design.md`, optional `implement.md`, optional `research/`, and context manifests (`implement.jsonl`, `check.jsonl`) for Cursor (sub-agent dispatch).
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
45
|
# Task lifecycle
|
|
46
|
-
python3 ./.
|
|
47
|
-
python3 ./.
|
|
48
|
-
python3 ./.
|
|
49
|
-
python3 ./.
|
|
50
|
-
python3 ./.
|
|
51
|
-
python3 ./.
|
|
52
|
-
python3 ./.
|
|
53
|
-
python3 ./.
|
|
54
|
-
python3 ./.
|
|
55
|
-
python3 ./.
|
|
56
|
-
python3 ./.
|
|
57
|
-
python3 ./.
|
|
58
|
-
python3 ./.
|
|
59
|
-
python3 ./.
|
|
46
|
+
python3 ./.cstl/scripts/task.py create "<title>" [--slug <name>] [--parent <dir>]
|
|
47
|
+
python3 ./.cstl/scripts/task.py dashboard # show Task Dashboard without mutating state
|
|
48
|
+
python3 ./.cstl/scripts/task.py select <name> # select task for this live session
|
|
49
|
+
python3 ./.cstl/scripts/task.py selected --source # show selected task and source
|
|
50
|
+
python3 ./.cstl/scripts/task.py start-execution <name> --check
|
|
51
|
+
python3 ./.cstl/scripts/task.py start-execution <name> --approved
|
|
52
|
+
python3 ./.cstl/scripts/task.py exit # clear selected task without changing status
|
|
53
|
+
python3 ./.cstl/scripts/task.py archive <name> # move to archive/{year-month}/
|
|
54
|
+
python3 ./.cstl/scripts/task.py list [--mine] [--status <s>]
|
|
55
|
+
python3 ./.cstl/scripts/task.py list-archive
|
|
56
|
+
python3 ./.cstl/scripts/task.py add-subtask <parent> <child>
|
|
57
|
+
python3 ./.cstl/scripts/task.py set-child-state <parent> <child> review --evidence verify.md
|
|
58
|
+
python3 ./.cstl/scripts/task.py prepare-child-worktree <parent> <child> --branch <child-branch>
|
|
59
|
+
python3 ./.cstl/scripts/task.py integrate-child <parent> <child> accepted --evidence handoff.md --ref <child-ref>
|
|
60
60
|
|
|
61
61
|
# Code-spec context (injected into implement/check agents via JSONL).
|
|
62
62
|
# `implement.jsonl` / `check.jsonl` are seeded on `task create` for sub-agent-capable
|
|
63
63
|
# platforms; the AI curates real spec + research entries during planning when needed.
|
|
64
|
-
python3 ./.
|
|
65
|
-
python3 ./.
|
|
66
|
-
python3 ./.
|
|
64
|
+
python3 ./.cstl/scripts/task.py add-context <name> <action> <file> <reason>
|
|
65
|
+
python3 ./.cstl/scripts/task.py list-context <name> [action]
|
|
66
|
+
python3 ./.cstl/scripts/task.py validate <name>
|
|
67
67
|
|
|
68
68
|
# Task metadata
|
|
69
|
-
python3 ./.
|
|
70
|
-
python3 ./.
|
|
71
|
-
python3 ./.
|
|
69
|
+
python3 ./.cstl/scripts/task.py set-branch <name> <branch>
|
|
70
|
+
python3 ./.cstl/scripts/task.py set-base-branch <name> <branch> # PR target
|
|
71
|
+
python3 ./.cstl/scripts/task.py set-scope <name> <scope>
|
|
72
72
|
|
|
73
73
|
# Hierarchy (parent/child)
|
|
74
|
-
python3 ./.
|
|
75
|
-
python3 ./.
|
|
74
|
+
python3 ./.cstl/scripts/task.py add-subtask <parent> <child>
|
|
75
|
+
python3 ./.cstl/scripts/task.py remove-subtask <parent> <child>
|
|
76
76
|
|
|
77
77
|
# PR creation
|
|
78
|
-
python3 ./.
|
|
78
|
+
python3 ./.cstl/scripts/task.py create-pr [name] [--dry-run]
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
> Run `python3 ./.
|
|
81
|
+
> Run `python3 ./.cstl/scripts/task.py --help` to see the authoritative, up-to-date list.
|
|
82
82
|
|
|
83
83
|
**Selected-task mechanism**: entering a Trellis project activates framework context, but every new live session starts with `Selected task: none`. `task.py create` creates artifacts only. `task.py select <task>` writes a per-session `selected_task` pointer without changing `task.json.status`. `task.py selected --source` reports that pointer. `task.py exit` clears it without changing status. `task.py start-execution <task> --check` verifies execution readiness without mutation; `task.py start-execution <task> --approved` is the explicit execution boundary and may flip `planning` to `in_progress`. `task.py archive <task>` writes `status=completed`, moves the directory to `archive/`, and deletes runtime session files that still point at the archived task.
|
|
84
84
|
|
|
85
85
|
### Workspace System
|
|
86
86
|
|
|
87
|
-
Records every AI session for cross-session tracking under `.
|
|
87
|
+
Records every AI session for cross-session tracking under `.cstl/workspace/<developer>/`.
|
|
88
88
|
|
|
89
89
|
- `journal-N.md` — session log. **Max 2000 lines per file**; a new `journal-(N+1).md` is auto-created when exceeded.
|
|
90
90
|
- `index.md` — personal index (total sessions, last active).
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
|
-
python3 ./.
|
|
93
|
+
python3 ./.cstl/scripts/add_session.py --title "Title" --commit "hash" --summary "Summary"
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
### Context Script
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
|
-
python3 ./.
|
|
100
|
-
python3 ./.
|
|
101
|
-
python3 ./.
|
|
102
|
-
python3 ./.
|
|
99
|
+
python3 ./.cstl/scripts/get_context.py # full session runtime
|
|
100
|
+
python3 ./.cstl/scripts/get_context.py --mode packages # available packages + spec layers
|
|
101
|
+
python3 ./.cstl/scripts/get_context.py --mode phase --step <X.Y> # detailed guide for a workflow step
|
|
102
|
+
python3 ./.cstl/scripts/get_context.py --mode retrieval-pack --json --input <evidence.json> # score collected evidence (not default --json)
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
**Evidence scoring:** default `--json` returns `retrievalGuide` only. After collecting artifact search, session memory, smart-search manifests under `{TASK}/research/smart-search/`, or codebase candidates, run **`--mode retrieval-pack`** with `--input` or stdin JSON. See `research/evidence-scoring-integration.md` in the active task or archived `06-15-child-phase2-evidence-scoring`.
|
|
106
106
|
|
|
107
107
|
**Research-end hook (Cursor `stop`):** when the selected task has `{TASK}/research/*.md` or `research/smart-search/`, `.cursor/hooks/research-end-retrieval-pack.py` may write `{TASK}/research/retrieval-pack-latest.json` via `get_context --mode retrieval-pack`. Default session JSON is unchanged; use the file when closing research or before Phase 3.1.
|
|
108
108
|
|
|
109
|
-
**Retrieval daily guide:** `.
|
|
109
|
+
**Retrieval daily guide:** `.cstl/spec/guides/retrieval-daily-guide.md` — when to use rg, codegraph, fast-context-mcp, smart-search-cli (and Cursor web fallback), artifact/session memory, codebase router (suggest-only), and explicit retrieval-pack scoring.
|
|
110
110
|
|
|
111
|
-
**Cursor subagent dispatch:** `.
|
|
111
|
+
**Cursor subagent dispatch:** `.cstl/spec/guides/cursor-subagent-policy.md` — `cstl-research` / `cstl-implement` / `cstl-check`; Parent child default **Task** `cstl-implement` from Parent session (`generate-child-prompt --mode subagent`). **Cursor++ BYOK:** per-type models via `.cstl/local/cursor2plus/` + user/project JSON maps (not committed slugs). **Native Cursor API:** frontmatter `model:` on agents still works. PRD Grill stays in `cstl-brainstorm`, not a subagent. **Cursor++:** compatible v0.0.11+ (SubAgent readonly bug fixed).
|
|
112
112
|
|
|
113
113
|
---
|
|
114
114
|
|
|
@@ -151,7 +151,7 @@ python3 ./.trellis/scripts/get_context.py --mode retrieval-pack --json --input <
|
|
|
151
151
|
- Run `cstl update` after editing to push the new bodies to
|
|
152
152
|
downstream user projects (block-level managed replacement)
|
|
153
153
|
- Full runtime contract:
|
|
154
|
-
.
|
|
154
|
+
.cstl/spec/cli/backend/workflow-state-contract.md
|
|
155
155
|
-->
|
|
156
156
|
|
|
157
157
|
## Phase Index
|
|
@@ -223,7 +223,7 @@ Before executing an upgrade that creates artifacts, changes task mode, adds gate
|
|
|
223
223
|
| No selected task + need dashboard | `cstl-start` |
|
|
224
224
|
| Selected task + resume step | `cstl-continue` |
|
|
225
225
|
| Planning / PRD | `cstl-brainstorm` |
|
|
226
|
-
| Parent with parallel children | `generate-child-prompt --mode subagent`; writable Agent; see `.
|
|
226
|
+
| Parent with parallel children | `generate-child-prompt --mode subagent`; writable Agent; see `.cstl/spec/guides/cursor-subagent-policy.md` |
|
|
227
227
|
|
|
228
228
|
Details: archived `06-15-child-phase3-task-ladder` → `research/task-ladder-iteration.md`.
|
|
229
229
|
|
|
@@ -254,11 +254,11 @@ Integration is Parent/Child-only. Ordinary Lite and Full Tasks skip Integration
|
|
|
254
254
|
Parent sessions can productize child dispatch and review without a new agent runtime:
|
|
255
255
|
|
|
256
256
|
```bash
|
|
257
|
-
python3 ./.
|
|
258
|
-
python3 ./.
|
|
259
|
-
python3 ./.
|
|
260
|
-
python3 ./.
|
|
261
|
-
python3 ./.
|
|
257
|
+
python3 ./.cstl/scripts/task.py parent-status <parent-task>
|
|
258
|
+
python3 ./.cstl/scripts/task.py generate-child-prompt <parent-task> <child-task> --mode inline
|
|
259
|
+
python3 ./.cstl/scripts/task.py review-child <parent-task> <child-task> --check --decision accept --ref <child-ref>
|
|
260
|
+
python3 ./.cstl/scripts/task.py review-child <parent-task> <child-task> --decision accept --ref <child-ref>
|
|
261
|
+
python3 ./.cstl/scripts/task.py review-child <parent-task> <child-task> --decision integrate-through --ref <child-ref>
|
|
262
262
|
```
|
|
263
263
|
|
|
264
264
|
- `generate-child-prompt` reads parent `task-map.md` for `depends_on` and `touches`, child artifacts, and optional parent `child-prompts.md`. Use `--mode subagent` only as a delivery hint when the platform can spawn subagents; inline mode remains the portable default.
|
|
@@ -380,8 +380,8 @@ Implementation defects inside the already approved contract route back to Execut
|
|
|
380
380
|
At each step, run this to fetch detailed guidance:
|
|
381
381
|
|
|
382
382
|
```bash
|
|
383
|
-
python3 ./.
|
|
384
|
-
# e.g. python3 ./.
|
|
383
|
+
python3 ./.cstl/scripts/get_context.py --mode phase --step <step>
|
|
384
|
+
# e.g. python3 ./.cstl/scripts/get_context.py --mode phase --step 1.1
|
|
385
385
|
```
|
|
386
386
|
|
|
387
387
|
---
|
|
@@ -395,7 +395,7 @@ Goal: classify the request, get task-creation consent when a task is needed, and
|
|
|
395
395
|
Create the task directory only after task-creation consent. The command sets status to `planning`, writes `task.json`, and creates a default `prd.md`. It does not select the task, start execution, or approve execution:
|
|
396
396
|
|
|
397
397
|
```bash
|
|
398
|
-
python3 ./.
|
|
398
|
+
python3 ./.cstl/scripts/task.py create "<task title>" --slug <name>
|
|
399
399
|
```
|
|
400
400
|
|
|
401
401
|
`--slug` is the human-readable name only. Do **not** include the `MM-DD-` date prefix; `task.py create` adds that prefix automatically.
|
|
@@ -405,14 +405,14 @@ For task trees, create the parent task first and then create each child with `--
|
|
|
405
405
|
After creation, select the task only when the user has chosen it for this live session:
|
|
406
406
|
|
|
407
407
|
```bash
|
|
408
|
-
python3 ./.
|
|
408
|
+
python3 ./.cstl/scripts/task.py select <task-dir>
|
|
409
409
|
```
|
|
410
410
|
|
|
411
411
|
After selection, the per-turn breadcrumb switches to `[workflow-state:planning]`, telling the AI to stay in planning.
|
|
412
412
|
|
|
413
413
|
Run only `create` and, when appropriate, `select` here. Do not run `start-execution --approved` until step 1.4 passes its non-mutating `--check` and the user gives explicit execution approval.
|
|
414
414
|
|
|
415
|
-
Skip when the user has already explicitly selected an appropriate task with `python3 ./.
|
|
415
|
+
Skip when the user has already explicitly selected an appropriate task with `python3 ./.cstl/scripts/task.py select <task>`.
|
|
416
416
|
|
|
417
417
|
#### 1.1 Requirement exploration `[required · repeatable]`
|
|
418
418
|
|
|
@@ -450,7 +450,7 @@ Spawn the research sub-agent:
|
|
|
450
450
|
|
|
451
451
|
|
|
452
452
|
**Retrieval during research**:
|
|
453
|
-
- Use `python3 ./.
|
|
453
|
+
- Use `python3 ./.cstl/scripts/search_artifacts.py --query "<topic>" --json` to find durable Trellis specs, prior tasks, research, verification notes, and workspace journals before re-discovering framework context.
|
|
454
454
|
- Use `codebase-retrieval` evidence levels for source-code questions: adapter output is candidate evidence until current source, Git, or validation confirms it.
|
|
455
455
|
- Persist useful exploratory retrieval chains, adapter availability, and competing hypotheses under `{TASK_DIR}/research/`.
|
|
456
456
|
|
|
@@ -486,7 +486,7 @@ Curate `implement.jsonl` and `check.jsonl` so the Phase 2 sub-agents get the rig
|
|
|
486
486
|
**Format**: one JSON object per line — `{"file": "<path>", "reason": "<why>"}`. Paths are repo-root relative.
|
|
487
487
|
|
|
488
488
|
**What to put in**:
|
|
489
|
-
- **Spec files** — `.
|
|
489
|
+
- **Spec files** — `.cstl/spec/<package>/<layer>/index.md` and any specific guideline files (`error-handling.md`, `conventions.md`, etc.) relevant to this task
|
|
490
490
|
- **Research files** — `{TASK_DIR}/research/*.md` that the sub-agent will need to consult
|
|
491
491
|
|
|
492
492
|
**What NOT to put in**:
|
|
@@ -502,7 +502,7 @@ These manifests do not replace `implement.md`. `implement.md` is the human-reada
|
|
|
502
502
|
**How to discover relevant specs**:
|
|
503
503
|
|
|
504
504
|
```bash
|
|
505
|
-
python3 ./.
|
|
505
|
+
python3 ./.cstl/scripts/get_context.py --mode packages
|
|
506
506
|
```
|
|
507
507
|
|
|
508
508
|
Lists every package + its spec layers with paths. Pick the entries that match this task's domain.
|
|
@@ -510,7 +510,7 @@ Lists every package + its spec layers with paths. Pick the entries that match th
|
|
|
510
510
|
Use artifact search when prior task/research evidence is likely relevant:
|
|
511
511
|
|
|
512
512
|
```bash
|
|
513
|
-
python3 ./.
|
|
513
|
+
python3 ./.cstl/scripts/search_artifacts.py --query "<topic>" --json
|
|
514
514
|
```
|
|
515
515
|
|
|
516
516
|
Add any reusable `{TASK_DIR}/research/*.md` files you discovered when sub-agents need them.
|
|
@@ -520,8 +520,8 @@ Add any reusable `{TASK_DIR}/research/*.md` files you discovered when sub-agents
|
|
|
520
520
|
Either edit the jsonl file directly in your editor, or use:
|
|
521
521
|
|
|
522
522
|
```bash
|
|
523
|
-
python3 ./.
|
|
524
|
-
python3 ./.
|
|
523
|
+
python3 ./.cstl/scripts/task.py add-context "$TASK_DIR" implement "<path>" "<reason>"
|
|
524
|
+
python3 ./.cstl/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reason>"
|
|
525
525
|
```
|
|
526
526
|
|
|
527
527
|
Delete the seed `_example` line once real entries exist (optional — it's skipped automatically by consumers).
|
|
@@ -535,7 +535,7 @@ Skip when: `implement.jsonl` and `check.jsonl` have agent-curated entries (the s
|
|
|
535
535
|
After artifact review, run the non-mutating execution preflight:
|
|
536
536
|
|
|
537
537
|
```bash
|
|
538
|
-
python3 ./.
|
|
538
|
+
python3 ./.cstl/scripts/task.py start-execution <task-dir> --check
|
|
539
539
|
```
|
|
540
540
|
|
|
541
541
|
For lightweight tasks, `prd.md` can be enough. For complex tasks, `prd.md`, `design.md`, and `implement.md` must exist and be reviewed before execution approval. On Cursor (sub-agent dispatch), curate jsonl manifests when extra spec or research context is needed; seed-only manifests are tolerated by consumers.
|
|
@@ -545,7 +545,7 @@ If `--check` passes, report that artifact gates are ready and include the task n
|
|
|
545
545
|
Only after the user approves execution in that context, run:
|
|
546
546
|
|
|
547
547
|
```bash
|
|
548
|
-
python3 ./.
|
|
548
|
+
python3 ./.cstl/scripts/task.py start-execution <task-dir> --approved
|
|
549
549
|
```
|
|
550
550
|
|
|
551
551
|
After this command succeeds, the breadcrumb switches to `[workflow-state:in_progress]`, and the rest of Phase 2 / 3 follows.
|
|
@@ -581,7 +581,7 @@ Implementation defects inside the approved contract remain Execution work: fix t
|
|
|
581
581
|
#### 2.1 Implement `[required · repeatable]`
|
|
582
582
|
|
|
583
583
|
Use retrieval layers before and during implementation when context is incomplete:
|
|
584
|
-
- `python3 ./.
|
|
584
|
+
- `python3 ./.cstl/scripts/search_artifacts.py --query "<topic>" --json` for durable Trellis specs, prior task artifacts, research, verification notes, and journals.
|
|
585
585
|
- `codebase-retrieval` evidence levels for source claims: candidate -> corroborated candidate -> verified claim; unresolved or unavailable adapters must be reported instead of treated as proof.
|
|
586
586
|
- Record exploratory chains in `{TASK_DIR}/research/` and final source/Git/test proof in `verify.md`.
|
|
587
587
|
|
|
@@ -629,7 +629,7 @@ Goal: ensure code quality, capture lessons, record the work.
|
|
|
629
629
|
|
|
630
630
|
For **complex** tasks, optionally before 3.1 when you have collected retrieval evidence JSON (e.g. after Phase 1.2 smart-search manifests in `{TASK}/research/smart-search/`):
|
|
631
631
|
|
|
632
|
-
`python3 ./.
|
|
632
|
+
`python3 ./.cstl/scripts/get_context.py --mode retrieval-pack --json --input <path-to-evidence.json>`
|
|
633
633
|
|
|
634
634
|
Use `contextPack.selected` / `scoredEvidence` to order citations in `verify.md`. Do **not** expect scoring in default `get_context --json`.
|
|
635
635
|
|
|
@@ -663,7 +663,7 @@ Review whether this task produced durable learning worth recording:
|
|
|
663
663
|
- requirement drift, architecture decisions, reusable conventions, or toolchain pitfalls;
|
|
664
664
|
- new project-local patterns that should affect future work.
|
|
665
665
|
|
|
666
|
-
If durable learning exists, load `cstl-update-spec` and update `.
|
|
666
|
+
If durable learning exists, load `cstl-update-spec` and update `.cstl/spec/` or write a focused `retrospective.md`, then link that evidence from `verify.md`.
|
|
667
667
|
|
|
668
668
|
If no durable learning exists, write an explicit `No durable learning` decision in `verify.md`. Do not run a spec update only to satisfy ceremony.
|
|
669
669
|
|
|
@@ -801,5 +801,5 @@ Supported events: `after_create / after_start / after_archive`. Use `after_archi
|
|
|
801
801
|
|
|
802
802
|
For the workflow state machine's runtime contract, the locations of all status writers, pseudo-statuses (`no_task` / `stale_<source_type>`), the hook reachability matrix, and other deep details, see:
|
|
803
803
|
|
|
804
|
-
- `.
|
|
805
|
-
- `.
|
|
804
|
+
- `.cstl/spec/cli/backend/workflow-state-contract.md` — runtime contract + writer table + test invariants
|
|
805
|
+
- `.cstl/scripts/inject-workflow-state.py` — actual parser (reads workflow.md only, no embedded text)
|
|
@@ -35,7 +35,7 @@ export interface MigrationItem {
|
|
|
35
35
|
* substring (live or commented), the section is treated as already present.
|
|
36
36
|
*/
|
|
37
37
|
export interface ConfigSectionAdded {
|
|
38
|
-
/** Target file relative to project root (e.g. `.
|
|
38
|
+
/** Target file relative to project root (e.g. `.cstl/config.yaml`). */
|
|
39
39
|
file: string;
|
|
40
40
|
/**
|
|
41
41
|
* Substring whose presence in the user file means this section already
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/types/migration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,IAAI,EAAE,QAAQ,GAAG,YAAY,GAAG,QAAQ,GAAG,kBAAkB,CAAC;IAC9D,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,EAAE,CAAC,EAAE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,CAAC;IAC3B,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAC/B,MAAM,GACN,SAAS,GACT,UAAU,GACV,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,aAAa;IAC5D,cAAc,EAAE,uBAAuB,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,8CAA8C;IAC9C,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,8CAA8C;IAC9C,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,wCAAwC;IACxC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,oCAAoC;IACpC,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,eAAe,GACf,MAAM,GACN,WAAW,CAAC;AAEhB;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AGENTS.md managed-block helpers.
|
|
3
|
+
*
|
|
4
|
+
* cursor-trellis maintains a `<!-- CSTL:START -->...<!-- CSTL:END -->` block in
|
|
5
|
+
* AGENTS.md. Upstream mindfold-ai/Trellis maintains a separate
|
|
6
|
+
* `<!-- TRELLIS:START -->...<!-- TRELLIS:END -->` block. The two blocks can
|
|
7
|
+
* coexist in the same file so a repo can run upstream Trellis (other platforms)
|
|
8
|
+
* and cursor-trellis (Cursor) side by side.
|
|
9
|
+
*
|
|
10
|
+
* cursor-trellis never touches the upstream TRELLIS block or user content
|
|
11
|
+
* outside its own CSTL block.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CSTL_BLOCK_START = "<!-- CSTL:START -->";
|
|
14
|
+
export declare const CSTL_BLOCK_END = "<!-- CSTL:END -->";
|
|
15
|
+
export declare const LEGACY_TRELLIS_BLOCK_START = "<!-- TRELLIS:START -->";
|
|
16
|
+
export declare const LEGACY_TRELLIS_BLOCK_END = "<!-- TRELLIS:END -->";
|
|
17
|
+
/** Extract the first block delimited by `startMarker`/`endMarker`, or null. */
|
|
18
|
+
export declare function extractBlock(content: string, startMarker: string, endMarker: string): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Insert or refresh the CSTL managed block in `existingContent` WITHOUT
|
|
21
|
+
* touching an upstream TRELLIS block or user content outside the blocks.
|
|
22
|
+
*
|
|
23
|
+
* - If `existingContent` already has a CSTL block → replace just that block.
|
|
24
|
+
* - Else if it has a legacy TRELLIS block → insert the CSTL block right after
|
|
25
|
+
* the TRELLIS block (coexistence with upstream Trellis).
|
|
26
|
+
* - Else → append the CSTL block at the end.
|
|
27
|
+
*
|
|
28
|
+
* `templateContent` must contain a CSTL block; its block is extracted and used
|
|
29
|
+
* as the inserted/refreshed CSTL block content. If `templateContent` has no
|
|
30
|
+
* CSTL block, the whole `templateContent` is used as the block (fallback).
|
|
31
|
+
*/
|
|
32
|
+
export declare function insertCstlManagedBlock(existingContent: string, templateContent: string): string;
|
|
33
|
+
/** True if `content` contains a CSTL managed block. */
|
|
34
|
+
export declare function hasCstlBlock(content: string): boolean;
|
|
35
|
+
/** True if `content` contains a legacy TRELLIS managed block. */
|
|
36
|
+
export declare function hasLegacyTrellisBlock(content: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Remove the CSTL managed block from `content`, leaving any upstream TRELLIS
|
|
39
|
+
* block and user content untouched. Collapses the blank lines left behind so
|
|
40
|
+
* the result reads naturally. Returns the content unchanged if no CSTL block
|
|
41
|
+
* is present.
|
|
42
|
+
*
|
|
43
|
+
* Used by `cstl uninstall` so a coexistence repo ends up with only the
|
|
44
|
+
* upstream TRELLIS block + user content after cursor-trellis is removed.
|
|
45
|
+
*/
|
|
46
|
+
export declare function removeCstlManagedBlock(content: string): string;
|
|
47
|
+
//# sourceMappingURL=agents-md.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents-md.d.ts","sourceRoot":"","sources":["../../src/utils/agents-md.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AACtD,eAAO,MAAM,cAAc,sBAAsB,CAAC;AAClD,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AACnE,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D,+EAA+E;AAC/E,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAMf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,GACtB,MAAM,CAwCR;AAED,uDAAuD;AACvD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAMrD;AAED,iEAAiE;AACjE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAM9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAiB9D"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AGENTS.md managed-block helpers.
|
|
3
|
+
*
|
|
4
|
+
* cursor-trellis maintains a `<!-- CSTL:START -->...<!-- CSTL:END -->` block in
|
|
5
|
+
* AGENTS.md. Upstream mindfold-ai/Trellis maintains a separate
|
|
6
|
+
* `<!-- TRELLIS:START -->...<!-- TRELLIS:END -->` block. The two blocks can
|
|
7
|
+
* coexist in the same file so a repo can run upstream Trellis (other platforms)
|
|
8
|
+
* and cursor-trellis (Cursor) side by side.
|
|
9
|
+
*
|
|
10
|
+
* cursor-trellis never touches the upstream TRELLIS block or user content
|
|
11
|
+
* outside its own CSTL block.
|
|
12
|
+
*/
|
|
13
|
+
export const CSTL_BLOCK_START = "<!-- CSTL:START -->";
|
|
14
|
+
export const CSTL_BLOCK_END = "<!-- CSTL:END -->";
|
|
15
|
+
export const LEGACY_TRELLIS_BLOCK_START = "<!-- TRELLIS:START -->";
|
|
16
|
+
export const LEGACY_TRELLIS_BLOCK_END = "<!-- TRELLIS:END -->";
|
|
17
|
+
/** Extract the first block delimited by `startMarker`/`endMarker`, or null. */
|
|
18
|
+
export function extractBlock(content, startMarker, endMarker) {
|
|
19
|
+
const start = content.indexOf(startMarker);
|
|
20
|
+
if (start === -1)
|
|
21
|
+
return null;
|
|
22
|
+
const end = content.indexOf(endMarker, start);
|
|
23
|
+
if (end === -1)
|
|
24
|
+
return null;
|
|
25
|
+
return content.slice(start, end + endMarker.length);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Insert or refresh the CSTL managed block in `existingContent` WITHOUT
|
|
29
|
+
* touching an upstream TRELLIS block or user content outside the blocks.
|
|
30
|
+
*
|
|
31
|
+
* - If `existingContent` already has a CSTL block → replace just that block.
|
|
32
|
+
* - Else if it has a legacy TRELLIS block → insert the CSTL block right after
|
|
33
|
+
* the TRELLIS block (coexistence with upstream Trellis).
|
|
34
|
+
* - Else → append the CSTL block at the end.
|
|
35
|
+
*
|
|
36
|
+
* `templateContent` must contain a CSTL block; its block is extracted and used
|
|
37
|
+
* as the inserted/refreshed CSTL block content. If `templateContent` has no
|
|
38
|
+
* CSTL block, the whole `templateContent` is used as the block (fallback).
|
|
39
|
+
*/
|
|
40
|
+
export function insertCstlManagedBlock(existingContent, templateContent) {
|
|
41
|
+
const block = extractBlock(templateContent, CSTL_BLOCK_START, CSTL_BLOCK_END) ??
|
|
42
|
+
templateContent;
|
|
43
|
+
// Case 1: existing already has a CSTL block → replace it in place.
|
|
44
|
+
const cstlStart = existingContent.indexOf(CSTL_BLOCK_START);
|
|
45
|
+
if (cstlStart !== -1) {
|
|
46
|
+
const cstlEnd = existingContent.indexOf(CSTL_BLOCK_END, cstlStart);
|
|
47
|
+
if (cstlEnd !== -1) {
|
|
48
|
+
return (existingContent.slice(0, cstlStart) +
|
|
49
|
+
block +
|
|
50
|
+
existingContent.slice(cstlEnd + CSTL_BLOCK_END.length));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Case 2: existing has a legacy TRELLIS block → coexist: insert CSTL block
|
|
54
|
+
// immediately after the TRELLIS block. Never modify the TRELLIS block.
|
|
55
|
+
const trellisStart = existingContent.indexOf(LEGACY_TRELLIS_BLOCK_START);
|
|
56
|
+
if (trellisStart !== -1) {
|
|
57
|
+
const trellisEnd = existingContent.indexOf(LEGACY_TRELLIS_BLOCK_END, trellisStart);
|
|
58
|
+
if (trellisEnd !== -1) {
|
|
59
|
+
const after = trellisEnd + LEGACY_TRELLIS_BLOCK_END.length;
|
|
60
|
+
return (existingContent.slice(0, after) +
|
|
61
|
+
"\n\n" +
|
|
62
|
+
block +
|
|
63
|
+
existingContent.slice(after));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Case 3: no managed block → append at end, preserving any user content.
|
|
67
|
+
const trimmed = existingContent.replace(/\s+$/, "");
|
|
68
|
+
return `${trimmed}\n\n${block}\n`;
|
|
69
|
+
}
|
|
70
|
+
/** True if `content` contains a CSTL managed block. */
|
|
71
|
+
export function hasCstlBlock(content) {
|
|
72
|
+
return (content.includes(CSTL_BLOCK_START) &&
|
|
73
|
+
content.indexOf(CSTL_BLOCK_END) >
|
|
74
|
+
content.indexOf(CSTL_BLOCK_START));
|
|
75
|
+
}
|
|
76
|
+
/** True if `content` contains a legacy TRELLIS managed block. */
|
|
77
|
+
export function hasLegacyTrellisBlock(content) {
|
|
78
|
+
return (content.includes(LEGACY_TRELLIS_BLOCK_START) &&
|
|
79
|
+
content.indexOf(LEGACY_TRELLIS_BLOCK_END) >
|
|
80
|
+
content.indexOf(LEGACY_TRELLIS_BLOCK_START));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Remove the CSTL managed block from `content`, leaving any upstream TRELLIS
|
|
84
|
+
* block and user content untouched. Collapses the blank lines left behind so
|
|
85
|
+
* the result reads naturally. Returns the content unchanged if no CSTL block
|
|
86
|
+
* is present.
|
|
87
|
+
*
|
|
88
|
+
* Used by `cstl uninstall` so a coexistence repo ends up with only the
|
|
89
|
+
* upstream TRELLIS block + user content after cursor-trellis is removed.
|
|
90
|
+
*/
|
|
91
|
+
export function removeCstlManagedBlock(content) {
|
|
92
|
+
const startIdx = content.indexOf(CSTL_BLOCK_START);
|
|
93
|
+
if (startIdx === -1) {
|
|
94
|
+
return content;
|
|
95
|
+
}
|
|
96
|
+
const endIdx = content.indexOf(CSTL_BLOCK_END, startIdx);
|
|
97
|
+
if (endIdx === -1) {
|
|
98
|
+
return content;
|
|
99
|
+
}
|
|
100
|
+
const before = content.slice(0, startIdx);
|
|
101
|
+
const after = content.slice(endIdx + CSTL_BLOCK_END.length);
|
|
102
|
+
// Collapse up to one blank-line gap on each side so we don't leave a run of
|
|
103
|
+
// 4+ newlines, but never trim away meaningful separator lines.
|
|
104
|
+
return (before.replace(/\n{2,}$/, "\n\n") +
|
|
105
|
+
after.replace(/^\n{2,}/, "\n\n")).replace(/^\n{2,}/, "\n");
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=agents-md.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents-md.js","sourceRoot":"","sources":["../../src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B,CAAC,OAAe;IACpD,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnD,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;QACpB,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACzD,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;QAClB,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAC5D,4EAA4E;IAC5E,+DAA+D;IAC/D,OAAO,CACL,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;QACjC,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CACjC,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -187,7 +187,7 @@ function policyVerification() {
|
|
|
187
187
|
return [
|
|
188
188
|
{
|
|
189
189
|
id: "policy-doc-top1",
|
|
190
|
-
requirement: "For policy/document intents, confirm Top-1 policy evidence from AGENTS.md or .
|
|
190
|
+
requirement: "For policy/document intents, confirm Top-1 policy evidence from AGENTS.md or .cstl/spec before ranking implementation modules first.",
|
|
191
191
|
appliesToRoles: ["exact", "semantic"],
|
|
192
192
|
},
|
|
193
193
|
{
|
|
@@ -345,7 +345,7 @@ function orderedRoutesForIntents(intents, includeOptionalAdapters, projectFileCo
|
|
|
345
345
|
role: "exact",
|
|
346
346
|
sourceFamily: "policy-docs",
|
|
347
347
|
commands: [
|
|
348
|
-
'rg -i "storage default|sidecar|sqlite only" AGENTS.md "**/AGENTS.md" README.md CONTRIBUTING.md .
|
|
348
|
+
'rg -i "storage default|sidecar|sqlite only" AGENTS.md "**/AGENTS.md" README.md CONTRIBUTING.md .cstl/spec',
|
|
349
349
|
],
|
|
350
350
|
rationale: "Policy/document intent: search instruction and spec docs first.",
|
|
351
351
|
});
|
|
@@ -369,7 +369,7 @@ function orderedRoutesForIntents(intents, includeOptionalAdapters, projectFileCo
|
|
|
369
369
|
role: "exact",
|
|
370
370
|
sourceFamily: "policy-docs",
|
|
371
371
|
commands: [
|
|
372
|
-
'rg -i "storage default|sidecar|sqlite only" AGENTS.md "**/AGENTS.md" README.md CONTRIBUTING.md .
|
|
372
|
+
'rg -i "storage default|sidecar|sqlite only" AGENTS.md "**/AGENTS.md" README.md CONTRIBUTING.md .cstl/spec',
|
|
373
373
|
],
|
|
374
374
|
rationale: "Policy/document intent: search instruction and spec docs first.",
|
|
375
375
|
});
|
|
@@ -395,7 +395,7 @@ function orderedRoutesForIntents(intents, includeOptionalAdapters, projectFileCo
|
|
|
395
395
|
role: "exact",
|
|
396
396
|
sourceFamily: "policy-docs",
|
|
397
397
|
commands: [
|
|
398
|
-
'rg -i "storage default|sidecar|sqlite only" AGENTS.md "**/AGENTS.md" README.md CONTRIBUTING.md .
|
|
398
|
+
'rg -i "storage default|sidecar|sqlite only" AGENTS.md "**/AGENTS.md" README.md CONTRIBUTING.md .cstl/spec',
|
|
399
399
|
],
|
|
400
400
|
rationale: "Policy/document branch after exact-primary when both intents match.",
|
|
401
401
|
});
|
|
@@ -547,7 +547,7 @@ function buildFallbackHints(intents, includeOptionalAdapters, routes, cursorEnv
|
|
|
547
547
|
if (intents.some((i) => i.id === "policy-document")) {
|
|
548
548
|
hints.push({
|
|
549
549
|
when: "semantic Top-1 is implementation-only for policy query",
|
|
550
|
-
action: "Fall back to policy-doc rg route and AGENTS.md/.
|
|
550
|
+
action: "Fall back to policy-doc rg route and AGENTS.md/.cstl/spec reads before accepting semantic ranking.",
|
|
551
551
|
replacesRole: "semantic",
|
|
552
552
|
});
|
|
553
553
|
}
|