@packmind/cli 0.27.0 → 0.28.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/main.cjs +172 -113
- 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.0",
|
|
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,9 +10120,11 @@ var InstallUseCase = class {
|
|
|
10081
10120
|
lockfileVersion: 1,
|
|
10082
10121
|
packageSlugs: [],
|
|
10083
10122
|
agents: [],
|
|
10084
|
-
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10085
10123
|
artifacts: {}
|
|
10086
10124
|
};
|
|
10125
|
+
if (!command32.skipInstalledAt) {
|
|
10126
|
+
effectiveLockFile.installedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
10127
|
+
}
|
|
10087
10128
|
let packagesSlugs;
|
|
10088
10129
|
let normalizedPackages = [];
|
|
10089
10130
|
if (hasExplicitPackages) {
|
|
@@ -10132,6 +10173,18 @@ var InstallUseCase = class {
|
|
|
10132
10173
|
uniqueFilesMap.set(file.path, file);
|
|
10133
10174
|
}
|
|
10134
10175
|
const uniqueFiles = Array.from(uniqueFilesMap.values());
|
|
10176
|
+
if (command32.skipInstalledAt) {
|
|
10177
|
+
for (const file of uniqueFiles) {
|
|
10178
|
+
if (file.path === "packmind-lock.json" && file.content) {
|
|
10179
|
+
try {
|
|
10180
|
+
const lockFileData = JSON.parse(file.content);
|
|
10181
|
+
delete lockFileData.installedAt;
|
|
10182
|
+
file.content = JSON.stringify(lockFileData, null, 2) + "\n";
|
|
10183
|
+
} catch {
|
|
10184
|
+
}
|
|
10185
|
+
}
|
|
10186
|
+
}
|
|
10187
|
+
}
|
|
10135
10188
|
for (const file of uniqueFiles) {
|
|
10136
10189
|
if (file.path.includes(".packmind/recipes/") && file.path.endsWith(".md")) {
|
|
10137
10190
|
result.recipesCount++;
|
|
@@ -10268,7 +10321,7 @@ var InstallUseCase = class {
|
|
|
10268
10321
|
async createOrUpdateFile(baseDirectory, file, result, skillFilePermissions) {
|
|
10269
10322
|
const fullPath = path7.join(baseDirectory, file.path);
|
|
10270
10323
|
const directory = path7.dirname(fullPath);
|
|
10271
|
-
await
|
|
10324
|
+
await fs6.mkdir(directory, { recursive: true });
|
|
10272
10325
|
const fileExists = await this.fileExists(fullPath);
|
|
10273
10326
|
if (file.content !== void 0) {
|
|
10274
10327
|
await this.handleFullContentUpdate(
|
|
@@ -10288,13 +10341,13 @@ var InstallUseCase = class {
|
|
|
10288
10341
|
);
|
|
10289
10342
|
}
|
|
10290
10343
|
if (skillFilePermissions && supportsUnixPermissions()) {
|
|
10291
|
-
await
|
|
10344
|
+
await fs6.chmod(fullPath, parsePermissionString(skillFilePermissions));
|
|
10292
10345
|
}
|
|
10293
10346
|
}
|
|
10294
10347
|
async handleFullContentUpdate(fullPath, content, fileExists, result, isBase64) {
|
|
10295
10348
|
if (isBase64) {
|
|
10296
10349
|
const buffer = Buffer.from(content, "base64");
|
|
10297
|
-
await
|
|
10350
|
+
await fs6.writeFile(fullPath, buffer);
|
|
10298
10351
|
if (fileExists) {
|
|
10299
10352
|
result.filesUpdated++;
|
|
10300
10353
|
} else {
|
|
@@ -10303,7 +10356,7 @@ var InstallUseCase = class {
|
|
|
10303
10356
|
return;
|
|
10304
10357
|
}
|
|
10305
10358
|
if (fileExists) {
|
|
10306
|
-
const existingContent = await
|
|
10359
|
+
const existingContent = await fs6.readFile(fullPath, "utf-8");
|
|
10307
10360
|
const commentMarker = this.extractCommentMarker(content);
|
|
10308
10361
|
let finalContent;
|
|
10309
10362
|
if (!commentMarker) {
|
|
@@ -10316,18 +10369,18 @@ var InstallUseCase = class {
|
|
|
10316
10369
|
);
|
|
10317
10370
|
}
|
|
10318
10371
|
if (existingContent !== finalContent) {
|
|
10319
|
-
await
|
|
10372
|
+
await fs6.writeFile(fullPath, finalContent, "utf-8");
|
|
10320
10373
|
result.filesUpdated++;
|
|
10321
10374
|
}
|
|
10322
10375
|
} else {
|
|
10323
|
-
await
|
|
10376
|
+
await fs6.writeFile(fullPath, content, "utf-8");
|
|
10324
10377
|
result.filesCreated++;
|
|
10325
10378
|
}
|
|
10326
10379
|
}
|
|
10327
10380
|
async handleSectionsUpdate(fullPath, sections, fileExists, result, baseDirectory) {
|
|
10328
10381
|
let currentContent = "";
|
|
10329
10382
|
if (fileExists) {
|
|
10330
|
-
currentContent = await
|
|
10383
|
+
currentContent = await fs6.readFile(fullPath, "utf-8");
|
|
10331
10384
|
}
|
|
10332
10385
|
const mergedContent = mergeSectionsIntoFileContent(
|
|
10333
10386
|
currentContent,
|
|
@@ -10335,11 +10388,11 @@ var InstallUseCase = class {
|
|
|
10335
10388
|
);
|
|
10336
10389
|
if (currentContent !== mergedContent) {
|
|
10337
10390
|
if (this.isEffectivelyEmpty(mergedContent) && fileExists) {
|
|
10338
|
-
await
|
|
10391
|
+
await fs6.unlink(fullPath);
|
|
10339
10392
|
result.filesDeleted++;
|
|
10340
10393
|
await this.removeEmptyParentDirectories(fullPath, baseDirectory);
|
|
10341
10394
|
} else {
|
|
10342
|
-
await
|
|
10395
|
+
await fs6.writeFile(fullPath, mergedContent, "utf-8");
|
|
10343
10396
|
if (fileExists) {
|
|
10344
10397
|
result.filesUpdated++;
|
|
10345
10398
|
} else {
|
|
@@ -10350,13 +10403,13 @@ var InstallUseCase = class {
|
|
|
10350
10403
|
}
|
|
10351
10404
|
async deleteFile(baseDirectory, filePath, result) {
|
|
10352
10405
|
const fullPath = path7.join(baseDirectory, filePath);
|
|
10353
|
-
const stat9 = await
|
|
10406
|
+
const stat9 = await fs6.stat(fullPath).catch(() => null);
|
|
10354
10407
|
if (stat9?.isDirectory()) {
|
|
10355
|
-
await
|
|
10408
|
+
await fs6.rm(fullPath, { recursive: true, force: true });
|
|
10356
10409
|
result.filesDeleted++;
|
|
10357
10410
|
await this.removeEmptyParentDirectories(fullPath, baseDirectory);
|
|
10358
10411
|
} else if (stat9?.isFile()) {
|
|
10359
|
-
await
|
|
10412
|
+
await fs6.unlink(fullPath);
|
|
10360
10413
|
result.filesDeleted++;
|
|
10361
10414
|
await this.removeEmptyParentDirectories(fullPath, baseDirectory);
|
|
10362
10415
|
}
|
|
@@ -10366,7 +10419,7 @@ var InstallUseCase = class {
|
|
|
10366
10419
|
}
|
|
10367
10420
|
async fileExists(filePath) {
|
|
10368
10421
|
try {
|
|
10369
|
-
await
|
|
10422
|
+
await fs6.access(filePath);
|
|
10370
10423
|
return true;
|
|
10371
10424
|
} catch {
|
|
10372
10425
|
return false;
|
|
@@ -10418,9 +10471,9 @@ ${endMarker}`;
|
|
|
10418
10471
|
for (const folder of folders) {
|
|
10419
10472
|
const fullPath = path7.join(baseDirectory, folder);
|
|
10420
10473
|
try {
|
|
10421
|
-
await
|
|
10474
|
+
await fs6.access(fullPath);
|
|
10422
10475
|
const fileCount = await this.countFilesInDirectory(fullPath);
|
|
10423
|
-
await
|
|
10476
|
+
await fs6.rm(fullPath, { recursive: true, force: true });
|
|
10424
10477
|
deletedFilesCount += fileCount;
|
|
10425
10478
|
await this.removeEmptyParentDirectories(fullPath, baseDirectory);
|
|
10426
10479
|
} catch {
|
|
@@ -10430,7 +10483,7 @@ ${endMarker}`;
|
|
|
10430
10483
|
}
|
|
10431
10484
|
async countFilesInDirectory(dirPath) {
|
|
10432
10485
|
let count = 0;
|
|
10433
|
-
const entries = await
|
|
10486
|
+
const entries = await fs6.readdir(dirPath, { withFileTypes: true });
|
|
10434
10487
|
for (const entry of entries) {
|
|
10435
10488
|
const entryPath = path7.join(dirPath, entry.name);
|
|
10436
10489
|
if (entry.isDirectory()) {
|
|
@@ -10443,7 +10496,7 @@ ${endMarker}`;
|
|
|
10443
10496
|
}
|
|
10444
10497
|
async isDirectoryEmpty(dirPath) {
|
|
10445
10498
|
try {
|
|
10446
|
-
const entries = await
|
|
10499
|
+
const entries = await fs6.readdir(dirPath);
|
|
10447
10500
|
return entries.length === 0;
|
|
10448
10501
|
} catch {
|
|
10449
10502
|
return false;
|
|
@@ -10456,7 +10509,7 @@ ${endMarker}`;
|
|
|
10456
10509
|
const isEmpty = await this.isDirectoryEmpty(currentDir);
|
|
10457
10510
|
if (!isEmpty) break;
|
|
10458
10511
|
try {
|
|
10459
|
-
await
|
|
10512
|
+
await fs6.rmdir(currentDir);
|
|
10460
10513
|
} catch {
|
|
10461
10514
|
break;
|
|
10462
10515
|
}
|
|
@@ -10521,7 +10574,7 @@ ${pkgList}`
|
|
|
10521
10574
|
};
|
|
10522
10575
|
|
|
10523
10576
|
// apps/cli/src/application/useCases/InstallDefaultSkillsUseCase.ts
|
|
10524
|
-
var
|
|
10577
|
+
var fs7 = __toESM(require("fs/promises"));
|
|
10525
10578
|
var path8 = __toESM(require("path"));
|
|
10526
10579
|
var import_semver = __toESM(require("semver"));
|
|
10527
10580
|
var InstallDefaultSkillsUseCase = class {
|
|
@@ -10610,22 +10663,22 @@ var InstallDefaultSkillsUseCase = class {
|
|
|
10610
10663
|
async createOrUpdateFile(baseDirectory, file, result) {
|
|
10611
10664
|
const fullPath = path8.join(baseDirectory, file.path);
|
|
10612
10665
|
const directory = path8.dirname(fullPath);
|
|
10613
|
-
await
|
|
10666
|
+
await fs7.mkdir(directory, { recursive: true });
|
|
10614
10667
|
const fileExists = await this.fileExists(fullPath);
|
|
10615
10668
|
if (fileExists) {
|
|
10616
|
-
const existingContent = await
|
|
10669
|
+
const existingContent = await fs7.readFile(fullPath, "utf-8");
|
|
10617
10670
|
if (existingContent !== file.content) {
|
|
10618
|
-
await
|
|
10671
|
+
await fs7.writeFile(fullPath, file.content, "utf-8");
|
|
10619
10672
|
result.filesUpdated++;
|
|
10620
10673
|
}
|
|
10621
10674
|
} else {
|
|
10622
|
-
await
|
|
10675
|
+
await fs7.writeFile(fullPath, file.content, "utf-8");
|
|
10623
10676
|
result.filesCreated++;
|
|
10624
10677
|
}
|
|
10625
10678
|
}
|
|
10626
10679
|
async fileExists(filePath) {
|
|
10627
10680
|
try {
|
|
10628
|
-
await
|
|
10681
|
+
await fs7.access(filePath);
|
|
10629
10682
|
return true;
|
|
10630
10683
|
} catch {
|
|
10631
10684
|
return false;
|
|
@@ -10763,7 +10816,7 @@ var EnvCredentialsProvider = class {
|
|
|
10763
10816
|
};
|
|
10764
10817
|
|
|
10765
10818
|
// apps/cli/src/infra/utils/credentials/FileCredentialsProvider.ts
|
|
10766
|
-
var
|
|
10819
|
+
var fs8 = __toESM(require("fs"));
|
|
10767
10820
|
var path9 = __toESM(require("path"));
|
|
10768
10821
|
var os2 = __toESM(require("os"));
|
|
10769
10822
|
var CREDENTIALS_DIR = ".packmind";
|
|
@@ -10777,11 +10830,11 @@ var FileCredentialsProvider = class {
|
|
|
10777
10830
|
}
|
|
10778
10831
|
hasCredentials() {
|
|
10779
10832
|
const credentialsPath = getCredentialsPath();
|
|
10780
|
-
if (!
|
|
10833
|
+
if (!fs8.existsSync(credentialsPath)) {
|
|
10781
10834
|
return false;
|
|
10782
10835
|
}
|
|
10783
10836
|
try {
|
|
10784
|
-
const content =
|
|
10837
|
+
const content = fs8.readFileSync(credentialsPath, "utf-8");
|
|
10785
10838
|
const credentials = JSON.parse(content);
|
|
10786
10839
|
return !!credentials.apiKey;
|
|
10787
10840
|
} catch {
|
|
@@ -10790,11 +10843,11 @@ var FileCredentialsProvider = class {
|
|
|
10790
10843
|
}
|
|
10791
10844
|
loadCredentials() {
|
|
10792
10845
|
const credentialsPath = getCredentialsPath();
|
|
10793
|
-
if (!
|
|
10846
|
+
if (!fs8.existsSync(credentialsPath)) {
|
|
10794
10847
|
return null;
|
|
10795
10848
|
}
|
|
10796
10849
|
try {
|
|
10797
|
-
const content =
|
|
10850
|
+
const content = fs8.readFileSync(credentialsPath, "utf-8");
|
|
10798
10851
|
const credentials = JSON.parse(content);
|
|
10799
10852
|
if (!credentials.apiKey) {
|
|
10800
10853
|
return null;
|
|
@@ -10818,12 +10871,12 @@ var FileCredentialsProvider = class {
|
|
|
10818
10871
|
};
|
|
10819
10872
|
function saveCredentials(apiKey) {
|
|
10820
10873
|
const credentialsDir = path9.join(os2.homedir(), CREDENTIALS_DIR);
|
|
10821
|
-
if (!
|
|
10822
|
-
|
|
10874
|
+
if (!fs8.existsSync(credentialsDir)) {
|
|
10875
|
+
fs8.mkdirSync(credentialsDir, { recursive: true, mode: 448 });
|
|
10823
10876
|
}
|
|
10824
10877
|
const credentialsPath = getCredentialsPath();
|
|
10825
10878
|
const credentials = { apiKey };
|
|
10826
|
-
|
|
10879
|
+
fs8.writeFileSync(credentialsPath, JSON.stringify(credentials, null, 2), {
|
|
10827
10880
|
mode: 384
|
|
10828
10881
|
});
|
|
10829
10882
|
}
|
|
@@ -11015,14 +11068,14 @@ var LoginUseCase = class {
|
|
|
11015
11068
|
};
|
|
11016
11069
|
|
|
11017
11070
|
// apps/cli/src/application/useCases/LogoutUseCase.ts
|
|
11018
|
-
var
|
|
11071
|
+
var fs9 = __toESM(require("fs"));
|
|
11019
11072
|
var ENV_VAR_NAME2 = "PACKMIND_API_KEY_V3";
|
|
11020
11073
|
var LogoutUseCase = class {
|
|
11021
11074
|
constructor(deps) {
|
|
11022
11075
|
this.deps = {
|
|
11023
11076
|
getCredentialsPath: deps?.getCredentialsPath ?? getCredentialsPath,
|
|
11024
|
-
fileExists: deps?.fileExists ?? ((path35) =>
|
|
11025
|
-
deleteFile: deps?.deleteFile ?? ((path35) =>
|
|
11077
|
+
fileExists: deps?.fileExists ?? ((path35) => fs9.existsSync(path35)),
|
|
11078
|
+
deleteFile: deps?.deleteFile ?? ((path35) => fs9.unlinkSync(path35)),
|
|
11026
11079
|
hasEnvVar: deps?.hasEnvVar ?? (() => !!process.env[ENV_VAR_NAME2])
|
|
11027
11080
|
};
|
|
11028
11081
|
}
|
|
@@ -11325,7 +11378,7 @@ var CheckCliVersionUseCase = class {
|
|
|
11325
11378
|
};
|
|
11326
11379
|
|
|
11327
11380
|
// apps/cli/src/infra/repositories/ConfigFileRepository.ts
|
|
11328
|
-
var
|
|
11381
|
+
var fs10 = __toESM(require("fs/promises"));
|
|
11329
11382
|
var path11 = __toESM(require("path"));
|
|
11330
11383
|
var ConfigFileRepository = class {
|
|
11331
11384
|
constructor() {
|
|
@@ -11347,7 +11400,7 @@ var ConfigFileRepository = class {
|
|
|
11347
11400
|
async configExists(baseDirectory) {
|
|
11348
11401
|
const configPath = this.getConfigPath(baseDirectory);
|
|
11349
11402
|
try {
|
|
11350
|
-
await
|
|
11403
|
+
await fs10.access(configPath);
|
|
11351
11404
|
return true;
|
|
11352
11405
|
} catch {
|
|
11353
11406
|
return false;
|
|
@@ -11356,7 +11409,7 @@ var ConfigFileRepository = class {
|
|
|
11356
11409
|
async readConfig(baseDirectory) {
|
|
11357
11410
|
const configPath = this.getConfigPath(baseDirectory);
|
|
11358
11411
|
try {
|
|
11359
|
-
const configContent = await
|
|
11412
|
+
const configContent = await fs10.readFile(configPath, "utf-8");
|
|
11360
11413
|
const rawConfig = JSON.parse(configContent);
|
|
11361
11414
|
if (!rawConfig.packages || typeof rawConfig.packages !== "object") {
|
|
11362
11415
|
throw new Error(
|
|
@@ -11394,7 +11447,7 @@ var ConfigFileRepository = class {
|
|
|
11394
11447
|
}
|
|
11395
11448
|
async writeConfigToPath(configPath, config) {
|
|
11396
11449
|
const configContent = JSON.stringify(config, null, 2) + "\n";
|
|
11397
|
-
await
|
|
11450
|
+
await fs10.writeFile(configPath, configContent, "utf-8");
|
|
11398
11451
|
}
|
|
11399
11452
|
/**
|
|
11400
11453
|
* Recursively finds all directories containing packmind.json in descendant folders.
|
|
@@ -11426,7 +11479,7 @@ var ConfigFileRepository = class {
|
|
|
11426
11479
|
}
|
|
11427
11480
|
async tryReadDirectory(directory) {
|
|
11428
11481
|
try {
|
|
11429
|
-
return await
|
|
11482
|
+
return await fs10.readdir(directory, { withFileTypes: true });
|
|
11430
11483
|
} catch {
|
|
11431
11484
|
return null;
|
|
11432
11485
|
}
|
|
@@ -11642,7 +11695,7 @@ var ConfigFileRepository = class {
|
|
|
11642
11695
|
}
|
|
11643
11696
|
async tryReadFile(filePath) {
|
|
11644
11697
|
try {
|
|
11645
|
-
return await
|
|
11698
|
+
return await fs10.readFile(filePath, "utf-8");
|
|
11646
11699
|
} catch (error) {
|
|
11647
11700
|
if (error.code === "ENOENT") {
|
|
11648
11701
|
return null;
|
|
@@ -11660,7 +11713,7 @@ var ConfigFileRepository = class {
|
|
|
11660
11713
|
};
|
|
11661
11714
|
|
|
11662
11715
|
// apps/cli/src/infra/repositories/LockFileRepository.ts
|
|
11663
|
-
var
|
|
11716
|
+
var fs11 = __toESM(require("fs/promises"));
|
|
11664
11717
|
var path12 = __toESM(require("path"));
|
|
11665
11718
|
var LockFileRepository = class {
|
|
11666
11719
|
constructor() {
|
|
@@ -11669,7 +11722,7 @@ var LockFileRepository = class {
|
|
|
11669
11722
|
async read(baseDirectory) {
|
|
11670
11723
|
const lockFilePath = this.getLockFilePath(baseDirectory);
|
|
11671
11724
|
try {
|
|
11672
|
-
const content = await
|
|
11725
|
+
const content = await fs11.readFile(lockFilePath, "utf-8");
|
|
11673
11726
|
const parsed = JSON.parse(content);
|
|
11674
11727
|
if (!this.isValidLockFile(parsed)) {
|
|
11675
11728
|
logWarningConsole(`Malformed lock file: ${lockFilePath}`);
|
|
@@ -11692,7 +11745,7 @@ var LockFileRepository = class {
|
|
|
11692
11745
|
return false;
|
|
11693
11746
|
}
|
|
11694
11747
|
const obj = data;
|
|
11695
|
-
return
|
|
11748
|
+
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
11749
|
}
|
|
11697
11750
|
getLockFilePath(baseDirectory) {
|
|
11698
11751
|
return path12.join(baseDirectory, this.LOCK_FILENAME);
|
|
@@ -11995,7 +12048,7 @@ ${spaceList}`
|
|
|
11995
12048
|
|
|
11996
12049
|
// apps/cli/src/application/useCases/diffStrategies/CommandDiffStrategy.ts
|
|
11997
12050
|
var import_diff2 = require("diff");
|
|
11998
|
-
var
|
|
12051
|
+
var fs13 = __toESM(require("fs/promises"));
|
|
11999
12052
|
var path15 = __toESM(require("path"));
|
|
12000
12053
|
var CommandDiffStrategy = class {
|
|
12001
12054
|
supports(file) {
|
|
@@ -12005,7 +12058,7 @@ var CommandDiffStrategy = class {
|
|
|
12005
12058
|
const fullPath = path15.join(baseDirectory, file.path);
|
|
12006
12059
|
let localContent;
|
|
12007
12060
|
try {
|
|
12008
|
-
localContent = await
|
|
12061
|
+
localContent = await fs13.readFile(fullPath, "utf-8");
|
|
12009
12062
|
} catch {
|
|
12010
12063
|
return [];
|
|
12011
12064
|
}
|
|
@@ -12035,7 +12088,7 @@ var CommandDiffStrategy = class {
|
|
|
12035
12088
|
|
|
12036
12089
|
// apps/cli/src/application/useCases/diffStrategies/SkillDiffStrategy.ts
|
|
12037
12090
|
var import_diff3 = require("diff");
|
|
12038
|
-
var
|
|
12091
|
+
var fs14 = __toESM(require("fs/promises"));
|
|
12039
12092
|
var path16 = __toESM(require("path"));
|
|
12040
12093
|
|
|
12041
12094
|
// apps/cli/src/application/utils/stripFrontmatter.ts
|
|
@@ -12384,14 +12437,14 @@ var SkillDiffStrategy = class {
|
|
|
12384
12437
|
}
|
|
12385
12438
|
async tryReadFile(filePath) {
|
|
12386
12439
|
try {
|
|
12387
|
-
return await
|
|
12440
|
+
return await fs14.readFile(filePath, "utf-8");
|
|
12388
12441
|
} catch {
|
|
12389
12442
|
return null;
|
|
12390
12443
|
}
|
|
12391
12444
|
}
|
|
12392
12445
|
async tryReadFileBinaryAware(filePath) {
|
|
12393
12446
|
try {
|
|
12394
|
-
const buffer = await
|
|
12447
|
+
const buffer = await fs14.readFile(filePath);
|
|
12395
12448
|
if (isBinaryFile(filePath, buffer)) {
|
|
12396
12449
|
return { content: buffer.toString("base64"), isBase64: true };
|
|
12397
12450
|
}
|
|
@@ -12403,7 +12456,7 @@ var SkillDiffStrategy = class {
|
|
|
12403
12456
|
async listFilesRecursively(dirPath, prefix = "") {
|
|
12404
12457
|
let entries;
|
|
12405
12458
|
try {
|
|
12406
|
-
entries = await
|
|
12459
|
+
entries = await fs14.readdir(dirPath);
|
|
12407
12460
|
} catch {
|
|
12408
12461
|
return [];
|
|
12409
12462
|
}
|
|
@@ -12429,7 +12482,7 @@ var SkillDiffStrategy = class {
|
|
|
12429
12482
|
}
|
|
12430
12483
|
async tryStatFile(filePath) {
|
|
12431
12484
|
try {
|
|
12432
|
-
const stat9 = await
|
|
12485
|
+
const stat9 = await fs14.stat(filePath);
|
|
12433
12486
|
return { isDirectory: stat9.isDirectory() };
|
|
12434
12487
|
} catch {
|
|
12435
12488
|
return null;
|
|
@@ -12437,7 +12490,7 @@ var SkillDiffStrategy = class {
|
|
|
12437
12490
|
}
|
|
12438
12491
|
async tryGetPermissions(filePath) {
|
|
12439
12492
|
try {
|
|
12440
|
-
const stat9 = await
|
|
12493
|
+
const stat9 = await fs14.stat(filePath);
|
|
12441
12494
|
return modeToPermissionStringOrDefault(stat9.mode);
|
|
12442
12495
|
} catch {
|
|
12443
12496
|
return null;
|
|
@@ -12453,7 +12506,7 @@ var SkillDiffStrategy = class {
|
|
|
12453
12506
|
};
|
|
12454
12507
|
|
|
12455
12508
|
// apps/cli/src/application/useCases/diffStrategies/StandardDiffStrategy.ts
|
|
12456
|
-
var
|
|
12509
|
+
var fs15 = __toESM(require("fs/promises"));
|
|
12457
12510
|
var path17 = __toESM(require("path"));
|
|
12458
12511
|
|
|
12459
12512
|
// apps/cli/src/application/utils/parseStandardMd.ts
|
|
@@ -12765,7 +12818,7 @@ var StandardDiffStrategy = class {
|
|
|
12765
12818
|
const fullPath = path17.join(baseDirectory, file.path);
|
|
12766
12819
|
let localContent;
|
|
12767
12820
|
try {
|
|
12768
|
-
localContent = await
|
|
12821
|
+
localContent = await fs15.readFile(fullPath, "utf-8");
|
|
12769
12822
|
} catch {
|
|
12770
12823
|
return [];
|
|
12771
12824
|
}
|
|
@@ -13667,11 +13720,11 @@ var HumanReadableLogger = class {
|
|
|
13667
13720
|
var pathModule2 = __toESM(require("path"));
|
|
13668
13721
|
|
|
13669
13722
|
// apps/cli/src/infra/commands/lintHandler.ts
|
|
13670
|
-
var
|
|
13723
|
+
var fs17 = __toESM(require("fs/promises"));
|
|
13671
13724
|
var pathModule = __toESM(require("path"));
|
|
13672
13725
|
|
|
13673
13726
|
// apps/cli/src/application/services/PackmindIgnoreReader.ts
|
|
13674
|
-
var
|
|
13727
|
+
var fs16 = __toESM(require("fs/promises"));
|
|
13675
13728
|
var path18 = __toESM(require("path"));
|
|
13676
13729
|
var IGNORE_FILENAME = ".packmindignore";
|
|
13677
13730
|
var PackmindIgnoreReader = class {
|
|
@@ -13702,7 +13755,7 @@ var PackmindIgnoreReader = class {
|
|
|
13702
13755
|
async parseIgnoreFile(filePath) {
|
|
13703
13756
|
let content;
|
|
13704
13757
|
try {
|
|
13705
|
-
content = await
|
|
13758
|
+
content = await fs16.readFile(filePath, "utf-8");
|
|
13706
13759
|
} catch (err) {
|
|
13707
13760
|
if (err.code === "ENOENT") {
|
|
13708
13761
|
return [];
|
|
@@ -13749,7 +13802,7 @@ async function lintHandler(args2, deps) {
|
|
|
13749
13802
|
const absolutePath = resolvePath(targetPath);
|
|
13750
13803
|
let stats;
|
|
13751
13804
|
try {
|
|
13752
|
-
stats = await
|
|
13805
|
+
stats = await fs17.stat(absolutePath);
|
|
13753
13806
|
} catch (err) {
|
|
13754
13807
|
const isNotFound = err.code === "ENOENT";
|
|
13755
13808
|
const message = isNotFound ? `File or directory "${absolutePath}" does not exist` : `Cannot access "${absolutePath}": ${err.message}`;
|
|
@@ -14067,13 +14120,13 @@ function extractWasmFiles() {
|
|
|
14067
14120
|
|
|
14068
14121
|
// apps/cli/src/main.ts
|
|
14069
14122
|
var import_dotenv = require("dotenv");
|
|
14070
|
-
var
|
|
14123
|
+
var fs26 = __toESM(require("fs"));
|
|
14071
14124
|
var path34 = __toESM(require("path"));
|
|
14072
14125
|
|
|
14073
14126
|
// apps/cli/src/infra/commands/InstallCommand.ts
|
|
14074
14127
|
var import_cmd_ts2 = __toESM(require_cjs());
|
|
14075
14128
|
var path19 = __toESM(require("path"));
|
|
14076
|
-
var
|
|
14129
|
+
var fs18 = __toESM(require("fs"));
|
|
14077
14130
|
|
|
14078
14131
|
// apps/cli/src/infra/commands/installPackagesHandler.ts
|
|
14079
14132
|
function formatOverviewRow(configPath, packages, pathColumnWidth) {
|
|
@@ -14155,14 +14208,14 @@ function findSubDirectoriesWithPackmindJson(dirPath, recursive) {
|
|
|
14155
14208
|
const result = [];
|
|
14156
14209
|
let entries;
|
|
14157
14210
|
try {
|
|
14158
|
-
entries =
|
|
14211
|
+
entries = fs18.readdirSync(dirPath, { withFileTypes: true });
|
|
14159
14212
|
} catch {
|
|
14160
14213
|
return result;
|
|
14161
14214
|
}
|
|
14162
14215
|
for (const entry of entries) {
|
|
14163
14216
|
if (!entry.isDirectory()) continue;
|
|
14164
14217
|
const subDir = path19.join(dirPath, entry.name);
|
|
14165
|
-
if (
|
|
14218
|
+
if (fs18.existsSync(path19.join(subDir, "packmind.json"))) {
|
|
14166
14219
|
result.push(subDir);
|
|
14167
14220
|
}
|
|
14168
14221
|
if (recursive) {
|
|
@@ -14240,7 +14293,7 @@ async function notifyArtefactsDistributionIfInGitRepo(params) {
|
|
|
14240
14293
|
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(dir);
|
|
14241
14294
|
if (!gitRoot) return;
|
|
14242
14295
|
const lockFilePath = path19.join(dir, "packmind-lock.json");
|
|
14243
|
-
const content =
|
|
14296
|
+
const content = fs18.readFileSync(lockFilePath, "utf-8");
|
|
14244
14297
|
const packmindLockFile = JSON.parse(content);
|
|
14245
14298
|
const gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
|
|
14246
14299
|
const gitBranch = packmindCliHexa.getCurrentBranch(gitRoot);
|
|
@@ -14293,7 +14346,8 @@ async function installHandler({
|
|
|
14293
14346
|
packages,
|
|
14294
14347
|
list,
|
|
14295
14348
|
show,
|
|
14296
|
-
status
|
|
14349
|
+
status,
|
|
14350
|
+
skipInstalledAt
|
|
14297
14351
|
}) {
|
|
14298
14352
|
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
14299
14353
|
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
@@ -14321,12 +14375,12 @@ async function installHandler({
|
|
|
14321
14375
|
}
|
|
14322
14376
|
const cwd = installPath ? path19.resolve(process.cwd(), installPath) : process.cwd();
|
|
14323
14377
|
if (installPath) {
|
|
14324
|
-
if (!
|
|
14378
|
+
if (!fs18.existsSync(cwd)) {
|
|
14325
14379
|
logErrorConsole(`Path does not exist: ${cwd}`);
|
|
14326
14380
|
process.exit(1);
|
|
14327
14381
|
return;
|
|
14328
14382
|
}
|
|
14329
|
-
if (!
|
|
14383
|
+
if (!fs18.statSync(cwd).isDirectory()) {
|
|
14330
14384
|
logErrorConsole(`Path is not a directory: ${cwd}`);
|
|
14331
14385
|
process.exit(1);
|
|
14332
14386
|
return;
|
|
@@ -14339,7 +14393,7 @@ async function installHandler({
|
|
|
14339
14393
|
targetDirs = [cwd];
|
|
14340
14394
|
} else {
|
|
14341
14395
|
targetDirs = [];
|
|
14342
|
-
if (
|
|
14396
|
+
if (fs18.existsSync(path19.join(cwd, "packmind.json"))) {
|
|
14343
14397
|
targetDirs.push(cwd);
|
|
14344
14398
|
}
|
|
14345
14399
|
targetDirs.push(...findSubDirectoriesWithPackmindJson(cwd, true));
|
|
@@ -14354,7 +14408,8 @@ async function installHandler({
|
|
|
14354
14408
|
try {
|
|
14355
14409
|
const result = await packmindCliHexa.install({
|
|
14356
14410
|
baseDirectory: dir,
|
|
14357
|
-
packages: packages.length > 0 ? packages : void 0
|
|
14411
|
+
packages: packages.length > 0 ? packages : void 0,
|
|
14412
|
+
skipInstalledAt
|
|
14358
14413
|
});
|
|
14359
14414
|
results.push(result);
|
|
14360
14415
|
await notifyArtefactsDistributionIfInGitRepo({
|
|
@@ -14420,6 +14475,10 @@ var installCommand = (0, import_cmd_ts2.command)({
|
|
|
14420
14475
|
long: "show",
|
|
14421
14476
|
description: "[Deprecated] Show details of a specific package",
|
|
14422
14477
|
defaultValue: () => ""
|
|
14478
|
+
}),
|
|
14479
|
+
skipInstalledAt: (0, import_cmd_ts2.flag)({
|
|
14480
|
+
long: "skip-installed-at",
|
|
14481
|
+
description: "Omit the installedAt timestamp from the packmind-lock.json file"
|
|
14423
14482
|
})
|
|
14424
14483
|
},
|
|
14425
14484
|
handler: installHandler
|
|
@@ -14725,7 +14784,7 @@ var import_cmd_ts9 = __toESM(require_cjs());
|
|
|
14725
14784
|
var readline2 = __toESM(require("readline"));
|
|
14726
14785
|
|
|
14727
14786
|
// apps/cli/src/infra/commands/skills/incompatibleSkillsHandler.ts
|
|
14728
|
-
var
|
|
14787
|
+
var fs19 = __toESM(require("fs/promises"));
|
|
14729
14788
|
var path20 = __toESM(require("path"));
|
|
14730
14789
|
async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm) {
|
|
14731
14790
|
const skillNames = skills.map((s) => s.skillName).join(", ");
|
|
@@ -14742,7 +14801,7 @@ async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm)
|
|
|
14742
14801
|
const skillRootDirs = skill.filePaths.filter((p) => path20.basename(p) === "SKILL.md").map((p) => path20.dirname(p));
|
|
14743
14802
|
for (const dir of skillRootDirs) {
|
|
14744
14803
|
try {
|
|
14745
|
-
await
|
|
14804
|
+
await fs19.rm(path20.join(baseDirectory, dir), {
|
|
14746
14805
|
recursive: true,
|
|
14747
14806
|
force: true
|
|
14748
14807
|
});
|
|
@@ -14755,7 +14814,7 @@ async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm)
|
|
|
14755
14814
|
for (const relativePath of skill.filePaths) {
|
|
14756
14815
|
if (!skillRootDirs.some((dir) => relativePath.startsWith(dir + "/"))) {
|
|
14757
14816
|
try {
|
|
14758
|
-
await
|
|
14817
|
+
await fs19.unlink(path20.join(baseDirectory, relativePath));
|
|
14759
14818
|
} catch (error) {
|
|
14760
14819
|
logErrorConsole(
|
|
14761
14820
|
`Failed to delete "${relativePath}": ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -15233,7 +15292,7 @@ var import_cmd_ts18 = __toESM(require_cjs());
|
|
|
15233
15292
|
|
|
15234
15293
|
// apps/cli/src/infra/commands/playbook/diffArtefactsHandler.ts
|
|
15235
15294
|
var nodePath = __toESM(require("path"));
|
|
15236
|
-
var
|
|
15295
|
+
var fs20 = __toESM(require("fs/promises"));
|
|
15237
15296
|
|
|
15238
15297
|
// apps/cli/src/infra/utils/diffFormatter.ts
|
|
15239
15298
|
var import_diff4 = require("diff");
|
|
@@ -15532,7 +15591,7 @@ async function diffArtefactsHandler(deps) {
|
|
|
15532
15591
|
const searchPath = nodePath.resolve(cwd, deps.path ?? ".");
|
|
15533
15592
|
if (deps.path !== void 0) {
|
|
15534
15593
|
try {
|
|
15535
|
-
await
|
|
15594
|
+
await fs20.stat(searchPath);
|
|
15536
15595
|
} catch {
|
|
15537
15596
|
logErrorConsole(`Path does not exist: ${searchPath}`);
|
|
15538
15597
|
exit(1);
|
|
@@ -16427,7 +16486,7 @@ var import_cmd_ts24 = __toESM(require_cjs());
|
|
|
16427
16486
|
|
|
16428
16487
|
// apps/cli/src/infra/repositories/PlaybookLocalRepository.ts
|
|
16429
16488
|
var crypto = __toESM(require("crypto"));
|
|
16430
|
-
var
|
|
16489
|
+
var fs21 = __toESM(require("fs"));
|
|
16431
16490
|
var os3 = __toESM(require("os"));
|
|
16432
16491
|
var path21 = __toESM(require("path"));
|
|
16433
16492
|
var yaml = __toESM(require("yaml"));
|
|
@@ -16483,11 +16542,11 @@ var PlaybookLocalRepository = class {
|
|
|
16483
16542
|
return normalized;
|
|
16484
16543
|
}
|
|
16485
16544
|
readYaml() {
|
|
16486
|
-
if (!
|
|
16545
|
+
if (!fs21.existsSync(this.storagePath)) {
|
|
16487
16546
|
return { version: 1, changes: [] };
|
|
16488
16547
|
}
|
|
16489
16548
|
try {
|
|
16490
|
-
const content =
|
|
16549
|
+
const content = fs21.readFileSync(this.storagePath, "utf-8");
|
|
16491
16550
|
const parsed = yaml.parse(content);
|
|
16492
16551
|
if (!parsed || !Array.isArray(parsed.changes)) {
|
|
16493
16552
|
return { version: 1, changes: [] };
|
|
@@ -16502,13 +16561,13 @@ var PlaybookLocalRepository = class {
|
|
|
16502
16561
|
}
|
|
16503
16562
|
writeYaml(data) {
|
|
16504
16563
|
const dir = path21.dirname(this.storagePath);
|
|
16505
|
-
|
|
16506
|
-
|
|
16564
|
+
fs21.mkdirSync(dir, { recursive: true });
|
|
16565
|
+
fs21.writeFileSync(this.storagePath, yaml.stringify(data), "utf-8");
|
|
16507
16566
|
}
|
|
16508
16567
|
};
|
|
16509
16568
|
|
|
16510
16569
|
// apps/cli/src/infra/commands/playbook/addHandler.ts
|
|
16511
|
-
var
|
|
16570
|
+
var fs22 = __toESM(require("fs"));
|
|
16512
16571
|
var path25 = __toESM(require("path"));
|
|
16513
16572
|
var yaml2 = __toESM(require("yaml"));
|
|
16514
16573
|
var import_slug = __toESM(require("slug"));
|
|
@@ -16878,7 +16937,7 @@ function resolveSkillDirectoryRoot(absolutePath) {
|
|
|
16878
16937
|
return path25.dirname(absolutePath);
|
|
16879
16938
|
}
|
|
16880
16939
|
try {
|
|
16881
|
-
if (
|
|
16940
|
+
if (fs22.statSync(absolutePath).isDirectory()) {
|
|
16882
16941
|
return absolutePath;
|
|
16883
16942
|
}
|
|
16884
16943
|
} catch {
|
|
@@ -16887,7 +16946,7 @@ function resolveSkillDirectoryRoot(absolutePath) {
|
|
|
16887
16946
|
let current = path25.dirname(absolutePath);
|
|
16888
16947
|
const root = path25.parse(current).root;
|
|
16889
16948
|
while (current !== root) {
|
|
16890
|
-
if (
|
|
16949
|
+
if (fs22.existsSync(path25.join(current, "SKILL.md"))) {
|
|
16891
16950
|
return current;
|
|
16892
16951
|
}
|
|
16893
16952
|
current = path25.dirname(current);
|
|
@@ -17292,7 +17351,7 @@ var addPlaybookCommand = (0, import_cmd_ts24.command)({
|
|
|
17292
17351
|
var import_cmd_ts25 = __toESM(require_cjs());
|
|
17293
17352
|
|
|
17294
17353
|
// apps/cli/src/infra/commands/playbook/rmHandler.ts
|
|
17295
|
-
var
|
|
17354
|
+
var fs23 = __toESM(require("fs"));
|
|
17296
17355
|
var path26 = __toESM(require("path"));
|
|
17297
17356
|
function isSkillSupportFile(absolutePath) {
|
|
17298
17357
|
const normalized = absolutePath.replace(/\\/g, "/");
|
|
@@ -17321,7 +17380,7 @@ async function playbookRmHandler(deps) {
|
|
|
17321
17380
|
return;
|
|
17322
17381
|
}
|
|
17323
17382
|
const absolutePath = path26.resolve(getCwd(), filePath);
|
|
17324
|
-
if (!
|
|
17383
|
+
if (!fs23.existsSync(absolutePath)) {
|
|
17325
17384
|
logErrorConsole(`File not found: "${filePath}"`);
|
|
17326
17385
|
exit(1);
|
|
17327
17386
|
return;
|
|
@@ -19163,7 +19222,7 @@ var import_cmd_ts38 = __toESM(require_cjs());
|
|
|
19163
19222
|
var import_cmd_ts37 = __toESM(require_cjs());
|
|
19164
19223
|
|
|
19165
19224
|
// apps/cli/src/application/services/AgentArtifactDetectionService.ts
|
|
19166
|
-
var
|
|
19225
|
+
var fs24 = __toESM(require("fs/promises"));
|
|
19167
19226
|
var path32 = __toESM(require("path"));
|
|
19168
19227
|
var AGENT_ARTIFACT_CHECKS = [
|
|
19169
19228
|
{ agent: "claude", paths: [".claude"] },
|
|
@@ -19209,7 +19268,7 @@ var AgentArtifactDetectionService = class {
|
|
|
19209
19268
|
}
|
|
19210
19269
|
async pathExists(filePath) {
|
|
19211
19270
|
try {
|
|
19212
|
-
await
|
|
19271
|
+
await fs24.access(filePath);
|
|
19213
19272
|
return true;
|
|
19214
19273
|
} catch {
|
|
19215
19274
|
return false;
|
|
@@ -19226,7 +19285,7 @@ var AgentArtifactDetectionService = class {
|
|
|
19226
19285
|
}
|
|
19227
19286
|
}
|
|
19228
19287
|
try {
|
|
19229
|
-
const entries = await
|
|
19288
|
+
const entries = await fs24.readdir(currentDir, { withFileTypes: true });
|
|
19230
19289
|
for (const entry of entries) {
|
|
19231
19290
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
19232
19291
|
queue.push(path32.join(currentDir, entry.name));
|
|
@@ -19245,7 +19304,7 @@ var inquirer = __toESM(require("inquirer"));
|
|
|
19245
19304
|
|
|
19246
19305
|
// apps/cli/src/infra/commands/config/agents/agentsHandlerUtils.ts
|
|
19247
19306
|
var path33 = __toESM(require("path"));
|
|
19248
|
-
var
|
|
19307
|
+
var fs25 = __toESM(require("fs/promises"));
|
|
19249
19308
|
function getRelativePath(dir, startDirectory) {
|
|
19250
19309
|
if (dir === startDirectory) return "./packmind.json";
|
|
19251
19310
|
return "./" + path33.relative(startDirectory, dir) + "/packmind.json";
|
|
@@ -19255,7 +19314,7 @@ async function resolveStartDirectory(args2, getCwd, exit) {
|
|
|
19255
19314
|
if (args2.path) {
|
|
19256
19315
|
const resolvedPath = path33.resolve(getCwd(), args2.path);
|
|
19257
19316
|
try {
|
|
19258
|
-
const stat9 = await
|
|
19317
|
+
const stat9 = await fs25.stat(resolvedPath);
|
|
19259
19318
|
if (!stat9.isDirectory()) {
|
|
19260
19319
|
logErrorConsole(`Path is not a directory: ${resolvedPath}`);
|
|
19261
19320
|
exit(1);
|
|
@@ -19968,7 +20027,7 @@ function findEnvFile() {
|
|
|
19968
20027
|
let parentDir = path34.dirname(searchDir);
|
|
19969
20028
|
while (searchDir !== parentDir) {
|
|
19970
20029
|
const envPath2 = path34.join(searchDir, ".env");
|
|
19971
|
-
if (
|
|
20030
|
+
if (fs26.existsSync(envPath2)) {
|
|
19972
20031
|
return envPath2;
|
|
19973
20032
|
}
|
|
19974
20033
|
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.0",
|
|
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",
|