@neural-tools/core 0.1.4 → 0.1.6

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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2025 Luke Amy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,236 @@
1
+ # @neural-tools/core
2
+
3
+ > Core utilities and types for Neural Tools
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@neural-tools/core)](https://www.npmjs.com/package/@neural-tools/core)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](../../LICENSE.md)
7
+
8
+ Shared utilities, types, and functions used across all Neural Tools packages.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install @neural-tools/core
14
+ ```
15
+
16
+ ## Features
17
+
18
+ - **Logger** - Beautiful CLI logging with colors and spinners
19
+ - **Types** - TypeScript types and Zod schemas
20
+ - **License Management** - Feature checking and validation
21
+ - **Utilities** - Common helper functions
22
+
23
+ ## Usage
24
+
25
+ ### Logger
26
+
27
+ Formatted console output with colors and loading indicators.
28
+
29
+ ```typescript
30
+ import { logger } from '@neural-tools/core';
31
+
32
+ // Headers and sections
33
+ logger.header('My Application');
34
+ logger.section('Configuration', [
35
+ 'Environment: production',
36
+ 'Region: us-east-1'
37
+ ]);
38
+
39
+ // Status messages
40
+ logger.success('Operation completed!');
41
+ logger.error('Something went wrong');
42
+ logger.warning('This is a warning');
43
+ logger.info('Informational message');
44
+
45
+ // Spinners
46
+ logger.startSpinner('Processing...');
47
+ // ... do work ...
48
+ logger.succeedSpinner('Done!');
49
+ // or
50
+ logger.failSpinner('Failed');
51
+
52
+ // New lines
53
+ logger.newline();
54
+ ```
55
+
56
+ ### Types
57
+
58
+ TypeScript types and Zod schemas for validation.
59
+
60
+ ```typescript
61
+ import {
62
+ License,
63
+ LicenseTier,
64
+ MCPConfig,
65
+ ClaudeCommandConfig
66
+ } from '@neural-tools/core';
67
+
68
+ // License types
69
+ const license: License = {
70
+ tier: LicenseTier.FREE,
71
+ features: ['mcp-generation', 'claude-commands']
72
+ };
73
+
74
+ // MCP configuration
75
+ const mcpConfig: MCPConfig = {
76
+ name: 'my-mcp',
77
+ description: 'My MCP server',
78
+ version: '1.0.0',
79
+ license: 'MIT'
80
+ };
81
+
82
+ // Claude command configuration
83
+ const commandConfig: ClaudeCommandConfig = {
84
+ name: 'my-command',
85
+ description: 'My command',
86
+ content: 'Command prompt content...'
87
+ };
88
+ ```
89
+
90
+ ### License Management
91
+
92
+ Check feature availability (all features are enabled by default).
93
+
94
+ ```typescript
95
+ import {
96
+ checkFeature,
97
+ requireFeature,
98
+ licenseManager
99
+ } from '@neural-tools/core';
100
+
101
+ // Check if a feature is available
102
+ const hasVectorDB = await checkFeature('vector-db');
103
+ // Returns: true (all features are free)
104
+
105
+ // Require a feature (throws if not available)
106
+ await requireFeature('cloud-deployment', 'Cloud Deployment');
107
+ // Does not throw - all features are available
108
+
109
+ // Get current tier
110
+ const tier = await licenseManager.getTier();
111
+ ```
112
+
113
+ ## API Reference
114
+
115
+ ### Logger Methods
116
+
117
+ | Method | Description |
118
+ |--------|-------------|
119
+ | `header(text)` | Display a large header |
120
+ | `section(title, items)` | Display a titled section with items |
121
+ | `success(message)` | Green success message |
122
+ | `error(message)` | Red error message |
123
+ | `warning(message)` | Yellow warning message |
124
+ | `info(message)` | Blue info message |
125
+ | `startSpinner(text)` | Start loading spinner |
126
+ | `succeedSpinner(text?)` | Complete spinner with success |
127
+ | `failSpinner(text?)` | Complete spinner with failure |
128
+ | `newline()` | Add blank line |
129
+
130
+ ### Type Exports
131
+
132
+ ```typescript
133
+ // License types
134
+ export enum LicenseTier {
135
+ FREE = 'free',
136
+ PRO = 'pro',
137
+ ENTERPRISE = 'enterprise'
138
+ }
139
+
140
+ export interface License {
141
+ tier: LicenseTier;
142
+ email?: string;
143
+ key?: string;
144
+ expiresAt?: string;
145
+ features: string[];
146
+ }
147
+
148
+ // Configuration types
149
+ export interface MCPConfig {
150
+ name: string;
151
+ description: string;
152
+ version: string;
153
+ author?: string;
154
+ homepage?: string;
155
+ repository?: string;
156
+ license: string;
157
+ fastmcp?: {
158
+ tools: string[];
159
+ prompts: string[];
160
+ resources: string[];
161
+ };
162
+ }
163
+
164
+ export interface ClaudeCommandConfig {
165
+ name: string;
166
+ description: string;
167
+ argumentHint?: string;
168
+ allowedTools?: string[];
169
+ content: string;
170
+ }
171
+ ```
172
+
173
+ ### License Manager
174
+
175
+ ```typescript
176
+ class LicenseManager {
177
+ // Load license from disk
178
+ async loadLicense(): Promise<License>
179
+
180
+ // Save license to disk
181
+ async saveLicense(license: License): Promise<void>
182
+
183
+ // Check if feature is available (always returns true)
184
+ async checkFeature(feature: string): Promise<boolean>
185
+
186
+ // Require feature (no-op, all features available)
187
+ async requireFeature(feature: string, featureName?: string): Promise<void>
188
+
189
+ // Get current license tier
190
+ async getTier(): Promise<LicenseTier>
191
+ }
192
+
193
+ // Singleton instance
194
+ export const licenseManager: LicenseManager
195
+ ```
196
+
197
+ ## Dependencies
198
+
199
+ - **zod** - Schema validation
200
+ - **chalk** - Terminal colors
201
+ - **ora** - Terminal spinners
202
+
203
+ ## Development
204
+
205
+ ```bash
206
+ # Install dependencies
207
+ pnpm install
208
+
209
+ # Build
210
+ pnpm build
211
+
212
+ # Watch mode
213
+ pnpm dev
214
+ ```
215
+
216
+ ## Used By
217
+
218
+ - [@neural-tools/cli](../cli) - Main CLI tool
219
+ - [@neural-tools/create](../create-ai-toolkit) - Project scaffolding
220
+ - [@neural-tools/vector-db](../vector-db) - Vector database utilities
221
+ - [@neural-tools/semantic-cache](../semantic-cache) - Semantic caching
222
+ - [@neural-tools/fine-tune](../fine-tune) - Fine-tuning utilities
223
+
224
+ ## Contributing
225
+
226
+ Contributions are welcome! See the [main repository](https://github.com/MacLeanLuke/neural-tools) for guidelines.
227
+
228
+ ## License
229
+
230
+ MIT - See [LICENSE.md](../../LICENSE.md) for details.
231
+
232
+ ## Links
233
+
234
+ - [Documentation](https://neural-tools.com/docs/core.html)
235
+ - [GitHub](https://github.com/MacLeanLuke/neural-tools)
236
+ - [npm](https://www.npmjs.com/package/@neural-tools/core)
@@ -1,10 +1,11 @@
1
1
  import { z } from 'zod';
2
- export declare enum LicenseTier {
2
+
3
+ declare enum LicenseTier {
3
4
  FREE = "free",
4
5
  PRO = "pro",
5
6
  ENTERPRISE = "enterprise"
6
7
  }
7
- export declare const LicenseSchema: z.ZodObject<{
8
+ declare const LicenseSchema: z.ZodObject<{
8
9
  tier: z.ZodNativeEnum<typeof LicenseTier>;
9
10
  email: z.ZodOptional<z.ZodString>;
10
11
  key: z.ZodOptional<z.ZodString>;
@@ -23,8 +24,8 @@ export declare const LicenseSchema: z.ZodObject<{
23
24
  expiresAt?: string | undefined;
24
25
  features?: string[] | undefined;
25
26
  }>;
26
- export type License = z.infer<typeof LicenseSchema>;
27
- export declare const MCPConfigSchema: z.ZodObject<{
27
+ type License = z.infer<typeof LicenseSchema>;
28
+ declare const MCPConfigSchema: z.ZodObject<{
28
29
  name: z.ZodString;
29
30
  description: z.ZodString;
30
31
  version: z.ZodString;
@@ -72,8 +73,8 @@ export declare const MCPConfigSchema: z.ZodObject<{
72
73
  resources?: string[] | undefined;
73
74
  } | undefined;
74
75
  }>;
75
- export type MCPConfig = z.infer<typeof MCPConfigSchema>;
76
- export declare const ClaudeCommandConfigSchema: z.ZodObject<{
76
+ type MCPConfig = z.infer<typeof MCPConfigSchema>;
77
+ declare const ClaudeCommandConfigSchema: z.ZodObject<{
77
78
  name: z.ZodString;
78
79
  description: z.ZodString;
79
80
  argumentHint: z.ZodOptional<z.ZodString>;
@@ -92,38 +93,38 @@ export declare const ClaudeCommandConfigSchema: z.ZodObject<{
92
93
  argumentHint?: string | undefined;
93
94
  allowedTools?: string[] | undefined;
94
95
  }>;
95
- export type ClaudeCommandConfig = z.infer<typeof ClaudeCommandConfigSchema>;
96
- export interface GeneratorOptions {
96
+ type ClaudeCommandConfig = z.infer<typeof ClaudeCommandConfigSchema>;
97
+ interface GeneratorOptions {
97
98
  name: string;
98
99
  description?: string;
99
100
  outputDir?: string;
100
101
  template?: string;
101
102
  dryRun?: boolean;
102
103
  }
103
- export interface MCPGeneratorOptions extends GeneratorOptions {
104
+ interface MCPGeneratorOptions extends GeneratorOptions {
104
105
  fastmcp?: boolean;
105
106
  cicd?: 'github' | 'harness' | 'none';
106
107
  deployment?: 'aws' | 'gcp' | 'none';
107
108
  }
108
- export interface ClaudeCommandGeneratorOptions extends GeneratorOptions {
109
+ interface ClaudeCommandGeneratorOptions extends GeneratorOptions {
109
110
  arguments?: string[];
110
111
  allowedTools?: string[];
111
112
  installGlobally?: boolean;
112
113
  }
113
- export interface VectorDBConfig {
114
+ interface VectorDBConfig {
114
115
  provider: 'pinecone' | 'qdrant' | 'chromadb' | 'local';
115
116
  apiKey?: string;
116
117
  endpoint?: string;
117
118
  dimension?: number;
118
119
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
119
120
  }
120
- export interface SemanticCacheConfig {
121
+ interface SemanticCacheConfig {
121
122
  enabled: boolean;
122
123
  ttl?: number;
123
124
  similarityThreshold?: number;
124
125
  vectorDB?: VectorDBConfig;
125
126
  }
126
- export interface FineTuneConfig {
127
+ interface FineTuneConfig {
127
128
  provider: 'openai' | 'anthropic' | 'custom';
128
129
  model: string;
129
130
  datasetPath: string;
@@ -131,3 +132,39 @@ export interface FineTuneConfig {
131
132
  epochs?: number;
132
133
  learningRate?: number;
133
134
  }
135
+
136
+ declare class LicenseManager {
137
+ private static instance;
138
+ private license;
139
+ private constructor();
140
+ static getInstance(): LicenseManager;
141
+ loadLicense(): Promise<License>;
142
+ saveLicense(license: License): Promise<void>;
143
+ checkFeature(feature: string): Promise<boolean>;
144
+ requireFeature(feature: string, featureName?: string): Promise<void>;
145
+ getTier(): Promise<LicenseTier>;
146
+ }
147
+ declare const licenseManager: LicenseManager;
148
+ declare function checkLicense(): Promise<License>;
149
+ declare function checkFeature(feature: string): Promise<boolean>;
150
+ declare function requireFeature(feature: string, featureName?: string): Promise<void>;
151
+
152
+ declare class Logger {
153
+ private spinner;
154
+ info(message: string): void;
155
+ success(message: string): void;
156
+ warn(message: string): void;
157
+ error(message: string): void;
158
+ debug(message: string): void;
159
+ startSpinner(message: string): void;
160
+ succeedSpinner(message?: string): void;
161
+ failSpinner(message?: string): void;
162
+ updateSpinner(message: string): void;
163
+ log(message: string): void;
164
+ newline(): void;
165
+ header(message: string): void;
166
+ section(title: string, content: string[]): void;
167
+ }
168
+ declare const logger: Logger;
169
+
170
+ export { type ClaudeCommandConfig, ClaudeCommandConfigSchema, type ClaudeCommandGeneratorOptions, type FineTuneConfig, type GeneratorOptions, type License, LicenseManager, LicenseSchema, LicenseTier, Logger, type MCPConfig, MCPConfigSchema, type MCPGeneratorOptions, type SemanticCacheConfig, type VectorDBConfig, checkFeature, checkLicense, licenseManager, logger, requireFeature };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,170 @@
1
- export * from './types';
2
- export * from './license';
3
- export { logger, Logger } from './logger';
1
+ import { z } from 'zod';
2
+
3
+ declare enum LicenseTier {
4
+ FREE = "free",
5
+ PRO = "pro",
6
+ ENTERPRISE = "enterprise"
7
+ }
8
+ declare const LicenseSchema: z.ZodObject<{
9
+ tier: z.ZodNativeEnum<typeof LicenseTier>;
10
+ email: z.ZodOptional<z.ZodString>;
11
+ key: z.ZodOptional<z.ZodString>;
12
+ expiresAt: z.ZodOptional<z.ZodString>;
13
+ features: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
14
+ }, "strip", z.ZodTypeAny, {
15
+ tier: LicenseTier;
16
+ features: string[];
17
+ email?: string | undefined;
18
+ key?: string | undefined;
19
+ expiresAt?: string | undefined;
20
+ }, {
21
+ tier: LicenseTier;
22
+ email?: string | undefined;
23
+ key?: string | undefined;
24
+ expiresAt?: string | undefined;
25
+ features?: string[] | undefined;
26
+ }>;
27
+ type License = z.infer<typeof LicenseSchema>;
28
+ declare const MCPConfigSchema: z.ZodObject<{
29
+ name: z.ZodString;
30
+ description: z.ZodString;
31
+ version: z.ZodString;
32
+ author: z.ZodOptional<z.ZodString>;
33
+ homepage: z.ZodOptional<z.ZodString>;
34
+ repository: z.ZodOptional<z.ZodString>;
35
+ license: z.ZodDefault<z.ZodString>;
36
+ fastmcp: z.ZodOptional<z.ZodObject<{
37
+ tools: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
38
+ prompts: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
39
+ resources: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
40
+ }, "strip", z.ZodTypeAny, {
41
+ tools: string[];
42
+ prompts: string[];
43
+ resources: string[];
44
+ }, {
45
+ tools?: string[] | undefined;
46
+ prompts?: string[] | undefined;
47
+ resources?: string[] | undefined;
48
+ }>>;
49
+ }, "strip", z.ZodTypeAny, {
50
+ name: string;
51
+ description: string;
52
+ version: string;
53
+ license: string;
54
+ author?: string | undefined;
55
+ homepage?: string | undefined;
56
+ repository?: string | undefined;
57
+ fastmcp?: {
58
+ tools: string[];
59
+ prompts: string[];
60
+ resources: string[];
61
+ } | undefined;
62
+ }, {
63
+ name: string;
64
+ description: string;
65
+ version: string;
66
+ author?: string | undefined;
67
+ homepage?: string | undefined;
68
+ repository?: string | undefined;
69
+ license?: string | undefined;
70
+ fastmcp?: {
71
+ tools?: string[] | undefined;
72
+ prompts?: string[] | undefined;
73
+ resources?: string[] | undefined;
74
+ } | undefined;
75
+ }>;
76
+ type MCPConfig = z.infer<typeof MCPConfigSchema>;
77
+ declare const ClaudeCommandConfigSchema: z.ZodObject<{
78
+ name: z.ZodString;
79
+ description: z.ZodString;
80
+ argumentHint: z.ZodOptional<z.ZodString>;
81
+ allowedTools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
82
+ content: z.ZodString;
83
+ }, "strip", z.ZodTypeAny, {
84
+ name: string;
85
+ description: string;
86
+ content: string;
87
+ argumentHint?: string | undefined;
88
+ allowedTools?: string[] | undefined;
89
+ }, {
90
+ name: string;
91
+ description: string;
92
+ content: string;
93
+ argumentHint?: string | undefined;
94
+ allowedTools?: string[] | undefined;
95
+ }>;
96
+ type ClaudeCommandConfig = z.infer<typeof ClaudeCommandConfigSchema>;
97
+ interface GeneratorOptions {
98
+ name: string;
99
+ description?: string;
100
+ outputDir?: string;
101
+ template?: string;
102
+ dryRun?: boolean;
103
+ }
104
+ interface MCPGeneratorOptions extends GeneratorOptions {
105
+ fastmcp?: boolean;
106
+ cicd?: 'github' | 'harness' | 'none';
107
+ deployment?: 'aws' | 'gcp' | 'none';
108
+ }
109
+ interface ClaudeCommandGeneratorOptions extends GeneratorOptions {
110
+ arguments?: string[];
111
+ allowedTools?: string[];
112
+ installGlobally?: boolean;
113
+ }
114
+ interface VectorDBConfig {
115
+ provider: 'pinecone' | 'qdrant' | 'chromadb' | 'local';
116
+ apiKey?: string;
117
+ endpoint?: string;
118
+ dimension?: number;
119
+ metric?: 'cosine' | 'euclidean' | 'dotproduct';
120
+ }
121
+ interface SemanticCacheConfig {
122
+ enabled: boolean;
123
+ ttl?: number;
124
+ similarityThreshold?: number;
125
+ vectorDB?: VectorDBConfig;
126
+ }
127
+ interface FineTuneConfig {
128
+ provider: 'openai' | 'anthropic' | 'custom';
129
+ model: string;
130
+ datasetPath: string;
131
+ validationSplit?: number;
132
+ epochs?: number;
133
+ learningRate?: number;
134
+ }
135
+
136
+ declare class LicenseManager {
137
+ private static instance;
138
+ private license;
139
+ private constructor();
140
+ static getInstance(): LicenseManager;
141
+ loadLicense(): Promise<License>;
142
+ saveLicense(license: License): Promise<void>;
143
+ checkFeature(feature: string): Promise<boolean>;
144
+ requireFeature(feature: string, featureName?: string): Promise<void>;
145
+ getTier(): Promise<LicenseTier>;
146
+ }
147
+ declare const licenseManager: LicenseManager;
148
+ declare function checkLicense(): Promise<License>;
149
+ declare function checkFeature(feature: string): Promise<boolean>;
150
+ declare function requireFeature(feature: string, featureName?: string): Promise<void>;
151
+
152
+ declare class Logger {
153
+ private spinner;
154
+ info(message: string): void;
155
+ success(message: string): void;
156
+ warn(message: string): void;
157
+ error(message: string): void;
158
+ debug(message: string): void;
159
+ startSpinner(message: string): void;
160
+ succeedSpinner(message?: string): void;
161
+ failSpinner(message?: string): void;
162
+ updateSpinner(message: string): void;
163
+ log(message: string): void;
164
+ newline(): void;
165
+ header(message: string): void;
166
+ section(title: string, content: string[]): void;
167
+ }
168
+ declare const logger: Logger;
169
+
170
+ export { type ClaudeCommandConfig, ClaudeCommandConfigSchema, type ClaudeCommandGeneratorOptions, type FineTuneConfig, type GeneratorOptions, type License, LicenseManager, LicenseSchema, LicenseTier, Logger, type MCPConfig, MCPConfigSchema, type MCPGeneratorOptions, type SemanticCacheConfig, type VectorDBConfig, checkFeature, checkLicense, licenseManager, logger, requireFeature };
package/dist/index.js CHANGED
@@ -1,25 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Logger = exports.logger = void 0;
18
- // Types
19
- __exportStar(require("./types"), exports);
20
- // License management
21
- __exportStar(require("./license"), exports);
22
- // Logger
23
- var logger_1 = require("./logger");
24
- Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return logger_1.logger; } });
25
- Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
1
+ "use strict";var C=Object.create;var l=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var F=(t,e)=>{for(var i in e)l(t,i,{get:e[i],enumerable:!0})},y=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of L(e))!E.call(t,s)&&s!==i&&l(t,s,{get:()=>e[s],enumerable:!(r=w(e,s))||r.enumerable});return t};var a=(t,e,i)=>(i=t!=null?C(S(t)):{},y(e||!t||!t.__esModule?l(i,"default",{value:t,enumerable:!0}):i,t)),P=t=>y(l({},"__esModule",{value:!0}),t);var R={};F(R,{ClaudeCommandConfigSchema:()=>O,LicenseManager:()=>d,LicenseSchema:()=>g,LicenseTier:()=>p,Logger:()=>c,MCPConfigSchema:()=>k,checkFeature:()=>G,checkLicense:()=>D,licenseManager:()=>m,logger:()=>b,requireFeature:()=>M});module.exports=P(R);var n=require("zod"),p=(r=>(r.FREE="free",r.PRO="pro",r.ENTERPRISE="enterprise",r))(p||{}),g=n.z.object({tier:n.z.nativeEnum(p),email:n.z.string().email().optional(),key:n.z.string().optional(),expiresAt:n.z.string().datetime().optional(),features:n.z.array(n.z.string()).default([])}),k=n.z.object({name:n.z.string(),description:n.z.string(),version:n.z.string(),author:n.z.string().optional(),homepage:n.z.string().url().optional(),repository:n.z.string().url().optional(),license:n.z.string().default("MIT"),fastmcp:n.z.object({tools:n.z.array(n.z.string()).default([]),prompts:n.z.array(n.z.string()).default([]),resources:n.z.array(n.z.string()).default([])}).optional()}),O=n.z.object({name:n.z.string(),description:n.z.string(),argumentHint:n.z.string().optional(),allowedTools:n.z.array(n.z.string()).optional(),content:n.z.string()});var u=a(require("fs/promises")),h=a(require("path")),x=a(require("os"));var f=h.default.join(x.default.homedir(),".ai-toolkit","license.json"),d=class t{static instance;license=null;constructor(){}static getInstance(){return t.instance||(t.instance=new t),t.instance}async loadLicense(){if(this.license)return this.license;try{let e=await u.default.readFile(f,"utf-8"),i=JSON.parse(e);if(this.license=g.parse(i),this.license.expiresAt&&new Date(this.license.expiresAt)<new Date)throw new Error("License has expired");return this.license}catch{return this.license={tier:"free",features:["mcp-generation","claude-commands","basic-templates"]},this.license}}async saveLicense(e){let i=g.parse(e),r=h.default.dirname(f);await u.default.mkdir(r,{recursive:!0}),await u.default.writeFile(f,JSON.stringify(i,null,2),"utf-8"),this.license=i}async checkFeature(e){return!0}async requireFeature(e,i){if(!await this.checkFeature(e)){let s=i||e;throw new Error(`Feature "${s}" requires a Pro or Enterprise license.
2
+ Visit https://ai-toolkit.dev/pricing to upgrade.`)}}async getTier(){return(await this.loadLicense()).tier}},m=d.getInstance();async function D(){return m.loadLicense()}async function G(t){return m.checkFeature(t)}async function M(t,e){return m.requireFeature(t,e)}var o=a(require("chalk")),v=a(require("ora")),c=class{spinner=null;info(e){console.log(o.default.blue("\u2139"),e)}success(e){console.log(o.default.green("\u2713"),e)}warn(e){console.log(o.default.yellow("\u26A0"),e)}error(e){console.log(o.default.red("\u2717"),e)}debug(e){process.env.DEBUG&&console.log(o.default.gray("\u2192"),e)}startSpinner(e){this.spinner=(0,v.default)(e).start()}succeedSpinner(e){this.spinner&&(this.spinner.succeed(e),this.spinner=null)}failSpinner(e){this.spinner&&(this.spinner.fail(e),this.spinner=null)}updateSpinner(e){this.spinner&&(this.spinner.text=e)}log(e){console.log(e)}newline(){console.log()}header(e){console.log(),console.log(o.default.bold.cyan(e)),console.log(o.default.cyan("\u2500".repeat(e.length)))}section(e,i){this.header(e),i.forEach(r=>this.log(` ${r}`)),this.newline()}},b=new c;0&&(module.exports={ClaudeCommandConfigSchema,LicenseManager,LicenseSchema,LicenseTier,Logger,MCPConfigSchema,checkFeature,checkLicense,licenseManager,logger,requireFeature});
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import{z as n}from"zod";var a=(i=>(i.FREE="free",i.PRO="pro",i.ENTERPRISE="enterprise",i))(a||{}),c=n.object({tier:n.nativeEnum(a),email:n.string().email().optional(),key:n.string().optional(),expiresAt:n.string().datetime().optional(),features:n.array(n.string()).default([])}),v=n.object({name:n.string(),description:n.string(),version:n.string(),author:n.string().optional(),homepage:n.string().url().optional(),repository:n.string().url().optional(),license:n.string().default("MIT"),fastmcp:n.object({tools:n.array(n.string()).default([]),prompts:n.array(n.string()).default([]),resources:n.array(n.string()).default([])}).optional()}),b=n.object({name:n.string(),description:n.string(),argumentHint:n.string().optional(),allowedTools:n.array(n.string()).optional(),content:n.string()});import l from"fs/promises";import d from"path";import f from"os";var p=d.join(f.homedir(),".ai-toolkit","license.json"),g=class t{static instance;license=null;constructor(){}static getInstance(){return t.instance||(t.instance=new t),t.instance}async loadLicense(){if(this.license)return this.license;try{let e=await l.readFile(p,"utf-8"),r=JSON.parse(e);if(this.license=c.parse(r),this.license.expiresAt&&new Date(this.license.expiresAt)<new Date)throw new Error("License has expired");return this.license}catch{return this.license={tier:"free",features:["mcp-generation","claude-commands","basic-templates"]},this.license}}async saveLicense(e){let r=c.parse(e),i=d.dirname(p);await l.mkdir(i,{recursive:!0}),await l.writeFile(p,JSON.stringify(r,null,2),"utf-8"),this.license=r}async checkFeature(e){return!0}async requireFeature(e,r){if(!await this.checkFeature(e)){let m=r||e;throw new Error(`Feature "${m}" requires a Pro or Enterprise license.
2
+ Visit https://ai-toolkit.dev/pricing to upgrade.`)}}async getTier(){return(await this.loadLicense()).tier}},u=g.getInstance();async function P(){return u.loadLicense()}async function k(t){return u.checkFeature(t)}async function O(t,e){return u.requireFeature(t,e)}import o from"chalk";import h from"ora";var s=class{spinner=null;info(e){console.log(o.blue("\u2139"),e)}success(e){console.log(o.green("\u2713"),e)}warn(e){console.log(o.yellow("\u26A0"),e)}error(e){console.log(o.red("\u2717"),e)}debug(e){process.env.DEBUG&&console.log(o.gray("\u2192"),e)}startSpinner(e){this.spinner=h(e).start()}succeedSpinner(e){this.spinner&&(this.spinner.succeed(e),this.spinner=null)}failSpinner(e){this.spinner&&(this.spinner.fail(e),this.spinner=null)}updateSpinner(e){this.spinner&&(this.spinner.text=e)}log(e){console.log(e)}newline(){console.log()}header(e){console.log(),console.log(o.bold.cyan(e)),console.log(o.cyan("\u2500".repeat(e.length)))}section(e,r){this.header(e),r.forEach(i=>this.log(` ${i}`)),this.newline()}},y=new s;export{b as ClaudeCommandConfigSchema,g as LicenseManager,c as LicenseSchema,a as LicenseTier,s as Logger,v as MCPConfigSchema,k as checkFeature,P as checkLicense,u as licenseManager,y as logger,O as requireFeature};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neural-tools/core",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Core utilities and types for Neural Tools",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "url": "https://github.com/MacLeanLuke/neural-tools.git",
14
14
  "directory": "packages/core"
15
15
  },
