@aiagentflow/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 (155) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +232 -0
  3. package/dist/agents/base.d.ts +69 -0
  4. package/dist/agents/base.d.ts.map +1 -0
  5. package/dist/agents/base.js +78 -0
  6. package/dist/agents/base.js.map +1 -0
  7. package/dist/agents/factory.d.ts +21 -0
  8. package/dist/agents/factory.d.ts.map +1 -0
  9. package/dist/agents/factory.js +50 -0
  10. package/dist/agents/factory.js.map +1 -0
  11. package/dist/agents/roles/architect.d.ts +23 -0
  12. package/dist/agents/roles/architect.d.ts.map +1 -0
  13. package/dist/agents/roles/architect.js +39 -0
  14. package/dist/agents/roles/architect.js.map +1 -0
  15. package/dist/agents/roles/coder.d.ts +19 -0
  16. package/dist/agents/roles/coder.d.ts.map +1 -0
  17. package/dist/agents/roles/coder.js +38 -0
  18. package/dist/agents/roles/coder.js.map +1 -0
  19. package/dist/agents/roles/fixer.d.ts +19 -0
  20. package/dist/agents/roles/fixer.d.ts.map +1 -0
  21. package/dist/agents/roles/fixer.js +29 -0
  22. package/dist/agents/roles/fixer.js.map +1 -0
  23. package/dist/agents/roles/judge.d.ts +24 -0
  24. package/dist/agents/roles/judge.d.ts.map +1 -0
  25. package/dist/agents/roles/judge.js +38 -0
  26. package/dist/agents/roles/judge.js.map +1 -0
  27. package/dist/agents/roles/reviewer.d.ts +28 -0
  28. package/dist/agents/roles/reviewer.d.ts.map +1 -0
  29. package/dist/agents/roles/reviewer.js +49 -0
  30. package/dist/agents/roles/reviewer.js.map +1 -0
  31. package/dist/agents/roles/tester.d.ts +19 -0
  32. package/dist/agents/roles/tester.d.ts.map +1 -0
  33. package/dist/agents/roles/tester.js +29 -0
  34. package/dist/agents/roles/tester.js.map +1 -0
  35. package/dist/agents/types.d.ts +13 -0
  36. package/dist/agents/types.d.ts.map +1 -0
  37. package/dist/agents/types.js +25 -0
  38. package/dist/agents/types.js.map +1 -0
  39. package/dist/cli/commands/config.d.ts +9 -0
  40. package/dist/cli/commands/config.d.ts.map +1 -0
  41. package/dist/cli/commands/config.js +30 -0
  42. package/dist/cli/commands/config.js.map +1 -0
  43. package/dist/cli/commands/doctor.d.ts +12 -0
  44. package/dist/cli/commands/doctor.d.ts.map +1 -0
  45. package/dist/cli/commands/doctor.js +63 -0
  46. package/dist/cli/commands/doctor.js.map +1 -0
  47. package/dist/cli/commands/init.d.ts +12 -0
  48. package/dist/cli/commands/init.d.ts.map +1 -0
  49. package/dist/cli/commands/init.js +231 -0
  50. package/dist/cli/commands/init.js.map +1 -0
  51. package/dist/cli/commands/run.d.ts +11 -0
  52. package/dist/cli/commands/run.d.ts.map +1 -0
  53. package/dist/cli/commands/run.js +66 -0
  54. package/dist/cli/commands/run.js.map +1 -0
  55. package/dist/cli/index.d.ts +9 -0
  56. package/dist/cli/index.d.ts.map +1 -0
  57. package/dist/cli/index.js +24 -0
  58. package/dist/cli/index.js.map +1 -0
  59. package/dist/core/config/defaults.d.ts +22 -0
  60. package/dist/core/config/defaults.d.ts.map +1 -0
  61. package/dist/core/config/defaults.js +60 -0
  62. package/dist/core/config/defaults.js.map +1 -0
  63. package/dist/core/config/manager.d.ts +45 -0
  64. package/dist/core/config/manager.d.ts.map +1 -0
  65. package/dist/core/config/manager.js +106 -0
  66. package/dist/core/config/manager.js.map +1 -0
  67. package/dist/core/config/schema.d.ts +780 -0
  68. package/dist/core/config/schema.d.ts.map +1 -0
  69. package/dist/core/config/schema.js +102 -0
  70. package/dist/core/config/schema.js.map +1 -0
  71. package/dist/core/config/types.d.ts +24 -0
  72. package/dist/core/config/types.d.ts.map +1 -0
  73. package/dist/core/config/types.js +11 -0
  74. package/dist/core/config/types.js.map +1 -0
  75. package/dist/core/errors.d.ts +36 -0
  76. package/dist/core/errors.d.ts.map +1 -0
  77. package/dist/core/errors.js +60 -0
  78. package/dist/core/errors.js.map +1 -0
  79. package/dist/core/workflow/approval.d.ts +22 -0
  80. package/dist/core/workflow/approval.d.ts.map +1 -0
  81. package/dist/core/workflow/approval.js +54 -0
  82. package/dist/core/workflow/approval.js.map +1 -0
  83. package/dist/core/workflow/engine.d.ts +128 -0
  84. package/dist/core/workflow/engine.d.ts.map +1 -0
  85. package/dist/core/workflow/engine.js +159 -0
  86. package/dist/core/workflow/engine.js.map +1 -0
  87. package/dist/core/workflow/file-parser.d.ts +41 -0
  88. package/dist/core/workflow/file-parser.d.ts.map +1 -0
  89. package/dist/core/workflow/file-parser.js +138 -0
  90. package/dist/core/workflow/file-parser.js.map +1 -0
  91. package/dist/core/workflow/qa-policy.d.ts +55 -0
  92. package/dist/core/workflow/qa-policy.d.ts.map +1 -0
  93. package/dist/core/workflow/qa-policy.js +119 -0
  94. package/dist/core/workflow/qa-policy.js.map +1 -0
  95. package/dist/core/workflow/runner.d.ts +30 -0
  96. package/dist/core/workflow/runner.d.ts.map +1 -0
  97. package/dist/core/workflow/runner.js +273 -0
  98. package/dist/core/workflow/runner.js.map +1 -0
  99. package/dist/core/workflow/session.d.ts +37 -0
  100. package/dist/core/workflow/session.d.ts.map +1 -0
  101. package/dist/core/workflow/session.js +93 -0
  102. package/dist/core/workflow/session.js.map +1 -0
  103. package/dist/core/workflow/task-queue.d.ts +46 -0
  104. package/dist/core/workflow/task-queue.d.ts.map +1 -0
  105. package/dist/core/workflow/task-queue.js +106 -0
  106. package/dist/core/workflow/task-queue.js.map +1 -0
  107. package/dist/core/workflow/test-runner.d.ts +25 -0
  108. package/dist/core/workflow/test-runner.d.ts.map +1 -0
  109. package/dist/core/workflow/test-runner.js +50 -0
  110. package/dist/core/workflow/test-runner.js.map +1 -0
  111. package/dist/core/workflow/token-tracker.d.ts +54 -0
  112. package/dist/core/workflow/token-tracker.d.ts.map +1 -0
  113. package/dist/core/workflow/token-tracker.js +98 -0
  114. package/dist/core/workflow/token-tracker.js.map +1 -0
  115. package/dist/git/client.d.ts +47 -0
  116. package/dist/git/client.d.ts.map +1 -0
  117. package/dist/git/client.js +109 -0
  118. package/dist/git/client.js.map +1 -0
  119. package/dist/prompts/library.d.ts +35 -0
  120. package/dist/prompts/library.d.ts.map +1 -0
  121. package/dist/prompts/library.js +238 -0
  122. package/dist/prompts/library.js.map +1 -0
  123. package/dist/providers/anthropic.d.ts +55 -0
  124. package/dist/providers/anthropic.d.ts.map +1 -0
  125. package/dist/providers/anthropic.js +237 -0
  126. package/dist/providers/anthropic.js.map +1 -0
  127. package/dist/providers/ollama.d.ts +44 -0
  128. package/dist/providers/ollama.d.ts.map +1 -0
  129. package/dist/providers/ollama.js +211 -0
  130. package/dist/providers/ollama.js.map +1 -0
  131. package/dist/providers/registry.d.ts +36 -0
  132. package/dist/providers/registry.d.ts.map +1 -0
  133. package/dist/providers/registry.js +91 -0
  134. package/dist/providers/registry.js.map +1 -0
  135. package/dist/providers/types.d.ts +100 -0
  136. package/dist/providers/types.d.ts.map +1 -0
  137. package/dist/providers/types.js +12 -0
  138. package/dist/providers/types.js.map +1 -0
  139. package/dist/types/index.d.ts +11 -0
  140. package/dist/types/index.d.ts.map +1 -0
  141. package/dist/types/index.js +9 -0
  142. package/dist/types/index.js.map +1 -0
  143. package/dist/utils/fs.d.ts +30 -0
  144. package/dist/utils/fs.d.ts.map +1 -0
  145. package/dist/utils/fs.js +80 -0
  146. package/dist/utils/fs.js.map +1 -0
  147. package/dist/utils/logger.d.ts +46 -0
  148. package/dist/utils/logger.d.ts.map +1 -0
  149. package/dist/utils/logger.js +87 -0
  150. package/dist/utils/logger.js.map +1 -0
  151. package/dist/utils/validation.d.ts +28 -0
  152. package/dist/utils/validation.d.ts.map +1 -0
  153. package/dist/utils/validation.js +38 -0
  154. package/dist/utils/validation.js.map +1 -0
  155. package/package.json +62 -0
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Provider registry — factory that creates the correct provider from config.
3
+ *
4
+ * New providers are added by:
5
+ * 1. Create the adapter file in src/providers/
6
+ * 2. Register it in the PROVIDER_FACTORIES map below
7
+ * 3. Add the name to LLMProviderName type in types.ts
8
+ *
9
+ * Dependency direction: registry.ts → types.ts, anthropic.ts, ollama.ts, errors.ts
10
+ * Used by: workflow engine, CLI doctor command
11
+ */
12
+ import { AnthropicProvider } from './anthropic.js';
13
+ import { OllamaProvider } from './ollama.js';
14
+ import { ProviderError } from '../core/errors.js';
15
+ import { logger } from '../utils/logger.js';
16
+ /**
17
+ * Factory functions for each provider.
18
+ * Add new providers here — this is the ONLY place that needs to change.
19
+ */
20
+ const PROVIDER_FACTORIES = {
21
+ anthropic: (config) => {
22
+ const anthropicConfig = config.anthropic;
23
+ if (!anthropicConfig) {
24
+ throw new ProviderError('Anthropic provider is not configured. Run "aiagentflow init" to set up.', { provider: 'anthropic' });
25
+ }
26
+ return new AnthropicProvider(anthropicConfig);
27
+ },
28
+ ollama: (config) => {
29
+ const ollamaConfig = config.ollama;
30
+ return new OllamaProvider(ollamaConfig);
31
+ },
32
+ };
33
+ /** Cache of created provider instances (one per provider name). */
34
+ const providerCache = new Map();
35
+ /**
36
+ * Create (or return cached) a provider instance by name.
37
+ *
38
+ * @param name - The provider name ('anthropic' | 'ollama')
39
+ * @param config - The providers section of the app config
40
+ * @returns An LLMProvider instance
41
+ * @throws {ProviderError} if the provider name is unknown or config is missing
42
+ */
43
+ export function createProvider(name, config) {
44
+ // Return cached instance if available
45
+ const cached = providerCache.get(name);
46
+ if (cached)
47
+ return cached;
48
+ const factory = PROVIDER_FACTORIES[name];
49
+ if (!factory) {
50
+ throw new ProviderError(`Unknown provider: "${name}". Available: ${Object.keys(PROVIDER_FACTORIES).join(', ')}`, { provider: name, available: Object.keys(PROVIDER_FACTORIES) });
51
+ }
52
+ logger.debug(`Creating provider: ${name}`);
53
+ const provider = factory(config);
54
+ providerCache.set(name, provider);
55
+ return provider;
56
+ }
57
+ /**
58
+ * Clear the provider cache (useful for testing or config changes).
59
+ */
60
+ export function clearProviderCache() {
61
+ providerCache.clear();
62
+ }
63
+ /**
64
+ * Get all supported provider names.
65
+ */
66
+ export function getSupportedProviders() {
67
+ return Object.keys(PROVIDER_FACTORIES);
68
+ }
69
+ /**
70
+ * Validate all configured providers can connect.
71
+ * Returns a map of provider name → connection status.
72
+ */
73
+ export async function validateAllProviders(config) {
74
+ const results = {};
75
+ for (const name of getSupportedProviders()) {
76
+ try {
77
+ // Only validate providers that are actually configured
78
+ if (name === 'anthropic' && !config.anthropic) {
79
+ results[name] = false;
80
+ continue;
81
+ }
82
+ const provider = createProvider(name, config);
83
+ results[name] = await provider.validateConnection();
84
+ }
85
+ catch {
86
+ results[name] = false;
87
+ }
88
+ }
89
+ return results;
90
+ }
91
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/providers/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,iBAAiB,EAAgC,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,cAAc,EAA6B,MAAM,aAAa,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;;GAGG;AACH,MAAM,kBAAkB,GAAqE;IACzF,SAAS,EAAE,CAAC,MAAsB,EAAE,EAAE;QAClC,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC;QACzC,IAAI,CAAC,eAAe,EAAE,CAAC;YACnB,MAAM,IAAI,aAAa,CACnB,yEAAyE,EACzE,EAAE,QAAQ,EAAE,WAAW,EAAE,CAC5B,CAAC;QACN,CAAC;QACD,OAAO,IAAI,iBAAiB,CAAC,eAA0C,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,EAAE,CAAC,MAAsB,EAAE,EAAE;QAC/B,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;QACnC,OAAO,IAAI,cAAc,CAAC,YAAgD,CAAC,CAAC;IAChF,CAAC;CACJ,CAAC;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CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;gBAC5C,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;gBACtB,SAAS;YACb,CAAC;YAED,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAC9C,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,QAAQ,CAAC,kBAAkB,EAAE,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QAC1B,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * LLM Provider interface contract.
3
+ *
4
+ * Every provider adapter (Anthropic, Ollama, future OpenAI, etc.)
5
+ * MUST implement the LLMProvider interface. This ensures consumers
6
+ * never depend on provider-specific details.
7
+ *
8
+ * Dependency direction: providers/types.ts → nothing (leaf module)
9
+ * Used by: all provider implementations, registry, agents, workflow engine
10
+ */
11
+ /** Supported LLM provider names. Add new providers here. */
12
+ export type LLMProviderName = 'anthropic' | 'ollama';
13
+ /** Role in a chat conversation. */
14
+ export type ChatRole = 'system' | 'user' | 'assistant';
15
+ /** A single message in a chat conversation. */
16
+ export interface ChatMessage {
17
+ readonly role: ChatRole;
18
+ readonly content: string;
19
+ }
20
+ /** Options for a chat completion request. */
21
+ export interface ChatOptions {
22
+ /** Model to use (overrides default from config). */
23
+ readonly model?: string;
24
+ /** Sampling temperature (0.0 - 2.0). */
25
+ readonly temperature?: number;
26
+ /** Maximum tokens in the response. */
27
+ readonly maxTokens?: number;
28
+ /** Stop sequences to halt generation. */
29
+ readonly stopSequences?: readonly string[];
30
+ /** System prompt (some providers handle this separately). */
31
+ readonly systemPrompt?: string;
32
+ }
33
+ /** Response from a non-streaming chat completion. */
34
+ export interface ChatResponse {
35
+ /** The generated text content. */
36
+ readonly content: string;
37
+ /** The model that was used. */
38
+ readonly model: string;
39
+ /** Token usage statistics. */
40
+ readonly usage: TokenUsage;
41
+ /** Provider-specific finish reason. */
42
+ readonly finishReason: string;
43
+ }
44
+ /** A single chunk in a streaming response. */
45
+ export interface ChatChunk {
46
+ /** Incremental text content. */
47
+ readonly content: string;
48
+ /** Whether this is the final chunk. */
49
+ readonly done: boolean;
50
+ }
51
+ /** Token usage statistics for a request. */
52
+ export interface TokenUsage {
53
+ readonly promptTokens: number;
54
+ readonly completionTokens: number;
55
+ readonly totalTokens: number;
56
+ }
57
+ /** Information about an available model. */
58
+ export interface ModelInfo {
59
+ readonly id: string;
60
+ readonly name: string;
61
+ readonly provider: LLMProviderName;
62
+ /** Context window size in tokens, if known. */
63
+ readonly contextWindow?: number;
64
+ }
65
+ /**
66
+ * The contract that every LLM provider adapter MUST implement.
67
+ *
68
+ * Adding a new provider means:
69
+ * 1. Create `src/providers/<name>.ts` implementing this interface
70
+ * 2. Register it in `src/providers/registry.ts`
71
+ * 3. Add the name to LLMProviderName type above
72
+ *
73
+ * That's it. Zero changes to consumers.
74
+ */
75
+ export interface LLMProvider {
76
+ /** The provider's unique identifier. */
77
+ readonly name: LLMProviderName;
78
+ /**
79
+ * Send a chat completion request and get the full response.
80
+ * @throws {ProviderError} on API failure, network error, or invalid response.
81
+ */
82
+ chat(messages: ChatMessage[], options?: ChatOptions): Promise<ChatResponse>;
83
+ /**
84
+ * Send a streaming chat completion request.
85
+ * Yields incremental text chunks as they arrive.
86
+ * @throws {ProviderError} on API failure, network error, or invalid response.
87
+ */
88
+ stream(messages: ChatMessage[], options?: ChatOptions): AsyncIterable<ChatChunk>;
89
+ /**
90
+ * List all models available from this provider.
91
+ * @throws {ProviderError} if the provider cannot be reached.
92
+ */
93
+ listModels(): Promise<ModelInfo[]>;
94
+ /**
95
+ * Validate that the provider connection is working (API key valid, server reachable).
96
+ * Returns true if healthy, false otherwise. Should NOT throw.
97
+ */
98
+ validateConnection(): Promise<boolean>;
99
+ }
100
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @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W,UAAU;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAChC;AAED,4CAA4C;AAC5C,MAAM,WAAW,SAAS;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,+CAA+C;IAC/C,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IACxB,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAE/B;;;OAGG;IACH,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAE5E;;;;OAIG;IACH,MAAM,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;IAEjF;;;OAGG;IACH,UAAU,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAEnC;;;OAGG;IACH,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * LLM Provider interface contract.
3
+ *
4
+ * Every provider adapter (Anthropic, Ollama, future OpenAI, etc.)
5
+ * MUST implement the LLMProvider interface. This ensures consumers
6
+ * never depend on provider-specific details.
7
+ *
8
+ * Dependency direction: providers/types.ts → nothing (leaf module)
9
+ * Used by: all provider implementations, registry, agents, workflow engine
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Global shared types re-exported from a single entry point.
3
+ *
4
+ * Dependency direction: types/index.ts → nothing (leaf module)
5
+ * Used by: every layer that needs shared type definitions
6
+ */
7
+ export { AppError, ConfigError, ProviderError, GitError, WorkflowError, ValidationError, } from '../core/errors.js';
8
+ export type { AppConfig, ProviderConfig, ProjectConfig, WorkflowConfig, AgentConfig, AgentRoleConfig, } from '../core/config/types.js';
9
+ export type { LLMProvider, ChatMessage, ChatOptions, ChatResponse, ChatChunk, ModelInfo, LLMProviderName, } from '../providers/types.js';
10
+ export type { AgentRole } from '../agents/types.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACH,QAAQ,EACR,WAAW,EACX,aAAa,EACb,QAAQ,EACR,aAAa,EACb,eAAe,GAClB,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EACR,SAAS,EACT,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,eAAe,GAClB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,SAAS,EACT,eAAe,GAClB,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Global shared types re-exported from a single entry point.
3
+ *
4
+ * Dependency direction: types/index.ts → nothing (leaf module)
5
+ * Used by: every layer that needs shared type definitions
6
+ */
7
+ // Re-export all error types
8
+ export { AppError, ConfigError, ProviderError, GitError, WorkflowError, ValidationError, } from '../core/errors.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,4BAA4B;AAC5B,OAAO,EACH,QAAQ,EACR,WAAW,EACX,aAAa,EACb,QAAQ,EACR,aAAa,EACb,eAAe,GAClB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * File system helpers with consistent error handling.
3
+ *
4
+ * Dependency direction: fs.ts → node:fs, node:path, errors.ts
5
+ * Used by: config manager, CLI commands
6
+ */
7
+ /**
8
+ * Read a JSON file and parse it.
9
+ * @throws {ConfigError} if the file doesn't exist or contains invalid JSON.
10
+ */
11
+ export declare function readJsonFile<T>(filePath: string): T;
12
+ /**
13
+ * Write data to a JSON file, creating parent directories if needed.
14
+ * @throws {ConfigError} if the write fails.
15
+ */
16
+ export declare function writeJsonFile(filePath: string, data: unknown): void;
17
+ /**
18
+ * Ensure a directory exists, creating it recursively if needed.
19
+ */
20
+ export declare function ensureDir(dirPath: string): void;
21
+ /**
22
+ * Check if a file exists at the given path.
23
+ */
24
+ export declare function fileExists(filePath: string): boolean;
25
+ /**
26
+ * Read a text file and return its contents.
27
+ * @throws {ConfigError} if the file doesn't exist.
28
+ */
29
+ export declare function readTextFile(filePath: string): string;
30
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,CAiBnD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAgBnE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAK/C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQrD"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * File system helpers with consistent error handling.
3
+ *
4
+ * Dependency direction: fs.ts → node:fs, node:path, errors.ts
5
+ * Used by: config manager, CLI commands
6
+ */
7
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
8
+ import { dirname, resolve } from 'node:path';
9
+ import { ConfigError } from '../core/errors.js';
10
+ /**
11
+ * Read a JSON file and parse it.
12
+ * @throws {ConfigError} if the file doesn't exist or contains invalid JSON.
13
+ */
14
+ export function readJsonFile(filePath) {
15
+ const absolutePath = resolve(filePath);
16
+ if (!existsSync(absolutePath)) {
17
+ throw new ConfigError(`File not found: ${absolutePath}`, { filePath: absolutePath });
18
+ }
19
+ try {
20
+ const content = readFileSync(absolutePath, 'utf-8');
21
+ return JSON.parse(content);
22
+ }
23
+ catch (err) {
24
+ if (err instanceof ConfigError)
25
+ throw err;
26
+ throw new ConfigError(`Failed to parse JSON file: ${absolutePath}`, {
27
+ filePath: absolutePath,
28
+ originalError: err instanceof Error ? err.message : String(err),
29
+ });
30
+ }
31
+ }
32
+ /**
33
+ * Write data to a JSON file, creating parent directories if needed.
34
+ * @throws {ConfigError} if the write fails.
35
+ */
36
+ export function writeJsonFile(filePath, data) {
37
+ const absolutePath = resolve(filePath);
38
+ try {
39
+ const dir = dirname(absolutePath);
40
+ if (!existsSync(dir)) {
41
+ mkdirSync(dir, { recursive: true });
42
+ }
43
+ writeFileSync(absolutePath, JSON.stringify(data, null, 2) + '\n', 'utf-8');
44
+ }
45
+ catch (err) {
46
+ if (err instanceof ConfigError)
47
+ throw err;
48
+ throw new ConfigError(`Failed to write file: ${absolutePath}`, {
49
+ filePath: absolutePath,
50
+ originalError: err instanceof Error ? err.message : String(err),
51
+ });
52
+ }
53
+ }
54
+ /**
55
+ * Ensure a directory exists, creating it recursively if needed.
56
+ */
57
+ export function ensureDir(dirPath) {
58
+ const absolutePath = resolve(dirPath);
59
+ if (!existsSync(absolutePath)) {
60
+ mkdirSync(absolutePath, { recursive: true });
61
+ }
62
+ }
63
+ /**
64
+ * Check if a file exists at the given path.
65
+ */
66
+ export function fileExists(filePath) {
67
+ return existsSync(resolve(filePath));
68
+ }
69
+ /**
70
+ * Read a text file and return its contents.
71
+ * @throws {ConfigError} if the file doesn't exist.
72
+ */
73
+ export function readTextFile(filePath) {
74
+ const absolutePath = resolve(filePath);
75
+ if (!existsSync(absolutePath)) {
76
+ throw new ConfigError(`File not found: ${absolutePath}`, { filePath: absolutePath });
77
+ }
78
+ return readFileSync(absolutePath, 'utf-8');
79
+ }
80
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAI,QAAgB;IAC5C,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEvC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,WAAW,CAAC,mBAAmB,YAAY,EAAE,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;IACzF,CAAC;IAED,IAAI,CAAC;QACD,MAAM,OAAO,GAAG,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAM,CAAC;IACpC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,IAAI,GAAG,YAAY,WAAW;YAAE,MAAM,GAAG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AE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,QAAgB;IACvC,OAAO,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AACzC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IACzC,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEvC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,WAAW,CAAC,mBAAmB,YAAY,EAAE,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;IACzF,CAAC;IAED,OAAO,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Structured console logger with chalk colors and log levels.
3
+ *
4
+ * Dependency direction: logger.ts → chalk (external only)
5
+ * Used by: every layer for consistent logging output
6
+ */
7
+ export declare enum LogLevel {
8
+ Debug = 0,
9
+ Info = 1,
10
+ Warn = 2,
11
+ Error = 3,
12
+ Silent = 4
13
+ }
14
+ /** Set the global log level. */
15
+ export declare function setLogLevel(level: LogLevel): void;
16
+ /** Get the current global log level. */
17
+ export declare function getLogLevel(): LogLevel;
18
+ /** Log a debug message (grey, only shown at Debug level). */
19
+ export declare function debug(message: string, ...args: unknown[]): void;
20
+ /** Log an info message (blue). */
21
+ export declare function info(message: string, ...args: unknown[]): void;
22
+ /** Log a success message (green). */
23
+ export declare function success(message: string, ...args: unknown[]): void;
24
+ /** Log a warning message (yellow). */
25
+ export declare function warn(message: string, ...args: unknown[]): void;
26
+ /** Log an error message (red). */
27
+ export declare function error(message: string, ...args: unknown[]): void;
28
+ /** Log a step in a process (cyan, with step number). */
29
+ export declare function step(stepNumber: number, total: number, message: string): void;
30
+ /** Log a blank line for readability. */
31
+ export declare function blank(): void;
32
+ /** Log a header/banner (bold white). */
33
+ export declare function header(message: string): void;
34
+ export declare const logger: {
35
+ debug: typeof debug;
36
+ info: typeof info;
37
+ success: typeof success;
38
+ warn: typeof warn;
39
+ error: typeof error;
40
+ step: typeof step;
41
+ blank: typeof blank;
42
+ header: typeof header;
43
+ setLogLevel: typeof setLogLevel;
44
+ getLogLevel: typeof getLogLevel;
45
+ };
46
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,oBAAY,QAAQ;IAChB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;IACT,MAAM,IAAI;CACb;AAID,gCAAgC;AAChC,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAEjD;AAED,wCAAwC;AACxC,wBAAgB,WAAW,IAAI,QAAQ,CAEtC;AAED,6DAA6D;AAC7D,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAI/D;AAED,kCAAkC;AAClC,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAI9D;AAED,qCAAqC;AACrC,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAIjE;AAED,sCAAsC;AACtC,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAI9D;AAED,kCAAkC;AAClC,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAI/D;AAED,wDAAwD;AACxD,wBAAgB,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAI7E;AAED,wCAAwC;AACxC,wBAAgB,KAAK,IAAI,IAAI,CAI5B;AAED,wCAAwC;AACxC,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAM5C;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;CAWlB,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Structured console logger with chalk colors and log levels.
3
+ *
4
+ * Dependency direction: logger.ts → chalk (external only)
5
+ * Used by: every layer for consistent logging output
6
+ */
7
+ import chalk from 'chalk';
8
+ export var LogLevel;
9
+ (function (LogLevel) {
10
+ LogLevel[LogLevel["Debug"] = 0] = "Debug";
11
+ LogLevel[LogLevel["Info"] = 1] = "Info";
12
+ LogLevel[LogLevel["Warn"] = 2] = "Warn";
13
+ LogLevel[LogLevel["Error"] = 3] = "Error";
14
+ LogLevel[LogLevel["Silent"] = 4] = "Silent";
15
+ })(LogLevel || (LogLevel = {}));
16
+ let currentLevel = LogLevel.Info;
17
+ /** Set the global log level. */
18
+ export function setLogLevel(level) {
19
+ currentLevel = level;
20
+ }
21
+ /** Get the current global log level. */
22
+ export function getLogLevel() {
23
+ return currentLevel;
24
+ }
25
+ /** Log a debug message (grey, only shown at Debug level). */
26
+ export function debug(message, ...args) {
27
+ if (currentLevel <= LogLevel.Debug) {
28
+ console.debug(chalk.gray(`[DEBUG] ${message}`), ...args);
29
+ }
30
+ }
31
+ /** Log an info message (blue). */
32
+ export function info(message, ...args) {
33
+ if (currentLevel <= LogLevel.Info) {
34
+ console.info(chalk.blue(`[INFO] ${message}`), ...args);
35
+ }
36
+ }
37
+ /** Log a success message (green). */
38
+ export function success(message, ...args) {
39
+ if (currentLevel <= LogLevel.Info) {
40
+ console.info(chalk.green(`✔ ${message}`), ...args);
41
+ }
42
+ }
43
+ /** Log a warning message (yellow). */
44
+ export function warn(message, ...args) {
45
+ if (currentLevel <= LogLevel.Warn) {
46
+ console.warn(chalk.yellow(`[WARN] ${message}`), ...args);
47
+ }
48
+ }
49
+ /** Log an error message (red). */
50
+ export function error(message, ...args) {
51
+ if (currentLevel <= LogLevel.Error) {
52
+ console.error(chalk.red(`[ERROR] ${message}`), ...args);
53
+ }
54
+ }
55
+ /** Log a step in a process (cyan, with step number). */
56
+ export function step(stepNumber, total, message) {
57
+ if (currentLevel <= LogLevel.Info) {
58
+ console.info(chalk.cyan(`[${stepNumber}/${total}] ${message}`));
59
+ }
60
+ }
61
+ /** Log a blank line for readability. */
62
+ export function blank() {
63
+ if (currentLevel <= LogLevel.Info) {
64
+ console.log();
65
+ }
66
+ }
67
+ /** Log a header/banner (bold white). */
68
+ export function header(message) {
69
+ if (currentLevel <= LogLevel.Info) {
70
+ console.log();
71
+ console.log(chalk.bold.white(message));
72
+ console.log(chalk.gray('─'.repeat(Math.min(message.length + 4, 60))));
73
+ }
74
+ }
75
+ export const logger = {
76
+ debug,
77
+ info,
78
+ success,
79
+ warn,
80
+ error,
81
+ step,
82
+ blank,
83
+ header,
84
+ setLogLevel,
85
+ getLogLevel,
86
+ };
87
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAN,IAAY,QAMX;AAND,WAAY,QAAQ;IAChB,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,uCAAQ,CAAA;IACR,yCAAS,CAAA;IACT,2CAAU,CAAA;AACd,CAAC,EANW,QAAQ,KAAR,QAAQ,QAMnB;AAED,IAAI,YAAY,GAAa,QAAQ,CAAC,IAAI,CAAC;AAE3C,gCAAgC;AAChC,MAAM,UAAU,WAAW,CAAC,KAAe;IACvC,YAAY,GAAG,KAAK,CAAC;AACzB,CAAC;AAED,wCAAwC;AACxC,MAAM,UAAU,WAAW;IACvB,OAAO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O,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAC5D,CAAC;AACL,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,IAAI,CAAC,UAAkB,EAAE,KAAa,EAAE,OAAe;IACnE,IAAI,YAAY,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC;IACpE,CAAC;AACL,CAAC;AAED,wCAAwC;AACxC,MAAM,UAAU,KAAK;IACjB,IAAI,YAAY,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChC,OAAO,CAAC,GAAG,EAAE,CAAC;IAClB,CAAC;AACL,CAAC;AAED,wCAAwC;AACxC,MAAM,UAAU,MAAM,CAAC,OAAe;IAClC,IAAI,YAAY,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChC,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,KAAK;IACL,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;IACL,MAAM;IACN,WAAW;IACX,WAAW;CACd,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Common validators for user input and data.
3
+ *
4
+ * Dependency direction: validation.ts → zod
5
+ * Used by: CLI commands, config module
6
+ */
7
+ import { z } from 'zod';
8
+ /** Validate that a string is a non-empty trimmed string. */
9
+ export declare const nonEmptyString: z.ZodString;
10
+ /** Validate a URL string. */
11
+ export declare const urlString: z.ZodString;
12
+ /** Validate a port number (1-65535). */
13
+ export declare const portNumber: z.ZodNumber;
14
+ /**
15
+ * Validate that an API key looks reasonable (non-empty, no whitespace).
16
+ * Does NOT validate against the provider — just basic format.
17
+ */
18
+ export declare const apiKeyFormat: z.ZodEffects<z.ZodString, string, string>;
19
+ /**
20
+ * Validate a model name string (alphanumeric, hyphens, colons, dots, slashes).
21
+ * Examples: "claude-3-5-sonnet-20241022", "llama3.2:latest", "gpt-4o"
22
+ */
23
+ export declare const modelName: z.ZodString;
24
+ /**
25
+ * Validate a positive integer within a reasonable range.
26
+ */
27
+ export declare function positiveInt(max?: number): z.ZodNumber;
28
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4DAA4D;AAC5D,eAAO,MAAM,cAAc,aAAoD,CAAC;AAEhF,6BAA6B;AAC7B,eAAO,MAAM,SAAS,aAAwC,CAAC;AAE/D,wCAAwC;AACxC,eAAO,MAAM,UAAU,aAAqC,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,YAAY,2CAImD,CAAC;AAE7E;;;GAGG;AACH,eAAO,MAAM,SAAS,aAOjB,CAAC;AAEN;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,GAAE,MAAY,GAAG,CAAC,CAAC,SAAS,CAE1D"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Common validators for user input and data.
3
+ *
4
+ * Dependency direction: validation.ts → zod
5
+ * Used by: CLI commands, config module
6
+ */
7
+ import { z } from 'zod';
8
+ /** Validate that a string is a non-empty trimmed string. */
9
+ export const nonEmptyString = z.string().trim().min(1, 'Value cannot be empty');
10
+ /** Validate a URL string. */
11
+ export const urlString = z.string().url('Must be a valid URL');
12
+ /** Validate a port number (1-65535). */
13
+ export const portNumber = z.number().int().min(1).max(65535);
14
+ /**
15
+ * Validate that an API key looks reasonable (non-empty, no whitespace).
16
+ * Does NOT validate against the provider — just basic format.
17
+ */
18
+ export const apiKeyFormat = z
19
+ .string()
20
+ .trim()
21
+ .min(8, 'API key seems too short')
22
+ .refine((val) => !/\s/.test(val), 'API key must not contain whitespace');
23
+ /**
24
+ * Validate a model name string (alphanumeric, hyphens, colons, dots, slashes).
25
+ * Examples: "claude-3-5-sonnet-20241022", "llama3.2:latest", "gpt-4o"
26
+ */
27
+ export const modelName = z
28
+ .string()
29
+ .trim()
30
+ .min(1, 'Model name cannot be empty')
31
+ .regex(/^[a-zA-Z0-9][a-zA-Z0-9\-_.:\/]*$/, 'Model name must start with alphanumeric and contain only alphanumeric, hyphens, underscores, dots, colons, or slashes');
32
+ /**
33
+ * Validate a positive integer within a reasonable range.
34
+ */
35
+ export function positiveInt(max = 100) {
36
+ return z.number().int().min(1).max(max);
37
+ }
38
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4DAA4D;AAC5D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC;AAEhF,6BAA6B;AAC7B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAE/D,wCAAwC;AACxC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAE7D;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KACxB,MAAM,EAAE;KACR,IAAI,EAAE;KACN,GAAG,CAAC,CAAC,EAAE,yBAAyB,CAAC;KACjC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,qCAAqC,CAAC,CAAC;AAE7E;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC;KACrB,MAAM,EAAE;KACR,IAAI,EAAE;KACN,GAAG,CAAC,CAAC,EAAE,4BAA4B,CAAC;KACpC,KAAK,CACF,kCAAkC,EAClC,uHAAuH,CAC1H,CAAC;AAEN;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc,GAAG;IACzC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC5C,CAAC"}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@aiagentflow/cli",
3
+ "version": "0.1.0",
4
+ "description": "A local-first, CLI-driven multi-agent AI software engineering workflow orchestrator",
5
+ "type": "module",
6
+ "bin": {
7
+ "aiagentflow": "./dist/cli/index.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/aiagentflow/aiagentflow.git"
17
+ },
18
+ "homepage": "https://aiagentflow.dev",
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "dev": "tsx src/cli/index.ts",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest",
24
+ "lint": "eslint src/",
25
+ "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
26
+ "typecheck": "tsc --noEmit"
27
+ },
28
+ "engines": {
29
+ "node": ">=20.0.0"
30
+ },
31
+ "keywords": [
32
+ "ai",
33
+ "workflow",
34
+ "multi-agent",
35
+ "cli",
36
+ "orchestrator",
37
+ "code-review",
38
+ "testing",
39
+ "automation"
40
+ ],
41
+ "license": "MIT",
42
+ "dependencies": {
43
+ "chalk": "^5.3.0",
44
+ "commander": "^12.1.0",
45
+ "execa": "^9.5.2",
46
+ "ora": "^8.1.1",
47
+ "prompts": "^2.4.2",
48
+ "simple-git": "^3.27.0",
49
+ "zod": "^3.24.2"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^22.13.4",
53
+ "@types/prompts": "^2.4.9",
54
+ "@typescript-eslint/eslint-plugin": "^8.24.0",
55
+ "@typescript-eslint/parser": "^8.24.0",
56
+ "eslint": "^9.20.0",
57
+ "prettier": "^3.5.2",
58
+ "tsx": "^4.19.3",
59
+ "typescript": "^5.7.3",
60
+ "vitest": "^3.0.6"
61
+ }
62
+ }