@skaile/workspaces 0.15.0 → 0.16.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 +53 -0
- package/dist/asset-feeds-L4ROBIAZ.js +90 -0
- package/dist/asset-feeds-L4ROBIAZ.js.map +1 -0
- package/dist/asset-manager/index.js +5 -5
- package/dist/asset-manager/installer.js +4 -4
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/asset-manager/src/installer.d.ts.map +1 -1
- package/dist/base-assets/connectors/deploy.js +5 -5
- package/dist/base-assets/connectors/devserver.js +5 -5
- package/dist/base-assets/connectors/flow/adapter.js +5 -5
- package/dist/base-assets/connectors/flow/run-flow.js +6 -6
- package/dist/base-assets/connectors/flow.js +5 -5
- package/dist/base-assets/connectors/git.js +5 -5
- package/dist/base-assets/connectors/gmail.js +5 -5
- package/dist/base-assets/connectors/googledrive.js +5 -5
- package/dist/base-assets/connectors/local.js +5 -5
- package/dist/base-assets/connectors/mattermost.js +5 -5
- package/dist/base-assets/connectors/memory.js +5 -5
- package/dist/base-assets/connectors/minio.js +5 -5
- package/dist/base-assets/connectors/postgres.js +5 -5
- package/dist/base-assets/connectors/redis.js +5 -5
- package/dist/base-assets/connectors/s3.js +5 -5
- package/dist/base-assets/connectors/sharepoint.js +5 -5
- package/dist/base-assets/connectors/sqlite.js +5 -5
- package/dist/base-assets/connectors/static-server.js +5 -5
- package/dist/base-assets/connectors/tunnel.js +5 -5
- package/dist/base-assets/connectors/webdav.js +5 -5
- package/dist/base-assets/connectors/xstate-store.js +5 -5
- package/dist/base-assets/connectors/xstate.js +5 -5
- package/dist/base-assets/connectors/yjs.js +5 -5
- package/dist/{chunk-SVNFQSU3.js → chunk-3DS5VIQP.js} +3 -3
- package/dist/{chunk-SVNFQSU3.js.map → chunk-3DS5VIQP.js.map} +1 -1
- package/dist/{chunk-4GEVGRWB.js → chunk-42YLNYFK.js} +11 -13
- package/dist/chunk-42YLNYFK.js.map +1 -0
- package/dist/{chunk-4RUVG5GX.js → chunk-4BRSVK7Q.js} +46 -3
- package/dist/chunk-4BRSVK7Q.js.map +1 -0
- package/dist/{chunk-Z24KPZKU.js → chunk-75M5W7FX.js} +8 -8
- package/dist/{chunk-Z24KPZKU.js.map → chunk-75M5W7FX.js.map} +1 -1
- package/dist/{chunk-SO43XRWF.js → chunk-ALJM24WL.js} +5 -5
- package/dist/{chunk-SO43XRWF.js.map → chunk-ALJM24WL.js.map} +1 -1
- package/dist/{chunk-2NIOMFSQ.js → chunk-FNCYNUGS.js} +78 -81
- package/dist/chunk-FNCYNUGS.js.map +1 -0
- package/dist/{chunk-6EN5IJ2Y.js → chunk-IY4X7PZN.js} +3 -3
- package/dist/{chunk-6EN5IJ2Y.js.map → chunk-IY4X7PZN.js.map} +1 -1
- package/dist/{chunk-W75ASXH4.js → chunk-KJ2LLWRF.js} +3 -3
- package/dist/{chunk-W75ASXH4.js.map → chunk-KJ2LLWRF.js.map} +1 -1
- package/dist/{chunk-6DEGWPAR.js → chunk-SMFZFFIZ.js} +3 -3
- package/dist/{chunk-6DEGWPAR.js.map → chunk-SMFZFFIZ.js.map} +1 -1
- package/dist/{chunk-GAZINYCS.js → chunk-SOQMVRQL.js} +19 -3
- package/dist/chunk-SOQMVRQL.js.map +1 -0
- package/dist/{chunk-7R4WLTZW.js → chunk-YMMWP3YL.js} +29 -19
- package/dist/chunk-YMMWP3YL.js.map +1 -0
- package/dist/{chunk-HSOEX3TA.js → chunk-YW36VEVN.js} +4 -4
- package/dist/{chunk-HSOEX3TA.js.map → chunk-YW36VEVN.js.map} +1 -1
- package/dist/{chunk-G7O7WDXX.js → chunk-ZUQXHBEH.js} +2 -2
- package/dist/{chunk-G7O7WDXX.js.map → chunk-ZUQXHBEH.js.map} +1 -1
- package/dist/cli/index.js +376 -207
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/asset-feeds.d.ts +42 -0
- package/dist/cli/src/asset-feeds.d.ts.map +1 -0
- package/dist/cli/src/commands/manage.d.ts +31 -20
- package/dist/cli/src/commands/manage.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/cli/src/commands/source.d.ts +6 -4
- package/dist/cli/src/commands/source.d.ts.map +1 -1
- package/dist/cli/src/ensure-sources.d.ts +25 -0
- package/dist/cli/src/ensure-sources.d.ts.map +1 -0
- package/dist/connectors/config.js +4 -4
- package/dist/connectors/index.js +5 -5
- package/dist/core/index.js +3 -3
- package/dist/core/runtime-assets.js +2 -2
- package/dist/core/src/index.d.ts +1 -1
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts +27 -0
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/src/workspace-yaml-editor.d.ts +10 -1
- package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
- package/dist/core/workspace-config.js +1 -1
- package/dist/ensure-sources-V26CZNJF.js +68 -0
- package/dist/ensure-sources-V26CZNJF.js.map +1 -0
- package/dist/library/index.js +1 -1
- package/dist/library/src/local/db.d.ts.map +1 -1
- package/dist/library/src/local/store-paths.d.ts.map +1 -1
- package/dist/{open-library-XD7QYLMW.js → open-library-T6RXQJTQ.js} +4 -4
- package/dist/{open-library-XD7QYLMW.js.map → open-library-T6RXQJTQ.js.map} +1 -1
- package/dist/runner/index.js +7 -7
- package/dist/sdk/asset-manager.js +5 -5
- package/dist/sdk/core.js +3 -3
- package/dist/sdk/index.js +7 -7
- package/dist/sdk/runner.js +7 -7
- package/dist/{setup-WZFCLQ2J.js → setup-R6VWIPLL.js} +5 -5
- package/dist/{setup-WZFCLQ2J.js.map → setup-R6VWIPLL.js.map} +1 -1
- package/dist/{store-client-BM3IBDPT.js → store-client-FLD3XUY7.js} +6 -6
- package/dist/{store-client-BM3IBDPT.js.map → store-client-FLD3XUY7.js.map} +1 -1
- package/dist/tui/index.js +7 -7
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2NIOMFSQ.js.map +0 -1
- package/dist/chunk-4GEVGRWB.js.map +0 -1
- package/dist/chunk-4RUVG5GX.js.map +0 -1
- package/dist/chunk-7R4WLTZW.js.map +0 -1
- package/dist/chunk-GAZINYCS.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { discoverAssetsInTree, loadSourceConfig } from './chunk-GKIA2PU5.js';
|
|
2
2
|
import { PresetManifestSchema } from './chunk-NELZIQ2E.js';
|
|
3
|
-
import { __export
|
|
3
|
+
import { __export } from './chunk-NSBPE2FW.js';
|
|
4
4
|
import * as crypto from 'crypto';
|
|
5
5
|
import { createHash } from 'crypto';
|
|
6
|
-
import * as
|
|
6
|
+
import * as fs12 from 'fs';
|
|
7
7
|
import * as path4 from 'path';
|
|
8
8
|
import { resolve, join, sep, dirname, isAbsolute } from 'path';
|
|
9
9
|
import { eq, like, and } from 'drizzle-orm';
|
|
@@ -13,8 +13,8 @@ import { stringify, parse, parseDocument } from 'yaml';
|
|
|
13
13
|
import { createClient } from '@libsql/client';
|
|
14
14
|
import { drizzle } from 'drizzle-orm/libsql';
|
|
15
15
|
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
|
|
16
|
-
import { rm, mkdir, writeFile } from 'fs/promises';
|
|
17
16
|
import { spawnSync } from 'child_process';
|
|
17
|
+
import { rm, mkdir, writeFile } from 'fs/promises';
|
|
18
18
|
|
|
19
19
|
// library/src/library.ts
|
|
20
20
|
var KNOWN_ASSET_KINDS = [
|
|
@@ -138,9 +138,9 @@ function projectConfigPath(projectDir) {
|
|
|
138
138
|
return path4.join(projectDir, ".skaile", CONFIG_FILENAME);
|
|
139
139
|
}
|
|
140
140
|
function loadConfigFile(filePath) {
|
|
141
|
-
if (!
|
|
141
|
+
if (!fs12.existsSync(filePath)) return null;
|
|
142
142
|
try {
|
|
143
|
-
const content =
|
|
143
|
+
const content = fs12.readFileSync(filePath, "utf-8");
|
|
144
144
|
const raw = parse(content);
|
|
145
145
|
if (!raw || typeof raw !== "object") return null;
|
|
146
146
|
return SkaileConfigSchema.partial().parse(raw);
|
|
@@ -189,10 +189,10 @@ function resolveConfig(opts) {
|
|
|
189
189
|
}
|
|
190
190
|
function saveConfig(filePath, config) {
|
|
191
191
|
const dir = path4.dirname(filePath);
|
|
192
|
-
if (!
|
|
193
|
-
|
|
192
|
+
if (!fs12.existsSync(dir)) {
|
|
193
|
+
fs12.mkdirSync(dir, { recursive: true });
|
|
194
194
|
}
|
|
195
|
-
|
|
195
|
+
fs12.writeFileSync(filePath, stringify(config, { indent: 2 }), "utf-8");
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
// library/src/local/schema.ts
|
|
@@ -293,9 +293,9 @@ function deriveSlug(sourceConfig, sourcePath, existingSlugs) {
|
|
|
293
293
|
}
|
|
294
294
|
function listSidecarSlugsOnDisk() {
|
|
295
295
|
const root = getSidecarRoot();
|
|
296
|
-
if (!
|
|
296
|
+
if (!fs12.existsSync(root)) return [];
|
|
297
297
|
const out = [];
|
|
298
|
-
for (const entry of
|
|
298
|
+
for (const entry of fs12.readdirSync(root, { withFileTypes: true })) {
|
|
299
299
|
if (!entry.isDirectory()) continue;
|
|
300
300
|
if (entry.name.startsWith(".")) continue;
|
|
301
301
|
out.push(entry.name);
|
|
@@ -320,25 +320,25 @@ function migratedMarkerPath() {
|
|
|
320
320
|
function migrateSidecarsToStoreIfNeeded() {
|
|
321
321
|
const storeRoot = getStoreRoot();
|
|
322
322
|
const marker = migratedMarkerPath();
|
|
323
|
-
if (
|
|
323
|
+
if (fs12.existsSync(marker)) return { migrated: 0, storeRoot };
|
|
324
324
|
const sidecarRoot = getSidecarRoot();
|
|
325
325
|
const manifestsDir = getStoreManifestsDir();
|
|
326
326
|
const candidates = [];
|
|
327
|
-
if (
|
|
328
|
-
for (const entry of
|
|
327
|
+
if (fs12.existsSync(sidecarRoot)) {
|
|
328
|
+
for (const entry of fs12.readdirSync(sidecarRoot, { withFileTypes: true })) {
|
|
329
329
|
if (!entry.isDirectory()) continue;
|
|
330
330
|
if (entry.name.startsWith(".")) continue;
|
|
331
331
|
const src = path4.join(sidecarRoot, entry.name, ".skaile-source.yaml");
|
|
332
|
-
if (
|
|
332
|
+
if (fs12.existsSync(src)) candidates.push({ src, slug: entry.name });
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
|
|
335
|
+
fs12.mkdirSync(manifestsDir, { recursive: true });
|
|
336
336
|
let migrated = 0;
|
|
337
337
|
for (const { src, slug } of candidates) {
|
|
338
338
|
const dest = path4.join(manifestsDir, `${slug}.yaml`);
|
|
339
|
-
if (
|
|
339
|
+
if (fs12.existsSync(dest)) continue;
|
|
340
340
|
try {
|
|
341
|
-
|
|
341
|
+
fs12.renameSync(src, dest);
|
|
342
342
|
migrated++;
|
|
343
343
|
} catch (err) {
|
|
344
344
|
process.stderr.write(
|
|
@@ -347,11 +347,10 @@ function migrateSidecarsToStoreIfNeeded() {
|
|
|
347
347
|
);
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
if (!
|
|
350
|
+
if (!fs12.existsSync(path4.join(storeRoot, ".git"))) {
|
|
351
351
|
try {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
fs11.writeFileSync(
|
|
352
|
+
spawnSync("git", ["init", "--quiet"], { cwd: storeRoot, stdio: "ignore" });
|
|
353
|
+
fs12.writeFileSync(
|
|
355
354
|
path4.join(storeRoot, ".gitignore"),
|
|
356
355
|
"# Remote-store cache \u2014 local to this machine.\nremote-cache/\n",
|
|
357
356
|
"utf8"
|
|
@@ -359,7 +358,7 @@ function migrateSidecarsToStoreIfNeeded() {
|
|
|
359
358
|
} catch {
|
|
360
359
|
}
|
|
361
360
|
}
|
|
362
|
-
|
|
361
|
+
fs12.writeFileSync(marker, (/* @__PURE__ */ new Date()).toISOString(), "utf8");
|
|
363
362
|
return { migrated, storeRoot };
|
|
364
363
|
}
|
|
365
364
|
|
|
@@ -506,11 +505,9 @@ async function runLibrariesMigration(client) {
|
|
|
506
505
|
await client.batch(stmts);
|
|
507
506
|
}
|
|
508
507
|
function assertNoLegacyLibDb(newDbPath) {
|
|
509
|
-
|
|
510
|
-
const os5 = __require("os");
|
|
511
|
-
if (fs13.existsSync(newDbPath)) return;
|
|
508
|
+
if (fs12.existsSync(newDbPath)) return;
|
|
512
509
|
const parent = path4.dirname(newDbPath);
|
|
513
|
-
const skaileHome = path4.join(
|
|
510
|
+
const skaileHome = path4.join(os.homedir(), ".skaile");
|
|
514
511
|
const defaultIndexPath2 = path4.join(skaileHome, "index.db");
|
|
515
512
|
const candidates = [];
|
|
516
513
|
if (path4.basename(newDbPath) === "index.db") {
|
|
@@ -524,7 +521,7 @@ function assertNoLegacyLibDb(newDbPath) {
|
|
|
524
521
|
candidates.push(path4.join(path4.dirname(parent), "library", "lib.db"));
|
|
525
522
|
}
|
|
526
523
|
for (const legacy of candidates) {
|
|
527
|
-
if (!
|
|
524
|
+
if (!fs12.existsSync(legacy)) continue;
|
|
528
525
|
throw new Error(
|
|
529
526
|
`Found legacy index database at ${legacy}. The lib.db \u2192 index.db relocation ran for one release and has been removed. Move the file manually to ${newDbPath} (and any -wal / -shm siblings), then retry.`
|
|
530
527
|
);
|
|
@@ -742,12 +739,12 @@ var LocalIndex = class {
|
|
|
742
739
|
dbPath = resolveIndexPath();
|
|
743
740
|
this._kindRegistry = optionsOrDir?.kindRegistry;
|
|
744
741
|
}
|
|
745
|
-
if (!
|
|
746
|
-
|
|
742
|
+
if (!fs12.existsSync(dir)) {
|
|
743
|
+
fs12.mkdirSync(dir, { recursive: true });
|
|
747
744
|
}
|
|
748
745
|
const dbParent = path4.dirname(dbPath);
|
|
749
|
-
if (!
|
|
750
|
-
|
|
746
|
+
if (!fs12.existsSync(dbParent)) {
|
|
747
|
+
fs12.mkdirSync(dbParent, { recursive: true });
|
|
751
748
|
}
|
|
752
749
|
this.libraryDir = dir;
|
|
753
750
|
this.dbPath = dbPath;
|
|
@@ -1363,8 +1360,8 @@ var LibraryManager = class {
|
|
|
1363
1360
|
const lib = await this.requireLibrary(nameOrId);
|
|
1364
1361
|
const db = await this.lib.dbHandle();
|
|
1365
1362
|
await db.delete(libraries).where(eq(libraries.id, lib.id)).run();
|
|
1366
|
-
if (opts.purge &&
|
|
1367
|
-
|
|
1363
|
+
if (opts.purge && fs12.existsSync(lib.path)) {
|
|
1364
|
+
fs12.rmSync(lib.path, { recursive: true, force: true });
|
|
1368
1365
|
}
|
|
1369
1366
|
}
|
|
1370
1367
|
/**
|
|
@@ -1381,7 +1378,7 @@ var LibraryManager = class {
|
|
|
1381
1378
|
);
|
|
1382
1379
|
if (writableDefault) return { library: writableDefault, created: false };
|
|
1383
1380
|
const personalPath = path4.join(librariesDir, "personal");
|
|
1384
|
-
|
|
1381
|
+
fs12.mkdirSync(personalPath, { recursive: true });
|
|
1385
1382
|
const lib = await this.addLibrary({
|
|
1386
1383
|
name: "personal",
|
|
1387
1384
|
path: personalPath,
|
|
@@ -1443,11 +1440,11 @@ var SidecarGit = class {
|
|
|
1443
1440
|
* @docLink packages/library/concepts#sidecar-git
|
|
1444
1441
|
*/
|
|
1445
1442
|
async ensureInitialized() {
|
|
1446
|
-
if (!
|
|
1447
|
-
|
|
1443
|
+
if (!fs12.existsSync(this.rootDir)) {
|
|
1444
|
+
fs12.mkdirSync(this.rootDir, { recursive: true });
|
|
1448
1445
|
}
|
|
1449
1446
|
const gitDir = path4.join(this.rootDir, ".git");
|
|
1450
|
-
const freshRepo = !
|
|
1447
|
+
const freshRepo = !fs12.existsSync(gitDir);
|
|
1451
1448
|
if (freshRepo) {
|
|
1452
1449
|
const init = this.spawn(["init", "-b", "main"]);
|
|
1453
1450
|
if (init.exitCode !== 0) {
|
|
@@ -1455,9 +1452,9 @@ var SidecarGit = class {
|
|
|
1455
1452
|
}
|
|
1456
1453
|
}
|
|
1457
1454
|
const attrsPath = path4.join(this.rootDir, ".gitattributes");
|
|
1458
|
-
if (!
|
|
1455
|
+
if (!fs12.existsSync(attrsPath)) fs12.writeFileSync(attrsPath, GITATTRIBUTES, "utf-8");
|
|
1459
1456
|
const readmePath = path4.join(this.rootDir, "README.md");
|
|
1460
|
-
if (!
|
|
1457
|
+
if (!fs12.existsSync(readmePath)) fs12.writeFileSync(readmePath, ROOT_README, "utf-8");
|
|
1461
1458
|
if (!this.hasGlobalGitConfig("user.name")) {
|
|
1462
1459
|
this.spawn(["config", "user.name", FALLBACK_USER_NAME]);
|
|
1463
1460
|
}
|
|
@@ -1483,7 +1480,7 @@ var SidecarGit = class {
|
|
|
1483
1480
|
async commit(slug, message, opts) {
|
|
1484
1481
|
if (opts?.skip) return;
|
|
1485
1482
|
const slugDir = path4.join(this.rootDir, slug);
|
|
1486
|
-
if (
|
|
1483
|
+
if (fs12.existsSync(slugDir)) {
|
|
1487
1484
|
this.spawn(["add", "--", slug]);
|
|
1488
1485
|
} else {
|
|
1489
1486
|
this.spawn(["add", "-A"]);
|
|
@@ -1594,8 +1591,8 @@ function parseWorkspaceV2(raw) {
|
|
|
1594
1591
|
}
|
|
1595
1592
|
function loadWorkspaceV2(dir, filename = "skaile.yaml") {
|
|
1596
1593
|
const filePath = path4.join(dir, filename);
|
|
1597
|
-
if (!
|
|
1598
|
-
const content =
|
|
1594
|
+
if (!fs12.existsSync(filePath)) return null;
|
|
1595
|
+
const content = fs12.readFileSync(filePath, "utf-8");
|
|
1599
1596
|
const raw = parse(content);
|
|
1600
1597
|
if (!raw || typeof raw !== "object") return null;
|
|
1601
1598
|
return parseWorkspaceV2(raw);
|
|
@@ -1603,32 +1600,32 @@ function loadWorkspaceV2(dir, filename = "skaile.yaml") {
|
|
|
1603
1600
|
function saveWorkspaceV2(dir, v2, filename = "skaile.yaml") {
|
|
1604
1601
|
const filePath = path4.join(dir, filename);
|
|
1605
1602
|
let existing = {};
|
|
1606
|
-
if (
|
|
1607
|
-
const content =
|
|
1603
|
+
if (fs12.existsSync(filePath)) {
|
|
1604
|
+
const content = fs12.readFileSync(filePath, "utf-8");
|
|
1608
1605
|
existing = parse(content) ?? {};
|
|
1609
1606
|
}
|
|
1610
1607
|
existing.version = 2;
|
|
1611
1608
|
if (v2.library !== void 0) existing.library = v2.library;
|
|
1612
1609
|
if (v2.presets_applied !== void 0) existing.presets_applied = v2.presets_applied;
|
|
1613
|
-
if (!
|
|
1614
|
-
|
|
1610
|
+
if (!fs12.existsSync(dir)) {
|
|
1611
|
+
fs12.mkdirSync(dir, { recursive: true });
|
|
1615
1612
|
}
|
|
1616
|
-
|
|
1613
|
+
fs12.writeFileSync(filePath, stringify(existing, { indent: 2 }), "utf-8");
|
|
1617
1614
|
}
|
|
1618
1615
|
var LOCK_FILENAME = "skaile.lock.yaml";
|
|
1619
1616
|
function loadLockFile(dir) {
|
|
1620
1617
|
const filePath = path4.join(dir, LOCK_FILENAME);
|
|
1621
|
-
if (!
|
|
1622
|
-
const content =
|
|
1618
|
+
if (!fs12.existsSync(filePath)) return null;
|
|
1619
|
+
const content = fs12.readFileSync(filePath, "utf-8");
|
|
1623
1620
|
const raw = parse(content);
|
|
1624
1621
|
return LockFileSchema.parse(raw);
|
|
1625
1622
|
}
|
|
1626
1623
|
function saveLockFile(dir, lock) {
|
|
1627
1624
|
const filePath = path4.join(dir, LOCK_FILENAME);
|
|
1628
|
-
if (!
|
|
1629
|
-
|
|
1625
|
+
if (!fs12.existsSync(dir)) {
|
|
1626
|
+
fs12.mkdirSync(dir, { recursive: true });
|
|
1630
1627
|
}
|
|
1631
|
-
|
|
1628
|
+
fs12.writeFileSync(
|
|
1632
1629
|
filePath,
|
|
1633
1630
|
`# Auto-generated by skaile. Do not edit manually.
|
|
1634
1631
|
${stringify(lock, { indent: 2 })}`,
|
|
@@ -1646,8 +1643,8 @@ function createEmptyLockFile() {
|
|
|
1646
1643
|
}
|
|
1647
1644
|
function detectWorkspaceVersion(dir, filename = "skaile.yaml") {
|
|
1648
1645
|
const filePath = path4.join(dir, filename);
|
|
1649
|
-
if (!
|
|
1650
|
-
const content =
|
|
1646
|
+
if (!fs12.existsSync(filePath)) return null;
|
|
1647
|
+
const content = fs12.readFileSync(filePath, "utf-8");
|
|
1651
1648
|
const raw = parse(content);
|
|
1652
1649
|
if (!raw || typeof raw !== "object") return null;
|
|
1653
1650
|
return raw.version === 2 ? 2 : 1;
|
|
@@ -1655,7 +1652,7 @@ function detectWorkspaceVersion(dir, filename = "skaile.yaml") {
|
|
|
1655
1652
|
var MANIFEST_FILENAME = ".skaile-source.yaml";
|
|
1656
1653
|
async function writeManifestIfMissing(input) {
|
|
1657
1654
|
const manifestPath = path4.join(input.libraryPath, MANIFEST_FILENAME);
|
|
1658
|
-
if (
|
|
1655
|
+
if (fs12.existsSync(manifestPath)) return { wrote: false, manifestPath };
|
|
1659
1656
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1660
1657
|
const yaml = `# Generated by skaile library add on ${now}
|
|
1661
1658
|
# Edit by hand to inline discovered assets; or run \`skaile library refresh-manifest\`.
|
|
@@ -1664,13 +1661,13 @@ structure: ${input.structure}
|
|
|
1664
1661
|
publisher: ""
|
|
1665
1662
|
assets: []
|
|
1666
1663
|
`;
|
|
1667
|
-
|
|
1664
|
+
fs12.writeFileSync(manifestPath, yaml, "utf-8");
|
|
1668
1665
|
if (input.ownership !== "owner") {
|
|
1669
1666
|
const excludePath = path4.join(input.libraryPath, ".git", "info", "exclude");
|
|
1670
|
-
if (
|
|
1671
|
-
const current =
|
|
1667
|
+
if (fs12.existsSync(path4.dirname(excludePath))) {
|
|
1668
|
+
const current = fs12.existsSync(excludePath) ? fs12.readFileSync(excludePath, "utf-8") : "";
|
|
1672
1669
|
if (!current.includes(MANIFEST_FILENAME)) {
|
|
1673
|
-
|
|
1670
|
+
fs12.writeFileSync(
|
|
1674
1671
|
excludePath,
|
|
1675
1672
|
(current.endsWith("\n") || current === "" ? current : `${current}
|
|
1676
1673
|
`) + `# skaile-managed local-overlay manifest
|
|
@@ -1686,10 +1683,10 @@ ${MANIFEST_FILENAME}
|
|
|
1686
1683
|
function migrateWorkspaceConfig(dir, opts) {
|
|
1687
1684
|
const filename = opts?.filename ?? "skaile.yaml";
|
|
1688
1685
|
const filePath = path4.join(dir, filename);
|
|
1689
|
-
if (!
|
|
1686
|
+
if (!fs12.existsSync(filePath)) {
|
|
1690
1687
|
return { migrated: false, version: 1, warnings: ["No skaile.yaml found"] };
|
|
1691
1688
|
}
|
|
1692
|
-
const content =
|
|
1689
|
+
const content = fs12.readFileSync(filePath, "utf-8");
|
|
1693
1690
|
const raw = parse(content);
|
|
1694
1691
|
if (!raw || typeof raw !== "object") {
|
|
1695
1692
|
return { migrated: false, version: 1, warnings: ["Invalid YAML content"] };
|
|
@@ -1721,7 +1718,7 @@ function migrateWorkspaceConfig(dir, opts) {
|
|
|
1721
1718
|
} else {
|
|
1722
1719
|
doc.set("version", 2);
|
|
1723
1720
|
}
|
|
1724
|
-
|
|
1721
|
+
fs12.writeFileSync(filePath, doc.toString(), "utf-8");
|
|
1725
1722
|
}
|
|
1726
1723
|
return {
|
|
1727
1724
|
migrated: !opts?.dryRun,
|
|
@@ -1904,9 +1901,9 @@ function defToCatalogAsset(def) {
|
|
|
1904
1901
|
}
|
|
1905
1902
|
function loadSourceConfigIfPresent(rootPath) {
|
|
1906
1903
|
const configPath = path4.join(rootPath, ".skaile-source.yaml");
|
|
1907
|
-
if (!
|
|
1904
|
+
if (!fs12.existsSync(configPath)) return void 0;
|
|
1908
1905
|
try {
|
|
1909
|
-
const content =
|
|
1906
|
+
const content = fs12.readFileSync(configPath, "utf-8");
|
|
1910
1907
|
const result = loadSourceConfig(content);
|
|
1911
1908
|
if (!result.ok) return void 0;
|
|
1912
1909
|
return result.config;
|
|
@@ -1992,17 +1989,17 @@ var CatalogCache = class {
|
|
|
1992
1989
|
/** Read a cached tarball from disk if present, otherwise `null`. */
|
|
1993
1990
|
readTarball(sha256) {
|
|
1994
1991
|
const p = this.tarballPath(sha256);
|
|
1995
|
-
if (!
|
|
1996
|
-
return
|
|
1992
|
+
if (!fs12.existsSync(p)) return null;
|
|
1993
|
+
return fs12.readFileSync(p);
|
|
1997
1994
|
}
|
|
1998
1995
|
/** Persist a tarball blob to disk (atomic write). */
|
|
1999
1996
|
writeTarball(sha256, bytes) {
|
|
2000
1997
|
const dir = path4.join(this.dir, TARBALL_DIR);
|
|
2001
|
-
if (!
|
|
1998
|
+
if (!fs12.existsSync(dir)) fs12.mkdirSync(dir, { recursive: true });
|
|
2002
1999
|
const finalPath = this.tarballPath(sha256);
|
|
2003
2000
|
const tmpPath = `${finalPath}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
2004
|
-
|
|
2005
|
-
|
|
2001
|
+
fs12.writeFileSync(tmpPath, bytes);
|
|
2002
|
+
fs12.renameSync(tmpPath, finalPath);
|
|
2006
2003
|
}
|
|
2007
2004
|
// ── public: invalidation ────────────────────────────────────────────────
|
|
2008
2005
|
/**
|
|
@@ -2022,8 +2019,8 @@ var CatalogCache = class {
|
|
|
2022
2019
|
invalidateEverything() {
|
|
2023
2020
|
this.invalidateAll();
|
|
2024
2021
|
const tarballDir = path4.join(this.dir, TARBALL_DIR);
|
|
2025
|
-
if (
|
|
2026
|
-
|
|
2022
|
+
if (fs12.existsSync(tarballDir)) {
|
|
2023
|
+
fs12.rmSync(tarballDir, { recursive: true, force: true });
|
|
2027
2024
|
}
|
|
2028
2025
|
}
|
|
2029
2026
|
/** Return whether `ttlMs` is zero (air-gapped mode). */
|
|
@@ -2032,9 +2029,9 @@ var CatalogCache = class {
|
|
|
2032
2029
|
}
|
|
2033
2030
|
// ── private ─────────────────────────────────────────────────────────────
|
|
2034
2031
|
ensureDir() {
|
|
2035
|
-
if (!
|
|
2032
|
+
if (!fs12.existsSync(this.dir)) fs12.mkdirSync(this.dir, { recursive: true });
|
|
2036
2033
|
const tarballDir = path4.join(this.dir, TARBALL_DIR);
|
|
2037
|
-
if (!
|
|
2034
|
+
if (!fs12.existsSync(tarballDir)) fs12.mkdirSync(tarballDir, { recursive: true });
|
|
2038
2035
|
}
|
|
2039
2036
|
indexPath() {
|
|
2040
2037
|
return path4.join(this.dir, INDEX_FILE);
|
|
@@ -2042,12 +2039,12 @@ var CatalogCache = class {
|
|
|
2042
2039
|
loadIndex() {
|
|
2043
2040
|
if (this.index) return this.index;
|
|
2044
2041
|
const p = this.indexPath();
|
|
2045
|
-
if (!
|
|
2042
|
+
if (!fs12.existsSync(p)) {
|
|
2046
2043
|
this.index = { version: 1, resolve: {}, list: {} };
|
|
2047
2044
|
return this.index;
|
|
2048
2045
|
}
|
|
2049
2046
|
try {
|
|
2050
|
-
const raw = JSON.parse(
|
|
2047
|
+
const raw = JSON.parse(fs12.readFileSync(p, "utf-8"));
|
|
2051
2048
|
if (raw && typeof raw === "object" && raw.version === 1) {
|
|
2052
2049
|
this.index = {
|
|
2053
2050
|
version: 1,
|
|
@@ -2065,8 +2062,8 @@ var CatalogCache = class {
|
|
|
2065
2062
|
this.index = idx;
|
|
2066
2063
|
const p = this.indexPath();
|
|
2067
2064
|
const tmp = `${p}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
2068
|
-
|
|
2069
|
-
|
|
2065
|
+
fs12.writeFileSync(tmp, JSON.stringify(idx, null, 2), "utf-8");
|
|
2066
|
+
fs12.renameSync(tmp, p);
|
|
2070
2067
|
}
|
|
2071
2068
|
};
|
|
2072
2069
|
function filterKey(filter) {
|
|
@@ -2799,9 +2796,9 @@ function validateKnowledge(data) {
|
|
|
2799
2796
|
}
|
|
2800
2797
|
function collectDirRecursive(baseDir, relativeDir) {
|
|
2801
2798
|
const full = path4.join(baseDir, relativeDir);
|
|
2802
|
-
if (!
|
|
2799
|
+
if (!fs12.existsSync(full) || !fs12.statSync(full).isDirectory()) return [];
|
|
2803
2800
|
const results = [];
|
|
2804
|
-
for (const entry of
|
|
2801
|
+
for (const entry of fs12.readdirSync(full, { withFileTypes: true })) {
|
|
2805
2802
|
const rel = path4.posix.join(relativeDir, entry.name);
|
|
2806
2803
|
if (entry.isDirectory()) {
|
|
2807
2804
|
results.push(...collectDirRecursive(baseDir, rel));
|
|
@@ -3511,5 +3508,5 @@ function deepEqual(a, b) {
|
|
|
3511
3508
|
}
|
|
3512
3509
|
|
|
3513
3510
|
export { CatalogCache, CatalogConfigSchema, CatalogHttpError, DuplicateLibraryNameError, DuplicateSubscriptionError, GitSyncDriver, InstanceHasConsumersError, InstanceNotFoundError, InterpolationError, KNOWN_ASSET_KINDS, KnowledgeManifestSchema, LIBRARY_BACKENDS, LIBRARY_OWNERSHIPS, LIBRARY_STRUCTURES, LOCAL_CATALOG_URL, LibraryConfigSchema, LibraryError, LibraryInstanceRefSchema, LibraryManager, LibrarySectionSchema, LibrarySyncError, LocalCatalogSource, LocalIndex, LocalSyncDriver, LockFileSchema, LockSubscriptionSchema, OfflineError, OperationNotPermittedError, PIN_POLICIES, PinPolicySchema, PresetAppliedSchema, PresetExpandedSchema, RemoteCatalogSource, RequiresEdgeSchema, RestCatalogSource, SidecarGit, SkaileConfigSchema, SourceNotFoundError, SubscriptionNotFoundError, TarballHashMismatchError, UserLibraryNotFoundError, WorkspaceConfigV2Schema, applyNonStructuralUpgrade, applyPreset, applyPresetFromData, classifyRef, createEmptyLockFile, deriveSlug, detectChanges, detectNestedPresetRefs, detectWorkspaceVersion, evaluateUpgrade, extractLibraryInstanceId, extractReferencedKeys, filterKey, getConfigDefaults, getDefaultValue, getSidecarRoot, getStoreManifestsDir, getStoreRoot, hasInterpolationTokens, installFromManifest, interpolate, isLocalCatalogUrl, isSecretPlaceholder, knowledgeKindProvider, listSidecarSlugsOnDisk, loadLockFile, loadWorkspaceV2, migrateSidecarsToStoreIfNeeded, migrateWorkspaceConfig, parsePreset, parsePresetYaml, parseWorkspaceV2, projectConfigPath, queryInstancePickerChoices, resolveAllItems, resolveConfig, resolveIndexPath, resolveItem, resolveLibraryDir, resolvePin, resolveSidecarPaths, saveConfig, saveLockFile, saveWorkspaceV2, sha256Hex, skaileHomeDir, storeSecrets, trpcGetUrl, userConfigPath, validateAllPlaceholders, validateKnowledge, validateNestingDepth, validatePlaceholder, writeManifestIfMissing };
|
|
3514
|
-
//# sourceMappingURL=chunk-
|
|
3515
|
-
//# sourceMappingURL=chunk-
|
|
3511
|
+
//# sourceMappingURL=chunk-FNCYNUGS.js.map
|
|
3512
|
+
//# sourceMappingURL=chunk-FNCYNUGS.js.map
|