Skip to content

Commit

Permalink
Add docs (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroki0525 authored Nov 22, 2023
1 parent 071d21a commit 3a9b95b
Show file tree
Hide file tree
Showing 18 changed files with 450 additions and 282 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.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-unused-imports": "3.0.0",
"eslint-plugin-vitest": "^0.3.9",
"eslint-plugin-vitest": "^0.3.10",
"husky": "^8.0.3",
"lint-staged": "^15.0.0",
"lint-staged": "^15.1.0",
"prettier": "3.1.0",
"tsup": "^8.0.0",
"tsx": "^4.0.0",
"tsup": "^8.0.1",
"tsx": "^4.2.0",
"turbo": "^1.10.16",
"typescript": "5.2.2",
"vitest": "^0.34.6"
Expand Down
45 changes: 44 additions & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
# 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, please create a file which contains your tasks like below.

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

Finally, please execute the following command.

```bash
npx -p @dandori/cli dandori-miro your_tasks.txt -b your_miro_board_id
yarn dlx -p @dandori/cli dandori-miro your_tasks.txt -b your_miro_board_id
pnpm --package=@dandori/cli dlx dandori-miro your_tasks.txt -b your_miro_board_id
```

## Requirements

* Please see [`@dandori/core` README]('../core/README.md') and [`@dandori/ui` README]('../ui/README.md') before using `@dandori/cli`.

## Supported External APIs

* [Miro](https://miro.com/)
1 change: 1 addition & 0 deletions packages/cli/src/core/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ describe("DandoriCoreCli", () => {
"description",
"deadline",
"assignee",
"status",
"all",
];
const expectedMessage = `Unsupported optional task props: ${optionalTaskProps}. Supported optional task props are ${supportedOptionalTaskProps.join(
Expand Down
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.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"license": "MIT",
"dependencies": {
"@dandori/libs": "workspace:*",
"openai": "^4.15.0"
"openai": "^4.19.1"
}
}
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.
2 changes: 1 addition & 1 deletion packages/libs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"license": "MIT",
"dependencies": {
"dotenv": "^16.3.1",
"pino": "^8.16.1",
"pino": "^8.16.2",
"pino-pretty": "^10.2.3"
}
}
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/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"author": "Hiroki Miyaji",
"license": "MIT",
"dependencies": {
"@mirohq/miro-api": "^2.0.2",
"@mirohq/miro-api": "^2.1.0",
"@notionhq/client": "^2.2.13",
"flat-to-nested": "^1.1.1",
"tree-model": "^1.0.7"
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
Loading

0 comments on commit 3a9b95b

Please sign in to comment.