@cr8rcho/alkahest 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ko.md +208 -0
- package/README.md +208 -0
- package/dist/assets/dashboard.html +647 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +68 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/hook.d.ts +1 -0
- package/dist/commands/hook.js +64 -0
- package/dist/commands/hook.js.map +1 -0
- package/dist/commands/login.d.ts +11 -0
- package/dist/commands/login.js +27 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/mcp.d.ts +6 -0
- package/dist/commands/mcp.js +13 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/publish.d.ts +19 -0
- package/dist/commands/publish.js +27 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/scan.d.ts +11 -0
- package/dist/commands/scan.js +29 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/update.d.ts +15 -0
- package/dist/commands/update.js +41 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/view.d.ts +6 -0
- package/dist/commands/view.js +21 -0
- package/dist/commands/view.js.map +1 -0
- package/dist/core/adapters/angular.d.ts +2 -0
- package/dist/core/adapters/angular.js +305 -0
- package/dist/core/adapters/angular.js.map +1 -0
- package/dist/core/adapters/astro.d.ts +3 -0
- package/dist/core/adapters/astro.js +140 -0
- package/dist/core/adapters/astro.js.map +1 -0
- package/dist/core/adapters/compose.d.ts +2 -0
- package/dist/core/adapters/compose.js +195 -0
- package/dist/core/adapters/compose.js.map +1 -0
- package/dist/core/adapters/django.d.ts +2 -0
- package/dist/core/adapters/django.js +314 -0
- package/dist/core/adapters/django.js.map +1 -0
- package/dist/core/adapters/expo-router.d.ts +2 -0
- package/dist/core/adapters/expo-router.js +60 -0
- package/dist/core/adapters/expo-router.js.map +1 -0
- package/dist/core/adapters/flask.d.ts +2 -0
- package/dist/core/adapters/flask.js +249 -0
- package/dist/core/adapters/flask.js.map +1 -0
- package/dist/core/adapters/flutter.d.ts +2 -0
- package/dist/core/adapters/flutter.js +232 -0
- package/dist/core/adapters/flutter.js.map +1 -0
- package/dist/core/adapters/index.d.ts +19 -0
- package/dist/core/adapters/index.js +59 -0
- package/dist/core/adapters/index.js.map +1 -0
- package/dist/core/adapters/next-app.d.ts +2 -0
- package/dist/core/adapters/next-app.js +62 -0
- package/dist/core/adapters/next-app.js.map +1 -0
- package/dist/core/adapters/next-pages.d.ts +2 -0
- package/dist/core/adapters/next-pages.js +70 -0
- package/dist/core/adapters/next-pages.js.map +1 -0
- package/dist/core/adapters/nuxt.d.ts +2 -0
- package/dist/core/adapters/nuxt.js +59 -0
- package/dist/core/adapters/nuxt.js.map +1 -0
- package/dist/core/adapters/rails.d.ts +2 -0
- package/dist/core/adapters/rails.js +275 -0
- package/dist/core/adapters/rails.js.map +1 -0
- package/dist/core/adapters/react-jsx.d.ts +68 -0
- package/dist/core/adapters/react-jsx.js +355 -0
- package/dist/core/adapters/react-jsx.js.map +1 -0
- package/dist/core/adapters/react-navigation.d.ts +2 -0
- package/dist/core/adapters/react-navigation.js +153 -0
- package/dist/core/adapters/react-navigation.js.map +1 -0
- package/dist/core/adapters/react-router.d.ts +2 -0
- package/dist/core/adapters/react-router.js +249 -0
- package/dist/core/adapters/react-router.js.map +1 -0
- package/dist/core/adapters/remix.d.ts +2 -0
- package/dist/core/adapters/remix.js +109 -0
- package/dist/core/adapters/remix.js.map +1 -0
- package/dist/core/adapters/static-html.d.ts +2 -0
- package/dist/core/adapters/static-html.js +157 -0
- package/dist/core/adapters/static-html.js.map +1 -0
- package/dist/core/adapters/sveltekit.d.ts +2 -0
- package/dist/core/adapters/sveltekit.js +151 -0
- package/dist/core/adapters/sveltekit.js.map +1 -0
- package/dist/core/adapters/swiftui.d.ts +2 -0
- package/dist/core/adapters/swiftui.js +216 -0
- package/dist/core/adapters/swiftui.js.map +1 -0
- package/dist/core/adapters/types.d.ts +65 -0
- package/dist/core/adapters/types.js +2 -0
- package/dist/core/adapters/types.js.map +1 -0
- package/dist/core/adapters/uikit.d.ts +2 -0
- package/dist/core/adapters/uikit.js +178 -0
- package/dist/core/adapters/uikit.js.map +1 -0
- package/dist/core/adapters/vue-router.d.ts +2 -0
- package/dist/core/adapters/vue-router.js +224 -0
- package/dist/core/adapters/vue-router.js.map +1 -0
- package/dist/core/adapters/vue-sfc.d.ts +28 -0
- package/dist/core/adapters/vue-sfc.js +132 -0
- package/dist/core/adapters/vue-sfc.js.map +1 -0
- package/dist/core/credentials.d.ts +24 -0
- package/dist/core/credentials.js +30 -0
- package/dist/core/credentials.js.map +1 -0
- package/dist/core/dashboard.d.ts +9 -0
- package/dist/core/dashboard.js +20 -0
- package/dist/core/dashboard.js.map +1 -0
- package/dist/core/emit.d.ts +7 -0
- package/dist/core/emit.js +23 -0
- package/dist/core/emit.js.map +1 -0
- package/dist/core/hash.d.ts +2 -0
- package/dist/core/hash.js +6 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/pipeline.d.ts +25 -0
- package/dist/core/pipeline.js +122 -0
- package/dist/core/pipeline.js.map +1 -0
- package/dist/core/publish.d.ts +31 -0
- package/dist/core/publish.js +87 -0
- package/dist/core/publish.js.map +1 -0
- package/dist/core/resolve.d.ts +42 -0
- package/dist/core/resolve.js +128 -0
- package/dist/core/resolve.js.map +1 -0
- package/dist/core/serve.d.ts +5 -0
- package/dist/core/serve.js +52 -0
- package/dist/core/serve.js.map +1 -0
- package/dist/core/types.d.ts +117 -0
- package/dist/core/types.js +9 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/version.d.ts +23 -0
- package/dist/core/version.js +102 -0
- package/dist/core/version.js.map +1 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +224 -0
- package/dist/mcp/server.js.map +1 -0
- package/package.json +57 -0
package/README.ko.md
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# Alkahest
|
|
2
|
+
|
|
3
|
+
[English](./README.md) · **한국어**
|
|
4
|
+
|
|
5
|
+
> 코드에서 제품을 역으로 복원해, 사람이 제품 결정을 내리게 한다.
|
|
6
|
+
|
|
7
|
+
UI 코드베이스를 **정적 분석**해 **제품 지도(Product Map)** 를 만드는 CLI입니다.
|
|
8
|
+
화면을 노드로, 화면 간 이동과 화면이 부르는 API/데이터 호출을 엣지로 뽑아내, 인터랙티브 대시보드로 보여주고 PRD·요구사항 작성을 돕습니다.
|
|
9
|
+
|
|
10
|
+
플랫폼은 **어댑터로 확장**합니다 — 현재 **Next.js (app-router)** 와 **SwiftUI** 지원. 데이터 모델이 플랫폼 무관이라 어댑터만 추가하면 다른 프레임워크도 됩니다.
|
|
11
|
+
|
|
12
|
+
레퍼런스들(graphify·codegraph·Understand-Anything)이 *코드 심볼* 그래프라면, Alkahest는 한 단계 위 **화면(screen) 레벨의 제품 이해**를 목표로 합니다 — 대상 사용자는 **PM/기획자**.
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
화면(Screen) ──이동(Link/router.push/redirect)──▶ 화면(Screen)
|
|
16
|
+
│
|
|
17
|
+
└──호출(fetch/useQuery/server action)──▶ 리소스(API 엔드포인트/데이터)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 2-레이어 그래프
|
|
21
|
+
|
|
22
|
+
- **노드**: `Screen`(route/page) · `Resource`(화면이 부르는 API·데이터)
|
|
23
|
+
- **엣지**: `Transition`(화면→화면 이동) · `Call`(화면→리소스 호출)
|
|
24
|
+
- 여러 화면이 같은 리소스를 부르면 노드를 공유 → "어떤 화면들이 `/api/orders`를 함께 쓰는가"가 그래프로 드러납니다(데이터 의존성·변경 영향).
|
|
25
|
+
|
|
26
|
+
## 키 불필요 — 추론은 에이전트가
|
|
27
|
+
|
|
28
|
+
핵심 산출물 `map.json`은 **결정론적이라 LLM 키가 필요 없습니다.** Alkahest는 LLM을 직접 호출하지 않습니다. 요약·PRD·요구사항 같은 서술형 출력이 필요하면, **에이전트**가 추론합니다 — Alkahest를 MCP 서버로 연결하면 Claude Code / Codex / Cursor가 제품 지도를 질의해서 직접 글을 씁니다. 키도, SDK도 없습니다.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
나 ── "체크아웃 화면 PRD 써줘" ──▶ 에이전트 (Claude Code / Codex)
|
|
32
|
+
│ get_screen / who_calls (MCP)
|
|
33
|
+
▼
|
|
34
|
+
Alkahest → map.json (결정론적, 키 없음)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 설치
|
|
38
|
+
|
|
39
|
+
> npm 배포 예정. 현재는 소스에서 빌드해 사용합니다.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/cr8rcho/alkahest.git
|
|
43
|
+
cd alkahest
|
|
44
|
+
npm install
|
|
45
|
+
npm run build
|
|
46
|
+
npm link # 'alkahest' 명령을 전역에 연결 (선택)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
배포 후에는: `npm i -g @cr8rcho/alkahest` 또는 `npx @cr8rcho/alkahest …` (실행 명령은 그대로 `alkahest`)
|
|
50
|
+
|
|
51
|
+
## 빠른 시작 (Claude Code)
|
|
52
|
+
|
|
53
|
+
Claude Code 사용자가 0부터 대시보드에서 그래프 + PRD를 보기까지:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 1. alkahest 설치: npm i -g @cr8rcho/alkahest (또는 위처럼 소스 빌드 후 `npm link`)
|
|
57
|
+
|
|
58
|
+
# 2. 내 프로젝트 루트에서 제품 지도 생성
|
|
59
|
+
cd ~/my-next-app
|
|
60
|
+
alkahest scan # → .alkahest/map.json + index.html
|
|
61
|
+
|
|
62
|
+
# 3. Claude Code에 MCP 서버 등록 (project 스코프 = .mcp.json으로 공유)
|
|
63
|
+
claude mcp add alkahest -s project -- alkahest mcp
|
|
64
|
+
# 연결 확인: `claude` 실행 후 `/mcp` → 목록에 "alkahest" 표시
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
이제 **Claude Code에 말만 하면** 됩니다 — 알아서 alkahest MCP 도구를 씁니다:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
나: "이 제품 화면들 개요 좀 정리해줘."
|
|
71
|
+
→ Claude가 overview 호출 → 구조 요약.
|
|
72
|
+
|
|
73
|
+
나: "체크아웃 화면이랑 장바구니 화면 PRD 써줘."
|
|
74
|
+
→ Claude가 get_screen / who_calls 로 구조를 읽고,
|
|
75
|
+
각 PRD를 작성해 set_prd 로 map.json에 저장.
|
|
76
|
+
|
|
77
|
+
나: "alkahest view" (또는 터미널에서 직접 실행)
|
|
78
|
+
→ 대시보드가 열림. 화면 노드를 클릭하면 우측 패널에
|
|
79
|
+
방금 Claude가 쓴 Summary + PRD가 보임.
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
요약: **scan → MCP 등록 → Claude에게 요청 → `view`.** 키 없음 — 글은 Claude가 쓰고, alkahest가 `map.json`에 저장해 자기완결 대시보드로 렌더합니다.
|
|
83
|
+
|
|
84
|
+
## 사용법
|
|
85
|
+
|
|
86
|
+
분석할 프로젝트 루트에서 실행하면, 그 프로젝트 안 `.alkahest/` 에 산출물이 생깁니다.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
alkahest scan # 분석 → .alkahest/map.json + index.html (기본: 증분)
|
|
90
|
+
alkahest scan --full # 기준선 무시하고 전체 재스캔
|
|
91
|
+
alkahest view # 대시보드를 로컬 서버로 열기 (2-레이어 그래프)
|
|
92
|
+
alkahest hook install # 커밋·머지 시 scan 자동 실행 (diff 자동 갱신)
|
|
93
|
+
alkahest mcp # MCP 서버 실행 (에이전트가 제품 지도를 질의, 키 불필요)
|
|
94
|
+
alkahest login # publish 토큰 저장 (alkahest.app → Account → Create token)
|
|
95
|
+
alkahest publish # 지도를 hosted 뷰어에 업로드 → 공유 링크
|
|
96
|
+
alkahest update # 최신 GitHub 릴리스로 업데이트 (--check: 확인만)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 대시보드 조작
|
|
100
|
+
|
|
101
|
+
- **force-directed 레이아웃** — 노드가 연결 관계에 따라 자연스럽게 자리잡습니다. 시드 고정이라 매번 같은 배치.
|
|
102
|
+
- **시작점**은 라벨 앞 `▶` 로 표시 (앱 진입점 / 루트 라우트)
|
|
103
|
+
- **호버**: 노드에 올리면 연결된 엣지·이웃이 색으로 강조 (미리보기)
|
|
104
|
+
- **클릭**: 화면을 선택해 우측 패널에 기능·이동·호출을 고정 표시
|
|
105
|
+
- **드래그**로 노드 이동(연결된 이웃이 따라옴), **휠/핀치**로 확대·축소, 빈 곳 드래그로 이동
|
|
106
|
+
- 우상단 **🌗** 라이트/다크 전환, **⤢ 맞춤** 전체 보기
|
|
107
|
+
- 엣지: 실선 = 이동, 짧은 점선 = 포함, 긴 점선 = 호출
|
|
108
|
+
|
|
109
|
+
### 에이전트(MCP) 연동
|
|
110
|
+
|
|
111
|
+
MCP 서버를 한 번 등록하면, 에이전트가 제품 지도를 읽고 **요약·PRD·요구사항을 직접** 작성합니다 — 키 불필요.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Claude Code (권장): project 스코프는 공유용 .mcp.json 에 기록
|
|
115
|
+
claude mcp add alkahest -s project -- alkahest mcp
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
또는 MCP를 지원하는 다른 에이전트 설정에 직접 추가:
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"mcpServers": {
|
|
123
|
+
"alkahest": { "command": "alkahest", "args": ["mcp"] }
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**제공 도구:**
|
|
129
|
+
|
|
130
|
+
| 도구 | 하는 일 |
|
|
131
|
+
|---|---|
|
|
132
|
+
| `scan` | 프로젝트 제품 지도를 (재)생성 |
|
|
133
|
+
| `overview` | 전체 화면·리소스 목록 한눈에 |
|
|
134
|
+
| `get_screen` | 한 화면의 전체 구조(기능·이동·호출·소스) |
|
|
135
|
+
| `who_calls` | 특정 API/리소스를 부르는 화면들 (변경 영향) |
|
|
136
|
+
| `set_summary` | 화면에 한 줄 요약 저장 → 대시보드 패널에 표시 |
|
|
137
|
+
| `set_prd` | 화면에 PRD/요구사항 마크다운 저장 → 패널에 렌더 |
|
|
138
|
+
| `publish` | 지도를 hosted 뷰어에 올려 공유 링크 생성 (토큰 필요, 아래 참고) |
|
|
139
|
+
| `check_version` | 설치 버전 vs 최신 GitHub 릴리스 보고 (에이전트가 `alkahest update` 안내 가능) |
|
|
140
|
+
|
|
141
|
+
에이전트는 `get_screen` / `who_calls` 로 읽고 `set_summary` / `set_prd` 로 써넣습니다. 둘 다 `map.json`에 기록하고 `index.html`을 재생성하므로 대시보드가 항상 최신입니다.
|
|
142
|
+
|
|
143
|
+
**에이전트에서 publish (선택).** `scan`·읽기·쓰기는 키가 필요 없지만, `publish`는 지도를 계정에 업로드하므로 토큰이 필요합니다. **alkahest.app → Account → Create token** 에서 토큰을 받아 MCP 설정에 넣어주세요:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
claude mcp add alkahest -s project \
|
|
147
|
+
-e ALKAHEST_TOKEN=alk_xxxxx \
|
|
148
|
+
-e ALKAHEST_API_URL=https://<ref>.supabase.co/functions/v1 \
|
|
149
|
+
-- alkahest mcp
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"mcpServers": {
|
|
155
|
+
"alkahest": {
|
|
156
|
+
"command": "alkahest",
|
|
157
|
+
"args": ["mcp"],
|
|
158
|
+
"env": {
|
|
159
|
+
"ALKAHEST_TOKEN": "alk_xxxxx",
|
|
160
|
+
"ALKAHEST_API_URL": "https://<ref>.supabase.co/functions/v1"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
이미 `alkahest login` 을 했다면 저장된 자격증명이 fallback으로 쓰여서 env 없이도 됩니다. 그다음 에이전트에게 *"이거 publish 해줘"* 라고만 하면 링크를 돌려줍니다.
|
|
168
|
+
|
|
169
|
+
## 산출물 — `.alkahest/`
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
.alkahest/
|
|
173
|
+
├─ map.json # 표준 ProductMap (모든 출력의 원천)
|
|
174
|
+
└─ index.html # 자기완결 인터랙티브 대시보드 (외부 의존성/네트워크 없음)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
`index.html`은 데이터 + 렌더 코드를 모두 인라인한 **자기완결 파일**이라, alkahest나 서버 없이 브라우저로 바로 열립니다. `.alkahest/` 는 `.gitignore` 에 추가하길 권장합니다.
|
|
178
|
+
|
|
179
|
+
## 증분 + 자동 갱신
|
|
180
|
+
|
|
181
|
+
`scan`은 기본 **증분**입니다 — `map.json`의 파일 해시와 비교해 바뀐 화면만 재파싱하고, 나머지는 그대로 보존합니다. `alkahest hook install`로 git hook을 걸면 커밋·머지 때마다 자동으로 갱신됩니다.
|
|
182
|
+
|
|
183
|
+
## 지원 범위 / 한계
|
|
184
|
+
|
|
185
|
+
현재 어댑터:
|
|
186
|
+
|
|
187
|
+
| 어댑터 | 화면 | 이동 | 호출 |
|
|
188
|
+
|---|---|---|---|
|
|
189
|
+
| **Next.js app-router** | `app/**/page.tsx` | `<Link>`·`router.push`·`redirect` | `fetch`·query 훅 |
|
|
190
|
+
| **SwiftUI** | `struct X: View` | `NavigationLink`·`.sheet`·`.fullScreenCover`·`navigationDestination` | `URL(string:)`·`URLRequest` |
|
|
191
|
+
|
|
192
|
+
- **한계**: 파일/뷰 단위로 파싱 — 임포트한 자식 컴포넌트 내부의 기능/호출은 아직 미추적. 동적 대상(`router.push(변수)`, `useQuery` 훅의 URL 등)은 "미해결"로 표시.
|
|
193
|
+
- pages router / React Router / Compose 등 추가 어댑터, 런타임 스크린샷은 수요에 따라 추가 예정 — 새 플랫폼은 `src/core/adapters/`에 어댑터 하나 추가하면 됩니다.
|
|
194
|
+
|
|
195
|
+
## 개발
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
npm install
|
|
199
|
+
npm run build
|
|
200
|
+
node dist/cli.js scan examples/sample-next # 번들 픽스처로 시험
|
|
201
|
+
npm run typecheck
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
설계 단일 출처는 [`ALKAHEST.md`](./ALKAHEST.md) 입니다.
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
MIT
|
package/README.md
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# Alkahest
|
|
2
|
+
|
|
3
|
+
**English** · [한국어](./README.ko.md)
|
|
4
|
+
|
|
5
|
+
> Reverse-engineer the product from the code, so people can make product decisions.
|
|
6
|
+
|
|
7
|
+
Alkahest is a CLI that **statically analyzes** a UI codebase and builds a **Product Map**.
|
|
8
|
+
It extracts screens as nodes, and the navigation between screens plus the API/data calls each screen makes as edges — then shows it in an interactive dashboard and helps you write PRDs and requirements.
|
|
9
|
+
|
|
10
|
+
Platforms are **pluggable via adapters** — currently **Next.js (app-router)** and **SwiftUI**. The data model is platform-agnostic, so other frameworks just need a new adapter.
|
|
11
|
+
|
|
12
|
+
Where the references (graphify, codegraph, Understand-Anything) build *code-symbol* graphs, Alkahest aims one level up — **screen-level product understanding** — for a target audience of **PMs / product folks**.
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
Screen ──navigate (Link / router.push / redirect)──▶ Screen
|
|
16
|
+
│
|
|
17
|
+
└──call (fetch / useQuery / server action)──▶ Resource (API endpoint / data)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Two-layer graph
|
|
21
|
+
|
|
22
|
+
- **Nodes**: `Screen` (route/page) · `Resource` (the API/data a screen calls)
|
|
23
|
+
- **Edges**: `Transition` (screen → screen) · `Call` (screen → resource)
|
|
24
|
+
- When several screens call the same resource they share one node — so the graph reveals "which screens use `/api/orders` together" (data dependencies & change impact).
|
|
25
|
+
|
|
26
|
+
## No API key — the agent reasons
|
|
27
|
+
|
|
28
|
+
The core output `map.json` is **deterministic and needs no LLM key.** Alkahest never calls an LLM itself. When you want narrative output (summaries, PRDs, requirements), your **agent** does the reasoning: connect Alkahest as an MCP server, and Claude Code / Codex / Cursor query the product map and write the prose themselves — no key, no SDK.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
You ── "write a PRD for the checkout screen" ──▶ Agent (Claude Code / Codex)
|
|
32
|
+
│ get_screen / who_calls (MCP)
|
|
33
|
+
▼
|
|
34
|
+
Alkahest → map.json (deterministic, no key)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
> npm publish is planned. For now, build from source.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/cr8rcho/alkahest.git
|
|
43
|
+
cd alkahest
|
|
44
|
+
npm install
|
|
45
|
+
npm run build
|
|
46
|
+
npm link # link the 'alkahest' command globally (optional)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
After publish: `npm i -g @cr8rcho/alkahest` or `npx @cr8rcho/alkahest …` (the command stays `alkahest`)
|
|
50
|
+
|
|
51
|
+
## Quickstart (Claude Code)
|
|
52
|
+
|
|
53
|
+
The full flow for a Claude Code user, from zero to a graph + PRDs in the dashboard:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 1. Install alkahest: npm i -g @cr8rcho/alkahest (or build from source above + `npm link`)
|
|
57
|
+
|
|
58
|
+
# 2. In your project root, build the product map
|
|
59
|
+
cd ~/my-next-app
|
|
60
|
+
alkahest scan # → .alkahest/map.json + index.html
|
|
61
|
+
|
|
62
|
+
# 3. Register the MCP server with Claude Code (project scope = shared via .mcp.json)
|
|
63
|
+
claude mcp add alkahest -s project -- alkahest mcp
|
|
64
|
+
# verify it's connected: run `claude` then `/mcp` → "alkahest" should be listed
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Now just **talk to Claude Code** — it uses the alkahest MCP tools for you:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
You: "Give me an overview of this product's screens."
|
|
71
|
+
→ Claude calls overview → summarizes the structure.
|
|
72
|
+
|
|
73
|
+
You: "Write a PRD for the checkout screen and the cart screen."
|
|
74
|
+
→ Claude calls get_screen / who_calls to read the structure,
|
|
75
|
+
writes each PRD, and calls set_prd to save it into map.json.
|
|
76
|
+
|
|
77
|
+
You: "alkahest view" (or run it in a terminal)
|
|
78
|
+
→ opens the dashboard. Click a screen node → the right panel
|
|
79
|
+
shows its Summary + PRD that Claude just wrote.
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
That's it: **scan → register MCP → ask Claude → `view`.** No API key — Claude does the writing, alkahest stores it in `map.json` and renders it in the self-contained dashboard.
|
|
83
|
+
|
|
84
|
+
## Usage
|
|
85
|
+
|
|
86
|
+
Run it from the root of the project you want to analyze; outputs land in that project's `.alkahest/` folder.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
alkahest scan # analyze → .alkahest/map.json + index.html (incremental by default)
|
|
90
|
+
alkahest scan --full # ignore the baseline and rescan everything
|
|
91
|
+
alkahest view # open the dashboard via a local server (two-layer graph)
|
|
92
|
+
alkahest hook install # run scan automatically on commit/merge (diff-driven refresh)
|
|
93
|
+
alkahest mcp # run the MCP server (agents query the product map; no key)
|
|
94
|
+
alkahest login # save your publish token (Account → Create token on alkahest.app)
|
|
95
|
+
alkahest publish # upload the map to the hosted viewer → shareable link
|
|
96
|
+
alkahest update # update to the latest GitHub release (--check to only check)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Dashboard interactions
|
|
100
|
+
|
|
101
|
+
- **Force-directed layout** — nodes settle naturally by their connections. A fixed seed keeps the layout the same every time.
|
|
102
|
+
- **Start point** is marked with a `▶` prefix on its label (app entry point / root route).
|
|
103
|
+
- **Hover** a node to highlight its connected edges and neighbors by color (preview).
|
|
104
|
+
- **Click** a screen to pin it — the right panel shows its features, transitions, and calls.
|
|
105
|
+
- **Drag** a node to move it (connected neighbors follow), **wheel/pinch** to zoom, drag empty space to pan.
|
|
106
|
+
- Top right: **🌗** light/dark toggle, **⤢ Fit** to frame the whole graph.
|
|
107
|
+
- Edges: solid = navigate, short dashes = contains, long dashes = call.
|
|
108
|
+
|
|
109
|
+
### Agent (MCP) integration
|
|
110
|
+
|
|
111
|
+
Register the MCP server once, then the agent reads the map and **writes summaries / PRDs / requirements itself** — no key needed.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Claude Code (recommended): project scope writes a shared .mcp.json
|
|
115
|
+
claude mcp add alkahest -s project -- alkahest mcp
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Or add it to any MCP-capable agent's config directly:
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"mcpServers": {
|
|
123
|
+
"alkahest": { "command": "alkahest", "args": ["mcp"] }
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Tools exposed:**
|
|
129
|
+
|
|
130
|
+
| Tool | What it does |
|
|
131
|
+
|---|---|
|
|
132
|
+
| `scan` | (re)build the product map for the project |
|
|
133
|
+
| `overview` | list all screens & resources at a glance |
|
|
134
|
+
| `get_screen` | one screen's full structure (features, navigation, calls, source) |
|
|
135
|
+
| `who_calls` | which screens call a given API/resource (impact analysis) |
|
|
136
|
+
| `set_summary` | save a one-line summary onto a screen → shown in the dashboard panel |
|
|
137
|
+
| `set_prd` | save a PRD/requirements markdown onto a screen → rendered in the panel |
|
|
138
|
+
| `publish` | upload the map to the hosted viewer → shareable link (needs a token, see below) |
|
|
139
|
+
| `check_version` | report installed vs latest GitHub release (so the agent can suggest `alkahest update`) |
|
|
140
|
+
|
|
141
|
+
The agent reads with `get_screen` / `who_calls` and writes back with `set_summary` / `set_prd`; both write into `map.json` and re-render `index.html`, so the dashboard always reflects the latest.
|
|
142
|
+
|
|
143
|
+
**Publishing from the agent (optional).** `scan` / read / write-back need no key. `publish` does — it uploads the map to your account on the hosted viewer. Get a token at **alkahest.app → Account → Create token**, then put it in the MCP config so the server can authenticate:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
claude mcp add alkahest -s project \
|
|
147
|
+
-e ALKAHEST_TOKEN=alk_xxxxx \
|
|
148
|
+
-e ALKAHEST_API_URL=https://<ref>.supabase.co/functions/v1 \
|
|
149
|
+
-- alkahest mcp
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"mcpServers": {
|
|
155
|
+
"alkahest": {
|
|
156
|
+
"command": "alkahest",
|
|
157
|
+
"args": ["mcp"],
|
|
158
|
+
"env": {
|
|
159
|
+
"ALKAHEST_TOKEN": "alk_xxxxx",
|
|
160
|
+
"ALKAHEST_API_URL": "https://<ref>.supabase.co/functions/v1"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
If you've already run `alkahest login`, the saved credentials are used as a fallback — no env needed. Then just ask the agent to *"publish this"* and it returns the link.
|
|
168
|
+
|
|
169
|
+
## Output — `.alkahest/`
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
.alkahest/
|
|
173
|
+
├─ map.json # the canonical ProductMap (source of every output)
|
|
174
|
+
└─ index.html # self-contained interactive dashboard (no external deps / network)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
`index.html` inlines both the data and the render code, so it's a **self-contained file** you can open in a browser without Alkahest or a server. Add `.alkahest/` to your `.gitignore`.
|
|
178
|
+
|
|
179
|
+
## Incremental & auto-refresh
|
|
180
|
+
|
|
181
|
+
`scan` is **incremental** by default — it compares file hashes against `map.json`, re-parses only the changed screens, and preserves everything else. Run `alkahest hook install` to wire a git hook so the map refreshes automatically on every commit/merge.
|
|
182
|
+
|
|
183
|
+
## Scope & limitations
|
|
184
|
+
|
|
185
|
+
Current adapters:
|
|
186
|
+
|
|
187
|
+
| Adapter | Screen | Navigate | Call |
|
|
188
|
+
|---|---|---|---|
|
|
189
|
+
| **Next.js app-router** | `app/**/page.tsx` | `<Link>` · `router.push` · `redirect` | `fetch` · query hooks |
|
|
190
|
+
| **SwiftUI** | `struct X: View` | `NavigationLink` · `.sheet` · `.fullScreenCover` · `navigationDestination` | `URL(string:)` · `URLRequest` |
|
|
191
|
+
|
|
192
|
+
- **Limitations**: parsing is per file/view — features/calls inside imported child components aren't traced yet. Dynamic targets (`router.push(variable)`, a `useQuery` hook's URL, etc.) are marked "unresolved".
|
|
193
|
+
- More adapters (pages router, React Router, Jetpack Compose, …) and runtime screenshots are planned as needed — a new platform is just one adapter under `src/core/adapters/`.
|
|
194
|
+
|
|
195
|
+
## Development
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
npm install
|
|
199
|
+
npm run build
|
|
200
|
+
node dist/cli.js scan examples/sample-next # try it on the bundled fixture
|
|
201
|
+
npm run typecheck
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The single source of truth for the design is [`ALKAHEST.md`](./ALKAHEST.md).
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
MIT
|