@artifactshare/cli 0.19.1 → 0.20.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/CHANGELOG.md +10 -1
- package/README.md +34 -24
- package/dist/cli.js +683 -114
- package/package.json +1 -1
- package/skills/artifactshare/SKILL.md +86 -607
- package/skills/artifactshare/references/authentication-profiles-skills.md +72 -0
- package/skills/artifactshare/references/comments.md +64 -0
- package/skills/artifactshare/references/local-write-recovery.md +35 -0
- package/skills/artifactshare/references/organize-settings.md +109 -0
- package/skills/artifactshare/references/preview.md +155 -0
- package/skills/artifactshare/references/rest-api-only.md +76 -0
- package/skills/artifactshare/references/static-sites.md +39 -0
- package/skills/artifactshare/references/upload-path-safety.md +18 -0
- package/skills/artifactshare/references/version-labels.md +30 -0
- package/skills/artifactshare/artifactshare.mdc +0 -351
package/dist/cli.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { C as defaultPreviewNotificationRegistration, D as isPreviewAnchor, O as isPreviewAnnotation, S as createPreviewNotificationCoordinator, T as PREVIEW_MUTATION_HEADER, _ as resolveLiveSession, a as annotationsFilePath, b as updateSessionNotificationRegistration, c as isSessionId, d as previewsDir, f as probeSession, g as removeSessionFile, h as releaseStaleClaim, i as cursorNotificationRegistration, k as isPreviewDoneItemInput, l as previewIdentityPath, m as readSessionFile, n as CURSOR_ACP_NOTIFICATION_TIMEOUT_MS, o as claimSessionStart, p as processAlive, r as createCursorAcpAdapter, s as isConnectionRefused, u as previewRealpath, v as sessionIdForPath, w as samePreviewNotificationRegistration, x as writeSessionFile, y as tokenFingerprint } from "./cursor-notification-Hz6fuACK.js";
|
|
2
2
|
import { chmodSync, constants, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, watch, writeFileSync } from "node:fs";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
3
4
|
import { cli, define, lazy } from "gunshi";
|
|
4
5
|
import { generate } from "gunshi/generator";
|
|
5
6
|
import { z } from "zod";
|
|
6
7
|
import { execFile, spawn } from "node:child_process";
|
|
7
8
|
import * as fs from "node:fs/promises";
|
|
8
|
-
import { chmod, lstat, mkdir, readFile, realpath,
|
|
9
|
+
import { chmod, lstat, mkdir, readFile, readdir, realpath, rename, rmdir, stat, unlink, writeFile } from "node:fs/promises";
|
|
9
10
|
import { arch, homedir, platform } from "node:os";
|
|
10
11
|
import path, { basename, dirname, extname, join, relative, resolve, sep } from "node:path";
|
|
11
12
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -708,6 +709,83 @@ const PROJECT_EDIT_RESPONSE_SCHEMA = ProjectEditResponseSchema;
|
|
|
708
709
|
const CLI_EDIT_RESPONSE_SCHEMA = CliEditResponseSchema;
|
|
709
710
|
const CLI_MOVE_RESPONSE_SCHEMA = CliMoveResponseSchema;
|
|
710
711
|
const RESOLVE_RESPONSE_SCHEMA = ResolveResponseSchema;
|
|
712
|
+
const SkillLegacyDiagnosticSchema = z.object({
|
|
713
|
+
path: z.string(),
|
|
714
|
+
present: z.boolean(),
|
|
715
|
+
managed: z.boolean(),
|
|
716
|
+
coexistence: z.boolean(),
|
|
717
|
+
hint: z.string().nullable()
|
|
718
|
+
});
|
|
719
|
+
const LocalSkillTargetSchema = z.object({
|
|
720
|
+
folder_path: z.string().nullable(),
|
|
721
|
+
complete: z.boolean(),
|
|
722
|
+
current: z.boolean(),
|
|
723
|
+
older_version: z.boolean(),
|
|
724
|
+
missing_files: z.array(z.string()),
|
|
725
|
+
different_files: z.array(z.string()),
|
|
726
|
+
modified_files: z.array(z.string()),
|
|
727
|
+
ownership_manifest: z.enum([
|
|
728
|
+
"valid",
|
|
729
|
+
"absent",
|
|
730
|
+
"invalid"
|
|
731
|
+
]),
|
|
732
|
+
legacy_rule: SkillLegacyDiagnosticSchema.optional()
|
|
733
|
+
}).extend({
|
|
734
|
+
tool: z.string(),
|
|
735
|
+
scope: z.string(),
|
|
736
|
+
path: z.string().nullable(),
|
|
737
|
+
available: z.boolean().optional(),
|
|
738
|
+
code: z.string().optional(),
|
|
739
|
+
hint: z.string().optional(),
|
|
740
|
+
installed: z.boolean(),
|
|
741
|
+
managed: z.boolean(),
|
|
742
|
+
installed_version: z.number().nullable(),
|
|
743
|
+
update_available: z.boolean()
|
|
744
|
+
});
|
|
745
|
+
z.object({
|
|
746
|
+
bundled_version: z.number(),
|
|
747
|
+
targets: z.array(LocalSkillTargetSchema.extend({ detected: z.boolean() }))
|
|
748
|
+
});
|
|
749
|
+
z.object({
|
|
750
|
+
bundled_version: z.number(),
|
|
751
|
+
update_available: z.boolean(),
|
|
752
|
+
update_command: z.string().nullable(),
|
|
753
|
+
targets: z.array(LocalSkillTargetSchema.extend({ update_command: z.string().nullable() }))
|
|
754
|
+
});
|
|
755
|
+
const SkillLegacyActionSchema = z.object({
|
|
756
|
+
path: z.string(),
|
|
757
|
+
action: z.enum([
|
|
758
|
+
"removed",
|
|
759
|
+
"would_remove",
|
|
760
|
+
"kept_unmanaged",
|
|
761
|
+
"remove_failed"
|
|
762
|
+
]),
|
|
763
|
+
hint: z.string().optional()
|
|
764
|
+
});
|
|
765
|
+
const SkillsActionTargetSchema = z.object({
|
|
766
|
+
tool: z.string(),
|
|
767
|
+
scope: z.string(),
|
|
768
|
+
path: z.string().nullable(),
|
|
769
|
+
folder_path: z.string().nullable(),
|
|
770
|
+
action: z.enum([
|
|
771
|
+
"installed",
|
|
772
|
+
"updated",
|
|
773
|
+
"update_recommended",
|
|
774
|
+
"unchanged",
|
|
775
|
+
"removed",
|
|
776
|
+
"not_installed",
|
|
777
|
+
"skipped_unmanaged",
|
|
778
|
+
"skipped"
|
|
779
|
+
]),
|
|
780
|
+
update_command: z.string().optional(),
|
|
781
|
+
code: z.string().optional(),
|
|
782
|
+
hint: z.string().optional(),
|
|
783
|
+
legacy_rule: SkillLegacyActionSchema.optional()
|
|
784
|
+
});
|
|
785
|
+
z.object({
|
|
786
|
+
dry_run: z.boolean(),
|
|
787
|
+
targets: z.array(SkillsActionTargetSchema)
|
|
788
|
+
});
|
|
711
789
|
//#endregion
|
|
712
790
|
//#region src/constants.ts
|
|
713
791
|
const DEFAULT_BASE_URL = "https://artifactshare.com";
|
|
@@ -1470,9 +1548,9 @@ function configHomeUnavailableError(profile) {
|
|
|
1470
1548
|
function skillUpdateConflictError(path) {
|
|
1471
1549
|
return cliError({
|
|
1472
1550
|
code: "skill_update_conflict",
|
|
1473
|
-
message: `The
|
|
1474
|
-
why: "Artifact Share
|
|
1475
|
-
hint: "Inspect the
|
|
1551
|
+
message: `The skill folder at ${path} has an ownership or path conflict.`,
|
|
1552
|
+
why: "Artifact Share requires a managed entry, valid ownership metadata, regular owned files, and no unowned path collisions.",
|
|
1553
|
+
hint: "Inspect the skill folder and repair invalid metadata or unsafe paths before reinstalling. Use skills install --tool <tool> --force only to take over bundled paths; user additions are preserved.",
|
|
1476
1554
|
agentRecoverable: false,
|
|
1477
1555
|
requiresHuman: true,
|
|
1478
1556
|
recovery: { kind: "ask_human" },
|
|
@@ -4144,6 +4222,266 @@ async function runArtifactsList(parsed, mode) {
|
|
|
4144
4222
|
return writeSuccess(command, body, mode);
|
|
4145
4223
|
}
|
|
4146
4224
|
//#endregion
|
|
4225
|
+
//#region src/command-runners/skill-folder.ts
|
|
4226
|
+
const MANIFEST = ".artifactshare-managed.json";
|
|
4227
|
+
function managedState(content) {
|
|
4228
|
+
if (content === null) return { kind: "missing" };
|
|
4229
|
+
if (!content.includes("artifactshare-skill")) return { kind: "unmanaged" };
|
|
4230
|
+
const block = content.match(/<!--\s*artifactshare-skill([\s\S]*?)-->/)?.[1];
|
|
4231
|
+
const version = block?.match(/(?:^|\n)\s*version:\s*(\d+)\s*(?:\n|$)/)?.[1];
|
|
4232
|
+
if (version === void 0 || !/(?:^|\n)\s*managed:\s*true\s*(?:\n|$)/.test(block ?? "") || !Number.isSafeInteger(Number(version))) return { kind: "broken" };
|
|
4233
|
+
return {
|
|
4234
|
+
kind: "managed",
|
|
4235
|
+
version: Number(version)
|
|
4236
|
+
};
|
|
4237
|
+
}
|
|
4238
|
+
const hash = (text) => createHash("sha256").update(text).digest("hex");
|
|
4239
|
+
const validPath = (path) => (path === "SKILL.md" || path.startsWith("references/")) && !/[\\:]/.test(path) && path.split("/").every((part) => part !== "" && part !== "." && part !== "..");
|
|
4240
|
+
async function info(path) {
|
|
4241
|
+
try {
|
|
4242
|
+
return await lstat(path);
|
|
4243
|
+
} catch (error) {
|
|
4244
|
+
if (error.code === "ENOENT") return null;
|
|
4245
|
+
throw error;
|
|
4246
|
+
}
|
|
4247
|
+
}
|
|
4248
|
+
async function rootFor(entry) {
|
|
4249
|
+
const config = dirname(dirname(dirname(entry)));
|
|
4250
|
+
const root = await realpath(config).catch(() => config);
|
|
4251
|
+
return join(root, "skills", "artifactshare");
|
|
4252
|
+
}
|
|
4253
|
+
async function safe(root, relative, retiredAncestors = /* @__PURE__ */ new Set(), replacedDirectories = /* @__PURE__ */ new Set()) {
|
|
4254
|
+
const parts = [
|
|
4255
|
+
dirname(root),
|
|
4256
|
+
root,
|
|
4257
|
+
...relative.split("/").map((_, i, all) => join(root, ...all.slice(0, i + 1)))
|
|
4258
|
+
];
|
|
4259
|
+
for (let i = 0; i < parts.length; i++) {
|
|
4260
|
+
const item = await info(parts[i]);
|
|
4261
|
+
if (i < parts.length - 1 && item?.isFile() && retiredAncestors.has(parts[i])) return;
|
|
4262
|
+
if (i === parts.length - 1 && item?.isDirectory() && replacedDirectories.has(parts[i])) continue;
|
|
4263
|
+
if (item && (item.isSymbolicLink() || (i === parts.length - 1 ? !item.isFile() : !item.isDirectory()))) throw new Error(`Unsafe skill path (type change or link): ${parts[i]}. Inspect the path and reinstall the skill.`);
|
|
4264
|
+
}
|
|
4265
|
+
}
|
|
4266
|
+
async function bytesAt(root, path) {
|
|
4267
|
+
await safe(root, path);
|
|
4268
|
+
return await readFile(join(root, path)).catch((error) => {
|
|
4269
|
+
if (error.code === "ENOENT") return null;
|
|
4270
|
+
throw error;
|
|
4271
|
+
});
|
|
4272
|
+
}
|
|
4273
|
+
async function textAt(root, path) {
|
|
4274
|
+
return (await bytesAt(root, path))?.toString("utf8") ?? null;
|
|
4275
|
+
}
|
|
4276
|
+
async function stateAt(root) {
|
|
4277
|
+
try {
|
|
4278
|
+
return managedState(await textAt(root, "SKILL.md"));
|
|
4279
|
+
} catch {
|
|
4280
|
+
return { kind: "broken" };
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
async function readSkillState(entry) {
|
|
4284
|
+
return stateAt(await rootFor(entry));
|
|
4285
|
+
}
|
|
4286
|
+
async function loadSkillBundle(root) {
|
|
4287
|
+
const files = {};
|
|
4288
|
+
const visit = async (relative) => {
|
|
4289
|
+
const path = join(root, relative);
|
|
4290
|
+
const item = await info(path);
|
|
4291
|
+
if (!item) return;
|
|
4292
|
+
if (item.isDirectory()) for (const name of (await readdir(path)).sort()) await visit(`${relative}/${name}`);
|
|
4293
|
+
else if (item.isFile() && validPath(relative)) files[relative] = await readFile(path, "utf8");
|
|
4294
|
+
else throw new Error(`Invalid bundled skill path: ${relative}`);
|
|
4295
|
+
};
|
|
4296
|
+
await visit("SKILL.md");
|
|
4297
|
+
await visit("references");
|
|
4298
|
+
const state = managedState(files["SKILL.md"] ?? null);
|
|
4299
|
+
if (state.kind !== "managed") throw new Error("The bundled SKILL.md has a missing or invalid managed marker.");
|
|
4300
|
+
if (new Set(Object.keys(files).map((path) => path.toLowerCase())).size !== Object.keys(files).length) throw new Error("Colliding bundled skill paths.");
|
|
4301
|
+
return {
|
|
4302
|
+
files,
|
|
4303
|
+
version: state.version
|
|
4304
|
+
};
|
|
4305
|
+
}
|
|
4306
|
+
async function ownership(root, state) {
|
|
4307
|
+
try {
|
|
4308
|
+
const text = await textAt(root, MANIFEST);
|
|
4309
|
+
if (text === null) return { status: "absent" };
|
|
4310
|
+
const value = JSON.parse(text);
|
|
4311
|
+
if (state.kind !== "managed" || value.schema_version !== 1 || value.version !== state.version || !value.files || typeof value.files !== "object" || Array.isArray(value.files) || !Object.hasOwn(value.files, "SKILL.md")) return { status: "invalid" };
|
|
4312
|
+
const paths = Object.keys(value.files);
|
|
4313
|
+
if (new Set(paths.map((path) => path.toLowerCase())).size !== paths.length || !paths.every((path) => validPath(path) && typeof value.files[path] === "string" && /^[a-f0-9]{64}$/.test(value.files[path]))) return { status: "invalid" };
|
|
4314
|
+
return {
|
|
4315
|
+
status: "valid",
|
|
4316
|
+
manifest: value
|
|
4317
|
+
};
|
|
4318
|
+
} catch {
|
|
4319
|
+
return { status: "invalid" };
|
|
4320
|
+
}
|
|
4321
|
+
}
|
|
4322
|
+
async function folderDiagnostics(entry, bundle) {
|
|
4323
|
+
const root = await rootFor(entry);
|
|
4324
|
+
const state = await stateAt(root);
|
|
4325
|
+
const owned = await ownership(root, state);
|
|
4326
|
+
const missing_files = [], different_files = [], modified_files = [];
|
|
4327
|
+
for (const path of Object.keys(bundle.files).sort()) {
|
|
4328
|
+
const text = await bytesAt(root, path).catch(() => null);
|
|
4329
|
+
if (text === null) missing_files.push(path);
|
|
4330
|
+
else if (!text.equals(Buffer.from(bundle.files[path]))) different_files.push(path);
|
|
4331
|
+
}
|
|
4332
|
+
if (owned.manifest) for (const path of Object.keys(owned.manifest.files).sort()) {
|
|
4333
|
+
const text = await bytesAt(root, path).catch(() => null);
|
|
4334
|
+
if (text === null || hash(text) !== owned.manifest.files[path]) modified_files.push(path);
|
|
4335
|
+
}
|
|
4336
|
+
const manifestMatches = owned.manifest !== void 0 && Object.keys(owned.manifest.files).length === Object.keys(bundle.files).length && Object.entries(bundle.files).every(([path, text]) => owned.manifest?.files[path] === hash(text));
|
|
4337
|
+
return {
|
|
4338
|
+
folder_path: dirname(entry),
|
|
4339
|
+
complete: missing_files.length === 0,
|
|
4340
|
+
current: state.kind === "managed" && state.version === bundle.version && !missing_files.length && !different_files.length && owned.status === "valid" && manifestMatches,
|
|
4341
|
+
older_version: state.kind === "managed" && state.version < bundle.version,
|
|
4342
|
+
missing_files,
|
|
4343
|
+
different_files,
|
|
4344
|
+
modified_files,
|
|
4345
|
+
ownership_manifest: owned.status
|
|
4346
|
+
};
|
|
4347
|
+
}
|
|
4348
|
+
async function preflightFolder(entry, bundle, force = false, forceRetirement = force) {
|
|
4349
|
+
const root = await rootFor(entry);
|
|
4350
|
+
const state = await stateAt(root);
|
|
4351
|
+
await safe(root, "SKILL.md");
|
|
4352
|
+
const owned = await ownership(root, state);
|
|
4353
|
+
if (owned.status === "invalid" && !force || !force && state.kind !== "managed" && state.kind !== "missing") throw new Error(`Skill ownership conflict: ${join(root, state.kind === "managed" ? MANIFEST : "SKILL.md")} (${state.kind === "managed" ? "invalid ownership metadata" : "user-edited file"}). Inspect the folder and use skills install --force to reinstall bundled paths.`);
|
|
4354
|
+
const previous = owned.manifest?.files ?? (state.kind === "managed" ? { "SKILL.md": "" } : {});
|
|
4355
|
+
await safe(root, MANIFEST);
|
|
4356
|
+
for (const path of Object.keys(previous)) await safe(root, path);
|
|
4357
|
+
if (!forceRetirement) for (const [path, expected] of Object.entries(previous)) {
|
|
4358
|
+
if (bundle && Object.hasOwn(bundle.files, path)) continue;
|
|
4359
|
+
const bytes = await bytesAt(root, path);
|
|
4360
|
+
if (expected && bytes !== null && hash(bytes) !== expected) throw new Error(`Modified skill file: ${path}. Preserve your edits before removing or retiring this file, or reinstall with skills install --force.`);
|
|
4361
|
+
}
|
|
4362
|
+
const blockers = Object.keys(previous).filter((path) => bundle && !Object.hasOwn(bundle.files, path) && Object.keys(bundle.files).some((next) => next.startsWith(`${path}/`)));
|
|
4363
|
+
const retiredAncestors = new Set(blockers.map((path) => join(root, path)));
|
|
4364
|
+
const replacedDirectories = /* @__PURE__ */ new Set();
|
|
4365
|
+
const checkDirectory = async (relative) => {
|
|
4366
|
+
if (!Object.keys(previous).some((path) => path.startsWith(`${relative}/`))) throw new Error(`Unowned skill directory (type change): ${relative}. Preserve or move this entry before updating.`);
|
|
4367
|
+
for (const name of await readdir(join(root, relative))) {
|
|
4368
|
+
const child = `${relative}/${name}`;
|
|
4369
|
+
const item = await info(join(root, child));
|
|
4370
|
+
if (item?.isDirectory()) await checkDirectory(child);
|
|
4371
|
+
else if (!item?.isFile() || !Object.hasOwn(previous, child)) throw new Error(`Unowned skill file or type change: ${child}. Preserve or move this entry before updating.`);
|
|
4372
|
+
}
|
|
4373
|
+
replacedDirectories.add(join(root, relative));
|
|
4374
|
+
};
|
|
4375
|
+
for (const path of Object.keys(bundle?.files ?? {})) {
|
|
4376
|
+
if (!blockers.some((ancestor) => path.startsWith(`${ancestor}/`))) {
|
|
4377
|
+
await safe(root, path, retiredAncestors, /* @__PURE__ */ new Set([join(root, path)]));
|
|
4378
|
+
if ((await info(join(root, path)))?.isDirectory()) await checkDirectory(path);
|
|
4379
|
+
}
|
|
4380
|
+
await safe(root, path, retiredAncestors, replacedDirectories);
|
|
4381
|
+
if (!Object.hasOwn(previous, path) && !replacedDirectories.has(join(root, path)) && !blockers.some((ancestor) => path.startsWith(`${ancestor}/`)) && await info(join(root, path)) && !force) throw new Error(`Unowned skill file: ${path}. Use skills install --force to take over bundled paths.`);
|
|
4382
|
+
}
|
|
4383
|
+
return {
|
|
4384
|
+
root,
|
|
4385
|
+
previous,
|
|
4386
|
+
blockers,
|
|
4387
|
+
replacedDirectories
|
|
4388
|
+
};
|
|
4389
|
+
}
|
|
4390
|
+
async function prune(root, paths) {
|
|
4391
|
+
const dirs = /* @__PURE__ */ new Set();
|
|
4392
|
+
for (const path of paths) {
|
|
4393
|
+
let dir = dirname(join(root, path));
|
|
4394
|
+
while (dir.startsWith(root) && dir !== root) {
|
|
4395
|
+
dirs.add(dir);
|
|
4396
|
+
dir = dirname(dir);
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
4399
|
+
for (const dir of [...dirs].sort((a, b) => b.length - a.length)) await rmdir(dir).catch(() => {});
|
|
4400
|
+
}
|
|
4401
|
+
async function writeSkillFolder(entry, bundle, force = false, forceRetirement = force) {
|
|
4402
|
+
const { root, previous, blockers, replacedDirectories } = await preflightFolder(entry, bundle, force, forceRetirement);
|
|
4403
|
+
const files = {
|
|
4404
|
+
...bundle.files,
|
|
4405
|
+
[MANIFEST]: JSON.stringify({
|
|
4406
|
+
schema_version: 1,
|
|
4407
|
+
version: bundle.version,
|
|
4408
|
+
files: Object.fromEntries(Object.entries(bundle.files).map(([path, text]) => [path, hash(text)]))
|
|
4409
|
+
}, null, 2) + "\n"
|
|
4410
|
+
};
|
|
4411
|
+
const staged = /* @__PURE__ */ new Map();
|
|
4412
|
+
const backups = /* @__PURE__ */ new Map();
|
|
4413
|
+
const changed = /* @__PURE__ */ new Set();
|
|
4414
|
+
const createdDirectories = [];
|
|
4415
|
+
const removedDirectories = [];
|
|
4416
|
+
const ensureDirectory = async (path) => {
|
|
4417
|
+
if (await info(path)) return;
|
|
4418
|
+
await ensureDirectory(dirname(path));
|
|
4419
|
+
await mkdir(path);
|
|
4420
|
+
createdDirectories.push(path);
|
|
4421
|
+
};
|
|
4422
|
+
for (const path of /* @__PURE__ */ new Set([...Object.keys(previous), ...Object.keys(files)])) {
|
|
4423
|
+
const blocked = blockers.some((ancestor) => path.startsWith(`${ancestor}/`));
|
|
4424
|
+
backups.set(path, !blocked && (await info(join(root, path)))?.isFile() ? await readFile(join(root, path)) : null);
|
|
4425
|
+
}
|
|
4426
|
+
const retire = async (path) => {
|
|
4427
|
+
if (backups.get(path) !== null) {
|
|
4428
|
+
await unlink(join(root, path));
|
|
4429
|
+
changed.add(path);
|
|
4430
|
+
}
|
|
4431
|
+
};
|
|
4432
|
+
const commit = async (path) => {
|
|
4433
|
+
await ensureDirectory(dirname(join(root, path)));
|
|
4434
|
+
await rename(staged.get(path), join(root, path));
|
|
4435
|
+
changed.add(path);
|
|
4436
|
+
};
|
|
4437
|
+
try {
|
|
4438
|
+
for (const [path, text] of Object.entries(files)) {
|
|
4439
|
+
const blocker = blockers.find((ancestor) => path.startsWith(`${ancestor}/`));
|
|
4440
|
+
const stagingDir = dirname(join(root, blocker ?? path));
|
|
4441
|
+
await ensureDirectory(stagingDir);
|
|
4442
|
+
const temp = join(stagingDir, `.artifactshare-${randomUUID()}.tmp`);
|
|
4443
|
+
staged.set(path, temp);
|
|
4444
|
+
await writeFile(temp, text, { flag: "wx" });
|
|
4445
|
+
}
|
|
4446
|
+
const retired = Object.keys(previous).filter((path) => !Object.hasOwn(bundle.files, path));
|
|
4447
|
+
const earlyRetired = new Set(retired.filter((path) => blockers.includes(path) || [...replacedDirectories].some((dir) => join(root, path).startsWith(`${dir}${sep}`))));
|
|
4448
|
+
for (const path of earlyRetired) await retire(path);
|
|
4449
|
+
for (const dir of [...replacedDirectories].sort((a, b) => b.length - a.length)) {
|
|
4450
|
+
await rmdir(dir);
|
|
4451
|
+
removedDirectories.push(dir);
|
|
4452
|
+
}
|
|
4453
|
+
for (const path of Object.keys(bundle.files).filter((relative) => relative !== "SKILL.md").sort()) await commit(path);
|
|
4454
|
+
for (const path of retired) if (!earlyRetired.has(path)) await retire(path);
|
|
4455
|
+
await commit(MANIFEST);
|
|
4456
|
+
await commit("SKILL.md");
|
|
4457
|
+
await prune(root, retired);
|
|
4458
|
+
} catch (error) {
|
|
4459
|
+
for (const path of [...changed].reverse()) if ((await info(join(root, path)))?.isFile()) await unlink(join(root, path));
|
|
4460
|
+
for (const dir of [...createdDirectories].reverse()) await rmdir(dir).catch(() => {});
|
|
4461
|
+
for (const dir of removedDirectories.reverse()) await mkdir(dir, { recursive: true });
|
|
4462
|
+
for (const path of changed) {
|
|
4463
|
+
const bytes = backups.get(path);
|
|
4464
|
+
if (bytes !== null && bytes !== void 0) {
|
|
4465
|
+
await mkdir(dirname(join(root, path)), { recursive: true });
|
|
4466
|
+
await writeFile(join(root, path), bytes);
|
|
4467
|
+
}
|
|
4468
|
+
}
|
|
4469
|
+
throw error;
|
|
4470
|
+
} finally {
|
|
4471
|
+
for (const path of staged.values()) await unlink(path).catch(() => {});
|
|
4472
|
+
for (const dir of [...createdDirectories].reverse()) await rmdir(dir).catch(() => {});
|
|
4473
|
+
}
|
|
4474
|
+
}
|
|
4475
|
+
async function removeSkillFolder(entry) {
|
|
4476
|
+
const { root, previous } = await preflightFolder(entry);
|
|
4477
|
+
for (const path of [...Object.keys(previous), MANIFEST]) await unlink(join(root, path)).catch((error) => {
|
|
4478
|
+
if (error.code !== "ENOENT") throw error;
|
|
4479
|
+
});
|
|
4480
|
+
await prune(root, Object.keys(previous));
|
|
4481
|
+
await rmdir(root).catch(() => {});
|
|
4482
|
+
await rmdir(dirname(root)).catch(() => {});
|
|
4483
|
+
}
|
|
4484
|
+
//#endregion
|
|
4147
4485
|
//#region src/command-runners/skills.ts
|
|
4148
4486
|
const SKILL_TOOLS = [
|
|
4149
4487
|
"codex",
|
|
@@ -4165,26 +4503,77 @@ const TOOL_CONFIG = {
|
|
|
4165
4503
|
detectDirs: [".cursor"]
|
|
4166
4504
|
}
|
|
4167
4505
|
};
|
|
4168
|
-
function scopeTargetConfig(tool,
|
|
4169
|
-
if (tool === "cursor") {
|
|
4170
|
-
if (scope === "project") return {
|
|
4171
|
-
relativePath: join(".cursor", "rules", "artifactshare.mdc"),
|
|
4172
|
-
bundledFile: "artifactshare.mdc",
|
|
4173
|
-
pruneDirs: []
|
|
4174
|
-
};
|
|
4175
|
-
return {
|
|
4176
|
-
relativePath: join(".cursor", "skills", "artifactshare", "SKILL.md"),
|
|
4177
|
-
bundledFile: "SKILL.md",
|
|
4178
|
-
pruneDirs: ["artifactshare", "skills"]
|
|
4179
|
-
};
|
|
4180
|
-
}
|
|
4506
|
+
function scopeTargetConfig(tool, _scope) {
|
|
4181
4507
|
return {
|
|
4182
|
-
relativePath: join(tool === "codex" ? ".agents" : ".claude", SKILL_FILE_PATH),
|
|
4183
|
-
bundledFile: "SKILL.md",
|
|
4508
|
+
relativePath: join(tool === "codex" ? ".agents" : tool === "cursor" ? ".cursor" : ".claude", SKILL_FILE_PATH),
|
|
4184
4509
|
pruneDirs: ["artifactshare", "skills"]
|
|
4185
4510
|
};
|
|
4186
4511
|
}
|
|
4512
|
+
const CLAUDE_CONFIG_HINT = "Set CLAUDE_CONFIG_DIR to a non-empty path or unset it to use ~/.claude.";
|
|
4513
|
+
function claudeUserRoot() {
|
|
4514
|
+
const value = process.env.CLAUDE_CONFIG_DIR;
|
|
4515
|
+
if (value === void 0) return {
|
|
4516
|
+
state: "unset",
|
|
4517
|
+
path: join(homedir(), ".claude")
|
|
4518
|
+
};
|
|
4519
|
+
return value.trim() ? {
|
|
4520
|
+
state: "set",
|
|
4521
|
+
path: resolve(value)
|
|
4522
|
+
} : {
|
|
4523
|
+
state: "blank",
|
|
4524
|
+
path: void 0
|
|
4525
|
+
};
|
|
4526
|
+
}
|
|
4527
|
+
function availableTarget(target) {
|
|
4528
|
+
return target.path !== null;
|
|
4529
|
+
}
|
|
4530
|
+
function unavailableState(target) {
|
|
4531
|
+
return {
|
|
4532
|
+
tool: target.tool,
|
|
4533
|
+
scope: target.scope,
|
|
4534
|
+
path: null,
|
|
4535
|
+
available: false,
|
|
4536
|
+
code: target.error.code,
|
|
4537
|
+
hint: target.error.hint,
|
|
4538
|
+
installed: false,
|
|
4539
|
+
managed: false,
|
|
4540
|
+
installed_version: null,
|
|
4541
|
+
update_available: false,
|
|
4542
|
+
folder_path: null,
|
|
4543
|
+
complete: false,
|
|
4544
|
+
current: false,
|
|
4545
|
+
older_version: false,
|
|
4546
|
+
missing_files: [],
|
|
4547
|
+
different_files: [],
|
|
4548
|
+
modified_files: [],
|
|
4549
|
+
ownership_manifest: "absent"
|
|
4550
|
+
};
|
|
4551
|
+
}
|
|
4552
|
+
function unavailableActionTargets(tools, scope) {
|
|
4553
|
+
return allTargets().filter((target) => !availableTarget(target) && (tools.length === 0 || tools.includes(target.tool)) && scope !== "project");
|
|
4554
|
+
}
|
|
4555
|
+
function unavailableSelection(tools, scope) {
|
|
4556
|
+
if (!tools.includes("claude") || scope !== "user") return void 0;
|
|
4557
|
+
const target = skillTarget("claude", "user");
|
|
4558
|
+
return availableTarget(target) ? void 0 : target.error;
|
|
4559
|
+
}
|
|
4187
4560
|
function skillTarget(tool, scope) {
|
|
4561
|
+
if (tool === "claude" && scope === "user") {
|
|
4562
|
+
const root = claudeUserRoot();
|
|
4563
|
+
if (root.state === "blank") return {
|
|
4564
|
+
tool,
|
|
4565
|
+
scope,
|
|
4566
|
+
path: null,
|
|
4567
|
+
error: validationError("Claude Code user skills are unavailable because CLAUDE_CONFIG_DIR is empty or whitespace-only.", CLAUDE_CONFIG_HINT)
|
|
4568
|
+
};
|
|
4569
|
+
const path = join(root.path, SKILL_FILE_PATH);
|
|
4570
|
+
return {
|
|
4571
|
+
tool,
|
|
4572
|
+
scope,
|
|
4573
|
+
path,
|
|
4574
|
+
absolutePath: path
|
|
4575
|
+
};
|
|
4576
|
+
}
|
|
4188
4577
|
const relative = scopeTargetConfig(tool, scope).relativePath;
|
|
4189
4578
|
const path = scope === "project" ? relative : join(homedir(), relative);
|
|
4190
4579
|
return {
|
|
@@ -4194,44 +4583,47 @@ function skillTarget(tool, scope) {
|
|
|
4194
4583
|
absolutePath: resolve(path)
|
|
4195
4584
|
};
|
|
4196
4585
|
}
|
|
4197
|
-
function bundledContentForTarget(bundled, target) {
|
|
4198
|
-
const file = scopeTargetConfig(target.tool, target.scope).bundledFile;
|
|
4199
|
-
return bundled.contentsByFile[file];
|
|
4200
|
-
}
|
|
4201
4586
|
function allTargets() {
|
|
4202
4587
|
return SKILL_TOOLS.flatMap((tool) => TOOL_CONFIG[tool].scopes.map((scope) => skillTarget(tool, scope)));
|
|
4203
4588
|
}
|
|
4204
|
-
function
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4589
|
+
function readTarget(target) {
|
|
4590
|
+
return readSkillState(target.absolutePath);
|
|
4591
|
+
}
|
|
4592
|
+
function loadBundledSkills() {
|
|
4593
|
+
return loadSkillBundle(fileURLToPath(new URL("../skills/artifactshare/", import.meta.url)));
|
|
4594
|
+
}
|
|
4595
|
+
async function legacyRule(target) {
|
|
4596
|
+
if (target.tool !== "cursor" || target.scope !== "project") return void 0;
|
|
4597
|
+
const path = join(".cursor", "rules", "artifactshare.mdc");
|
|
4598
|
+
const info = await lstat(path).catch(() => null);
|
|
4599
|
+
const parent = await lstat(dirname(path)).catch(() => null);
|
|
4600
|
+
const content = info?.isFile() && !parent?.isSymbolicLink() ? await readFile(path, "utf8").catch(() => null) : null;
|
|
4601
|
+
const present = info !== null;
|
|
4602
|
+
const managed = managedState(content).kind === "managed";
|
|
4211
4603
|
return {
|
|
4212
|
-
|
|
4213
|
-
|
|
4604
|
+
path,
|
|
4605
|
+
present,
|
|
4606
|
+
managed,
|
|
4607
|
+
coexistence: present && await lstat(target.absolutePath).catch(() => null) !== null,
|
|
4608
|
+
hint: present && !managed ? "Inspect the legacy Cursor rule and manually remove it if the skill folder replaces it." : null
|
|
4214
4609
|
};
|
|
4215
4610
|
}
|
|
4216
|
-
async function
|
|
4217
|
-
|
|
4611
|
+
async function legacyManagedVersion(target) {
|
|
4612
|
+
const legacy = await legacyRule(target);
|
|
4613
|
+
if (!legacy?.managed) return void 0;
|
|
4614
|
+
const state = managedState(await readFile(legacy.path, "utf8"));
|
|
4615
|
+
return state.kind === "managed" ? state.version : void 0;
|
|
4218
4616
|
}
|
|
4219
|
-
async function
|
|
4220
|
-
const contentsByFile = {};
|
|
4221
|
-
let version;
|
|
4222
|
-
for (const file of ["SKILL.md", "artifactshare.mdc"]) {
|
|
4223
|
-
const url = new URL(`../skills/artifactshare/${file}`, import.meta.url);
|
|
4224
|
-
const content = await readFile(url, "utf8");
|
|
4225
|
-
const state = managedState(content);
|
|
4226
|
-
if (state.kind !== "managed" || (version ?? state.version) !== state.version) throw new Error(`The bundled ${file} has a missing or mismatched managed marker.`);
|
|
4227
|
-
version = state.version;
|
|
4228
|
-
contentsByFile[file] = content;
|
|
4229
|
-
}
|
|
4617
|
+
async function diagnostic(target, bundle) {
|
|
4230
4618
|
return {
|
|
4231
|
-
|
|
4232
|
-
|
|
4619
|
+
...await folderDiagnostics(target.absolutePath, bundle),
|
|
4620
|
+
folder_path: dirname(target.path),
|
|
4621
|
+
...target.tool === "cursor" && target.scope === "project" ? { legacy_rule: await legacyRule(target) } : {}
|
|
4233
4622
|
};
|
|
4234
4623
|
}
|
|
4624
|
+
async function isCurrent(target, bundle) {
|
|
4625
|
+
return (await folderDiagnostics(target.absolutePath, bundle)).current;
|
|
4626
|
+
}
|
|
4235
4627
|
function parseTools(value, options = {}) {
|
|
4236
4628
|
const raws = arrayOption(value);
|
|
4237
4629
|
const tools = [];
|
|
@@ -4276,12 +4668,16 @@ function parseFilters(parsed, options = {}) {
|
|
|
4276
4668
|
};
|
|
4277
4669
|
}
|
|
4278
4670
|
function filteredTargets(tools, scope) {
|
|
4279
|
-
return allTargets().filter((target) => (tools.length === 0 || tools.includes(target.tool)) && (scope === void 0 || target.scope === scope));
|
|
4671
|
+
return allTargets().filter(availableTarget).filter((target) => (tools.length === 0 || tools.includes(target.tool)) && (scope === void 0 || target.scope === scope));
|
|
4280
4672
|
}
|
|
4281
4673
|
function detectionBase(scope) {
|
|
4282
4674
|
return scope === "project" ? process.cwd() : homedir();
|
|
4283
4675
|
}
|
|
4284
4676
|
async function isToolDetected(tool, scope) {
|
|
4677
|
+
if (tool === "claude" && scope === "user") {
|
|
4678
|
+
const root = claudeUserRoot();
|
|
4679
|
+
return root.state !== "blank" && Boolean((await stat(root.path).catch(() => null))?.isDirectory());
|
|
4680
|
+
}
|
|
4285
4681
|
const base = detectionBase(scope);
|
|
4286
4682
|
for (const dir of TOOL_CONFIG[tool].detectDirs) if ((await stat(join(base, dir)).catch(() => null))?.isDirectory()) return true;
|
|
4287
4683
|
return false;
|
|
@@ -4294,48 +4690,90 @@ async function autoDetectedTools() {
|
|
|
4294
4690
|
];
|
|
4295
4691
|
const detected = [];
|
|
4296
4692
|
for (const tool of autoOrder) if (await isToolDetected(tool, "project")) detected.push(tool);
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4693
|
+
if (detected.length === 0) return {
|
|
4694
|
+
tools: [
|
|
4695
|
+
"codex",
|
|
4696
|
+
"claude",
|
|
4697
|
+
"cursor"
|
|
4698
|
+
],
|
|
4699
|
+
fallback: true
|
|
4700
|
+
};
|
|
4701
|
+
if (!detected.includes("claude") && claudeUserRoot().state === "set" && await isToolDetected("claude", "user")) detected.unshift("claude");
|
|
4702
|
+
return {
|
|
4703
|
+
tools: detected,
|
|
4704
|
+
fallback: false
|
|
4705
|
+
};
|
|
4302
4706
|
}
|
|
4303
4707
|
async function autoTargets(scope) {
|
|
4304
4708
|
const targetScope = scope ?? "user";
|
|
4305
|
-
|
|
4709
|
+
const { tools, fallback } = await autoDetectedTools();
|
|
4710
|
+
return {
|
|
4711
|
+
targets: tools.filter((tool) => TOOL_CONFIG[tool].scopes.includes(targetScope)).map((tool) => skillTarget(tool, targetScope)).filter(availableTarget),
|
|
4712
|
+
fallback
|
|
4713
|
+
};
|
|
4306
4714
|
}
|
|
4307
4715
|
function targetPathKey(target) {
|
|
4308
4716
|
return realpath(target.absolutePath).catch(() => target.absolutePath);
|
|
4309
4717
|
}
|
|
4310
|
-
async function
|
|
4311
|
-
if (content
|
|
4312
|
-
|
|
4313
|
-
|
|
4718
|
+
async function prepareAction(item, dryRun) {
|
|
4719
|
+
if (item.content) {
|
|
4720
|
+
if (item.automatic) {
|
|
4721
|
+
const details = await diagnostic(item.target, item.content);
|
|
4722
|
+
if (details.modified_files.length) throw new Error(`Modified skill files: ${details.modified_files.join(", ")}`);
|
|
4723
|
+
}
|
|
4724
|
+
await preflightFolder(item.target.absolutePath, item.content, item.force, item.forceRetirement);
|
|
4725
|
+
}
|
|
4726
|
+
if (item.action === "removed") await preflightFolder(item.target.absolutePath);
|
|
4727
|
+
const legacy = await legacyRule(item.target);
|
|
4728
|
+
if (legacy?.managed && item.action === "unchanged" && !await isCurrent(item.target, await loadBundledSkills())) {
|
|
4729
|
+
item.action = "update_recommended";
|
|
4314
4730
|
return;
|
|
4315
4731
|
}
|
|
4316
|
-
if (
|
|
4317
|
-
|
|
4318
|
-
|
|
4732
|
+
if (legacy?.present) {
|
|
4733
|
+
if (!legacy.managed) item.legacy = {
|
|
4734
|
+
path: legacy.path,
|
|
4735
|
+
action: "kept_unmanaged",
|
|
4736
|
+
hint: legacy.hint ?? "Inspect the legacy rule."
|
|
4737
|
+
};
|
|
4738
|
+
else if (item.content || item.action === "unchanged" || item.action === "removed" || item.action === "not_installed" || item.removeLegacy) item.legacy = {
|
|
4739
|
+
path: legacy.path,
|
|
4740
|
+
action: dryRun ? "would_remove" : "removed"
|
|
4741
|
+
};
|
|
4319
4742
|
}
|
|
4320
4743
|
}
|
|
4321
|
-
async function
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4744
|
+
async function applyAction(item) {
|
|
4745
|
+
if (item.content) await writeSkillFolder(item.target.absolutePath, item.content, item.force, item.forceRetirement);
|
|
4746
|
+
if (item.action === "removed") await removeSkillFolder(item.target.absolutePath);
|
|
4747
|
+
if (item.legacy?.action === "removed") try {
|
|
4748
|
+
await unlink(item.legacy.path);
|
|
4749
|
+
} catch {
|
|
4750
|
+
item.legacy = {
|
|
4751
|
+
path: item.legacy.path,
|
|
4752
|
+
action: "remove_failed",
|
|
4753
|
+
hint: "Retry skills update --tool cursor --scope project --json to remove the legacy rule."
|
|
4754
|
+
};
|
|
4331
4755
|
}
|
|
4332
4756
|
}
|
|
4333
4757
|
function skillUpdateCommand(target) {
|
|
4334
4758
|
return `${CLI_INVOCATION} skills update --tool ${target.tool} --scope ${target.scope} --json`;
|
|
4335
4759
|
}
|
|
4336
4760
|
async function finishActions(command, planned, dryRun, mode) {
|
|
4761
|
+
for (const item of planned) try {
|
|
4762
|
+
await prepareAction(item, dryRun);
|
|
4763
|
+
} catch (error) {
|
|
4764
|
+
if (item.fallbackAction) {
|
|
4765
|
+
item.action = item.fallbackAction;
|
|
4766
|
+
delete item.content;
|
|
4767
|
+
continue;
|
|
4768
|
+
}
|
|
4769
|
+
const conflict = skillUpdateConflictError(item.target.path);
|
|
4770
|
+
if (error instanceof Error) conflict.hint = error.message;
|
|
4771
|
+
writeFailure(command, conflict, mode, 1);
|
|
4772
|
+
return;
|
|
4773
|
+
}
|
|
4337
4774
|
const completed = [...planned];
|
|
4338
4775
|
if (!dryRun) for (const [index, item] of planned.entries()) try {
|
|
4776
|
+
await prepareAction(item, false);
|
|
4339
4777
|
await applyAction(item);
|
|
4340
4778
|
completed[index] = item;
|
|
4341
4779
|
} catch (error) {
|
|
@@ -4351,18 +4789,31 @@ async function finishActions(command, planned, dryRun, mode) {
|
|
|
4351
4789
|
}
|
|
4352
4790
|
return {
|
|
4353
4791
|
dry_run: dryRun,
|
|
4354
|
-
targets: completed.map(({ target, action }) => ({
|
|
4792
|
+
targets: completed.map(({ target, action, legacy }) => ({
|
|
4355
4793
|
tool: target.tool,
|
|
4356
4794
|
scope: target.scope,
|
|
4357
4795
|
path: target.path,
|
|
4796
|
+
folder_path: dirname(target.path),
|
|
4797
|
+
...legacy ? { legacy_rule: legacy } : {},
|
|
4358
4798
|
action,
|
|
4359
4799
|
...action === "update_recommended" ? { update_command: skillUpdateCommand(target) } : {}
|
|
4360
4800
|
}))
|
|
4361
4801
|
};
|
|
4362
4802
|
}
|
|
4363
|
-
async function runActions(command, planned, dryRun, mode) {
|
|
4803
|
+
async function runActions(command, planned, dryRun, mode, unavailableTargets = []) {
|
|
4364
4804
|
const data = await finishActions(command, planned, dryRun, mode);
|
|
4365
|
-
if (data)
|
|
4805
|
+
if (data) {
|
|
4806
|
+
data.targets.push(...unavailableTargets.map((target) => ({
|
|
4807
|
+
tool: target.tool,
|
|
4808
|
+
scope: target.scope,
|
|
4809
|
+
path: null,
|
|
4810
|
+
folder_path: null,
|
|
4811
|
+
action: "skipped",
|
|
4812
|
+
code: target.error.code,
|
|
4813
|
+
hint: target.error.hint
|
|
4814
|
+
})));
|
|
4815
|
+
writeSuccess(command, data, mode);
|
|
4816
|
+
}
|
|
4366
4817
|
}
|
|
4367
4818
|
async function bundledOrFailure(command, mode) {
|
|
4368
4819
|
try {
|
|
@@ -4385,9 +4836,10 @@ async function runSkillsInstall(parsed, mode) {
|
|
|
4385
4836
|
const planned = [];
|
|
4386
4837
|
for (const tool of tools) {
|
|
4387
4838
|
const target = skillTarget(tool, scope);
|
|
4839
|
+
if (!availableTarget(target)) return writeFailure(command, target.error, mode, 1);
|
|
4388
4840
|
const state = await readTarget(target);
|
|
4389
4841
|
if ((state.kind === "unmanaged" || state.kind === "broken") && !force) return writeFailure(command, skillUpdateConflictError(target.path), mode, 1);
|
|
4390
|
-
if (state.kind === "managed" &&
|
|
4842
|
+
if (state.kind === "managed" && await isCurrent(target, bundled) && !force) {
|
|
4391
4843
|
planned.push({
|
|
4392
4844
|
target,
|
|
4393
4845
|
action: "unchanged"
|
|
@@ -4397,7 +4849,8 @@ async function runSkillsInstall(parsed, mode) {
|
|
|
4397
4849
|
planned.push({
|
|
4398
4850
|
target,
|
|
4399
4851
|
action: state.kind === "missing" ? "installed" : "updated",
|
|
4400
|
-
content:
|
|
4852
|
+
content: bundled,
|
|
4853
|
+
force
|
|
4401
4854
|
});
|
|
4402
4855
|
}
|
|
4403
4856
|
await runActions(command, planned, parsed.options.dryRun === true, mode);
|
|
@@ -4413,9 +4866,14 @@ async function ensureSkills(parsed, mode, options = {}) {
|
|
|
4413
4866
|
writeFailure(command, validationError("--tool is required.", "Pass --tool auto, --tool codex, --tool claude, or --tool cursor; repeat explicit tools for multiple targets."), mode, 1);
|
|
4414
4867
|
return;
|
|
4415
4868
|
}
|
|
4869
|
+
const unavailable = unavailableSelection(filters.tools, filters.scope ?? "project");
|
|
4870
|
+
if (unavailable) {
|
|
4871
|
+
writeFailure(command, unavailable, mode, 1);
|
|
4872
|
+
return;
|
|
4873
|
+
}
|
|
4416
4874
|
const bundled = await bundledOrFailure(command, mode);
|
|
4417
4875
|
if (!bundled) return void 0;
|
|
4418
|
-
const targets = filters.auto ? await autoTargets(filters.scope) : filteredTargets(filters.tools, filters.scope ?? "project");
|
|
4876
|
+
const targets = (filters.auto ? await autoTargets(filters.scope) : void 0)?.targets ?? filteredTargets(filters.tools, filters.scope ?? "project");
|
|
4419
4877
|
const planned = [];
|
|
4420
4878
|
for (const target of targets) {
|
|
4421
4879
|
const state = await readTarget(target);
|
|
@@ -4424,50 +4882,94 @@ async function ensureSkills(parsed, mode, options = {}) {
|
|
|
4424
4882
|
writeFailure(command, skillUpdateConflictError(target.path), mode, 1);
|
|
4425
4883
|
return;
|
|
4426
4884
|
}
|
|
4427
|
-
const
|
|
4885
|
+
const automaticUpdate = filters.auto || options.command === "init" || options.command === "open";
|
|
4886
|
+
if (automaticUpdate && state.kind === "managed" && state.version > bundled.version) continue;
|
|
4887
|
+
const details = await diagnostic(target, bundled);
|
|
4888
|
+
if (automaticUpdate && state.kind === "managed" && details.modified_files.length) {
|
|
4889
|
+
planned.push({
|
|
4890
|
+
target,
|
|
4891
|
+
action: "update_recommended"
|
|
4892
|
+
});
|
|
4893
|
+
continue;
|
|
4894
|
+
}
|
|
4895
|
+
const unchanged = state.kind === "managed" && (state.version >= bundled.version && automaticUpdate || state.version > bundled.version || details.current);
|
|
4428
4896
|
planned.push(unchanged ? {
|
|
4429
4897
|
target,
|
|
4430
4898
|
action: "unchanged"
|
|
4431
4899
|
} : {
|
|
4432
4900
|
target,
|
|
4433
4901
|
action: state.kind === "missing" ? "installed" : "updated",
|
|
4434
|
-
content:
|
|
4902
|
+
content: bundled,
|
|
4903
|
+
automatic: automaticUpdate,
|
|
4904
|
+
...automaticUpdate ? { fallbackAction: "update_recommended" } : {}
|
|
4435
4905
|
});
|
|
4436
4906
|
}
|
|
4437
|
-
if (options.autoUpdateUserManaged) {
|
|
4907
|
+
if (options.autoUpdateUserManaged || filters.auto) {
|
|
4438
4908
|
const plannedPaths = new Set(await Promise.all(planned.map((action) => targetPathKey(action.target))));
|
|
4439
|
-
for (const target of
|
|
4909
|
+
for (const target of await automaticTargets(bundled)) {
|
|
4440
4910
|
if (plannedPaths.has(await targetPathKey(target))) continue;
|
|
4441
4911
|
const state = await readTarget(target);
|
|
4442
|
-
if (state.kind
|
|
4912
|
+
if (state.kind === "managed" && state.version > bundled.version) continue;
|
|
4913
|
+
const details = await diagnostic(target, bundled);
|
|
4914
|
+
if (state.kind === "managed" && details.modified_files.length) {
|
|
4915
|
+
planned.push({
|
|
4916
|
+
target,
|
|
4917
|
+
action: "update_recommended",
|
|
4918
|
+
installedVersion: state.version
|
|
4919
|
+
});
|
|
4920
|
+
continue;
|
|
4921
|
+
}
|
|
4922
|
+
if (target.scope !== "project" && (state.kind !== "managed" || state.version >= bundled.version || await isCurrent(target, bundled))) continue;
|
|
4443
4923
|
planned.push({
|
|
4444
4924
|
target,
|
|
4445
|
-
action: "updated",
|
|
4446
|
-
content:
|
|
4925
|
+
action: state.kind === "managed" && state.version >= bundled.version ? "unchanged" : "updated",
|
|
4926
|
+
...state.kind === "managed" && state.version >= bundled.version ? {} : { content: bundled },
|
|
4927
|
+
automatic: true,
|
|
4447
4928
|
fallbackAction: "update_recommended"
|
|
4448
4929
|
});
|
|
4449
4930
|
}
|
|
4450
4931
|
}
|
|
4451
4932
|
return finishActions(command, planned, parsed.options.dryRun === true, mode);
|
|
4452
4933
|
}
|
|
4934
|
+
async function automaticTargets(bundled) {
|
|
4935
|
+
const targets = allTargets().filter(availableTarget).filter((target) => target.scope === "user");
|
|
4936
|
+
const project = skillTarget("cursor", "project");
|
|
4937
|
+
if (availableTarget(project)) {
|
|
4938
|
+
const version = await legacyManagedVersion(project);
|
|
4939
|
+
if (version !== void 0 && version <= bundled.version) targets.push(project);
|
|
4940
|
+
}
|
|
4941
|
+
return targets;
|
|
4942
|
+
}
|
|
4453
4943
|
async function autoUpdateUserManagedSkills() {
|
|
4454
4944
|
try {
|
|
4455
4945
|
const bundled = await loadBundledSkills();
|
|
4456
4946
|
const planned = [];
|
|
4457
|
-
for (const target of
|
|
4947
|
+
for (const target of await automaticTargets(bundled)) {
|
|
4458
4948
|
const state = await readTarget(target);
|
|
4459
|
-
if (state.kind
|
|
4949
|
+
if (state.kind === "managed" && state.version > bundled.version) continue;
|
|
4950
|
+
const details = await diagnostic(target, bundled);
|
|
4951
|
+
if (state.kind === "managed" && details.modified_files.length) {
|
|
4952
|
+
planned.push({
|
|
4953
|
+
target,
|
|
4954
|
+
action: "update_recommended",
|
|
4955
|
+
installedVersion: state.version
|
|
4956
|
+
});
|
|
4957
|
+
continue;
|
|
4958
|
+
}
|
|
4959
|
+
if (target.scope !== "project" && (state.kind !== "managed" || state.version >= bundled.version || await isCurrent(target, bundled))) continue;
|
|
4460
4960
|
planned.push({
|
|
4461
4961
|
target,
|
|
4462
|
-
action: "updated",
|
|
4463
|
-
content:
|
|
4962
|
+
action: state.kind === "managed" && state.version >= bundled.version ? "unchanged" : "updated",
|
|
4963
|
+
...state.kind === "managed" && state.version >= bundled.version ? {} : { content: bundled },
|
|
4964
|
+
automatic: true,
|
|
4464
4965
|
fallbackAction: "update_recommended",
|
|
4465
|
-
installedVersion: state.version
|
|
4966
|
+
installedVersion: state.kind === "managed" ? state.version : await legacyManagedVersion(target) ?? bundled.version
|
|
4466
4967
|
});
|
|
4467
4968
|
}
|
|
4468
4969
|
if (planned.length === 0) return void 0;
|
|
4469
4970
|
const completed = [...planned];
|
|
4470
4971
|
for (const [index, item] of planned.entries()) try {
|
|
4972
|
+
await prepareAction(item, false);
|
|
4471
4973
|
await applyAction(item);
|
|
4472
4974
|
completed[index] = item;
|
|
4473
4975
|
} catch {
|
|
@@ -4477,11 +4979,13 @@ async function autoUpdateUserManagedSkills() {
|
|
|
4477
4979
|
...item.installedVersion !== void 0 ? { installedVersion: item.installedVersion } : {}
|
|
4478
4980
|
};
|
|
4479
4981
|
}
|
|
4480
|
-
return { targets: completed.map(({ target, action, installedVersion }) => ({
|
|
4982
|
+
return { targets: completed.map(({ target, action, installedVersion, legacy }) => ({
|
|
4481
4983
|
tool: target.tool,
|
|
4482
|
-
scope:
|
|
4984
|
+
scope: target.scope,
|
|
4483
4985
|
path: target.path,
|
|
4484
|
-
|
|
4986
|
+
folder_path: dirname(target.path),
|
|
4987
|
+
...legacy ? { legacy_rule: legacy } : {},
|
|
4988
|
+
action: action === "update_recommended" ? "update_recommended" : "updated",
|
|
4485
4989
|
installed_version: installedVersion ?? bundled.version,
|
|
4486
4990
|
bundled_version: bundled.version,
|
|
4487
4991
|
...action === "update_recommended" ? { update_command: skillUpdateCommand(target) } : {}
|
|
@@ -4499,11 +5003,19 @@ async function runSkillsList(parsed, mode) {
|
|
|
4499
5003
|
if (!bundled) return;
|
|
4500
5004
|
const targets = [];
|
|
4501
5005
|
for (const target of allTargets()) {
|
|
5006
|
+
if (!availableTarget(target)) {
|
|
5007
|
+
targets.push({
|
|
5008
|
+
...unavailableState(target),
|
|
5009
|
+
detected: false
|
|
5010
|
+
});
|
|
5011
|
+
continue;
|
|
5012
|
+
}
|
|
4502
5013
|
const state = await readTarget(target);
|
|
4503
5014
|
targets.push({
|
|
4504
5015
|
tool: target.tool,
|
|
4505
5016
|
scope: target.scope,
|
|
4506
5017
|
path: target.path,
|
|
5018
|
+
...await diagnostic(target, bundled),
|
|
4507
5019
|
detected: await isToolDetected(target.tool, target.scope),
|
|
4508
5020
|
installed: state.kind !== "missing",
|
|
4509
5021
|
managed: state.kind === "managed",
|
|
@@ -4520,8 +5032,22 @@ async function skillDiagnostics() {
|
|
|
4520
5032
|
const bundled = await loadBundledSkills();
|
|
4521
5033
|
const targets = [];
|
|
4522
5034
|
for (const target of allTargets()) {
|
|
5035
|
+
if (!availableTarget(target)) {
|
|
5036
|
+
targets.push({
|
|
5037
|
+
...unavailableState(target),
|
|
5038
|
+
update_command: null
|
|
5039
|
+
});
|
|
5040
|
+
continue;
|
|
5041
|
+
}
|
|
4523
5042
|
const state = await readTarget(target);
|
|
5043
|
+
const details = await diagnostic(target, bundled);
|
|
4524
5044
|
const updateAvailable = state.kind === "managed" && state.version !== bundled.version;
|
|
5045
|
+
let recoveryCommand = skillUpdateCommand(target);
|
|
5046
|
+
if (state.kind === "managed" && !details.current) try {
|
|
5047
|
+
await preflightFolder(target.absolutePath, bundled);
|
|
5048
|
+
} catch {
|
|
5049
|
+
recoveryCommand = `${CLI_INVOCATION} skills install --tool ${target.tool} --scope ${target.scope} --force --json`;
|
|
5050
|
+
}
|
|
4525
5051
|
targets.push({
|
|
4526
5052
|
tool: target.tool,
|
|
4527
5053
|
scope: target.scope,
|
|
@@ -4530,13 +5056,14 @@ async function skillDiagnostics() {
|
|
|
4530
5056
|
managed: state.kind === "managed",
|
|
4531
5057
|
installed_version: state.kind === "managed" ? state.version : null,
|
|
4532
5058
|
update_available: updateAvailable,
|
|
4533
|
-
|
|
5059
|
+
...details,
|
|
5060
|
+
update_command: updateAvailable || state.kind === "managed" && !details.current ? recoveryCommand : null
|
|
4534
5061
|
});
|
|
4535
5062
|
}
|
|
4536
|
-
const updateTargets = targets.filter((target) => target.
|
|
5063
|
+
const updateTargets = targets.filter((target) => target.update_command !== null);
|
|
4537
5064
|
return {
|
|
4538
5065
|
bundled_version: bundled.version,
|
|
4539
|
-
update_available:
|
|
5066
|
+
update_available: targets.some((target) => target.update_available),
|
|
4540
5067
|
update_command: updateTargets.length > 0 ? `${CLI_INVOCATION} skills update --json` : null,
|
|
4541
5068
|
targets
|
|
4542
5069
|
};
|
|
@@ -4545,6 +5072,8 @@ async function runSkillsUpdate(parsed, mode) {
|
|
|
4545
5072
|
const command = "skills update";
|
|
4546
5073
|
const filters = parseFilters(parsed);
|
|
4547
5074
|
if (filters.error) return writeFailure(command, filters.error, mode, 1);
|
|
5075
|
+
const unavailable = unavailableSelection(filters.tools, filters.scope);
|
|
5076
|
+
if (unavailable) return writeFailure(command, unavailable, mode, 1);
|
|
4548
5077
|
const force = parsed.options.force === true;
|
|
4549
5078
|
const bundled = await bundledOrFailure(command, mode);
|
|
4550
5079
|
if (!bundled) return;
|
|
@@ -4552,7 +5081,11 @@ async function runSkillsUpdate(parsed, mode) {
|
|
|
4552
5081
|
for (const target of filteredTargets(filters.tools, filters.scope)) {
|
|
4553
5082
|
const state = await readTarget(target);
|
|
4554
5083
|
if (state.kind === "broken") return writeFailure(command, skillUpdateConflictError(target.path), mode, 1);
|
|
4555
|
-
if (state.kind === "missing") planned.push({
|
|
5084
|
+
if (state.kind === "missing") planned.push((await legacyRule(target))?.managed ? {
|
|
5085
|
+
target,
|
|
5086
|
+
action: "installed",
|
|
5087
|
+
content: bundled
|
|
5088
|
+
} : {
|
|
4556
5089
|
target,
|
|
4557
5090
|
action: "not_installed"
|
|
4558
5091
|
});
|
|
@@ -4560,32 +5093,38 @@ async function runSkillsUpdate(parsed, mode) {
|
|
|
4560
5093
|
target,
|
|
4561
5094
|
action: "skipped_unmanaged"
|
|
4562
5095
|
});
|
|
4563
|
-
else if (
|
|
5096
|
+
else if (!await isCurrent(target, bundled) || force) planned.push({
|
|
4564
5097
|
target,
|
|
4565
5098
|
action: "updated",
|
|
4566
|
-
content:
|
|
5099
|
+
content: bundled,
|
|
5100
|
+
forceRetirement: force
|
|
4567
5101
|
});
|
|
4568
5102
|
else planned.push({
|
|
4569
5103
|
target,
|
|
4570
5104
|
action: "unchanged"
|
|
4571
5105
|
});
|
|
4572
5106
|
}
|
|
4573
|
-
await runActions(command, planned, parsed.options.dryRun === true, mode);
|
|
5107
|
+
await runActions(command, planned, parsed.options.dryRun === true, mode, unavailableActionTargets(filters.tools, filters.scope));
|
|
4574
5108
|
}
|
|
4575
5109
|
async function runSkillsRemove(parsed, mode) {
|
|
4576
5110
|
const command = "skills remove";
|
|
4577
5111
|
const filters = parseFilters(parsed);
|
|
4578
5112
|
if (filters.error) return writeFailure(command, filters.error, mode, 1);
|
|
5113
|
+
const unavailable = unavailableSelection(filters.tools, filters.scope);
|
|
5114
|
+
if (unavailable) return writeFailure(command, unavailable, mode, 1);
|
|
4579
5115
|
const planned = [];
|
|
4580
5116
|
for (const target of filteredTargets(filters.tools, filters.scope)) {
|
|
4581
5117
|
const state = await readTarget(target);
|
|
4582
|
-
|
|
5118
|
+
if (state.kind === "broken") return writeFailure(command, skillUpdateConflictError(target.path), mode, 1);
|
|
5119
|
+
const managedLegacy = (await legacyRule(target))?.managed === true;
|
|
5120
|
+
const action = state.kind === "missing" ? managedLegacy ? "removed" : "not_installed" : state.kind === "managed" ? "removed" : "skipped_unmanaged";
|
|
4583
5121
|
planned.push({
|
|
4584
5122
|
target,
|
|
4585
|
-
action
|
|
5123
|
+
action,
|
|
5124
|
+
removeLegacy: true
|
|
4586
5125
|
});
|
|
4587
5126
|
}
|
|
4588
|
-
await runActions(command, planned, parsed.options.dryRun === true, mode);
|
|
5127
|
+
await runActions(command, planned, parsed.options.dryRun === true, mode, unavailableActionTargets(filters.tools, filters.scope));
|
|
4589
5128
|
}
|
|
4590
5129
|
//#endregion
|
|
4591
5130
|
//#region src/command-runners/open.ts
|
|
@@ -14909,6 +15448,11 @@ auto-installed; use skills install --tool cursor --scope project. Existing
|
|
|
14909
15448
|
project-scope skills are not modified. For static sites or multi-file artifacts,
|
|
14910
15449
|
the JSON includes a download next_command.
|
|
14911
15450
|
|
|
15451
|
+
Claude Code user skills go to $CLAUDE_CONFIG_DIR/skills when set, otherwise
|
|
15452
|
+
~/.claude/skills. Relative paths resolve against cwd without tilde expansion.
|
|
15453
|
+
A nonblank CLAUDE_CONFIG_DIR also enables detection at that root; blank values
|
|
15454
|
+
skip automatic writes. Set a non-empty path or unset CLAUDE_CONFIG_DIR.
|
|
15455
|
+
|
|
14912
15456
|
Common failures:
|
|
14913
15457
|
auth_required Set ARTIFACTSHARE_TOKEN before open
|
|
14914
15458
|
skill_update_conflict Inspect the file or run skills install --tool <tool> --force
|
|
@@ -15762,17 +16306,24 @@ const skillsInstallDefinition = define({
|
|
|
15762
16306
|
force: {
|
|
15763
16307
|
type: "boolean",
|
|
15764
16308
|
toKebab: true,
|
|
15765
|
-
description: "
|
|
16309
|
+
description: "Take over bundled paths only; preserve user additions"
|
|
15766
16310
|
}
|
|
15767
16311
|
},
|
|
15768
16312
|
examples: `npm exec --yes --package=@artifactshare/cli -- artifactshare skills install --tool codex --scope project --json
|
|
15769
16313
|
npm exec --yes --package=@artifactshare/cli -- artifactshare skills install --tool claude --tool cursor --dry-run --json
|
|
15770
16314
|
|
|
15771
|
-
Writes
|
|
16315
|
+
Writes SKILL.md and bundled references into skills/artifactshare/ for every tool and scope.
|
|
16316
|
+
Project Cursor uses .cursor/skills/artifactshare/. A manifest tracks owned files.
|
|
15772
16317
|
Files without the Artifact Share managed marker are never overwritten without --force.
|
|
15773
16318
|
|
|
16319
|
+
Claude Code user skills go to $CLAUDE_CONFIG_DIR/skills when set, otherwise
|
|
16320
|
+
~/.claude/skills. Relative paths resolve against cwd without tilde expansion.
|
|
16321
|
+
A nonblank CLAUDE_CONFIG_DIR also enables detection at that root; blank values
|
|
16322
|
+
skip automatic writes. Set a non-empty path or unset CLAUDE_CONFIG_DIR.
|
|
16323
|
+
Explicit Claude user installs reject blank values with validation_failed.
|
|
16324
|
+
|
|
15774
16325
|
Common failures:
|
|
15775
|
-
validation_failed Pass --tool codex|claude|cursor;
|
|
16326
|
+
validation_failed Pass --tool codex|claude|cursor; all tools support --scope project or user
|
|
15776
16327
|
skill_update_conflict An unmanaged file exists at the target path; inspect it or pass --force`
|
|
15777
16328
|
});
|
|
15778
16329
|
const skillsListDefinition = define({
|
|
@@ -15782,7 +16333,8 @@ const skillsListDefinition = define({
|
|
|
15782
16333
|
args: commonArgs,
|
|
15783
16334
|
examples: `npm exec --yes --package=@artifactshare/cli -- artifactshare skills list --json
|
|
15784
16335
|
|
|
15785
|
-
Reports each tool and scope with detection,
|
|
16336
|
+
Reports each tool and scope with detection, version, completeness, missing/differing files,
|
|
16337
|
+
ownership metadata, and legacy Cursor rule coexistence.
|
|
15786
16338
|
Runs locally; no network or authentication is used.`
|
|
15787
16339
|
});
|
|
15788
16340
|
const skillsUpdateDefinition = define({
|
|
@@ -15795,20 +16347,21 @@ const skillsUpdateDefinition = define({
|
|
|
15795
16347
|
force: {
|
|
15796
16348
|
type: "boolean",
|
|
15797
16349
|
toKebab: true,
|
|
15798
|
-
description: "Rewrite managed files
|
|
16350
|
+
description: "Rewrite managed folder files; never take over an unmanaged entry"
|
|
15799
16351
|
}
|
|
15800
16352
|
},
|
|
15801
16353
|
examples: `npm exec --yes --package=@artifactshare/cli -- artifactshare skills update --json
|
|
15802
16354
|
npm exec --yes --package=@artifactshare/cli -- artifactshare skills update --tool codex --scope user --json
|
|
15803
16355
|
|
|
15804
|
-
|
|
16356
|
+
Updates managed folders, repairs same-version drift, and preserves user-added files.
|
|
16357
|
+
Managed legacy Cursor rules migrate after the new project folder is ready.
|
|
15805
16358
|
|
|
15806
16359
|
Common failures:
|
|
15807
16360
|
skill_update_conflict A managed marker is broken; inspect the file or reinstall with --force`
|
|
15808
16361
|
});
|
|
15809
16362
|
const skillsEnsureDefinition = define({
|
|
15810
16363
|
name: "ensure",
|
|
15811
|
-
description: "Install or update the bundled Artifact Share skill.",
|
|
16364
|
+
description: "Install or update the bundled Artifact Share skill; Claude user scope follows CLAUDE_CONFIG_DIR.",
|
|
15812
16365
|
toKebab: true,
|
|
15813
16366
|
args: {
|
|
15814
16367
|
...commonArgs,
|
|
@@ -15824,9 +16377,18 @@ npm exec --yes --package=@artifactshare/cli -- artifactshare skills ensure --too
|
|
|
15824
16377
|
npm exec --yes --package=@artifactshare/cli -- artifactshare skills ensure --tool claude --json
|
|
15825
16378
|
|
|
15826
16379
|
Use --tool auto from an agent workspace. It detects .claude, .codex/.agents, or
|
|
15827
|
-
.cursor in the current directory
|
|
15828
|
-
|
|
15829
|
-
|
|
16380
|
+
.cursor in the current directory, or the Claude user root when CLAUDE_CONFIG_DIR
|
|
16381
|
+
is nonblank, and installs
|
|
16382
|
+
or updates the matching user-scope skills. If none are present, it prepares user-scope Codex, Claude Code, and Cursor
|
|
16383
|
+
skills. Cursor project scope needs skills install --tool cursor --scope project,
|
|
16384
|
+
except existing managed legacy Cursor rules migrate automatically.
|
|
16385
|
+
|
|
16386
|
+
Claude user skills use CLAUDE_CONFIG_DIR when set, otherwise ~/.claude.
|
|
16387
|
+
Relative paths resolve against cwd; tilde is literal. Blank values skip automatic
|
|
16388
|
+
writes. Set CLAUDE_CONFIG_DIR to a non-empty path or unset it. Selecting both --tool claude
|
|
16389
|
+
and --scope user makes mutations fail with validation_failed. Omit --scope from
|
|
16390
|
+
skills update/remove --tool claude to process project scope and get a skipped
|
|
16391
|
+
user entry. List and doctor show the unavailable user target.
|
|
15830
16392
|
|
|
15831
16393
|
Common failures:
|
|
15832
16394
|
validation_failed Pass --tool auto|codex|claude|cursor; --tool auto supports --scope user only (omit --scope or pass --scope user). Project scope needs skills install --tool <tool> --scope project
|
|
@@ -15843,7 +16405,8 @@ const skillsRemoveDefinition = define({
|
|
|
15843
16405
|
examples: `npm exec --yes --package=@artifactshare/cli -- artifactshare skills remove --json
|
|
15844
16406
|
npm exec --yes --package=@artifactshare/cli -- artifactshare skills remove --tool cursor --json
|
|
15845
16407
|
|
|
15846
|
-
Only files
|
|
16408
|
+
Only manifest-owned files (or a legacy managed SKILL.md) are deleted; user files are preserved.
|
|
16409
|
+
Project Cursor removal also cleans managed legacy rules.`
|
|
15847
16410
|
});
|
|
15848
16411
|
const skillsDefinition = define({
|
|
15849
16412
|
name: "skills",
|
|
@@ -15887,8 +16450,14 @@ Without flags, init detects Claude Code, Codex, or Cursor in the working directo
|
|
|
15887
16450
|
installs or updates the bundled skill in user scope, and shows the next steps (sign
|
|
15888
16451
|
in, then share). With no agent detected, it prepares user-scope Codex, Claude Code,
|
|
15889
16452
|
and Cursor skills. Cursor project scope is not auto-installed; use skills install
|
|
15890
|
-
--tool cursor --scope project. Existing project-scope skills are not modified.
|
|
16453
|
+
--tool cursor --scope project. Existing project-scope skills are not modified, except managed legacy Cursor rules migrate to .cursor/skills/artifactshare/.
|
|
15891
16454
|
data.mode is "onboarding".
|
|
16455
|
+
|
|
16456
|
+
Claude Code user skills go to $CLAUDE_CONFIG_DIR/skills when set, otherwise
|
|
16457
|
+
~/.claude/skills. Relative paths resolve against cwd without tilde expansion.
|
|
16458
|
+
A nonblank CLAUDE_CONFIG_DIR also enables detection at that root; blank values
|
|
16459
|
+
skip automatic writes. Set a non-empty path or unset CLAUDE_CONFIG_DIR.
|
|
16460
|
+
|
|
15892
16461
|
With --profile or --project-id, init saves working-directory defaults to
|
|
15893
16462
|
.artifactshare/config.local.json instead (data.mode is "config"); secrets are never written there.
|
|
15894
16463
|
Config saves preserve unknown keys and refuse linked or changed paths.
|