@via-dev/via 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 (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +87 -0
  3. package/dist/cli.js +136 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/commands/config.js +124 -0
  6. package/dist/commands/config.js.map +1 -0
  7. package/dist/commands/learn.js +112 -0
  8. package/dist/commands/learn.js.map +1 -0
  9. package/dist/commands/list.js +38 -0
  10. package/dist/commands/list.js.map +1 -0
  11. package/dist/commands/remove.js +82 -0
  12. package/dist/commands/remove.js.map +1 -0
  13. package/dist/commands/ui/index.js +23 -0
  14. package/dist/commands/ui/index.js.map +1 -0
  15. package/dist/commands/ui/server.js +47 -0
  16. package/dist/commands/ui/server.js.map +1 -0
  17. package/dist/commands/ui/static/script.js +101 -0
  18. package/dist/commands/ui/static/script.js.map +1 -0
  19. package/dist/commands/ui/static/styles.js +245 -0
  20. package/dist/commands/ui/static/styles.js.map +1 -0
  21. package/dist/commands/ui/templates/layout.js +51 -0
  22. package/dist/commands/ui/templates/layout.js.map +1 -0
  23. package/dist/commands/use.js +236 -0
  24. package/dist/commands/use.js.map +1 -0
  25. package/dist/schema.js +12 -0
  26. package/dist/schema.js.map +1 -0
  27. package/dist/types.js +3 -0
  28. package/dist/types.js.map +1 -0
  29. package/dist/utils/add/file-scanner.js +99 -0
  30. package/dist/utils/add/file-scanner.js.map +1 -0
  31. package/dist/utils/add/get-dependencies.js +75 -0
  32. package/dist/utils/add/get-dependencies.js.map +1 -0
  33. package/dist/utils/add/meta.js +22 -0
  34. package/dist/utils/add/meta.js.map +1 -0
  35. package/dist/utils/add/module-processor.js +140 -0
  36. package/dist/utils/add/module-processor.js.map +1 -0
  37. package/dist/utils/ai/blocks.js +22 -0
  38. package/dist/utils/ai/blocks.js.map +1 -0
  39. package/dist/utils/ai/detection-prompt.js +173 -0
  40. package/dist/utils/ai/detection-prompt.js.map +1 -0
  41. package/dist/utils/ai/models.js +17 -0
  42. package/dist/utils/ai/models.js.map +1 -0
  43. package/dist/utils/ai/sdk.js +36 -0
  44. package/dist/utils/ai/sdk.js.map +1 -0
  45. package/dist/utils/branding.js +82 -0
  46. package/dist/utils/branding.js.map +1 -0
  47. package/dist/utils/constants.js +56 -0
  48. package/dist/utils/constants.js.map +1 -0
  49. package/dist/utils/paths.js +14 -0
  50. package/dist/utils/paths.js.map +1 -0
  51. package/dist/utils/use/text.js +31 -0
  52. package/dist/utils/use/text.js.map +1 -0
  53. package/package.json +63 -0
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.detectBlocks = void 0;
4
+ const detection_prompt_1 = require("./detection-prompt");
5
+ const sdk_1 = require("./sdk");
6
+ const schema_1 = require("../../schema");
7
+ const detectBlocks = async (fileMeta) => {
8
+ const messages = [
9
+ {
10
+ role: 'system',
11
+ content: detection_prompt_1.detectionPrompt,
12
+ },
13
+ {
14
+ role: 'user',
15
+ content: JSON.stringify(fileMeta),
16
+ },
17
+ ];
18
+ const result = await (0, sdk_1.getAiJsonObject)(messages, schema_1.moduleSchema);
19
+ return result.output;
20
+ };
21
+ exports.detectBlocks = detectBlocks;
22
+ //# sourceMappingURL=blocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../../src/utils/ai/blocks.ts"],"names":[],"mappings":";;;AACA,yDAAqD;AACrD,+BAAwC;AACxC,yCAA4C;AAGrC,MAAM,YAAY,GAAG,KAAK,EAAE,QAAgB,EAAE,EAAE;IACnD,MAAM,QAAQ,GAAmB;QAC7B;YACI,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,kCAAe;SAC3B;QACD;YACI,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;SACpC;KACJ,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAe,EAAC,QAAQ,EAAE,qBAAY,CAAC,CAAC;IAC7D,OAAO,MAAM,CAAC,MAAM,CAAC;AACzB,CAAC,CAAA;AAdY,QAAA,YAAY,gBAcxB"}
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.detectionPrompt = void 0;
4
+ exports.detectionPrompt = `You are a senior full-stack engineer, cloud engineer, and software architect with deep experience in:
5
+ Next.js (App Router and Pages Router)
6
+ Node.js with Express
7
+ Hono
8
+ NestJS
9
+ AWS CDK (TypeScript / JavaScript)
10
+
11
+ Your task is to analyze a project's code structure and identify logical application modules.
12
+
13
+ A "module" is a cohesive, domain-level unit of functionality (e.g. users, auth, projects, billing, usage) that represents a business or application concept.
14
+
15
+ A module may include one or more of the following, depending on framework:
16
+ - API routes or route handlers
17
+ - Controllers or request handlers
18
+ - Services or business logic
19
+ - Models, schemas, DTOs, or entities
20
+ - Validators or middleware
21
+ - Repositories or data-access layers
22
+
23
+ For AWS CDK projects, a "module" represents a logical infrastructure unit.
24
+ Examples include:
25
+ - S3 bucket provisioning
26
+ - Lambda function creation
27
+ - API Gateway setup
28
+ - DynamoDB table definitions
29
+ - IAM roles and policies
30
+ - Event-driven resources
31
+
32
+ A CDK module may be implemented as:
33
+ - a Stack
34
+ - a Construct
35
+ - or a standalone file that creates one or more AWS resources
36
+
37
+ You will NOT be given full source code.
38
+
39
+ You WILL be given:
40
+ - folder paths
41
+ - file names
42
+ - import relationships
43
+ - exported symbols
44
+ - detected keywords (e.g. router, get, post, controller, service)
45
+ - short file summaries
46
+
47
+ You must infer module boundaries using **structure, naming, and responsibility**, not framework assumptions.
48
+
49
+ A module has a single entry file (also called start file).
50
+ The entry file is the primary integration point where the module is registered with the framework or router.
51
+ Examples include route definition files, router files, framework module files, or API entry points.
52
+
53
+ ---
54
+
55
+ ### FRAMEWORK AWARENESS RULES
56
+
57
+ You must recognize patterns specific to each framework:
58
+
59
+ #### Next.js
60
+ - Modules often live under:
61
+ - "app/api/<module>/route.ts"
62
+ - "pages/api/<module>.ts"
63
+ - "app/<module>/" (when route + logic are colocated)
64
+ - Files under app/api or pages/api are **API modules**
65
+ - Shared UI components, hooks, and utilities are NOT modules
66
+ - API route folders represent modules even if only 1 file exists
67
+ - The module entry file is app/api/<module>/route.ts OR pages/api/<module>.ts
68
+
69
+ #### Express / Hono
70
+ - Modules are commonly folder-based:
71
+ - routes/users.ts
72
+ - controllers/users.controller.ts
73
+ - services/user.service.ts
74
+ - Routers (router.get, app.use, hono.get) strongly indicate module boundaries
75
+ - A module may span multiple folders (routes + services + models)
76
+ - The module entry file is the file that creates or exports a router , creates or exports a router or is mounted via app.use or router.use
77
+ - Typical entry files include: routes/<module>.ts
78
+ <module>.routes.ts
79
+ <module>.router.ts
80
+
81
+ #### NestJS
82
+ - Each @Module() decorator defines a module
83
+ - Files typically include:
84
+ - .module.ts
85
+ - .controller.ts
86
+ - .service.ts
87
+ - NestJS modules should be treated as **authoritative module boundaries**
88
+ - Shared modules (e.g. CommonModule) are NOT business modules
89
+ - The module entry file is the file containing @Module()
90
+ - The module entry file is the file containing @Module()
91
+
92
+
93
+ ### AWS CDK
94
+
95
+ - Modules are infrastructure-focused, not application routes
96
+ - A module is defined by the creation of one or more AWS resources using CDK constructs
97
+ - Common indicators include:
98
+ - new s3.Bucket(...)
99
+ - new lambda.Function(...)
100
+ - new apigateway.RestApi(...)
101
+ - new dynamodb.Table(...)
102
+ - new iam.Role(...)
103
+
104
+ - Modules may be:
105
+ - Stack-based (extends Stack)
106
+ - Construct-based (extends Construct)
107
+ - File-based (resource creation in a single file)
108
+
109
+ - AWS CDK module boundaries:
110
+ - Prefer Stack or Construct classes as module boundaries
111
+ - If multiple resources are created together for a single purpose, treat them as one module
112
+ - Shared infrastructure (VPCs, shared IAM, shared utilities) is NOT a business module
113
+
114
+ - AWS CDK module entry file rules:
115
+ - If a Stack class exists, the file defining that Stack is the module entry file
116
+ - If a Construct class exists, the file defining that Construct is the module entry file
117
+ - Otherwise, the entry file is the file where AWS resources are instantiated
118
+ ---
119
+
120
+ ### IMPORTANT RULES (STRICT)
121
+
122
+ 1. Do NOT invent files, folders, or code.
123
+ 2. Do NOT assume a framework unless evidence exists.
124
+ 3. Prefer folder-based grouping, but allow file-based modules.
125
+ 4. A module may consist of multiple files across directories.
126
+ 5. Shared infrastructure (config, db, logger, utils) is NOT a module.
127
+ 6. If confidence is low, still include the module but mark it as "low".
128
+ 7. Output MUST be valid JSON only. No prose, no comments.
129
+
130
+ ---
131
+
132
+ ### YOUR TASK
133
+
134
+ Given the project structure:
135
+ 1. Identify all logical application modules
136
+ 2. For each module:
137
+ - module name (lowercase, plural if appropriate)
138
+ - primary entity name (if applicable)
139
+ - module entry file (single file path)
140
+ - confidence level
141
+ - module type
142
+ - files belonging to the module
143
+ - placeholder naming patterns
144
+ 3. Identify core/shared files that do NOT belong to any module
145
+
146
+ ---
147
+
148
+ ### OUTPUT FORMAT (STRICT JSON)
149
+
150
+ {
151
+ "modules": [
152
+ {
153
+ "moduleName": "users",
154
+ "entryFile": "src/modules/users/routes.ts",
155
+ "confidence": "high | medium | low",
156
+ }
157
+ ]
158
+ }
159
+
160
+ ---
161
+
162
+ ### QUALITY CHECK BEFORE RESPONDING
163
+
164
+ - Every file listed MUST exist in the input
165
+ - No file may appear in more than one module
166
+ - Module names must reflect domain concepts, not technical roles
167
+ - NestJS @Module definitions take priority if present
168
+ - Next.js app/api routes must be treated as modules
169
+ - If no modules are detected, return an empty array
170
+ - Every module MUST have exactly one entryFile, and it MUST also appear in that module’s files array
171
+
172
+ Return ONLY the JSON.`;
173
+ //# sourceMappingURL=detection-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detection-prompt.js","sourceRoot":"","sources":["../../../src/utils/ai/detection-prompt.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAwKT,CAAA"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAvailableModels = void 0;
4
+ const getAvailableModels = (provider) => {
5
+ switch (provider) {
6
+ case 'openai':
7
+ return ['gpt-4o', 'gpt-4o-mini', 'gpt-5.2', 'gpt-5-mini', 'gpt-5-nano', 'gpt-5'];
8
+ case 'google':
9
+ return ['gemini-flash-latest', 'gemini-pro-latest'];
10
+ case 'anthropic':
11
+ return ['claude-haiku-4-5', 'claude-sonnet-4-5'];
12
+ default:
13
+ return [];
14
+ }
15
+ };
16
+ exports.getAvailableModels = getAvailableModels;
17
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/utils/ai/models.ts"],"names":[],"mappings":";;;AAAO,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAE,EAAE;IACnD,QAAQ,QAAQ,EAAE,CAAC;QACf,KAAK,QAAQ;YACT,OAAO,CAAC,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QACrF,KAAK,QAAQ;YACT,OAAO,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;QACxD,KAAK,WAAW;YACZ,OAAO,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAC;QACrD;YACI,OAAO,EAAE,CAAC;IAClB,CAAC;AACL,CAAC,CAAA;AAXY,QAAA,kBAAkB,sBAW9B"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAiJsonObject = void 0;
4
+ const google_1 = require("@ai-sdk/google");
5
+ const anthropic_1 = require("@ai-sdk/anthropic");
6
+ const openai_1 = require("@ai-sdk/openai");
7
+ const ai_1 = require("ai");
8
+ const config_1 = require("../../commands/config");
9
+ const getModel = async () => {
10
+ const config = await (0, config_1.getConfig)();
11
+ const apiKey = config.apiKey || process.env[`${config.provider.toUpperCase()}_API_KEY`];
12
+ switch (config.provider) {
13
+ case 'google':
14
+ return (0, google_1.createGoogleGenerativeAI)({ apiKey })(config.model);
15
+ case 'anthropic':
16
+ return (0, anthropic_1.createAnthropic)({ apiKey })(config.model);
17
+ case 'ollama':
18
+ return (0, openai_1.createOpenAI)({
19
+ baseURL: config.baseUrl,
20
+ apiKey: "ollama",
21
+ })(config.model);
22
+ case 'openai':
23
+ default:
24
+ return (0, openai_1.createOpenAI)({ apiKey })(config.model);
25
+ }
26
+ };
27
+ const getAiJsonObject = async (messages, schema) => {
28
+ const model = await getModel();
29
+ return (0, ai_1.streamText)({
30
+ model,
31
+ output: ai_1.Output.object({ schema }),
32
+ messages,
33
+ });
34
+ };
35
+ exports.getAiJsonObject = getAiJsonObject;
36
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../../src/utils/ai/sdk.ts"],"names":[],"mappings":";;;AAAA,2CAA0D;AAC1D,iDAAoD;AACpD,2CAA8C;AAC9C,2BAAsD;AAEtD,kDAAkD;AAGlD,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;IACxB,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,GAAE,CAAC;IACjC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IAExF,QAAQ,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtB,KAAK,QAAQ;YACT,OAAO,IAAA,iCAAwB,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9D,KAAK,WAAW;YACZ,OAAO,IAAA,2BAAe,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrD,KAAK,QAAQ;YACT,OAAO,IAAA,qBAAY,EAAC;gBAChB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,MAAM,EAAE,QAAQ;aACnB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrB,KAAK,QAAQ,CAAC;QACd;YACI,OAAO,IAAA,qBAAY,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtD,CAAC;AACL,CAAC,CAAC;AAGK,MAAM,eAAe,GAAG,KAAK,EAAE,QAAwB,EAAE,MAA6B,EAAE,EAAE;IAC7F,MAAM,KAAK,GAAG,MAAM,QAAQ,EAAE,CAAC;IAC/B,OAAO,IAAA,eAAU,EAAC;QACd,KAAK;QACL,MAAM,EAAE,WAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QACjC,QAAQ;KACX,CAAC,CAAC;AACP,CAAC,CAAA;AAPY,QAAA,eAAe,mBAO3B"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.showStatusLoader = exports.showWelcomeMessage = exports.showAbout = exports.showLogo = void 0;
7
+ const figlet_1 = __importDefault(require("figlet"));
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const gradient_string_1 = __importDefault(require("gradient-string"));
10
+ const viaGradient = (0, gradient_string_1.default)(["#9621A1", "#C13C62", "#B6353B"]);
11
+ const showLogo = () => {
12
+ const text = figlet_1.default.textSync("VIA", {
13
+ font: "Standard",
14
+ horizontalLayout: "default",
15
+ verticalLayout: "default",
16
+ });
17
+ console.log(viaGradient.multiline(text));
18
+ };
19
+ exports.showLogo = showLogo;
20
+ const showAbout = () => {
21
+ console.log(`${chalk_1.default.bold(viaGradient("Via — pattern-aware developer tooling"))}\n`);
22
+ console.log(`${chalk_1.default.white("Via helps you reuse real project patterns instead of rewriting boilerplate.")}`);
23
+ console.log(`${chalk_1.default.white("Most scaffolding tools start from templates.")}`);
24
+ console.log(`${chalk_1.default.white("Via starts from ")}${chalk_1.default.bold.cyan("YOUR")}${chalk_1.default.white(" code.")}\n`);
25
+ console.log(`${chalk_1.default.white("It learns how your projects are structured — modules, routes, services,")}`);
26
+ console.log(`${chalk_1.default.white("infrastructure, and patterns — and lets you reuse them consistently")}`);
27
+ console.log(`${chalk_1.default.white("across new projects and features.")}\n`);
28
+ console.log(chalk_1.default.cyan.bold("To use a learned module:"));
29
+ console.log(`${chalk_1.default.white(" via <module_name> create <new_name>")}\n`);
30
+ console.log(chalk_1.default.cyan.bold("Why Via exists:"));
31
+ console.log(`${chalk_1.default.gray(" •")} Copy-pasting modules across projects is slow and error-prone`);
32
+ console.log(`${chalk_1.default.gray(" •")} Boilerplates don’t match real-world codebases`);
33
+ console.log(`${chalk_1.default.gray(" •")} Every team has its own patterns — Via adapts to them\n`);
34
+ console.log(chalk_1.default.cyan.bold("What Via does:"));
35
+ console.log(`${chalk_1.default.gray(" •")} Learns modules from an existing project`);
36
+ console.log(`${chalk_1.default.gray(" •")} Understands entry files, structure, and conventions`);
37
+ console.log(`${chalk_1.default.gray(" •")} Generates new modules that match your codebase`);
38
+ console.log(`${chalk_1.default.gray(" •")} Works with Next.js, Express, Hono, NestJS, and AWS CDK\n`);
39
+ console.log(chalk_1.default.cyan.bold("How module learning works:"));
40
+ console.log(`${chalk_1.default.gray(" •")} To detect modules across an entire codebase, Via uses AI`);
41
+ console.log(`${chalk_1.default.gray(" •")} For precise control, you can skip AI and learn a module manually`);
42
+ console.log(`${chalk_1.default.gray(" •")} Run ${chalk_1.default.white.bold("via learn <folder_path>")}`);
43
+ console.log(`${chalk_1.default.gray(" •")} Select the module entry file`);
44
+ console.log(`${chalk_1.default.gray(" •")} Via traces all dependencies and builds the module graph automatically\n`);
45
+ console.log(chalk_1.default.cyan.bold("How Via uses AI (important):"));
46
+ console.log(`${chalk_1.default.gray(" •")} You choose the AI provider from a predefined list`);
47
+ console.log(`${chalk_1.default.gray(" •")} AI is used ONLY during ${chalk_1.default.white.bold("via learn")}`);
48
+ console.log(`${chalk_1.default.gray(" •")} No AI calls during generate, list, or remove`);
49
+ console.log(`${chalk_1.default.gray(" •")} This gives you:`);
50
+ console.log(`${chalk_1.default.gray(" -")} predictable output`);
51
+ console.log(`${chalk_1.default.gray(" -")} no surprise token usage`);
52
+ console.log(`${chalk_1.default.gray(" -")} offline-friendly generation`);
53
+ console.log(`${chalk_1.default.gray(" -")} the benefits of AI without runtime dependency\n`);
54
+ };
55
+ exports.showAbout = showAbout;
56
+ const showWelcomeMessage = (message) => {
57
+ console.log(viaGradient(message));
58
+ console.log("\n");
59
+ };
60
+ exports.showWelcomeMessage = showWelcomeMessage;
61
+ const showStatusLoader = () => {
62
+ const messages = [
63
+ "Finding common patterns...",
64
+ "Going through bytes...",
65
+ "Analyzing project structure...",
66
+ "Resolving dependencies...",
67
+ "Detecting modules...",
68
+ ];
69
+ let i = 0;
70
+ const interval = setInterval(() => {
71
+ process.stdout.write(`\r${viaGradient(messages[i % messages.length])}`);
72
+ i++;
73
+ }, 1500);
74
+ return {
75
+ stop: () => {
76
+ clearInterval(interval);
77
+ process.stdout.write("\r\u001b[K"); // Clear the line
78
+ }
79
+ };
80
+ };
81
+ exports.showStatusLoader = showStatusLoader;
82
+ //# sourceMappingURL=branding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branding.js","sourceRoot":"","sources":["../../src/utils/branding.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,kDAA0B;AAC1B,sEAAuC;AAEvC,MAAM,WAAW,GAAG,IAAA,yBAAQ,EAAC,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAEzD,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AEK,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAE,EAAE;IAClD,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC,CAAC;AAHW,QAAA,kBAAkB,sBAG7B;AAEK,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACjC,MAAM,QAAQ,GAAG;QACb,4BAA4B;QAC5B,wBAAwB;QACxB,gCAAgC;QAChC,2BAA2B;QAC3B,sBAAsB;KACzB,CAAC;IACF,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;QACxE,CAAC,EAAE,CAAC;IACR,CAAC,EAAE,IAAI,CAAC,CAAC;IAET,OAAO;QACH,IAAI,EAAE,GAAG,EAAE;YACP,aAAa,CAAC,QAAQ,CAAC,CAAC;YACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB;QACzD,CAAC;KACJ,CAAC;AACN,CAAC,CAAC;AApBW,QAAA,gBAAgB,oBAoB3B"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IGNORE_LIST = void 0;
4
+ exports.IGNORE_LIST = [
5
+ // Node / JavaScript
6
+ '.git',
7
+ '.gitignore',
8
+ '.serverless',
9
+ "node_modules",
10
+ "npm-debug.log",
11
+ "yarn-debug.log",
12
+ "yarn-error.log",
13
+ "pnpm-debug.log",
14
+ "dist",
15
+ "build",
16
+ "coverage",
17
+ ".npm",
18
+ ".pnp",
19
+ ".pnp.js",
20
+ // TypeScript
21
+ "*.tsbuildinfo",
22
+ // Environment / Secrets
23
+ ".env",
24
+ ".env.*",
25
+ ".DS_Store",
26
+ // Logs
27
+ "logs",
28
+ "*.log",
29
+ "debug.log",
30
+ // OS / System
31
+ "Thumbs.db",
32
+ ".Trash-*",
33
+ ".idea",
34
+ ".vscode",
35
+ // Testing
36
+ ".nyc_output",
37
+ // Cache
38
+ ".cache",
39
+ ".parcel-cache",
40
+ ".next",
41
+ ".nuxt",
42
+ ".svelte-kit",
43
+ ".turbo",
44
+ ".eslintcache",
45
+ ".stylelintcache",
46
+ // Build tools
47
+ ".webpack",
48
+ ".rollup.cache",
49
+ ".parcel-cache",
50
+ // Misc
51
+ "*.local",
52
+ "*.swp",
53
+ "*.swo",
54
+ "*.bak"
55
+ ];
56
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACzB,oBAAoB;IACpB,MAAM;IACN,YAAY;IACZ,aAAa;IACb,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,MAAM;IACN,OAAO;IACP,UAAU;IACV,MAAM;IACN,MAAM;IACN,SAAS;IAET,aAAa;IACb,eAAe;IAEf,wBAAwB;IACxB,MAAM;IACN,QAAQ;IACR,WAAW;IAEX,OAAO;IACP,MAAM;IACN,OAAO;IACP,WAAW;IAEX,cAAc;IACd,WAAW;IACX,UAAU;IACV,OAAO;IACP,SAAS;IAET,UAAU;IACV,aAAa;IAEb,QAAQ;IACR,QAAQ;IACR,eAAe;IACf,OAAO;IACP,OAAO;IACP,aAAa;IACb,QAAQ;IACR,cAAc;IACd,iBAAiB;IAEjB,cAAc;IACd,UAAU;IACV,eAAe;IACf,eAAe;IAEf,OAAO;IACP,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;CACR,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getViaDataPath = exports.getViaDataDir = void 0;
4
+ const os_1 = require("os");
5
+ const path_1 = require("path");
6
+ const getViaDataDir = () => {
7
+ return (0, path_1.join)((0, os_1.homedir)(), '.via');
8
+ };
9
+ exports.getViaDataDir = getViaDataDir;
10
+ const getViaDataPath = (filename) => {
11
+ return (0, path_1.join)((0, exports.getViaDataDir)(), filename);
12
+ };
13
+ exports.getViaDataPath = getViaDataPath;
14
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":";;;AAAA,2BAA6B;AAC7B,+BAA4B;AAErB,MAAM,aAAa,GAAG,GAAG,EAAE;IAC9B,OAAO,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,MAAM,CAAC,CAAC;AACnC,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB;AAEK,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC/C,OAAO,IAAA,WAAI,EAAC,IAAA,qBAAa,GAAE,EAAE,QAAQ,CAAC,CAAC;AAC3C,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pluralize = exports.isSingluar = exports.singularize = void 0;
4
+ const singularize = (name) => {
5
+ if (name.endsWith("ies"))
6
+ return name.slice(0, -3) + "y";
7
+ if (name.endsWith("es")) {
8
+ const base = name.slice(0, -2);
9
+ if (base.endsWith("s") || base.endsWith("x") || base.endsWith("z") || base.endsWith("ch") || base.endsWith("sh")) {
10
+ return base;
11
+ }
12
+ }
13
+ if (name.endsWith("s") && !name.endsWith("ss"))
14
+ return name.slice(0, -1);
15
+ return name;
16
+ };
17
+ exports.singularize = singularize;
18
+ const isSingluar = (name) => {
19
+ return name === (0, exports.singularize)(name);
20
+ };
21
+ exports.isSingluar = isSingluar;
22
+ const pluralize = (name) => {
23
+ if (name.endsWith("y") && !/[aeiou]y$/i.test(name))
24
+ return name.slice(0, -1) + "ies";
25
+ if (name.endsWith("s") || name.endsWith("x") || name.endsWith("z") || name.endsWith("ch") || name.endsWith("sh")) {
26
+ return name + "es";
27
+ }
28
+ return name + "s";
29
+ };
30
+ exports.pluralize = pluralize;
31
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/utils/use/text.ts"],"names":[],"mappings":";;;AAAO,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE;IACxC,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACzD,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/G,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACzE,OAAO,IAAI,CAAC;AAChB,CAAC,CAAA;AAVY,QAAA,WAAW,eAUvB;AAGM,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE;IACvC,OAAO,IAAI,KAAK,IAAA,mBAAW,EAAC,IAAI,CAAC,CAAC;AACtC,CAAC,CAAA;AAFY,QAAA,UAAU,cAEtB;AAEM,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE;IACtC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACrF,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/G,OAAO,IAAI,GAAG,IAAI,CAAC;IACvB,CAAC;IACD,OAAO,IAAI,GAAG,GAAG,CAAC;AACtB,CAAC,CAAA;AANY,QAAA,SAAS,aAMrB"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@via-dev/via",
3
+ "version": "0.1.0",
4
+ "description": "Via is a CLI tool designed to 'learn' from common code patterns and 'use' them to generate new code efficiently.",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "license": "MIT",
9
+ "author": "viping7",
10
+ "type": "commonjs",
11
+ "main": "index.js",
12
+ "scripts": {
13
+ "dev": "ts-node src/cli.ts",
14
+ "build": "tsc",
15
+ "prepublishOnly": "npm run build",
16
+ "start": "node dist/cli.js",
17
+ "l": "tsc & npm link",
18
+ "test": "jest",
19
+ "lint": "eslint \"src/**/*.{ts,js}\" --ext .ts,.js",
20
+ "lint:fix": "eslint \"src/**/*.{ts,js}\" --ext .ts,.js --fix"
21
+ },
22
+ "bin": {
23
+ "via": "./dist/cli.js"
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "README.md"
28
+ ],
29
+ "devDependencies": {
30
+ "@types/figlet": "^1.7.0",
31
+ "@types/gradient-string": "^1.1.6",
32
+ "@types/inquirer": "^9.0.9",
33
+ "@types/jest": "^30.0.0",
34
+ "@types/node": "^24.10.1",
35
+ "jest": "^30.2.0",
36
+ "ts-jest": "^29.4.6",
37
+ "ts-node": "^10.9.2",
38
+ "typescript": "^5.9.3",
39
+ "eslint": "^8.45.0",
40
+ "@typescript-eslint/parser": "^6.8.0",
41
+ "@typescript-eslint/eslint-plugin": "^6.8.0"
42
+ },
43
+ "dependencies": {
44
+ "@ai-sdk/anthropic": "^3.0.44",
45
+ "@ai-sdk/google": "^3.0.29",
46
+ "@ai-sdk/openai": "^3.0.26",
47
+ "@hono/node-server": "^1.19.9",
48
+ "@inquirer/prompts": "^8.2.0",
49
+ "@toon-format/toon": "^2.1.0",
50
+ "@types/lodash": "^4.17.21",
51
+ "ai": "^6.0.77",
52
+ "chalk": "^4.1.2",
53
+ "commander": "^14.0.2",
54
+ "dotenv": "^17.2.4",
55
+ "figlet": "^1.10.0",
56
+ "gradient-string": "^3.0.0",
57
+ "hono": "^4.11.9",
58
+ "inquirer": "^13.2.2",
59
+ "lodash": "^4.17.21",
60
+ "open": "^11.0.0",
61
+ "ts-morph": "^27.0.2"
62
+ }
63
+ }