sphereai-cli 1.0.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 (70) hide show
  1. package/README.md +529 -0
  2. package/dist/commands/auth.d.ts +3 -0
  3. package/dist/commands/auth.d.ts.map +1 -0
  4. package/dist/commands/auth.js +194 -0
  5. package/dist/commands/auth.js.map +1 -0
  6. package/dist/commands/execute.d.ts +3 -0
  7. package/dist/commands/execute.d.ts.map +1 -0
  8. package/dist/commands/execute.js +165 -0
  9. package/dist/commands/execute.js.map +1 -0
  10. package/dist/commands/files.d.ts +3 -0
  11. package/dist/commands/files.d.ts.map +1 -0
  12. package/dist/commands/files.js +235 -0
  13. package/dist/commands/files.js.map +1 -0
  14. package/dist/commands/models.d.ts +3 -0
  15. package/dist/commands/models.d.ts.map +1 -0
  16. package/dist/commands/models.js +70 -0
  17. package/dist/commands/models.js.map +1 -0
  18. package/dist/commands/prompts.d.ts +3 -0
  19. package/dist/commands/prompts.d.ts.map +1 -0
  20. package/dist/commands/prompts.js +72 -0
  21. package/dist/commands/prompts.js.map +1 -0
  22. package/dist/index.d.ts +3 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +103 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/services/api-client.d.ts +16 -0
  27. package/dist/services/api-client.d.ts.map +1 -0
  28. package/dist/services/api-client.js +125 -0
  29. package/dist/services/api-client.js.map +1 -0
  30. package/dist/services/auth-service.d.ts +28 -0
  31. package/dist/services/auth-service.d.ts.map +1 -0
  32. package/dist/services/auth-service.js +171 -0
  33. package/dist/services/auth-service.js.map +1 -0
  34. package/dist/services/cli-api-client.d.ts +20 -0
  35. package/dist/services/cli-api-client.d.ts.map +1 -0
  36. package/dist/services/cli-api-client.js +83 -0
  37. package/dist/services/cli-api-client.js.map +1 -0
  38. package/dist/services/config-service.d.ts +43 -0
  39. package/dist/services/config-service.d.ts.map +1 -0
  40. package/dist/services/config-service.js +97 -0
  41. package/dist/services/config-service.js.map +1 -0
  42. package/dist/services/file-tracking-service.d.ts +62 -0
  43. package/dist/services/file-tracking-service.d.ts.map +1 -0
  44. package/dist/services/file-tracking-service.js +207 -0
  45. package/dist/services/file-tracking-service.js.map +1 -0
  46. package/dist/types/api-types.d.ts +67 -0
  47. package/dist/types/api-types.d.ts.map +1 -0
  48. package/dist/types/api-types.js +10 -0
  49. package/dist/types/api-types.js.map +1 -0
  50. package/dist/utils/errors.d.ts +35 -0
  51. package/dist/utils/errors.d.ts.map +1 -0
  52. package/dist/utils/errors.js +82 -0
  53. package/dist/utils/errors.js.map +1 -0
  54. package/dist/utils/file-walker.d.ts +31 -0
  55. package/dist/utils/file-walker.d.ts.map +1 -0
  56. package/dist/utils/file-walker.js +118 -0
  57. package/dist/utils/file-walker.js.map +1 -0
  58. package/dist/utils/formatters.d.ts +35 -0
  59. package/dist/utils/formatters.d.ts.map +1 -0
  60. package/dist/utils/formatters.js +101 -0
  61. package/dist/utils/formatters.js.map +1 -0
  62. package/dist/utils/ignore-parser.d.ts +21 -0
  63. package/dist/utils/ignore-parser.d.ts.map +1 -0
  64. package/dist/utils/ignore-parser.js +170 -0
  65. package/dist/utils/ignore-parser.js.map +1 -0
  66. package/dist/utils/sphereignore.d.ts +34 -0
  67. package/dist/utils/sphereignore.d.ts.map +1 -0
  68. package/dist/utils/sphereignore.js +148 -0
  69. package/dist/utils/sphereignore.js.map +1 -0
  70. package/package.json +48 -0
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Parse .sphereignore file and return patterns to ignore
3
+ * Similar to .gitignore syntax
4
+ */
5
+ export declare class SphereIgnore {
6
+ private patterns;
7
+ private ignoreFilePath;
8
+ constructor(cwd?: string);
9
+ /**
10
+ * Load patterns from .sphereignore file
11
+ */
12
+ private loadPatterns;
13
+ /**
14
+ * Check if a file path should be ignored
15
+ */
16
+ shouldIgnore(filePath: string): boolean;
17
+ /**
18
+ * Convert a glob-like pattern to a RegExp
19
+ */
20
+ private patternToRegex;
21
+ /**
22
+ * Get all patterns
23
+ */
24
+ getPatterns(): string[];
25
+ /**
26
+ * Check if .sphereignore file exists
27
+ */
28
+ exists(): boolean;
29
+ /**
30
+ * Get the path to .sphereignore file
31
+ */
32
+ getFilePath(): string;
33
+ }
34
+ //# sourceMappingURL=sphereignore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sphereignore.d.ts","sourceRoot":"","sources":["../../src/utils/sphereignore.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,cAAc,CAAS;gBAEnB,GAAG,GAAE,MAAsB;IAKvC;;OAEG;IACH,OAAO,CAAC,YAAY;IAwCpB;;OAEG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAyB9C;;OAEG;IACH,OAAO,CAAC,cAAc;IAUtB;;OAEG;IACI,WAAW,IAAI,MAAM,EAAE;IAI9B;;OAEG;IACI,MAAM,IAAI,OAAO;IAIxB;;OAEG;IACI,WAAW,IAAI,MAAM;CAG7B"}
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.SphereIgnore = void 0;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ /**
40
+ * Parse .sphereignore file and return patterns to ignore
41
+ * Similar to .gitignore syntax
42
+ */
43
+ class SphereIgnore {
44
+ constructor(cwd = process.cwd()) {
45
+ this.patterns = [];
46
+ this.ignoreFilePath = path.join(cwd, '.sphereignore');
47
+ this.loadPatterns();
48
+ }
49
+ /**
50
+ * Load patterns from .sphereignore file
51
+ */
52
+ loadPatterns() {
53
+ try {
54
+ if (fs.existsSync(this.ignoreFilePath)) {
55
+ const content = fs.readFileSync(this.ignoreFilePath, 'utf-8');
56
+ this.patterns = content
57
+ .split('\n')
58
+ .map(line => line.trim())
59
+ .filter(line => line && !line.startsWith('#')); // Remove empty lines and comments
60
+ }
61
+ else {
62
+ // Default patterns if no .sphereignore exists
63
+ this.patterns = [
64
+ 'node_modules',
65
+ '.git',
66
+ 'dist',
67
+ 'build',
68
+ '.env',
69
+ '.env.*',
70
+ '*.log',
71
+ '.DS_Store',
72
+ 'coverage',
73
+ '.vscode',
74
+ '.idea'
75
+ ];
76
+ }
77
+ }
78
+ catch (error) {
79
+ // If file doesn't exist or can't be read, use default patterns
80
+ this.patterns = [
81
+ 'node_modules',
82
+ '.git',
83
+ 'dist',
84
+ 'build',
85
+ '.env',
86
+ '.env.*',
87
+ '*.log',
88
+ '.DS_Store',
89
+ 'coverage'
90
+ ];
91
+ }
92
+ }
93
+ /**
94
+ * Check if a file path should be ignored
95
+ */
96
+ shouldIgnore(filePath) {
97
+ const normalizedPath = filePath.replace(/\\/g, '/');
98
+ return this.patterns.some(pattern => {
99
+ // Handle directory patterns (ending with /)
100
+ if (pattern.endsWith('/')) {
101
+ const dirPattern = pattern.slice(0, -1);
102
+ return normalizedPath.startsWith(dirPattern + '/') ||
103
+ normalizedPath.includes('/' + dirPattern + '/');
104
+ }
105
+ // Handle wildcard patterns
106
+ if (pattern.includes('*')) {
107
+ const regex = this.patternToRegex(pattern);
108
+ return regex.test(normalizedPath);
109
+ }
110
+ // Handle exact matches and directory matches
111
+ return normalizedPath === pattern ||
112
+ normalizedPath.startsWith(pattern + '/') ||
113
+ normalizedPath.includes('/' + pattern + '/') ||
114
+ normalizedPath.includes('/' + pattern);
115
+ });
116
+ }
117
+ /**
118
+ * Convert a glob-like pattern to a RegExp
119
+ */
120
+ patternToRegex(pattern) {
121
+ const regexPattern = pattern
122
+ .replace(/\./g, '\\.')
123
+ .replace(/\*\*/g, '.*')
124
+ .replace(/\*/g, '[^/]*')
125
+ .replace(/\?/g, '.');
126
+ return new RegExp(`(^|/)${regexPattern}($|/)`);
127
+ }
128
+ /**
129
+ * Get all patterns
130
+ */
131
+ getPatterns() {
132
+ return [...this.patterns];
133
+ }
134
+ /**
135
+ * Check if .sphereignore file exists
136
+ */
137
+ exists() {
138
+ return fs.existsSync(this.ignoreFilePath);
139
+ }
140
+ /**
141
+ * Get the path to .sphereignore file
142
+ */
143
+ getFilePath() {
144
+ return this.ignoreFilePath;
145
+ }
146
+ }
147
+ exports.SphereIgnore = SphereIgnore;
148
+ //# sourceMappingURL=sphereignore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sphereignore.js","sourceRoot":"","sources":["../../src/utils/sphereignore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B;;;GAGG;AACH,MAAa,YAA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OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,MAAM;QACX,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,WAAW;QAChB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF;AAjHD,oCAiHC"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "sphereai-cli",
3
+ "version": "1.0.0",
4
+ "description": "CLI tool for interacting with the SphereAI API",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "sphereai": "./dist/index.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "dev": "tsc --watch",
12
+ "start": "node dist/index.js",
13
+ "prepare": "npm run build",
14
+ "clean": "rimraf dist"
15
+ },
16
+ "keywords": [
17
+ "cli",
18
+ "sphereai",
19
+ "ai",
20
+ "api",
21
+ "rest"
22
+ ],
23
+ "author": "Nava Tech For Business",
24
+ "license": "ISC",
25
+ "dependencies": {
26
+ "axios": "^1.6.7",
27
+ "chalk": "^4.1.2",
28
+ "cli-table3": "^0.6.3",
29
+ "commander": "^12.0.0",
30
+ "conf": "^10.2.0",
31
+ "dotenv": "^17.2.3",
32
+ "express": "^4.18.2",
33
+ "open": "^8.4.2",
34
+ "ora": "^5.4.1"
35
+ },
36
+ "devDependencies": {
37
+ "@types/express": "^4.17.21",
38
+ "@types/node": "^20.11.17",
39
+ "rimraf": "^5.0.5",
40
+ "typescript": "^5.3.3"
41
+ },
42
+ "engines": {
43
+ "node": ">=14.0.0"
44
+ },
45
+ "files": [
46
+ "dist"
47
+ ]
48
+ }