Skip to content

Commit

Permalink
Almost there
Browse files Browse the repository at this point in the history
  • Loading branch information
hrishioa committed Mar 20, 2024
1 parent 7738aba commit 72de26f
Show file tree
Hide file tree
Showing 10 changed files with 276 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ packages/*/*.wasm
*.a
profile.json

dist

.env
node_modules
.envrc
.swcrc
yarn.lock
dist
*.tmp
*.log
*.out.js
Expand Down
172 changes: 172 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
.DS_Store
zig-cache
packages/*/*.wasm
*.o
*.a
profile.json

.env
node_modules
.envrc
.swcrc
yarn.lock
*.tmp
*.log
*.out.js
*.out.refresh.js
**/package-lock.json
build
*.wat
zig-out
pnpm-lock.yaml
README.md.template
src/deps/zig-clap/example
src/deps/zig-clap/README.md
src/deps/zig-clap/.github
src/deps/zig-clap/.gitattributes
out
outdir

.trace
cover
coverage
coverv
*.trace
github
out.*
out
.parcel-cache
esbuilddir
*.bun
parceldist
esbuilddir
outdir/
outcss
.next
txt.js
.idea
.vscode/cpp*
.vscode/clang*

node_modules_*
*.jsb
*.zip
bun-zigld
bun-singlehtreaded
bun-nomimalloc
bun-mimalloc
examples/lotta-modules/bun-yday
examples/lotta-modules/bun-old
examples/lotta-modules/bun-nofscache

src/node-fallbacks/out/*
src/node-fallbacks/node_modules
sign.json
release/
*.dmg
sign.*.json
packages/debug-*
packages/bun-cli/postinstall.js
packages/bun-*/bun
packages/bun-*/bun-profile
packages/bun-*/debug-bun
packages/bun-*/*.o
packages/bun-cli/postinstall.js

packages/bun-cli/bin/*
bun-test-scratch
misctools/fetch

src/deps/libiconv
src/deps/openssl
src/tests.zig
*.blob
src/deps/s2n-tls
.npm
.npm.gz

bun-binary

src/deps/PLCrashReporter/

*.dSYM
*.crash
misctools/sha
packages/bun-wasm/*.mjs
packages/bun-wasm/*.cjs
packages/bun-wasm/*.map
packages/bun-wasm/*.js
packages/bun-wasm/*.d.ts
packages/bun-wasm/*.d.cts
packages/bun-wasm/*.d.mts
*.bc

src/fallback.version
src/runtime.version
*.sqlite
*.database
*.db
misctools/machbench
*.big
.eslintcache

/bun-webkit

src/deps/c-ares/build
src/bun.js/bindings-obj
src/bun.js/debug-bindings-obj

failing-tests.txt
test.txt
myscript.sh

cold-jsc-start
cold-jsc-start.d

/testdir
/test.ts
/test.js

src/js/out/modules*
src/js/out/functions*
src/js/out/tmp
src/js/out/DebugPath.h

make-dev-stats.csv

.uuid
tsconfig.tsbuildinfo

test/js/bun/glob/fixtures
*.lib
*.pdb
CMakeFiles
build.ninja
.ninja_deps
.ninja_log
CMakeCache.txt
cmake_install.cmake
compile_commands.json

*.lib
x64
**/*.vcxproj*
**/*.sln*
**/*.dir
**/*.pdb

/.webkit-cache
/.cache
/src/deps/libuv
/build-*/
/kcov-out

.vs

**/.verdaccio-db.json
/test-report.md
/test-report.json

########################### MY STUFF

test
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Lumentis

To install dependencies:

```bash
bun install
```

To run:

```bash
bun run index.ts
```

This project was created using `bun init` in bun v1.0.29. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
9 changes: 6 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
3. scraping web links
4. recursive scraping web pages
3. Recursive summarisation?
4. Do we need to ask and set style separately?
5. Maybe change themes to sections we want to make sure we generate?
6. Kill the node process
4. \n's
5. Do we need to ask and set style separately?
6. Maybe change themes to sections we want to make sure we generate?
7. Kill the node process
8. Maybe uncheck the intended audience except top 2
9. Thing still running is back - need to check and fix
31 changes: 29 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
{
"dependencies": { "@anthropic-ai/sdk": "^0.19.0", "@anthropic-ai/tokenizer": "^0.0.4", "@inquirer/prompts": "^4.3.0", "cross-spawn": "^7.0.3", "nextra": "^2.13.4", "nextra-theme-docs": "^2.13.4", "react": "^18.2.0", "react-dom": "^18.2.0" },
"name": "lumentis",
"version": "0.0.2",
"author": "Hrishi Olickel <twitter-@hrishioa> (https://olickel.com)",
"description": "Create awesome docs from your transcripts, notes and documents in seconds, ready to deploy.",
"license": "GPL-3.0-only",
"dependencies": {
"@anthropic-ai/sdk": "^0.19.0",
"@anthropic-ai/tokenizer": "^0.0.4",
"@inquirer/prompts": "^4.3.0",
"cross-spawn": "^7.0.3"
},
"devDependencies": {
"@swc/core": "^1.4.8",
"@types/bun": "latest",
"@types/cross-spawn": "^6.0.6"
},
"main": "dist/app.js",
"bin": {
"lumentis": "dist/app.js"
},
"script": {
"run": "bun run src/app.ts",
"build": "tsup"
},
"files": [
"dist"
],
"type": "module",
"peerDependencies": {
"typescript": "^5.0.0"
}
}
}
2 changes: 1 addition & 1 deletion src/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export async function runClaudeInference(

return {
success: false,
error: err.toString(),
error: (err as Error).toString(),
};
}
}
Expand Down
24 changes: 10 additions & 14 deletions src/wizard.ts → src/app.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env node

