zrcadlo https://github.com/atscan/atscan
remove cli, future is go cli
This commit is contained in:
rodič
d8b47f1a63
revize
79384e36d0
|
@ -6,6 +6,10 @@ This is a monorepo containing the backend and frontend of ATScan.
|
|||
|
||||
The current version is hosted at [atscan.net](https://atscan.net). You can follow us on Bluesky as [@atscan.net](https://bsky.app/profile/did:plc:ft3tl5dxjn4psdk6asenqn3r).
|
||||
|
||||
## Our libraries
|
||||
|
||||
- [broadsky](https://github.com/atscan/broadsky) - Bridge Streaming Wire Protocol (v0) to NATS and other protocols
|
||||
|
||||
## Technology stack
|
||||
|
||||
### Infrastructure
|
||||
|
@ -30,10 +34,6 @@ The current version is hosted at [atscan.net](https://atscan.net). You can follo
|
|||
- [Numbro](https://numbrojs.com/) number library
|
||||
- [Minidenticons](https://github.com/laurentpayot/minidenticons) identicon generator
|
||||
|
||||
### CLI
|
||||
- [Deno](https://deno.land/) JavaScript runtime
|
||||
- [Cliffy](https://cliffy.io/) commandline framework
|
||||
|
||||
## Authors
|
||||
- Tree (GitHub: [@burningtree](https://github.com/burningtree), Bluesky: [@tree.fail](https://bsky.app/profile/did:plc:524tuhdhh3m7li5gycdn6boe))
|
||||
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
|
||||
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
|
||||
import jsonata from "npm:jsonata"
|
||||
import { inspect, read } from "../backend/lib/car.js";
|
||||
|
||||
await new Command()
|
||||
.name("ats-repo")
|
||||
.action(() => { console.log("Please specify command or use `-h`") })
|
||||
.command("car-inspect,ci", "Inspect CAR file")
|
||||
.option("--did <val:string>", "DID", { required: true })
|
||||
.option("--signing-key <val:string>", "Signing key", { required: true })
|
||||
.arguments("<file:string>", 'Input CAR file')
|
||||
.example("Inspect CAR file", "ats r ci --did did:plc:ixko5wwzamist35uptkjae7p --signing-key did:key:zQ3shXv3xDNbJfYiMtyNT3E6buJtgKwQTYpoJu6NJDU2EHyVj backend/db/repos/test.car")
|
||||
.action(async ({ did, signingKey }, file) => {
|
||||
const out = await inspect(await Deno.readFile(file), did, signingKey)
|
||||
console.log(JSON.stringify(out, null, 2))
|
||||
})
|
||||
.command("remote-car-inspect,rci", "Inspect remote CAR file")
|
||||
.option('--checkout,-c', "Read checkout data")
|
||||
.option('--query,-q <query>', "Query result with JSONata")
|
||||
.option('--debug', "Debug")
|
||||
.arguments("<did:string>", 'DID')
|
||||
.action(async ({ debug, checkout, query }, did) => {
|
||||
// get did info
|
||||
const didRes = await fetch('https://api.atscan.net/'+did)
|
||||
if (!didRes.ok) {
|
||||
console.error(`Error: ${didRes.status} ${didRes.statusText}`)
|
||||
return;
|
||||
}
|
||||
const didInfo = await didRes.json()
|
||||
const signingKey = didInfo.revs[didInfo.revs.length-1].operation.verificationMethods.atproto
|
||||
// fetch remote repo
|
||||
const repo = await fetch(`${didInfo.pds[0]}/xrpc/com.atproto.sync.getRepo?did=${did}`)
|
||||
const data = new Uint8Array(await repo.arrayBuffer())
|
||||
// load and validate repo
|
||||
let out;
|
||||
if (debug) {
|
||||
out = await read(data, did, signingKey)
|
||||
} else if (checkout) {
|
||||
const resp = await read(data, did, signingKey)
|
||||
delete resp.checkout.newCids
|
||||
out = resp.checkout
|
||||
} else {
|
||||
out = await inspect(data, did, signingKey)
|
||||
}
|
||||
|
||||
if (query) {
|
||||
out = await jsonata(query).evaluate(out)
|
||||
}
|
||||
console.log(JSON.stringify(out, null, 2))
|
||||
})
|
||||
.example("Inspect remote CAR", "ats r rci did:plc:naichbdds7i7cwbzwzvjraxm")
|
||||
.example("Get all current data", "ats r rci did:plc:naichbdds7i7cwbzwzvjraxm -c")
|
||||
.example("Get feed generators", "ats r rci did:plc:524tuhdhh3m7li5gycdn6boe -c -q 'contents.`app.bsky.feed.generator`'")
|
||||
.parse(Deno.args)
|
14
cli/ats.js
14
cli/ats.js
|
@ -1,14 +0,0 @@
|
|||
|
||||
import { Command } from "https://deno.land/x/cliffy@v0.25.7/command/mod.ts";
|
||||
//import { inspect } from "./lib/car.js";
|
||||
|
||||
await new Command()
|
||||
.name("ats")
|
||||
.description("CLI for ATScan")
|
||||
.meta("deno", Deno.version.deno)
|
||||
.meta("v8", Deno.version.v8)
|
||||
.version("0.1.0")
|
||||
.usage("<command>")
|
||||
.action(() => { console.log("Please specify command or use `-h`") })
|
||||
.command("repo,r", "Repository tools").executable()
|
||||
.parse(Deno.args)
|
Načítá se…
Odkázat v novém úkolu