# Set up Luno OS

Set up Luno OS and connect the CLI to a Luno OS workspace on the web platform, where users view deployments, logs, and manage credentials.

**Luno OS in a sentence:** A single platform for teams to build, deploy, and manage internal agents and AI systems, with every project defined as TypeScript they own.

**Your immediate task:** Install the CLI, connect it to the user's account, initialize the local Luno OS codebase (if needed), deploy to a platform project, then read `AGENTS.md` and help the user build. `AGENTS.md` points you to the documentation, which you read with `luno docs search` and `luno docs query`.

---

## Two kinds of "project"

Luno OS uses two related ideas:

- **Local codebase**: the directory with `luno.config.ts` and `src/` (`luno init` scaffolds this). You build here and deploy it to a platform project.
- **Platform project** (called a **Space** in the web app; say "Space" to the user): an org-owned cloud record: a deploy target plus a hosted runtime (its own luno server, URL, project-scoped credentials). Signup usually **auto-creates** the organization default project named after the org (`{Org name}`); it stays **inactive** until the first deploy. You can create additional projects up to the organization's plan limits.

`luno deploy --project <id>` links them: it uploads the built local codebase and activates that platform project's server. Deployed agents and workflows run there; the web workspace is where users can manage their projects, deployments, logs, credentials, etc.

---

## 1. Install the CLI

```
npm install -g @meetluno/cli
```

Installs the `luno` command on their machine. Does **not** change this repo.

---

## 2. Connect the CLI

```
luno auth login
```

Opens the browser to an **Authorize the CLI** page. The user must click **Approve**. Links the CLI to their Luno OS account and org.

---

## 3. Initialize local Luno OS (if needed)

Check the repo root for `luno.config.ts`.

**If it exists:** skip this step; the local Luno OS codebase is already set up here.

**If it does not exist:**

```
luno init . --yes
```

Scaffolds the local Luno OS codebase in the current directory.

**Or**, to scaffold into a new subfolder (replace `<folder>` with any folder name):

```
luno init <folder> --yes
cd <folder>
```

Scaffolds `luno.config.ts`, `tsconfig.json`, `src/`, `AGENTS.md`, and `package.json` scripts for `build`, `lint`, `typecheck`, and `test`. Step 4 must run from that project directory (`deploy` resolves the local codebase from your current working directory).

---

## 4. Pick a platform project and deploy

From the local project directory, list platform projects in their org:

```
luno projects list
```

Each project has a `status`:

- **`inactive`**: never deployed (common for the auto-created default project, named after the org). Safe to deploy a fresh `luno init` scaffold here.
- **`active`**: already running deployed code — often the team's real work. **Do not** deploy a fresh scaffold to an active project unless the user explicitly asks you to replace what's running there.

**Pick a deploy target:**

1. If there is an **`inactive`** project, deploy to that project's `id`.
2. If every project is **`active`**, or you're unsure which project the user intended, **create a new project** (or ask the user which project to use — never guess). Orgs can create additional projects up to their plan limits:

```
luno projects create --name "FIRST_NAME's Project"
```

(Replace `FIRST_NAME` with the user's first name, or use another name like `My Project`.)

If the list is empty, create one the same way.

Then deploy the local codebase to that platform project:

```
luno deploy --project <project-id>
```

Deploy runs lint and typecheck, builds the local codebase, uploads the `dist/` artifact, and starts the platform project's hosted server. A fresh `luno init` scaffold includes example agents and workflows that run in the cloud after deploy. **Deploying replaces whatever is currently running on that platform project** — choose the target carefully.

---

## Set up finished

Setup is complete when install, auth, init (if needed), and deploy have succeeded.

Once setup is finished: read `AGENTS.md` — it points you to the documentation, which you read with `luno docs search` and `luno docs query` — then follow up with the user. Ask what they want to build, edit, check next, etc.

---

Get started by installing the CLI with:

```
npm install -g @meetluno/cli
```