@braingrid/cli 0.2.15 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/cli.js +80 -19
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.16] - 2025-12-17
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **--format option for show commands**
|
|
15
|
+
- Added `--format` option to `requirement show` command
|
|
16
|
+
- Added `--format` option to `task show` command
|
|
17
|
+
- Supports all standard formats: table (default), json, xml, markdown
|
|
18
|
+
- Consistent with other commands that already support `--format`
|
|
19
|
+
|
|
10
20
|
## [0.2.15] - 2025-12-15
|
|
11
21
|
|
|
12
22
|
### Changed
|
package/dist/cli.js
CHANGED
|
@@ -422,7 +422,7 @@ import axios3, { AxiosError as AxiosError2 } from "axios";
|
|
|
422
422
|
|
|
423
423
|
// src/build-config.ts
|
|
424
424
|
var BUILD_ENV = true ? "production" : process.env.NODE_ENV === "test" ? "development" : "production";
|
|
425
|
-
var CLI_VERSION = true ? "0.2.
|
|
425
|
+
var CLI_VERSION = true ? "0.2.16" : "0.0.0-test";
|
|
426
426
|
var PRODUCTION_CONFIG = {
|
|
427
427
|
apiUrl: "https://app.braingrid.ai",
|
|
428
428
|
workosAuthUrl: "https://auth.braingrid.ai",
|
|
@@ -3940,6 +3940,15 @@ async function handleRequirementShow(opts) {
|
|
|
3940
3940
|
message: chalk7.red("\u274C Not authenticated. Please run `braingrid login` first.")
|
|
3941
3941
|
};
|
|
3942
3942
|
}
|
|
3943
|
+
const format = opts?.format || "table";
|
|
3944
|
+
if (!["table", "json", "xml", "markdown"].includes(format)) {
|
|
3945
|
+
return {
|
|
3946
|
+
success: false,
|
|
3947
|
+
message: chalk7.red(
|
|
3948
|
+
`\u274C Invalid format: ${format}. Supported formats: table, json, xml, markdown`
|
|
3949
|
+
)
|
|
3950
|
+
};
|
|
3951
|
+
}
|
|
3943
3952
|
const requirementResult = await workspaceManager.getRequirement(opts?.id);
|
|
3944
3953
|
if (!requirementResult.success) {
|
|
3945
3954
|
return {
|
|
@@ -3961,17 +3970,39 @@ async function handleRequirementShow(opts) {
|
|
|
3961
3970
|
const requirement2 = await requirementService.getProjectRequirement(projectId, normalizedId);
|
|
3962
3971
|
stopSpinner();
|
|
3963
3972
|
stopSpinner = null;
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3973
|
+
let output;
|
|
3974
|
+
switch (format) {
|
|
3975
|
+
case "json": {
|
|
3976
|
+
output = JSON.stringify(requirement2, null, 2);
|
|
3977
|
+
break;
|
|
3978
|
+
}
|
|
3979
|
+
case "xml": {
|
|
3980
|
+
output = formatRequirementBuildXml(requirement2);
|
|
3981
|
+
break;
|
|
3982
|
+
}
|
|
3983
|
+
case "markdown": {
|
|
3984
|
+
output = formatRequirementBuildMarkdown(requirement2, {
|
|
3985
|
+
apiUrl: config.apiUrl,
|
|
3986
|
+
projectShortId: projectId
|
|
3987
|
+
});
|
|
3988
|
+
break;
|
|
3989
|
+
}
|
|
3990
|
+
case "table":
|
|
3991
|
+
default: {
|
|
3992
|
+
output = "\n" + formatRequirementOutput(requirement2, {
|
|
3993
|
+
showDescription: true,
|
|
3994
|
+
showContent: true,
|
|
3995
|
+
showTasks: true,
|
|
3996
|
+
showUpdated: true,
|
|
3997
|
+
apiUrl: config.apiUrl,
|
|
3998
|
+
projectShortId: projectId
|
|
3999
|
+
});
|
|
4000
|
+
break;
|
|
4001
|
+
}
|
|
4002
|
+
}
|
|
3972
4003
|
return {
|
|
3973
4004
|
success: true,
|
|
3974
|
-
message:
|
|
4005
|
+
message: output,
|
|
3975
4006
|
data: requirement2
|
|
3976
4007
|
};
|
|
3977
4008
|
} catch (error) {
|
|
@@ -4623,6 +4654,15 @@ async function handleTaskShow(id, opts) {
|
|
|
4623
4654
|
message: chalk8.red("\u274C Not authenticated. Please run `braingrid login` first.")
|
|
4624
4655
|
};
|
|
4625
4656
|
}
|
|
4657
|
+
const format = opts?.format || "table";
|
|
4658
|
+
if (!["table", "json", "xml", "markdown"].includes(format)) {
|
|
4659
|
+
return {
|
|
4660
|
+
success: false,
|
|
4661
|
+
message: chalk8.red(
|
|
4662
|
+
`\u274C Invalid format: ${format}. Supported formats: table, json, xml, markdown`
|
|
4663
|
+
)
|
|
4664
|
+
};
|
|
4665
|
+
}
|
|
4626
4666
|
const workspace = await workspaceManager.getProject(opts?.project);
|
|
4627
4667
|
if (!workspace.success) {
|
|
4628
4668
|
return {
|
|
@@ -4645,13 +4685,34 @@ async function handleTaskShow(id, opts) {
|
|
|
4645
4685
|
const task2 = await taskService.getTask(projectId, requirementId, taskId);
|
|
4646
4686
|
stopSpinner();
|
|
4647
4687
|
stopSpinner = null;
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4688
|
+
let output;
|
|
4689
|
+
switch (format) {
|
|
4690
|
+
case "json": {
|
|
4691
|
+
output = JSON.stringify(task2, null, 2);
|
|
4692
|
+
break;
|
|
4693
|
+
}
|
|
4694
|
+
case "xml":
|
|
4695
|
+
case "markdown": {
|
|
4696
|
+
output = formatTasksListOutput([task2], format, true, {
|
|
4697
|
+
requirementId,
|
|
4698
|
+
projectShortId: projectId,
|
|
4699
|
+
requirementShortId: opts?.requirement || requirementId,
|
|
4700
|
+
apiUrl: config.apiUrl
|
|
4701
|
+
});
|
|
4702
|
+
break;
|
|
4703
|
+
}
|
|
4704
|
+
case "table":
|
|
4705
|
+
default: {
|
|
4706
|
+
output = formatTaskOutput(task2, {
|
|
4707
|
+
showContent: true,
|
|
4708
|
+
apiUrl: config.apiUrl,
|
|
4709
|
+
projectShortId: projectId,
|
|
4710
|
+
requirementShortId: opts?.requirement || requirementId,
|
|
4711
|
+
requirementId
|
|
4712
|
+
});
|
|
4713
|
+
break;
|
|
4714
|
+
}
|
|
4715
|
+
}
|
|
4655
4716
|
return {
|
|
4656
4717
|
success: true,
|
|
4657
4718
|
message: output,
|
|
@@ -6954,7 +7015,7 @@ requirement.command("list").description("List requirements for a project").optio
|
|
|
6954
7015
|
requirement.command("show [id]").description("Show requirement details (auto-detects ID from git branch if not provided)").option(
|
|
6955
7016
|
"-p, --project <id>",
|
|
6956
7017
|
"project ID (auto-detects from .braingrid/project.json if not provided)"
|
|
6957
|
-
).action(async (id, opts) => {
|
|
7018
|
+
).option("--format <format>", "output format (table, json, xml, markdown)", "table").action(async (id, opts) => {
|
|
6958
7019
|
const result = await handleRequirementShow({ ...opts, id });
|
|
6959
7020
|
console.log(result.message);
|
|
6960
7021
|
if (!result.success) {
|
|
@@ -7027,7 +7088,7 @@ task.command("summary").description("Show task summary table (quick overview wit
|
|
|
7027
7088
|
process.exit(1);
|
|
7028
7089
|
}
|
|
7029
7090
|
});
|
|
7030
|
-
task.command("show <id>").description("Show task details").option("-r, --requirement <id>", "requirement ID (REQ-456, auto-detects project if initialized)").option("-p, --project <id>", "project ID (PROJ-123, optional if project is initialized)").action(async (id, opts) => {
|
|
7091
|
+
task.command("show <id>").description("Show task details").option("-r, --requirement <id>", "requirement ID (REQ-456, auto-detects project if initialized)").option("-p, --project <id>", "project ID (PROJ-123, optional if project is initialized)").option("--format <format>", "output format (table, json, xml, markdown)", "table").action(async (id, opts) => {
|
|
7031
7092
|
const result = await handleTaskShow(id, opts);
|
|
7032
7093
|
console.log(result.message);
|
|
7033
7094
|
if (!result.success) {
|