mirror of
https://github.com/linsa-io/linsa.git
synced 2026-01-11 22:40:32 +01:00
cli > scripts, readme
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,7 +19,6 @@ pnpm-lock.yaml
|
||||
.next
|
||||
|
||||
# repos
|
||||
cli
|
||||
private
|
||||
docs
|
||||
|
||||
|
||||
5
cli/readme.md
Normal file
5
cli/readme.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# CLI
|
||||
|
||||
> CLI for interfacing with LA
|
||||
|
||||
Will be modelled after [Encore's Go CLI](https://github.com/encoredev/encore/tree/main/cli/cmd/encore).
|
||||
@@ -4,8 +4,8 @@
|
||||
"dev": "bun web",
|
||||
"web": "cd web && bun dev",
|
||||
"web:build": "bun run --filter '*' build",
|
||||
"cli": "bun run --watch cli/run.ts",
|
||||
"seed": "bun --watch cli/seed.ts",
|
||||
"cli": "bun run --watch scripts/run.ts",
|
||||
"seed": "bun --watch scripts/seed.ts",
|
||||
"tauri": "tauri",
|
||||
"app:build": "bun tauri build -b dmg -v"
|
||||
},
|
||||
|
||||
31
readme.md
31
readme.md
@@ -2,33 +2,40 @@
|
||||
|
||||
> Organize world's knowledge, explore connections and curate learning paths
|
||||
|
||||
## Files
|
||||
|
||||
- [api](api) - http services (using TS/[Encore](https://encore.dev/))
|
||||
- [app](app) - desktop app (wrapping the [website](web) with desktop specific logic) (using [Tauri](https://v2.tauri.app/))
|
||||
- [cli](cli) - cli (using [Go](https://go.dev))
|
||||
- [docs](https://github.com/learn-anything/docs) - public docs hosted on [docs.learn-anything.xyz](https://docs.learn-anything.xyz/) (separate repo, to be managed by LA itself soon)
|
||||
- [lib](lib) - shared utility functions in TS
|
||||
- [nix](nix) - shared nix code
|
||||
- [scripts](scripts) - utility scripts in TS
|
||||
- [web](web) - website hosted on [learn-anything.xyz](https://learn-anything.xyz) (using [React](https://react.dev/)/[Next.js](https://nextjs.org/) + [Jazz](https://jazz.tools/) for local/global state)
|
||||
|
||||
## Setup
|
||||
|
||||
> [!NOTE]
|
||||
> Project is currently in unstable state but actively improving. Reach out on [Discord](https://discord.gg/bxtD8x6aNF) for help.
|
||||
|
||||
Using [Bun](https://bun.sh):
|
||||
|
||||
```
|
||||
bun i
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Project is currently in unstable state but actively improving. Reach out on [Discord](https://discord.gg/bxtD8x6aNF) for help.
|
||||
> [!NOTE] > `bun setup` is not yet done but will be a command to fully bootstrap a local working env for the project, without it, running `bun web` is impossible yet
|
||||
|
||||
```
|
||||
bun setup
|
||||
```
|
||||
|
||||
## Run website
|
||||
|
||||
> [!NOTE]
|
||||
> Requires jazz to be seeded, docs for this are TODO:
|
||||
|
||||
```
|
||||
bun web
|
||||
```
|
||||
|
||||
## Stack
|
||||
|
||||
- [React](https://react.dev/)/[Next.js](https://nextjs.org/) - website built on this
|
||||
- [Encore](https://encore.dev/) - http services in ts/node
|
||||
- [Jazz](https://jazz.tools/) - global/local state management in both react and encore ts http services
|
||||
- [Tauri](https://v2.tauri.app/)/[Rust](https://www.rust-lang.org) - desktop app (wrapping the website with desktop specific logic)
|
||||
|
||||
## Contributing
|
||||
|
||||
If you want to help contribute to code, ask for help on [Discord](https://discord.gg/bxtD8x6aNF)'s `#dev` channel. You will be onboarded and unblocked fast.
|
||||
|
||||
88
scripts/past-seed.ts
Normal file
88
scripts/past-seed.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
// @ts-nocheck
|
||||
async function devSeed() {
|
||||
const { worker } = await startWorker({
|
||||
accountID: "co_zhvp7ryXJzDvQagX61F6RCZFJB9",
|
||||
accountSecret: JAZZ_WORKER_SECRET
|
||||
})
|
||||
const user = (await (
|
||||
await LaAccount.createAs(worker, {
|
||||
creationProps: { name: "nikiv" }
|
||||
})
|
||||
).ensureLoaded({ root: { personalLinks: [], pages: [], todos: [] } }))!
|
||||
const globalLinksGroup = Group.create({ owner: worker })
|
||||
globalLinksGroup.addMember("everyone", "reader")
|
||||
const globalLink1 = GlobalLink.create({ url: "https://google.com" }, { owner: globalLinksGroup })
|
||||
const globalLink2 = GlobalLink.create({ url: "https://jazz.tools" }, { owner: globalLinksGroup })
|
||||
// TODO: make note: optional
|
||||
const personalLink1 = PersonalLink.create(
|
||||
{ globalLink: globalLink1, type: "personalLink", note: "" },
|
||||
{ owner: user }
|
||||
)
|
||||
const personalLink2 = PersonalLink.create(
|
||||
{ globalLink: globalLink2, type: "personalLink", note: "Great framework" },
|
||||
{ owner: user }
|
||||
)
|
||||
user.root.personalLinks.push(personalLink1)
|
||||
user.root.personalLinks.push(personalLink2)
|
||||
const pageOneTitle = "Physics"
|
||||
const pageTwoTitle = "Karabiner"
|
||||
const page1 = PersonalPage.create(
|
||||
{ title: pageOneTitle, slug: generateUniqueSlug([], pageOneTitle), content: "Physics is great" },
|
||||
{ owner: user }
|
||||
)
|
||||
const page2 = PersonalPage.create(
|
||||
{ title: pageTwoTitle, slug: generateUniqueSlug([], pageTwoTitle), content: "Karabiner is great" },
|
||||
{ owner: user }
|
||||
)
|
||||
user.root.personalPages?.push(page1)
|
||||
user.root.personalPages?.push(page2)
|
||||
const page1 = Page.create({ title: "Physics", content: "Physics is great" }, { owner: user })
|
||||
const page2 = Page.create({ title: "Karabiner", content: "Karabiner is great" }, { owner: user })
|
||||
user.root.pages.push(page1)
|
||||
user.root.pages.push(page2)
|
||||
const credentials = {
|
||||
accountID: user.id,
|
||||
accountSecret: (user._raw as RawControlledAccount).agentSecret
|
||||
}
|
||||
await Bun.write(
|
||||
"./web/.env",
|
||||
`VITE_SEED_ACCOUNTS='${JSON.stringify({
|
||||
nikiv: credentials
|
||||
})}'`
|
||||
)
|
||||
await Bun.write(
|
||||
"./.env",
|
||||
`VITE_SEED_ACCOUNTS='${JSON.stringify({
|
||||
nikiv: credentials
|
||||
})}'`
|
||||
)
|
||||
}
|
||||
const globalLink = GlobalLink.create(
|
||||
{
|
||||
url: "https://google.com",
|
||||
urlTitle: "Google",
|
||||
protocol: "https"
|
||||
},
|
||||
{ owner: globalGroup }
|
||||
)
|
||||
const user = (await (
|
||||
await LaAccount.createAs(worker, {
|
||||
creationProps: { name: "nikiv" }
|
||||
})
|
||||
).ensureLoaded({ root: { personalLinks: [], pages: [], todos: [] } }))!
|
||||
console.log(process.env.JAZZ_GLOBAL_GROUP!, "group")
|
||||
console.log(worker)
|
||||
// TODO: type err
|
||||
console.log(globalGroup, "group")
|
||||
return
|
||||
const currentFilePath = import.meta.path
|
||||
const connectionsFilePath = `${currentFilePath.replace("seed.ts", "/seed/connections.json")}`
|
||||
const file = Bun.file(connectionsFilePath)
|
||||
const fileContent = await file.text()
|
||||
const topicsWithConnections = JSON.parse(fileContent)
|
||||
// let topicsWithConnections = JSON.stringify(obj, null, 2)
|
||||
console.log(topicsWithConnections)
|
||||
// TODO: type err
|
||||
topicsWithConnections.map(topic => {
|
||||
const globalTopic = GlobalTopic.create({ name: topic.name, description: topic.description }, { owner: globalGroup })
|
||||
})
|
||||
Reference in New Issue
Block a user