glotfile 0.4.0 → 0.4.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.
@@ -2929,7 +2929,7 @@ function selectContextTargets(state, opts, cache2, lastRunAt) {
2929
2929
  let candidates = [];
2930
2930
  for (const key of Object.keys(state.keys).sort()) {
2931
2931
  const entry = state.keys[key];
2932
- if (entry.context) continue;
2932
+ if (entry.context && !opts.force) continue;
2933
2933
  if (keySet && !keySet.has(key)) continue;
2934
2934
  if (keyRe && !keyRe.test(key)) continue;
2935
2935
  if (cutoff) {
@@ -2977,7 +2977,7 @@ ${s.lines}
2977
2977
  });
2978
2978
  return 'Write a context note for each key. Return JSON {"items":[{"id","context"}]}.\n' + JSON.stringify(items, null, 2);
2979
2979
  }
2980
- function applyContext(state, reqs, results, clock = systemClock) {
2980
+ function applyContext(state, reqs, results, clock = systemClock, force = false) {
2981
2981
  const byId = new Map(reqs.map((r) => [r.id, r]));
2982
2982
  let written = 0;
2983
2983
  const errors = [];
@@ -2998,7 +2998,7 @@ function applyContext(state, reqs, results, clock = systemClock) {
2998
2998
  continue;
2999
2999
  }
3000
3000
  const entry = state.keys[req.key];
3001
- if (!entry || entry.context) continue;
3001
+ if (!entry || entry.context && !force) continue;
3002
3002
  entry.context = context;
3003
3003
  entry.contextSource = "ai";
3004
3004
  entry.contextAt = clock();
@@ -4643,7 +4643,8 @@ function createApi(deps) {
4643
4643
  keyGlob: body.keyGlob,
4644
4644
  limit: body.limit,
4645
4645
  since: body.since,
4646
- keys: body.keys
4646
+ keys: body.keys,
4647
+ force: body.force
4647
4648
  }, cache2, body.lastRunAt);
4648
4649
  if (!targets.length) {
4649
4650
  await stream.writeSSE({ event: "done", data: JSON.stringify({ requested: 0, written: 0, errors: [] }) });
@@ -4696,7 +4697,7 @@ function createApi(deps) {
4696
4697
  if (signal?.aborted) break;
4697
4698
  const batch = raw;
4698
4699
  const fresh = load();
4699
- const { written, errors } = applyContext(fresh, chunk2, batch.items ?? []);
4700
+ const { written, errors } = applyContext(fresh, chunk2, batch.items ?? [], void 0, body.force === true);
4700
4701
  appendLog(projectRoot, {
4701
4702
  at: (/* @__PURE__ */ new Date()).toISOString(),
4702
4703
  kind: "context",
@@ -1129,7 +1129,7 @@ function selectContextTargets(state, opts, cache2, lastRunAt) {
1129
1129
  let candidates = [];
1130
1130
  for (const key of Object.keys(state.keys).sort()) {
1131
1131
  const entry = state.keys[key];
1132
- if (entry.context) continue;
1132
+ if (entry.context && !opts.force) continue;
1133
1133
  if (keySet && !keySet.has(key)) continue;
1134
1134
  if (keyRe && !keyRe.test(key)) continue;
1135
1135
  if (cutoff) {
@@ -1197,7 +1197,7 @@ var CONTEXT_BATCH_SCHEMA = {
1197
1197
  required: ["items"],
1198
1198
  additionalProperties: false
1199
1199
  };
1200
- function applyContext(state, reqs, results, clock = systemClock) {
1200
+ function applyContext(state, reqs, results, clock = systemClock, force = false) {
1201
1201
  const byId = new Map(reqs.map((r) => [r.id, r]));
1202
1202
  let written = 0;
1203
1203
  const errors = [];
@@ -1218,7 +1218,7 @@ function applyContext(state, reqs, results, clock = systemClock) {
1218
1218
  continue;
1219
1219
  }
1220
1220
  const entry = state.keys[req.key];
1221
- if (!entry || entry.context) continue;
1221
+ if (!entry || entry.context && !force) continue;
1222
1222
  entry.context = context;
1223
1223
  entry.contextSource = "ai";
1224
1224
  entry.contextAt = clock();
@@ -4273,7 +4273,8 @@ function createApi(deps) {
4273
4273
  keyGlob: body.keyGlob,
4274
4274
  limit: body.limit,
4275
4275
  since: body.since,
4276
- keys: body.keys
4276
+ keys: body.keys,
4277
+ force: body.force
4277
4278
  }, cache2, body.lastRunAt);
4278
4279
  if (!targets.length) {
4279
4280
  await stream.writeSSE({ event: "done", data: JSON.stringify({ requested: 0, written: 0, errors: [] }) });
@@ -4326,7 +4327,7 @@ function createApi(deps) {
4326
4327
  if (signal?.aborted) break;
4327
4328
  const batch = raw;
4328
4329
  const fresh = load();
4329
- const { written, errors } = applyContext(fresh, chunk2, batch.items ?? []);
4330
+ const { written, errors } = applyContext(fresh, chunk2, batch.items ?? [], void 0, body.force === true);
4330
4331
  appendLog(projectRoot, {
4331
4332
  at: (/* @__PURE__ */ new Date()).toISOString(),
4332
4333
  kind: "context",