@chosengeneration/light-code 0.155.0 → 0.156.0
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/dist/cli.cjs +309 -21
- package/dist/server.cjs +306 -18
- package/package.json +1 -1
package/dist/server.cjs
CHANGED
|
@@ -60174,7 +60174,7 @@ var writeParams = external_exports.object({
|
|
|
60174
60174
|
name: external_exports.string().describe('Short kebab-case identifier, e.g. "internal-http-client". Becomes the filename.'),
|
|
60175
60175
|
description: external_exports.string().describe("One line, and the only part loaded into every future conversation \u2014 so write it as the trigger for reading the skill: what subject it covers, not what it says."),
|
|
60176
60176
|
body: external_exports.string().describe("The markdown content. Be concrete: package names, import paths, function signatures, a short example. This is read only when relevant, so length costs nothing."),
|
|
60177
|
-
audience: external_exports.enum(["me", "team"]).optional().describe('Who the skill is for. "me": kept only for this user, on this computer, in every project - never shared. "team": saved where the team shares skills.
|
|
60177
|
+
audience: external_exports.enum(["me", "team"]).optional().describe('Who the skill is for. "me": kept only for this user, on this computer, in every project - never shared. "team" (the default - leave this out): saved where the team shares skills. Use "me" ONLY when the user explicitly says the skill is personal, private or just for them; do not ask. Omit when updating: the skill stays where it is.'),
|
|
60178
60178
|
images: external_exports.array(external_exports.object({
|
|
60179
60179
|
source: external_exports.string().min(1).describe("The picture as it is now, relative to the workspace root."),
|
|
60180
60180
|
name: external_exports.string().optional().describe("What to call it inside the skill. Defaults to the source file name."),
|
|
@@ -61302,7 +61302,7 @@ function isInstallableRequirement(requirement) {
|
|
|
61302
61302
|
}
|
|
61303
61303
|
|
|
61304
61304
|
// ../../packages/core/dist/python/tools.js
|
|
61305
|
-
var audienceParam = external_exports.enum(["me", "team"]).optional().describe('Who the tool is for. "me": kept only for this user, on this computer, in every project - never shared. "team": saved where the team shares tools.
|
|
61305
|
+
var audienceParam = external_exports.enum(["me", "team"]).optional().describe('Who the tool is for. "me": kept only for this user, on this computer, in every project - never shared. "team" (the default - leave this out): saved where the team shares tools. Use "me" ONLY when the user explicitly says the tool is personal, private or just for them; do not ask. Omit when updating: the tool stays where it is.');
|
|
61306
61306
|
function toolFolder(context, name, audience) {
|
|
61307
61307
|
const personal = context.personalToolsDir;
|
|
61308
61308
|
if (audience === "me") {
|
|
@@ -74685,6 +74685,15 @@ function toolsForAccess(tools, readOnly, label) {
|
|
|
74685
74685
|
var import_node_crypto15 = require("node:crypto");
|
|
74686
74686
|
var import_promises25 = __toESM(require("node:fs/promises"), 1);
|
|
74687
74687
|
var import_node_path45 = __toESM(require("node:path"), 1);
|
|
74688
|
+
var TOMBSTONE_PREFIX = "LIGHT-CODE-DELETED:";
|
|
74689
|
+
function tombstoneText(who, when3) {
|
|
74690
|
+
return `${TOMBSTONE_PREFIX} removed for the team by ${who} on ${when3.toISOString().slice(0, 10)}. Light Code no longer loads this file; writing a new one of the same name brings it back.
|
|
74691
|
+
`;
|
|
74692
|
+
}
|
|
74693
|
+
function isTombstone(bytes) {
|
|
74694
|
+
const head = new TextDecoder().decode(bytes.slice(0, 64)).replace(/^\uFEFF/, "");
|
|
74695
|
+
return head.startsWith(TOMBSTONE_PREFIX);
|
|
74696
|
+
}
|
|
74688
74697
|
var TEAM_REPO_STATE_FILE = ".lightcode-teamrepo.json";
|
|
74689
74698
|
var decoder = new TextDecoder("utf-8", { fatal: true });
|
|
74690
74699
|
function contentHash(bytes) {
|
|
@@ -74815,6 +74824,14 @@ async function syncTeamRepo(options) {
|
|
|
74815
74824
|
continue;
|
|
74816
74825
|
const fetched = hash2(bytes);
|
|
74817
74826
|
const before = state.files[change.path];
|
|
74827
|
+
if (isTombstone(bytes)) {
|
|
74828
|
+
state.files[change.path] = { commit: head, hash: fetched, deleted: true };
|
|
74829
|
+
if (before?.deleted !== true) {
|
|
74830
|
+
await import_promises25.default.rm(mirrorFile(target.kind, target.relative), { force: true });
|
|
74831
|
+
report.removed.push(change.path);
|
|
74832
|
+
}
|
|
74833
|
+
continue;
|
|
74834
|
+
}
|
|
74818
74835
|
state.files[change.path] = { commit: head, hash: fetched };
|
|
74819
74836
|
if (before?.hash === fetched)
|
|
74820
74837
|
continue;
|
|
@@ -74849,6 +74866,27 @@ async function syncTeamRepo(options) {
|
|
|
74849
74866
|
}
|
|
74850
74867
|
chosen.set(repoPath, { hash: mine, file: entry.file });
|
|
74851
74868
|
const known = state.files[repoPath];
|
|
74869
|
+
if (known?.deleted === true && state.pushed[repoPath] !== known.hash) {
|
|
74870
|
+
if (mine === state.pushed[repoPath]) {
|
|
74871
|
+
const inside = (options.removable ?? []).some((dir) => entry.file.toLowerCase().startsWith(import_node_path45.default.resolve(dir).toLowerCase() + import_node_path45.default.sep));
|
|
74872
|
+
if (inside) {
|
|
74873
|
+
await import_promises25.default.rm(entry.file, { force: true });
|
|
74874
|
+
state.pushed[repoPath] = known.hash;
|
|
74875
|
+
report.removed.push(`${repoPath} (copy on this computer)`);
|
|
74876
|
+
} else {
|
|
74877
|
+
report.conflicts.push({
|
|
74878
|
+
path: repoPath,
|
|
74879
|
+
reason: `deleted for the team in the repository, but an unchanged copy still loads here from ${entry.file} - delete it there if it should go`
|
|
74880
|
+
});
|
|
74881
|
+
}
|
|
74882
|
+
} else {
|
|
74883
|
+
report.conflicts.push({
|
|
74884
|
+
path: repoPath,
|
|
74885
|
+
reason: "deleted for the team in the repository, but changed here since - not re-added; delete yours, or write it again to bring it back"
|
|
74886
|
+
});
|
|
74887
|
+
}
|
|
74888
|
+
continue;
|
|
74889
|
+
}
|
|
74852
74890
|
if (known?.hash === mine) {
|
|
74853
74891
|
state.pushed[repoPath] = mine;
|
|
74854
74892
|
continue;
|
|
@@ -74929,7 +74967,7 @@ async function syncTeamRepo(options) {
|
|
|
74929
74967
|
else
|
|
74930
74968
|
delete state.released;
|
|
74931
74969
|
for (const repoPath of Object.keys(state.pushed)) {
|
|
74932
|
-
if (!present2.has(repoPath) && !released.has(repoPath) && state.files[repoPath] !== void 0)
|
|
74970
|
+
if (!present2.has(repoPath) && !released.has(repoPath) && state.files[repoPath] !== void 0 && state.files[repoPath]?.deleted !== true)
|
|
74933
74971
|
report.deletedHere.push(repoPath);
|
|
74934
74972
|
}
|
|
74935
74973
|
}
|
|
@@ -74952,6 +74990,8 @@ async function checkCoverage(options) {
|
|
|
74952
74990
|
const repoPath = repoPathFor(folder, kind, entry.relative);
|
|
74953
74991
|
const mine = hash2(new Uint8Array(await import_promises25.default.readFile(entry.file)));
|
|
74954
74992
|
const known = state.files[repoPath];
|
|
74993
|
+
if (known?.deleted === true)
|
|
74994
|
+
continue;
|
|
74955
74995
|
if (known === void 0)
|
|
74956
74996
|
problems.push(`${entry.file} - not in the repository yet`);
|
|
74957
74997
|
else if (known.hash !== mine && state.pushed[repoPath] !== mine)
|
|
@@ -74975,6 +75015,59 @@ async function releaseFromRecord(stateFile, repoPaths) {
|
|
|
74975
75015
|
parsed.released = [.../* @__PURE__ */ new Set([...parsed.released ?? [], ...repoPaths])].sort();
|
|
74976
75016
|
await writeWhole2(stateFile, JSON.stringify(parsed, null, 1));
|
|
74977
75017
|
}
|
|
75018
|
+
async function tombstoneInRepo(options) {
|
|
75019
|
+
const { folder } = options;
|
|
75020
|
+
const mirrorFile = (repoPath) => {
|
|
75021
|
+
const target = classifyRepoPath(folder, repoPath);
|
|
75022
|
+
return target === void 0 ? void 0 : import_node_path45.default.join(options.mirror[target.kind], ...target.relative.split("/"));
|
|
75023
|
+
};
|
|
75024
|
+
const state = await readState(options.stateFile, mirrorFile);
|
|
75025
|
+
const bytes = new TextEncoder().encode(tombstoneText(options.who, options.now ?? /* @__PURE__ */ new Date()));
|
|
75026
|
+
const marker = hash2(bytes);
|
|
75027
|
+
const done = [];
|
|
75028
|
+
let failed2;
|
|
75029
|
+
for (const repoPath of options.repoPaths) {
|
|
75030
|
+
const known = state.files[repoPath];
|
|
75031
|
+
if (known === void 0 || known.deleted === true)
|
|
75032
|
+
continue;
|
|
75033
|
+
const kind = classifyRepoPath(folder, repoPath)?.kind ?? "skills";
|
|
75034
|
+
try {
|
|
75035
|
+
const commit = await options.api.commitFile({
|
|
75036
|
+
path: repoPath,
|
|
75037
|
+
bytes,
|
|
75038
|
+
branch: options.branch,
|
|
75039
|
+
message: `Light Code: delete ${kind}/${repoPath.split("/").pop() ?? repoPath} for the team (${options.who})`,
|
|
75040
|
+
sourceCommitId: known.commit
|
|
75041
|
+
});
|
|
75042
|
+
state.files[repoPath] = { commit: commit ?? known.commit, hash: marker, deleted: true };
|
|
75043
|
+
state.pushed[repoPath] = marker;
|
|
75044
|
+
const local = mirrorFile(repoPath);
|
|
75045
|
+
if (local !== void 0)
|
|
75046
|
+
await import_promises25.default.rm(local, { force: true });
|
|
75047
|
+
done.push(repoPath);
|
|
75048
|
+
} catch (error51) {
|
|
75049
|
+
const status2 = error51.status;
|
|
75050
|
+
failed2 = {
|
|
75051
|
+
path: repoPath,
|
|
75052
|
+
problem: status2 === 409 ? "changed in the repository since the last sync - press Sync now and try again" : error51 instanceof Error ? error51.message : String(error51)
|
|
75053
|
+
};
|
|
75054
|
+
break;
|
|
75055
|
+
}
|
|
75056
|
+
}
|
|
75057
|
+
await writeWhole2(options.stateFile, JSON.stringify(state, null, 1));
|
|
75058
|
+
return { done, ...failed2 !== void 0 ? { failed: failed2 } : {} };
|
|
75059
|
+
}
|
|
75060
|
+
async function repoFilesOf(options) {
|
|
75061
|
+
const state = await readState(options.stateFile, () => void 0);
|
|
75062
|
+
return Object.entries(state.files).filter(([repoPath, entry]) => {
|
|
75063
|
+
if (entry.deleted === true)
|
|
75064
|
+
return false;
|
|
75065
|
+
const target = classifyRepoPath(options.folder, repoPath);
|
|
75066
|
+
if (target === void 0 || target.kind !== options.kind)
|
|
75067
|
+
return false;
|
|
75068
|
+
return options.kind === "tools" ? target.relative === `${options.name}.py` : target.relative.toLowerCase() === `${options.name.toLowerCase()}.md` || target.relative.toLowerCase().startsWith(`${options.name.toLowerCase()}/`);
|
|
75069
|
+
}).map(([repoPath]) => repoPath).sort();
|
|
75070
|
+
}
|
|
74978
75071
|
|
|
74979
75072
|
// ../../packages/core/dist/platform/httpTrace.js
|
|
74980
75073
|
var SECRET_NAME = /secret|password|passwd|token|api[-_]?key|assertion|credential|session|signature|cookie/i;
|
|
@@ -84311,6 +84404,155 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84311
84404
|
...teamRepoRetire !== void 0 ? { retire: teamRepoRetire } : {}
|
|
84312
84405
|
});
|
|
84313
84406
|
}
|
|
84407
|
+
async function teamRepoFiles(settings) {
|
|
84408
|
+
const repoRef = { project: settings.project, repo: settings.repo };
|
|
84409
|
+
const client = await bitbucketClient();
|
|
84410
|
+
return {
|
|
84411
|
+
branchHead: (branch) => client.branchHead(repoRef, branch),
|
|
84412
|
+
defaultBranch: () => client.defaultBranch(repoRef),
|
|
84413
|
+
createBranch: (name, startPoint) => client.createBranch(repoRef, name, startPoint),
|
|
84414
|
+
listFiles: (folder, at) => client.listFiles(repoRef, folder, at),
|
|
84415
|
+
changes: (since2, until) => client.changes(repoRef, since2, until),
|
|
84416
|
+
readBytes: (file2, at) => client.readBytes(repoRef, file2, at),
|
|
84417
|
+
commitFile: (file2) => client.commitFile(repoRef, file2)
|
|
84418
|
+
};
|
|
84419
|
+
}
|
|
84420
|
+
async function planDeleteEverywhere(kind, name) {
|
|
84421
|
+
const plan2 = { kind, name, local: [], buckets: [], repo: [], notes: [] };
|
|
84422
|
+
const valid = kind === "skill" ? isValidSkillName(name) : isValidToolName(name);
|
|
84423
|
+
if (!valid)
|
|
84424
|
+
return { ...plan2, error: `"${name}" is not a valid ${kind} name.` };
|
|
84425
|
+
const config2 = await loadSettings();
|
|
84426
|
+
const team = teamRepoPlan(config2);
|
|
84427
|
+
const teamCopy = "dirs" in team ? kind === "skill" ? team.dirs.skills : team.dirs.tools : void 0;
|
|
84428
|
+
const unique = (dirs) => {
|
|
84429
|
+
const out = [];
|
|
84430
|
+
for (const dir of dirs)
|
|
84431
|
+
if (dir !== void 0 && !samePath(dir, teamCopy) && !out.some((seen) => samePath(seen, dir)))
|
|
84432
|
+
out.push(dir);
|
|
84433
|
+
return out;
|
|
84434
|
+
};
|
|
84435
|
+
const has2 = async (target) => import_promises28.default.stat(target).then(() => true, () => false);
|
|
84436
|
+
if (kind === "skill") {
|
|
84437
|
+
for (const dir of unique([skillsDir, localSkillsDir, personalSkillsDir, ...mirroredSkillsDirs])) {
|
|
84438
|
+
if (await has2(import_node_path51.default.join(dir, skillFileName(name))))
|
|
84439
|
+
plan2.local.push(import_node_path51.default.join(dir, skillFileName(name)));
|
|
84440
|
+
if (await has2(import_node_path51.default.join(dir, name, "SKILL.md")))
|
|
84441
|
+
plan2.local.push(import_node_path51.default.join(dir, name));
|
|
84442
|
+
}
|
|
84443
|
+
for (const extra of config2.skills?.paths ?? []) {
|
|
84444
|
+
const dir = resolveSkillDir(extra);
|
|
84445
|
+
if (dir !== void 0 && (await has2(import_node_path51.default.join(dir, skillFileName(name))) || await has2(import_node_path51.default.join(dir, name, "SKILL.md")))) {
|
|
84446
|
+
plan2.notes.push(`Also in ${dir}, a folder you added in Settings -> Skills - not removed; delete it there.`);
|
|
84447
|
+
}
|
|
84448
|
+
}
|
|
84449
|
+
} else {
|
|
84450
|
+
for (const dir of unique([pythonFolders(config2).toolsDir, localToolsDir(config2), personalToolsDir, ...mirroredToolsDirs])) {
|
|
84451
|
+
if (await has2(import_node_path51.default.join(dir, toolFileName(name))))
|
|
84452
|
+
plan2.local.push(import_node_path51.default.join(dir, toolFileName(name)));
|
|
84453
|
+
}
|
|
84454
|
+
}
|
|
84455
|
+
const mirrors = (kind === "skill" ? cachedSkillMirrors : cachedToolMirrors).filter((mirror) => mirror.enabled === true);
|
|
84456
|
+
for (const mirror of mirrors) {
|
|
84457
|
+
const target = targetById(cachedS3, mirror.connectionId);
|
|
84458
|
+
if (target === void 0) {
|
|
84459
|
+
plan2.notes.push(`The bucket connection "${mirror.connectionId}" is unusable - its copy, if any, cannot be checked.`);
|
|
84460
|
+
continue;
|
|
84461
|
+
}
|
|
84462
|
+
try {
|
|
84463
|
+
const options = { target, ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}, name };
|
|
84464
|
+
const keys = kind === "skill" ? await skillKeysInBucket(options) : await toolKeysInBucket(options);
|
|
84465
|
+
if (keys.length === 0)
|
|
84466
|
+
continue;
|
|
84467
|
+
if (target.readOnly === true) {
|
|
84468
|
+
plan2.notes.push(`In ${target.label}, which is configured read-only - not removed there.`);
|
|
84469
|
+
continue;
|
|
84470
|
+
}
|
|
84471
|
+
plan2.buckets.push({ connectionId: mirror.connectionId, ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}, label: target.label, keys });
|
|
84472
|
+
} catch (error51) {
|
|
84473
|
+
plan2.notes.push(`${target.label} could not be listed: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
84474
|
+
}
|
|
84475
|
+
}
|
|
84476
|
+
if ("dirs" in team) {
|
|
84477
|
+
plan2.repo = await repoFilesOf({ folder: team.settings.folder, stateFile: team.stateFile, mirror: team.dirs, kind: kind === "skill" ? "skills" : "tools", name });
|
|
84478
|
+
plan2.repoLabel = `${team.settings.project}/${team.settings.repo} (${team.settings.branch})`;
|
|
84479
|
+
}
|
|
84480
|
+
if (plan2.local.length === 0 && plan2.buckets.length === 0 && plan2.repo.length === 0)
|
|
84481
|
+
plan2.error = `No ${kind} called "${name}" was found to delete.`;
|
|
84482
|
+
return plan2;
|
|
84483
|
+
}
|
|
84484
|
+
async function handlePreviewDeleteEverywhere(kind, name) {
|
|
84485
|
+
post({ type: "deleteEverywherePlan", plan: await planDeleteEverywhere(kind, name) });
|
|
84486
|
+
}
|
|
84487
|
+
async function handleDeleteEverywhere(requested2) {
|
|
84488
|
+
const { kind, name } = requested2;
|
|
84489
|
+
const done = (ok, message4) => post({ type: "deleteEverywhereDone", kind, name, ok, message: message4 });
|
|
84490
|
+
try {
|
|
84491
|
+
const config2 = await loadSettings();
|
|
84492
|
+
const team = teamRepoPlan(config2);
|
|
84493
|
+
if ("dirs" in team && requested2.repo.length > 0)
|
|
84494
|
+
await handleTeamRepoSync("before deleting everywhere");
|
|
84495
|
+
const fresh = await planDeleteEverywhere(kind, name);
|
|
84496
|
+
const parts = [];
|
|
84497
|
+
if ("dirs" in team) {
|
|
84498
|
+
const repoPaths = requested2.repo.filter((repoPath) => fresh.repo.includes(repoPath));
|
|
84499
|
+
if (repoPaths.length > 0) {
|
|
84500
|
+
const result = await tombstoneInRepo({
|
|
84501
|
+
api: await teamRepoFiles(team.settings),
|
|
84502
|
+
branch: team.settings.branch,
|
|
84503
|
+
folder: team.settings.folder,
|
|
84504
|
+
stateFile: team.stateFile,
|
|
84505
|
+
mirror: team.dirs,
|
|
84506
|
+
repoPaths,
|
|
84507
|
+
who: cachedAttribution.author ?? "someone"
|
|
84508
|
+
});
|
|
84509
|
+
if (result.failed !== void 0) {
|
|
84510
|
+
done(false, `Not deleted: the repository refused ${result.failed.path} (${result.failed.problem}). Nothing else was removed, so it stays consistent - try again.`);
|
|
84511
|
+
return;
|
|
84512
|
+
}
|
|
84513
|
+
parts.push(`Marked deleted in the team repository ${fresh.repoLabel ?? ""} (${String(result.done.length)} file(s)); colleagues' copies go at their next sync.`);
|
|
84514
|
+
}
|
|
84515
|
+
}
|
|
84516
|
+
for (const bucket of requested2.buckets) {
|
|
84517
|
+
const mirror = (kind === "skill" ? cachedSkillMirrors : cachedToolMirrors).find((entry) => entry.connectionId === bucket.connectionId && (entry.prefix ?? "") === (bucket.prefix ?? ""));
|
|
84518
|
+
const target = mirror !== void 0 ? targetById(cachedS3, mirror.connectionId) : void 0;
|
|
84519
|
+
if (mirror === void 0 || target === void 0) {
|
|
84520
|
+
parts.push(`${bucket.label}: no longer configured - skipped.`);
|
|
84521
|
+
continue;
|
|
84522
|
+
}
|
|
84523
|
+
const options = { target, ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}, name, keys: bucket.keys };
|
|
84524
|
+
const result = kind === "skill" ? await removeSkillFromBucket(options) : await removeToolFromBucket(options);
|
|
84525
|
+
parts.push(`${target.label}: removed ${String(result.removed.length)} object(s)${result.failed.length > 0 ? `, ${String(result.failed.length)} failed (${result.failed.map((each) => each.key).join(", ")})` : ""}.`);
|
|
84526
|
+
}
|
|
84527
|
+
const local = requested2.local.filter((entry) => fresh.local.some((allowed) => samePath(allowed, entry)));
|
|
84528
|
+
const localProblems = [];
|
|
84529
|
+
for (const entry of local) {
|
|
84530
|
+
try {
|
|
84531
|
+
await import_promises28.default.rm(entry, { recursive: true, force: true });
|
|
84532
|
+
if (kind === "tool")
|
|
84533
|
+
await forgetTool(import_node_path51.default.dirname(entry), name).catch(() => void 0);
|
|
84534
|
+
} catch (error51) {
|
|
84535
|
+
localProblems.push(`${entry} (${error51 instanceof Error ? error51.message : String(error51)})`);
|
|
84536
|
+
}
|
|
84537
|
+
}
|
|
84538
|
+
if (local.length > 0)
|
|
84539
|
+
parts.push(`Removed ${String(local.length - localProblems.length)} cop${local.length === 1 ? "y" : "ies"} on this computer.`);
|
|
84540
|
+
if (localProblems.length > 0)
|
|
84541
|
+
parts.push(`Could not remove: ${localProblems.join("; ")}.`);
|
|
84542
|
+
if (kind === "skill") {
|
|
84543
|
+
await refreshSkills();
|
|
84544
|
+
void postSkills();
|
|
84545
|
+
} else {
|
|
84546
|
+
await python.refresh();
|
|
84547
|
+
await postPython();
|
|
84548
|
+
}
|
|
84549
|
+
await postTeamRepo();
|
|
84550
|
+
logger.info(`delete everywhere: ${kind} ${name} - ${parts.join(" ")}`);
|
|
84551
|
+
done(localProblems.length === 0, parts.length > 0 ? parts.join(" ") : "Nothing was left to remove.");
|
|
84552
|
+
} catch (error51) {
|
|
84553
|
+
done(false, error51 instanceof Error ? error51.message : String(error51));
|
|
84554
|
+
}
|
|
84555
|
+
}
|
|
84314
84556
|
let cachedTeamRepoLabel;
|
|
84315
84557
|
function sharedWith(kind) {
|
|
84316
84558
|
const mirrors = kind === "skills" ? cachedSkillMirrors : cachedToolMirrors;
|
|
@@ -84459,18 +84701,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84459
84701
|
}
|
|
84460
84702
|
teamRepoSyncing = true;
|
|
84461
84703
|
await postTeamRepo();
|
|
84462
|
-
const repoRef = { project: plan2.settings.project, repo: plan2.settings.repo };
|
|
84463
84704
|
try {
|
|
84464
|
-
const
|
|
84465
|
-
const api = {
|
|
84466
|
-
branchHead: (branch) => client.branchHead(repoRef, branch),
|
|
84467
|
-
defaultBranch: () => client.defaultBranch(repoRef),
|
|
84468
|
-
createBranch: (name, startPoint) => client.createBranch(repoRef, name, startPoint),
|
|
84469
|
-
listFiles: (folder, at) => client.listFiles(repoRef, folder, at),
|
|
84470
|
-
changes: (since2, until) => client.changes(repoRef, since2, until),
|
|
84471
|
-
readBytes: (file2, at) => client.readBytes(repoRef, file2, at),
|
|
84472
|
-
commitFile: (file2) => client.commitFile(repoRef, file2)
|
|
84473
|
-
};
|
|
84705
|
+
const api = await teamRepoFiles(plan2.settings);
|
|
84474
84706
|
const report = await syncTeamRepo({
|
|
84475
84707
|
api,
|
|
84476
84708
|
branch: plan2.settings.branch,
|
|
@@ -84483,7 +84715,14 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
84483
84715
|
},
|
|
84484
84716
|
mirror: plan2.dirs,
|
|
84485
84717
|
stateFile: plan2.stateFile,
|
|
84486
|
-
author: cachedAttribution.author ?? "someone"
|
|
84718
|
+
author: cachedAttribution.author ?? "someone",
|
|
84719
|
+
// Folders Light Code syncs itself: an unchanged copy there of something deleted for the team goes.
|
|
84720
|
+
removable: [
|
|
84721
|
+
...mirroredSkillsDirs.filter((dir) => !samePath(dir, plan2.dirs.skills)),
|
|
84722
|
+
...mirroredToolsDirs.filter((dir) => !samePath(dir, plan2.dirs.tools)),
|
|
84723
|
+
plan2.own.skills,
|
|
84724
|
+
plan2.own.tools
|
|
84725
|
+
]
|
|
84487
84726
|
});
|
|
84488
84727
|
lastTeamRepoSync = Date.now();
|
|
84489
84728
|
teamRepoStatus = {
|
|
@@ -88084,6 +88323,10 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
88084
88323
|
reportFailure("handleSaveTeamRepo", handleSaveTeamRepo(message4.settings));
|
|
88085
88324
|
} else if (message4.type === "syncTeamRepo") {
|
|
88086
88325
|
reportFailure("handleTeamRepoSync", handleTeamRepoSync("asked"));
|
|
88326
|
+
} else if (message4.type === "previewDeleteEverywhere") {
|
|
88327
|
+
reportFailure("handlePreviewDeleteEverywhere", handlePreviewDeleteEverywhere(message4.kind, message4.name));
|
|
88328
|
+
} else if (message4.type === "deleteEverywhere") {
|
|
88329
|
+
reportFailure("handleDeleteEverywhere", handleDeleteEverywhere(message4.plan));
|
|
88087
88330
|
} else if (message4.type === "retireS3Buckets") {
|
|
88088
88331
|
reportFailure("handleRetireS3Buckets", handleRetireS3Buckets(message4.confirm));
|
|
88089
88332
|
} else if (message4.type === "saveTeamSkillSelection") {
|
|
@@ -90435,7 +90678,7 @@ alert about.
|
|
|
90435
90678
|
{
|
|
90436
90679
|
id: "skills",
|
|
90437
90680
|
title: "Skills: teaching it things it cannot work out",
|
|
90438
|
-
keywords: ["skill", "teach", "instructions", "standing", "always", "master skill", "markdown", "edit skill", "editor", "edit standing instructions", "standing instructions", "edit a skill", "placeholder", "placeholders", "skill defaults", "default values", "skill inputs", "stop asking", "keep skill private", "which skills to send", "keep to myself"],
|
|
90681
|
+
keywords: ["skill", "teach", "instructions", "standing", "always", "master skill", "markdown", "edit skill", "editor", "edit standing instructions", "standing instructions", "edit a skill", "placeholder", "placeholders", "skill defaults", "default values", "skill inputs", "stop asking", "keep skill private", "which skills to send", "keep to myself", "delete everywhere", "force delete", "delete a skill for the team", "only me", "personal skill"],
|
|
90439
90682
|
body: `
|
|
90440
90683
|
A skill is markdown with frontmatter (\`name\`, \`description\`), kept in the workspace so it lands
|
|
90441
90684
|
in git and gets reviewed. **Settings \u2192 Skills.**
|
|
@@ -90467,8 +90710,19 @@ and the assistant copies it into the workspace with \`use_skill_file\` rather th
|
|
|
90467
90710
|
bytes into the conversation. Describe each file in one line in the skill body; a file nobody
|
|
90468
90711
|
described is one the assistant will never know to reach for.
|
|
90469
90712
|
|
|
90470
|
-
**
|
|
90471
|
-
|
|
90713
|
+
**Delete everywhere.** Each skill in Settings -> Skills, and each tool in Settings -> Python, has
|
|
90714
|
+
**Delete everywhere**: it first lists exactly what will go - every copy on this computer, the objects in
|
|
90715
|
+
each S3 bucket folder, and its files in the team repository - and only the second press removes them. The
|
|
90716
|
+
repository cannot delete a file over Bitbucket's REST API, so each file is replaced by a one-line
|
|
90717
|
+
"deleted by you on <date>" marker; history keeps the old version, and every Light Code treats it as gone:
|
|
90718
|
+
colleagues' unchanged copies in folders Light Code syncs are removed at their next sync, and a copy someone
|
|
90719
|
+
changed, or keeps in their own project folder, is reported rather than removed. The repository goes first:
|
|
90720
|
+
if it refuses (someone changed the file meanwhile), nothing else is removed - press Sync now and try again.
|
|
90721
|
+
Writing a new skill or tool of the same name brings it back. It is a button only: the assistant cannot
|
|
90722
|
+
delete for the team. On a shared server only an admin may.
|
|
90723
|
+
|
|
90724
|
+
**Only me, or the team.** A new skill or Python tool is **for the team** unless you say it is personal
|
|
90725
|
+
("just for me", "keep it private") - the assistant does not ask. **Only me** keeps it in your personal folder on this computer
|
|
90472
90726
|
(%LOCALAPPDATA%\\light-code\\personal) - used in every project, in VS Code, Fire Code and the Node host
|
|
90473
90727
|
alike, and never uploaded to a bucket, committed to the team repository or sent to the team skills
|
|
90474
90728
|
pool. **The team** saves it where your team shares: committed to the team repository and/or uploaded
|
|
@@ -91274,6 +91528,8 @@ identical content, which is agreement, not a conflict; an edit someone makes in
|
|
|
91274
91528
|
by the next sync. The same name in two folders here is one file when identical; when the copies differ,
|
|
91275
91529
|
the one Light Code uses is committed and the other is listed.
|
|
91276
91530
|
|
|
91531
|
+
**Deleting one for the team.** Use **Delete everywhere** on the skill (Settings -> Skills) or tool (Settings -> Python): it lists every copy - this computer, S3 bucket folders, the repository - before removing them, and replaces the repository file with a "deleted" marker that every Light Code honours. See the skills topic for the details.
|
|
91532
|
+
|
|
91277
91533
|
**Where new ones are saved.** While the repository is on, new skills and Python tools are saved in a
|
|
91278
91534
|
folder of its own outside the project (the panel shows the path), so they never land in the project's git.
|
|
91279
91535
|
A folder you chose in Settings -> Skills or Settings -> Python, or an S3 bucket folder marked "Publish",
|
|
@@ -94759,6 +95015,36 @@ async function removeSkillFromBucket(options) {
|
|
|
94759
95015
|
}
|
|
94760
95016
|
return result;
|
|
94761
95017
|
}
|
|
95018
|
+
function belongsToTool(key2, where, name) {
|
|
95019
|
+
return key2.startsWith(where) && key2.slice(where.length) === `${name}.py`;
|
|
95020
|
+
}
|
|
95021
|
+
async function toolKeysInBucket(options) {
|
|
95022
|
+
const base = normalisePrefix(options.target.prefix);
|
|
95023
|
+
const where = normalisePrefix(`${base}${options.prefix ?? ""}`);
|
|
95024
|
+
const objects = await options.target.client.list(where, 1e3, options.signal);
|
|
95025
|
+
return objects.map((object3) => object3.key).filter((key2) => belongsToTool(key2, where, options.name)).sort();
|
|
95026
|
+
}
|
|
95027
|
+
async function removeToolFromBucket(options) {
|
|
95028
|
+
if (options.target.readOnly === true) {
|
|
95029
|
+
throw new Error(`${options.target.label} is configured read-only, so nothing can be deleted from it.`);
|
|
95030
|
+
}
|
|
95031
|
+
const base = normalisePrefix(options.target.prefix);
|
|
95032
|
+
const where = normalisePrefix(`${base}${options.prefix ?? ""}`);
|
|
95033
|
+
const result = { removed: [], failed: [], rejected: [] };
|
|
95034
|
+
for (const key2 of options.keys) {
|
|
95035
|
+
if (!belongsToTool(key2, where, options.name)) {
|
|
95036
|
+
result.rejected.push(key2);
|
|
95037
|
+
continue;
|
|
95038
|
+
}
|
|
95039
|
+
try {
|
|
95040
|
+
await options.target.client.remove(key2, options.signal);
|
|
95041
|
+
result.removed.push(key2);
|
|
95042
|
+
} catch (error51) {
|
|
95043
|
+
result.failed.push({ key: key2, problem: error51 instanceof Error ? error51.message : String(error51) });
|
|
95044
|
+
}
|
|
95045
|
+
}
|
|
95046
|
+
return result;
|
|
95047
|
+
}
|
|
94762
95048
|
|
|
94763
95049
|
// src/reachableHosts.ts
|
|
94764
95050
|
var import_node_os7 = __toESM(require("node:os"), 1);
|
|
@@ -94955,6 +95241,8 @@ var ADMIN_ONLY_MESSAGES = [
|
|
|
94955
95241
|
* else's bucket folder is not a normal user's business either.
|
|
94956
95242
|
*/
|
|
94957
95243
|
"previewBucketSkillDelete",
|
|
95244
|
+
// Lists what "Delete everywhere" would remove from shared buckets and the team repository.
|
|
95245
|
+
"previewDeleteEverywhere",
|
|
94958
95246
|
// Processes this machine will spawn.
|
|
94959
95247
|
"saveMcpServer",
|
|
94960
95248
|
"saveMcpServers",
|