2026-02-17 13:39:47 -06:00
|
|
|
import { Command } from "commander";
|
|
|
|
|
import { onboard } from "./commands/onboard.js";
|
|
|
|
|
import { doctor } from "./commands/doctor.js";
|
2026-02-18 16:46:45 -06:00
|
|
|
import { envCommand } from "./commands/env.js";
|
2026-02-17 13:39:47 -06:00
|
|
|
import { configure } from "./commands/configure.js";
|
2026-02-23 19:43:52 -06:00
|
|
|
import { addAllowedHostname } from "./commands/allowed-hostname.js";
|
2026-02-17 20:46:07 -06:00
|
|
|
import { heartbeatRun } from "./commands/heartbeat-run.js";
|
2026-02-20 07:10:58 -06:00
|
|
|
import { runCommand } from "./commands/run.js";
|
2026-02-23 14:40:59 -06:00
|
|
|
import { bootstrapCeoInvite } from "./commands/auth-bootstrap-ceo.js";
|
2026-03-05 06:02:12 -06:00
|
|
|
import { dbBackupCommand } from "./commands/db-backup.js";
|
Add SSH environment support (#4358)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies
> - The environments subsystem already models execution environments,
but before this branch there was no end-to-end SSH-backed runtime path
for agents to actually run work against a remote box
> - That meant agents could be configured around environment concepts
without a reliable way to execute adapter sessions remotely, sync
workspace state, and preserve run context across supported adapters
> - We also need environment selection to participate in normal
Paperclip control-plane behavior: agent defaults, project/issue
selection, route validation, and environment probing
> - Because this capability is still experimental, the UI surface should
be easy to hide and easy to remove later without undoing the underlying
implementation
> - This pull request adds SSH environment execution support across the
runtime, adapters, routes, schema, and tests, then puts the visible
environment-management UI behind an experimental flag
> - The benefit is that we can validate real SSH-backed agent execution
now while keeping the user-facing controls safely gated until the
feature is ready to come out of experimentation
## What Changed
- Added SSH-backed execution target support in the shared adapter
runtime, including remote workspace preparation, skill/runtime asset
sync, remote session handling, and workspace restore behavior after
runs.
- Added SSH execution coverage for supported local adapters, plus remote
execution tests across Claude, Codex, Cursor, Gemini, OpenCode, and Pi.
- Added environment selection and environment-management backend support
needed for SSH execution, including route/service work, validation,
probing, and agent default environment persistence.
- Added CLI support for SSH environment lab verification and updated
related docs/tests.
- Added the `enableEnvironments` experimental flag and gated the
environment UI behind it on company settings, agent configuration, and
project configuration surfaces.
## Verification
- `pnpm exec vitest run
packages/adapters/claude-local/src/server/execute.remote.test.ts
packages/adapters/cursor-local/src/server/execute.remote.test.ts
packages/adapters/gemini-local/src/server/execute.remote.test.ts
packages/adapters/opencode-local/src/server/execute.remote.test.ts
packages/adapters/pi-local/src/server/execute.remote.test.ts`
- `pnpm exec vitest run server/src/__tests__/environment-routes.test.ts`
- `pnpm exec vitest run
server/src/__tests__/instance-settings-routes.test.ts`
- `pnpm exec vitest run ui/src/lib/new-agent-hire-payload.test.ts
ui/src/lib/new-agent-runtime-config.test.ts`
- `pnpm -r typecheck`
- `pnpm build`
- Manual verification on a branch-local dev server:
- enabled the experimental flag
- created an SSH environment
- created a Linux Claude agent using that environment
- confirmed a run executed on the Linux box and synced workspace changes
back
## Risks
- Medium: this touches runtime execution flow across multiple adapters,
so regressions would likely show up in remote session setup, workspace
sync, or environment selection precedence.
- The UI flag reduces exposure, but the underlying runtime and route
changes are still substantial and rely on migration correctness.
- The change set is broad across adapters, control-plane services,
migrations, and UI gating, so review should pay close attention to
environment-selection precedence and remote workspace lifecycle
behavior.
## Model Used
- OpenAI Codex via Paperclip's local Codex adapter, GPT-5-class coding
model with tool use and code execution in the local repo workspace. The
local adapter does not surface a more specific public model version
string in this branch workflow.
## Checklist
- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] If this change affects the UI, I have included before/after
screenshots
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will address all Greptile and reviewer comments before
requesting merge
2026-04-23 19:15:22 -07:00
|
|
|
import { registerEnvLabCommands } from "./commands/env-lab.js";
|
2026-02-20 07:10:58 -06:00
|
|
|
import { registerContextCommands } from "./commands/client/context.js";
|
|
|
|
|
import { registerCompanyCommands } from "./commands/client/company.js";
|
|
|
|
|
import { registerIssueCommands } from "./commands/client/issue.js";
|
|
|
|
|
import { registerAgentCommands } from "./commands/client/agent.js";
|
|
|
|
|
import { registerApprovalCommands } from "./commands/client/approval.js";
|
|
|
|
|
import { registerActivityCommands } from "./commands/client/activity.js";
|
|
|
|
|
import { registerDashboardCommands } from "./commands/client/dashboard.js";
|
2026-04-02 11:38:57 -05:00
|
|
|
import { registerRoutineCommands } from "./commands/routines.js";
|
2026-04-02 09:11:49 -05:00
|
|
|
import { registerFeedbackCommands } from "./commands/client/feedback.js";
|
Add secrets provider vaults and remote import (#5429)
## Thinking Path
> - Paperclip orchestrates AI-agent companies and needs secrets handling
to work across local development, hosted operators, and governed agent
execution.
> - The affected subsystem is the company-scoped secrets control plane:
database schema, server services/routes, CLI workflows, and the Secrets
settings UI.
> - The gap was that secrets were local-only and operators could not
manage provider vaults or import existing remote references without
exposing plaintext.
> - This branch adds provider vault configuration plus an AWS Secrets
Manager remote-import path while preserving company boundaries, binding
context, and audit trails.
> - I kept the PR to a single branch PR, removed unrelated
lockfile/package drift, rebased the full branch onto the current
`public-gh/master`, and addressed fresh Greptile findings.
> - The benefit is a reviewable implementation of provider-backed
secrets with focused tests covering provider selection, import
conflicts, deleted secret reuse, rotation guards, and AWS signing
behavior.
## What Changed
- Added provider vault support for company secrets, including provider
config storage, default vault handling, health checks, binding usage,
access events, and remote import preview/commit.
- Added an AWS Secrets Manager provider using SigV4 request signing,
bounded request timeouts, namespace guardrails, cached runtime
credential resolution, and external-reference linking without plaintext
reads.
- Added Secrets UI surfaces for vault management and remote import, plus
CLI/API documentation for setup and operations.
- Stabilized routine webhook secret binding paths and SSH
environment-driver fixture bindings discovered during verification.
- Addressed Greptile and CI findings: no lockfile/package drift,
monotonic migration metadata, disabled-vault default races, soft-deleted
secret hiding/recreate behavior, remove behavior with disabled vaults,
soft-deleted external-reference re-import, non-active rotation guards,
managed-secret soft deletion through PATCH, and per-call AWS SDK
credential client churn.
- Rebased this branch onto `public-gh/master` at `0e1a5828` and
force-pushed with lease to keep this as the single PR for the branch.
## Verification
- `git fetch public-gh master`
- `git rebase public-gh/master`
- `git diff --name-only public-gh/master...HEAD | grep
'^pnpm-lock\.yaml$' || true` confirmed `pnpm-lock.yaml` is not in the PR
diff.
- Confirmed migration ordering: master ends at `0081_optimal_dormammu`;
this PR adds `0082_dry_vision` and
`0083_company_secret_provider_configs`.
- Inspected migrations for repeat safety: new tables/indexes use `IF NOT
EXISTS`; foreign keys are guarded by `DO $$ ... IF NOT EXISTS`; column
additions use `ADD COLUMN IF NOT EXISTS`.
- `pnpm -r typecheck` passed before the Greptile follow-up commits.
- `pnpm test:run` ran the full stable Vitest path before the Greptile
follow-up commits; it completed with 3 timing-related failures under
parallel load: `codex-local-execute.test.ts`,
`cursor-local-execute.test.ts`, and `environment-service.test.ts`.
- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/codex-local-execute.test.ts
src/__tests__/cursor-local-execute.test.ts
src/__tests__/environment-service.test.ts` passed on targeted rerun
(`24/24`).
- `pnpm build` passed before the Greptile follow-up commits. Vite
reported existing chunk-size/dynamic-import warnings.
- After Greptile follow-up commits: `pnpm --filter @paperclipai/server
exec vitest run src/__tests__/secrets-service.test.ts` passed (`26/26`).
- After Greptile follow-up commits: `pnpm --filter @paperclipai/server
exec vitest run src/__tests__/aws-secrets-manager-provider.test.ts
src/__tests__/secrets-service.test.ts` passed (`39/39`).
- After Greptile follow-up commits: `pnpm --filter @paperclipai/server
typecheck` passed.
- Captured Storybook screenshots from `ui/storybook-static` for visual
review.
- Latest PR checks on `5ca3a5cf`: `policy`, serialized server suites
1/4-4/4, `Canary Dry Run`, `e2e`, `security/snyk`, and `Greptile Review`
pass; aggregate `verify` is still registering the completed child
checks.
- Greptile review loop continued through the latest requested pass; all
Greptile review threads are resolved and the latest `Greptile Review`
check on `5ca3a5cf` passed with 0 comments added.
## Screenshots
Before: the provider-vault and remote-import surfaces did not exist on
`master`; these are after-state screenshots from the Storybook fixtures.



## Risks
- Migration risk: this adds new secret provider tables and extends
existing secret rows. The migrations were checked for monotonic ordering
and idempotent guards, but reviewers should still inspect upgrade
behavior carefully.
- Provider risk: AWS support uses direct SigV4 requests. Automated tests
cover signing, request timeouts, vault-config selection, namespace
guardrails, pending-version archival, sanitized provider errors, and
service-level cleanup paths. A real-vault AWS smoke test remains
deployment validation for an operator with AWS credentials rather than
an unverified merge blocker in this local branch.
- UI risk: the Secrets page and import dialog are large new surfaces;
screenshots are included above for reviewer inspection.
- Verification risk: the full local stable test command hit
parallel-load timing failures, although the exact failed files passed
when rerun directly.
- Operational risk: remote import intentionally avoids plaintext reads;
operators must understand that imported external references resolve at
runtime and may fail if AWS permissions change.
> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.
## Model Used
- OpenAI Codex, GPT-5 coding agent with local shell/tool use in the
Paperclip worktree. Exact context-window size was not exposed by the
runtime.
## Checklist
- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [ ] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] If this change affects the UI, I have included before/after
screenshots
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will address all Greptile and reviewer comments before
requesting merge
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 18:22:17 -05:00
|
|
|
import { registerSecretCommands } from "./commands/client/secrets.js";
|
2026-03-02 14:20:37 -06:00
|
|
|
import { applyDataDirOverride, type DataDirOptionLike } from "./config/data-dir.js";
|
2026-03-10 10:08:13 -05:00
|
|
|
import { loadPaperclipEnvFile } from "./config/env.js";
|
2026-03-31 08:08:18 -05:00
|
|
|
import { initTelemetryFromConfigFile, flushTelemetry } from "./telemetry.js";
|
2026-03-10 10:08:13 -05:00
|
|
|
import { registerWorktreeCommands } from "./commands/worktree.js";
|
2026-03-14 13:58:43 -07:00
|
|
|
import { registerPluginCommands } from "./commands/client/plugin.js";
|
2026-03-23 07:48:03 -05:00
|
|
|
import { registerClientAuthCommands } from "./commands/client/auth.js";
|
2026-03-31 08:08:18 -05:00
|
|
|
import { cliVersion } from "./version.js";
|
2026-02-17 13:39:47 -06:00
|
|
|
|
|
|
|
|
const program = new Command();
|
2026-03-02 14:20:37 -06:00
|
|
|
const DATA_DIR_OPTION_HELP =
|
|
|
|
|
"Paperclip data directory root (isolates state from ~/.paperclip)";
|
2026-02-17 13:39:47 -06:00
|
|
|
|
|
|
|
|
program
|
2026-03-03 08:45:26 -06:00
|
|
|
.name("paperclipai")
|
2026-02-17 13:39:47 -06:00
|
|
|
.description("Paperclip CLI — setup, diagnose, and configure your instance")
|
2026-03-31 08:08:18 -05:00
|
|
|
.version(cliVersion);
|
2026-02-17 13:39:47 -06:00
|
|
|
|
2026-03-02 14:20:37 -06:00
|
|
|
program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
|
|
|
const options = actionCommand.optsWithGlobals() as DataDirOptionLike;
|
|
|
|
|
const optionNames = new Set(actionCommand.options.map((option) => option.attributeName()));
|
|
|
|
|
applyDataDirOverride(options, {
|
|
|
|
|
hasConfigOption: optionNames.has("config"),
|
|
|
|
|
hasContextOption: optionNames.has("context"),
|
|
|
|
|
});
|
2026-03-10 10:08:13 -05:00
|
|
|
loadPaperclipEnvFile(options.config);
|
2026-03-31 08:08:18 -05:00
|
|
|
initTelemetryFromConfigFile(options.config);
|
2026-03-02 14:20:37 -06:00
|
|
|
});
|
|
|
|
|
|
2026-02-17 13:39:47 -06:00
|
|
|
program
|
|
|
|
|
.command("onboard")
|
|
|
|
|
.description("Interactive first-run setup wizard")
|
|
|
|
|
.option("-c, --config <path>", "Path to config file")
|
2026-03-02 14:20:37 -06:00
|
|
|
.option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP)
|
2026-04-10 07:32:16 -05:00
|
|
|
.option("--bind <mode>", "Quickstart reachability preset (loopback, lan, tailnet)")
|
|
|
|
|
.option("-y, --yes", "Accept quickstart defaults (trusted local loopback unless --bind is set) and start immediately", false)
|
2026-03-03 10:24:34 -06:00
|
|
|
.option("--run", "Start Paperclip immediately after saving config", false)
|
2026-02-17 13:39:47 -06:00
|
|
|
.action(onboard);
|
|
|
|
|
|
|
|
|
|
program
|
|
|
|
|
.command("doctor")
|
|
|
|
|
.description("Run diagnostic checks on your Paperclip setup")
|
|
|
|
|
.option("-c, --config <path>", "Path to config file")
|
2026-03-02 14:20:37 -06:00
|
|
|
.option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP)
|
2026-02-17 13:39:47 -06:00
|
|
|
.option("--repair", "Attempt to repair issues automatically")
|
|
|
|
|
.alias("--fix")
|
|
|
|
|
.option("-y, --yes", "Skip repair confirmation prompts")
|
2026-02-20 07:10:58 -06:00
|
|
|
.action(async (opts) => {
|
|
|
|
|
await doctor(opts);
|
|
|
|
|
});
|
2026-02-17 13:39:47 -06:00
|
|
|
|
2026-02-18 16:46:45 -06:00
|
|
|
program
|
|
|
|
|
.command("env")
|
|
|
|
|
.description("Print environment variables for deployment")
|
|
|
|
|
.option("-c, --config <path>", "Path to config file")
|
2026-03-02 14:20:37 -06:00
|
|
|
.option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP)
|
2026-02-18 16:46:45 -06:00
|
|
|
.action(envCommand);
|
|
|
|
|
|
2026-02-17 13:39:47 -06:00
|
|
|
program
|
|
|
|
|
.command("configure")
|
|
|
|
|
.description("Update configuration sections")
|
|
|
|
|
.option("-c, --config <path>", "Path to config file")
|
2026-03-02 14:20:37 -06:00
|
|
|
.option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP)
|
2026-02-20 10:31:56 -06:00
|
|
|
.option("-s, --section <section>", "Section to configure (llm, database, logging, server, storage, secrets)")
|
2026-02-17 13:39:47 -06:00
|
|
|
.action(configure);
|
|
|
|
|
|
2026-03-05 06:02:12 -06:00
|
|
|
program
|
|
|
|
|
.command("db:backup")
|
|
|
|
|
.description("Create a one-off database backup using current config")
|
|
|
|
|
.option("-c, --config <path>", "Path to config file")
|
|
|
|
|
.option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP)
|
|
|
|
|
.option("--dir <path>", "Backup output directory (overrides config)")
|
|
|
|
|
.option("--retention-days <days>", "Retention window used for pruning", (value) => Number(value))
|
|
|
|
|
.option("--filename-prefix <prefix>", "Backup filename prefix", "paperclip")
|
|
|
|
|
.option("--json", "Print backup metadata as JSON")
|
|
|
|
|
.action(async (opts) => {
|
|
|
|
|
await dbBackupCommand(opts);
|
|
|
|
|
});
|
|
|
|
|
|
2026-02-23 19:43:52 -06:00
|
|
|
program
|
|
|
|
|
.command("allowed-hostname")
|
|
|
|
|
.description("Allow a hostname for authenticated/private mode access")
|
|
|
|
|
.argument("<host>", "Hostname to allow (for example dotta-macbook-pro)")
|
|
|
|
|
.option("-c, --config <path>", "Path to config file")
|
2026-03-02 14:20:37 -06:00
|
|
|
.option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP)
|
2026-02-23 19:43:52 -06:00
|
|
|
.action(addAllowedHostname);
|
|
|
|
|
|
2026-02-20 07:10:58 -06:00
|
|
|
program
|
|
|
|
|
.command("run")
|
|
|
|
|
.description("Bootstrap local setup (onboard + doctor) and run Paperclip")
|
|
|
|
|
.option("-c, --config <path>", "Path to config file")
|
2026-03-02 14:20:37 -06:00
|
|
|
.option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP)
|
2026-02-20 07:10:58 -06:00
|
|
|
.option("-i, --instance <id>", "Local instance id (default: default)")
|
2026-04-10 07:32:16 -05:00
|
|
|
.option("--bind <mode>", "On first run, use onboarding reachability preset (loopback, lan, tailnet)")
|
2026-02-20 07:10:58 -06:00
|
|
|
.option("--repair", "Attempt automatic repairs during doctor", true)
|
|
|
|
|
.option("--no-repair", "Disable automatic repairs during doctor")
|
|
|
|
|
.action(runCommand);
|
|
|
|
|
|
2026-02-17 20:46:07 -06:00
|
|
|
const heartbeat = program.command("heartbeat").description("Heartbeat utilities");
|
|
|
|
|
|
|
|
|
|
heartbeat
|
|
|
|
|
.command("run")
|
|
|
|
|
.description("Run one agent heartbeat and stream live logs")
|
|
|
|
|
.requiredOption("-a, --agent-id <agentId>", "Agent ID to invoke")
|
|
|
|
|
.option("-c, --config <path>", "Path to config file")
|
2026-03-02 14:20:37 -06:00
|
|
|
.option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP)
|
2026-02-20 07:10:58 -06:00
|
|
|
.option("--context <path>", "Path to CLI context file")
|
|
|
|
|
.option("--profile <name>", "CLI context profile name")
|
2026-02-17 21:12:31 -06:00
|
|
|
.option("--api-base <url>", "Base URL for the Paperclip server API")
|
2026-02-20 07:10:58 -06:00
|
|
|
.option("--api-key <token>", "Bearer token for agent-authenticated calls")
|
2026-02-17 20:46:07 -06:00
|
|
|
.option(
|
|
|
|
|
"--source <source>",
|
|
|
|
|
"Invocation source (timer | assignment | on_demand | automation)",
|
|
|
|
|
"on_demand",
|
|
|
|
|
)
|
|
|
|
|
.option("--trigger <trigger>", "Trigger detail (manual | ping | callback | system)", "manual")
|
|
|
|
|
.option("--timeout-ms <ms>", "Max time to wait before giving up", "0")
|
2026-02-20 07:10:58 -06:00
|
|
|
.option("--json", "Output raw JSON where applicable")
|
2026-02-18 13:02:12 -06:00
|
|
|
.option("--debug", "Show raw adapter stdout/stderr JSON chunks")
|
2026-02-17 20:46:07 -06:00
|
|
|
.action(heartbeatRun);
|
|
|
|
|
|
2026-02-20 07:10:58 -06:00
|
|
|
registerContextCommands(program);
|
|
|
|
|
registerCompanyCommands(program);
|
|
|
|
|
registerIssueCommands(program);
|
|
|
|
|
registerAgentCommands(program);
|
|
|
|
|
registerApprovalCommands(program);
|
|
|
|
|
registerActivityCommands(program);
|
|
|
|
|
registerDashboardCommands(program);
|
2026-04-02 11:38:57 -05:00
|
|
|
registerRoutineCommands(program);
|
2026-04-02 09:11:49 -05:00
|
|
|
registerFeedbackCommands(program);
|
Add secrets provider vaults and remote import (#5429)
## Thinking Path
> - Paperclip orchestrates AI-agent companies and needs secrets handling
to work across local development, hosted operators, and governed agent
execution.
> - The affected subsystem is the company-scoped secrets control plane:
database schema, server services/routes, CLI workflows, and the Secrets
settings UI.
> - The gap was that secrets were local-only and operators could not
manage provider vaults or import existing remote references without
exposing plaintext.
> - This branch adds provider vault configuration plus an AWS Secrets
Manager remote-import path while preserving company boundaries, binding
context, and audit trails.
> - I kept the PR to a single branch PR, removed unrelated
lockfile/package drift, rebased the full branch onto the current
`public-gh/master`, and addressed fresh Greptile findings.
> - The benefit is a reviewable implementation of provider-backed
secrets with focused tests covering provider selection, import
conflicts, deleted secret reuse, rotation guards, and AWS signing
behavior.
## What Changed
- Added provider vault support for company secrets, including provider
config storage, default vault handling, health checks, binding usage,
access events, and remote import preview/commit.
- Added an AWS Secrets Manager provider using SigV4 request signing,
bounded request timeouts, namespace guardrails, cached runtime
credential resolution, and external-reference linking without plaintext
reads.
- Added Secrets UI surfaces for vault management and remote import, plus
CLI/API documentation for setup and operations.
- Stabilized routine webhook secret binding paths and SSH
environment-driver fixture bindings discovered during verification.
- Addressed Greptile and CI findings: no lockfile/package drift,
monotonic migration metadata, disabled-vault default races, soft-deleted
secret hiding/recreate behavior, remove behavior with disabled vaults,
soft-deleted external-reference re-import, non-active rotation guards,
managed-secret soft deletion through PATCH, and per-call AWS SDK
credential client churn.
- Rebased this branch onto `public-gh/master` at `0e1a5828` and
force-pushed with lease to keep this as the single PR for the branch.
## Verification
- `git fetch public-gh master`
- `git rebase public-gh/master`
- `git diff --name-only public-gh/master...HEAD | grep
'^pnpm-lock\.yaml$' || true` confirmed `pnpm-lock.yaml` is not in the PR
diff.
- Confirmed migration ordering: master ends at `0081_optimal_dormammu`;
this PR adds `0082_dry_vision` and
`0083_company_secret_provider_configs`.
- Inspected migrations for repeat safety: new tables/indexes use `IF NOT
EXISTS`; foreign keys are guarded by `DO $$ ... IF NOT EXISTS`; column
additions use `ADD COLUMN IF NOT EXISTS`.
- `pnpm -r typecheck` passed before the Greptile follow-up commits.
- `pnpm test:run` ran the full stable Vitest path before the Greptile
follow-up commits; it completed with 3 timing-related failures under
parallel load: `codex-local-execute.test.ts`,
`cursor-local-execute.test.ts`, and `environment-service.test.ts`.
- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/codex-local-execute.test.ts
src/__tests__/cursor-local-execute.test.ts
src/__tests__/environment-service.test.ts` passed on targeted rerun
(`24/24`).
- `pnpm build` passed before the Greptile follow-up commits. Vite
reported existing chunk-size/dynamic-import warnings.
- After Greptile follow-up commits: `pnpm --filter @paperclipai/server
exec vitest run src/__tests__/secrets-service.test.ts` passed (`26/26`).
- After Greptile follow-up commits: `pnpm --filter @paperclipai/server
exec vitest run src/__tests__/aws-secrets-manager-provider.test.ts
src/__tests__/secrets-service.test.ts` passed (`39/39`).
- After Greptile follow-up commits: `pnpm --filter @paperclipai/server
typecheck` passed.
- Captured Storybook screenshots from `ui/storybook-static` for visual
review.
- Latest PR checks on `5ca3a5cf`: `policy`, serialized server suites
1/4-4/4, `Canary Dry Run`, `e2e`, `security/snyk`, and `Greptile Review`
pass; aggregate `verify` is still registering the completed child
checks.
- Greptile review loop continued through the latest requested pass; all
Greptile review threads are resolved and the latest `Greptile Review`
check on `5ca3a5cf` passed with 0 comments added.
## Screenshots
Before: the provider-vault and remote-import surfaces did not exist on
`master`; these are after-state screenshots from the Storybook fixtures.



## Risks
- Migration risk: this adds new secret provider tables and extends
existing secret rows. The migrations were checked for monotonic ordering
and idempotent guards, but reviewers should still inspect upgrade
behavior carefully.
- Provider risk: AWS support uses direct SigV4 requests. Automated tests
cover signing, request timeouts, vault-config selection, namespace
guardrails, pending-version archival, sanitized provider errors, and
service-level cleanup paths. A real-vault AWS smoke test remains
deployment validation for an operator with AWS credentials rather than
an unverified merge blocker in this local branch.
- UI risk: the Secrets page and import dialog are large new surfaces;
screenshots are included above for reviewer inspection.
- Verification risk: the full local stable test command hit
parallel-load timing failures, although the exact failed files passed
when rerun directly.
- Operational risk: remote import intentionally avoids plaintext reads;
operators must understand that imported external references resolve at
runtime and may fail if AWS permissions change.
> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.
## Model Used
- OpenAI Codex, GPT-5 coding agent with local shell/tool use in the
Paperclip worktree. Exact context-window size was not exposed by the
runtime.
## Checklist
- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [ ] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] If this change affects the UI, I have included before/after
screenshots
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will address all Greptile and reviewer comments before
requesting merge
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 18:22:17 -05:00
|
|
|
registerSecretCommands(program);
|
2026-03-10 10:08:13 -05:00
|
|
|
registerWorktreeCommands(program);
|
Add SSH environment support (#4358)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies
> - The environments subsystem already models execution environments,
but before this branch there was no end-to-end SSH-backed runtime path
for agents to actually run work against a remote box
> - That meant agents could be configured around environment concepts
without a reliable way to execute adapter sessions remotely, sync
workspace state, and preserve run context across supported adapters
> - We also need environment selection to participate in normal
Paperclip control-plane behavior: agent defaults, project/issue
selection, route validation, and environment probing
> - Because this capability is still experimental, the UI surface should
be easy to hide and easy to remove later without undoing the underlying
implementation
> - This pull request adds SSH environment execution support across the
runtime, adapters, routes, schema, and tests, then puts the visible
environment-management UI behind an experimental flag
> - The benefit is that we can validate real SSH-backed agent execution
now while keeping the user-facing controls safely gated until the
feature is ready to come out of experimentation
## What Changed
- Added SSH-backed execution target support in the shared adapter
runtime, including remote workspace preparation, skill/runtime asset
sync, remote session handling, and workspace restore behavior after
runs.
- Added SSH execution coverage for supported local adapters, plus remote
execution tests across Claude, Codex, Cursor, Gemini, OpenCode, and Pi.
- Added environment selection and environment-management backend support
needed for SSH execution, including route/service work, validation,
probing, and agent default environment persistence.
- Added CLI support for SSH environment lab verification and updated
related docs/tests.
- Added the `enableEnvironments` experimental flag and gated the
environment UI behind it on company settings, agent configuration, and
project configuration surfaces.
## Verification
- `pnpm exec vitest run
packages/adapters/claude-local/src/server/execute.remote.test.ts
packages/adapters/cursor-local/src/server/execute.remote.test.ts
packages/adapters/gemini-local/src/server/execute.remote.test.ts
packages/adapters/opencode-local/src/server/execute.remote.test.ts
packages/adapters/pi-local/src/server/execute.remote.test.ts`
- `pnpm exec vitest run server/src/__tests__/environment-routes.test.ts`
- `pnpm exec vitest run
server/src/__tests__/instance-settings-routes.test.ts`
- `pnpm exec vitest run ui/src/lib/new-agent-hire-payload.test.ts
ui/src/lib/new-agent-runtime-config.test.ts`
- `pnpm -r typecheck`
- `pnpm build`
- Manual verification on a branch-local dev server:
- enabled the experimental flag
- created an SSH environment
- created a Linux Claude agent using that environment
- confirmed a run executed on the Linux box and synced workspace changes
back
## Risks
- Medium: this touches runtime execution flow across multiple adapters,
so regressions would likely show up in remote session setup, workspace
sync, or environment selection precedence.
- The UI flag reduces exposure, but the underlying runtime and route
changes are still substantial and rely on migration correctness.
- The change set is broad across adapters, control-plane services,
migrations, and UI gating, so review should pay close attention to
environment-selection precedence and remote workspace lifecycle
behavior.
## Model Used
- OpenAI Codex via Paperclip's local Codex adapter, GPT-5-class coding
model with tool use and code execution in the local repo workspace. The
local adapter does not surface a more specific public model version
string in this branch workflow.
## Checklist
- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] If this change affects the UI, I have included before/after
screenshots
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will address all Greptile and reviewer comments before
requesting merge
2026-04-23 19:15:22 -07:00
|
|
|
registerEnvLabCommands(program);
|
2026-03-14 13:58:43 -07:00
|
|
|
registerPluginCommands(program);
|
2026-02-20 07:10:58 -06:00
|
|
|
|
2026-02-23 14:40:59 -06:00
|
|
|
const auth = program.command("auth").description("Authentication and bootstrap utilities");
|
|
|
|
|
|
|
|
|
|
auth
|
|
|
|
|
.command("bootstrap-ceo")
|
|
|
|
|
.description("Create a one-time bootstrap invite URL for first instance admin")
|
|
|
|
|
.option("-c, --config <path>", "Path to config file")
|
2026-03-02 14:20:37 -06:00
|
|
|
.option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP)
|
2026-02-23 14:40:59 -06:00
|
|
|
.option("--force", "Create new invite even if admin already exists", false)
|
|
|
|
|
.option("--expires-hours <hours>", "Invite expiration window in hours", (value) => Number(value))
|
|
|
|
|
.option("--base-url <url>", "Public base URL used to print invite link")
|
|
|
|
|
.action(bootstrapCeoInvite);
|
|
|
|
|
|
2026-03-23 07:48:03 -05:00
|
|
|
registerClientAuthCommands(auth);
|
|
|
|
|
|
2026-03-31 08:08:18 -05:00
|
|
|
async function main(): Promise<void> {
|
|
|
|
|
let failed = false;
|
|
|
|
|
try {
|
|
|
|
|
await program.parseAsync();
|
|
|
|
|
} catch (err) {
|
|
|
|
|
failed = true;
|
|
|
|
|
console.error(err instanceof Error ? err.message : String(err));
|
|
|
|
|
} finally {
|
|
|
|
|
await flushTelemetry();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (failed) {
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void main();
|