Compare commits

...
Sign in to create a new pull request.

24 commits

Author SHA1 Message Date
ZTatman
140841783b docs: add language labels to fenced code blocks 2026-04-13 14:28:53 -04:00
ZTatman
b246f51aa0 fix(cli): redact secrets consistently across init and view 2026-04-13 14:25:45 -04:00
ZTatman
dbba75d42a fix(cli): handle version flag anywhere in argv 2026-04-13 14:10:12 -04:00
ZTatman
3270d2283c fix(cli): show subcommands in help usage and list 2026-04-13 14:07:35 -04:00
ZTatman
9b7f5d6194 fix(cli): atomic config writes, validate subcommands and reject positionals 2026-04-13 13:51:55 -04:00
ZTatman
fb7ffaf248 fix: update Dockerfile for security and fix README command references
- Add non-root USER directive to Dockerfile
- Copy pnpm-lock.yaml before install
- Update README checklist with current CLI commands
2026-04-13 13:14:56 -04:00
ZTatman
90363e59cd docs: add agents.md for codebase obstacles 2026-04-13 13:04:35 -04:00
ZTatman
4c99fe71fa refactor(cli): simplify verify, improve error messages, use env var names
- Use ENV_MAPPING from config.ts instead of inline object
- Display env var names (SNAKE_CASE) not internal keys
- Remove 'set' verbiage from display output
- Improve forgejo-checks error messages with actionable descriptions
- Fix tsconfig composites causing build issues
2026-04-13 12:47:57 -04:00
ZTatman
8a716964bb refactor: clean up dead code and redundant checks 2026-04-12 23:10:10 -04:00
ZTatman
177c724fdf fix(cli): show option descriptions in help output and move verify under config 2026-04-12 23:07:34 -04:00
ZTatman
6588fad461 refactor(verify): simplify by extracting functions and removing duplication 2026-04-12 23:06:17 -04:00
ZTatman
18d3b175de fix(verify): simplify missing config detection
- Use REQUIRED_KEYS directly instead of complex mapping lookup
- KISS: simpler code that's easier to understand
2026-04-12 22:43:43 -04:00
ZTatman
9647f27db4 fix(cli): simplify path derivation for --output flag
- Remove unused outDir variable
- Directly use opts.output or default to cwd/.env
2026-04-12 18:29:51 -04:00
ZTatman
134d5ff8c7 fix(cli): handle help flag as subcommand parameter more explicitly
- Convert help flags to undefined before passing to showCommandHelp
- Improves semantic clarity when user runs 'myst config --help'
2026-04-12 18:28:32 -04:00
ZTatman
55d45adec8 fix(cli): replace process.exit(0) with proper exit handling
- Use process.exitCode + return in select cancel path
- Use process.exitCode + throw in group onCancel handler
- Allows finally blocks to run for cleanup
2026-04-12 18:22:06 -04:00
ZTatman
a7f30a0d3a docs: update README with current CLI commands
- Replace myst init with myst config init
- Replace myst forgejo bootstrap with myst verify
- Replace myst doctor with myst verify --diagnostic
- Replace myst config print with myst config view
2026-04-12 18:19:55 -04:00
ZTatman
099d521288 refactor: simplify .env generation and remove unnecessary escaping
- Remove escapeEnvValue function (no longer needed)
- Simplify generateEnvFile to write plain KEY=value format
- Remove quote-stripping from parseEnvFile
- Move helper functions back to module level for cleaner code
- Use DATABASE_PROTOCOLS in validateDatabaseUrl
2026-04-12 18:13:16 -04:00
ZTatman
a4ee1d95dc fix(cli): add default timeout to forgejo api check fetch requests 2026-04-12 17:42:46 -04:00
ZTatman
d6b9677ca5 refactor(cli): restructure CLI with new command router and merge verify/doctor
- Replace custom argument parsing with generic cli-router
- Add subcommand support (myst config init, myst config view)
- Merge verify and doctor into single command with --diagnostic flag
- Extract shared forgejo-checks to utils
- Remove unused code (generatePassword, EnvKey/ConfigKey types)
- Add dynamic package.json for help/version display
2026-04-11 22:16:22 -04:00
ZTatman
6884dffda6 refactor: consolidate env config into single config.ts
- Create single packages/cli/src/config.ts with:
  - MystEnvironmentVariables interface
  - ENV_MAPPING constant
  - REQUIRED_KEYS constant
  - parseEnvFile()
  - validateDatabaseUrl()
  - generateEnvFile()

- Remove duplicates:
  - constants.ts (absorbed)
  - utils/config.ts (absorbed)
  - utils/env.ts (absorbed)

- Update command files to import from config.ts
2026-04-11 18:34:49 -04:00
ZTatman
a3c202a662 feat(cli): add config print, verify, and doctor commands for config validation
- myst config print: show current config with redacted secrets
- myst verify: verify Forgejo connectivity and API token
- myst doctor: comprehensive validation of config and connectivity
- add start script to service package.json
2026-04-09 20:40:55 -04:00
ZTatman
31c3105e34 remove myst.config.json generation, rely on .env for container deployments 2026-04-08 14:52:11 -04:00
ZTatman
f1a4a6d18c refactor: use parseArgs from node:util to do basic parsing 2026-04-08 14:40:49 -04:00
ZTatman
c4c41e0e31 refactor(cli): move help related functions to help.ts to keep
cli/src/index.ts entry point narrow
2026-04-08 10:28:59 -04:00
20 changed files with 1040 additions and 281 deletions

14
.dockerignore Normal file
View file

@ -0,0 +1,14 @@
node_modules
.git
*.log
.env
.env.*
!.env.example
dist
tsconfig.tsbuildinfo
*.tsbuildinfo
coverage
.vscode
.idea
*.md
!README.md

24
Dockerfile Normal file
View file

@ -0,0 +1,24 @@
FROM node:22-alpine
WORKDIR /app
COPY package*.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY packages/service/package*.json ./packages/service/
COPY packages/shared/package*.json ./packages/shared/
COPY tsconfig.base.json ./
RUN npm install -g pnpm
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm -r --filter @myst/service build
ENV PORT=3000
EXPOSE 3000
USER node
CMD ["pnpm", "--filter", "@myst/service", "start"]

View file

