@packmind/cli 0.27.0 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.cjs +171 -114
- package/package.json +2 -1
package/main.cjs
CHANGED
|
@@ -3855,7 +3855,7 @@ var require_package = __commonJS({
|
|
|
3855
3855
|
"apps/cli/package.json"(exports2, module2) {
|
|
3856
3856
|
module2.exports = {
|
|
3857
3857
|
name: "@packmind/cli",
|
|
3858
|
-
version: "0.
|
|
3858
|
+
version: "0.28.1",
|
|
3859
3859
|
description: "A command-line interface for Packmind linting and code quality checks",
|
|
3860
3860
|
private: false,
|
|
3861
3861
|
bin: {
|
|
@@ -4311,13 +4311,16 @@ function camelToKebab(str) {
|
|
|
4311
4311
|
}
|
|
4312
4312
|
var CLAUDE_CODE_ADDITIONAL_FIELDS = {
|
|
4313
4313
|
"argument-hint": "argumentHint",
|
|
4314
|
+
when_to_use: "whenToUse",
|
|
4314
4315
|
"disable-model-invocation": "disableModelInvocation",
|
|
4315
4316
|
"user-invocable": "userInvocable",
|
|
4316
4317
|
model: "model",
|
|
4317
4318
|
context: "context",
|
|
4318
4319
|
agent: "agent",
|
|
4319
4320
|
effort: "effort",
|
|
4320
|
-
hooks: "hooks"
|
|
4321
|
+
hooks: "hooks",
|
|
4322
|
+
paths: "paths",
|
|
4323
|
+
shell: "shell"
|
|
4321
4324
|
};
|
|
4322
4325
|
var CAMEL_TO_YAML_KEY = Object.fromEntries(
|
|
4323
4326
|
Object.entries(CLAUDE_CODE_ADDITIONAL_FIELDS).map(([yaml4, camel]) => [
|
|
@@ -6625,6 +6628,40 @@ function isCommunityEditionError(tbd) {
|
|
|
6625
6628
|
}
|
|
6626
6629
|
|
|
6627
6630
|
// apps/cli/src/infra/http/PackmindHttpClient.ts
|
|
6631
|
+
var import_undici = require("undici");
|
|
6632
|
+
var tls = __toESM(require("tls"));
|
|
6633
|
+
var fs4 = __toESM(require("fs"));
|
|
6634
|
+
function buildDispatcher() {
|
|
6635
|
+
const cas = [...tls.rootCertificates];
|
|
6636
|
+
const programFiles = process.env["ProgramFiles"] ?? "C:\\Program Files";
|
|
6637
|
+
const programFilesX86 = process.env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)";
|
|
6638
|
+
const systemCertFiles = [
|
|
6639
|
+
"/etc/ssl/certs/ca-certificates.crt",
|
|
6640
|
+
// Debian/Ubuntu
|
|
6641
|
+
"/etc/ssl/cert.pem",
|
|
6642
|
+
// macOS / Alpine
|
|
6643
|
+
"/etc/ssl/certs/ca-bundle.crt",
|
|
6644
|
+
// RHEL / CentOS
|
|
6645
|
+
// Git for Windows bundles (most common CA source on Windows)
|
|
6646
|
+
`${programFiles}\\Git\\usr\\ssl\\certs\\ca-bundle.crt`,
|
|
6647
|
+
`${programFiles}\\Git\\mingw64\\ssl\\certs\\ca-bundle.crt`,
|
|
6648
|
+
`${programFilesX86}\\Git\\usr\\ssl\\certs\\ca-bundle.crt`,
|
|
6649
|
+
`${programFilesX86}\\Git\\mingw64\\ssl\\certs\\ca-bundle.crt`,
|
|
6650
|
+
`D:\\ca-certificates.crt`,
|
|
6651
|
+
`/private/etc/ssl/certs/ca-certificates.crt`,
|
|
6652
|
+
// Mac OS
|
|
6653
|
+
process.env.NODE_EXTRA_CA_CERTS
|
|
6654
|
+
// user-defined extra CAs
|
|
6655
|
+
].filter(Boolean);
|
|
6656
|
+
for (const certFile of systemCertFiles) {
|
|
6657
|
+
try {
|
|
6658
|
+
cas.push(fs4.readFileSync(certFile));
|
|
6659
|
+
} catch {
|
|
6660
|
+
}
|
|
6661
|
+
}
|
|
6662
|
+
return new import_undici.Agent({ connect: { ca: cas } });
|
|
6663
|
+
}
|
|
6664
|
+
var dispatcher = buildDispatcher();
|
|
6628
6665
|
var PackmindHttpClient = class {
|
|
6629
6666
|
constructor(apiKey) {
|
|
6630
6667
|
this.apiKey = apiKey;
|
|
@@ -6680,7 +6717,9 @@ var PackmindHttpClient = class {
|
|
|
6680
6717
|
Authorization: `Bearer ${this.apiKey}`,
|
|
6681
6718
|
"User-Agent": `packmind-cli:${import_package.version}`
|
|
6682
6719
|
},
|
|
6683
|
-
...body ? { body: JSON.stringify(body) } : {}
|
|
6720
|
+
...body ? { body: JSON.stringify(body) } : {},
|
|
6721
|
+
// @ts-expect-error — Node.js fetch (undici) accepts a dispatcher option not present in the DOM types
|
|
6722
|
+
dispatcher
|
|
6684
6723
|
});
|
|
6685
6724
|
if (!response.ok) {
|
|
6686
6725
|
if (options.onError) {
|
|
@@ -9681,7 +9720,7 @@ function parseSkillMd(content) {
|
|
|
9681
9720
|
}
|
|
9682
9721
|
|
|
9683
9722
|
// apps/cli/src/application/useCases/InstallPackagesUseCase.ts
|
|
9684
|
-
var
|
|
9723
|
+
var fs5 = __toESM(require("fs/promises"));
|
|
9685
9724
|
var path6 = __toESM(require("path"));
|
|
9686
9725
|
|
|
9687
9726
|
// apps/cli/src/infra/utils/permissions.ts
|
|
@@ -9793,7 +9832,7 @@ var InstallPackagesUseCase = class {
|
|
|
9793
9832
|
async createOrUpdateFile(baseDirectory, file, result, skillFilePermissions) {
|
|
9794
9833
|
const fullPath = path6.join(baseDirectory, file.path);
|
|
9795
9834
|
const directory = path6.dirname(fullPath);
|
|
9796
|
-
await
|
|
9835
|
+
await fs5.mkdir(directory, { recursive: true });
|
|
9797
9836
|
const fileExists = await this.fileExists(fullPath);
|
|
9798
9837
|
if (file.content !== void 0) {
|
|
9799
9838
|
await this.handleFullContentUpdate(
|
|
@@ -9813,13 +9852,13 @@ var InstallPackagesUseCase = class {
|
|
|
9813
9852
|
);
|
|
9814
9853
|
}
|
|
9815
9854
|
if (skillFilePermissions && supportsUnixPermissions()) {
|
|
9816
|
-
await
|
|
9855
|
+
await fs5.chmod(fullPath, parsePermissionString(skillFilePermissions));
|
|
9817
9856
|
}
|
|
9818
9857
|
}
|
|
9819
9858
|
async handleFullContentUpdate(fullPath, content, fileExists, result, isBase64) {
|
|
9820
9859
|
if (isBase64) {
|
|
9821
9860
|
const buffer = Buffer.from(content, "base64");
|
|
9822
|
-
await
|
|
9861
|
+
await fs5.writeFile(fullPath, buffer);
|
|
9823
9862
|
if (fileExists) {
|
|
9824
9863
|
result.filesUpdated++;
|
|
9825
9864
|
} else {
|
|
@@ -9828,7 +9867,7 @@ var InstallPackagesUseCase = class {
|
|
|
9828
9867
|
return;
|
|
9829
9868
|
}
|
|
9830
9869
|
if (fileExists) {
|
|
9831
|
-
const existingContent = await
|
|
9870
|
+
const existingContent = await fs5.readFile(fullPath, "utf-8");
|
|
9832
9871
|
const commentMarker = this.extractCommentMarker(content);
|
|
9833
9872
|
let finalContent;
|
|
9834
9873
|
if (!commentMarker) {
|
|
@@ -9841,18 +9880,18 @@ var InstallPackagesUseCase = class {
|
|
|
9841
9880
|
);
|
|
9842
9881
|
}
|
|
9843
9882
|
if (existingContent !== finalContent) {
|
|
9844
|
-
await
|
|
9883
|
+
await fs5.writeFile(fullPath, finalContent, "utf-8");
|
|
9845
9884
|
result.filesUpdated++;
|
|
9846
9885
|
}
|
|
9847
9886
|
} else {
|
|
9848
|
-
await
|
|
9887
|
+
await fs5.writeFile(fullPath, content, "utf-8");
|
|
9849
9888
|
result.filesCreated++;
|
|
9850
9889
|
}
|
|
9851
9890
|
}
|
|
9852
9891
|
async handleSectionsUpdate(fullPath, sections, fileExists, result, baseDirectory) {
|
|
9853
9892
|
let currentContent = "";
|
|
9854
9893
|
if (fileExists) {
|
|
9855
|
-
currentContent = await
|
|
9894
|
+
currentContent = await fs5.readFile(fullPath, "utf-8");
|
|
9856
9895
|
}
|
|
9857
9896
|
const mergedContent = mergeSectionsIntoFileContent(
|
|
9858
9897
|
currentContent,
|
|
@@ -9860,11 +9899,11 @@ var InstallPackagesUseCase = class {
|
|
|
9860
9899
|
);
|
|
9861
9900
|
if (currentContent !== mergedContent) {
|
|
9862
9901
|
if (this.isEffectivelyEmpty(mergedContent) && fileExists) {
|
|
9863
|
-
await
|
|
9902
|
+
await fs5.unlink(fullPath);
|
|
9864
9903
|
result.filesDeleted++;
|
|
9865
9904
|
await this.removeEmptyParentDirectories(fullPath, baseDirectory);
|
|
9866
9905
|
} else {
|
|
9867
|
-
await
|
|
9906
|
+
await fs5.writeFile(fullPath, mergedContent, "utf-8");
|
|
9868
9907
|
if (fileExists) {
|
|
9869
9908
|
result.filesUpdated++;
|
|
9870
9909
|
} else {
|
|
@@ -9875,20 +9914,20 @@ var InstallPackagesUseCase = class {
|
|
|
9875
9914
|
}
|
|
9876
9915
|
async deleteFile(baseDirectory, filePath, result) {
|
|
9877
9916
|
const fullPath = path6.join(baseDirectory, filePath);
|
|
9878
|
-
const stat9 = await
|
|
9917
|
+
const stat9 = await fs5.stat(fullPath).catch(() => null);
|
|
9879
9918
|
if (stat9?.isDirectory()) {
|
|
9880
|
-
await
|
|
9919
|
+
await fs5.rm(fullPath, { recursive: true, force: true });
|
|
9881
9920
|
result.filesDeleted++;
|
|
9882
9921
|
await this.removeEmptyParentDirectories(fullPath, baseDirectory);
|
|
9883
9922
|
} else if (stat9?.isFile()) {
|
|
9884
|
-
await
|
|
9923
|
+
await fs5.unlink(fullPath);
|
|
9885
9924
|
result.filesDeleted++;
|
|
9886
9925
|
await this.removeEmptyParentDirectories(fullPath, baseDirectory);
|
|
9887
9926
|
}
|
|
9888
9927
|
}
|
|
9889
9928
|
async fileExists(filePath) {
|
|
9890
9929
|
try {
|
|
9891
|
-
await
|
|
9930
|
+
await fs5.access(filePath);
|
|
9892
9931
|
return true;
|
|
9893
9932
|
} catch {
|
|
9894
9933
|
return false;
|
|
@@ -9959,9 +9998,9 @@ ${endMarker}`;
|
|
|
9959
9998
|
for (const folder of folders) {
|
|
9960
9999
|
const fullPath = path6.join(baseDirectory, folder);
|
|
9961
10000
|
try {
|
|
9962
|
-
await
|
|
10001
|
+
await fs5.access(fullPath);
|
|
9963
10002
|
const fileCount = await this.countFilesInDirectory(fullPath);
|
|
9964
|
-
await
|
|
10003
|
+
await fs5.rm(fullPath, { recursive: true, force: true });
|
|
9965
10004
|
deletedFilesCount += fileCount;
|
|
9966
10005
|
await this.removeEmptyParentDirectories(fullPath, baseDirectory);
|
|
9967
10006
|
} catch {
|
|
@@ -9974,7 +10013,7 @@ ${endMarker}`;
|
|
|
9974
10013
|
*/
|
|
9975
10014
|
async countFilesInDirectory(dirPath) {
|
|
9976
10015
|
let count = 0;
|
|
9977
|
-
const entries = await
|
|
10016
|
+
const entries = await fs5.readdir(dirPath, { withFileTypes: true });
|
|
9978
10017
|
for (const entry of entries) {
|
|
9979
10018
|
const entryPath = path6.join(dirPath, entry.name);
|
|
9980
10019
|
if (entry.isDirectory()) {
|
|
@@ -9990,7 +10029,7 @@ ${endMarker}`;
|
|
|
9990
10029
|
*/
|
|
9991
10030
|
async isDirectoryEmpty(dirPath) {
|
|
9992
10031
|
try {
|
|
9993
|
-
const entries = await
|
|
10032
|
+
const entries = await fs5.readdir(dirPath);
|
|
9994
10033
|
return entries.length === 0;
|
|
9995
10034
|
} catch {
|
|
9996
10035
|
return false;
|
|
@@ -10007,7 +10046,7 @@ ${endMarker}`;
|
|
|
10007
10046
|
const isEmpty = await this.isDirectoryEmpty(currentDir);
|
|
10008
10047
|
if (!isEmpty) break;
|
|
10009
10048
|
try {
|
|
10010
|
-
await
|
|
10049
|
+
await fs5.rmdir(currentDir);
|
|
10011
10050
|
} catch {
|
|
10012
10051
|
break;
|
|
10013
10052
|
}
|
|
@@ -10017,7 +10056,7 @@ ${endMarker}`;
|
|
|
10017
10056
|
};
|
|
10018
10057
|
|
|
10019
10058
|
// apps/cli/src/application/useCases/InstallUseCase.ts
|
|
10020
|
-
var
|
|
10059
|
+
var fs6 = __toESM(require("fs/promises"));
|
|
10021
10060
|
var path7 = __toESM(require("path"));
|
|
10022
10061
|
|
|
10023
10062
|
// apps/cli/src/application/utils/normalizePackageSlugs.ts
|
|
@@ -10081,8 +10120,8 @@ var InstallUseCase = class {
|
|
|
10081
10120
|
lockfileVersion: 1,
|
|
10082
10121
|
packageSlugs: [],
|
|
10083
10122
|
agents: [],
|
|
10084
|
-
|
|
10085
|
-
|
|
10123
|
+
artifacts: {},
|
|
10124
|
+
...command32.skipInstalledAt ? {} : { installedAt: (/* @__PURE__ */ new Date()).toISOString() }
|
|
10086
10125
|
};
|
|
10087
10126
|
let packagesSlugs;
|
|
10088
10127
|
let normalizedPackages = [];
|
|
@@ -10132,6 +10171,18 @@ var InstallUseCase = class {
|
|
|
10132
10171
|
uniqueFilesMap.set(file.path, file);
|
|
10133
10172
|
}
|
|
10134
10173
|
const uniqueFiles = Array.from(uniqueFilesMap.values());
|
|
10174
|
+
if (command32.skipInstalledAt) {
|
|
10175
|
+
for (const file of uniqueFiles) {
|
|
10176
|
+
if (file.path === "packmind-lock.json" && file.content) {
|
|
10177
|
+
try {
|
|
10178
|
+
const lockFileData = JSON.parse(file.content);
|
|
10179
|
+
delete lockFileData.installedAt;
|
|
10180
|
+
file.content = JSON.stringify(lockFileData, null, 2) + "\n";
|
|
10181
|
+
} catch {
|
|
10182
|
+
}
|
|
10183
|
+
}
|
|
10184
|
+
}
|
|
10185
|
+
}
|
|
10135
10186
|
for (const file of uniqueFiles) {
|
|
10136
10187
|
if (file.path.includes(".packmind/recipes/") && file.path.endsWith(".md")) {
|
|
10137
10188
|
result.recipesCount++;
|
|
@@ -10268,7 +10319,7 @@ var InstallUseCase = class {
|
|
|
10268
10319
|
async createOrUpdateFile(baseDirectory, file, result, skillFilePermissions) {
|
|
10269
10320
|
const fullPath = path7.join(baseDirectory, file.path);
|
|
10270
10321
|
const directory = path7.dirname(fullPath);
|
|
10271
|
-
await
|
|
10322
|
+
await fs6.mkdir(directory, { recursive: true });
|
|
10272
10323
|
const fileExists = await this.fileExists(fullPath);
|
|
10273
10324
|
if (file.content !== void 0) {
|
|
10274
10325
|
await this.handleFullContentUpdate(
|
|
@@ -10288,13 +10339,13 @@ var InstallUseCase = class {
|
|
|
10288
10339
|
);
|
|
10289
10340
|
}
|
|
10290
10341
|
if (skillFilePermissions && supportsUnixPermissions()) {
|
|
10291
|
-
await
|
|
10342
|
+
await fs6.chmod(fullPath, parsePermissionString(skillFilePermissions));
|
|
10292
10343
|
}
|
|
10293
10344
|
}
|
|
10294
10345
|
async handleFullContentUpdate(fullPath, content, fileExists, result, isBase64) {
|
|
10295
10346
|
if (isBase64) {
|
|
10296
10347
|
const buffer = Buffer.from(content, "base64");
|
|
10297
|
-
await
|
|
10348
|
+
await fs6.writeFile(fullPath, buffer);
|
|
10298
10349
|
if (fileExists) {
|
|
10299
10350
|
result.filesUpdated++;
|
|
10300
10351
|
} else {
|
|
@@ -10303,7 +10354,7 @@ var InstallUseCase = class {
|
|
|
10303
10354
|
return;
|
|
10304
10355
|
}
|
|
10305
10356
|
if (fileExists) {
|
|
10306
|
-
const existingContent = await
|
|
10357
|
+
const existingContent = await fs6.readFile(fullPath, "utf-8");
|
|
10307
10358
|
const commentMarker = this.extractCommentMarker(content);
|
|
10308
10359
|
let finalContent;
|
|
10309
10360
|
if (!commentMarker) {
|
|
@@ -10316,18 +10367,18 @@ var InstallUseCase = class {
|
|
|
10316
10367
|
);
|
|
10317
10368
|
}
|
|
10318
10369
|
if (existingContent !== finalContent) {
|
|
10319
|
-
await
|
|
10370
|
+
await fs6.writeFile(fullPath, finalContent, "utf-8");
|
|
10320
10371
|
result.filesUpdated++;
|
|
10321
10372
|
}
|
|
10322
10373
|
} else {
|
|
10323
|
-
await
|
|
10374
|
+
await fs6.writeFile(fullPath, content, "utf-8");
|
|
10324
10375
|
result.filesCreated++;
|
|
10325
10376
|
}
|
|
10326
10377
|
}
|
|
10327
10378
|
async handleSectionsUpdate(fullPath, sections, fileExists, result, baseDirectory) {
|
|
10328
10379
|
let currentContent = "";
|
|
10329
10380
|
if (fileExists) {
|
|
10330
|
-
currentContent = await
|
|
10381
|
+
currentContent = await fs6.readFile(fullPath, "utf-8");
|
|
10331
10382
|
}
|
|
10332
10383
|
const mergedContent = mergeSectionsIntoFileContent(
|
|
10333
10384
|
currentContent,
|
|
@@ -10335,11 +10386,11 @@ var InstallUseCase = class {
|
|
|
10335
10386
|
);
|
|
10336
10387
|
if (currentContent !== mergedContent) {
|
|
10337
10388
|
if (this.isEffectivelyEmpty(mergedContent) && fileExists) {
|
|
10338
|
-
await
|
|
10389
|
+
await fs6.unlink(fullPath);
|
|
10339
10390
|
result.filesDeleted++;
|
|
10340
10391
|
await this.removeEmptyParentDirectories(fullPath, baseDirectory);
|
|
10341
10392
|
} else {
|
|
10342
|
-
await
|
|
10393
|
+
await fs6.writeFile(fullPath, mergedContent, "utf-8");
|
|
10343
10394
|
if (fileExists) {
|
|
10344
10395
|
result.filesUpdated++;
|
|
10345
10396
|
} else {
|
|
@@ -10350,13 +10401,13 @@ var InstallUseCase = class {
|
|
|
10350
10401
|
}
|
|
10351
10402
|
async deleteFile(baseDirectory, filePath, result) {
|
|
10352
10403
|
const fullPath = path7.join(baseDirectory, filePath);
|
|
10353
|
-
const stat9 = await
|
|
10404
|
+
const stat9 = await fs6.stat(fullPath).catch(() => null);
|
|
10354
10405
|
if (stat9?.isDirectory()) {
|
|
10355
|
-
await
|
|
10406
|
+
await fs6.rm(fullPath, { recursive: true, force: true });
|
|
10356
10407
|
result.filesDeleted++;
|
|
10357
10408
|
await this.removeEmptyParentDirectories(fullPath, baseDirectory);
|
|
10358
10409
|
} else if (stat9?.isFile()) {
|
|
10359
|
-
await
|
|
10410
|
+
await fs6.unlink(fullPath);
|
|
10360
10411
|
result.filesDeleted++;
|
|
10361
10412
|
await this.removeEmptyParentDirectories(fullPath, baseDirectory);
|
|
10362
10413
|
}
|
|
@@ -10366,7 +10417,7 @@ var InstallUseCase = class {
|
|
|
10366
10417
|
}
|
|
10367
10418
|
async fileExists(filePath) {
|
|
10368
10419
|
try {
|
|
10369
|
-
await
|
|
10420
|
+
await fs6.access(filePath);
|
|
10370
10421
|
return true;
|
|
10371
10422
|
} catch {
|
|
10372
10423
|
return false;
|
|
@@ -10418,9 +10469,9 @@ ${endMarker}`;
|
|
|
10418
10469
|
for (const folder of folders) {
|
|
10419
10470
|
const fullPath = path7.join(baseDirectory, folder);
|
|
10420
10471
|
try {
|
|
10421
|
-
await
|
|
10472
|
+
await fs6.access(fullPath);
|
|
10422
10473
|
const fileCount = await this.countFilesInDirectory(fullPath);
|
|
10423
|
-
await
|
|
10474
|
+
await fs6.rm(fullPath, { recursive: true, force: true });
|
|
10424
10475
|
deletedFilesCount += fileCount;
|
|
10425
10476
|
await this.removeEmptyParentDirectories(fullPath, baseDirectory);
|
|
10426
10477
|
} catch {
|
|
@@ -10430,7 +10481,7 @@ ${endMarker}`;
|
|
|
10430
10481
|
}
|
|
10431
10482
|
async countFilesInDirectory(dirPath) {
|
|
10432
10483
|
let count = 0;
|
|
10433
|
-
const entries = await
|
|
10484
|
+
const entries = await fs6.readdir(dirPath, { withFileTypes: true });
|
|
10434
10485
|
for (const entry of entries) {
|
|
10435
10486
|
const entryPath = path7.join(dirPath, entry.name);
|
|
10436
10487
|
if (entry.isDirectory()) {
|
|
@@ -10443,7 +10494,7 @@ ${endMarker}`;
|
|
|
10443
10494
|
}
|
|
10444
10495
|
async isDirectoryEmpty(dirPath) {
|
|
10445
10496
|
try {
|
|
10446
|
-
const entries = await
|
|
10497
|
+
const entries = await fs6.readdir(dirPath);
|
|
10447
10498
|
return entries.length === 0;
|
|
10448
10499
|
} catch {
|
|
10449
10500
|
return false;
|
|
@@ -10456,7 +10507,7 @@ ${endMarker}`;
|
|
|
10456
10507
|
const isEmpty = await this.isDirectoryEmpty(currentDir);
|
|
10457
10508
|
if (!isEmpty) break;
|
|
10458
10509
|
try {
|
|
10459
|
-
await
|
|
10510
|
+
await fs6.rmdir(currentDir);
|
|
10460
10511
|
} catch {
|
|
10461
10512
|
break;
|
|
10462
10513
|
}
|
|
@@ -10521,7 +10572,7 @@ ${pkgList}`
|
|
|
10521
10572
|
};
|
|
10522
10573
|
|
|
10523
10574
|
// apps/cli/src/application/useCases/InstallDefaultSkillsUseCase.ts
|
|
10524
|
-
var
|
|
10575
|
+
var fs7 = __toESM(require("fs/promises"));
|
|
10525
10576
|
var path8 = __toESM(require("path"));
|
|
10526
10577
|
var import_semver = __toESM(require("semver"));
|
|
10527
10578
|
var InstallDefaultSkillsUseCase = class {
|
|
@@ -10610,22 +10661,22 @@ var InstallDefaultSkillsUseCase = class {
|
|
|
10610
10661
|
async createOrUpdateFile(baseDirectory, file, result) {
|
|
10611
10662
|
const fullPath = path8.join(baseDirectory, file.path);
|
|
10612
10663
|
const directory = path8.dirname(fullPath);
|
|
10613
|
-
await
|
|
10664
|
+
await fs7.mkdir(directory, { recursive: true });
|
|
10614
10665
|
const fileExists = await this.fileExists(fullPath);
|
|
10615
10666
|
if (fileExists) {
|
|
10616
|
-
const existingContent = await
|
|
10667
|
+
const existingContent = await fs7.readFile(fullPath, "utf-8");
|
|
10617
10668
|
if (existingContent !== file.content) {
|
|
10618
|
-
await
|
|
10669
|
+
await fs7.writeFile(fullPath, file.content, "utf-8");
|
|
10619
10670
|
result.filesUpdated++;
|
|
10620
10671
|
}
|
|
10621
10672
|
} else {
|
|
10622
|
-
await
|
|
10673
|
+
await fs7.writeFile(fullPath, file.content, "utf-8");
|
|
10623
10674
|
result.filesCreated++;
|
|
10624
10675
|
}
|
|
10625
10676
|
}
|
|
10626
10677
|
async fileExists(filePath) {
|
|
10627
10678
|
try {
|
|
10628
|
-
await
|
|
10679
|
+
await fs7.access(filePath);
|
|
10629
10680
|
return true;
|
|
10630
10681
|
} catch {
|
|
10631
10682
|
return false;
|
|
@@ -10763,7 +10814,7 @@ var EnvCredentialsProvider = class {
|
|
|
10763
10814
|
};
|
|
10764
10815
|
|
|
10765
10816
|
// apps/cli/src/infra/utils/credentials/FileCredentialsProvider.ts
|
|
10766
|
-
var
|
|
10817
|
+
var fs8 = __toESM(require("fs"));
|
|
10767
10818
|
var path9 = __toESM(require("path"));
|
|
10768
10819
|
var os2 = __toESM(require("os"));
|
|
10769
10820
|
var CREDENTIALS_DIR = ".packmind";
|
|
@@ -10777,11 +10828,11 @@ var FileCredentialsProvider = class {
|
|
|
10777
10828
|
}
|
|
10778
10829
|
hasCredentials() {
|
|
10779
10830
|
const credentialsPath = getCredentialsPath();
|
|
10780
|
-
if (!
|
|
10831
|
+
if (!fs8.existsSync(credentialsPath)) {
|
|
10781
10832
|
return false;
|
|
10782
10833
|
}
|
|
10783
10834
|
try {
|
|
10784
|
-
const content =
|
|
10835
|
+
const content = fs8.readFileSync(credentialsPath, "utf-8");
|
|
10785
10836
|
const credentials = JSON.parse(content);
|
|
10786
10837
|
return !!credentials.apiKey;
|
|
10787
10838
|
} catch {
|
|
@@ -10790,11 +10841,11 @@ var FileCredentialsProvider = class {
|
|
|
10790
10841
|
}
|
|
10791
10842
|
loadCredentials() {
|
|
10792
10843
|
const credentialsPath = getCredentialsPath();
|
|
10793
|
-
if (!
|
|
10844
|
+
if (!fs8.existsSync(credentialsPath)) {
|
|
10794
10845
|
return null;
|
|
10795
10846
|
}
|
|
10796
10847
|
try {
|
|
10797
|
-
const content =
|
|
10848
|
+
const content = fs8.readFileSync(credentialsPath, "utf-8");
|
|
10798
10849
|
const credentials = JSON.parse(content);
|
|
10799
10850
|
if (!credentials.apiKey) {
|
|
10800
10851
|
return null;
|
|
@@ -10818,12 +10869,12 @@ var FileCredentialsProvider = class {
|
|
|
10818
10869
|
};
|
|
10819
10870
|
function saveCredentials(apiKey) {
|
|
10820
10871
|
const credentialsDir = path9.join(os2.homedir(), CREDENTIALS_DIR);
|
|
10821
|
-
if (!
|
|
10822
|
-
|
|
10872
|
+
if (!fs8.existsSync(credentialsDir)) {
|
|
10873
|
+
fs8.mkdirSync(credentialsDir, { recursive: true, mode: 448 });
|
|
10823
10874
|
}
|
|
10824
10875
|
const credentialsPath = getCredentialsPath();
|
|
10825
10876
|
const credentials = { apiKey };
|
|
10826
|
-
|
|
10877
|
+
fs8.writeFileSync(credentialsPath, JSON.stringify(credentials, null, 2), {
|
|
10827
10878
|
mode: 384
|
|
10828
10879
|
});
|
|
10829
10880
|
}
|
|
@@ -11015,14 +11066,14 @@ var LoginUseCase = class {
|
|
|
11015
11066
|
};
|
|
11016
11067
|
|
|
11017
11068
|
// apps/cli/src/application/useCases/LogoutUseCase.ts
|
|
11018
|
-
var
|
|
11069
|
+
var fs9 = __toESM(require("fs"));
|
|
11019
11070
|
var ENV_VAR_NAME2 = "PACKMIND_API_KEY_V3";
|
|
11020
11071
|
var LogoutUseCase = class {
|
|
11021
11072
|
constructor(deps) {
|
|
11022
11073
|
this.deps = {
|
|
11023
11074
|
getCredentialsPath: deps?.getCredentialsPath ?? getCredentialsPath,
|
|
11024
|
-
fileExists: deps?.fileExists ?? ((path35) =>
|
|
11025
|
-
deleteFile: deps?.deleteFile ?? ((path35) =>
|
|
11075
|
+
fileExists: deps?.fileExists ?? ((path35) => fs9.existsSync(path35)),
|
|
11076
|
+
deleteFile: deps?.deleteFile ?? ((path35) => fs9.unlinkSync(path35)),
|
|
11026
11077
|
hasEnvVar: deps?.hasEnvVar ?? (() => !!process.env[ENV_VAR_NAME2])
|
|
11027
11078
|
};
|
|
11028
11079
|
}
|
|
@@ -11325,7 +11376,7 @@ var CheckCliVersionUseCase = class {
|
|
|
11325
11376
|
};
|
|
11326
11377
|
|
|
11327
11378
|
// apps/cli/src/infra/repositories/ConfigFileRepository.ts
|
|
11328
|
-
var
|
|
11379
|
+
var fs10 = __toESM(require("fs/promises"));
|
|
11329
11380
|
var path11 = __toESM(require("path"));
|
|
11330
11381
|
var ConfigFileRepository = class {
|
|
11331
11382
|
constructor() {
|
|
@@ -11347,7 +11398,7 @@ var ConfigFileRepository = class {
|
|
|
11347
11398
|
async configExists(baseDirectory) {
|
|
11348
11399
|
const configPath = this.getConfigPath(baseDirectory);
|
|
11349
11400
|
try {
|
|
11350
|
-
await
|
|
11401
|
+
await fs10.access(configPath);
|
|
11351
11402
|
return true;
|
|
11352
11403
|
} catch {
|
|
11353
11404
|
return false;
|
|
@@ -11356,7 +11407,7 @@ var ConfigFileRepository = class {
|
|
|
11356
11407
|
async readConfig(baseDirectory) {
|
|
11357
11408
|
const configPath = this.getConfigPath(baseDirectory);
|
|
11358
11409
|
try {
|
|
11359
|
-
const configContent = await
|
|
11410
|
+
const configContent = await fs10.readFile(configPath, "utf-8");
|
|
11360
11411
|
const rawConfig = JSON.parse(configContent);
|
|
11361
11412
|
if (!rawConfig.packages || typeof rawConfig.packages !== "object") {
|
|
11362
11413
|
throw new Error(
|
|
@@ -11394,7 +11445,7 @@ var ConfigFileRepository = class {
|
|
|
11394
11445
|
}
|
|
11395
11446
|
async writeConfigToPath(configPath, config) {
|
|
11396
11447
|
const configContent = JSON.stringify(config, null, 2) + "\n";
|
|
11397
|
-
await
|
|
11448
|
+
await fs10.writeFile(configPath, configContent, "utf-8");
|
|
11398
11449
|
}
|
|
11399
11450
|
/**
|
|
11400
11451
|
* Recursively finds all directories containing packmind.json in descendant folders.
|
|
@@ -11426,7 +11477,7 @@ var ConfigFileRepository = class {
|
|
|
11426
11477
|
}
|
|
11427
11478
|
async tryReadDirectory(directory) {
|
|
11428
11479
|
try {
|
|
11429
|
-
return await
|
|
11480
|
+
return await fs10.readdir(directory, { withFileTypes: true });
|
|
11430
11481
|
} catch {
|
|
11431
11482
|
return null;
|
|
11432
11483
|
}
|
|
@@ -11642,7 +11693,7 @@ var ConfigFileRepository = class {
|
|
|
11642
11693
|
}
|
|
11643
11694
|
async tryReadFile(filePath) {
|
|
11644
11695
|
try {
|
|
11645
|
-
return await
|
|
11696
|
+
return await fs10.readFile(filePath, "utf-8");
|
|
11646
11697
|
} catch (error) {
|
|
11647
11698
|
if (error.code === "ENOENT") {
|
|
11648
11699
|
return null;
|
|
@@ -11660,7 +11711,7 @@ var ConfigFileRepository = class {
|
|
|
11660
11711
|
};
|
|
11661
11712
|
|
|
11662
11713
|
// apps/cli/src/infra/repositories/LockFileRepository.ts
|
|
11663
|
-
var
|
|
11714
|
+
var fs11 = __toESM(require("fs/promises"));
|
|
11664
11715
|
var path12 = __toESM(require("path"));
|
|
11665
11716
|
var LockFileRepository = class {
|
|
11666
11717
|
constructor() {
|
|
@@ -11669,7 +11720,7 @@ var LockFileRepository = class {
|
|
|
11669
11720
|
async read(baseDirectory) {
|
|
11670
11721
|
const lockFilePath = this.getLockFilePath(baseDirectory);
|
|
11671
11722
|
try {
|
|
11672
|
-
const content = await
|
|
11723
|
+
const content = await fs11.readFile(lockFilePath, "utf-8");
|
|
11673
11724
|
const parsed = JSON.parse(content);
|
|
11674
11725
|
if (!this.isValidLockFile(parsed)) {
|
|
11675
11726
|
logWarningConsole(`Malformed lock file: ${lockFilePath}`);
|
|
@@ -11692,7 +11743,7 @@ var LockFileRepository = class {
|
|
|
11692
11743
|
return false;
|
|
11693
11744
|
}
|
|
11694
11745
|
const obj = data;
|
|
11695
|
-
return
|
|
11746
|
+
return Array.isArray(obj.packageSlugs) && Array.isArray(obj.agents) && (obj.targetId === void 0 || typeof obj.targetId === "string") && typeof obj.artifacts === "object" && obj.artifacts !== null && !Array.isArray(obj.artifacts);
|
|
11696
11747
|
}
|
|
11697
11748
|
getLockFilePath(baseDirectory) {
|
|
11698
11749
|
return path12.join(baseDirectory, this.LOCK_FILENAME);
|
|
@@ -11995,7 +12046,7 @@ ${spaceList}`
|
|
|
11995
12046
|
|
|
11996
12047
|
// apps/cli/src/application/useCases/diffStrategies/CommandDiffStrategy.ts
|
|
11997
12048
|
var import_diff2 = require("diff");
|
|
11998
|
-
var
|
|
12049
|
+
var fs13 = __toESM(require("fs/promises"));
|
|
11999
12050
|
var path15 = __toESM(require("path"));
|
|
12000
12051
|
var CommandDiffStrategy = class {
|
|
12001
12052
|
supports(file) {
|
|
@@ -12005,7 +12056,7 @@ var CommandDiffStrategy = class {
|
|
|
12005
12056
|
const fullPath = path15.join(baseDirectory, file.path);
|
|
12006
12057
|
let localContent;
|
|
12007
12058
|
try {
|
|
12008
|
-
localContent = await
|
|
12059
|
+
localContent = await fs13.readFile(fullPath, "utf-8");
|
|
12009
12060
|
} catch {
|
|
12010
12061
|
return [];
|
|
12011
12062
|
}
|
|
@@ -12035,7 +12086,7 @@ var CommandDiffStrategy = class {
|
|
|
12035
12086
|
|
|
12036
12087
|
// apps/cli/src/application/useCases/diffStrategies/SkillDiffStrategy.ts
|
|
12037
12088
|
var import_diff3 = require("diff");
|
|
12038
|
-
var
|
|
12089
|
+
var fs14 = __toESM(require("fs/promises"));
|
|
12039
12090
|
var path16 = __toESM(require("path"));
|
|
12040
12091
|
|
|
12041
12092
|
// apps/cli/src/application/utils/stripFrontmatter.ts
|
|
@@ -12384,14 +12435,14 @@ var SkillDiffStrategy = class {
|
|
|
12384
12435
|
}
|
|
12385
12436
|
async tryReadFile(filePath) {
|
|
12386
12437
|
try {
|
|
12387
|
-
return await
|
|
12438
|
+
return await fs14.readFile(filePath, "utf-8");
|
|
12388
12439
|
} catch {
|
|
12389
12440
|
return null;
|
|
12390
12441
|
}
|
|
12391
12442
|
}
|
|
12392
12443
|
async tryReadFileBinaryAware(filePath) {
|
|
12393
12444
|
try {
|
|
12394
|
-
const buffer = await
|
|
12445
|
+
const buffer = await fs14.readFile(filePath);
|
|
12395
12446
|
if (isBinaryFile(filePath, buffer)) {
|
|
12396
12447
|
return { content: buffer.toString("base64"), isBase64: true };
|
|
12397
12448
|
}
|
|
@@ -12403,7 +12454,7 @@ var SkillDiffStrategy = class {
|
|
|
12403
12454
|
async listFilesRecursively(dirPath, prefix = "") {
|
|
12404
12455
|
let entries;
|
|
12405
12456
|
try {
|
|
12406
|
-
entries = await
|
|
12457
|
+
entries = await fs14.readdir(dirPath);
|
|
12407
12458
|
} catch {
|
|
12408
12459
|
return [];
|
|
12409
12460
|
}
|
|
@@ -12429,7 +12480,7 @@ var SkillDiffStrategy = class {
|
|
|
12429
12480
|
}
|
|
12430
12481
|
async tryStatFile(filePath) {
|
|
12431
12482
|
try {
|
|
12432
|
-
const stat9 = await
|
|
12483
|
+
const stat9 = await fs14.stat(filePath);
|
|
12433
12484
|
return { isDirectory: stat9.isDirectory() };
|
|
12434
12485
|
} catch {
|
|
12435
12486
|
return null;
|
|
@@ -12437,7 +12488,7 @@ var SkillDiffStrategy = class {
|
|
|
12437
12488
|
}
|
|
12438
12489
|
async tryGetPermissions(filePath) {
|
|
12439
12490
|
try {
|
|
12440
|
-
const stat9 = await
|
|
12491
|
+
const stat9 = await fs14.stat(filePath);
|
|
12441
12492
|
return modeToPermissionStringOrDefault(stat9.mode);
|
|
12442
12493
|
} catch {
|
|
12443
12494
|
return null;
|
|
@@ -12453,7 +12504,7 @@ var SkillDiffStrategy = class {
|
|
|
12453
12504
|
};
|
|
12454
12505
|
|
|
12455
12506
|
// apps/cli/src/application/useCases/diffStrategies/StandardDiffStrategy.ts
|
|
12456
|
-
var
|
|
12507
|
+
var fs15 = __toESM(require("fs/promises"));
|
|
12457
12508
|
var path17 = __toESM(require("path"));
|
|
12458
12509
|
|
|
12459
12510
|
// apps/cli/src/application/utils/parseStandardMd.ts
|
|
@@ -12765,7 +12816,7 @@ var StandardDiffStrategy = class {
|
|
|
12765
12816
|
const fullPath = path17.join(baseDirectory, file.path);
|
|
12766
12817
|
let localContent;
|
|
12767
12818
|
try {
|
|
12768
|
-
localContent = await
|
|
12819
|
+
localContent = await fs15.readFile(fullPath, "utf-8");
|
|
12769
12820
|
} catch {
|
|
12770
12821
|
return [];
|
|
12771
12822
|
}
|
|
@@ -13667,11 +13718,11 @@ var HumanReadableLogger = class {
|
|
|
13667
13718
|
var pathModule2 = __toESM(require("path"));
|
|
13668
13719
|
|
|
13669
13720
|
// apps/cli/src/infra/commands/lintHandler.ts
|
|
13670
|
-
var
|
|
13721
|
+
var fs17 = __toESM(require("fs/promises"));
|
|
13671
13722
|
var pathModule = __toESM(require("path"));
|
|
13672
13723
|
|
|
13673
13724
|
// apps/cli/src/application/services/PackmindIgnoreReader.ts
|
|
13674
|
-
var
|
|
13725
|
+
var fs16 = __toESM(require("fs/promises"));
|
|
13675
13726
|
var path18 = __toESM(require("path"));
|
|
13676
13727
|
var IGNORE_FILENAME = ".packmindignore";
|
|
13677
13728
|
var PackmindIgnoreReader = class {
|
|
@@ -13702,7 +13753,7 @@ var PackmindIgnoreReader = class {
|
|
|
13702
13753
|
async parseIgnoreFile(filePath) {
|
|
13703
13754
|
let content;
|
|
13704
13755
|
try {
|
|
13705
|
-
content = await
|
|
13756
|
+
content = await fs16.readFile(filePath, "utf-8");
|
|
13706
13757
|
} catch (err) {
|
|
13707
13758
|
if (err.code === "ENOENT") {
|
|
13708
13759
|
return [];
|
|
@@ -13749,7 +13800,7 @@ async function lintHandler(args2, deps) {
|
|
|
13749
13800
|
const absolutePath = resolvePath(targetPath);
|
|
13750
13801
|
let stats;
|
|
13751
13802
|
try {
|
|
13752
|
-
stats = await
|
|
13803
|
+
stats = await fs17.stat(absolutePath);
|
|
13753
13804
|
} catch (err) {
|
|
13754
13805
|
const isNotFound = err.code === "ENOENT";
|
|
13755
13806
|
const message = isNotFound ? `File or directory "${absolutePath}" does not exist` : `Cannot access "${absolutePath}": ${err.message}`;
|
|
@@ -14067,13 +14118,13 @@ function extractWasmFiles() {
|
|
|
14067
14118
|
|
|
14068
14119
|
// apps/cli/src/main.ts
|
|
14069
14120
|
var import_dotenv = require("dotenv");
|
|
14070
|
-
var
|
|
14121
|
+
var fs26 = __toESM(require("fs"));
|
|
14071
14122
|
var path34 = __toESM(require("path"));
|
|
14072
14123
|
|
|
14073
14124
|
// apps/cli/src/infra/commands/InstallCommand.ts
|
|
14074
14125
|
var import_cmd_ts2 = __toESM(require_cjs());
|
|
14075
14126
|
var path19 = __toESM(require("path"));
|
|
14076
|
-
var
|
|
14127
|
+
var fs18 = __toESM(require("fs"));
|
|
14077
14128
|
|
|
14078
14129
|
// apps/cli/src/infra/commands/installPackagesHandler.ts
|
|
14079
14130
|
function formatOverviewRow(configPath, packages, pathColumnWidth) {
|
|
@@ -14155,14 +14206,14 @@ function findSubDirectoriesWithPackmindJson(dirPath, recursive) {
|
|
|
14155
14206
|
const result = [];
|
|
14156
14207
|
let entries;
|
|
14157
14208
|
try {
|
|
14158
|
-
entries =
|
|
14209
|
+
entries = fs18.readdirSync(dirPath, { withFileTypes: true });
|
|
14159
14210
|
} catch {
|
|
14160
14211
|
return result;
|
|
14161
14212
|
}
|
|
14162
14213
|
for (const entry of entries) {
|
|
14163
14214
|
if (!entry.isDirectory()) continue;
|
|
14164
14215
|
const subDir = path19.join(dirPath, entry.name);
|
|
14165
|
-
if (
|
|
14216
|
+
if (fs18.existsSync(path19.join(subDir, "packmind.json"))) {
|
|
14166
14217
|
result.push(subDir);
|
|
14167
14218
|
}
|
|
14168
14219
|
if (recursive) {
|
|
@@ -14240,7 +14291,7 @@ async function notifyArtefactsDistributionIfInGitRepo(params) {
|
|
|
14240
14291
|
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(dir);
|
|
14241
14292
|
if (!gitRoot) return;
|
|
14242
14293
|
const lockFilePath = path19.join(dir, "packmind-lock.json");
|
|
14243
|
-
const content =
|
|
14294
|
+
const content = fs18.readFileSync(lockFilePath, "utf-8");
|
|
14244
14295
|
const packmindLockFile = JSON.parse(content);
|
|
14245
14296
|
const gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
|
|
14246
14297
|
const gitBranch = packmindCliHexa.getCurrentBranch(gitRoot);
|
|
@@ -14293,7 +14344,8 @@ async function installHandler({
|
|
|
14293
14344
|
packages,
|
|
14294
14345
|
list,
|
|
14295
14346
|
show,
|
|
14296
|
-
status
|
|
14347
|
+
status,
|
|
14348
|
+
skipInstalledAt
|
|
14297
14349
|
}) {
|
|
14298
14350
|
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
14299
14351
|
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
@@ -14321,12 +14373,12 @@ async function installHandler({
|
|
|
14321
14373
|
}
|
|
14322
14374
|
const cwd = installPath ? path19.resolve(process.cwd(), installPath) : process.cwd();
|
|
14323
14375
|
if (installPath) {
|
|
14324
|
-
if (!
|
|
14376
|
+
if (!fs18.existsSync(cwd)) {
|
|
14325
14377
|
logErrorConsole(`Path does not exist: ${cwd}`);
|
|
14326
14378
|
process.exit(1);
|
|
14327
14379
|
return;
|
|
14328
14380
|
}
|
|
14329
|
-
if (!
|
|
14381
|
+
if (!fs18.statSync(cwd).isDirectory()) {
|
|
14330
14382
|
logErrorConsole(`Path is not a directory: ${cwd}`);
|
|
14331
14383
|
process.exit(1);
|
|
14332
14384
|
return;
|
|
@@ -14339,7 +14391,7 @@ async function installHandler({
|
|
|
14339
14391
|
targetDirs = [cwd];
|
|
14340
14392
|
} else {
|
|
14341
14393
|
targetDirs = [];
|
|
14342
|
-
if (
|
|
14394
|
+
if (fs18.existsSync(path19.join(cwd, "packmind.json"))) {
|
|
14343
14395
|
targetDirs.push(cwd);
|
|
14344
14396
|
}
|
|
14345
14397
|
targetDirs.push(...findSubDirectoriesWithPackmindJson(cwd, true));
|
|
@@ -14354,7 +14406,8 @@ async function installHandler({
|
|
|
14354
14406
|
try {
|
|
14355
14407
|
const result = await packmindCliHexa.install({
|
|
14356
14408
|
baseDirectory: dir,
|
|
14357
|
-
packages: packages.length > 0 ? packages : void 0
|
|
14409
|
+
packages: packages.length > 0 ? packages : void 0,
|
|
14410
|
+
skipInstalledAt
|
|
14358
14411
|
});
|
|
14359
14412
|
results.push(result);
|
|
14360
14413
|
await notifyArtefactsDistributionIfInGitRepo({
|
|
@@ -14420,6 +14473,10 @@ var installCommand = (0, import_cmd_ts2.command)({
|
|
|
14420
14473
|
long: "show",
|
|
14421
14474
|
description: "[Deprecated] Show details of a specific package",
|
|
14422
14475
|
defaultValue: () => ""
|
|
14476
|
+
}),
|
|
14477
|
+
skipInstalledAt: (0, import_cmd_ts2.flag)({
|
|
14478
|
+
long: "skip-installed-at",
|
|
14479
|
+
description: "Omit the installedAt timestamp from the packmind-lock.json file"
|
|
14423
14480
|
})
|
|
14424
14481
|
},
|
|
14425
14482
|
handler: installHandler
|
|
@@ -14725,7 +14782,7 @@ var import_cmd_ts9 = __toESM(require_cjs());
|
|
|
14725
14782
|
var readline2 = __toESM(require("readline"));
|
|
14726
14783
|
|
|
14727
14784
|
// apps/cli/src/infra/commands/skills/incompatibleSkillsHandler.ts
|
|
14728
|
-
var
|
|
14785
|
+
var fs19 = __toESM(require("fs/promises"));
|
|
14729
14786
|
var path20 = __toESM(require("path"));
|
|
14730
14787
|
async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm) {
|
|
14731
14788
|
const skillNames = skills.map((s) => s.skillName).join(", ");
|
|
@@ -14742,7 +14799,7 @@ async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm)
|
|
|
14742
14799
|
const skillRootDirs = skill.filePaths.filter((p) => path20.basename(p) === "SKILL.md").map((p) => path20.dirname(p));
|
|
14743
14800
|
for (const dir of skillRootDirs) {
|
|
14744
14801
|
try {
|
|
14745
|
-
await
|
|
14802
|
+
await fs19.rm(path20.join(baseDirectory, dir), {
|
|
14746
14803
|
recursive: true,
|
|
14747
14804
|
force: true
|
|
14748
14805
|
});
|
|
@@ -14755,7 +14812,7 @@ async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm)
|
|
|
14755
14812
|
for (const relativePath of skill.filePaths) {
|
|
14756
14813
|
if (!skillRootDirs.some((dir) => relativePath.startsWith(dir + "/"))) {
|
|
14757
14814
|
try {
|
|
14758
|
-
await
|
|
14815
|
+
await fs19.unlink(path20.join(baseDirectory, relativePath));
|
|
14759
14816
|
} catch (error) {
|
|
14760
14817
|
logErrorConsole(
|
|
14761
14818
|
`Failed to delete "${relativePath}": ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -15233,7 +15290,7 @@ var import_cmd_ts18 = __toESM(require_cjs());
|
|
|
15233
15290
|
|
|
15234
15291
|
// apps/cli/src/infra/commands/playbook/diffArtefactsHandler.ts
|
|
15235
15292
|
var nodePath = __toESM(require("path"));
|
|
15236
|
-
var
|
|
15293
|
+
var fs20 = __toESM(require("fs/promises"));
|
|
15237
15294
|
|
|
15238
15295
|
// apps/cli/src/infra/utils/diffFormatter.ts
|
|
15239
15296
|
var import_diff4 = require("diff");
|
|
@@ -15532,7 +15589,7 @@ async function diffArtefactsHandler(deps) {
|
|
|
15532
15589
|
const searchPath = nodePath.resolve(cwd, deps.path ?? ".");
|
|
15533
15590
|
if (deps.path !== void 0) {
|
|
15534
15591
|
try {
|
|
15535
|
-
await
|
|
15592
|
+
await fs20.stat(searchPath);
|
|
15536
15593
|
} catch {
|
|
15537
15594
|
logErrorConsole(`Path does not exist: ${searchPath}`);
|
|
15538
15595
|
exit(1);
|
|
@@ -16427,7 +16484,7 @@ var import_cmd_ts24 = __toESM(require_cjs());
|
|
|
16427
16484
|
|
|
16428
16485
|
// apps/cli/src/infra/repositories/PlaybookLocalRepository.ts
|
|
16429
16486
|
var crypto = __toESM(require("crypto"));
|
|
16430
|
-
var
|
|
16487
|
+
var fs21 = __toESM(require("fs"));
|
|
16431
16488
|
var os3 = __toESM(require("os"));
|
|
16432
16489
|
var path21 = __toESM(require("path"));
|
|
16433
16490
|
var yaml = __toESM(require("yaml"));
|
|
@@ -16483,11 +16540,11 @@ var PlaybookLocalRepository = class {
|
|
|
16483
16540
|
return normalized;
|
|
16484
16541
|
}
|
|
16485
16542
|
readYaml() {
|
|
16486
|
-
if (!
|
|
16543
|
+
if (!fs21.existsSync(this.storagePath)) {
|
|
16487
16544
|
return { version: 1, changes: [] };
|
|
16488
16545
|
}
|
|
16489
16546
|
try {
|
|
16490
|
-
const content =
|
|
16547
|
+
const content = fs21.readFileSync(this.storagePath, "utf-8");
|
|
16491
16548
|
const parsed = yaml.parse(content);
|
|
16492
16549
|
if (!parsed || !Array.isArray(parsed.changes)) {
|
|
16493
16550
|
return { version: 1, changes: [] };
|
|
@@ -16502,13 +16559,13 @@ var PlaybookLocalRepository = class {
|
|
|
16502
16559
|
}
|
|
16503
16560
|
writeYaml(data) {
|
|
16504
16561
|
const dir = path21.dirname(this.storagePath);
|
|
16505
|
-
|
|
16506
|
-
|
|
16562
|
+
fs21.mkdirSync(dir, { recursive: true });
|
|
16563
|
+
fs21.writeFileSync(this.storagePath, yaml.stringify(data), "utf-8");
|
|
16507
16564
|
}
|
|
16508
16565
|
};
|
|
16509
16566
|
|
|
16510
16567
|
// apps/cli/src/infra/commands/playbook/addHandler.ts
|
|
16511
|
-
var
|
|
16568
|
+
var fs22 = __toESM(require("fs"));
|
|
16512
16569
|
var path25 = __toESM(require("path"));
|
|
16513
16570
|
var yaml2 = __toESM(require("yaml"));
|
|
16514
16571
|
var import_slug = __toESM(require("slug"));
|
|
@@ -16878,7 +16935,7 @@ function resolveSkillDirectoryRoot(absolutePath) {
|
|
|
16878
16935
|
return path25.dirname(absolutePath);
|
|
16879
16936
|
}
|
|
16880
16937
|
try {
|
|
16881
|
-
if (
|
|
16938
|
+
if (fs22.statSync(absolutePath).isDirectory()) {
|
|
16882
16939
|
return absolutePath;
|
|
16883
16940
|
}
|
|
16884
16941
|
} catch {
|
|
@@ -16887,7 +16944,7 @@ function resolveSkillDirectoryRoot(absolutePath) {
|
|
|
16887
16944
|
let current = path25.dirname(absolutePath);
|
|
16888
16945
|
const root = path25.parse(current).root;
|
|
16889
16946
|
while (current !== root) {
|
|
16890
|
-
if (
|
|
16947
|
+
if (fs22.existsSync(path25.join(current, "SKILL.md"))) {
|
|
16891
16948
|
return current;
|
|
16892
16949
|
}
|
|
16893
16950
|
current = path25.dirname(current);
|
|
@@ -17292,7 +17349,7 @@ var addPlaybookCommand = (0, import_cmd_ts24.command)({
|
|
|
17292
17349
|
var import_cmd_ts25 = __toESM(require_cjs());
|
|
17293
17350
|
|
|
17294
17351
|
// apps/cli/src/infra/commands/playbook/rmHandler.ts
|
|
17295
|
-
var
|
|
17352
|
+
var fs23 = __toESM(require("fs"));
|
|
17296
17353
|
var path26 = __toESM(require("path"));
|
|
17297
17354
|
function isSkillSupportFile(absolutePath) {
|
|
17298
17355
|
const normalized = absolutePath.replace(/\\/g, "/");
|
|
@@ -17321,7 +17378,7 @@ async function playbookRmHandler(deps) {
|
|
|
17321
17378
|
return;
|
|
17322
17379
|
}
|
|
17323
17380
|
const absolutePath = path26.resolve(getCwd(), filePath);
|
|
17324
|
-
if (!
|
|
17381
|
+
if (!fs23.existsSync(absolutePath)) {
|
|
17325
17382
|
logErrorConsole(`File not found: "${filePath}"`);
|
|
17326
17383
|
exit(1);
|
|
17327
17384
|
return;
|
|
@@ -19163,7 +19220,7 @@ var import_cmd_ts38 = __toESM(require_cjs());
|
|
|
19163
19220
|
var import_cmd_ts37 = __toESM(require_cjs());
|
|
19164
19221
|
|
|
19165
19222
|
// apps/cli/src/application/services/AgentArtifactDetectionService.ts
|
|
19166
|
-
var
|
|
19223
|
+
var fs24 = __toESM(require("fs/promises"));
|
|
19167
19224
|
var path32 = __toESM(require("path"));
|
|
19168
19225
|
var AGENT_ARTIFACT_CHECKS = [
|
|
19169
19226
|
{ agent: "claude", paths: [".claude"] },
|
|
@@ -19209,7 +19266,7 @@ var AgentArtifactDetectionService = class {
|
|
|
19209
19266
|
}
|
|
19210
19267
|
async pathExists(filePath) {
|
|
19211
19268
|
try {
|
|
19212
|
-
await
|
|
19269
|
+
await fs24.access(filePath);
|
|
19213
19270
|
return true;
|
|
19214
19271
|
} catch {
|
|
19215
19272
|
return false;
|
|
@@ -19226,7 +19283,7 @@ var AgentArtifactDetectionService = class {
|
|
|
19226
19283
|
}
|
|
19227
19284
|
}
|
|
19228
19285
|
try {
|
|
19229
|
-
const entries = await
|
|
19286
|
+
const entries = await fs24.readdir(currentDir, { withFileTypes: true });
|
|
19230
19287
|
for (const entry of entries) {
|
|
19231
19288
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
19232
19289
|
queue.push(path32.join(currentDir, entry.name));
|
|
@@ -19245,7 +19302,7 @@ var inquirer = __toESM(require("inquirer"));
|
|
|
19245
19302
|
|
|
19246
19303
|
// apps/cli/src/infra/commands/config/agents/agentsHandlerUtils.ts
|
|
19247
19304
|
var path33 = __toESM(require("path"));
|
|
19248
|
-
var
|
|
19305
|
+
var fs25 = __toESM(require("fs/promises"));
|
|
19249
19306
|
function getRelativePath(dir, startDirectory) {
|
|
19250
19307
|
if (dir === startDirectory) return "./packmind.json";
|
|
19251
19308
|
return "./" + path33.relative(startDirectory, dir) + "/packmind.json";
|
|
@@ -19255,7 +19312,7 @@ async function resolveStartDirectory(args2, getCwd, exit) {
|
|
|
19255
19312
|
if (args2.path) {
|
|
19256
19313
|
const resolvedPath = path33.resolve(getCwd(), args2.path);
|
|
19257
19314
|
try {
|
|
19258
|
-
const stat9 = await
|
|
19315
|
+
const stat9 = await fs25.stat(resolvedPath);
|
|
19259
19316
|
if (!stat9.isDirectory()) {
|
|
19260
19317
|
logErrorConsole(`Path is not a directory: ${resolvedPath}`);
|
|
19261
19318
|
exit(1);
|
|
@@ -19968,7 +20025,7 @@ function findEnvFile() {
|
|
|
19968
20025
|
let parentDir = path34.dirname(searchDir);
|
|
19969
20026
|
while (searchDir !== parentDir) {
|
|
19970
20027
|
const envPath2 = path34.join(searchDir, ".env");
|
|
19971
|
-
if (
|
|
20028
|
+
if (fs26.existsSync(envPath2)) {
|
|
19972
20029
|
return envPath2;
|
|
19973
20030
|
}
|
|
19974
20031
|
if (searchDir === stopDir) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@packmind/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"description": "A command-line interface for Packmind linting and code quality checks",
|
|
5
5
|
"private": false,
|
|
6
6
|
"bin": {
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"open": "11.0.0",
|
|
58
58
|
"semver": "^7.7.4",
|
|
59
59
|
"slug": "11.0.1",
|
|
60
|
+
"undici": "7.22.0",
|
|
60
61
|
"uuid": "11.1.0",
|
|
61
62
|
"validator": "13.15.22",
|
|
62
63
|
"web-tree-sitter": "0.25.10",
|