# 프로젝트 구조 및 모노레포 워크스페이스 생성

1. 프로젝트 폴더를 생성하고 해당 디렉터리로 이동합니다:

```bash
mkdir walnut-app
cd walnut-app
```

2. `packages` 디렉터리를 생성하고, `contracts` 및 `cli` 하위 디렉터리를 추가합니다:

```bash
mkdir -p packages/contracts packages/cli
```

`contracts` 디렉터리는 **Seismic 스마트 컨트랙트 및 테스트 파일을 저장**하는 공간이며,\
`cli` 디렉터리는 **스마트 컨트랙트와 상호작용할 수 있는 인터페이스**를 포함합니다.

***

3. 루트 디렉터리에서 `bun` 프로젝트를 초기화합니다:

```bash
bun init -y && rm index.ts && rm tsconfig.json && touch .prettierrc && touch .gitmodules
```

기본적으로 `bun init -y`를 실행하면 `index.ts` 및 `tsconfig.json` 파일이 생성되지만,\
루트 디렉터리를 **모노레포 구조 관리에 집중하도록 유지하기 위해** 해당 파일들을 제거합니다.

또한, **일관된 코드 포매팅을 위한 `.prettierrc` 파일**과\
**컨트랙트 서브모듈 관리를 위한 `.gitmodules` 파일**을 생성합니다.

***

4. 기본 `package.json` 파일을 아래 내용으로 대체하여 **모노레포 환경을 설정**합니다:

```json
{
  "workspaces": [
    "packages/**"
  ],
  "dependencies": {},
  "devDependencies": {
    "@trivago/prettier-plugin-sort-imports": "^5.2.1",
    "prettier": "^3.4.2"
  }
}
```

***

5. `.prettierrc` 파일에 **일관된 코드 포매팅을 위한 설정을 추가**합니다:

```json
{
  "semi": false,
  "tabWidth": 2,
  "singleQuote": true,
  "printWidth": 80,
  "trailingComma": "es5",
  "plugins": ["@trivago/prettier-plugin-sort-imports"],
  "importOrder": [
    "<TYPES>^(?!@)([^.].*$)</TYPES>",
    "<TYPES>^@(.*)$</TYPES>",
    "<TYPES>^[./]</TYPES>",
    "^(?!@)([^.].*$)",
    "^@(.*)$",
    "^[./]"
  ],
  "importOrderParserPlugins": ["typescript", "jsx", "decorators-legacy"],
  "importOrderSeparation": true,
  "importOrderSortSpecifiers": true
}
```

***

6. `.gitignore` 파일을 다음과 같이 변경하여 불필요한 파일을 제외합니다:

```plaintext
# 컴파일러 파일
cache/
out/

# 개발 브로드캐스트 로그 무시
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

# 문서
docs/

# 환경 변수 파일
.env

node_modules/
```

***

7. `.gitmodules` 파일에 **Git 서브모듈을 추가**하여 Foundry 표준 라이브러리(`forge-std`)를 추적합니다:

```plaintext
[submodule "packages/contracts/lib/forge-std"]
	path = packages/contracts/lib/forge-std
	url = https://github.com/foundry-rs/forge-std
```

이제 프로젝트 구조와 모노레포 워크스페이스가 설정되었습니다.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://clairetranslation.gitbook.io/seismic-docs-kr/undefined-2/undefined-2/walnut/undefined-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
