@blxzer/cursor-trellis 0.2.9 → 0.3.2
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 +94 -0
- package/README.md +85 -19
- package/README.zh-CN.md +60 -21
- package/bin/smart-search.js +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +46 -18
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/capability-smoke.d.ts +24 -0
- package/dist/commands/capability-smoke.d.ts.map +1 -0
- package/dist/commands/capability-smoke.js +83 -0
- package/dist/commands/capability-smoke.js.map +1 -0
- 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 +197 -91
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/uninstall.d.ts +4 -4
- package/dist/commands/uninstall.js +12 -12
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.d.ts +7 -2
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +161 -61
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/upgrade.js +2 -2
- package/dist/commands/upgrade.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/cursor.d.ts +2 -2
- package/dist/configurators/cursor.js +4 -4
- package/dist/configurators/cursor.js.map +1 -1
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +4 -4
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/shared.d.ts +10 -10
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +32 -32
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/workflow.d.ts +6 -6
- 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.2.10.json +374 -0
- package/dist/migrations/manifests/0.3.0.json +89 -0
- package/dist/migrations/manifests/0.3.1.json +32 -0
- package/dist/templates/common/bundled-skills/{trellis-cursor2plus-setup → cstl-cursor2plus-setup}/SKILL.md +15 -14
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/SKILL.md +75 -75
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/add-project-local-conventions.md +19 -19
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-agents.md +8 -8
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-context-loading.md +26 -26
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-hooks.md +9 -9
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-skills-or-commands.md +8 -8
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-spec-structure.md +17 -17
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-task-lifecycle.md +46 -46
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/change-workflow.md +18 -18
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/customize-local/overview.md +55 -55
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/local-architecture/context-injection.md +20 -20
- package/dist/templates/common/bundled-skills/cstl-meta/references/local-architecture/generated-files.md +83 -0
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/local-architecture/overview.md +15 -15
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/local-architecture/spec-system.md +12 -12
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/local-architecture/task-system.md +34 -34
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/local-architecture/workflow.md +8 -8
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/local-architecture/workspace-memory.md +19 -19
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/platform-files/agents.md +12 -12
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/platform-files/hooks-and-settings.md +7 -7
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/platform-files/overview.md +9 -9
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/platform-files/platform-map.md +7 -7
- package/dist/templates/common/bundled-skills/{trellis-meta → cstl-meta}/references/platform-files/skills-and-commands.md +19 -19
- package/dist/templates/common/bundled-skills/{trellis-micro-grill → cstl-micro-grill}/SKILL.md +62 -47
- package/dist/templates/common/bundled-skills/{trellis-skill-creator → cstl-skill-creator}/SKILL.md +44 -44
- package/dist/templates/common/bundled-skills/{trellis-skill-creator → cstl-skill-creator}/references/authoring-rules.md +97 -97
- package/dist/templates/common/bundled-skills/{trellis-skill-creator/references/trellis-skill-locations.md → cstl-skill-creator/references/cstl-skill-locations.md} +52 -52
- package/dist/templates/common/bundled-skills/{trellis-skill-creator → cstl-skill-creator}/references/review-checklist.md +47 -47
- package/dist/templates/common/bundled-skills/{trellis-spec-bootstrap → cstl-spec-bootstrap}/SKILL.md +6 -6
- package/dist/templates/common/bundled-skills/{trellis-spec-bootstrap → cstl-spec-bootstrap}/references/repository-analysis.md +1 -1
- package/dist/templates/common/bundled-skills/{trellis-spec-bootstrap → cstl-spec-bootstrap}/references/spec-task-planning.md +3 -3
- package/dist/templates/common/bundled-skills/{trellis-spec-bootstrap → cstl-spec-bootstrap}/references/spec-writing.md +1 -1
- package/dist/templates/common/commands/continue.md +24 -24
- package/dist/templates/common/commands/finish-work.md +5 -5
- package/dist/templates/common/commands/start.md +20 -20
- package/dist/templates/common/index.d.ts +1 -1
- package/dist/templates/common/index.d.ts.map +1 -1
- package/dist/templates/common/skills/before-dev.md +4 -4
- package/dist/templates/common/skills/brainstorm.md +188 -164
- 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/{trellis-check.md → cstl-check.md} +14 -14
- package/dist/templates/cursor/agents/{trellis-implement.md → cstl-implement.md} +14 -14
- package/dist/templates/cursor/agents/{trellis-research.md → cstl-research.md} +11 -11
- package/dist/templates/cursor/commands/cursor2plus-setup.md +15 -15
- 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 +2 -2
- package/dist/templates/cursor/fixtures/expected-rules.js.map +1 -1
- package/dist/templates/cursor/rules/{trellis-subagent-dispatch.mdc → cstl-subagent-dispatch.mdc} +4 -4
- package/dist/templates/cursor/rules/{trellis-triage.mdc → cstl-triage.mdc} +3 -3
- 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 +13 -13
- 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 +634 -634
- package/dist/templates/markdown/spec/guides/cursor-context-injection-guide.md.txt +5 -5
- package/dist/templates/markdown/spec/guides/cursor-semantic-compliance.md.txt +7 -1
- package/dist/templates/markdown/spec/guides/cursor-subagent-policy.md.txt +393 -391
- package/dist/templates/markdown/spec/guides/durable-learning-decision-guide.md.txt +14 -14
- package/dist/templates/markdown/spec/guides/execution-strategy.md.txt +5 -5
- package/dist/templates/markdown/spec/guides/index.md.txt +3 -2
- 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 +2 -2
- package/dist/templates/shared-hooks/index.js +2 -2
- 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 +4 -4
- package/dist/templates/shared-hooks/inject-workflow-state.py +37 -37
- package/dist/templates/shared-hooks/research-end-retrieval-pack.py +2 -2
- package/dist/templates/shared-hooks/session-start.py +16 -16
- package/dist/templates/trellis/config/execution-strategy-rules.json +1 -1
- package/dist/templates/trellis/config.yaml +5 -25
- package/dist/templates/trellis/index.d.ts +2 -2
- package/dist/templates/trellis/index.js +2 -2
- package/dist/templates/trellis/local/README.md +15 -13
- package/dist/templates/trellis/local/patch_wpelc8.py +7 -7
- package/dist/templates/trellis/local/subagent-models.json.example +1 -1
- package/dist/templates/trellis/local/trellis-task-models.json.example +3 -3
- package/dist/templates/trellis/local/trellis-task-models.json5.example +5 -5
- package/dist/templates/trellis/local/trellis_task_models_config.py +6 -6
- 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/cli_adapter.py +3 -3
- 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/execution_strategy.py +1 -1
- package/dist/templates/trellis/scripts/common/packages_context.py +23 -23
- package/dist/templates/trellis/scripts/common/parent_orchestration.py +702 -702
- 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_context.py +1159 -1159
- 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 +7 -7
- 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 +2056 -2034
- package/dist/templates/trellis/scripts/common/task_store.py +1594 -1594
- 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 +805 -805
- package/dist/types/ai-tools.d.ts +1 -1
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +1 -1
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/types/migration.d.ts +1 -1
- package/dist/types/migration.d.ts.map +1 -1
- package/dist/utils/agents-md.d.ts +37 -0
- package/dist/utils/agents-md.d.ts.map +1 -0
- package/dist/utils/agents-md.js +82 -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.d.ts +14 -3
- package/dist/utils/project-capabilities.d.ts.map +1 -1
- package/dist/utils/project-capabilities.js +127 -17
- 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 +6 -3
- 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-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 +12 -10
- 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 +3 -4
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +0 -83
- /package/bin/{trellis.js → cstl.js} +0 -0
- /package/dist/templates/common/bundled-skills/{trellis-spec-bootstrap → cstl-spec-bootstrap}/references/mcp-setup.md +0 -0
|
@@ -22,7 +22,7 @@ from pathlib import Path
|
|
|
22
22
|
# =============================================================================
|
|
23
23
|
|
|
24
24
|
# Directory names
|
|
25
|
-
DIR_WORKFLOW = ".
|
|
25
|
+
DIR_WORKFLOW = ".cstl"
|
|
26
26
|
DIR_WORKSPACE = "workspace"
|
|
27
27
|
DIR_TASKS = "tasks"
|
|
28
28
|
DIR_ARCHIVE = "archive"
|
|
@@ -41,7 +41,7 @@ FILE_JOURNAL_PREFIX = "journal-"
|
|
|
41
41
|
# =============================================================================
|
|
42
42
|
|
|
43
43
|
def get_repo_root(start_path: Path | None = None) -> Path:
|
|
44
|
-
"""Find the nearest directory containing .
|
|
44
|
+
"""Find the nearest directory containing .cstl/ folder.
|
|
45
45
|
|
|
46
46
|
This handles nested git repos correctly (e.g., test project inside another repo).
|
|
47
47
|
|
|
@@ -49,7 +49,7 @@ def get_repo_root(start_path: Path | None = None) -> Path:
|
|
|
49
49
|
start_path: Starting directory to search from. Defaults to current directory.
|
|
50
50
|
|
|
51
51
|
Returns:
|
|
52
|
-
Path to repository root, or current directory if no .
|
|
52
|
+
Path to repository root, or current directory if no .cstl/ found.
|
|
53
53
|
"""
|
|
54
54
|
current = (start_path or Path.cwd()).resolve()
|
|
55
55
|
|
|
@@ -58,7 +58,7 @@ def get_repo_root(start_path: Path | None = None) -> Path:
|
|
|
58
58
|
return current
|
|
59
59
|
current = current.parent
|
|
60
60
|
|
|
61
|
-
# Fallback to current directory if no .
|
|
61
|
+
# Fallback to current directory if no .cstl/ found
|
|
62
62
|
return Path.cwd().resolve()
|
|
63
63
|
|
|
64
64
|
|
|
@@ -204,14 +204,14 @@ def count_lines(file_path: Path) -> int:
|
|
|
204
204
|
|
|
205
205
|
|
|
206
206
|
# =============================================================================
|
|
207
|
-
# Selected Task Management
|
|
207
|
+
# Selected Task Management
|
|
208
208
|
# =============================================================================
|
|
209
209
|
|
|
210
|
-
def normalize_task_ref(task_ref: str) -> str:
|
|
210
|
+
def normalize_task_ref(task_ref: str) -> str:
|
|
211
211
|
"""Normalize a task ref for stable runtime storage.
|
|
212
212
|
|
|
213
213
|
Stored refs should prefer repo-relative POSIX paths like
|
|
214
|
-
`.
|
|
214
|
+
`.cstl/tasks/03-27-my-task`, even on Windows. Absolute paths are preserved
|
|
215
215
|
unless they can later be converted back to repo-relative form by callers.
|
|
216
216
|
"""
|
|
217
217
|
normalized = task_ref.strip()
|
|
@@ -251,70 +251,70 @@ def resolve_task_ref(task_ref: str, repo_root: Path | None = None) -> Path | Non
|
|
|
251
251
|
return repo_root / DIR_WORKFLOW / DIR_TASKS / path_obj
|
|
252
252
|
|
|
253
253
|
|
|
254
|
-
def get_selected_task(
|
|
255
|
-
repo_root: Path | None = None,
|
|
256
|
-
platform_input: dict | None = None,
|
|
257
|
-
platform: str | None = None,
|
|
258
|
-
) -> str | None:
|
|
259
|
-
"""Get selected task directory path (relative to repo_root).
|
|
260
|
-
|
|
261
|
-
Args:
|
|
262
|
-
repo_root: Repository root path. Defaults to auto-detected.
|
|
263
|
-
|
|
264
|
-
Returns:
|
|
265
|
-
Relative path to selected task directory or None.
|
|
266
|
-
"""
|
|
267
|
-
if repo_root is None:
|
|
268
|
-
repo_root = get_repo_root()
|
|
269
|
-
|
|
270
|
-
from .active_task import resolve_selected_task
|
|
271
|
-
|
|
272
|
-
return resolve_selected_task(repo_root, platform_input, platform).task_path
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
def get_selected_task_abs(
|
|
276
|
-
repo_root: Path | None = None,
|
|
277
|
-
platform_input: dict | None = None,
|
|
278
|
-
platform: str | None = None,
|
|
279
|
-
) -> Path | None:
|
|
280
|
-
"""Get selected task directory absolute path.
|
|
281
|
-
|
|
282
|
-
Args:
|
|
283
|
-
repo_root: Repository root path. Defaults to auto-detected.
|
|
284
|
-
|
|
285
|
-
Returns:
|
|
286
|
-
Absolute path to selected task directory or None.
|
|
287
|
-
"""
|
|
288
|
-
if repo_root is None:
|
|
289
|
-
repo_root = get_repo_root()
|
|
290
|
-
|
|
291
|
-
relative = get_selected_task(repo_root, platform_input, platform)
|
|
292
|
-
if relative:
|
|
293
|
-
return resolve_task_ref(relative, repo_root)
|
|
294
|
-
return None
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
def get_selected_task_source(
|
|
298
|
-
repo_root: Path | None = None,
|
|
299
|
-
platform_input: dict | None = None,
|
|
300
|
-
platform: str | None = None,
|
|
301
|
-
) -> tuple[str, str | None, str | None]:
|
|
302
|
-
"""Get selected task source as (`source`, `context_key`, `task_path`)."""
|
|
303
|
-
if repo_root is None:
|
|
304
|
-
repo_root = get_repo_root()
|
|
305
|
-
|
|
306
|
-
from .active_task import get_selected_task_source as _get_source
|
|
307
|
-
|
|
308
|
-
return _get_source(repo_root, platform_input, platform)
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
def set_selected_task(
|
|
312
|
-
task_path: str,
|
|
313
|
-
repo_root: Path | None = None,
|
|
314
|
-
platform_input: dict | None = None,
|
|
315
|
-
platform: str | None = None,
|
|
316
|
-
) -> bool:
|
|
317
|
-
"""Set selected task in session scope.
|
|
254
|
+
def get_selected_task(
|
|
255
|
+
repo_root: Path | None = None,
|
|
256
|
+
platform_input: dict | None = None,
|
|
257
|
+
platform: str | None = None,
|
|
258
|
+
) -> str | None:
|
|
259
|
+
"""Get selected task directory path (relative to repo_root).
|
|
260
|
+
|
|
261
|
+
Args:
|
|
262
|
+
repo_root: Repository root path. Defaults to auto-detected.
|
|
263
|
+
|
|
264
|
+
Returns:
|
|
265
|
+
Relative path to selected task directory or None.
|
|
266
|
+
"""
|
|
267
|
+
if repo_root is None:
|
|
268
|
+
repo_root = get_repo_root()
|
|
269
|
+
|
|
270
|
+
from .active_task import resolve_selected_task
|
|
271
|
+
|
|
272
|
+
return resolve_selected_task(repo_root, platform_input, platform).task_path
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def get_selected_task_abs(
|
|
276
|
+
repo_root: Path | None = None,
|
|
277
|
+
platform_input: dict | None = None,
|
|
278
|
+
platform: str | None = None,
|
|
279
|
+
) -> Path | None:
|
|
280
|
+
"""Get selected task directory absolute path.
|
|
281
|
+
|
|
282
|
+
Args:
|
|
283
|
+
repo_root: Repository root path. Defaults to auto-detected.
|
|
284
|
+
|
|
285
|
+
Returns:
|
|
286
|
+
Absolute path to selected task directory or None.
|
|
287
|
+
"""
|
|
288
|
+
if repo_root is None:
|
|
289
|
+
repo_root = get_repo_root()
|
|
290
|
+
|
|
291
|
+
relative = get_selected_task(repo_root, platform_input, platform)
|
|
292
|
+
if relative:
|
|
293
|
+
return resolve_task_ref(relative, repo_root)
|
|
294
|
+
return None
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
def get_selected_task_source(
|
|
298
|
+
repo_root: Path | None = None,
|
|
299
|
+
platform_input: dict | None = None,
|
|
300
|
+
platform: str | None = None,
|
|
301
|
+
) -> tuple[str, str | None, str | None]:
|
|
302
|
+
"""Get selected task source as (`source`, `context_key`, `task_path`)."""
|
|
303
|
+
if repo_root is None:
|
|
304
|
+
repo_root = get_repo_root()
|
|
305
|
+
|
|
306
|
+
from .active_task import get_selected_task_source as _get_source
|
|
307
|
+
|
|
308
|
+
return _get_source(repo_root, platform_input, platform)
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
def set_selected_task(
|
|
312
|
+
task_path: str,
|
|
313
|
+
repo_root: Path | None = None,
|
|
314
|
+
platform_input: dict | None = None,
|
|
315
|
+
platform: str | None = None,
|
|
316
|
+
) -> bool:
|
|
317
|
+
"""Set selected task in session scope.
|
|
318
318
|
|
|
319
319
|
Args:
|
|
320
320
|
task_path: Task directory path (relative to repo_root).
|
|
@@ -326,22 +326,22 @@ def set_selected_task(
|
|
|
326
326
|
if repo_root is None:
|
|
327
327
|
repo_root = get_repo_root()
|
|
328
328
|
|
|
329
|
-
from .active_task import set_selected_task as _set_selected_task
|
|
330
|
-
|
|
331
|
-
return _set_selected_task(
|
|
332
|
-
task_path,
|
|
333
|
-
repo_root,
|
|
334
|
-
platform_input=platform_input,
|
|
329
|
+
from .active_task import set_selected_task as _set_selected_task
|
|
330
|
+
|
|
331
|
+
return _set_selected_task(
|
|
332
|
+
task_path,
|
|
333
|
+
repo_root,
|
|
334
|
+
platform_input=platform_input,
|
|
335
335
|
platform=platform,
|
|
336
336
|
) is not None
|
|
337
337
|
|
|
338
338
|
|
|
339
|
-
def clear_selected_task(
|
|
340
|
-
repo_root: Path | None = None,
|
|
341
|
-
platform_input: dict | None = None,
|
|
342
|
-
platform: str | None = None,
|
|
343
|
-
) -> bool:
|
|
344
|
-
"""Clear selected task in session scope.
|
|
339
|
+
def clear_selected_task(
|
|
340
|
+
repo_root: Path | None = None,
|
|
341
|
+
platform_input: dict | None = None,
|
|
342
|
+
platform: str | None = None,
|
|
343
|
+
) -> bool:
|
|
344
|
+
"""Clear selected task in session scope.
|
|
345
345
|
|
|
346
346
|
Args:
|
|
347
347
|
repo_root: Repository root path. Defaults to auto-detected.
|
|
@@ -352,36 +352,36 @@ def clear_selected_task(
|
|
|
352
352
|
if repo_root is None:
|
|
353
353
|
repo_root = get_repo_root()
|
|
354
354
|
|
|
355
|
-
from .active_task import clear_selected_task as _clear_selected_task
|
|
356
|
-
|
|
357
|
-
_clear_selected_task(
|
|
358
|
-
repo_root,
|
|
359
|
-
platform_input=platform_input,
|
|
360
|
-
platform=platform,
|
|
355
|
+
from .active_task import clear_selected_task as _clear_selected_task
|
|
356
|
+
|
|
357
|
+
_clear_selected_task(
|
|
358
|
+
repo_root,
|
|
359
|
+
platform_input=platform_input,
|
|
360
|
+
platform=platform,
|
|
361
361
|
)
|
|
362
362
|
return True
|
|
363
363
|
|
|
364
364
|
|
|
365
|
-
def has_selected_task(repo_root: Path | None = None) -> bool:
|
|
366
|
-
"""Check if a selected task exists.
|
|
365
|
+
def has_selected_task(repo_root: Path | None = None) -> bool:
|
|
366
|
+
"""Check if a selected task exists.
|
|
367
367
|
|
|
368
368
|
Args:
|
|
369
369
|
repo_root: Repository root path. Defaults to auto-detected.
|
|
370
370
|
|
|
371
371
|
Returns:
|
|
372
|
-
True if selected task is set.
|
|
373
|
-
"""
|
|
374
|
-
return get_selected_task(repo_root) is not None
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
# Internal compatibility aliases. New user-facing code should use selected-task
|
|
378
|
-
# names; existing internal helpers can migrate incrementally.
|
|
379
|
-
get_current_task = get_selected_task
|
|
380
|
-
get_current_task_abs = get_selected_task_abs
|
|
381
|
-
get_current_task_source = get_selected_task_source
|
|
382
|
-
set_current_task = set_selected_task
|
|
383
|
-
clear_current_task = clear_selected_task
|
|
384
|
-
has_current_task = has_selected_task
|
|
372
|
+
True if selected task is set.
|
|
373
|
+
"""
|
|
374
|
+
return get_selected_task(repo_root) is not None
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
# Internal compatibility aliases. New user-facing code should use selected-task
|
|
378
|
+
# names; existing internal helpers can migrate incrementally.
|
|
379
|
+
get_current_task = get_selected_task
|
|
380
|
+
get_current_task_abs = get_selected_task_abs
|
|
381
|
+
get_current_task_source = get_selected_task_source
|
|
382
|
+
set_current_task = set_selected_task
|
|
383
|
+
clear_current_task = clear_selected_task
|
|
384
|
+
has_current_task = has_selected_task
|
|
385
385
|
|
|
386
386
|
|
|
387
387
|
# =============================================================================
|
|
@@ -405,8 +405,8 @@ def generate_task_date_prefix() -> str:
|
|
|
405
405
|
def get_spec_dir(package: str | None = None, repo_root: Path | None = None) -> Path:
|
|
406
406
|
"""Get the spec directory path.
|
|
407
407
|
|
|
408
|
-
Single-repo: .
|
|
409
|
-
Monorepo with package: .
|
|
408
|
+
Single-repo: .cstl/spec
|
|
409
|
+
Monorepo with package: .cstl/spec/<package>
|
|
410
410
|
|
|
411
411
|
Uses lazy import to avoid circular dependency with config.py.
|
|
412
412
|
"""
|
|
@@ -454,4 +454,4 @@ if __name__ == "__main__":
|
|
|
454
454
|
print(f"Tasks dir: {get_tasks_dir(repo)}")
|
|
455
455
|
print(f"Workspace dir: {get_workspace_dir(repo)}")
|
|
456
456
|
print(f"Journal file: {get_active_journal_file(repo)}")
|
|
457
|
-
print(f"Selected task: {get_selected_task(repo)}")
|
|
457
|
+
print(f"Selected task: {get_selected_task(repo)}")
|
|
@@ -181,7 +181,7 @@ def _cursor_step_for_route(
|
|
|
181
181
|
|
|
182
182
|
if route_id == "policy-docs-rg" or str(route.get("sourceFamily")) == "policy-docs":
|
|
183
183
|
return (
|
|
184
|
-
"使用 **Grep** 在 `AGENTS.md`、`**/AGENTS.md`、`.
|
|
184
|
+
"使用 **Grep** 在 `AGENTS.md`、`**/AGENTS.md`、`.cstl/spec`、`README.md` "
|
|
185
185
|
"中搜索策略/边界关键词。"
|
|
186
186
|
)
|
|
187
187
|
|
|
@@ -3,24 +3,24 @@ Safe git-add helpers for Trellis-owned paths.
|
|
|
3
3
|
|
|
4
4
|
Why this module exists
|
|
5
5
|
----------------------
|
|
6
|
-
A real user incident: a project's `.gitignore` listed `.
|
|
6
|
+
A real user incident: a project's `.gitignore` listed `.cstl/` (company-wide
|
|
7
7
|
template / personal habit). When `add_session.py` and `task.py archive` ran
|
|
8
8
|
their auto-commit and `git add` failed with `ignored by .gitignore`, the AI
|
|
9
9
|
agent driving the workflow "fixed" it by retrying with
|
|
10
|
-
`git add -f .
|
|
11
|
-
(`.
|
|
12
|
-
`.
|
|
10
|
+
`git add -f .cstl/` — which fan-out-included every ignored subtree
|
|
11
|
+
(`.cstl/.backup-*/`, `.cstl/worktrees/`, `.cstl/.template-hashes.json`,
|
|
12
|
+
`.cstl/.runtime/`), committing 548 files / 83474 lines of caches/backups.
|
|
13
13
|
|
|
14
14
|
Design
|
|
15
15
|
------
|
|
16
16
|
- Scripts only stage SPECIFIC product paths (journal files, index.md, the
|
|
17
|
-
current task dir, the archive dir). Never the whole `.
|
|
17
|
+
current task dir, the archive dir). Never the whole `.cstl/` tree.
|
|
18
18
|
- If plain `git add <specific>` fails with "ignored by", DO NOT retry with
|
|
19
|
-
``-f``. The presence of `.
|
|
20
|
-
intent ("keep .
|
|
19
|
+
``-f``. The presence of `.cstl/` in `.gitignore` is treated as user
|
|
20
|
+
intent ("keep .cstl/ local-only"). The script warns and skips the
|
|
21
21
|
auto-commit; users who want auto-staging can either fix their `.gitignore`
|
|
22
22
|
or set ``session_auto_commit: false`` and manage git themselves.
|
|
23
|
-
- The warning includes a negative example: ``Do NOT use `git add -f .
|
|
23
|
+
- The warning includes a negative example: ``Do NOT use `git add -f .cstl/` ...``
|
|
24
24
|
so any AI rereading the log doesn't reinvent the bug.
|
|
25
25
|
|
|
26
26
|
History note: 0.5.10 introduced an automatic ``git add -f`` retry on the
|
|
@@ -46,15 +46,15 @@ from .paths import (
|
|
|
46
46
|
)
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
# Paths under .
|
|
49
|
+
# Paths under .cstl/ that must NEVER be auto-staged. Listed here so the
|
|
50
50
|
# warning to the user can show concrete subpaths to ignore individually
|
|
51
|
-
# instead of ignoring the whole `.
|
|
51
|
+
# instead of ignoring the whole `.cstl/` tree.
|
|
52
52
|
TRELLIS_IGNORED_SUBPATHS = (
|
|
53
|
-
".
|
|
54
|
-
".
|
|
55
|
-
".
|
|
56
|
-
".
|
|
57
|
-
".
|
|
53
|
+
".cstl/.backup-*",
|
|
54
|
+
".cstl/worktrees/",
|
|
55
|
+
".cstl/.template-hashes.json",
|
|
56
|
+
".cstl/.runtime/",
|
|
57
|
+
".cstl/.cache/",
|
|
58
58
|
)
|
|
59
59
|
|
|
60
60
|
|
|
@@ -66,14 +66,14 @@ def safe_trellis_paths_to_add(repo_root: Path) -> list[str]:
|
|
|
66
66
|
checking afterwards.
|
|
67
67
|
|
|
68
68
|
Included:
|
|
69
|
-
- .
|
|
70
|
-
- .
|
|
71
|
-
- .
|
|
72
|
-
- .
|
|
69
|
+
- .cstl/workspace/<developer>/journal-*.md
|
|
70
|
+
- .cstl/workspace/<developer>/index.md
|
|
71
|
+
- .cstl/tasks/<task-dir>/ (every active task directory)
|
|
72
|
+
- .cstl/tasks/archive/ (whole archive subtree, if present)
|
|
73
73
|
|
|
74
74
|
Excluded (intentionally — these must not be staged):
|
|
75
|
-
- .
|
|
76
|
-
.
|
|
75
|
+
- .cstl/.backup-*, .cstl/worktrees/,
|
|
76
|
+
.cstl/.template-hashes.json, .cstl/.runtime/, .cstl/.cache/
|
|
77
77
|
"""
|
|
78
78
|
paths: list[str] = []
|
|
79
79
|
|
|
@@ -133,7 +133,7 @@ def safe_archive_paths_to_add(
|
|
|
133
133
|
commit boundary.
|
|
134
134
|
|
|
135
135
|
Backwards-compat: with no arguments, the function walks the whole
|
|
136
|
-
`.
|
|
136
|
+
`.cstl/tasks/` subtree the old way (active tasks + archive). New
|
|
137
137
|
callers should always pass `task_name`.
|
|
138
138
|
"""
|
|
139
139
|
paths: list[str] = []
|
|
@@ -206,11 +206,11 @@ def print_gitignore_warning(paths: list[str]) -> None:
|
|
|
206
206
|
"""Explain to the user (and any AI reading the log) what to do.
|
|
207
207
|
|
|
208
208
|
CRITICAL: includes the negative example
|
|
209
|
-
``Do NOT use `git add -f .
|
|
209
|
+
``Do NOT use `git add -f .cstl/``` — agents reading the warning are
|
|
210
210
|
known to invent that command, which fans out to ignored caches/backups.
|
|
211
211
|
"""
|
|
212
212
|
print(
|
|
213
|
-
"[WARN] git add failed because .
|
|
213
|
+
"[WARN] git add failed because .cstl/ paths are ignored by your .gitignore.",
|
|
214
214
|
file=sys.stderr,
|
|
215
215
|
)
|
|
216
216
|
print(
|
|
@@ -231,20 +231,20 @@ def print_gitignore_warning(paths: list[str]) -> None:
|
|
|
231
231
|
print(f"[WARN] {p}", file=sys.stderr)
|
|
232
232
|
else:
|
|
233
233
|
print(
|
|
234
|
-
"[WARN] .
|
|
234
|
+
"[WARN] .cstl/workspace/<developer>/{journal-*.md,index.md}",
|
|
235
235
|
file=sys.stderr,
|
|
236
236
|
)
|
|
237
237
|
print(
|
|
238
|
-
"[WARN] .
|
|
238
|
+
"[WARN] .cstl/tasks/<task-dir>/",
|
|
239
239
|
file=sys.stderr,
|
|
240
240
|
)
|
|
241
241
|
print(
|
|
242
|
-
"[WARN] .
|
|
242
|
+
"[WARN] .cstl/tasks/archive/",
|
|
243
243
|
file=sys.stderr,
|
|
244
244
|
)
|
|
245
245
|
print("[WARN]", file=sys.stderr)
|
|
246
246
|
print(
|
|
247
|
-
"[WARN] Recommended: change your .gitignore from `.
|
|
247
|
+
"[WARN] Recommended: change your .gitignore from `.cstl/` to specific",
|
|
248
248
|
file=sys.stderr,
|
|
249
249
|
)
|
|
250
250
|
print(
|
|
@@ -255,11 +255,11 @@ def print_gitignore_warning(paths: list[str]) -> None:
|
|
|
255
255
|
print(f"[WARN] {sub}", file=sys.stderr)
|
|
256
256
|
print("[WARN]", file=sys.stderr)
|
|
257
257
|
print(
|
|
258
|
-
"[WARN] Or, if you intentionally keep .
|
|
258
|
+
"[WARN] Or, if you intentionally keep .cstl/ local-only, set in",
|
|
259
259
|
file=sys.stderr,
|
|
260
260
|
)
|
|
261
261
|
print(
|
|
262
|
-
"[WARN] .
|
|
262
|
+
"[WARN] .cstl/config.yaml:",
|
|
263
263
|
file=sys.stderr,
|
|
264
264
|
)
|
|
265
265
|
print(
|
|
@@ -276,7 +276,7 @@ def print_gitignore_warning(paths: list[str]) -> None:
|
|
|
276
276
|
)
|
|
277
277
|
print("[WARN]", file=sys.stderr)
|
|
278
278
|
print(
|
|
279
|
-
"[WARN] Do NOT use `git add -f .
|
|
279
|
+
"[WARN] Do NOT use `git add -f .cstl/` — it pulls in backups, worktrees,",
|
|
280
280
|
file=sys.stderr,
|
|
281
281
|
)
|
|
282
282
|
print(
|