# Cloud Workflow

Tipolink Cloud runs natively over **MCP** around every code change. Once configured in your coding app's MCP JSON file, your AI agent executes the complete lifecycle—workspace alignment, resync, impact mapping, helper discovery, and post-edit guard—without switching to terminal CLI commands.

## 0. Align & Sync Workspace

Before inspecting or editing a repository, verify your active workspace binding:

- **MCP tool:** `tipolink_workspace({ action: "status" })` or `tipolink_workspace({ action: "bind", workspaceId: "<repo_path>" })`
- **Cost:** 0 credits (free)

When onboarding a repository, after large refactors/branch switches, or when a response reports an outdated schema, sync directly via MCP (note: routine edits and deletions are already auto-synced by `tipolink_map`, `tipolink_find_helper`, and `tipolink_guard`):

- **MCP tool:** `tipolink_sync({})` (or `tipolink_sync({ force: true })` for full disk re-extraction)
- **Cost:** 0 credits (no-op) / 1 credit (incremental `<10` files) / 5 credits (cold index, `>=10` files, or `force: true`)
- **CLI companion:** `npx -y @tipolink/mcp@latest sync [--force]`

## 1. Impact Map before you edit

Before changing a shared file, exported function, or type contract, find out which files depend on it.

- **MCP tool:** `tipolink_map({ target: "src/billing/checkout.ts" })`
- **Cost:** 5 credits
- **CLI companion:** `npx -y @tipolink/mcp@latest map src/billing/checkout.ts`

The result lists direct callers, transitive callers (including re-exports through barrel `index.ts` files), and frequently co-imported sibling modules so every affected call site can be updated in one pass.

## 2. Helper Discovery before you write a utility

Before writing a new helper, search the workspace for an existing export.

- **MCP tool:** `tipolink_find_helper({ query: "format currency with tax", limit: 30, fromFile: "src/billing/invoice.ts" })`
- **Cost:** 1 credit
- **CLI companion:** `npx -y @tipolink/mcp@latest find-helper "format currency with tax" --limit 30`

The result lists matching exported functions, types, and constants together with the exact relative import statement so you can reuse the canonical helper instead of duplicating it.

## 3. Codebase Guard after you edit

After editing, verify your changes before finishing or merging.

- **MCP tool:** `tipolink_guard({ modifiedFiles: ["src/billing/checkout.ts"] })` (or `{}` for the entire workspace)
- **Cost:** 2 credits incremental (5 credits on a cold/first full index)
- **CLI companion:** `npx -y @tipolink/mcp@latest guard --staged`

Guard checks three critical invariants:

- **Import integrity:** every relative path and `tsconfig` / language path alias resolves cleanly.
- **Dependency health:** changes introduce zero static runtime circular import loops.
- **Deduplication:** changes do not duplicate existing helper implementations.

## Credit summary

| Operation | MCP Tool | Cost |
| --- | --- | --- |
| Workspace Status / Bind | `tipolink_workspace` | 0 credits (free) |
| Helper Discovery (Symbol Search) | `tipolink_find_helper` | 1 credit |
| Codebase Guard | `tipolink_guard` | 2 credits (5 cold index) |
| Impact Map (Dependency Map) | `tipolink_map` | 5 credits |
| Workspace Sync | `tipolink_sync` | 0 no-op / 1 incremental / 5 full |
