ctask list shows tasks by default and projects with --projects.
--all controls archived visibility (independent of --projects),
so the four combinations work as the spec defines:
- ctask list active tasks
- ctask list --all active + archived tasks
- ctask list --projects active projects
- ctask list --projects --all active + archived projects
Empty-result message reflects the active filter.
ListOpts gains a Projects bool that filters by EffectiveType.
Default behavior (Projects: false) now returns tasks only --
this is a deliberate semantic change that supports the new
'ctask list' (tasks) vs 'ctask list --projects' (projects)
spec.
The change silently regresses two cmd-level callers that scan
for "the most recently updated workspace": cmd/last.go (used by
'ctask last') and cmd/delete.go (used to print the "this was
your most recent workspace" note). Both are fixed by unioning a
tasks-scan with a projects-scan, so 'last' and 'delete' continue
to consider both types.
Test helper createTestWorkspaceTyped allows setting an explicit
type (or "" to simulate a v0.2 workspace with no type field).
After Create() returns, project mode now:
1. Runs git init (or prints "git not found; skipped..." if git
is unavailable)
2. Calls EnsureGitignore, which is a no-op when a seed already
supplied .gitignore (preserving the seed-wins rule end-to-end)
Both git unavailability and git init failure are non-fatal: ctask
warns and continues, so a missing/broken git toolchain never blocks
project creation.
EnsureGitignore writes a minimal .gitignore (.ctask/ +
logs/sessions.log) iff one does not already exist. This is the
file-system half of the v0.3 seed-wins rule for .gitignore: if
either the general or project seed copied a .gitignore into the
workspace, EnsureGitignore must be a no-op.
GitAvailable + RunGitInit wrap exec.LookPath("git") and `git init`
respectively, so the caller in cmd/new.go can decide whether to
print the informational note when git is missing.
Tests cover:
- missing -> created with the minimal body
- present -> preserved verbatim
- integration: general seed .gitignore preserved end-to-end
- integration: project seed .gitignore preserved end-to-end
- integration: no seed -> minimal body created
ctask new gains --project, which:
- records type=project on the workspace
- defaults the category to "projects"
- applies general + project seed overlays
- uses CTASK_PROJECT_ROOT when set, with no doubled "projects/"
path unless the user explicitly passes -c
- exports CTASK_TYPE=project into the child session
EnvVars now takes a taskType arg and exports CTASK_TYPE. Empty
type defaults to "task" for safety. resume/open also pass
EffectiveType so the env var is correct on resume of a v0.2
workspace.
Git init for project mode is wired in the next commit.
When SkipCategoryDir is true, Create places the workspace directly
under Root and does not append a Category subdirectory. This is the
mechanism that prevents doubled paths like
~/projects/projects/<slug> when the user sets CTASK_PROJECT_ROOT
without an explicit -c flag. The Category value is still recorded
on TaskMeta so list/info/filter still work.
CreateOpts gains IsProject, SeedDir, and ProjectSeedDir. The new
seeding flow is:
1. write built-in defaults (task or project CLAUDE.md + notes.md)
2. apply general seed if SeedDir != "" (overlay)
3. apply project seed if IsProject && ProjectSeedDir != "" (overlay)
4. write task.yaml (last, so seeds can never inject metadata)
The obsolete TestCreateDoesNotOverwriteSeedFiles test is removed:
its v0.2 invariant ("don't overwrite existing files") no longer
holds because v0.3 always lays defaults onto a fresh dir and seeds
are expected to overwrite.
TaskMeta now records type: task or type: project. EffectiveType
returns 'task' for missing/empty/unknown values and for nil meta,
so v0.2 workspaces continue to read as tasks without any
migration. The field is placed between Category and Mode in the
YAML output. Tests cover the round-trip and the legacy
no-type-field case.
CopySeedDir is the v0.3 user seed overlay primitive: recursive copy
from a seed directory to a workspace, overwriting destination
files. task.yaml and the .ctask metadata directory at the seed root
are intentionally skipped so a stale or hostile seed cannot
overwrite ctask-owned state. Missing src is a no-op (the seed
directory is optional).
ResolveSeedDir, ResolveProjectSeedDir, and ResolveProjectRoot read
the v0.3 environment variables (CTASK_SEED_DIR,
CTASK_SEED_PROJECT_DIR, CTASK_PROJECT_ROOT) and fall back to
platform defaults under %APPDATA%\ctask or ~/.config/ctask. The
expandPath helper handles tilde expansion + abs-path resolution
once for all resolvers.
ClaudeMDProject returns the project-oriented default used when
--project is passed (and no project seed overrides it). Adds tests
asserting required v0.3 spec sections and ASCII-only content.
Replaces the v0.2 task-scoped template with the v0.3 workspace
guidelines (file placement conventions + session handoff).
ClaudeMD signature is preserved for API compatibility; the
parameters are no longer interpolated.
When the status-line helper is found but Claude settings are misconfigured,
the fix suggestion now shows the real path (e.g. /c/Users/Warren/...) instead
of a <you> placeholder. Always suggests the .sh variant even if only .ps1
was found, since Claude Code runs statusLine through bash.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
justfile with build/install/uninstall/test targets. CLAUDE.md updated with
new install path and commands. status-line-setup.md updated for
%LOCALAPPDATA%\ctask\bin location.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds the canonical install location as the primary search path on Windows,
before falling back to GOPATH/bin. Updates the Claude config guidance message
to reference the new path.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removes only ctask-owned files from %LOCALAPPDATA%\ctask\bin. Removes PATH
entry only if .ctask-path-added marker exists (ownership tracking). Cleans
empty install directory. Never touches workspace data.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Builds from local repo, installs to %LOCALAPPDATA%\ctask\bin, adds to user
PATH with ownership marker (.ctask-path-added) for safe uninstall. Finds Go
in standard install location if not on PowerShell PATH.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add "Repository and Package Identity" rule to both the project-level CLAUDE.md
and the seeded CLAUDE.md template (internal/seed/templates.go). Every new ctask
workspace now inherits guidance against fabricating repo URLs, module paths,
GitHub identities, or remote install commands.
Also adds local-only build/install instructions and data safety invariant
documentation to the project-level CLAUDE.md.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Root cause: CTASK_WORKSPACE env var only exists inside the child session spawned
by ctask resume. A separate terminal window does not inherit it, so the env-var
check was bypassed entirely. os.RemoveAll then deleted all accessible files while
the root dir was locked by the active cmd.exe process.
Fix: Add a second protection check for .ctask/manifest-start.json, which is only
present during a live session. Both checks run before any mutation (summary scan,
confirmation, or deletion). Either check triggers immediate refusal.
Tests: 4 new tests covering manifest-based protection, no-file-mutation on refusal,
env-var protection, and normal deletion of inactive workspaces.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace box-drawing characters (U+2500) in session log with ASCII dashes.
Replace em dashes (U+2014) in CLAUDE.md template with double hyphens.
Remove em dash from comment in run.go.
Add ASCII-guard tests for session log output and seed templates.
Prevents mojibake on Windows terminals that misinterpret UTF-8 as CP1252.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contents summary, confirmation prompt, --force flag, --all for archived, refuses deletion of active session workspace.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Scans non-archived workspaces, finds highest updated_at, delegates to resume flow with session hooks.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Checks: workspace root, agent on PATH, status line helper, Claude settings, existing workspaces. Actionable fix guidance for each failure.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Advisory instructions to append a brief summary to notes.md before ending a session. Also update logs/ description from "reserved" to "automatic session snapshots".
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Refactor new/resume/open to use session.Run() which wraps child process launch with pre/post manifest capture and append-only session logging to logs/sessions.log. Bump version to 0.2.0.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Exit 2 for missing required arguments, exit 127 for agent not found. SilenceUsage on all commands to avoid dumping usage on runtime errors.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bash and PowerShell helpers for Claude Code statusLine. Setup docs with fallback note for non-Claude agents.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Complete command implementations with all flags per spec. Shared query resolution helper.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
DefaultShell, ExecAgent, ExecShell with prompt prefix. Banner, container notice. Tests for all helpers.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Create function produces full workspace layout (task.yaml, CLAUDE.md, notes.md, context/, output/, logs/). Seed files only written if missing. Collision suffixing tested.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Slugify, AutoTitle, DirName, ResolveDir with -2, -3 suffixing. Full test coverage.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
TaskMeta struct matching task.yaml schema exactly. Tests for roundtrip, field presence, and archive state.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Go module, cobra root command, config resolution (CTASK_ROOT, CTASK_AGENT, EnvVars) with tests.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>