Discussion: accept `pantry.toml` as the pantry file name (keeping `pantry.conf`)

オープン
#689 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
活発
技術スタック
rust
領域
cli

調査の方向性

Start with crates/core/src/context.rs and the pantry edit path at crates/core/src/pantry/mod.rs:1142; inspect how Context::discover and Context::search find pantry files. The proposal is still under discussion, with compatibility questions about other apps and older CookCLI versions unresolved, so first determine whether the change is agreed before attempting implementation.

索引モデルが issue の本文から書いたものです。

説明

area: pantry feature request needs discussion

This is a proposal for discussion, not a decided change. Comments are welcome, especially from anyone who maintains another app that reads the pantry file.

Background

A recipe folder can hold two hand-written config files side by side, in two different formats:

File Format Comments
config/aisle.conf Cooklang's own format ([aisle], then name | synonym) //
config/pantry.conf TOML #

Both end in .conf, so nothing tells you which one is which. #687 (reported on Discord) is the result: someone wrote # comments in aisle.conf, the way pantry.conf beside it takes them, and they became ingredients. #688 now warns about those lines, but the cause is still there. The same confusion works in reverse: // note or -- note in pantry.conf is a TOML error, and the web shopping list then ignores the whole pantry.

The spec's conventions.md says the pantry file is TOML, but it doesn't name the file. pantry.conf is a CookCLI convention.

Proposal

Accept pantry.toml as the pantry file's name, and keep reading pantry.conf:

  1. Look for pantry.toml first, then pantry.conf, in ./config/ and in the global config dir (COOK_CONFIG_DIR, ~/.config/cook/, …). All lookups go through Context::discover / Context::search in crates/core/src/context.rs, so this is mostly one place.
  2. If both exist, use pantry.toml. cook doctor pantry and the /pantry page say that pantry.conf is being ignored.
  3. Edits (the CLI and the /pantry page) go back to the file that was read, whatever its name.
  4. When there is no pantry yet, the first edit creates config/pantry.toml instead of config/pantry.conf (crates/core/src/pantry/mod.rs:1142). The exception is if another app turns out to look for pantry.conf by name (question 1): then new pantries stay pantry.conf until those apps read both names. Otherwise, new users would still get the two .conf files side by side.
  5. Docs, README and help texts say "pantry.toml (or pantry.conf)".

aisle.conf keeps its name and its format. With pantry.toml next to it, the different extensions show that the two files have different formats.

Questions

  1. Does anything else look for config/pantry.conf by name? For example the Cook mobile apps, cook.md, or the sync service. If one does and a user renames the file, that app loses the pantry without saying why. This is the main question; if the answer is yes, those apps need to read pantry.toml too before CookCLI creates it.
  2. Is it worth it? About 60 files on main mention pantry.conf (tests, docs, the 9 locales, core, server). The alternative is to keep the name and rely on documentation plus the #688-style warnings.
  3. Should the spec name the files? conventions.md could say "pantry.toml (formerly pantry.conf)", so that every app agrees.
  4. When should new pantries become pantry.toml? Right away, or after one release that reads both names, so that an older cook on the same folder still finds the pantry?

Not part of this proposal: changing the aisle.conf format. That needs the spec and cooklang-rs, and was option 3 in #687.

主要言語
Rust
スター
1.4k
フォーク
120
平均マージ
1日 20時間
マージ済み PR(30日)
116

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

cooklang/cookcli のほかの issue

cooklang/cookcli の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。