16
- "homepage": "https://neural-tools.com",
16
+ "homepage": "https://neural-tools.com/docs/core.html",
17
17
  "bugs": {
18
18
  "url": "https://github.com/MacLeanLuke/neural-tools/issues"
19
19
  },
@@ -39,8 +39,8 @@
39
39
  "dist"
40
40
  ],
41
41
  "scripts": {
42
- "build": "tsc",
43
- "dev": "tsc --watch",
42
+ "build": "tsup",
43
+ "dev": "tsup --watch",
44
44
  "clean": "rm -rf dist",
45
45
  "test": "echo 'Tests coming soon'"
46
46
  }
package/dist/license.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import { License, LicenseTier } from './types';
2
- export declare class LicenseManager {
3
- private static instance;
4
- private license;
5
- private constructor();
6
- static getInstance(): LicenseManager;
7
- loadLicense(): Promise<License>;
8
- saveLicense(license: License): Promise<void>;
9
- checkFeature(feature: string): Promise<boolean>;
10
- requireFeature(feature: string, featureName?: string): Promise<void>;
11
- getTier(): Promise<LicenseTier>;
12
- }
13
- export declare const licenseManager: LicenseManager;
14
- export declare function checkLicense(): Promise<License>;
15
- export declare function checkFeature(feature: string): Promise<boolean>;
16
- export declare function requireFeature(feature: string, featureName?: string): Promise<void>;
package/dist/license.js DELETED
@@ -1,120 +0,0 @@
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.licenseManager = exports.LicenseManager = void 0;
7
- exports.checkLicense = checkLicense;
8
- exports.checkFeature = checkFeature;
9
- exports.requireFeature = requireFeature;
10
- const promises_1 = __importDefault(require("fs/promises"));
11
- const path_1 = __importDefault(require("path"));
12
- const os_1 = __importDefault(require("os"));
13
- const types_1 = require("./types");
14
- const LICENSE_FILE = path_1.default.join(os_1.default.homedir(), '.ai-toolkit', 'license.json');
15
- class LicenseManager {
16
- static instance;
17
- license = null;
18
- constructor() { }
19
- static getInstance() {
20
- if (!LicenseManager.instance) {
21
- LicenseManager.instance = new LicenseManager();
22
- }
23
- return LicenseManager.instance;
24
- }
25
- async loadLicense() {
26
- if (this.license) {
27
- return this.license;
28
- }
29
- try {
30
- const licenseData = await promises_1.default.readFile(LICENSE_FILE, 'utf-8');
31
- const parsed = JSON.parse(licenseData);
32
- this.license = types_1.LicenseSchema.parse(parsed);
33
- // Check if license is expired
34
- if (this.license.expiresAt) {
35
- const expiresAt = new Date(this.license.expiresAt);
36
- if (expiresAt < new Date()) {
37
- throw new Error('License has expired');
38
- }
39
- }
40
- return this.license;
41
- }
42
- catch (error) {
43
- // Default to free tier if no license found
44
- this.license = {
45
- tier: types_1.LicenseTier.FREE,
46
- features: ['mcp-generation', 'claude-commands', 'basic-templates']
47
- };
48
- return this.license;
49
- }
50
- }
51
- async saveLicense(license) {
52
- const validated = types_1.LicenseSchema.parse(license);
53
- const licenseDir = path_1.default.dirname(LICENSE_FILE);
54
- await promises_1.default.mkdir(licenseDir, { recursive: true });
55
- await promises_1.default.writeFile(LICENSE_FILE, JSON.stringify(validated, null, 2), 'utf-8');
56
- this.license = validated;
57
- }
58
- async checkFeature(feature) {
59
- const license = await this.loadLicense();
60
- // Free tier features
61
- const freeTierFeatures = [
62
- 'mcp-generation',
63
- 'claude-commands',
64
- 'basic-templates',
65
- 'local-development'
66
- ];
67
- // Pro tier features
68
- const proTierFeatures = [
69
- ...freeTierFeatures,
70
- 'vector-db',
71
- 'semantic-cache',
72
- 'fine-tuning',
73
- 'cloud-deployment',
74
- 'premium-templates',
75
- 'github-automation'
76
- ];
77
- // Enterprise tier features
78
- const enterpriseTierFeatures = [
79
- ...proTierFeatures,
80
- 'white-label',
81
- 'custom-integrations',
82
- 'priority-support',
83
- 'sla-guarantee'
84
- ];
85
- switch (license.tier) {
86
- case types_1.LicenseTier.FREE:
87
- return freeTierFeatures.includes(feature) || license.features.includes(feature);
88
- case types_1.LicenseTier.PRO:
89
- return proTierFeatures.includes(feature) || license.features.includes(feature);
90
- case types_1.LicenseTier.ENTERPRISE:
91
- return enterpriseTierFeatures.includes(feature) || license.features.includes(feature);
92
- default:
93
- return freeTierFeatures.includes(feature);
94
- }
95
- }
96
- async requireFeature(feature, featureName) {
97
- const hasFeature = await this.checkFeature(feature);
98
- if (!hasFeature) {
99
- const displayName = featureName || feature;
100
- throw new Error(`Feature "${displayName}" requires a Pro or Enterprise license.\n` +
101
- `Visit https://ai-toolkit.dev/pricing to upgrade.`);
102
- }
103
- }
104
- async getTier() {
105
- const license = await this.loadLicense();
106
- return license.tier;
107
- }
108
- }
109
- exports.LicenseManager = LicenseManager;
110
- exports.licenseManager = LicenseManager.getInstance();
111
- // Convenience functions
112
- async function checkLicense() {
113
- return exports.licenseManager.loadLicense();
114
- }
115
- async function checkFeature(feature) {
116
- return exports.licenseManager.checkFeature(feature);
117
- }
118
- async function requireFeature(feature, featureName) {
119
- return exports.licenseManager.requireFeature(feature, featureName);
120
- }
package/dist/logger.d.ts DELETED
@@ -1,17 +0,0 @@
1
- export declare class Logger {
2
- private spinner;
3
- info(message: string): void;
4
- success(message: string): void;
5
- warn(message: string): void;
6
- error(message: string): void;
7
- debug(message: string): void;
8
- startSpinner(message: string): void;
9
- succeedSpinner(message?: string): void;
10
- failSpinner(message?: string): void;
11
- updateSpinner(message: string): void;
12
- log(message: string): void;
13
- newline(): void;
14
- header(message: string): void;
15
- section(title: string, content: string[]): void;
16
- }
17
- export declare const logger: Logger;
package/dist/logger.js DELETED
@@ -1,66 +0,0 @@
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.logger = exports.Logger = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const ora_1 = __importDefault(require("ora"));
9
- class Logger {
10
- spinner = null;
11
- info(message) {
12
- console.log(chalk_1.default.blue('ℹ'), message);
13
- }
14
- success(message) {
15
- console.log(chalk_1.default.green('✓'), message);
16
- }
17
- warn(message) {
18
- console.log(chalk_1.default.yellow('⚠'), message);
19
- }
20
- error(message) {
21
- console.log(chalk_1.default.red('✗'), message);
22
- }
23
- debug(message) {
24
- if (process.env.DEBUG) {
25
- console.log(chalk_1.default.gray('→'), message);
26
- }
27
- }
28
- startSpinner(message) {
29
- this.spinner = (0, ora_1.default)(message).start();
30
- }
31
- succeedSpinner(message) {
32
- if (this.spinner) {
33
- this.spinner.succeed(message);
34
- this.spinner = null;
35
- }
36
- }
37
- failSpinner(message) {
38
- if (this.spinner) {
39
- this.spinner.fail(message);
40
- this.spinner = null;
41
- }
42
- }
43
- updateSpinner(message) {
44
- if (this.spinner) {
45
- this.spinner.text = message;
46
- }
47
- }
48
- log(message) {
49
- console.log(message);
50
- }
51
- newline() {
52
- console.log();
53
- }
54
- header(message) {
55
- console.log();
56
- console.log(chalk_1.default.bold.cyan(message));
57
- console.log(chalk_1.default.cyan('─'.repeat(message.length)));
58
- }
59
- section(title, content) {
60
- this.header(title);
61
- content.forEach(line => this.log(` ${line}`));
62
- this.newline();
63
- }
64
- }
65
- exports.Logger = Logger;
66
- exports.logger = new Logger();
package/dist/types.js DELETED
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ClaudeCommandConfigSchema = exports.MCPConfigSchema = exports.LicenseSchema = exports.LicenseTier = void 0;
4
- const zod_1 = require("zod");
5
- // License tiers
6
- var LicenseTier;
7
- (function (LicenseTier) {
8
- LicenseTier["FREE"] = "free";
9
- LicenseTier["PRO"] = "pro";
10
- LicenseTier["ENTERPRISE"] = "enterprise";
11
- })(LicenseTier || (exports.LicenseTier = LicenseTier = {}));
12
- // License schema
13
- exports.LicenseSchema = zod_1.z.object({
14
- tier: zod_1.z.nativeEnum(LicenseTier),
15
- email: zod_1.z.string().email().optional(),
16
- key: zod_1.z.string().optional(),
17
- expiresAt: zod_1.z.string().datetime().optional(),
18
- features: zod_1.z.array(zod_1.z.string()).default([])
19
- });
20
- // MCP Configuration
21
- exports.MCPConfigSchema = zod_1.z.object({
22
- name: zod_1.z.string(),
23
- description: zod_1.z.string(),
24
- version: zod_1.z.string(),
25
- author: zod_1.z.string().optional(),
26
- homepage: zod_1.z.string().url().optional(),
27
- repository: zod_1.z.string().url().optional(),
28
- license: zod_1.z.string().default('MIT'),
29
- fastmcp: zod_1.z.object({
30
- tools: zod_1.z.array(zod_1.z.string()).default([]),
31
- prompts: zod_1.z.array(zod_1.z.string()).default([]),
32
- resources: zod_1.z.array(zod_1.z.string()).default([])
33
- }).optional()
34
- });
35
- // Claude Command Configuration
36
- exports.ClaudeCommandConfigSchema = zod_1.z.object({
37
- name: zod_1.z.string(),
38
- description: zod_1.z.string(),
39
- argumentHint: zod_1.z.string().optional(),
40
- allowedTools: zod_1.z.array(zod_1.z.string()).optional(),
41
- content: zod_1.z.string()
42
- });