dr-gen 0.1.3 → 0.1.4

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.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # decision-record-generator (dr-gen)
2
2
 
3
3
  Generate lightweight Decision Records (DRs) from `decision.yaml`.
4
- Built for fast-moving teams who need a small, reproducible “evidence trail” of decisions (why/rule) for handoffs, audits, and security questionnaires.
4
+ Built for fast-moving teams who need a small, reproducible “evidence trail” of decisions (why/decision) for handoffs, audits, and security questionnaires.
5
5
 
6
6
  日本語は下の「Japanese (日本語)」セクションにまとめています。
7
7
 
@@ -85,7 +85,7 @@ dr-gen new --lang ja
85
85
 
86
86
  You can also set `DR_GEN_LANG=ja`.
87
87
 
88
- This asks for the minimum useful info (Title + Why + Rule). Other fields are optional.
88
+ This asks for the minimum useful info (Title + Why + Decision). Other fields are optional.
89
89
  By default, `date` is set to today's date (YYYY-MM-DD). To disable this:
90
90
 
91
91
  ```bash
@@ -171,6 +171,9 @@ dr-gen new
171
171
  dr-gen verify out/<date>__<title>__<id>/
172
172
  dr-gen list --from 2026-01-01 --to 2026-01-31
173
173
 
174
+ # Japanese report labels
175
+ dr-gen list --from 2026-01-01 --to 2026-01-31 --lang ja
176
+
174
177
  # Optional: keep the Decision line on one terminal line
175
178
  dr-gen list --from 2026-01-01 --to 2026-01-31 --max-decision-len 60
176
179
  ```
@@ -179,7 +182,7 @@ dr-gen list --from 2026-01-01 --to 2026-01-31 --max-decision-len 60
179
182
 
180
183
  ## Japanese (日本語)
181
184
 
182
- 引き継ぎ・監査対応・セキュリティに関する確認(質問対応)のために、意思決定(Why / Rule)を小さく・再現可能な形で残すDRジェネレーターです。`decision.yaml` から Markdown / JSON を生成し、`manifest.json` の SHA256 ハッシュで改ざん検知できます。
185
+ 引き継ぎ・監査対応・セキュリティに関する確認(質問対応)のために、意思決定(Why / Decision)を小さく・再現可能な形で残すDRジェネレーターです。`decision.yaml` から Markdown / JSON を生成し、`manifest.json` の SHA256 ハッシュで改ざん検知できます。
183
186
 
184
187
  ### 最速で試す(npm)
185
188
 
@@ -204,7 +207,7 @@ dr-gen new --lang ja
204
207
 
205
208
  環境変数で指定することもできます(例: `DR_GEN_LANG=ja`)。
206
209
 
207
- Title / Why / Rule を中心に入力します(他は任意)。`--no-date` で日付自動入力を無効にできます。
210
+ Title / Why / Decision を中心に入力します(他は任意)。`--no-date` で日付自動入力を無効にできます。
208
211
 
209
212
  `status` / `alternatives` などを追記してから生成したい場合は、まず `decision.yaml` だけ作るのがおすすめです。
210
213
 
@@ -229,6 +232,9 @@ npx dr-gen@latest verify out/<date>__<title>__<id>/
229
232
  ```bash
230
233
  dr-gen list --from 2026-01-01 --to 2026-01-31
231
234
 
235
+ # レポート文言を日本語にする
236
+ dr-gen list --from 2026-01-01 --to 2026-01-31 --lang ja
237
+
232
238
  # 任意: Decision 行の文字数上限(デフォルト: 80)
233
239
  dr-gen list --from 2026-01-01 --to 2026-01-31 --max-decision-len 60
234
240
  ```
