leerness 1.9.70 → 1.9.71

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.71 — 2026-05-20
4
+
5
+ **`.env` / `.env.example` 자동 동기화 (보안 정책: 키만, 실제 값 절대 노출 안 함)**.
6
+
7
+ ### Added — `leerness env check` / `env sync` 명령
8
+ - `leerness env check [<path>]` — `.env`에 있는데 `.env.example`에 없는 키 / 반대도 자동 감지.
9
+ - `--json`: 구조화된 JSON 출력 (CI 친화).
10
+ - exit code: `.env.example` 누락 키 ≥1 시 1 (보안 가시화).
11
+ - `leerness env sync [<path>]` — 누락 키만 `.env.example` 끝에 append (값은 빈 문자열).
12
+
13
+ ### Improved — `leerness audit` 통합
14
+ - 매 audit 시 `.env` ↔ `.env.example` 자동 비교, 누락 시 warning 추가.
15
+ - `audit --fix` 시 누락 키 자동 추가 (보안 정책: 실제 값 미노출).
16
+ - `--no-env-check`로 비활성화 가능.
17
+
18
+ ### 보안 정책 (검증됨)
19
+ - `.env`의 실제 값은 **절대** `.env.example`로 옮기지 않음.
20
+ - 추가되는 줄: `KEY=` (빈 문자열).
21
+ - 사용자 글로벌 룰 (.env 보안) 준수.
22
+
23
+ ### Verified
24
+ - stress-v17 — env check / sync / audit 통합 + 보안 정책 + 누적 회귀.
25
+ - e2e 회귀: 219/219 PASS 유지.
26
+
27
+ ---
28
+
3
29
  ## 1.9.70 — 2026-05-19
4
30
 
5
31
  **MCP server `tools/call` 자동 사용 통계** (1.9.65 usage-stats 확장).
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **AI 코딩 에이전트의 거짓 완료·중복·망각·충돌을 막아주는 검수·기억·협업 CLI 하네스.**
4
4
 
