paper-harness-cli 2.4.0__tar.gz → 2.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/AGENTS.md +2 -2
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/CHANGELOG.md +10 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/PKG-INFO +4 -2
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/README.md +3 -1
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/SPEC.md +6 -1
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/pyproject.toml +1 -1
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/__init__.py +1 -1
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/paper.toml +2 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/cli.py +9 -1
- paper_harness_cli-2.5.0/src/paperops/context/__init__.py +114 -0
- paper_harness_cli-2.5.0/src/paperops/context/_notes.py +143 -0
- paper_harness_cli-2.5.0/src/paperops/context/_render.py +73 -0
- paper_harness_cli-2.5.0/src/paperops/context/_sources.py +54 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/harness.py +14 -2
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/project.py +15 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/scaffold.py +12 -1
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/skills/paper-brief/SKILL.md +5 -1
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/skills/paper-predict/SKILL.md +4 -0
- paper_harness_cli-2.5.0/src/paperops/tex/__init__.py +18 -0
- paper_harness_cli-2.4.0/src/paperops/tex.py → paper_harness_cli-2.5.0/src/paperops/tex/_outline.py +2 -104
- paper_harness_cli-2.5.0/src/paperops/tex/_source.py +107 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/tests/test_project.py +52 -1
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/uv.lock +1 -1
- paper_harness_cli-2.4.0/src/paperops/context.py +0 -334
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/.github/assets/conversation-dark.svg +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/.github/assets/conversation-light.svg +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/.github/assets/hero-dark.svg +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/.github/assets/hero-light.svg +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/.github/assets/make_readme_art.py +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/.github/workflows/ci.yml +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/.github/workflows/publish-pypi.yml +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/.gitignore +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/CLAUDE.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/docs/lessons-from-style.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/docs/results-and-model-readings.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/docs/review-baseline.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/docs/writing-intent.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/BRIEF.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/LOG.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/README.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/STYLE.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/STYLE.shared.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/figures/_template/figure.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/figures/_template/make.py +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/figures/common.py +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/figures/paper.mplstyle +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/gitignore +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/manuscript/main.tex +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/manuscript/numbers.tex +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/manuscript/preamble.en.tex +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/manuscript/preamble.ja.tex +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/manuscript/refs.bib +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/_scaffold/manuscript/sections/.gitkeep +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/build.py +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/skills/paper-check/SKILL.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/skills/paper-draft/SKILL.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/skills/paper-draft/references/results-and-model.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/skills/paper-figure/SKILL.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/src/paperops/skills/paper-revise/SKILL.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/tests/__init__.py +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/tests/conftest.py +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/tests/test_build.py +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/tests/test_figures.py +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/tests/test_harness.py +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/tests/test_tex.py +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/vscode/paperops-review/.gitignore +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/vscode/paperops-review/.vscodeignore +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/vscode/paperops-review/README.md +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/vscode/paperops-review/extension.js +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/vscode/paperops-review/merge.js +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/vscode/paperops-review/package-lock.json +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/vscode/paperops-review/package.json +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/vscode/paperops-review/test/host.js +0 -0
- {paper_harness_cli-2.4.0 → paper_harness_cli-2.5.0}/vscode/paperops-review/test/merge.test.js +0 -0
|
@@ -13,8 +13,8 @@ src/paperops/
|
|
|
13
13
|
├── project.py paper.toml の読み込み
|
|
14
14
|
├── scaffold.py init と update
|
|
15
15
|
├── harness.py AGENTS.md の管理 block、skill の配置
|
|
16
|
-
├── context
|
|
17
|
-
├── tex
|
|
16
|
+
├── context/ pops context の集約、ノートと source の読み取り、表示
|
|
17
|
+
├── tex/ TeX の読み込み、%> コメント、骨子の抽出
|
|
18
18
|
├── build.py PDF の build と log の要約
|
|
19
19
|
├── skills/ 論文 project に配る skill(paper-brief, -draft, -figure, -revise, -predict, -check)
|
|
20
20
|
└── _scaffold/ 論文 project の雛形
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.5.0(2026-11-21)
|
|
4
|
+
|
|
5
|
+
- 論文の区分 `paper.toml` の `[paper] track` を足した。`submission`(投稿を目指す論文)では、主張・発見・載せないもの、
|
|
6
|
+
それに関わる本文の変更は推奨案を添えて著者に見せ、答えを待つ(BRIEF が `draft` でも)。`progress`(進捗を論文の形で
|
|
7
|
+
まとめる論文)では、agent が推奨案を反映し、変えたこと・理由・採らなかった案を `LOG.md` に残して報告する。上乗せの
|
|
8
|
+
確認は「これから要る計算」に「投稿前」として残し、投稿へ移るときに行う。管理区間の規則、`paper-brief`・`paper-predict`、
|
|
9
|
+
`pops context`(2 行目に区分、未設定なら促す)、`pops init --track`(既定は `submission`)が区分を扱う。
|
|
10
|
+
区分の無い既存の論文は従来どおり BRIEF の状態で決める。
|
|
11
|
+
- 内部: `pops context` の集約・表示と TeX の読み込みを、責務ごとの module(`context/`、`tex/`)に分けた。動作は同じ。
|
|
12
|
+
|
|
3
13
|
## 2.4.0(2026-11-19)
|
|
4
14
|
|
|
5
15
|
- `paper-check` の講評で、通すのに必要なもの(原稿の中の食い違いと、当たれば主張が変わる疑い)と、良くする案を
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: paper-harness-cli
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0
|
|
4
4
|
Summary: Minimal harness for writing a paper with AI agents: brief, figures, review comments, learned style
|
|
5
5
|
Project-URL: Homepage, https://github.com/Nkzono99/paperops
|
|
6
6
|
Project-URL: Repository, https://github.com/Nkzono99/paperops
|
|
@@ -51,6 +51,8 @@ cd paper-rough-pipe
|
|
|
51
51
|
`--source` は結果の出どころで、runops project の root などを指します。複数書け、後から足すこともできます。
|
|
52
52
|
できた directory で Codex か Claude Code を起動して、書きたい論文について話しかけてください。
|
|
53
53
|
英語で書き始めるときは `--lang en` を付けます。
|
|
54
|
+
投稿の前に進捗を論文の形でまとめておく論文には `--track progress` を付けます。主張や本文に推奨する変更があれば、
|
|
55
|
+
agent が反映してから報告します。既定の `submission` では、主張に関わる変更は著者が決めます(`paper.toml` で替えられます)。
|
|
54
56
|
|
|
55
57
|
## 頼めること
|
|
56
58
|
|
|
@@ -133,7 +135,7 @@ STYLE の「候補」「共有待ち」も手掛かりになります。実際
|
|
|
133
135
|
|
|
134
136
|
```text
|
|
135
137
|
paper-rough-pipe/
|
|
136
|
-
├── paper.toml source・言語・build の設定
|
|
138
|
+
├── paper.toml 論文の区分・source・言語・build の設定
|
|
137
139
|
├── BRIEF.md 何を言う論文か(主張 1 文、発見、載せないもの、段落骨子)
|
|
138
140
|
├── STYLE.md 添削から学んだ、この論文での書き方
|
|
139
141
|
├── manuscript/
|
|
@@ -31,6 +31,8 @@ cd paper-rough-pipe
|
|
|
31
31
|
`--source` は結果の出どころで、runops project の root などを指します。複数書け、後から足すこともできます。
|
|
32
32
|
できた directory で Codex か Claude Code を起動して、書きたい論文について話しかけてください。
|
|
33
33
|
英語で書き始めるときは `--lang en` を付けます。
|
|
34
|
+
投稿の前に進捗を論文の形でまとめておく論文には `--track progress` を付けます。主張や本文に推奨する変更があれば、
|
|
35
|
+
agent が反映してから報告します。既定の `submission` では、主張に関わる変更は著者が決めます(`paper.toml` で替えられます)。
|
|
34
36
|
|
|
35
37
|
## 頼めること
|
|
36
38
|
|
|
@@ -113,7 +115,7 @@ STYLE の「候補」「共有待ち」も手掛かりになります。実際
|
|
|
113
115
|
|
|
114
116
|
```text
|
|
115
117
|
paper-rough-pipe/
|
|
116
|
-
├── paper.toml source・言語・build の設定
|
|
118
|
+
├── paper.toml 論文の区分・source・言語・build の設定
|
|
117
119
|
├── BRIEF.md 何を言う論文か(主張 1 文、発見、載せないもの、段落骨子)
|
|
118
120
|
├── STYLE.md 添削から学んだ、この論文での書き方
|
|
119
121
|
├── manuscript/
|
|
@@ -42,7 +42,7 @@ AI エージェントが論文 1 本を主張の設計から PDF まで作り、
|
|
|
42
42
|
|
|
43
43
|
| path | 持ち主 | 内容 |
|
|
44
44
|
|---|---|---|
|
|
45
|
-
| `paper.toml` | project | `[paper] title, lang, main`、`[build] engine, bib, tex_bin`、`[style] shared`、`[[sources]] name, path, note` |
|
|
45
|
+
| `paper.toml` | project | `[paper] title, lang, track, main`、`[build] engine, bib, tex_bin`、`[style] shared`、`[[sources]] name, path, note` |
|
|
46
46
|
| `BRIEF.md` | project | 状態、主張 1 文、問いと意義、主要な発見(発見ごとに状態・根拠・成立条件と置き場、賭けなら確かめ方・外れたら)、載せないもの、図の割り当て、段落骨子、これから要る計算(発表までに要るものと、行わない検証)、未決 |
|
|
47
47
|
| `STYLE.md` | project | この論文の規則。節: 文章、構成、図、用語と表記、候補、共有待ち |
|
|
48
48
|
| 共有 STYLE(既定 `~/.config/paperops/STYLE.md`) | 著者 | 論文をまたぐ規則。`pops init` が無ければ作る |
|
|
@@ -58,6 +58,11 @@ AI エージェントが論文 1 本を主張の設計から PDF まで作り、
|
|
|
58
58
|
|
|
59
59
|
`pops context` と `pops outline` は次の書式だけに依存する。skill と雛形はこれを保つ。
|
|
60
60
|
|
|
61
|
+
- `paper.toml`: `[paper] track` は論文の区分で、`submission`(投稿を目指す。主張に関わる変更は著者が決める)か
|
|
62
|
+
`progress`(進捗を論文の形でまとめる。推奨案は agent が反映して報告する)。無ければ未設定で、管理区間の規則は
|
|
63
|
+
BRIEF の状態(`draft` / `approved`)で決める。他の値は error。`pops init --track` の既定は `submission`。
|
|
64
|
+
`pops context` は区分を 2 行目に出し、未設定なら著者と決めるよう促す。JSON は `track`(未設定は空文字)。
|
|
65
|
+
|
|
61
66
|
- `BRIEF.md`、`figure.md`: 行頭の `状態: <語>`。BRIEF は `draft` / `approved`、図は `draft` / `reviewed` / `approved` / `predicted`。
|
|
62
67
|
- `BRIEF.md`: `## 主張` で始まる見出しの下の最初の行が主張 1 文。`## 未決` で始まる節の直下では、
|
|
63
68
|
`- [ ] 項目` と従来の `- 項目` が未決。`- [x]` / `- [X]` と空の項目は数えない。
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "paper-harness-cli"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.5.0"
|
|
8
8
|
description = "Minimal harness for writing a paper with AI agents: brief, figures, review comments, learned style"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -8,7 +8,7 @@ import sys
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
|
|
10
10
|
from paperops import __version__
|
|
11
|
-
from paperops.project import DEFAULT_SHARED_STYLE, PaperopsError, load_project
|
|
11
|
+
from paperops.project import DEFAULT_SHARED_STYLE, DEFAULT_TRACK, PaperopsError, load_project
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def _init(args: argparse.Namespace) -> int:
|
|
@@ -19,6 +19,7 @@ def _init(args: argparse.Namespace) -> int:
|
|
|
19
19
|
target,
|
|
20
20
|
title=args.title,
|
|
21
21
|
lang=args.lang,
|
|
22
|
+
track=args.track,
|
|
22
23
|
sources=[Path(p) for p in args.source],
|
|
23
24
|
shared_style=args.style,
|
|
24
25
|
)
|
|
@@ -80,6 +81,13 @@ def make_parser() -> argparse.ArgumentParser:
|
|
|
80
81
|
init.add_argument("dir", nargs="?", default=".")
|
|
81
82
|
init.add_argument("--title", default="", help="working title (default: directory name)")
|
|
82
83
|
init.add_argument("--lang", default="ja", help="language the draft is written in: ja or en")
|
|
84
|
+
init.add_argument(
|
|
85
|
+
"--track",
|
|
86
|
+
default=DEFAULT_TRACK,
|
|
87
|
+
help="submission: aimed at a journal, the author settles changes to the claim (default); "
|
|
88
|
+
"progress: progress written up as a paper, the agent applies its recommended changes "
|
|
89
|
+
"and reports them",
|
|
90
|
+
)
|
|
83
91
|
init.add_argument(
|
|
84
92
|
"--source",
|
|
85
93
|
action="append",
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""Collect the project state for ``pops context``."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import time
|
|
6
|
+
from dataclasses import asdict
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from paperops import __version__
|
|
10
|
+
from paperops.harness import deployed_version
|
|
11
|
+
from paperops.project import Project
|
|
12
|
+
from paperops.tex import find_comments, outline, read_lines
|
|
13
|
+
|
|
14
|
+
from ._notes import brief_state, figure_states, style_state
|
|
15
|
+
from ._render import render
|
|
16
|
+
from ._sources import source_state
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"PREDICTION_MARK",
|
|
20
|
+
"brief_state",
|
|
21
|
+
"build_state",
|
|
22
|
+
"figure_states",
|
|
23
|
+
"gather",
|
|
24
|
+
"prediction_marks",
|
|
25
|
+
"render",
|
|
26
|
+
"source_state",
|
|
27
|
+
"style_state",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
PREDICTION_MARK = "\\pred{"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def prediction_marks(tex_files: list[Path], root: Path) -> dict:
|
|
34
|
+
"""Where ``\\pred{`` marks remain: results written ahead of the runs that will confirm them."""
|
|
35
|
+
files = {}
|
|
36
|
+
for path in tex_files:
|
|
37
|
+
count = sum(line.text.count(PREDICTION_MARK) for line in read_lines(path))
|
|
38
|
+
if count:
|
|
39
|
+
files[str(path.relative_to(root))] = count
|
|
40
|
+
return {"marks": sum(files.values()), "files": files}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def build_state(project: Project, tex_files: list[Path]) -> dict:
|
|
44
|
+
pdf = project.root / "build" / f"{project.main.stem}.pdf"
|
|
45
|
+
if not pdf.is_file():
|
|
46
|
+
return {"pdf": "", "built": "", "stale": False}
|
|
47
|
+
inputs = [*tex_files, *project.manuscript_dir.glob("*.bib")]
|
|
48
|
+
inputs += list((project.root / "figures").glob("*/*.pdf"))
|
|
49
|
+
built = pdf.stat().st_mtime
|
|
50
|
+
return {
|
|
51
|
+
"pdf": str(pdf.relative_to(project.root)),
|
|
52
|
+
"built": time.strftime("%Y-%m-%d %H:%M", time.localtime(built)),
|
|
53
|
+
"stale": any(p.stat().st_mtime > built for p in inputs if p.is_file()),
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def gather(project: Project) -> dict:
|
|
58
|
+
root = project.root
|
|
59
|
+
tex_files = sorted(project.manuscript_dir.rglob("*.tex"))
|
|
60
|
+
paragraphs = []
|
|
61
|
+
if project.main_path.is_file():
|
|
62
|
+
paragraphs = [item for item in outline(project.main_path, root) if item.kind == "paragraph"]
|
|
63
|
+
comments = [asdict(c) for c in find_comments(tex_files, root)]
|
|
64
|
+
brief = brief_state(root)
|
|
65
|
+
deployed = deployed_version(root)
|
|
66
|
+
|
|
67
|
+
hints = []
|
|
68
|
+
if deployed and deployed != __version__:
|
|
69
|
+
hints.append(
|
|
70
|
+
f"harness is from paperops {deployed}, installed is {__version__}: pops update"
|
|
71
|
+
)
|
|
72
|
+
if not project.track:
|
|
73
|
+
hints.append(
|
|
74
|
+
'paper.toml has no [paper] track: settle "submission" or "progress" with the author'
|
|
75
|
+
)
|
|
76
|
+
if not brief["message"]:
|
|
77
|
+
hints.append("BRIEF.md has no message yet: start with the paper-brief skill")
|
|
78
|
+
elif brief["status"] != "approved":
|
|
79
|
+
if project.track == "progress":
|
|
80
|
+
hints.append(
|
|
81
|
+
"BRIEF.md is a draft (progress): apply the recommended option, then report it"
|
|
82
|
+
)
|
|
83
|
+
else:
|
|
84
|
+
hints.append(
|
|
85
|
+
"BRIEF.md is a draft: get the author's approval, or their word to go ahead"
|
|
86
|
+
)
|
|
87
|
+
if comments:
|
|
88
|
+
hints.append(f"{len(comments)} open review comments: paper-revise skill")
|
|
89
|
+
build = build_state(project, tex_files)
|
|
90
|
+
if build["stale"]:
|
|
91
|
+
hints.append("the PDF is older than the manuscript or figures: pops build")
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
"paperops": __version__,
|
|
95
|
+
"title": project.title,
|
|
96
|
+
"lang": project.lang,
|
|
97
|
+
"track": project.track,
|
|
98
|
+
"brief": brief,
|
|
99
|
+
"style": {
|
|
100
|
+
"project": style_state(root / "STYLE.md"),
|
|
101
|
+
"shared": style_state(project.shared_style),
|
|
102
|
+
},
|
|
103
|
+
"sources": [source_state(s) for s in project.sources],
|
|
104
|
+
"manuscript": {
|
|
105
|
+
"main": str(project.main),
|
|
106
|
+
"files": len(tex_files),
|
|
107
|
+
"paragraphs": len(paragraphs),
|
|
108
|
+
},
|
|
109
|
+
"build": build,
|
|
110
|
+
"figures": figure_states(root),
|
|
111
|
+
"predictions": prediction_marks(tex_files, root),
|
|
112
|
+
"comments": comments,
|
|
113
|
+
"next": hints,
|
|
114
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"""Read BRIEF, STYLE, and figure review notes for the project summary."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
_HTML_COMMENT_RE = re.compile(r"<!--.*?-->", re.DOTALL)
|
|
9
|
+
_STATUS_RE = re.compile(r"^(?:状態|status)\s*[::]\s*(\S+)", re.MULTILINE)
|
|
10
|
+
_ROUND_RE = re.compile(r"^- R\d+", re.MULTILINE)
|
|
11
|
+
_FINDING_RE = re.compile(r"^###\s+(\S+)")
|
|
12
|
+
_FINDING_STATUS_RE = re.compile(r"^-\s*(?:状態|status)\s*[::]\s*([^\s((]+)")
|
|
13
|
+
_CHECKBOX_RE = re.compile(r"^\[([ xX])\](?:\s+|$)")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _read(path: Path) -> str:
|
|
17
|
+
try:
|
|
18
|
+
return _HTML_COMMENT_RE.sub("", path.read_text(encoding="utf-8"))
|
|
19
|
+
except OSError:
|
|
20
|
+
return ""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _sections(text: str) -> dict[str, list[str]]:
|
|
24
|
+
"""Lines of a markdown file grouped by ``## `` heading."""
|
|
25
|
+
sections: dict[str, list[str]] = {}
|
|
26
|
+
current = ""
|
|
27
|
+
for line in text.splitlines():
|
|
28
|
+
if line.startswith("## "):
|
|
29
|
+
current = line[3:].strip()
|
|
30
|
+
sections.setdefault(current, [])
|
|
31
|
+
elif current:
|
|
32
|
+
sections[current].append(line)
|
|
33
|
+
return sections
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _bullets(lines: list[str]) -> int:
|
|
37
|
+
return sum(1 for line in lines if line.startswith("- ") and line[2:].strip())
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _open_items(lines: list[str]) -> list[str]:
|
|
41
|
+
items = []
|
|
42
|
+
for line in lines:
|
|
43
|
+
if not line.startswith("- "):
|
|
44
|
+
continue
|
|
45
|
+
item = line[2:].strip()
|
|
46
|
+
checkbox = _CHECKBOX_RE.match(item)
|
|
47
|
+
if checkbox:
|
|
48
|
+
if checkbox[1].lower() == "x":
|
|
49
|
+
continue
|
|
50
|
+
item = item[checkbox.end() :]
|
|
51
|
+
if item:
|
|
52
|
+
items.append(item)
|
|
53
|
+
return items
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _findings(lines: list[str]) -> list[dict]:
|
|
57
|
+
"""Findings (``### C1 ...``) with their ``- 状態:`` (e.g. 確認済み or 予想)."""
|
|
58
|
+
found: list[dict] = []
|
|
59
|
+
for line in lines:
|
|
60
|
+
heading = _FINDING_RE.match(line)
|
|
61
|
+
status = _FINDING_STATUS_RE.match(line)
|
|
62
|
+
if heading:
|
|
63
|
+
found.append({"id": heading.group(1), "status": ""})
|
|
64
|
+
elif status and found and not found[-1]["status"]:
|
|
65
|
+
found[-1]["status"] = status.group(1)
|
|
66
|
+
return found
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def brief_state(root: Path) -> dict:
|
|
70
|
+
path = root / "BRIEF.md"
|
|
71
|
+
text = _read(path)
|
|
72
|
+
sections = _sections(text)
|
|
73
|
+
status = _STATUS_RE.search(text)
|
|
74
|
+
message = ""
|
|
75
|
+
open_items: list[str] = []
|
|
76
|
+
findings: list[dict] = []
|
|
77
|
+
for heading, lines in sections.items():
|
|
78
|
+
if heading.startswith("主張") and not message:
|
|
79
|
+
message = next((ln.strip() for ln in lines if ln.strip()), "")
|
|
80
|
+
elif heading.startswith("未決"):
|
|
81
|
+
open_items.extend(_open_items(lines))
|
|
82
|
+
elif heading.startswith("主要な発見"):
|
|
83
|
+
findings = _findings(lines)
|
|
84
|
+
return {
|
|
85
|
+
"exists": path.is_file(),
|
|
86
|
+
"status": status.group(1) if status else "draft",
|
|
87
|
+
"message": message,
|
|
88
|
+
"findings": findings,
|
|
89
|
+
"open_items": len(open_items),
|
|
90
|
+
"open_item_texts": open_items,
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def style_state(path: Path | None) -> dict:
|
|
95
|
+
if path is None:
|
|
96
|
+
return {"path": "", "exists": False, "rules": 0, "candidates": 0, "pending": 0}
|
|
97
|
+
counts = {"rules": 0, "candidates": 0, "pending": 0}
|
|
98
|
+
for heading, lines in _sections(_read(path)).items():
|
|
99
|
+
if heading.startswith("候補"):
|
|
100
|
+
counts["candidates"] += _bullets(lines)
|
|
101
|
+
elif heading.startswith("共有待ち"):
|
|
102
|
+
counts["pending"] += _bullets(lines)
|
|
103
|
+
else:
|
|
104
|
+
counts["rules"] += _bullets(lines)
|
|
105
|
+
return {"path": str(path), "exists": path.is_file(), **counts}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def figure_states(root: Path) -> list[dict]:
|
|
109
|
+
figures = []
|
|
110
|
+
base = root / "figures"
|
|
111
|
+
if not base.is_dir():
|
|
112
|
+
return figures
|
|
113
|
+
for directory in sorted(p for p in base.iterdir() if p.is_dir()):
|
|
114
|
+
if directory.name.startswith(("_", ".")):
|
|
115
|
+
continue
|
|
116
|
+
script = directory / "make.py"
|
|
117
|
+
notes = directory / "figure.md"
|
|
118
|
+
if not script.is_file() and not notes.is_file():
|
|
119
|
+
continue
|
|
120
|
+
text = _read(notes)
|
|
121
|
+
status = _STATUS_RE.search(text)
|
|
122
|
+
message = ""
|
|
123
|
+
for heading, lines in _sections(text).items():
|
|
124
|
+
if heading.startswith("メッセージ"):
|
|
125
|
+
message = next((ln.strip() for ln in lines if ln.strip()), "")
|
|
126
|
+
outputs = [directory / f"{directory.name}{ext}" for ext in (".pdf", ".png")]
|
|
127
|
+
outputs = [p for p in outputs if p.is_file()]
|
|
128
|
+
if not outputs:
|
|
129
|
+
output = "missing"
|
|
130
|
+
elif script.is_file() and script.stat().st_mtime > min(p.stat().st_mtime for p in outputs):
|
|
131
|
+
output = "stale"
|
|
132
|
+
else:
|
|
133
|
+
output = "ok"
|
|
134
|
+
figures.append(
|
|
135
|
+
{
|
|
136
|
+
"name": directory.name,
|
|
137
|
+
"status": status.group(1) if status else "draft",
|
|
138
|
+
"message": message,
|
|
139
|
+
"rounds": len(_ROUND_RE.findall(text)),
|
|
140
|
+
"output": output,
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
return figures
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""Render the project summary as plain text."""
|
|
2
|
+
|
|
3
|
+
from paperops.project import TRACKS
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def render(state: dict) -> str:
|
|
7
|
+
out = [f"paper: {state['title'] or '(untitled)'} [{state['lang']}]"]
|
|
8
|
+
track = state.get("track", "")
|
|
9
|
+
out.append(
|
|
10
|
+
f"track: {track} ({TRACKS[track]})" if track in TRACKS else "track: (not set in paper.toml)"
|
|
11
|
+
)
|
|
12
|
+
brief = state["brief"]
|
|
13
|
+
out.append(f"brief: {brief['status']} message: {brief['message'] or '(not written)'}")
|
|
14
|
+
if brief["findings"]:
|
|
15
|
+
listed = ", ".join(f"{f['id']} {f['status'] or '(no status)'}" for f in brief["findings"])
|
|
16
|
+
out.append(f" findings: {listed}")
|
|
17
|
+
out.append(f" open items in BRIEF.md: {brief['open_items']}")
|
|
18
|
+
out.extend(f" - {item}" for item in brief["open_item_texts"][:3])
|
|
19
|
+
|
|
20
|
+
for key, label in (("project", "STYLE.md"), ("shared", "shared")):
|
|
21
|
+
style = state["style"][key]
|
|
22
|
+
if not style["path"]:
|
|
23
|
+
continue
|
|
24
|
+
name = label if key == "project" else f"shared {style['path']}"
|
|
25
|
+
if not style["exists"]:
|
|
26
|
+
out.append(f"style: {name} (missing)")
|
|
27
|
+
continue
|
|
28
|
+
extra = f", {style['pending']} waiting to be shared" if style["pending"] else ""
|
|
29
|
+
out.append(
|
|
30
|
+
f"style: {name}: {style['rules']} rules, {style['candidates']} candidates{extra}"
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
out.append("sources:" if state["sources"] else "sources: (none; add [[sources]] to paper.toml)")
|
|
34
|
+
for src in state["sources"]:
|
|
35
|
+
if not src["exists"]:
|
|
36
|
+
out.append(f" - {src['name']}: {src['path']} (missing)")
|
|
37
|
+
continue
|
|
38
|
+
kind = "runops project" if src["runops"] else "directory"
|
|
39
|
+
log = f", LOG.md {src['log_updated']}" if src["log_updated"] else ""
|
|
40
|
+
out.append(f" - {src['name']}: {src['path']} ({kind}{log})")
|
|
41
|
+
out += [f" {topic}" for topic in src["analysis"]]
|
|
42
|
+
|
|
43
|
+
manuscript = state["manuscript"]
|
|
44
|
+
build = state["build"]
|
|
45
|
+
built = "not built"
|
|
46
|
+
if build["pdf"]:
|
|
47
|
+
built = f"{build['pdf']} {build['built']}" + (" (stale)" if build["stale"] else "")
|
|
48
|
+
out.append(f"manuscript: {manuscript['main']}, {manuscript['paragraphs']} paragraphs; {built}")
|
|
49
|
+
|
|
50
|
+
out.append("figures:" if state["figures"] else "figures: (none)")
|
|
51
|
+
for fig in state["figures"]:
|
|
52
|
+
out.append(
|
|
53
|
+
f" - {fig['name']}: {fig['message'] or '(no message in figure.md)'}\n"
|
|
54
|
+
f" {fig['status']}, {fig['rounds']} review rounds, "
|
|
55
|
+
f"output {fig['output']}"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
predictions = state["predictions"]
|
|
59
|
+
if predictions["marks"]:
|
|
60
|
+
where = ", ".join(f"{name} {n}" for name, n in predictions["files"].items())
|
|
61
|
+
out.append(f"predictions: {predictions['marks']} \\pred marks ({where})")
|
|
62
|
+
else:
|
|
63
|
+
out.append("predictions: no \\pred marks")
|
|
64
|
+
|
|
65
|
+
comments = state["comments"]
|
|
66
|
+
out.append(f"comments: {len(comments)} open" if comments else "comments: none open")
|
|
67
|
+
for c in comments:
|
|
68
|
+
out.append(f" - {c['file']}:{c['line']}: {c['text']}")
|
|
69
|
+
if c["target"]:
|
|
70
|
+
out.append(f" on: {c['target']}")
|
|
71
|
+
|
|
72
|
+
out += [f"next: {hint}" for hint in state["next"]]
|
|
73
|
+
return "\n".join(out)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""Discover research sources and their analysis topics."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import time
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from paperops.project import Source
|
|
9
|
+
|
|
10
|
+
_MAX_TOPICS = 40
|
|
11
|
+
_RUN_TREE_DEPTH = 5
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _day(path: Path) -> str:
|
|
15
|
+
return time.strftime("%Y-%m-%d", time.localtime(path.stat().st_mtime))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _analysis_topics(source: Source) -> list[str]:
|
|
19
|
+
"""READMEs of analysis topics in a runops project (project-wide and per run group)."""
|
|
20
|
+
root = source.path
|
|
21
|
+
topics = sorted((root / "analysis").glob("*/README.md")) if (root / "analysis").is_dir() else []
|
|
22
|
+
|
|
23
|
+
def walk(directory: Path, depth: int) -> None:
|
|
24
|
+
if depth > _RUN_TREE_DEPTH or len(topics) >= _MAX_TOPICS:
|
|
25
|
+
return
|
|
26
|
+
try:
|
|
27
|
+
children = sorted(p for p in directory.iterdir() if p.is_dir())
|
|
28
|
+
except OSError:
|
|
29
|
+
return
|
|
30
|
+
for child in children:
|
|
31
|
+
if child.name == "_analysis":
|
|
32
|
+
topics.extend(sorted(child.glob("*/README.md")))
|
|
33
|
+
elif child.name.startswith(("_", ".")) or (child / "manifest.toml").is_file():
|
|
34
|
+
continue # archive, scratch and run directories are not searched
|
|
35
|
+
else:
|
|
36
|
+
walk(child, depth + 1)
|
|
37
|
+
|
|
38
|
+
if (root / "runs").is_dir():
|
|
39
|
+
walk(root / "runs", 1)
|
|
40
|
+
return [str(p.relative_to(root)) for p in topics[:_MAX_TOPICS]]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def source_state(source: Source) -> dict:
|
|
44
|
+
exists = source.path.is_dir()
|
|
45
|
+
log = source.path / "LOG.md"
|
|
46
|
+
return {
|
|
47
|
+
"name": source.name,
|
|
48
|
+
"path": str(source.path),
|
|
49
|
+
"note": source.note,
|
|
50
|
+
"exists": exists,
|
|
51
|
+
"runops": exists and source.is_runops,
|
|
52
|
+
"log_updated": _day(log) if log.is_file() else "",
|
|
53
|
+
"analysis": _analysis_topics(source) if exists else [],
|
|
54
|
+
}
|
|
@@ -30,14 +30,14 @@ BLOCK = """\
|
|
|
30
30
|
| `STYLE.md` と共有 STYLE | 著者の文体・構成・図の好み。添削コメントから学んだ規則がここに溜まる |
|
|
31
31
|
| `manuscript/` | `main.tex`、`sections/`、`numbers.tex`(本文に出す数値と出典)、`refs.bib` |
|
|
32
32
|
| `figures/<name>/` | 図 1 枚につき 1 directory。`make.py`、`figure.md`(設計と推敲記録)、出力 |
|
|
33
|
-
| `paper.toml` |
|
|
33
|
+
| `paper.toml` | 論文の区分(`track`)、参照する source(runops project など)、言語、build 設定、共有 STYLE の場所 |
|
|
34
34
|
| `LOG.md` | 決めたことと理由。日付見出しで追記する |
|
|
35
35
|
|
|
36
36
|
## Commands
|
|
37
37
|
|
|
38
38
|
| command | effect |
|
|
39
39
|
|---|---|
|
|
40
|
-
| `pops context [--json]` | 現状の一覧: BRIEF と発見の状態、STYLE、source と解析 topic、図、残っている予想、未対応の添削コメント、build |
|
|
40
|
+
| `pops context [--json]` | 現状の一覧: 論文の区分、BRIEF と発見の状態、STYLE、source と解析 topic、図、残っている予想、未対応の添削コメント、build |
|
|
41
41
|
| `pops outline [--json]` | 見出し、各段落の第 1 文と分量、caption の第 1 文。骨子の確認に使う |
|
|
42
42
|
| `pops build [--main PATH]` | PDF を `build/` に作り、エラー・未定義の参照と引用を要約する |
|
|
43
43
|
| `pops update` | この block と skill を、導入されている paperops の版に合わせる |
|
|
@@ -47,9 +47,21 @@ BLOCK = """\
|
|
|
47
47
|
- **執筆・改稿を始めるときは `pops context` を読む。** BRIEF の状態、未対応コメント、図と build の鮮度がわかります。
|
|
48
48
|
指定 PDF だけへの講評は、その PDF を直接読みます。
|
|
49
49
|
- **主張を先に決め、本文をそれに従わせる。** BRIEF.md の主張 1 文と主要な発見が、何を書き、何を削るかの基準です。
|
|
50
|
+
主張・発見・載せないものを変えるときの決め方は、次の項の論文の区分で決まります。区分が書かれていなければ、
|
|
50
51
|
BRIEF が `approved` のとき、主張・発見・載せないものを変える案は著者に確認してから反映します
|
|
51
52
|
(段落骨子、図の割り当て、未決は、直して報告すれば足ります)。
|
|
52
53
|
`draft` のときは案を見せて承認を得るか、「任せる」と言われたら推奨案で進めます。
|
|
54
|
+
- **論文の区分(`paper.toml` の `[paper] track`)で、変更の決め方と確認の深さが変わる。**
|
|
55
|
+
- `submission`(投稿): 投稿を目指して書く論文です。主張・発見・載せないもの、それに関わる本文の変更は、
|
|
56
|
+
推奨案を添えて著者に見せ、答えを待ちます(BRIEF が `draft` でも)。言い回し、向きの変わらない数値の更新、
|
|
57
|
+
段落骨子、図の割り当て、未決は、直して報告すれば足ります。結果が予想に答えたら、判定と変更案を報告し、
|
|
58
|
+
原稿は著者の答えを受けてから直します。
|
|
59
|
+
- `progress`(進捗): 進捗を、投稿を意識した論文の形でまとめておく論文です。著者は変更を任せています。
|
|
60
|
+
推奨案を反映し、`LOG.md` に変えたこと・理由・採らなかった案を書いて、報告で変えた点を示します(著者は戻せます)。
|
|
61
|
+
結果が予想に答えたら、判定から原稿の更新まで進めます。上乗せの確認(定常、収束、seed の繰り返し)は、
|
|
62
|
+
BRIEF の「これから要る計算」に「投稿前」として残します。
|
|
63
|
+
- 投稿すると決まったら `submission` に替え、「投稿前」に残した確認を著者に見せます。
|
|
64
|
+
source 側の計算と、push・release は、どちらの区分でも著者が決めます。
|
|
53
65
|
- **分かったことと、その意味を先に書く。** 決め手になった比較を示し、そこから言えることを言い切ります。
|
|
54
66
|
留保は、省くと読者が結果の意味や使える範囲を取り違えるものだけ、その判断に必要な箇所に一度書きます。
|
|
55
67
|
図や時系列から「ほぼ一致した」「ほぼ収束した」と読めて、それで次の議論に進めるなら、その一文で十分です。
|
|
@@ -8,6 +8,13 @@ from pathlib import Path
|
|
|
8
8
|
|
|
9
9
|
CONFIG_NAME = "paper.toml"
|
|
10
10
|
DEFAULT_SHARED_STYLE = "~/.config/paperops/STYLE.md"
|
|
11
|
+
# The paper's track ([paper] track) decides who settles changes to the claim: the author
|
|
12
|
+
# (submission) or the agent with its recommended option, reported afterwards (progress).
|
|
13
|
+
TRACKS = {
|
|
14
|
+
"submission": "投稿: changes to the claim wait for the author",
|
|
15
|
+
"progress": "進捗: recommended changes are applied, then reported",
|
|
16
|
+
}
|
|
17
|
+
DEFAULT_TRACK = "submission"
|
|
11
18
|
|
|
12
19
|
|
|
13
20
|
class PaperopsError(Exception):
|
|
@@ -32,6 +39,7 @@ class Project:
|
|
|
32
39
|
root: Path
|
|
33
40
|
title: str = ""
|
|
34
41
|
lang: str = "ja"
|
|
42
|
+
track: str = "" # one of TRACKS, or "" when paper.toml does not say
|
|
35
43
|
main: Path = Path("manuscript/main.tex")
|
|
36
44
|
engine: str = "xelatex"
|
|
37
45
|
bib: str = "bibtex"
|
|
@@ -92,11 +100,18 @@ def load_project(start: Path | None = None) -> Project:
|
|
|
92
100
|
)
|
|
93
101
|
)
|
|
94
102
|
|
|
103
|
+
track = str(paper.get("track", "")).strip()
|
|
104
|
+
if track and track not in TRACKS:
|
|
105
|
+
raise PaperopsError(
|
|
106
|
+
f"{CONFIG_NAME}: [paper] track must be one of {', '.join(TRACKS)}, not {track!r}"
|
|
107
|
+
)
|
|
108
|
+
|
|
95
109
|
shared = str(style.get("shared", DEFAULT_SHARED_STYLE)).strip()
|
|
96
110
|
return Project(
|
|
97
111
|
root=root,
|
|
98
112
|
title=str(paper.get("title", "")),
|
|
99
113
|
lang=str(paper.get("lang", "ja")),
|
|
114
|
+
track=track,
|
|
100
115
|
main=Path(str(paper.get("main", "manuscript/main.tex"))),
|
|
101
116
|
engine=str(build.get("engine", "xelatex")),
|
|
102
117
|
bib=str(build.get("bib", "bibtex")),
|
|
@@ -8,7 +8,14 @@ from importlib import resources
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
|
|
10
10
|
from paperops.harness import deploy_skills, write_harness
|
|
11
|
-
from paperops.project import
|
|
11
|
+
from paperops.project import (
|
|
12
|
+
CONFIG_NAME,
|
|
13
|
+
DEFAULT_SHARED_STYLE,
|
|
14
|
+
DEFAULT_TRACK,
|
|
15
|
+
TRACKS,
|
|
16
|
+
PaperopsError,
|
|
17
|
+
load_project,
|
|
18
|
+
)
|
|
12
19
|
|
|
13
20
|
LANGS = ("ja", "en")
|
|
14
21
|
# Scaffold files stored under another name: git would read a nested ``.gitignore`` here,
|
|
@@ -38,12 +45,15 @@ def init_project(
|
|
|
38
45
|
*,
|
|
39
46
|
title: str = "",
|
|
40
47
|
lang: str = "ja",
|
|
48
|
+
track: str = DEFAULT_TRACK,
|
|
41
49
|
sources: list[Path] | None = None,
|
|
42
50
|
shared_style: str = DEFAULT_SHARED_STYLE,
|
|
43
51
|
) -> list[str]:
|
|
44
52
|
"""Create a paper project in ``target``; existing files are kept as they are."""
|
|
45
53
|
if lang not in LANGS:
|
|
46
54
|
raise PaperopsError(f"--lang must be one of {', '.join(LANGS)}")
|
|
55
|
+
if track not in TRACKS:
|
|
56
|
+
raise PaperopsError(f"--track must be one of {', '.join(TRACKS)}")
|
|
47
57
|
target = target.resolve()
|
|
48
58
|
if (target / CONFIG_NAME).exists():
|
|
49
59
|
raise PaperopsError(f"{target} is already a paperops project; use `pops update`")
|
|
@@ -79,6 +89,7 @@ def init_project(
|
|
|
79
89
|
text = (
|
|
80
90
|
text.replace("{{title}}", _toml_string(title))
|
|
81
91
|
.replace("{{lang}}", _toml_string(lang))
|
|
92
|
+
.replace("{{track}}", _toml_string(track))
|
|
82
93
|
.replace("{{shared_style}}", _toml_string(shared_style))
|
|
83
94
|
)
|
|
84
95
|
taken: set[str] = set()
|