package/dist/cli.js CHANGED
@@ -241,18 +241,21 @@ async function main(argv) {
241
241
  .option('-o, --out-dir <dir>', 'Base output directory to scan', 'out')
242
242
  .option('--from <YYYY-MM-DD>', 'Start date (inclusive) based on folder name prefix', '')
243
243
  .option('--to <YYYY-MM-DD>', 'End date (inclusive) based on folder name prefix', '')
244
+ .option('--lang <lang>', 'Language for report labels (en|ja). Also supports DR_GEN_LANG env var.', '')
244
245
  .option('--max-decision-len <n>', 'Max characters for the Decision line in the report (default: 80)', '80')
245
246
  .action(async (options) => {
246
247
  const from = options.from.trim().length > 0 ? options.from.trim() : undefined;
247
248
  const to = options.to.trim().length > 0 ? options.to.trim() : undefined;
248
249
  const maxDecisionLen = parsePositiveIntOrThrow(options.maxDecisionLen, '--max-decision-len');
250
+ const lang = resolveLang(options.lang);
249
251
  const items = await listDecisions({ outDir: options.outDir, from, to });
250
252
  const report = renderListReportMarkdown(items, {
251
253
  outDir: options.outDir,
252
254
  from,
253
255
  to,
254
256
  generatedAtIso: new Date().toISOString(),
255
- maxDecisionLen
257
+ maxDecisionLen,
258
+ lang
256
259
  });
257
260
  console.log(report);
258
261
  });
package/dist/list.js CHANGED
@@ -148,22 +148,60 @@ function extractFolderId(folderName) {
148
148
  const last = parts.at(-1) ?? folderName;
149
149
  return /^[0-9a-f]{8}$/i.test(last) ? last : folderName;
150
150
  }
151
+ function listLabels(lang) {
152
+ if (lang === 'ja') {
153
+ return {
154
+ reportTitle: '# 意思決定レポート',
155
+ outDir: '- 出力ディレクトリ',
156
+ period: '- 期間',
157
+ generatedAt: '- 生成日時',
158
+ decisionsSection: '## 一覧',
159
+ periodAll: '全て',
160
+ periodFrom: (from) => `開始 ${from}`,
161
+ periodTo: (to) => `終了 ${to}`,
162
+ id: 'ID',
163
+ date: '日付',
164
+ title: 'タイトル',
165
+ status: 'ステータス',
166
+ decider: '決定者',
167
+ decision: '決定事項'
168
+ };
169
+ }
170
+ return {
171
+ reportTitle: '# Decision Record Report',
172
+ outDir: '- Out dir',
173
+ period: '- Period',
174
+ generatedAt: '- Generated at',
175
+ decisionsSection: '## Decisions',
176
+ periodAll: 'all',
177
+ periodFrom: (from) => `from ${from}`,
178
+ periodTo: (to) => `to ${to}`,
179
+ id: 'ID',
180
+ date: 'Date',
181
+ title: 'Title',
182
+ status: 'Status',
183
+ decider: 'Decider',
184
+ decision: 'Decision'
185
+ };
186
+ }
151
187
  export function renderListReportMarkdown(items, options) {
152
188
  const lines = [];
153
189
  const maxDecisionLen = options.maxDecisionLen ?? 80;
154
- lines.push('# Decision Record Report');
190
+ const lang = options.lang ?? 'en';
191
+ const labels = listLabels(lang);
192
+ lines.push(labels.reportTitle);
155
193
  lines.push('');
156
194
  const periodParts = [];
157
195
  if (options.from !== undefined && options.from.trim().length > 0)
158
- periodParts.push(`from ${options.from}`);
196
+ periodParts.push(labels.periodFrom(options.from));
159
197
  if (options.to !== undefined && options.to.trim().length > 0)
160
- periodParts.push(`to ${options.to}`);
161
- const period = periodParts.length > 0 ? periodParts.join(' ') : 'all';
162
- lines.push(`- Out dir: ${options.outDir}`);
163
- lines.push(`- Period: ${period}`);
164
- lines.push(`- Generated at: ${options.generatedAtIso}`);
198
+ periodParts.push(labels.periodTo(options.to));
199
+ const period = periodParts.length > 0 ? periodParts.join(' ') : labels.periodAll;
200
+ lines.push(`${labels.outDir}: ${options.outDir}`);
201
+ lines.push(`${labels.period}: ${period}`);
202
+ lines.push(`${labels.generatedAt}: ${options.generatedAtIso}`);
165
203
  lines.push('');
166
- lines.push('## Decisions');
204
+ lines.push(labels.decisionsSection);
167
205
  lines.push('');
168
206
  for (const item of items) {
169
207
  const id = extractFolderId(item.folderName);
@@ -172,18 +210,18 @@ export function renderListReportMarkdown(items, options) {
172
210
  const status = item.summary?.status ?? '';
173
211
  const decider = item.summary?.decider ?? '';
174
212
  const rule = item.ruleExcerpt ?? '';
175
- lines.push(`- ID: ${mdEscape(id)}`);
213
+ lines.push(`- ${labels.id}: ${mdEscape(id)}`);
176
214
  if (date.length > 0)
177
- lines.push(` - Date: ${mdEscape(date)}`);
215
+ lines.push(` - ${labels.date}: ${mdEscape(date)}`);
178
216
  if (title.length > 0)
179
- lines.push(` - Title: ${mdEscape(title)}`);
217
+ lines.push(` - ${labels.title}: ${mdEscape(title)}`);
180
218
  if (status.length > 0)
181
- lines.push(` - Status: ${mdEscape(status)}`);
219
+ lines.push(` - ${labels.status}: ${mdEscape(status)}`);
182
220
  if (decider.length > 0)
183
- lines.push(` - Decider: ${mdEscape(decider)}`);
221
+ lines.push(` - ${labels.decider}: ${mdEscape(decider)}`);
184
222
  if (rule.length > 0) {
185
223
  const clipped = truncateOneLine(rule, maxDecisionLen);
186
- lines.push(` - Decision: ${mdEscape(clipped)}`);
224
+ lines.push(` - ${labels.decision}: ${mdEscape(clipped)}`);
187
225
  }
188
226
  // Add a blank line between entries for readability and safer copy/paste.
189
227
  lines.push('');
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "dr-gen",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Generate lightweight Decision Records from decision.yaml",
5
- "homepage": "https://github.com/Ineeza/decision-record-generator#readme",
5
+ "homepage": "https://www.ineeza.com/",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/Ineeza/decision-record-generator.git"