@fleettools/fleet-shared 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.
- package/README.md +203 -0
- package/dist/config.d.ts +95 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +177 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/project.d.ts +41 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +264 -0
- package/dist/project.js.map +1 -0
- package/dist/runtime.d.ts +46 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +101 -0
- package/dist/runtime.js.map +1 -0
- package/dist/utils.d.ts +72 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +193 -0
- package/dist/utils.js.map +1 -0
- package/package.json +71 -0
package/README.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# @fleettools/fleet-shared
|
|
2
|
+
|
|
3
|
+
Shared utilities and configuration for FleetTools
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @fleettools/fleet-shared
|
|
9
|
+
# or
|
|
10
|
+
bun install @fleettools/fleet-shared
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
### Runtime Detection
|
|
16
|
+
```typescript
|
|
17
|
+
import { detectRuntime, getRuntimeInfo } from '@fleettools/fleet-shared/runtime';
|
|
18
|
+
|
|
19
|
+
const runtime = detectRuntime(); // 'bun' | 'node' | 'unknown'
|
|
20
|
+
const info = getRuntimeInfo();
|
|
21
|
+
// {
|
|
22
|
+
// type: 'bun',
|
|
23
|
+
// version: '1.0.0',
|
|
24
|
+
// platform: 'linux',
|
|
25
|
+
// arch: 'x64',
|
|
26
|
+
// supported: true,
|
|
27
|
+
// isBun: true,
|
|
28
|
+
// isNode: false
|
|
29
|
+
// }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Configuration Management
|
|
33
|
+
```typescript
|
|
34
|
+
import {
|
|
35
|
+
loadGlobalConfig,
|
|
36
|
+
saveGlobalConfig,
|
|
37
|
+
loadProjectConfig,
|
|
38
|
+
isFleetProject
|
|
39
|
+
} from '@fleettools/fleet-shared/config';
|
|
40
|
+
|
|
41
|
+
const globalConfig = loadGlobalConfig();
|
|
42
|
+
const projectConfig = loadProjectConfig();
|
|
43
|
+
const isProject = isFleetProject();
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Project Initialization
|
|
47
|
+
```typescript
|
|
48
|
+
import {
|
|
49
|
+
initializeProject,
|
|
50
|
+
getAvailableTemplates
|
|
51
|
+
} from '@fleettools/fleet-shared/project';
|
|
52
|
+
|
|
53
|
+
const templates = getAvailableTemplates(); // ['basic', 'agent']
|
|
54
|
+
const config = initializeProject('./my-project', 'basic', {
|
|
55
|
+
name: 'My Project',
|
|
56
|
+
services: { squawk: { enabled: true } }
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Utilities
|
|
61
|
+
```typescript
|
|
62
|
+
import {
|
|
63
|
+
commandExists,
|
|
64
|
+
sleep,
|
|
65
|
+
retry,
|
|
66
|
+
formatBytes,
|
|
67
|
+
formatDuration,
|
|
68
|
+
generateId
|
|
69
|
+
} from '@fleettools/fleet-shared/utils';
|
|
70
|
+
|
|
71
|
+
const hasNode = commandExists('node');
|
|
72
|
+
await sleep(1000);
|
|
73
|
+
const result = await retry(() => riskyOperation(), 3);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## API Reference
|
|
77
|
+
|
|
78
|
+
### Runtime Detection
|
|
79
|
+
|
|
80
|
+
- `detectRuntime(): RuntimeType` - Detect current JavaScript runtime
|
|
81
|
+
- `getRuntimeInfo(): RuntimeInfo` - Get detailed runtime information
|
|
82
|
+
- `isSupportedRuntime(): boolean` - Check if runtime is supported
|
|
83
|
+
- `getPreferredRuntime(): 'bun' | 'node'` - Get preferred runtime
|
|
84
|
+
|
|
85
|
+
### Configuration
|
|
86
|
+
|
|
87
|
+
- `loadGlobalConfig(): FleetGlobalConfig` - Load global configuration
|
|
88
|
+
- `saveGlobalConfig(config: FleetGlobalConfig): void` - Save global configuration
|
|
89
|
+
- `loadProjectConfig(): FleetProjectConfig | null` - Load project configuration
|
|
90
|
+
- `saveProjectConfig(config: FleetProjectConfig): void` - Save project configuration
|
|
91
|
+
- `isFleetProject(): boolean` - Check if directory is a FleetTools project
|
|
92
|
+
|
|
93
|
+
### Project Management
|
|
94
|
+
|
|
95
|
+
- `initializeProject(path, template, config): FleetProjectConfig` - Initialize new project
|
|
96
|
+
- `getAvailableTemplates(): string[]` - Get available project templates
|
|
97
|
+
- `getTemplateInfo(name): ProjectTemplate | null` - Get template information
|
|
98
|
+
- `isValidProject(path): boolean` - Validate project structure
|
|
99
|
+
- `getProjectRoot(): string | null` - Find project root directory
|
|
100
|
+
|
|
101
|
+
### Utilities
|
|
102
|
+
|
|
103
|
+
- `commandExists(command): boolean` - Check if command exists in PATH
|
|
104
|
+
- `sleep(ms): Promise<void>` - Sleep for specified milliseconds
|
|
105
|
+
- `retry(fn, maxAttempts, baseDelay): Promise<T>` - Retry with exponential backoff
|
|
106
|
+
- `formatBytes(bytes): string` - Format bytes to human readable string
|
|
107
|
+
- `formatDuration(ms): string` - Format duration to human readable string
|
|
108
|
+
- `generateId(length): string` - Generate random ID
|
|
109
|
+
- `deepClone(obj): T` - Deep clone object
|
|
110
|
+
- `isPromise(value): boolean` - Check if value is a promise
|
|
111
|
+
- `EventEmitter` - Simple event emitter class
|
|
112
|
+
|
|
113
|
+
## Types
|
|
114
|
+
|
|
115
|
+
### RuntimeInfo
|
|
116
|
+
```typescript
|
|
117
|
+
interface RuntimeInfo {
|
|
118
|
+
type: RuntimeType;
|
|
119
|
+
version: string;
|
|
120
|
+
platform: string;
|
|
121
|
+
arch: string;
|
|
122
|
+
supported: boolean;
|
|
123
|
+
isBun: boolean;
|
|
124
|
+
isNode: boolean;
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### FleetGlobalConfig
|
|
129
|
+
```typescript
|
|
130
|
+
interface FleetGlobalConfig {
|
|
131
|
+
version: string;
|
|
132
|
+
defaultRuntime: 'bun' | 'node';
|
|
133
|
+
telemetry: {
|
|
134
|
+
enabled: boolean;
|
|
135
|
+
endpoint?: string;
|
|
136
|
+
};
|
|
137
|
+
services: {
|
|
138
|
+
autoStart: boolean;
|
|
139
|
+
squawkPort: number;
|
|
140
|
+
apiPort: number;
|
|
141
|
+
};
|
|
142
|
+
paths: {
|
|
143
|
+
configDir: string;
|
|
144
|
+
dataDir: string;
|
|
145
|
+
logDir: string;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### FleetProjectConfig
|
|
151
|
+
```typescript
|
|
152
|
+
interface FleetProjectConfig {
|
|
153
|
+
name: string;
|
|
154
|
+
version: string;
|
|
155
|
+
fleet: {
|
|
156
|
+
version: string;
|
|
157
|
+
mode: 'local' | 'synced';
|
|
158
|
+
workspaceId?: string;
|
|
159
|
+
};
|
|
160
|
+
services: {
|
|
161
|
+
squawk: {
|
|
162
|
+
enabled: boolean;
|
|
163
|
+
port: number;
|
|
164
|
+
dataDir: string;
|
|
165
|
+
};
|
|
166
|
+
api: {
|
|
167
|
+
enabled: boolean;
|
|
168
|
+
port: number;
|
|
169
|
+
};
|
|
170
|
+
postgres: {
|
|
171
|
+
enabled: boolean;
|
|
172
|
+
provider: 'podman' | 'docker' | 'local';
|
|
173
|
+
port: number;
|
|
174
|
+
container?: string;
|
|
175
|
+
dataDir: string;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
plugins: {
|
|
179
|
+
claudeCode: boolean;
|
|
180
|
+
openCode: boolean;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Development
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
git clone https://github.com/v1truvius/fleettools.git
|
|
189
|
+
cd fleettools/packages/fleet-shared
|
|
190
|
+
bun install
|
|
191
|
+
bun run dev # Development mode with watch
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Testing
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
bun test
|
|
198
|
+
bun run test:coverage
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## License
|
|
202
|
+
|
|
203
|
+
MIT License - see LICENSE file for details.
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Management
|
|
3
|
+
*
|
|
4
|
+
* Global and project-level configuration for FleetTools
|
|
5
|
+
*/
|
|
6
|
+
export interface FleetGlobalConfig {
|
|
7
|
+
version: string;
|
|
8
|
+
defaultRuntime: 'bun' | 'node';
|
|
9
|
+
telemetry: {
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
endpoint?: string;
|
|
12
|
+
};
|
|
13
|
+
services: {
|
|
14
|
+
autoStart: boolean;
|
|
15
|
+
squawkPort: number;
|
|
16
|
+
apiPort: number;
|
|
17
|
+
};
|
|
18
|
+
paths: {
|
|
19
|
+
configDir: string;
|
|
20
|
+
dataDir: string;
|
|
21
|
+
logDir: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface FleetProjectConfig {
|
|
25
|
+
name: string;
|
|
26
|
+
version: string;
|
|
27
|
+
fleet: {
|
|
28
|
+
version: string;
|
|
29
|
+
mode: 'local' | 'synced';
|
|
30
|
+
workspaceId?: string;
|
|
31
|
+
};
|
|
32
|
+
services: {
|
|
33
|
+
squawk: {
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
port: number;
|
|
36
|
+
dataDir: string;
|
|
37
|
+
};
|
|
38
|
+
api: {
|
|
39
|
+
enabled: boolean;
|
|
40
|
+
port: number;
|
|
41
|
+
};
|
|
42
|
+
postgres: {
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
provider: 'podman' | 'docker' | 'local';
|
|
45
|
+
port: number;
|
|
46
|
+
container?: string;
|
|
47
|
+
dataDir: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
plugins: {
|
|
51
|
+
claudeCode: boolean;
|
|
52
|
+
openCode: boolean;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get the default global configuration
|
|
57
|
+
*/
|
|
58
|
+
export declare function getDefaultGlobalConfig(): FleetGlobalConfig;
|
|
59
|
+
/**
|
|
60
|
+
* Get the global configuration file path
|
|
61
|
+
*/
|
|
62
|
+
export declare function getGlobalConfigPath(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Load global configuration
|
|
65
|
+
*/
|
|
66
|
+
export declare function loadGlobalConfig(): FleetGlobalConfig;
|
|
67
|
+
/**
|
|
68
|
+
* Save global configuration
|
|
69
|
+
*/
|
|
70
|
+
export declare function saveGlobalConfig(config: FleetGlobalConfig): void;
|
|
71
|
+
/**
|
|
72
|
+
* Get the project configuration file path
|
|
73
|
+
*/
|
|
74
|
+
export declare function getProjectConfigPath(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Load project configuration
|
|
77
|
+
*/
|
|
78
|
+
export declare function loadProjectConfig(): FleetProjectConfig | null;
|
|
79
|
+
/**
|
|
80
|
+
* Get default project configuration
|
|
81
|
+
*/
|
|
82
|
+
export declare function getDefaultProjectConfig(): FleetProjectConfig;
|
|
83
|
+
/**
|
|
84
|
+
* Save project configuration
|
|
85
|
+
*/
|
|
86
|
+
export declare function saveProjectConfig(config: FleetProjectConfig): void;
|
|
87
|
+
/**
|
|
88
|
+
* Check if current directory is a FleetTools project
|
|
89
|
+
*/
|
|
90
|
+
export declare function isFleetProject(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Ensure all required directories exist
|
|
93
|
+
*/
|
|
94
|
+
export declare function ensureDirectories(config: FleetGlobalConfig): void;
|
|
95
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,KAAK,GAAG,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,QAAQ,EAAE;QACR,SAAS,EAAE,OAAO,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,KAAK,EAAE;QACL,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,QAAQ,EAAE;QACR,MAAM,EAAE;YACN,OAAO,EAAE,OAAO,CAAC;YACjB,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;QACF,GAAG,EAAE;YACH,OAAO,EAAE,OAAO,CAAC;YACjB,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;QACF,QAAQ,EAAE;YACR,OAAO,EAAE,OAAO,CAAC;YACjB,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;YACxC,IAAI,EAAE,MAAM,CAAC;YACb,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;IACF,OAAO,EAAE;QACP,UAAU,EAAE,OAAO,CAAC;QACpB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,iBAAiB,CAsB1D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,iBAAiB,CAepD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAUhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,kBAAkB,GAAG,IAAI,CAe7D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,kBAAkB,CA8B5D;AAuBD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAIlE;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAYjE"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Management
|
|
3
|
+
*
|
|
4
|
+
* Global and project-level configuration for FleetTools
|
|
5
|
+
*/
|
|
6
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
7
|
+
import { join, dirname } from 'node:path';
|
|
8
|
+
import { homedir } from 'node:os';
|
|
9
|
+
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
|
10
|
+
/**
|
|
11
|
+
* Get the default global configuration
|
|
12
|
+
*/
|
|
13
|
+
export function getDefaultGlobalConfig() {
|
|
14
|
+
const configDir = join(homedir(), '.config', 'fleet');
|
|
15
|
+
const dataDir = join(homedir(), '.local', 'share', 'fleet');
|
|
16
|
+
const logDir = join(homedir(), '.local', 'state', 'fleet', 'logs');
|
|
17
|
+
return {
|
|
18
|
+
version: '1.0.0',
|
|
19
|
+
defaultRuntime: 'bun',
|
|
20
|
+
telemetry: {
|
|
21
|
+
enabled: false
|
|
22
|
+
},
|
|
23
|
+
services: {
|
|
24
|
+
autoStart: false,
|
|
25
|
+
squawkPort: 3000,
|
|
26
|
+
apiPort: 3001
|
|
27
|
+
},
|
|
28
|
+
paths: {
|
|
29
|
+
configDir,
|
|
30
|
+
dataDir,
|
|
31
|
+
logDir
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get the global configuration file path
|
|
37
|
+
*/
|
|
38
|
+
export function getGlobalConfigPath() {
|
|
39
|
+
return join(homedir(), '.config', 'fleet', 'config.yaml');
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Load global configuration
|
|
43
|
+
*/
|
|
44
|
+
export function loadGlobalConfig() {
|
|
45
|
+
const configPath = getGlobalConfigPath();
|
|
46
|
+
if (!existsSync(configPath)) {
|
|
47
|
+
return getDefaultGlobalConfig();
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
51
|
+
const parsed = parseYaml(content);
|
|
52
|
+
return { ...getDefaultGlobalConfig(), ...parsed };
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
console.warn(`Failed to parse global config: ${error}`);
|
|
56
|
+
return getDefaultGlobalConfig();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Save global configuration
|
|
61
|
+
*/
|
|
62
|
+
export function saveGlobalConfig(config) {
|
|
63
|
+
const configPath = getGlobalConfigPath();
|
|
64
|
+
const configDir = dirname(configPath);
|
|
65
|
+
if (!existsSync(configDir)) {
|
|
66
|
+
mkdirSync(configDir, { recursive: true });
|
|
67
|
+
}
|
|
68
|
+
const content = stringifyYaml(config);
|
|
69
|
+
writeFileSync(configPath, content, 'utf-8');
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get the project configuration file path
|
|
73
|
+
*/
|
|
74
|
+
export function getProjectConfigPath() {
|
|
75
|
+
return join(process.cwd(), 'fleet.yaml');
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Load project configuration
|
|
79
|
+
*/
|
|
80
|
+
export function loadProjectConfig() {
|
|
81
|
+
const configPath = getProjectConfigPath();
|
|
82
|
+
if (!existsSync(configPath)) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
87
|
+
const parsed = parseYaml(content);
|
|
88
|
+
return getProjectConfigWithDefaults(parsed);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
console.warn(`Failed to parse project config: ${error}`);
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get default project configuration
|
|
97
|
+
*/
|
|
98
|
+
export function getDefaultProjectConfig() {
|
|
99
|
+
return {
|
|
100
|
+
name: 'fleet-project',
|
|
101
|
+
version: '1.0.0',
|
|
102
|
+
fleet: {
|
|
103
|
+
version: '0.1.0',
|
|
104
|
+
mode: 'local'
|
|
105
|
+
},
|
|
106
|
+
services: {
|
|
107
|
+
squawk: {
|
|
108
|
+
enabled: true,
|
|
109
|
+
port: 3000,
|
|
110
|
+
dataDir: './.fleet/squawk'
|
|
111
|
+
},
|
|
112
|
+
api: {
|
|
113
|
+
enabled: true,
|
|
114
|
+
port: 3001
|
|
115
|
+
},
|
|
116
|
+
postgres: {
|
|
117
|
+
enabled: false,
|
|
118
|
+
provider: 'podman',
|
|
119
|
+
port: 5432,
|
|
120
|
+
dataDir: './.fleet/postgres'
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
plugins: {
|
|
124
|
+
claudeCode: true,
|
|
125
|
+
openCode: true
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Merge user config with defaults
|
|
131
|
+
*/
|
|
132
|
+
function getProjectConfigWithDefaults(userConfig) {
|
|
133
|
+
const defaults = getDefaultProjectConfig();
|
|
134
|
+
return {
|
|
135
|
+
...defaults,
|
|
136
|
+
...userConfig,
|
|
137
|
+
fleet: { ...defaults.fleet, ...userConfig.fleet },
|
|
138
|
+
services: {
|
|
139
|
+
...defaults.services,
|
|
140
|
+
...userConfig.services,
|
|
141
|
+
squawk: { ...defaults.services.squawk, ...userConfig.services?.squawk },
|
|
142
|
+
api: { ...defaults.services.api, ...userConfig.services?.api },
|
|
143
|
+
postgres: { ...defaults.services.postgres, ...userConfig.services?.postgres }
|
|
144
|
+
},
|
|
145
|
+
plugins: { ...defaults.plugins, ...userConfig.plugins }
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Save project configuration
|
|
150
|
+
*/
|
|
151
|
+
export function saveProjectConfig(config) {
|
|
152
|
+
const configPath = getProjectConfigPath();
|
|
153
|
+
const content = stringifyYaml(config);
|
|
154
|
+
writeFileSync(configPath, content, 'utf-8');
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Check if current directory is a FleetTools project
|
|
158
|
+
*/
|
|
159
|
+
export function isFleetProject() {
|
|
160
|
+
return existsSync(getProjectConfigPath());
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Ensure all required directories exist
|
|
164
|
+
*/
|
|
165
|
+
export function ensureDirectories(config) {
|
|
166
|
+
const dirs = [
|
|
167
|
+
config.paths.configDir,
|
|
168
|
+
config.paths.dataDir,
|
|
169
|
+
config.paths.logDir
|
|
170
|
+
];
|
|
171
|
+
dirs.forEach(dir => {
|
|
172
|
+
if (!existsSync(dir)) {
|
|
173
|
+
mkdirSync(dir, { recursive: true });
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177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+
*
|
|
4
|
+
* Shared utilities, configuration, and runtime detection
|
|
5
|
+
*/
|
|
6
|
+
export * from './runtime.js';
|
|
7
|
+
export * from './config.js';
|
|
8
|
+
export * from './project.js';
|
|
9
|
+
export * from './utils.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FleetTools Shared Package
|
|
3
|
+
*
|
|
4
|
+
* Shared utilities, configuration, and runtime detection
|
|
5
|
+
*/
|
|
6
|
+
export * from './runtime.js';
|
|
7
|
+
export * from './config.js';
|
|
8
|
+
export * from './project.js';
|
|
9
|
+
export * from './utils.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project Management Utilities
|
|
3
|
+
*
|
|
4
|
+
* Utilities for managing FleetTools projects
|
|
5
|
+
*/
|
|
6
|
+
import { FleetProjectConfig } from './config.js';
|
|
7
|
+
/**
|
|
8
|
+
* Project template structure
|
|
9
|
+
*/
|
|
10
|
+
export interface ProjectTemplate {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
directories: string[];
|
|
14
|
+
files: Record<string, string>;
|
|
15
|
+
dependencies?: Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Available project templates
|
|
19
|
+
*/
|
|
20
|
+
export declare const PROJECT_TEMPLATES: Record<string, ProjectTemplate>;
|
|
21
|
+
/**
|
|
22
|
+
* Initialize a new FleetTools project
|
|
23
|
+
*/
|
|
24
|
+
export declare function initializeProject(projectPath: string, templateName: string, config?: Partial<FleetProjectConfig>): FleetProjectConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Get available templates
|
|
27
|
+
*/
|
|
28
|
+
export declare function getAvailableTemplates(): string[];
|
|
29
|
+
/**
|
|
30
|
+
* Get template information
|
|
31
|
+
*/
|
|
32
|
+
export declare function getTemplateInfo(templateName: string): ProjectTemplate | null;
|
|
33
|
+
/**
|
|
34
|
+
* Check if a directory is a valid FleetTools project
|
|
35
|
+
*/
|
|
36
|
+
export declare function isValidProject(projectPath: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Get project root directory (searches upward from current directory)
|
|
39
|
+
*/
|
|
40
|
+
export declare function getProjectRoot(): string | null;
|
|
41
|
+
//# sourceMappingURL=project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAoK7D,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,MAAM,GAAE,OAAO,CAAC,kBAAkB,CAAM,GACvC,kBAAkB,CAyDpB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAE5E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAG3D;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAW9C"}
|
package/dist/project.js
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project Management Utilities
|
|
3
|
+
*
|
|
4
|
+
* Utilities for managing FleetTools projects
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
/**
|
|
9
|
+
* Available project templates
|
|
10
|
+
*/
|
|
11
|
+
export const PROJECT_TEMPLATES = {
|
|
12
|
+
basic: {
|
|
13
|
+
name: 'Basic FleetTools Project',
|
|
14
|
+
description: 'A basic FleetTools setup for AI agent coordination',
|
|
15
|
+
directories: [
|
|
16
|
+
'.fleet/squawk',
|
|
17
|
+
'.fleet/postgres',
|
|
18
|
+
'.flightline/work-orders',
|
|
19
|
+
'.flightline/ctk',
|
|
20
|
+
'.flightline/tech-orders',
|
|
21
|
+
'spec',
|
|
22
|
+
'tests'
|
|
23
|
+
],
|
|
24
|
+
files: {
|
|
25
|
+
'.gitignore': `# FleetTools
|
|
26
|
+
.fleet/
|
|
27
|
+
.flightline/
|
|
28
|
+
*.log
|
|
29
|
+
|
|
30
|
+
# Dependencies
|
|
31
|
+
node_modules/
|
|
32
|
+
bun.lockb
|
|
33
|
+
package-lock.json
|
|
34
|
+
|
|
35
|
+
# IDE
|
|
36
|
+
.vscode/
|
|
37
|
+
.idea/
|
|
38
|
+
*.swp
|
|
39
|
+
*.swo
|
|
40
|
+
|
|
41
|
+
# OS
|
|
42
|
+
.DS_Store
|
|
43
|
+
Thumbs.db
|
|
44
|
+
`,
|
|
45
|
+
'README.md': `# FleetTools Project
|
|
46
|
+
|
|
47
|
+
This is a FleetTools project for AI agent coordination.
|
|
48
|
+
|
|
49
|
+
## Getting Started
|
|
50
|
+
|
|
51
|
+
1. Start FleetTools services:
|
|
52
|
+
\`\`\`bash
|
|
53
|
+
fleet start
|
|
54
|
+
\`\`\`
|
|
55
|
+
|
|
56
|
+
2. Check status:
|
|
57
|
+
\`\`\`bash
|
|
58
|
+
fleet status
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
3. View available commands:
|
|
62
|
+
\`\`\`bash
|
|
63
|
+
fleet --help
|
|
64
|
+
\`\`\`
|
|
65
|
+
|
|
66
|
+
## Project Structure
|
|
67
|
+
|
|
68
|
+
- \`.fleet/\` - Local FleetTools data and services
|
|
69
|
+
- \`.flightline/\` - Git-backed work tracking
|
|
70
|
+
- \`spec/\` - Project specifications
|
|
71
|
+
- \`tests/\` - Test files
|
|
72
|
+
|
|
73
|
+
## Learn More
|
|
74
|
+
|
|
75
|
+
Visit [FleetTools Documentation](https://github.com/v1truvius/fleettools) for more information.
|
|
76
|
+
`
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
agent: {
|
|
80
|
+
name: 'AI Agent Project',
|
|
81
|
+
description: 'Project template for developing AI agents with FleetTools integration',
|
|
82
|
+
directories: [
|
|
83
|
+
'.fleet/squawk',
|
|
84
|
+
'.fleet/postgres',
|
|
85
|
+
'.flightline/work-orders',
|
|
86
|
+
'.flightline/ctk',
|
|
87
|
+
'.flightline/tech-orders',
|
|
88
|
+
'src/agents',
|
|
89
|
+
'src/tasks',
|
|
90
|
+
'src/tools',
|
|
91
|
+
'spec/agents',
|
|
92
|
+
'tests',
|
|
93
|
+
'docs'
|
|
94
|
+
],
|
|
95
|
+
files: {
|
|
96
|
+
'.gitignore': `# FleetTools
|
|
97
|
+
.fleet/
|
|
98
|
+
.flightline/
|
|
99
|
+
*.log
|
|
100
|
+
|
|
101
|
+
# Dependencies
|
|
102
|
+
node_modules/
|
|
103
|
+
bun.lockb
|
|
104
|
+
package-lock.json
|
|
105
|
+
|
|
106
|
+
# IDE
|
|
107
|
+
.vscode/
|
|
108
|
+
.idea/
|
|
109
|
+
*.swp
|
|
110
|
+
*.swo
|
|
111
|
+
|
|
112
|
+
# OS
|
|
113
|
+
.DS_Store
|
|
114
|
+
Thumbs.db
|
|
115
|
+
`,
|
|
116
|
+
'README.md': `# AI Agent Project
|
|
117
|
+
|
|
118
|
+
A FleetTools project for developing and coordinating AI agents.
|
|
119
|
+
|
|
120
|
+
## Project Structure
|
|
121
|
+
|
|
122
|
+
- \`src/agents/\` - Agent implementations
|
|
123
|
+
- \`src/tasks/\` - Task definitions
|
|
124
|
+
- \`src/tools/\` - Tool implementations
|
|
125
|
+
- \`spec/agents/\` - Agent specifications
|
|
126
|
+
- \`docs/\` - Documentation
|
|
127
|
+
|
|
128
|
+
## Getting Started
|
|
129
|
+
|
|
130
|
+
1. Install dependencies:
|
|
131
|
+
\`\`\`bash
|
|
132
|
+
bun install
|
|
133
|
+
\`\`\`
|
|
134
|
+
|
|
135
|
+
2. Start FleetTools:
|
|
136
|
+
\`\`\`bash
|
|
137
|
+
fleet start
|
|
138
|
+
\`\`\`
|
|
139
|
+
|
|
140
|
+
3. Create your first agent:
|
|
141
|
+
\`\`\`bash
|
|
142
|
+
fleet agent create my-agent
|
|
143
|
+
\`\`\`
|
|
144
|
+
|
|
145
|
+
## Learn More
|
|
146
|
+
|
|
147
|
+
See the [FleetTools Documentation](https://github.com/v1truvius/fleettools) for detailed guides.
|
|
148
|
+
`,
|
|
149
|
+
'package.json': JSON.stringify({
|
|
150
|
+
name: 'my-fleet-agent',
|
|
151
|
+
version: '1.0.0',
|
|
152
|
+
description: 'A FleetTools AI agent project',
|
|
153
|
+
type: 'module',
|
|
154
|
+
scripts: {
|
|
155
|
+
'start': 'fleet start',
|
|
156
|
+
'test': 'bun test',
|
|
157
|
+
'build': 'bun build'
|
|
158
|
+
},
|
|
159
|
+
dependencies: {
|
|
160
|
+
'@fleettools/core': 'workspace:*',
|
|
161
|
+
'@fleettools/fleet-shared': 'workspace:*'
|
|
162
|
+
},
|
|
163
|
+
devDependencies: {
|
|
164
|
+
'typescript': '^5.9.3',
|
|
165
|
+
'@types/node': '^20.10.6'
|
|
166
|
+
}
|
|
167
|
+
}, null, 2)
|
|
168
|
+
},
|
|
169
|
+
dependencies: {
|
|
170
|
+
'@fleettools/core': 'workspace:*',
|
|
171
|
+
'@fleettools/fleet-shared': 'workspace:*'
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Initialize a new FleetTools project
|
|
177
|
+
*/
|
|
178
|
+
export function initializeProject(projectPath, templateName, config = {}) {
|
|
179
|
+
const template = PROJECT_TEMPLATES[templateName];
|
|
180
|
+
if (!template) {
|
|
181
|
+
throw new Error(`Unknown template: ${templateName}`);
|
|
182
|
+
}
|
|
183
|
+
// Create directories
|
|
184
|
+
template.directories.forEach(dir => {
|
|
185
|
+
const fullPath = join(projectPath, dir);
|
|
186
|
+
if (!existsSync(fullPath)) {
|
|
187
|
+
mkdirSync(fullPath, { recursive: true });
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
// Create files
|
|
191
|
+
Object.entries(template.files).forEach(([filePath, content]) => {
|
|
192
|
+
const fullPath = join(projectPath, filePath);
|
|
193
|
+
writeFileSync(fullPath, content, 'utf-8');
|
|
194
|
+
});
|
|
195
|
+
// Create project config
|
|
196
|
+
const projectConfig = {
|
|
197
|
+
name: config.name || template.name,
|
|
198
|
+
version: config.version || '1.0.0',
|
|
199
|
+
fleet: {
|
|
200
|
+
version: '0.1.0',
|
|
201
|
+
mode: 'local',
|
|
202
|
+
...config.fleet
|
|
203
|
+
},
|
|
204
|
+
services: {
|
|
205
|
+
squawk: {
|
|
206
|
+
enabled: true,
|
|
207
|
+
port: 3000,
|
|
208
|
+
dataDir: './.fleet/squawk',
|
|
209
|
+
...config.services?.squawk
|
|
210
|
+
},
|
|
211
|
+
api: {
|
|
212
|
+
enabled: true,
|
|
213
|
+
port: 3001,
|
|
214
|
+
...config.services?.api
|
|
215
|
+
},
|
|
216
|
+
postgres: {
|
|
217
|
+
enabled: false,
|
|
218
|
+
provider: 'podman',
|
|
219
|
+
port: 5432,
|
|
220
|
+
dataDir: './.fleet/postgres',
|
|
221
|
+
...config.services?.postgres
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
plugins: {
|
|
225
|
+
claudeCode: true,
|
|
226
|
+
openCode: true,
|
|
227
|
+
...config.plugins
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
return projectConfig;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Get available templates
|
|
234
|
+
*/
|
|
235
|
+
export function getAvailableTemplates() {
|
|
236
|
+
return Object.keys(PROJECT_TEMPLATES);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Get template information
|
|
240
|
+
*/
|
|
241
|
+
export function getTemplateInfo(templateName) {
|
|
242
|
+
return PROJECT_TEMPLATES[templateName] || null;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Check if a directory is a valid FleetTools project
|
|
246
|
+
*/
|
|
247
|
+
export function isValidProject(projectPath) {
|
|
248
|
+
const configPath = join(projectPath, 'fleet.yaml');
|
|
249
|
+
return existsSync(configPath);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Get project root directory (searches upward from current directory)
|
|
253
|
+
*/
|
|
254
|
+
export function getProjectRoot() {
|
|
255
|
+
let currentDir = process.cwd();
|
|
256
|
+
while (currentDir !== '/') {
|
|
257
|
+
if (isValidProject(currentDir)) {
|
|
258
|
+
return currentDir;
|
|
259
|
+
}
|
|
260
|
+
currentDir = join(currentDir, '..');
|
|
261
|
+
}
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAcjC;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAoC;IAChE,KAAK,EAAE;QACL,IAAI,EAAE,0BAA0B;QAChC,WAAW,EAAE,oDAAoD;QACjE,WAAW,EAAE;YACX,eAAe;YACf,iBAAiB;YACjB,yBAAyB;YACzB,iBAAiB;YACjB,yBAAyB;YACzB,MAAM;YACN,OAAO;SACR;QACD,KAAK,EAAE;YACL,YAAY,EAAE;;;;;;;;;;;;;;;;;;;CAmBnB;YACK,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BlB;SACI;KACF;IAED,KAAK,EAAE;QACL,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,uEAAuE;QACpF,WAAW,EAAE;YACX,eAAe;YACf,iBAAiB;YACjB,yBAAyB;YACzB,iBAAiB;YACjB,yBAAyB;YACzB,YAAY;YACZ,WAAW;YACX,WAAW;YACX,aAAa;YACb,OAAO;YACP,MAAM;SACP;QACD,KAAK,EAAE;YACL,YAAY,EAAE;;;;;;;;;;;;;;;;;;;CAmBnB;YACK,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgClB;YACK,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC;gBAC7B,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,OAAO;gBAChB,WAAW,EAAE,+BAA+B;gBAC5C,IAAI,EAAE,QAAQ;gBACd,OAAO,EA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ChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,IAAI,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE/B,OAAO,UAAU,KAAK,GAAG,EAAE,CAAC;QAC1B,IAAI,cAAc,CAAC,UAAU,CAAC,EAAE,CAAC;YAC/B,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime Detection and Information
|
|
3
|
+
*
|
|
4
|
+
* Utilities for detecting and managing different JavaScript runtimes
|
|
5
|
+
* Supports Bun and Node.js
|
|
6
|
+
*/
|
|
7
|
+
export type RuntimeType = 'bun' | 'node' | 'unknown';
|
|
8
|
+
export interface RuntimeInfo {
|
|
9
|
+
type: RuntimeType;
|
|
10
|
+
version: string;
|
|
11
|
+
platform: string;
|
|
12
|
+
arch: string;
|
|
13
|
+
supported: boolean;
|
|
14
|
+
isBun: boolean;
|
|
15
|
+
isNode: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Detect the current JavaScript runtime
|
|
19
|
+
*/
|
|
20
|
+
export declare function detectRuntime(): RuntimeType;
|
|
21
|
+
/**
|
|
22
|
+
* Get detailed runtime information
|
|
23
|
+
*/
|
|
24
|
+
export declare function getRuntimeInfo(): RuntimeInfo;
|
|
25
|
+
/**
|
|
26
|
+
* Check if the current runtime is supported
|
|
27
|
+
*/
|
|
28
|
+
export declare function isSupportedRuntime(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Get the preferred runtime for the current platform
|
|
31
|
+
* Defaults to Bun, falls back to Node.js
|
|
32
|
+
*/
|
|
33
|
+
export declare function getPreferredRuntime(): 'bun' | 'node';
|
|
34
|
+
/**
|
|
35
|
+
* Check if we're running in a development environment
|
|
36
|
+
*/
|
|
37
|
+
export declare function isDevelopment(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Get the appropriate executable for the preferred runtime
|
|
40
|
+
*/
|
|
41
|
+
export declare function getRuntimeExecutable(): string;
|
|
42
|
+
/**
|
|
43
|
+
* Create a require function that works across runtimes
|
|
44
|
+
*/
|
|
45
|
+
export declare function createCrossRuntimeRequire(): NodeJS.Require | ((id: string) => never);
|
|
46
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,WAAW,CAY3C;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,WAAW,CA4B5C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,KAAK,GAAG,MAAM,CAapD;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAG7C;AAED;;GAEG;AACH,wBAAgB,yBAAyB,2BAKzB,MAAM,YAIrB"}
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime Detection and Information
|
|
3
|
+
*
|
|
4
|
+
* Utilities for detecting and managing different JavaScript runtimes
|
|
5
|
+
* Supports Bun and Node.js
|
|
6
|
+
*/
|
|
7
|
+
import { platform, arch } from 'node:os';
|
|
8
|
+
import { createRequire } from 'node:module';
|
|
9
|
+
/**
|
|
10
|
+
* Detect the current JavaScript runtime
|
|
11
|
+
*/
|
|
12
|
+
export function detectRuntime() {
|
|
13
|
+
// Check for Bun first (it has global.Bun)
|
|
14
|
+
if (typeof globalThis.Bun !== 'undefined') {
|
|
15
|
+
return 'bun';
|
|
16
|
+
}
|
|
17
|
+
// Check for Node.js
|
|
18
|
+
if (typeof process !== 'undefined' && process.versions && process.versions.node) {
|
|
19
|
+
return 'node';
|
|
20
|
+
}
|
|
21
|
+
return 'unknown';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get detailed runtime information
|
|
25
|
+
*/
|
|
26
|
+
export function getRuntimeInfo() {
|
|
27
|
+
const type = detectRuntime();
|
|
28
|
+
let version = 'unknown';
|
|
29
|
+
let supported = false;
|
|
30
|
+
switch (type) {
|
|
31
|
+
case 'bun':
|
|
32
|
+
version = (globalThis.Bun?.version) || 'unknown';
|
|
33
|
+
supported = true; // Bun 1.0+ is supported
|
|
34
|
+
break;
|
|
35
|
+
case 'node':
|
|
36
|
+
version = process.versions.node || 'unknown';
|
|
37
|
+
const majorVersion = parseInt(version.split('.')[0], 10);
|
|
38
|
+
supported = majorVersion >= 18; // Node.js 18+ is supported
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
supported = false;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
type,
|
|
45
|
+
version,
|
|
46
|
+
platform: platform(),
|
|
47
|
+
arch: arch(),
|
|
48
|
+
supported,
|
|
49
|
+
isBun: type === 'bun',
|
|
50
|
+
isNode: type === 'node'
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Check if the current runtime is supported
|
|
55
|
+
*/
|
|
56
|
+
export function isSupportedRuntime() {
|
|
57
|
+
return getRuntimeInfo().supported;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get the preferred runtime for the current platform
|
|
61
|
+
* Defaults to Bun, falls back to Node.js
|
|
62
|
+
*/
|
|
63
|
+
export function getPreferredRuntime() {
|
|
64
|
+
const info = getRuntimeInfo();
|
|
65
|
+
if (info.isBun && info.supported) {
|
|
66
|
+
return 'bun';
|
|
67
|
+
}
|
|
68
|
+
if (info.isNode && info.supported) {
|
|
69
|
+
return 'node';
|
|
70
|
+
}
|
|
71
|
+
// Default to bun for new installations
|
|
72
|
+
return 'bun';
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Check if we're running in a development environment
|
|
76
|
+
*/
|
|
77
|
+
export function isDevelopment() {
|
|
78
|
+
return process.env.NODE_ENV === 'development' || process.env.NODE_ENV !== 'production';
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get the appropriate executable for the preferred runtime
|
|
82
|
+
*/
|
|
83
|
+
export function getRuntimeExecutable() {
|
|
84
|
+
const preferred = getPreferredRuntime();
|
|
85
|
+
return preferred;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Create a require function that works across runtimes
|
|
89
|
+
*/
|
|
90
|
+
export function createCrossRuntimeRequire() {
|
|
91
|
+
try {
|
|
92
|
+
return createRequire(import.meta.url);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// Fallback for environments where createRequire might not work
|
|
96
|
+
return (id) => {
|
|
97
|
+
throw new Error(`Cannot require module: ${id}`);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAW,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CA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U,kBAAkB;IAChC,OAAO,cAAc,EAAE,CAAC,SAAS,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;IAE9B,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,uCAAuC;IACvC,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC;AACzF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,SAAS,GAAG,mBAAmB,EAAE,CAAC;IACxC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB;IACvC,IAAI,CAAC;QACH,OAAO,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,+DAA+D;QAC/D,OAAO,CAAC,EAAU,EAAE,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;QAClD,CAAC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* General Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared utility functions for FleetTools
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Color utilities
|
|
8
|
+
*/
|
|
9
|
+
export declare const colors: {
|
|
10
|
+
reset: string;
|
|
11
|
+
bright: string;
|
|
12
|
+
dim: string;
|
|
13
|
+
red: string;
|
|
14
|
+
green: string;
|
|
15
|
+
yellow: string;
|
|
16
|
+
blue: string;
|
|
17
|
+
magenta: string;
|
|
18
|
+
cyan: string;
|
|
19
|
+
white: string;
|
|
20
|
+
gray: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Simple color formatter (fallback when chalk not available)
|
|
24
|
+
*/
|
|
25
|
+
export declare function colorize(text: string, color: keyof typeof colors): string;
|
|
26
|
+
/**
|
|
27
|
+
* Check if a command exists in PATH
|
|
28
|
+
*/
|
|
29
|
+
export declare function commandExists(command: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Find a file in parent directories
|
|
32
|
+
*/
|
|
33
|
+
export declare function findUp(filename: string, cwd?: string): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Sleep for a specified number of milliseconds
|
|
36
|
+
*/
|
|
37
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Retry an async function with exponential backoff
|
|
40
|
+
*/
|
|
41
|
+
export declare function retry<T>(fn: () => Promise<T>, maxAttempts?: number, baseDelay?: number): Promise<T>;
|
|
42
|
+
/**
|
|
43
|
+
* Format bytes to human readable string
|
|
44
|
+
*/
|
|
45
|
+
export declare function formatBytes(bytes: number): string;
|
|
46
|
+
/**
|
|
47
|
+
* Format duration to human readable string
|
|
48
|
+
*/
|
|
49
|
+
export declare function formatDuration(ms: number): string;
|
|
50
|
+
/**
|
|
51
|
+
* Generate a random ID
|
|
52
|
+
*/
|
|
53
|
+
export declare function generateId(length?: number): string;
|
|
54
|
+
/**
|
|
55
|
+
* Deep clone an object
|
|
56
|
+
*/
|
|
57
|
+
export declare function deepClone<T>(obj: T): T;
|
|
58
|
+
/**
|
|
59
|
+
* Check if a value is a promise
|
|
60
|
+
*/
|
|
61
|
+
export declare function isPromise(value: any): value is Promise<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Create a simple EventEmitter
|
|
64
|
+
*/
|
|
65
|
+
export declare class FleetEventEmitter {
|
|
66
|
+
private events;
|
|
67
|
+
on(event: string, listener: Function): void;
|
|
68
|
+
off(event: string, listener: Function): void;
|
|
69
|
+
emit(event: string, ...args: any[]): void;
|
|
70
|
+
removeAllListeners(event?: string): void;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;CAYlB,CAAC;AAEF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,OAAO,MAAM,GAAG,MAAM,CAEzE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAQtD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAYnF;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;GAEG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAC3B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,WAAW,GAAE,MAAU,EACvB,SAAS,GAAE,MAAa,GACvB,OAAO,CAAC,CAAC,CAAC,CAmBZ;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAYjD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,GAAE,MAAU,GAAG,MAAM,CASrD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAwBtC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,CAE3D;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAkC;IAEhD,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAO3C,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAS5C,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAYzC,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;CAOzC"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* General Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared utility functions for FleetTools
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
7
|
+
import { join, resolve } from 'node:path';
|
|
8
|
+
/**
|
|
9
|
+
* Color utilities
|
|
10
|
+
*/
|
|
11
|
+
export const colors = {
|
|
12
|
+
reset: '\x1b[0m',
|
|
13
|
+
bright: '\x1b[1m',
|
|
14
|
+
dim: '\x1b[2m',
|
|
15
|
+
red: '\x1b[31m',
|
|
16
|
+
green: '\x1b[32m',
|
|
17
|
+
yellow: '\x1b[33m',
|
|
18
|
+
blue: '\x1b[34m',
|
|
19
|
+
magenta: '\x1b[35m',
|
|
20
|
+
cyan: '\x1b[36m',
|
|
21
|
+
white: '\x1b[37m',
|
|
22
|
+
gray: '\x1b[90m'
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Simple color formatter (fallback when chalk not available)
|
|
26
|
+
*/
|
|
27
|
+
export function colorize(text, color) {
|
|
28
|
+
return `${colors[color]}${text}${colors.reset}`;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Check if a command exists in PATH
|
|
32
|
+
*/
|
|
33
|
+
export function commandExists(command) {
|
|
34
|
+
try {
|
|
35
|
+
const { execSync } = require('node:child_process');
|
|
36
|
+
execSync(`which ${command}`, { stdio: 'ignore' });
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Find a file in parent directories
|
|
45
|
+
*/
|
|
46
|
+
export function findUp(filename, cwd = process.cwd()) {
|
|
47
|
+
let currentDir = cwd;
|
|
48
|
+
while (currentDir !== '/') {
|
|
49
|
+
const filePath = join(currentDir, filename);
|
|
50
|
+
if (existsSync(filePath)) {
|
|
51
|
+
return filePath;
|
|
52
|
+
}
|
|
53
|
+
currentDir = resolve(currentDir, '..');
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Sleep for a specified number of milliseconds
|
|
59
|
+
*/
|
|
60
|
+
export function sleep(ms) {
|
|
61
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Retry an async function with exponential backoff
|
|
65
|
+
*/
|
|
66
|
+
export async function retry(fn, maxAttempts = 3, baseDelay = 1000) {
|
|
67
|
+
let lastError;
|
|
68
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
69
|
+
try {
|
|
70
|
+
return await fn();
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
lastError = error;
|
|
74
|
+
if (attempt === maxAttempts) {
|
|
75
|
+
throw lastError;
|
|
76
|
+
}
|
|
77
|
+
const delay = baseDelay * Math.pow(2, attempt - 1);
|
|
78
|
+
await sleep(delay);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
throw lastError;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Format bytes to human readable string
|
|
85
|
+
*/
|
|
86
|
+
export function formatBytes(bytes) {
|
|
87
|
+
if (bytes === 0)
|
|
88
|
+
return '0 B';
|
|
89
|
+
const k = 1024;
|
|
90
|
+
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
91
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
92
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Format duration to human readable string
|
|
96
|
+
*/
|
|
97
|
+
export function formatDuration(ms) {
|
|
98
|
+
if (ms < 1000)
|
|
99
|
+
return `${ms}ms`;
|
|
100
|
+
const seconds = Math.floor(ms / 1000);
|
|
101
|
+
const minutes = Math.floor(seconds / 60);
|
|
102
|
+
const hours = Math.floor(minutes / 60);
|
|
103
|
+
const days = Math.floor(hours / 24);
|
|
104
|
+
if (days > 0)
|
|
105
|
+
return `${days}d ${hours % 24}h`;
|
|
106
|
+
if (hours > 0)
|
|
107
|
+
return `${hours}h ${minutes % 60}m`;
|
|
108
|
+
if (minutes > 0)
|
|
109
|
+
return `${minutes}m ${seconds % 60}s`;
|
|
110
|
+
return `${seconds}s`;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Generate a random ID
|
|
114
|
+
*/
|
|
115
|
+
export function generateId(length = 8) {
|
|
116
|
+
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
|
117
|
+
let result = '';
|
|
118
|
+
for (let i = 0; i < length; i++) {
|
|
119
|
+
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
120
|
+
}
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Deep clone an object
|
|
125
|
+
*/
|
|
126
|
+
export function deepClone(obj) {
|
|
127
|
+
if (obj === null || typeof obj !== 'object') {
|
|
128
|
+
return obj;
|
|
129
|
+
}
|
|
130
|
+
if (obj instanceof Date) {
|
|
131
|
+
return new Date(obj.getTime());
|
|
132
|
+
}
|
|
133
|
+
if (obj instanceof Array) {
|
|
134
|
+
return obj.map(item => deepClone(item));
|
|
135
|
+
}
|
|
136
|
+
if (typeof obj === 'object') {
|
|
137
|
+
const cloned = {};
|
|
138
|
+
for (const key in obj) {
|
|
139
|
+
if (obj.hasOwnProperty(key)) {
|
|
140
|
+
cloned[key] = deepClone(obj[key]);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return cloned;
|
|
144
|
+
}
|
|
145
|
+
return obj;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Check if a value is a promise
|
|
149
|
+
*/
|
|
150
|
+
export function isPromise(value) {
|
|
151
|
+
return value !== null && value !== undefined && typeof value.then === 'function';
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Create a simple EventEmitter
|
|
155
|
+
*/
|
|
156
|
+
export class FleetEventEmitter {
|
|
157
|
+
events = {};
|
|
158
|
+
on(event, listener) {
|
|
159
|
+
if (!this.events[event]) {
|
|
160
|
+
this.events[event] = [];
|
|
161
|
+
}
|
|
162
|
+
this.events[event].push(listener);
|
|
163
|
+
}
|
|
164
|
+
off(event, listener) {
|
|
165
|
+
if (!this.events[event])
|
|
166
|
+
return;
|
|
167
|
+
const index = this.events[event].indexOf(listener);
|
|
168
|
+
if (index > -1) {
|
|
169
|
+
this.events[event].splice(index, 1);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
emit(event, ...args) {
|
|
173
|
+
if (!this.events[event])
|
|
174
|
+
return;
|
|
175
|
+
this.events[event].forEach(listener => {
|
|
176
|
+
try {
|
|
177
|
+
listener(...args);
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
console.error(`Error in event listener for '${event}':`, error);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
removeAllListeners(event) {
|
|
185
|
+
if (event) {
|
|
186
|
+
delete this.events[event];
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
this.events = {};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,KAA0B;IAC/D,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,IAAI,CAAC;QACH,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACnD,QAAQ,CAAC,SAAS,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,QAAgB,EAAE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AC;IACL,CAAC;IAED,kBAAkB,CAAC,KAAc;QAC/B,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fleettools/fleet-shared",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared utilities and configuration for FleetTools",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./config": {
|
|
14
|
+
"types": "./dist/config.d.ts",
|
|
15
|
+
"import": "./dist/config.js"
|
|
16
|
+
},
|
|
17
|
+
"./runtime": {
|
|
18
|
+
"types": "./dist/runtime.d.ts",
|
|
19
|
+
"import": "./dist/runtime.js"
|
|
20
|
+
},
|
|
21
|
+
"./project": {
|
|
22
|
+
"types": "./dist/project.d.ts",
|
|
23
|
+
"import": "./dist/project.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc && bun run build:types",
|
|
28
|
+
"build:types": "tsc --emitDeclarationOnly",
|
|
29
|
+
"build:bun": "bun build src/index.ts --outdir dist --target bun --format esm",
|
|
30
|
+
"dev": "bun --watch src/index.ts",
|
|
31
|
+
"test": "bun test",
|
|
32
|
+
"test:watch": "bun test --watch",
|
|
33
|
+
"test:coverage": "bun test --coverage",
|
|
34
|
+
"prepublishOnly": "bun run build && bun run test"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"yaml": "^2.3.4",
|
|
38
|
+
"chalk": "^5.3.0",
|
|
39
|
+
"@fleettools/core": "^0.1.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^25.0.9",
|
|
43
|
+
"typescript": "^5.9.3"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"dist",
|
|
47
|
+
"README.md"
|
|
48
|
+
],
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"bun": ">=1.0.0",
|
|
54
|
+
"node": ">=18.0.0"
|
|
55
|
+
},
|
|
56
|
+
"keywords": [
|
|
57
|
+
"fleettools",
|
|
58
|
+
"shared",
|
|
59
|
+
"utilities",
|
|
60
|
+
"configuration"
|
|
61
|
+
],
|
|
62
|
+
"repository": {
|
|
63
|
+
"type": "git",
|
|
64
|
+
"url": "git+https://github.com/v1truv1us/fleettools.git",
|
|
65
|
+
"directory": "packages/fleet-shared"
|
|
66
|
+
},
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://github.com/v1truvius/fleettools/issues"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://github.com/v1truvius/fleettools#readme"
|
|
71
|
+
}
|