import {
CLAUDE_MODELS,
EDITORS,
LUMENTIS_FOLDER,
lumentisFolderPath,
MAX_HEADING_CHAR_LENGTH,
RUNNERS,
WIZARD_STATE_FILE,
wizardStatePath,
} from "./constants";
import path from "path";
Expand All @@ -31,14 +31,7 @@ import {
getTitleInferenceMessages,
} from "./prompts";
import { getClaudeCosts, runClaudeInference } from "./ai";
import {
Outline,
OutlineSection,
ReadyToGeneratePage,
WizardState,
} from "./types";
import { getRequiredHeader } from "@anthropic-ai/sdk/core";
import { MessageParam } from "@anthropic-ai/sdk/resources";
import { OutlineSection, ReadyToGeneratePage, WizardState } from "./types";
import { generatePages, idempotentlySetupNextraDocs } from "./page-generator";

async function runWizard() {
Expand Down Expand Up @@ -259,7 +252,7 @@ async function runWizard() {
const selectedAnswer: string = await select({
message: "Pick your favorite or enter a new one: ",
choices: titleOptionsResponse.response
.map((title) => ({
.map((title: string) => ({
name: title,
value: title,
}))
Expand Down Expand Up @@ -314,7 +307,7 @@ async function runWizard() {
if (themesOptionsResponse.success) {
const selectedThemes = await checkbox({
message: "Deselect any you don't want: ",
choices: themesOptionsResponse.response.map((theme) => ({
choices: themesOptionsResponse.response.map((theme: string) => ({
name: theme,
value: theme,
checked: true,
Expand Down Expand Up @@ -375,7 +368,7 @@ async function runWizard() {
if (audienceOptionsResponse.success) {
const selectedAudience: string[] = await checkbox({
message: "Deselect any you don't want: ",
choices: audienceOptionsResponse.response.map((audience) => ({
choices: audienceOptionsResponse.response.map((audience: string) => ({
name: audience,
value: audience,
checked: true,
Expand Down Expand Up @@ -455,7 +448,10 @@ async function runWizard() {
message: `Opening ${process.env.EDITOR} to answer:`,
waitForUseInput: false,
default: `Here are some questions: \n${questionsResponse.response
.map((question, index) => `${index + 1}. ${question}\n\nAnswer: \n\n`)
.map(
(question: string, index: number) =>
`${index + 1}. ${question}\n\nAnswer: \n\n`
)
.join("\n")}`,
});

Expand Down
4 changes: 3 additions & 1 deletion src/page-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ export async function generatePages(
}

console.log(
`\n\nAND WE'RE DONE! Run \`${preferredRunner.command} run dev\` to start the docs server once you quit. You can always rerun Lumentis to make changes.`
`\n\nAND WE'RE DONE! Run \`${preferredRunner.command} run dev\` to start the docs server once you quit. You can always rerun Lumentis to make changes.
You can learn more about Nextra (what we use for our theme) here: https://nextra.site/docs/docs-theme/start`
);
}
29 changes: 29 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"ts-node": {
"files": true
},
"compilerOptions": {
"baseUrl": ".",
"target": "es2018",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"strictPropertyInitialization": false,
"skipLibCheck": true,
// "strictNullChecks": true,
"strictBindCallApply": false,
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "./dist",
"incremental": true,
"noImplicitAny": false,
"noFallthroughCasesInSwitch": false,
"resolveJsonModule": true
},
"include": ["src/**/*"]
}
9 changes: 9 additions & 0 deletions tsup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from "tsup";

export default defineConfig({
entry: ["src/app.ts"],
publicDir: false,
clean: true,
minify: true,
format: ["cjs", "esm"], // 👈 Node
});

0 comments on commit 72de26f

Please sign in to comment.