@nudge-ai/cli 0.0.1-beta.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/bin.cjs ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ const require_src = require('./src-6tjbSqai.cjs');
3
+ let fs = require("fs");
4
+ fs = require_src.__toESM(fs);
5
+ let path = require("path");
6
+ path = require_src.__toESM(path);
7
+
8
+ //#region src/bin.ts
9
+ const args = process.argv.slice(2);
10
+ if (args[0] !== "generate") {
11
+ console.error(`Usage: nudge generate [--no-cache]`);
12
+ process.exit(1);
13
+ }
14
+ const noCache = args.includes("--no-cache");
15
+ const cwd = process.cwd();
16
+ const configPath = path.join(cwd, "nudge.config.json");
17
+ let config = {};
18
+ if (fs.existsSync(configPath)) config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
19
+ const outputPath = config.generatedFile ? path.join(cwd, config.generatedFile) : path.join(cwd, "src", "prompts.gen.ts");
20
+ require_src.generate(path.dirname(outputPath), outputPath, {
21
+ promptFilenamePattern: config.promptFilenamePattern,
22
+ aiConfig: config.ai,
23
+ noCache
24
+ }).catch((error) => {
25
+ console.error("Error generating prompts:", error);
26
+ process.exit(1);
27
+ });
28
+
29
+ //#endregion
package/dist/bin.d.cts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/bin.d.mts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/bin.mjs ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ import { t as generate } from "./src-DG37IBZ6.mjs";
3
+ import * as fs from "fs";
4
+ import * as path from "path";
5
+
6
+ //#region src/bin.ts
7
+ const args = process.argv.slice(2);
8
+ if (args[0] !== "generate") {
9
+ console.error(`Usage: nudge generate [--no-cache]`);
10
+ process.exit(1);
11
+ }
12
+ const noCache = args.includes("--no-cache");
13
+ const cwd = process.cwd();
14
+ const configPath = path.join(cwd, "nudge.config.json");
15
+ let config = {};
16
+ if (fs.existsSync(configPath)) config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
17
+ const outputPath = config.generatedFile ? path.join(cwd, config.generatedFile) : path.join(cwd, "src", "prompts.gen.ts");
18
+ generate(path.dirname(outputPath), outputPath, {
19
+ promptFilenamePattern: config.promptFilenamePattern,
20
+ aiConfig: config.ai,
21
+ noCache
22
+ }).catch((error) => {
23
+ console.error("Error generating prompts:", error);
24
+ process.exit(1);
25
+ });
26
+
27
+ //#endregion
28
+ export { };
29
+ //# sourceMappingURL=bin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.mjs","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { AIConfig } from \"./ai.js\";\nimport { generate } from \"./index.js\";\n\ntype NudgeConfig = {\n generatedFile?: string;\n promptFilenamePattern?: string;\n ai?: AIConfig;\n};\n\nconst args = process.argv.slice(2);\nconst command = args[0];\n\nif (command !== \"generate\") {\n console.error(`Usage: nudge generate [--no-cache]`);\n process.exit(1);\n}\n\nconst noCache = args.includes(\"--no-cache\");\n\nconst cwd = process.cwd();\nconst configPath = path.join(cwd, \"nudge.config.json\");\n\nlet config: NudgeConfig = {};\nif (fs.existsSync(configPath)) {\n config = JSON.parse(fs.readFileSync(configPath, \"utf-8\"));\n}\n\nconst outputPath = config.generatedFile\n ? path.join(cwd, config.generatedFile)\n : path.join(cwd, \"src\", \"prompts.gen.ts\");\n\nconst targetDir = path.dirname(outputPath);\n\ngenerate(targetDir, outputPath, {\n promptFilenamePattern: config.promptFilenamePattern,\n aiConfig: config.ai,\n noCache,\n}).catch((error) => {\n console.error(\"Error generating prompts:\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;AAYA,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;AAGlC,IAFgB,KAAK,OAEL,YAAY;AAC1B,SAAQ,MAAM,qCAAqC;AACnD,SAAQ,KAAK,EAAE;;AAGjB,MAAM,UAAU,KAAK,SAAS,aAAa;AAE3C,MAAM,MAAM,QAAQ,KAAK;AACzB,MAAM,aAAa,KAAK,KAAK,KAAK,oBAAoB;AAEtD,IAAI,SAAsB,EAAE;AAC5B,IAAI,GAAG,WAAW,WAAW,CAC3B,UAAS,KAAK,MAAM,GAAG,aAAa,YAAY,QAAQ,CAAC;AAG3D,MAAM,aAAa,OAAO,gBACtB,KAAK,KAAK,KAAK,OAAO,cAAc,GACpC,KAAK,KAAK,KAAK,OAAO,iBAAiB;AAI3C,SAFkB,KAAK,QAAQ,WAAW,EAEtB,YAAY;CAC9B,uBAAuB,OAAO;CAC9B,UAAU,OAAO;CACjB;CACD,CAAC,CAAC,OAAO,UAAU;AAClB,SAAQ,MAAM,6BAA6B,MAAM;AACjD,SAAQ,KAAK,EAAE;EACf"}
package/dist/index.cjs ADDED
@@ -0,0 +1,4 @@
1
+ const require_src = require('./src-6tjbSqai.cjs');
2
+
3
+ exports.discoverPrompts = require_src.discoverPrompts;
4
+ exports.generate = require_src.generate;
@@ -0,0 +1,27 @@
1
+ import { PromptBuilderState } from "@nudge-ai/core";
2
+
3
+ //#region src/ai.d.ts
4
+ type AIConfig = {
5
+ provider: "openai" | "openrouter";
6
+ apiKeyEnvVar: string;
7
+ model: string;
8
+ };
9
+ //#endregion
10
+ //#region src/discover.d.ts
11
+ type DiscoveredPrompt = {
12
+ id: string;
13
+ state: PromptBuilderState;
14
+ filePath: string;
15
+ };
16
+ declare function discoverPrompts(dir: string, pattern: string): Promise<DiscoveredPrompt[]>;
17
+ //#endregion
18
+ //#region src/index.d.ts
19
+ type GenerateOptions = {
20
+ promptFilenamePattern?: string;
21
+ aiConfig?: AIConfig;
22
+ noCache?: boolean;
23
+ };
24
+ declare function generate(targetDir: string, outputPath: string, options?: GenerateOptions): Promise<void>;
25
+ //#endregion
26
+ export { type DiscoveredPrompt, GenerateOptions, discoverPrompts, generate };
27
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/ai.ts","../src/discover.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;KAGY,QAAA;;EAAA,YAAQ,EAAA,MAAA;;;;;KCCR,gBAAA;;EDDA,KAAA,ECGH,kBDHW;;;iBCgBE,eAAA,gCAGnB,QAAQ;;;ADnBC,KEGA,eAAA,GFHQ;;aEKP;;ADJb,CAAA;AAeA,iBCPe,QAAA,CDOsB,SAG1B,EAAA,MAAA,EAAA,UAAR,EAAA,MAAO,EAAA,OAAA,CAAA,ECPC,eDOD,CAAA,ECPqB,ODOrB,CAAA,IAAA,CAAA"}
@@ -0,0 +1,28 @@
1
+ import "dotenv/config";
2
+ import { PromptBuilderState } from "@nudge-ai/core";
3
+
4
+ //#region src/ai.d.ts
5
+ type AIConfig = {
6
+ provider: "openai" | "openrouter";
7
+ apiKeyEnvVar: string;
8
+ model: string;
9
+ };
10
+ //#endregion
11
+ //#region src/discover.d.ts
12
+ type DiscoveredPrompt = {
13
+ id: string;
14
+ state: PromptBuilderState;
15
+ filePath: string;
16
+ };
17
+ declare function discoverPrompts(dir: string, pattern: string): Promise<DiscoveredPrompt[]>;
18
+ //#endregion
19
+ //#region src/index.d.ts
20
+ type GenerateOptions = {
21
+ promptFilenamePattern?: string;
22
+ aiConfig?: AIConfig;
23
+ noCache?: boolean;
24
+ };
25
+ declare function generate(targetDir: string, outputPath: string, options?: GenerateOptions): Promise<void>;
26
+ //#endregion
27
+ export { type DiscoveredPrompt, GenerateOptions, discoverPrompts, generate };
28
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/ai.ts","../src/discover.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;KAGY,QAAA;;;EAAA,KAAA,EAAA,MAAQ;;;;KCCR,gBAAA;;SAEH;EDHG,QAAA,EAAA,MAAQ;;iBCgBE,eAAA,gCAGnB,QAAQ;;;KChBC,eAAA;EFHA,qBAAQ,CAAA,EAAA,MAAA;aEKP;;;ADJb,iBCQe,QAAA,CDRa,SAEnB,EAAA,MAAA,EAAA,UAAkB,EAAA,MAAA,EAAA,OAAA,CAAA,ECShB,eDTgB,CAAA,ECSI,ODTJ,CAAA,IAAA,CAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import { n as discoverPrompts, t as generate } from "./src-DG37IBZ6.mjs";
2
+
3
+ export { discoverPrompts, generate };