@fractary/core-cli 0.1.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.
Files changed (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +313 -0
  3. package/dist/cli.d.ts +8 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +86 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/docs/index.d.ts +11 -0
  8. package/dist/commands/docs/index.d.ts.map +1 -0
  9. package/dist/commands/docs/index.js +276 -0
  10. package/dist/commands/docs/index.js.map +1 -0
  11. package/dist/commands/file/index.d.ts +11 -0
  12. package/dist/commands/file/index.d.ts.map +1 -0
  13. package/dist/commands/file/index.js +210 -0
  14. package/dist/commands/file/index.js.map +1 -0
  15. package/dist/commands/logs/index.d.ts +11 -0
  16. package/dist/commands/logs/index.d.ts.map +1 -0
  17. package/dist/commands/logs/index.js +277 -0
  18. package/dist/commands/logs/index.js.map +1 -0
  19. package/dist/commands/logs/utils.d.ts +11 -0
  20. package/dist/commands/logs/utils.d.ts.map +1 -0
  21. package/dist/commands/logs/utils.js +39 -0
  22. package/dist/commands/logs/utils.js.map +1 -0
  23. package/dist/commands/repo/branch.d.ts +6 -0
  24. package/dist/commands/repo/branch.d.ts.map +1 -0
  25. package/dist/commands/repo/branch.js +128 -0
  26. package/dist/commands/repo/branch.js.map +1 -0
  27. package/dist/commands/repo/commit.d.ts +6 -0
  28. package/dist/commands/repo/commit.d.ts.map +1 -0
  29. package/dist/commands/repo/commit.js +51 -0
  30. package/dist/commands/repo/commit.js.map +1 -0
  31. package/dist/commands/repo/index.d.ts +11 -0
  32. package/dist/commands/repo/index.d.ts.map +1 -0
  33. package/dist/commands/repo/index.js +33 -0
  34. package/dist/commands/repo/index.js.map +1 -0
  35. package/dist/commands/repo/pr.d.ts +6 -0
  36. package/dist/commands/repo/pr.d.ts.map +1 -0
  37. package/dist/commands/repo/pr.js +165 -0
  38. package/dist/commands/repo/pr.js.map +1 -0
  39. package/dist/commands/repo/status.d.ts +8 -0
  40. package/dist/commands/repo/status.d.ts.map +1 -0
  41. package/dist/commands/repo/status.js +123 -0
  42. package/dist/commands/repo/status.js.map +1 -0
  43. package/dist/commands/repo/tag.d.ts +6 -0
  44. package/dist/commands/repo/tag.d.ts.map +1 -0
  45. package/dist/commands/repo/tag.js +125 -0
  46. package/dist/commands/repo/tag.js.map +1 -0
  47. package/dist/commands/repo/worktree.d.ts +6 -0
  48. package/dist/commands/repo/worktree.d.ts.map +1 -0
  49. package/dist/commands/repo/worktree.js +137 -0
  50. package/dist/commands/repo/worktree.js.map +1 -0
  51. package/dist/commands/spec/index.d.ts +11 -0
  52. package/dist/commands/spec/index.d.ts.map +1 -0
  53. package/dist/commands/spec/index.js +264 -0
  54. package/dist/commands/spec/index.js.map +1 -0
  55. package/dist/commands/work/index.d.ts +11 -0
  56. package/dist/commands/work/index.d.ts.map +1 -0
  57. package/dist/commands/work/index.js +773 -0
  58. package/dist/commands/work/index.js.map +1 -0
  59. package/dist/index.d.ts +16 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +51 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/sdk/factory.d.ts +51 -0
  64. package/dist/sdk/factory.d.ts.map +1 -0
  65. package/dist/sdk/factory.js +188 -0
  66. package/dist/sdk/factory.js.map +1 -0
  67. package/dist/utils/config.d.ts +71 -0
  68. package/dist/utils/config.d.ts.map +1 -0
  69. package/dist/utils/config.js +219 -0
  70. package/dist/utils/config.js.map +1 -0
  71. package/dist/utils/errors.d.ts +42 -0
  72. package/dist/utils/errors.d.ts.map +1 -0
  73. package/dist/utils/errors.js +144 -0
  74. package/dist/utils/errors.js.map +1 -0
  75. package/dist/utils/output.d.ts +115 -0
  76. package/dist/utils/output.d.ts.map +1 -0
  77. package/dist/utils/output.js +201 -0
  78. package/dist/utils/output.js.map +1 -0
  79. package/package.json +78 -0
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ /**
3
+ * Output Formatting Utilities
4
+ *
5
+ * Provides standardized output formatting for both JSON and text modes.
6
+ */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.success = success;
12
+ exports.error = error;
13
+ exports.warning = warning;
14
+ exports.info = info;
15
+ exports.formatTable = formatTable;
16
+ exports.formatList = formatList;
17
+ exports.formatKeyValue = formatKeyValue;
18
+ exports.formatSection = formatSection;
19
+ exports.formatSuccess = formatSuccess;
20
+ exports.formatError = formatError;
21
+ exports.formatLoading = formatLoading;
22
+ exports.truncate = truncate;
23
+ exports.formatTimestamp = formatTimestamp;
24
+ const chalk_1 = __importDefault(require("chalk"));
25
+ const cli_table3_1 = __importDefault(require("cli-table3"));
26
+ /**
27
+ * Output a success message with data
28
+ *
29
+ * @param data - The data to output
30
+ * @param options - Output options
31
+ */
32
+ function success(data, options = {}) {
33
+ if (options.json) {
34
+ console.log(JSON.stringify({ status: 'success', data }, null, 2));
35
+ }
36
+ else {
37
+ // For text mode, the caller is responsible for formatting
38
+ // This function is here for consistency with the JSON mode
39
+ console.log(data);
40
+ }
41
+ }
42
+ /**
43
+ * Output an error message
44
+ *
45
+ * @param message - The error message
46
+ * @param code - The error code
47
+ * @param options - Output options
48
+ */
49
+ function error(message, code, options = {}) {
50
+ if (options.json) {
51
+ console.error(JSON.stringify({ status: 'error', error: { code, message } }, null, 2));
52
+ }
53
+ else {
54
+ console.error(chalk_1.default.red('Error:'), message);
55
+ }
56
+ }
57
+ /**
58
+ * Output a warning message
59
+ *
60
+ * @param message - The warning message
61
+ * @param options - Output options
62
+ */
63
+ function warning(message, options = {}) {
64
+ if (options.json) {
65
+ console.warn(JSON.stringify({ status: 'warning', message }, null, 2));
66
+ }
67
+ else {
68
+ console.warn(chalk_1.default.yellow('Warning:'), message);
69
+ }
70
+ }
71
+ /**
72
+ * Output an info message
73
+ *
74
+ * @param message - The info message
75
+ * @param options - Output options
76
+ */
77
+ function info(message, options = {}) {
78
+ if (options.json) {
79
+ console.log(JSON.stringify({ status: 'info', message }, null, 2));
80
+ }
81
+ else {
82
+ console.log(chalk_1.default.blue('ℹ'), message);
83
+ }
84
+ }
85
+ /**
86
+ * Create a formatted table
87
+ *
88
+ * @param headers - Table headers
89
+ * @param rows - Table rows
90
+ * @returns Formatted table as string
91
+ */
92
+ function formatTable(headers, rows) {
93
+ const table = new cli_table3_1.default({
94
+ head: headers.map(h => chalk_1.default.bold(h)),
95
+ style: {
96
+ head: [],
97
+ border: [],
98
+ },
99
+ });
100
+ rows.forEach(row => table.push(row));
101
+ return table.toString();
102
+ }
103
+ /**
104
+ * Format a list of items
105
+ *
106
+ * @param items - The items to format
107
+ * @param bullet - The bullet character (default: •)
108
+ * @returns Formatted list as string
109
+ */
110
+ function formatList(items, bullet = '•') {
111
+ return items.map(item => ` ${chalk_1.default.gray(bullet)} ${item}`).join('\n');
112
+ }
113
+ /**
114
+ * Format a key-value pair
115
+ *
116
+ * @param key - The key
117
+ * @param value - The value
118
+ * @param options - Formatting options
119
+ * @returns Formatted key-value as string
120
+ */
121
+ function formatKeyValue(key, value, options = {}) {
122
+ const formattedKey = options.color !== false ? chalk_1.default.bold(key) : key;
123
+ return `${formattedKey}: ${value}`;
124
+ }
125
+ /**
126
+ * Format a section with title and content
127
+ *
128
+ * @param title - The section title
129
+ * @param content - The section content
130
+ * @returns Formatted section as string
131
+ */
132
+ function formatSection(title, content) {
133
+ return `\n${chalk_1.default.bold.underline(title)}\n${content}\n`;
134
+ }
135
+ /**
136
+ * Format a success checkmark
137
+ *
138
+ * @param message - The success message
139
+ * @returns Formatted success message
140
+ */
141
+ function formatSuccess(message) {
142
+ return chalk_1.default.green('✓') + ' ' + message;
143
+ }
144
+ /**
145
+ * Format an error cross
146
+ *
147
+ * @param message - The error message
148
+ * @returns Formatted error message
149
+ */
150
+ function formatError(message) {
151
+ return chalk_1.default.red('✗') + ' ' + message;
152
+ }
153
+ /**
154
+ * Format a spinner/loading message
155
+ *
156
+ * @param message - The loading message
157
+ * @returns Formatted loading message
158
+ */
159
+ function formatLoading(message) {
160
+ return chalk_1.default.cyan('◷') + ' ' + message;
161
+ }
162
+ /**
163
+ * Truncate a string to a maximum length
164
+ *
165
+ * @param str - The string to truncate
166
+ * @param maxLength - The maximum length
167
+ * @returns Truncated string
168
+ */
169
+ function truncate(str, maxLength) {
170
+ if (str.length <= maxLength) {
171
+ return str;
172
+ }
173
+ return str.slice(0, maxLength - 3) + '...';
174
+ }
175
+ /**
176
+ * Format a timestamp
177
+ *
178
+ * @param date - The date to format
179
+ * @param options - Formatting options
180
+ * @returns Formatted timestamp
181
+ */
182
+ function formatTimestamp(date, options = {}) {
183
+ const d = typeof date === 'string' ? new Date(date) : date;
184
+ if (options.relative) {
185
+ const now = new Date();
186
+ const diffMs = now.getTime() - d.getTime();
187
+ const diffMins = Math.floor(diffMs / 60000);
188
+ const diffHours = Math.floor(diffMs / 3600000);
189
+ const diffDays = Math.floor(diffMs / 86400000);
190
+ if (diffMins < 1)
191
+ return 'just now';
192
+ if (diffMins < 60)
193
+ return `${diffMins} minute${diffMins === 1 ? '' : 's'} ago`;
194
+ if (diffHours < 24)
195
+ return `${diffHours} hour${diffHours === 1 ? '' : 's'} ago`;
196
+ if (diffDays < 7)
197
+ return `${diffDays} day${diffDays === 1 ? '' : 's'} ago`;
198
+ }
199
+ return d.toLocaleString();
200
+ }
201
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AAkBH,0BAQC;AASD,sBAMC;AAQD,0BAMC;AAQD,oBAMC;AASD,kCAYC;AASD,gCAEC;AAUD,wCAOC;AASD,sCAEC;AAQD,sCAEC;AAQD,kCAEC;AAQD,sCAEC;AASD,4BAKC;AASD,0CAoBC;AAxMD,kDAA0B;AAC1B,4DAA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AG,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;QAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;QAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC;QAE/C,IAAI,QAAQ,GAAG,CAAC;YAAE,OAAO,UAAU,CAAC;QACpC,IAAI,QAAQ,GAAG,EAAE;YAAE,OAAO,GAAG,QAAQ,UAAU,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;QAC/E,IAAI,SAAS,GAAG,EAAE;YAAE,OAAO,GAAG,SAAS,QAAQ,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;QAChF,IAAI,QAAQ,GAAG,CAAC;YAAE,OAAO,GAAG,QAAQ,OAAO,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAC7E,CAAC;IAED,OAAO,CAAC,CAAC,cAAc,EAAE,CAAC;AAC5B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@fractary/core-cli",
3
+ "version": "0.1.0",
4
+ "description": "CLI for Fractary Core SDK - work tracking, repository management, specifications, logging, file storage, and documentation",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "fractary-core": "dist/cli.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "dev": "tsc --watch",
17
+ "build": "tsc",
18
+ "test": "jest",
19
+ "test:watch": "jest --watch",
20
+ "test:coverage": "jest --coverage",
21
+ "lint": "eslint src --ext .ts",
22
+ "lint:fix": "eslint src --ext .ts --fix",
23
+ "typecheck": "tsc --noEmit",
24
+ "clean": "rm -rf dist",
25
+ "prepublishOnly": "npm run clean && npm run build"
26
+ },
27
+ "keywords": [
28
+ "fractary",
29
+ "core",
30
+ "cli",
31
+ "work",
32
+ "repository",
33
+ "git",
34
+ "github",
35
+ "gitlab",
36
+ "bitbucket",
37
+ "jira",
38
+ "linear",
39
+ "specification",
40
+ "logging",
41
+ "file-storage",
42
+ "documentation"
43
+ ],
44
+ "author": "Fractary Team",
45
+ "license": "MIT",
46
+ "dependencies": {
47
+ "@fractary/core": "^0.1.0",
48
+ "chalk": "^5.3.0",
49
+ "cli-table3": "^0.6.5",
50
+ "commander": "^11.1.0",
51
+ "inquirer": "^13.1.0"
52
+ },
53
+ "devDependencies": {
54
+ "@types/jest": "^30.0.0",
55
+ "@types/node": "^20.19.26",
56
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
57
+ "@typescript-eslint/parser": "^6.19.0",
58
+ "eslint": "^8.56.0",
59
+ "jest": "^29.7.0",
60
+ "ts-jest": "^29.1.1",
61
+ "typescript": "^5.3.3"
62
+ },
63
+ "engines": {
64
+ "node": ">=18.0.0"
65
+ },
66
+ "repository": {
67
+ "type": "git",
68
+ "url": "git+https://github.com/fractary/core.git",
69
+ "directory": "cli"
70
+ },
71
+ "bugs": {
72
+ "url": "https://github.com/fractary/core/issues"
73
+ },
74
+ "homepage": "https://github.com/fractary/core/tree/main/cli#readme",
75
+ "publishConfig": {
76
+ "access": "public"
77
+ }
78
+ }