@diffin/cli 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 (2) hide show
  1. package/lib/backfill.mjs +19 -1
  2. package/package.json +1 -1
package/lib/backfill.mjs CHANGED
@@ -16,7 +16,7 @@ import { ensureInit } from './init.mjs';
16
16
  import { watchAll, watchJourney } from './watch.mjs';
17
17
  import { journey } from './journey.mjs';
18
18
  import { machineHash } from './machine.mjs';
19
- import { ALL_LOOKBACK_MS, withoutIgnored, excludeFolders, excludedFrom, allowFolders, allowedFrom, folderCensus, folderTree } from './ignore.mjs';
19
+ import { ALL_LOOKBACK_MS, withoutIgnored, excludeFolders, excludedFrom, excludedFolders, allowFolders, allowedFolders, allowedFrom, folderCensus, folderTree } from './ignore.mjs';
20
20
  import { deviceId, foldersAsked, markFoldersAsked } from './state.mjs';
21
21
 
22
22
  /**
@@ -128,6 +128,22 @@ async function chooseFolders(plans, { ask, title = '올릴 폴더', note = '작
128
128
  return { cancelled: false, excluded };
129
129
  }
130
130
 
131
+ /**
132
+ * The lists the person just picked, told to the server at once (2026-10-12): the app's folder screen read empty after
133
+ * the first production onboarding, because only a capture reported folders. Names only — the same two fields a
134
+ * capture sends (`syncFolders` in capture.mjs) — and no `held`: onboarding does not look for held folders, and the
135
+ * server leaves its waiting list alone when the field is absent. A machine with no list yet (a pipe, `--yes`) has
136
+ * nothing to say; and nothing here may stop a backfill — no network, or an older server, leaves it for the next capture.
137
+ */
138
+ export async function reportFolders(token) {
139
+ const allowed = allowedFolders();
140
+ if (allowed === null) return false;
141
+ try {
142
+ const res = await fetchRetry(`${SERVER}/folders/held`, () => ({ method: 'POST', headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' }, body: JSON.stringify({ device: deviceId(), allowed: allowed.map((f) => posixPath(scrub(f))), excluded: excludedFolders().map((f) => posixPath(scrub(f))) }) }), 1);
143
+ return res.ok;
144
+ } catch { return false; }
145
+ }
146
+
131
147
  export async function backfill(argv = []) {
132
148
  const noWait = argv.includes('--no-wait');
133
149
  const vals = (name) => argv.reduce((a, x, i) => (x === name && argv[i + 1] ? [...a, argv[i + 1]] : a), []);
@@ -209,6 +225,8 @@ export async function backfill(argv = []) {
209
225
  const kept = await chooseFolders(recent, { ask: true, title: '기록할 폴더', note: '이 기기에서 최근 작업한 폴더입니다. 앞으로 기록하지 않을 폴더는 선택을 해제하세요.', unit: '기록' });
210
226
  if (kept.excluded.length) stepSkip('제외한 폴더', kept.excluded.map((f) => posixPath(scrub(f))).join(' · '), dim('이 기기에서 기록하지 않습니다 · 되돌리려면 diffin include <폴더>'));
211
227
  }
228
+ // the allow and deny lists as they stand now, so the app shows them before the first capture
229
+ await reportFolders(token);
212
230
 
213
231
  // What a person watches is FILES, not sessions. One Claude Code session carries its own transcript and every
214
232
  // subagent's — measured, 3 sessions were 638 files — so a counter that moves once per session sat still for minutes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diffin/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Capture your AI work history into diffin",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://diffin.work",