@iqlabs-official/git-sdk 0.1.0 → 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.
Files changed (2) hide show
  1. package/README.md +67 -36
  2. package/package.json +20 -8
package/README.md CHANGED
@@ -1,49 +1,80 @@
1
- # @iqlabs/git
1
+ # @iqlabs-official/git-sdk
2
2
 
3
- IQ Labs 의 on-chain git SDK. 브라우저 / Node 양쪽 지원. IQ Git v2 스키마 구현체.
3
+ Embed on-chain Git into your Solana dApp. Browser SDK for letting users browse, create, and commit to repositories from your website, with a Node entry for tooling.
4
4
 
5
- ## 상위 문서
5
+ ## Install
6
6
 
7
- 이 repo 는 `iq-git-cli` 에 있는 v2 설계 문서의 일부를 구현합니다.
7
+ ```bash
8
+ npm install @iqlabs-official/git-sdk
9
+ ```
10
+
11
+ Peer deps: `@solana/web3.js`, `@iqlabs-official/solana-sdk` (aliased as `iqlabs-sdk`), `buffer`.
12
+
13
+ ## Usage
8
14
 
9
- - 전체 설계: [../iq-git-cli/IQGIT-V2-PLAN.md](../iq-git-cli/IQGIT-V2-PLAN.md)
10
- - 글로벌 TODO: [../iq-git-cli/IQGIT-V2-TODO.md](../iq-git-cli/IQGIT-V2-TODO.md)
11
- - 코드 법칙: [../iq-git-cli/CODE-RULES.md](../iq-git-cli/CODE-RULES.md)
12
- - 본 repo TODO: [./TODO.md](./TODO.md)
15
+ ### Browser (frontend / dApp)
13
16
 
14
- ## 구조
17
+ ```ts
18
+ import { GitClient, readRegistryPage } from "@iqlabs-official/git-sdk/browser";
19
+ import { useConnection, useWallet } from "@solana/wallet-adapter-react";
15
20
 
21
+ const { connection } = useConnection();
22
+ const wallet = useWallet();
23
+
24
+ // Read-only — no wallet required.
25
+ const entries = await readRegistryPage(connection, { limit: 50 });
26
+
27
+ // Write — needs a connected wallet adapter.
28
+ const client = new GitClient({
29
+ connection,
30
+ signer: {
31
+ publicKey: wallet.publicKey!,
32
+ signTransaction: wallet.signTransaction!,
33
+ signAllTransactions: wallet.signAllTransactions!,
34
+ },
35
+ });
36
+
37
+ await client.createRepo({
38
+ name: "my-repo",
39
+ description: "hello on-chain",
40
+ isPublic: true,
41
+ timestamp: Date.now(),
42
+ });
16
43
  ```
17
- src/
18
- ├─ index.ts ← "@iqlabs/git" (shared)
19
- ├─ browser.ts ← "@iqlabs/git/browser"
20
- ├─ node.ts ← "@iqlabs/git/node"
21
- ├─ core/ ← L0 types, seed, hash, chunk, codec, errors
22
- ├─ wallet/ ← L0 Signer 추상
23
- ├─ chain/ ← L1 iqlabs-sdk 래퍼 + gateway fallback
24
- ├─ storage/ ← L2 BlobStore, TreeStore
25
- ├─ model/ ← L3 RepoService, CommitService, RegistryService
26
- ├─ client/ ← L4 GitClient (facade)
27
- └─ platform/ ← fs-node / fs-browser
28
-
29
- scripts/
30
- └─ bootstrap-registry.ts ← git_repos:all createTable (admin, 1회)
44
+
45
+ ### Node (CLI / scripts)
46
+
47
+ ```ts
48
+ import { GitClient } from "@iqlabs-official/git-sdk/node";
49
+ import { Connection, Keypair } from "@solana/web3.js";
50
+
51
+ const connection = new Connection(process.env.SOLANA_RPC_ENDPOINT!);
52
+ const signer = Keypair.fromSecretKey(/* your secret key */);
53
+ const client = new GitClient({ connection, signer });
54
+
55
+ await client.commit("my-repo", "initial", scan);
31
56
  ```
