@packmind/cli 0.26.0 → 0.27.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 +988 -1360
- package/package.json +2 -1
package/main.cjs
CHANGED
|
@@ -843,7 +843,7 @@ var require_types = __commonJS({
|
|
|
843
843
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
844
844
|
exports2.boolean = exports2.string = exports2.number = void 0;
|
|
845
845
|
exports2.optional = optional17;
|
|
846
|
-
exports2.array =
|
|
846
|
+
exports2.array = array2;
|
|
847
847
|
var type_1 = require_type();
|
|
848
848
|
exports2.number = {
|
|
849
849
|
async from(str) {
|
|
@@ -877,7 +877,7 @@ var require_types = __commonJS({
|
|
|
877
877
|
}
|
|
878
878
|
};
|
|
879
879
|
}
|
|
880
|
-
function
|
|
880
|
+
function array2(t) {
|
|
881
881
|
return {
|
|
882
882
|
...t,
|
|
883
883
|
async from(inputs) {
|
|
@@ -1526,9 +1526,9 @@ Did you mean ${chalk_1.default.italic(option22)}?`;
|
|
|
1526
1526
|
}
|
|
1527
1527
|
};
|
|
1528
1528
|
}
|
|
1529
|
-
function flatMap(
|
|
1529
|
+
function flatMap(array2, f) {
|
|
1530
1530
|
const rs = [];
|
|
1531
|
-
for (const item of
|
|
1531
|
+
for (const item of array2) {
|
|
1532
1532
|
rs.push(...f(item));
|
|
1533
1533
|
}
|
|
1534
1534
|
return rs;
|
|
@@ -1582,6 +1582,9 @@ function stripAnsi(string21) {
|
|
|
1582
1582
|
if (typeof string21 !== "string") {
|
|
1583
1583
|
throw new TypeError(`Expected a \`string\`, got \`${typeof string21}\``);
|
|
1584
1584
|
}
|
|
1585
|
+
if (!string21.includes("\x1B") && !string21.includes("\x9B")) {
|
|
1586
|
+
return string21;
|
|
1587
|
+
}
|
|
1585
1588
|
return string21.replace(regex, "");
|
|
1586
1589
|
}
|
|
1587
1590
|
var regex;
|
|
@@ -1698,12 +1701,12 @@ var require_command = __commonJS({
|
|
|
1698
1701
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1699
1702
|
};
|
|
1700
1703
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1701
|
-
exports2.command =
|
|
1704
|
+
exports2.command = command32;
|
|
1702
1705
|
var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
|
|
1703
1706
|
var Result = __importStar(require_Result());
|
|
1704
1707
|
var circuitbreaker_1 = require_circuitbreaker();
|
|
1705
1708
|
var utils_1 = require_utils();
|
|
1706
|
-
function
|
|
1709
|
+
function command32(config) {
|
|
1707
1710
|
const argEntries = (0, utils_1.entries)(config.args);
|
|
1708
1711
|
const circuitbreaker = (0, circuitbreaker_1.createCircuitBreaker)(!!config.version);
|
|
1709
1712
|
return {
|
|
@@ -2587,7 +2590,7 @@ var require_has_flag = __commonJS({
|
|
|
2587
2590
|
var require_supports_color = __commonJS({
|
|
2588
2591
|
"node_modules/supports-color/index.js"(exports2, module2) {
|
|
2589
2592
|
"use strict";
|
|
2590
|
-
var
|
|
2593
|
+
var os4 = require("os");
|
|
2591
2594
|
var tty2 = require("tty");
|
|
2592
2595
|
var hasFlag2 = require_has_flag();
|
|
2593
2596
|
var { env: env2 } = process;
|
|
@@ -2635,7 +2638,7 @@ var require_supports_color = __commonJS({
|
|
|
2635
2638
|
return min;
|
|
2636
2639
|
}
|
|
2637
2640
|
if (process.platform === "win32") {
|
|
2638
|
-
const osRelease =
|
|
2641
|
+
const osRelease = os4.release().split(".");
|
|
2639
2642
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
2640
2643
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
2641
2644
|
}
|
|
@@ -3427,11 +3430,11 @@ var require_multioption = __commonJS({
|
|
|
3427
3430
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
3428
3431
|
};
|
|
3429
3432
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3430
|
-
exports2.multioption =
|
|
3433
|
+
exports2.multioption = multioption2;
|
|
3431
3434
|
var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
|
|
3432
3435
|
var Result = __importStar(require_Result());
|
|
3433
3436
|
var findOption_1 = require_findOption();
|
|
3434
|
-
function
|
|
3437
|
+
function multioption2(config) {
|
|
3435
3438
|
return {
|
|
3436
3439
|
helpTopics() {
|
|
3437
3440
|
var _a, _b;
|
|
@@ -3852,7 +3855,7 @@ var require_package = __commonJS({
|
|
|
3852
3855
|
"apps/cli/package.json"(exports2, module2) {
|
|
3853
3856
|
module2.exports = {
|
|
3854
3857
|
name: "@packmind/cli",
|
|
3855
|
-
version: "0.
|
|
3858
|
+
version: "0.27.0",
|
|
3856
3859
|
description: "A command-line interface for Packmind linting and code quality checks",
|
|
3857
3860
|
private: false,
|
|
3858
3861
|
bin: {
|
|
@@ -3898,7 +3901,7 @@ var require_package = __commonJS({
|
|
|
3898
3901
|
});
|
|
3899
3902
|
|
|
3900
3903
|
// apps/cli/src/main.ts
|
|
3901
|
-
var
|
|
3904
|
+
var import_cmd_ts41 = __toESM(require_cjs());
|
|
3902
3905
|
|
|
3903
3906
|
// apps/cli/src/infra/commands/LinterCommand.ts
|
|
3904
3907
|
var import_cmd_ts = __toESM(require_cjs());
|
|
@@ -4448,6 +4451,20 @@ var SpaceMembersRoleUpdatedEvent = class extends UserEvent {
|
|
|
4448
4451
|
}
|
|
4449
4452
|
};
|
|
4450
4453
|
|
|
4454
|
+
// packages/types/src/spaces/events/SpacePinnedEvent.ts
|
|
4455
|
+
var SpacePinnedEvent = class extends UserEvent {
|
|
4456
|
+
static {
|
|
4457
|
+
this.eventName = "spaces.space.pinned";
|
|
4458
|
+
}
|
|
4459
|
+
};
|
|
4460
|
+
|
|
4461
|
+
// packages/types/src/spaces/events/SpaceUnpinnedEvent.ts
|
|
4462
|
+
var SpaceUnpinnedEvent = class extends UserEvent {
|
|
4463
|
+
static {
|
|
4464
|
+
this.eventName = "spaces.space.unpinned";
|
|
4465
|
+
}
|
|
4466
|
+
};
|
|
4467
|
+
|
|
4451
4468
|
// packages/types/src/spaces/events/SpaceVisibilityUpdatedEvent.ts
|
|
4452
4469
|
var SpaceVisibilityUpdatedEvent = class extends UserEvent {
|
|
4453
4470
|
static {
|
|
@@ -5303,8 +5320,8 @@ var ExecuteSingleFileAstUseCase = class _ExecuteSingleFileAstUseCase {
|
|
|
5303
5320
|
static {
|
|
5304
5321
|
this.fallbackRuleContent = "adhoc-rule";
|
|
5305
5322
|
}
|
|
5306
|
-
async execute(
|
|
5307
|
-
const { program, fileContent, language } =
|
|
5323
|
+
async execute(command32) {
|
|
5324
|
+
const { program, fileContent, language } = command32;
|
|
5308
5325
|
const result = await this.linterExecutionUseCase.execute({
|
|
5309
5326
|
filePath: "cli-single-file",
|
|
5310
5327
|
fileContent,
|
|
@@ -5363,30 +5380,30 @@ var GitService = class {
|
|
|
5363
5380
|
this.gitRunner = gitRunner;
|
|
5364
5381
|
this.logger = logger2;
|
|
5365
5382
|
}
|
|
5366
|
-
getGitRepositoryRoot(
|
|
5383
|
+
getGitRepositoryRoot(path35) {
|
|
5367
5384
|
try {
|
|
5368
5385
|
const { stdout } = this.gitRunner("rev-parse --show-toplevel", {
|
|
5369
|
-
cwd:
|
|
5386
|
+
cwd: path35
|
|
5370
5387
|
});
|
|
5371
5388
|
const gitRoot = stdout.trim();
|
|
5372
5389
|
this.logger.debug("Resolved git repository root", {
|
|
5373
|
-
inputPath:
|
|
5390
|
+
inputPath: path35,
|
|
5374
5391
|
gitRoot
|
|
5375
5392
|
});
|
|
5376
5393
|
return gitRoot;
|
|
5377
5394
|
} catch (error) {
|
|
5378
5395
|
if (error instanceof Error) {
|
|
5379
5396
|
throw new Error(
|
|
5380
|
-
`Failed to get Git repository root. The path '${
|
|
5397
|
+
`Failed to get Git repository root. The path '${path35}' does not appear to be inside a Git repository.
|
|
5381
5398
|
${error.message}`
|
|
5382
5399
|
);
|
|
5383
5400
|
}
|
|
5384
5401
|
throw new Error("Failed to get Git repository root: Unknown error");
|
|
5385
5402
|
}
|
|
5386
5403
|
}
|
|
5387
|
-
tryGetGitRepositoryRoot(
|
|
5404
|
+
tryGetGitRepositoryRoot(path35) {
|
|
5388
5405
|
try {
|
|
5389
|
-
return this.getGitRepositoryRoot(
|
|
5406
|
+
return this.getGitRepositoryRoot(path35);
|
|
5390
5407
|
} catch {
|
|
5391
5408
|
return null;
|
|
5392
5409
|
}
|
|
@@ -5688,8 +5705,8 @@ var GetGitRemoteUrlUseCase = class {
|
|
|
5688
5705
|
constructor(gitRemoteUrlService = new GitService()) {
|
|
5689
5706
|
this.gitRemoteUrlService = gitRemoteUrlService;
|
|
5690
5707
|
}
|
|
5691
|
-
async execute(
|
|
5692
|
-
const { path: repoPath, origin: origin9 } =
|
|
5708
|
+
async execute(command32) {
|
|
5709
|
+
const { path: repoPath, origin: origin9 } = command32;
|
|
5693
5710
|
return this.gitRemoteUrlService.getGitRemoteUrl(repoPath, origin9);
|
|
5694
5711
|
}
|
|
5695
5712
|
};
|
|
@@ -5841,8 +5858,8 @@ var ListFilesInDirectoryUseCase = class {
|
|
|
5841
5858
|
constructor(listFiles = new ListFiles()) {
|
|
5842
5859
|
this.listFiles = listFiles;
|
|
5843
5860
|
}
|
|
5844
|
-
async execute(
|
|
5845
|
-
const { path: directoryPath, extensions, excludes = [] } =
|
|
5861
|
+
async execute(command32) {
|
|
5862
|
+
const { path: directoryPath, extensions, excludes = [] } = command32;
|
|
5846
5863
|
const files = await this.listFiles.listFilesInDirectory(
|
|
5847
5864
|
directoryPath,
|
|
5848
5865
|
extensions,
|
|
@@ -5957,7 +5974,7 @@ var LintFilesAgainstRuleUseCase = class {
|
|
|
5957
5974
|
};
|
|
5958
5975
|
};
|
|
5959
5976
|
}
|
|
5960
|
-
async execute(
|
|
5977
|
+
async execute(command32) {
|
|
5961
5978
|
const {
|
|
5962
5979
|
path: userPath,
|
|
5963
5980
|
draftMode,
|
|
@@ -5966,7 +5983,7 @@ var LintFilesAgainstRuleUseCase = class {
|
|
|
5966
5983
|
language,
|
|
5967
5984
|
diffMode,
|
|
5968
5985
|
ignorePatterns
|
|
5969
|
-
} =
|
|
5986
|
+
} = command32;
|
|
5970
5987
|
this.logger.debug(
|
|
5971
5988
|
`Starting linting: path="${userPath}", draftMode=${!!draftMode}, standardSlug="${standardSlug || "N/A"}", ruleId="${ruleId || "N/A"}", language="${language || "N/A"}", diffMode="${diffMode ?? "none"}"`
|
|
5972
5989
|
);
|
|
@@ -6282,8 +6299,8 @@ var LintFilesAgainstRuleUseCase = class {
|
|
|
6282
6299
|
return null;
|
|
6283
6300
|
}
|
|
6284
6301
|
}
|
|
6285
|
-
async executeProgramsForFile(
|
|
6286
|
-
const result = await this.services.linterExecutionUseCase.execute(
|
|
6302
|
+
async executeProgramsForFile(command32) {
|
|
6303
|
+
const result = await this.services.linterExecutionUseCase.execute(command32);
|
|
6287
6304
|
return result.violations;
|
|
6288
6305
|
}
|
|
6289
6306
|
extractExtensionFromFile(filePath) {
|
|
@@ -6306,8 +6323,8 @@ var LintFilesFromConfigUseCase = class {
|
|
|
6306
6323
|
this.logger = logger2;
|
|
6307
6324
|
this.detectionProgramsCache = /* @__PURE__ */ new Map();
|
|
6308
6325
|
}
|
|
6309
|
-
async execute(
|
|
6310
|
-
const { path: userPath, diffMode, ignorePatterns } =
|
|
6326
|
+
async execute(command32) {
|
|
6327
|
+
const { path: userPath, diffMode, ignorePatterns } = command32;
|
|
6311
6328
|
this.logger.debug(
|
|
6312
6329
|
`Starting local linting: path="${userPath}", diffMode="${diffMode ?? "none"}"`
|
|
6313
6330
|
);
|
|
@@ -6567,8 +6584,8 @@ var LintFilesFromConfigUseCase = class {
|
|
|
6567
6584
|
return null;
|
|
6568
6585
|
}
|
|
6569
6586
|
}
|
|
6570
|
-
async executeProgramsForFile(
|
|
6571
|
-
const result = await this.services.linterExecutionUseCase.execute(
|
|
6587
|
+
async executeProgramsForFile(command32) {
|
|
6588
|
+
const result = await this.services.linterExecutionUseCase.execute(command32);
|
|
6572
6589
|
return result.violations;
|
|
6573
6590
|
}
|
|
6574
6591
|
extractExtensionFromFile(filePath) {
|
|
@@ -6651,10 +6668,10 @@ var PackmindHttpClient = class {
|
|
|
6651
6668
|
return null;
|
|
6652
6669
|
}
|
|
6653
6670
|
}
|
|
6654
|
-
async request(
|
|
6671
|
+
async request(path35, options = {}) {
|
|
6655
6672
|
const { host } = this.getAuthContext();
|
|
6656
6673
|
const { method = "GET", body } = options;
|
|
6657
|
-
const url = `${host}${
|
|
6674
|
+
const url = `${host}${path35}`;
|
|
6658
6675
|
try {
|
|
6659
6676
|
const response = await fetch(url, {
|
|
6660
6677
|
method,
|
|
@@ -6705,13 +6722,13 @@ var PackmindHttpClient = class {
|
|
|
6705
6722
|
var ChangeProposalGateway = class {
|
|
6706
6723
|
constructor(httpClient) {
|
|
6707
6724
|
this.httpClient = httpClient;
|
|
6708
|
-
this.batchCreate = async (
|
|
6725
|
+
this.batchCreate = async (command32) => {
|
|
6709
6726
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6710
6727
|
return this.httpClient.request(
|
|
6711
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6728
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/change-proposals/batch`,
|
|
6712
6729
|
{
|
|
6713
6730
|
method: "POST",
|
|
6714
|
-
body: { proposals:
|
|
6731
|
+
body: { proposals: command32.proposals },
|
|
6715
6732
|
onError: (response) => {
|
|
6716
6733
|
if (response.status === 404) {
|
|
6717
6734
|
throw new CommunityEditionError("change proposals");
|
|
@@ -6720,29 +6737,29 @@ var ChangeProposalGateway = class {
|
|
|
6720
6737
|
}
|
|
6721
6738
|
);
|
|
6722
6739
|
};
|
|
6723
|
-
this.batchApply = async (
|
|
6740
|
+
this.batchApply = async (command32) => {
|
|
6724
6741
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6725
6742
|
return this.httpClient.request(
|
|
6726
6743
|
`/api/v0/organizations/${organizationId}/playbook/apply`,
|
|
6727
6744
|
{
|
|
6728
6745
|
method: "POST",
|
|
6729
6746
|
body: {
|
|
6730
|
-
proposals:
|
|
6731
|
-
message:
|
|
6732
|
-
...
|
|
6733
|
-
directUpdate:
|
|
6747
|
+
proposals: command32.proposals,
|
|
6748
|
+
message: command32.message,
|
|
6749
|
+
...command32.directUpdate !== void 0 && {
|
|
6750
|
+
directUpdate: command32.directUpdate
|
|
6734
6751
|
}
|
|
6735
6752
|
}
|
|
6736
6753
|
}
|
|
6737
6754
|
);
|
|
6738
6755
|
};
|
|
6739
|
-
this.check = async (
|
|
6756
|
+
this.check = async (command32) => {
|
|
6740
6757
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6741
6758
|
return this.httpClient.request(
|
|
6742
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6759
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/change-proposals/check`,
|
|
6743
6760
|
{
|
|
6744
6761
|
method: "POST",
|
|
6745
|
-
body: { proposals:
|
|
6762
|
+
body: { proposals: command32.proposals },
|
|
6746
6763
|
onError: (response) => {
|
|
6747
6764
|
if (response.status === 404) {
|
|
6748
6765
|
throw new CommunityEditionError("change proposals");
|
|
@@ -6758,13 +6775,13 @@ var ChangeProposalGateway = class {
|
|
|
6758
6775
|
var LinterGateway = class {
|
|
6759
6776
|
constructor(httpClient) {
|
|
6760
6777
|
this.httpClient = httpClient;
|
|
6761
|
-
this.getDraftDetectionProgramsForRule = async (
|
|
6778
|
+
this.getDraftDetectionProgramsForRule = async (command32) => {
|
|
6762
6779
|
const payload = {
|
|
6763
|
-
standardSlug:
|
|
6764
|
-
ruleId:
|
|
6780
|
+
standardSlug: command32.standardSlug,
|
|
6781
|
+
ruleId: command32.ruleId
|
|
6765
6782
|
};
|
|
6766
|
-
if (
|
|
6767
|
-
payload.language =
|
|
6783
|
+
if (command32.language) {
|
|
6784
|
+
payload.language = command32.language;
|
|
6768
6785
|
}
|
|
6769
6786
|
return this.httpClient.request("/api/v0/list-draft-detection-program", {
|
|
6770
6787
|
method: "POST",
|
|
@@ -6776,13 +6793,13 @@ var LinterGateway = class {
|
|
|
6776
6793
|
}
|
|
6777
6794
|
});
|
|
6778
6795
|
};
|
|
6779
|
-
this.getActiveDetectionProgramsForRule = async (
|
|
6796
|
+
this.getActiveDetectionProgramsForRule = async (command32) => {
|
|
6780
6797
|
const payload = {
|
|
6781
|
-
standardSlug:
|
|
6782
|
-
ruleId:
|
|
6798
|
+
standardSlug: command32.standardSlug,
|
|
6799
|
+
ruleId: command32.ruleId
|
|
6783
6800
|
};
|
|
6784
|
-
if (
|
|
6785
|
-
payload.language =
|
|
6801
|
+
if (command32.language) {
|
|
6802
|
+
payload.language = command32.language;
|
|
6786
6803
|
}
|
|
6787
6804
|
return this.httpClient.request("/api/v0/list-active-detection-program", {
|
|
6788
6805
|
method: "POST",
|
|
@@ -6794,13 +6811,13 @@ var LinterGateway = class {
|
|
|
6794
6811
|
}
|
|
6795
6812
|
});
|
|
6796
6813
|
};
|
|
6797
|
-
this.getDetectionProgramsForPackages = async (
|
|
6814
|
+
this.getDetectionProgramsForPackages = async (command32) => {
|
|
6798
6815
|
const response = await this.httpClient.request(
|
|
6799
6816
|
"/api/v0/detection-programs-for-packages",
|
|
6800
6817
|
{
|
|
6801
6818
|
method: "POST",
|
|
6802
6819
|
body: {
|
|
6803
|
-
packagesSlugs:
|
|
6820
|
+
packagesSlugs: command32.packagesSlugs
|
|
6804
6821
|
},
|
|
6805
6822
|
onError: (response2) => {
|
|
6806
6823
|
if (response2.status === 404) {
|
|
@@ -6811,10 +6828,10 @@ var LinterGateway = class {
|
|
|
6811
6828
|
);
|
|
6812
6829
|
return handleScopeInTargetsResponse(response);
|
|
6813
6830
|
};
|
|
6814
|
-
this.trackLinterExecution = async (
|
|
6831
|
+
this.trackLinterExecution = async (command32) => {
|
|
6815
6832
|
return this.httpClient.request(`/api/v0/track-execution`, {
|
|
6816
6833
|
method: "POST",
|
|
6817
|
-
body:
|
|
6834
|
+
body: command32
|
|
6818
6835
|
});
|
|
6819
6836
|
};
|
|
6820
6837
|
}
|
|
@@ -6836,25 +6853,6 @@ function handleScopeInTargetsResponse(response) {
|
|
|
6836
6853
|
};
|
|
6837
6854
|
}
|
|
6838
6855
|
|
|
6839
|
-
// apps/cli/src/infra/repositories/McpGateway.ts
|
|
6840
|
-
var McpGateway = class {
|
|
6841
|
-
constructor(httpClient) {
|
|
6842
|
-
this.httpClient = httpClient;
|
|
6843
|
-
this.getToken = async () => {
|
|
6844
|
-
const { organizationId } = this.httpClient.getAuthContext();
|
|
6845
|
-
return this.httpClient.request(
|
|
6846
|
-
`/api/v0/organizations/${organizationId}/mcp/token`
|
|
6847
|
-
);
|
|
6848
|
-
};
|
|
6849
|
-
this.getUrl = async () => {
|
|
6850
|
-
const { organizationId } = this.httpClient.getAuthContext();
|
|
6851
|
-
return this.httpClient.request(
|
|
6852
|
-
`/api/v0/organizations/${organizationId}/mcp/url`
|
|
6853
|
-
);
|
|
6854
|
-
};
|
|
6855
|
-
}
|
|
6856
|
-
};
|
|
6857
|
-
|
|
6858
6856
|
// apps/cli/src/infra/repositories/SpacesGateway.ts
|
|
6859
6857
|
var SpacesGateway = class {
|
|
6860
6858
|
constructor(httpClient) {
|
|
@@ -6887,27 +6885,27 @@ var SpacesGateway = class {
|
|
|
6887
6885
|
var SkillsGateway = class {
|
|
6888
6886
|
constructor(httpClient) {
|
|
6889
6887
|
this.httpClient = httpClient;
|
|
6890
|
-
this.upload = async (
|
|
6888
|
+
this.upload = async (command32) => {
|
|
6891
6889
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6892
6890
|
return this.httpClient.request(
|
|
6893
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6891
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/skills/upload`,
|
|
6894
6892
|
{
|
|
6895
6893
|
method: "POST",
|
|
6896
|
-
body:
|
|
6894
|
+
body: command32
|
|
6897
6895
|
}
|
|
6898
6896
|
);
|
|
6899
6897
|
};
|
|
6900
|
-
this.getDefaults = async (
|
|
6898
|
+
this.getDefaults = async (command32) => {
|
|
6901
6899
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6902
6900
|
const queryParams = new URLSearchParams();
|
|
6903
|
-
if (
|
|
6901
|
+
if (command32.includeBeta) {
|
|
6904
6902
|
queryParams.set("includeBeta", "true");
|
|
6905
|
-
} else if (
|
|
6906
|
-
queryParams.set("cliVersion",
|
|
6903
|
+
} else if (command32.cliVersion) {
|
|
6904
|
+
queryParams.set("cliVersion", command32.cliVersion);
|
|
6907
6905
|
}
|
|
6908
|
-
if (
|
|
6906
|
+
if (command32.agents !== void 0) {
|
|
6909
6907
|
queryParams.append("agentsConfigOverride", "true");
|
|
6910
|
-
|
|
6908
|
+
command32.agents.forEach((agent) => {
|
|
6911
6909
|
queryParams.append("agent", agent);
|
|
6912
6910
|
});
|
|
6913
6911
|
}
|
|
@@ -6916,10 +6914,10 @@ var SkillsGateway = class {
|
|
|
6916
6914
|
`/api/v0/organizations/${organizationId}/skills/default${queryString ? `?${queryString}` : ""}`
|
|
6917
6915
|
);
|
|
6918
6916
|
};
|
|
6919
|
-
this.list = async (
|
|
6917
|
+
this.list = async (command32) => {
|
|
6920
6918
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6921
6919
|
return this.httpClient.request(
|
|
6922
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6920
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/skills`
|
|
6923
6921
|
);
|
|
6924
6922
|
};
|
|
6925
6923
|
}
|
|
@@ -6929,17 +6927,17 @@ var SkillsGateway = class {
|
|
|
6929
6927
|
var CommandsGateway = class {
|
|
6930
6928
|
constructor(httpClient) {
|
|
6931
6929
|
this.httpClient = httpClient;
|
|
6932
|
-
this.create = async (
|
|
6930
|
+
this.create = async (command32) => {
|
|
6933
6931
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6934
6932
|
return this.httpClient.request(
|
|
6935
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6936
|
-
{ method: "POST", body:
|
|
6933
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/recipes`,
|
|
6934
|
+
{ method: "POST", body: command32 }
|
|
6937
6935
|
);
|
|
6938
6936
|
};
|
|
6939
|
-
this.list = async (
|
|
6937
|
+
this.list = async (command32) => {
|
|
6940
6938
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6941
6939
|
const listRecipesResponse = await this.httpClient.request(
|
|
6942
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6940
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/recipes`
|
|
6943
6941
|
);
|
|
6944
6942
|
if (listRecipesResponse instanceof Array) {
|
|
6945
6943
|
return { recipes: listRecipesResponse };
|
|
@@ -6980,10 +6978,10 @@ var StandardsGateway = class {
|
|
|
6980
6978
|
}
|
|
6981
6979
|
);
|
|
6982
6980
|
};
|
|
6983
|
-
this.list = async (
|
|
6981
|
+
this.list = async (command32) => {
|
|
6984
6982
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6985
6983
|
return this.httpClient.request(
|
|
6986
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6984
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/standards`
|
|
6987
6985
|
);
|
|
6988
6986
|
};
|
|
6989
6987
|
}
|
|
@@ -6994,10 +6992,10 @@ var PackagesGateway = class {
|
|
|
6994
6992
|
constructor(apiKey, httpClient) {
|
|
6995
6993
|
this.apiKey = apiKey;
|
|
6996
6994
|
this.httpClient = httpClient;
|
|
6997
|
-
this.list = async (
|
|
6995
|
+
this.list = async (command32) => {
|
|
6998
6996
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6999
6997
|
return this.httpClient.request(
|
|
7000
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6998
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/packages`
|
|
7001
6999
|
);
|
|
7002
7000
|
};
|
|
7003
7001
|
this.getSummary = async ({
|
|
@@ -7009,24 +7007,24 @@ var PackagesGateway = class {
|
|
|
7009
7007
|
`/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/summary/${encodeURIComponent(slug3)}`
|
|
7010
7008
|
);
|
|
7011
7009
|
};
|
|
7012
|
-
this.create = async (
|
|
7010
|
+
this.create = async (command32) => {
|
|
7013
7011
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7014
7012
|
return this.httpClient.request(
|
|
7015
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
7013
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/packages`,
|
|
7016
7014
|
{
|
|
7017
7015
|
method: "POST",
|
|
7018
|
-
body:
|
|
7016
|
+
body: command32
|
|
7019
7017
|
}
|
|
7020
7018
|
);
|
|
7021
7019
|
};
|
|
7022
|
-
this.addArtefacts = async (
|
|
7020
|
+
this.addArtefacts = async (command32) => {
|
|
7023
7021
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7024
|
-
const { packageId, spaceId } =
|
|
7022
|
+
const { packageId, spaceId } = command32;
|
|
7025
7023
|
return this.httpClient.request(
|
|
7026
7024
|
`/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/${packageId}/add-artifacts`,
|
|
7027
7025
|
{
|
|
7028
7026
|
method: "POST",
|
|
7029
|
-
body:
|
|
7027
|
+
body: command32
|
|
7030
7028
|
}
|
|
7031
7029
|
);
|
|
7032
7030
|
};
|
|
@@ -7037,31 +7035,31 @@ var PackagesGateway = class {
|
|
|
7037
7035
|
var DeploymentGateway = class {
|
|
7038
7036
|
constructor(httpClient) {
|
|
7039
7037
|
this.httpClient = httpClient;
|
|
7040
|
-
this.pull = async (
|
|
7038
|
+
this.pull = async (command32) => {
|
|
7041
7039
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7042
7040
|
const queryParams = new URLSearchParams();
|
|
7043
|
-
if (
|
|
7044
|
-
|
|
7041
|
+
if (command32.packagesSlugs && command32.packagesSlugs.length > 0) {
|
|
7042
|
+
command32.packagesSlugs.forEach((slug3) => {
|
|
7045
7043
|
queryParams.append("packageSlug", slug3);
|
|
7046
7044
|
});
|
|
7047
7045
|
}
|
|
7048
|
-
if (
|
|
7049
|
-
|
|
7046
|
+
if (command32.previousPackagesSlugs && command32.previousPackagesSlugs.length > 0) {
|
|
7047
|
+
command32.previousPackagesSlugs.forEach((slug3) => {
|
|
7050
7048
|
queryParams.append("previousPackageSlug", slug3);
|
|
7051
7049
|
});
|
|
7052
7050
|
}
|
|
7053
|
-
if (
|
|
7054
|
-
queryParams.append("gitRemoteUrl",
|
|
7051
|
+
if (command32.gitRemoteUrl) {
|
|
7052
|
+
queryParams.append("gitRemoteUrl", command32.gitRemoteUrl);
|
|
7055
7053
|
}
|
|
7056
|
-
if (
|
|
7057
|
-
queryParams.append("gitBranch",
|
|
7054
|
+
if (command32.gitBranch) {
|
|
7055
|
+
queryParams.append("gitBranch", command32.gitBranch);
|
|
7058
7056
|
}
|
|
7059
|
-
if (
|
|
7060
|
-
queryParams.append("relativePath",
|
|
7057
|
+
if (command32.relativePath) {
|
|
7058
|
+
queryParams.append("relativePath", command32.relativePath);
|
|
7061
7059
|
}
|
|
7062
|
-
if (
|
|
7060
|
+
if (command32.agents !== void 0) {
|
|
7063
7061
|
queryParams.append("agentsConfigOverride", "true");
|
|
7064
|
-
|
|
7062
|
+
command32.agents.forEach((agent) => {
|
|
7065
7063
|
queryParams.append("agent", agent);
|
|
7066
7064
|
});
|
|
7067
7065
|
}
|
|
@@ -7069,71 +7067,71 @@ var DeploymentGateway = class {
|
|
|
7069
7067
|
`/api/v0/organizations/${organizationId}/pull?${queryParams.toString()}`
|
|
7070
7068
|
);
|
|
7071
7069
|
};
|
|
7072
|
-
this.install = async (
|
|
7070
|
+
this.install = async (command32) => {
|
|
7073
7071
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7074
7072
|
return this.httpClient.request(
|
|
7075
7073
|
`/api/v0/organizations/${organizationId}/install`,
|
|
7076
7074
|
{
|
|
7077
7075
|
method: "POST",
|
|
7078
7076
|
body: {
|
|
7079
|
-
packagesSlugs:
|
|
7080
|
-
packmindLockFile:
|
|
7081
|
-
...
|
|
7082
|
-
...
|
|
7077
|
+
packagesSlugs: command32.packagesSlugs,
|
|
7078
|
+
packmindLockFile: command32.packmindLockFile,
|
|
7079
|
+
...command32.relativePath && { relativePath: command32.relativePath },
|
|
7080
|
+
...command32.agents !== void 0 && { agents: command32.agents }
|
|
7083
7081
|
}
|
|
7084
7082
|
}
|
|
7085
7083
|
);
|
|
7086
7084
|
};
|
|
7087
|
-
this.getDeployed = async (
|
|
7085
|
+
this.getDeployed = async (command32) => {
|
|
7088
7086
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7089
7087
|
return this.httpClient.request(
|
|
7090
7088
|
`/api/v0/organizations/${organizationId}/deployed-content`,
|
|
7091
7089
|
{
|
|
7092
7090
|
method: "POST",
|
|
7093
7091
|
body: {
|
|
7094
|
-
packagesSlugs:
|
|
7095
|
-
gitRemoteUrl:
|
|
7096
|
-
gitBranch:
|
|
7097
|
-
relativePath:
|
|
7098
|
-
...
|
|
7092
|
+
packagesSlugs: command32.packagesSlugs,
|
|
7093
|
+
gitRemoteUrl: command32.gitRemoteUrl,
|
|
7094
|
+
gitBranch: command32.gitBranch,
|
|
7095
|
+
relativePath: command32.relativePath,
|
|
7096
|
+
...command32.agents !== void 0 && { agents: command32.agents }
|
|
7099
7097
|
}
|
|
7100
7098
|
}
|
|
7101
7099
|
);
|
|
7102
7100
|
};
|
|
7103
|
-
this.getContentByVersions = async (
|
|
7101
|
+
this.getContentByVersions = async (command32) => {
|
|
7104
7102
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7105
7103
|
return this.httpClient.request(
|
|
7106
7104
|
`/api/v0/organizations/${organizationId}/content-by-versions`,
|
|
7107
7105
|
{
|
|
7108
7106
|
method: "POST",
|
|
7109
7107
|
body: {
|
|
7110
|
-
artifacts:
|
|
7111
|
-
...
|
|
7108
|
+
artifacts: command32.artifacts,
|
|
7109
|
+
...command32.agents !== void 0 && { agents: command32.agents }
|
|
7112
7110
|
}
|
|
7113
7111
|
}
|
|
7114
7112
|
);
|
|
7115
7113
|
};
|
|
7116
|
-
this.notifyDistribution = async (
|
|
7114
|
+
this.notifyDistribution = async (command32) => {
|
|
7117
7115
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7118
7116
|
return this.httpClient.request(
|
|
7119
7117
|
`/api/v0/organizations/${organizationId}/deployments`,
|
|
7120
7118
|
{
|
|
7121
7119
|
method: "POST",
|
|
7122
|
-
body:
|
|
7120
|
+
body: command32
|
|
7123
7121
|
}
|
|
7124
7122
|
);
|
|
7125
7123
|
};
|
|
7126
|
-
this.notifyArtefactsDistribution = async (
|
|
7124
|
+
this.notifyArtefactsDistribution = async (command32) => {
|
|
7127
7125
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7128
7126
|
return this.httpClient.request(
|
|
7129
7127
|
`/api/v0/organizations/${organizationId}/deployments/notify-artifacts-distribution`,
|
|
7130
7128
|
{
|
|
7131
7129
|
method: "POST",
|
|
7132
7130
|
body: {
|
|
7133
|
-
gitRemoteUrl:
|
|
7134
|
-
gitBranch:
|
|
7135
|
-
relativePath:
|
|
7136
|
-
packmindLockFile:
|
|
7131
|
+
gitRemoteUrl: command32.gitRemoteUrl,
|
|
7132
|
+
gitBranch: command32.gitBranch,
|
|
7133
|
+
relativePath: command32.relativePath,
|
|
7134
|
+
packmindLockFile: command32.packmindLockFile
|
|
7137
7135
|
}
|
|
7138
7136
|
}
|
|
7139
7137
|
);
|
|
@@ -7184,7 +7182,6 @@ var PackmindGateway = class {
|
|
|
7184
7182
|
this.httpClient = new PackmindHttpClient(apiKey);
|
|
7185
7183
|
this.changeProposals = new ChangeProposalGateway(this.httpClient);
|
|
7186
7184
|
this.linter = new LinterGateway(this.httpClient);
|
|
7187
|
-
this.mcp = new McpGateway(this.httpClient);
|
|
7188
7185
|
this.spaces = new SpacesGateway(this.httpClient);
|
|
7189
7186
|
this.skills = new SkillsGateway(this.httpClient);
|
|
7190
7187
|
this.commands = new CommandsGateway(this.httpClient);
|
|
@@ -8935,8 +8932,8 @@ var ExecuteLinterProgramsUseCase = class {
|
|
|
8935
8932
|
this.linterAstAdapter = linterAstAdapter;
|
|
8936
8933
|
this.logger = logger2;
|
|
8937
8934
|
}
|
|
8938
|
-
async execute(
|
|
8939
|
-
const { filePath, fileContent, language, programs } =
|
|
8935
|
+
async execute(command32) {
|
|
8936
|
+
const { filePath, fileContent, language, programs } = command32;
|
|
8940
8937
|
if (programs.length === 0) {
|
|
8941
8938
|
return {
|
|
8942
8939
|
file: filePath,
|
|
@@ -9722,8 +9719,8 @@ var InstallPackagesUseCase = class {
|
|
|
9722
9719
|
constructor(packmindGateway) {
|
|
9723
9720
|
this.packmindGateway = packmindGateway;
|
|
9724
9721
|
}
|
|
9725
|
-
async execute(
|
|
9726
|
-
const baseDirectory =
|
|
9722
|
+
async execute(command32) {
|
|
9723
|
+
const baseDirectory = command32.baseDirectory || process.cwd();
|
|
9727
9724
|
const result = {
|
|
9728
9725
|
filesCreated: 0,
|
|
9729
9726
|
filesUpdated: 0,
|
|
@@ -9735,12 +9732,12 @@ var InstallPackagesUseCase = class {
|
|
|
9735
9732
|
skillDirectoriesDeleted: 0
|
|
9736
9733
|
};
|
|
9737
9734
|
const response = await this.packmindGateway.deployment.pull({
|
|
9738
|
-
packagesSlugs:
|
|
9739
|
-
previousPackagesSlugs:
|
|
9740
|
-
gitRemoteUrl:
|
|
9741
|
-
gitBranch:
|
|
9742
|
-
relativePath:
|
|
9743
|
-
agents:
|
|
9735
|
+
packagesSlugs: command32.packagesSlugs,
|
|
9736
|
+
previousPackagesSlugs: command32.previousPackagesSlugs,
|
|
9737
|
+
gitRemoteUrl: command32.gitRemoteUrl,
|
|
9738
|
+
gitBranch: command32.gitBranch,
|
|
9739
|
+
relativePath: command32.relativePath,
|
|
9740
|
+
agents: command32.agents
|
|
9744
9741
|
});
|
|
9745
9742
|
const filteredCreateOrUpdate = response.fileUpdates.createOrUpdate.filter(
|
|
9746
9743
|
(file) => file.path !== "packmind.json"
|
|
@@ -10047,8 +10044,8 @@ var InstallUseCase = class {
|
|
|
10047
10044
|
this.configFileRepository = configFileRepository;
|
|
10048
10045
|
this.spaceService = spaceService;
|
|
10049
10046
|
}
|
|
10050
|
-
async execute(
|
|
10051
|
-
const baseDirectory =
|
|
10047
|
+
async execute(command32) {
|
|
10048
|
+
const baseDirectory = command32.baseDirectory || process.cwd();
|
|
10052
10049
|
const result = {
|
|
10053
10050
|
filesCreated: 0,
|
|
10054
10051
|
filesUpdated: 0,
|
|
@@ -10066,7 +10063,7 @@ var InstallUseCase = class {
|
|
|
10066
10063
|
skillDirectoriesDeleted: 0,
|
|
10067
10064
|
missingAccess: []
|
|
10068
10065
|
};
|
|
10069
|
-
const hasExplicitPackages =
|
|
10066
|
+
const hasExplicitPackages = command32.packages && command32.packages.length > 0;
|
|
10070
10067
|
const lockFile = await this.lockFileRepository.read(baseDirectory);
|
|
10071
10068
|
const config = await this.configFileRepository.readConfig(baseDirectory);
|
|
10072
10069
|
if (!config && !hasExplicitPackages) {
|
|
@@ -10090,7 +10087,7 @@ var InstallUseCase = class {
|
|
|
10090
10087
|
let packagesSlugs;
|
|
10091
10088
|
let normalizedPackages = [];
|
|
10092
10089
|
if (hasExplicitPackages) {
|
|
10093
|
-
normalizedPackages = await this.normalizePackageSlugs(
|
|
10090
|
+
normalizedPackages = await this.normalizePackageSlugs(command32.packages);
|
|
10094
10091
|
await this.validatePackageAccess(normalizedPackages);
|
|
10095
10092
|
const normalizedConfigPackages = config ? await this.normalizeAndSaveConfigPackages(baseDirectory, config) : [];
|
|
10096
10093
|
packagesSlugs = [
|
|
@@ -10475,8 +10472,8 @@ var UninstallUseCase = class {
|
|
|
10475
10472
|
this.spaceService = spaceService;
|
|
10476
10473
|
this.installUseCase = installUseCase;
|
|
10477
10474
|
}
|
|
10478
|
-
async execute(
|
|
10479
|
-
const baseDirectory =
|
|
10475
|
+
async execute(command32) {
|
|
10476
|
+
const baseDirectory = command32.baseDirectory || process.cwd();
|
|
10480
10477
|
const config = await this.configFileRepository.readConfig(baseDirectory);
|
|
10481
10478
|
if (!config) {
|
|
10482
10479
|
const configFileExists = await this.configFileRepository.configExists(baseDirectory);
|
|
@@ -10490,7 +10487,7 @@ var UninstallUseCase = class {
|
|
|
10490
10487
|
);
|
|
10491
10488
|
}
|
|
10492
10489
|
const normalized = await normalizePackageSlugs(
|
|
10493
|
-
|
|
10490
|
+
command32.packages,
|
|
10494
10491
|
this.spaceService
|
|
10495
10492
|
);
|
|
10496
10493
|
const notInstalled = normalized.filter((pkg) => !(pkg in config.packages));
|
|
@@ -10531,8 +10528,8 @@ var InstallDefaultSkillsUseCase = class {
|
|
|
10531
10528
|
constructor(repositories) {
|
|
10532
10529
|
this.repositories = repositories;
|
|
10533
10530
|
}
|
|
10534
|
-
async execute(
|
|
10535
|
-
const baseDirectory =
|
|
10531
|
+
async execute(command32) {
|
|
10532
|
+
const baseDirectory = command32.baseDirectory || process.cwd();
|
|
10536
10533
|
const result = {
|
|
10537
10534
|
filesCreated: 0,
|
|
10538
10535
|
filesUpdated: 0,
|
|
@@ -10545,17 +10542,17 @@ var InstallDefaultSkillsUseCase = class {
|
|
|
10545
10542
|
const agents = config?.agents;
|
|
10546
10543
|
const response = await this.repositories.packmindGateway.skills.getDefaults(
|
|
10547
10544
|
{
|
|
10548
|
-
cliVersion:
|
|
10549
|
-
includeBeta:
|
|
10545
|
+
cliVersion: command32.cliVersion,
|
|
10546
|
+
includeBeta: command32.includeBeta,
|
|
10550
10547
|
agents
|
|
10551
10548
|
}
|
|
10552
10549
|
);
|
|
10553
10550
|
result.skippedSkillsCount = response.skippedSkillsCount;
|
|
10554
10551
|
const incompatibleInstalledMap = /* @__PURE__ */ new Map();
|
|
10555
10552
|
const incompatibleSkillDirs = /* @__PURE__ */ new Map();
|
|
10556
|
-
if (
|
|
10553
|
+
if (command32.cliVersion) {
|
|
10557
10554
|
for (const file of response.fileUpdates.createOrUpdate) {
|
|
10558
|
-
if (path8.basename(file.path) === "SKILL.md" && file.content && this.isVersionConstraintViolated(file.content,
|
|
10555
|
+
if (path8.basename(file.path) === "SKILL.md" && file.content && this.isVersionConstraintViolated(file.content, command32.cliVersion)) {
|
|
10559
10556
|
const dir = path8.dirname(file.path);
|
|
10560
10557
|
const skillName = this.getSkillName(file.content) ?? path8.basename(dir);
|
|
10561
10558
|
incompatibleSkillDirs.set(dir, skillName);
|
|
@@ -10566,12 +10563,15 @@ var InstallDefaultSkillsUseCase = class {
|
|
|
10566
10563
|
for (const file of response.fileUpdates.createOrUpdate) {
|
|
10567
10564
|
try {
|
|
10568
10565
|
if (!file.content) continue;
|
|
10569
|
-
const isIncompatible =
|
|
10566
|
+
const isIncompatible = command32.cliVersion && (this.isVersionConstraintViolated(
|
|
10570
10567
|
file.content,
|
|
10571
|
-
|
|
10572
|
-
) ||
|
|
10568
|
+
command32.cliVersion
|
|
10569
|
+
) || this.isUnderIncompatibleSkillDir(
|
|
10570
|
+
file.path,
|
|
10571
|
+
incompatibleSkillDirs
|
|
10572
|
+
));
|
|
10573
10573
|
if (isIncompatible) {
|
|
10574
|
-
const skillName = this.getSkillName(file.content) ??
|
|
10574
|
+
const skillName = this.getSkillName(file.content) ?? this.getSkillNameForPath(file.path, incompatibleSkillDirs) ?? path8.basename(file.path);
|
|
10575
10575
|
const fullPath = path8.join(baseDirectory, file.path);
|
|
10576
10576
|
const fileAlreadyInstalled = await this.fileExists(fullPath);
|
|
10577
10577
|
if (fileAlreadyInstalled) {
|
|
@@ -10631,6 +10631,25 @@ var InstallDefaultSkillsUseCase = class {
|
|
|
10631
10631
|
return false;
|
|
10632
10632
|
}
|
|
10633
10633
|
}
|
|
10634
|
+
/**
|
|
10635
|
+
* Returns true if the given file path is inside one of the incompatible skill
|
|
10636
|
+
* directories, including nested subdirectories (e.g. `scripts/`).
|
|
10637
|
+
*/
|
|
10638
|
+
isUnderIncompatibleSkillDir(filePath, incompatibleSkillDirs) {
|
|
10639
|
+
return this.getSkillNameForPath(filePath, incompatibleSkillDirs) !== null;
|
|
10640
|
+
}
|
|
10641
|
+
/**
|
|
10642
|
+
* Returns the skill name for the given file path by finding the incompatible
|
|
10643
|
+
* skill directory that contains it (including nested subdirectories).
|
|
10644
|
+
*/
|
|
10645
|
+
getSkillNameForPath(filePath, incompatibleSkillDirs) {
|
|
10646
|
+
for (const [dir, skillName] of incompatibleSkillDirs.entries()) {
|
|
10647
|
+
if (filePath === dir || filePath.startsWith(dir + "/") || filePath.startsWith(dir + path8.sep)) {
|
|
10648
|
+
return skillName;
|
|
10649
|
+
}
|
|
10650
|
+
}
|
|
10651
|
+
return null;
|
|
10652
|
+
}
|
|
10634
10653
|
/**
|
|
10635
10654
|
* Returns true if the skill's `metadata.packmind-cli-version` constraint
|
|
10636
10655
|
* is present AND the given CLI version does NOT satisfy it (i.e. the skill
|
|
@@ -10661,10 +10680,10 @@ var ListPackagesUseCase = class {
|
|
|
10661
10680
|
this.packmindGateway = packmindGateway;
|
|
10662
10681
|
this.spaceService = spaceService;
|
|
10663
10682
|
}
|
|
10664
|
-
async execute(
|
|
10665
|
-
if (
|
|
10683
|
+
async execute(command32) {
|
|
10684
|
+
if (command32.spaceId) {
|
|
10666
10685
|
const response = await this.packmindGateway.packages.list({
|
|
10667
|
-
spaceId:
|
|
10686
|
+
spaceId: command32.spaceId
|
|
10668
10687
|
});
|
|
10669
10688
|
return response.packages;
|
|
10670
10689
|
}
|
|
@@ -10683,8 +10702,8 @@ var GetPackageSummaryUseCase = class {
|
|
|
10683
10702
|
constructor(gateway) {
|
|
10684
10703
|
this.gateway = gateway;
|
|
10685
10704
|
}
|
|
10686
|
-
async execute(
|
|
10687
|
-
return this.gateway.packages.getSummary(
|
|
10705
|
+
async execute(command32) {
|
|
10706
|
+
return this.gateway.packages.getSummary(command32);
|
|
10688
10707
|
}
|
|
10689
10708
|
};
|
|
10690
10709
|
|
|
@@ -10963,8 +10982,8 @@ var LoginUseCase = class {
|
|
|
10963
10982
|
startCallbackServer: deps?.startCallbackServer ?? defaultStartCallbackServer
|
|
10964
10983
|
};
|
|
10965
10984
|
}
|
|
10966
|
-
async execute(
|
|
10967
|
-
const { host, code: providedCode } =
|
|
10985
|
+
async execute(command32) {
|
|
10986
|
+
const { host, code: providedCode } = command32;
|
|
10968
10987
|
let code;
|
|
10969
10988
|
if (providedCode) {
|
|
10970
10989
|
code = providedCode;
|
|
@@ -11002,8 +11021,8 @@ var LogoutUseCase = class {
|
|
|
11002
11021
|
constructor(deps) {
|
|
11003
11022
|
this.deps = {
|
|
11004
11023
|
getCredentialsPath: deps?.getCredentialsPath ?? getCredentialsPath,
|
|
11005
|
-
fileExists: deps?.fileExists ?? ((
|
|
11006
|
-
deleteFile: deps?.deleteFile ?? ((
|
|
11024
|
+
fileExists: deps?.fileExists ?? ((path35) => fs8.existsSync(path35)),
|
|
11025
|
+
deleteFile: deps?.deleteFile ?? ((path35) => fs8.unlinkSync(path35)),
|
|
11007
11026
|
hasEnvVar: deps?.hasEnvVar ?? (() => !!process.env[ENV_VAR_NAME2])
|
|
11008
11027
|
};
|
|
11009
11028
|
}
|
|
@@ -11282,7 +11301,7 @@ var CheckCliVersionUseCase = class {
|
|
|
11282
11301
|
timeoutMs: deps?.timeoutMs ?? VERSION_CHECK_TIMEOUT_MS
|
|
11283
11302
|
};
|
|
11284
11303
|
}
|
|
11285
|
-
async execute(
|
|
11304
|
+
async execute(command32) {
|
|
11286
11305
|
try {
|
|
11287
11306
|
const latestVersion = await Promise.race([
|
|
11288
11307
|
this.deps.fetchLatestVersion(this.deps.fetchFn),
|
|
@@ -11293,9 +11312,9 @@ var CheckCliVersionUseCase = class {
|
|
|
11293
11312
|
)
|
|
11294
11313
|
)
|
|
11295
11314
|
]);
|
|
11296
|
-
const updateAvailable = import_semver3.default.gt(latestVersion,
|
|
11315
|
+
const updateAvailable = import_semver3.default.gt(latestVersion, command32.currentVersion);
|
|
11297
11316
|
return {
|
|
11298
|
-
currentVersion:
|
|
11317
|
+
currentVersion: command32.currentVersion,
|
|
11299
11318
|
latestVersion,
|
|
11300
11319
|
updateAvailable
|
|
11301
11320
|
};
|
|
@@ -11305,222 +11324,9 @@ var CheckCliVersionUseCase = class {
|
|
|
11305
11324
|
}
|
|
11306
11325
|
};
|
|
11307
11326
|
|
|
11308
|
-
// apps/cli/src/application/useCases/SetupMcpUseCase.ts
|
|
11309
|
-
var ALL_AGENTS = [
|
|
11310
|
-
{ type: "claude", name: "Claude Code" },
|
|
11311
|
-
{ type: "cursor", name: "Cursor" },
|
|
11312
|
-
{ type: "vscode", name: "VS Code" },
|
|
11313
|
-
{ type: "continue", name: "Continue.dev" }
|
|
11314
|
-
];
|
|
11315
|
-
var SetupMcpUseCase = class {
|
|
11316
|
-
constructor(deps) {
|
|
11317
|
-
this.deps = deps;
|
|
11318
|
-
}
|
|
11319
|
-
async execute(command33) {
|
|
11320
|
-
const { agentTypes } = command33;
|
|
11321
|
-
const [tokenResult, urlResult] = await Promise.all([
|
|
11322
|
-
this.deps.gateway.mcp.getToken({}),
|
|
11323
|
-
this.deps.gateway.mcp.getUrl({})
|
|
11324
|
-
]);
|
|
11325
|
-
const config = {
|
|
11326
|
-
url: urlResult.url,
|
|
11327
|
-
accessToken: tokenResult.access_token
|
|
11328
|
-
};
|
|
11329
|
-
const results = [];
|
|
11330
|
-
let hasFailure = false;
|
|
11331
|
-
for (const agentType of agentTypes) {
|
|
11332
|
-
const agentName = ALL_AGENTS.find((a) => a.type === agentType)?.name || agentType;
|
|
11333
|
-
const installResult = this.deps.mcpConfigService.installForAgent(
|
|
11334
|
-
agentType,
|
|
11335
|
-
config
|
|
11336
|
-
);
|
|
11337
|
-
results.push({
|
|
11338
|
-
agentType,
|
|
11339
|
-
agentName,
|
|
11340
|
-
success: installResult.success,
|
|
11341
|
-
error: installResult.error
|
|
11342
|
-
});
|
|
11343
|
-
if (!installResult.success) {
|
|
11344
|
-
hasFailure = true;
|
|
11345
|
-
}
|
|
11346
|
-
}
|
|
11347
|
-
return {
|
|
11348
|
-
results,
|
|
11349
|
-
manualConfigJson: hasFailure ? this.deps.mcpConfigService.getClassicConfig(config) : void 0
|
|
11350
|
-
};
|
|
11351
|
-
}
|
|
11352
|
-
};
|
|
11353
|
-
|
|
11354
|
-
// apps/cli/src/application/services/McpConfigService.ts
|
|
11355
|
-
var fs9 = __toESM(require("fs"));
|
|
11356
|
-
var path11 = __toESM(require("path"));
|
|
11357
|
-
var os3 = __toESM(require("os"));
|
|
11358
|
-
var import_child_process3 = require("child_process");
|
|
11359
|
-
var McpConfigService = class {
|
|
11360
|
-
constructor(projectDir = process.cwd()) {
|
|
11361
|
-
this.projectDir = projectDir;
|
|
11362
|
-
}
|
|
11363
|
-
installForAgent(agent, config) {
|
|
11364
|
-
switch (agent) {
|
|
11365
|
-
case "claude":
|
|
11366
|
-
return this.installClaudeMcp(config);
|
|
11367
|
-
case "cursor":
|
|
11368
|
-
return this.installCursorMcp(config);
|
|
11369
|
-
case "vscode":
|
|
11370
|
-
return this.installVSCodeMcp(config);
|
|
11371
|
-
case "continue":
|
|
11372
|
-
return this.installContinueMcp(config);
|
|
11373
|
-
default:
|
|
11374
|
-
return { success: false, error: `Unknown agent: ${agent}` };
|
|
11375
|
-
}
|
|
11376
|
-
}
|
|
11377
|
-
getClassicConfig(config) {
|
|
11378
|
-
const mcpConfig = {
|
|
11379
|
-
mcpServers: {
|
|
11380
|
-
packmind: {
|
|
11381
|
-
url: config.url,
|
|
11382
|
-
headers: {
|
|
11383
|
-
Authorization: `Bearer ${config.accessToken}`
|
|
11384
|
-
}
|
|
11385
|
-
}
|
|
11386
|
-
}
|
|
11387
|
-
};
|
|
11388
|
-
return JSON.stringify(mcpConfig, null, 2);
|
|
11389
|
-
}
|
|
11390
|
-
installClaudeMcp(config) {
|
|
11391
|
-
const command33 = `claude mcp add --transport http packmind ${config.url} --header "Authorization: Bearer ${config.accessToken}"`;
|
|
11392
|
-
try {
|
|
11393
|
-
(0, import_child_process3.execSync)(command33, { stdio: "pipe" });
|
|
11394
|
-
return { success: true };
|
|
11395
|
-
} catch (error) {
|
|
11396
|
-
const execError = error;
|
|
11397
|
-
const errorMessage = execError.stderr ? execError.stderr.toString().trim() : execError.message || String(error);
|
|
11398
|
-
return { success: false, error: errorMessage };
|
|
11399
|
-
}
|
|
11400
|
-
}
|
|
11401
|
-
installCursorMcp(config) {
|
|
11402
|
-
try {
|
|
11403
|
-
const cursorConfigPath = path11.join(os3.homedir(), ".cursor", "mcp.json");
|
|
11404
|
-
const cursorConfig = this.buildCursorConfig(config);
|
|
11405
|
-
const existingConfig = this.readExistingJsonConfig(cursorConfigPath);
|
|
11406
|
-
const mergedConfig = this.mergeConfig(existingConfig, cursorConfig);
|
|
11407
|
-
fs9.writeFileSync(cursorConfigPath, JSON.stringify(mergedConfig, null, 2));
|
|
11408
|
-
return { success: true };
|
|
11409
|
-
} catch (error) {
|
|
11410
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
11411
|
-
return { success: false, error: errorMessage };
|
|
11412
|
-
}
|
|
11413
|
-
}
|
|
11414
|
-
installVSCodeMcp(config) {
|
|
11415
|
-
try {
|
|
11416
|
-
const vscodeDir = path11.join(this.projectDir, ".vscode");
|
|
11417
|
-
if (!fs9.existsSync(vscodeDir)) {
|
|
11418
|
-
fs9.mkdirSync(vscodeDir, { recursive: true });
|
|
11419
|
-
}
|
|
11420
|
-
const vscodeConfigPath = path11.join(vscodeDir, "mcp.json");
|
|
11421
|
-
const vscodeConfig = this.buildVSCodeConfig(config);
|
|
11422
|
-
const existingConfig = this.readExistingJsonConfig(vscodeConfigPath);
|
|
11423
|
-
const mergedConfig = this.mergeVSCodeConfig(existingConfig, vscodeConfig);
|
|
11424
|
-
fs9.writeFileSync(vscodeConfigPath, JSON.stringify(mergedConfig, null, 2));
|
|
11425
|
-
return { success: true };
|
|
11426
|
-
} catch (error) {
|
|
11427
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
11428
|
-
return { success: false, error: errorMessage };
|
|
11429
|
-
}
|
|
11430
|
-
}
|
|
11431
|
-
installContinueMcp(config) {
|
|
11432
|
-
try {
|
|
11433
|
-
const continueDir = path11.join(this.projectDir, ".continue");
|
|
11434
|
-
const mcpServersDir = path11.join(continueDir, "mcpServers");
|
|
11435
|
-
if (!fs9.existsSync(mcpServersDir)) {
|
|
11436
|
-
fs9.mkdirSync(mcpServersDir, { recursive: true });
|
|
11437
|
-
}
|
|
11438
|
-
const continueConfigPath = path11.join(mcpServersDir, "packmind.yaml");
|
|
11439
|
-
const continueConfig = this.buildContinueYamlConfig(config);
|
|
11440
|
-
fs9.writeFileSync(continueConfigPath, continueConfig);
|
|
11441
|
-
return { success: true };
|
|
11442
|
-
} catch (error) {
|
|
11443
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
11444
|
-
return { success: false, error: errorMessage };
|
|
11445
|
-
}
|
|
11446
|
-
}
|
|
11447
|
-
buildCursorConfig(config) {
|
|
11448
|
-
return {
|
|
11449
|
-
mcpServers: {
|
|
11450
|
-
packmind: {
|
|
11451
|
-
url: config.url,
|
|
11452
|
-
headers: {
|
|
11453
|
-
Authorization: `Bearer ${config.accessToken}`
|
|
11454
|
-
}
|
|
11455
|
-
}
|
|
11456
|
-
}
|
|
11457
|
-
};
|
|
11458
|
-
}
|
|
11459
|
-
buildVSCodeConfig(config) {
|
|
11460
|
-
return {
|
|
11461
|
-
servers: {
|
|
11462
|
-
"packmind-mcp-vscode": {
|
|
11463
|
-
url: config.url,
|
|
11464
|
-
type: "http",
|
|
11465
|
-
headers: {
|
|
11466
|
-
Authorization: `Bearer ${config.accessToken}`
|
|
11467
|
-
}
|
|
11468
|
-
}
|
|
11469
|
-
},
|
|
11470
|
-
inputs: []
|
|
11471
|
-
};
|
|
11472
|
-
}
|
|
11473
|
-
buildContinueYamlConfig(config) {
|
|
11474
|
-
return `name: Packmind MCP Server
|
|
11475
|
-
version: 0.0.1
|
|
11476
|
-
schema: v1
|
|
11477
|
-
mcpServers:
|
|
11478
|
-
- name: Packmind
|
|
11479
|
-
type: streamable-http
|
|
11480
|
-
url: ${config.url}
|
|
11481
|
-
requestOptions:
|
|
11482
|
-
headers:
|
|
11483
|
-
Authorization: "Bearer ${config.accessToken}"
|
|
11484
|
-
`;
|
|
11485
|
-
}
|
|
11486
|
-
readExistingJsonConfig(filePath) {
|
|
11487
|
-
try {
|
|
11488
|
-
if (fs9.existsSync(filePath)) {
|
|
11489
|
-
const content = fs9.readFileSync(filePath, "utf-8");
|
|
11490
|
-
return JSON.parse(content);
|
|
11491
|
-
}
|
|
11492
|
-
} catch {
|
|
11493
|
-
}
|
|
11494
|
-
return {};
|
|
11495
|
-
}
|
|
11496
|
-
mergeConfig(existing, newConfig) {
|
|
11497
|
-
const existingServers = existing["mcpServers"] || {};
|
|
11498
|
-
const newServers = newConfig["mcpServers"] || {};
|
|
11499
|
-
return {
|
|
11500
|
-
...existing,
|
|
11501
|
-
mcpServers: {
|
|
11502
|
-
...existingServers,
|
|
11503
|
-
...newServers
|
|
11504
|
-
}
|
|
11505
|
-
};
|
|
11506
|
-
}
|
|
11507
|
-
mergeVSCodeConfig(existing, newConfig) {
|
|
11508
|
-
const existingServers = existing["servers"] || {};
|
|
11509
|
-
const newServers = newConfig["servers"] || {};
|
|
11510
|
-
return {
|
|
11511
|
-
...existing,
|
|
11512
|
-
servers: {
|
|
11513
|
-
...existingServers,
|
|
11514
|
-
...newServers
|
|
11515
|
-
},
|
|
11516
|
-
inputs: existing["inputs"] || newConfig["inputs"] || []
|
|
11517
|
-
};
|
|
11518
|
-
}
|
|
11519
|
-
};
|
|
11520
|
-
|
|
11521
11327
|
// apps/cli/src/infra/repositories/ConfigFileRepository.ts
|
|
11522
|
-
var
|
|
11523
|
-
var
|
|
11328
|
+
var fs9 = __toESM(require("fs/promises"));
|
|
11329
|
+
var path11 = __toESM(require("path"));
|
|
11524
11330
|
var ConfigFileRepository = class {
|
|
11525
11331
|
constructor() {
|
|
11526
11332
|
this.CONFIG_FILENAME = "packmind.json";
|
|
@@ -11541,7 +11347,7 @@ var ConfigFileRepository = class {
|
|
|
11541
11347
|
async configExists(baseDirectory) {
|
|
11542
11348
|
const configPath = this.getConfigPath(baseDirectory);
|
|
11543
11349
|
try {
|
|
11544
|
-
await
|
|
11350
|
+
await fs9.access(configPath);
|
|
11545
11351
|
return true;
|
|
11546
11352
|
} catch {
|
|
11547
11353
|
return false;
|
|
@@ -11550,7 +11356,7 @@ var ConfigFileRepository = class {
|
|
|
11550
11356
|
async readConfig(baseDirectory) {
|
|
11551
11357
|
const configPath = this.getConfigPath(baseDirectory);
|
|
11552
11358
|
try {
|
|
11553
|
-
const configContent = await
|
|
11359
|
+
const configContent = await fs9.readFile(configPath, "utf-8");
|
|
11554
11360
|
const rawConfig = JSON.parse(configContent);
|
|
11555
11361
|
if (!rawConfig.packages || typeof rawConfig.packages !== "object") {
|
|
11556
11362
|
throw new Error(
|
|
@@ -11584,18 +11390,18 @@ var ConfigFileRepository = class {
|
|
|
11584
11390
|
}
|
|
11585
11391
|
}
|
|
11586
11392
|
getConfigPath(directory) {
|
|
11587
|
-
return
|
|
11393
|
+
return path11.join(directory, this.CONFIG_FILENAME);
|
|
11588
11394
|
}
|
|
11589
11395
|
async writeConfigToPath(configPath, config) {
|
|
11590
11396
|
const configContent = JSON.stringify(config, null, 2) + "\n";
|
|
11591
|
-
await
|
|
11397
|
+
await fs9.writeFile(configPath, configContent, "utf-8");
|
|
11592
11398
|
}
|
|
11593
11399
|
/**
|
|
11594
11400
|
* Recursively finds all directories containing packmind.json in descendant folders.
|
|
11595
11401
|
* Excludes common build/dependency directories (node_modules, .git, dist, etc.)
|
|
11596
11402
|
*/
|
|
11597
11403
|
async findDescendantConfigs(directory) {
|
|
11598
|
-
const normalizedDir = normalizePath2(
|
|
11404
|
+
const normalizedDir = normalizePath2(path11.resolve(directory));
|
|
11599
11405
|
return this.searchDescendantsRecursively(normalizedDir);
|
|
11600
11406
|
}
|
|
11601
11407
|
async searchDescendantsRecursively(currentDir) {
|
|
@@ -11608,7 +11414,7 @@ var ConfigFileRepository = class {
|
|
|
11608
11414
|
if (!entry.isDirectory() || this.isExcludedDirectory(entry.name)) {
|
|
11609
11415
|
continue;
|
|
11610
11416
|
}
|
|
11611
|
-
const entryPath = normalizePath2(
|
|
11417
|
+
const entryPath = normalizePath2(path11.join(currentDir, entry.name));
|
|
11612
11418
|
const config = await this.readConfig(entryPath);
|
|
11613
11419
|
if (config) {
|
|
11614
11420
|
results.push(entryPath);
|
|
@@ -11620,7 +11426,7 @@ var ConfigFileRepository = class {
|
|
|
11620
11426
|
}
|
|
11621
11427
|
async tryReadDirectory(directory) {
|
|
11622
11428
|
try {
|
|
11623
|
-
return await
|
|
11429
|
+
return await fs9.readdir(directory, { withFileTypes: true });
|
|
11624
11430
|
} catch {
|
|
11625
11431
|
return null;
|
|
11626
11432
|
}
|
|
@@ -11639,21 +11445,21 @@ var ConfigFileRepository = class {
|
|
|
11639
11445
|
async readHierarchicalConfig(startDirectory, stopDirectory) {
|
|
11640
11446
|
const configs = [];
|
|
11641
11447
|
const configPaths = [];
|
|
11642
|
-
const normalizedStart = normalizePath2(
|
|
11643
|
-
const normalizedStop = stopDirectory ? normalizePath2(
|
|
11448
|
+
const normalizedStart = normalizePath2(path11.resolve(startDirectory));
|
|
11449
|
+
const normalizedStop = stopDirectory ? normalizePath2(path11.resolve(stopDirectory)) : null;
|
|
11644
11450
|
let currentDir = normalizedStart;
|
|
11645
11451
|
while (true) {
|
|
11646
11452
|
const config = await this.readConfig(currentDir);
|
|
11647
11453
|
if (config) {
|
|
11648
11454
|
configs.push(config);
|
|
11649
11455
|
configPaths.push(
|
|
11650
|
-
normalizePath2(
|
|
11456
|
+
normalizePath2(path11.join(currentDir, this.CONFIG_FILENAME))
|
|
11651
11457
|
);
|
|
11652
11458
|
}
|
|
11653
11459
|
if (normalizedStop !== null && currentDir === normalizedStop) {
|
|
11654
11460
|
break;
|
|
11655
11461
|
}
|
|
11656
|
-
const parentDir = normalizePath2(
|
|
11462
|
+
const parentDir = normalizePath2(path11.dirname(currentDir));
|
|
11657
11463
|
if (parentDir === currentDir) {
|
|
11658
11464
|
break;
|
|
11659
11465
|
}
|
|
@@ -11678,8 +11484,8 @@ var ConfigFileRepository = class {
|
|
|
11678
11484
|
* and returns each config with its target path.
|
|
11679
11485
|
*/
|
|
11680
11486
|
async findAllConfigsInTree(startDirectory, stopDirectory) {
|
|
11681
|
-
const normalizedStart = normalizePath2(
|
|
11682
|
-
const normalizedStop = stopDirectory ? normalizePath2(
|
|
11487
|
+
const normalizedStart = normalizePath2(path11.resolve(startDirectory));
|
|
11488
|
+
const normalizedStop = stopDirectory ? normalizePath2(path11.resolve(stopDirectory)) : null;
|
|
11683
11489
|
const basePath = normalizedStop ?? normalizedStart;
|
|
11684
11490
|
const searchRoot = normalizedStop ?? normalizedStart;
|
|
11685
11491
|
const configsMap = /* @__PURE__ */ new Map();
|
|
@@ -11705,7 +11511,7 @@ var ConfigFileRepository = class {
|
|
|
11705
11511
|
if (stopDir !== null && currentDir === stopDir) {
|
|
11706
11512
|
break;
|
|
11707
11513
|
}
|
|
11708
|
-
const parentDir = normalizePath2(
|
|
11514
|
+
const parentDir = normalizePath2(path11.dirname(currentDir));
|
|
11709
11515
|
if (parentDir === currentDir) {
|
|
11710
11516
|
break;
|
|
11711
11517
|
}
|
|
@@ -11836,7 +11642,7 @@ var ConfigFileRepository = class {
|
|
|
11836
11642
|
}
|
|
11837
11643
|
async tryReadFile(filePath) {
|
|
11838
11644
|
try {
|
|
11839
|
-
return await
|
|
11645
|
+
return await fs9.readFile(filePath, "utf-8");
|
|
11840
11646
|
} catch (error) {
|
|
11841
11647
|
if (error.code === "ENOENT") {
|
|
11842
11648
|
return null;
|
|
@@ -11854,8 +11660,8 @@ var ConfigFileRepository = class {
|
|
|
11854
11660
|
};
|
|
11855
11661
|
|
|
11856
11662
|
// apps/cli/src/infra/repositories/LockFileRepository.ts
|
|
11857
|
-
var
|
|
11858
|
-
var
|
|
11663
|
+
var fs10 = __toESM(require("fs/promises"));
|
|
11664
|
+
var path12 = __toESM(require("path"));
|
|
11859
11665
|
var LockFileRepository = class {
|
|
11860
11666
|
constructor() {
|
|
11861
11667
|
this.LOCK_FILENAME = "packmind-lock.json";
|
|
@@ -11863,7 +11669,7 @@ var LockFileRepository = class {
|
|
|
11863
11669
|
async read(baseDirectory) {
|
|
11864
11670
|
const lockFilePath = this.getLockFilePath(baseDirectory);
|
|
11865
11671
|
try {
|
|
11866
|
-
const content = await
|
|
11672
|
+
const content = await fs10.readFile(lockFilePath, "utf-8");
|
|
11867
11673
|
const parsed = JSON.parse(content);
|
|
11868
11674
|
if (!this.isValidLockFile(parsed)) {
|
|
11869
11675
|
logWarningConsole(`Malformed lock file: ${lockFilePath}`);
|
|
@@ -11889,7 +11695,7 @@ var LockFileRepository = class {
|
|
|
11889
11695
|
return typeof obj.installedAt === "string" && 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);
|
|
11890
11696
|
}
|
|
11891
11697
|
getLockFilePath(baseDirectory) {
|
|
11892
|
-
return
|
|
11698
|
+
return path12.join(baseDirectory, this.LOCK_FILENAME);
|
|
11893
11699
|
}
|
|
11894
11700
|
};
|
|
11895
11701
|
|
|
@@ -11899,22 +11705,17 @@ var ListStandardsUseCase = class {
|
|
|
11899
11705
|
this.packmindGateway = packmindGateway;
|
|
11900
11706
|
this.spaceService = spaceService;
|
|
11901
11707
|
}
|
|
11902
|
-
async execute(
|
|
11903
|
-
if (
|
|
11708
|
+
async execute(command32) {
|
|
11709
|
+
if (command32.spaceId) {
|
|
11904
11710
|
const response = await this.packmindGateway.standards.list({
|
|
11905
|
-
spaceId:
|
|
11711
|
+
spaceId: command32.spaceId
|
|
11906
11712
|
});
|
|
11907
|
-
return response.standards
|
|
11908
|
-
...s,
|
|
11909
|
-
spaceId: command33.spaceId
|
|
11910
|
-
}));
|
|
11713
|
+
return response.standards;
|
|
11911
11714
|
}
|
|
11912
11715
|
const spaces = await this.spaceService.getSpaces();
|
|
11913
11716
|
const results = await Promise.all(
|
|
11914
11717
|
spaces.map(
|
|
11915
|
-
(space) => this.packmindGateway.standards.list({ spaceId: space.id }).then(
|
|
11916
|
-
(r) => r.standards.map((s) => ({ ...s, spaceId: space.id }))
|
|
11917
|
-
)
|
|
11718
|
+
(space) => this.packmindGateway.standards.list({ spaceId: space.id }).then((r) => r.standards)
|
|
11918
11719
|
)
|
|
11919
11720
|
);
|
|
11920
11721
|
return results.flat();
|
|
@@ -11927,10 +11728,10 @@ var ListCommandsUseCase = class {
|
|
|
11927
11728
|
this.packmindGateway = packmindGateway;
|
|
11928
11729
|
this.spaceService = spaceService;
|
|
11929
11730
|
}
|
|
11930
|
-
async execute(
|
|
11931
|
-
if (
|
|
11731
|
+
async execute(command32) {
|
|
11732
|
+
if (command32.spaceId) {
|
|
11932
11733
|
const response = await this.packmindGateway.commands.list({
|
|
11933
|
-
spaceId:
|
|
11734
|
+
spaceId: command32.spaceId
|
|
11934
11735
|
});
|
|
11935
11736
|
return response.recipes;
|
|
11936
11737
|
}
|
|
@@ -11950,16 +11751,16 @@ var ListSkillsUseCase = class {
|
|
|
11950
11751
|
this.packmindGateway = packmindGateway;
|
|
11951
11752
|
this.spaceService = spaceService;
|
|
11952
11753
|
}
|
|
11953
|
-
async execute(
|
|
11954
|
-
if (
|
|
11754
|
+
async execute(command32) {
|
|
11755
|
+
if (command32.spaceId) {
|
|
11955
11756
|
const skills = await this.packmindGateway.skills.list({
|
|
11956
|
-
spaceId:
|
|
11757
|
+
spaceId: command32.spaceId
|
|
11957
11758
|
});
|
|
11958
11759
|
return skills.map((s) => ({
|
|
11959
11760
|
slug: s.slug,
|
|
11960
11761
|
name: s.name,
|
|
11961
11762
|
description: s.description,
|
|
11962
|
-
spaceId:
|
|
11763
|
+
spaceId: s.spaceId
|
|
11963
11764
|
}));
|
|
11964
11765
|
}
|
|
11965
11766
|
const spaces = await this.spaceService.getSpaces();
|
|
@@ -11990,7 +11791,7 @@ function normalizeLineEndings(content) {
|
|
|
11990
11791
|
}
|
|
11991
11792
|
|
|
11992
11793
|
// apps/cli/src/infra/utils/binaryDetection.ts
|
|
11993
|
-
var
|
|
11794
|
+
var path13 = __toESM(require("path"));
|
|
11994
11795
|
var BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
11995
11796
|
// Images
|
|
11996
11797
|
".png",
|
|
@@ -12048,7 +11849,7 @@ var BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
12048
11849
|
".sqlite3"
|
|
12049
11850
|
]);
|
|
12050
11851
|
function isBinaryExtension(filePath) {
|
|
12051
|
-
const ext =
|
|
11852
|
+
const ext = path13.extname(filePath).toLowerCase();
|
|
12052
11853
|
return BINARY_EXTENSIONS.has(ext);
|
|
12053
11854
|
}
|
|
12054
11855
|
function isBinaryBuffer(buffer) {
|
|
@@ -12068,7 +11869,11 @@ function normalizePath3(filePath) {
|
|
|
12068
11869
|
}
|
|
12069
11870
|
var MAX_FILE_SIZE_BYTES = 10 * 1024 * 1024;
|
|
12070
11871
|
var MAX_FILE_SIZE_MB = 10;
|
|
12071
|
-
var BLACKLIST_PATTERNS = [
|
|
11872
|
+
var BLACKLIST_PATTERNS = [
|
|
11873
|
+
"**/.DS_Store",
|
|
11874
|
+
"**/node_modules",
|
|
11875
|
+
"**/node_modules/**"
|
|
11876
|
+
];
|
|
12072
11877
|
function isBlacklisted(relativePath) {
|
|
12073
11878
|
const normalizedPath = relativePath.replace(/\\/g, "/");
|
|
12074
11879
|
return BLACKLIST_PATTERNS.some(
|
|
@@ -12124,8 +11929,8 @@ var UploadSkillUseCase = class {
|
|
|
12124
11929
|
constructor(deps) {
|
|
12125
11930
|
this.deps = deps;
|
|
12126
11931
|
}
|
|
12127
|
-
async execute(
|
|
12128
|
-
const files = await readSkillDirectory(
|
|
11932
|
+
async execute(command32) {
|
|
11933
|
+
const files = await readSkillDirectory(command32.skillPath);
|
|
12129
11934
|
if (!files.find((f) => f.relativePath === "SKILL.md")) {
|
|
12130
11935
|
throw new Error("SKILL.md not found in skill directory");
|
|
12131
11936
|
}
|
|
@@ -12139,7 +11944,7 @@ var UploadSkillUseCase = class {
|
|
|
12139
11944
|
if (totalSize > 10 * 1024 * 1024) {
|
|
12140
11945
|
throw new Error(`Skill size (${totalSize} bytes) exceeds 10MB limit`);
|
|
12141
11946
|
}
|
|
12142
|
-
const space = await this.getSpace(
|
|
11947
|
+
const space = await this.getSpace(command32.spaceSlug);
|
|
12143
11948
|
const payload = {
|
|
12144
11949
|
files: files.map((f) => ({
|
|
12145
11950
|
path: f.relativePath,
|
|
@@ -12151,7 +11956,7 @@ var UploadSkillUseCase = class {
|
|
|
12151
11956
|
const uploadSkillResponse = await this.deps.gateway.skills.upload({
|
|
12152
11957
|
spaceId: createSpaceId(space.id),
|
|
12153
11958
|
files: payload.files,
|
|
12154
|
-
originSkill:
|
|
11959
|
+
originSkill: command32.originSkill
|
|
12155
11960
|
});
|
|
12156
11961
|
return {
|
|
12157
11962
|
skillId: uploadSkillResponse.skill.id,
|
|
@@ -12190,17 +11995,17 @@ ${spaceList}`
|
|
|
12190
11995
|
|
|
12191
11996
|
// apps/cli/src/application/useCases/diffStrategies/CommandDiffStrategy.ts
|
|
12192
11997
|
var import_diff2 = require("diff");
|
|
12193
|
-
var
|
|
12194
|
-
var
|
|
11998
|
+
var fs12 = __toESM(require("fs/promises"));
|
|
11999
|
+
var path15 = __toESM(require("path"));
|
|
12195
12000
|
var CommandDiffStrategy = class {
|
|
12196
12001
|
supports(file) {
|
|
12197
12002
|
return file.artifactType === "command";
|
|
12198
12003
|
}
|
|
12199
12004
|
async diff(file, baseDirectory) {
|
|
12200
|
-
const fullPath =
|
|
12005
|
+
const fullPath = path15.join(baseDirectory, file.path);
|
|
12201
12006
|
let localContent;
|
|
12202
12007
|
try {
|
|
12203
|
-
localContent = await
|
|
12008
|
+
localContent = await fs12.readFile(fullPath, "utf-8");
|
|
12204
12009
|
} catch {
|
|
12205
12010
|
return [];
|
|
12206
12011
|
}
|
|
@@ -12230,8 +12035,8 @@ var CommandDiffStrategy = class {
|
|
|
12230
12035
|
|
|
12231
12036
|
// apps/cli/src/application/useCases/diffStrategies/SkillDiffStrategy.ts
|
|
12232
12037
|
var import_diff3 = require("diff");
|
|
12233
|
-
var
|
|
12234
|
-
var
|
|
12038
|
+
var fs13 = __toESM(require("fs/promises"));
|
|
12039
|
+
var path16 = __toESM(require("path"));
|
|
12235
12040
|
|
|
12236
12041
|
// apps/cli/src/application/utils/stripFrontmatter.ts
|
|
12237
12042
|
var FRONTMATTER_DELIMITER2 = "---";
|
|
@@ -12266,7 +12071,7 @@ var SkillDiffStrategy = class {
|
|
|
12266
12071
|
async diffNewFiles(skillFolders, serverFiles, baseDirectory) {
|
|
12267
12072
|
const diffs = [];
|
|
12268
12073
|
for (const folder of skillFolders) {
|
|
12269
|
-
const folderPath =
|
|
12074
|
+
const folderPath = path16.join(baseDirectory, folder);
|
|
12270
12075
|
const localFiles = await this.listFilesRecursively(folderPath);
|
|
12271
12076
|
const serverPathsInFolder = new Set(
|
|
12272
12077
|
serverFiles.filter((f) => f.path.startsWith(folder + "/")).map((f) => f.path)
|
|
@@ -12285,7 +12090,7 @@ var SkillDiffStrategy = class {
|
|
|
12285
12090
|
if (serverPathsInFolder.has(filePath)) {
|
|
12286
12091
|
continue;
|
|
12287
12092
|
}
|
|
12288
|
-
const fullPath =
|
|
12093
|
+
const fullPath = path16.join(baseDirectory, filePath);
|
|
12289
12094
|
const localRead = await this.tryReadFileBinaryAware(fullPath);
|
|
12290
12095
|
if (localRead === null) {
|
|
12291
12096
|
continue;
|
|
@@ -12312,7 +12117,7 @@ var SkillDiffStrategy = class {
|
|
|
12312
12117
|
return diffs;
|
|
12313
12118
|
}
|
|
12314
12119
|
async diffSkillMd(file, baseDirectory) {
|
|
12315
|
-
const fullPath =
|
|
12120
|
+
const fullPath = path16.join(baseDirectory, file.path);
|
|
12316
12121
|
const localContent = await this.tryReadFile(fullPath);
|
|
12317
12122
|
if (localContent === null) {
|
|
12318
12123
|
return [];
|
|
@@ -12369,7 +12174,7 @@ var SkillDiffStrategy = class {
|
|
|
12369
12174
|
return [];
|
|
12370
12175
|
}
|
|
12371
12176
|
const skillFileId = createSkillFileId(file.skillFileId);
|
|
12372
|
-
const fullPath =
|
|
12177
|
+
const fullPath = path16.join(baseDirectory, file.path);
|
|
12373
12178
|
const localRead = await this.tryReadFileBinaryAware(fullPath);
|
|
12374
12179
|
const fileRelativePath = this.computeRelativePath(file.path, skillFolders);
|
|
12375
12180
|
if (localRead === null) {
|
|
@@ -12579,14 +12384,14 @@ var SkillDiffStrategy = class {
|
|
|
12579
12384
|
}
|
|
12580
12385
|
async tryReadFile(filePath) {
|
|
12581
12386
|
try {
|
|
12582
|
-
return await
|
|
12387
|
+
return await fs13.readFile(filePath, "utf-8");
|
|
12583
12388
|
} catch {
|
|
12584
12389
|
return null;
|
|
12585
12390
|
}
|
|
12586
12391
|
}
|
|
12587
12392
|
async tryReadFileBinaryAware(filePath) {
|
|
12588
12393
|
try {
|
|
12589
|
-
const buffer = await
|
|
12394
|
+
const buffer = await fs13.readFile(filePath);
|
|
12590
12395
|
if (isBinaryFile(filePath, buffer)) {
|
|
12591
12396
|
return { content: buffer.toString("base64"), isBase64: true };
|
|
12592
12397
|
}
|
|
@@ -12598,13 +12403,13 @@ var SkillDiffStrategy = class {
|
|
|
12598
12403
|
async listFilesRecursively(dirPath, prefix = "") {
|
|
12599
12404
|
let entries;
|
|
12600
12405
|
try {
|
|
12601
|
-
entries = await
|
|
12406
|
+
entries = await fs13.readdir(dirPath);
|
|
12602
12407
|
} catch {
|
|
12603
12408
|
return [];
|
|
12604
12409
|
}
|
|
12605
12410
|
const files = [];
|
|
12606
12411
|
for (const entry of entries) {
|
|
12607
|
-
const fullPath =
|
|
12412
|
+
const fullPath = path16.join(dirPath, entry);
|
|
12608
12413
|
const stat9 = await this.tryStatFile(fullPath);
|
|
12609
12414
|
if (!stat9) {
|
|
12610
12415
|
continue;
|
|
@@ -12624,7 +12429,7 @@ var SkillDiffStrategy = class {
|
|
|
12624
12429
|
}
|
|
12625
12430
|
async tryStatFile(filePath) {
|
|
12626
12431
|
try {
|
|
12627
|
-
const stat9 = await
|
|
12432
|
+
const stat9 = await fs13.stat(filePath);
|
|
12628
12433
|
return { isDirectory: stat9.isDirectory() };
|
|
12629
12434
|
} catch {
|
|
12630
12435
|
return null;
|
|
@@ -12632,7 +12437,7 @@ var SkillDiffStrategy = class {
|
|
|
12632
12437
|
}
|
|
12633
12438
|
async tryGetPermissions(filePath) {
|
|
12634
12439
|
try {
|
|
12635
|
-
const stat9 = await
|
|
12440
|
+
const stat9 = await fs13.stat(filePath);
|
|
12636
12441
|
return modeToPermissionStringOrDefault(stat9.mode);
|
|
12637
12442
|
} catch {
|
|
12638
12443
|
return null;
|
|
@@ -12648,8 +12453,8 @@ var SkillDiffStrategy = class {
|
|
|
12648
12453
|
};
|
|
12649
12454
|
|
|
12650
12455
|
// apps/cli/src/application/useCases/diffStrategies/StandardDiffStrategy.ts
|
|
12651
|
-
var
|
|
12652
|
-
var
|
|
12456
|
+
var fs14 = __toESM(require("fs/promises"));
|
|
12457
|
+
var path17 = __toESM(require("path"));
|
|
12653
12458
|
|
|
12654
12459
|
// apps/cli/src/application/utils/parseStandardMd.ts
|
|
12655
12460
|
var DEPLOYER_PARSERS = [
|
|
@@ -12957,10 +12762,10 @@ var StandardDiffStrategy = class {
|
|
|
12957
12762
|
return file.artifactType === "standard";
|
|
12958
12763
|
}
|
|
12959
12764
|
async diff(file, baseDirectory) {
|
|
12960
|
-
const fullPath =
|
|
12765
|
+
const fullPath = path17.join(baseDirectory, file.path);
|
|
12961
12766
|
let localContent;
|
|
12962
12767
|
try {
|
|
12963
|
-
localContent = await
|
|
12768
|
+
localContent = await fs14.readFile(fullPath, "utf-8");
|
|
12964
12769
|
} catch {
|
|
12965
12770
|
return [];
|
|
12966
12771
|
}
|
|
@@ -13084,9 +12889,9 @@ var DiffArtefactsUseCase = class {
|
|
|
13084
12889
|
new StandardDiffStrategy()
|
|
13085
12890
|
];
|
|
13086
12891
|
}
|
|
13087
|
-
async execute(
|
|
13088
|
-
const baseDirectory =
|
|
13089
|
-
const response = await this.fetchContent(
|
|
12892
|
+
async execute(command32) {
|
|
12893
|
+
const baseDirectory = command32.baseDirectory || process.cwd();
|
|
12894
|
+
const response = await this.fetchContent(command32, baseDirectory);
|
|
13090
12895
|
const filteredFiles = response.fileUpdates.createOrUpdate.filter(
|
|
13091
12896
|
(file) => file.path !== "packmind.json"
|
|
13092
12897
|
);
|
|
@@ -13099,7 +12904,7 @@ var DiffArtefactsUseCase = class {
|
|
|
13099
12904
|
);
|
|
13100
12905
|
const prefixedSkillFolders = this.prefixSkillFolders(
|
|
13101
12906
|
response.skillFolders,
|
|
13102
|
-
|
|
12907
|
+
command32.relativePath
|
|
13103
12908
|
);
|
|
13104
12909
|
const diffs = [];
|
|
13105
12910
|
for (const file of diffableFiles) {
|
|
@@ -13126,7 +12931,7 @@ var DiffArtefactsUseCase = class {
|
|
|
13126
12931
|
targetId: response.targetId ? createTargetId(response.targetId) : void 0
|
|
13127
12932
|
}));
|
|
13128
12933
|
}
|
|
13129
|
-
async fetchContent(
|
|
12934
|
+
async fetchContent(command32, baseDirectory) {
|
|
13130
12935
|
const lockFile = await this.lockFileRepository.read(baseDirectory);
|
|
13131
12936
|
if (lockFile) {
|
|
13132
12937
|
try {
|
|
@@ -13146,11 +12951,11 @@ var DiffArtefactsUseCase = class {
|
|
|
13146
12951
|
}
|
|
13147
12952
|
}
|
|
13148
12953
|
return this.packmindGateway.deployment.getDeployed({
|
|
13149
|
-
packagesSlugs:
|
|
13150
|
-
gitRemoteUrl:
|
|
13151
|
-
gitBranch:
|
|
13152
|
-
relativePath:
|
|
13153
|
-
agents:
|
|
12954
|
+
packagesSlugs: command32.packagesSlugs,
|
|
12955
|
+
gitRemoteUrl: command32.gitRemoteUrl,
|
|
12956
|
+
gitBranch: command32.gitBranch,
|
|
12957
|
+
relativePath: command32.relativePath,
|
|
12958
|
+
agents: command32.agents
|
|
13154
12959
|
});
|
|
13155
12960
|
}
|
|
13156
12961
|
prefixSkillFolders(skillFolders, relativePath) {
|
|
@@ -13174,8 +12979,8 @@ var SubmitDiffsUseCase = class {
|
|
|
13174
12979
|
constructor(packmindGateway) {
|
|
13175
12980
|
this.packmindGateway = packmindGateway;
|
|
13176
12981
|
}
|
|
13177
|
-
async execute(
|
|
13178
|
-
const { groupedDiffs, message } =
|
|
12982
|
+
async execute(command32) {
|
|
12983
|
+
const { groupedDiffs, message } = command32;
|
|
13179
12984
|
const skipped = [];
|
|
13180
12985
|
const validDiffs = [];
|
|
13181
12986
|
for (const group of groupedDiffs) {
|
|
@@ -13250,8 +13055,8 @@ var CheckDiffsUseCase = class {
|
|
|
13250
13055
|
constructor(packmindGateway) {
|
|
13251
13056
|
this.packmindGateway = packmindGateway;
|
|
13252
13057
|
}
|
|
13253
|
-
async execute(
|
|
13254
|
-
const { groupedDiffs } =
|
|
13058
|
+
async execute(command32) {
|
|
13059
|
+
const { groupedDiffs } = command32;
|
|
13255
13060
|
const results = [];
|
|
13256
13061
|
const validDiffs = [];
|
|
13257
13062
|
const invalidDiffs = [];
|
|
@@ -13332,13 +13137,151 @@ var SpaceService = class {
|
|
|
13332
13137
|
}
|
|
13333
13138
|
};
|
|
13334
13139
|
|
|
13140
|
+
// apps/cli/src/infra/repositories/CliOutput.ts
|
|
13141
|
+
init_source();
|
|
13142
|
+
var import_log_update = __toESM(require("log-update"));
|
|
13143
|
+
var CLI_PREFIX2 = "packmind-cli";
|
|
13144
|
+
var CliFormatter = class {
|
|
13145
|
+
static success(message) {
|
|
13146
|
+
return `${source_default.bgGreen.bold(CLI_PREFIX2)} ${source_default.green.bold(message)}`;
|
|
13147
|
+
}
|
|
13148
|
+
static info(message) {
|
|
13149
|
+
return `${source_default.bgBlue.bold(CLI_PREFIX2)} ${source_default.blue(message)}`;
|
|
13150
|
+
}
|
|
13151
|
+
static warning(message) {
|
|
13152
|
+
return `${source_default.bgYellow.bold(CLI_PREFIX2)} ${source_default.yellow.bold(message)}`;
|
|
13153
|
+
}
|
|
13154
|
+
static error(message) {
|
|
13155
|
+
return `${source_default.bgRed.bold(CLI_PREFIX2)} ${source_default.red(message)}`;
|
|
13156
|
+
}
|
|
13157
|
+
static command(command32) {
|
|
13158
|
+
return source_default.yellow(command32);
|
|
13159
|
+
}
|
|
13160
|
+
static loader(text) {
|
|
13161
|
+
return source_default.dim.italic(text);
|
|
13162
|
+
}
|
|
13163
|
+
static header(title) {
|
|
13164
|
+
return source_default.bold.underline(title);
|
|
13165
|
+
}
|
|
13166
|
+
static subHeader(title) {
|
|
13167
|
+
return source_default.bold(title);
|
|
13168
|
+
}
|
|
13169
|
+
static slug(slug3) {
|
|
13170
|
+
return source_default.blue.bold(slug3);
|
|
13171
|
+
}
|
|
13172
|
+
static label(label) {
|
|
13173
|
+
return source_default.dim(label);
|
|
13174
|
+
}
|
|
13175
|
+
};
|
|
13176
|
+
var CliOutput = class {
|
|
13177
|
+
constructor(logger2 = console) {
|
|
13178
|
+
this.logger = logger2;
|
|
13179
|
+
}
|
|
13180
|
+
notifySuccess(message, help) {
|
|
13181
|
+
this.notifyMessage(
|
|
13182
|
+
CliFormatter.success(message),
|
|
13183
|
+
(msg) => this.logger.log(msg),
|
|
13184
|
+
help
|
|
13185
|
+
);
|
|
13186
|
+
}
|
|
13187
|
+
notifyInfo(message, help) {
|
|
13188
|
+
this.notifyMessage(
|
|
13189
|
+
CliFormatter.info(message),
|
|
13190
|
+
(msg) => this.logger.log(msg),
|
|
13191
|
+
help
|
|
13192
|
+
);
|
|
13193
|
+
}
|
|
13194
|
+
notifyWarning(message, help) {
|
|
13195
|
+
this.notifyMessage(
|
|
13196
|
+
CliFormatter.warning(message),
|
|
13197
|
+
(msg) => this.logger.warn(msg),
|
|
13198
|
+
help
|
|
13199
|
+
);
|
|
13200
|
+
}
|
|
13201
|
+
notifyError(message, help) {
|
|
13202
|
+
this.notifyMessage(
|
|
13203
|
+
CliFormatter.error(message),
|
|
13204
|
+
(msg) => this.logger.error(msg),
|
|
13205
|
+
help
|
|
13206
|
+
);
|
|
13207
|
+
}
|
|
13208
|
+
showLoader(message) {
|
|
13209
|
+
this.logger.log(CliFormatter.loader(message));
|
|
13210
|
+
}
|
|
13211
|
+
async withLoader(message, loader) {
|
|
13212
|
+
(0, import_log_update.default)(CliFormatter.loader(message));
|
|
13213
|
+
try {
|
|
13214
|
+
return loader();
|
|
13215
|
+
} finally {
|
|
13216
|
+
import_log_update.default.clear();
|
|
13217
|
+
}
|
|
13218
|
+
}
|
|
13219
|
+
showArtefact(artefact, help) {
|
|
13220
|
+
this.logger.log(CliFormatter.label(artefact.slug));
|
|
13221
|
+
this.logger.log(CliFormatter.header(artefact.title));
|
|
13222
|
+
if (artefact.url) {
|
|
13223
|
+
this.logger.log(CliFormatter.label(artefact.url));
|
|
13224
|
+
}
|
|
13225
|
+
this.logger.log("");
|
|
13226
|
+
if (artefact.description) {
|
|
13227
|
+
this.logger.log(artefact.description);
|
|
13228
|
+
}
|
|
13229
|
+
this.logger.log("");
|
|
13230
|
+
this.displayHelp((msg) => this.logger.log(msg), help);
|
|
13231
|
+
}
|
|
13232
|
+
listArtefacts(title, artefacts, help) {
|
|
13233
|
+
this.logger.log(CliFormatter.header(title));
|
|
13234
|
+
this.logger.log("");
|
|
13235
|
+
this.displayList(artefacts);
|
|
13236
|
+
this.displayHelp((msg) => this.logger.log(msg), help);
|
|
13237
|
+
}
|
|
13238
|
+
listScopedArtefacts(title, scopedArtefacts, help) {
|
|
13239
|
+
this.logger.log(CliFormatter.header(title));
|
|
13240
|
+
this.logger.log("");
|
|
13241
|
+
for (const { title: title2, artefacts } of scopedArtefacts) {
|
|
13242
|
+
this.logger.log(CliFormatter.subHeader(title2));
|
|
13243
|
+
this.logger.log("");
|
|
13244
|
+
this.displayList(artefacts);
|
|
13245
|
+
}
|
|
13246
|
+
this.displayHelp((msg) => this.logger.log(msg), help);
|
|
13247
|
+
}
|
|
13248
|
+
notifyMessage(message, output, help) {
|
|
13249
|
+
output(message);
|
|
13250
|
+
this.displayHelp(output, help);
|
|
13251
|
+
}
|
|
13252
|
+
displayList(artefacts) {
|
|
13253
|
+
for (const artefact of artefacts) {
|
|
13254
|
+
this.logger.log(`- ${CliFormatter.label(artefact.slug)}`);
|
|
13255
|
+
this.logger.log(` Name: ${CliFormatter.header(artefact.title)}`);
|
|
13256
|
+
if (artefact.url) {
|
|
13257
|
+
this.logger.log(` ${CliFormatter.label(artefact.url)}`);
|
|
13258
|
+
}
|
|
13259
|
+
this.logger.log("");
|
|
13260
|
+
}
|
|
13261
|
+
}
|
|
13262
|
+
displayHelp(output, help) {
|
|
13263
|
+
if (help) {
|
|
13264
|
+
output(help.content);
|
|
13265
|
+
if (help.exampleCommand) {
|
|
13266
|
+
output(`
|
|
13267
|
+
Example: ${CliFormatter.command(help.exampleCommand)}`);
|
|
13268
|
+
}
|
|
13269
|
+
if (help.command) {
|
|
13270
|
+
output(`
|
|
13271
|
+
${CliFormatter.command(help.command)}`);
|
|
13272
|
+
}
|
|
13273
|
+
}
|
|
13274
|
+
}
|
|
13275
|
+
};
|
|
13276
|
+
|
|
13335
13277
|
// apps/cli/src/PackmindCliHexaFactory.ts
|
|
13336
13278
|
var PackmindCliHexaFactory = class {
|
|
13337
13279
|
constructor() {
|
|
13338
13280
|
this.repositories = {
|
|
13339
13281
|
packmindGateway: new PackmindGateway(loadApiKey()),
|
|
13340
13282
|
configFileRepository: new ConfigFileRepository(),
|
|
13341
|
-
lockFileRepository: new LockFileRepository()
|
|
13283
|
+
lockFileRepository: new LockFileRepository(),
|
|
13284
|
+
output: new CliOutput()
|
|
13342
13285
|
};
|
|
13343
13286
|
this.services = {
|
|
13344
13287
|
listFiles: new ListFiles(),
|
|
@@ -13388,10 +13331,6 @@ var PackmindCliHexaFactory = class {
|
|
|
13388
13331
|
logout: new LogoutUseCase(),
|
|
13389
13332
|
whoami: new WhoamiUseCase(),
|
|
13390
13333
|
checkCliVersion: new CheckCliVersionUseCase(),
|
|
13391
|
-
setupMcp: new SetupMcpUseCase({
|
|
13392
|
-
gateway: this.repositories.packmindGateway,
|
|
13393
|
-
mcpConfigService: new McpConfigService()
|
|
13394
|
-
}),
|
|
13395
13334
|
listStandards: new ListStandardsUseCase(
|
|
13396
13335
|
this.repositories.packmindGateway,
|
|
13397
13336
|
this.services.spaceService
|
|
@@ -13422,14 +13361,14 @@ var PackmindCliHexaFactory = class {
|
|
|
13422
13361
|
var origin8 = "PackmindCliHexa";
|
|
13423
13362
|
var PackmindCliHexa = class {
|
|
13424
13363
|
constructor(logger2 = new PackmindLogger(origin8)) {
|
|
13425
|
-
this.notifyDistribution = async (
|
|
13364
|
+
this.notifyDistribution = async (command32) => {
|
|
13426
13365
|
return this.hexa.repositories.packmindGateway.deployment.notifyDistribution(
|
|
13427
|
-
|
|
13366
|
+
command32
|
|
13428
13367
|
);
|
|
13429
13368
|
};
|
|
13430
|
-
this.notifyArtefactsDistribution = async (
|
|
13369
|
+
this.notifyArtefactsDistribution = async (command32) => {
|
|
13431
13370
|
return this.hexa.repositories.packmindGateway.deployment.notifyArtefactsDistribution(
|
|
13432
|
-
|
|
13371
|
+
command32
|
|
13433
13372
|
);
|
|
13434
13373
|
};
|
|
13435
13374
|
this.logger = logger2;
|
|
@@ -13449,29 +13388,32 @@ var PackmindCliHexa = class {
|
|
|
13449
13388
|
this.logger.info("Destroying PackmindCliHexa");
|
|
13450
13389
|
this.logger.info("PackmindCliHexa destroyed");
|
|
13451
13390
|
}
|
|
13452
|
-
|
|
13453
|
-
return this.hexa.
|
|
13391
|
+
get output() {
|
|
13392
|
+
return this.hexa.repositories.output;
|
|
13393
|
+
}
|
|
13394
|
+
async getGitRemoteUrl(command32) {
|
|
13395
|
+
return this.hexa.useCases.getGitRemoteUrl.execute(command32);
|
|
13454
13396
|
}
|
|
13455
|
-
async listFilesInDirectory(
|
|
13456
|
-
return this.hexa.useCases.listFilesInDirectoryUseCase.execute(
|
|
13397
|
+
async listFilesInDirectory(command32) {
|
|
13398
|
+
return this.hexa.useCases.listFilesInDirectoryUseCase.execute(command32);
|
|
13457
13399
|
}
|
|
13458
|
-
async lintFilesAgainstRule(
|
|
13459
|
-
return this.hexa.useCases.lintFilesAgainstRule.execute(
|
|
13400
|
+
async lintFilesAgainstRule(command32) {
|
|
13401
|
+
return this.hexa.useCases.lintFilesAgainstRule.execute(command32);
|
|
13460
13402
|
}
|
|
13461
|
-
async lintFilesFromConfig(
|
|
13462
|
-
return this.hexa.useCases.lintFilesFromConfig.execute(
|
|
13403
|
+
async lintFilesFromConfig(command32) {
|
|
13404
|
+
return this.hexa.useCases.lintFilesFromConfig.execute(command32);
|
|
13463
13405
|
}
|
|
13464
|
-
async installPackages(
|
|
13465
|
-
return this.hexa.useCases.installPackages.execute(
|
|
13406
|
+
async installPackages(command32) {
|
|
13407
|
+
return this.hexa.useCases.installPackages.execute(command32);
|
|
13466
13408
|
}
|
|
13467
|
-
async install(
|
|
13468
|
-
return this.hexa.useCases.install.execute(
|
|
13409
|
+
async install(command32) {
|
|
13410
|
+
return this.hexa.useCases.install.execute(command32);
|
|
13469
13411
|
}
|
|
13470
|
-
async uninstall(
|
|
13471
|
-
return this.hexa.useCases.uninstall.execute(
|
|
13412
|
+
async uninstall(command32) {
|
|
13413
|
+
return this.hexa.useCases.uninstall.execute(command32);
|
|
13472
13414
|
}
|
|
13473
|
-
async diffArtefacts(
|
|
13474
|
-
return this.hexa.useCases.diffArtefacts.execute(
|
|
13415
|
+
async diffArtefacts(command32) {
|
|
13416
|
+
return this.hexa.useCases.diffArtefacts.execute(command32);
|
|
13475
13417
|
}
|
|
13476
13418
|
async submitDiffs(groupedDiffs, message) {
|
|
13477
13419
|
return this.hexa.useCases.submitDiffs.execute({ groupedDiffs, message });
|
|
@@ -13479,20 +13421,20 @@ var PackmindCliHexa = class {
|
|
|
13479
13421
|
async checkDiffs(groupedDiffs) {
|
|
13480
13422
|
return this.hexa.useCases.checkDiffs.execute({ groupedDiffs });
|
|
13481
13423
|
}
|
|
13482
|
-
async listPackages(
|
|
13483
|
-
return this.hexa.useCases.listPackages.execute(
|
|
13424
|
+
async listPackages(command32) {
|
|
13425
|
+
return this.hexa.useCases.listPackages.execute(command32);
|
|
13484
13426
|
}
|
|
13485
|
-
async getPackageBySlug(
|
|
13486
|
-
return this.hexa.useCases.getPackageBySlug.execute(
|
|
13427
|
+
async getPackageBySlug(command32) {
|
|
13428
|
+
return this.hexa.useCases.getPackageBySlug.execute(command32);
|
|
13487
13429
|
}
|
|
13488
|
-
async listStandards(
|
|
13489
|
-
return this.hexa.useCases.listStandards.execute(
|
|
13430
|
+
async listStandards(command32) {
|
|
13431
|
+
return this.hexa.useCases.listStandards.execute(command32);
|
|
13490
13432
|
}
|
|
13491
|
-
async listCommands(
|
|
13492
|
-
return this.hexa.useCases.listCommands.execute(
|
|
13433
|
+
async listCommands(command32) {
|
|
13434
|
+
return this.hexa.useCases.listCommands.execute(command32);
|
|
13493
13435
|
}
|
|
13494
|
-
async listSkills(
|
|
13495
|
-
return this.hexa.useCases.listSkills.execute(
|
|
13436
|
+
async listSkills(command32) {
|
|
13437
|
+
return this.hexa.useCases.listSkills.execute(command32);
|
|
13496
13438
|
}
|
|
13497
13439
|
async configExists(baseDirectory) {
|
|
13498
13440
|
return await this.hexa.repositories.configFileRepository.configExists(
|
|
@@ -13579,20 +13521,17 @@ var PackmindCliHexa = class {
|
|
|
13579
13521
|
directory
|
|
13580
13522
|
);
|
|
13581
13523
|
}
|
|
13582
|
-
async login(
|
|
13583
|
-
return this.hexa.useCases.login.execute(
|
|
13524
|
+
async login(command32) {
|
|
13525
|
+
return this.hexa.useCases.login.execute(command32);
|
|
13584
13526
|
}
|
|
13585
|
-
async logout(
|
|
13586
|
-
return this.hexa.useCases.logout.execute(
|
|
13527
|
+
async logout(command32) {
|
|
13528
|
+
return this.hexa.useCases.logout.execute(command32);
|
|
13587
13529
|
}
|
|
13588
|
-
async whoami(
|
|
13589
|
-
return this.hexa.useCases.whoami.execute(
|
|
13530
|
+
async whoami(command32) {
|
|
13531
|
+
return this.hexa.useCases.whoami.execute(command32);
|
|
13590
13532
|
}
|
|
13591
|
-
async checkCliVersion(
|
|
13592
|
-
return this.hexa.useCases.checkCliVersion.execute(
|
|
13593
|
-
}
|
|
13594
|
-
async setupMcp(command33) {
|
|
13595
|
-
return this.hexa.useCases.setupMcp.execute(command33);
|
|
13533
|
+
async checkCliVersion(command32) {
|
|
13534
|
+
return this.hexa.useCases.checkCliVersion.execute(command32);
|
|
13596
13535
|
}
|
|
13597
13536
|
getCurrentBranch(repoPath) {
|
|
13598
13537
|
return this.hexa.services.gitRemoteUrlService.getCurrentBranch(repoPath).branch;
|
|
@@ -13600,11 +13539,11 @@ var PackmindCliHexa = class {
|
|
|
13600
13539
|
getGitRemoteUrlFromPath(repoPath) {
|
|
13601
13540
|
return this.hexa.services.gitRemoteUrlService.getGitRemoteUrl(repoPath).gitRemoteUrl;
|
|
13602
13541
|
}
|
|
13603
|
-
async uploadSkill(
|
|
13604
|
-
return this.hexa.useCases.uploadSkill.execute(
|
|
13542
|
+
async uploadSkill(command32) {
|
|
13543
|
+
return this.hexa.useCases.uploadSkill.execute(command32);
|
|
13605
13544
|
}
|
|
13606
|
-
async installDefaultSkills(
|
|
13607
|
-
return this.hexa.useCases.installDefaultSkills.execute(
|
|
13545
|
+
async installDefaultSkills(command32) {
|
|
13546
|
+
return this.hexa.useCases.installDefaultSkills.execute(command32);
|
|
13608
13547
|
}
|
|
13609
13548
|
getPackmindGateway() {
|
|
13610
13549
|
return this.hexa.repositories.packmindGateway;
|
|
@@ -13728,31 +13667,31 @@ var HumanReadableLogger = class {
|
|
|
13728
13667
|
var pathModule2 = __toESM(require("path"));
|
|
13729
13668
|
|
|
13730
13669
|
// apps/cli/src/infra/commands/lintHandler.ts
|
|
13731
|
-
var
|
|
13670
|
+
var fs16 = __toESM(require("fs/promises"));
|
|
13732
13671
|
var pathModule = __toESM(require("path"));
|
|
13733
13672
|
|
|
13734
13673
|
// apps/cli/src/application/services/PackmindIgnoreReader.ts
|
|
13735
|
-
var
|
|
13736
|
-
var
|
|
13674
|
+
var fs15 = __toESM(require("fs/promises"));
|
|
13675
|
+
var path18 = __toESM(require("path"));
|
|
13737
13676
|
var IGNORE_FILENAME = ".packmindignore";
|
|
13738
13677
|
var PackmindIgnoreReader = class {
|
|
13739
13678
|
async readIgnorePatterns(startDirectory, stopDirectory) {
|
|
13740
13679
|
const patterns = [];
|
|
13741
|
-
const normalizedStart =
|
|
13742
|
-
const normalizedStop = stopDirectory ?
|
|
13680
|
+
const normalizedStart = path18.resolve(startDirectory);
|
|
13681
|
+
const normalizedStop = stopDirectory ? path18.resolve(stopDirectory) : null;
|
|
13743
13682
|
if (normalizedStop === null) {
|
|
13744
|
-
const ignoreFile =
|
|
13683
|
+
const ignoreFile = path18.join(normalizedStart, IGNORE_FILENAME);
|
|
13745
13684
|
return this.parseIgnoreFile(ignoreFile);
|
|
13746
13685
|
}
|
|
13747
13686
|
let currentDir = normalizedStart;
|
|
13748
13687
|
while (true) {
|
|
13749
|
-
const ignoreFile =
|
|
13688
|
+
const ignoreFile = path18.join(currentDir, IGNORE_FILENAME);
|
|
13750
13689
|
const filePatterns = await this.parseIgnoreFile(ignoreFile);
|
|
13751
13690
|
patterns.push(...filePatterns);
|
|
13752
13691
|
if (currentDir === normalizedStop) {
|
|
13753
13692
|
break;
|
|
13754
13693
|
}
|
|
13755
|
-
const parentDir =
|
|
13694
|
+
const parentDir = path18.dirname(currentDir);
|
|
13756
13695
|
if (parentDir === currentDir) {
|
|
13757
13696
|
break;
|
|
13758
13697
|
}
|
|
@@ -13763,7 +13702,7 @@ var PackmindIgnoreReader = class {
|
|
|
13763
13702
|
async parseIgnoreFile(filePath) {
|
|
13764
13703
|
let content;
|
|
13765
13704
|
try {
|
|
13766
|
-
content = await
|
|
13705
|
+
content = await fs15.readFile(filePath, "utf-8");
|
|
13767
13706
|
} catch (err) {
|
|
13768
13707
|
if (err.code === "ENOENT") {
|
|
13769
13708
|
return [];
|
|
@@ -13784,7 +13723,7 @@ function isNotLoggedInError(error) {
|
|
|
13784
13723
|
}
|
|
13785
13724
|
async function lintHandler(args2, deps) {
|
|
13786
13725
|
const {
|
|
13787
|
-
path:
|
|
13726
|
+
path: path35,
|
|
13788
13727
|
draft,
|
|
13789
13728
|
rule,
|
|
13790
13729
|
language,
|
|
@@ -13806,11 +13745,11 @@ async function lintHandler(args2, deps) {
|
|
|
13806
13745
|
throw new Error("option --rule is required to use --draft mode");
|
|
13807
13746
|
}
|
|
13808
13747
|
const startedAt = Date.now();
|
|
13809
|
-
const targetPath =
|
|
13748
|
+
const targetPath = path35 ?? ".";
|
|
13810
13749
|
const absolutePath = resolvePath(targetPath);
|
|
13811
13750
|
let stats;
|
|
13812
13751
|
try {
|
|
13813
|
-
stats = await
|
|
13752
|
+
stats = await fs16.stat(absolutePath);
|
|
13814
13753
|
} catch (err) {
|
|
13815
13754
|
const isNotFound = err.code === "ENOENT";
|
|
13816
13755
|
const message = isNotFound ? `File or directory "${absolutePath}" does not exist` : `Cannot access "${absolutePath}": ${err.message}`;
|
|
@@ -14128,13 +14067,13 @@ function extractWasmFiles() {
|
|
|
14128
14067
|
|
|
14129
14068
|
// apps/cli/src/main.ts
|
|
14130
14069
|
var import_dotenv = require("dotenv");
|
|
14131
|
-
var
|
|
14132
|
-
var
|
|
14070
|
+
var fs25 = __toESM(require("fs"));
|
|
14071
|
+
var path34 = __toESM(require("path"));
|
|
14133
14072
|
|
|
14134
14073
|
// apps/cli/src/infra/commands/InstallCommand.ts
|
|
14135
14074
|
var import_cmd_ts2 = __toESM(require_cjs());
|
|
14136
|
-
var
|
|
14137
|
-
var
|
|
14075
|
+
var path19 = __toESM(require("path"));
|
|
14076
|
+
var fs17 = __toESM(require("fs"));
|
|
14138
14077
|
|
|
14139
14078
|
// apps/cli/src/infra/commands/installPackagesHandler.ts
|
|
14140
14079
|
function formatOverviewRow(configPath, packages, pathColumnWidth) {
|
|
@@ -14211,18 +14150,19 @@ ${uniqueCount} unique ${packageWord} currently installed.`);
|
|
|
14211
14150
|
}
|
|
14212
14151
|
|
|
14213
14152
|
// apps/cli/src/infra/commands/InstallCommand.ts
|
|
14153
|
+
var { version: CLI_VERSION } = require_package();
|
|
14214
14154
|
function findSubDirectoriesWithPackmindJson(dirPath, recursive) {
|
|
14215
14155
|
const result = [];
|
|
14216
14156
|
let entries;
|
|
14217
14157
|
try {
|
|
14218
|
-
entries =
|
|
14158
|
+
entries = fs17.readdirSync(dirPath, { withFileTypes: true });
|
|
14219
14159
|
} catch {
|
|
14220
14160
|
return result;
|
|
14221
14161
|
}
|
|
14222
14162
|
for (const entry of entries) {
|
|
14223
14163
|
if (!entry.isDirectory()) continue;
|
|
14224
|
-
const subDir =
|
|
14225
|
-
if (
|
|
14164
|
+
const subDir = path19.join(dirPath, entry.name);
|
|
14165
|
+
if (fs17.existsSync(path19.join(subDir, "packmind.json"))) {
|
|
14226
14166
|
result.push(subDir);
|
|
14227
14167
|
}
|
|
14228
14168
|
if (recursive) {
|
|
@@ -14299,8 +14239,8 @@ async function notifyArtefactsDistributionIfInGitRepo(params) {
|
|
|
14299
14239
|
try {
|
|
14300
14240
|
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(dir);
|
|
14301
14241
|
if (!gitRoot) return;
|
|
14302
|
-
const lockFilePath =
|
|
14303
|
-
const content =
|
|
14242
|
+
const lockFilePath = path19.join(dir, "packmind-lock.json");
|
|
14243
|
+
const content = fs17.readFileSync(lockFilePath, "utf-8");
|
|
14304
14244
|
const packmindLockFile = JSON.parse(content);
|
|
14305
14245
|
const gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
|
|
14306
14246
|
const gitBranch = packmindCliHexa.getCurrentBranch(gitRoot);
|
|
@@ -14320,6 +14260,34 @@ async function notifyArtefactsDistributionIfInGitRepo(params) {
|
|
|
14320
14260
|
} catch {
|
|
14321
14261
|
}
|
|
14322
14262
|
}
|
|
14263
|
+
async function installDefaultSkillsIfAtGitRoot(params) {
|
|
14264
|
+
const { packmindCliHexa, cwd } = params;
|
|
14265
|
+
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(cwd);
|
|
14266
|
+
if (!gitRoot || cwd !== gitRoot) {
|
|
14267
|
+
return;
|
|
14268
|
+
}
|
|
14269
|
+
try {
|
|
14270
|
+
logConsole("\nInstalling default skills...");
|
|
14271
|
+
const skillsResult = await packmindCliHexa.installDefaultSkills({
|
|
14272
|
+
cliVersion: CLI_VERSION,
|
|
14273
|
+
baseDirectory: cwd
|
|
14274
|
+
});
|
|
14275
|
+
if (skillsResult.errors.length > 0) {
|
|
14276
|
+
skillsResult.errors.forEach((err) => {
|
|
14277
|
+
logWarningConsole(`Warning: ${err}`);
|
|
14278
|
+
});
|
|
14279
|
+
}
|
|
14280
|
+
const totalSkillFiles = skillsResult.filesCreated + skillsResult.filesUpdated;
|
|
14281
|
+
if (totalSkillFiles > 0) {
|
|
14282
|
+
logConsole(
|
|
14283
|
+
`Default skills: added ${skillsResult.filesCreated} files, changed ${skillsResult.filesUpdated} files`
|
|
14284
|
+
);
|
|
14285
|
+
} else if (skillsResult.errors.length === 0) {
|
|
14286
|
+
logConsole("Default skills are already up to date");
|
|
14287
|
+
}
|
|
14288
|
+
} catch {
|
|
14289
|
+
}
|
|
14290
|
+
}
|
|
14323
14291
|
async function installHandler({
|
|
14324
14292
|
installPath,
|
|
14325
14293
|
packages,
|
|
@@ -14351,14 +14319,14 @@ async function installHandler({
|
|
|
14351
14319
|
logConsole(`Use ${formatCommand(showCommand)} instead.`);
|
|
14352
14320
|
process.exit(1);
|
|
14353
14321
|
}
|
|
14354
|
-
const cwd = installPath ?
|
|
14322
|
+
const cwd = installPath ? path19.resolve(process.cwd(), installPath) : process.cwd();
|
|
14355
14323
|
if (installPath) {
|
|
14356
|
-
if (!
|
|
14324
|
+
if (!fs17.existsSync(cwd)) {
|
|
14357
14325
|
logErrorConsole(`Path does not exist: ${cwd}`);
|
|
14358
14326
|
process.exit(1);
|
|
14359
14327
|
return;
|
|
14360
14328
|
}
|
|
14361
|
-
if (!
|
|
14329
|
+
if (!fs17.statSync(cwd).isDirectory()) {
|
|
14362
14330
|
logErrorConsole(`Path is not a directory: ${cwd}`);
|
|
14363
14331
|
process.exit(1);
|
|
14364
14332
|
return;
|
|
@@ -14371,7 +14339,7 @@ async function installHandler({
|
|
|
14371
14339
|
targetDirs = [cwd];
|
|
14372
14340
|
} else {
|
|
14373
14341
|
targetDirs = [];
|
|
14374
|
-
if (
|
|
14342
|
+
if (fs17.existsSync(path19.join(cwd, "packmind.json"))) {
|
|
14375
14343
|
targetDirs.push(cwd);
|
|
14376
14344
|
}
|
|
14377
14345
|
targetDirs.push(...findSubDirectoriesWithPackmindJson(cwd, true));
|
|
@@ -14412,6 +14380,7 @@ async function installHandler({
|
|
|
14412
14380
|
logWarningConsole(warning);
|
|
14413
14381
|
}
|
|
14414
14382
|
logConsole(buildInstallSummary(combined));
|
|
14383
|
+
await installDefaultSkillsIfAtGitRoot({ packmindCliHexa, cwd });
|
|
14415
14384
|
const allErrors = [...combined.errors, ...thrownErrors];
|
|
14416
14385
|
if (allErrors.length > 0) {
|
|
14417
14386
|
logWarningConsole(`Encountered ${allErrors.length} error(s):`);
|
|
@@ -14627,7 +14596,7 @@ function displayVersionNotice(result) {
|
|
|
14627
14596
|
}
|
|
14628
14597
|
|
|
14629
14598
|
// apps/cli/src/infra/commands/WhoamiCommand.ts
|
|
14630
|
-
var { version:
|
|
14599
|
+
var { version: CLI_VERSION2 } = require_package();
|
|
14631
14600
|
function formatExpiresAt(expiresAt) {
|
|
14632
14601
|
const now = /* @__PURE__ */ new Date();
|
|
14633
14602
|
if (expiresAt < now) {
|
|
@@ -14671,7 +14640,7 @@ var whoamiCommand = (0, import_cmd_ts6.command)({
|
|
|
14671
14640
|
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
14672
14641
|
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
14673
14642
|
const versionCheckPromise = packmindCliHexa.checkCliVersion({
|
|
14674
|
-
currentVersion:
|
|
14643
|
+
currentVersion: CLI_VERSION2
|
|
14675
14644
|
});
|
|
14676
14645
|
const result = await packmindCliHexa.whoami({});
|
|
14677
14646
|
if (!result.isAuthenticated) {
|
|
@@ -14699,308 +14668,65 @@ Credentials are loaded from (in order of priority):`);
|
|
|
14699
14668
|
}
|
|
14700
14669
|
});
|
|
14701
14670
|
|
|
14702
|
-
// apps/cli/src/infra/commands/
|
|
14703
|
-
var
|
|
14704
|
-
var fs20 = __toESM(require("fs"));
|
|
14705
|
-
var readline2 = __toESM(require("readline"));
|
|
14706
|
-
var inquirer = __toESM(require("inquirer"));
|
|
14671
|
+
// apps/cli/src/infra/commands/SkillsCommand.ts
|
|
14672
|
+
var import_cmd_ts11 = __toESM(require_cjs());
|
|
14707
14673
|
|
|
14708
|
-
// apps/cli/src/
|
|
14709
|
-
var
|
|
14710
|
-
var path21 = __toESM(require("path"));
|
|
14711
|
-
var os4 = __toESM(require("os"));
|
|
14712
|
-
var import_child_process4 = require("child_process");
|
|
14713
|
-
var AgentDetectionService = class {
|
|
14714
|
-
constructor(projectDir = process.cwd()) {
|
|
14715
|
-
this.projectDir = projectDir;
|
|
14716
|
-
}
|
|
14717
|
-
detectAgents() {
|
|
14718
|
-
const agents = [];
|
|
14719
|
-
if (this.isClaudeAvailable()) {
|
|
14720
|
-
agents.push({ type: "claude", name: "Claude Code" });
|
|
14721
|
-
}
|
|
14722
|
-
if (this.isCursorAvailable()) {
|
|
14723
|
-
agents.push({ type: "cursor", name: "Cursor" });
|
|
14724
|
-
}
|
|
14725
|
-
if (this.isVSCodeAvailable()) {
|
|
14726
|
-
agents.push({ type: "vscode", name: "VS Code" });
|
|
14727
|
-
}
|
|
14728
|
-
if (this.isContinueAvailable()) {
|
|
14729
|
-
agents.push({ type: "continue", name: "Continue.dev" });
|
|
14730
|
-
}
|
|
14731
|
-
return agents;
|
|
14732
|
-
}
|
|
14733
|
-
isClaudeAvailable() {
|
|
14734
|
-
return this.isCommandAvailable("claude");
|
|
14735
|
-
}
|
|
14736
|
-
isCursorAvailable() {
|
|
14737
|
-
const cursorConfigDir = path21.join(os4.homedir(), ".cursor");
|
|
14738
|
-
return fs19.existsSync(cursorConfigDir);
|
|
14739
|
-
}
|
|
14740
|
-
isVSCodeAvailable() {
|
|
14741
|
-
const vscodeDir = path21.join(this.projectDir, ".vscode");
|
|
14742
|
-
return fs19.existsSync(vscodeDir);
|
|
14743
|
-
}
|
|
14744
|
-
isContinueAvailable() {
|
|
14745
|
-
const continueDir = path21.join(this.projectDir, ".continue");
|
|
14746
|
-
return fs19.existsSync(continueDir);
|
|
14747
|
-
}
|
|
14748
|
-
isCommandAvailable(command33) {
|
|
14749
|
-
try {
|
|
14750
|
-
const whichCommand = process.platform === "win32" ? "where" : "which";
|
|
14751
|
-
(0, import_child_process4.execSync)(`${whichCommand} ${command33}`, { stdio: "pipe" });
|
|
14752
|
-
return true;
|
|
14753
|
-
} catch {
|
|
14754
|
-
return false;
|
|
14755
|
-
}
|
|
14756
|
-
}
|
|
14757
|
-
};
|
|
14674
|
+
// apps/cli/src/infra/commands/skills/AddSkillCommand.ts
|
|
14675
|
+
var import_cmd_ts8 = __toESM(require_cjs());
|
|
14758
14676
|
|
|
14759
|
-
// apps/cli/src/infra/commands/
|
|
14760
|
-
var
|
|
14761
|
-
|
|
14762
|
-
|
|
14763
|
-
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
|
|
14767
|
-
|
|
14768
|
-
|
|
14769
|
-
var AgentArgType = {
|
|
14677
|
+
// apps/cli/src/infra/commands/sharedOptions.ts
|
|
14678
|
+
var import_cmd_ts7 = __toESM(require_cjs());
|
|
14679
|
+
var originSkillOption = (0, import_cmd_ts7.option)({
|
|
14680
|
+
long: "origin-skill",
|
|
14681
|
+
description: "Name of the skill that triggered this command",
|
|
14682
|
+
type: (0, import_cmd_ts7.optional)(import_cmd_ts7.string)
|
|
14683
|
+
});
|
|
14684
|
+
|
|
14685
|
+
// apps/cli/src/infra/commands/customParameters/SpaceSlug.ts
|
|
14686
|
+
var SpaceSlug = {
|
|
14770
14687
|
from: async (input) => {
|
|
14771
|
-
|
|
14772
|
-
if (VALID_AGENTS.includes(normalized)) {
|
|
14773
|
-
return normalized;
|
|
14774
|
-
}
|
|
14775
|
-
throw new Error(
|
|
14776
|
-
`Invalid agent '${input}'. Valid options are: ${VALID_AGENTS.join(", ")}`
|
|
14777
|
-
);
|
|
14688
|
+
return input.startsWith("@") ? input.slice(1) : input;
|
|
14778
14689
|
}
|
|
14779
14690
|
};
|
|
14780
14691
|
|
|
14781
|
-
// apps/cli/src/infra/commands/SetupMcpCommand.ts
|
|
14782
|
-
var ALL_AGENTS2 = [
|
|
14783
|
-
{ type: "claude", name: "Claude Code" },
|
|
14784
|
-
{ type: "cursor", name: "Cursor" },
|
|
14785
|
-
{ type: "vscode", name: "VS Code" },
|
|
14786
|
-
{ type: "continue", name: "Continue.dev" }
|
|
14787
|
-
];
|
|
14788
|
-
async function promptAgentsWithReadline(choices) {
|
|
14789
|
-
const input = fs20.createReadStream("/dev/tty");
|
|
14790
|
-
const output = fs20.createWriteStream("/dev/tty");
|
|
14791
|
-
const rl = readline2.createInterface({
|
|
14792
|
-
input,
|
|
14793
|
-
output
|
|
14794
|
-
});
|
|
14795
|
-
output.write("Select agents to configure:\n");
|
|
14796
|
-
choices.forEach((choice, index) => {
|
|
14797
|
-
const marker = choice.checked ? "*" : " ";
|
|
14798
|
-
output.write(` ${index + 1}. [${marker}] ${choice.name}
|
|
14799
|
-
`);
|
|
14800
|
-
});
|
|
14801
|
-
output.write("\n");
|
|
14802
|
-
const preselected = choices.map((c, i) => c.checked ? i + 1 : null).filter((i) => i !== null);
|
|
14803
|
-
const defaultValue = preselected.length > 0 ? preselected.join(",") : "1,2,3";
|
|
14804
|
-
return new Promise((resolve15) => {
|
|
14805
|
-
rl.question(
|
|
14806
|
-
`Enter numbers separated by commas (default: ${defaultValue}): `,
|
|
14807
|
-
(answer) => {
|
|
14808
|
-
rl.close();
|
|
14809
|
-
input.destroy();
|
|
14810
|
-
output.destroy();
|
|
14811
|
-
const trimmed = answer.trim();
|
|
14812
|
-
const numbersStr = trimmed === "" ? defaultValue : trimmed;
|
|
14813
|
-
const numbers = numbersStr.split(",").map((s) => parseInt(s.trim(), 10)).filter((n) => !isNaN(n) && n >= 1 && n <= choices.length);
|
|
14814
|
-
const selectedAgents = numbers.map((n) => choices[n - 1].value);
|
|
14815
|
-
resolve15(selectedAgents);
|
|
14816
|
-
}
|
|
14817
|
-
);
|
|
14818
|
-
});
|
|
14819
|
-
}
|
|
14820
|
-
var setupMcpCommand = (0, import_cmd_ts7.command)({
|
|
14821
|
-
name: "setup-mcp",
|
|
14822
|
-
description: "Configure MCP (Model Context Protocol) for AI coding agents",
|
|
14823
|
-
args: {
|
|
14824
|
-
targets: (0, import_cmd_ts7.multioption)({
|
|
14825
|
-
type: (0, import_cmd_ts7.array)(AgentArgType),
|
|
14826
|
-
long: "target",
|
|
14827
|
-
short: "t",
|
|
14828
|
-
description: "Target agent(s) to configure (copilot, cursor, claude, or continue). Can be specified multiple times. If omitted, interactive mode is used."
|
|
14829
|
-
})
|
|
14830
|
-
},
|
|
14831
|
-
handler: async ({ targets }) => {
|
|
14832
|
-
const credentials = loadCredentials();
|
|
14833
|
-
if (!credentials) {
|
|
14834
|
-
logErrorConsole("Not authenticated");
|
|
14835
|
-
logConsole("\nNo credentials found. You can authenticate by either:");
|
|
14836
|
-
logConsole(" 1. Running `packmind-cli login`");
|
|
14837
|
-
logConsole(" 2. Setting PACKMIND_API_KEY_V3 environment variable");
|
|
14838
|
-
logConsole(`
|
|
14839
|
-
Credentials are loaded from (in order of priority):`);
|
|
14840
|
-
logConsole(` 1. PACKMIND_API_KEY_V3 environment variable`);
|
|
14841
|
-
logConsole(` 2. ${getCredentialsPath()}`);
|
|
14842
|
-
process.exit(1);
|
|
14843
|
-
}
|
|
14844
|
-
if (credentials.isExpired) {
|
|
14845
|
-
logErrorConsole("Credentials expired");
|
|
14846
|
-
logConsole("\nRun `packmind-cli login` to re-authenticate.");
|
|
14847
|
-
process.exit(1);
|
|
14848
|
-
}
|
|
14849
|
-
const agentDetectionService = new AgentDetectionService();
|
|
14850
|
-
let selectedAgents;
|
|
14851
|
-
if (targets.length > 0) {
|
|
14852
|
-
selectedAgents = targets.map((t) => agentArgToType[t]).filter((a) => a !== void 0);
|
|
14853
|
-
} else {
|
|
14854
|
-
logConsole("\nDetecting installed AI agents...\n");
|
|
14855
|
-
const detectedAgents = agentDetectionService.detectAgents();
|
|
14856
|
-
if (detectedAgents.length > 0) {
|
|
14857
|
-
logConsole("Found agents:");
|
|
14858
|
-
detectedAgents.forEach((detectedAgent) => {
|
|
14859
|
-
logConsole(` - ${detectedAgent.name}`);
|
|
14860
|
-
});
|
|
14861
|
-
logConsole("");
|
|
14862
|
-
} else {
|
|
14863
|
-
logConsole("No supported agents detected.\n");
|
|
14864
|
-
}
|
|
14865
|
-
const detectedTypes = new Set(detectedAgents.map((a) => a.type));
|
|
14866
|
-
const choices = ALL_AGENTS2.map((agentInfo) => ({
|
|
14867
|
-
name: agentInfo.name,
|
|
14868
|
-
value: agentInfo.type,
|
|
14869
|
-
checked: detectedTypes.has(agentInfo.type)
|
|
14870
|
-
}));
|
|
14871
|
-
let promptedAgents;
|
|
14872
|
-
const useSimplePrompt = process.env.PACKMIND_SIMPLE_PROMPT === "1" || !process.stdin.isTTY;
|
|
14873
|
-
if (useSimplePrompt) {
|
|
14874
|
-
promptedAgents = await promptAgentsWithReadline(choices);
|
|
14875
|
-
} else {
|
|
14876
|
-
const result2 = await inquirer.default.prompt([
|
|
14877
|
-
{
|
|
14878
|
-
type: "checkbox",
|
|
14879
|
-
name: "selectedAgents",
|
|
14880
|
-
message: "Select agents to configure (use space to select):",
|
|
14881
|
-
choices
|
|
14882
|
-
}
|
|
14883
|
-
]);
|
|
14884
|
-
promptedAgents = result2.selectedAgents;
|
|
14885
|
-
}
|
|
14886
|
-
if (promptedAgents.length === 0) {
|
|
14887
|
-
logConsole("\nNo agents selected. Exiting.");
|
|
14888
|
-
process.exit(0);
|
|
14889
|
-
}
|
|
14890
|
-
selectedAgents = promptedAgents;
|
|
14891
|
-
}
|
|
14892
|
-
logConsole("\nFetching MCP configuration...\n");
|
|
14893
|
-
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
14894
|
-
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
14895
|
-
let result;
|
|
14896
|
-
try {
|
|
14897
|
-
result = await packmindCliHexa.setupMcp({ agentTypes: selectedAgents });
|
|
14898
|
-
} catch (error) {
|
|
14899
|
-
logErrorConsole("Failed to fetch MCP configuration from server.");
|
|
14900
|
-
if (error instanceof Error) {
|
|
14901
|
-
logConsole(` ${error.message}`);
|
|
14902
|
-
}
|
|
14903
|
-
process.exit(1);
|
|
14904
|
-
}
|
|
14905
|
-
let successCount = 0;
|
|
14906
|
-
const failedAgents = [];
|
|
14907
|
-
for (const agentResult of result.results) {
|
|
14908
|
-
logConsole(`Installing MCP for ${agentResult.agentName}...`);
|
|
14909
|
-
if (agentResult.success) {
|
|
14910
|
-
logSuccessConsole(` ${agentResult.agentName} configured successfully`);
|
|
14911
|
-
successCount++;
|
|
14912
|
-
} else {
|
|
14913
|
-
logErrorConsole(` Failed to configure ${agentResult.agentName}`);
|
|
14914
|
-
failedAgents.push({
|
|
14915
|
-
name: agentResult.agentName,
|
|
14916
|
-
error: agentResult.error || ""
|
|
14917
|
-
});
|
|
14918
|
-
}
|
|
14919
|
-
}
|
|
14920
|
-
logConsole("");
|
|
14921
|
-
if (failedAgents.length > 0) {
|
|
14922
|
-
for (const failed of failedAgents) {
|
|
14923
|
-
logWarningConsole(`Failed to configure ${failed.name}:`);
|
|
14924
|
-
logConsole(`
|
|
14925
|
-
Error: ${failed.error}`);
|
|
14926
|
-
if (failed.error.includes("ENOENT") || failed.error.includes("not found") || failed.error.includes("command not found")) {
|
|
14927
|
-
logConsole(
|
|
14928
|
-
`
|
|
14929
|
-
Hint: Make sure the agent CLI is installed and available in your PATH.`
|
|
14930
|
-
);
|
|
14931
|
-
}
|
|
14932
|
-
logConsole(`
|
|
14933
|
-
Manual configuration:`);
|
|
14934
|
-
logConsole(result.manualConfigJson ?? "undefined");
|
|
14935
|
-
logConsole("");
|
|
14936
|
-
}
|
|
14937
|
-
}
|
|
14938
|
-
if (successCount > 0) {
|
|
14939
|
-
const agentWord = successCount === 1 ? "agent" : "agents";
|
|
14940
|
-
logConsole(
|
|
14941
|
-
formatBold(`Done! MCP configured for ${successCount} ${agentWord}.`)
|
|
14942
|
-
);
|
|
14943
|
-
}
|
|
14944
|
-
if (failedAgents.length > 0) {
|
|
14945
|
-
process.exit(1);
|
|
14946
|
-
}
|
|
14947
|
-
}
|
|
14948
|
-
});
|
|
14949
|
-
|
|
14950
|
-
// apps/cli/src/infra/commands/SkillsCommand.ts
|
|
14951
|
-
var import_cmd_ts12 = __toESM(require_cjs());
|
|
14952
|
-
|
|
14953
14692
|
// apps/cli/src/infra/commands/skills/AddSkillCommand.ts
|
|
14954
|
-
var
|
|
14955
|
-
|
|
14956
|
-
// apps/cli/src/infra/commands/sharedOptions.ts
|
|
14957
|
-
var import_cmd_ts8 = __toESM(require_cjs());
|
|
14958
|
-
var originSkillOption = (0, import_cmd_ts8.option)({
|
|
14959
|
-
long: "origin-skill",
|
|
14960
|
-
description: "Name of the skill that triggered this command",
|
|
14961
|
-
type: (0, import_cmd_ts8.optional)(import_cmd_ts8.string)
|
|
14962
|
-
});
|
|
14963
|
-
|
|
14964
|
-
// apps/cli/src/infra/commands/customParameters/SpaceSlug.ts
|
|
14965
|
-
var SpaceSlug = {
|
|
14966
|
-
from: async (input) => {
|
|
14967
|
-
return input.startsWith("@") ? input.slice(1) : input;
|
|
14968
|
-
}
|
|
14969
|
-
};
|
|
14970
|
-
|
|
14971
|
-
// apps/cli/src/infra/commands/skills/AddSkillCommand.ts
|
|
14972
|
-
var addSkillCommand = (0, import_cmd_ts9.command)({
|
|
14693
|
+
var addSkillCommand = (0, import_cmd_ts8.command)({
|
|
14973
14694
|
name: "add",
|
|
14974
14695
|
description: "[Deprecated] Add a skill from a local directory to a Packmind organization",
|
|
14975
14696
|
args: {
|
|
14976
|
-
skillPath: (0,
|
|
14977
|
-
type:
|
|
14697
|
+
skillPath: (0, import_cmd_ts8.positional)({
|
|
14698
|
+
type: import_cmd_ts8.string,
|
|
14978
14699
|
displayName: "path",
|
|
14979
14700
|
description: "Path to skill directory containing SKILL.md"
|
|
14980
14701
|
}),
|
|
14981
|
-
space: (0,
|
|
14702
|
+
space: (0, import_cmd_ts8.option)({
|
|
14982
14703
|
long: "space",
|
|
14983
14704
|
description: "Slug of the space in which to add the skill (with or without leading @)",
|
|
14984
|
-
type: (0,
|
|
14705
|
+
type: (0, import_cmd_ts8.optional)(SpaceSlug)
|
|
14985
14706
|
}),
|
|
14986
14707
|
originSkill: originSkillOption
|
|
14987
14708
|
},
|
|
14988
14709
|
handler: async () => {
|
|
14989
|
-
|
|
14990
|
-
|
|
14991
|
-
|
|
14710
|
+
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
14711
|
+
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
14712
|
+
packmindCliHexa.output.notifyError(
|
|
14713
|
+
'Command "packmind-cli skills add" has been removed.',
|
|
14714
|
+
{
|
|
14715
|
+
content: 'Use the "playbook add" command instead:',
|
|
14716
|
+
exampleCommand: "packmind-cli playbook add .packmind/commands/my-command.md"
|
|
14717
|
+
}
|
|
14992
14718
|
);
|
|
14993
14719
|
process.exit(1);
|
|
14994
14720
|
}
|
|
14995
14721
|
});
|
|
14996
14722
|
|
|
14997
14723
|
// apps/cli/src/infra/commands/skills/InstallDefaultSkillsCommand.ts
|
|
14998
|
-
var
|
|
14999
|
-
var
|
|
14724
|
+
var import_cmd_ts9 = __toESM(require_cjs());
|
|
14725
|
+
var readline2 = __toESM(require("readline"));
|
|
15000
14726
|
|
|
15001
14727
|
// apps/cli/src/infra/commands/skills/incompatibleSkillsHandler.ts
|
|
15002
|
-
var
|
|
15003
|
-
var
|
|
14728
|
+
var fs18 = __toESM(require("fs/promises"));
|
|
14729
|
+
var path20 = __toESM(require("path"));
|
|
15004
14730
|
async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm) {
|
|
15005
14731
|
const skillNames = skills.map((s) => s.skillName).join(", ");
|
|
15006
14732
|
logWarningConsole(
|
|
@@ -15013,10 +14739,10 @@ async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm)
|
|
|
15013
14739
|
return;
|
|
15014
14740
|
}
|
|
15015
14741
|
for (const skill of skills) {
|
|
15016
|
-
const skillRootDirs = skill.filePaths.filter((p) =>
|
|
14742
|
+
const skillRootDirs = skill.filePaths.filter((p) => path20.basename(p) === "SKILL.md").map((p) => path20.dirname(p));
|
|
15017
14743
|
for (const dir of skillRootDirs) {
|
|
15018
14744
|
try {
|
|
15019
|
-
await
|
|
14745
|
+
await fs18.rm(path20.join(baseDirectory, dir), {
|
|
15020
14746
|
recursive: true,
|
|
15021
14747
|
force: true
|
|
15022
14748
|
});
|
|
@@ -15029,7 +14755,7 @@ async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm)
|
|
|
15029
14755
|
for (const relativePath of skill.filePaths) {
|
|
15030
14756
|
if (!skillRootDirs.some((dir) => relativePath.startsWith(dir + "/"))) {
|
|
15031
14757
|
try {
|
|
15032
|
-
await
|
|
14758
|
+
await fs18.unlink(path20.join(baseDirectory, relativePath));
|
|
15033
14759
|
} catch (error) {
|
|
15034
14760
|
logErrorConsole(
|
|
15035
14761
|
`Failed to delete "${relativePath}": ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -15042,12 +14768,12 @@ async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm)
|
|
|
15042
14768
|
}
|
|
15043
14769
|
|
|
15044
14770
|
// apps/cli/src/infra/commands/skills/InstallDefaultSkillsCommand.ts
|
|
15045
|
-
var { version:
|
|
15046
|
-
var installDefaultSkillsCommand = (0,
|
|
14771
|
+
var { version: CLI_VERSION3 } = require_package();
|
|
14772
|
+
var installDefaultSkillsCommand = (0, import_cmd_ts9.command)({
|
|
15047
14773
|
name: "install-default",
|
|
15048
14774
|
description: "Install default Packmind skills for configured coding agents",
|
|
15049
14775
|
args: {
|
|
15050
|
-
includeBeta: (0,
|
|
14776
|
+
includeBeta: (0, import_cmd_ts9.flag)({
|
|
15051
14777
|
long: "include-beta",
|
|
15052
14778
|
description: "Include unreleased/beta skills"
|
|
15053
14779
|
})
|
|
@@ -15060,7 +14786,7 @@ var installDefaultSkillsCommand = (0, import_cmd_ts10.command)({
|
|
|
15060
14786
|
const baseDirectory = process.cwd();
|
|
15061
14787
|
const result = await packmindCliHexa.installDefaultSkills({
|
|
15062
14788
|
includeBeta,
|
|
15063
|
-
cliVersion: includeBeta ? void 0 :
|
|
14789
|
+
cliVersion: includeBeta ? void 0 : CLI_VERSION3,
|
|
15064
14790
|
baseDirectory
|
|
15065
14791
|
});
|
|
15066
14792
|
if (result.skippedSkillsCount > 0) {
|
|
@@ -15068,13 +14794,6 @@ var installDefaultSkillsCommand = (0, import_cmd_ts10.command)({
|
|
|
15068
14794
|
`${result.skippedSkillsCount} skill(s) were skipped because they require a newer version of packmind-cli. Run "${formatCommand("packmind-cli update")}" to get the latest version.`
|
|
15069
14795
|
);
|
|
15070
14796
|
}
|
|
15071
|
-
if (result.skippedIncompatibleSkillNames.length > 0) {
|
|
15072
|
-
for (const skillName of result.skippedIncompatibleSkillNames) {
|
|
15073
|
-
logWarningConsole(
|
|
15074
|
-
`Skill "${skillName}" was not installed because it is not compatible with this version of packmind-cli.`
|
|
15075
|
-
);
|
|
15076
|
-
}
|
|
15077
|
-
}
|
|
15078
14797
|
if (result.incompatibleInstalledSkills.length > 0) {
|
|
15079
14798
|
await handleIncompatibleInstalledSkillsWithPrompt(
|
|
15080
14799
|
result.incompatibleInstalledSkills,
|
|
@@ -15117,7 +14836,7 @@ async function handleIncompatibleInstalledSkillsWithPrompt(skills, baseDirectory
|
|
|
15117
14836
|
);
|
|
15118
14837
|
}
|
|
15119
14838
|
async function promptConfirmation(question) {
|
|
15120
|
-
const rl =
|
|
14839
|
+
const rl = readline2.createInterface({
|
|
15121
14840
|
input: process.stdin,
|
|
15122
14841
|
output: process.stdout
|
|
15123
14842
|
});
|
|
@@ -15130,7 +14849,7 @@ async function promptConfirmation(question) {
|
|
|
15130
14849
|
}
|
|
15131
14850
|
|
|
15132
14851
|
// apps/cli/src/infra/commands/ListSkillsCommand.ts
|
|
15133
|
-
var
|
|
14852
|
+
var import_cmd_ts10 = __toESM(require_cjs());
|
|
15134
14853
|
|
|
15135
14854
|
// apps/cli/src/infra/utils/spaceFilterUtils.ts
|
|
15136
14855
|
function resolveSpaceFromArgs(spaceArg, spaces) {
|
|
@@ -15149,104 +14868,89 @@ function resolveUrlBuilder(buildArtifactPath) {
|
|
|
15149
14868
|
return (spaceSlug, artifactId) => `${decoded.host}/org/${orgSlug}/space/${spaceSlug}/${buildArtifactPath(artifactId)}`;
|
|
15150
14869
|
}
|
|
15151
14870
|
|
|
15152
|
-
// apps/cli/src/infra/
|
|
15153
|
-
function
|
|
15154
|
-
const
|
|
14871
|
+
// apps/cli/src/infra/utils/groupArtefactsBySpaces.ts
|
|
14872
|
+
function groupArtefactBySpaces(artefacts, spaces) {
|
|
14873
|
+
const spacesById = new Map(
|
|
15155
14874
|
spaces.map((s) => [s.id, s])
|
|
15156
14875
|
);
|
|
15157
|
-
const
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
|
|
15162
|
-
|
|
15163
|
-
|
|
15164
|
-
|
|
15165
|
-
let group = groupsMap.get(space.id);
|
|
15166
|
-
if (!group) {
|
|
15167
|
-
group = { space, items: [] };
|
|
15168
|
-
groupsMap.set(space.id, group);
|
|
15169
|
-
}
|
|
15170
|
-
group.items.push(skill);
|
|
15171
|
-
}
|
|
15172
|
-
const groups = [...groupsMap.values()].sort(
|
|
15173
|
-
(a, b) => a.space.name.localeCompare(b.space.name)
|
|
15174
|
-
);
|
|
15175
|
-
return { groups, orphaned };
|
|
15176
|
-
}
|
|
15177
|
-
function displayGroupedSkills(skills, spaces, buildUrl) {
|
|
15178
|
-
const { groups, orphaned } = groupSkillsBySpace(skills, spaces);
|
|
15179
|
-
for (const { space, items } of groups) {
|
|
15180
|
-
logConsole(`Space "${space.name}":
|
|
15181
|
-
`);
|
|
15182
|
-
for (const skill of [...items].sort(
|
|
15183
|
-
(a, b) => a.slug.localeCompare(b.slug)
|
|
15184
|
-
)) {
|
|
15185
|
-
logConsole(` ${formatSlug(skill.slug)}`);
|
|
15186
|
-
logConsole(` ${formatLabel("Name:")} ${skill.name}`);
|
|
15187
|
-
if (skill.description) {
|
|
15188
|
-
const descriptionLines = skill.description.trim().split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
15189
|
-
const firstLine = descriptionLines[0];
|
|
15190
|
-
if (firstLine) {
|
|
15191
|
-
const truncated = firstLine.length > 80 ? firstLine.slice(0, 77) + "..." : firstLine;
|
|
15192
|
-
logConsole(` ${formatLabel("Desc:")} ${truncated}`);
|
|
15193
|
-
}
|
|
15194
|
-
}
|
|
15195
|
-
const url = buildUrl(space.slug, skill.slug);
|
|
15196
|
-
if (url) {
|
|
15197
|
-
logConsole(` ${formatLabel("Link:")} ${url}`);
|
|
15198
|
-
}
|
|
15199
|
-
logConsole("");
|
|
14876
|
+
const groupedArtefacts = artefacts.reduce((acc, artefact) => {
|
|
14877
|
+
const space = spacesById.get(artefact.spaceId);
|
|
14878
|
+
if (space) {
|
|
14879
|
+
const group = acc.get(artefact.spaceId) ?? { space, artefacts: [] };
|
|
14880
|
+
acc.set(artefact.spaceId, {
|
|
14881
|
+
space,
|
|
14882
|
+
artefacts: [...group.artefacts, artefact]
|
|
14883
|
+
});
|
|
15200
14884
|
}
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
|
|
15204
|
-
|
|
15205
|
-
|
|
15206
|
-
|
|
15207
|
-
logConsole("");
|
|
15208
|
-
}
|
|
14885
|
+
return acc;
|
|
14886
|
+
}, /* @__PURE__ */ new Map());
|
|
14887
|
+
return [...groupedArtefacts.values()].map(({ space, artefacts: artefacts2 }) => ({
|
|
14888
|
+
space,
|
|
14889
|
+
artefacts: [...artefacts2].sort((a, b) => a.slug.localeCompare(b.slug))
|
|
14890
|
+
})).sort((a, b) => a.space.name.localeCompare(b.space.name));
|
|
15209
14891
|
}
|
|
14892
|
+
|
|
14893
|
+
// apps/cli/src/infra/commands/skills/listSkillsHandler.ts
|
|
15210
14894
|
async function listSkillsHandler(args2, deps) {
|
|
15211
14895
|
const { packmindCliHexa, exit } = deps;
|
|
15212
14896
|
try {
|
|
15213
|
-
|
|
15214
|
-
|
|
14897
|
+
const spaces = await packmindCliHexa.output.withLoader(
|
|
14898
|
+
"Fetching spaces",
|
|
14899
|
+
() => packmindCliHexa.getSpaces()
|
|
14900
|
+
);
|
|
15215
14901
|
const matchedSpace = resolveSpaceFromArgs(args2.space, spaces);
|
|
15216
14902
|
if (args2.space && !matchedSpace) {
|
|
15217
|
-
|
|
14903
|
+
const availableSpaces = spaces.map((s) => ` - @${s.slug}`).join("\n");
|
|
14904
|
+
packmindCliHexa.output.notifyError(`Space "@${args2.space}" not found.`, {
|
|
14905
|
+
content: `Available spaces:
|
|
14906
|
+
${availableSpaces}`
|
|
14907
|
+
});
|
|
15218
14908
|
exit(1);
|
|
15219
14909
|
return;
|
|
15220
14910
|
}
|
|
15221
|
-
const skills = await packmindCliHexa.
|
|
15222
|
-
|
|
14911
|
+
const skills = await packmindCliHexa.output.withLoader(
|
|
14912
|
+
"Fetching skills",
|
|
14913
|
+
() => packmindCliHexa.listSkills(
|
|
14914
|
+
matchedSpace ? { spaceId: matchedSpace.id } : {}
|
|
14915
|
+
)
|
|
15223
14916
|
);
|
|
15224
14917
|
if (skills.length === 0) {
|
|
15225
|
-
|
|
14918
|
+
packmindCliHexa.output.notifyInfo(
|
|
15226
14919
|
matchedSpace ? `No skills found in space "@${matchedSpace.slug}".` : "No skills found."
|
|
15227
14920
|
);
|
|
15228
14921
|
exit(0);
|
|
15229
14922
|
return;
|
|
15230
14923
|
}
|
|
15231
|
-
logConsole(formatHeader(`\u{1F4CB} Skills (${skills.length})
|
|
15232
|
-
`));
|
|
15233
14924
|
const buildUrl = resolveUrlBuilder((slug3) => `skills/${slug3}/files`);
|
|
15234
|
-
|
|
14925
|
+
const groups = groupArtefactBySpaces(skills, spaces);
|
|
14926
|
+
packmindCliHexa.output.listScopedArtefacts(
|
|
14927
|
+
`\u{1F4CB} Skills (${skills.length})`,
|
|
14928
|
+
groups.map(({ space, artefacts }) => ({
|
|
14929
|
+
title: `Space: ${space.name}`,
|
|
14930
|
+
artefacts: artefacts.map((skill) => ({
|
|
14931
|
+
title: skill.name,
|
|
14932
|
+
slug: skill.slug,
|
|
14933
|
+
description: skill.description ?? void 0,
|
|
14934
|
+
url: buildUrl(space.slug, skill.slug)
|
|
14935
|
+
}))
|
|
14936
|
+
}))
|
|
14937
|
+
);
|
|
15235
14938
|
exit(0);
|
|
15236
14939
|
} catch (err) {
|
|
15237
|
-
|
|
15238
|
-
|
|
14940
|
+
packmindCliHexa.output.notifyError("Failed to list skills:", {
|
|
14941
|
+
content: err instanceof Error ? err.message : String(err)
|
|
14942
|
+
});
|
|
15239
14943
|
exit(1);
|
|
15240
14944
|
}
|
|
15241
14945
|
}
|
|
15242
14946
|
|
|
15243
14947
|
// apps/cli/src/infra/commands/ListSkillsCommand.ts
|
|
15244
|
-
var listSkillsCommand = (0,
|
|
14948
|
+
var listSkillsCommand = (0, import_cmd_ts10.command)({
|
|
15245
14949
|
name: "list",
|
|
15246
14950
|
description: "List available skills",
|
|
15247
14951
|
args: {
|
|
15248
|
-
space: (0,
|
|
15249
|
-
type: (0,
|
|
14952
|
+
space: (0, import_cmd_ts10.option)({
|
|
14953
|
+
type: (0, import_cmd_ts10.optional)(SpaceSlug),
|
|
15250
14954
|
long: "space",
|
|
15251
14955
|
description: "Filter skills by space slug"
|
|
15252
14956
|
})
|
|
@@ -15265,7 +14969,7 @@ var listSkillsCommand = (0, import_cmd_ts11.command)({
|
|
|
15265
14969
|
});
|
|
15266
14970
|
|
|
15267
14971
|
// apps/cli/src/infra/commands/SkillsCommand.ts
|
|
15268
|
-
var skillsCommand = (0,
|
|
14972
|
+
var skillsCommand = (0, import_cmd_ts11.subcommands)({
|
|
15269
14973
|
name: "skills",
|
|
15270
14974
|
description: "Manage skills in your Packmind organization",
|
|
15271
14975
|
cmds: {
|
|
@@ -15276,138 +14980,104 @@ var skillsCommand = (0, import_cmd_ts12.subcommands)({
|
|
|
15276
14980
|
});
|
|
15277
14981
|
|
|
15278
14982
|
// apps/cli/src/infra/commands/StandardsCommand.ts
|
|
15279
|
-
var
|
|
14983
|
+
var import_cmd_ts14 = __toESM(require_cjs());
|
|
15280
14984
|
|
|
15281
14985
|
// apps/cli/src/infra/commands/CreateStandardCommand.ts
|
|
15282
|
-
var
|
|
15283
|
-
var createStandardCommand = (0,
|
|
14986
|
+
var import_cmd_ts12 = __toESM(require_cjs());
|
|
14987
|
+
var createStandardCommand = (0, import_cmd_ts12.command)({
|
|
15284
14988
|
name: "create",
|
|
15285
14989
|
description: "[Deprecated] Create a coding standard from a playbook JSON file or stdin",
|
|
15286
14990
|
args: {
|
|
15287
|
-
file: (0,
|
|
14991
|
+
file: (0, import_cmd_ts12.positional)({
|
|
15288
14992
|
displayName: "file",
|
|
15289
14993
|
description: "Path to the playbook JSON file (reads from stdin if omitted)",
|
|
15290
|
-
type: (0,
|
|
14994
|
+
type: (0, import_cmd_ts12.optional)(import_cmd_ts12.string)
|
|
15291
14995
|
}),
|
|
15292
|
-
space: (0,
|
|
14996
|
+
space: (0, import_cmd_ts12.option)({
|
|
15293
14997
|
long: "space",
|
|
15294
14998
|
description: "Slug of the space in which to create the standard (with or without leading @)",
|
|
15295
|
-
type: (0,
|
|
14999
|
+
type: (0, import_cmd_ts12.optional)(SpaceSlug)
|
|
15296
15000
|
}),
|
|
15297
15001
|
originSkill: originSkillOption
|
|
15298
15002
|
},
|
|
15299
15003
|
handler: async () => {
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
|
|
15303
|
-
|
|
15304
|
-
|
|
15004
|
+
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
15005
|
+
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
15006
|
+
packmindCliHexa.output.notifyError(
|
|
15007
|
+
'Command "packmind-cli standards create" has been removed.',
|
|
15008
|
+
{
|
|
15009
|
+
content: 'Use the "playbook add" command instead:',
|
|
15010
|
+
exampleCommand: "packmind-cli playbook add .packmind/standards/my-standard.md"
|
|
15011
|
+
}
|
|
15305
15012
|
);
|
|
15306
15013
|
process.exit(1);
|
|
15307
15014
|
}
|
|
15308
15015
|
});
|
|
15309
15016
|
|
|
15310
15017
|
// apps/cli/src/infra/commands/ListStandardsCommand.ts
|
|
15311
|
-
var
|
|
15018
|
+
var import_cmd_ts13 = __toESM(require_cjs());
|
|
15312
15019
|
|
|
15313
15020
|
// apps/cli/src/infra/commands/standards/listStandardsHandler.ts
|
|
15314
|
-
function groupStandardsBySpace(standards, spaces) {
|
|
15315
|
-
const spaceMap = new Map(
|
|
15316
|
-
spaces.map((s) => [s.id, s])
|
|
15317
|
-
);
|
|
15318
|
-
const groupsMap = /* @__PURE__ */ new Map();
|
|
15319
|
-
const orphaned = [];
|
|
15320
|
-
for (const standard of standards) {
|
|
15321
|
-
const space = spaceMap.get(standard.spaceId);
|
|
15322
|
-
if (!space) {
|
|
15323
|
-
orphaned.push(standard);
|
|
15324
|
-
continue;
|
|
15325
|
-
}
|
|
15326
|
-
let group = groupsMap.get(space.id);
|
|
15327
|
-
if (!group) {
|
|
15328
|
-
group = { space, items: [] };
|
|
15329
|
-
groupsMap.set(space.id, group);
|
|
15330
|
-
}
|
|
15331
|
-
group.items.push(standard);
|
|
15332
|
-
}
|
|
15333
|
-
const groups = [...groupsMap.values()].sort(
|
|
15334
|
-
(a, b) => a.space.name.localeCompare(b.space.name)
|
|
15335
|
-
);
|
|
15336
|
-
return { groups, orphaned };
|
|
15337
|
-
}
|
|
15338
|
-
function displayGroupedStandards(standards, spaces, buildUrl) {
|
|
15339
|
-
const { groups, orphaned } = groupStandardsBySpace(standards, spaces);
|
|
15340
|
-
for (const { space, items } of groups) {
|
|
15341
|
-
logConsole(`Space "${space.name}":
|
|
15342
|
-
`);
|
|
15343
|
-
for (const standard of [...items].sort(
|
|
15344
|
-
(a, b) => a.slug.localeCompare(b.slug)
|
|
15345
|
-
)) {
|
|
15346
|
-
logConsole(` ${formatSlug(standard.slug)}`);
|
|
15347
|
-
logConsole(` ${formatLabel("Name:")} ${standard.name}`);
|
|
15348
|
-
if (standard.description) {
|
|
15349
|
-
const descriptionLines = standard.description.trim().split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
15350
|
-
const firstLine = descriptionLines[0];
|
|
15351
|
-
if (firstLine) {
|
|
15352
|
-
const truncated = firstLine.length > 80 ? firstLine.slice(0, 77) + "..." : firstLine;
|
|
15353
|
-
logConsole(` ${formatLabel("Desc:")} ${truncated}`);
|
|
15354
|
-
}
|
|
15355
|
-
}
|
|
15356
|
-
const url = buildUrl(space.slug, standard.id);
|
|
15357
|
-
if (url) {
|
|
15358
|
-
logConsole(` ${formatLabel("Link:")} ${url}`);
|
|
15359
|
-
}
|
|
15360
|
-
logConsole("");
|
|
15361
|
-
}
|
|
15362
|
-
}
|
|
15363
|
-
for (const standard of [...orphaned].sort(
|
|
15364
|
-
(a, b) => a.slug.localeCompare(b.slug)
|
|
15365
|
-
)) {
|
|
15366
|
-
logConsole(` ${formatSlug(standard.slug)}`);
|
|
15367
|
-
logConsole(` ${formatLabel("Name:")} ${standard.name}`);
|
|
15368
|
-
logConsole("");
|
|
15369
|
-
}
|
|
15370
|
-
}
|
|
15371
15021
|
async function listStandardsHandler(args2, deps) {
|
|
15372
15022
|
const { packmindCliHexa, exit } = deps;
|
|
15373
15023
|
try {
|
|
15374
|
-
|
|
15375
|
-
|
|
15024
|
+
const spaces = await packmindCliHexa.output.withLoader(
|
|
15025
|
+
"Fetching spaces",
|
|
15026
|
+
() => packmindCliHexa.getSpaces()
|
|
15027
|
+
);
|
|
15376
15028
|
const matchedSpace = resolveSpaceFromArgs(args2.space, spaces);
|
|
15377
15029
|
if (args2.space && !matchedSpace) {
|
|
15378
|
-
|
|
15030
|
+
const availableSpaces = spaces.map((space) => ` - @${space.slug}`).join("\n");
|
|
15031
|
+
packmindCliHexa.output.notifyError(`Space "@${args2.space}" not found.`, {
|
|
15032
|
+
content: `Available spaces:
|
|
15033
|
+
${availableSpaces}`
|
|
15034
|
+
});
|
|
15379
15035
|
exit(1);
|
|
15380
15036
|
return;
|
|
15381
15037
|
}
|
|
15382
|
-
const standards = await packmindCliHexa.
|
|
15383
|
-
|
|
15038
|
+
const standards = await packmindCliHexa.output.withLoader(
|
|
15039
|
+
"Fetching standards",
|
|
15040
|
+
() => packmindCliHexa.listStandards(
|
|
15041
|
+
matchedSpace ? { spaceId: matchedSpace.id } : {}
|
|
15042
|
+
)
|
|
15384
15043
|
);
|
|
15385
15044
|
if (standards.length === 0) {
|
|
15386
|
-
|
|
15045
|
+
packmindCliHexa.output.notifyInfo(
|
|
15387
15046
|
matchedSpace ? `No standards found in space "@${matchedSpace.slug}".` : "No standards found."
|
|
15388
15047
|
);
|
|
15389
15048
|
exit(0);
|
|
15390
15049
|
return;
|
|
15391
15050
|
}
|
|
15392
|
-
|
|
15393
|
-
`));
|
|
15051
|
+
const groupedStandards = groupArtefactBySpaces(standards, spaces);
|
|
15394
15052
|
const buildUrl = resolveUrlBuilder((id) => `standards/${id}/summary`);
|
|
15395
|
-
|
|
15053
|
+
const scopedArtefacts = groupedStandards.map(({ space, artefacts }) => ({
|
|
15054
|
+
title: `Space: ${space.name}`,
|
|
15055
|
+
artefacts: artefacts.map((s) => ({
|
|
15056
|
+
title: s.name,
|
|
15057
|
+
slug: s.slug,
|
|
15058
|
+
url: buildUrl(space.slug, s.id)
|
|
15059
|
+
}))
|
|
15060
|
+
}));
|
|
15061
|
+
packmindCliHexa.output.listScopedArtefacts(
|
|
15062
|
+
`\u{1F4CB} Standards (${standards.length})`,
|
|
15063
|
+
scopedArtefacts
|
|
15064
|
+
);
|
|
15396
15065
|
exit(0);
|
|
15397
15066
|
} catch (err) {
|
|
15398
|
-
|
|
15399
|
-
|
|
15067
|
+
packmindCliHexa.output.notifyError("Failed to list standards:", {
|
|
15068
|
+
content: err instanceof Error ? err.message : String(err)
|
|
15069
|
+
});
|
|
15400
15070
|
exit(1);
|
|
15401
15071
|
}
|
|
15402
15072
|
}
|
|
15403
15073
|
|
|
15404
15074
|
// apps/cli/src/infra/commands/ListStandardsCommand.ts
|
|
15405
|
-
var listStandardsCommand = (0,
|
|
15075
|
+
var listStandardsCommand = (0, import_cmd_ts13.command)({
|
|
15406
15076
|
name: "list",
|
|
15407
15077
|
description: "List available coding standards",
|
|
15408
15078
|
args: {
|
|
15409
|
-
space: (0,
|
|
15410
|
-
type: (0,
|
|
15079
|
+
space: (0, import_cmd_ts13.option)({
|
|
15080
|
+
type: (0, import_cmd_ts13.optional)(SpaceSlug),
|
|
15411
15081
|
long: "space",
|
|
15412
15082
|
description: "Filter standards by space slug"
|
|
15413
15083
|
})
|
|
@@ -15426,7 +15096,7 @@ var listStandardsCommand = (0, import_cmd_ts14.command)({
|
|
|
15426
15096
|
});
|
|
15427
15097
|
|
|
15428
15098
|
// apps/cli/src/infra/commands/StandardsCommand.ts
|
|
15429
|
-
var standardsCommand = (0,
|
|
15099
|
+
var standardsCommand = (0, import_cmd_ts14.subcommands)({
|
|
15430
15100
|
name: "standards",
|
|
15431
15101
|
description: "Manage coding standards",
|
|
15432
15102
|
cmds: {
|
|
@@ -15436,130 +15106,103 @@ var standardsCommand = (0, import_cmd_ts15.subcommands)({
|
|
|
15436
15106
|
});
|
|
15437
15107
|
|
|
15438
15108
|
// apps/cli/src/infra/commands/CommandsCommand.ts
|
|
15439
|
-
var
|
|
15109
|
+
var import_cmd_ts17 = __toESM(require_cjs());
|
|
15440
15110
|
|
|
15441
15111
|
// apps/cli/src/infra/commands/CreateCommandCommand.ts
|
|
15442
|
-
var
|
|
15443
|
-
var createCommandCommand = (0,
|
|
15112
|
+
var import_cmd_ts15 = __toESM(require_cjs());
|
|
15113
|
+
var createCommandCommand = (0, import_cmd_ts15.command)({
|
|
15444
15114
|
name: "create",
|
|
15445
15115
|
description: "[Deprecated] Create a command from a playbook JSON file or stdin",
|
|
15446
15116
|
args: {
|
|
15447
|
-
file: (0,
|
|
15117
|
+
file: (0, import_cmd_ts15.positional)({
|
|
15448
15118
|
displayName: "file",
|
|
15449
15119
|
description: "Path to the command playbook JSON file (reads from stdin if omitted)",
|
|
15450
|
-
type: (0,
|
|
15120
|
+
type: (0, import_cmd_ts15.optional)(import_cmd_ts15.string)
|
|
15451
15121
|
}),
|
|
15452
|
-
space: (0,
|
|
15122
|
+
space: (0, import_cmd_ts15.option)({
|
|
15453
15123
|
long: "space",
|
|
15454
15124
|
description: "Slug of the space in which to create the command",
|
|
15455
|
-
type: (0,
|
|
15125
|
+
type: (0, import_cmd_ts15.optional)(SpaceSlug)
|
|
15456
15126
|
}),
|
|
15457
15127
|
originSkill: originSkillOption
|
|
15458
15128
|
},
|
|
15459
15129
|
handler: async () => {
|
|
15460
|
-
|
|
15461
|
-
|
|
15462
|
-
|
|
15130
|
+
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
15131
|
+
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
15132
|
+
packmindCliHexa.output.notifyError(
|
|
15133
|
+
'Command "packmind-cli commands create" has been removed.',
|
|
15134
|
+
{
|
|
15135
|
+
content: 'Use the "playbook add" command instead:',
|
|
15136
|
+
exampleCommand: "packmind-cli playbook add .packmind/commands/my-command.md"
|
|
15137
|
+
}
|
|
15463
15138
|
);
|
|
15464
15139
|
process.exit(1);
|
|
15465
15140
|
}
|
|
15466
15141
|
});
|
|
15467
15142
|
|
|
15468
15143
|
// apps/cli/src/infra/commands/ListCommandsCommand.ts
|
|
15469
|
-
var
|
|
15144
|
+
var import_cmd_ts16 = __toESM(require_cjs());
|
|
15470
15145
|
|
|
15471
15146
|
// apps/cli/src/infra/commands/commands/listCommandsHandler.ts
|
|
15472
|
-
function groupCommandsBySpace(commands, spaces) {
|
|
15473
|
-
const spaceMap = new Map(
|
|
15474
|
-
spaces.map((s) => [s.id, s])
|
|
15475
|
-
);
|
|
15476
|
-
const groupsMap = /* @__PURE__ */ new Map();
|
|
15477
|
-
const orphaned = [];
|
|
15478
|
-
for (const cmd of commands) {
|
|
15479
|
-
const space = spaceMap.get(cmd.spaceId);
|
|
15480
|
-
if (!space) {
|
|
15481
|
-
orphaned.push(cmd);
|
|
15482
|
-
continue;
|
|
15483
|
-
}
|
|
15484
|
-
let group = groupsMap.get(space.id);
|
|
15485
|
-
if (!group) {
|
|
15486
|
-
group = { space, cmds: [] };
|
|
15487
|
-
groupsMap.set(space.id, group);
|
|
15488
|
-
}
|
|
15489
|
-
group.cmds.push(cmd);
|
|
15490
|
-
}
|
|
15491
|
-
const groups = [...groupsMap.values()].sort(
|
|
15492
|
-
(a, b) => a.space.name.localeCompare(b.space.name)
|
|
15493
|
-
);
|
|
15494
|
-
return { groups, orphaned };
|
|
15495
|
-
}
|
|
15496
|
-
function displayGroupedCommands(commands, spaces, buildUrl) {
|
|
15497
|
-
const { groups, orphaned } = groupCommandsBySpace(commands, spaces);
|
|
15498
|
-
for (const { space, cmds } of groups) {
|
|
15499
|
-
logConsole(`Space "${space.name}":
|
|
15500
|
-
`);
|
|
15501
|
-
for (const cmd of [...cmds].sort((a, b) => a.slug.localeCompare(b.slug))) {
|
|
15502
|
-
logConsole(` ${formatSlug(cmd.slug)}`);
|
|
15503
|
-
logConsole(` ${formatLabel("Name:")} ${cmd.name}`);
|
|
15504
|
-
const url = buildUrl(space.slug, cmd.id);
|
|
15505
|
-
if (url) {
|
|
15506
|
-
logConsole(` ${formatLabel("Link:")} ${url}`);
|
|
15507
|
-
}
|
|
15508
|
-
logConsole("");
|
|
15509
|
-
}
|
|
15510
|
-
}
|
|
15511
|
-
for (const cmd of [...orphaned].sort(
|
|
15512
|
-
(a, b) => a.slug.localeCompare(b.slug)
|
|
15513
|
-
)) {
|
|
15514
|
-
logConsole(` ${formatSlug(cmd.slug)}`);
|
|
15515
|
-
logConsole(` ${formatLabel("Name:")} ${cmd.name}`);
|
|
15516
|
-
logConsole("");
|
|
15517
|
-
}
|
|
15518
|
-
}
|
|
15519
15147
|
async function listCommandsHandler(args2, deps) {
|
|
15520
15148
|
const { packmindCliHexa, exit } = deps;
|
|
15521
15149
|
try {
|
|
15522
|
-
|
|
15523
|
-
|
|
15150
|
+
const spaces = await packmindCliHexa.output.withLoader(
|
|
15151
|
+
"Fetching spaces",
|
|
15152
|
+
() => packmindCliHexa.getSpaces()
|
|
15153
|
+
);
|
|
15524
15154
|
const matchedSpace = resolveSpaceFromArgs(args2.space, spaces);
|
|
15525
15155
|
if (args2.space && !matchedSpace) {
|
|
15526
|
-
|
|
15156
|
+
const availableSpaces = spaces.map((space) => ` - @${space.slug}`).join("\n");
|
|
15157
|
+
packmindCliHexa.output.notifyError(`Space "@${args2.space}" not found.`, {
|
|
15158
|
+
content: `Available spaces:
|
|
15159
|
+
${availableSpaces}`
|
|
15160
|
+
});
|
|
15527
15161
|
exit(1);
|
|
15528
15162
|
return;
|
|
15529
15163
|
}
|
|
15530
|
-
const commands = await packmindCliHexa.
|
|
15531
|
-
|
|
15164
|
+
const commands = await packmindCliHexa.output.withLoader(
|
|
15165
|
+
"Fetching commands",
|
|
15166
|
+
() => packmindCliHexa.listCommands(
|
|
15167
|
+
matchedSpace ? { spaceId: matchedSpace.id } : {}
|
|
15168
|
+
)
|
|
15532
15169
|
);
|
|
15533
15170
|
if (commands.length === 0) {
|
|
15534
|
-
|
|
15171
|
+
packmindCliHexa.output.notifyInfo(
|
|
15535
15172
|
matchedSpace ? `No commands found in space "@${matchedSpace.slug}".` : "No commands found."
|
|
15536
15173
|
);
|
|
15537
15174
|
exit(0);
|
|
15538
15175
|
return;
|
|
15539
15176
|
}
|
|
15540
|
-
|
|
15541
|
-
`));
|
|
15177
|
+
const groupedCommands = groupArtefactBySpaces(commands, spaces);
|
|
15542
15178
|
const buildUrl = resolveUrlBuilder((id) => `commands/${id}`);
|
|
15543
|
-
|
|
15179
|
+
packmindCliHexa.output.listScopedArtefacts(
|
|
15180
|
+
`\u{1F4CB} Commands (${commands.length})`,
|
|
15181
|
+
groupedCommands.map(({ space, artefacts }) => ({
|
|
15182
|
+
title: `Space: ${space.name}`,
|
|
15183
|
+
artefacts: artefacts.map((cmd) => ({
|
|
15184
|
+
title: cmd.name,
|
|
15185
|
+
slug: cmd.slug,
|
|
15186
|
+
url: buildUrl(space.slug, cmd.id)
|
|
15187
|
+
}))
|
|
15188
|
+
}))
|
|
15189
|
+
);
|
|
15544
15190
|
exit(0);
|
|
15545
15191
|
} catch (err) {
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
} else {
|
|
15550
|
-
logErrorConsole(String(err));
|
|
15551
|
-
}
|
|
15192
|
+
packmindCliHexa.output.notifyError("Failed to list commands:", {
|
|
15193
|
+
content: err instanceof Error ? err.message : String(err)
|
|
15194
|
+
});
|
|
15552
15195
|
exit(1);
|
|
15553
15196
|
}
|
|
15554
15197
|
}
|
|
15555
15198
|
|
|
15556
15199
|
// apps/cli/src/infra/commands/ListCommandsCommand.ts
|
|
15557
|
-
var listCommandsCommand = (0,
|
|
15200
|
+
var listCommandsCommand = (0, import_cmd_ts16.command)({
|
|
15558
15201
|
name: "list",
|
|
15559
15202
|
description: "List available commands",
|
|
15560
15203
|
args: {
|
|
15561
|
-
space: (0,
|
|
15562
|
-
type: (0,
|
|
15204
|
+
space: (0, import_cmd_ts16.option)({
|
|
15205
|
+
type: (0, import_cmd_ts16.optional)(SpaceSlug),
|
|
15563
15206
|
long: "space",
|
|
15564
15207
|
description: "Filter commands by space slug"
|
|
15565
15208
|
})
|
|
@@ -15576,7 +15219,7 @@ var listCommandsCommand = (0, import_cmd_ts17.command)({
|
|
|
15576
15219
|
});
|
|
15577
15220
|
|
|
15578
15221
|
// apps/cli/src/infra/commands/CommandsCommand.ts
|
|
15579
|
-
var commandsCommand = (0,
|
|
15222
|
+
var commandsCommand = (0, import_cmd_ts17.subcommands)({
|
|
15580
15223
|
name: "commands",
|
|
15581
15224
|
description: "Manage commands",
|
|
15582
15225
|
cmds: {
|
|
@@ -15586,11 +15229,11 @@ var commandsCommand = (0, import_cmd_ts18.subcommands)({
|
|
|
15586
15229
|
});
|
|
15587
15230
|
|
|
15588
15231
|
// apps/cli/src/infra/commands/DiffCommand.ts
|
|
15589
|
-
var
|
|
15232
|
+
var import_cmd_ts18 = __toESM(require_cjs());
|
|
15590
15233
|
|
|
15591
15234
|
// apps/cli/src/infra/commands/playbook/diffArtefactsHandler.ts
|
|
15592
15235
|
var nodePath = __toESM(require("path"));
|
|
15593
|
-
var
|
|
15236
|
+
var fs19 = __toESM(require("fs/promises"));
|
|
15594
15237
|
|
|
15595
15238
|
// apps/cli/src/infra/utils/diffFormatter.ts
|
|
15596
15239
|
var import_diff4 = require("diff");
|
|
@@ -15889,7 +15532,7 @@ async function diffArtefactsHandler(deps) {
|
|
|
15889
15532
|
const searchPath = nodePath.resolve(cwd, deps.path ?? ".");
|
|
15890
15533
|
if (deps.path !== void 0) {
|
|
15891
15534
|
try {
|
|
15892
|
-
await
|
|
15535
|
+
await fs19.stat(searchPath);
|
|
15893
15536
|
} catch {
|
|
15894
15537
|
logErrorConsole(`Path does not exist: ${searchPath}`);
|
|
15895
15538
|
exit(1);
|
|
@@ -16019,37 +15662,37 @@ async function diffArtefactsHandler(deps) {
|
|
|
16019
15662
|
}
|
|
16020
15663
|
|
|
16021
15664
|
// apps/cli/src/infra/commands/DiffCommand.ts
|
|
16022
|
-
var diffCommand = (0,
|
|
15665
|
+
var diffCommand = (0, import_cmd_ts18.command)({
|
|
16023
15666
|
name: "diff",
|
|
16024
15667
|
description: "[Deprecated] Use `playbook diff` commands instead. Run for migration guidance",
|
|
16025
15668
|
args: {
|
|
16026
|
-
submit: (0,
|
|
15669
|
+
submit: (0, import_cmd_ts18.flag)({
|
|
16027
15670
|
long: "submit",
|
|
16028
15671
|
description: "Submit detected changes as change proposals"
|
|
16029
15672
|
}),
|
|
16030
|
-
includeSubmitted: (0,
|
|
15673
|
+
includeSubmitted: (0, import_cmd_ts18.flag)({
|
|
16031
15674
|
long: "include-submitted",
|
|
16032
15675
|
description: "Include already submitted changes in the output"
|
|
16033
15676
|
}),
|
|
16034
|
-
message: (0,
|
|
15677
|
+
message: (0, import_cmd_ts18.option)({
|
|
16035
15678
|
long: "message",
|
|
16036
15679
|
short: "m",
|
|
16037
15680
|
description: "Message describing the intent behind the changes (max 1024 chars)",
|
|
16038
|
-
type: (0,
|
|
15681
|
+
type: (0, import_cmd_ts18.optional)(import_cmd_ts18.string)
|
|
16039
15682
|
}),
|
|
16040
|
-
path: (0,
|
|
15683
|
+
path: (0, import_cmd_ts18.option)({
|
|
16041
15684
|
long: "path",
|
|
16042
15685
|
short: "p",
|
|
16043
15686
|
description: "Path to analyze (relative to current directory)",
|
|
16044
|
-
type: (0,
|
|
15687
|
+
type: (0, import_cmd_ts18.optional)(import_cmd_ts18.string)
|
|
16045
15688
|
}),
|
|
16046
|
-
positionals: (0,
|
|
16047
|
-
type:
|
|
15689
|
+
positionals: (0, import_cmd_ts18.restPositionals)({
|
|
15690
|
+
type: import_cmd_ts18.string,
|
|
16048
15691
|
displayName: "args",
|
|
16049
15692
|
description: "Subcommand and arguments (e.g., add <path>, remove <path>)"
|
|
16050
15693
|
})
|
|
16051
15694
|
},
|
|
16052
|
-
handler: async ({ submit, includeSubmitted, message, path:
|
|
15695
|
+
handler: async ({ submit, includeSubmitted, message, path: path35, positionals }) => {
|
|
16053
15696
|
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
16054
15697
|
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
16055
15698
|
if (submit) {
|
|
@@ -16065,7 +15708,7 @@ var diffCommand = (0, import_cmd_ts19.command)({
|
|
|
16065
15708
|
process.exit(1);
|
|
16066
15709
|
}
|
|
16067
15710
|
if (positionals[0] === "add") {
|
|
16068
|
-
const addFilePath =
|
|
15711
|
+
const addFilePath = path35 && positionals[1] ? `${path35}/${positionals[1]}`.replace(/\/+/g, "/") : positionals[1];
|
|
16069
15712
|
const addCommand = `packmind-cli playbook add ${addFilePath}`;
|
|
16070
15713
|
logErrorConsole("Deprecated: `packmind-cli diff add` has been removed");
|
|
16071
15714
|
logInfoConsole("Use the following command instead:");
|
|
@@ -16073,7 +15716,7 @@ var diffCommand = (0, import_cmd_ts19.command)({
|
|
|
16073
15716
|
process.exit(1);
|
|
16074
15717
|
}
|
|
16075
15718
|
if (positionals[0] === "remove" || positionals[0] === "rm") {
|
|
16076
|
-
const removeFilePath =
|
|
15719
|
+
const removeFilePath = path35 && positionals[1] ? `${path35}/${positionals[1]}`.replace(/\/+/g, "/") : positionals[1];
|
|
16077
15720
|
const removeCommand = `packmind-cli playbook remove ${removeFilePath}`;
|
|
16078
15721
|
logErrorConsole(
|
|
16079
15722
|
"Deprecated: `packmind-cli diff remove` has been removed"
|
|
@@ -16082,7 +15725,7 @@ var diffCommand = (0, import_cmd_ts19.command)({
|
|
|
16082
15725
|
logInfoConsole(` ${formatCommand(removeCommand)}`);
|
|
16083
15726
|
process.exit(1);
|
|
16084
15727
|
}
|
|
16085
|
-
const diffCommand3 = `packmind-cli playbook diff${includeSubmitted ? " --include-submitted" : ""}${
|
|
15728
|
+
const diffCommand3 = `packmind-cli playbook diff${includeSubmitted ? " --include-submitted" : ""}${path35 ? ` --path ${path35}` : ""}`;
|
|
16086
15729
|
logErrorConsole("Deprecated: `packmind-cli diff` will be removed");
|
|
16087
15730
|
logInfoConsole("Use the following command instead:");
|
|
16088
15731
|
logInfoConsole(` ${formatCommand(diffCommand3)}`);
|
|
@@ -16092,16 +15735,16 @@ var diffCommand = (0, import_cmd_ts19.command)({
|
|
|
16092
15735
|
getCwd: () => process.cwd(),
|
|
16093
15736
|
log: console.log,
|
|
16094
15737
|
includeSubmitted,
|
|
16095
|
-
path:
|
|
15738
|
+
path: path35
|
|
16096
15739
|
});
|
|
16097
15740
|
}
|
|
16098
15741
|
});
|
|
16099
15742
|
|
|
16100
15743
|
// apps/cli/src/infra/commands/PackagesCommand.ts
|
|
16101
|
-
var
|
|
15744
|
+
var import_cmd_ts23 = __toESM(require_cjs());
|
|
16102
15745
|
|
|
16103
15746
|
// apps/cli/src/infra/commands/CreatePackageCommand.ts
|
|
16104
|
-
var
|
|
15747
|
+
var import_cmd_ts19 = __toESM(require_cjs());
|
|
16105
15748
|
|
|
16106
15749
|
// apps/cli/src/infra/commands/packages/createPackageHandler.ts
|
|
16107
15750
|
function toExpectedSlug(name) {
|
|
@@ -16158,15 +15801,15 @@ var CreatePackageUseCase = class {
|
|
|
16158
15801
|
this.gateway = gateway;
|
|
16159
15802
|
this.spaceService = spaceService;
|
|
16160
15803
|
}
|
|
16161
|
-
async execute(
|
|
16162
|
-
const space = await this.getSpace(
|
|
15804
|
+
async execute(command32) {
|
|
15805
|
+
const space = await this.getSpace(command32);
|
|
16163
15806
|
const result = await this.gateway.packages.create({
|
|
16164
15807
|
spaceId: space.id,
|
|
16165
|
-
name:
|
|
16166
|
-
description:
|
|
15808
|
+
name: command32.name,
|
|
15809
|
+
description: command32.description ?? "",
|
|
16167
15810
|
recipeIds: [],
|
|
16168
15811
|
standardIds: [],
|
|
16169
|
-
originSkill:
|
|
15812
|
+
originSkill: command32.originSkill
|
|
16170
15813
|
});
|
|
16171
15814
|
return {
|
|
16172
15815
|
packageId: result.package.id,
|
|
@@ -16175,12 +15818,12 @@ var CreatePackageUseCase = class {
|
|
|
16175
15818
|
spaceSlug: space.slug
|
|
16176
15819
|
};
|
|
16177
15820
|
}
|
|
16178
|
-
async getSpace(
|
|
15821
|
+
async getSpace(command32) {
|
|
16179
15822
|
const spaces = await this.spaceService.getSpaces();
|
|
16180
|
-
if (
|
|
16181
|
-
const found = spaces.find((s) => s.slug ===
|
|
15823
|
+
if (command32.spaceSlug) {
|
|
15824
|
+
const found = spaces.find((s) => s.slug === command32.spaceSlug);
|
|
16182
15825
|
if (!found) {
|
|
16183
|
-
throw new Error(`Space '${
|
|
15826
|
+
throw new Error(`Space '${command32.spaceSlug}' not found.`);
|
|
16184
15827
|
}
|
|
16185
15828
|
return found;
|
|
16186
15829
|
}
|
|
@@ -16198,25 +15841,25 @@ ${spaceList}`
|
|
|
16198
15841
|
};
|
|
16199
15842
|
|
|
16200
15843
|
// apps/cli/src/infra/commands/CreatePackageCommand.ts
|
|
16201
|
-
var createPackageCommand = (0,
|
|
15844
|
+
var createPackageCommand = (0, import_cmd_ts19.command)({
|
|
16202
15845
|
name: "create",
|
|
16203
15846
|
description: "Create a new package",
|
|
16204
15847
|
args: {
|
|
16205
|
-
name: (0,
|
|
15848
|
+
name: (0, import_cmd_ts19.positional)({
|
|
16206
15849
|
displayName: "name",
|
|
16207
15850
|
description: "Name of the package to create",
|
|
16208
|
-
type:
|
|
15851
|
+
type: import_cmd_ts19.string
|
|
16209
15852
|
}),
|
|
16210
|
-
description: (0,
|
|
15853
|
+
description: (0, import_cmd_ts19.option)({
|
|
16211
15854
|
long: "description",
|
|
16212
15855
|
short: "d",
|
|
16213
15856
|
description: "Description of the package (optional)",
|
|
16214
|
-
type: (0,
|
|
15857
|
+
type: (0, import_cmd_ts19.optional)(import_cmd_ts19.string)
|
|
16215
15858
|
}),
|
|
16216
|
-
space: (0,
|
|
15859
|
+
space: (0, import_cmd_ts19.option)({
|
|
16217
15860
|
long: "space",
|
|
16218
15861
|
description: "Slug of the space in which to create the package",
|
|
16219
|
-
type: (0,
|
|
15862
|
+
type: (0, import_cmd_ts19.optional)(SpaceSlug)
|
|
16220
15863
|
}),
|
|
16221
15864
|
originSkill: originSkillOption
|
|
16222
15865
|
},
|
|
@@ -16270,7 +15913,7 @@ var createPackageCommand = (0, import_cmd_ts20.command)({
|
|
|
16270
15913
|
});
|
|
16271
15914
|
|
|
16272
15915
|
// apps/cli/src/infra/commands/AddToPackageCommand.ts
|
|
16273
|
-
var
|
|
15916
|
+
var import_cmd_ts20 = __toESM(require_cjs());
|
|
16274
15917
|
|
|
16275
15918
|
// apps/cli/src/domain/errors/ItemNotFoundError.ts
|
|
16276
15919
|
var ItemNotFoundError = class extends Error {
|
|
@@ -16290,8 +15933,8 @@ var AddToPackageUseCase = class {
|
|
|
16290
15933
|
this.gateway = gateway;
|
|
16291
15934
|
this.spaceService = spaceService;
|
|
16292
15935
|
}
|
|
16293
|
-
async execute(
|
|
16294
|
-
const { packageSlug, spaceSlug, itemType, itemSlugs } =
|
|
15936
|
+
async execute(command32) {
|
|
15937
|
+
const { packageSlug, spaceSlug, itemType, itemSlugs } = command32;
|
|
16295
15938
|
const space = spaceSlug ? await this.resolveSpaceBySlug(spaceSlug) : await this.spaceService.getDefaultSpace();
|
|
16296
15939
|
const packages = await this.gateway.packages.list({
|
|
16297
15940
|
spaceId: space.id
|
|
@@ -16312,7 +15955,7 @@ var AddToPackageUseCase = class {
|
|
|
16312
15955
|
standardIds: [],
|
|
16313
15956
|
recipeIds: [],
|
|
16314
15957
|
skillIds: [],
|
|
16315
|
-
originSkill:
|
|
15958
|
+
originSkill: command32.originSkill
|
|
16316
15959
|
};
|
|
16317
15960
|
if (itemType === "standard") {
|
|
16318
15961
|
addCommand.standardIds = ids.map(createStandardId);
|
|
@@ -16364,7 +16007,7 @@ var AddToPackageUseCase = class {
|
|
|
16364
16007
|
}
|
|
16365
16008
|
async findCommandBySlug(slug3, spaceId) {
|
|
16366
16009
|
const commands = await this.gateway.commands.list({ spaceId });
|
|
16367
|
-
return commands.recipes.find((
|
|
16010
|
+
return commands.recipes.find((command32) => command32.slug === slug3) ?? null;
|
|
16368
16011
|
}
|
|
16369
16012
|
async findSkillBySlug(slug3, spaceId) {
|
|
16370
16013
|
const skills = await this.gateway.skills.list({ spaceId });
|
|
@@ -16450,11 +16093,11 @@ async function executeAddToPackage(pkgSlug, spaceSlug, itemType, itemSlugs, useC
|
|
|
16450
16093
|
logErrorConsole(message);
|
|
16451
16094
|
if (error instanceof ItemNotFoundError) {
|
|
16452
16095
|
const spaceFlag = error.spaceSlug ? ` --space ${error.spaceSlug}` : "";
|
|
16453
|
-
const
|
|
16096
|
+
const command32 = formatCommand(
|
|
16454
16097
|
`packmind-cli ${error.itemType}s list${spaceFlag}`
|
|
16455
16098
|
);
|
|
16456
16099
|
logInfoConsole(
|
|
16457
|
-
`Run \`${
|
|
16100
|
+
`Run \`${command32}\` to display available ${error.itemType}s`
|
|
16458
16101
|
);
|
|
16459
16102
|
}
|
|
16460
16103
|
return { success: false, error: message };
|
|
@@ -16480,29 +16123,29 @@ async function addToPackageHandler(args2, deps) {
|
|
|
16480
16123
|
}
|
|
16481
16124
|
|
|
16482
16125
|
// apps/cli/src/infra/commands/AddToPackageCommand.ts
|
|
16483
|
-
var addToPackageCommand = (0,
|
|
16126
|
+
var addToPackageCommand = (0, import_cmd_ts20.command)({
|
|
16484
16127
|
name: "add",
|
|
16485
16128
|
description: "Add standards, commands, or skills to a package",
|
|
16486
16129
|
args: {
|
|
16487
|
-
to: (0,
|
|
16130
|
+
to: (0, import_cmd_ts20.option)({
|
|
16488
16131
|
long: "to",
|
|
16489
16132
|
description: "Target package slug (use @space/package format when multiple spaces exist)",
|
|
16490
|
-
type:
|
|
16133
|
+
type: import_cmd_ts20.string
|
|
16491
16134
|
}),
|
|
16492
|
-
standards: (0,
|
|
16135
|
+
standards: (0, import_cmd_ts20.multioption)({
|
|
16493
16136
|
long: "standard",
|
|
16494
16137
|
description: "Standard slug(s) to add",
|
|
16495
|
-
type: (0,
|
|
16138
|
+
type: (0, import_cmd_ts20.array)(import_cmd_ts20.string)
|
|
16496
16139
|
}),
|
|
16497
|
-
commands: (0,
|
|
16140
|
+
commands: (0, import_cmd_ts20.multioption)({
|
|
16498
16141
|
long: "command",
|
|
16499
16142
|
description: "Command slug(s) to add",
|
|
16500
|
-
type: (0,
|
|
16143
|
+
type: (0, import_cmd_ts20.array)(import_cmd_ts20.string)
|
|
16501
16144
|
}),
|
|
16502
|
-
skills: (0,
|
|
16145
|
+
skills: (0, import_cmd_ts20.multioption)({
|
|
16503
16146
|
long: "skill",
|
|
16504
16147
|
description: "Skill slug(s) to add",
|
|
16505
|
-
type: (0,
|
|
16148
|
+
type: (0, import_cmd_ts20.array)(import_cmd_ts20.string)
|
|
16506
16149
|
}),
|
|
16507
16150
|
originSkill: originSkillOption
|
|
16508
16151
|
},
|
|
@@ -16538,111 +16181,79 @@ var addToPackageCommand = (0, import_cmd_ts21.command)({
|
|
|
16538
16181
|
});
|
|
16539
16182
|
|
|
16540
16183
|
// apps/cli/src/infra/commands/listPackagesCommand.ts
|
|
16541
|
-
var
|
|
16184
|
+
var import_cmd_ts21 = __toESM(require_cjs());
|
|
16542
16185
|
|
|
16543
16186
|
// apps/cli/src/infra/commands/packages/listPackagesHandler.ts
|
|
16544
|
-
function logPackageEntry(pkg, fullSlug, spaceSlug, buildUrl) {
|
|
16545
|
-
logConsole(`- ${formatSlug(fullSlug)}`);
|
|
16546
|
-
logConsole(` ${formatLabel("Name:")} ${pkg.name}`);
|
|
16547
|
-
const url = buildUrl(spaceSlug, pkg.id);
|
|
16548
|
-
if (url) {
|
|
16549
|
-
logConsole(` ${formatLabel("Link:")} ${url}`);
|
|
16550
|
-
}
|
|
16551
|
-
if (pkg.description) {
|
|
16552
|
-
const lines = pkg.description.trim().split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
|
|
16553
|
-
const [first, ...rest] = lines;
|
|
16554
|
-
logConsole(` ${formatLabel("Description:")} ${first}`);
|
|
16555
|
-
rest.forEach((l) => logConsole(` ${l}`));
|
|
16556
|
-
}
|
|
16557
|
-
}
|
|
16558
|
-
function groupPackagesBySpace(packages, spaces) {
|
|
16559
|
-
const spaceMap = new Map(
|
|
16560
|
-
spaces.map((s) => [s.id, s])
|
|
16561
|
-
);
|
|
16562
|
-
const groupsMap = /* @__PURE__ */ new Map();
|
|
16563
|
-
for (const pkg of packages) {
|
|
16564
|
-
const space = spaceMap.get(pkg.spaceId);
|
|
16565
|
-
if (!space) {
|
|
16566
|
-
continue;
|
|
16567
|
-
}
|
|
16568
|
-
let group = groupsMap.get(space.id);
|
|
16569
|
-
if (!group) {
|
|
16570
|
-
group = { space, pkgs: [] };
|
|
16571
|
-
groupsMap.set(space.id, group);
|
|
16572
|
-
}
|
|
16573
|
-
group.pkgs.push(pkg);
|
|
16574
|
-
}
|
|
16575
|
-
return [...groupsMap.values()].sort(
|
|
16576
|
-
(a, b) => a.space.name.localeCompare(b.space.name)
|
|
16577
|
-
);
|
|
16578
|
-
}
|
|
16579
|
-
function displayGroupedPackages(packages, spaces, buildUrl) {
|
|
16580
|
-
const groups = groupPackagesBySpace(packages, spaces);
|
|
16581
|
-
let firstSlug = null;
|
|
16582
|
-
for (const { space, pkgs } of groups) {
|
|
16583
|
-
logConsole(`Space "${space.name}":
|
|
16584
|
-
`);
|
|
16585
|
-
for (const pkg of [...pkgs].sort((a, b) => a.slug.localeCompare(b.slug))) {
|
|
16586
|
-
const fullSlug = `@${space.slug}/${pkg.slug}`;
|
|
16587
|
-
firstSlug ??= fullSlug;
|
|
16588
|
-
logPackageEntry(pkg, fullSlug, space.slug, buildUrl);
|
|
16589
|
-
logConsole("");
|
|
16590
|
-
}
|
|
16591
|
-
}
|
|
16592
|
-
return firstSlug ?? formatSlug(packages[0].slug);
|
|
16593
|
-
}
|
|
16594
16187
|
async function listPackagesHandler(args2, deps) {
|
|
16595
16188
|
const { packmindCliHexa, exit } = deps;
|
|
16596
16189
|
try {
|
|
16597
|
-
|
|
16598
|
-
|
|
16190
|
+
const allSpaces = await packmindCliHexa.output.withLoader(
|
|
16191
|
+
"Fetching spaces",
|
|
16192
|
+
() => packmindCliHexa.getSpaces()
|
|
16193
|
+
);
|
|
16599
16194
|
if (!allSpaces || allSpaces.length === 0) {
|
|
16600
16195
|
throw new Error("Unable to list organization spaces.");
|
|
16601
16196
|
}
|
|
16602
16197
|
const matchedSpace = resolveSpaceFromArgs(args2.space, allSpaces);
|
|
16603
16198
|
if (args2.space && !matchedSpace) {
|
|
16604
|
-
|
|
16605
|
-
|
|
16606
|
-
`Available spaces:
|
|
16607
|
-
|
|
16199
|
+
const availableSpaces = allSpaces.map((s) => ` - @${s.slug}`).join("\n");
|
|
16200
|
+
packmindCliHexa.output.notifyError(`Space "@${args2.space}" not found.`, {
|
|
16201
|
+
content: `Available spaces:
|
|
16202
|
+
${availableSpaces}`
|
|
16203
|
+
});
|
|
16608
16204
|
exit(1);
|
|
16609
16205
|
return;
|
|
16610
16206
|
}
|
|
16611
|
-
const packages = await packmindCliHexa.
|
|
16612
|
-
|
|
16207
|
+
const packages = await packmindCliHexa.output.withLoader(
|
|
16208
|
+
"Fetching packages",
|
|
16209
|
+
() => packmindCliHexa.listPackages(
|
|
16210
|
+
matchedSpace ? { spaceId: matchedSpace.id } : {}
|
|
16211
|
+
)
|
|
16613
16212
|
);
|
|
16614
16213
|
const spaces = matchedSpace ? [matchedSpace] : allSpaces;
|
|
16615
16214
|
if (packages.length === 0) {
|
|
16616
|
-
|
|
16215
|
+
packmindCliHexa.output.notifyInfo(
|
|
16617
16216
|
matchedSpace ? `No packages found in space "@${matchedSpace.slug}".` : "No packages found."
|
|
16618
16217
|
);
|
|
16619
16218
|
exit(0);
|
|
16620
16219
|
return;
|
|
16621
16220
|
}
|
|
16622
16221
|
const buildUrl = resolveUrlBuilder((id) => `packages/${id}`);
|
|
16623
|
-
|
|
16624
|
-
const
|
|
16625
|
-
|
|
16626
|
-
|
|
16222
|
+
const groups = groupArtefactBySpaces(packages, spaces);
|
|
16223
|
+
const scopedArtefacts = groups.map(({ space, artefacts }) => ({
|
|
16224
|
+
title: `Space: ${space.name}`,
|
|
16225
|
+
artefacts: artefacts.map((pkg) => ({
|
|
16226
|
+
title: pkg.name,
|
|
16227
|
+
slug: `@${space.slug}/${pkg.slug}`,
|
|
16228
|
+
description: pkg.description,
|
|
16229
|
+
url: buildUrl(space.slug, pkg.id)
|
|
16230
|
+
}))
|
|
16231
|
+
}));
|
|
16232
|
+
const firstSlug = scopedArtefacts[0]?.artefacts[0]?.slug ?? `@${packages[0].slug}`;
|
|
16233
|
+
packmindCliHexa.output.listScopedArtefacts(
|
|
16234
|
+
`\u{1F4E6} Packages (${packages.length})`,
|
|
16235
|
+
scopedArtefacts,
|
|
16236
|
+
{
|
|
16237
|
+
content: "How to install a package:",
|
|
16238
|
+
exampleCommand: `packmind-cli install ${firstSlug}`
|
|
16239
|
+
}
|
|
16240
|
+
);
|
|
16627
16241
|
exit(0);
|
|
16628
16242
|
} catch (err) {
|
|
16629
|
-
|
|
16630
|
-
|
|
16631
|
-
|
|
16632
|
-
} else {
|
|
16633
|
-
logErrorConsole(String(err));
|
|
16634
|
-
}
|
|
16243
|
+
packmindCliHexa.output.notifyError("Failed to list packages:", {
|
|
16244
|
+
content: err instanceof Error ? err.message : String(err)
|
|
16245
|
+
});
|
|
16635
16246
|
exit(1);
|
|
16636
16247
|
}
|
|
16637
16248
|
}
|
|
16638
16249
|
|
|
16639
16250
|
// apps/cli/src/infra/commands/listPackagesCommand.ts
|
|
16640
|
-
var listPackagesCommand = (0,
|
|
16251
|
+
var listPackagesCommand = (0, import_cmd_ts21.command)({
|
|
16641
16252
|
name: "list",
|
|
16642
16253
|
description: "List available packages",
|
|
16643
16254
|
args: {
|
|
16644
|
-
space: (0,
|
|
16645
|
-
type: (0,
|
|
16255
|
+
space: (0, import_cmd_ts21.option)({
|
|
16256
|
+
type: (0, import_cmd_ts21.optional)(SpaceSlug),
|
|
16646
16257
|
long: "space",
|
|
16647
16258
|
description: "Filter packages by space slug"
|
|
16648
16259
|
})
|
|
@@ -16659,7 +16270,7 @@ var listPackagesCommand = (0, import_cmd_ts22.command)({
|
|
|
16659
16270
|
});
|
|
16660
16271
|
|
|
16661
16272
|
// apps/cli/src/infra/commands/packages/showPackageCommand.ts
|
|
16662
|
-
var
|
|
16273
|
+
var import_cmd_ts22 = __toESM(require_cjs());
|
|
16663
16274
|
|
|
16664
16275
|
// apps/cli/src/infra/commands/packages/showPackageHandler.ts
|
|
16665
16276
|
function isNotFoundError(err) {
|
|
@@ -16778,12 +16389,12 @@ ${pkg.name} (${fullSlug}):
|
|
|
16778
16389
|
}
|
|
16779
16390
|
|
|
16780
16391
|
// apps/cli/src/infra/commands/packages/showPackageCommand.ts
|
|
16781
|
-
var showPackageCommand = (0,
|
|
16392
|
+
var showPackageCommand = (0, import_cmd_ts22.command)({
|
|
16782
16393
|
name: "show",
|
|
16783
16394
|
description: "Show details of a specific package",
|
|
16784
16395
|
args: {
|
|
16785
|
-
slug: (0,
|
|
16786
|
-
type:
|
|
16396
|
+
slug: (0, import_cmd_ts22.positional)({
|
|
16397
|
+
type: import_cmd_ts22.string,
|
|
16787
16398
|
displayName: "package",
|
|
16788
16399
|
description: "Package slug (e.g. backend or @my-space/backend)"
|
|
16789
16400
|
})
|
|
@@ -16796,7 +16407,7 @@ var showPackageCommand = (0, import_cmd_ts23.command)({
|
|
|
16796
16407
|
});
|
|
16797
16408
|
|
|
16798
16409
|
// apps/cli/src/infra/commands/PackagesCommand.ts
|
|
16799
|
-
var packagesCommand = (0,
|
|
16410
|
+
var packagesCommand = (0, import_cmd_ts23.subcommands)({
|
|
16800
16411
|
name: "packages",
|
|
16801
16412
|
description: "Manage packages",
|
|
16802
16413
|
cmds: {
|
|
@@ -16808,24 +16419,24 @@ var packagesCommand = (0, import_cmd_ts24.subcommands)({
|
|
|
16808
16419
|
});
|
|
16809
16420
|
|
|
16810
16421
|
// apps/cli/src/infra/commands/PlaybookCommand.ts
|
|
16811
|
-
var
|
|
16422
|
+
var import_cmd_ts30 = __toESM(require_cjs());
|
|
16812
16423
|
|
|
16813
16424
|
// apps/cli/src/infra/commands/playbook/AddCommand.ts
|
|
16814
16425
|
var import_fs21 = require("fs");
|
|
16815
|
-
var
|
|
16426
|
+
var import_cmd_ts24 = __toESM(require_cjs());
|
|
16816
16427
|
|
|
16817
16428
|
// apps/cli/src/infra/repositories/PlaybookLocalRepository.ts
|
|
16818
16429
|
var crypto = __toESM(require("crypto"));
|
|
16819
|
-
var
|
|
16820
|
-
var
|
|
16821
|
-
var
|
|
16430
|
+
var fs20 = __toESM(require("fs"));
|
|
16431
|
+
var os3 = __toESM(require("os"));
|
|
16432
|
+
var path21 = __toESM(require("path"));
|
|
16822
16433
|
var yaml = __toESM(require("yaml"));
|
|
16823
16434
|
var PlaybookLocalRepository = class {
|
|
16824
16435
|
constructor(repoRoot) {
|
|
16825
16436
|
const normalized = this.normalizeRepoRoot(repoRoot);
|
|
16826
16437
|
const hash = crypto.createHash("md5").update(normalized).digest("hex");
|
|
16827
|
-
this.storagePath =
|
|
16828
|
-
|
|
16438
|
+
this.storagePath = path21.join(
|
|
16439
|
+
os3.homedir(),
|
|
16829
16440
|
".packmind",
|
|
16830
16441
|
hash,
|
|
16831
16442
|
"playbook.yaml"
|
|
@@ -16872,11 +16483,11 @@ var PlaybookLocalRepository = class {
|
|
|
16872
16483
|
return normalized;
|
|
16873
16484
|
}
|
|
16874
16485
|
readYaml() {
|
|
16875
|
-
if (!
|
|
16486
|
+
if (!fs20.existsSync(this.storagePath)) {
|
|
16876
16487
|
return { version: 1, changes: [] };
|
|
16877
16488
|
}
|
|
16878
16489
|
try {
|
|
16879
|
-
const content =
|
|
16490
|
+
const content = fs20.readFileSync(this.storagePath, "utf-8");
|
|
16880
16491
|
const parsed = yaml.parse(content);
|
|
16881
16492
|
if (!parsed || !Array.isArray(parsed.changes)) {
|
|
16882
16493
|
return { version: 1, changes: [] };
|
|
@@ -16890,20 +16501,20 @@ var PlaybookLocalRepository = class {
|
|
|
16890
16501
|
}
|
|
16891
16502
|
}
|
|
16892
16503
|
writeYaml(data) {
|
|
16893
|
-
const dir =
|
|
16894
|
-
|
|
16895
|
-
|
|
16504
|
+
const dir = path21.dirname(this.storagePath);
|
|
16505
|
+
fs20.mkdirSync(dir, { recursive: true });
|
|
16506
|
+
fs20.writeFileSync(this.storagePath, yaml.stringify(data), "utf-8");
|
|
16896
16507
|
}
|
|
16897
16508
|
};
|
|
16898
16509
|
|
|
16899
16510
|
// apps/cli/src/infra/commands/playbook/addHandler.ts
|
|
16900
|
-
var
|
|
16901
|
-
var
|
|
16511
|
+
var fs21 = __toESM(require("fs"));
|
|
16512
|
+
var path25 = __toESM(require("path"));
|
|
16902
16513
|
var yaml2 = __toESM(require("yaml"));
|
|
16903
16514
|
var import_slug = __toESM(require("slug"));
|
|
16904
16515
|
|
|
16905
16516
|
// apps/cli/src/application/utils/parseCommandFile.ts
|
|
16906
|
-
var
|
|
16517
|
+
var path22 = __toESM(require("path"));
|
|
16907
16518
|
var FRONTMATTER_DELIMITER3 = "---";
|
|
16908
16519
|
function parseCommandFile(content, filePath) {
|
|
16909
16520
|
content = normalizeLineEndings(content);
|
|
@@ -16959,7 +16570,7 @@ function stripYamlQuotes2(value) {
|
|
|
16959
16570
|
return value;
|
|
16960
16571
|
}
|
|
16961
16572
|
function extractFilenameSlug(filePath) {
|
|
16962
|
-
let basename4 =
|
|
16573
|
+
let basename4 = path22.basename(filePath);
|
|
16963
16574
|
if (basename4.endsWith(".prompt.md")) {
|
|
16964
16575
|
basename4 = basename4.slice(0, -".prompt.md".length);
|
|
16965
16576
|
} else if (basename4.endsWith(".md")) {
|
|
@@ -17126,7 +16737,7 @@ function parseSkillDirectory(files) {
|
|
|
17126
16737
|
}
|
|
17127
16738
|
|
|
17128
16739
|
// apps/cli/src/application/utils/findNearestConfigDir.ts
|
|
17129
|
-
var
|
|
16740
|
+
var path23 = __toESM(require("path"));
|
|
17130
16741
|
async function findNearestConfigDir(startDir, packmindCliHexa) {
|
|
17131
16742
|
let current = startDir;
|
|
17132
16743
|
while (true) {
|
|
@@ -17134,7 +16745,7 @@ async function findNearestConfigDir(startDir, packmindCliHexa) {
|
|
|
17134
16745
|
if (exists) {
|
|
17135
16746
|
return current;
|
|
17136
16747
|
}
|
|
17137
|
-
const parent =
|
|
16748
|
+
const parent = path23.dirname(current);
|
|
17138
16749
|
if (parent === current) {
|
|
17139
16750
|
return null;
|
|
17140
16751
|
}
|
|
@@ -17143,7 +16754,7 @@ async function findNearestConfigDir(startDir, packmindCliHexa) {
|
|
|
17143
16754
|
}
|
|
17144
16755
|
|
|
17145
16756
|
// apps/cli/src/application/utils/resolveDeployedContext.ts
|
|
17146
|
-
var
|
|
16757
|
+
var path24 = __toESM(require("path"));
|
|
17147
16758
|
async function resolveDeployedContext(packmindCliHexa, targetDir) {
|
|
17148
16759
|
try {
|
|
17149
16760
|
const space = await packmindCliHexa.getDefaultSpace();
|
|
@@ -17155,7 +16766,7 @@ async function resolveDeployedContext(packmindCliHexa, targetDir) {
|
|
|
17155
16766
|
}
|
|
17156
16767
|
const gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
|
|
17157
16768
|
const gitBranch = packmindCliHexa.getCurrentBranch(gitRoot);
|
|
17158
|
-
const rel =
|
|
16769
|
+
const rel = path24.relative(gitRoot, targetDir);
|
|
17159
16770
|
const relativePath = rel.startsWith("..") ? "/" : rel ? `/${rel}/` : "/";
|
|
17160
16771
|
const deployedContent = await packmindCliHexa.getPackmindGateway().deployment.getDeployed({
|
|
17161
16772
|
packagesSlugs: configPackages,
|
|
@@ -17220,19 +16831,19 @@ async function fetchDeployedFiles(gateway, lockFile) {
|
|
|
17220
16831
|
|
|
17221
16832
|
// apps/cli/src/infra/commands/playbook/addHandler.ts
|
|
17222
16833
|
async function tryStageRemovedFromLockFile(resolvedPath, deps) {
|
|
17223
|
-
const fileDir =
|
|
16834
|
+
const fileDir = path25.dirname(resolvedPath);
|
|
17224
16835
|
const targetDir = await findNearestConfigDir(fileDir, deps.packmindCliHexa);
|
|
17225
16836
|
if (!targetDir) return false;
|
|
17226
16837
|
const lockFile = await deps.lockFileRepository.read(targetDir);
|
|
17227
16838
|
if (!lockFile) return false;
|
|
17228
|
-
const normalizedPath = normalizePath2(
|
|
16839
|
+
const normalizedPath = normalizePath2(path25.relative(targetDir, resolvedPath));
|
|
17229
16840
|
const lockEntry = findLockFileEntryForPath(
|
|
17230
16841
|
normalizedPath,
|
|
17231
16842
|
lockFile.artifacts
|
|
17232
16843
|
);
|
|
17233
16844
|
if (!lockEntry) return false;
|
|
17234
16845
|
const gitRoot = await deps.packmindCliHexa.tryGetGitRepositoryRoot(targetDir);
|
|
17235
|
-
const configDir = gitRoot ? normalizePath2(
|
|
16846
|
+
const configDir = gitRoot ? normalizePath2(path25.relative(gitRoot, targetDir)) : "";
|
|
17236
16847
|
const deployedContext = await resolveDeployedContext(
|
|
17237
16848
|
deps.packmindCliHexa,
|
|
17238
16849
|
targetDir
|
|
@@ -17264,22 +16875,22 @@ async function tryStageRemovedFromLockFile(resolvedPath, deps) {
|
|
|
17264
16875
|
}
|
|
17265
16876
|
function resolveSkillDirectoryRoot(absolutePath) {
|
|
17266
16877
|
if (absolutePath.endsWith("SKILL.md")) {
|
|
17267
|
-
return
|
|
16878
|
+
return path25.dirname(absolutePath);
|
|
17268
16879
|
}
|
|
17269
16880
|
try {
|
|
17270
|
-
if (
|
|
16881
|
+
if (fs21.statSync(absolutePath).isDirectory()) {
|
|
17271
16882
|
return absolutePath;
|
|
17272
16883
|
}
|
|
17273
16884
|
} catch {
|
|
17274
16885
|
return absolutePath;
|
|
17275
16886
|
}
|
|
17276
|
-
let current =
|
|
17277
|
-
const root =
|
|
16887
|
+
let current = path25.dirname(absolutePath);
|
|
16888
|
+
const root = path25.parse(current).root;
|
|
17278
16889
|
while (current !== root) {
|
|
17279
|
-
if (
|
|
16890
|
+
if (fs21.existsSync(path25.join(current, "SKILL.md"))) {
|
|
17280
16891
|
return current;
|
|
17281
16892
|
}
|
|
17282
|
-
current =
|
|
16893
|
+
current = path25.dirname(current);
|
|
17283
16894
|
}
|
|
17284
16895
|
return absolutePath;
|
|
17285
16896
|
}
|
|
@@ -17302,17 +16913,17 @@ async function playbookAddHandler(deps) {
|
|
|
17302
16913
|
exit(1);
|
|
17303
16914
|
return;
|
|
17304
16915
|
}
|
|
17305
|
-
const absolutePath =
|
|
16916
|
+
const absolutePath = path25.resolve(cwd, filePath);
|
|
17306
16917
|
let artifactType;
|
|
17307
16918
|
let codingAgent;
|
|
17308
16919
|
const earlyTargetDir = await findNearestConfigDir(
|
|
17309
|
-
|
|
16920
|
+
path25.dirname(absolutePath),
|
|
17310
16921
|
packmindCliHexa
|
|
17311
16922
|
);
|
|
17312
16923
|
const earlyLockFile = earlyTargetDir ? await lockFileRepository.read(earlyTargetDir) : null;
|
|
17313
16924
|
if (earlyLockFile && earlyTargetDir) {
|
|
17314
16925
|
const normalizedForLookup = normalizePath2(
|
|
17315
|
-
|
|
16926
|
+
path25.relative(earlyTargetDir, absolutePath)
|
|
17316
16927
|
);
|
|
17317
16928
|
const lockResult = findLockFileEntryAndFileForPath(
|
|
17318
16929
|
normalizedForLookup,
|
|
@@ -17446,7 +17057,7 @@ Content goes here...`
|
|
|
17446
17057
|
return;
|
|
17447
17058
|
}
|
|
17448
17059
|
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(targetDir);
|
|
17449
|
-
const configDir = gitRoot ? normalizePath2(
|
|
17060
|
+
const configDir = gitRoot ? normalizePath2(path25.relative(gitRoot, targetDir)) : "";
|
|
17450
17061
|
const deployedContext = await resolveDeployedContext(
|
|
17451
17062
|
packmindCliHexa,
|
|
17452
17063
|
targetDir
|
|
@@ -17454,7 +17065,7 @@ Content goes here...`
|
|
|
17454
17065
|
const targetId = deployedContext?.targetId ?? earlyLockFile?.targetId;
|
|
17455
17066
|
const normalizedFilePath = (() => {
|
|
17456
17067
|
const refPath = artifactType === "skill" && skillDirPath ? skillDirPath : absolutePath;
|
|
17457
|
-
return normalizePath2(
|
|
17068
|
+
return normalizePath2(path25.relative(targetDir, refPath));
|
|
17458
17069
|
})();
|
|
17459
17070
|
let spaceId;
|
|
17460
17071
|
let spaceName;
|
|
@@ -17569,7 +17180,7 @@ Run ${formatLabel("packmind-cli install")} to update before making changes.`
|
|
|
17569
17180
|
);
|
|
17570
17181
|
const allMatch = skillDeployedFiles.length > 0 && skillDeployedFiles.length === skillFiles.length && skillDeployedFiles.every((deployed) => {
|
|
17571
17182
|
const localFile = skillFiles.find(
|
|
17572
|
-
(f) => normalizePath2(
|
|
17183
|
+
(f) => normalizePath2(path25.join(normalizedFilePath, f.relativePath)) === normalizePath2(deployed.path)
|
|
17573
17184
|
);
|
|
17574
17185
|
return localFile && deployed.content?.trim() === localFile.content.trim() && (!deployed.skillFilePermissions || deployed.skillFilePermissions === localFile.permissions);
|
|
17575
17186
|
});
|
|
@@ -17639,17 +17250,17 @@ function formatSpaceList(spaces) {
|
|
|
17639
17250
|
}
|
|
17640
17251
|
|
|
17641
17252
|
// apps/cli/src/infra/commands/playbook/AddCommand.ts
|
|
17642
|
-
var addPlaybookCommand = (0,
|
|
17253
|
+
var addPlaybookCommand = (0, import_cmd_ts24.command)({
|
|
17643
17254
|
name: "add",
|
|
17644
17255
|
description: "Stage a local artifact change",
|
|
17645
17256
|
args: {
|
|
17646
|
-
filePath: (0,
|
|
17647
|
-
type:
|
|
17257
|
+
filePath: (0, import_cmd_ts24.positional)({
|
|
17258
|
+
type: import_cmd_ts24.string,
|
|
17648
17259
|
displayName: "path",
|
|
17649
17260
|
description: "Path to the artifact file or directory to stage"
|
|
17650
17261
|
}),
|
|
17651
|
-
space: (0,
|
|
17652
|
-
type: (0,
|
|
17262
|
+
space: (0, import_cmd_ts24.option)({
|
|
17263
|
+
type: (0, import_cmd_ts24.optional)(SpaceSlug),
|
|
17653
17264
|
long: "space",
|
|
17654
17265
|
description: "Target space slug"
|
|
17655
17266
|
})
|
|
@@ -17678,11 +17289,11 @@ var addPlaybookCommand = (0, import_cmd_ts25.command)({
|
|
|
17678
17289
|
});
|
|
17679
17290
|
|
|
17680
17291
|
// apps/cli/src/infra/commands/playbook/RmCommand.ts
|
|
17681
|
-
var
|
|
17292
|
+
var import_cmd_ts25 = __toESM(require_cjs());
|
|
17682
17293
|
|
|
17683
17294
|
// apps/cli/src/infra/commands/playbook/rmHandler.ts
|
|
17684
|
-
var
|
|
17685
|
-
var
|
|
17295
|
+
var fs22 = __toESM(require("fs"));
|
|
17296
|
+
var path26 = __toESM(require("path"));
|
|
17686
17297
|
function isSkillSupportFile(absolutePath) {
|
|
17687
17298
|
const normalized = absolutePath.replace(/\\/g, "/");
|
|
17688
17299
|
const skillDirMatch = normalized.match(/\/skills\/[^/]+\//);
|
|
@@ -17709,14 +17320,14 @@ async function playbookRmHandler(deps) {
|
|
|
17709
17320
|
exit(1);
|
|
17710
17321
|
return;
|
|
17711
17322
|
}
|
|
17712
|
-
const absolutePath =
|
|
17713
|
-
if (!
|
|
17323
|
+
const absolutePath = path26.resolve(getCwd(), filePath);
|
|
17324
|
+
if (!fs22.existsSync(absolutePath)) {
|
|
17714
17325
|
logErrorConsole(`File not found: "${filePath}"`);
|
|
17715
17326
|
exit(1);
|
|
17716
17327
|
return;
|
|
17717
17328
|
}
|
|
17718
17329
|
const targetDir = await findNearestConfigDir(
|
|
17719
|
-
|
|
17330
|
+
path26.dirname(absolutePath),
|
|
17720
17331
|
packmindCliHexa
|
|
17721
17332
|
);
|
|
17722
17333
|
if (!targetDir) {
|
|
@@ -17733,7 +17344,7 @@ async function playbookRmHandler(deps) {
|
|
|
17733
17344
|
return;
|
|
17734
17345
|
}
|
|
17735
17346
|
const normalizedForLookup = normalizePath2(
|
|
17736
|
-
|
|
17347
|
+
path26.relative(targetDir, absolutePath)
|
|
17737
17348
|
);
|
|
17738
17349
|
const lockResult = findLockFileEntryAndFileForPath(
|
|
17739
17350
|
normalizedForLookup,
|
|
@@ -17755,7 +17366,7 @@ async function playbookRmHandler(deps) {
|
|
|
17755
17366
|
}
|
|
17756
17367
|
const resolvedAbsolutePath = artifactType === "skill" ? resolveSkillDirPath(absolutePath) : absolutePath;
|
|
17757
17368
|
const normalizedFilePath = normalizePath2(
|
|
17758
|
-
|
|
17369
|
+
path26.relative(targetDir, resolvedAbsolutePath)
|
|
17759
17370
|
);
|
|
17760
17371
|
const lockEntry = findLockFileEntryAndFileForPath(normalizedFilePath, lockFile.artifacts)?.entry ?? lockResult.entry;
|
|
17761
17372
|
if (!lockEntry) {
|
|
@@ -17783,7 +17394,7 @@ async function playbookRmHandler(deps) {
|
|
|
17783
17394
|
}
|
|
17784
17395
|
const spaceName = matchingSpace.name;
|
|
17785
17396
|
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(targetDir);
|
|
17786
|
-
const configDir = gitRoot ? normalizePath2(
|
|
17397
|
+
const configDir = gitRoot ? normalizePath2(path26.relative(gitRoot, targetDir)) : "";
|
|
17787
17398
|
const deployedContext = await resolveDeployedContext(
|
|
17788
17399
|
packmindCliHexa,
|
|
17789
17400
|
targetDir
|
|
@@ -17809,13 +17420,13 @@ async function playbookRmHandler(deps) {
|
|
|
17809
17420
|
}
|
|
17810
17421
|
|
|
17811
17422
|
// apps/cli/src/infra/commands/playbook/RmCommand.ts
|
|
17812
|
-
var rmPlaybookCommand = (0,
|
|
17423
|
+
var rmPlaybookCommand = (0, import_cmd_ts25.command)({
|
|
17813
17424
|
name: "rm",
|
|
17814
17425
|
description: "Stage an artifact for removal",
|
|
17815
17426
|
aliases: ["remove"],
|
|
17816
17427
|
args: {
|
|
17817
|
-
filePath: (0,
|
|
17818
|
-
type:
|
|
17428
|
+
filePath: (0, import_cmd_ts25.positional)({
|
|
17429
|
+
type: import_cmd_ts25.string,
|
|
17819
17430
|
displayName: "path",
|
|
17820
17431
|
description: "Path to the artifact file or directory to remove"
|
|
17821
17432
|
})
|
|
@@ -17841,10 +17452,10 @@ var rmPlaybookCommand = (0, import_cmd_ts26.command)({
|
|
|
17841
17452
|
});
|
|
17842
17453
|
|
|
17843
17454
|
// apps/cli/src/infra/commands/playbook/UnstageCommand.ts
|
|
17844
|
-
var
|
|
17455
|
+
var import_cmd_ts26 = __toESM(require_cjs());
|
|
17845
17456
|
|
|
17846
17457
|
// apps/cli/src/infra/commands/playbook/unstageHandler.ts
|
|
17847
|
-
var
|
|
17458
|
+
var path27 = __toESM(require("path"));
|
|
17848
17459
|
async function playbookUnstageHandler(deps) {
|
|
17849
17460
|
const {
|
|
17850
17461
|
packmindCliHexa,
|
|
@@ -17862,10 +17473,10 @@ async function playbookUnstageHandler(deps) {
|
|
|
17862
17473
|
return;
|
|
17863
17474
|
}
|
|
17864
17475
|
const cwd = getCwd();
|
|
17865
|
-
const absolutePath =
|
|
17476
|
+
const absolutePath = path27.resolve(cwd, filePath);
|
|
17866
17477
|
const resolvedPath = resolveSkillDirPath(absolutePath);
|
|
17867
17478
|
const configDir = await findNearestConfigDir(
|
|
17868
|
-
|
|
17479
|
+
path27.dirname(resolvedPath),
|
|
17869
17480
|
packmindCliHexa
|
|
17870
17481
|
);
|
|
17871
17482
|
if (!configDir) {
|
|
@@ -17878,10 +17489,10 @@ async function playbookUnstageHandler(deps) {
|
|
|
17878
17489
|
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(cwd);
|
|
17879
17490
|
const baseDir = gitRoot ?? configDir;
|
|
17880
17491
|
const normalizedFilePath = normalizePath2(
|
|
17881
|
-
|
|
17492
|
+
path27.relative(baseDir, resolvedPath)
|
|
17882
17493
|
);
|
|
17883
17494
|
const matchingEntries = playbookLocalRepository.getChanges().filter((c) => {
|
|
17884
|
-
const fullEntryPath = c.configDir ? normalizePath2(
|
|
17495
|
+
const fullEntryPath = c.configDir ? normalizePath2(path27.join(c.configDir, c.filePath)) : c.filePath;
|
|
17885
17496
|
return fullEntryPath === normalizedFilePath;
|
|
17886
17497
|
});
|
|
17887
17498
|
if (matchingEntries.length === 0) {
|
|
@@ -17925,17 +17536,17 @@ ${spaceList}`
|
|
|
17925
17536
|
}
|
|
17926
17537
|
|
|
17927
17538
|
// apps/cli/src/infra/commands/playbook/UnstageCommand.ts
|
|
17928
|
-
var unstagePlaybookCommand = (0,
|
|
17539
|
+
var unstagePlaybookCommand = (0, import_cmd_ts26.command)({
|
|
17929
17540
|
name: "unstage",
|
|
17930
17541
|
description: "Remove a staged change",
|
|
17931
17542
|
args: {
|
|
17932
|
-
filePath: (0,
|
|
17933
|
-
type:
|
|
17543
|
+
filePath: (0, import_cmd_ts26.positional)({
|
|
17544
|
+
type: import_cmd_ts26.string,
|
|
17934
17545
|
displayName: "path",
|
|
17935
17546
|
description: "Path to the artifact file or directory to unstage"
|
|
17936
17547
|
}),
|
|
17937
|
-
space: (0,
|
|
17938
|
-
type: (0,
|
|
17548
|
+
space: (0, import_cmd_ts26.option)({
|
|
17549
|
+
type: (0, import_cmd_ts26.optional)(SpaceSlug),
|
|
17939
17550
|
long: "space",
|
|
17940
17551
|
description: "Target space slug (required when artifact is staged for multiple spaces)"
|
|
17941
17552
|
})
|
|
@@ -17961,19 +17572,19 @@ var unstagePlaybookCommand = (0, import_cmd_ts27.command)({
|
|
|
17961
17572
|
|
|
17962
17573
|
// apps/cli/src/infra/commands/playbook/StatusCommand.ts
|
|
17963
17574
|
var import_fs23 = require("fs");
|
|
17964
|
-
var
|
|
17575
|
+
var import_cmd_ts27 = __toESM(require_cjs());
|
|
17965
17576
|
|
|
17966
17577
|
// apps/cli/src/infra/utils/listDirectoryFiles.ts
|
|
17967
17578
|
var import_fs22 = require("fs");
|
|
17968
|
-
var
|
|
17579
|
+
var path28 = __toESM(require("path"));
|
|
17969
17580
|
function listDirectoryFiles(dirPath) {
|
|
17970
17581
|
const results = [];
|
|
17971
17582
|
const entries = (0, import_fs22.readdirSync)(dirPath, { withFileTypes: true });
|
|
17972
17583
|
for (const entry of entries) {
|
|
17973
|
-
const fullPath =
|
|
17584
|
+
const fullPath = path28.join(dirPath, entry.name);
|
|
17974
17585
|
if (entry.isDirectory()) {
|
|
17975
17586
|
for (const nested of listDirectoryFiles(fullPath)) {
|
|
17976
|
-
results.push(
|
|
17587
|
+
results.push(path28.join(entry.name, nested));
|
|
17977
17588
|
}
|
|
17978
17589
|
} else if (entry.isFile()) {
|
|
17979
17590
|
results.push(entry.name);
|
|
@@ -17983,7 +17594,7 @@ function listDirectoryFiles(dirPath) {
|
|
|
17983
17594
|
}
|
|
17984
17595
|
|
|
17985
17596
|
// apps/cli/src/infra/commands/playbook/statusHandler.ts
|
|
17986
|
-
var
|
|
17597
|
+
var path29 = __toESM(require("path"));
|
|
17987
17598
|
|
|
17988
17599
|
// apps/cli/src/infra/utils/stringUtils.ts
|
|
17989
17600
|
function capitalize(s) {
|
|
@@ -18018,7 +17629,7 @@ function groupStagedChanges(changes, cwd, gitRoot) {
|
|
|
18018
17629
|
const changeType = change.changeType ?? "updated";
|
|
18019
17630
|
const key = `${change.artifactType}:${change.artifactName}:${changeType}`;
|
|
18020
17631
|
const rootRelativePath = change.configDir ? `${change.configDir}/${change.filePath}` : change.filePath;
|
|
18021
|
-
const displayPath = gitRoot ? normalizePath2(
|
|
17632
|
+
const displayPath = gitRoot ? normalizePath2(path29.relative(cwd, path29.join(gitRoot, rootRelativePath))) : rootRelativePath;
|
|
18022
17633
|
const existing = groups.get(key);
|
|
18023
17634
|
if (existing) {
|
|
18024
17635
|
existing.filePaths.push(displayPath);
|
|
@@ -18076,12 +17687,12 @@ async function playbookStatusHandler(deps) {
|
|
|
18076
17687
|
const fallbackConfigDir = await findNearestConfigDir(cwd, packmindCliHexa);
|
|
18077
17688
|
const configDirs = /* @__PURE__ */ new Set([...stagedByConfigDir.keys()]);
|
|
18078
17689
|
if (fallbackConfigDir && !configDirs.has("__cwd__")) {
|
|
18079
|
-
const rel = gitRoot ? normalizePath2(
|
|
17690
|
+
const rel = gitRoot ? normalizePath2(path29.relative(gitRoot, fallbackConfigDir)) : "";
|
|
18080
17691
|
if (!configDirs.has(rel)) configDirs.add(rel);
|
|
18081
17692
|
}
|
|
18082
17693
|
const descendantDirs = await packmindCliHexa.findDescendantConfigs(cwd);
|
|
18083
17694
|
for (const descendantDir of descendantDirs) {
|
|
18084
|
-
const rel = gitRoot ? normalizePath2(
|
|
17695
|
+
const rel = gitRoot ? normalizePath2(path29.relative(gitRoot, descendantDir)) : normalizePath2(path29.relative(cwd, descendantDir));
|
|
18085
17696
|
if (!configDirs.has(rel)) configDirs.add(rel);
|
|
18086
17697
|
}
|
|
18087
17698
|
for (const configDirKey of configDirs) {
|
|
@@ -18089,7 +17700,7 @@ async function playbookStatusHandler(deps) {
|
|
|
18089
17700
|
if (configDirKey === "__cwd__") {
|
|
18090
17701
|
projectDir = fallbackConfigDir;
|
|
18091
17702
|
} else if (gitRoot) {
|
|
18092
|
-
projectDir =
|
|
17703
|
+
projectDir = path29.join(gitRoot, configDirKey);
|
|
18093
17704
|
} else {
|
|
18094
17705
|
continue;
|
|
18095
17706
|
}
|
|
@@ -18114,11 +17725,11 @@ async function playbookStatusHandler(deps) {
|
|
|
18114
17725
|
continue;
|
|
18115
17726
|
}
|
|
18116
17727
|
const displayPath = normalizePath2(
|
|
18117
|
-
|
|
17728
|
+
path29.relative(cwd, path29.join(projectDir, deployedFile.path))
|
|
18118
17729
|
);
|
|
18119
17730
|
let localContent;
|
|
18120
17731
|
try {
|
|
18121
|
-
localContent = readFile11(
|
|
17732
|
+
localContent = readFile11(path29.join(projectDir, deployedFile.path));
|
|
18122
17733
|
} catch {
|
|
18123
17734
|
const artifact = findArtifactForFile(
|
|
18124
17735
|
deployedFile.path,
|
|
@@ -18147,7 +17758,7 @@ async function playbookStatusHandler(deps) {
|
|
|
18147
17758
|
});
|
|
18148
17759
|
}
|
|
18149
17760
|
} else if (deployedFile.skillFilePermissions && getFileMode) {
|
|
18150
|
-
const localMode = getFileMode(
|
|
17761
|
+
const localMode = getFileMode(path29.join(projectDir, deployedFile.path));
|
|
18151
17762
|
if (localMode !== null) {
|
|
18152
17763
|
const localPermissions = modeToPermissionStringOrDefault(localMode);
|
|
18153
17764
|
if (localPermissions !== deployedFile.skillFilePermissions) {
|
|
@@ -18176,13 +17787,13 @@ async function playbookStatusHandler(deps) {
|
|
|
18176
17787
|
(f) => normalizePath2(f.path).endsWith("/SKILL.md")
|
|
18177
17788
|
);
|
|
18178
17789
|
if (!skillMdFile) continue;
|
|
18179
|
-
const skillDir = normalizePath2(
|
|
17790
|
+
const skillDir = normalizePath2(path29.dirname(skillMdFile.path));
|
|
18180
17791
|
if (targetStagedPaths.has(skillDir) || targetSkillDirPaths.some(
|
|
18181
17792
|
(staged) => skillDir === staged || skillDir.startsWith(staged + "/")
|
|
18182
17793
|
)) {
|
|
18183
17794
|
continue;
|
|
18184
17795
|
}
|
|
18185
|
-
const absoluteSkillDir =
|
|
17796
|
+
const absoluteSkillDir = path29.join(projectDir, skillDir);
|
|
18186
17797
|
let localFiles;
|
|
18187
17798
|
try {
|
|
18188
17799
|
localFiles = listDirectoryFiles2(absoluteSkillDir);
|
|
@@ -18191,11 +17802,11 @@ async function playbookStatusHandler(deps) {
|
|
|
18191
17802
|
}
|
|
18192
17803
|
for (const localRelPath of localFiles) {
|
|
18193
17804
|
const normalizedLocalPath = normalizePath2(
|
|
18194
|
-
|
|
17805
|
+
path29.join(skillDir, localRelPath)
|
|
18195
17806
|
);
|
|
18196
17807
|
if (!deployedPathSet.has(normalizedLocalPath)) {
|
|
18197
17808
|
const displayPath = normalizePath2(
|
|
18198
|
-
|
|
17809
|
+
path29.relative(cwd, path29.join(projectDir, normalizedLocalPath))
|
|
18199
17810
|
);
|
|
18200
17811
|
untrackedChanges.push({
|
|
18201
17812
|
artifactName: entry.name,
|
|
@@ -18243,7 +17854,7 @@ async function playbookStatusHandler(deps) {
|
|
|
18243
17854
|
}
|
|
18244
17855
|
|
|
18245
17856
|
// apps/cli/src/infra/commands/playbook/StatusCommand.ts
|
|
18246
|
-
var statusPlaybookCommand = (0,
|
|
17857
|
+
var statusPlaybookCommand = (0, import_cmd_ts27.command)({
|
|
18247
17858
|
name: "status",
|
|
18248
17859
|
description: "Show staged and untracked changes",
|
|
18249
17860
|
args: {},
|
|
@@ -18277,13 +17888,13 @@ var statusPlaybookCommand = (0, import_cmd_ts28.command)({
|
|
|
18277
17888
|
|
|
18278
17889
|
// apps/cli/src/infra/commands/playbook/SubmitCommand.ts
|
|
18279
17890
|
var import_fs24 = require("fs");
|
|
18280
|
-
var
|
|
17891
|
+
var import_child_process3 = require("child_process");
|
|
18281
17892
|
var import_os2 = require("os");
|
|
18282
17893
|
var import_path5 = require("path");
|
|
18283
|
-
var
|
|
17894
|
+
var import_cmd_ts28 = __toESM(require_cjs());
|
|
18284
17895
|
|
|
18285
17896
|
// apps/cli/src/infra/commands/playbook/submitHandler.ts
|
|
18286
|
-
var
|
|
17897
|
+
var path31 = __toESM(require("path"));
|
|
18287
17898
|
|
|
18288
17899
|
// apps/cli/src/infra/commands/playbook/submit/duplicateNameChecker.ts
|
|
18289
17900
|
var import_slug2 = __toESM(require("slug"));
|
|
@@ -18345,7 +17956,7 @@ async function checkForDuplicateNames(createdEntries, packmindGateway) {
|
|
|
18345
17956
|
}
|
|
18346
17957
|
|
|
18347
17958
|
// apps/cli/src/infra/commands/playbook/submit/targetContextResolver.ts
|
|
18348
|
-
var
|
|
17959
|
+
var path30 = __toESM(require("path"));
|
|
18349
17960
|
async function createTargetContextResolver(deps) {
|
|
18350
17961
|
const { lockFileRepository, cwd, packmindCliHexa } = deps;
|
|
18351
17962
|
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(cwd);
|
|
@@ -18356,7 +17967,7 @@ async function createTargetContextResolver(deps) {
|
|
|
18356
17967
|
if (cache.has(key)) return cache.get(key);
|
|
18357
17968
|
let projectDir;
|
|
18358
17969
|
if (entry.configDir !== void 0 && gitRoot) {
|
|
18359
|
-
projectDir =
|
|
17970
|
+
projectDir = path30.join(gitRoot, entry.configDir);
|
|
18360
17971
|
} else {
|
|
18361
17972
|
projectDir = await findNearestConfigDir(cwd, packmindCliHexa);
|
|
18362
17973
|
}
|
|
@@ -19304,7 +18915,7 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
|
|
|
19304
18915
|
const entryCtx = resolver.getCachedContext(entry.configDir);
|
|
19305
18916
|
if (!entryCtx?.projectDir) continue;
|
|
19306
18917
|
try {
|
|
19307
|
-
const fullPath =
|
|
18918
|
+
const fullPath = path31.join(entryCtx.projectDir, entry.filePath);
|
|
19308
18919
|
if (entry.artifactType === "skill") {
|
|
19309
18920
|
deps.rmSync(fullPath, { recursive: true });
|
|
19310
18921
|
} else {
|
|
@@ -19332,7 +18943,7 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
|
|
|
19332
18943
|
const entryCtx = resolver.getCachedContext(entry.configDir);
|
|
19333
18944
|
if (!entryCtx?.projectDir) continue;
|
|
19334
18945
|
try {
|
|
19335
|
-
const fullPath =
|
|
18946
|
+
const fullPath = path31.join(entryCtx.projectDir, entry.filePath);
|
|
19336
18947
|
if (entry.artifactType === "skill") {
|
|
19337
18948
|
deps.rmSync(fullPath, { recursive: true });
|
|
19338
18949
|
} else {
|
|
@@ -19385,7 +18996,7 @@ function openEditorForMessage(prefill) {
|
|
|
19385
18996
|
const tmpFile = (0, import_path5.join)((0, import_os2.tmpdir)(), `packmind-submit-${Date.now()}.md`);
|
|
19386
18997
|
try {
|
|
19387
18998
|
(0, import_fs24.writeFileSync)(tmpFile, prefill, "utf-8");
|
|
19388
|
-
(0,
|
|
18999
|
+
(0, import_child_process3.execSync)(`${editor} "${tmpFile}"`, { stdio: "inherit" });
|
|
19389
19000
|
const content = (0, import_fs24.readFileSync)(tmpFile, "utf-8");
|
|
19390
19001
|
const stripped = content.split("\n").filter((line) => !line.startsWith("#")).join("\n").trim();
|
|
19391
19002
|
return stripped || null;
|
|
@@ -19398,17 +19009,17 @@ function openEditorForMessage(prefill) {
|
|
|
19398
19009
|
}
|
|
19399
19010
|
}
|
|
19400
19011
|
}
|
|
19401
|
-
var submitPlaybookCommand = (0,
|
|
19012
|
+
var submitPlaybookCommand = (0, import_cmd_ts28.command)({
|
|
19402
19013
|
name: "submit",
|
|
19403
19014
|
description: "Submit staged changes as proposals",
|
|
19404
19015
|
args: {
|
|
19405
|
-
message: (0,
|
|
19406
|
-
type: (0,
|
|
19016
|
+
message: (0, import_cmd_ts28.option)({
|
|
19017
|
+
type: (0, import_cmd_ts28.optional)(import_cmd_ts28.string),
|
|
19407
19018
|
long: "message",
|
|
19408
19019
|
short: "m",
|
|
19409
19020
|
description: "Message describing the intent behind the proposed changes"
|
|
19410
19021
|
}),
|
|
19411
|
-
noReview: (0,
|
|
19022
|
+
noReview: (0, import_cmd_ts28.flag)({
|
|
19412
19023
|
long: "no-review",
|
|
19413
19024
|
description: "Apply changes directly without creating proposals for review"
|
|
19414
19025
|
})
|
|
@@ -19438,23 +19049,23 @@ var submitPlaybookCommand = (0, import_cmd_ts29.command)({
|
|
|
19438
19049
|
});
|
|
19439
19050
|
|
|
19440
19051
|
// apps/cli/src/infra/commands/playbook/DiffCommand.ts
|
|
19441
|
-
var
|
|
19442
|
-
var diffCommand2 = (0,
|
|
19052
|
+
var import_cmd_ts29 = __toESM(require_cjs());
|
|
19053
|
+
var diffCommand2 = (0, import_cmd_ts29.command)({
|
|
19443
19054
|
name: "diff",
|
|
19444
19055
|
description: "Show differences between local command files and server content",
|
|
19445
19056
|
args: {
|
|
19446
|
-
includeSubmitted: (0,
|
|
19057
|
+
includeSubmitted: (0, import_cmd_ts29.flag)({
|
|
19447
19058
|
long: "include-submitted",
|
|
19448
19059
|
description: "Include already submitted changes in the output"
|
|
19449
19060
|
}),
|
|
19450
|
-
path: (0,
|
|
19061
|
+
path: (0, import_cmd_ts29.option)({
|
|
19451
19062
|
long: "path",
|
|
19452
19063
|
short: "p",
|
|
19453
19064
|
description: "Path to analyze (relative to current directory)",
|
|
19454
|
-
type: (0,
|
|
19065
|
+
type: (0, import_cmd_ts29.optional)(import_cmd_ts29.string)
|
|
19455
19066
|
})
|
|
19456
19067
|
},
|
|
19457
|
-
handler: async ({ includeSubmitted, path:
|
|
19068
|
+
handler: async ({ includeSubmitted, path: path35 }) => {
|
|
19458
19069
|
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
19459
19070
|
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
19460
19071
|
await diffArtefactsHandler({
|
|
@@ -19463,13 +19074,13 @@ var diffCommand2 = (0, import_cmd_ts30.command)({
|
|
|
19463
19074
|
getCwd: () => process.cwd(),
|
|
19464
19075
|
log: console.log,
|
|
19465
19076
|
includeSubmitted,
|
|
19466
|
-
path:
|
|
19077
|
+
path: path35
|
|
19467
19078
|
});
|
|
19468
19079
|
}
|
|
19469
19080
|
});
|
|
19470
19081
|
|
|
19471
19082
|
// apps/cli/src/infra/commands/PlaybookCommand.ts
|
|
19472
|
-
var playbookCommand = (0,
|
|
19083
|
+
var playbookCommand = (0, import_cmd_ts30.subcommands)({
|
|
19473
19084
|
name: "playbook",
|
|
19474
19085
|
description: "Manage local playbook files and propose changes to your team",
|
|
19475
19086
|
cmds: {
|
|
@@ -19483,10 +19094,10 @@ var playbookCommand = (0, import_cmd_ts31.subcommands)({
|
|
|
19483
19094
|
});
|
|
19484
19095
|
|
|
19485
19096
|
// apps/cli/src/infra/commands/SpacesCommand.ts
|
|
19486
|
-
var
|
|
19097
|
+
var import_cmd_ts32 = __toESM(require_cjs());
|
|
19487
19098
|
|
|
19488
19099
|
// apps/cli/src/infra/commands/ListSpacesCommand.ts
|
|
19489
|
-
var
|
|
19100
|
+
var import_cmd_ts31 = __toESM(require_cjs());
|
|
19490
19101
|
|
|
19491
19102
|
// apps/cli/src/infra/commands/spaces/listSpacesHandler.ts
|
|
19492
19103
|
function displaySpace(space) {
|
|
@@ -19522,7 +19133,7 @@ async function listSpacesHandler(deps) {
|
|
|
19522
19133
|
}
|
|
19523
19134
|
|
|
19524
19135
|
// apps/cli/src/infra/commands/ListSpacesCommand.ts
|
|
19525
|
-
var listSpacesCommand = (0,
|
|
19136
|
+
var listSpacesCommand = (0, import_cmd_ts31.command)({
|
|
19526
19137
|
name: "list",
|
|
19527
19138
|
description: "List available spaces in the organization",
|
|
19528
19139
|
args: {},
|
|
@@ -19537,7 +19148,7 @@ var listSpacesCommand = (0, import_cmd_ts32.command)({
|
|
|
19537
19148
|
});
|
|
19538
19149
|
|
|
19539
19150
|
// apps/cli/src/infra/commands/SpacesCommand.ts
|
|
19540
|
-
var spacesCommand = (0,
|
|
19151
|
+
var spacesCommand = (0, import_cmd_ts32.subcommands)({
|
|
19541
19152
|
name: "spaces",
|
|
19542
19153
|
description: "Manage spaces in your Packmind organization",
|
|
19543
19154
|
cmds: {
|
|
@@ -19546,14 +19157,14 @@ var spacesCommand = (0, import_cmd_ts33.subcommands)({
|
|
|
19546
19157
|
});
|
|
19547
19158
|
|
|
19548
19159
|
// apps/cli/src/infra/commands/config/ConfigCommand.ts
|
|
19549
|
-
var
|
|
19160
|
+
var import_cmd_ts38 = __toESM(require_cjs());
|
|
19550
19161
|
|
|
19551
19162
|
// apps/cli/src/infra/commands/config/ConfigAgentsCommand.ts
|
|
19552
|
-
var
|
|
19163
|
+
var import_cmd_ts37 = __toESM(require_cjs());
|
|
19553
19164
|
|
|
19554
19165
|
// apps/cli/src/application/services/AgentArtifactDetectionService.ts
|
|
19555
|
-
var
|
|
19556
|
-
var
|
|
19166
|
+
var fs23 = __toESM(require("fs/promises"));
|
|
19167
|
+
var path32 = __toESM(require("path"));
|
|
19557
19168
|
var AGENT_ARTIFACT_CHECKS = [
|
|
19558
19169
|
{ agent: "claude", paths: [".claude"] },
|
|
19559
19170
|
{ agent: "cursor", paths: [".cursor"] },
|
|
@@ -19582,7 +19193,7 @@ var AgentArtifactDetectionService = class {
|
|
|
19582
19193
|
}
|
|
19583
19194
|
} else {
|
|
19584
19195
|
for (const relativePath of check.paths) {
|
|
19585
|
-
const fullPath =
|
|
19196
|
+
const fullPath = path32.join(baseDirectory, relativePath);
|
|
19586
19197
|
const exists = await this.pathExists(fullPath);
|
|
19587
19198
|
if (exists) {
|
|
19588
19199
|
detected.push({
|
|
@@ -19598,7 +19209,7 @@ var AgentArtifactDetectionService = class {
|
|
|
19598
19209
|
}
|
|
19599
19210
|
async pathExists(filePath) {
|
|
19600
19211
|
try {
|
|
19601
|
-
await
|
|
19212
|
+
await fs23.access(filePath);
|
|
19602
19213
|
return true;
|
|
19603
19214
|
} catch {
|
|
19604
19215
|
return false;
|
|
@@ -19609,16 +19220,16 @@ var AgentArtifactDetectionService = class {
|
|
|
19609
19220
|
while (queue.length > 0) {
|
|
19610
19221
|
const currentDir = queue.shift();
|
|
19611
19222
|
for (const targetPath of targetPaths) {
|
|
19612
|
-
const fullPath =
|
|
19223
|
+
const fullPath = path32.join(currentDir, targetPath);
|
|
19613
19224
|
if (await this.pathExists(fullPath)) {
|
|
19614
19225
|
return fullPath;
|
|
19615
19226
|
}
|
|
19616
19227
|
}
|
|
19617
19228
|
try {
|
|
19618
|
-
const entries = await
|
|
19229
|
+
const entries = await fs23.readdir(currentDir, { withFileTypes: true });
|
|
19619
19230
|
for (const entry of entries) {
|
|
19620
19231
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
19621
|
-
queue.push(
|
|
19232
|
+
queue.push(path32.join(currentDir, entry.name));
|
|
19622
19233
|
}
|
|
19623
19234
|
}
|
|
19624
19235
|
} catch {
|
|
@@ -19629,22 +19240,22 @@ var AgentArtifactDetectionService = class {
|
|
|
19629
19240
|
};
|
|
19630
19241
|
|
|
19631
19242
|
// apps/cli/src/infra/commands/config/configAgentsHandler.ts
|
|
19632
|
-
var
|
|
19633
|
-
var
|
|
19243
|
+
var readline3 = __toESM(require("readline"));
|
|
19244
|
+
var inquirer = __toESM(require("inquirer"));
|
|
19634
19245
|
|
|
19635
19246
|
// apps/cli/src/infra/commands/config/agents/agentsHandlerUtils.ts
|
|
19636
|
-
var
|
|
19637
|
-
var
|
|
19247
|
+
var path33 = __toESM(require("path"));
|
|
19248
|
+
var fs24 = __toESM(require("fs/promises"));
|
|
19638
19249
|
function getRelativePath(dir, startDirectory) {
|
|
19639
19250
|
if (dir === startDirectory) return "./packmind.json";
|
|
19640
|
-
return "./" +
|
|
19251
|
+
return "./" + path33.relative(startDirectory, dir) + "/packmind.json";
|
|
19641
19252
|
}
|
|
19642
19253
|
async function resolveStartDirectory(args2, getCwd, exit) {
|
|
19643
19254
|
let startDirectory = getCwd();
|
|
19644
19255
|
if (args2.path) {
|
|
19645
|
-
const resolvedPath =
|
|
19256
|
+
const resolvedPath = path33.resolve(getCwd(), args2.path);
|
|
19646
19257
|
try {
|
|
19647
|
-
const stat9 = await
|
|
19258
|
+
const stat9 = await fs24.stat(resolvedPath);
|
|
19648
19259
|
if (!stat9.isDirectory()) {
|
|
19649
19260
|
logErrorConsole(`Path is not a directory: ${resolvedPath}`);
|
|
19650
19261
|
exit(1);
|
|
@@ -19706,9 +19317,9 @@ async function configAgentsHandler(deps) {
|
|
|
19706
19317
|
}));
|
|
19707
19318
|
let selectedAgents;
|
|
19708
19319
|
if (useSimplePrompt) {
|
|
19709
|
-
selectedAgents = await
|
|
19320
|
+
selectedAgents = await promptAgentsWithReadline(choices);
|
|
19710
19321
|
} else {
|
|
19711
|
-
const result = await
|
|
19322
|
+
const result = await inquirer.default.prompt([
|
|
19712
19323
|
{
|
|
19713
19324
|
type: "checkbox",
|
|
19714
19325
|
name: "selectedAgents",
|
|
@@ -19739,10 +19350,10 @@ async function configAgentsHandler(deps) {
|
|
|
19739
19350
|
);
|
|
19740
19351
|
}
|
|
19741
19352
|
}
|
|
19742
|
-
async function
|
|
19353
|
+
async function promptAgentsWithReadline(choices) {
|
|
19743
19354
|
const input = process.stdin;
|
|
19744
19355
|
const output = process.stdout;
|
|
19745
|
-
const rl =
|
|
19356
|
+
const rl = readline3.createInterface({
|
|
19746
19357
|
input,
|
|
19747
19358
|
output
|
|
19748
19359
|
});
|
|
@@ -19811,12 +19422,30 @@ async function propagateAgentsToDescendants(configRepository, baseDirectory, sel
|
|
|
19811
19422
|
}
|
|
19812
19423
|
|
|
19813
19424
|
// apps/cli/src/infra/commands/config/ConfigAgentsAddCommand.ts
|
|
19814
|
-
var
|
|
19815
|
-
var
|
|
19425
|
+
var readline4 = __toESM(require("readline"));
|
|
19426
|
+
var import_cmd_ts34 = __toESM(require_cjs());
|
|
19816
19427
|
|
|
19817
19428
|
// apps/cli/src/infra/commands/customParameters/AgentNamesPositional.ts
|
|
19818
|
-
var
|
|
19819
|
-
|
|
19429
|
+
var import_cmd_ts33 = __toESM(require_cjs());
|
|
19430
|
+
|
|
19431
|
+
// apps/cli/src/infra/commands/customParameters/AgentArgType.ts
|
|
19432
|
+
var VALID_AGENTS = Object.keys(CodingAgents).filter(
|
|
19433
|
+
(a) => a !== "packmind"
|
|
19434
|
+
);
|
|
19435
|
+
var AgentArgType = {
|
|
19436
|
+
from: async (input) => {
|
|
19437
|
+
const normalized = input.toLowerCase();
|
|
19438
|
+
if (VALID_AGENTS.includes(normalized)) {
|
|
19439
|
+
return normalized;
|
|
19440
|
+
}
|
|
19441
|
+
throw new Error(
|
|
19442
|
+
`Invalid agent '${input}'. Valid options are: ${VALID_AGENTS.join(", ")}`
|
|
19443
|
+
);
|
|
19444
|
+
}
|
|
19445
|
+
};
|
|
19446
|
+
|
|
19447
|
+
// apps/cli/src/infra/commands/customParameters/AgentNamesPositional.ts
|
|
19448
|
+
var agentNamesPositional = (0, import_cmd_ts33.restPositionals)({
|
|
19820
19449
|
type: AgentArgType,
|
|
19821
19450
|
displayName: "agents",
|
|
19822
19451
|
description: "Agent identifiers (e.g. claude cursor)"
|
|
@@ -19912,7 +19541,7 @@ To restore organization settings later, remove all local agents with: packmind-c
|
|
|
19912
19541
|
// apps/cli/src/infra/commands/config/ConfigAgentsAddCommand.ts
|
|
19913
19542
|
function createPromptConfirm() {
|
|
19914
19543
|
return (message) => new Promise((resolve15) => {
|
|
19915
|
-
const rl =
|
|
19544
|
+
const rl = readline4.createInterface({
|
|
19916
19545
|
input: process.stdin,
|
|
19917
19546
|
output: process.stdout
|
|
19918
19547
|
});
|
|
@@ -19922,12 +19551,12 @@ function createPromptConfirm() {
|
|
|
19922
19551
|
});
|
|
19923
19552
|
});
|
|
19924
19553
|
}
|
|
19925
|
-
var addAgentsCommand = (0,
|
|
19554
|
+
var addAgentsCommand = (0, import_cmd_ts34.command)({
|
|
19926
19555
|
name: "add",
|
|
19927
19556
|
description: "Add coding agents to packmind.json files",
|
|
19928
19557
|
args: {
|
|
19929
|
-
path: (0,
|
|
19930
|
-
type:
|
|
19558
|
+
path: (0, import_cmd_ts34.option)({
|
|
19559
|
+
type: import_cmd_ts34.string,
|
|
19931
19560
|
short: "p",
|
|
19932
19561
|
long: "path",
|
|
19933
19562
|
defaultValue: () => "",
|
|
@@ -19953,7 +19582,7 @@ var addAgentsCommand = (0, import_cmd_ts35.command)({
|
|
|
19953
19582
|
});
|
|
19954
19583
|
|
|
19955
19584
|
// apps/cli/src/infra/commands/config/ConfigAgentsListCommand.ts
|
|
19956
|
-
var
|
|
19585
|
+
var import_cmd_ts35 = __toESM(require_cjs());
|
|
19957
19586
|
|
|
19958
19587
|
// apps/cli/src/infra/commands/config/agents/listAgentsHandler.ts
|
|
19959
19588
|
var SOURCE_LABELS = {
|
|
@@ -20033,12 +19662,12 @@ async function listAgentsHandler(args2, deps) {
|
|
|
20033
19662
|
}
|
|
20034
19663
|
|
|
20035
19664
|
// apps/cli/src/infra/commands/config/ConfigAgentsListCommand.ts
|
|
20036
|
-
var listAgentsCommand = (0,
|
|
19665
|
+
var listAgentsCommand = (0, import_cmd_ts35.command)({
|
|
20037
19666
|
name: "list",
|
|
20038
19667
|
description: "List coding agents configured across packmind.json files",
|
|
20039
19668
|
args: {
|
|
20040
|
-
path: (0,
|
|
20041
|
-
type:
|
|
19669
|
+
path: (0, import_cmd_ts35.option)({
|
|
19670
|
+
type: import_cmd_ts35.string,
|
|
20042
19671
|
short: "p",
|
|
20043
19672
|
long: "path",
|
|
20044
19673
|
defaultValue: () => "",
|
|
@@ -20062,7 +19691,7 @@ var listAgentsCommand = (0, import_cmd_ts36.command)({
|
|
|
20062
19691
|
});
|
|
20063
19692
|
|
|
20064
19693
|
// apps/cli/src/infra/commands/config/ConfigAgentsRemoveCommand.ts
|
|
20065
|
-
var
|
|
19694
|
+
var import_cmd_ts36 = __toESM(require_cjs());
|
|
20066
19695
|
|
|
20067
19696
|
// apps/cli/src/infra/commands/config/agents/removeAgentsHandler.ts
|
|
20068
19697
|
async function removeAgentsHandler(args2, deps) {
|
|
@@ -20145,13 +19774,13 @@ function logConfiguredAgentsHint(configuredAgents) {
|
|
|
20145
19774
|
}
|
|
20146
19775
|
|
|
20147
19776
|
// apps/cli/src/infra/commands/config/ConfigAgentsRemoveCommand.ts
|
|
20148
|
-
var removeAgentsCommand = (0,
|
|
19777
|
+
var removeAgentsCommand = (0, import_cmd_ts36.command)({
|
|
20149
19778
|
name: "rm",
|
|
20150
19779
|
aliases: ["remove"],
|
|
20151
19780
|
description: "Remove coding agents from packmind.json files",
|
|
20152
19781
|
args: {
|
|
20153
|
-
path: (0,
|
|
20154
|
-
type:
|
|
19782
|
+
path: (0, import_cmd_ts36.option)({
|
|
19783
|
+
type: import_cmd_ts36.string,
|
|
20155
19784
|
short: "p",
|
|
20156
19785
|
long: "path",
|
|
20157
19786
|
defaultValue: () => "",
|
|
@@ -20173,7 +19802,7 @@ var removeAgentsCommand = (0, import_cmd_ts37.command)({
|
|
|
20173
19802
|
});
|
|
20174
19803
|
|
|
20175
19804
|
// apps/cli/src/infra/commands/config/ConfigAgentsCommand.ts
|
|
20176
|
-
var configAgentsSetupCommand = (0,
|
|
19805
|
+
var configAgentsSetupCommand = (0, import_cmd_ts37.command)({
|
|
20177
19806
|
name: "setup",
|
|
20178
19807
|
description: "Configure which coding agents to generate artifacts for",
|
|
20179
19808
|
args: {},
|
|
@@ -20191,7 +19820,7 @@ var configAgentsSetupCommand = (0, import_cmd_ts38.command)({
|
|
|
20191
19820
|
});
|
|
20192
19821
|
}
|
|
20193
19822
|
});
|
|
20194
|
-
var configAgentsCommand = (0,
|
|
19823
|
+
var configAgentsCommand = (0, import_cmd_ts37.subcommands)({
|
|
20195
19824
|
name: "agents",
|
|
20196
19825
|
description: "Manage coding agents configuration",
|
|
20197
19826
|
cmds: {
|
|
@@ -20203,7 +19832,7 @@ var configAgentsCommand = (0, import_cmd_ts38.subcommands)({
|
|
|
20203
19832
|
});
|
|
20204
19833
|
|
|
20205
19834
|
// apps/cli/src/infra/commands/config/ConfigCommand.ts
|
|
20206
|
-
var configCommand = (0,
|
|
19835
|
+
var configCommand = (0, import_cmd_ts38.subcommands)({
|
|
20207
19836
|
name: "config",
|
|
20208
19837
|
description: "Manage Packmind configuration",
|
|
20209
19838
|
cmds: {
|
|
@@ -20212,7 +19841,7 @@ var configCommand = (0, import_cmd_ts39.subcommands)({
|
|
|
20212
19841
|
});
|
|
20213
19842
|
|
|
20214
19843
|
// apps/cli/src/infra/commands/InitCommand.ts
|
|
20215
|
-
var
|
|
19844
|
+
var import_cmd_ts39 = __toESM(require_cjs());
|
|
20216
19845
|
|
|
20217
19846
|
// apps/cli/src/infra/commands/initHandler.ts
|
|
20218
19847
|
async function initHandler(deps) {
|
|
@@ -20273,8 +19902,8 @@ async function initHandler(deps) {
|
|
|
20273
19902
|
}
|
|
20274
19903
|
|
|
20275
19904
|
// apps/cli/src/infra/commands/InitCommand.ts
|
|
20276
|
-
var { version:
|
|
20277
|
-
var initCommand = (0,
|
|
19905
|
+
var { version: CLI_VERSION4 } = require_package();
|
|
19906
|
+
var initCommand = (0, import_cmd_ts39.command)({
|
|
20278
19907
|
name: "init",
|
|
20279
19908
|
description: "Initialize Packmind in the current project",
|
|
20280
19909
|
args: {},
|
|
@@ -20290,7 +19919,7 @@ var initCommand = (0, import_cmd_ts40.command)({
|
|
|
20290
19919
|
packmindGateway: packmindCliHexa.getPackmindGateway(),
|
|
20291
19920
|
baseDirectory,
|
|
20292
19921
|
installDefaultSkills: packmindCliHexa.installDefaultSkills.bind(packmindCliHexa),
|
|
20293
|
-
cliVersion:
|
|
19922
|
+
cliVersion: CLI_VERSION4
|
|
20294
19923
|
});
|
|
20295
19924
|
if (!result.success) {
|
|
20296
19925
|
for (const error of result.errors) {
|
|
@@ -20302,20 +19931,20 @@ var initCommand = (0, import_cmd_ts40.command)({
|
|
|
20302
19931
|
});
|
|
20303
19932
|
|
|
20304
19933
|
// apps/cli/src/infra/commands/UpdateCommand.ts
|
|
20305
|
-
var
|
|
20306
|
-
var { version:
|
|
20307
|
-
var updateCommand = (0,
|
|
19934
|
+
var import_cmd_ts40 = __toESM(require_cjs());
|
|
19935
|
+
var { version: CLI_VERSION5 } = require_package();
|
|
19936
|
+
var updateCommand = (0, import_cmd_ts40.command)({
|
|
20308
19937
|
name: "update",
|
|
20309
19938
|
description: "Update packmind-cli to the latest version",
|
|
20310
19939
|
args: {
|
|
20311
|
-
check: (0,
|
|
19940
|
+
check: (0, import_cmd_ts40.flag)({
|
|
20312
19941
|
long: "check",
|
|
20313
19942
|
description: "Only check if a newer version is available without performing the update"
|
|
20314
19943
|
})
|
|
20315
19944
|
},
|
|
20316
19945
|
handler: async ({ check }) => {
|
|
20317
19946
|
await updateHandler({
|
|
20318
|
-
currentVersion:
|
|
19947
|
+
currentVersion: CLI_VERSION5,
|
|
20319
19948
|
isExecutableMode: hasEmbeddedWasmFiles(),
|
|
20320
19949
|
executablePath: process.execPath,
|
|
20321
19950
|
scriptPath: require.main?.filename,
|
|
@@ -20328,25 +19957,25 @@ var updateCommand = (0, import_cmd_ts41.command)({
|
|
|
20328
19957
|
});
|
|
20329
19958
|
|
|
20330
19959
|
// apps/cli/src/main.ts
|
|
20331
|
-
var { version:
|
|
19960
|
+
var { version: CLI_VERSION6 } = require_package();
|
|
20332
19961
|
function findEnvFile() {
|
|
20333
19962
|
const currentDir = process.cwd();
|
|
20334
19963
|
const gitService = new GitService();
|
|
20335
19964
|
const gitRoot = gitService.getGitRepositoryRootSync(currentDir);
|
|
20336
|
-
const filesystemRoot =
|
|
19965
|
+
const filesystemRoot = path34.parse(currentDir).root;
|
|
20337
19966
|
const stopDir = gitRoot ?? filesystemRoot;
|
|
20338
19967
|
let searchDir = currentDir;
|
|
20339
|
-
let parentDir =
|
|
19968
|
+
let parentDir = path34.dirname(searchDir);
|
|
20340
19969
|
while (searchDir !== parentDir) {
|
|
20341
|
-
const envPath2 =
|
|
20342
|
-
if (
|
|
19970
|
+
const envPath2 = path34.join(searchDir, ".env");
|
|
19971
|
+
if (fs25.existsSync(envPath2)) {
|
|
20343
19972
|
return envPath2;
|
|
20344
19973
|
}
|
|
20345
19974
|
if (searchDir === stopDir) {
|
|
20346
19975
|
return null;
|
|
20347
19976
|
}
|
|
20348
19977
|
searchDir = parentDir;
|
|
20349
|
-
parentDir =
|
|
19978
|
+
parentDir = path34.dirname(searchDir);
|
|
20350
19979
|
}
|
|
20351
19980
|
return null;
|
|
20352
19981
|
}
|
|
@@ -20363,10 +19992,10 @@ if (hasEmbeddedWasmFiles()) {
|
|
|
20363
19992
|
}
|
|
20364
19993
|
var args = process.argv.slice(2);
|
|
20365
19994
|
if (args.includes("--version") || args.includes("-v")) {
|
|
20366
|
-
logConsole(`packmind-cli version ${
|
|
19995
|
+
logConsole(`packmind-cli version ${CLI_VERSION6}`);
|
|
20367
19996
|
process.exit(0);
|
|
20368
19997
|
}
|
|
20369
|
-
var app = (0,
|
|
19998
|
+
var app = (0, import_cmd_ts41.subcommands)({
|
|
20370
19999
|
name: "packmind-cli",
|
|
20371
20000
|
description: "Packmind CLI tool",
|
|
20372
20001
|
cmds: {
|
|
@@ -20380,7 +20009,6 @@ var app = (0, import_cmd_ts42.subcommands)({
|
|
|
20380
20009
|
logout: logoutCommand,
|
|
20381
20010
|
packages: packagesCommand,
|
|
20382
20011
|
playbook: playbookCommand,
|
|
20383
|
-
"setup-mcp": setupMcpCommand,
|
|
20384
20012
|
skills: skillsCommand,
|
|
20385
20013
|
spaces: spacesCommand,
|
|
20386
20014
|
standards: standardsCommand,
|
|
@@ -20389,7 +20017,7 @@ var app = (0, import_cmd_ts42.subcommands)({
|
|
|
20389
20017
|
whoami: whoamiCommand
|
|
20390
20018
|
}
|
|
20391
20019
|
});
|
|
20392
|
-
(0,
|
|
20020
|
+
(0, import_cmd_ts41.run)(app, args).catch((error) => {
|
|
20393
20021
|
logErrorConsole(error.message);
|
|
20394
20022
|
process.exit(1);
|
|
20395
20023
|
});
|