Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Bug report
description: Report a reproducible Brings CLI defect
labels: [bug]
body:
- type: textarea
id: reproduction
attributes:
label: Reproduction
description: Include the command, sanitized input, expected result, and actual result.
validations:
required: true
- type: input
id: version
attributes:
label: Version
placeholder: 0.1.0
validations:
required: true
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Feature request
description: Propose a local-first Brings CLI capability
labels: [enhancement]
body:
- type: textarea
id: problem
attributes:
label: Problem and proposed workflow
validations:
required: true
- type: textarea
id: data
attributes:
label: Document and compatibility impact
description: Explain durable data changes and backward compatibility.
validations:
required: true
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Summary

Describe the user-visible change and its local-first data impact.

## Verification

- [ ] `bun run verify`
- [ ] Relevant CLI command exercised against a temporary document

## Checklist

- [ ] README and CHANGELOG updated when behavior changed.
- [ ] No document data, credentials, or generated artifacts are included.
- [ ] The change preserves stable document identifiers.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
groups:
development-dependencies:
dependency-type: development
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI

on:
push:
branches: [main]
pull_request:

permissions:
contents: read

jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install --frozen-lockfile
- run: bun run verify
19 changes: 19 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CodeQL

on:
push:
branches: [main]
pull_request:
schedule:
- cron: "19 4 * * 1"

permissions:
contents: read
security-events: write

jobs:
analyze:
uses: github/codeql-action/.github/workflows/codeql.yml@v3
with:
languages: javascript-typescript
build-mode: none
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
coverage/
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

All notable changes to this project are documented here.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# brings-cli
Scriptable local-first Brings design-document CLI for independent creators.
# Brings CLI

`@vectojs/brings-cli` is the local-first command line interface for creating,
inspecting, and transforming Brings design documents. It intentionally has no
cloud or collaboration dependency.
4 changes: 4 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Security Policy

Please report vulnerabilities privately to the VectoJS maintainers. Do not
include untrusted executable content in a Brings document.
113 changes: 113 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "plugins": ["typescript"] }
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@vectojs/brings-cli",
"version": "0.1.0",
"description": "Scriptable local-first Brings design-document CLI.",
"license": "MIT",
"type": "module",
"bin": {
"brings": "./src/cli.ts"
},
"scripts": {
"build": "tsc --noEmit",
"test": "bun test",
"format:check": "prettier --check .",
"lint": "oxlint --deny-warnings src test",
"verify": "bun run format:check && bun run lint && bun run test && bun run build"
},
"dependencies": {
"@vectojs/brings-core": "0.11.0"
},
"devDependencies": {
"@types/bun": "^1.3.0",
"oxlint": "^1.73.0",
"prettier": "^3.9.5",
"typescript": "^7.0.2"
}
}
39 changes: 39 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bun
import { createDocumentStore } from "@vectojs/brings-core";

const [command, file] = process.argv.slice(2);
if (!command || !file || !["create", "inspect"].includes(command)) {
console.error("Usage: brings <create|inspect> <document.json>");
process.exit(2);
}

if (command === "create") {
const documentId = crypto.randomUUID();
const pageId = crypto.randomUUID();
const created = createDocumentStore({
id: documentId,
name: "Untitled",
initialPage: { id: pageId, name: "Page 1" },
});
if (!created.ok)
throw new Error(`Core rejected the new document: ${created.error.code}`);
await Bun.write(
file,
`${JSON.stringify(created.value.snapshot().document, null, 2)}\n`,
);
console.log(JSON.stringify({ file, documentId, pageId }, null, 2));
} else {
const document = await Bun.file(file).json();
console.log(
JSON.stringify(
{
id: document.id,
name: document.name,
pages: document.pages?.length ?? 0,
nodes: document.nodes?.length ?? 0,
},
null,
2,
),
);
}
7 changes: 7 additions & 0 deletions test/cli.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { expect, test } from "bun:test";

test("keeps the public CLI entrypoint present", () => {
expect(
Bun.file(new URL("../src/cli.ts", import.meta.url)).size,
).toBeGreaterThan(0);
});
11 changes: 11 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"noEmit": true,
"types": ["bun"]
},
"include": ["src", "test"]
}
Loading