earthstar-project / earthstar-cli Goto Github PK
View Code? Open in Web Editor NEWA complete Earthstar toolbox in the console.
License: GNU Lesser General Public License v3.0
A complete Earthstar toolbox in the console.
License: GNU Lesser General Public License v3.0
earthstar identities generate foobar
ValidationError: name must be between 4 and 4 characters long, but is 6
My first choice was > 4 and I imagine most people will do that too...
Error is a somewhat confusing read also 😅
Length ~ 16 chars to avoid this?
Do a bulk import/export between earthstar documents and a directory of files.
This might require a lot of configuration, maybe it's better as a separate script.
How do we make earthstar paths safe to use as filenames?
Do we allow subdirectories, or put everything in one flat directory?
Can we use timestamps for two-way sync, or do we have to ask the user what to do when the data doesn't match?
How do we tell the difference between deleted files and empty files? Earthstar doesn't have deletion yet, only empty values (See earthstar-project/earthstar#20 Deletion)
Do we represent directories themselves in Earthstar, or ignore them?
The CLI interacts with the filesystem in two ways:
ReplicaDriverFs
. The contents of this directory are meant to be opaque to users.earthstar share sync-fs
command, writing changes from the disk to the replica and vice versa. The contents of this directory are intended to be interacted with by users.I saw this cause some confusion with testers before the CLI was launched. Which is the one for Earthstar's use, and which one is for users to interact with?
The only idea I have to counter this is to hide the directories used by ReplicaDriverFs
entirely, and ferret them into some application support folder someplace.
Versions:
The Deno.setRaw() error happens when running a command like "earthstar shares latest":
$ earthstar shares latest
? Choose a share › error: Uncaught (in promise) TypeError: Deno.setRaw is not a function
(Deno.setRaw as setRaw)(
^
at Input.#readChar (https://deno.land/x/[email protected]/prompt/_generic_prompt.ts:285:30)
at Input.#readKey (https://deno.land/x/[email protected]/prompt/_generic_prompt.ts:273:50)
at Input.read (https://deno.land/x/[email protected]/prompt/_generic_prompt.ts:169:52)
at Input.#execute (https://deno.land/x/[email protected]/prompt/_generic_prompt.ts:111:21)
at async Input.prompt (https://deno.land/x/[email protected]/prompt/_generic_prompt.ts:90:14)
at async Command.fn (https://deno.land/x/[email protected]/src/share.ts:490:36)
at async Command.execute (https://deno.land/x/[email protected]/command/command.ts:1026:7)
at async Command.parse (https://deno.land/x/[email protected]/command/command.ts:940:16)
at async https://deno.land/x/[email protected]/src/main.ts:23:1
Seems to be related to this denoland/deno#15796
Downgrade Deno to version 1.25.4 for now.
When trying to follow instructions from https://earthstar-project.org/get-started/install-cli
, there is an error and the cli does not install.
command:
deno install --allow-read --allow-write --allow-net --allow-run --allow-env --no-check --unstable -f --location https://earthstar-project.org -n earthstar https://deno.land/x/earthstar_cli/src/main.ts
error:
error: Module not found "https://deno.land/x/crayon/types.ts". at https://deno.land/x/[email protected]/index.ts:8:24
❯ deno --version
deno 1.23.1 (release, aarch64-apple-darwin)
v8 10.4.132.8
typescript 4.7.2
🤷
Add support for generating and redeeming Earthstar invitation URLs.
Add some commands to make it easier to import/export single documents to files, either as JSON (including the document metadata) or just as the document content.
// new commands
earthstar document
earthstar content [--binary]
// new flags to existing command
earthstar set --fromFile <filename> [--binary]
Usage
// print out a whole document as JSON
earthstar document <dbFilename> <path>
// prints out just document.content
earthstar content <dbFilename> <path>
// redirect it to a file, to export the data out of earthstar
earthstar content <dbFilename> <path> > myfile
// read data from a file to use as the document's content
earthstar set <dbFilename> <authorFile> <path> --fromFile <filename>
// new option --binary means treat the file as binary instead of utf-8
// which means it needs to be encoded/decoded to base64 for storage in Earthstar
earthstar content <dbFilename> <path> --binary
earthstar set <dbFilename> <authorFile> <path> --fromFile <filename> --binary
Or maybe instead of --fromFile
, it could try to read from stdin so you could do earthstar set db.sqlite author.json /path < myfile
Tested running the Earthstar cli on a Windows Powershell and command prompt.
It all installs well, but there seems to be a functional issue with the "shares" command where it never returns the control back to the user.
Environment:
Windows 10 Pro Version 21H1 (OS Build 19043.1645)
PowerShell 7.2.2
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
PS C:\Users\johan> earthstar --version
v8.3.3
PS C:\Users\johan> deno --version
deno 1.21.0 (release, x86_64-pc-windows-msvc)
v8 10.0.139.17
typescript 4.6.2
Creating an identity and setting up a share worked in the C:\Users\johan\Shares
folder. The sharename.sqlite
and sharename.sqlite-journal
files are created.
However the command which are related to "shares" never seem to finish or return back the prompt to the user.
The command earthstar shares list
does not end; unclear why. Tried using elevated command prompt without success.
The command earthstar identities list
works fine.
The command earthstar upgrade
works fine.
The command earthstar servers list
works fine.
Tried adding the "deno.exe" executable to the "allowed apps" list, but it does not seem to make a difference.
If running...
npm install --global earthstar-cli
Gives the error...
> node-gyp rebuild --release
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!```
The problem is related to setup of the xcode command line tools. They might already be set up, but node is picky about them. (node-gyp is the build tool that compiles native C code such as SQLite, which is used inside Earthstar.)
At least on MacOS Catalina (15), the solution is
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
Sources:
The NPM CLI seems very outdated. Maybe it should have a warning that it doesn't work anymore?
(After earthstar-project/earthstar-pub#3 Make earthstar-pub an importable module)
Would it make sense to embed earthstar-pub
into the cli here, to quickly launch a pub?
Would it be useful to show a live stream of write events from a pub, in the command line?
testing inside denoland/deno:alpine-1.25.4
(https://hub.docker.com/r/denoland/deno/)
earthstar identities generate foob --current
Added @foob to stored identities.
/ # earthstar shares generate foob
Generated share address.
? No directory for storing shares has been set yet. Where you would you like it? (/root/Shares) › /root/Shares
Added +foob.kvebxpmd1k0a
'schemaVersion share~/Shares # earthstar shares set
? Choose a share › +foob.kvebxpmd1k0a
? Choose a path › foo.txt
? Enter document content › barbar
Could not set the document.
invalid_document
$ deno install --allow-read --allow-write --allow-net --allow-run --allow-env --no-check --unstable -f --location https://earthstar-project.org -n earthstar https://deno.land/x/earthstar_cli/src/main.ts
Download https://deno.land/x/crayon/types.ts
Warning Implicitly using latest version (3.3.2) for https://deno.land/x/crayon/types.ts
Download https://deno.land/x/[email protected]/types.ts
error: Module not found "https://deno.land/x/crayon/types.ts".
at https://deno.land/x/[email protected]/index.ts:8:24
deno 1.23.3 (release, x86_64-apple-darwin)
v8 10.4.132.8
typescript 4.7.4
If I run:
docker build -t earthstar-project/earthstar:latest .
With the following Dockerfile:
FROM denoland/deno:alpine-1.25.4
RUN deno install \
--allow-read \
--allow-write \
--allow-net \
--allow-run \
--allow-env \
--no-check \
--unstable \
-f \
--location https://earthstar-project.org \
-n earthstar \
https://deno.land/x/earthstar_cli/src/main.ts
Then I'm basically good to go to have an image which I can use to package for Co-op Cloud.
The thing to figure out in this issue is how to publish these images as the CLI changes.
It would be best if you would consider publishing yourselves here from this repo via some CI thingy? Or manually:
docker build -t earthstar-project/earthstar:latest .
docker push earthstar-project/earthstar
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.