@ooneex/cli 1.34.1 → 1.35.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/dist/index.js CHANGED
@@ -95129,35 +95129,41 @@ describe("{{NAME}}Ai", () => {
95129
95129
  expect({{NAME}}Ai.name.endsWith("Ai")).toBe(true);
95130
95130
  });
95131
95131
 
95132
+ test("should inject one dependency via constructor", () => {
95133
+ expect({{NAME}}Ai.length).toBe(1);
95134
+ });
95135
+
95132
95136
  test("should have 'run' method", () => {
95133
95137
  expect({{NAME}}Ai.prototype.run).toBeDefined();
95134
95138
  expect(typeof {{NAME}}Ai.prototype.run).toBe("function");
95135
95139
  });
95136
95140
 
95137
- test("should have 'runStream' method", () => {
95141
+ test("should have 'runStream' async generator method", () => {
95138
95142
  expect({{NAME}}Ai.prototype.runStream).toBeDefined();
95139
95143
  expect(typeof {{NAME}}Ai.prototype.runStream).toBe("function");
95144
+ const AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
95145
+ expect({{NAME}}Ai.prototype.runStream).toBeInstanceOf(AsyncGeneratorFunction);
95140
95146
  });
95141
95147
  });
95142
95148
  `;
95143
95149
 
95144
95150
  // src/templates/ai.txt
95145
- var ai_default = `import { decorator, type IAiChat, OpenAi, type OpenAiConfigType } from "@ooneex/ai";
95151
+ var ai_default = `import { decorator, OpenRouterAi, type OpenRouterConfigType } from "@ooneex/ai";
95146
95152
  import { inject } from "@ooneex/container";
95147
95153
 
95148
95154
  @decorator.ai()
95149
- export class {{NAME}}Ai implements IAiChat<OpenAiConfigType> {
95150
- constructor(@inject(OpenAi) private readonly ai: OpenAi) {}
95155
+ export class {{NAME}}Ai {
95156
+ constructor(@inject(OpenRouterAi) private readonly ai: OpenRouterAi) {}
95151
95157
 
95152
- public async run<T>(prompt?: string, config?: Omit<OpenAiConfigType, "prompt">): Promise<T> {
95153
- return this.ai.run<T>(prompt || "My prompt", config);
95158
+ public async run<T>(content: string, config?: OpenRouterConfigType): Promise<T> {
95159
+ return this.ai.run<T>(content, config);
95154
95160
  }
95155
95161
 
95156
95162
  public async *runStream(
95157
- prompt?: string,
95158
- config?: Omit<OpenAiConfigType, "prompt" | "output">,
95163
+ content: string,
95164
+ config?: OpenRouterConfigType,
95159
95165
  ): AsyncGenerator<string, void, unknown> {
95160
- yield* this.ai.runStream(prompt || "My prompt", config);
95166
+ yield* this.ai.runStream(content, config);
95161
95167
  }
95162
95168
  }
95163
95169
  `;
@@ -95452,6 +95458,7 @@ class MakeCommandCommand {
95452
95458
  const base = join16("modules", module);
95453
95459
  const { commandPath: filePath, testPath } = await commandCreate({
95454
95460
  name,
95461
+ module,
95455
95462
  commandDir: join16(base, "src", "commands"),
95456
95463
  testsDir: join16(base, "tests", "commands")
95457
95464
  });
@@ -109765,4 +109772,4 @@ SeedRunCommand = __legacyDecorateClassTS([
109765
109772
  // src/index.ts
109766
109773
  await run();
109767
109774
 
109768
- //# debugId=1A6419EF7EB53FE364756E2164756E21
109775
+ //# debugId=14737BBCA1E113FB64756E2164756E21