Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cmd/dalcli/cmd_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import (
// appendHistoryBuffer writes a session record to history-buffer.
// Scribe dal will later merge this into .dal/{name}/history.md.
func appendHistoryBuffer(dalName, task, result, status string) {
bufferDir := "/workspace/history-buffer"
bufferDir := os.Getenv("DALCLI_HISTORY_BUFFER")
if bufferDir == "" {
bufferDir = "/workspace/history-buffer"
}
if _, err := os.Stat(bufferDir); err != nil {
return // history-buffer not mounted, skip silently
}
Expand Down
8 changes: 2 additions & 6 deletions cmd/dalcli/cmd_history_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ import (
)

func TestAppendHistoryBuffer_DirectCall(t *testing.T) {
if _, err := os.Stat("/workspace"); err != nil {
t.Skip("not in container environment")
}
bufDir := "/workspace/history-buffer"
os.MkdirAll(bufDir, 0755)
defer os.RemoveAll(bufDir)
bufDir := t.TempDir()
t.Setenv("DALCLI_HISTORY_BUFFER", bufDir)

appendHistoryBuffer("test-dal", "implement feature", "done", "완료")

Expand Down
5 changes: 4 additions & 1 deletion cmd/dalcli/cmd_propose.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ func proposeCmd(dalName string) *cobra.Command {
}

func proposeDecision(dalName, title, body string) error {
inboxDir := "/workspace/decisions/inbox"
inboxDir := os.Getenv("DALCLI_DECISIONS_INBOX")
if inboxDir == "" {
inboxDir = "/workspace/decisions/inbox"
}
if err := os.MkdirAll(inboxDir, 0755); err != nil {
return fmt.Errorf("inbox not available: %w", err)
}
Expand Down
11 changes: 2 additions & 9 deletions cmd/dalcli/cmd_propose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,8 @@ import (
)

func TestProposeDecision_DirectCall(t *testing.T) {
// proposeDecision writes to /workspace/decisions/inbox
// We can't easily redirect, but we can test it if /workspace exists
// Skip if /workspace doesn't exist (not in container)
inboxDir := "/workspace/decisions/inbox"
if _, err := os.Stat("/workspace"); err != nil {
t.Skip("not in container environment")
}
os.MkdirAll(inboxDir, 0755)
defer os.RemoveAll(inboxDir)
inboxDir := t.TempDir()
t.Setenv("DALCLI_DECISIONS_INBOX", inboxDir)

err := proposeDecision("test-dal", "test title", "test body")
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions cmd/dalcli/cmd_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ func TestIsActiveThread(t *testing.T) {
// ── autoGitWorkflow ──

func TestAutoGitWorkflow_NoWorkspace(t *testing.T) {
// Skip when /workspace has uncommitted changes — this test assumes a clean workspace.
if out, err := exec.Command("git", "-C", "/workspace", "status", "--porcelain").Output(); err == nil && len(strings.TrimSpace(string(out))) > 0 {
t.Skip("workspace has uncommitted changes")
}
result := autoGitWorkflow("test-dal")
if result != "" {
t.Errorf("expected empty for no workspace, got %q", result)
Expand Down
10 changes: 9 additions & 1 deletion cmd/dalcli/cmd_wisdom.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,17 @@ func wisdomCmd(dalName string) *cobra.Command {
return cmd
}

// wisdomInboxDir returns the inbox directory, allowing override via environment variable.
func wisdomInboxDir() string {
if d := os.Getenv("DALCLI_WISDOM_INBOX"); d != "" {
return d
}
return "/workspace/wisdom-inbox"
}

// proposeWisdom writes a wisdom proposal to wisdom-inbox.
func proposeWisdom(dalName, pattern, context string, isAntiPattern bool) error {
inboxDir := "/workspace/wisdom-inbox"
inboxDir := wisdomInboxDir()
if err := os.MkdirAll(inboxDir, 0755); err != nil {
return fmt.Errorf("wisdom inbox not available: %w", err)
}
Expand Down
16 changes: 4 additions & 12 deletions cmd/dalcli/cmd_wisdom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ import (
)

func TestProposeWisdom_DirectCall_Pattern(t *testing.T) {
if _, err := os.Stat("/workspace"); err != nil {
t.Skip("not in container environment")
}
inboxDir := "/workspace/wisdom-inbox"
os.MkdirAll(inboxDir, 0755)
defer os.RemoveAll(inboxDir)
inboxDir := t.TempDir()
t.Setenv("DALCLI_WISDOM_INBOX", inboxDir)

err := proposeWisdom("test-dal", "always test first", "prevents regressions", false)
if err != nil {
Expand All @@ -33,12 +29,8 @@ func TestProposeWisdom_DirectCall_Pattern(t *testing.T) {
}

func TestProposeWisdom_DirectCall_AntiPattern(t *testing.T) {
if _, err := os.Stat("/workspace"); err != nil {
t.Skip("not in container environment")
}
inboxDir := "/workspace/wisdom-inbox"
os.MkdirAll(inboxDir, 0755)
defer os.RemoveAll(inboxDir)
inboxDir := t.TempDir()
t.Setenv("DALCLI_WISDOM_INBOX", inboxDir)

err := proposeWisdom("test-dal", "force push", "destroys history", true)
if err != nil {
Expand Down
Loading