{"id":19854826,"url":"https://github.com/jy8752/note-cli","last_synced_at":"2026-03-03T14:40:11.532Z","repository":{"id":193303691,"uuid":"688328518","full_name":"JY8752/note-cli","owner":"JY8752","description":"note-cli is CLI tool to manage article. ex) note(Article Submission Service), Blog","archived":false,"fork":false,"pushed_at":"2023-10-01T12:01:30.000Z","size":365,"stargazers_count":12,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T20:35:58.783Z","etag":null,"topics":["cli","cobra","go","golang","headless-browsers","rod","template"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JY8752.png","metadata":{"files":{"readme":"README.ja.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-07T06:04:36.000Z","updated_at":"2025-01-27T09:40:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"2b497412-e5fa-4ad9-b5b8-f471b65276fc","html_url":"https://github.com/JY8752/note-cli","commit_stats":null,"previous_names":["jy8752/note-cli"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JY8752%2Fnote-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JY8752%2Fnote-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JY8752%2Fnote-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JY8752%2Fnote-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JY8752","download_url":"https://codeload.github.com/JY8752/note-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251969247,"owners_count":21673182,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","cobra","go","golang","headless-browsers","rod","template"],"created_at":"2024-11-12T14:10:44.118Z","updated_at":"2026-03-03T14:40:06.500Z","avatar_url":"https://github.com/JY8752.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/logo.jpeg\" width=\"500\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\nNote CLI tool!!\n\u003c/p\u003e\n\n\u003cp align='center'\u003e\n\u003ca href=\"https://github.com/JY8752/note-cli/releases/latest\"\u003e\u003cimg alt=\"GitHub release (latest by date)\" src=\"https://img.shields.io/github/v/release/JY8752/note-cli?style=flat\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/JY8752/note-cli/releases/latest\"\u003e\u003cimg alt=\"GitHub all releases\" src=\"https://img.shields.io/github/downloads/JY8752/note-cli/total?style=flat\"\u003e\u003c/a\u003e\n\u003ca href=\"./LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/JY8752/note-cli?style=flat\" /\u003e\u003c/a\u003e\n\u003c!-- \u003ca href=\"https://github.com/JY8752/note-cli/actions/workflows/ci.yml\"\u003e\u003cimg alt=\"GitHub Workflow Status\" src=\"https://img.shields.io/github/actions/workflow/status/JY8752/note-cli/ci.yml?branch=main\u0026logo=github\u0026style=flat\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://codeclimate.com/github/JY8752/note-cli/maintainability\"\u003e\u003cimg alt=\"Code Climate maintainability\" src=\"https://img.shields.io/codeclimate/maintainability/JY8752/note-cli?logo=codeclimate\u0026style=flat\" /\u003e\u003c/a\u003e --\u003e\n\u003ca href=\"https://goreportcard.com/report/github.com/JY8752/note-cli\"\u003e\u003cimg alt=\"Go Report Card\" src=\"https://goreportcard.com/badge/github.com/JY8752/note-cli\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/github/JY8752/note-cli\"\u003e\u003cimg alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/JY8752/note-cli?logo=codecov\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"./README.md\"\u003eEnglish\u003c/a\u003e | 日本語\n\u003c/p\u003e\n\n# note-cli\n\n**note-cli**は記事投稿サイトである[note](https://note.com/)の記事作成、管理をサービス上ではなく自分のローカル環境で行うためのCLIツールです。note-cliを作成したモチベーションは以下の通りです。\n\n- webブラウザで開いたエディタではなく自分の好きなエディタで執筆したい。(例えば、VSCode)\n- markdown形式で執筆した記事をGitHubなどでバージョン管理したい。\n- 記事画像を用意するのがめんどくさい。(noteが用意してくれている無料の画像はあまり使いたくない)\n\n**note-cliはnote以外の記事管理ツールとしても使用できるはずです。例えば、自分で公開しているブログの記事管理などにも使えるでしょう。もし、足りない機能や改善点があればPull Requestまたはissueなどで気軽にお知らせください。**\n\n## note-cliでできること\n\n- 記事をすぐに執筆できるようにmarkdownファイルを含む記事ディレクトリをコマンドで作成します。\n- 記事にアップロードするための画像をコマンドで作成することができます。\n\n## インストール\n\n### Go install\n\n```\ngo install github.com/JY8752/note-cli@latest\n```\n\n### Homebrew\n\n```\nbrew install JY8752/tap/note-cli\n```\n\n```\n% note-cli -h\n\nnote-cli is a CLI command tool for creating, writing, and managing note articles\n\nUsage:\n  note-cli [command]\n\nAvailable Commands:\n  completion  Generate the autocompletion script for the specified shell\n  create      Create a new article directory.\n  help        Help about any command\n\nFlags:\n  -h, --help     help for note-cli\n  -t, --toggle   Help message for toggle\n\nUse \"note-cli [command] --help\" for more information about a command.\n```\n\n## はじめに\n\n1. 記事を管理するディレクトリを作成し移動します。\n\n```\nmkdir note-cli-demo\ncd note-cli-demo\n```\n\n2. 記事ディレクトリを作成します。\n\n```\n% note-cli create article .\n\nCreate directory. a6b420c6-9bb2-4060-869c-20c171fc9827\nCreate file. a6b420c6-9bb2-4060-869c-20c171fc9827.md\n```\n\n```\n.\n└── a6b420c6-9bb2-4060-869c-20c171fc9827\n    └── a6b420c6-9bb2-4060-869c-20c171fc9827.md\n```\n\n- ```a6b420c6-9bb2-4060-869c-20c171fc9827.md``` 記事ファイル。ファイル名はディレクトリ名と同じで今回はランダム値(UUID)を使用しています。\n- ~~```config.yaml``` 設定ファイル。記事のタイトルや著者名などを設定するファイルです。~~\n\n```yaml:config.yaml\ntitle: article title\nauthor: your name \n```\n\n**config.yamlは廃止しました。記事タイトルや著者名などの設定情報は記事markdownファイルのメタデータとして記載するように変更されています。**\n\n3. 記事画像を生成する。\n\n以下のコマンドを実行することで```output.png```が生成されます。\n\n```\n% note-cli create image ./a6b420c6-9bb2-4060-869c-20c171fc9827.md\n\nComplete generate OGP image\n```\n\n\u003cimg src=\"./assets/output.png\"/\u003e\n\nアイコン画像を用意することで画像にアイコンを載せることも可能です。また、テンプレート画像は別の種類を選択することもできます。\n\n```\n% note-cli create image ./a6b420c6-9bb2-4060-869c-20c171fc9827.md -i ./icon.png --template 2\n```\n\n\u003cimg src=\"./assets/output2.png\"/\u003e\n\n4. まとめ\n\n- ```note-cli create article```コマンドで投稿する記事ファイルとディレクトリをコマンドで作成することができます。作成したmarkdownファイルに記事を作成したらコピペしてwebから投稿してください。\n\n- 記事の投稿に必要な画像はOGP画像風にコマンドで作成することができます。このテンプレート画像は他の種類を選択することもできますし、独自でカスタムテンプレートを用意することもできます。\n\n- このようにして、noteの記事を投稿するのに必要な記事ファイルと画像ファイルをコマンドから作成することができ、GitHubなどでバージョン管理をすることが可能です。\n\n## create article\n\n```create article```コマンドを実行するとユニークなランダム値(UUID)を使用してディレクトリを作成します。ディレクトリ内には以下のファイルも併せて作成され配置されます。引数にはディレクトリもしくはファイルの作成場所を指定します。\n\n- ```\u003cdirectory name\u003e.md``` 記事ファイル。投稿したい記事の内容をこのファイル内に書き込んでいきます。\n- ~~```config.yaml``` 記事や画像ファイルの生成に関する設定をこのファイルで行います。~~\n\n### ~~config.yaml~~\n\n```yaml\ntitle: article title\nauthor: your name\n```\n\n| Field | Type | Description |\n| --- | --- | --- |\n|title|string|生成する画像に載せる記事タイトル|\n|author|string|記事執筆者|\n\n### \\\u003cdirectory name\u003e.md\n\nマークダウンファイルは以下のようなメタデータを持ちます。画像の出力には```title```と```author```の項目が使用されます。\n\n```yaml:article.md\n---\ntitle: \"\"\ntags: []\ndate: \"2023-09-29\"\nauthor: \"\"\n---\n```\n\n| Field | Type | Description |\n| --- | --- | --- |\n|title|string|生成する画像に載せる記事タイトル|\n|tags|[]string|記事に紐づけるタグ|\n|date|string|ファイル作成日|\n|author|string|記事執筆者|\n\n### ```--time(-t)```\n\nこのフラグを付けることでデフォルトのUUIDではなく、現在時刻でディレクトリおよびファイルを作成することができます。現在時刻はコマンド実行のOSのタイムゾーンに依存し、```YYYY-mm-dd```のフォーマットで生成されます。\n\n```\n% note-cli create article . -t \nCreate directory. 2023-09-08\nCreate file. 2023-09-08.md\n```\n\n既にディレクトリが存在している場合、```YYYY-mm-dd-{number}```という形式でnumberをインクリメントしてディレクトリを作成します。\n\n```\n% note-cli create article . -t\nCreate directory. 2023-09-08-2\nCreate file. 2023-09-08-2.md\n```\n\n### ```--name(-n)```\n\nこのフラグを付けることで任意のディレクトリ名で作成することができます。**既に指定の名前でディレクトリが存在する場合はコマンドは失敗します。**\n\n```\n% note-cli create article . -n article-A\nCreate directory. article-A\nCreate file. article-A.md\n```\n\n### ```--author(-a)```\n\nこのフラグを付けることで記事著者名を事前に渡すことができます。\n\n```\n% go run main.go create article . -a Yamanaka.J\nCreate directory. cc4ab85a-2aa7-48a6-8472-3b36ef4778fa\nCreate file. cc4ab85a-2aa7-48a6-8472-3b36ef4778fa/cc4ab85a-2aa7-48a6-8472-3b36ef4778fa.md\n\n% cat cc4ab85a-2aa7-48a6-8472-3b36ef4778fa/cc4ab85a-2aa7-48a6-8472-3b36ef4778fa.md \n---\ntitle: \"\"\ntags: []\ndate: \"2023-09-29\"\nauthor: \"Yamanaka.J\"\n---\n```\n\n### ```--no-dir```\n\nこのフラグを付けることでディレクトリを作成することなく、ファイルを作成します。\n\n```\n% note-cli create article . --no-dir -t\nCreate file. 2023-09-30.md\n\n% cat 2023-09-30.md \n---\ntitle: \"\"\ntags: []\ndate: \"2023-09-30\"\nauthor: \"\"\n---\n```\n\n**note-cliは記事から生成した画像を記事と一緒に管理しやすいようにディレクトリ構造を採用しています。しかし、このディレクトリ構造が不要な場合は```no-dir```フラグを使用することでファイルのみを管理することができます。例えば、個人ブログをmarkdownで書いているなら、その記事の管理に使用することもできるでしょう。**\n\n## create image\n\n```create image```コマンドを実行することで[OGP](https://ogp.me/)画像風の画像を生成することができます。~~画像の生成にはカレントディレクトリに\u003ca href=\"#configyaml\"\u003econfig.yaml\u003c/a\u003eが存在している必要があります。もし、config.yamlが存在していなかった場合はコマンドが失敗します。~~\n\n**config.yamlは廃止となっています。代わりに、markdownファイルのメタデータが存在している必要があります。メタデータを読み取ることができなかった場合、互換性を保つためにカレントディレクトリにあるconfig.yamlを探し、それでもなければコマンドは失敗します。**\n\n画像の生成にはメタデータが記載されているmarkdownファイルのパスをコマンドの引数に指定してください。\n\n```\n% note-cli create image ./article.md\nComplete generate OGP image\n```\n\n### ```--icon(-i)```\n\nこのフラグの後にicon画像のパスを指定することで画像にアイコンを含めることができます。\n\n```\n% note-cli create image ./article.md -i ./icon.png \n```\n\n### ```--output(-o)```\n\nデフォルトではカレントディレクトリに```output.png```というファイル名で画像は出力されます。出力先を変更したい場合はこのフラグの後にパスを指定することで変更することができます。\n\n```\n% note-cli create image ./article.md -o ./ogp.png \n```\n\n### ```--template```\n\n画像の生成はいくつかのテンプレートとなるHTMLファイルに必要な情報を含めて出力されます。このフラグのあとに```テンプレート番号```を指定することで使用するテンプレートファイルを変更することができます。テンプレートファイルの詳細について[こちら](./docs/templates/templates.md)。(デフォルトでは1番のテンプレートファイルが使用されます。)\n\n```\n% note-cli create image ./article.md --template 2\n```\n\n### use custom template file\n\nカレントディレクトリに```template.tmpl```という名前でファイルを配置することで独自に用意したカスタムテンプレートファイルを使用することもできます。テンプレートファイルの形式は[既存のファイル](./internal/run/templates/1.tmpl)を参考にしてください。\n\nテンプレートファイルはGoの```template/html```パッケージを使用しています。テンプレートファイルには以下の変数を使用することができます。\n\n|variable|description|\n|--------|-----------|\n|{{.Title}}|記事タイトル。この値は\u003ca href=\"#configyaml\"\u003econfig.yaml\u003c/a\u003eで設定した値になります。|\n|{{.IconPath}}|アイコン画像。コマンドで指定されていればbase64エンコードされたアイコン画像が値になります。|\n|{{.Author}}|著者名。この値は\u003ca href=\"#configyaml\"\u003econfig.yaml\u003c/a\u003eで設定した値になります。|\n\n**もしカスタムのテンプレートファイルを作成したならば、ぜひPull Requestを送ってください。組み込みのテンプレートファイルに追加させていただきたいです。Pull Requestの作成の仕方については[こちら](./docs/templates/templates.md)を参照ください。**","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjy8752%2Fnote-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjy8752%2Fnote-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjy8752%2Fnote-cli/lists"}