@teambit/cli 0.0.1306 → 0.0.1308
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/cli-output-style-guide.md +91 -0
- package/dist/cli-output-style-guide.md +91 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/dist/output-formatter.d.ts +19 -1
- package/dist/output-formatter.js +31 -5
- package/dist/output-formatter.js.map +1 -1
- package/dist/{preview-1774645620266.js → preview-1775227485691.js} +2 -2
- package/package.json +3 -3
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# CLI Output Style Guide
|
|
2
|
+
|
|
3
|
+
All CLI command output should use the shared formatting toolkit from `@teambit/cli` (`scopes/harmony/cli/output-formatter.ts`). Never use raw `chalk.underline` for headers or hardcode Unicode symbols directly.
|
|
4
|
+
|
|
5
|
+
## Toolkit Functions
|
|
6
|
+
|
|
7
|
+
| Function | Purpose | Example output |
|
|
8
|
+
| ----------------------------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| `formatTitle(text)` | Bold white section title | **modified components** |
|
|
10
|
+
| `formatSection(title, desc, items)` | Full section: title with count, dim description, item list. Returns `''` if items is empty | **modified components (3)**<br> _(use "bit diff" to compare)_<br><br> › comp-a<br> › comp-b |
|
|
11
|
+
| `formatItem(text, symbol?)` | Indented item line (3-space + symbol + text). Defaults to `bulletSymbol` | › comp-a |
|
|
12
|
+
| `formatHint(text)` | Dim text for hints/timing | _Finished. (1.2s)_ |
|
|
13
|
+
| `formatSuccessSummary(msg)` | Green checkmark + green text | ✔ 5/5 compiled successfully |
|
|
14
|
+
| `formatWarningSummary(msg)` | Warning symbol + yellow text | ⚠ 2/5 failed |
|
|
15
|
+
| `joinSections(sections)` | Filter empty strings, join with `\n\n` | — |
|
|
16
|
+
| `renderSections(sections, expand?)` | Render with collapsible section support | — |
|
|
17
|
+
|
|
18
|
+
## Symbols
|
|
19
|
+
|
|
20
|
+
| Symbol | Variable | Use for |
|
|
21
|
+
| ----------- | ----------------- | ------------------------------------------------------------------------------------------- |
|
|
22
|
+
| ✔ (green) | `successSymbol()` | Summary lines confirming an operation completed. **Not** for individual items in long lists |
|
|
23
|
+
| ⚠ (yellow) | `warnSymbol` | Items with warnings, deprecations, pending state |
|
|
24
|
+
| ✖ (red) | `errorSymbol` | Items with errors, failures, missing/deleted state |
|
|
25
|
+
| › (dim) | `bulletSymbol` | Neutral list items — the default for informational lists |
|
|
26
|
+
|
|
27
|
+
## Design Principles
|
|
28
|
+
|
|
29
|
+
### Silence means success
|
|
30
|
+
|
|
31
|
+
For commands that process many components (compile, import), don't list every successful item. Show only failures by default, with the full list available via `--verbose`. The summary line is enough when everything passes.
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
# default — all pass:
|
|
35
|
+
✔ 309/309 components compiled successfully.
|
|
36
|
+
Finished. (45s)
|
|
37
|
+
|
|
38
|
+
# default — some fail:
|
|
39
|
+
✖ teambit.workspace/watcher ... failed
|
|
40
|
+
✖ teambit.vue/vue-aspect ... failed
|
|
41
|
+
|
|
42
|
+
⚠ 2/309 components failed to compile.
|
|
43
|
+
Finished. (45s)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Reserve checkmarks for summaries
|
|
47
|
+
|
|
48
|
+
Use `bulletSymbol` (›) for individual items in lists. Reserve `successSymbol` (✔) for summary lines that confirm an operation completed. A long list of checkmarks is visual noise.
|
|
49
|
+
|
|
50
|
+
### Section structure
|
|
51
|
+
|
|
52
|
+
Use `formatSection` when you have a title + optional description + list of items. For sections with non-standard structure (key-value summaries, error messages with suggestions), use `formatTitle` for the heading.
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// Standard section — use formatSection
|
|
56
|
+
formatSection('modified components', '(use "bit diff" to compare)', items);
|
|
57
|
+
|
|
58
|
+
// Non-standard section — use formatTitle directly
|
|
59
|
+
const title = formatTitle('Merge Summary');
|
|
60
|
+
const body = `\nTotal Merged: ${chalk.bold(count)}`;
|
|
61
|
+
return `${title}${body}`;
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Join sections with joinSections
|
|
65
|
+
|
|
66
|
+
Never use `compact([...]).join('\n\n')` from lodash. Use `joinSections([...])` which filters empty strings and joins with double newlines.
|
|
67
|
+
|
|
68
|
+
### Error sections
|
|
69
|
+
|
|
70
|
+
Prefix error section titles with `errorSymbol`:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
const title = `${errorSymbol} ${formatTitle('Installation Error')}`;
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Conflict/warning sections
|
|
77
|
+
|
|
78
|
+
Prefix conflict section titles with `warnSymbol`:
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
const title = formatTitle(`${warnSymbol} files with conflicts summary`);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Commands already using this toolkit
|
|
85
|
+
|
|
86
|
+
- `bit status` — `scopes/component/status/status-cmd.ts`, `status-formatter.ts`
|
|
87
|
+
- `bit tag` / `bit snap` / `bit export` — use toolkit symbols and formatters
|
|
88
|
+
- `bit compile` — `scopes/compilation/compiler/compiler.cmd.ts`, `output-formatter.ts`
|
|
89
|
+
- `bit import` — `scopes/scope/importer/import.cmd.ts`
|
|
90
|
+
- `bit merge` — `scopes/component/merging/merge-cmd.ts`
|
|
91
|
+
- Shared merge helpers — `scopes/component/modules/merge-helper/merge-output.ts` (also used by `checkout`, `switch`, `lane merge`)
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# CLI Output Style Guide
|
|
2
|
+
|
|
3
|
+
All CLI command output should use the shared formatting toolkit from `@teambit/cli` (`scopes/harmony/cli/output-formatter.ts`). Never use raw `chalk.underline` for headers or hardcode Unicode symbols directly.
|
|
4
|
+
|
|
5
|
+
## Toolkit Functions
|
|
6
|
+
|
|
7
|
+
| Function | Purpose | Example output |
|
|
8
|
+
| ----------------------------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| `formatTitle(text)` | Bold white section title | **modified components** |
|
|
10
|
+
| `formatSection(title, desc, items)` | Full section: title with count, dim description, item list. Returns `''` if items is empty | **modified components (3)**<br> _(use "bit diff" to compare)_<br><br> › comp-a<br> › comp-b |
|
|
11
|
+
| `formatItem(text, symbol?)` | Indented item line (3-space + symbol + text). Defaults to `bulletSymbol` | › comp-a |
|
|
12
|
+
| `formatHint(text)` | Dim text for hints/timing | _Finished. (1.2s)_ |
|
|
13
|
+
| `formatSuccessSummary(msg)` | Green checkmark + green text | ✔ 5/5 compiled successfully |
|
|
14
|
+
| `formatWarningSummary(msg)` | Warning symbol + yellow text | ⚠ 2/5 failed |
|
|
15
|
+
| `joinSections(sections)` | Filter empty strings, join with `\n\n` | — |
|
|
16
|
+
| `renderSections(sections, expand?)` | Render with collapsible section support | — |
|
|
17
|
+
|
|
18
|
+
## Symbols
|
|
19
|
+
|
|
20
|
+
| Symbol | Variable | Use for |
|
|
21
|
+
| ----------- | ----------------- | ------------------------------------------------------------------------------------------- |
|
|
22
|
+
| ✔ (green) | `successSymbol()` | Summary lines confirming an operation completed. **Not** for individual items in long lists |
|
|
23
|
+
| ⚠ (yellow) | `warnSymbol` | Items with warnings, deprecations, pending state |
|
|
24
|
+
| ✖ (red) | `errorSymbol` | Items with errors, failures, missing/deleted state |
|
|
25
|
+
| › (dim) | `bulletSymbol` | Neutral list items — the default for informational lists |
|
|
26
|
+
|
|
27
|
+
## Design Principles
|
|
28
|
+
|
|
29
|
+
### Silence means success
|
|
30
|
+
|
|
31
|
+
For commands that process many components (compile, import), don't list every successful item. Show only failures by default, with the full list available via `--verbose`. The summary line is enough when everything passes.
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
# default — all pass:
|
|
35
|
+
✔ 309/309 components compiled successfully.
|
|
36
|
+
Finished. (45s)
|
|
37
|
+
|
|
38
|
+
# default — some fail:
|
|
39
|
+
✖ teambit.workspace/watcher ... failed
|
|
40
|
+
✖ teambit.vue/vue-aspect ... failed
|
|
41
|
+
|
|
42
|
+
⚠ 2/309 components failed to compile.
|
|
43
|
+
Finished. (45s)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Reserve checkmarks for summaries
|
|
47
|
+
|
|
48
|
+
Use `bulletSymbol` (›) for individual items in lists. Reserve `successSymbol` (✔) for summary lines that confirm an operation completed. A long list of checkmarks is visual noise.
|
|
49
|
+
|
|
50
|
+
### Section structure
|
|
51
|
+
|
|
52
|
+
Use `formatSection` when you have a title + optional description + list of items. For sections with non-standard structure (key-value summaries, error messages with suggestions), use `formatTitle` for the heading.
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// Standard section — use formatSection
|
|
56
|
+
formatSection('modified components', '(use "bit diff" to compare)', items);
|
|
57
|
+
|
|
58
|
+
// Non-standard section — use formatTitle directly
|
|
59
|
+
const title = formatTitle('Merge Summary');
|
|
60
|
+
const body = `\nTotal Merged: ${chalk.bold(count)}`;
|
|
61
|
+
return `${title}${body}`;
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Join sections with joinSections
|
|
65
|
+
|
|
66
|
+
Never use `compact([...]).join('\n\n')` from lodash. Use `joinSections([...])` which filters empty strings and joins with double newlines.
|
|
67
|
+
|
|
68
|
+
### Error sections
|
|
69
|
+
|
|
70
|
+
Prefix error section titles with `errorSymbol`:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
const title = `${errorSymbol} ${formatTitle('Installation Error')}`;
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Conflict/warning sections
|
|
77
|
+
|
|
78
|
+
Prefix conflict section titles with `warnSymbol`:
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
const title = formatTitle(`${warnSymbol} files with conflicts summary`);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Commands already using this toolkit
|
|
85
|
+
|
|
86
|
+
- `bit status` — `scopes/component/status/status-cmd.ts`, `status-formatter.ts`
|
|
87
|
+
- `bit tag` / `bit snap` / `bit export` — use toolkit symbols and formatters
|
|
88
|
+
- `bit compile` — `scopes/compilation/compiler/compiler.cmd.ts`, `output-formatter.ts`
|
|
89
|
+
- `bit import` — `scopes/scope/importer/import.cmd.ts`
|
|
90
|
+
- `bit merge` — `scopes/component/merging/merge-cmd.ts`
|
|
91
|
+
- Shared merge helpers — `scopes/component/modules/merge-helper/merge-output.ts` (also used by `checkout`, `switch`, `lane merge`)
|
package/dist/index.d.ts
CHANGED
|
@@ -9,5 +9,6 @@ export { defaultErrorHandler };
|
|
|
9
9
|
export type { Command, CLIArgs, Flags, GenericObject, CommandOptions } from './command';
|
|
10
10
|
export { getArgsData, getCommandName, getFlagsData } from './command-helper';
|
|
11
11
|
export * from './exceptions';
|
|
12
|
-
export { successSymbol, warnSymbol, errorSymbol, formatItem, formatSection, formatHint, formatSuccessSummary, formatWarningSummary, joinSections, } from './output-formatter';
|
|
12
|
+
export { successSymbol, warnSymbol, errorSymbol, bulletSymbol, formatItem, formatSection, formatTitle, formatHint, formatSuccessSummary, formatWarningSummary, joinSections, renderSections, } from './output-formatter';
|
|
13
|
+
export type { OutputSection } from './output-formatter';
|
|
13
14
|
export { CLIAspect as default, MainRuntime, CLIAspect };
|
package/dist/index.js
CHANGED
|
@@ -18,12 +18,15 @@ var _exportNames = {
|
|
|
18
18
|
successSymbol: true,
|
|
19
19
|
warnSymbol: true,
|
|
20
20
|
errorSymbol: true,
|
|
21
|
+
bulletSymbol: true,
|
|
21
22
|
formatItem: true,
|
|
22
23
|
formatSection: true,
|
|
24
|
+
formatTitle: true,
|
|
23
25
|
formatHint: true,
|
|
24
26
|
formatSuccessSummary: true,
|
|
25
27
|
formatWarningSummary: true,
|
|
26
|
-
joinSections: true
|
|
28
|
+
joinSections: true,
|
|
29
|
+
renderSections: true
|
|
27
30
|
};
|
|
28
31
|
Object.defineProperty(exports, "CLIAspect", {
|
|
29
32
|
enumerable: true,
|
|
@@ -43,6 +46,12 @@ Object.defineProperty(exports, "MainRuntime", {
|
|
|
43
46
|
return _cli().MainRuntime;
|
|
44
47
|
}
|
|
45
48
|
});
|
|
49
|
+
Object.defineProperty(exports, "bulletSymbol", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return _outputFormatter().bulletSymbol;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
46
55
|
Object.defineProperty(exports, "default", {
|
|
47
56
|
enumerable: true,
|
|
48
57
|
get: function () {
|
|
@@ -85,6 +94,12 @@ Object.defineProperty(exports, "formatSuccessSummary", {
|
|
|
85
94
|
return _outputFormatter().formatSuccessSummary;
|
|
86
95
|
}
|
|
87
96
|
});
|
|
97
|
+
Object.defineProperty(exports, "formatTitle", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function () {
|
|
100
|
+
return _outputFormatter().formatTitle;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
88
103
|
Object.defineProperty(exports, "formatWarningSummary", {
|
|
89
104
|
enumerable: true,
|
|
90
105
|
get: function () {
|
|
@@ -133,6 +148,12 @@ Object.defineProperty(exports, "joinSections", {
|
|
|
133
148
|
return _outputFormatter().joinSections;
|
|
134
149
|
}
|
|
135
150
|
});
|
|
151
|
+
Object.defineProperty(exports, "renderSections", {
|
|
152
|
+
enumerable: true,
|
|
153
|
+
get: function () {
|
|
154
|
+
return _outputFormatter().renderSections;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
136
157
|
Object.defineProperty(exports, "setExitOnUnhandledRejection", {
|
|
137
158
|
enumerable: true,
|
|
138
159
|
get: function () {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_globalFlags","_interopRequireDefault","_defaultErrorHandler","_cliParser","_handleErrors","_commandHelper","_exceptions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_outputFormatter","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["import { CLIAspect, MainRuntime } from './cli.aspect';\nimport globalFlags from './global-flags';\nimport defaultErrorHandler from './default-error-handler';\nexport { CLIParser } from './cli-parser';\nexport type { CLIMain, CommandList, CommandsSlot } from './cli.main.runtime';\nexport { handleUnhandledRejection, handleErrorAndExit, setExitOnUnhandledRejection } from './handle-errors';\nexport { globalFlags };\nexport { defaultErrorHandler };\nexport type { Command, CLIArgs, Flags, GenericObject, CommandOptions } from './command';\nexport { getArgsData, getCommandName, getFlagsData } from './command-helper';\nexport * from './exceptions';\n\nexport {\n successSymbol,\n warnSymbol,\n errorSymbol,\n formatItem,\n formatSection,\n formatHint,\n formatSuccessSummary,\n formatWarningSummary,\n joinSections,\n} from './output-formatter';\n\nexport { CLIAspect as default, MainRuntime, CLIAspect };\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_globalFlags","_interopRequireDefault","_defaultErrorHandler","_cliParser","_handleErrors","_commandHelper","_exceptions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_outputFormatter","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["import { CLIAspect, MainRuntime } from './cli.aspect';\nimport globalFlags from './global-flags';\nimport defaultErrorHandler from './default-error-handler';\nexport { CLIParser } from './cli-parser';\nexport type { CLIMain, CommandList, CommandsSlot } from './cli.main.runtime';\nexport { handleUnhandledRejection, handleErrorAndExit, setExitOnUnhandledRejection } from './handle-errors';\nexport { globalFlags };\nexport { defaultErrorHandler };\nexport type { Command, CLIArgs, Flags, GenericObject, CommandOptions } from './command';\nexport { getArgsData, getCommandName, getFlagsData } from './command-helper';\nexport * from './exceptions';\n\nexport {\n successSymbol,\n warnSymbol,\n errorSymbol,\n bulletSymbol,\n formatItem,\n formatSection,\n formatTitle,\n formatHint,\n formatSuccessSummary,\n formatWarningSummary,\n joinSections,\n renderSections,\n} from './output-formatter';\nexport type { OutputSection } from './output-formatter';\n\nexport { CLIAspect as default, Main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AAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAEA,SAAAS,iBAAA;EAAA,MAAArB,IAAA,GAAAC,OAAA;EAAAoB,gBAAA,YAAAA,CAAA;IAAA,OAAArB,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAa4B,SAAAG,uBAAAmB,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -3,13 +3,17 @@ export declare function successSymbol(): string;
|
|
|
3
3
|
export declare const warnSymbol: string;
|
|
4
4
|
/** Red error symbol */
|
|
5
5
|
export declare const errorSymbol: string;
|
|
6
|
-
/**
|
|
6
|
+
/** Neutral bullet for informational items (no success/failure connotation) */
|
|
7
|
+
export declare const bulletSymbol: string;
|
|
8
|
+
/** Format a single item with 3-space indent + symbol + text. Defaults to bullet symbol. */
|
|
7
9
|
export declare function formatItem(text: string, symbol?: string): string;
|
|
8
10
|
/**
|
|
9
11
|
* Format a section with bold white title (including item count), dim description, and items.
|
|
10
12
|
* Returns empty string if items array is empty.
|
|
11
13
|
*/
|
|
12
14
|
export declare function formatSection(title: string, description: string, items: string[]): string;
|
|
15
|
+
/** Format a bold white section title */
|
|
16
|
+
export declare function formatTitle(text: string): string;
|
|
13
17
|
/** Format hint text in dim color */
|
|
14
18
|
export declare function formatHint(text: string): string;
|
|
15
19
|
/** Format a success summary: green checkmark + green message */
|
|
@@ -18,3 +22,17 @@ export declare function formatSuccessSummary(msg: string): string;
|
|
|
18
22
|
export declare function formatWarningSummary(msg: string): string;
|
|
19
23
|
/** Filter out empty strings and join remaining sections with double newlines */
|
|
20
24
|
export declare function joinSections(sections: string[]): string;
|
|
25
|
+
export interface OutputSection {
|
|
26
|
+
/** The fully rendered section text */
|
|
27
|
+
content: string;
|
|
28
|
+
/** If set, this section starts collapsed. Use --expand to show full content. */
|
|
29
|
+
collapsible?: {
|
|
30
|
+
/** Summary line shown when collapsed */
|
|
31
|
+
summary: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Render sections to a string, collapsing sections that are marked collapsible.
|
|
36
|
+
* When expand is true, all sections are shown expanded.
|
|
37
|
+
*/
|
|
38
|
+
export declare function renderSections(sections: OutputSection[], expand?: boolean): string;
|
package/dist/output-formatter.js
CHANGED
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.errorSymbol = void 0;
|
|
6
|
+
exports.errorSymbol = exports.bulletSymbol = void 0;
|
|
7
7
|
exports.formatHint = formatHint;
|
|
8
8
|
exports.formatItem = formatItem;
|
|
9
9
|
exports.formatSection = formatSection;
|
|
10
10
|
exports.formatSuccessSummary = formatSuccessSummary;
|
|
11
|
+
exports.formatTitle = formatTitle;
|
|
11
12
|
exports.formatWarningSummary = formatWarningSummary;
|
|
12
13
|
exports.joinSections = joinSections;
|
|
14
|
+
exports.renderSections = renderSections;
|
|
13
15
|
exports.successSymbol = successSymbol;
|
|
14
16
|
exports.warnSymbol = void 0;
|
|
15
17
|
function _chalk() {
|
|
@@ -39,9 +41,12 @@ const warnSymbol = exports.warnSymbol = _chalk().default.yellow('\u26A0');
|
|
|
39
41
|
/** Red error symbol */
|
|
40
42
|
const errorSymbol = exports.errorSymbol = _chalk().default.red('\u2716');
|
|
41
43
|
|
|
42
|
-
/**
|
|
44
|
+
/** Neutral bullet for informational items (no success/failure connotation) */
|
|
45
|
+
const bulletSymbol = exports.bulletSymbol = _chalk().default.dim('\u203A');
|
|
46
|
+
|
|
47
|
+
/** Format a single item with 3-space indent + symbol + text. Defaults to bullet symbol. */
|
|
43
48
|
function formatItem(text, symbol) {
|
|
44
|
-
const s = symbol ??
|
|
49
|
+
const s = symbol ?? bulletSymbol;
|
|
45
50
|
return ` ${s} ${text}`;
|
|
46
51
|
}
|
|
47
52
|
|
|
@@ -51,14 +56,20 @@ function formatItem(text, symbol) {
|
|
|
51
56
|
*/
|
|
52
57
|
function formatSection(title, description, items) {
|
|
53
58
|
if (!items.length) return '';
|
|
54
|
-
const lines = [
|
|
59
|
+
const lines = [formatTitle(`${title} (${items.length})`)];
|
|
55
60
|
if (description) {
|
|
56
|
-
|
|
61
|
+
const indented = description.split('\n').map(l => ` ${l}`).join('\n');
|
|
62
|
+
lines.push(_chalk().default.dim(indented));
|
|
57
63
|
}
|
|
58
64
|
lines.push(...items);
|
|
59
65
|
return lines.join('\n');
|
|
60
66
|
}
|
|
61
67
|
|
|
68
|
+
/** Format a bold white section title */
|
|
69
|
+
function formatTitle(text) {
|
|
70
|
+
return _chalk().default.bold.white(text);
|
|
71
|
+
}
|
|
72
|
+
|
|
62
73
|
/** Format hint text in dim color */
|
|
63
74
|
function formatHint(text) {
|
|
64
75
|
return _chalk().default.dim(text);
|
|
@@ -78,5 +89,20 @@ function formatWarningSummary(msg) {
|
|
|
78
89
|
function joinSections(sections) {
|
|
79
90
|
return sections.filter(Boolean).join('\n\n');
|
|
80
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Render sections to a string, collapsing sections that are marked collapsible.
|
|
94
|
+
* When expand is true, all sections are shown expanded.
|
|
95
|
+
*/
|
|
96
|
+
function renderSections(sections, expand = false) {
|
|
97
|
+
const parts = [];
|
|
98
|
+
for (const section of sections) {
|
|
99
|
+
if (section.collapsible && !expand) {
|
|
100
|
+
parts.push(section.collapsible.summary);
|
|
101
|
+
} else if (section.content) {
|
|
102
|
+
parts.push(section.content);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return parts.filter(Boolean).join('\n\n');
|
|
106
|
+
}
|
|
81
107
|
|
|
82
108
|
//# sourceMappingURL=output-formatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_os","e","__esModule","default","_successSymbol","platform","chalk","green","successSymbol","warnSymbol","exports","yellow","errorSymbol","red","formatItem","text","symbol","s","formatSection","title","description","items","length","lines","
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_os","e","__esModule","default","_successSymbol","platform","chalk","green","successSymbol","warnSymbol","exports","yellow","errorSymbol","red","bulletSymbol","dim","formatItem","text","symbol","s","formatSection","title","description","items","length","lines","formatTitle","indented","split","map","l","join","push","bold","white","formatHint","formatSuccessSummary","msg","formatWarningSummary","joinSections","sections","filter","Boolean","renderSections","expand","parts","section","collapsible","summary","content"],"sources":["output-formatter.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { platform } from 'os';\n\n/** Cross-platform green checkmark (mirrors Logger.successSymbol without importing Logger to avoid coupling) */\nconst _successSymbol = platform() === 'win32' ? chalk.green('\\u2713') : chalk.green('\\u2714');\nexport function successSymbol(): string {\n return _successSymbol;\n}\n\n/** Yellow warning symbol */\nexport const warnSymbol = chalk.yellow('\\u26A0');\n\n/** Red error symbol */\nexport const errorSymbol = chalk.red('\\u2716');\n\n/** Neutral bullet for informational items (no success/failure connotation) */\nexport const bulletSymbol = chalk.dim('\\u203A');\n\n/** Format a single item with 3-space indent + symbol + text. Defaults to bullet symbol. */\nexport function formatItem(text: string, symbol?: string): string {\n const s = symbol ?? bulletSymbol;\n return ` ${s} ${text}`;\n}\n\n/**\n * Format a section with bold white title (including item count), dim description, and items.\n * Returns empty string if items array is empty.\n */\nexport function formatSection(title: string, description: string, items: string[]): string {\n if (!items.length) return '';\n const lines: string[] = [formatTitle(`${title} (${items.length})`)];\n if (description) {\n const indented = description\n .split('\\n')\n .map((l) => ` ${l}`)\n .join('\\n');\n lines.push(chalk.dim(indented));\n }\n lines.push(...items);\n return lines.join('\\n');\n}\n\n/** Format a bold white section title */\nexport function formatTitle(text: string): string {\n return chalk.bold.white(text);\n}\n\n/** Format hint text in dim color */\nexport function formatHint(text: string): string {\n return chalk.dim(text);\n}\n\n/** Format a success summary: green checkmark + green message */\nexport function formatSuccessSummary(msg: string): string {\n return `${successSymbol()} ${chalk.green(msg)}`;\n}\n\n/** Format a warning summary: warning symbol + yellow message */\nexport function formatWarningSummary(msg: string): string {\n return `${warnSymbol} ${chalk.yellow(msg)}`;\n}\n\n/** Filter out empty strings and join remaining sections with double newlines */\nexport function joinSections(sections: string[]): string {\n return sections.filter(Boolean).join('\\n\\n');\n}\n\nexport interface OutputSection {\n /** The fully rendered section text */\n content: string;\n /** If set, this section starts collapsed. Use --expand to show full content. */\n collapsible?: {\n /** Summary line shown when collapsed */\n summary: string;\n };\n}\n\n/**\n * Render sections to a string, collapsing sections that are marked collapsible.\n * When expand is true, all sections are shown expanded.\n */\nexport function renderSections(sections: OutputSection[], expand = false): string {\n const parts: string[] = [];\n for (const section of sections) {\n if (section.collapsible && !expand) {\n parts.push(section.collapsible.summary);\n } else if (section.content) {\n parts.push(section.content);\n }\n }\n return parts.filter(Boolean).join('\\n\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,IAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA8B,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B;AACA,MAAMG,cAAc,GAAG,IAAAC,cAAQ,EAAC,CAAC,KAAK,OAAO,GAAGC,gBA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,EAAU;EAChD,OAAOX,gBAAK,CAAC2B,IAAI,CAACC,KAAK,CAACjB,IAAI,CAAC;AAC/B;;AAEA;AACO,SAASkB,UAAUA,CAAClB,IAAY,EAAU;EAC/C,OAAOX,gBAAK,CAACS,GAAG,CAACE,IAAI,CAAC;AACxB;;AAEA;AACO,SAASmB,oBAAoBA,CAACC,GAAW,EAAU;EACxD,OAAO,GAAG7B,aAAa,CAAC,CAAC,IAAIF,gBAAK,CAACC,KAAK,CAAC8B,GAAG,CAAC,EAAE;AACjD;;AAEA;AACO,SAASC,oBAAoBA,CAACD,GAAW,EAAU;EACxD,OAAO,GAAG5B,UAAU,IAAIH,gBAAK,CAACK,MAAM,CAAC0B,GAAG,CAAC,EAAE;AAC7C;;AAEA;AACO,SAASE,YAAYA,CAACC,QAAkB,EAAU;EACvD,OAAOA,QAAQ,CAACC,MAAM,CAACC,OAAO,CAAC,CAACX,IAAI,CAAC,MAAM,CAAC;AAC9C;AAYA;AACA;AACA;AACA;AACO,SAASY,cAAcA,CAACH,QAAyB,EAAEI,MAAM,GAAG,KAAK,EAAU;EAChF,MAAMC,KAAe,GAAG,EAAE;EAC1B,KAAK,MAAMC,OAAO,IAAIN,QAAQ,EAAE;IAC9B,IAAIM,OAAO,CAACC,WAAW,IAAI,CAACH,MAAM,EAAE;MAClCC,KAAK,CAACb,IAAI,CAACc,OAAO,CAACC,WAAW,CAACC,OAAO,CAAC;IACzC,CAAC,MAAM,IAAIF,OAAO,CAACG,OAAO,EAAE;MAC1BJ,KAAK,CAACb,IAAI,CAACc,OAAO,CAACG,OAAO,CAAC;IAC7B;EACF;EACA,OAAOJ,KAAK,CAACJ,MAAM,CAACC,OAAO,CAAC,CAACX,IAAI,CAAC,MAAM,CAAC;AAC3C","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.1308/dist/cli.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.1308/dist/cli.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1308",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/harmony/cli",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.harmony",
|
|
8
8
|
"name": "cli",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.1308"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@teambit/legacy.constants": "0.0.24",
|
|
25
25
|
"@teambit/bit-error": "0.0.404",
|
|
26
26
|
"@teambit/legacy.cli.error": "0.0.36",
|
|
27
|
-
"@teambit/logger": "0.0.
|
|
27
|
+
"@teambit/logger": "0.0.1401"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/didyoumean": "1.2.0",
|