@arcadiasystems/morse-cli 0.1.0
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/CHANGELOG.md +58 -0
- package/LICENSE +21 -0
- package/README.md +294 -0
- package/dist/index.js +1962 -0
- package/docs/QUICKSTART.md +205 -0
- package/package.json +64 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Morse CLI quick start
|
|
2
|
+
|
|
3
|
+
This walks a new user from an empty machine to a published, readable entry on
|
|
4
|
+
Sui testnet, then tears it down. Every command is copy-pasteable; expected
|
|
5
|
+
output is shown beneath each step. Replace IDs in later steps with the ones your
|
|
6
|
+
own runs print.
|
|
7
|
+
|
|
8
|
+
## 0. Prerequisites
|
|
9
|
+
|
|
10
|
+
- Install [Bun](https://bun.sh) >= 1.2.
|
|
11
|
+
- Have a Sui testnet keypair. If you use the Sui CLI, export one with
|
|
12
|
+
`sui keytool export --key-identity <alias>` to get a `suiprivkey1...` string.
|
|
13
|
+
- Fund the address with testnet SUI ([faucet](https://faucet.sui.io/)) for gas,
|
|
14
|
+
and with WAL ([Walrus faucet](https://docs.walrus.site/usage/web-tool.html))
|
|
15
|
+
for content uploads.
|
|
16
|
+
|
|
17
|
+
Install the CLI:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
bun add -g @arcadiasystems/morse-cli
|
|
21
|
+
morse --version
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 1. Create a profile
|
|
25
|
+
|
|
26
|
+
A profile pins the network. The first profile you add becomes the default.
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
morse config add testnet --network testnet
|
|
30
|
+
```
|
|
31
|
+
```
|
|
32
|
+
Saved profile "testnet" (testnet).
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 2. Import your key
|
|
36
|
+
|
|
37
|
+
`account import` prompts for the secret key and a keystore password, both hidden.
|
|
38
|
+
The key is encrypted at rest (scrypt + AES-256-GCM) and never stored in plaintext.
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
morse account import
|
|
42
|
+
```
|
|
43
|
+
```
|
|
44
|
+
Private key (suiprivkey...):
|
|
45
|
+
New keystore password:
|
|
46
|
+
Confirm password:
|
|
47
|
+
Imported account 0x830b... (profile "testnet").
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Confirm the active account:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
morse account show
|
|
54
|
+
```
|
|
55
|
+
```
|
|
56
|
+
0x830bd528f47068329ddbc9fcbd1f0ead051e01b0538897bb260c4c299f44ba3e
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 3. Create a publication
|
|
60
|
+
|
|
61
|
+
`publication create` selects the new publication as your active one, so the next
|
|
62
|
+
steps need no ids.
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
morse publication create --name "My Blog" --slug my-blog
|
|
66
|
+
```
|
|
67
|
+
```
|
|
68
|
+
Created "My Blog" (0x9f3c...)
|
|
69
|
+
ownerCap: 0x1205...
|
|
70
|
+
publisherCap: 0x6b6c...
|
|
71
|
+
tx: EScsJc...
|
|
72
|
+
Selected as the active publication.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Check the active context any time:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
morse status
|
|
79
|
+
```
|
|
80
|
+
```
|
|
81
|
+
profile: testnet
|
|
82
|
+
network: testnet
|
|
83
|
+
account: 0x830b...
|
|
84
|
+
publication: 0x9f3c...
|
|
85
|
+
collection: (none)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 4. Create a collection
|
|
89
|
+
|
|
90
|
+
Collections group entries and fix a storage mode (`blob` or `quilt`) at creation.
|
|
91
|
+
This one becomes the active collection.
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
morse collection create posts --mode blob
|
|
95
|
+
```
|
|
96
|
+
```
|
|
97
|
+
Created collection "posts". Selected as the active collection. (tx: DacDfQ...)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 5. Add an entry from a file
|
|
101
|
+
|
|
102
|
+
This uploads the file to Walrus and attaches it as the first revision of a new
|
|
103
|
+
entry. The active publication and collection are used; content type is inferred
|
|
104
|
+
from the extension.
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
echo "hello morse" > post.txt
|
|
108
|
+
morse entry add first-post --file post.txt
|
|
109
|
+
```
|
|
110
|
+
```
|
|
111
|
+
Uploading 12 bytes to Walrus...
|
|
112
|
+
Added entry #0 "first-post". (tx: D9Yfjk...)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## 6. Read it back
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
morse entry get 0
|
|
119
|
+
```
|
|
120
|
+
```
|
|
121
|
+
#0 first-post
|
|
122
|
+
publicHead: 0 draftHead: none
|
|
123
|
+
revisions: 1
|
|
124
|
+
[0] text/plain (blob 0x57fb...) by 0x830b...
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
List everything in the active collection:
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
morse entry list
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## 7. Publish a new revision
|
|
134
|
+
|
|
135
|
+
Append another version of the content as a public revision:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
echo "hello morse, revised" > post-v2.txt
|
|
139
|
+
morse revision publish-direct 0 --file post-v2.txt
|
|
140
|
+
```
|
|
141
|
+
```
|
|
142
|
+
Uploading 21 bytes to Walrus...
|
|
143
|
+
Blob uploaded (0x...). Submitting transaction...
|
|
144
|
+
Published revision #1 on entry #0. (tx: ...)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## 8. (Optional) Encrypted content
|
|
148
|
+
|
|
149
|
+
Add an encrypted entry and decrypt it back. Encryption uses Seal; decryption
|
|
150
|
+
signs a short-lived SessionKey with your active account.
|
|
151
|
+
|
|
152
|
+
```sh
|
|
153
|
+
echo "for subscribers only" > secret.txt
|
|
154
|
+
morse entry add-encrypted members --file secret.txt
|
|
155
|
+
```
|
|
156
|
+
```
|
|
157
|
+
Encrypting and uploading 21 bytes...
|
|
158
|
+
Added encrypted entry #1 "members". (tx: ...)
|
|
159
|
+
```
|
|
160
|
+
```sh
|
|
161
|
+
morse entry decrypt 1 --out recovered.txt
|
|
162
|
+
cat recovered.txt
|
|
163
|
+
```
|
|
164
|
+
```
|
|
165
|
+
Fetching ciphertext from Walrus...
|
|
166
|
+
Signing a SessionKey with the active account...
|
|
167
|
+
Wrote 21 bytes to recovered.txt.
|
|
168
|
+
for subscribers only
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## 9. Tear down
|
|
172
|
+
|
|
173
|
+
Delete in reverse order: entries, then the collection, then the publication. A
|
|
174
|
+
publication must be empty (no collections) before it can be deleted. These use
|
|
175
|
+
the active context; `publication delete` clears the active publication.
|
|
176
|
+
|
|
177
|
+
```sh
|
|
178
|
+
morse entry delete 0 --yes
|
|
179
|
+
morse entry delete 1 --yes
|
|
180
|
+
morse collection delete posts --yes
|
|
181
|
+
morse publication delete --yes
|
|
182
|
+
```
|
|
183
|
+
```
|
|
184
|
+
Deleted entry #0. (tx: ...)
|
|
185
|
+
Deleted entry #1. (tx: ...)
|
|
186
|
+
Deleted collection "posts". (tx: ...)
|
|
187
|
+
Deleted 0x9f3c.... (tx: ...)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
To work on a different existing publication later, switch context with
|
|
191
|
+
`morse use <slug-or-id>` (and optionally a collection): `morse use my-blog posts`.
|
|
192
|
+
|
|
193
|
+
## Scripting tips
|
|
194
|
+
|
|
195
|
+
- Add `--json` (before the subcommand) for machine-readable output, and parse
|
|
196
|
+
stdout only. Example: `morse --json publication list | jq '.results[].publicationId'`.
|
|
197
|
+
- In CI, set `MORSE_PRIVATE_KEY` and `MORSE_KEYSTORE_PASSWORD` so commands run
|
|
198
|
+
without prompts, and pass `--yes` to skip confirmations.
|
|
199
|
+
- Check `$?`: `0` success, `1` generic error (contract abort, validation), `2`
|
|
200
|
+
usage/declined, `3` not found, `4` auth, `5` network. See the README for the
|
|
201
|
+
full table.
|
|
202
|
+
|
|
203
|
+
The output shown above is illustrative; exact IDs, digests, and the human-text
|
|
204
|
+
format may differ between runs and releases. Parse `--json` output for anything
|
|
205
|
+
a script depends on.
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@arcadiasystems/morse-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Command-line interface for the Morse decentralized CMS on Sui.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"sui",
|
|
12
|
+
"walrus",
|
|
13
|
+
"seal",
|
|
14
|
+
"cms",
|
|
15
|
+
"cli",
|
|
16
|
+
"decentralized",
|
|
17
|
+
"blockchain"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/arcadiasystems/morse-dcms.git",
|
|
22
|
+
"directory": "morse-cli"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/arcadiasystems/morse-dcms/tree/main/morse-cli#readme",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/arcadiasystems/morse-dcms/issues"
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"morse": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"docs",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE",
|
|
36
|
+
"CHANGELOG.md"
|
|
37
|
+
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18",
|
|
40
|
+
"bun": ">=1.2.0"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"start": "bun src/index.ts",
|
|
44
|
+
"build": "bun build src/index.ts --target node --packages external --outfile dist/index.js",
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
46
|
+
"lint": "biome check .",
|
|
47
|
+
"lint:fix": "biome check --write .",
|
|
48
|
+
"test": "bun test",
|
|
49
|
+
"test:coverage": "bun test --coverage",
|
|
50
|
+
"prepublishOnly": "tsc --noEmit && biome check . && bun test && bun run build"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@arcadiasystems/morse-sdk": "^0.1.4",
|
|
54
|
+
"@mysten/seal": "1.1.3",
|
|
55
|
+
"@mysten/sui": "2.16.2",
|
|
56
|
+
"@mysten/walrus": "1.1.6",
|
|
57
|
+
"commander": "^14.0.3"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@biomejs/biome": "2.4.7",
|
|
61
|
+
"@types/bun": "latest",
|
|
62
|
+
"typescript": "^5.6.0"
|
|
63
|
+
}
|
|
64
|
+
}
|