@packmind/cli 0.26.1 → 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 +577 -1048
- package/package.json +1 -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;
|
|
@@ -1701,12 +1701,12 @@ var require_command = __commonJS({
|
|
|
1701
1701
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1702
1702
|
};
|
|
1703
1703
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1704
|
-
exports2.command =
|
|
1704
|
+
exports2.command = command32;
|
|
1705
1705
|
var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
|
|
1706
1706
|
var Result = __importStar(require_Result());
|
|
1707
1707
|
var circuitbreaker_1 = require_circuitbreaker();
|
|
1708
1708
|
var utils_1 = require_utils();
|
|
1709
|
-
function
|
|
1709
|
+
function command32(config) {
|
|
1710
1710
|
const argEntries = (0, utils_1.entries)(config.args);
|
|
1711
1711
|
const circuitbreaker = (0, circuitbreaker_1.createCircuitBreaker)(!!config.version);
|
|
1712
1712
|
return {
|
|
@@ -2590,7 +2590,7 @@ var require_has_flag = __commonJS({
|
|
|
2590
2590
|
var require_supports_color = __commonJS({
|
|
2591
2591
|
"node_modules/supports-color/index.js"(exports2, module2) {
|
|
2592
2592
|
"use strict";
|
|
2593
|
-
var
|
|
2593
|
+
var os4 = require("os");
|
|
2594
2594
|
var tty2 = require("tty");
|
|
2595
2595
|
var hasFlag2 = require_has_flag();
|
|
2596
2596
|
var { env: env2 } = process;
|
|
@@ -2638,7 +2638,7 @@ var require_supports_color = __commonJS({
|
|
|
2638
2638
|
return min;
|
|
2639
2639
|
}
|
|
2640
2640
|
if (process.platform === "win32") {
|
|
2641
|
-
const osRelease =
|
|
2641
|
+
const osRelease = os4.release().split(".");
|
|
2642
2642
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
2643
2643
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
2644
2644
|
}
|
|
@@ -3430,11 +3430,11 @@ var require_multioption = __commonJS({
|
|
|
3430
3430
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
3431
3431
|
};
|
|
3432
3432
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3433
|
-
exports2.multioption =
|
|
3433
|
+
exports2.multioption = multioption2;
|
|
3434
3434
|
var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
|
|
3435
3435
|
var Result = __importStar(require_Result());
|
|
3436
3436
|
var findOption_1 = require_findOption();
|
|
3437
|
-
function
|
|
3437
|
+
function multioption2(config) {
|
|
3438
3438
|
return {
|
|
3439
3439
|
helpTopics() {
|
|
3440
3440
|
var _a, _b;
|
|
@@ -3855,7 +3855,7 @@ var require_package = __commonJS({
|
|
|
3855
3855
|
"apps/cli/package.json"(exports2, module2) {
|
|
3856
3856
|
module2.exports = {
|
|
3857
3857
|
name: "@packmind/cli",
|
|
3858
|
-
version: "0.
|
|
3858
|
+
version: "0.27.0",
|
|
3859
3859
|
description: "A command-line interface for Packmind linting and code quality checks",
|
|
3860
3860
|
private: false,
|
|
3861
3861
|
bin: {
|
|
@@ -3901,7 +3901,7 @@ var require_package = __commonJS({
|
|
|
3901
3901
|
});
|
|
3902
3902
|
|
|
3903
3903
|
// apps/cli/src/main.ts
|
|
3904
|
-
var
|
|
3904
|
+
var import_cmd_ts41 = __toESM(require_cjs());
|
|
3905
3905
|
|
|
3906
3906
|
// apps/cli/src/infra/commands/LinterCommand.ts
|
|
3907
3907
|
var import_cmd_ts = __toESM(require_cjs());
|
|
@@ -5320,8 +5320,8 @@ var ExecuteSingleFileAstUseCase = class _ExecuteSingleFileAstUseCase {
|
|
|
5320
5320
|
static {
|
|
5321
5321
|
this.fallbackRuleContent = "adhoc-rule";
|
|
5322
5322
|
}
|
|
5323
|
-
async execute(
|
|
5324
|
-
const { program, fileContent, language } =
|
|
5323
|
+
async execute(command32) {
|
|
5324
|
+
const { program, fileContent, language } = command32;
|
|
5325
5325
|
const result = await this.linterExecutionUseCase.execute({
|
|
5326
5326
|
filePath: "cli-single-file",
|
|
5327
5327
|
fileContent,
|
|
@@ -5380,30 +5380,30 @@ var GitService = class {
|
|
|
5380
5380
|
this.gitRunner = gitRunner;
|
|
5381
5381
|
this.logger = logger2;
|
|
5382
5382
|
}
|
|
5383
|
-
getGitRepositoryRoot(
|
|
5383
|
+
getGitRepositoryRoot(path35) {
|
|
5384
5384
|
try {
|
|
5385
5385
|
const { stdout } = this.gitRunner("rev-parse --show-toplevel", {
|
|
5386
|
-
cwd:
|
|
5386
|
+
cwd: path35
|
|
5387
5387
|
});
|
|
5388
5388
|
const gitRoot = stdout.trim();
|
|
5389
5389
|
this.logger.debug("Resolved git repository root", {
|
|
5390
|
-
inputPath:
|
|
5390
|
+
inputPath: path35,
|
|
5391
5391
|
gitRoot
|
|
5392
5392
|
});
|
|
5393
5393
|
return gitRoot;
|
|
5394
5394
|
} catch (error) {
|
|
5395
5395
|
if (error instanceof Error) {
|
|
5396
5396
|
throw new Error(
|
|
5397
|
-
`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.
|
|
5398
5398
|
${error.message}`
|
|
5399
5399
|
);
|
|
5400
5400
|
}
|
|
5401
5401
|
throw new Error("Failed to get Git repository root: Unknown error");
|
|
5402
5402
|
}
|
|
5403
5403
|
}
|
|
5404
|
-
tryGetGitRepositoryRoot(
|
|
5404
|
+
tryGetGitRepositoryRoot(path35) {
|
|
5405
5405
|
try {
|
|
5406
|
-
return this.getGitRepositoryRoot(
|
|
5406
|
+
return this.getGitRepositoryRoot(path35);
|
|
5407
5407
|
} catch {
|
|
5408
5408
|
return null;
|
|
5409
5409
|
}
|
|
@@ -5705,8 +5705,8 @@ var GetGitRemoteUrlUseCase = class {
|
|
|
5705
5705
|
constructor(gitRemoteUrlService = new GitService()) {
|
|
5706
5706
|
this.gitRemoteUrlService = gitRemoteUrlService;
|
|
5707
5707
|
}
|
|
5708
|
-
async execute(
|
|
5709
|
-
const { path: repoPath, origin: origin9 } =
|
|
5708
|
+
async execute(command32) {
|
|
5709
|
+
const { path: repoPath, origin: origin9 } = command32;
|
|
5710
5710
|
return this.gitRemoteUrlService.getGitRemoteUrl(repoPath, origin9);
|
|
5711
5711
|
}
|
|
5712
5712
|
};
|
|
@@ -5858,8 +5858,8 @@ var ListFilesInDirectoryUseCase = class {
|
|
|
5858
5858
|
constructor(listFiles = new ListFiles()) {
|
|
5859
5859
|
this.listFiles = listFiles;
|
|
5860
5860
|
}
|
|
5861
|
-
async execute(
|
|
5862
|
-
const { path: directoryPath, extensions, excludes = [] } =
|
|
5861
|
+
async execute(command32) {
|
|
5862
|
+
const { path: directoryPath, extensions, excludes = [] } = command32;
|
|
5863
5863
|
const files = await this.listFiles.listFilesInDirectory(
|
|
5864
5864
|
directoryPath,
|
|
5865
5865
|
extensions,
|
|
@@ -5974,7 +5974,7 @@ var LintFilesAgainstRuleUseCase = class {
|
|
|
5974
5974
|
};
|
|
5975
5975
|
};
|
|
5976
5976
|
}
|
|
5977
|
-
async execute(
|
|
5977
|
+
async execute(command32) {
|
|
5978
5978
|
const {
|
|
5979
5979
|
path: userPath,
|
|
5980
5980
|
draftMode,
|
|
@@ -5983,7 +5983,7 @@ var LintFilesAgainstRuleUseCase = class {
|
|
|
5983
5983
|
language,
|
|
5984
5984
|
diffMode,
|
|
5985
5985
|
ignorePatterns
|
|
5986
|
-
} =
|
|
5986
|
+
} = command32;
|
|
5987
5987
|
this.logger.debug(
|
|
5988
5988
|
`Starting linting: path="${userPath}", draftMode=${!!draftMode}, standardSlug="${standardSlug || "N/A"}", ruleId="${ruleId || "N/A"}", language="${language || "N/A"}", diffMode="${diffMode ?? "none"}"`
|
|
5989
5989
|
);
|
|
@@ -6299,8 +6299,8 @@ var LintFilesAgainstRuleUseCase = class {
|
|
|
6299
6299
|
return null;
|
|
6300
6300
|
}
|
|
6301
6301
|
}
|
|
6302
|
-
async executeProgramsForFile(
|
|
6303
|
-
const result = await this.services.linterExecutionUseCase.execute(
|
|
6302
|
+
async executeProgramsForFile(command32) {
|
|
6303
|
+
const result = await this.services.linterExecutionUseCase.execute(command32);
|
|
6304
6304
|
return result.violations;
|
|
6305
6305
|
}
|
|
6306
6306
|
extractExtensionFromFile(filePath) {
|
|
@@ -6323,8 +6323,8 @@ var LintFilesFromConfigUseCase = class {
|
|
|
6323
6323
|
this.logger = logger2;
|
|
6324
6324
|
this.detectionProgramsCache = /* @__PURE__ */ new Map();
|
|
6325
6325
|
}
|
|
6326
|
-
async execute(
|
|
6327
|
-
const { path: userPath, diffMode, ignorePatterns } =
|
|
6326
|
+
async execute(command32) {
|
|
6327
|
+
const { path: userPath, diffMode, ignorePatterns } = command32;
|
|
6328
6328
|
this.logger.debug(
|
|
6329
6329
|
`Starting local linting: path="${userPath}", diffMode="${diffMode ?? "none"}"`
|
|
6330
6330
|
);
|
|
@@ -6584,8 +6584,8 @@ var LintFilesFromConfigUseCase = class {
|
|
|
6584
6584
|
return null;
|
|
6585
6585
|
}
|
|
6586
6586
|
}
|
|
6587
|
-
async executeProgramsForFile(
|
|
6588
|
-
const result = await this.services.linterExecutionUseCase.execute(
|
|
6587
|
+
async executeProgramsForFile(command32) {
|
|
6588
|
+
const result = await this.services.linterExecutionUseCase.execute(command32);
|
|
6589
6589
|
return result.violations;
|
|
6590
6590
|
}
|
|
6591
6591
|
extractExtensionFromFile(filePath) {
|
|
@@ -6668,10 +6668,10 @@ var PackmindHttpClient = class {
|
|
|
6668
6668
|
return null;
|
|
6669
6669
|
}
|
|
6670
6670
|
}
|
|
6671
|
-
async request(
|
|
6671
|
+
async request(path35, options = {}) {
|
|
6672
6672
|
const { host } = this.getAuthContext();
|
|
6673
6673
|
const { method = "GET", body } = options;
|
|
6674
|
-
const url = `${host}${
|
|
6674
|
+
const url = `${host}${path35}`;
|
|
6675
6675
|
try {
|
|
6676
6676
|
const response = await fetch(url, {
|
|
6677
6677
|
method,
|
|
@@ -6722,13 +6722,13 @@ var PackmindHttpClient = class {
|
|
|
6722
6722
|
var ChangeProposalGateway = class {
|
|
6723
6723
|
constructor(httpClient) {
|
|
6724
6724
|
this.httpClient = httpClient;
|
|
6725
|
-
this.batchCreate = async (
|
|
6725
|
+
this.batchCreate = async (command32) => {
|
|
6726
6726
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6727
6727
|
return this.httpClient.request(
|
|
6728
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6728
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/change-proposals/batch`,
|
|
6729
6729
|
{
|
|
6730
6730
|
method: "POST",
|
|
6731
|
-
body: { proposals:
|
|
6731
|
+
body: { proposals: command32.proposals },
|
|
6732
6732
|
onError: (response) => {
|
|
6733
6733
|
if (response.status === 404) {
|
|
6734
6734
|
throw new CommunityEditionError("change proposals");
|
|
@@ -6737,29 +6737,29 @@ var ChangeProposalGateway = class {
|
|
|
6737
6737
|
}
|
|
6738
6738
|
);
|
|
6739
6739
|
};
|
|
6740
|
-
this.batchApply = async (
|
|
6740
|
+
this.batchApply = async (command32) => {
|
|
6741
6741
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6742
6742
|
return this.httpClient.request(
|
|
6743
6743
|
`/api/v0/organizations/${organizationId}/playbook/apply`,
|
|
6744
6744
|
{
|
|
6745
6745
|
method: "POST",
|
|
6746
6746
|
body: {
|
|
6747
|
-
proposals:
|
|
6748
|
-
message:
|
|
6749
|
-
...
|
|
6750
|
-
directUpdate:
|
|
6747
|
+
proposals: command32.proposals,
|
|
6748
|
+
message: command32.message,
|
|
6749
|
+
...command32.directUpdate !== void 0 && {
|
|
6750
|
+
directUpdate: command32.directUpdate
|
|
6751
6751
|
}
|
|
6752
6752
|
}
|
|
6753
6753
|
}
|
|
6754
6754
|
);
|
|
6755
6755
|
};
|
|
6756
|
-
this.check = async (
|
|
6756
|
+
this.check = async (command32) => {
|
|
6757
6757
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6758
6758
|
return this.httpClient.request(
|
|
6759
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6759
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/change-proposals/check`,
|
|
6760
6760
|
{
|
|
6761
6761
|
method: "POST",
|
|
6762
|
-
body: { proposals:
|
|
6762
|
+
body: { proposals: command32.proposals },
|
|
6763
6763
|
onError: (response) => {
|
|
6764
6764
|
if (response.status === 404) {
|
|
6765
6765
|
throw new CommunityEditionError("change proposals");
|
|
@@ -6775,13 +6775,13 @@ var ChangeProposalGateway = class {
|
|
|
6775
6775
|
var LinterGateway = class {
|
|
6776
6776
|
constructor(httpClient) {
|
|
6777
6777
|
this.httpClient = httpClient;
|
|
6778
|
-
this.getDraftDetectionProgramsForRule = async (
|
|
6778
|
+
this.getDraftDetectionProgramsForRule = async (command32) => {
|
|
6779
6779
|
const payload = {
|
|
6780
|
-
standardSlug:
|
|
6781
|
-
ruleId:
|
|
6780
|
+
standardSlug: command32.standardSlug,
|
|
6781
|
+
ruleId: command32.ruleId
|
|
6782
6782
|
};
|
|
6783
|
-
if (
|
|
6784
|
-
payload.language =
|
|
6783
|
+
if (command32.language) {
|
|
6784
|
+
payload.language = command32.language;
|
|
6785
6785
|
}
|
|
6786
6786
|
return this.httpClient.request("/api/v0/list-draft-detection-program", {
|
|
6787
6787
|
method: "POST",
|
|
@@ -6793,13 +6793,13 @@ var LinterGateway = class {
|
|
|
6793
6793
|
}
|
|
6794
6794
|
});
|
|
6795
6795
|
};
|
|
6796
|
-
this.getActiveDetectionProgramsForRule = async (
|
|
6796
|
+
this.getActiveDetectionProgramsForRule = async (command32) => {
|
|
6797
6797
|
const payload = {
|
|
6798
|
-
standardSlug:
|
|
6799
|
-
ruleId:
|
|
6798
|
+
standardSlug: command32.standardSlug,
|
|
6799
|
+
ruleId: command32.ruleId
|
|
6800
6800
|
};
|
|
6801
|
-
if (
|
|
6802
|
-
payload.language =
|
|
6801
|
+
if (command32.language) {
|
|
6802
|
+
payload.language = command32.language;
|
|
6803
6803
|
}
|
|
6804
6804
|
return this.httpClient.request("/api/v0/list-active-detection-program", {
|
|
6805
6805
|
method: "POST",
|
|
@@ -6811,13 +6811,13 @@ var LinterGateway = class {
|
|
|
6811
6811
|
}
|
|
6812
6812
|
});
|
|
6813
6813
|
};
|
|
6814
|
-
this.getDetectionProgramsForPackages = async (
|
|
6814
|
+
this.getDetectionProgramsForPackages = async (command32) => {
|
|
6815
6815
|
const response = await this.httpClient.request(
|
|
6816
6816
|
"/api/v0/detection-programs-for-packages",
|
|
6817
6817
|
{
|
|
6818
6818
|
method: "POST",
|
|
6819
6819
|
body: {
|
|
6820
|
-
packagesSlugs:
|
|
6820
|
+
packagesSlugs: command32.packagesSlugs
|
|
6821
6821
|
},
|
|
6822
6822
|
onError: (response2) => {
|
|
6823
6823
|
if (response2.status === 404) {
|
|
@@ -6828,10 +6828,10 @@ var LinterGateway = class {
|
|
|
6828
6828
|
);
|
|
6829
6829
|
return handleScopeInTargetsResponse(response);
|
|
6830
6830
|
};
|
|
6831
|
-
this.trackLinterExecution = async (
|
|
6831
|
+
this.trackLinterExecution = async (command32) => {
|
|
6832
6832
|
return this.httpClient.request(`/api/v0/track-execution`, {
|
|
6833
6833
|
method: "POST",
|
|
6834
|
-
body:
|
|
6834
|
+
body: command32
|
|
6835
6835
|
});
|
|
6836
6836
|
};
|
|
6837
6837
|
}
|
|
@@ -6853,25 +6853,6 @@ function handleScopeInTargetsResponse(response) {
|
|
|
6853
6853
|
};
|
|
6854
6854
|
}
|
|
6855
6855
|
|
|
6856
|
-
// apps/cli/src/infra/repositories/McpGateway.ts
|
|
6857
|
-
var McpGateway = class {
|
|
6858
|
-
constructor(httpClient) {
|
|
6859
|
-
this.httpClient = httpClient;
|
|
6860
|
-
this.getToken = async () => {
|
|
6861
|
-
const { organizationId } = this.httpClient.getAuthContext();
|
|
6862
|
-
return this.httpClient.request(
|
|
6863
|
-
`/api/v0/organizations/${organizationId}/mcp/token`
|
|
6864
|
-
);
|
|
6865
|
-
};
|
|
6866
|
-
this.getUrl = async () => {
|
|
6867
|
-
const { organizationId } = this.httpClient.getAuthContext();
|
|
6868
|
-
return this.httpClient.request(
|
|
6869
|
-
`/api/v0/organizations/${organizationId}/mcp/url`
|
|
6870
|
-
);
|
|
6871
|
-
};
|
|
6872
|
-
}
|
|
6873
|
-
};
|
|
6874
|
-
|
|
6875
6856
|
// apps/cli/src/infra/repositories/SpacesGateway.ts
|
|
6876
6857
|
var SpacesGateway = class {
|
|
6877
6858
|
constructor(httpClient) {
|
|
@@ -6904,27 +6885,27 @@ var SpacesGateway = class {
|
|
|
6904
6885
|
var SkillsGateway = class {
|
|
6905
6886
|
constructor(httpClient) {
|
|
6906
6887
|
this.httpClient = httpClient;
|
|
6907
|
-
this.upload = async (
|
|
6888
|
+
this.upload = async (command32) => {
|
|
6908
6889
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6909
6890
|
return this.httpClient.request(
|
|
6910
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6891
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/skills/upload`,
|
|
6911
6892
|
{
|
|
6912
6893
|
method: "POST",
|
|
6913
|
-
body:
|
|
6894
|
+
body: command32
|
|
6914
6895
|
}
|
|
6915
6896
|
);
|
|
6916
6897
|
};
|
|
6917
|
-
this.getDefaults = async (
|
|
6898
|
+
this.getDefaults = async (command32) => {
|
|
6918
6899
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6919
6900
|
const queryParams = new URLSearchParams();
|
|
6920
|
-
if (
|
|
6901
|
+
if (command32.includeBeta) {
|
|
6921
6902
|
queryParams.set("includeBeta", "true");
|
|
6922
|
-
} else if (
|
|
6923
|
-
queryParams.set("cliVersion",
|
|
6903
|
+
} else if (command32.cliVersion) {
|
|
6904
|
+
queryParams.set("cliVersion", command32.cliVersion);
|
|
6924
6905
|
}
|
|
6925
|
-
if (
|
|
6906
|
+
if (command32.agents !== void 0) {
|
|
6926
6907
|
queryParams.append("agentsConfigOverride", "true");
|
|
6927
|
-
|
|
6908
|
+
command32.agents.forEach((agent) => {
|
|
6928
6909
|
queryParams.append("agent", agent);
|
|
6929
6910
|
});
|
|
6930
6911
|
}
|
|
@@ -6933,10 +6914,10 @@ var SkillsGateway = class {
|
|
|
6933
6914
|
`/api/v0/organizations/${organizationId}/skills/default${queryString ? `?${queryString}` : ""}`
|
|
6934
6915
|
);
|
|
6935
6916
|
};
|
|
6936
|
-
this.list = async (
|
|
6917
|
+
this.list = async (command32) => {
|
|
6937
6918
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6938
6919
|
return this.httpClient.request(
|
|
6939
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6920
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/skills`
|
|
6940
6921
|
);
|
|
6941
6922
|
};
|
|
6942
6923
|
}
|
|
@@ -6946,17 +6927,17 @@ var SkillsGateway = class {
|
|
|
6946
6927
|
var CommandsGateway = class {
|
|
6947
6928
|
constructor(httpClient) {
|
|
6948
6929
|
this.httpClient = httpClient;
|
|
6949
|
-
this.create = async (
|
|
6930
|
+
this.create = async (command32) => {
|
|
6950
6931
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6951
6932
|
return this.httpClient.request(
|
|
6952
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6953
|
-
{ method: "POST", body:
|
|
6933
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/recipes`,
|
|
6934
|
+
{ method: "POST", body: command32 }
|
|
6954
6935
|
);
|
|
6955
6936
|
};
|
|
6956
|
-
this.list = async (
|
|
6937
|
+
this.list = async (command32) => {
|
|
6957
6938
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6958
6939
|
const listRecipesResponse = await this.httpClient.request(
|
|
6959
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6940
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/recipes`
|
|
6960
6941
|
);
|
|
6961
6942
|
if (listRecipesResponse instanceof Array) {
|
|
6962
6943
|
return { recipes: listRecipesResponse };
|
|
@@ -6997,10 +6978,10 @@ var StandardsGateway = class {
|
|
|
6997
6978
|
}
|
|
6998
6979
|
);
|
|
6999
6980
|
};
|
|
7000
|
-
this.list = async (
|
|
6981
|
+
this.list = async (command32) => {
|
|
7001
6982
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7002
6983
|
return this.httpClient.request(
|
|
7003
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6984
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/standards`
|
|
7004
6985
|
);
|
|
7005
6986
|
};
|
|
7006
6987
|
}
|
|
@@ -7011,10 +6992,10 @@ var PackagesGateway = class {
|
|
|
7011
6992
|
constructor(apiKey, httpClient) {
|
|
7012
6993
|
this.apiKey = apiKey;
|
|
7013
6994
|
this.httpClient = httpClient;
|
|
7014
|
-
this.list = async (
|
|
6995
|
+
this.list = async (command32) => {
|
|
7015
6996
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7016
6997
|
return this.httpClient.request(
|
|
7017
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6998
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/packages`
|
|
7018
6999
|
);
|
|
7019
7000
|
};
|
|
7020
7001
|
this.getSummary = async ({
|
|
@@ -7026,24 +7007,24 @@ var PackagesGateway = class {
|
|
|
7026
7007
|
`/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/summary/${encodeURIComponent(slug3)}`
|
|
7027
7008
|
);
|
|
7028
7009
|
};
|
|
7029
|
-
this.create = async (
|
|
7010
|
+
this.create = async (command32) => {
|
|
7030
7011
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7031
7012
|
return this.httpClient.request(
|
|
7032
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
7013
|
+
`/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/packages`,
|
|
7033
7014
|
{
|
|
7034
7015
|
method: "POST",
|
|
7035
|
-
body:
|
|
7016
|
+
body: command32
|
|
7036
7017
|
}
|
|
7037
7018
|
);
|
|
7038
7019
|
};
|
|
7039
|
-
this.addArtefacts = async (
|
|
7020
|
+
this.addArtefacts = async (command32) => {
|
|
7040
7021
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7041
|
-
const { packageId, spaceId } =
|
|
7022
|
+
const { packageId, spaceId } = command32;
|
|
7042
7023
|
return this.httpClient.request(
|
|
7043
7024
|
`/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/${packageId}/add-artifacts`,
|
|
7044
7025
|
{
|
|
7045
7026
|
method: "POST",
|
|
7046
|
-
body:
|
|
7027
|
+
body: command32
|
|
7047
7028
|
}
|
|
7048
7029
|
);
|
|
7049
7030
|
};
|
|
@@ -7054,31 +7035,31 @@ var PackagesGateway = class {
|
|
|
7054
7035
|
var DeploymentGateway = class {
|
|
7055
7036
|
constructor(httpClient) {
|
|
7056
7037
|
this.httpClient = httpClient;
|
|
7057
|
-
this.pull = async (
|
|
7038
|
+
this.pull = async (command32) => {
|
|
7058
7039
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7059
7040
|
const queryParams = new URLSearchParams();
|
|
7060
|
-
if (
|
|
7061
|
-
|
|
7041
|
+
if (command32.packagesSlugs && command32.packagesSlugs.length > 0) {
|
|
7042
|
+
command32.packagesSlugs.forEach((slug3) => {
|
|
7062
7043
|
queryParams.append("packageSlug", slug3);
|
|
7063
7044
|
});
|
|
7064
7045
|
}
|
|
7065
|
-
if (
|
|
7066
|
-
|
|
7046
|
+
if (command32.previousPackagesSlugs && command32.previousPackagesSlugs.length > 0) {
|
|
7047
|
+
command32.previousPackagesSlugs.forEach((slug3) => {
|
|
7067
7048
|
queryParams.append("previousPackageSlug", slug3);
|
|
7068
7049
|
});
|
|
7069
7050
|
}
|
|
7070
|
-
if (
|
|
7071
|
-
queryParams.append("gitRemoteUrl",
|
|
7051
|
+
if (command32.gitRemoteUrl) {
|
|
7052
|
+
queryParams.append("gitRemoteUrl", command32.gitRemoteUrl);
|
|
7072
7053
|
}
|
|
7073
|
-
if (
|
|
7074
|
-
queryParams.append("gitBranch",
|
|
7054
|
+
if (command32.gitBranch) {
|
|
7055
|
+
queryParams.append("gitBranch", command32.gitBranch);
|
|
7075
7056
|
}
|
|
7076
|
-
if (
|
|
7077
|
-
queryParams.append("relativePath",
|
|
7057
|
+
if (command32.relativePath) {
|
|
7058
|
+
queryParams.append("relativePath", command32.relativePath);
|
|
7078
7059
|
}
|
|
7079
|
-
if (
|
|
7060
|
+
if (command32.agents !== void 0) {
|
|
7080
7061
|
queryParams.append("agentsConfigOverride", "true");
|
|
7081
|
-
|
|
7062
|
+
command32.agents.forEach((agent) => {
|
|
7082
7063
|
queryParams.append("agent", agent);
|
|
7083
7064
|
});
|
|
7084
7065
|
}
|
|
@@ -7086,71 +7067,71 @@ var DeploymentGateway = class {
|
|
|
7086
7067
|
`/api/v0/organizations/${organizationId}/pull?${queryParams.toString()}`
|
|
7087
7068
|
);
|
|
7088
7069
|
};
|
|
7089
|
-
this.install = async (
|
|
7070
|
+
this.install = async (command32) => {
|
|
7090
7071
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7091
7072
|
return this.httpClient.request(
|
|
7092
7073
|
`/api/v0/organizations/${organizationId}/install`,
|
|
7093
7074
|
{
|
|
7094
7075
|
method: "POST",
|
|
7095
7076
|
body: {
|
|
7096
|
-
packagesSlugs:
|
|
7097
|
-
packmindLockFile:
|
|
7098
|
-
...
|
|
7099
|
-
...
|
|
7077
|
+
packagesSlugs: command32.packagesSlugs,
|
|
7078
|
+
packmindLockFile: command32.packmindLockFile,
|
|
7079
|
+
...command32.relativePath && { relativePath: command32.relativePath },
|
|
7080
|
+
...command32.agents !== void 0 && { agents: command32.agents }
|
|
7100
7081
|
}
|
|
7101
7082
|
}
|
|
7102
7083
|
);
|
|
7103
7084
|
};
|
|
7104
|
-
this.getDeployed = async (
|
|
7085
|
+
this.getDeployed = async (command32) => {
|
|
7105
7086
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7106
7087
|
return this.httpClient.request(
|
|
7107
7088
|
`/api/v0/organizations/${organizationId}/deployed-content`,
|
|
7108
7089
|
{
|
|
7109
7090
|
method: "POST",
|
|
7110
7091
|
body: {
|
|
7111
|
-
packagesSlugs:
|
|
7112
|
-
gitRemoteUrl:
|
|
7113
|
-
gitBranch:
|
|
7114
|
-
relativePath:
|
|
7115
|
-
...
|
|
7092
|
+
packagesSlugs: command32.packagesSlugs,
|
|
7093
|
+
gitRemoteUrl: command32.gitRemoteUrl,
|
|
7094
|
+
gitBranch: command32.gitBranch,
|
|
7095
|
+
relativePath: command32.relativePath,
|
|
7096
|
+
...command32.agents !== void 0 && { agents: command32.agents }
|
|
7116
7097
|
}
|
|
7117
7098
|
}
|
|
7118
7099
|
);
|
|
7119
7100
|
};
|
|
7120
|
-
this.getContentByVersions = async (
|
|
7101
|
+
this.getContentByVersions = async (command32) => {
|
|
7121
7102
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7122
7103
|
return this.httpClient.request(
|
|
7123
7104
|
`/api/v0/organizations/${organizationId}/content-by-versions`,
|
|
7124
7105
|
{
|
|
7125
7106
|
method: "POST",
|
|
7126
7107
|
body: {
|
|
7127
|
-
artifacts:
|
|
7128
|
-
...
|
|
7108
|
+
artifacts: command32.artifacts,
|
|
7109
|
+
...command32.agents !== void 0 && { agents: command32.agents }
|
|
7129
7110
|
}
|
|
7130
7111
|
}
|
|
7131
7112
|
);
|
|
7132
7113
|
};
|
|
7133
|
-
this.notifyDistribution = async (
|
|
7114
|
+
this.notifyDistribution = async (command32) => {
|
|
7134
7115
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7135
7116
|
return this.httpClient.request(
|
|
7136
7117
|
`/api/v0/organizations/${organizationId}/deployments`,
|
|
7137
7118
|
{
|
|
7138
7119
|
method: "POST",
|
|
7139
|
-
body:
|
|
7120
|
+
body: command32
|
|
7140
7121
|
}
|
|
7141
7122
|
);
|
|
7142
7123
|
};
|
|
7143
|
-
this.notifyArtefactsDistribution = async (
|
|
7124
|
+
this.notifyArtefactsDistribution = async (command32) => {
|
|
7144
7125
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7145
7126
|
return this.httpClient.request(
|
|
7146
7127
|
`/api/v0/organizations/${organizationId}/deployments/notify-artifacts-distribution`,
|
|
7147
7128
|
{
|
|
7148
7129
|
method: "POST",
|
|
7149
7130
|
body: {
|
|
7150
|
-
gitRemoteUrl:
|
|
7151
|
-
gitBranch:
|
|
7152
|
-
relativePath:
|
|
7153
|
-
packmindLockFile:
|
|
7131
|
+
gitRemoteUrl: command32.gitRemoteUrl,
|
|
7132
|
+
gitBranch: command32.gitBranch,
|
|
7133
|
+
relativePath: command32.relativePath,
|
|
7134
|
+
packmindLockFile: command32.packmindLockFile
|
|
7154
7135
|
}
|
|
7155
7136
|
}
|
|
7156
7137
|
);
|
|
@@ -7201,7 +7182,6 @@ var PackmindGateway = class {
|
|
|
7201
7182
|
this.httpClient = new PackmindHttpClient(apiKey);
|
|
7202
7183
|
this.changeProposals = new ChangeProposalGateway(this.httpClient);
|
|
7203
7184
|
this.linter = new LinterGateway(this.httpClient);
|
|
7204
|
-
this.mcp = new McpGateway(this.httpClient);
|
|
7205
7185
|
this.spaces = new SpacesGateway(this.httpClient);
|
|
7206
7186
|
this.skills = new SkillsGateway(this.httpClient);
|
|
7207
7187
|
this.commands = new CommandsGateway(this.httpClient);
|
|
@@ -8952,8 +8932,8 @@ var ExecuteLinterProgramsUseCase = class {
|
|
|
8952
8932
|
this.linterAstAdapter = linterAstAdapter;
|
|
8953
8933
|
this.logger = logger2;
|
|
8954
8934
|
}
|
|
8955
|
-
async execute(
|
|
8956
|
-
const { filePath, fileContent, language, programs } =
|
|
8935
|
+
async execute(command32) {
|
|
8936
|
+
const { filePath, fileContent, language, programs } = command32;
|
|
8957
8937
|
if (programs.length === 0) {
|
|
8958
8938
|
return {
|
|
8959
8939
|
file: filePath,
|
|
@@ -9739,8 +9719,8 @@ var InstallPackagesUseCase = class {
|
|
|
9739
9719
|
constructor(packmindGateway) {
|
|
9740
9720
|
this.packmindGateway = packmindGateway;
|
|
9741
9721
|
}
|
|
9742
|
-
async execute(
|
|
9743
|
-
const baseDirectory =
|
|
9722
|
+
async execute(command32) {
|
|
9723
|
+
const baseDirectory = command32.baseDirectory || process.cwd();
|
|
9744
9724
|
const result = {
|
|
9745
9725
|
filesCreated: 0,
|
|
9746
9726
|
filesUpdated: 0,
|
|
@@ -9752,12 +9732,12 @@ var InstallPackagesUseCase = class {
|
|
|
9752
9732
|
skillDirectoriesDeleted: 0
|
|
9753
9733
|
};
|
|
9754
9734
|
const response = await this.packmindGateway.deployment.pull({
|
|
9755
|
-
packagesSlugs:
|
|
9756
|
-
previousPackagesSlugs:
|
|
9757
|
-
gitRemoteUrl:
|
|
9758
|
-
gitBranch:
|
|
9759
|
-
relativePath:
|
|
9760
|
-
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
|
|
9761
9741
|
});
|
|
9762
9742
|
const filteredCreateOrUpdate = response.fileUpdates.createOrUpdate.filter(
|
|
9763
9743
|
(file) => file.path !== "packmind.json"
|
|
@@ -10064,8 +10044,8 @@ var InstallUseCase = class {
|
|
|
10064
10044
|
this.configFileRepository = configFileRepository;
|
|
10065
10045
|
this.spaceService = spaceService;
|
|
10066
10046
|
}
|
|
10067
|
-
async execute(
|
|
10068
|
-
const baseDirectory =
|
|
10047
|
+
async execute(command32) {
|
|
10048
|
+
const baseDirectory = command32.baseDirectory || process.cwd();
|
|
10069
10049
|
const result = {
|
|
10070
10050
|
filesCreated: 0,
|
|
10071
10051
|
filesUpdated: 0,
|
|
@@ -10083,7 +10063,7 @@ var InstallUseCase = class {
|
|
|
10083
10063
|
skillDirectoriesDeleted: 0,
|
|
10084
10064
|
missingAccess: []
|
|
10085
10065
|
};
|
|
10086
|
-
const hasExplicitPackages =
|
|
10066
|
+
const hasExplicitPackages = command32.packages && command32.packages.length > 0;
|
|
10087
10067
|
const lockFile = await this.lockFileRepository.read(baseDirectory);
|
|
10088
10068
|
const config = await this.configFileRepository.readConfig(baseDirectory);
|
|
10089
10069
|
if (!config && !hasExplicitPackages) {
|
|
@@ -10107,7 +10087,7 @@ var InstallUseCase = class {
|
|
|
10107
10087
|
let packagesSlugs;
|
|
10108
10088
|
let normalizedPackages = [];
|
|
10109
10089
|
if (hasExplicitPackages) {
|
|
10110
|
-
normalizedPackages = await this.normalizePackageSlugs(
|
|
10090
|
+
normalizedPackages = await this.normalizePackageSlugs(command32.packages);
|
|
10111
10091
|
await this.validatePackageAccess(normalizedPackages);
|
|
10112
10092
|
const normalizedConfigPackages = config ? await this.normalizeAndSaveConfigPackages(baseDirectory, config) : [];
|
|
10113
10093
|
packagesSlugs = [
|
|
@@ -10492,8 +10472,8 @@ var UninstallUseCase = class {
|
|
|
10492
10472
|
this.spaceService = spaceService;
|
|
10493
10473
|
this.installUseCase = installUseCase;
|
|
10494
10474
|
}
|
|
10495
|
-
async execute(
|
|
10496
|
-
const baseDirectory =
|
|
10475
|
+
async execute(command32) {
|
|
10476
|
+
const baseDirectory = command32.baseDirectory || process.cwd();
|
|
10497
10477
|
const config = await this.configFileRepository.readConfig(baseDirectory);
|
|
10498
10478
|
if (!config) {
|
|
10499
10479
|
const configFileExists = await this.configFileRepository.configExists(baseDirectory);
|
|
@@ -10507,7 +10487,7 @@ var UninstallUseCase = class {
|
|
|
10507
10487
|
);
|
|
10508
10488
|
}
|
|
10509
10489
|
const normalized = await normalizePackageSlugs(
|
|
10510
|
-
|
|
10490
|
+
command32.packages,
|
|
10511
10491
|
this.spaceService
|
|
10512
10492
|
);
|
|
10513
10493
|
const notInstalled = normalized.filter((pkg) => !(pkg in config.packages));
|
|
@@ -10548,8 +10528,8 @@ var InstallDefaultSkillsUseCase = class {
|
|
|
10548
10528
|
constructor(repositories) {
|
|
10549
10529
|
this.repositories = repositories;
|
|
10550
10530
|
}
|
|
10551
|
-
async execute(
|
|
10552
|
-
const baseDirectory =
|
|
10531
|
+
async execute(command32) {
|
|
10532
|
+
const baseDirectory = command32.baseDirectory || process.cwd();
|
|
10553
10533
|
const result = {
|
|
10554
10534
|
filesCreated: 0,
|
|
10555
10535
|
filesUpdated: 0,
|
|
@@ -10562,17 +10542,17 @@ var InstallDefaultSkillsUseCase = class {
|
|
|
10562
10542
|
const agents = config?.agents;
|
|
10563
10543
|
const response = await this.repositories.packmindGateway.skills.getDefaults(
|
|
10564
10544
|
{
|
|
10565
|
-
cliVersion:
|
|
10566
|
-
includeBeta:
|
|
10545
|
+
cliVersion: command32.cliVersion,
|
|
10546
|
+
includeBeta: command32.includeBeta,
|
|
10567
10547
|
agents
|
|
10568
10548
|
}
|
|
10569
10549
|
);
|
|
10570
10550
|
result.skippedSkillsCount = response.skippedSkillsCount;
|
|
10571
10551
|
const incompatibleInstalledMap = /* @__PURE__ */ new Map();
|
|
10572
10552
|
const incompatibleSkillDirs = /* @__PURE__ */ new Map();
|
|
10573
|
-
if (
|
|
10553
|
+
if (command32.cliVersion) {
|
|
10574
10554
|
for (const file of response.fileUpdates.createOrUpdate) {
|
|
10575
|
-
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)) {
|
|
10576
10556
|
const dir = path8.dirname(file.path);
|
|
10577
10557
|
const skillName = this.getSkillName(file.content) ?? path8.basename(dir);
|
|
10578
10558
|
incompatibleSkillDirs.set(dir, skillName);
|
|
@@ -10583,9 +10563,9 @@ var InstallDefaultSkillsUseCase = class {
|
|
|
10583
10563
|
for (const file of response.fileUpdates.createOrUpdate) {
|
|
10584
10564
|
try {
|
|
10585
10565
|
if (!file.content) continue;
|
|
10586
|
-
const isIncompatible =
|
|
10566
|
+
const isIncompatible = command32.cliVersion && (this.isVersionConstraintViolated(
|
|
10587
10567
|
file.content,
|
|
10588
|
-
|
|
10568
|
+
command32.cliVersion
|
|
10589
10569
|
) || this.isUnderIncompatibleSkillDir(
|
|
10590
10570
|
file.path,
|
|
10591
10571
|
incompatibleSkillDirs
|
|
@@ -10700,10 +10680,10 @@ var ListPackagesUseCase = class {
|
|
|
10700
10680
|
this.packmindGateway = packmindGateway;
|
|
10701
10681
|
this.spaceService = spaceService;
|
|
10702
10682
|
}
|
|
10703
|
-
async execute(
|
|
10704
|
-
if (
|
|
10683
|
+
async execute(command32) {
|
|
10684
|
+
if (command32.spaceId) {
|
|
10705
10685
|
const response = await this.packmindGateway.packages.list({
|
|
10706
|
-
spaceId:
|
|
10686
|
+
spaceId: command32.spaceId
|
|
10707
10687
|
});
|
|
10708
10688
|
return response.packages;
|
|
10709
10689
|
}
|
|
@@ -10722,8 +10702,8 @@ var GetPackageSummaryUseCase = class {
|
|
|
10722
10702
|
constructor(gateway) {
|
|
10723
10703
|
this.gateway = gateway;
|
|
10724
10704
|
}
|
|
10725
|
-
async execute(
|
|
10726
|
-
return this.gateway.packages.getSummary(
|
|
10705
|
+
async execute(command32) {
|
|
10706
|
+
return this.gateway.packages.getSummary(command32);
|
|
10727
10707
|
}
|
|
10728
10708
|
};
|
|
10729
10709
|
|
|
@@ -11002,8 +10982,8 @@ var LoginUseCase = class {
|
|
|
11002
10982
|
startCallbackServer: deps?.startCallbackServer ?? defaultStartCallbackServer
|
|
11003
10983
|
};
|
|
11004
10984
|
}
|
|
11005
|
-
async execute(
|
|
11006
|
-
const { host, code: providedCode } =
|
|
10985
|
+
async execute(command32) {
|
|
10986
|
+
const { host, code: providedCode } = command32;
|
|
11007
10987
|
let code;
|
|
11008
10988
|
if (providedCode) {
|
|
11009
10989
|
code = providedCode;
|
|
@@ -11041,8 +11021,8 @@ var LogoutUseCase = class {
|
|
|
11041
11021
|
constructor(deps) {
|
|
11042
11022
|
this.deps = {
|
|
11043
11023
|
getCredentialsPath: deps?.getCredentialsPath ?? getCredentialsPath,
|
|
11044
|
-
fileExists: deps?.fileExists ?? ((
|
|
11045
|
-
deleteFile: deps?.deleteFile ?? ((
|
|
11024
|
+
fileExists: deps?.fileExists ?? ((path35) => fs8.existsSync(path35)),
|
|
11025
|
+
deleteFile: deps?.deleteFile ?? ((path35) => fs8.unlinkSync(path35)),
|
|
11046
11026
|
hasEnvVar: deps?.hasEnvVar ?? (() => !!process.env[ENV_VAR_NAME2])
|
|
11047
11027
|
};
|
|
11048
11028
|
}
|
|
@@ -11321,7 +11301,7 @@ var CheckCliVersionUseCase = class {
|
|
|
11321
11301
|
timeoutMs: deps?.timeoutMs ?? VERSION_CHECK_TIMEOUT_MS
|
|
11322
11302
|
};
|
|
11323
11303
|
}
|
|
11324
|
-
async execute(
|
|
11304
|
+
async execute(command32) {
|
|
11325
11305
|
try {
|
|
11326
11306
|
const latestVersion = await Promise.race([
|
|
11327
11307
|
this.deps.fetchLatestVersion(this.deps.fetchFn),
|
|
@@ -11332,9 +11312,9 @@ var CheckCliVersionUseCase = class {
|
|
|
11332
11312
|
)
|
|
11333
11313
|
)
|
|
11334
11314
|
]);
|
|
11335
|
-
const updateAvailable = import_semver3.default.gt(latestVersion,
|
|
11315
|
+
const updateAvailable = import_semver3.default.gt(latestVersion, command32.currentVersion);
|
|
11336
11316
|
return {
|
|
11337
|
-
currentVersion:
|
|
11317
|
+
currentVersion: command32.currentVersion,
|
|
11338
11318
|
latestVersion,
|
|
11339
11319
|
updateAvailable
|
|
11340
11320
|
};
|
|
@@ -11344,222 +11324,9 @@ var CheckCliVersionUseCase = class {
|
|
|
11344
11324
|
}
|
|
11345
11325
|
};
|
|
11346
11326
|
|
|
11347
|
-
// apps/cli/src/application/useCases/SetupMcpUseCase.ts
|
|
11348
|
-
var ALL_AGENTS = [
|
|
11349
|
-
{ type: "claude", name: "Claude Code" },
|
|
11350
|
-
{ type: "cursor", name: "Cursor" },
|
|
11351
|
-
{ type: "vscode", name: "VS Code" },
|
|
11352
|
-
{ type: "continue", name: "Continue.dev" }
|
|
11353
|
-
];
|
|
11354
|
-
var SetupMcpUseCase = class {
|
|
11355
|
-
constructor(deps) {
|
|
11356
|
-
this.deps = deps;
|
|
11357
|
-
}
|
|
11358
|
-
async execute(command33) {
|
|
11359
|
-
const { agentTypes } = command33;
|
|
11360
|
-
const [tokenResult, urlResult] = await Promise.all([
|
|
11361
|
-
this.deps.gateway.mcp.getToken({}),
|
|
11362
|
-
this.deps.gateway.mcp.getUrl({})
|
|
11363
|
-
]);
|
|
11364
|
-
const config = {
|
|
11365
|
-
url: urlResult.url,
|
|
11366
|
-
accessToken: tokenResult.access_token
|
|
11367
|
-
};
|
|
11368
|
-
const results = [];
|
|
11369
|
-
let hasFailure = false;
|
|
11370
|
-
for (const agentType of agentTypes) {
|
|
11371
|
-
const agentName = ALL_AGENTS.find((a) => a.type === agentType)?.name || agentType;
|
|
11372
|
-
const installResult = this.deps.mcpConfigService.installForAgent(
|
|
11373
|
-
agentType,
|
|
11374
|
-
config
|
|
11375
|
-
);
|
|
11376
|
-
results.push({
|
|
11377
|
-
agentType,
|
|
11378
|
-
agentName,
|
|
11379
|
-
success: installResult.success,
|
|
11380
|
-
error: installResult.error
|
|
11381
|
-
});
|
|
11382
|
-
if (!installResult.success) {
|
|
11383
|
-
hasFailure = true;
|
|
11384
|
-
}
|
|
11385
|
-
}
|
|
11386
|
-
return {
|
|
11387
|
-
results,
|
|
11388
|
-
manualConfigJson: hasFailure ? this.deps.mcpConfigService.getClassicConfig(config) : void 0
|
|
11389
|
-
};
|
|
11390
|
-
}
|
|
11391
|
-
};
|
|
11392
|
-
|
|
11393
|
-
// apps/cli/src/application/services/McpConfigService.ts
|
|
11394
|
-
var fs9 = __toESM(require("fs"));
|
|
11395
|
-
var path11 = __toESM(require("path"));
|
|
11396
|
-
var os3 = __toESM(require("os"));
|
|
11397
|
-
var import_child_process3 = require("child_process");
|
|
11398
|
-
var McpConfigService = class {
|
|
11399
|
-
constructor(projectDir = process.cwd()) {
|
|
11400
|
-
this.projectDir = projectDir;
|
|
11401
|
-
}
|
|
11402
|
-
installForAgent(agent, config) {
|
|
11403
|
-
switch (agent) {
|
|
11404
|
-
case "claude":
|
|
11405
|
-
return this.installClaudeMcp(config);
|
|
11406
|
-
case "cursor":
|
|
11407
|
-
return this.installCursorMcp(config);
|
|
11408
|
-
case "vscode":
|
|
11409
|
-
return this.installVSCodeMcp(config);
|
|
11410
|
-
case "continue":
|
|
11411
|
-
return this.installContinueMcp(config);
|
|
11412
|
-
default:
|
|
11413
|
-
return { success: false, error: `Unknown agent: ${agent}` };
|
|
11414
|
-
}
|
|
11415
|
-
}
|
|
11416
|
-
getClassicConfig(config) {
|
|
11417
|
-
const mcpConfig = {
|
|
11418
|
-
mcpServers: {
|
|
11419
|
-
packmind: {
|
|
11420
|
-
url: config.url,
|
|
11421
|
-
headers: {
|
|
11422
|
-
Authorization: `Bearer ${config.accessToken}`
|
|
11423
|
-
}
|
|
11424
|
-
}
|
|
11425
|
-
}
|
|
11426
|
-
};
|
|
11427
|
-
return JSON.stringify(mcpConfig, null, 2);
|
|
11428
|
-
}
|
|
11429
|
-
installClaudeMcp(config) {
|
|
11430
|
-
const command33 = `claude mcp add --transport http packmind ${config.url} --header "Authorization: Bearer ${config.accessToken}"`;
|
|
11431
|
-
try {
|
|
11432
|
-
(0, import_child_process3.execSync)(command33, { stdio: "pipe" });
|
|
11433
|
-
return { success: true };
|
|
11434
|
-
} catch (error) {
|
|
11435
|
-
const execError = error;
|
|
11436
|
-
const errorMessage = execError.stderr ? execError.stderr.toString().trim() : execError.message || String(error);
|
|
11437
|
-
return { success: false, error: errorMessage };
|
|
11438
|
-
}
|
|
11439
|
-
}
|
|
11440
|
-
installCursorMcp(config) {
|
|
11441
|
-
try {
|
|
11442
|
-
const cursorConfigPath = path11.join(os3.homedir(), ".cursor", "mcp.json");
|
|
11443
|
-
const cursorConfig = this.buildCursorConfig(config);
|
|
11444
|
-
const existingConfig = this.readExistingJsonConfig(cursorConfigPath);
|
|
11445
|
-
const mergedConfig = this.mergeConfig(existingConfig, cursorConfig);
|
|
11446
|
-
fs9.writeFileSync(cursorConfigPath, JSON.stringify(mergedConfig, null, 2));
|
|
11447
|
-
return { success: true };
|
|
11448
|
-
} catch (error) {
|
|
11449
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
11450
|
-
return { success: false, error: errorMessage };
|
|
11451
|
-
}
|
|
11452
|
-
}
|
|
11453
|
-
installVSCodeMcp(config) {
|
|
11454
|
-
try {
|
|
11455
|
-
const vscodeDir = path11.join(this.projectDir, ".vscode");
|
|
11456
|
-
if (!fs9.existsSync(vscodeDir)) {
|
|
11457
|
-
fs9.mkdirSync(vscodeDir, { recursive: true });
|
|
11458
|
-
}
|
|
11459
|
-
const vscodeConfigPath = path11.join(vscodeDir, "mcp.json");
|
|
11460
|
-
const vscodeConfig = this.buildVSCodeConfig(config);
|
|
11461
|
-
const existingConfig = this.readExistingJsonConfig(vscodeConfigPath);
|
|
11462
|
-
const mergedConfig = this.mergeVSCodeConfig(existingConfig, vscodeConfig);
|
|
11463
|
-
fs9.writeFileSync(vscodeConfigPath, JSON.stringify(mergedConfig, null, 2));
|
|
11464
|
-
return { success: true };
|
|
11465
|
-
} catch (error) {
|
|
11466
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
11467
|
-
return { success: false, error: errorMessage };
|
|
11468
|
-
}
|
|
11469
|
-
}
|
|
11470
|
-
installContinueMcp(config) {
|
|
11471
|
-
try {
|
|
11472
|
-
const continueDir = path11.join(this.projectDir, ".continue");
|
|
11473
|
-
const mcpServersDir = path11.join(continueDir, "mcpServers");
|
|
11474
|
-
if (!fs9.existsSync(mcpServersDir)) {
|
|
11475
|
-
fs9.mkdirSync(mcpServersDir, { recursive: true });
|
|
11476
|
-
}
|
|
11477
|
-
const continueConfigPath = path11.join(mcpServersDir, "packmind.yaml");
|
|
11478
|
-
const continueConfig = this.buildContinueYamlConfig(config);
|
|
11479
|
-
fs9.writeFileSync(continueConfigPath, continueConfig);
|
|
11480
|
-
return { success: true };
|
|
11481
|
-
} catch (error) {
|
|
11482
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
11483
|
-
return { success: false, error: errorMessage };
|
|
11484
|
-
}
|
|
11485
|
-
}
|
|
11486
|
-
buildCursorConfig(config) {
|
|
11487
|
-
return {
|
|
11488
|
-
mcpServers: {
|
|
11489
|
-
packmind: {
|
|
11490
|
-
url: config.url,
|
|
11491
|
-
headers: {
|
|
11492
|
-
Authorization: `Bearer ${config.accessToken}`
|
|
11493
|
-
}
|
|
11494
|
-
}
|
|
11495
|
-
}
|
|
11496
|
-
};
|
|
11497
|
-
}
|
|
11498
|
-
buildVSCodeConfig(config) {
|
|
11499
|
-
return {
|
|
11500
|
-
servers: {
|
|
11501
|
-
"packmind-mcp-vscode": {
|
|
11502
|
-
url: config.url,
|
|
11503
|
-
type: "http",
|
|
11504
|
-
headers: {
|
|
11505
|
-
Authorization: `Bearer ${config.accessToken}`
|
|
11506
|
-
}
|
|
11507
|
-
}
|
|
11508
|
-
},
|
|
11509
|
-
inputs: []
|
|
11510
|
-
};
|
|
11511
|
-
}
|
|
11512
|
-
buildContinueYamlConfig(config) {
|
|
11513
|
-
return `name: Packmind MCP Server
|
|
11514
|
-
version: 0.0.1
|
|
11515
|
-
schema: v1
|
|
11516
|
-
mcpServers:
|
|
11517
|
-
- name: Packmind
|
|
11518
|
-
type: streamable-http
|
|
11519
|
-
url: ${config.url}
|
|
11520
|
-
requestOptions:
|
|
11521
|
-
headers:
|
|
11522
|
-
Authorization: "Bearer ${config.accessToken}"
|
|
11523
|
-
`;
|
|
11524
|
-
}
|
|
11525
|
-
readExistingJsonConfig(filePath) {
|
|
11526
|
-
try {
|
|
11527
|
-
if (fs9.existsSync(filePath)) {
|
|
11528
|
-
const content = fs9.readFileSync(filePath, "utf-8");
|
|
11529
|
-
return JSON.parse(content);
|
|
11530
|
-
}
|
|
11531
|
-
} catch {
|
|
11532
|
-
}
|
|
11533
|
-
return {};
|
|
11534
|
-
}
|
|
11535
|
-
mergeConfig(existing, newConfig) {
|
|
11536
|
-
const existingServers = existing["mcpServers"] || {};
|
|
11537
|
-
const newServers = newConfig["mcpServers"] || {};
|
|
11538
|
-
return {
|
|
11539
|
-
...existing,
|
|
11540
|
-
mcpServers: {
|
|
11541
|
-
...existingServers,
|
|
11542
|
-
...newServers
|
|
11543
|
-
}
|
|
11544
|
-
};
|
|
11545
|
-
}
|
|
11546
|
-
mergeVSCodeConfig(existing, newConfig) {
|
|
11547
|
-
const existingServers = existing["servers"] || {};
|
|
11548
|
-
const newServers = newConfig["servers"] || {};
|
|
11549
|
-
return {
|
|
11550
|
-
...existing,
|
|
11551
|
-
servers: {
|
|
11552
|
-
...existingServers,
|
|
11553
|
-
...newServers
|
|
11554
|
-
},
|
|
11555
|
-
inputs: existing["inputs"] || newConfig["inputs"] || []
|
|
11556
|
-
};
|
|
11557
|
-
}
|
|
11558
|
-
};
|
|
11559
|
-
|
|
11560
11327
|
// apps/cli/src/infra/repositories/ConfigFileRepository.ts
|
|
11561
|
-
var
|
|
11562
|
-
var
|
|
11328
|
+
var fs9 = __toESM(require("fs/promises"));
|
|
11329
|
+
var path11 = __toESM(require("path"));
|
|
11563
11330
|
var ConfigFileRepository = class {
|
|
11564
11331
|
constructor() {
|
|
11565
11332
|
this.CONFIG_FILENAME = "packmind.json";
|
|
@@ -11580,7 +11347,7 @@ var ConfigFileRepository = class {
|
|
|
11580
11347
|
async configExists(baseDirectory) {
|
|
11581
11348
|
const configPath = this.getConfigPath(baseDirectory);
|
|
11582
11349
|
try {
|
|
11583
|
-
await
|
|
11350
|
+
await fs9.access(configPath);
|
|
11584
11351
|
return true;
|
|
11585
11352
|
} catch {
|
|
11586
11353
|
return false;
|
|
@@ -11589,7 +11356,7 @@ var ConfigFileRepository = class {
|
|
|
11589
11356
|
async readConfig(baseDirectory) {
|
|
11590
11357
|
const configPath = this.getConfigPath(baseDirectory);
|
|
11591
11358
|
try {
|
|
11592
|
-
const configContent = await
|
|
11359
|
+
const configContent = await fs9.readFile(configPath, "utf-8");
|
|
11593
11360
|
const rawConfig = JSON.parse(configContent);
|
|
11594
11361
|
if (!rawConfig.packages || typeof rawConfig.packages !== "object") {
|
|
11595
11362
|
throw new Error(
|
|
@@ -11623,18 +11390,18 @@ var ConfigFileRepository = class {
|
|
|
11623
11390
|
}
|
|
11624
11391
|
}
|
|
11625
11392
|
getConfigPath(directory) {
|
|
11626
|
-
return
|
|
11393
|
+
return path11.join(directory, this.CONFIG_FILENAME);
|
|
11627
11394
|
}
|
|
11628
11395
|
async writeConfigToPath(configPath, config) {
|
|
11629
11396
|
const configContent = JSON.stringify(config, null, 2) + "\n";
|
|
11630
|
-
await
|
|
11397
|
+
await fs9.writeFile(configPath, configContent, "utf-8");
|
|
11631
11398
|
}
|
|
11632
11399
|
/**
|
|
11633
11400
|
* Recursively finds all directories containing packmind.json in descendant folders.
|
|
11634
11401
|
* Excludes common build/dependency directories (node_modules, .git, dist, etc.)
|
|
11635
11402
|
*/
|
|
11636
11403
|
async findDescendantConfigs(directory) {
|
|
11637
|
-
const normalizedDir = normalizePath2(
|
|
11404
|
+
const normalizedDir = normalizePath2(path11.resolve(directory));
|
|
11638
11405
|
return this.searchDescendantsRecursively(normalizedDir);
|
|
11639
11406
|
}
|
|
11640
11407
|
async searchDescendantsRecursively(currentDir) {
|
|
@@ -11647,7 +11414,7 @@ var ConfigFileRepository = class {
|
|
|
11647
11414
|
if (!entry.isDirectory() || this.isExcludedDirectory(entry.name)) {
|
|
11648
11415
|
continue;
|
|
11649
11416
|
}
|
|
11650
|
-
const entryPath = normalizePath2(
|
|
11417
|
+
const entryPath = normalizePath2(path11.join(currentDir, entry.name));
|
|
11651
11418
|
const config = await this.readConfig(entryPath);
|
|
11652
11419
|
if (config) {
|
|
11653
11420
|
results.push(entryPath);
|
|
@@ -11659,7 +11426,7 @@ var ConfigFileRepository = class {
|
|
|
11659
11426
|
}
|
|
11660
11427
|
async tryReadDirectory(directory) {
|
|
11661
11428
|
try {
|
|
11662
|
-
return await
|
|
11429
|
+
return await fs9.readdir(directory, { withFileTypes: true });
|
|
11663
11430
|
} catch {
|
|
11664
11431
|
return null;
|
|
11665
11432
|
}
|
|
@@ -11678,21 +11445,21 @@ var ConfigFileRepository = class {
|
|
|
11678
11445
|
async readHierarchicalConfig(startDirectory, stopDirectory) {
|
|
11679
11446
|
const configs = [];
|
|
11680
11447
|
const configPaths = [];
|
|
11681
|
-
const normalizedStart = normalizePath2(
|
|
11682
|
-
const normalizedStop = stopDirectory ? normalizePath2(
|
|
11448
|
+
const normalizedStart = normalizePath2(path11.resolve(startDirectory));
|
|
11449
|
+
const normalizedStop = stopDirectory ? normalizePath2(path11.resolve(stopDirectory)) : null;
|
|
11683
11450
|
let currentDir = normalizedStart;
|
|
11684
11451
|
while (true) {
|
|
11685
11452
|
const config = await this.readConfig(currentDir);
|
|
11686
11453
|
if (config) {
|
|
11687
11454
|
configs.push(config);
|
|
11688
11455
|
configPaths.push(
|
|
11689
|
-
normalizePath2(
|
|
11456
|
+
normalizePath2(path11.join(currentDir, this.CONFIG_FILENAME))
|
|
11690
11457
|
);
|
|
11691
11458
|
}
|
|
11692
11459
|
if (normalizedStop !== null && currentDir === normalizedStop) {
|
|
11693
11460
|
break;
|
|
11694
11461
|
}
|
|
11695
|
-
const parentDir = normalizePath2(
|
|
11462
|
+
const parentDir = normalizePath2(path11.dirname(currentDir));
|
|
11696
11463
|
if (parentDir === currentDir) {
|
|
11697
11464
|
break;
|
|
11698
11465
|
}
|
|
@@ -11717,8 +11484,8 @@ var ConfigFileRepository = class {
|
|
|
11717
11484
|
* and returns each config with its target path.
|
|
11718
11485
|
*/
|
|
11719
11486
|
async findAllConfigsInTree(startDirectory, stopDirectory) {
|
|
11720
|
-
const normalizedStart = normalizePath2(
|
|
11721
|
-
const normalizedStop = stopDirectory ? normalizePath2(
|
|
11487
|
+
const normalizedStart = normalizePath2(path11.resolve(startDirectory));
|
|
11488
|
+
const normalizedStop = stopDirectory ? normalizePath2(path11.resolve(stopDirectory)) : null;
|
|
11722
11489
|
const basePath = normalizedStop ?? normalizedStart;
|
|
11723
11490
|
const searchRoot = normalizedStop ?? normalizedStart;
|
|
11724
11491
|
const configsMap = /* @__PURE__ */ new Map();
|
|
@@ -11744,7 +11511,7 @@ var ConfigFileRepository = class {
|
|
|
11744
11511
|
if (stopDir !== null && currentDir === stopDir) {
|
|
11745
11512
|
break;
|
|
11746
11513
|
}
|
|
11747
|
-
const parentDir = normalizePath2(
|
|
11514
|
+
const parentDir = normalizePath2(path11.dirname(currentDir));
|
|
11748
11515
|
if (parentDir === currentDir) {
|
|
11749
11516
|
break;
|
|
11750
11517
|
}
|
|
@@ -11875,7 +11642,7 @@ var ConfigFileRepository = class {
|
|
|
11875
11642
|
}
|
|
11876
11643
|
async tryReadFile(filePath) {
|
|
11877
11644
|
try {
|
|
11878
|
-
return await
|
|
11645
|
+
return await fs9.readFile(filePath, "utf-8");
|
|
11879
11646
|
} catch (error) {
|
|
11880
11647
|
if (error.code === "ENOENT") {
|
|
11881
11648
|
return null;
|
|
@@ -11893,8 +11660,8 @@ var ConfigFileRepository = class {
|
|
|
11893
11660
|
};
|
|
11894
11661
|
|
|
11895
11662
|
// apps/cli/src/infra/repositories/LockFileRepository.ts
|
|
11896
|
-
var
|
|
11897
|
-
var
|
|
11663
|
+
var fs10 = __toESM(require("fs/promises"));
|
|
11664
|
+
var path12 = __toESM(require("path"));
|
|
11898
11665
|
var LockFileRepository = class {
|
|
11899
11666
|
constructor() {
|
|
11900
11667
|
this.LOCK_FILENAME = "packmind-lock.json";
|
|
@@ -11902,7 +11669,7 @@ var LockFileRepository = class {
|
|
|
11902
11669
|
async read(baseDirectory) {
|
|
11903
11670
|
const lockFilePath = this.getLockFilePath(baseDirectory);
|
|
11904
11671
|
try {
|
|
11905
|
-
const content = await
|
|
11672
|
+
const content = await fs10.readFile(lockFilePath, "utf-8");
|
|
11906
11673
|
const parsed = JSON.parse(content);
|
|
11907
11674
|
if (!this.isValidLockFile(parsed)) {
|
|
11908
11675
|
logWarningConsole(`Malformed lock file: ${lockFilePath}`);
|
|
@@ -11928,7 +11695,7 @@ var LockFileRepository = class {
|
|
|
11928
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);
|
|
11929
11696
|
}
|
|
11930
11697
|
getLockFilePath(baseDirectory) {
|
|
11931
|
-
return
|
|
11698
|
+
return path12.join(baseDirectory, this.LOCK_FILENAME);
|
|
11932
11699
|
}
|
|
11933
11700
|
};
|
|
11934
11701
|
|
|
@@ -11938,10 +11705,10 @@ var ListStandardsUseCase = class {
|
|
|
11938
11705
|
this.packmindGateway = packmindGateway;
|
|
11939
11706
|
this.spaceService = spaceService;
|
|
11940
11707
|
}
|
|
11941
|
-
async execute(
|
|
11942
|
-
if (
|
|
11708
|
+
async execute(command32) {
|
|
11709
|
+
if (command32.spaceId) {
|
|
11943
11710
|
const response = await this.packmindGateway.standards.list({
|
|
11944
|
-
spaceId:
|
|
11711
|
+
spaceId: command32.spaceId
|
|
11945
11712
|
});
|
|
11946
11713
|
return response.standards;
|
|
11947
11714
|
}
|
|
@@ -11961,10 +11728,10 @@ var ListCommandsUseCase = class {
|
|
|
11961
11728
|
this.packmindGateway = packmindGateway;
|
|
11962
11729
|
this.spaceService = spaceService;
|
|
11963
11730
|
}
|
|
11964
|
-
async execute(
|
|
11965
|
-
if (
|
|
11731
|
+
async execute(command32) {
|
|
11732
|
+
if (command32.spaceId) {
|
|
11966
11733
|
const response = await this.packmindGateway.commands.list({
|
|
11967
|
-
spaceId:
|
|
11734
|
+
spaceId: command32.spaceId
|
|
11968
11735
|
});
|
|
11969
11736
|
return response.recipes;
|
|
11970
11737
|
}
|
|
@@ -11984,10 +11751,10 @@ var ListSkillsUseCase = class {
|
|
|
11984
11751
|
this.packmindGateway = packmindGateway;
|
|
11985
11752
|
this.spaceService = spaceService;
|
|
11986
11753
|
}
|
|
11987
|
-
async execute(
|
|
11988
|
-
if (
|
|
11754
|
+
async execute(command32) {
|
|
11755
|
+
if (command32.spaceId) {
|
|
11989
11756
|
const skills = await this.packmindGateway.skills.list({
|
|
11990
|
-
spaceId:
|
|
11757
|
+
spaceId: command32.spaceId
|
|
11991
11758
|
});
|
|
11992
11759
|
return skills.map((s) => ({
|
|
11993
11760
|
slug: s.slug,
|
|
@@ -12024,7 +11791,7 @@ function normalizeLineEndings(content) {
|
|
|
12024
11791
|
}
|
|
12025
11792
|
|
|
12026
11793
|
// apps/cli/src/infra/utils/binaryDetection.ts
|
|
12027
|
-
var
|
|
11794
|
+
var path13 = __toESM(require("path"));
|
|
12028
11795
|
var BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
12029
11796
|
// Images
|
|
12030
11797
|
".png",
|
|
@@ -12082,7 +11849,7 @@ var BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
12082
11849
|
".sqlite3"
|
|
12083
11850
|
]);
|
|
12084
11851
|
function isBinaryExtension(filePath) {
|
|
12085
|
-
const ext =
|
|
11852
|
+
const ext = path13.extname(filePath).toLowerCase();
|
|
12086
11853
|
return BINARY_EXTENSIONS.has(ext);
|
|
12087
11854
|
}
|
|
12088
11855
|
function isBinaryBuffer(buffer) {
|
|
@@ -12162,8 +11929,8 @@ var UploadSkillUseCase = class {
|
|
|
12162
11929
|
constructor(deps) {
|
|
12163
11930
|
this.deps = deps;
|
|
12164
11931
|
}
|
|
12165
|
-
async execute(
|
|
12166
|
-
const files = await readSkillDirectory(
|
|
11932
|
+
async execute(command32) {
|
|
11933
|
+
const files = await readSkillDirectory(command32.skillPath);
|
|
12167
11934
|
if (!files.find((f) => f.relativePath === "SKILL.md")) {
|
|
12168
11935
|
throw new Error("SKILL.md not found in skill directory");
|
|
12169
11936
|
}
|
|
@@ -12177,7 +11944,7 @@ var UploadSkillUseCase = class {
|
|
|
12177
11944
|
if (totalSize > 10 * 1024 * 1024) {
|
|
12178
11945
|
throw new Error(`Skill size (${totalSize} bytes) exceeds 10MB limit`);
|
|
12179
11946
|
}
|
|
12180
|
-
const space = await this.getSpace(
|
|
11947
|
+
const space = await this.getSpace(command32.spaceSlug);
|
|
12181
11948
|
const payload = {
|
|
12182
11949
|
files: files.map((f) => ({
|
|
12183
11950
|
path: f.relativePath,
|
|
@@ -12189,7 +11956,7 @@ var UploadSkillUseCase = class {
|
|
|
12189
11956
|
const uploadSkillResponse = await this.deps.gateway.skills.upload({
|
|
12190
11957
|
spaceId: createSpaceId(space.id),
|
|
12191
11958
|
files: payload.files,
|
|
12192
|
-
originSkill:
|
|
11959
|
+
originSkill: command32.originSkill
|
|
12193
11960
|
});
|
|
12194
11961
|
return {
|
|
12195
11962
|
skillId: uploadSkillResponse.skill.id,
|
|
@@ -12228,17 +11995,17 @@ ${spaceList}`
|
|
|
12228
11995
|
|
|
12229
11996
|
// apps/cli/src/application/useCases/diffStrategies/CommandDiffStrategy.ts
|
|
12230
11997
|
var import_diff2 = require("diff");
|
|
12231
|
-
var
|
|
12232
|
-
var
|
|
11998
|
+
var fs12 = __toESM(require("fs/promises"));
|
|
11999
|
+
var path15 = __toESM(require("path"));
|
|
12233
12000
|
var CommandDiffStrategy = class {
|
|
12234
12001
|
supports(file) {
|
|
12235
12002
|
return file.artifactType === "command";
|
|
12236
12003
|
}
|
|
12237
12004
|
async diff(file, baseDirectory) {
|
|
12238
|
-
const fullPath =
|
|
12005
|
+
const fullPath = path15.join(baseDirectory, file.path);
|
|
12239
12006
|
let localContent;
|
|
12240
12007
|
try {
|
|
12241
|
-
localContent = await
|
|
12008
|
+
localContent = await fs12.readFile(fullPath, "utf-8");
|
|
12242
12009
|
} catch {
|
|
12243
12010
|
return [];
|
|
12244
12011
|
}
|
|
@@ -12268,8 +12035,8 @@ var CommandDiffStrategy = class {
|
|
|
12268
12035
|
|
|
12269
12036
|
// apps/cli/src/application/useCases/diffStrategies/SkillDiffStrategy.ts
|
|
12270
12037
|
var import_diff3 = require("diff");
|
|
12271
|
-
var
|
|
12272
|
-
var
|
|
12038
|
+
var fs13 = __toESM(require("fs/promises"));
|
|
12039
|
+
var path16 = __toESM(require("path"));
|
|
12273
12040
|
|
|
12274
12041
|
// apps/cli/src/application/utils/stripFrontmatter.ts
|
|
12275
12042
|
var FRONTMATTER_DELIMITER2 = "---";
|
|
@@ -12304,7 +12071,7 @@ var SkillDiffStrategy = class {
|
|
|
12304
12071
|
async diffNewFiles(skillFolders, serverFiles, baseDirectory) {
|
|
12305
12072
|
const diffs = [];
|
|
12306
12073
|
for (const folder of skillFolders) {
|
|
12307
|
-
const folderPath =
|
|
12074
|
+
const folderPath = path16.join(baseDirectory, folder);
|
|
12308
12075
|
const localFiles = await this.listFilesRecursively(folderPath);
|
|
12309
12076
|
const serverPathsInFolder = new Set(
|
|
12310
12077
|
serverFiles.filter((f) => f.path.startsWith(folder + "/")).map((f) => f.path)
|
|
@@ -12323,7 +12090,7 @@ var SkillDiffStrategy = class {
|
|
|
12323
12090
|
if (serverPathsInFolder.has(filePath)) {
|
|
12324
12091
|
continue;
|
|
12325
12092
|
}
|
|
12326
|
-
const fullPath =
|
|
12093
|
+
const fullPath = path16.join(baseDirectory, filePath);
|
|
12327
12094
|
const localRead = await this.tryReadFileBinaryAware(fullPath);
|
|
12328
12095
|
if (localRead === null) {
|
|
12329
12096
|
continue;
|
|
@@ -12350,7 +12117,7 @@ var SkillDiffStrategy = class {
|
|
|
12350
12117
|
return diffs;
|
|
12351
12118
|
}
|
|
12352
12119
|
async diffSkillMd(file, baseDirectory) {
|
|
12353
|
-
const fullPath =
|
|
12120
|
+
const fullPath = path16.join(baseDirectory, file.path);
|
|
12354
12121
|
const localContent = await this.tryReadFile(fullPath);
|
|
12355
12122
|
if (localContent === null) {
|
|
12356
12123
|
return [];
|
|
@@ -12407,7 +12174,7 @@ var SkillDiffStrategy = class {
|
|
|
12407
12174
|
return [];
|
|
12408
12175
|
}
|
|
12409
12176
|
const skillFileId = createSkillFileId(file.skillFileId);
|
|
12410
|
-
const fullPath =
|
|
12177
|
+
const fullPath = path16.join(baseDirectory, file.path);
|
|
12411
12178
|
const localRead = await this.tryReadFileBinaryAware(fullPath);
|
|
12412
12179
|
const fileRelativePath = this.computeRelativePath(file.path, skillFolders);
|
|
12413
12180
|
if (localRead === null) {
|
|
@@ -12617,14 +12384,14 @@ var SkillDiffStrategy = class {
|
|
|
12617
12384
|
}
|
|
12618
12385
|
async tryReadFile(filePath) {
|
|
12619
12386
|
try {
|
|
12620
|
-
return await
|
|
12387
|
+
return await fs13.readFile(filePath, "utf-8");
|
|
12621
12388
|
} catch {
|
|
12622
12389
|
return null;
|
|
12623
12390
|
}
|
|
12624
12391
|
}
|
|
12625
12392
|
async tryReadFileBinaryAware(filePath) {
|
|
12626
12393
|
try {
|
|
12627
|
-
const buffer = await
|
|
12394
|
+
const buffer = await fs13.readFile(filePath);
|
|
12628
12395
|
if (isBinaryFile(filePath, buffer)) {
|
|
12629
12396
|
return { content: buffer.toString("base64"), isBase64: true };
|
|
12630
12397
|
}
|
|
@@ -12636,13 +12403,13 @@ var SkillDiffStrategy = class {
|
|
|
12636
12403
|
async listFilesRecursively(dirPath, prefix = "") {
|
|
12637
12404
|
let entries;
|
|
12638
12405
|
try {
|
|
12639
|
-
entries = await
|
|
12406
|
+
entries = await fs13.readdir(dirPath);
|
|
12640
12407
|
} catch {
|
|
12641
12408
|
return [];
|
|
12642
12409
|
}
|
|
12643
12410
|
const files = [];
|
|
12644
12411
|
for (const entry of entries) {
|
|
12645
|
-
const fullPath =
|
|
12412
|
+
const fullPath = path16.join(dirPath, entry);
|
|
12646
12413
|
const stat9 = await this.tryStatFile(fullPath);
|
|
12647
12414
|
if (!stat9) {
|
|
12648
12415
|
continue;
|
|
@@ -12662,7 +12429,7 @@ var SkillDiffStrategy = class {
|
|
|
12662
12429
|
}
|
|
12663
12430
|
async tryStatFile(filePath) {
|
|
12664
12431
|
try {
|
|
12665
|
-
const stat9 = await
|
|
12432
|
+
const stat9 = await fs13.stat(filePath);
|
|
12666
12433
|
return { isDirectory: stat9.isDirectory() };
|
|
12667
12434
|
} catch {
|
|
12668
12435
|
return null;
|
|
@@ -12670,7 +12437,7 @@ var SkillDiffStrategy = class {
|
|
|
12670
12437
|
}
|
|
12671
12438
|
async tryGetPermissions(filePath) {
|
|
12672
12439
|
try {
|
|
12673
|
-
const stat9 = await
|
|
12440
|
+
const stat9 = await fs13.stat(filePath);
|
|
12674
12441
|
return modeToPermissionStringOrDefault(stat9.mode);
|
|
12675
12442
|
} catch {
|
|
12676
12443
|
return null;
|
|
@@ -12686,8 +12453,8 @@ var SkillDiffStrategy = class {
|
|
|
12686
12453
|
};
|
|
12687
12454
|
|
|
12688
12455
|
// apps/cli/src/application/useCases/diffStrategies/StandardDiffStrategy.ts
|
|
12689
|
-
var
|
|
12690
|
-
var
|
|
12456
|
+
var fs14 = __toESM(require("fs/promises"));
|
|
12457
|
+
var path17 = __toESM(require("path"));
|
|
12691
12458
|
|
|
12692
12459
|
// apps/cli/src/application/utils/parseStandardMd.ts
|
|
12693
12460
|
var DEPLOYER_PARSERS = [
|
|
@@ -12995,10 +12762,10 @@ var StandardDiffStrategy = class {
|
|
|
12995
12762
|
return file.artifactType === "standard";
|
|
12996
12763
|
}
|
|
12997
12764
|
async diff(file, baseDirectory) {
|
|
12998
|
-
const fullPath =
|
|
12765
|
+
const fullPath = path17.join(baseDirectory, file.path);
|
|
12999
12766
|
let localContent;
|
|
13000
12767
|
try {
|
|
13001
|
-
localContent = await
|
|
12768
|
+
localContent = await fs14.readFile(fullPath, "utf-8");
|
|
13002
12769
|
} catch {
|
|
13003
12770
|
return [];
|
|
13004
12771
|
}
|
|
@@ -13122,9 +12889,9 @@ var DiffArtefactsUseCase = class {
|
|
|
13122
12889
|
new StandardDiffStrategy()
|
|
13123
12890
|
];
|
|
13124
12891
|
}
|
|
13125
|
-
async execute(
|
|
13126
|
-
const baseDirectory =
|
|
13127
|
-
const response = await this.fetchContent(
|
|
12892
|
+
async execute(command32) {
|
|
12893
|
+
const baseDirectory = command32.baseDirectory || process.cwd();
|
|
12894
|
+
const response = await this.fetchContent(command32, baseDirectory);
|
|
13128
12895
|
const filteredFiles = response.fileUpdates.createOrUpdate.filter(
|
|
13129
12896
|
(file) => file.path !== "packmind.json"
|
|
13130
12897
|
);
|
|
@@ -13137,7 +12904,7 @@ var DiffArtefactsUseCase = class {
|
|
|
13137
12904
|
);
|
|
13138
12905
|
const prefixedSkillFolders = this.prefixSkillFolders(
|
|
13139
12906
|
response.skillFolders,
|
|
13140
|
-
|
|
12907
|
+
command32.relativePath
|
|
13141
12908
|
);
|
|
13142
12909
|
const diffs = [];
|
|
13143
12910
|
for (const file of diffableFiles) {
|
|
@@ -13164,7 +12931,7 @@ var DiffArtefactsUseCase = class {
|
|
|
13164
12931
|
targetId: response.targetId ? createTargetId(response.targetId) : void 0
|
|
13165
12932
|
}));
|
|
13166
12933
|
}
|
|
13167
|
-
async fetchContent(
|
|
12934
|
+
async fetchContent(command32, baseDirectory) {
|
|
13168
12935
|
const lockFile = await this.lockFileRepository.read(baseDirectory);
|
|
13169
12936
|
if (lockFile) {
|
|
13170
12937
|
try {
|
|
@@ -13184,11 +12951,11 @@ var DiffArtefactsUseCase = class {
|
|
|
13184
12951
|
}
|
|
13185
12952
|
}
|
|
13186
12953
|
return this.packmindGateway.deployment.getDeployed({
|
|
13187
|
-
packagesSlugs:
|
|
13188
|
-
gitRemoteUrl:
|
|
13189
|
-
gitBranch:
|
|
13190
|
-
relativePath:
|
|
13191
|
-
agents:
|
|
12954
|
+
packagesSlugs: command32.packagesSlugs,
|
|
12955
|
+
gitRemoteUrl: command32.gitRemoteUrl,
|
|
12956
|
+
gitBranch: command32.gitBranch,
|
|
12957
|
+
relativePath: command32.relativePath,
|
|
12958
|
+
agents: command32.agents
|
|
13192
12959
|
});
|
|
13193
12960
|
}
|
|
13194
12961
|
prefixSkillFolders(skillFolders, relativePath) {
|
|
@@ -13212,8 +12979,8 @@ var SubmitDiffsUseCase = class {
|
|
|
13212
12979
|
constructor(packmindGateway) {
|
|
13213
12980
|
this.packmindGateway = packmindGateway;
|
|
13214
12981
|
}
|
|
13215
|
-
async execute(
|
|
13216
|
-
const { groupedDiffs, message } =
|
|
12982
|
+
async execute(command32) {
|
|
12983
|
+
const { groupedDiffs, message } = command32;
|
|
13217
12984
|
const skipped = [];
|
|
13218
12985
|
const validDiffs = [];
|
|
13219
12986
|
for (const group of groupedDiffs) {
|
|
@@ -13288,8 +13055,8 @@ var CheckDiffsUseCase = class {
|
|
|
13288
13055
|
constructor(packmindGateway) {
|
|
13289
13056
|
this.packmindGateway = packmindGateway;
|
|
13290
13057
|
}
|
|
13291
|
-
async execute(
|
|
13292
|
-
const { groupedDiffs } =
|
|
13058
|
+
async execute(command32) {
|
|
13059
|
+
const { groupedDiffs } = command32;
|
|
13293
13060
|
const results = [];
|
|
13294
13061
|
const validDiffs = [];
|
|
13295
13062
|
const invalidDiffs = [];
|
|
@@ -13387,8 +13154,8 @@ var CliFormatter = class {
|
|
|
13387
13154
|
static error(message) {
|
|
13388
13155
|
return `${source_default.bgRed.bold(CLI_PREFIX2)} ${source_default.red(message)}`;
|
|
13389
13156
|
}
|
|
13390
|
-
static command(
|
|
13391
|
-
return source_default.yellow(
|
|
13157
|
+
static command(command32) {
|
|
13158
|
+
return source_default.yellow(command32);
|
|
13392
13159
|
}
|
|
13393
13160
|
static loader(text) {
|
|
13394
13161
|
return source_default.dim.italic(text);
|
|
@@ -13564,10 +13331,6 @@ var PackmindCliHexaFactory = class {
|
|
|
13564
13331
|
logout: new LogoutUseCase(),
|
|
13565
13332
|
whoami: new WhoamiUseCase(),
|
|
13566
13333
|
checkCliVersion: new CheckCliVersionUseCase(),
|
|
13567
|
-
setupMcp: new SetupMcpUseCase({
|
|
13568
|
-
gateway: this.repositories.packmindGateway,
|
|
13569
|
-
mcpConfigService: new McpConfigService()
|
|
13570
|
-
}),
|
|
13571
13334
|
listStandards: new ListStandardsUseCase(
|
|
13572
13335
|
this.repositories.packmindGateway,
|
|
13573
13336
|
this.services.spaceService
|
|
@@ -13598,14 +13361,14 @@ var PackmindCliHexaFactory = class {
|
|
|
13598
13361
|
var origin8 = "PackmindCliHexa";
|
|
13599
13362
|
var PackmindCliHexa = class {
|
|
13600
13363
|
constructor(logger2 = new PackmindLogger(origin8)) {
|
|
13601
|
-
this.notifyDistribution = async (
|
|
13364
|
+
this.notifyDistribution = async (command32) => {
|
|
13602
13365
|
return this.hexa.repositories.packmindGateway.deployment.notifyDistribution(
|
|
13603
|
-
|
|
13366
|
+
command32
|
|
13604
13367
|
);
|
|
13605
13368
|
};
|
|
13606
|
-
this.notifyArtefactsDistribution = async (
|
|
13369
|
+
this.notifyArtefactsDistribution = async (command32) => {
|
|
13607
13370
|
return this.hexa.repositories.packmindGateway.deployment.notifyArtefactsDistribution(
|
|
13608
|
-
|
|
13371
|
+
command32
|
|
13609
13372
|
);
|
|
13610
13373
|
};
|
|
13611
13374
|
this.logger = logger2;
|
|
@@ -13628,29 +13391,29 @@ var PackmindCliHexa = class {
|
|
|
13628
13391
|
get output() {
|
|
13629
13392
|
return this.hexa.repositories.output;
|
|
13630
13393
|
}
|
|
13631
|
-
async getGitRemoteUrl(
|
|
13632
|
-
return this.hexa.useCases.getGitRemoteUrl.execute(
|
|
13394
|
+
async getGitRemoteUrl(command32) {
|
|
13395
|
+
return this.hexa.useCases.getGitRemoteUrl.execute(command32);
|
|
13633
13396
|
}
|
|
13634
|
-
async listFilesInDirectory(
|
|
13635
|
-
return this.hexa.useCases.listFilesInDirectoryUseCase.execute(
|
|
13397
|
+
async listFilesInDirectory(command32) {
|
|
13398
|
+
return this.hexa.useCases.listFilesInDirectoryUseCase.execute(command32);
|
|
13636
13399
|
}
|
|
13637
|
-
async lintFilesAgainstRule(
|
|
13638
|
-
return this.hexa.useCases.lintFilesAgainstRule.execute(
|
|
13400
|
+
async lintFilesAgainstRule(command32) {
|
|
13401
|
+
return this.hexa.useCases.lintFilesAgainstRule.execute(command32);
|
|
13639
13402
|
}
|
|
13640
|
-
async lintFilesFromConfig(
|
|
13641
|
-
return this.hexa.useCases.lintFilesFromConfig.execute(
|
|
13403
|
+
async lintFilesFromConfig(command32) {
|
|
13404
|
+
return this.hexa.useCases.lintFilesFromConfig.execute(command32);
|
|
13642
13405
|
}
|
|
13643
|
-
async installPackages(
|
|
13644
|
-
return this.hexa.useCases.installPackages.execute(
|
|
13406
|
+
async installPackages(command32) {
|
|
13407
|
+
return this.hexa.useCases.installPackages.execute(command32);
|
|
13645
13408
|
}
|
|
13646
|
-
async install(
|
|
13647
|
-
return this.hexa.useCases.install.execute(
|
|
13409
|
+
async install(command32) {
|
|
13410
|
+
return this.hexa.useCases.install.execute(command32);
|
|
13648
13411
|
}
|
|
13649
|
-
async uninstall(
|
|
13650
|
-
return this.hexa.useCases.uninstall.execute(
|
|
13412
|
+
async uninstall(command32) {
|
|
13413
|
+
return this.hexa.useCases.uninstall.execute(command32);
|
|
13651
13414
|
}
|
|
13652
|
-
async diffArtefacts(
|
|
13653
|
-
return this.hexa.useCases.diffArtefacts.execute(
|
|
13415
|
+
async diffArtefacts(command32) {
|
|
13416
|
+
return this.hexa.useCases.diffArtefacts.execute(command32);
|
|
13654
13417
|
}
|
|
13655
13418
|
async submitDiffs(groupedDiffs, message) {
|
|
13656
13419
|
return this.hexa.useCases.submitDiffs.execute({ groupedDiffs, message });
|
|
@@ -13658,20 +13421,20 @@ var PackmindCliHexa = class {
|
|
|
13658
13421
|
async checkDiffs(groupedDiffs) {
|
|
13659
13422
|
return this.hexa.useCases.checkDiffs.execute({ groupedDiffs });
|
|
13660
13423
|
}
|
|
13661
|
-
async listPackages(
|
|
13662
|
-
return this.hexa.useCases.listPackages.execute(
|
|
13424
|
+
async listPackages(command32) {
|
|
13425
|
+
return this.hexa.useCases.listPackages.execute(command32);
|
|
13663
13426
|
}
|
|
13664
|
-
async getPackageBySlug(
|
|
13665
|
-
return this.hexa.useCases.getPackageBySlug.execute(
|
|
13427
|
+
async getPackageBySlug(command32) {
|
|
13428
|
+
return this.hexa.useCases.getPackageBySlug.execute(command32);
|
|
13666
13429
|
}
|
|
13667
|
-
async listStandards(
|
|
13668
|
-
return this.hexa.useCases.listStandards.execute(
|
|
13430
|
+
async listStandards(command32) {
|
|
13431
|
+
return this.hexa.useCases.listStandards.execute(command32);
|
|
13669
13432
|
}
|
|
13670
|
-
async listCommands(
|
|
13671
|
-
return this.hexa.useCases.listCommands.execute(
|
|
13433
|
+
async listCommands(command32) {
|
|
13434
|
+
return this.hexa.useCases.listCommands.execute(command32);
|
|
13672
13435
|
}
|
|
13673
|
-
async listSkills(
|
|
13674
|
-
return this.hexa.useCases.listSkills.execute(
|
|
13436
|
+
async listSkills(command32) {
|
|
13437
|
+
return this.hexa.useCases.listSkills.execute(command32);
|
|
13675
13438
|
}
|
|
13676
13439
|
async configExists(baseDirectory) {
|
|
13677
13440
|
return await this.hexa.repositories.configFileRepository.configExists(
|
|
@@ -13758,20 +13521,17 @@ var PackmindCliHexa = class {
|
|
|
13758
13521
|
directory
|
|
13759
13522
|
);
|
|
13760
13523
|
}
|
|
13761
|
-
async login(
|
|
13762
|
-
return this.hexa.useCases.login.execute(
|
|
13524
|
+
async login(command32) {
|
|
13525
|
+
return this.hexa.useCases.login.execute(command32);
|
|
13763
13526
|
}
|
|
13764
|
-
async logout(
|
|
13765
|
-
return this.hexa.useCases.logout.execute(
|
|
13527
|
+
async logout(command32) {
|
|
13528
|
+
return this.hexa.useCases.logout.execute(command32);
|
|
13766
13529
|
}
|
|
13767
|
-
async whoami(
|
|
13768
|
-
return this.hexa.useCases.whoami.execute(
|
|
13530
|
+
async whoami(command32) {
|
|
13531
|
+
return this.hexa.useCases.whoami.execute(command32);
|
|
13769
13532
|
}
|
|
13770
|
-
async checkCliVersion(
|
|
13771
|
-
return this.hexa.useCases.checkCliVersion.execute(
|
|
13772
|
-
}
|
|
13773
|
-
async setupMcp(command33) {
|
|
13774
|
-
return this.hexa.useCases.setupMcp.execute(command33);
|
|
13533
|
+
async checkCliVersion(command32) {
|
|
13534
|
+
return this.hexa.useCases.checkCliVersion.execute(command32);
|
|
13775
13535
|
}
|
|
13776
13536
|
getCurrentBranch(repoPath) {
|
|
13777
13537
|
return this.hexa.services.gitRemoteUrlService.getCurrentBranch(repoPath).branch;
|
|
@@ -13779,11 +13539,11 @@ var PackmindCliHexa = class {
|
|
|
13779
13539
|
getGitRemoteUrlFromPath(repoPath) {
|
|
13780
13540
|
return this.hexa.services.gitRemoteUrlService.getGitRemoteUrl(repoPath).gitRemoteUrl;
|
|
13781
13541
|
}
|
|
13782
|
-
async uploadSkill(
|
|
13783
|
-
return this.hexa.useCases.uploadSkill.execute(
|
|
13542
|
+
async uploadSkill(command32) {
|
|
13543
|
+
return this.hexa.useCases.uploadSkill.execute(command32);
|
|
13784
13544
|
}
|
|
13785
|
-
async installDefaultSkills(
|
|
13786
|
-
return this.hexa.useCases.installDefaultSkills.execute(
|
|
13545
|
+
async installDefaultSkills(command32) {
|
|
13546
|
+
return this.hexa.useCases.installDefaultSkills.execute(command32);
|
|
13787
13547
|
}
|
|
13788
13548
|
getPackmindGateway() {
|
|
13789
13549
|
return this.hexa.repositories.packmindGateway;
|
|
@@ -13907,31 +13667,31 @@ var HumanReadableLogger = class {
|
|
|
13907
13667
|
var pathModule2 = __toESM(require("path"));
|
|
13908
13668
|
|
|
13909
13669
|
// apps/cli/src/infra/commands/lintHandler.ts
|
|
13910
|
-
var
|
|
13670
|
+
var fs16 = __toESM(require("fs/promises"));
|
|
13911
13671
|
var pathModule = __toESM(require("path"));
|
|
13912
13672
|
|
|
13913
13673
|
// apps/cli/src/application/services/PackmindIgnoreReader.ts
|
|
13914
|
-
var
|
|
13915
|
-
var
|
|
13674
|
+
var fs15 = __toESM(require("fs/promises"));
|
|
13675
|
+
var path18 = __toESM(require("path"));
|
|
13916
13676
|
var IGNORE_FILENAME = ".packmindignore";
|
|
13917
13677
|
var PackmindIgnoreReader = class {
|
|
13918
13678
|
async readIgnorePatterns(startDirectory, stopDirectory) {
|
|
13919
13679
|
const patterns = [];
|
|
13920
|
-
const normalizedStart =
|
|
13921
|
-
const normalizedStop = stopDirectory ?
|
|
13680
|
+
const normalizedStart = path18.resolve(startDirectory);
|
|
13681
|
+
const normalizedStop = stopDirectory ? path18.resolve(stopDirectory) : null;
|
|
13922
13682
|
if (normalizedStop === null) {
|
|
13923
|
-
const ignoreFile =
|
|
13683
|
+
const ignoreFile = path18.join(normalizedStart, IGNORE_FILENAME);
|
|
13924
13684
|
return this.parseIgnoreFile(ignoreFile);
|
|
13925
13685
|
}
|
|
13926
13686
|
let currentDir = normalizedStart;
|
|
13927
13687
|
while (true) {
|
|
13928
|
-
const ignoreFile =
|
|
13688
|
+
const ignoreFile = path18.join(currentDir, IGNORE_FILENAME);
|
|
13929
13689
|
const filePatterns = await this.parseIgnoreFile(ignoreFile);
|
|
13930
13690
|
patterns.push(...filePatterns);
|
|
13931
13691
|
if (currentDir === normalizedStop) {
|
|
13932
13692
|
break;
|
|
13933
13693
|
}
|
|
13934
|
-
const parentDir =
|
|
13694
|
+
const parentDir = path18.dirname(currentDir);
|
|
13935
13695
|
if (parentDir === currentDir) {
|
|
13936
13696
|
break;
|
|
13937
13697
|
}
|
|
@@ -13942,7 +13702,7 @@ var PackmindIgnoreReader = class {
|
|
|
13942
13702
|
async parseIgnoreFile(filePath) {
|
|
13943
13703
|
let content;
|
|
13944
13704
|
try {
|
|
13945
|
-
content = await
|
|
13705
|
+
content = await fs15.readFile(filePath, "utf-8");
|
|
13946
13706
|
} catch (err) {
|
|
13947
13707
|
if (err.code === "ENOENT") {
|
|
13948
13708
|
return [];
|
|
@@ -13963,7 +13723,7 @@ function isNotLoggedInError(error) {
|
|
|
13963
13723
|
}
|
|
13964
13724
|
async function lintHandler(args2, deps) {
|
|
13965
13725
|
const {
|
|
13966
|
-
path:
|
|
13726
|
+
path: path35,
|
|
13967
13727
|
draft,
|
|
13968
13728
|
rule,
|
|
13969
13729
|
language,
|
|
@@ -13985,11 +13745,11 @@ async function lintHandler(args2, deps) {
|
|
|
13985
13745
|
throw new Error("option --rule is required to use --draft mode");
|
|
13986
13746
|
}
|
|
13987
13747
|
const startedAt = Date.now();
|
|
13988
|
-
const targetPath =
|
|
13748
|
+
const targetPath = path35 ?? ".";
|
|
13989
13749
|
const absolutePath = resolvePath(targetPath);
|
|
13990
13750
|
let stats;
|
|
13991
13751
|
try {
|
|
13992
|
-
stats = await
|
|
13752
|
+
stats = await fs16.stat(absolutePath);
|
|
13993
13753
|
} catch (err) {
|
|
13994
13754
|
const isNotFound = err.code === "ENOENT";
|
|
13995
13755
|
const message = isNotFound ? `File or directory "${absolutePath}" does not exist` : `Cannot access "${absolutePath}": ${err.message}`;
|
|
@@ -14307,13 +14067,13 @@ function extractWasmFiles() {
|
|
|
14307
14067
|
|
|
14308
14068
|
// apps/cli/src/main.ts
|
|
14309
14069
|
var import_dotenv = require("dotenv");
|
|
14310
|
-
var
|
|
14311
|
-
var
|
|
14070
|
+
var fs25 = __toESM(require("fs"));
|
|
14071
|
+
var path34 = __toESM(require("path"));
|
|
14312
14072
|
|
|
14313
14073
|
// apps/cli/src/infra/commands/InstallCommand.ts
|
|
14314
14074
|
var import_cmd_ts2 = __toESM(require_cjs());
|
|
14315
|
-
var
|
|
14316
|
-
var
|
|
14075
|
+
var path19 = __toESM(require("path"));
|
|
14076
|
+
var fs17 = __toESM(require("fs"));
|
|
14317
14077
|
|
|
14318
14078
|
// apps/cli/src/infra/commands/installPackagesHandler.ts
|
|
14319
14079
|
function formatOverviewRow(configPath, packages, pathColumnWidth) {
|
|
@@ -14395,14 +14155,14 @@ function findSubDirectoriesWithPackmindJson(dirPath, recursive) {
|
|
|
14395
14155
|
const result = [];
|
|
14396
14156
|
let entries;
|
|
14397
14157
|
try {
|
|
14398
|
-
entries =
|
|
14158
|
+
entries = fs17.readdirSync(dirPath, { withFileTypes: true });
|
|
14399
14159
|
} catch {
|
|
14400
14160
|
return result;
|
|
14401
14161
|
}
|
|
14402
14162
|
for (const entry of entries) {
|
|
14403
14163
|
if (!entry.isDirectory()) continue;
|
|
14404
|
-
const subDir =
|
|
14405
|
-
if (
|
|
14164
|
+
const subDir = path19.join(dirPath, entry.name);
|
|
14165
|
+
if (fs17.existsSync(path19.join(subDir, "packmind.json"))) {
|
|
14406
14166
|
result.push(subDir);
|
|
14407
14167
|
}
|
|
14408
14168
|
if (recursive) {
|
|
@@ -14479,8 +14239,8 @@ async function notifyArtefactsDistributionIfInGitRepo(params) {
|
|
|
14479
14239
|
try {
|
|
14480
14240
|
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(dir);
|
|
14481
14241
|
if (!gitRoot) return;
|
|
14482
|
-
const lockFilePath =
|
|
14483
|
-
const content =
|
|
14242
|
+
const lockFilePath = path19.join(dir, "packmind-lock.json");
|
|
14243
|
+
const content = fs17.readFileSync(lockFilePath, "utf-8");
|
|
14484
14244
|
const packmindLockFile = JSON.parse(content);
|
|
14485
14245
|
const gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
|
|
14486
14246
|
const gitBranch = packmindCliHexa.getCurrentBranch(gitRoot);
|
|
@@ -14559,14 +14319,14 @@ async function installHandler({
|
|
|
14559
14319
|
logConsole(`Use ${formatCommand(showCommand)} instead.`);
|
|
14560
14320
|
process.exit(1);
|
|
14561
14321
|
}
|
|
14562
|
-
const cwd = installPath ?
|
|
14322
|
+
const cwd = installPath ? path19.resolve(process.cwd(), installPath) : process.cwd();
|
|
14563
14323
|
if (installPath) {
|
|
14564
|
-
if (!
|
|
14324
|
+
if (!fs17.existsSync(cwd)) {
|
|
14565
14325
|
logErrorConsole(`Path does not exist: ${cwd}`);
|
|
14566
14326
|
process.exit(1);
|
|
14567
14327
|
return;
|
|
14568
14328
|
}
|
|
14569
|
-
if (!
|
|
14329
|
+
if (!fs17.statSync(cwd).isDirectory()) {
|
|
14570
14330
|
logErrorConsole(`Path is not a directory: ${cwd}`);
|
|
14571
14331
|
process.exit(1);
|
|
14572
14332
|
return;
|
|
@@ -14579,7 +14339,7 @@ async function installHandler({
|
|
|
14579
14339
|
targetDirs = [cwd];
|
|
14580
14340
|
} else {
|
|
14581
14341
|
targetDirs = [];
|
|
14582
|
-
if (
|
|
14342
|
+
if (fs17.existsSync(path19.join(cwd, "packmind.json"))) {
|
|
14583
14343
|
targetDirs.push(cwd);
|
|
14584
14344
|
}
|
|
14585
14345
|
targetDirs.push(...findSubDirectoriesWithPackmindJson(cwd, true));
|
|
@@ -14908,266 +14668,18 @@ Credentials are loaded from (in order of priority):`);
|
|
|
14908
14668
|
}
|
|
14909
14669
|
});
|
|
14910
14670
|
|
|
14911
|
-
// apps/cli/src/infra/commands/SetupMcpCommand.ts
|
|
14912
|
-
var import_cmd_ts7 = __toESM(require_cjs());
|
|
14913
|
-
var fs20 = __toESM(require("fs"));
|
|
14914
|
-
var readline2 = __toESM(require("readline"));
|
|
14915
|
-
var inquirer = __toESM(require("inquirer"));
|
|
14916
|
-
|
|
14917
|
-
// apps/cli/src/application/services/AgentDetectionService.ts
|
|
14918
|
-
var fs19 = __toESM(require("fs"));
|
|
14919
|
-
var path21 = __toESM(require("path"));
|
|
14920
|
-
var os4 = __toESM(require("os"));
|
|
14921
|
-
var import_child_process4 = require("child_process");
|
|
14922
|
-
var AgentDetectionService = class {
|
|
14923
|
-
constructor(projectDir = process.cwd()) {
|
|
14924
|
-
this.projectDir = projectDir;
|
|
14925
|
-
}
|
|
14926
|
-
detectAgents() {
|
|
14927
|
-
const agents = [];
|
|
14928
|
-
if (this.isClaudeAvailable()) {
|
|
14929
|
-
agents.push({ type: "claude", name: "Claude Code" });
|
|
14930
|
-
}
|
|
14931
|
-
if (this.isCursorAvailable()) {
|
|
14932
|
-
agents.push({ type: "cursor", name: "Cursor" });
|
|
14933
|
-
}
|
|
14934
|
-
if (this.isVSCodeAvailable()) {
|
|
14935
|
-
agents.push({ type: "vscode", name: "VS Code" });
|
|
14936
|
-
}
|
|
14937
|
-
if (this.isContinueAvailable()) {
|
|
14938
|
-
agents.push({ type: "continue", name: "Continue.dev" });
|
|
14939
|
-
}
|
|
14940
|
-
return agents;
|
|
14941
|
-
}
|
|
14942
|
-
isClaudeAvailable() {
|
|
14943
|
-
return this.isCommandAvailable("claude");
|
|
14944
|
-
}
|
|
14945
|
-
isCursorAvailable() {
|
|
14946
|
-
const cursorConfigDir = path21.join(os4.homedir(), ".cursor");
|
|
14947
|
-
return fs19.existsSync(cursorConfigDir);
|
|
14948
|
-
}
|
|
14949
|
-
isVSCodeAvailable() {
|
|
14950
|
-
const vscodeDir = path21.join(this.projectDir, ".vscode");
|
|
14951
|
-
return fs19.existsSync(vscodeDir);
|
|
14952
|
-
}
|
|
14953
|
-
isContinueAvailable() {
|
|
14954
|
-
const continueDir = path21.join(this.projectDir, ".continue");
|
|
14955
|
-
return fs19.existsSync(continueDir);
|
|
14956
|
-
}
|
|
14957
|
-
isCommandAvailable(command33) {
|
|
14958
|
-
try {
|
|
14959
|
-
const whichCommand = process.platform === "win32" ? "where" : "which";
|
|
14960
|
-
(0, import_child_process4.execSync)(`${whichCommand} ${command33}`, { stdio: "pipe" });
|
|
14961
|
-
return true;
|
|
14962
|
-
} catch {
|
|
14963
|
-
return false;
|
|
14964
|
-
}
|
|
14965
|
-
}
|
|
14966
|
-
};
|
|
14967
|
-
|
|
14968
|
-
// apps/cli/src/infra/commands/customParameters/AgentArgType.ts
|
|
14969
|
-
var VALID_AGENTS = Object.keys(CodingAgents).filter(
|
|
14970
|
-
(a) => a !== "packmind"
|
|
14971
|
-
);
|
|
14972
|
-
var agentArgToType = {
|
|
14973
|
-
copilot: "vscode",
|
|
14974
|
-
cursor: "cursor",
|
|
14975
|
-
claude: "claude",
|
|
14976
|
-
continue: "continue"
|
|
14977
|
-
};
|
|
14978
|
-
var AgentArgType = {
|
|
14979
|
-
from: async (input) => {
|
|
14980
|
-
const normalized = input.toLowerCase();
|
|
14981
|
-
if (VALID_AGENTS.includes(normalized)) {
|
|
14982
|
-
return normalized;
|
|
14983
|
-
}
|
|
14984
|
-
throw new Error(
|
|
14985
|
-
`Invalid agent '${input}'. Valid options are: ${VALID_AGENTS.join(", ")}`
|
|
14986
|
-
);
|
|
14987
|
-
}
|
|
14988
|
-
};
|
|
14989
|
-
|
|
14990
|
-
// apps/cli/src/infra/commands/SetupMcpCommand.ts
|
|
14991
|
-
var ALL_AGENTS2 = [
|
|
14992
|
-
{ type: "claude", name: "Claude Code" },
|
|
14993
|
-
{ type: "cursor", name: "Cursor" },
|
|
14994
|
-
{ type: "vscode", name: "VS Code" },
|
|
14995
|
-
{ type: "continue", name: "Continue.dev" }
|
|
14996
|
-
];
|
|
14997
|
-
async function promptAgentsWithReadline(choices) {
|
|
14998
|
-
const input = fs20.createReadStream("/dev/tty");
|
|
14999
|
-
const output = fs20.createWriteStream("/dev/tty");
|
|
15000
|
-
const rl = readline2.createInterface({
|
|
15001
|
-
input,
|
|
15002
|
-
output
|
|
15003
|
-
});
|
|
15004
|
-
output.write("Select agents to configure:\n");
|
|
15005
|
-
choices.forEach((choice, index) => {
|
|
15006
|
-
const marker = choice.checked ? "*" : " ";
|
|
15007
|
-
output.write(` ${index + 1}. [${marker}] ${choice.name}
|
|
15008
|
-
`);
|
|
15009
|
-
});
|
|
15010
|
-
output.write("\n");
|
|
15011
|
-
const preselected = choices.map((c, i) => c.checked ? i + 1 : null).filter((i) => i !== null);
|
|
15012
|
-
const defaultValue = preselected.length > 0 ? preselected.join(",") : "1,2,3";
|
|
15013
|
-
return new Promise((resolve15) => {
|
|
15014
|
-
rl.question(
|
|
15015
|
-
`Enter numbers separated by commas (default: ${defaultValue}): `,
|
|
15016
|
-
(answer) => {
|
|
15017
|
-
rl.close();
|
|
15018
|
-
input.destroy();
|
|
15019
|
-
output.destroy();
|
|
15020
|
-
const trimmed = answer.trim();
|
|
15021
|
-
const numbersStr = trimmed === "" ? defaultValue : trimmed;
|
|
15022
|
-
const numbers = numbersStr.split(",").map((s) => parseInt(s.trim(), 10)).filter((n) => !isNaN(n) && n >= 1 && n <= choices.length);
|
|
15023
|
-
const selectedAgents = numbers.map((n) => choices[n - 1].value);
|
|
15024
|
-
resolve15(selectedAgents);
|
|
15025
|
-
}
|
|
15026
|
-
);
|
|
15027
|
-
});
|
|
15028
|
-
}
|
|
15029
|
-
var setupMcpCommand = (0, import_cmd_ts7.command)({
|
|
15030
|
-
name: "setup-mcp",
|
|
15031
|
-
description: "Configure MCP (Model Context Protocol) for AI coding agents",
|
|
15032
|
-
args: {
|
|
15033
|
-
targets: (0, import_cmd_ts7.multioption)({
|
|
15034
|
-
type: (0, import_cmd_ts7.array)(AgentArgType),
|
|
15035
|
-
long: "target",
|
|
15036
|
-
short: "t",
|
|
15037
|
-
description: "Target agent(s) to configure (copilot, cursor, claude, or continue). Can be specified multiple times. If omitted, interactive mode is used."
|
|
15038
|
-
})
|
|
15039
|
-
},
|
|
15040
|
-
handler: async ({ targets }) => {
|
|
15041
|
-
const credentials = loadCredentials();
|
|
15042
|
-
if (!credentials) {
|
|
15043
|
-
logErrorConsole("Not authenticated");
|
|
15044
|
-
logConsole("\nNo credentials found. You can authenticate by either:");
|
|
15045
|
-
logConsole(" 1. Running `packmind-cli login`");
|
|
15046
|
-
logConsole(" 2. Setting PACKMIND_API_KEY_V3 environment variable");
|
|
15047
|
-
logConsole(`
|
|
15048
|
-
Credentials are loaded from (in order of priority):`);
|
|
15049
|
-
logConsole(` 1. PACKMIND_API_KEY_V3 environment variable`);
|
|
15050
|
-
logConsole(` 2. ${getCredentialsPath()}`);
|
|
15051
|
-
process.exit(1);
|
|
15052
|
-
}
|
|
15053
|
-
if (credentials.isExpired) {
|
|
15054
|
-
logErrorConsole("Credentials expired");
|
|
15055
|
-
logConsole("\nRun `packmind-cli login` to re-authenticate.");
|
|
15056
|
-
process.exit(1);
|
|
15057
|
-
}
|
|
15058
|
-
const agentDetectionService = new AgentDetectionService();
|
|
15059
|
-
let selectedAgents;
|
|
15060
|
-
if (targets.length > 0) {
|
|
15061
|
-
selectedAgents = targets.map((t) => agentArgToType[t]).filter((a) => a !== void 0);
|
|
15062
|
-
} else {
|
|
15063
|
-
logConsole("\nDetecting installed AI agents...\n");
|
|
15064
|
-
const detectedAgents = agentDetectionService.detectAgents();
|
|
15065
|
-
if (detectedAgents.length > 0) {
|
|
15066
|
-
logConsole("Found agents:");
|
|
15067
|
-
detectedAgents.forEach((detectedAgent) => {
|
|
15068
|
-
logConsole(` - ${detectedAgent.name}`);
|
|
15069
|
-
});
|
|
15070
|
-
logConsole("");
|
|
15071
|
-
} else {
|
|
15072
|
-
logConsole("No supported agents detected.\n");
|
|
15073
|
-
}
|
|
15074
|
-
const detectedTypes = new Set(detectedAgents.map((a) => a.type));
|
|
15075
|
-
const choices = ALL_AGENTS2.map((agentInfo) => ({
|
|
15076
|
-
name: agentInfo.name,
|
|
15077
|
-
value: agentInfo.type,
|
|
15078
|
-
checked: detectedTypes.has(agentInfo.type)
|
|
15079
|
-
}));
|
|
15080
|
-
let promptedAgents;
|
|
15081
|
-
const useSimplePrompt = process.env.PACKMIND_SIMPLE_PROMPT === "1" || !process.stdin.isTTY;
|
|
15082
|
-
if (useSimplePrompt) {
|
|
15083
|
-
promptedAgents = await promptAgentsWithReadline(choices);
|
|
15084
|
-
} else {
|
|
15085
|
-
const result2 = await inquirer.default.prompt([
|
|
15086
|
-
{
|
|
15087
|
-
type: "checkbox",
|
|
15088
|
-
name: "selectedAgents",
|
|
15089
|
-
message: "Select agents to configure (use space to select):",
|
|
15090
|
-
choices
|
|
15091
|
-
}
|
|
15092
|
-
]);
|
|
15093
|
-
promptedAgents = result2.selectedAgents;
|
|
15094
|
-
}
|
|
15095
|
-
if (promptedAgents.length === 0) {
|
|
15096
|
-
logConsole("\nNo agents selected. Exiting.");
|
|
15097
|
-
process.exit(0);
|
|
15098
|
-
}
|
|
15099
|
-
selectedAgents = promptedAgents;
|
|
15100
|
-
}
|
|
15101
|
-
logConsole("\nFetching MCP configuration...\n");
|
|
15102
|
-
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
15103
|
-
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
15104
|
-
let result;
|
|
15105
|
-
try {
|
|
15106
|
-
result = await packmindCliHexa.setupMcp({ agentTypes: selectedAgents });
|
|
15107
|
-
} catch (error) {
|
|
15108
|
-
logErrorConsole("Failed to fetch MCP configuration from server.");
|
|
15109
|
-
if (error instanceof Error) {
|
|
15110
|
-
logConsole(` ${error.message}`);
|
|
15111
|
-
}
|
|
15112
|
-
process.exit(1);
|
|
15113
|
-
}
|
|
15114
|
-
let successCount = 0;
|
|
15115
|
-
const failedAgents = [];
|
|
15116
|
-
for (const agentResult of result.results) {
|
|
15117
|
-
logConsole(`Installing MCP for ${agentResult.agentName}...`);
|
|
15118
|
-
if (agentResult.success) {
|
|
15119
|
-
logSuccessConsole(` ${agentResult.agentName} configured successfully`);
|
|
15120
|
-
successCount++;
|
|
15121
|
-
} else {
|
|
15122
|
-
logErrorConsole(` Failed to configure ${agentResult.agentName}`);
|
|
15123
|
-
failedAgents.push({
|
|
15124
|
-
name: agentResult.agentName,
|
|
15125
|
-
error: agentResult.error || ""
|
|
15126
|
-
});
|
|
15127
|
-
}
|
|
15128
|
-
}
|
|
15129
|
-
logConsole("");
|
|
15130
|
-
if (failedAgents.length > 0) {
|
|
15131
|
-
for (const failed of failedAgents) {
|
|
15132
|
-
logWarningConsole(`Failed to configure ${failed.name}:`);
|
|
15133
|
-
logConsole(`
|
|
15134
|
-
Error: ${failed.error}`);
|
|
15135
|
-
if (failed.error.includes("ENOENT") || failed.error.includes("not found") || failed.error.includes("command not found")) {
|
|
15136
|
-
logConsole(
|
|
15137
|
-
`
|
|
15138
|
-
Hint: Make sure the agent CLI is installed and available in your PATH.`
|
|
15139
|
-
);
|
|
15140
|
-
}
|
|
15141
|
-
logConsole(`
|
|
15142
|
-
Manual configuration:`);
|
|
15143
|
-
logConsole(result.manualConfigJson ?? "undefined");
|
|
15144
|
-
logConsole("");
|
|
15145
|
-
}
|
|
15146
|
-
}
|
|
15147
|
-
if (successCount > 0) {
|
|
15148
|
-
const agentWord = successCount === 1 ? "agent" : "agents";
|
|
15149
|
-
logConsole(
|
|
15150
|
-
formatBold(`Done! MCP configured for ${successCount} ${agentWord}.`)
|
|
15151
|
-
);
|
|
15152
|
-
}
|
|
15153
|
-
if (failedAgents.length > 0) {
|
|
15154
|
-
process.exit(1);
|
|
15155
|
-
}
|
|
15156
|
-
}
|
|
15157
|
-
});
|
|
15158
|
-
|
|
15159
14671
|
// apps/cli/src/infra/commands/SkillsCommand.ts
|
|
15160
|
-
var
|
|
14672
|
+
var import_cmd_ts11 = __toESM(require_cjs());
|
|
15161
14673
|
|
|
15162
14674
|
// apps/cli/src/infra/commands/skills/AddSkillCommand.ts
|
|
15163
|
-
var
|
|
14675
|
+
var import_cmd_ts8 = __toESM(require_cjs());
|
|
15164
14676
|
|
|
15165
14677
|
// apps/cli/src/infra/commands/sharedOptions.ts
|
|
15166
|
-
var
|
|
15167
|
-
var originSkillOption = (0,
|
|
14678
|
+
var import_cmd_ts7 = __toESM(require_cjs());
|
|
14679
|
+
var originSkillOption = (0, import_cmd_ts7.option)({
|
|
15168
14680
|
long: "origin-skill",
|
|
15169
14681
|
description: "Name of the skill that triggered this command",
|
|
15170
|
-
type: (0,
|
|
14682
|
+
type: (0, import_cmd_ts7.optional)(import_cmd_ts7.string)
|
|
15171
14683
|
});
|
|
15172
14684
|
|
|
15173
14685
|
// apps/cli/src/infra/commands/customParameters/SpaceSlug.ts
|
|
@@ -15178,19 +14690,19 @@ var SpaceSlug = {
|
|
|
15178
14690
|
};
|
|
15179
14691
|
|
|
15180
14692
|
// apps/cli/src/infra/commands/skills/AddSkillCommand.ts
|
|
15181
|
-
var addSkillCommand = (0,
|
|
14693
|
+
var addSkillCommand = (0, import_cmd_ts8.command)({
|
|
15182
14694
|
name: "add",
|
|
15183
14695
|
description: "[Deprecated] Add a skill from a local directory to a Packmind organization",
|
|
15184
14696
|
args: {
|
|
15185
|
-
skillPath: (0,
|
|
15186
|
-
type:
|
|
14697
|
+
skillPath: (0, import_cmd_ts8.positional)({
|
|
14698
|
+
type: import_cmd_ts8.string,
|
|
15187
14699
|
displayName: "path",
|
|
15188
14700
|
description: "Path to skill directory containing SKILL.md"
|
|
15189
14701
|
}),
|
|
15190
|
-
space: (0,
|
|
14702
|
+
space: (0, import_cmd_ts8.option)({
|
|
15191
14703
|
long: "space",
|
|
15192
14704
|
description: "Slug of the space in which to add the skill (with or without leading @)",
|
|
15193
|
-
type: (0,
|
|
14705
|
+
type: (0, import_cmd_ts8.optional)(SpaceSlug)
|
|
15194
14706
|
}),
|
|
15195
14707
|
originSkill: originSkillOption
|
|
15196
14708
|
},
|
|
@@ -15209,12 +14721,12 @@ var addSkillCommand = (0, import_cmd_ts9.command)({
|
|
|
15209
14721
|
});
|
|
15210
14722
|
|
|
15211
14723
|
// apps/cli/src/infra/commands/skills/InstallDefaultSkillsCommand.ts
|
|
15212
|
-
var
|
|
15213
|
-
var
|
|
14724
|
+
var import_cmd_ts9 = __toESM(require_cjs());
|
|
14725
|
+
var readline2 = __toESM(require("readline"));
|
|
15214
14726
|
|
|
15215
14727
|
// apps/cli/src/infra/commands/skills/incompatibleSkillsHandler.ts
|
|
15216
|
-
var
|
|
15217
|
-
var
|
|
14728
|
+
var fs18 = __toESM(require("fs/promises"));
|
|
14729
|
+
var path20 = __toESM(require("path"));
|
|
15218
14730
|
async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm) {
|
|
15219
14731
|
const skillNames = skills.map((s) => s.skillName).join(", ");
|
|
15220
14732
|
logWarningConsole(
|
|
@@ -15227,10 +14739,10 @@ async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm)
|
|
|
15227
14739
|
return;
|
|
15228
14740
|
}
|
|
15229
14741
|
for (const skill of skills) {
|
|
15230
|
-
const skillRootDirs = skill.filePaths.filter((p) =>
|
|
14742
|
+
const skillRootDirs = skill.filePaths.filter((p) => path20.basename(p) === "SKILL.md").map((p) => path20.dirname(p));
|
|
15231
14743
|
for (const dir of skillRootDirs) {
|
|
15232
14744
|
try {
|
|
15233
|
-
await
|
|
14745
|
+
await fs18.rm(path20.join(baseDirectory, dir), {
|
|
15234
14746
|
recursive: true,
|
|
15235
14747
|
force: true
|
|
15236
14748
|
});
|
|
@@ -15243,7 +14755,7 @@ async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm)
|
|
|
15243
14755
|
for (const relativePath of skill.filePaths) {
|
|
15244
14756
|
if (!skillRootDirs.some((dir) => relativePath.startsWith(dir + "/"))) {
|
|
15245
14757
|
try {
|
|
15246
|
-
await
|
|
14758
|
+
await fs18.unlink(path20.join(baseDirectory, relativePath));
|
|
15247
14759
|
} catch (error) {
|
|
15248
14760
|
logErrorConsole(
|
|
15249
14761
|
`Failed to delete "${relativePath}": ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -15257,11 +14769,11 @@ async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm)
|
|
|
15257
14769
|
|
|
15258
14770
|
// apps/cli/src/infra/commands/skills/InstallDefaultSkillsCommand.ts
|
|
15259
14771
|
var { version: CLI_VERSION3 } = require_package();
|
|
15260
|
-
var installDefaultSkillsCommand = (0,
|
|
14772
|
+
var installDefaultSkillsCommand = (0, import_cmd_ts9.command)({
|
|
15261
14773
|
name: "install-default",
|
|
15262
14774
|
description: "Install default Packmind skills for configured coding agents",
|
|
15263
14775
|
args: {
|
|
15264
|
-
includeBeta: (0,
|
|
14776
|
+
includeBeta: (0, import_cmd_ts9.flag)({
|
|
15265
14777
|
long: "include-beta",
|
|
15266
14778
|
description: "Include unreleased/beta skills"
|
|
15267
14779
|
})
|
|
@@ -15324,7 +14836,7 @@ async function handleIncompatibleInstalledSkillsWithPrompt(skills, baseDirectory
|
|
|
15324
14836
|
);
|
|
15325
14837
|
}
|
|
15326
14838
|
async function promptConfirmation(question) {
|
|
15327
|
-
const rl =
|
|
14839
|
+
const rl = readline2.createInterface({
|
|
15328
14840
|
input: process.stdin,
|
|
15329
14841
|
output: process.stdout
|
|
15330
14842
|
});
|
|
@@ -15337,7 +14849,7 @@ async function promptConfirmation(question) {
|
|
|
15337
14849
|
}
|
|
15338
14850
|
|
|
15339
14851
|
// apps/cli/src/infra/commands/ListSkillsCommand.ts
|
|
15340
|
-
var
|
|
14852
|
+
var import_cmd_ts10 = __toESM(require_cjs());
|
|
15341
14853
|
|
|
15342
14854
|
// apps/cli/src/infra/utils/spaceFilterUtils.ts
|
|
15343
14855
|
function resolveSpaceFromArgs(spaceArg, spaces) {
|
|
@@ -15433,12 +14945,12 @@ ${availableSpaces}`
|
|
|
15433
14945
|
}
|
|
15434
14946
|
|
|
15435
14947
|
// apps/cli/src/infra/commands/ListSkillsCommand.ts
|
|
15436
|
-
var listSkillsCommand = (0,
|
|
14948
|
+
var listSkillsCommand = (0, import_cmd_ts10.command)({
|
|
15437
14949
|
name: "list",
|
|
15438
14950
|
description: "List available skills",
|
|
15439
14951
|
args: {
|
|
15440
|
-
space: (0,
|
|
15441
|
-
type: (0,
|
|
14952
|
+
space: (0, import_cmd_ts10.option)({
|
|
14953
|
+
type: (0, import_cmd_ts10.optional)(SpaceSlug),
|
|
15442
14954
|
long: "space",
|
|
15443
14955
|
description: "Filter skills by space slug"
|
|
15444
14956
|
})
|
|
@@ -15457,7 +14969,7 @@ var listSkillsCommand = (0, import_cmd_ts11.command)({
|
|
|
15457
14969
|
});
|
|
15458
14970
|
|
|
15459
14971
|
// apps/cli/src/infra/commands/SkillsCommand.ts
|
|
15460
|
-
var skillsCommand = (0,
|
|
14972
|
+
var skillsCommand = (0, import_cmd_ts11.subcommands)({
|
|
15461
14973
|
name: "skills",
|
|
15462
14974
|
description: "Manage skills in your Packmind organization",
|
|
15463
14975
|
cmds: {
|
|
@@ -15468,23 +14980,23 @@ var skillsCommand = (0, import_cmd_ts12.subcommands)({
|
|
|
15468
14980
|
});
|
|
15469
14981
|
|
|
15470
14982
|
// apps/cli/src/infra/commands/StandardsCommand.ts
|
|
15471
|
-
var
|
|
14983
|
+
var import_cmd_ts14 = __toESM(require_cjs());
|
|
15472
14984
|
|
|
15473
14985
|
// apps/cli/src/infra/commands/CreateStandardCommand.ts
|
|
15474
|
-
var
|
|
15475
|
-
var createStandardCommand = (0,
|
|
14986
|
+
var import_cmd_ts12 = __toESM(require_cjs());
|
|
14987
|
+
var createStandardCommand = (0, import_cmd_ts12.command)({
|
|
15476
14988
|
name: "create",
|
|
15477
14989
|
description: "[Deprecated] Create a coding standard from a playbook JSON file or stdin",
|
|
15478
14990
|
args: {
|
|
15479
|
-
file: (0,
|
|
14991
|
+
file: (0, import_cmd_ts12.positional)({
|
|
15480
14992
|
displayName: "file",
|
|
15481
14993
|
description: "Path to the playbook JSON file (reads from stdin if omitted)",
|
|
15482
|
-
type: (0,
|
|
14994
|
+
type: (0, import_cmd_ts12.optional)(import_cmd_ts12.string)
|
|
15483
14995
|
}),
|
|
15484
|
-
space: (0,
|
|
14996
|
+
space: (0, import_cmd_ts12.option)({
|
|
15485
14997
|
long: "space",
|
|
15486
14998
|
description: "Slug of the space in which to create the standard (with or without leading @)",
|
|
15487
|
-
type: (0,
|
|
14999
|
+
type: (0, import_cmd_ts12.optional)(SpaceSlug)
|
|
15488
15000
|
}),
|
|
15489
15001
|
originSkill: originSkillOption
|
|
15490
15002
|
},
|
|
@@ -15503,7 +15015,7 @@ var createStandardCommand = (0, import_cmd_ts13.command)({
|
|
|
15503
15015
|
});
|
|
15504
15016
|
|
|
15505
15017
|
// apps/cli/src/infra/commands/ListStandardsCommand.ts
|
|
15506
|
-
var
|
|
15018
|
+
var import_cmd_ts13 = __toESM(require_cjs());
|
|
15507
15019
|
|
|
15508
15020
|
// apps/cli/src/infra/commands/standards/listStandardsHandler.ts
|
|
15509
15021
|
async function listStandardsHandler(args2, deps) {
|
|
@@ -15560,12 +15072,12 @@ ${availableSpaces}`
|
|
|
15560
15072
|
}
|
|
15561
15073
|
|
|
15562
15074
|
// apps/cli/src/infra/commands/ListStandardsCommand.ts
|
|
15563
|
-
var listStandardsCommand = (0,
|
|
15075
|
+
var listStandardsCommand = (0, import_cmd_ts13.command)({
|
|
15564
15076
|
name: "list",
|
|
15565
15077
|
description: "List available coding standards",
|
|
15566
15078
|
args: {
|
|
15567
|
-
space: (0,
|
|
15568
|
-
type: (0,
|
|
15079
|
+
space: (0, import_cmd_ts13.option)({
|
|
15080
|
+
type: (0, import_cmd_ts13.optional)(SpaceSlug),
|
|
15569
15081
|
long: "space",
|
|
15570
15082
|
description: "Filter standards by space slug"
|
|
15571
15083
|
})
|
|
@@ -15584,7 +15096,7 @@ var listStandardsCommand = (0, import_cmd_ts14.command)({
|
|
|
15584
15096
|
});
|
|
15585
15097
|
|
|
15586
15098
|
// apps/cli/src/infra/commands/StandardsCommand.ts
|
|
15587
|
-
var standardsCommand = (0,
|
|
15099
|
+
var standardsCommand = (0, import_cmd_ts14.subcommands)({
|
|
15588
15100
|
name: "standards",
|
|
15589
15101
|
description: "Manage coding standards",
|
|
15590
15102
|
cmds: {
|
|
@@ -15594,23 +15106,23 @@ var standardsCommand = (0, import_cmd_ts15.subcommands)({
|
|
|
15594
15106
|
});
|
|
15595
15107
|
|
|
15596
15108
|
// apps/cli/src/infra/commands/CommandsCommand.ts
|
|
15597
|
-
var
|
|
15109
|
+
var import_cmd_ts17 = __toESM(require_cjs());
|
|
15598
15110
|
|
|
15599
15111
|
// apps/cli/src/infra/commands/CreateCommandCommand.ts
|
|
15600
|
-
var
|
|
15601
|
-
var createCommandCommand = (0,
|
|
15112
|
+
var import_cmd_ts15 = __toESM(require_cjs());
|
|
15113
|
+
var createCommandCommand = (0, import_cmd_ts15.command)({
|
|
15602
15114
|
name: "create",
|
|
15603
15115
|
description: "[Deprecated] Create a command from a playbook JSON file or stdin",
|
|
15604
15116
|
args: {
|
|
15605
|
-
file: (0,
|
|
15117
|
+
file: (0, import_cmd_ts15.positional)({
|
|
15606
15118
|
displayName: "file",
|
|
15607
15119
|
description: "Path to the command playbook JSON file (reads from stdin if omitted)",
|
|
15608
|
-
type: (0,
|
|
15120
|
+
type: (0, import_cmd_ts15.optional)(import_cmd_ts15.string)
|
|
15609
15121
|
}),
|
|
15610
|
-
space: (0,
|
|
15122
|
+
space: (0, import_cmd_ts15.option)({
|
|
15611
15123
|
long: "space",
|
|
15612
15124
|
description: "Slug of the space in which to create the command",
|
|
15613
|
-
type: (0,
|
|
15125
|
+
type: (0, import_cmd_ts15.optional)(SpaceSlug)
|
|
15614
15126
|
}),
|
|
15615
15127
|
originSkill: originSkillOption
|
|
15616
15128
|
},
|
|
@@ -15629,7 +15141,7 @@ var createCommandCommand = (0, import_cmd_ts16.command)({
|
|
|
15629
15141
|
});
|
|
15630
15142
|
|
|
15631
15143
|
// apps/cli/src/infra/commands/ListCommandsCommand.ts
|
|
15632
|
-
var
|
|
15144
|
+
var import_cmd_ts16 = __toESM(require_cjs());
|
|
15633
15145
|
|
|
15634
15146
|
// apps/cli/src/infra/commands/commands/listCommandsHandler.ts
|
|
15635
15147
|
async function listCommandsHandler(args2, deps) {
|
|
@@ -15685,12 +15197,12 @@ ${availableSpaces}`
|
|
|
15685
15197
|
}
|
|
15686
15198
|
|
|
15687
15199
|
// apps/cli/src/infra/commands/ListCommandsCommand.ts
|
|
15688
|
-
var listCommandsCommand = (0,
|
|
15200
|
+
var listCommandsCommand = (0, import_cmd_ts16.command)({
|
|
15689
15201
|
name: "list",
|
|
15690
15202
|
description: "List available commands",
|
|
15691
15203
|
args: {
|
|
15692
|
-
space: (0,
|
|
15693
|
-
type: (0,
|
|
15204
|
+
space: (0, import_cmd_ts16.option)({
|
|
15205
|
+
type: (0, import_cmd_ts16.optional)(SpaceSlug),
|
|
15694
15206
|
long: "space",
|
|
15695
15207
|
description: "Filter commands by space slug"
|
|
15696
15208
|
})
|
|
@@ -15707,7 +15219,7 @@ var listCommandsCommand = (0, import_cmd_ts17.command)({
|
|
|
15707
15219
|
});
|
|
15708
15220
|
|
|
15709
15221
|
// apps/cli/src/infra/commands/CommandsCommand.ts
|
|
15710
|
-
var commandsCommand = (0,
|
|
15222
|
+
var commandsCommand = (0, import_cmd_ts17.subcommands)({
|
|
15711
15223
|
name: "commands",
|
|
15712
15224
|
description: "Manage commands",
|
|
15713
15225
|
cmds: {
|
|
@@ -15717,11 +15229,11 @@ var commandsCommand = (0, import_cmd_ts18.subcommands)({
|
|
|
15717
15229
|
});
|
|
15718
15230
|
|
|
15719
15231
|
// apps/cli/src/infra/commands/DiffCommand.ts
|
|
15720
|
-
var
|
|
15232
|
+
var import_cmd_ts18 = __toESM(require_cjs());
|
|
15721
15233
|
|
|
15722
15234
|
// apps/cli/src/infra/commands/playbook/diffArtefactsHandler.ts
|
|
15723
15235
|
var nodePath = __toESM(require("path"));
|
|
15724
|
-
var
|
|
15236
|
+
var fs19 = __toESM(require("fs/promises"));
|
|
15725
15237
|
|
|
15726
15238
|
// apps/cli/src/infra/utils/diffFormatter.ts
|
|
15727
15239
|
var import_diff4 = require("diff");
|
|
@@ -16020,7 +15532,7 @@ async function diffArtefactsHandler(deps) {
|
|
|
16020
15532
|
const searchPath = nodePath.resolve(cwd, deps.path ?? ".");
|
|
16021
15533
|
if (deps.path !== void 0) {
|
|
16022
15534
|
try {
|
|
16023
|
-
await
|
|
15535
|
+
await fs19.stat(searchPath);
|
|
16024
15536
|
} catch {
|
|
16025
15537
|
logErrorConsole(`Path does not exist: ${searchPath}`);
|
|
16026
15538
|
exit(1);
|
|
@@ -16150,37 +15662,37 @@ async function diffArtefactsHandler(deps) {
|
|
|
16150
15662
|
}
|
|
16151
15663
|
|
|
16152
15664
|
// apps/cli/src/infra/commands/DiffCommand.ts
|
|
16153
|
-
var diffCommand = (0,
|
|
15665
|
+
var diffCommand = (0, import_cmd_ts18.command)({
|
|
16154
15666
|
name: "diff",
|
|
16155
15667
|
description: "[Deprecated] Use `playbook diff` commands instead. Run for migration guidance",
|
|
16156
15668
|
args: {
|
|
16157
|
-
submit: (0,
|
|
15669
|
+
submit: (0, import_cmd_ts18.flag)({
|
|
16158
15670
|
long: "submit",
|
|
16159
15671
|
description: "Submit detected changes as change proposals"
|
|
16160
15672
|
}),
|
|
16161
|
-
includeSubmitted: (0,
|
|
15673
|
+
includeSubmitted: (0, import_cmd_ts18.flag)({
|
|
16162
15674
|
long: "include-submitted",
|
|
16163
15675
|
description: "Include already submitted changes in the output"
|
|
16164
15676
|
}),
|
|
16165
|
-
message: (0,
|
|
15677
|
+
message: (0, import_cmd_ts18.option)({
|
|
16166
15678
|
long: "message",
|
|
16167
15679
|
short: "m",
|
|
16168
15680
|
description: "Message describing the intent behind the changes (max 1024 chars)",
|
|
16169
|
-
type: (0,
|
|
15681
|
+
type: (0, import_cmd_ts18.optional)(import_cmd_ts18.string)
|
|
16170
15682
|
}),
|
|
16171
|
-
path: (0,
|
|
15683
|
+
path: (0, import_cmd_ts18.option)({
|
|
16172
15684
|
long: "path",
|
|
16173
15685
|
short: "p",
|
|
16174
15686
|
description: "Path to analyze (relative to current directory)",
|
|
16175
|
-
type: (0,
|
|
15687
|
+
type: (0, import_cmd_ts18.optional)(import_cmd_ts18.string)
|
|
16176
15688
|
}),
|
|
16177
|
-
positionals: (0,
|
|
16178
|
-
type:
|
|
15689
|
+
positionals: (0, import_cmd_ts18.restPositionals)({
|
|
15690
|
+
type: import_cmd_ts18.string,
|
|
16179
15691
|
displayName: "args",
|
|
16180
15692
|
description: "Subcommand and arguments (e.g., add <path>, remove <path>)"
|
|
16181
15693
|
})
|
|
16182
15694
|
},
|
|
16183
|
-
handler: async ({ submit, includeSubmitted, message, path:
|
|
15695
|
+
handler: async ({ submit, includeSubmitted, message, path: path35, positionals }) => {
|
|
16184
15696
|
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
16185
15697
|
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
16186
15698
|
if (submit) {
|
|
@@ -16196,7 +15708,7 @@ var diffCommand = (0, import_cmd_ts19.command)({
|
|
|
16196
15708
|
process.exit(1);
|
|
16197
15709
|
}
|
|
16198
15710
|
if (positionals[0] === "add") {
|
|
16199
|
-
const addFilePath =
|
|
15711
|
+
const addFilePath = path35 && positionals[1] ? `${path35}/${positionals[1]}`.replace(/\/+/g, "/") : positionals[1];
|
|
16200
15712
|
const addCommand = `packmind-cli playbook add ${addFilePath}`;
|
|
16201
15713
|
logErrorConsole("Deprecated: `packmind-cli diff add` has been removed");
|
|
16202
15714
|
logInfoConsole("Use the following command instead:");
|
|
@@ -16204,7 +15716,7 @@ var diffCommand = (0, import_cmd_ts19.command)({
|
|
|
16204
15716
|
process.exit(1);
|
|
16205
15717
|
}
|
|
16206
15718
|
if (positionals[0] === "remove" || positionals[0] === "rm") {
|
|
16207
|
-
const removeFilePath =
|
|
15719
|
+
const removeFilePath = path35 && positionals[1] ? `${path35}/${positionals[1]}`.replace(/\/+/g, "/") : positionals[1];
|
|
16208
15720
|
const removeCommand = `packmind-cli playbook remove ${removeFilePath}`;
|
|
16209
15721
|
logErrorConsole(
|
|
16210
15722
|
"Deprecated: `packmind-cli diff remove` has been removed"
|
|
@@ -16213,7 +15725,7 @@ var diffCommand = (0, import_cmd_ts19.command)({
|
|
|
16213
15725
|
logInfoConsole(` ${formatCommand(removeCommand)}`);
|
|
16214
15726
|
process.exit(1);
|
|
16215
15727
|
}
|
|
16216
|
-
const diffCommand3 = `packmind-cli playbook diff${includeSubmitted ? " --include-submitted" : ""}${
|
|
15728
|
+
const diffCommand3 = `packmind-cli playbook diff${includeSubmitted ? " --include-submitted" : ""}${path35 ? ` --path ${path35}` : ""}`;
|
|
16217
15729
|
logErrorConsole("Deprecated: `packmind-cli diff` will be removed");
|
|
16218
15730
|
logInfoConsole("Use the following command instead:");
|
|
16219
15731
|
logInfoConsole(` ${formatCommand(diffCommand3)}`);
|
|
@@ -16223,16 +15735,16 @@ var diffCommand = (0, import_cmd_ts19.command)({
|
|
|
16223
15735
|
getCwd: () => process.cwd(),
|
|
16224
15736
|
log: console.log,
|
|
16225
15737
|
includeSubmitted,
|
|
16226
|
-
path:
|
|
15738
|
+
path: path35
|
|
16227
15739
|
});
|
|
16228
15740
|
}
|
|
16229
15741
|
});
|
|
16230
15742
|
|
|
16231
15743
|
// apps/cli/src/infra/commands/PackagesCommand.ts
|
|
16232
|
-
var
|
|
15744
|
+
var import_cmd_ts23 = __toESM(require_cjs());
|
|
16233
15745
|
|
|
16234
15746
|
// apps/cli/src/infra/commands/CreatePackageCommand.ts
|
|
16235
|
-
var
|
|
15747
|
+
var import_cmd_ts19 = __toESM(require_cjs());
|
|
16236
15748
|
|
|
16237
15749
|
// apps/cli/src/infra/commands/packages/createPackageHandler.ts
|
|
16238
15750
|
function toExpectedSlug(name) {
|
|
@@ -16289,15 +15801,15 @@ var CreatePackageUseCase = class {
|
|
|
16289
15801
|
this.gateway = gateway;
|
|
16290
15802
|
this.spaceService = spaceService;
|
|
16291
15803
|
}
|
|
16292
|
-
async execute(
|
|
16293
|
-
const space = await this.getSpace(
|
|
15804
|
+
async execute(command32) {
|
|
15805
|
+
const space = await this.getSpace(command32);
|
|
16294
15806
|
const result = await this.gateway.packages.create({
|
|
16295
15807
|
spaceId: space.id,
|
|
16296
|
-
name:
|
|
16297
|
-
description:
|
|
15808
|
+
name: command32.name,
|
|
15809
|
+
description: command32.description ?? "",
|
|
16298
15810
|
recipeIds: [],
|
|
16299
15811
|
standardIds: [],
|
|
16300
|
-
originSkill:
|
|
15812
|
+
originSkill: command32.originSkill
|
|
16301
15813
|
});
|
|
16302
15814
|
return {
|
|
16303
15815
|
packageId: result.package.id,
|
|
@@ -16306,12 +15818,12 @@ var CreatePackageUseCase = class {
|
|
|
16306
15818
|
spaceSlug: space.slug
|
|
16307
15819
|
};
|
|
16308
15820
|
}
|
|
16309
|
-
async getSpace(
|
|
15821
|
+
async getSpace(command32) {
|
|
16310
15822
|
const spaces = await this.spaceService.getSpaces();
|
|
16311
|
-
if (
|
|
16312
|
-
const found = spaces.find((s) => s.slug ===
|
|
15823
|
+
if (command32.spaceSlug) {
|
|
15824
|
+
const found = spaces.find((s) => s.slug === command32.spaceSlug);
|
|
16313
15825
|
if (!found) {
|
|
16314
|
-
throw new Error(`Space '${
|
|
15826
|
+
throw new Error(`Space '${command32.spaceSlug}' not found.`);
|
|
16315
15827
|
}
|
|
16316
15828
|
return found;
|
|
16317
15829
|
}
|
|
@@ -16329,25 +15841,25 @@ ${spaceList}`
|
|
|
16329
15841
|
};
|
|
16330
15842
|
|
|
16331
15843
|
// apps/cli/src/infra/commands/CreatePackageCommand.ts
|
|
16332
|
-
var createPackageCommand = (0,
|
|
15844
|
+
var createPackageCommand = (0, import_cmd_ts19.command)({
|
|
16333
15845
|
name: "create",
|
|
16334
15846
|
description: "Create a new package",
|
|
16335
15847
|
args: {
|
|
16336
|
-
name: (0,
|
|
15848
|
+
name: (0, import_cmd_ts19.positional)({
|
|
16337
15849
|
displayName: "name",
|
|
16338
15850
|
description: "Name of the package to create",
|
|
16339
|
-
type:
|
|
15851
|
+
type: import_cmd_ts19.string
|
|
16340
15852
|
}),
|
|
16341
|
-
description: (0,
|
|
15853
|
+
description: (0, import_cmd_ts19.option)({
|
|
16342
15854
|
long: "description",
|
|
16343
15855
|
short: "d",
|
|
16344
15856
|
description: "Description of the package (optional)",
|
|
16345
|
-
type: (0,
|
|
15857
|
+
type: (0, import_cmd_ts19.optional)(import_cmd_ts19.string)
|
|
16346
15858
|
}),
|
|
16347
|
-
space: (0,
|
|
15859
|
+
space: (0, import_cmd_ts19.option)({
|
|
16348
15860
|
long: "space",
|
|
16349
15861
|
description: "Slug of the space in which to create the package",
|
|
16350
|
-
type: (0,
|
|
15862
|
+
type: (0, import_cmd_ts19.optional)(SpaceSlug)
|
|
16351
15863
|
}),
|
|
16352
15864
|
originSkill: originSkillOption
|
|
16353
15865
|
},
|
|
@@ -16401,7 +15913,7 @@ var createPackageCommand = (0, import_cmd_ts20.command)({
|
|
|
16401
15913
|
});
|
|
16402
15914
|
|
|
16403
15915
|
// apps/cli/src/infra/commands/AddToPackageCommand.ts
|
|
16404
|
-
var
|
|
15916
|
+
var import_cmd_ts20 = __toESM(require_cjs());
|
|
16405
15917
|
|
|
16406
15918
|
// apps/cli/src/domain/errors/ItemNotFoundError.ts
|
|
16407
15919
|
var ItemNotFoundError = class extends Error {
|
|
@@ -16421,8 +15933,8 @@ var AddToPackageUseCase = class {
|
|
|
16421
15933
|
this.gateway = gateway;
|
|
16422
15934
|
this.spaceService = spaceService;
|
|
16423
15935
|
}
|
|
16424
|
-
async execute(
|
|
16425
|
-
const { packageSlug, spaceSlug, itemType, itemSlugs } =
|
|
15936
|
+
async execute(command32) {
|
|
15937
|
+
const { packageSlug, spaceSlug, itemType, itemSlugs } = command32;
|
|
16426
15938
|
const space = spaceSlug ? await this.resolveSpaceBySlug(spaceSlug) : await this.spaceService.getDefaultSpace();
|
|
16427
15939
|
const packages = await this.gateway.packages.list({
|
|
16428
15940
|
spaceId: space.id
|
|
@@ -16443,7 +15955,7 @@ var AddToPackageUseCase = class {
|
|
|
16443
15955
|
standardIds: [],
|
|
16444
15956
|
recipeIds: [],
|
|
16445
15957
|
skillIds: [],
|
|
16446
|
-
originSkill:
|
|
15958
|
+
originSkill: command32.originSkill
|
|
16447
15959
|
};
|
|
16448
15960
|
if (itemType === "standard") {
|
|
16449
15961
|
addCommand.standardIds = ids.map(createStandardId);
|
|
@@ -16495,7 +16007,7 @@ var AddToPackageUseCase = class {
|
|
|
16495
16007
|
}
|
|
16496
16008
|
async findCommandBySlug(slug3, spaceId) {
|
|
16497
16009
|
const commands = await this.gateway.commands.list({ spaceId });
|
|
16498
|
-
return commands.recipes.find((
|
|
16010
|
+
return commands.recipes.find((command32) => command32.slug === slug3) ?? null;
|
|
16499
16011
|
}
|
|
16500
16012
|
async findSkillBySlug(slug3, spaceId) {
|
|
16501
16013
|
const skills = await this.gateway.skills.list({ spaceId });
|
|
@@ -16581,11 +16093,11 @@ async function executeAddToPackage(pkgSlug, spaceSlug, itemType, itemSlugs, useC
|
|
|
16581
16093
|
logErrorConsole(message);
|
|
16582
16094
|
if (error instanceof ItemNotFoundError) {
|
|
16583
16095
|
const spaceFlag = error.spaceSlug ? ` --space ${error.spaceSlug}` : "";
|
|
16584
|
-
const
|
|
16096
|
+
const command32 = formatCommand(
|
|
16585
16097
|
`packmind-cli ${error.itemType}s list${spaceFlag}`
|
|
16586
16098
|
);
|
|
16587
16099
|
logInfoConsole(
|
|
16588
|
-
`Run \`${
|
|
16100
|
+
`Run \`${command32}\` to display available ${error.itemType}s`
|
|
16589
16101
|
);
|
|
16590
16102
|
}
|
|
16591
16103
|
return { success: false, error: message };
|
|
@@ -16611,29 +16123,29 @@ async function addToPackageHandler(args2, deps) {
|
|
|
16611
16123
|
}
|
|
16612
16124
|
|
|
16613
16125
|
// apps/cli/src/infra/commands/AddToPackageCommand.ts
|
|
16614
|
-
var addToPackageCommand = (0,
|
|
16126
|
+
var addToPackageCommand = (0, import_cmd_ts20.command)({
|
|
16615
16127
|
name: "add",
|
|
16616
16128
|
description: "Add standards, commands, or skills to a package",
|
|
16617
16129
|
args: {
|
|
16618
|
-
to: (0,
|
|
16130
|
+
to: (0, import_cmd_ts20.option)({
|
|
16619
16131
|
long: "to",
|
|
16620
16132
|
description: "Target package slug (use @space/package format when multiple spaces exist)",
|
|
16621
|
-
type:
|
|
16133
|
+
type: import_cmd_ts20.string
|
|
16622
16134
|
}),
|
|
16623
|
-
standards: (0,
|
|
16135
|
+
standards: (0, import_cmd_ts20.multioption)({
|
|
16624
16136
|
long: "standard",
|
|
16625
16137
|
description: "Standard slug(s) to add",
|
|
16626
|
-
type: (0,
|
|
16138
|
+
type: (0, import_cmd_ts20.array)(import_cmd_ts20.string)
|
|
16627
16139
|
}),
|
|
16628
|
-
commands: (0,
|
|
16140
|
+
commands: (0, import_cmd_ts20.multioption)({
|
|
16629
16141
|
long: "command",
|
|
16630
16142
|
description: "Command slug(s) to add",
|
|
16631
|
-
type: (0,
|
|
16143
|
+
type: (0, import_cmd_ts20.array)(import_cmd_ts20.string)
|
|
16632
16144
|
}),
|
|
16633
|
-
skills: (0,
|
|
16145
|
+
skills: (0, import_cmd_ts20.multioption)({
|
|
16634
16146
|
long: "skill",
|
|
16635
16147
|
description: "Skill slug(s) to add",
|
|
16636
|
-
type: (0,
|
|
16148
|
+
type: (0, import_cmd_ts20.array)(import_cmd_ts20.string)
|
|
16637
16149
|
}),
|
|
16638
16150
|
originSkill: originSkillOption
|
|
16639
16151
|
},
|
|
@@ -16669,7 +16181,7 @@ var addToPackageCommand = (0, import_cmd_ts21.command)({
|
|
|
16669
16181
|
});
|
|
16670
16182
|
|
|
16671
16183
|
// apps/cli/src/infra/commands/listPackagesCommand.ts
|
|
16672
|
-
var
|
|
16184
|
+
var import_cmd_ts21 = __toESM(require_cjs());
|
|
16673
16185
|
|
|
16674
16186
|
// apps/cli/src/infra/commands/packages/listPackagesHandler.ts
|
|
16675
16187
|
async function listPackagesHandler(args2, deps) {
|
|
@@ -16736,12 +16248,12 @@ ${availableSpaces}`
|
|
|
16736
16248
|
}
|
|
16737
16249
|
|
|
16738
16250
|
// apps/cli/src/infra/commands/listPackagesCommand.ts
|
|
16739
|
-
var listPackagesCommand = (0,
|
|
16251
|
+
var listPackagesCommand = (0, import_cmd_ts21.command)({
|
|
16740
16252
|
name: "list",
|
|
16741
16253
|
description: "List available packages",
|
|
16742
16254
|
args: {
|
|
16743
|
-
space: (0,
|
|
16744
|
-
type: (0,
|
|
16255
|
+
space: (0, import_cmd_ts21.option)({
|
|
16256
|
+
type: (0, import_cmd_ts21.optional)(SpaceSlug),
|
|
16745
16257
|
long: "space",
|
|
16746
16258
|
description: "Filter packages by space slug"
|
|
16747
16259
|
})
|
|
@@ -16758,7 +16270,7 @@ var listPackagesCommand = (0, import_cmd_ts22.command)({
|
|
|
16758
16270
|
});
|
|
16759
16271
|
|
|
16760
16272
|
// apps/cli/src/infra/commands/packages/showPackageCommand.ts
|
|
16761
|
-
var
|
|
16273
|
+
var import_cmd_ts22 = __toESM(require_cjs());
|
|
16762
16274
|
|
|
16763
16275
|
// apps/cli/src/infra/commands/packages/showPackageHandler.ts
|
|
16764
16276
|
function isNotFoundError(err) {
|
|
@@ -16877,12 +16389,12 @@ ${pkg.name} (${fullSlug}):
|
|
|
16877
16389
|
}
|
|
16878
16390
|
|
|
16879
16391
|
// apps/cli/src/infra/commands/packages/showPackageCommand.ts
|
|
16880
|
-
var showPackageCommand = (0,
|
|
16392
|
+
var showPackageCommand = (0, import_cmd_ts22.command)({
|
|
16881
16393
|
name: "show",
|
|
16882
16394
|
description: "Show details of a specific package",
|
|
16883
16395
|
args: {
|
|
16884
|
-
slug: (0,
|
|
16885
|
-
type:
|
|
16396
|
+
slug: (0, import_cmd_ts22.positional)({
|
|
16397
|
+
type: import_cmd_ts22.string,
|
|
16886
16398
|
displayName: "package",
|
|
16887
16399
|
description: "Package slug (e.g. backend or @my-space/backend)"
|
|
16888
16400
|
})
|
|
@@ -16895,7 +16407,7 @@ var showPackageCommand = (0, import_cmd_ts23.command)({
|
|
|
16895
16407
|
});
|
|
16896
16408
|
|
|
16897
16409
|
// apps/cli/src/infra/commands/PackagesCommand.ts
|
|
16898
|
-
var packagesCommand = (0,
|
|
16410
|
+
var packagesCommand = (0, import_cmd_ts23.subcommands)({
|
|
16899
16411
|
name: "packages",
|
|
16900
16412
|
description: "Manage packages",
|
|
16901
16413
|
cmds: {
|
|
@@ -16907,24 +16419,24 @@ var packagesCommand = (0, import_cmd_ts24.subcommands)({
|
|
|
16907
16419
|
});
|
|
16908
16420
|
|
|
16909
16421
|
// apps/cli/src/infra/commands/PlaybookCommand.ts
|
|
16910
|
-
var
|
|
16422
|
+
var import_cmd_ts30 = __toESM(require_cjs());
|
|
16911
16423
|
|
|
16912
16424
|
// apps/cli/src/infra/commands/playbook/AddCommand.ts
|
|
16913
16425
|
var import_fs21 = require("fs");
|
|
16914
|
-
var
|
|
16426
|
+
var import_cmd_ts24 = __toESM(require_cjs());
|
|
16915
16427
|
|
|
16916
16428
|
// apps/cli/src/infra/repositories/PlaybookLocalRepository.ts
|
|
16917
16429
|
var crypto = __toESM(require("crypto"));
|
|
16918
|
-
var
|
|
16919
|
-
var
|
|
16920
|
-
var
|
|
16430
|
+
var fs20 = __toESM(require("fs"));
|
|
16431
|
+
var os3 = __toESM(require("os"));
|
|
16432
|
+
var path21 = __toESM(require("path"));
|
|
16921
16433
|
var yaml = __toESM(require("yaml"));
|
|
16922
16434
|
var PlaybookLocalRepository = class {
|
|
16923
16435
|
constructor(repoRoot) {
|
|
16924
16436
|
const normalized = this.normalizeRepoRoot(repoRoot);
|
|
16925
16437
|
const hash = crypto.createHash("md5").update(normalized).digest("hex");
|
|
16926
|
-
this.storagePath =
|
|
16927
|
-
|
|
16438
|
+
this.storagePath = path21.join(
|
|
16439
|
+
os3.homedir(),
|
|
16928
16440
|
".packmind",
|
|
16929
16441
|
hash,
|
|
16930
16442
|
"playbook.yaml"
|
|
@@ -16971,11 +16483,11 @@ var PlaybookLocalRepository = class {
|
|
|
16971
16483
|
return normalized;
|
|
16972
16484
|
}
|
|
16973
16485
|
readYaml() {
|
|
16974
|
-
if (!
|
|
16486
|
+
if (!fs20.existsSync(this.storagePath)) {
|
|
16975
16487
|
return { version: 1, changes: [] };
|
|
16976
16488
|
}
|
|
16977
16489
|
try {
|
|
16978
|
-
const content =
|
|
16490
|
+
const content = fs20.readFileSync(this.storagePath, "utf-8");
|
|
16979
16491
|
const parsed = yaml.parse(content);
|
|
16980
16492
|
if (!parsed || !Array.isArray(parsed.changes)) {
|
|
16981
16493
|
return { version: 1, changes: [] };
|
|
@@ -16989,20 +16501,20 @@ var PlaybookLocalRepository = class {
|
|
|
16989
16501
|
}
|
|
16990
16502
|
}
|
|
16991
16503
|
writeYaml(data) {
|
|
16992
|
-
const dir =
|
|
16993
|
-
|
|
16994
|
-
|
|
16504
|
+
const dir = path21.dirname(this.storagePath);
|
|
16505
|
+
fs20.mkdirSync(dir, { recursive: true });
|
|
16506
|
+
fs20.writeFileSync(this.storagePath, yaml.stringify(data), "utf-8");
|
|
16995
16507
|
}
|
|
16996
16508
|
};
|
|
16997
16509
|
|
|
16998
16510
|
// apps/cli/src/infra/commands/playbook/addHandler.ts
|
|
16999
|
-
var
|
|
17000
|
-
var
|
|
16511
|
+
var fs21 = __toESM(require("fs"));
|
|
16512
|
+
var path25 = __toESM(require("path"));
|
|
17001
16513
|
var yaml2 = __toESM(require("yaml"));
|
|
17002
16514
|
var import_slug = __toESM(require("slug"));
|
|
17003
16515
|
|
|
17004
16516
|
// apps/cli/src/application/utils/parseCommandFile.ts
|
|
17005
|
-
var
|
|
16517
|
+
var path22 = __toESM(require("path"));
|
|
17006
16518
|
var FRONTMATTER_DELIMITER3 = "---";
|
|
17007
16519
|
function parseCommandFile(content, filePath) {
|
|
17008
16520
|
content = normalizeLineEndings(content);
|
|
@@ -17058,7 +16570,7 @@ function stripYamlQuotes2(value) {
|
|
|
17058
16570
|
return value;
|
|
17059
16571
|
}
|
|
17060
16572
|
function extractFilenameSlug(filePath) {
|
|
17061
|
-
let basename4 =
|
|
16573
|
+
let basename4 = path22.basename(filePath);
|
|
17062
16574
|
if (basename4.endsWith(".prompt.md")) {
|
|
17063
16575
|
basename4 = basename4.slice(0, -".prompt.md".length);
|
|
17064
16576
|
} else if (basename4.endsWith(".md")) {
|
|
@@ -17225,7 +16737,7 @@ function parseSkillDirectory(files) {
|
|
|
17225
16737
|
}
|
|
17226
16738
|
|
|
17227
16739
|
// apps/cli/src/application/utils/findNearestConfigDir.ts
|
|
17228
|
-
var
|
|
16740
|
+
var path23 = __toESM(require("path"));
|
|
17229
16741
|
async function findNearestConfigDir(startDir, packmindCliHexa) {
|
|
17230
16742
|
let current = startDir;
|
|
17231
16743
|
while (true) {
|
|
@@ -17233,7 +16745,7 @@ async function findNearestConfigDir(startDir, packmindCliHexa) {
|
|
|
17233
16745
|
if (exists) {
|
|
17234
16746
|
return current;
|
|
17235
16747
|
}
|
|
17236
|
-
const parent =
|
|
16748
|
+
const parent = path23.dirname(current);
|
|
17237
16749
|
if (parent === current) {
|
|
17238
16750
|
return null;
|
|
17239
16751
|
}
|
|
@@ -17242,7 +16754,7 @@ async function findNearestConfigDir(startDir, packmindCliHexa) {
|
|
|
17242
16754
|
}
|
|
17243
16755
|
|
|
17244
16756
|
// apps/cli/src/application/utils/resolveDeployedContext.ts
|
|
17245
|
-
var
|
|
16757
|
+
var path24 = __toESM(require("path"));
|
|
17246
16758
|
async function resolveDeployedContext(packmindCliHexa, targetDir) {
|
|
17247
16759
|
try {
|
|
17248
16760
|
const space = await packmindCliHexa.getDefaultSpace();
|
|
@@ -17254,7 +16766,7 @@ async function resolveDeployedContext(packmindCliHexa, targetDir) {
|
|
|
17254
16766
|
}
|
|
17255
16767
|
const gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
|
|
17256
16768
|
const gitBranch = packmindCliHexa.getCurrentBranch(gitRoot);
|
|
17257
|
-
const rel =
|
|
16769
|
+
const rel = path24.relative(gitRoot, targetDir);
|
|
17258
16770
|
const relativePath = rel.startsWith("..") ? "/" : rel ? `/${rel}/` : "/";
|
|
17259
16771
|
const deployedContent = await packmindCliHexa.getPackmindGateway().deployment.getDeployed({
|
|
17260
16772
|
packagesSlugs: configPackages,
|
|
@@ -17319,19 +16831,19 @@ async function fetchDeployedFiles(gateway, lockFile) {
|
|
|
17319
16831
|
|
|
17320
16832
|
// apps/cli/src/infra/commands/playbook/addHandler.ts
|
|
17321
16833
|
async function tryStageRemovedFromLockFile(resolvedPath, deps) {
|
|
17322
|
-
const fileDir =
|
|
16834
|
+
const fileDir = path25.dirname(resolvedPath);
|
|
17323
16835
|
const targetDir = await findNearestConfigDir(fileDir, deps.packmindCliHexa);
|
|
17324
16836
|
if (!targetDir) return false;
|
|
17325
16837
|
const lockFile = await deps.lockFileRepository.read(targetDir);
|
|
17326
16838
|
if (!lockFile) return false;
|
|
17327
|
-
const normalizedPath = normalizePath2(
|
|
16839
|
+
const normalizedPath = normalizePath2(path25.relative(targetDir, resolvedPath));
|
|
17328
16840
|
const lockEntry = findLockFileEntryForPath(
|
|
17329
16841
|
normalizedPath,
|
|
17330
16842
|
lockFile.artifacts
|
|
17331
16843
|
);
|
|
17332
16844
|
if (!lockEntry) return false;
|
|
17333
16845
|
const gitRoot = await deps.packmindCliHexa.tryGetGitRepositoryRoot(targetDir);
|
|
17334
|
-
const configDir = gitRoot ? normalizePath2(
|
|
16846
|
+
const configDir = gitRoot ? normalizePath2(path25.relative(gitRoot, targetDir)) : "";
|
|
17335
16847
|
const deployedContext = await resolveDeployedContext(
|
|
17336
16848
|
deps.packmindCliHexa,
|
|
17337
16849
|
targetDir
|
|
@@ -17363,22 +16875,22 @@ async function tryStageRemovedFromLockFile(resolvedPath, deps) {
|
|
|
17363
16875
|
}
|
|
17364
16876
|
function resolveSkillDirectoryRoot(absolutePath) {
|
|
17365
16877
|
if (absolutePath.endsWith("SKILL.md")) {
|
|
17366
|
-
return
|
|
16878
|
+
return path25.dirname(absolutePath);
|
|
17367
16879
|
}
|
|
17368
16880
|
try {
|
|
17369
|
-
if (
|
|
16881
|
+
if (fs21.statSync(absolutePath).isDirectory()) {
|
|
17370
16882
|
return absolutePath;
|
|
17371
16883
|
}
|
|
17372
16884
|
} catch {
|
|
17373
16885
|
return absolutePath;
|
|
17374
16886
|
}
|
|
17375
|
-
let current =
|
|
17376
|
-
const root =
|
|
16887
|
+
let current = path25.dirname(absolutePath);
|
|
16888
|
+
const root = path25.parse(current).root;
|
|
17377
16889
|
while (current !== root) {
|
|
17378
|
-
if (
|
|
16890
|
+
if (fs21.existsSync(path25.join(current, "SKILL.md"))) {
|
|
17379
16891
|
return current;
|
|
17380
16892
|
}
|
|
17381
|
-
current =
|
|
16893
|
+
current = path25.dirname(current);
|
|
17382
16894
|
}
|
|
17383
16895
|
return absolutePath;
|
|
17384
16896
|
}
|
|
@@ -17401,17 +16913,17 @@ async function playbookAddHandler(deps) {
|
|
|
17401
16913
|
exit(1);
|
|
17402
16914
|
return;
|
|
17403
16915
|
}
|
|
17404
|
-
const absolutePath =
|
|
16916
|
+
const absolutePath = path25.resolve(cwd, filePath);
|
|
17405
16917
|
let artifactType;
|
|
17406
16918
|
let codingAgent;
|
|
17407
16919
|
const earlyTargetDir = await findNearestConfigDir(
|
|
17408
|
-
|
|
16920
|
+
path25.dirname(absolutePath),
|
|
17409
16921
|
packmindCliHexa
|
|
17410
16922
|
);
|
|
17411
16923
|
const earlyLockFile = earlyTargetDir ? await lockFileRepository.read(earlyTargetDir) : null;
|
|
17412
16924
|
if (earlyLockFile && earlyTargetDir) {
|
|
17413
16925
|
const normalizedForLookup = normalizePath2(
|
|
17414
|
-
|
|
16926
|
+
path25.relative(earlyTargetDir, absolutePath)
|
|
17415
16927
|
);
|
|
17416
16928
|
const lockResult = findLockFileEntryAndFileForPath(
|
|
17417
16929
|
normalizedForLookup,
|
|
@@ -17545,7 +17057,7 @@ Content goes here...`
|
|
|
17545
17057
|
return;
|
|
17546
17058
|
}
|
|
17547
17059
|
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(targetDir);
|
|
17548
|
-
const configDir = gitRoot ? normalizePath2(
|
|
17060
|
+
const configDir = gitRoot ? normalizePath2(path25.relative(gitRoot, targetDir)) : "";
|
|
17549
17061
|
const deployedContext = await resolveDeployedContext(
|
|
17550
17062
|
packmindCliHexa,
|
|
17551
17063
|
targetDir
|
|
@@ -17553,7 +17065,7 @@ Content goes here...`
|
|
|
17553
17065
|
const targetId = deployedContext?.targetId ?? earlyLockFile?.targetId;
|
|
17554
17066
|
const normalizedFilePath = (() => {
|
|
17555
17067
|
const refPath = artifactType === "skill" && skillDirPath ? skillDirPath : absolutePath;
|
|
17556
|
-
return normalizePath2(
|
|
17068
|
+
return normalizePath2(path25.relative(targetDir, refPath));
|
|
17557
17069
|
})();
|
|
17558
17070
|
let spaceId;
|
|
17559
17071
|
let spaceName;
|
|
@@ -17668,7 +17180,7 @@ Run ${formatLabel("packmind-cli install")} to update before making changes.`
|
|
|
17668
17180
|
);
|
|
17669
17181
|
const allMatch = skillDeployedFiles.length > 0 && skillDeployedFiles.length === skillFiles.length && skillDeployedFiles.every((deployed) => {
|
|
17670
17182
|
const localFile = skillFiles.find(
|
|
17671
|
-
(f) => normalizePath2(
|
|
17183
|
+
(f) => normalizePath2(path25.join(normalizedFilePath, f.relativePath)) === normalizePath2(deployed.path)
|
|
17672
17184
|
);
|
|
17673
17185
|
return localFile && deployed.content?.trim() === localFile.content.trim() && (!deployed.skillFilePermissions || deployed.skillFilePermissions === localFile.permissions);
|
|
17674
17186
|
});
|
|
@@ -17738,17 +17250,17 @@ function formatSpaceList(spaces) {
|
|
|
17738
17250
|
}
|
|
17739
17251
|
|
|
17740
17252
|
// apps/cli/src/infra/commands/playbook/AddCommand.ts
|
|
17741
|
-
var addPlaybookCommand = (0,
|
|
17253
|
+
var addPlaybookCommand = (0, import_cmd_ts24.command)({
|
|
17742
17254
|
name: "add",
|
|
17743
17255
|
description: "Stage a local artifact change",
|
|
17744
17256
|
args: {
|
|
17745
|
-
filePath: (0,
|
|
17746
|
-
type:
|
|
17257
|
+
filePath: (0, import_cmd_ts24.positional)({
|
|
17258
|
+
type: import_cmd_ts24.string,
|
|
17747
17259
|
displayName: "path",
|
|
17748
17260
|
description: "Path to the artifact file or directory to stage"
|
|
17749
17261
|
}),
|
|
17750
|
-
space: (0,
|
|
17751
|
-
type: (0,
|
|
17262
|
+
space: (0, import_cmd_ts24.option)({
|
|
17263
|
+
type: (0, import_cmd_ts24.optional)(SpaceSlug),
|
|
17752
17264
|
long: "space",
|
|
17753
17265
|
description: "Target space slug"
|
|
17754
17266
|
})
|
|
@@ -17777,11 +17289,11 @@ var addPlaybookCommand = (0, import_cmd_ts25.command)({
|
|
|
17777
17289
|
});
|
|
17778
17290
|
|
|
17779
17291
|
// apps/cli/src/infra/commands/playbook/RmCommand.ts
|
|
17780
|
-
var
|
|
17292
|
+
var import_cmd_ts25 = __toESM(require_cjs());
|
|
17781
17293
|
|
|
17782
17294
|
// apps/cli/src/infra/commands/playbook/rmHandler.ts
|
|
17783
|
-
var
|
|
17784
|
-
var
|
|
17295
|
+
var fs22 = __toESM(require("fs"));
|
|
17296
|
+
var path26 = __toESM(require("path"));
|
|
17785
17297
|
function isSkillSupportFile(absolutePath) {
|
|
17786
17298
|
const normalized = absolutePath.replace(/\\/g, "/");
|
|
17787
17299
|
const skillDirMatch = normalized.match(/\/skills\/[^/]+\//);
|
|
@@ -17808,14 +17320,14 @@ async function playbookRmHandler(deps) {
|
|
|
17808
17320
|
exit(1);
|
|
17809
17321
|
return;
|
|
17810
17322
|
}
|
|
17811
|
-
const absolutePath =
|
|
17812
|
-
if (!
|
|
17323
|
+
const absolutePath = path26.resolve(getCwd(), filePath);
|
|
17324
|
+
if (!fs22.existsSync(absolutePath)) {
|
|
17813
17325
|
logErrorConsole(`File not found: "${filePath}"`);
|
|
17814
17326
|
exit(1);
|
|
17815
17327
|
return;
|
|
17816
17328
|
}
|
|
17817
17329
|
const targetDir = await findNearestConfigDir(
|
|
17818
|
-
|
|
17330
|
+
path26.dirname(absolutePath),
|
|
17819
17331
|
packmindCliHexa
|
|
17820
17332
|
);
|
|
17821
17333
|
if (!targetDir) {
|
|
@@ -17832,7 +17344,7 @@ async function playbookRmHandler(deps) {
|
|
|
17832
17344
|
return;
|
|
17833
17345
|
}
|
|
17834
17346
|
const normalizedForLookup = normalizePath2(
|
|
17835
|
-
|
|
17347
|
+
path26.relative(targetDir, absolutePath)
|
|
17836
17348
|
);
|
|
17837
17349
|
const lockResult = findLockFileEntryAndFileForPath(
|
|
17838
17350
|
normalizedForLookup,
|
|
@@ -17854,7 +17366,7 @@ async function playbookRmHandler(deps) {
|
|
|
17854
17366
|
}
|
|
17855
17367
|
const resolvedAbsolutePath = artifactType === "skill" ? resolveSkillDirPath(absolutePath) : absolutePath;
|
|
17856
17368
|
const normalizedFilePath = normalizePath2(
|
|
17857
|
-
|
|
17369
|
+
path26.relative(targetDir, resolvedAbsolutePath)
|
|
17858
17370
|
);
|
|
17859
17371
|
const lockEntry = findLockFileEntryAndFileForPath(normalizedFilePath, lockFile.artifacts)?.entry ?? lockResult.entry;
|
|
17860
17372
|
if (!lockEntry) {
|
|
@@ -17882,7 +17394,7 @@ async function playbookRmHandler(deps) {
|
|
|
17882
17394
|
}
|
|
17883
17395
|
const spaceName = matchingSpace.name;
|
|
17884
17396
|
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(targetDir);
|
|
17885
|
-
const configDir = gitRoot ? normalizePath2(
|
|
17397
|
+
const configDir = gitRoot ? normalizePath2(path26.relative(gitRoot, targetDir)) : "";
|
|
17886
17398
|
const deployedContext = await resolveDeployedContext(
|
|
17887
17399
|
packmindCliHexa,
|
|
17888
17400
|
targetDir
|
|
@@ -17908,13 +17420,13 @@ async function playbookRmHandler(deps) {
|
|
|
17908
17420
|
}
|
|
17909
17421
|
|
|
17910
17422
|
// apps/cli/src/infra/commands/playbook/RmCommand.ts
|
|
17911
|
-
var rmPlaybookCommand = (0,
|
|
17423
|
+
var rmPlaybookCommand = (0, import_cmd_ts25.command)({
|
|
17912
17424
|
name: "rm",
|
|
17913
17425
|
description: "Stage an artifact for removal",
|
|
17914
17426
|
aliases: ["remove"],
|
|
17915
17427
|
args: {
|
|
17916
|
-
filePath: (0,
|
|
17917
|
-
type:
|
|
17428
|
+
filePath: (0, import_cmd_ts25.positional)({
|
|
17429
|
+
type: import_cmd_ts25.string,
|
|
17918
17430
|
displayName: "path",
|
|
17919
17431
|
description: "Path to the artifact file or directory to remove"
|
|
17920
17432
|
})
|
|
@@ -17940,10 +17452,10 @@ var rmPlaybookCommand = (0, import_cmd_ts26.command)({
|
|
|
17940
17452
|
});
|
|
17941
17453
|
|
|
17942
17454
|
// apps/cli/src/infra/commands/playbook/UnstageCommand.ts
|
|
17943
|
-
var
|
|
17455
|
+
var import_cmd_ts26 = __toESM(require_cjs());
|
|
17944
17456
|
|
|
17945
17457
|
// apps/cli/src/infra/commands/playbook/unstageHandler.ts
|
|
17946
|
-
var
|
|
17458
|
+
var path27 = __toESM(require("path"));
|
|
17947
17459
|
async function playbookUnstageHandler(deps) {
|
|
17948
17460
|
const {
|
|
17949
17461
|
packmindCliHexa,
|
|
@@ -17961,10 +17473,10 @@ async function playbookUnstageHandler(deps) {
|
|
|
17961
17473
|
return;
|
|
17962
17474
|
}
|
|
17963
17475
|
const cwd = getCwd();
|
|
17964
|
-
const absolutePath =
|
|
17476
|
+
const absolutePath = path27.resolve(cwd, filePath);
|
|
17965
17477
|
const resolvedPath = resolveSkillDirPath(absolutePath);
|
|
17966
17478
|
const configDir = await findNearestConfigDir(
|
|
17967
|
-
|
|
17479
|
+
path27.dirname(resolvedPath),
|
|
17968
17480
|
packmindCliHexa
|
|
17969
17481
|
);
|
|
17970
17482
|
if (!configDir) {
|
|
@@ -17977,10 +17489,10 @@ async function playbookUnstageHandler(deps) {
|
|
|
17977
17489
|
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(cwd);
|
|
17978
17490
|
const baseDir = gitRoot ?? configDir;
|
|
17979
17491
|
const normalizedFilePath = normalizePath2(
|
|
17980
|
-
|
|
17492
|
+
path27.relative(baseDir, resolvedPath)
|
|
17981
17493
|
);
|
|
17982
17494
|
const matchingEntries = playbookLocalRepository.getChanges().filter((c) => {
|
|
17983
|
-
const fullEntryPath = c.configDir ? normalizePath2(
|
|
17495
|
+
const fullEntryPath = c.configDir ? normalizePath2(path27.join(c.configDir, c.filePath)) : c.filePath;
|
|
17984
17496
|
return fullEntryPath === normalizedFilePath;
|
|
17985
17497
|
});
|
|
17986
17498
|
if (matchingEntries.length === 0) {
|
|
@@ -18024,17 +17536,17 @@ ${spaceList}`
|
|
|
18024
17536
|
}
|
|
18025
17537
|
|
|
18026
17538
|
// apps/cli/src/infra/commands/playbook/UnstageCommand.ts
|
|
18027
|
-
var unstagePlaybookCommand = (0,
|
|
17539
|
+
var unstagePlaybookCommand = (0, import_cmd_ts26.command)({
|
|
18028
17540
|
name: "unstage",
|
|
18029
17541
|
description: "Remove a staged change",
|
|
18030
17542
|
args: {
|
|
18031
|
-
filePath: (0,
|
|
18032
|
-
type:
|
|
17543
|
+
filePath: (0, import_cmd_ts26.positional)({
|
|
17544
|
+
type: import_cmd_ts26.string,
|
|
18033
17545
|
displayName: "path",
|
|
18034
17546
|
description: "Path to the artifact file or directory to unstage"
|
|
18035
17547
|
}),
|
|
18036
|
-
space: (0,
|
|
18037
|
-
type: (0,
|
|
17548
|
+
space: (0, import_cmd_ts26.option)({
|
|
17549
|
+
type: (0, import_cmd_ts26.optional)(SpaceSlug),
|
|
18038
17550
|
long: "space",
|
|
18039
17551
|
description: "Target space slug (required when artifact is staged for multiple spaces)"
|
|
18040
17552
|
})
|
|
@@ -18060,19 +17572,19 @@ var unstagePlaybookCommand = (0, import_cmd_ts27.command)({
|
|
|
18060
17572
|
|
|
18061
17573
|
// apps/cli/src/infra/commands/playbook/StatusCommand.ts
|
|
18062
17574
|
var import_fs23 = require("fs");
|
|
18063
|
-
var
|
|
17575
|
+
var import_cmd_ts27 = __toESM(require_cjs());
|
|
18064
17576
|
|
|
18065
17577
|
// apps/cli/src/infra/utils/listDirectoryFiles.ts
|
|
18066
17578
|
var import_fs22 = require("fs");
|
|
18067
|
-
var
|
|
17579
|
+
var path28 = __toESM(require("path"));
|
|
18068
17580
|
function listDirectoryFiles(dirPath) {
|
|
18069
17581
|
const results = [];
|
|
18070
17582
|
const entries = (0, import_fs22.readdirSync)(dirPath, { withFileTypes: true });
|
|
18071
17583
|
for (const entry of entries) {
|
|
18072
|
-
const fullPath =
|
|
17584
|
+
const fullPath = path28.join(dirPath, entry.name);
|
|
18073
17585
|
if (entry.isDirectory()) {
|
|
18074
17586
|
for (const nested of listDirectoryFiles(fullPath)) {
|
|
18075
|
-
results.push(
|
|
17587
|
+
results.push(path28.join(entry.name, nested));
|
|
18076
17588
|
}
|
|
18077
17589
|
} else if (entry.isFile()) {
|
|
18078
17590
|
results.push(entry.name);
|
|
@@ -18082,7 +17594,7 @@ function listDirectoryFiles(dirPath) {
|
|
|
18082
17594
|
}
|
|
18083
17595
|
|
|
18084
17596
|
// apps/cli/src/infra/commands/playbook/statusHandler.ts
|
|
18085
|
-
var
|
|
17597
|
+
var path29 = __toESM(require("path"));
|
|
18086
17598
|
|
|
18087
17599
|
// apps/cli/src/infra/utils/stringUtils.ts
|
|
18088
17600
|
function capitalize(s) {
|
|
@@ -18117,7 +17629,7 @@ function groupStagedChanges(changes, cwd, gitRoot) {
|
|
|
18117
17629
|
const changeType = change.changeType ?? "updated";
|
|
18118
17630
|
const key = `${change.artifactType}:${change.artifactName}:${changeType}`;
|
|
18119
17631
|
const rootRelativePath = change.configDir ? `${change.configDir}/${change.filePath}` : change.filePath;
|
|
18120
|
-
const displayPath = gitRoot ? normalizePath2(
|
|
17632
|
+
const displayPath = gitRoot ? normalizePath2(path29.relative(cwd, path29.join(gitRoot, rootRelativePath))) : rootRelativePath;
|
|
18121
17633
|
const existing = groups.get(key);
|
|
18122
17634
|
if (existing) {
|
|
18123
17635
|
existing.filePaths.push(displayPath);
|
|
@@ -18175,12 +17687,12 @@ async function playbookStatusHandler(deps) {
|
|
|
18175
17687
|
const fallbackConfigDir = await findNearestConfigDir(cwd, packmindCliHexa);
|
|
18176
17688
|
const configDirs = /* @__PURE__ */ new Set([...stagedByConfigDir.keys()]);
|
|
18177
17689
|
if (fallbackConfigDir && !configDirs.has("__cwd__")) {
|
|
18178
|
-
const rel = gitRoot ? normalizePath2(
|
|
17690
|
+
const rel = gitRoot ? normalizePath2(path29.relative(gitRoot, fallbackConfigDir)) : "";
|
|
18179
17691
|
if (!configDirs.has(rel)) configDirs.add(rel);
|
|
18180
17692
|
}
|
|
18181
17693
|
const descendantDirs = await packmindCliHexa.findDescendantConfigs(cwd);
|
|
18182
17694
|
for (const descendantDir of descendantDirs) {
|
|
18183
|
-
const rel = gitRoot ? normalizePath2(
|
|
17695
|
+
const rel = gitRoot ? normalizePath2(path29.relative(gitRoot, descendantDir)) : normalizePath2(path29.relative(cwd, descendantDir));
|
|
18184
17696
|
if (!configDirs.has(rel)) configDirs.add(rel);
|
|
18185
17697
|
}
|
|
18186
17698
|
for (const configDirKey of configDirs) {
|
|
@@ -18188,7 +17700,7 @@ async function playbookStatusHandler(deps) {
|
|
|
18188
17700
|
if (configDirKey === "__cwd__") {
|
|
18189
17701
|
projectDir = fallbackConfigDir;
|
|
18190
17702
|
} else if (gitRoot) {
|
|
18191
|
-
projectDir =
|
|
17703
|
+
projectDir = path29.join(gitRoot, configDirKey);
|
|
18192
17704
|
} else {
|
|
18193
17705
|
continue;
|
|
18194
17706
|
}
|
|
@@ -18213,11 +17725,11 @@ async function playbookStatusHandler(deps) {
|
|
|
18213
17725
|
continue;
|
|
18214
17726
|
}
|
|
18215
17727
|
const displayPath = normalizePath2(
|
|
18216
|
-
|
|
17728
|
+
path29.relative(cwd, path29.join(projectDir, deployedFile.path))
|
|
18217
17729
|
);
|
|
18218
17730
|
let localContent;
|
|
18219
17731
|
try {
|
|
18220
|
-
localContent = readFile11(
|
|
17732
|
+
localContent = readFile11(path29.join(projectDir, deployedFile.path));
|
|
18221
17733
|
} catch {
|
|
18222
17734
|
const artifact = findArtifactForFile(
|
|
18223
17735
|
deployedFile.path,
|
|
@@ -18246,7 +17758,7 @@ async function playbookStatusHandler(deps) {
|
|
|
18246
17758
|
});
|
|
18247
17759
|
}
|
|
18248
17760
|
} else if (deployedFile.skillFilePermissions && getFileMode) {
|
|
18249
|
-
const localMode = getFileMode(
|
|
17761
|
+
const localMode = getFileMode(path29.join(projectDir, deployedFile.path));
|
|
18250
17762
|
if (localMode !== null) {
|
|
18251
17763
|
const localPermissions = modeToPermissionStringOrDefault(localMode);
|
|
18252
17764
|
if (localPermissions !== deployedFile.skillFilePermissions) {
|
|
@@ -18275,13 +17787,13 @@ async function playbookStatusHandler(deps) {
|
|
|
18275
17787
|
(f) => normalizePath2(f.path).endsWith("/SKILL.md")
|
|
18276
17788
|
);
|
|
18277
17789
|
if (!skillMdFile) continue;
|
|
18278
|
-
const skillDir = normalizePath2(
|
|
17790
|
+
const skillDir = normalizePath2(path29.dirname(skillMdFile.path));
|
|
18279
17791
|
if (targetStagedPaths.has(skillDir) || targetSkillDirPaths.some(
|
|
18280
17792
|
(staged) => skillDir === staged || skillDir.startsWith(staged + "/")
|
|
18281
17793
|
)) {
|
|
18282
17794
|
continue;
|
|
18283
17795
|
}
|
|
18284
|
-
const absoluteSkillDir =
|
|
17796
|
+
const absoluteSkillDir = path29.join(projectDir, skillDir);
|
|
18285
17797
|
let localFiles;
|
|
18286
17798
|
try {
|
|
18287
17799
|
localFiles = listDirectoryFiles2(absoluteSkillDir);
|
|
@@ -18290,11 +17802,11 @@ async function playbookStatusHandler(deps) {
|
|
|
18290
17802
|
}
|
|
18291
17803
|
for (const localRelPath of localFiles) {
|
|
18292
17804
|
const normalizedLocalPath = normalizePath2(
|
|
18293
|
-
|
|
17805
|
+
path29.join(skillDir, localRelPath)
|
|
18294
17806
|
);
|
|
18295
17807
|
if (!deployedPathSet.has(normalizedLocalPath)) {
|
|
18296
17808
|
const displayPath = normalizePath2(
|
|
18297
|
-
|
|
17809
|
+
path29.relative(cwd, path29.join(projectDir, normalizedLocalPath))
|
|
18298
17810
|
);
|
|
18299
17811
|
untrackedChanges.push({
|
|
18300
17812
|
artifactName: entry.name,
|
|
@@ -18342,7 +17854,7 @@ async function playbookStatusHandler(deps) {
|
|
|
18342
17854
|
}
|
|
18343
17855
|
|
|
18344
17856
|
// apps/cli/src/infra/commands/playbook/StatusCommand.ts
|
|
18345
|
-
var statusPlaybookCommand = (0,
|
|
17857
|
+
var statusPlaybookCommand = (0, import_cmd_ts27.command)({
|
|
18346
17858
|
name: "status",
|
|
18347
17859
|
description: "Show staged and untracked changes",
|
|
18348
17860
|
args: {},
|
|
@@ -18376,13 +17888,13 @@ var statusPlaybookCommand = (0, import_cmd_ts28.command)({
|
|
|
18376
17888
|
|
|
18377
17889
|
// apps/cli/src/infra/commands/playbook/SubmitCommand.ts
|
|
18378
17890
|
var import_fs24 = require("fs");
|
|
18379
|
-
var
|
|
17891
|
+
var import_child_process3 = require("child_process");
|
|
18380
17892
|
var import_os2 = require("os");
|
|
18381
17893
|
var import_path5 = require("path");
|
|
18382
|
-
var
|
|
17894
|
+
var import_cmd_ts28 = __toESM(require_cjs());
|
|
18383
17895
|
|
|
18384
17896
|
// apps/cli/src/infra/commands/playbook/submitHandler.ts
|
|
18385
|
-
var
|
|
17897
|
+
var path31 = __toESM(require("path"));
|
|
18386
17898
|
|
|
18387
17899
|
// apps/cli/src/infra/commands/playbook/submit/duplicateNameChecker.ts
|
|
18388
17900
|
var import_slug2 = __toESM(require("slug"));
|
|
@@ -18444,7 +17956,7 @@ async function checkForDuplicateNames(createdEntries, packmindGateway) {
|
|
|
18444
17956
|
}
|
|
18445
17957
|
|
|
18446
17958
|
// apps/cli/src/infra/commands/playbook/submit/targetContextResolver.ts
|
|
18447
|
-
var
|
|
17959
|
+
var path30 = __toESM(require("path"));
|
|
18448
17960
|
async function createTargetContextResolver(deps) {
|
|
18449
17961
|
const { lockFileRepository, cwd, packmindCliHexa } = deps;
|
|
18450
17962
|
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(cwd);
|
|
@@ -18455,7 +17967,7 @@ async function createTargetContextResolver(deps) {
|
|
|
18455
17967
|
if (cache.has(key)) return cache.get(key);
|
|
18456
17968
|
let projectDir;
|
|
18457
17969
|
if (entry.configDir !== void 0 && gitRoot) {
|
|
18458
|
-
projectDir =
|
|
17970
|
+
projectDir = path30.join(gitRoot, entry.configDir);
|
|
18459
17971
|
} else {
|
|
18460
17972
|
projectDir = await findNearestConfigDir(cwd, packmindCliHexa);
|
|
18461
17973
|
}
|
|
@@ -19403,7 +18915,7 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
|
|
|
19403
18915
|
const entryCtx = resolver.getCachedContext(entry.configDir);
|
|
19404
18916
|
if (!entryCtx?.projectDir) continue;
|
|
19405
18917
|
try {
|
|
19406
|
-
const fullPath =
|
|
18918
|
+
const fullPath = path31.join(entryCtx.projectDir, entry.filePath);
|
|
19407
18919
|
if (entry.artifactType === "skill") {
|
|
19408
18920
|
deps.rmSync(fullPath, { recursive: true });
|
|
19409
18921
|
} else {
|
|
@@ -19431,7 +18943,7 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
|
|
|
19431
18943
|
const entryCtx = resolver.getCachedContext(entry.configDir);
|
|
19432
18944
|
if (!entryCtx?.projectDir) continue;
|
|
19433
18945
|
try {
|
|
19434
|
-
const fullPath =
|
|
18946
|
+
const fullPath = path31.join(entryCtx.projectDir, entry.filePath);
|
|
19435
18947
|
if (entry.artifactType === "skill") {
|
|
19436
18948
|
deps.rmSync(fullPath, { recursive: true });
|
|
19437
18949
|
} else {
|
|
@@ -19484,7 +18996,7 @@ function openEditorForMessage(prefill) {
|
|
|
19484
18996
|
const tmpFile = (0, import_path5.join)((0, import_os2.tmpdir)(), `packmind-submit-${Date.now()}.md`);
|
|
19485
18997
|
try {
|
|
19486
18998
|
(0, import_fs24.writeFileSync)(tmpFile, prefill, "utf-8");
|
|
19487
|
-
(0,
|
|
18999
|
+
(0, import_child_process3.execSync)(`${editor} "${tmpFile}"`, { stdio: "inherit" });
|
|
19488
19000
|
const content = (0, import_fs24.readFileSync)(tmpFile, "utf-8");
|
|
19489
19001
|
const stripped = content.split("\n").filter((line) => !line.startsWith("#")).join("\n").trim();
|
|
19490
19002
|
return stripped || null;
|
|
@@ -19497,17 +19009,17 @@ function openEditorForMessage(prefill) {
|
|
|
19497
19009
|
}
|
|
19498
19010
|
}
|
|
19499
19011
|
}
|
|
19500
|
-
var submitPlaybookCommand = (0,
|
|
19012
|
+
var submitPlaybookCommand = (0, import_cmd_ts28.command)({
|
|
19501
19013
|
name: "submit",
|
|
19502
19014
|
description: "Submit staged changes as proposals",
|
|
19503
19015
|
args: {
|
|
19504
|
-
message: (0,
|
|
19505
|
-
type: (0,
|
|
19016
|
+
message: (0, import_cmd_ts28.option)({
|
|
19017
|
+
type: (0, import_cmd_ts28.optional)(import_cmd_ts28.string),
|
|
19506
19018
|
long: "message",
|
|
19507
19019
|
short: "m",
|
|
19508
19020
|
description: "Message describing the intent behind the proposed changes"
|
|
19509
19021
|
}),
|
|
19510
|
-
noReview: (0,
|
|
19022
|
+
noReview: (0, import_cmd_ts28.flag)({
|
|
19511
19023
|
long: "no-review",
|
|
19512
19024
|
description: "Apply changes directly without creating proposals for review"
|
|
19513
19025
|
})
|
|
@@ -19537,23 +19049,23 @@ var submitPlaybookCommand = (0, import_cmd_ts29.command)({
|
|
|
19537
19049
|
});
|
|
19538
19050
|
|
|
19539
19051
|
// apps/cli/src/infra/commands/playbook/DiffCommand.ts
|
|
19540
|
-
var
|
|
19541
|
-
var diffCommand2 = (0,
|
|
19052
|
+
var import_cmd_ts29 = __toESM(require_cjs());
|
|
19053
|
+
var diffCommand2 = (0, import_cmd_ts29.command)({
|
|
19542
19054
|
name: "diff",
|
|
19543
19055
|
description: "Show differences between local command files and server content",
|
|
19544
19056
|
args: {
|
|
19545
|
-
includeSubmitted: (0,
|
|
19057
|
+
includeSubmitted: (0, import_cmd_ts29.flag)({
|
|
19546
19058
|
long: "include-submitted",
|
|
19547
19059
|
description: "Include already submitted changes in the output"
|
|
19548
19060
|
}),
|
|
19549
|
-
path: (0,
|
|
19061
|
+
path: (0, import_cmd_ts29.option)({
|
|
19550
19062
|
long: "path",
|
|
19551
19063
|
short: "p",
|
|
19552
19064
|
description: "Path to analyze (relative to current directory)",
|
|
19553
|
-
type: (0,
|
|
19065
|
+
type: (0, import_cmd_ts29.optional)(import_cmd_ts29.string)
|
|
19554
19066
|
})
|
|
19555
19067
|
},
|
|
19556
|
-
handler: async ({ includeSubmitted, path:
|
|
19068
|
+
handler: async ({ includeSubmitted, path: path35 }) => {
|
|
19557
19069
|
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
19558
19070
|
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
19559
19071
|
await diffArtefactsHandler({
|
|
@@ -19562,13 +19074,13 @@ var diffCommand2 = (0, import_cmd_ts30.command)({
|
|
|
19562
19074
|
getCwd: () => process.cwd(),
|
|
19563
19075
|
log: console.log,
|
|
19564
19076
|
includeSubmitted,
|
|
19565
|
-
path:
|
|
19077
|
+
path: path35
|
|
19566
19078
|
});
|
|
19567
19079
|
}
|
|
19568
19080
|
});
|
|
19569
19081
|
|
|
19570
19082
|
// apps/cli/src/infra/commands/PlaybookCommand.ts
|
|
19571
|
-
var playbookCommand = (0,
|
|
19083
|
+
var playbookCommand = (0, import_cmd_ts30.subcommands)({
|
|
19572
19084
|
name: "playbook",
|
|
19573
19085
|
description: "Manage local playbook files and propose changes to your team",
|
|
19574
19086
|
cmds: {
|
|
@@ -19582,10 +19094,10 @@ var playbookCommand = (0, import_cmd_ts31.subcommands)({
|
|
|
19582
19094
|
});
|
|
19583
19095
|
|
|
19584
19096
|
// apps/cli/src/infra/commands/SpacesCommand.ts
|
|
19585
|
-
var
|
|
19097
|
+
var import_cmd_ts32 = __toESM(require_cjs());
|
|
19586
19098
|
|
|
19587
19099
|
// apps/cli/src/infra/commands/ListSpacesCommand.ts
|
|
19588
|
-
var
|
|
19100
|
+
var import_cmd_ts31 = __toESM(require_cjs());
|
|
19589
19101
|
|
|
19590
19102
|
// apps/cli/src/infra/commands/spaces/listSpacesHandler.ts
|
|
19591
19103
|
function displaySpace(space) {
|
|
@@ -19621,7 +19133,7 @@ async function listSpacesHandler(deps) {
|
|
|
19621
19133
|
}
|
|
19622
19134
|
|
|
19623
19135
|
// apps/cli/src/infra/commands/ListSpacesCommand.ts
|
|
19624
|
-
var listSpacesCommand = (0,
|
|
19136
|
+
var listSpacesCommand = (0, import_cmd_ts31.command)({
|
|
19625
19137
|
name: "list",
|
|
19626
19138
|
description: "List available spaces in the organization",
|
|
19627
19139
|
args: {},
|
|
@@ -19636,7 +19148,7 @@ var listSpacesCommand = (0, import_cmd_ts32.command)({
|
|
|
19636
19148
|
});
|
|
19637
19149
|
|
|
19638
19150
|
// apps/cli/src/infra/commands/SpacesCommand.ts
|
|
19639
|
-
var spacesCommand = (0,
|
|
19151
|
+
var spacesCommand = (0, import_cmd_ts32.subcommands)({
|
|
19640
19152
|
name: "spaces",
|
|
19641
19153
|
description: "Manage spaces in your Packmind organization",
|
|
19642
19154
|
cmds: {
|
|
@@ -19645,14 +19157,14 @@ var spacesCommand = (0, import_cmd_ts33.subcommands)({
|
|
|
19645
19157
|
});
|
|
19646
19158
|
|
|
19647
19159
|
// apps/cli/src/infra/commands/config/ConfigCommand.ts
|
|
19648
|
-
var
|
|
19160
|
+
var import_cmd_ts38 = __toESM(require_cjs());
|
|
19649
19161
|
|
|
19650
19162
|
// apps/cli/src/infra/commands/config/ConfigAgentsCommand.ts
|
|
19651
|
-
var
|
|
19163
|
+
var import_cmd_ts37 = __toESM(require_cjs());
|
|
19652
19164
|
|
|
19653
19165
|
// apps/cli/src/application/services/AgentArtifactDetectionService.ts
|
|
19654
|
-
var
|
|
19655
|
-
var
|
|
19166
|
+
var fs23 = __toESM(require("fs/promises"));
|
|
19167
|
+
var path32 = __toESM(require("path"));
|
|
19656
19168
|
var AGENT_ARTIFACT_CHECKS = [
|
|
19657
19169
|
{ agent: "claude", paths: [".claude"] },
|
|
19658
19170
|
{ agent: "cursor", paths: [".cursor"] },
|
|
@@ -19681,7 +19193,7 @@ var AgentArtifactDetectionService = class {
|
|
|
19681
19193
|
}
|
|
19682
19194
|
} else {
|
|
19683
19195
|
for (const relativePath of check.paths) {
|
|
19684
|
-
const fullPath =
|
|
19196
|
+
const fullPath = path32.join(baseDirectory, relativePath);
|
|
19685
19197
|
const exists = await this.pathExists(fullPath);
|
|
19686
19198
|
if (exists) {
|
|
19687
19199
|
detected.push({
|
|
@@ -19697,7 +19209,7 @@ var AgentArtifactDetectionService = class {
|
|
|
19697
19209
|
}
|
|
19698
19210
|
async pathExists(filePath) {
|
|
19699
19211
|
try {
|
|
19700
|
-
await
|
|
19212
|
+
await fs23.access(filePath);
|
|
19701
19213
|
return true;
|
|
19702
19214
|
} catch {
|
|
19703
19215
|
return false;
|
|
@@ -19708,16 +19220,16 @@ var AgentArtifactDetectionService = class {
|
|
|
19708
19220
|
while (queue.length > 0) {
|
|
19709
19221
|
const currentDir = queue.shift();
|
|
19710
19222
|
for (const targetPath of targetPaths) {
|
|
19711
|
-
const fullPath =
|
|
19223
|
+
const fullPath = path32.join(currentDir, targetPath);
|
|
19712
19224
|
if (await this.pathExists(fullPath)) {
|
|
19713
19225
|
return fullPath;
|
|
19714
19226
|
}
|
|
19715
19227
|
}
|
|
19716
19228
|
try {
|
|
19717
|
-
const entries = await
|
|
19229
|
+
const entries = await fs23.readdir(currentDir, { withFileTypes: true });
|
|
19718
19230
|
for (const entry of entries) {
|
|
19719
19231
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
19720
|
-
queue.push(
|
|
19232
|
+
queue.push(path32.join(currentDir, entry.name));
|
|
19721
19233
|
}
|
|
19722
19234
|
}
|
|
19723
19235
|
} catch {
|
|
@@ -19728,22 +19240,22 @@ var AgentArtifactDetectionService = class {
|
|
|
19728
19240
|
};
|
|
19729
19241
|
|
|
19730
19242
|
// apps/cli/src/infra/commands/config/configAgentsHandler.ts
|
|
19731
|
-
var
|
|
19732
|
-
var
|
|
19243
|
+
var readline3 = __toESM(require("readline"));
|
|
19244
|
+
var inquirer = __toESM(require("inquirer"));
|
|
19733
19245
|
|
|
19734
19246
|
// apps/cli/src/infra/commands/config/agents/agentsHandlerUtils.ts
|
|
19735
|
-
var
|
|
19736
|
-
var
|
|
19247
|
+
var path33 = __toESM(require("path"));
|
|
19248
|
+
var fs24 = __toESM(require("fs/promises"));
|
|
19737
19249
|
function getRelativePath(dir, startDirectory) {
|
|
19738
19250
|
if (dir === startDirectory) return "./packmind.json";
|
|
19739
|
-
return "./" +
|
|
19251
|
+
return "./" + path33.relative(startDirectory, dir) + "/packmind.json";
|
|
19740
19252
|
}
|
|
19741
19253
|
async function resolveStartDirectory(args2, getCwd, exit) {
|
|
19742
19254
|
let startDirectory = getCwd();
|
|
19743
19255
|
if (args2.path) {
|
|
19744
|
-
const resolvedPath =
|
|
19256
|
+
const resolvedPath = path33.resolve(getCwd(), args2.path);
|
|
19745
19257
|
try {
|
|
19746
|
-
const stat9 = await
|
|
19258
|
+
const stat9 = await fs24.stat(resolvedPath);
|
|
19747
19259
|
if (!stat9.isDirectory()) {
|
|
19748
19260
|
logErrorConsole(`Path is not a directory: ${resolvedPath}`);
|
|
19749
19261
|
exit(1);
|
|
@@ -19805,9 +19317,9 @@ async function configAgentsHandler(deps) {
|
|
|
19805
19317
|
}));
|
|
19806
19318
|
let selectedAgents;
|
|
19807
19319
|
if (useSimplePrompt) {
|
|
19808
|
-
selectedAgents = await
|
|
19320
|
+
selectedAgents = await promptAgentsWithReadline(choices);
|
|
19809
19321
|
} else {
|
|
19810
|
-
const result = await
|
|
19322
|
+
const result = await inquirer.default.prompt([
|
|
19811
19323
|
{
|
|
19812
19324
|
type: "checkbox",
|
|
19813
19325
|
name: "selectedAgents",
|
|
@@ -19838,10 +19350,10 @@ async function configAgentsHandler(deps) {
|
|
|
19838
19350
|
);
|
|
19839
19351
|
}
|
|
19840
19352
|
}
|
|
19841
|
-
async function
|
|
19353
|
+
async function promptAgentsWithReadline(choices) {
|
|
19842
19354
|
const input = process.stdin;
|
|
19843
19355
|
const output = process.stdout;
|
|
19844
|
-
const rl =
|
|
19356
|
+
const rl = readline3.createInterface({
|
|
19845
19357
|
input,
|
|
19846
19358
|
output
|
|
19847
19359
|
});
|
|
@@ -19910,12 +19422,30 @@ async function propagateAgentsToDescendants(configRepository, baseDirectory, sel
|
|
|
19910
19422
|
}
|
|
19911
19423
|
|
|
19912
19424
|
// apps/cli/src/infra/commands/config/ConfigAgentsAddCommand.ts
|
|
19913
|
-
var
|
|
19914
|
-
var
|
|
19425
|
+
var readline4 = __toESM(require("readline"));
|
|
19426
|
+
var import_cmd_ts34 = __toESM(require_cjs());
|
|
19915
19427
|
|
|
19916
19428
|
// apps/cli/src/infra/commands/customParameters/AgentNamesPositional.ts
|
|
19917
|
-
var
|
|
19918
|
-
|
|
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)({
|
|
19919
19449
|
type: AgentArgType,
|
|
19920
19450
|
displayName: "agents",
|
|
19921
19451
|
description: "Agent identifiers (e.g. claude cursor)"
|
|
@@ -20011,7 +19541,7 @@ To restore organization settings later, remove all local agents with: packmind-c
|
|
|
20011
19541
|
// apps/cli/src/infra/commands/config/ConfigAgentsAddCommand.ts
|
|
20012
19542
|
function createPromptConfirm() {
|
|
20013
19543
|
return (message) => new Promise((resolve15) => {
|
|
20014
|
-
const rl =
|
|
19544
|
+
const rl = readline4.createInterface({
|
|
20015
19545
|
input: process.stdin,
|
|
20016
19546
|
output: process.stdout
|
|
20017
19547
|
});
|
|
@@ -20021,12 +19551,12 @@ function createPromptConfirm() {
|
|
|
20021
19551
|
});
|
|
20022
19552
|
});
|
|
20023
19553
|
}
|
|
20024
|
-
var addAgentsCommand = (0,
|
|
19554
|
+
var addAgentsCommand = (0, import_cmd_ts34.command)({
|
|
20025
19555
|
name: "add",
|
|
20026
19556
|
description: "Add coding agents to packmind.json files",
|
|
20027
19557
|
args: {
|
|
20028
|
-
path: (0,
|
|
20029
|
-
type:
|
|
19558
|
+
path: (0, import_cmd_ts34.option)({
|
|
19559
|
+
type: import_cmd_ts34.string,
|
|
20030
19560
|
short: "p",
|
|
20031
19561
|
long: "path",
|
|
20032
19562
|
defaultValue: () => "",
|
|
@@ -20052,7 +19582,7 @@ var addAgentsCommand = (0, import_cmd_ts35.command)({
|
|
|
20052
19582
|
});
|
|
20053
19583
|
|
|
20054
19584
|
// apps/cli/src/infra/commands/config/ConfigAgentsListCommand.ts
|
|
20055
|
-
var
|
|
19585
|
+
var import_cmd_ts35 = __toESM(require_cjs());
|
|
20056
19586
|
|
|
20057
19587
|
// apps/cli/src/infra/commands/config/agents/listAgentsHandler.ts
|
|
20058
19588
|
var SOURCE_LABELS = {
|
|
@@ -20132,12 +19662,12 @@ async function listAgentsHandler(args2, deps) {
|
|
|
20132
19662
|
}
|
|
20133
19663
|
|
|
20134
19664
|
// apps/cli/src/infra/commands/config/ConfigAgentsListCommand.ts
|
|
20135
|
-
var listAgentsCommand = (0,
|
|
19665
|
+
var listAgentsCommand = (0, import_cmd_ts35.command)({
|
|
20136
19666
|
name: "list",
|
|
20137
19667
|
description: "List coding agents configured across packmind.json files",
|
|
20138
19668
|
args: {
|
|
20139
|
-
path: (0,
|
|
20140
|
-
type:
|
|
19669
|
+
path: (0, import_cmd_ts35.option)({
|
|
19670
|
+
type: import_cmd_ts35.string,
|
|
20141
19671
|
short: "p",
|
|
20142
19672
|
long: "path",
|
|
20143
19673
|
defaultValue: () => "",
|
|
@@ -20161,7 +19691,7 @@ var listAgentsCommand = (0, import_cmd_ts36.command)({
|
|
|
20161
19691
|
});
|
|
20162
19692
|
|
|
20163
19693
|
// apps/cli/src/infra/commands/config/ConfigAgentsRemoveCommand.ts
|
|
20164
|
-
var
|
|
19694
|
+
var import_cmd_ts36 = __toESM(require_cjs());
|
|
20165
19695
|
|
|
20166
19696
|
// apps/cli/src/infra/commands/config/agents/removeAgentsHandler.ts
|
|
20167
19697
|
async function removeAgentsHandler(args2, deps) {
|
|
@@ -20244,13 +19774,13 @@ function logConfiguredAgentsHint(configuredAgents) {
|
|
|
20244
19774
|
}
|
|
20245
19775
|
|
|
20246
19776
|
// apps/cli/src/infra/commands/config/ConfigAgentsRemoveCommand.ts
|
|
20247
|
-
var removeAgentsCommand = (0,
|
|
19777
|
+
var removeAgentsCommand = (0, import_cmd_ts36.command)({
|
|
20248
19778
|
name: "rm",
|
|
20249
19779
|
aliases: ["remove"],
|
|
20250
19780
|
description: "Remove coding agents from packmind.json files",
|
|
20251
19781
|
args: {
|
|
20252
|
-
path: (0,
|
|
20253
|
-
type:
|
|
19782
|
+
path: (0, import_cmd_ts36.option)({
|
|
19783
|
+
type: import_cmd_ts36.string,
|
|
20254
19784
|
short: "p",
|
|
20255
19785
|
long: "path",
|
|
20256
19786
|
defaultValue: () => "",
|
|
@@ -20272,7 +19802,7 @@ var removeAgentsCommand = (0, import_cmd_ts37.command)({
|
|
|
20272
19802
|
});
|
|
20273
19803
|
|
|
20274
19804
|
// apps/cli/src/infra/commands/config/ConfigAgentsCommand.ts
|
|
20275
|
-
var configAgentsSetupCommand = (0,
|
|
19805
|
+
var configAgentsSetupCommand = (0, import_cmd_ts37.command)({
|
|
20276
19806
|
name: "setup",
|
|
20277
19807
|
description: "Configure which coding agents to generate artifacts for",
|
|
20278
19808
|
args: {},
|
|
@@ -20290,7 +19820,7 @@ var configAgentsSetupCommand = (0, import_cmd_ts38.command)({
|
|
|
20290
19820
|
});
|
|
20291
19821
|
}
|
|
20292
19822
|
});
|
|
20293
|
-
var configAgentsCommand = (0,
|
|
19823
|
+
var configAgentsCommand = (0, import_cmd_ts37.subcommands)({
|
|
20294
19824
|
name: "agents",
|
|
20295
19825
|
description: "Manage coding agents configuration",
|
|
20296
19826
|
cmds: {
|
|
@@ -20302,7 +19832,7 @@ var configAgentsCommand = (0, import_cmd_ts38.subcommands)({
|
|
|
20302
19832
|
});
|
|
20303
19833
|
|
|
20304
19834
|
// apps/cli/src/infra/commands/config/ConfigCommand.ts
|
|
20305
|
-
var configCommand = (0,
|
|
19835
|
+
var configCommand = (0, import_cmd_ts38.subcommands)({
|
|
20306
19836
|
name: "config",
|
|
20307
19837
|
description: "Manage Packmind configuration",
|
|
20308
19838
|
cmds: {
|
|
@@ -20311,7 +19841,7 @@ var configCommand = (0, import_cmd_ts39.subcommands)({
|
|
|
20311
19841
|
});
|
|
20312
19842
|
|
|
20313
19843
|
// apps/cli/src/infra/commands/InitCommand.ts
|
|
20314
|
-
var
|
|
19844
|
+
var import_cmd_ts39 = __toESM(require_cjs());
|
|
20315
19845
|
|
|
20316
19846
|
// apps/cli/src/infra/commands/initHandler.ts
|
|
20317
19847
|
async function initHandler(deps) {
|
|
@@ -20373,7 +19903,7 @@ async function initHandler(deps) {
|
|
|
20373
19903
|
|
|
20374
19904
|
// apps/cli/src/infra/commands/InitCommand.ts
|
|
20375
19905
|
var { version: CLI_VERSION4 } = require_package();
|
|
20376
|
-
var initCommand = (0,
|
|
19906
|
+
var initCommand = (0, import_cmd_ts39.command)({
|
|
20377
19907
|
name: "init",
|
|
20378
19908
|
description: "Initialize Packmind in the current project",
|
|
20379
19909
|
args: {},
|
|
@@ -20401,13 +19931,13 @@ var initCommand = (0, import_cmd_ts40.command)({
|
|
|
20401
19931
|
});
|
|
20402
19932
|
|
|
20403
19933
|
// apps/cli/src/infra/commands/UpdateCommand.ts
|
|
20404
|
-
var
|
|
19934
|
+
var import_cmd_ts40 = __toESM(require_cjs());
|
|
20405
19935
|
var { version: CLI_VERSION5 } = require_package();
|
|
20406
|
-
var updateCommand = (0,
|
|
19936
|
+
var updateCommand = (0, import_cmd_ts40.command)({
|
|
20407
19937
|
name: "update",
|
|
20408
19938
|
description: "Update packmind-cli to the latest version",
|
|
20409
19939
|
args: {
|
|
20410
|
-
check: (0,
|
|
19940
|
+
check: (0, import_cmd_ts40.flag)({
|
|
20411
19941
|
long: "check",
|
|
20412
19942
|
description: "Only check if a newer version is available without performing the update"
|
|
20413
19943
|
})
|
|
@@ -20432,20 +19962,20 @@ function findEnvFile() {
|
|
|
20432
19962
|
const currentDir = process.cwd();
|
|
20433
19963
|
const gitService = new GitService();
|
|
20434
19964
|
const gitRoot = gitService.getGitRepositoryRootSync(currentDir);
|
|
20435
|
-
const filesystemRoot =
|
|
19965
|
+
const filesystemRoot = path34.parse(currentDir).root;
|
|
20436
19966
|
const stopDir = gitRoot ?? filesystemRoot;
|
|
20437
19967
|
let searchDir = currentDir;
|
|
20438
|
-
let parentDir =
|
|
19968
|
+
let parentDir = path34.dirname(searchDir);
|
|
20439
19969
|
while (searchDir !== parentDir) {
|
|
20440
|
-
const envPath2 =
|
|
20441
|
-
if (
|
|
19970
|
+
const envPath2 = path34.join(searchDir, ".env");
|
|
19971
|
+
if (fs25.existsSync(envPath2)) {
|
|
20442
19972
|
return envPath2;
|
|
20443
19973
|
}
|
|
20444
19974
|
if (searchDir === stopDir) {
|
|
20445
19975
|
return null;
|
|
20446
19976
|
}
|
|
20447
19977
|
searchDir = parentDir;
|
|
20448
|
-
parentDir =
|
|
19978
|
+
parentDir = path34.dirname(searchDir);
|
|
20449
19979
|
}
|
|
20450
19980
|
return null;
|
|
20451
19981
|
}
|
|
@@ -20465,7 +19995,7 @@ if (args.includes("--version") || args.includes("-v")) {
|
|
|
20465
19995
|
logConsole(`packmind-cli version ${CLI_VERSION6}`);
|
|
20466
19996
|
process.exit(0);
|
|
20467
19997
|
}
|
|
20468
|
-
var app = (0,
|
|
19998
|
+
var app = (0, import_cmd_ts41.subcommands)({
|
|
20469
19999
|
name: "packmind-cli",
|
|
20470
20000
|
description: "Packmind CLI tool",
|
|
20471
20001
|
cmds: {
|
|
@@ -20479,7 +20009,6 @@ var app = (0, import_cmd_ts42.subcommands)({
|
|
|
20479
20009
|
logout: logoutCommand,
|
|
20480
20010
|
packages: packagesCommand,
|
|
20481
20011
|
playbook: playbookCommand,
|
|
20482
|
-
"setup-mcp": setupMcpCommand,
|
|
20483
20012
|
skills: skillsCommand,
|
|
20484
20013
|
spaces: spacesCommand,
|
|
20485
20014
|
standards: standardsCommand,
|
|
@@ -20488,7 +20017,7 @@ var app = (0, import_cmd_ts42.subcommands)({
|
|
|
20488
20017
|
whoami: whoamiCommand
|
|
20489
20018
|
}
|
|
20490
20019
|
});
|
|
20491
|
-
(0,
|
|
20020
|
+
(0, import_cmd_ts41.run)(app, args).catch((error) => {
|
|
20492
20021
|
logErrorConsole(error.message);
|
|
20493
20022
|
process.exit(1);
|
|
20494
20023
|
});
|