@ -46,10 +46,10 @@ HTMX provides interactivity (filtering, form submissions) with minimal JavaScrip
## Quick Start ## Quick Start
### 1. Run `myst init` ### 1. Run `myst config init`
```bash ```bash
myst init myst config init
``` ```
Prompts for: Prompts for:
@ -92,12 +92,12 @@ GRANT_TOKEN_SECRET="your-secret-here"
## Phase 1 Progress ## Phase 1 Progress
- [x] Project renamed from Embargo to Myst - [x] Project renamed from Embargo to Myst
- [x] CLI scaffold (`myst init`) - [x] CLI scaffold (`myst config init`)
- [x] Config generation (`.env`, `myst.config.json`) - [x] Config generation (`.env`)
- [ ] Service foundation (FastAPI + PostgreSQL) - [ ] Service foundation (FastAPI + PostgreSQL)
- [ ] `myst forgejo bootstrap` — verify Forgejo connectivity - [x] `myst config verify` — verify Forgejo connectivity
- [ ] `myst doctor` — validate configuration - [x] `myst config verify --diagnostic` — comprehensive diagnostics
- [ ] `myst config print` — show current config - [x] `myst config view` — show current config
- [ ] Forgejo session authentication - [ ] Forgejo session authentication
- [ ] Repo ownership verification - [ ] Repo ownership verification
- [ ] Private link creation (email-verified) - [ ] Private link creation (email-verified)

69
agents.md Normal file
View file

@ -0,0 +1,69 @@
# agents.md
This file is the single source of truth for codebase obstacles, oddities, and their resolutions. Do not scatter this knowledge in comments, commit messages, or memory.
---
## Rules for agents
1. **Before solving a problem**, check this file. If the problem is documented, use the recorded solution or workaround. Do not re-derive it.
2. **After solving a new problem**, document it here before moving on. Keep entries concise.
3. **Do not deviate** from a recorded solution without first confirming with the user. Once confirmed, update this file with the new approach and reason before proceeding.
---
## Entry format
```text
### [Short problem title]
**Area:** [file, module, or system this affects]
**Obstacle:** What the problem is and where it appears.
**Solution/Workaround:** What was done to fix or work around it.
**Preference:** If multiple approaches exist, which was chosen and why.
```
---
## Documented obstacles
### TypeScript composite builds fail with no output
**Area:** packages/cli/tsconfig.json, tsconfig.base.json
**Obstacle:** When `composite: true` is set in tsconfig, TypeScript requires proper project references to build. The CLI package was building but producing no output files, causing "cannot find module" errors.
**Solution:** Remove `composite: true` from packages/cli/tsconfig.json. Also removed `noUncheckedIndexedAccess` and `exactOptionalPropertyTypes` from tsconfig.base.json as they caused strict type issues with dynamic config objects.
**Preference:** Use simple tsconfig without composite mode for CLI package.
### verify.ts overly complex abstraction
**Area:** packages/cli/src/commands/verify.ts
**Obstacle:** Code had too many layers: collectResults → addResult (inner function) → displayDiagnosticResults/verifyResults. Made it hard to trace and debug.
**Solution:** Rewrote to be flatter: verifyCommand → runDiagnosticMode/runVerifyMode. Used simple inline logic instead of adding functions for everything.
**Preference:** KISS - keep functions small but avoid over-abstraction.
### Error messages in forgejo-checks too generic
**Area:** packages/cli/src/utils/forgejo-checks.ts
**Obstacle:** Network errors showed "fetch failed" with no context. HTTP errors showed just status codes. Not actionable for users.
**Solution:** Added getErrorMessage() helper to detect: timeouts, connection refused, host not found. Improved HTTP error messages to include status text. Added context prefixes like "cannot reach server", "cannot connect to API".
**Preference:** Actionable messages that tell users what to fix.
### ENV_MAPPING duplicated inline in verify.ts
**Area:** packages/cli/src/commands/verify.ts
**Obstacle:** Had duplicate object with same keys as ENV_MAPPING from config.ts. Two sources of truth.
**Solution:** Import ENV_MAPPING and use it. Change display to show env var names (SNAKE_CASE) instead of internal keys.
**Preference:** Single source of truth in config.ts.
### Display verbiage redundancy
**Area:** packages/cli/src/commands/verify.ts
**Obstacle:** Displayed "MYST_PUBLIC_URL set" - "set" is redundant, icon already shows status.
**Solution:** Just show env var name, remove "set". Shows "MYST_PUBLIC_URL configured" or "MYST_PUBLIC_URL missing".
**Preference:** Cleaner, let icon indicate status.
### loadConfig returning wrong type for error case
**Area:** packages/cli/src/commands/verify.ts
**Obstacle:** loadConfig() threw error when .env not found, but caught and re-threw in verifyCommand. This caused process to exit with stack trace instead of clean message.
**Solution:** Return null on ENOENT, handle null in verifyCommand. Return type: `Record<string, string> | null`.
**Preference:** Explicit null handling over exceptions for user-facing errors.
### process.exit(0) prevents finally blocks
**Area:** CLI commands using process.exit()
**Obstacle:** process.exit(0) stops execution immediately, never runs cleanup code.
**Solution:** Use process.exitCode = 1 and return instead of process.exit().
**Preference:** Set exitCode and return to allow cleanup.

View file

@ -130,8 +130,7 @@ Only repo owners can create view links for their repos.
`myst init` should generate all Myst-owned deployment config needed for Phase 1: `myst init` should generate all Myst-owned deployment config needed for Phase 1:
- `.env` - `.env` (environment variables for Docker/container deployment)
- `myst.config.json`
- any future Myst-only deployment templates, but never Forgejo provisioning files - any future Myst-only deployment templates, but never Forgejo provisioning files
`myst init` should provide inline guidance that: `myst init` should provide inline guidance that:

View file

@ -45,7 +45,7 @@ Myst is a companion service deployed beside an existing Forgejo instance. It own
v v v v
Myst Database Forgejo API Myst Database Forgejo API
(Postgres) (existing instance) (Postgres) (existing instance)
``` ```ascii
Deployment boundaries: Deployment boundaries:
@ -208,7 +208,6 @@ The CLI is the primary way to configure and validate Myst against an existing Fo
- generate a grant token secret by default unless the operator pastes one - generate a grant token secret by default unless the operator pastes one
- generate all Myst-owned config files needed for deployment in Phase 1 - generate all Myst-owned config files needed for deployment in Phase 1
- write `.env` - write `.env`
- write `myst.config.json`
- print manual follow-up actions for admin URL protection, app deployment, and Forgejo validation - print manual follow-up actions for admin URL protection, app deployment, and Forgejo validation
- show links to Forgejo docs for API usage, token scopes, repo permissions, and the admin CLI - show links to Forgejo docs for API usage, token scopes, repo permissions, and the admin CLI
- remind operators to run `myst init` in the directory where Myst will be deployed, usually on the target VPS or server workspace - remind operators to run `myst init` in the directory where Myst will be deployed, usually on the target VPS or server workspace
@ -285,7 +284,6 @@ Forgejo docs to link directly from CLI output:
Expected outputs from `init`: Expected outputs from `init`:
- `.env` - `.env`
- `myst.config.json`
- optional platform templates for Myst only (e.g., Docker Compose for Dokploy) - optional platform templates for Myst only (e.g., Docker Compose for Dokploy)
## Data Model ## Data Model

