cliper-memory 0.1.0 → 0.1.2
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.md +144 -200
- package/dist/api/backend.d.ts +12 -0
- package/dist/api/backend.d.ts.map +1 -0
- package/dist/api/backend.js +39 -0
- package/dist/api/backend.js.map +1 -0
- package/dist/auth/github.js +1 -1
- package/dist/auth/github.js.map +1 -1
- package/dist/commands/agent.d.ts +2 -0
- package/dist/commands/agent.d.ts.map +1 -0
- package/dist/commands/agent.js +89 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/auth.d.ts +0 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +11 -67
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +21 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/push.d.ts +0 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +53 -92
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/view.d.ts +0 -1
- package/dist/commands/view.d.ts.map +1 -1
- package/dist/commands/view.js +20 -58
- package/dist/commands/view.js.map +1 -1
- package/dist/{auth → config}/config.d.ts +10 -3
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/githubWizard.d.ts +2 -0
- package/dist/config/githubWizard.d.ts.map +1 -0
- package/dist/config/githubWizard.js +69 -0
- package/dist/config/githubWizard.js.map +1 -0
- package/dist/config/loader.d.ts +5 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +59 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/wizard.d.ts +2 -0
- package/dist/config/wizard.d.ts.map +1 -0
- package/dist/config/wizard.js +94 -0
- package/dist/config/wizard.js.map +1 -0
- package/dist/index.js +21 -12
- package/dist/index.js.map +1 -1
- package/dist/scanner/gitContext.d.ts +3 -0
- package/dist/scanner/gitContext.d.ts.map +1 -1
- package/dist/scanner/gitContext.js +3 -1
- package/dist/scanner/gitContext.js.map +1 -1
- package/package.json +8 -11
- package/dist/auth/config.d.ts.map +0 -1
- package/dist/auth/config.js.map +0 -1
- /package/dist/{auth → config}/config.js +0 -0
package/README.md
CHANGED
|
@@ -1,268 +1,212 @@
|
|
|
1
|
-
# Cliper Memory
|
|
2
|
-
|
|
3
|
-
> Turn any codebase into a structured knowledge graph for AI agents.
|
|
4
|
-
|
|
5
|
-
Cliper Memory is a repository intelligence engine that converts source code, Git history, architecture, dependencies, and project metadata into structured memories that can be ingested by knowledge graph systems like Cognee.
|
|
6
|
-
|
|
7
|
-
Instead of storing a single flattened context document, Cliper Memory models a repository as interconnected memory objects, enabling AI systems to understand software at a much higher semantic level.
|
|
1
|
+
# Cliper Memory
|
|
2
|
+
> **New to Cliper?** Start with the [friendly tour](https://github.com/bristinWild/cliper-sdk/blob/main/About-Cliper.md).
|
|
8
3
|
|
|
9
4
|
> Transform any repository into a persistent AI memory graph.
|
|
10
5
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Why?
|
|
14
|
-
|
|
15
|
-
Large language models struggle with large repositories because:
|
|
16
|
-
|
|
17
|
-
- Repository context exceeds token limits
|
|
18
|
-
- Important relationships are lost in flattened documents
|
|
19
|
-
- Git history is ignored
|
|
20
|
-
- Architecture is difficult to infer
|
|
21
|
-
- Dependencies become disconnected
|
|
22
|
-
|
|
23
|
-
Cliper Memory solves this by converting repositories into structured memories that preserve relationships between files, modules, commits, packages, architecture, and future project artifacts.
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Features
|
|
28
|
-
|
|
29
|
-
### Repository Intelligence
|
|
6
|
+
**Git stores source code. Cliper stores engineering knowledge.**
|
|
30
7
|
|
|
31
|
-
-
|
|
32
|
-
- Git Memory
|
|
33
|
-
- File Summary Memory
|
|
34
|
-
- Dependency Memory
|
|
35
|
-
- Architecture Memory
|
|
36
|
-
- Responsibility Memory
|
|
37
|
-
- External Package Memory
|
|
38
|
-
- Gap Detection Memory
|
|
39
|
-
- Commit Memory
|
|
8
|
+
Every AI conversation about your codebase currently starts from zero - you re-send files, re-explain architecture, re-describe decisions. Cliper Memory inverts this: run `cliper init` once, and your repository becomes a structured knowledge graph in Cognee Cloud - typed memories connected by explicit relationships - that any AI application can query from that point on.
|
|
40
9
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
10
|
+
```text
|
|
11
|
+
Repository
|
|
12
|
+
│
|
|
13
|
+
▼
|
|
14
|
+
cliper init ← scan, extract, structure
|
|
15
|
+
│
|
|
16
|
+
▼
|
|
17
|
+
Structured Memories ← 10+ typed memory objects
|
|
18
|
+
│
|
|
19
|
+
▼
|
|
20
|
+
Cognee Cloud ← knowledge graph (cognify)
|
|
21
|
+
│
|
|
22
|
+
├──────────────┐
|
|
23
|
+
▼ ▼
|
|
24
|
+
Mobile App AI Agents
|
|
25
|
+
│ │
|
|
26
|
+
└──────┬───────┘
|
|
27
|
+
▼
|
|
28
|
+
Persistent Engineering Knowledge
|
|
29
|
+
```
|
|
50
30
|
|
|
51
31
|
---
|
|
52
32
|
|
|
53
|
-
##
|
|
33
|
+
## Requirements
|
|
54
34
|
|
|
55
|
-
|
|
35
|
+
- **Node.js 18+** (native `fetch` is used throughout)
|
|
36
|
+
- A **GitHub Personal Access Token** - `repo` (or `public_repo`) scope, used to fetch issues and pull requests
|
|
37
|
+
- A **Cognee Cloud** account - base URL and API key from your dashboard
|
|
56
38
|
|
|
57
|
-
|
|
39
|
+
## Installation
|
|
58
40
|
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
│
|
|
62
|
-
├── Git
|
|
63
|
-
│ ├── Commit
|
|
64
|
-
│ └── Release
|
|
65
|
-
│
|
|
66
|
-
├── Architecture
|
|
67
|
-
│ ├── Module
|
|
68
|
-
│ ├── Dependency
|
|
69
|
-
│ └── Responsibility
|
|
70
|
-
│
|
|
71
|
-
├── Files
|
|
72
|
-
│
|
|
73
|
-
├── Packages
|
|
74
|
-
│
|
|
75
|
-
├── Issues
|
|
76
|
-
│
|
|
77
|
-
├── Pull Requests
|
|
78
|
-
│
|
|
79
|
-
└── Discussions
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g cliper-memory
|
|
80
43
|
```
|
|
81
44
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
- unique identifier
|
|
85
|
-
- memory type
|
|
86
|
-
- metadata
|
|
87
|
-
- semantic relationships
|
|
88
|
-
- searchable content
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## Example Memory
|
|
93
|
-
|
|
94
|
-
```json
|
|
95
|
-
{
|
|
96
|
-
"id": "dependency:src/index.ts->src/commands/init",
|
|
97
|
-
"type": "dependency",
|
|
98
|
-
"title": "src/index.ts imports src/commands/init",
|
|
99
|
-
"relationships": [
|
|
100
|
-
"src/index.ts",
|
|
101
|
-
"src/commands/init"
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
```
|
|
45
|
+
This installs the `cliper` binary.
|
|
105
46
|
|
|
106
47
|
---
|
|
107
48
|
|
|
108
|
-
##
|
|
49
|
+
## Setup Guide
|
|
109
50
|
|
|
110
|
-
|
|
51
|
+
### 1. Authenticate
|
|
111
52
|
|
|
112
|
-
|
|
53
|
+
```bash
|
|
54
|
+
cliper auth
|
|
55
|
+
```
|
|
113
56
|
|
|
114
|
-
|
|
57
|
+
This runs two configuration steps:
|
|
115
58
|
|
|
116
|
-
-
|
|
117
|
-
- Memgraph
|
|
118
|
-
- Graphiti
|
|
119
|
-
- LanceDB
|
|
120
|
-
- Local JSON Memory
|
|
59
|
+
**GitHub** - paste your Personal Access Token. Cliper verifies it against the GitHub API and registers your user. The token is used to enrich repository memory with issues and pull requests.
|
|
121
60
|
|
|
122
|
-
|
|
61
|
+
**Cognee** - paste your Cognee Base URL (e.g. `https://tenant-xxxx.aws.cognee.ai`) and API Key. This is where your memory graphs are stored.
|
|
123
62
|
|
|
124
|
-
|
|
63
|
+
Credentials are written to `~/.cliper/config.json` with `0600` permissions. You can also configure a single provider:
|
|
125
64
|
|
|
126
65
|
```bash
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
cd cliper-memory
|
|
130
|
-
|
|
131
|
-
npm install
|
|
66
|
+
cliper auth github
|
|
67
|
+
cliper auth cognee
|
|
132
68
|
```
|
|
133
69
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
## Configuration
|
|
70
|
+
### 2. Initialize a repository
|
|
137
71
|
|
|
138
|
-
|
|
72
|
+
```bash
|
|
73
|
+
cd your-project
|
|
74
|
+
cliper init
|
|
75
|
+
```
|
|
139
76
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
77
|
+
The full pipeline runs in one command:
|
|
78
|
+
|
|
79
|
+
```text
|
|
80
|
+
✔ Scope detected: 22 paths active, 0 watched
|
|
81
|
+
✔ File tree built
|
|
82
|
+
✔ Extracted 43 files
|
|
83
|
+
✔ Git: main - feat: add restaking module
|
|
84
|
+
✔ References: 3 fetched, 0 failed
|
|
85
|
+
✔ Found 94 gaps (9 high priority)
|
|
86
|
+
✔ Dependency map: 70 edges, 13 external packages
|
|
87
|
+
✔ Context document built
|
|
88
|
+
✔ Repository registered with Cliper
|
|
89
|
+
✔ Cognee memory updated
|
|
143
90
|
```
|
|
144
91
|
|
|
145
|
-
|
|
92
|
+
What happened:
|
|
146
93
|
|
|
147
|
-
|
|
94
|
+
1. **Scope detection** - git activity analysis determines which paths matter; manual additions via `cliper scope` are preserved and merged.
|
|
95
|
+
2. **Extraction** - file tree annotation, source content extraction (default cap 50KB per file, configurable with `--max-file-size`), semantic labeling of what each file *does*.
|
|
96
|
+
3. **Intelligence passes** - dependency graph construction (internal edges + external packages), gap detection (undocumented patterns, ranked by severity), git context (commits, branch state), GitHub context (issues, pull requests), external reference resolution.
|
|
97
|
+
4. **Memory build** - everything is converted into typed, self-describing memory objects (see [Memory Types](#memory-types)) with explicit relationships.
|
|
98
|
+
5. **Sync** - memories are uploaded to your Cognee dataset (`cliper-<project>`) in parallel batches, then *cognified* into a knowledge graph. Chunked upload is deliberate: it keeps each ingestion unit small enough for Cognee's extraction pipeline to process reliably on real-world repositories.
|
|
99
|
+
6. **Local artifact** - a complete context document is written to `.cliper/context.md` for direct use with any LLM.
|
|
148
100
|
|
|
149
|
-
|
|
101
|
+
### 3. Use the memory
|
|
150
102
|
|
|
151
|
-
|
|
152
|
-
npm run build
|
|
103
|
+
**Paste context anywhere:**
|
|
153
104
|
|
|
154
|
-
|
|
105
|
+
```bash
|
|
106
|
+
cliper export | pbcopy # macOS
|
|
107
|
+
cliper export | xclip # Linux
|
|
155
108
|
```
|
|
156
109
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
---
|
|
110
|
+
**Query the graph** (via the Cognee search API, `GRAPH_COMPLETION` mode - this is what powers the Cliper mobile app's Ask mode):
|
|
160
111
|
|
|
112
|
+
```text
|
|
113
|
+
How is authentication implemented?
|
|
114
|
+
Which modules use the config loader?
|
|
115
|
+
What are the highest-priority gaps in this codebase?
|
|
116
|
+
How does the auth command relate to the init command?
|
|
117
|
+
```
|
|
161
118
|
|
|
162
|
-
|
|
119
|
+
Because memories are graph-connected rather than embedded in isolation, relationship questions ("how does X relate to Y", "what depends on Z") resolve through actual graph traversal instead of keyword proximity.
|
|
163
120
|
|
|
164
|
-
|
|
121
|
+
**Connect a coding agent:**
|
|
165
122
|
|
|
166
123
|
```bash
|
|
167
|
-
cliper
|
|
124
|
+
cliper agent connect
|
|
168
125
|
```
|
|
169
126
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
1. Scans the repository structure.
|
|
173
|
-
2. Extracts source code metadata.
|
|
174
|
-
3. Builds dependency and architecture relationships.
|
|
175
|
-
4. Analyzes Git history.
|
|
176
|
-
5. Detects repository gaps.
|
|
177
|
-
6. Converts everything into structured memory objects.
|
|
178
|
-
7. Uploads the memories to the configured Cognee dataset.
|
|
179
|
-
|
|
180
|
-
Once synchronized, the repository becomes a persistent knowledge graph stored in the user's Cognee cloud, allowing AI applications to query repository knowledge without repeatedly processing the entire codebase.
|
|
127
|
+
Detects locally installed agents (Claude Code, Codex, Cursor Agent), opens an authenticated WebSocket to the Cliper backend, and registers this machine as online - enabling remote task dispatch from the Cliper mobile app. Code execution always happens on your machine; only memory travels.
|
|
181
128
|
|
|
182
129
|
---
|
|
183
130
|
|
|
184
|
-
##
|
|
131
|
+
## Memory Types
|
|
185
132
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
Repository
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
Memory
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
133
|
+
Cliper does not upload raw files. Each unit of knowledge is a **typed memory object** - titled, tagged, related, and self-describing - so the graph understands *what kind of thing* it is storing:
|
|
134
|
+
|
|
135
|
+
| Memory Type | What it captures |
|
|
136
|
+
| --- | --- |
|
|
137
|
+
| **Repository Memory** | Identity of the project - name, purpose, top-level shape |
|
|
138
|
+
| **File Summary Memory** | Per-file semantic summary: what the file does, not just its name |
|
|
139
|
+
| **Responsibility Memory** | The role a file/module plays in the system |
|
|
140
|
+
| **Architecture Memory** | Module boundaries, layering, structural patterns |
|
|
141
|
+
| **Dependency Memory** | Internal import edges - who depends on whom |
|
|
142
|
+
| **External Package Memory** | Third-party packages and where they are used |
|
|
143
|
+
| **Git Memory** | Branch state, working tree context |
|
|
144
|
+
| **Commit Memory** | Individual commits with messages, authors, changed files |
|
|
145
|
+
| **Release Memory** | Release points in project history |
|
|
146
|
+
| **Timeline Memory** | The evolution of the repository over time |
|
|
147
|
+
| **Issue Memory** | GitHub issues attached to the repository |
|
|
148
|
+
| **Pull Request Memory** | GitHub PRs with their commit and file linkage |
|
|
149
|
+
|
|
150
|
+
## Relationship Graph
|
|
151
|
+
|
|
152
|
+
Memories are connected by explicit, first-class relationships - this is what makes Cliper a knowledge graph rather than a document dump:
|
|
153
|
+
|
|
154
|
+
```text
|
|
155
|
+
Repository ──▶ Commit Repository ──▶ Issue
|
|
156
|
+
Repository ──▶ Release Repository ──▶ Pull Request
|
|
157
|
+
Repository ──▶ Timeline
|
|
158
|
+
|
|
159
|
+
File ──▶ Dependency Commit ──▶ Changed Files
|
|
160
|
+
File ──▶ Responsibility Pull Request ──▶ Commit
|
|
161
|
+
Module ──▶ Architecture Pull Request ──▶ File
|
|
162
|
+
Package ──▶ Repository Release ──▶ Commit
|
|
209
163
|
```
|
|
210
164
|
|
|
211
|
-
|
|
165
|
+
A question like *"which files were touched by the PR that changed the auth flow?"* is a two-hop traversal (PR → Commit → Changed Files), not a similarity guess.
|
|
212
166
|
|
|
213
|
-
|
|
167
|
+
---
|
|
214
168
|
|
|
215
|
-
|
|
169
|
+
## Command Reference
|
|
216
170
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
- [
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
171
|
+
| Command | Description |
|
|
172
|
+
| --- | --- |
|
|
173
|
+
| `cliper init [-p path] [--max-file-size kb]` | Full scan → memory build → Cognee sync → backend registration |
|
|
174
|
+
| `cliper auth [github\|cognee]` | Configure credentials (`~/.cliper/config.json`) |
|
|
175
|
+
| `cliper agent connect` | Register local AI coding agents over WebSocket |
|
|
176
|
+
| `cliper sync` | Refresh stale sections of the context document |
|
|
177
|
+
| `cliper status` | Show what is fresh, stale, and in scope |
|
|
178
|
+
| `cliper scope <add\|remove\|watch\|list> [path]` | Manually steer what gets remembered |
|
|
179
|
+
| `cliper export [--format md\|txt]` | Print the context document to stdout |
|
|
180
|
+
| `cliper analyze --model <claude\|chatgpt>` | Generate a model-optimized prompt from the context |
|
|
226
181
|
|
|
227
|
-
|
|
182
|
+
## Configuration
|
|
228
183
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
184
|
+
| Location | Contents |
|
|
185
|
+
| --- | --- |
|
|
186
|
+
| `~/.cliper/config.json` | GitHub token, Cognee credentials (mode `0600`) |
|
|
187
|
+
| `.cliper/context.md` | Generated context document (per repo) |
|
|
188
|
+
| `.cliper/` scope config | Active/watched paths for this repo |
|
|
234
189
|
|
|
235
|
-
|
|
190
|
+
Cognee credentials can alternatively be provided via environment: `COGNEE_BASE_URL`, `COGNEE_API_KEY`.
|
|
236
191
|
|
|
237
|
-
|
|
238
|
-
- [ ] Repository Question Answering
|
|
239
|
-
- [ ] Multi-provider Support
|
|
240
|
-
- [ ] Incremental Memory Updates
|
|
241
|
-
- [ ] Live Repository Synchronization
|
|
192
|
+
`cliper init` automatically appends its artifacts to `.gitignore` and untracks accidentally committed `node_modules`.
|
|
242
193
|
|
|
243
194
|
---
|
|
244
195
|
|
|
245
|
-
##
|
|
196
|
+
## Roadmap
|
|
246
197
|
|
|
247
|
-
|
|
198
|
+
**Done** - repository knowledge graph (all memory types above), GitHub intelligence for issues/PRs, Cognee cloud provider with chunked sync, mobile companion (GitHub sign-in, repository browser, memory chat, live agent presence).
|
|
248
199
|
|
|
249
|
-
|
|
200
|
+
**In progress** - incremental sync (manifest-based, upload only changed memories), agent task execution pipeline (dispatch from phone → headless agent run → streamed edit/test/commit events).
|
|
250
201
|
|
|
251
|
-
|
|
202
|
+
**Planned** - multi-provider support (Neo4j, Memgraph, PostgreSQL + pgvector, Graphiti, LanceDB, local JSON), hybrid semantic search, developer SDK (`new Cliper().search(...)`, `.timeline()`, `.graph()`), team workspaces with cross-repository knowledge graphs, and a full agent ecosystem (refactoring, documentation, security review, PR review).
|
|
252
203
|
|
|
253
|
-
|
|
204
|
+
## Philosophy
|
|
254
205
|
|
|
255
|
-
|
|
256
|
-
- Explore architecture interactively.
|
|
257
|
-
- Ask questions about implementation details.
|
|
258
|
-
- Understand dependencies between modules.
|
|
259
|
-
- Navigate Git history conversationally.
|
|
260
|
-
- Retrieve repository knowledge without cloning the project.
|
|
206
|
+
The memory layer for software engineering. Instead of repeatedly sending repositories to AI models, developers initialize once, sync incrementally, and let AI applications and coding agents understand, search, and evolve software through a persistent knowledge graph.
|
|
261
207
|
|
|
262
|
-
|
|
208
|
+
Your code never leaves your machine - only its knowledge does.
|
|
263
209
|
|
|
264
210
|
---
|
|
265
211
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
MIT
|
|
212
|
+
**License:** MIT · **Issues & source:** [github.com/bristinWild/cliper-sdk](https://github.com/bristinWild/cliper-sdk)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function registerRepository(data: {
|
|
2
|
+
name: string;
|
|
3
|
+
githubOwner?: string;
|
|
4
|
+
githubRepo?: string;
|
|
5
|
+
branch: string;
|
|
6
|
+
dataset: string;
|
|
7
|
+
}): Promise<unknown>;
|
|
8
|
+
export declare function verifyCliAuth(token: string): Promise<{
|
|
9
|
+
id: string;
|
|
10
|
+
username: string;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/api/backend.ts"],"names":[],"mappings":"AAIA,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACnB,oBAiCA;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAO5F"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerRepository = registerRepository;
|
|
4
|
+
exports.verifyCliAuth = verifyCliAuth;
|
|
5
|
+
const config_1 = require("../config/config");
|
|
6
|
+
const API_URL = "http://localhost:4000";
|
|
7
|
+
async function registerRepository(data) {
|
|
8
|
+
const config = (0, config_1.loadConfig)();
|
|
9
|
+
const token = config.github?.token;
|
|
10
|
+
if (!token) {
|
|
11
|
+
throw new Error("GitHub is not configured. Run `cliper auth github`.");
|
|
12
|
+
}
|
|
13
|
+
console.log("Registering repository...");
|
|
14
|
+
console.log(data);
|
|
15
|
+
console.log(token);
|
|
16
|
+
console.log(`${API_URL}/repositories/register`);
|
|
17
|
+
const res = await fetch(`${API_URL}/repositories/register`, {
|
|
18
|
+
method: "POST",
|
|
19
|
+
headers: {
|
|
20
|
+
Authorization: `Bearer ${token}`,
|
|
21
|
+
"Content-Type": "application/json",
|
|
22
|
+
},
|
|
23
|
+
body: JSON.stringify(data),
|
|
24
|
+
});
|
|
25
|
+
if (!res.ok) {
|
|
26
|
+
throw new Error(await res.text());
|
|
27
|
+
}
|
|
28
|
+
return await res.json();
|
|
29
|
+
}
|
|
30
|
+
async function verifyCliAuth(token) {
|
|
31
|
+
const res = await fetch(`${API_URL}/auth/cli`, {
|
|
32
|
+
method: "POST",
|
|
33
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
34
|
+
});
|
|
35
|
+
if (!res.ok)
|
|
36
|
+
throw new Error(await res.text());
|
|
37
|
+
return (await res.json());
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=backend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../../src/api/backend.ts"],"names":[],"mappings":";;AAIA,gDAuCC;AAED,sCAOC;AApDD,6CAA8C;AAE9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CAAC,CAAC;IAC/C,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAqC,CAAC;AAClE,CAAC"}
|
package/dist/auth/github.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.getGithubToken = getGithubToken;
|
|
|
7
7
|
exports.saveGithubToken = saveGithubToken;
|
|
8
8
|
exports.hasGithubAuth = hasGithubAuth;
|
|
9
9
|
exports.getGithubHeaders = getGithubHeaders;
|
|
10
|
-
const config_1 = require("
|
|
10
|
+
const config_1 = require("../config/config");
|
|
11
11
|
const chalk_1 = __importDefault(require("chalk"));
|
|
12
12
|
function getGithubToken() {
|
|
13
13
|
return (0, config_1.loadConfig)().github?.token ?? null;
|
package/dist/auth/github.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/auth/github.ts"],"names":[],"mappings":";;;;;AAGA,wCAIC;AAED,0CAYC;AAED,sCAIC;AAED,4CAsBC;AAnDD,
|
|
1
|
+
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/auth/github.ts"],"names":[],"mappings":";;;;;AAGA,wCAIC;AAED,0CAYC;AAED,sCAIC;AAED,4CAsBC;AAnDD,6CAAyD;AACzD,kDAA0B;AAE1B,SAAgB,cAAc;IAE1B,OAAO,IAAA,mBAAU,GAAE,CAAC,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC;AAE9C,CAAC;AAED,SAAgB,eAAe,CAC3B,KAAa;IAGb,MAAM,MAAM,GAAG,IAAA,mBAAU,GAAE,CAAC;IAE5B,MAAM,CAAC,MAAM,GAAG;QACZ,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE;KACtB,CAAC;IAEF,IAAA,mBAAU,EAAC,MAAM,CAAC,CAAC;AAEvB,CAAC;AAED,SAAgB,aAAa;IAEzB,OAAO,cAAc,EAAE,KAAK,IAAI,CAAC;AAErC,CAAC;AAED,SAAgB,gBAAgB;IAE5B,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;IAE/B,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,OAAO,CAAC,GAAG,CACP,eAAK,CAAC,MAAM,CACR,6DAA6D,CAChE,CACJ,CAAC;IACN,CAAC;IAED,MAAM,OAAO,GAA2B;QACpC,MAAM,EAAE,6BAA6B;KACxC,CAAC;IAEF,IAAI,KAAK,EAAE,CAAC;QACR,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,KAAK,EAAE,CAAC;IACjD,CAAC;IAED,OAAO,OAAO,CAAC;AAEnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AA2BA,wBAAsB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgEjE"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.agentCommand = agentCommand;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const ora_1 = __importDefault(require("ora"));
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
10
|
+
const ws_1 = __importDefault(require("ws"));
|
|
11
|
+
const github_1 = require("../auth/github");
|
|
12
|
+
const WS_URL = "ws://localhost:4000/ws";
|
|
13
|
+
/** Which coding agents are installed on this machine? */
|
|
14
|
+
function detectAgents() {
|
|
15
|
+
const candidates = [
|
|
16
|
+
{ bin: "claude", name: "Claude Code" },
|
|
17
|
+
{ bin: "codex", name: "Codex CLI" },
|
|
18
|
+
{ bin: "cursor-agent", name: "Cursor Agent" },
|
|
19
|
+
];
|
|
20
|
+
return candidates
|
|
21
|
+
.filter(({ bin }) => {
|
|
22
|
+
try {
|
|
23
|
+
(0, child_process_1.execSync)(`which ${bin}`, { stdio: "ignore" });
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
.map(({ name }) => name);
|
|
31
|
+
}
|
|
32
|
+
async function agentCommand(action) {
|
|
33
|
+
if (action !== "connect") {
|
|
34
|
+
console.log(chalk_1.default.red(`Unknown action: ${action ?? "(none)"} — try: cliper agent connect`));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const token = (0, github_1.getGithubToken)();
|
|
38
|
+
if (!token) {
|
|
39
|
+
console.log(chalk_1.default.yellow("Not authenticated. Run: cliper auth github"));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
console.log(chalk_1.default.bold.cyan("\n cliper agent\n"));
|
|
43
|
+
const agents = detectAgents();
|
|
44
|
+
if (agents.length === 0) {
|
|
45
|
+
console.log(chalk_1.default.yellow(" ⚠ No coding agents detected (looked for claude, codex, cursor-agent)"));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
agents.forEach((a) => console.log(chalk_1.default.green(` ✓ ${a} detected`)));
|
|
49
|
+
}
|
|
50
|
+
const spinner = (0, ora_1.default)("Connecting to Cliper cloud...").start();
|
|
51
|
+
let heartbeat = null;
|
|
52
|
+
const connect = () => {
|
|
53
|
+
const ws = new ws_1.default(WS_URL, {
|
|
54
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
55
|
+
});
|
|
56
|
+
ws.on("open", () => {
|
|
57
|
+
spinner.succeed(chalk_1.default.green("Connected to Cliper cloud"));
|
|
58
|
+
ws.send(JSON.stringify({ type: "agent:register", agents }));
|
|
59
|
+
console.log(chalk_1.default.gray("\n Agent is online. Your phone can now see this machine."));
|
|
60
|
+
console.log(chalk_1.default.gray(" Waiting for tasks... (Ctrl+C to disconnect)\n"));
|
|
61
|
+
heartbeat = setInterval(() => ws.ping(), 20000);
|
|
62
|
+
});
|
|
63
|
+
ws.on("message", (raw) => {
|
|
64
|
+
try {
|
|
65
|
+
const msg = JSON.parse(raw.toString());
|
|
66
|
+
if (msg.type === "task") {
|
|
67
|
+
console.log(chalk_1.default.bold.magenta(` → Task received: ${msg.prompt}`));
|
|
68
|
+
console.log(chalk_1.default.gray(" (execution pipeline coming soon — acknowledging)"));
|
|
69
|
+
ws.send(JSON.stringify({ type: "task:ack", taskId: msg.taskId }));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
/* ignore malformed frames */
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
ws.on("close", () => {
|
|
77
|
+
if (heartbeat)
|
|
78
|
+
clearInterval(heartbeat);
|
|
79
|
+
console.log(chalk_1.default.yellow("\n Disconnected — retrying in 3s..."));
|
|
80
|
+
setTimeout(connect, 3000);
|
|
81
|
+
});
|
|
82
|
+
ws.on("error", (err) => {
|
|
83
|
+
spinner.fail(chalk_1.default.red(`Connection failed: ${err.message}`));
|
|
84
|
+
// 'close' fires after 'error' and handles the retry.
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
connect();
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":";;;;;AA2BA,oCAgEC;AA3FD,kDAA0B;AAC1B,8CAAsB;AACtB,iDAAyC;AACzC,4CAA2B;AAC3B,2CAAgD;AAEhD,MAAM,MAAM,GAAG,wBAAwB,CAAC;AAExC,yDAAyD;AACzD,SAAS,YAAY;IACjB,MAAM,UAAU,GAAG;QACf,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE;QACtC,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE;QACnC,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE;KAChD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sDAAsD,CAAC,CAAC,CAAC;oBAChF,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;gBACtE,CAAC;YACL,CAAC;YAAC,MAAM,CAAC;gBACL,6BAA6B;YACjC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YAChB,IAAI,SAAS;gBAAE,aAAa,CAAC,SAAS,CAAC,CAAC;YACxC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,sCAAsC,CAAC,CAAC,CAAC;YAClE,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACnB,OAAO,CAAC,IAAI,CAAC,eAAK,CAAC,GAAG,CAAC,sBAAsB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAC7D,qDAAqD;QACzD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,EAAE,CAAC;AACd,CAAC"}
|
package/dist/commands/auth.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAKA,wBAAsB,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BlE"}
|