this-is-enough 0.1.0 → 0.1.1

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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/bin/cli.js +44 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ThisIsEnough
1
+ # This-Is-Enough
2
2
 
3
3
  가볍지만 실행 가능한 에이전트 작업 규칙을 프로젝트에 설치하는 CLI입니다.
4
4
 
@@ -53,7 +53,7 @@ node /path/to/this-is-enough/bin/cli.js init --mode existing --cwd /path/to/repo
53
53
  - `--mode new|existing`
54
54
  - `--cwd <path>` (기본값: 현재 디렉토리)
55
55
  - `--dry-run` (변경 예정만 출력)
56
- - `--force` (기존 파일 덮어쓰기)
56
+ - `--force` (기존 파일 덮어쓰기, `AGENTS.md`는 차이가 있으면 `--force` 없이도 백업 후 갱신)
57
57
  - `--yes` (호환용, 기본이 이미 non-interactive)
58
58
 
59
59
  ### `doctor`
package/bin/cli.js CHANGED
@@ -157,6 +157,31 @@ function createFileIfMissing(filePath, content, options, actions) {
157
157
  }
158
158
  }
159
159
 
160
+ function syncCoreAgents(filePath, content, options, actions) {
161
+ if (!fs.existsSync(filePath)) {
162
+ actions.push(`create ${filePath}`);
163
+ if (!options.dryRun) {
164
+ fs.writeFileSync(filePath, content, "utf8");
165
+ }
166
+ return { status: "created", backupPath: null };
167
+ }
168
+
169
+ const current = fs.readFileSync(filePath, "utf8");
170
+ if (current === content) {
171
+ actions.push(`skip up-to-date ${filePath}`);
172
+ return { status: "up-to-date", backupPath: null };
173
+ }
174
+
175
+ const backupPath = `${filePath}.bak.${timestampForBackup()}`;
176
+ actions.push(`backup ${filePath} -> ${backupPath}`);
177
+ actions.push(`overwrite ${filePath}`);
178
+ if (!options.dryRun) {
179
+ fs.copyFileSync(filePath, backupPath);
180
+ fs.writeFileSync(filePath, content, "utf8");
181
+ }
182
+ return { status: "replaced", backupPath };
183
+ }
184
+
160
185
  function timestampForBackup() {
161
186
  const now = new Date();
162
187
  const p = (n) => String(n).padStart(2, "0");
@@ -195,7 +220,7 @@ function initProject(options) {
195
220
  ensureDir(dirPath, options, actions);
196
221
  }
197
222
 
198
- writeFileIfNeeded(paths.agentsPath, readTemplateAgents(), options, actions);
223
+ const agentsSyncResult = syncCoreAgents(paths.agentsPath, readTemplateAgents(), options, actions);
199
224
  writeFileIfNeeded(paths.architecturePath, ARCHITECTURE_TEMPLATE, options, actions);
200
225
  writeFileIfNeeded(paths.inboxPath, INBOX_TEMPLATE, options, actions);
201
226
 
@@ -243,6 +268,14 @@ function initProject(options) {
243
268
  }
244
269
  }
245
270
 
271
+ if (agentsSyncResult.status === "replaced") {
272
+ if (options.dryRun) {
273
+ info(`Note: existing AGENTS.md would be backed up to ${agentsSyncResult.backupPath} before replacement.`);
274
+ } else {
275
+ info(`Note: existing AGENTS.md was backed up to ${agentsSyncResult.backupPath} before replacement.`);
276
+ }
277
+ }
278
+
246
279
  info(options.dryRun ? "Init check complete." : "Init complete.");
247
280
  }
248
281
 
@@ -369,6 +402,7 @@ function upgradeProject(options) {
369
402
  const paths = resolveProjectPaths(options.cwd);
370
403
  const actions = [];
371
404
  const warnings = [];
405
+ let agentsBackupPath = null;
372
406
 
373
407
  ensureDir(paths.adrDir, options, actions);
374
408
  ensureDir(paths.reqsDir, options, actions);
@@ -392,6 +426,7 @@ function upgradeProject(options) {
392
426
  const backupPath = `${paths.agentsPath}.bak.${timestampForBackup()}`;
393
427
  actions.push(`backup ${paths.agentsPath} -> ${backupPath}`);
394
428
  actions.push(`overwrite ${paths.agentsPath}`);
429
+ agentsBackupPath = backupPath;
395
430
  if (!options.dryRun) {
396
431
  fs.copyFileSync(paths.agentsPath, backupPath);
397
432
  fs.writeFileSync(paths.agentsPath, templateAgents, "utf8");
@@ -430,6 +465,14 @@ function upgradeProject(options) {
430
465
  }
431
466
  }
432
467
 
468
+ if (agentsBackupPath) {
469
+ if (options.dryRun) {
470
+ info(`Note: existing AGENTS.md would be backed up to ${agentsBackupPath} before replacement.`);
471
+ } else {
472
+ info(`Note: existing AGENTS.md was backed up to ${agentsBackupPath} before replacement.`);
473
+ }
474
+ }
475
+
433
476
  info(options.dryRun ? "Upgrade check complete." : "Upgrade complete.");
434
477
  return 0;
435
478
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "this-is-enough",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Install and bootstrap the ThisIsEnough AGENTS.md workflow.",
5
5
  "license": "MIT",
6
6
  "bin": {