32
57
 
33
- ## 레이어 규칙
58
+ ## API surface
34
59
 
35
- `CODE-RULES.md` 따르며 추가로:
60
+ - `GitClient` — high-level workflows: `createRepo`, `commit`, `checkout`, `clone`, `log`, `status`.
61
+ - `readOwnerRepos`, `readRegistryPage` — owner repo list + public gallery.
62
+ - `readLatestCommit`, `readCommitHistory` — direct commit-table reads.
63
+ - `loadTree`, `loadBlob` — pull a stored `tree.json` or file blob by tx signature.
64
+ - `bootstrapRegistry` — one-time admin call to initialize the global registry table on a fresh network.
36
65
 
37
- - 상위 레이어는 **바로 아래 레이어만** import
38
- - `core/` 는 DOM / node fs 금지
39
- - `browser.ts` 는 `@solana/wallet-adapter-base` (타입만) OK
40
- - `node.ts` 는 `node:fs`, `node:crypto` OK
41
- - 위반은 eslint `no-restricted-imports` 로 빌드 시 차단
66
+ `SignerInput` from `@iqlabs-official/solana-sdk` is accepted everywhere a signer is needed: a `Keypair`, a web3.js `Signer`, or a wallet adapter object with `signTransaction` / `signAllTransactions`.
42
67
 
43
- ## 로컬 개발
68
+ ## Subpath entries
44
69
 
45
- ```bash
46
- npm install
47
- npm run build -- --watch
48
- npm link # 다른 repo 에서 npm link @iqlabs/git
49
- ```
70
+ | Import | When to use |
71
+ |---|---|
72
+ | `@iqlabs-official/git-sdk` | Types and pure functions only. No SHA-256 backend installed. |
73
+ | `@iqlabs-official/git-sdk/browser` | Installs SubtleCrypto SHA-256. Use this in browser apps. |
74
+ | `@iqlabs-official/git-sdk/node` | Installs `node:crypto` SHA-256. Use this in CLI / server. |
75
+
76
+ Importing the appropriate platform entry exactly once is required before calling any function that hashes content (e.g. `commit`, `status`).
77
+
78
+ ## License
79
+
80
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iqlabs-official/git-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Embed on-chain Git into your Solana dApp. Browser SDK for letting users browse, create, and commit to repositories from your website, with a Node entry for tooling.",
5
5
  "keywords": [
6
6
  "solana",
@@ -18,16 +18,28 @@
18
18
  "./dist/browser/index.js"
19
19
  ],
20
20
  "exports": {
21
- ".": { "types": "./dist/shared/index.d.ts", "import": "./dist/shared/index.js" },
22
- "./browser": { "types": "./dist/browser/index.d.ts", "import": "./dist/browser/index.js" },
23
- "./node": { "types": "./dist/node/index.d.ts", "import": "./dist/node/index.js" }
21
+ ".": {
22
+ "types": "./dist/shared/index.d.ts",
23
+ "import": "./dist/shared/index.js"
24
+ },
25
+ "./browser": {
26
+ "types": "./dist/browser/index.d.ts",
27
+ "import": "./dist/browser/index.js"
28
+ },
29
+ "./node": {
30
+ "types": "./dist/node/index.d.ts",
31
+ "import": "./dist/node/index.js"
32
+ }
24
33
  },
25
- "files": ["dist", "README.md"],
34
+ "files": [
35
+ "dist",
36
+ "README.md"
37
+ ],
26
38
  "scripts": {
27
- "build": "tsup",
39
+ "build": "tsup",
28
40
  "typecheck": "tsc --noEmit",
29
- "lint": "eslint src --max-warnings=0",
30
- "test": "vitest run"
41
+ "lint": "eslint src --max-warnings=0",
42
+ "test": "vitest run"
31
43
  },
32
44
  "peerDependencies": {
33
45
  "@solana/web3.js": "^1.98.0",