Skip to content
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
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ sce doctor # verify the install is healthy

`sce setup` writes OpenCode, Claude Code, and/or Pi config into your repo, installs the required git hooks, and initializes the per-repo Agent Trace database. Use `sce setup --pi` for Pi only, or `sce setup --all` for OpenCode + Claude Code + Pi. `sce doctor` is read-only by default; `sce doctor --fix` will repair the issues it knows how to repair (missing or stale hooks, missing canonical DB parent directories) and report the rest for manual follow-up.

With plain `sce setup`, after choosing targets and optional workflows, answer two independent confirmations:

```text
Enable automatic Agent Trace synchronization? [Y/n]
Enable SCE commit attribution trailers? [Y/n]
```

Both default to Yes, so pressing Enter enables that choice; answering `n` disables only the corresponding behavior. A successful target setup persists the answers in `.sce/config.json`:

```json
{
"agent_trace": { "auto_sync": true },
"policies": { "attribution_hooks": { "enabled": true } }
}
```

Non-interactive setup asks no questions. It explicitly enables both behaviors only when creating a missing repo-local config; an existing config's behavior values and omissions are not changed merely by a non-interactive run. Runtime precedence and hook behavior remain unchanged: `agent_trace.auto_sync` is config-file-only with omitted fallback `false`, while attribution can still be disabled by `SCE_ATTRIBUTION_HOOKS_DISABLED`, `SCE_DISABLED`, or its config value.

## Bash policy

**Stop agents from running commands your repo does not allow.**
Expand Down
13 changes: 3 additions & 10 deletions cli/src/services/config/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,6 @@ where
resolve_global_config_path,
)?;

if !runtime.validation_errors.is_empty() {
bail!(
"Agent Trace storage config resolution failed because a discovered config file is invalid: {}",
runtime.validation_errors.join(" | ")
);
}

Ok(ResolvedAgentTraceStorageRuntimeConfig {
repository_id: runtime.agent_trace_repository_id.value,
repository_remote: runtime.agent_trace_repository_remote.value,
Expand Down Expand Up @@ -564,7 +557,7 @@ where
source: ValueSource::ConfigFile(value.source),
},
None => ResolvedValue {
value: true,
value: false,
source: ValueSource::Default,
},
};
Expand Down Expand Up @@ -907,10 +900,10 @@ mod tests {
}

#[test]
fn agent_trace_auto_sync_defaults_to_true() {
fn agent_trace_auto_sync_defaults_to_false_when_missing() {
let runtime = resolve_runtime_with_config(None).unwrap();

assert!(runtime.agent_trace_auto_sync.value);
assert!(!runtime.agent_trace_auto_sync.value);
assert_eq!(runtime.agent_trace_auto_sync.source, ValueSource::Default);
}

Expand Down
29 changes: 23 additions & 6 deletions cli/src/services/setup/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ impl SetupCommand {
// The repository root is resolved before any prompt so the interactive
// optional-workflow prompt can pre-check the persisted selection.
let repository_root = resolve_setup_repository(&setup_start_path)?;
setup::validate_existing_repo_local_config(&repository_root).map_err(CliError::runtime)?;

let setup_dispatch = if self.request.context_only {
None
Expand All @@ -45,7 +44,14 @@ impl SetupCommand {
setup::SetupDispatch::Proceed {
mode: resolved_mode,
optional_workflows,
} => Some((resolved_mode, optional_workflows)),
agent_trace_auto_sync,
attribution_hooks_enabled,
} => Some((
resolved_mode,
optional_workflows,
agent_trace_auto_sync,
attribution_hooks_enabled,
)),
setup::SetupDispatch::Cancelled => {
return Ok(setup::setup_cancelled_text());
}
Expand Down Expand Up @@ -85,16 +91,27 @@ impl SetupCommand {
}

// Handle config target installation (OpenCode/Claude assets).
if let Some((resolved_mode, prompted_optional_workflows)) = setup_dispatch {
if let Some((
resolved_mode,
prompted_optional_workflows,
agent_trace_auto_sync,
attribution_hooks_enabled,
)) = setup_dispatch
{
// A prompted selection is authoritative for the run; without one the
// `--workflow` selection (or, absent that, the persisted one) applies.
let optional_workflows = prompted_optional_workflows
.as_deref()
.or(self.request.optional_workflows.as_deref());

let setup_message =
setup::run_setup_for_mode(&repository_root, resolved_mode, optional_workflows)
.map_err(CliError::runtime)?;
let setup_message = setup::run_setup_for_mode(
&repository_root,
resolved_mode,
optional_workflows,
agent_trace_auto_sync,
attribution_hooks_enabled,
)
.map_err(CliError::runtime)?;
sections.push(setup_message);
}

Expand Down
Loading
Loading