View file

@ -1,10 +1,10 @@
{ {
"name": "@myst/cli", "name": "@myst/cli",
"description": "A CLI tool that helps you wire Myst into an existing Forgejo instance with expiring grant access controls for repos you choose to share.", "description": "CLI for configuring and verifying Myst with Forgejo",
"version": "0.1.0", "version": "0.1.0",
"author": { "author": {
"name": "Zach Tatman", "name": "Zach Tatman",
"email": "zach.c.tatman@gmail.com" "email": "zach.tatman.dev@gmail.com"
}, },
"bugs": { "bugs": {
"url": "https://github.com/ZTatman/myst/issues" "url": "https://github.com/ZTatman/myst/issues"

View file

@ -0,0 +1,286 @@
import { parseArgs } from "node:util";
import * as c from "yoctocolors";
type Handler = (opts: Record<string, unknown>) => Promise<void>;
interface OptionSpec {
type: "string" | "boolean";
short?: string;
default?: string | boolean | string[] | boolean[];
description?: string;
}
type OptionsSpec = Record<string, OptionSpec>;
export interface CommandConfig {
description?: string;
options?: OptionsSpec;
subcommands?: Record<string, CommandConfig>;
handler?: Handler;
}
export type CommandRegistry = Record<string, CommandConfig>;
function showHelp(registry: CommandRegistry, description: string): void {
const PADDING = 4;
const INDENT = " ";
type HelpRow = { name: string; desc?: string };
const rows: HelpRow[] = [];
function addCommands(cmds: CommandRegistry, prefix = "") {
for (const [name, def] of Object.entries(cmds)) {
const fullName = prefix ? `${prefix} ${name}` : name;
if (def.subcommands) {
rows.push({ name: fullName });
addCommands(def.subcommands, fullName);
} else if (def.description) {
rows.push({ name: fullName, desc: def.description });
}
}
}
addCommands(registry);
const globalFlagRows: HelpRow[] = [
{ name: "-h, --help", desc: "Display help" },
{ name: "-v, --version", desc: "Display version" },
];
const allRows = [...rows, ...globalFlagRows];
const colWidth = Math.max(...allRows.map((r) => r.name.length)) + PADDING;
const lines: string[] = [];
lines.push(c.yellow("myst"));
lines.push("");
lines.push(`${INDENT}${description}`);
lines.push("");
lines.push(c.bold("Usage:"));
lines.push(`${INDENT}myst <command> [options]`);
lines.push("");
lines.push(c.bold("Commands:"));
for (const row of rows) {
if (row.desc) {
lines.push(`${INDENT}${row.name.padEnd(colWidth)}${c.dim(row.desc)}`);
} else {
lines.push(`${INDENT}${c.bold(row.name)}`);
}
}
lines.push("");
lines.push(c.bold("Global options:"));
for (const row of globalFlagRows) {
const desc = row.desc ?? "";
lines.push(`${INDENT}${row.name.padEnd(colWidth)}${c.dim(desc)}`);
}
process.stdout.write(lines.join("\n") + "\n");
}
function showCommandHelp(
command: string,
cmdConf: CommandConfig,
subcommand?: string,
): void {
const PADDING = 4;
const INDENT = " ";
type HelpRow = { name: string; desc?: string };
let targetConf: CommandConfig = cmdConf;
if (subcommand && cmdConf.subcommands) {
targetConf = cmdConf.subcommands[subcommand] ?? cmdConf;
}
const lines: string[] = [];
const fullName = subcommand ? `${command} ${subcommand}` : command;
lines.push(c.yellow("myst " + fullName));
lines.push("");
if (targetConf.description) {
lines.push(`${INDENT}${targetConf.description}`);
lines.push("");
}
const hasSubcommands = cmdConf.subcommands && Object.keys(cmdConf.subcommands).length > 0;
const usageCmd = subcommand ? `${command} ${subcommand}` : command;
const usageLine = hasSubcommands && !subcommand
? `myst ${command} <subcommand> [options]`
: `myst ${usageCmd} [options]`;
lines.push(c.bold("Usage:"));
lines.push(`${INDENT}${usageLine}`);
lines.push("");
if (hasSubcommands && !subcommand) {
const subcommandRows: HelpRow[] = [];
for (const [name, conf] of Object.entries(cmdConf.subcommands!)) {
subcommandRows.push({ name, desc: conf.description ?? "" });
}
const colWidth =
Math.max(...subcommandRows.map((r) => r.name.length)) + PADDING;
lines.push(c.bold("Subcommands:"));
for (const row of subcommandRows) {
if (row.desc) {
lines.push(`${INDENT}${row.name.padEnd(colWidth)}${c.dim(row.desc)}`);
} else {
lines.push(`${INDENT}${row.name}`);
}
}
lines.push("");
}
if (targetConf.options && Object.keys(targetConf.options).length > 0) {
const optionRows: HelpRow[] = [];
for (const [optName, optSpec] of Object.entries(targetConf.options)) {
const short = optSpec.short ? `, -${optSpec.short}` : "";
const typeHint = optSpec.type === "string" ? " <value>" : "";
const desc = optSpec.description ?? "";
optionRows.push({
name: `--${optName}${short}${typeHint}`,
desc,
});
}
const colWidth =
Math.max(...optionRows.map((r) => r.name.length)) + PADDING;
lines.push(c.bold("Options:"));
for (const row of optionRows) {
if (row.desc) {
lines.push(`${INDENT}${row.name.padEnd(colWidth)}${c.dim(row.desc)}`);
} else {
lines.push(`${INDENT}${row.name}`);
}
}
lines.push("");
}
lines.push(c.bold("Global options:"));
lines.push(`${INDENT}-h, --help Display help`);
lines.push(`${INDENT}-v, --version Display version`);
process.stdout.write(lines.join("\n") + "\n");
}
export async function runCli(
argv: string[],
registry: CommandRegistry,
): Promise<void> {
// Load package info once
const pkg = await import("../package.json", { with: { type: "json" } });
const description = pkg.default.description;
const version = pkg.default.version;
// Check for help/version flags
const isHelpFlag = (arg: string) => arg === "--help" || arg === "-h";
const isVersionFlag = (arg: string) => arg === "--version" || arg === "-v";
// Check for version flag (early exit)
if (argv.some(isVersionFlag)) {
process.stdout.write(version + "\n");
return;
}
// If no args or only help flags, show global help
if (argv.length === 0 || argv.every(isHelpFlag)) {
showHelp(registry, description);
return;
}
// Extract command and subcommand directly from argv
const command = argv[0] ?? "";
const subcommand = argv[1] ?? "";
const remainingArgs = argv.slice(2);
// If user types myst -h or --help with a command
const wantsCommandHelp =
isHelpFlag(subcommand) || remainingArgs.some(isHelpFlag);
const cmdConf = registry[command];
// Check if the command exists
if (!cmdConf) {
process.stderr.write(`${c.red("Error:")} Unknown command: ${command}\n`);
process.exitCode = 1;
return;
}
// If help is requested for a specific command, show command-specific help
if (wantsCommandHelp) {
const subcommands = cmdConf.subcommands;
const actualSubcommand =
subcommand && subcommands && subcommand in subcommands
? subcommand
: undefined;
showCommandHelp(command, cmdConf, actualSubcommand);
return;
}
let targetCmdConf: CommandConfig | undefined;
// Check if subcommand was passed and if it's a valid subcommand (not an option flag)
const subcommands = cmdConf.subcommands;
const isSubcommandAnOption = subcommand && subcommand.startsWith("-");
if (isSubcommandAnOption) {
// Subcommand looks like an option (e.g., --diagnostic), treat as option for parent
targetCmdConf = cmdConf.handler ? cmdConf : undefined;
} else if (subcommand && subcommands && subcommand in subcommands) {
targetCmdConf = subcommands[subcommand];
} else if (!subcommand && cmdConf.handler) {
// No subcommand passed, use the parent command handler directly
targetCmdConf = cmdConf;
}
// Check if the target subcommand handler exists
if (!targetCmdConf?.handler) {
if (subcommands && Object.keys(subcommands).length > 0) {
process.stderr.write(
`${c.red("Error:")} Missing subcommand for '${command}'. Available: ${Object.keys(subcommands).join(", ")}\n`,
);
} else {
// No subcommands available, treat as unknown subcommand
process.stderr.write(
`${c.red("Error:")} Unknown subcommand: ${subcommand}\n`,
);
}
process.exitCode = 1;
return;
}
// Build args for parseArgs - if subcommand is an option, include it
const argsForOptions = isSubcommandAnOption
? [subcommand, ...remainingArgs]
: remainingArgs;
try {
// Parse target command options
const { values: cmdOpts, positionals } = parseArgs({
args: argsForOptions,
options: targetCmdConf.options || {},
allowPositionals: true,
});
if (positionals.length > 0) {
process.stderr.write(
`${c.red("Error:")} Unexpected argument: ${positionals[0]}\n`,
);
process.exitCode = 1;
return;
}
// Execute the target command handler
await targetCmdConf.handler(cmdOpts);
} catch (error) {
const message = error instanceof Error ? error.message : "Unknown error";
process.stderr.write(`${c.red("Error:")} ${message}\n`);
process.exitCode = 1;
}
}

View file

@ -0,0 +1,14 @@
import * as configInit from "./commands/config/init.js";
import * as configView from "./commands/config/view.js";
import * as verify from "./commands/verify.js";
export const commandRegistry = {
config: {
description: "Configuration commands",
subcommands: {
init: configInit.commandConfig,
view: configView.commandConfig,
verify: verify.commandConfig,
},
},
};

View file

@ -4,14 +4,13 @@ import path from "node:path";
import * as c from "yoctocolors"; import * as c from "yoctocolors";
import * as p from "@clack/prompts"; import * as p from "@clack/prompts";
import { generateSecret } from "../utils/crypto.js"; import { generateSecret } from "../../utils/crypto.js";
import { generateEnvFile } from "../utils/env.js"; import {
generateEnvFile,
SECRET_ENV_KEYS,
} from "../../utils/config.js";
import { CommandConfig } from "../../cli-router.js";
/**
* Normalizes a URL to use https:// if no protocol is specified.
* @param value - The URL to normalize.
* @returns {string} The normalized URL.
*/
function normalizeHttpUrl(value: string): string { function normalizeHttpUrl(value: string): string {
const trimmed = value.trim(); const trimmed = value.trim();
const hasProtocol = /^[a-z]+:\/\//i.test(trimmed); const hasProtocol = /^[a-z]+:\/\//i.test(trimmed);
@ -24,12 +23,6 @@ function normalizeHttpUrl(value: string): string {
return hasProtocol ? trimmed : `https://${trimmed}`; return hasProtocol ? trimmed : `https://${trimmed}`;
} }
/**
* Validates a URL or host, returning the normalized URL or undefined if valid.
* @param value - The URL or host to validate.
* @param label - The label to use in error messages.
* @returns {string | undefined} The normalized URL or undefined if valid.
*/
function validateHttpUrlOrHost( function validateHttpUrlOrHost(
value: string | undefined, value: string | undefined,
label: string, label: string,
@ -39,7 +32,6 @@ function validateHttpUrlOrHost(
try { try {
const normalized = normalizeHttpUrl(value); const normalized = normalizeHttpUrl(value);
const url = new URL(normalized); const url = new URL(normalized);
if (!url.hostname) { if (!url.hostname) {
return `${label} must include a domain or hostname`; return `${label} must include a domain or hostname`;
} }
@ -50,11 +42,6 @@ function validateHttpUrlOrHost(
return undefined; return undefined;
} }
/**
* Validates a Postgres URL, returning undefined if valid.
* @param value - The Postgres URL to validate.
* @returns {string | undefined} The error message or undefined if valid.
*/
function validatePostgresUrl(value: string | undefined): string | undefined { function validatePostgresUrl(value: string | undefined): string | undefined {
if (!value?.trim()) { if (!value?.trim()) {
return "Database URL is required"; return "Database URL is required";
@ -72,61 +59,8 @@ function validatePostgresUrl(value: string | undefined): string | undefined {
return undefined; return undefined;
} }
/** async function init(opts: { output?: string }) {
* Writes a private file to disk, throwing an error if the file already exists. p.intro(c.bold("myst config init"));
* @param filePath - The path to the file to write.
* @param content - The content to write to the file.
* @returns {Promise<void>} A promise that resolves when the file is written.
*/
async function writePrivateFile(
filePath: string,
content: string,
): Promise<void> {
try {
await fs.writeFile(filePath, content, {
encoding: "utf8",
flag: "wx",
mode: 0o600,
});
} catch (e) {
const error = e as NodeJS.ErrnoException;
if (error.code === "EEXIST") {
throw new Error(
`Error: the file '${c.underline(path.basename(filePath))}' already exists in directory ${c.underline(path.dirname(filePath))}`,
);
}
throw error; // throw any other errors back if not EEXIST code
}
}
/**
* Preflight check for write targets, throwing an error if any target file already exists.
* @param filePaths - The paths of the files to write.
* @returns {Promise<void>} A promise that resolves when all targets are checked.
*/
async function preflightWriteTargets(filePaths: string[]): Promise<void> {
for (const filePath of filePaths) {
try {
await fs.access(filePath);
throw new Error(
`Error: the file '${c.underline(path.basename(filePath))}' already exists in directory ${c.underline(path.dirname(filePath))}`,
);
} catch (error) {
const err = error as NodeJS.ErrnoException;
if (err.code !== "ENOENT") {
throw error;
}
}
}
}
/**
* Initializes a Myst project by creating the necessary configuration files.
* @param _args - The command arguments.
* @returns {Promise<void>} A promise that resolves when the initialization is complete.
*/
export async function initCommand(_args: string[]): Promise<void> {
p.intro(c.bold("myst init"));
p.note( p.note(
[ [
`${c.bold("Run this in the directory where you plan to deploy Myst.")}`, `${c.bold("Run this in the directory where you plan to deploy Myst.")}`,
@ -146,6 +80,59 @@ export async function initCommand(_args: string[]): Promise<void> {
c.yellow("Before you start:"), c.yellow("Before you start:"),
); );
const envPath = opts.output || path.join(process.cwd(), ".env");
// Check if .env file already exists
let envExists = false;
try {
await fs.stat(envPath);
envExists = true;
} catch {
// .env file does not exist
}
// Handle existing .env file
if (envExists) {
while (true) {
const choice = await p.select({
message: c.red(
`The file .env already exists at ${envPath}. What would you like to do?`,
),
options: [
{ value: "view", label: "View .env content" },
{ value: "overwrite", label: "Overwrite .env" },
{ value: "cancel", label: "Cancel" },
],
});
if (p.isCancel(choice) || choice === "cancel") {
p.cancel("\nOperation cancelled.");
process.exitCode = 0;
return;
}
if (choice === "view") {
const envContent = await fs.readFile(envPath, { encoding: "utf-8" });
const maskedEnvContent = envContent
.split("\n")
.map((line) => {
if (!line.includes("=")) return line;
const [key] = line.split("=");
return SECRET_ENV_KEYS.includes(key as typeof SECRET_ENV_KEYS[number])
? `${key}=****`
: line;
})
.join("\n");
p.note(c.dim(maskedEnvContent), c.yellow("Current .env"));
continue;
}
if (choice === "overwrite") {
break;
}
}
}
const answers = await p.group( const answers = await p.group(
{ {
publicUrl: () => publicUrl: () =>
@ -198,7 +185,7 @@ export async function initCommand(_args: string[]): Promise<void> {
{ {
onCancel: () => { onCancel: () => {
p.cancel("\nOperation cancelled."); p.cancel("\nOperation cancelled.");
process.exit(0); process.exitCode = 0;
}, },
}, },
); );
@ -224,45 +211,37 @@ export async function initCommand(_args: string[]): Promise<void> {
publicUrl, publicUrl,
}); });
const configContent = JSON.stringify( if (envExists) {
{ const tempPath = envPath + ".tmp";
adminUrl, await fs.writeFile(tempPath, envContent, {
forgejoBaseUrl, encoding: "utf8",
forgejoBotUsername: answers.forgejoBotUsername, flag: "wx",
publicUrl, mode: 0o600,
}, });
null,
2,
);
const outDir = process.cwd(); await fs.unlink(envPath).catch(() => {});
const envPath = path.join(outDir, ".env"); await fs.rename(tempPath, envPath);
const configPath = path.join(outDir, "myst.config.json"); } else {
await fs.writeFile(envPath, envContent, {
encoding: "utf8",
flag: "wx",
mode: 0o600,
});
}
await preflightWriteTargets([envPath, configPath]); s.stop(c.yellow(`.env created at ${envPath}`));
await writePrivateFile(envPath, envContent);
await writePrivateFile(configPath, configContent);
s.stop("Config files generated");
p.note(
[c.green(".env"), c.green("myst.config.json")].join("\n"),
c.yellow("Files written to current directory"),
);
p.note( p.note(
[ [
`${c.bold("Public viewer URL:")} ${c.cyan(publicUrl)}`, `${c.bold("Public viewer URL:")} ${c.cyan(publicUrl)}`,
`${c.bold("Private admin URL:")} ${c.cyan(adminUrl)}`, `${c.bold("Admin URL:")} ${c.cyan(adminUrl)}`,
`${c.bold("Forgejo base URL:")} ${c.cyan(forgejoBaseUrl)}`, `${c.bold("Forgejo base URL:")} ${c.cyan(forgejoBaseUrl)}`,
`${c.bold("Forgejo bot username:")} ${c.green(answers.forgejoBotUsername)}`, `${c.bold("Myst bot username:")} ${c.cyan(answers.forgejoBotUsername)}`,
"", "",
`${c.bold("Admin URL reminder:")} protect this upstream with Tailscale, VPN, Cloudflare Access, or reverse-proxy auth.`, `${c.bold("Admin URL reminder:")} protect this upstream with Tailscale, VPN, Cloudflare Access, or reverse-proxy auth.`,
].join("\n"), ].join("\n"),
c.yellow("Next steps"),
); );
p.outro( p.log.success(
c.green( "Done. Verify myst's connection using the 'verify' command.\nOnce verified, deploy!",
"Done. Deploy Myst, then run forgejo bootstrap and doctor commands to verify setup.",
),
); );
} catch (error) { } catch (error) {
s.stop(); s.stop();
@ -272,3 +251,11 @@ export async function initCommand(_args: string[]): Promise<void> {
process.exitCode = 1; process.exitCode = 1;
} }
} }
export const commandConfig: CommandConfig = {
description: "Generate .env file",
options: {
output: { type: "string", short: "o" },
},
handler: init,
};

View file

@ -0,0 +1,49 @@
import path from "node:path";
import * as c from "yoctocolors";
import {
ENV_MAPPING,
MystEnvironmentVariables,
parseEnvFile,
SECRET_KEYS,
} from "../../utils/config.js";
import { CommandConfig } from "../../cli-router.js";
export const commandConfig: CommandConfig = {
description: "Display current configuration",
handler: async () => {
const envPath = path.join(process.cwd(), ".env");
let config: Partial<MystEnvironmentVariables>;
try {
config = parseEnvFile(envPath);
} catch (error) {
const err = error as NodeJS.ErrnoException;
if (err.code === "ENOENT") {
process.stderr.write(
`${c.red("Error:")} .env file not found in ${process.cwd()}\n`,
);
process.exitCode = 1;
return;
}
throw error;
}
process.stdout.write(c.bold("Myst Configuration\n"));
process.stdout.write(`${c.dim("─".repeat(40))}\n`);
for (const [envKey, configKey] of Object.entries(ENV_MAPPING)) {
const value = config[configKey];
const displayValue = SECRET_KEYS.includes(
configKey as (typeof SECRET_KEYS)[number],
)
? c.dim("****")
: value || c.dim("not set");
process.stdout.write(`${c.bold(envKey + ":")} ${displayValue}\n`);
}
process.exitCode = 0;
},
};

View file

@ -0,0 +1,204 @@
import path from "node:path";
import * as c from "yoctocolors";
import * as p from "@clack/prompts";
import { ENV_MAPPING, parseEnvFile, REQUIRED_KEYS } from "../utils/config.js";
import {
checkForgejoReachability,
checkForgejoApiAuthentication,
checkRepoAccess,
} from "../utils/forgejo-checks.js";
import { CommandConfig } from "../cli-router.js";
interface VerifyOptions {
diagnostic?: boolean;
}
interface CheckResult {
name: string;
success: boolean;
message?: string;
}
function loadConfig(): Record<string, string> | null {
const envPath = path.join(process.cwd(), ".env");
try {
return parseEnvFile(envPath);
} catch (error) {
const err = error as NodeJS.ErrnoException;
if (err.code === "ENOENT") {
p.cancel(`${c.red("Error:")} .env file not found in ${process.cwd()}`);
process.exitCode = 1;
return null;
}
throw error;
}
}
function getMissingKeys(config: Record<string, string>): string[] {
const missing: string[] = [];
for (const key of REQUIRED_KEYS) {
if (!config[key]) {
missing.push(key.replace(/(?<=[a-z])(?=[A-Z])/g, "_").toUpperCase());
}
}
return missing;
}
async function runDiagnosticMode(
config: Record<string, string>,
missing: string[],
): Promise<void> {
const results: CheckResult[] = [];
if (missing.length > 0) {
results.push({
name: "Required config",
success: false,
message: `Missing: ${missing.join(", ")}`,
});
}
for (const [envKey, configKey] of Object.entries(ENV_MAPPING)) {
const value = config[configKey];
results.push({
name: envKey,
success: !!value,
message: value ? "configured" : "missing",
});
}
const forgejoResults = await runForgejoChecks(config);
const allResults = [...results, ...forgejoResults];
const lines = allResults.map((r) => {
const icon = r.success ? c.green("✓") : c.red("✗");
const msg = r.message ? ` ${r.message}` : "";
return `${icon} ${r.name}${msg}`;
});
p.note(lines.join("\n"), c.yellow("Results"));
const failures = allResults.filter((r) => !r.success);
if (failures.length > 0) {
p.outro(c.red(`${failures.length} issue(s) found`));
process.exitCode = 1;
return;
}
p.outro(c.green("All checks passed"));
}
async function runVerifyMode(
config: Record<string, string>,
missing: string[],
): Promise<void> {
if (missing.length > 0) {
p.cancel(
`${c.red("Error:")} Missing required env variables: ${missing.join(", ")}`,
);
process.exitCode = 1;
return;
}
const s = p.spinner();
s.start("Verifying Forgejo configuration");
const forgejoResults = await runForgejoChecks(config);
const firstFailure = forgejoResults.find((r) => !r.success);
if (firstFailure) {
s.stop(firstFailure.message);
p.cancel(`${c.red("✗")} ${firstFailure.name}: ${firstFailure.message}`);
process.exitCode = 1;
return;
}
if (forgejoResults.length === 0) {
s.stop("No Forgejo configuration");
p.cancel(`${c.red("Error:")} Forgejo not configured`);
process.exitCode = 1;
return;
}
s.stop("Verification complete");
const [reachability, auth, repoAccess] = forgejoResults;
p.note(
[
`${c.green("✓")} ${reachability.name}`,
`${c.green("✓")} ${auth.name}: ${auth.message}`,
`${c.green(repoAccess.success ? "✓" : "✗")} ${repoAccess.name}: ${repoAccess.message}`,
].join("\n"),
c.yellow("Results"),
);
p.outro(c.green("Verification passed"));
}
async function runForgejoChecks(
config: Record<string, string>,
): Promise<CheckResult[]> {
const { forgejoBaseUrl, forgejoPat, forgejoBotUsername } = config;
if (!forgejoBaseUrl || !forgejoPat || !forgejoBotUsername) {
return [];
}
const results: CheckResult[] = [];
const reachability = await checkForgejoReachability(forgejoBaseUrl);
results.push(reachability);
if (!reachability.success) {
return results;
}
const auth = await checkForgejoApiAuthentication(forgejoBaseUrl, forgejoPat);
results.push(auth);
if (!auth.success) {
return results;
}
const repoAccess = await checkRepoAccess(
forgejoBaseUrl,
forgejoPat,
forgejoBotUsername,
);
results.push(repoAccess);
return results;
}
async function verifyCommand(opts: VerifyOptions): Promise<void> {
const isDiagnostic = opts.diagnostic ?? false;
p.intro(c.bold("myst verify"));
const config = loadConfig();
if (!config) {
return;
}
const missing = getMissingKeys(config);
if (isDiagnostic) {
await runDiagnosticMode(config, missing);
} else {
await runVerifyMode(config, missing);
}
}
export const commandConfig: CommandConfig = {
description: "Verify Myst configuration and connection to Forgejo",
options: {
diagnostic: {
type: "boolean",
description: "Show diagnostic information for all checks",
},
},
handler: verifyCommand,
};

View file

@ -1,113 +1,5 @@
#!/usr/bin/env node #!/usr/bin/env node
import * as c from "yoctocolors"; import { runCli } from "./cli-router.js";
import pkg from "../package.json" with { type: "json" }; import { commandRegistry } from "./commandRegistry.js";
import { initCommand } from "./commands/init.js"; await runCli(process.argv.slice(2), commandRegistry);
const PADDING = 4;
const INDENT = " ";
const USAGE = "myst <command> [options/flags] [arguments]";
type CommandName = "init";
interface Option {
name: CommandName | string | string[];
desc: string;
}
interface CLIConfig {
commands: Option[];
globalFlags: Option[];
}
const config: CLIConfig = {
commands: [
{ name: "init", desc: "Bootstrap Myst and generate config/env files" },
],
globalFlags: [
{ name: ["-h", "--help"], desc: "Display help information" },
{ name: ["-v", "--version"], desc: "Display package version number" },
],
};
const splitCamelCaseWords = (text: string): string =>
text.replace(/([a-z])([A-Z])/g, "$1 $2");
const toTitleCase = (text: string): string =>
text.replace(/\b\w/g, (c) => c.toUpperCase());
function formatSection(
header: string,
options: Option[],
colWidth: number,
): string {
const rows = options.map((o) => {
const name = Array.isArray(o.name) ? o.name.join(", ") : o.name;
return `${INDENT}${name.padEnd(colWidth)}${o.desc}`;
});
const title = toTitleCase(splitCamelCaseWords(header));
return [c.bold(title + ":"), ...rows].join("\n");
}
const allOptions = Object.values(config).flat();
const COL_WIDTH =
Math.max(
...allOptions.map((o) =>
Array.isArray(o.name) ? o.name.join(", ").length : o.name.length,
),
) + PADDING;
const HELP_TEXT = `
${c.yellow(pkg.name)}
${INDENT}${USAGE}
${Object.entries(config)
.map(([header, options]) =>
formatSection(header, options as Option[], COL_WIDTH),
)
.join("\n\n")}
`;
async function main(): Promise<void> {
const [command, ...options] = process.argv.slice(2);
const flags = options.filter((o) => o.startsWith("-"));
if (flags.includes("-v") || flags.includes("--version")) {
process.stdout.write(`${pkg.version}\n`);
process.exitCode = 0;
return;
}
if (!command || flags.includes("-h") || flags.includes("--help")) {
process.stdout.write(`${HELP_TEXT}`);
process.exitCode = 0;
return;
}
const knownCommands: Record<CommandName, (args: string[]) => Promise<void>> =
{
init: initCommand,
};
const isKnownCommand = (cmd: string): cmd is CommandName =>
cmd in knownCommands;
if (!isKnownCommand(command)) {
process.stderr.write(`Unknown command: ${command}\n`);
process.exitCode = 1;
return;
}
try {
await knownCommands[command](options);
} catch (error) {
const message = error instanceof Error ? error.message : "Unknown error";
process.stderr.write(`${c.red("Error:")} ${message}\n`);
process.exitCode = 1;
}
}
await main();

View file

@ -0,0 +1,103 @@
import fs from "node:fs";
export interface MystEnvironmentVariables {
publicUrl: string;
adminUrl: string;
databaseUrl: string;
forgejoBaseUrl: string;
forgejoBotUsername: string;
forgejoPat: string;
grantTokenSecret: string;
}
export const ENV_MAPPING = {
MYST_PUBLIC_URL: "publicUrl",
MYST_ADMIN_URL: "adminUrl",
DATABASE_URL: "databaseUrl",
FORGEJO_BASE_URL: "forgejoBaseUrl",
FORGEJO_BOT_USERNAME: "forgejoBotUsername",
FORGEJO_PAT: "forgejoPat",
GRANT_TOKEN_SECRET: "grantTokenSecret",
} as const;
export const REQUIRED_KEYS = [
"forgejoBaseUrl",
"forgejoBotUsername",
"forgejoPat",
] as const;
export const DATABASE_PROTOCOLS = ["postgres:", "postgresql:"] as const;
export const SECRET_KEYS = [
"forgejoPat",
"grantTokenSecret",
"databaseUrl",
"adminUrl",
] as const;
export const SECRET_ENV_KEYS = [
"DATABASE_URL",
"FORGEJO_PAT",
"GRANT_TOKEN_SECRET",
"MYST_ADMIN_URL",
] as const;
export function parseEnvFile(
envPath: string,
): Partial<MystEnvironmentVariables> {
const config: Partial<MystEnvironmentVariables> = {};
const content = fs.readFileSync(envPath, "utf-8");
const lines = content.split("\n");
for (const line of lines) {
const trimmed = line.trim();
if (!trimmed || trimmed.startsWith("#")) continue;
const [key, ...valueParts] = trimmed.split("=");
if (!key) continue;
const value = valueParts.join("=").trim();
const configKey = ENV_MAPPING[key as keyof typeof ENV_MAPPING];
if (configKey) {
config[configKey] = value;
}
}
return config;
}
export function validateDatabaseUrl(url: string | undefined): boolean {
if (!url) return false;
try {
const parsed = new URL(url);
return DATABASE_PROTOCOLS.includes(
parsed.protocol as "postgres:" | "postgresql:",
);
} catch {
return false;
}
}
export function generateEnvFile(options: MystEnvironmentVariables): string {
const lines = [
`# Public URL used for share links.`,
`MYST_PUBLIC_URL=${options.publicUrl}`,
``,
`# Private operator URL for the admin UI. Protect this upstream.`,
`MYST_ADMIN_URL=${options.adminUrl}`,
``,
`# Myst's own Postgres database.`,
`DATABASE_URL=${options.databaseUrl}`,
``,
`# Existing Forgejo instance and operator-created PAT for the dedicated Forgejo user.`,
`FORGEJO_BASE_URL=${options.forgejoBaseUrl}`,
`FORGEJO_BOT_USERNAME=${options.forgejoBotUsername}`,
`FORGEJO_PAT=${options.forgejoPat}`,
``,
`# Secret used to sign or derive grant tokens.`,
`GRANT_TOKEN_SECRET=${options.grantTokenSecret}`,
];
return lines.join("\n");
}

View file

@ -3,7 +3,3 @@ import { randomBytes } from "node:crypto";
export function generateSecret(bytes = 32): string { export function generateSecret(bytes = 32): string {
return randomBytes(bytes).toString("hex"); return randomBytes(bytes).toString("hex");
} }
export function generatePassword(bytes = 16): string {
return randomBytes(bytes).toString("base64url");
}

View file

@ -1,42 +0,0 @@
interface EnvOptions {
adminUrl: string;
databaseUrl: string;
forgejoBaseUrl: string;
forgejoBotUsername: string;
forgejoPat: string;
grantTokenSecret: string;
publicUrl: string;
}
function escapeEnvValue(value: string): string {
return `"${value
.replace(/\\/g, "\\\\") // Escape backslashes
.replace(/"/g, '\\"') // Escape double quotes
.replace(/\r?\n/g, "\\n") // Escape newlines
.replace(/\$/g, "\\$")}"`; // Escape dollar signs
}
/**
* Generates an .env file for Myst with the given options.
* @param options - The options for generating the .env file.
* @returns {string} The .env file formatted as a string.
*/
export function generateEnvFile(options: EnvOptions): string {
return `# Public URL used for share links.
MYST_PUBLIC_URL=${escapeEnvValue(options.publicUrl)}
# Private operator URL for the admin UI. Protect this upstream.
MYST_ADMIN_URL=${escapeEnvValue(options.adminUrl)}
# Myst's own Postgres database.
DATABASE_URL=${escapeEnvValue(options.databaseUrl)}
# Existing Forgejo instance and operator-created PAT for the dedicated Forgejo user.
FORGEJO_BASE_URL=${escapeEnvValue(options.forgejoBaseUrl)}
FORGEJO_BOT_USERNAME=${escapeEnvValue(options.forgejoBotUsername)}
FORGEJO_PAT=${escapeEnvValue(options.forgejoPat)}
# Secret used to sign or derive grant tokens.
GRANT_TOKEN_SECRET=${escapeEnvValue(options.grantTokenSecret)}
`;
}

View file

@ -0,0 +1,170 @@
const TIMEOUT = 5000;
export type CheckResult = {
name: string;
success: boolean;
message?: string;
};
export function createCheckResult(
name: string,
success: boolean,
message?: string,
): CheckResult {
const result: CheckResult = { name, success };
if (message !== undefined) {
result.message = message;
}
return result;
}
async function fetchWithTimeout(
url: string,
init: RequestInit,
): Promise<Response> {
return fetch(url, { ...init, signal: AbortSignal.timeout(TIMEOUT) });
}
function getErrorMessage(error: unknown, context: string): string {
if (error instanceof Error) {
if (error.name === "TimeoutError") {
return `${context}: connection timed out`;
}
if (error.message.includes("ECONNREFUSED")) {
return `${context}: connection refused`;
}
if (error.message.includes("ENOTFOUND") || error.message.includes("getaddrinfo")) {
return `${context}: host not found`;
}
return `${context}: ${error.message}`;
}
return `${context}: unknown error`;
}
export async function checkForgejoReachability(
baseUrl: string,
): Promise<CheckResult> {
try {
const response = await fetchWithTimeout(baseUrl, { method: "GET" });
if (response.ok) {
return createCheckResult("Forgejo reachability", true, "connected");
}
return createCheckResult(
"Forgejo reachability",
false,
`server returned ${response.status} ${response.statusText}`,
);
} catch (error) {
return createCheckResult(
"Forgejo reachability",
false,
getErrorMessage(error, "cannot reach server"),
);
}
}
export async function checkForgejoApiAuthentication(
baseUrl: string,
pat: string,
): Promise<CheckResult> {
try {
const response = await fetchWithTimeout(`${baseUrl}/api/v1/user`, {
method: "GET",
headers: {
Authorization: `Bearer ${pat}`,
},
});
if (response.status === 401) {
return createCheckResult(
"Forgejo API token",
false,
"token is invalid or expired",
);
}
if (response.status === 403) {
return createCheckResult(
"Forgejo API token",
false,
"token lacks sufficient permissions",
);
}
if (!response.ok) {
return createCheckResult(
"Forgejo API token",
false,
`server returned ${response.status}`,
);
}
const user = (await response.json()) as { login: string };
return createCheckResult(
"Forgejo API token",
true,
`authenticated as ${user.login}`,
);
} catch (error) {
return createCheckResult(
"Forgejo API token",
false,
getErrorMessage(error, "cannot connect to API"),
);
}
}
export async function checkRepoAccess(
baseUrl: string,
pat: string,
username: string,
): Promise<CheckResult> {
try {
const response = await fetchWithTimeout(
`${baseUrl}/api/v1/users/${username}/repos?limit=1`,
{
method: "GET",
headers: {
Authorization: `Bearer ${pat}`,
},
},
);
if (response.status === 401 || response.status === 403) {
return createCheckResult(
"Repo access",
false,
"token lacks permission to list repositories",
);
}
if (!response.ok) {
return createCheckResult(
"Repo access",
false,
`server returned ${response.status}`,
);
}
const repos = (await response.json()) as { name: string }[];
if (repos.length > 0) {
return createCheckResult(
"Repo access",
true,
`found ${repos.length} repository`,
);
}
return createCheckResult(
"Repo access",
false,
"no repositories found for user",
);
} catch (error) {
return createCheckResult(
"Repo access",
false,
getErrorMessage(error, "cannot list repositories"),
);
}
}

View file

@ -1,12 +1,9 @@
{ {
"extends": "../../tsconfig.base.json", "extends": "../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"composite": true,
"rootDir": "src", "rootDir": "src",
"outDir": "dist" "outDir": "dist"
}, },
"references": [ "references": [{ "path": "../shared" }],
{ "path": "../shared" }
],
"include": ["src/**/*.ts"] "include": ["src/**/*.ts"]
} }

View file

@ -5,6 +5,7 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"build": "tsc -p tsconfig.json", "build": "tsc -p tsconfig.json",
"start": "node dist/index.js",
"check": "tsc -b tsconfig.json", "check": "tsc -b tsconfig.json",
"clean": "rm -rf dist" "clean": "rm -rf dist"
}, },

View file

@ -9,8 +9,6 @@
"@myst/shared": ["packages/shared/src/index.ts"] "@myst/shared": ["packages/shared/src/index.ts"]
}, },
"strict": true, "strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"skipLibCheck": true, "skipLibCheck": true,
"declaration": true, "declaration": true,
"sourceMap": true, "sourceMap": true,