5
- [![npm](https://img.shields.io/badge/npm-leerness-blue)](https://www.npmjs.com/package/leerness) [![version](https://img.shields.io/badge/version-1.9.70-green)]() [![tests](https://img.shields.io/badge/e2e-219%2F219-success)]() [![license](https://img.shields.io/badge/license-MIT-lightgrey)]()
5
+ [![npm](https://img.shields.io/badge/npm-leerness-blue)](https://www.npmjs.com/package/leerness) [![version](https://img.shields.io/badge/version-1.9.71-green)]() [![tests](https://img.shields.io/badge/e2e-219%2F219-success)]() [![license](https://img.shields.io/badge/license-MIT-lightgrey)]()
6
6
 
7
7
  ```
8
8
  ╔══════════════════════════════════════════════════════════════╗
@@ -12,7 +12,7 @@
12
12
  ║ ██║ ██╔══╝ ██╔══╝ ██╔══██╗██║╚██╗██║██╔══╝ ╚════██║ ║
13
13
  ║ ███████╗███████╗███████╗██║ ██║██║ ╚████║███████╗███████║ ║
14
14
  ║ ╚══════╝╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚══════╝ ║
15
- ║ v1.9.70 AI Agent Reliability Harness ║
15
+ ║ v1.9.71 AI Agent Reliability Harness ║
16
16
  ║ verify · remember · orchestrate · audit · prevent drift ║
17
17
  ╚══════════════════════════════════════════════════════════════╝
18
18
  ```
@@ -433,6 +433,7 @@ npm test # = node ./scripts/e2e.js
433
433
 
434
434
  ## 변경 이력 (최근)
435
435
 
436
+ - **1.9.71** — **`.env` / `.env.example` 자동 동기화** — `leerness env check` / `env sync` 명령 + `audit` 통합 (`--fix`로 누락 키 자동 추가). 보안 정책: 실제 값 절대 노출 안 함 (키만 추가, 값은 빈 문자열).
436
437
  - **1.9.70** — **MCP server `tools/call` 자동 사용 통계** — 도구별 호출 카운트 (`.harness/cache/usage-stats.json#mcp.tools`) + `leerness usage stats` 출력에 MCP 섹션 + 드물게 호출되는 도구 식별.
437
438
  - **1.9.69** — **handoff에 skill-suggestions.md history hit 노출** (fuzzy 매칭, 최근 2건 + top 2 매치). AI가 이전 세션 결정을 일관 유지. mtime 기반 캐시 (1.9.65/66/67 캐시 패밀리 연속).
438
439
  - **1.9.68** — **`skill match` 결과 → `.harness/skill-suggestions.md` rolling history 자동 누적** (AI가 다음 세션에 이전 추천 참조 가능). `--no-save` / `LEERNESS_NO_SKILL_HISTORY=1`로 끄기.
package/bin/harness.js CHANGED
@@ -6,7 +6,7 @@ const path = require('path');
6
6
  const cp = require('child_process');
7
7
  const readline = require('readline');
8
8
 
9
- const VERSION = '1.9.70';
9
+ const VERSION = '1.9.71';
10
10
  const MARK = '<!-- leerness:managed -->';
11
11
  const README_START = '<!-- leerness:project-readme:start -->';
12
12
  const README_END = '<!-- leerness:project-readme:end -->';
@@ -1480,6 +1480,32 @@ function audit(root) {
1480
1480
  }
1481
1481
  } catch {}
1482
1482
  }
1483
+ // 1.9.71: .env / .env.example 동기화 감사 (--no-env-check로 끄기)
1484
+ if (!has('--no-env-check')) {
1485
+ try {
1486
+ const d = envDiff(root);
1487
+ if (exists(d.envPath) && exists(d.examplePath)) {
1488
+ if (d.inEnvOnly.length) {
1489
+ warnings++;
1490
+ warn(`.env에 있는 키 ${d.inEnvOnly.length}건이 .env.example에 누락: ${d.inEnvOnly.slice(0, 4).join(', ')}${d.inEnvOnly.length > 4 ? ' …' : ''}`);
1491
+ if (fix) {
1492
+ // 자동 동기화: 누락 키만 .env.example 끝에 append (값 비움)
1493
+ let example = read(d.examplePath);
1494
+ if (!example.endsWith('\n')) example += '\n';
1495
+ example += `\n# 1.9.71 audit --fix: 누락 키 자동 추가 (값은 빈 문자열, 보안 정책)\n`;
1496
+ for (const k of d.inEnvOnly) example += `${k}=\n`;
1497
+ writeUtf8(d.examplePath, example);
1498
+ ok(` ↳ fixed: .env.example에 ${d.inEnvOnly.length}건 자동 추가 (값은 빈 문자열, 1.9.71)`);
1499
+ fixed++;
1500
+ } else {
1501
+ log(` → 자동 동기화: leerness env sync 또는 leerness audit --fix`);
1502
+ }
1503
+ } else {
1504
+ ok('.env ↔ .env.example 동기화됨 (1.9.71)');
1505
+ }
1506
+ }
1507
+ } catch {}
1508
+ }
1483
1509
  // 1.9.63: --strict — warnings ≥ threshold 시 failures로 승격 (CI 친화)
1484
1510
  if (has('--strict')) {
1485
1511
  const threshold = parseInt(arg('--threshold', '1'), 10);
@@ -3216,11 +3242,12 @@ function _banner(opts = {}) {
3216
3242
  lines.push('');
3217
3243
  for (const ln of lines) log(ln);
3218
3244
  if (opts.quickStart) {
3219
- log(C.bold(C.cyan(' ✨ 빠른 시작 (1.9.70+ 워크플로)')));
3245
+ log(C.bold(C.cyan(' ✨ 빠른 시작 (1.9.71+ 워크플로)')));
3220
3246
  log(' ' + C.green('npx leerness@latest init .') + C.dim(' # 신규 프로젝트 + 외부 AI CLI 설정'));
3221
3247
  log(' ' + C.green('npx leerness handoff .') + C.dim(' # 컨텍스트 + lessons + 매칭 skill + 이전 history hit (1.9.69)'));
3222
3248
  log(' ' + C.green('npx leerness skill match "<query>"') + C.dim(' # 매칭 skill + rolling history 자동 누적 (1.9.68)'));
3223
3249
  log(' ' + C.green('npx leerness verify-claim T-0001 --run-tests') + C.dim(' # AI 거짓 완료 자동 검증'));
3250
+ log(' ' + C.green('npx leerness env check .') + C.dim(' # .env ↔ .env.example 동기화 검사 (1.9.71)'));
3224
3251
  log(' ' + C.green('npx leerness session close .') + C.dim(' # 마감 + 다음 라운드 추천 (default)'));
3225
3252
  log('');
3226
3253
  log(C.bold(C.cyan(' 🤖 메인 에이전트 (Claude/Cursor/Copilot)용')));
@@ -7138,6 +7165,77 @@ function whatsNewCmd(root) {
7138
7165
  log(` 4. 상세: \`cat CHANGELOG.md\` 또는 \`leerness whats-new --json\``);
7139
7166
  }
7140
7167
 
7168
+ // 1.9.71: .env / .env.example 자동 동기화 — 누락 키 감지 + (옵션) 자동 추가
7169
+ // 보안 정책: .env의 실제 값은 절대 옮기지 않음. .env.example엔 키만 (빈 값).
7170
+ function _parseEnvKeys(text) {
7171
+ // KEY=value 형식, comment(#) 무시, 빈 줄 무시
7172
+ const out = new Set();
7173
+ for (const raw of String(text || '').split('\n')) {
7174
+ const line = raw.trim();
7175
+ if (!line || line.startsWith('#')) continue;
7176
+ const m = line.match(/^([A-Z_][A-Z0-9_]*)\s*=/i);
7177
+ if (m) out.add(m[1]);
7178
+ }
7179
+ return out;
7180
+ }
7181
+ function envDiff(root) {
7182
+ root = absRoot(root || process.cwd());
7183
+ const envPath = path.join(root, '.env');
7184
+ const examplePath = path.join(root, '.env.example');
7185
+ const envKeys = exists(envPath) ? _parseEnvKeys(read(envPath)) : new Set();
7186
+ const exKeys = exists(examplePath) ? _parseEnvKeys(read(examplePath)) : new Set();
7187
+ const inEnvOnly = [...envKeys].filter(k => !exKeys.has(k));
7188
+ const inExampleOnly = [...exKeys].filter(k => !envKeys.has(k));
7189
+ return { envPath, examplePath, envKeys: [...envKeys], exKeys: [...exKeys], inEnvOnly, inExampleOnly };
7190
+ }
7191
+ function envCheckCmd(root) {
7192
+ const d = envDiff(root);
7193
+ const isJson = has('--json');
7194
+ if (isJson) { log(JSON.stringify(d, null, 2)); return; }
7195
+ log(`# leerness env check (1.9.71)`);
7196
+ log(`.env 존재: ${exists(d.envPath)} · .env.example 존재: ${exists(d.examplePath)}`);
7197
+ log(`총 .env 키 ${d.envKeys.length} · .env.example 키 ${d.exKeys.length}`);
7198
+ if (d.inEnvOnly.length) {
7199
+ log('');
7200
+ log(`⚠ .env에 있는데 .env.example에 없는 키 ${d.inEnvOnly.length}건 (보안 정책: 값 없이 키만 추가):`);
7201
+ for (const k of d.inEnvOnly) log(` - ${k}`);
7202
+ }
7203
+ if (d.inExampleOnly.length) {
7204
+ log('');
7205
+ log(`ℹ .env.example에 있는데 .env에 없는 키 ${d.inExampleOnly.length}건 (런타임 누락 가능):`);
7206
+ for (const k of d.inExampleOnly) log(` - ${k}`);
7207
+ }
7208
+ if (!d.inEnvOnly.length && !d.inExampleOnly.length) {
7209
+ log('');
7210
+ ok('.env ↔ .env.example 동기화됨');
7211
+ } else {
7212
+ log('');
7213
+ log(`💡 자동 동기화: leerness env sync${d.inEnvOnly.length ? ' (.env.example에 누락 키 추가 — 값은 빈 문자열)' : ''}`);
7214
+ }
7215
+ // 1.9.71: exit code = .env.example 누락 키 있으면 1 (보안 가시화)
7216
+ if (d.inEnvOnly.length) process.exitCode = 1;
7217
+ }
7218
+ function envSyncCmd(root) {
7219
+ const d = envDiff(root);
7220
+ log(`# leerness env sync (1.9.71)`);
7221
+ if (!exists(d.examplePath)) {
7222
+ fail(`.env.example 없음 — leerness init . 먼저 실행`);
7223
+ return;
7224
+ }
7225
+ if (!d.inEnvOnly.length) {
7226
+ ok('동기화 불필요 — .env.example에 누락 키 없음');
7227
+ return;
7228
+ }
7229
+ // 누락 키를 .env.example 끝에 append (값 비움, 보안 정책 코멘트 동반)
7230
+ let example = read(d.examplePath);
7231
+ if (!example.endsWith('\n')) example += '\n';
7232
+ example += `\n# 1.9.71 sync: .env에서 발견된 누락 키 (값은 빈 문자열 — 보안 정책)\n`;
7233
+ for (const k of d.inEnvOnly) example += `${k}=\n`;
7234
+ writeUtf8(d.examplePath, example);
7235
+ ok(`${d.inEnvOnly.length}건 추가됨 → ${rel(root, d.examplePath)}`);
7236
+ for (const k of d.inEnvOnly) log(` + ${k}=`);
7237
+ }
7238
+
7141
7239
  function usageStatsCmd(root) {
7142
7240
  root = absRoot(root || process.cwd());
7143
7241
  const stats = _readUsageStats(root);
@@ -7466,6 +7564,9 @@ async function main() {
7466
7564
  if (cmd === 'contract' && args[1] === 'verify') return contractVerifyCmd(args[2], args[3]);
7467
7565
  if (cmd === 'drift' && (args[1] === 'check' || !args[1])) return driftCheckCmd(args[2] || arg('--path', process.cwd()));
7468
7566
  if (cmd === 'usage' && (args[1] === 'stats' || !args[1])) return usageStatsCmd(args[2] || arg('--path', process.cwd()));
7567
+ // 1.9.71: leerness env check / sync — .env vs .env.example 자동 동기화
7568
+ if (cmd === 'env' && args[1] === 'check') return envCheckCmd(args[2] || arg('--path', process.cwd()));
7569
+ if (cmd === 'env' && args[1] === 'sync') return envSyncCmd(args[2] || arg('--path', process.cwd()));
7469
7570
  if (cmd === 'whats-new') return whatsNewCmd(args[1] || arg('--path', process.cwd()));
7470
7571
  if (cmd === 'reuse' && args[1] === 'autodetect') return reuseAutodetectCmd(args[2] || arg('--path', process.cwd()));
7471
7572
  if (cmd === 'setup-agents' || cmd === 'setup' && args[1] === 'agents') return await setupAgentsCmd(args[1] && args[1] !== 'agents' ? args[1] : (args[2] || process.cwd()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.70",
3
+ "version": "1.9.71",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",