Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroki0525 committed Nov 22, 2023
1 parent f3216a6 commit 26bfa34
Show file tree
Hide file tree
Showing 13 changed files with 217 additions and 13 deletions.
54 changes: 52 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
# Dandori(段取り)

<img src="./media/dandori.png" alt="dandori" width="206" height="206">
<img src="./media/dandori.png" alt="dandori" width="206">

*This project is experimental.*
*This project is experimental.*

Dandori analyzes and visualizes the dependencies of your tasks.

Let's look at a few examples.

## Example 1

### Input

```text
Today's My Tasks
* Send Email to John
* Send Email to Mary
* Report to Boss after sending emails
```

### Output(Miro)

<img src="./media/miro_example.png" alt="miro output example" width="422">

## Example 2

### Input

```text
Today's My Tasks
* [todo] Send Email to John
* [doing] Write a blog
* [done] Report to Boss
```

### Output(Notion)

<img src="./media/notion_example.png" alt="notion output example" width="426">

## Usage

This project is monorepo. You can choose the following ways to use it.

### Use CLI

Please read [`@dandori/cli` README](./packages/cli/README.md).

### Use your own code

Please read [`@dandori/core` README](./packages/core/README.md) and [`@dandori/ui` README](./packages/ui/README.md).

### License

Released under the MIT license.
Binary file added media/miro_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/notion_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 49 additions & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
# dandori/cli

*This project is experimental.*
This repository is responsible for executing `@dandori/*` packages.

## Installation

```bash
# It isn't necessary to install this package if you use the command like `npx` .
npm install @dandori/cli
yarn add @dandori/cli
pnpm add @dandori/cli
```

## Usage

First, please create `.env` file and set environment variables like below.

```text
OPENAI_API_KEY=your_openai_api_key
MIRO_API_KEY=your_miro_api_key
```

Second,

```ts
import generateDandoriTasks from '@dandori/core';
import { generateDandoriMiroCards } from "@dandori/ui";

const text = `
Today's My Tasks
* Send Email to John
* Send Email to Mary
* Report to Boss after sending emails
`;

const tasks = await generateDandoriTasks(text);
await generateDandoriMiroCards(tasks, {
boardId: '1234567890',
});
```

## Requirements

* Please see [`@dandori/core` README]('../core/README.md') before using `@dandori/ui`.
* `@dandori/ui` depends on external APIs. You need to set `EXTERNALAPP_API_KEY` environment variables like `MIRO_API_KEY` .
* `@dandori/ui` supports to load `.env` file. Please create `.env` file and set environment variables.

## Supported External APIs

* [Miro](https://miro.com/)
* [Notion](https://www.notion.so/)
1 change: 1 addition & 0 deletions packages/cli/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const supportedOptionalTaskProps: OptionalTaskPropsOption = [
"description",
"deadline",
"assignee",
"status",
"all",
];

Expand Down
30 changes: 29 additions & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# dandori/core

*This project is experimental.*
This repository is responsible for generating the task dependency from texts by using AI.

## Installation

```bash
npm install @dandori/core
yarn add @dandori/core
pnpm add @dandori/core
```

## Usage

```ts
import generateDandoriTasks from '@dandori/core';

const texts = `
Today's My Tasks
* Send Email to John
* Send Email to Mary
* Report to Boss after sending emails
`;

const tasks = await generateDandoriTasks(texts);
```

## Requirements

* `@dandori/core` depends on OpenAI API. You need to set `OPENAI_API_KEY` environment variable.
* `@dandori/core` supports to load `.env` file. Please create `.env` file and set `OPENAI_API_KEY` environment variable.
6 changes: 4 additions & 2 deletions packages/libs/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# dandori/ui
# dandori/libs

*This project is experimental.*
This repository is responsible for defining common logics for `@dandori/*` packages.

In most cases, you don't need to use this package directly.
40 changes: 39 additions & 1 deletion packages/ui/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# dandori/ui

*This project is experimental.*
This repository is responsible for viewing your tasks which are generated by `@dandori/core` .

## Installation

```bash
npm install @dandori/core @dandori/ui
yarn add @dandori/core @dandori/ui
pnpm add @dandori/core @dandori/ui
```

## Usage

```ts
import generateDandoriTasks from '@dandori/core';
import { generateDandoriMiroCards } from "@dandori/ui";

const text = `
Today's My Tasks
* Send Email to John
* Send Email to Mary
* Report to Boss after sending emails
`;

const tasks = await generateDandoriTasks(text);
await generateDandoriMiroCards(tasks, {
boardId: '1234567890',
});
```

## Requirements

* Please see [`@dandori/core` README]('../core/README.md') before using `@dandori/ui`.
* `@dandori/ui` depends on external APIs. You need to set `EXTERNALAPP_API_KEY` environment variables like `MIRO_API_KEY` .
* `@dandori/ui` supports to load `.env` file. Please create `.env` file and set environment variables.

## Supported External APIs

* [Miro](https://miro.com/)
* [Notion](https://www.notion.so/)
4 changes: 2 additions & 2 deletions packages/ui/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ declare module "process" {
global {
namespace NodeJS {
interface ProcessEnv {
MIRO_ACCESS_TOKEN: string;
NOTION_TOKEN: string;
MIRO_API_KEY: string;
NOTION_API_KEY: string;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/__tests__/notion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe("generateDandoriNotionPages", () => {
};

beforeAll(() => {
process.env.NOTION_TOKEN = "token";
process.env.NOTION_API_KEY = "token";
});

beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/miro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function generateDandoriMiroCards(
): Promise<void> {
const logger = getLogger();
const miroApi = new MiroApi(
process.env.MIRO_ACCESS_TOKEN,
process.env.MIRO_API_KEY,
undefined,
(...thing) => {
logger.debug(thing);
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/notion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const createPageParams = (
],
},
};
if (descriptionProp) {
if (description && descriptionProp) {
pageProperties[descriptionProp] = {
rich_text: [
{
Expand Down Expand Up @@ -134,7 +134,7 @@ export async function generateDandoriNotionPages(
): Promise<void> {
const logger = getLogger();
const client = new Client({
auth: process.env.NOTION_TOKEN,
auth: process.env.NOTION_API_KEY,
logger: (
level: LogLevel,
message: string,
Expand Down
37 changes: 37 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 26bfa34

Please sign in to comment.