@fractary/faber 0.1.1

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 (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +146 -0
  3. package/dist/api.d.ts +81 -0
  4. package/dist/api.d.ts.map +1 -0
  5. package/dist/api.js +261 -0
  6. package/dist/api.js.map +1 -0
  7. package/dist/bindings/claude-code/transformer.d.ts +55 -0
  8. package/dist/bindings/claude-code/transformer.d.ts.map +1 -0
  9. package/dist/bindings/claude-code/transformer.js +271 -0
  10. package/dist/bindings/claude-code/transformer.js.map +1 -0
  11. package/dist/bindings/index.d.ts +21 -0
  12. package/dist/bindings/index.d.ts.map +1 -0
  13. package/dist/bindings/index.js +43 -0
  14. package/dist/bindings/index.js.map +1 -0
  15. package/dist/core/concepts/base.d.ts +89 -0
  16. package/dist/core/concepts/base.d.ts.map +1 -0
  17. package/dist/core/concepts/base.js +230 -0
  18. package/dist/core/concepts/base.js.map +1 -0
  19. package/dist/core/concepts/eval.d.ts +90 -0
  20. package/dist/core/concepts/eval.d.ts.map +1 -0
  21. package/dist/core/concepts/eval.js +118 -0
  22. package/dist/core/concepts/eval.js.map +1 -0
  23. package/dist/core/concepts/index.d.ts +9 -0
  24. package/dist/core/concepts/index.d.ts.map +1 -0
  25. package/dist/core/concepts/index.js +36 -0
  26. package/dist/core/concepts/index.js.map +1 -0
  27. package/dist/core/concepts/role.d.ts +19 -0
  28. package/dist/core/concepts/role.d.ts.map +1 -0
  29. package/dist/core/concepts/role.js +227 -0
  30. package/dist/core/concepts/role.js.map +1 -0
  31. package/dist/core/concepts/team.d.ts +57 -0
  32. package/dist/core/concepts/team.d.ts.map +1 -0
  33. package/dist/core/concepts/team.js +106 -0
  34. package/dist/core/concepts/team.js.map +1 -0
  35. package/dist/core/concepts/tool.d.ts +43 -0
  36. package/dist/core/concepts/tool.d.ts.map +1 -0
  37. package/dist/core/concepts/tool.js +104 -0
  38. package/dist/core/concepts/tool.js.map +1 -0
  39. package/dist/core/concepts/workflow.d.ts +87 -0
  40. package/dist/core/concepts/workflow.d.ts.map +1 -0
  41. package/dist/core/concepts/workflow.js +114 -0
  42. package/dist/core/concepts/workflow.js.map +1 -0
  43. package/dist/core/config/index.d.ts +34 -0
  44. package/dist/core/config/index.d.ts.map +1 -0
  45. package/dist/core/config/index.js +80 -0
  46. package/dist/core/config/index.js.map +1 -0
  47. package/dist/core/config/loader.d.ts +53 -0
  48. package/dist/core/config/loader.d.ts.map +1 -0
  49. package/dist/core/config/loader.js +234 -0
  50. package/dist/core/config/loader.js.map +1 -0
  51. package/dist/core/contexts/index.d.ts +36 -0
  52. package/dist/core/contexts/index.d.ts.map +1 -0
  53. package/dist/core/contexts/index.js +75 -0
  54. package/dist/core/contexts/index.js.map +1 -0
  55. package/dist/core/contexts/loader.d.ts +66 -0
  56. package/dist/core/contexts/loader.d.ts.map +1 -0
  57. package/dist/core/contexts/loader.js +261 -0
  58. package/dist/core/contexts/loader.js.map +1 -0
  59. package/dist/core/overlays/index.d.ts +31 -0
  60. package/dist/core/overlays/index.d.ts.map +1 -0
  61. package/dist/core/overlays/index.js +82 -0
  62. package/dist/core/overlays/index.js.map +1 -0
  63. package/dist/core/overlays/resolver.d.ts +65 -0
  64. package/dist/core/overlays/resolver.d.ts.map +1 -0
  65. package/dist/core/overlays/resolver.js +249 -0
  66. package/dist/core/overlays/resolver.js.map +1 -0
  67. package/dist/index.d.ts +20 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +56 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/types/bindings.d.ts +59 -0
  72. package/dist/types/bindings.d.ts.map +1 -0
  73. package/dist/types/bindings.js +6 -0
  74. package/dist/types/bindings.js.map +1 -0
  75. package/dist/types/concepts.d.ts +131 -0
  76. package/dist/types/concepts.d.ts.map +1 -0
  77. package/dist/types/concepts.js +29 -0
  78. package/dist/types/concepts.js.map +1 -0
  79. package/dist/types/config.d.ts +42 -0
  80. package/dist/types/config.d.ts.map +1 -0
  81. package/dist/types/config.js +6 -0
  82. package/dist/types/config.js.map +1 -0
  83. package/dist/types/contexts.d.ts +59 -0
  84. package/dist/types/contexts.d.ts.map +1 -0
  85. package/dist/types/contexts.js +17 -0
  86. package/dist/types/contexts.js.map +1 -0
  87. package/dist/types/index.d.ts +17 -0
  88. package/dist/types/index.d.ts.map +1 -0
  89. package/dist/types/index.js +30 -0
  90. package/dist/types/index.js.map +1 -0
  91. package/dist/types/overlays.d.ts +28 -0
  92. package/dist/types/overlays.d.ts.map +1 -0
  93. package/dist/types/overlays.js +15 -0
  94. package/dist/types/overlays.js.map +1 -0
  95. package/dist/utils/file-system.d.ts +40 -0
  96. package/dist/utils/file-system.d.ts.map +1 -0
  97. package/dist/utils/file-system.js +105 -0
  98. package/dist/utils/file-system.js.map +1 -0
  99. package/dist/utils/template.d.ts +28 -0
  100. package/dist/utils/template.d.ts.map +1 -0
  101. package/dist/utils/template.js +107 -0
  102. package/dist/utils/template.js.map +1 -0
  103. package/dist/utils/validation.d.ts +42 -0
  104. package/dist/utils/validation.d.ts.map +1 -0
  105. package/dist/utils/validation.js +94 -0
  106. package/dist/utils/validation.js.map +1 -0
  107. package/package.json +83 -0
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Context type definitions
3
+ */
4
+ export declare enum ContextCategory {
5
+ SPECIALIST = "specialists",
6
+ PLATFORM = "platforms",
7
+ STANDARD = "standards",
8
+ PATTERN = "patterns",
9
+ PLAYBOOK = "playbooks",
10
+ REFERENCE = "references",
11
+ TROUBLESHOOTING = "troubleshooting"
12
+ }
13
+ export interface Context {
14
+ category: ContextCategory;
15
+ name: string;
16
+ content: string;
17
+ frontmatter?: ContextFrontmatter;
18
+ metadata?: ContextFrontmatter;
19
+ filePath?: string;
20
+ path?: string;
21
+ }
22
+ export interface ContextFrontmatter {
23
+ category?: ContextCategory;
24
+ name?: string;
25
+ description?: string;
26
+ platform?: string;
27
+ mcp_server?: string;
28
+ required_tools?: string[];
29
+ fallback?: 'api' | 'cli' | 'manual';
30
+ related?: string[];
31
+ tags?: string[];
32
+ }
33
+ export interface PlatformContext extends Context {
34
+ category: ContextCategory.PLATFORM;
35
+ platform: string;
36
+ mcp_server?: string;
37
+ required_tools?: string[];
38
+ }
39
+ export interface SpecialistContext extends Context {
40
+ category: ContextCategory.SPECIALIST;
41
+ domain?: string;
42
+ expertise?: string[];
43
+ }
44
+ export interface StandardContext extends Context {
45
+ category: ContextCategory.STANDARD;
46
+ }
47
+ export interface PatternContext extends Context {
48
+ category: ContextCategory.PATTERN;
49
+ }
50
+ export interface PlaybookContext extends Context {
51
+ category: ContextCategory.PLAYBOOK;
52
+ }
53
+ export interface ReferenceContext extends Context {
54
+ category: ContextCategory.REFERENCE;
55
+ }
56
+ export interface TroubleshootingContext extends Context {
57
+ category: ContextCategory.TROUBLESHOOTING;
58
+ }
59
+ //# sourceMappingURL=contexts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../src/types/contexts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oBAAY,eAAe;IACzB,UAAU,gBAAgB;IAC1B,QAAQ,cAAc;IACtB,QAAQ,cAAc;IACtB,OAAO,aAAa;IACpB,QAAQ,cAAc;IACtB,SAAS,eAAe;IACxB,eAAe,oBAAoB;CACpC;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,EAAE,eAAe,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC9C,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAkB,SAAQ,OAAO;IAChD,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC9C,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC;CACpC;AAED,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC9C,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC;CACpC;AAED,MAAM,WAAW,gBAAiB,SAAQ,OAAO;IAC/C,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC;CACrC;AAED,MAAM,WAAW,sBAAuB,SAAQ,OAAO;IACrD,QAAQ,EAAE,eAAe,CAAC,eAAe,CAAC;CAC3C"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * Context type definitions
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ContextCategory = void 0;
7
+ var ContextCategory;
8
+ (function (ContextCategory) {
9
+ ContextCategory["SPECIALIST"] = "specialists";
10
+ ContextCategory["PLATFORM"] = "platforms";
11
+ ContextCategory["STANDARD"] = "standards";
12
+ ContextCategory["PATTERN"] = "patterns";
13
+ ContextCategory["PLAYBOOK"] = "playbooks";
14
+ ContextCategory["REFERENCE"] = "references";
15
+ ContextCategory["TROUBLESHOOTING"] = "troubleshooting";
16
+ })(ContextCategory || (exports.ContextCategory = ContextCategory = {}));
17
+ //# sourceMappingURL=contexts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contexts.js","sourceRoot":"","sources":["../../src/types/contexts.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,6CAA0B,CAAA;IAC1B,yCAAsB,CAAA;IACtB,yCAAsB,CAAA;IACtB,uCAAoB,CAAA;IACpB,yCAAsB,CAAA;IACtB,2CAAwB,CAAA;IACxB,sDAAmC,CAAA;AACrC,CAAC,EARW,eAAe,+BAAf,eAAe,QAQ1B"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Core types for Faber-CLI
3
+ */
4
+ export * from './concepts';
5
+ export * from './contexts';
6
+ export * from './overlays';
7
+ export * from './config';
8
+ export * from './bindings';
9
+ export interface ConceptInfo {
10
+ type: ConceptType;
11
+ name: string;
12
+ description?: string;
13
+ path: string;
14
+ }
15
+ import { ConceptType } from './concepts';
16
+ export { ConceptType };
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAG3B,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /**
3
+ * Core types for Faber-CLI
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.ConceptType = void 0;
21
+ // Export all types from separate modules
22
+ __exportStar(require("./concepts"), exports);
23
+ __exportStar(require("./contexts"), exports);
24
+ __exportStar(require("./overlays"), exports);
25
+ __exportStar(require("./config"), exports);
26
+ __exportStar(require("./bindings"), exports);
27
+ // Re-export ConceptType for backward compatibility
28
+ const concepts_1 = require("./concepts");
29
+ Object.defineProperty(exports, "ConceptType", { enumerable: true, get: function () { return concepts_1.ConceptType; } });
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;AAEH,yCAAyC;AACzC,6CAA2B;AAC3B,6CAA2B;AAC3B,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAU3B,mDAAmD;AACnD,yCAAyC;AAChC,4FADA,sBAAW,OACA"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Overlay type definitions
3
+ */
4
+ export interface Overlay {
5
+ type: OverlayType;
6
+ name: string;
7
+ contexts?: string[];
8
+ config?: Record<string, unknown>;
9
+ }
10
+ export declare enum OverlayType {
11
+ ORGANIZATION = "organization",
12
+ PLATFORM = "platform",
13
+ ROLE = "role",
14
+ TEAM = "team",
15
+ WORKFLOW = "workflow"
16
+ }
17
+ export interface Overlays {
18
+ organization?: Overlay;
19
+ platform?: Overlay;
20
+ role?: Overlay;
21
+ team?: Overlay;
22
+ workflow?: Overlay;
23
+ }
24
+ export interface OverlayConfig {
25
+ enabled: boolean;
26
+ paths?: string[];
27
+ }
28
+ //# sourceMappingURL=overlays.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlays.d.ts","sourceRoot":"","sources":["../../src/types/overlays.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,oBAAY,WAAW;IACrB,YAAY,iBAAiB;IAC7B,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * Overlay type definitions
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.OverlayType = void 0;
7
+ var OverlayType;
8
+ (function (OverlayType) {
9
+ OverlayType["ORGANIZATION"] = "organization";
10
+ OverlayType["PLATFORM"] = "platform";
11
+ OverlayType["ROLE"] = "role";
12
+ OverlayType["TEAM"] = "team";
13
+ OverlayType["WORKFLOW"] = "workflow";
14
+ })(OverlayType || (exports.OverlayType = OverlayType = {}));
15
+ //# sourceMappingURL=overlays.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlays.js","sourceRoot":"","sources":["../../src/types/overlays.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AASH,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,4CAA6B,CAAA;IAC7B,oCAAqB,CAAA;IACrB,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,oCAAqB,CAAA;AACvB,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * File system utilities
3
+ */
4
+ /**
5
+ * Ensure a directory exists, creating it if necessary
6
+ */
7
+ export declare function ensureDirectoryExists(dirPath: string): Promise<void>;
8
+ /**
9
+ * Write content to a file
10
+ */
11
+ export declare function writeFile(filePath: string, content: string): Promise<void>;
12
+ /**
13
+ * Read a file
14
+ */
15
+ export declare function readFile(filePath: string): Promise<string>;
16
+ /**
17
+ * Check if a file exists
18
+ */
19
+ export declare function fileExists(filePath: string): Promise<boolean>;
20
+ /**
21
+ * Check if a directory exists
22
+ */
23
+ export declare function directoryExists(dirPath: string): Promise<boolean>;
24
+ /**
25
+ * List files in a directory
26
+ */
27
+ export declare function listFiles(dirPath: string, pattern?: RegExp): Promise<string[]>;
28
+ /**
29
+ * List directories in a directory
30
+ */
31
+ export declare function listDirectories(dirPath: string): Promise<string[]>;
32
+ /**
33
+ * Copy a file
34
+ */
35
+ export declare function copyFile(source: string, destination: string): Promise<void>;
36
+ /**
37
+ * Remove a file or directory
38
+ */
39
+ export declare function remove(targetPath: string): Promise<void>;
40
+ //# sourceMappingURL=file-system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system.d.ts","sourceRoot":"","sources":["../../src/utils/file-system.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ1E;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhF;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEhE;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOvE;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAWpF;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAKxE;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGjF;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9D"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ /**
3
+ * File system utilities
4
+ */
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ensureDirectoryExists = ensureDirectoryExists;
10
+ exports.writeFile = writeFile;
11
+ exports.readFile = readFile;
12
+ exports.fileExists = fileExists;
13
+ exports.directoryExists = directoryExists;
14
+ exports.listFiles = listFiles;
15
+ exports.listDirectories = listDirectories;
16
+ exports.copyFile = copyFile;
17
+ exports.remove = remove;
18
+ const fs_1 = require("fs");
19
+ const path_1 = __importDefault(require("path"));
20
+ /**
21
+ * Ensure a directory exists, creating it if necessary
22
+ */
23
+ async function ensureDirectoryExists(dirPath) {
24
+ try {
25
+ await fs_1.promises.mkdir(dirPath, { recursive: true });
26
+ }
27
+ catch (error) {
28
+ if (error.code !== 'EEXIST') {
29
+ throw error;
30
+ }
31
+ }
32
+ }
33
+ /**
34
+ * Write content to a file
35
+ */
36
+ async function writeFile(filePath, content) {
37
+ await ensureDirectoryExists(path_1.default.dirname(filePath));
38
+ await fs_1.promises.writeFile(filePath, content, 'utf-8');
39
+ }
40
+ /**
41
+ * Read a file
42
+ */
43
+ async function readFile(filePath) {
44
+ return fs_1.promises.readFile(filePath, 'utf-8');
45
+ }
46
+ /**
47
+ * Check if a file exists
48
+ */
49
+ async function fileExists(filePath) {
50
+ try {
51
+ await fs_1.promises.access(filePath);
52
+ return true;
53
+ }
54
+ catch {
55
+ return false;
56
+ }
57
+ }
58
+ /**
59
+ * Check if a directory exists
60
+ */
61
+ async function directoryExists(dirPath) {
62
+ try {
63
+ const stats = await fs_1.promises.stat(dirPath);
64
+ return stats.isDirectory();
65
+ }
66
+ catch {
67
+ return false;
68
+ }
69
+ }
70
+ /**
71
+ * List files in a directory
72
+ */
73
+ async function listFiles(dirPath, pattern) {
74
+ const entries = await fs_1.promises.readdir(dirPath, { withFileTypes: true });
75
+ let files = entries
76
+ .filter(entry => entry.isFile())
77
+ .map(entry => entry.name);
78
+ if (pattern) {
79
+ files = files.filter(file => pattern.test(file));
80
+ }
81
+ return files;
82
+ }
83
+ /**
84
+ * List directories in a directory
85
+ */
86
+ async function listDirectories(dirPath) {
87
+ const entries = await fs_1.promises.readdir(dirPath, { withFileTypes: true });
88
+ return entries
89
+ .filter(entry => entry.isDirectory())
90
+ .map(entry => entry.name);
91
+ }
92
+ /**
93
+ * Copy a file
94
+ */
95
+ async function copyFile(source, destination) {
96
+ await ensureDirectoryExists(path_1.default.dirname(destination));
97
+ await fs_1.promises.copyFile(source, destination);
98
+ }
99
+ /**
100
+ * Remove a file or directory
101
+ */
102
+ async function remove(targetPath) {
103
+ await fs_1.promises.rm(targetPath, { recursive: true, force: true });
104
+ }
105
+ //# sourceMappingURL=file-system.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-system.js","sourceRoot":"","sources":["../../src/utils/file-system.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAQH,sDAQC;AAKD,8BAGC;AAKD,4BAEC;AAKD,gCAOC;AAKD,0CAOC;AAKD,8BAWC;AAKD,0CAKC;AAKD,4BAGC;AAKD,wBAEC;AA9FD,2BAAoC;AACpC,gDAAwB;AAExB;;GAEG;AACI,KAAK,UAAU,qBAAqB,CAAC,OAAe;IACzD,IAAI,CAAC;QACH,MAAM,aAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAAa,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACrC,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,SAAS,CAAC,QAAgB,EAAE,OAAe;IAC/D,MAAM,qBAAqB,CAAC,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpD,MAAM,aAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC;AAED;;GAE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,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACnE,OAAO,OAAO;SACX,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;SACpC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,QAAQ,CAAC,MAAc,EAAE,WAAmB;IAChE,MAAM,qBAAqB,CAAC,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IACvD,MAAM,aAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,MAAM,CAAC,UAAkB;IAC7C,MAAM,aAAE,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Template utilities
3
+ */
4
+ /**
5
+ * Register common Handlebars helpers
6
+ */
7
+ export declare function registerHelpers(): void;
8
+ /**
9
+ * Compile a template from string
10
+ */
11
+ export declare function compileTemplate(template: string): HandlebarsTemplateDelegate;
12
+ /**
13
+ * Load and compile a template from file
14
+ */
15
+ export declare function loadTemplate(filePath: string): Promise<HandlebarsTemplateDelegate>;
16
+ /**
17
+ * Render a template with data
18
+ */
19
+ export declare function renderTemplate(template: HandlebarsTemplateDelegate, data: any): string;
20
+ /**
21
+ * Load, compile and render a template in one go
22
+ */
23
+ export declare function renderTemplateFile(filePath: string, data: any): Promise<string>;
24
+ /**
25
+ * Clear template cache
26
+ */
27
+ export declare function clearTemplateCache(): void;
28
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/utils/template.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAkDtC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,0BAA0B,CAE5E;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAcxF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,0BAA0B,EACpC,IAAI,EAAE,GAAG,GACR,MAAM,CAER;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,GAAG,GACR,OAAO,CAAC,MAAM,CAAC,CAGjB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ /**
3
+ * Template utilities
4
+ */
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.registerHelpers = registerHelpers;
10
+ exports.compileTemplate = compileTemplate;
11
+ exports.loadTemplate = loadTemplate;
12
+ exports.renderTemplate = renderTemplate;
13
+ exports.renderTemplateFile = renderTemplateFile;
14
+ exports.clearTemplateCache = clearTemplateCache;
15
+ const handlebars_1 = __importDefault(require("handlebars"));
16
+ const file_system_1 = require("./file-system");
17
+ // Cache for compiled templates
18
+ const templateCache = new Map();
19
+ /**
20
+ * Register common Handlebars helpers
21
+ */
22
+ function registerHelpers() {
23
+ // Convert to snake_case
24
+ handlebars_1.default.registerHelper('snake_case', (str) => {
25
+ return str.replace(/([A-Z])/g, '_$1').toLowerCase().replace(/^_/, '').replace(/-/g, '_');
26
+ });
27
+ // Convert to camelCase
28
+ handlebars_1.default.registerHelper('camel_case', (str) => {
29
+ return str.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
30
+ });
31
+ // Convert to PascalCase
32
+ handlebars_1.default.registerHelper('pascal_case', (str) => {
33
+ const camel = str.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
34
+ return camel.charAt(0).toUpperCase() + camel.slice(1);
35
+ });
36
+ // Convert to UPPER_SNAKE_CASE
37
+ handlebars_1.default.registerHelper('upper_snake_case', (str) => {
38
+ return str.replace(/([A-Z])/g, '_$1').toUpperCase().replace(/^_/, '').replace(/-/g, '_');
39
+ });
40
+ // Convert array to Python list
41
+ handlebars_1.default.registerHelper('python_list', (arr) => {
42
+ return `[${arr.map(s => `"${s}"`).join(', ')}]`;
43
+ });
44
+ // Convert array to JavaScript array
45
+ handlebars_1.default.registerHelper('js_array', (arr) => {
46
+ return JSON.stringify(arr);
47
+ });
48
+ // Conditional helper
49
+ handlebars_1.default.registerHelper('if_eq', function (a, b, options) {
50
+ if (a === b) {
51
+ return options.fn(this);
52
+ }
53
+ return options.inverse(this);
54
+ });
55
+ // Join array with separator
56
+ handlebars_1.default.registerHelper('join', (arr, separator) => {
57
+ return arr.join(separator);
58
+ });
59
+ // Indent text
60
+ handlebars_1.default.registerHelper('indent', (text, spaces) => {
61
+ const indent = ' '.repeat(spaces);
62
+ return text.split('\n').map(line => indent + line).join('\n');
63
+ });
64
+ }
65
+ /**
66
+ * Compile a template from string
67
+ */
68
+ function compileTemplate(template) {
69
+ return handlebars_1.default.compile(template);
70
+ }
71
+ /**
72
+ * Load and compile a template from file
73
+ */
74
+ async function loadTemplate(filePath) {
75
+ // Check cache
76
+ if (templateCache.has(filePath)) {
77
+ return templateCache.get(filePath);
78
+ }
79
+ // Load and compile
80
+ const content = await (0, file_system_1.readFile)(filePath);
81
+ const compiled = compileTemplate(content);
82
+ // Cache
83
+ templateCache.set(filePath, compiled);
84
+ return compiled;
85
+ }
86
+ /**
87
+ * Render a template with data
88
+ */
89
+ function renderTemplate(template, data) {
90
+ return template(data);
91
+ }
92
+ /**
93
+ * Load, compile and render a template in one go
94
+ */
95
+ async function renderTemplateFile(filePath, data) {
96
+ const template = await loadTemplate(filePath);
97
+ return renderTemplate(template, data);
98
+ }
99
+ /**
100
+ * Clear template cache
101
+ */
102
+ function clearTemplateCache() {
103
+ templateCache.clear();
104
+ }
105
+ // Register helpers on module load
106
+ registerHelpers();
107
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/utils/template.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAWH,0CAkDC;AAKD,0CAEC;AAKD,oCAcC;AAKD,wCAKC;AAKD,gDAMC;AAKD,gDAEC;AAjHD,4DAAoC;AACpC,+CAAyC;AAEzC,+BAA+B;AAC/B,MAAM,aAAa,GAAG,IAAI,GAAG,EAAsC,CAAC;AAEpE;;GAEG;AACH,SAAgB,eAAe;IAC7B,wBAAwB;IACxB,oBAAU,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,GAAW,EAAE,EAAE;QACtD,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;IAEH,uBAAuB;IACvB,oBAAU,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,GAAW,EAAE,EAAE;QACtD,OAAO,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,wBAAwB;IACxB,oBAAU,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,GAAW,EAAE,EAAE;QACvD,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC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;AACxC,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB;IAChC,aAAa,CAAC,KAAK,EAAE,CAAC;AACxB,CAAC;AAED,kCAAkC;AAClC,eAAe,EAAE,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Validation utilities
3
+ */
4
+ import { z } from 'zod';
5
+ import { ValidationError, ValidationResult } from '../types';
6
+ /**
7
+ * Validate data against a Zod schema
8
+ */
9
+ export declare function validateSchema<T>(data: unknown, schema: z.ZodSchema<T>): {
10
+ success: boolean;
11
+ data?: T;
12
+ errors?: ValidationError[];
13
+ };
14
+ /**
15
+ * Create a validation result
16
+ */
17
+ export declare function createValidationResult(valid: boolean, errors?: ValidationError[], warnings?: any[]): ValidationResult;
18
+ /**
19
+ * Validate a concept name
20
+ */
21
+ export declare function validateConceptName(name: string): boolean;
22
+ /**
23
+ * Validate a platform name
24
+ */
25
+ export declare function validatePlatformName(name: string): boolean;
26
+ /**
27
+ * Validate a file path
28
+ */
29
+ export declare function validateFilePath(filePath: string): boolean;
30
+ /**
31
+ * Validate an email
32
+ */
33
+ export declare function validateEmail(email: string): boolean;
34
+ /**
35
+ * Validate a URL
36
+ */
37
+ export declare function validateUrl(url: string): boolean;
38
+ /**
39
+ * Validate semantic version
40
+ */
41
+ export declare function validateSemver(version: string): boolean;
42
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE7D;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GACrB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE,eAAe,EAAE,CAAA;CAAE,CAe5D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,MAAM,GAAE,eAAe,EAAO,EAC9B,QAAQ,GAAE,GAAG,EAAO,GACnB,gBAAgB,CAMlB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIzD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI1D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGpD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOhD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAGvD"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ /**
3
+ * Validation utilities
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.validateSchema = validateSchema;
7
+ exports.createValidationResult = createValidationResult;
8
+ exports.validateConceptName = validateConceptName;
9
+ exports.validatePlatformName = validatePlatformName;
10
+ exports.validateFilePath = validateFilePath;
11
+ exports.validateEmail = validateEmail;
12
+ exports.validateUrl = validateUrl;
13
+ exports.validateSemver = validateSemver;
14
+ const zod_1 = require("zod");
15
+ /**
16
+ * Validate data against a Zod schema
17
+ */
18
+ function validateSchema(data, schema) {
19
+ try {
20
+ const validated = schema.parse(data);
21
+ return { success: true, data: validated };
22
+ }
23
+ catch (error) {
24
+ if (error instanceof zod_1.z.ZodError) {
25
+ const errors = error.errors.map(e => ({
26
+ path: e.path.join('.'),
27
+ message: e.message,
28
+ code: e.code
29
+ }));
30
+ return { success: false, errors };
31
+ }
32
+ throw error;
33
+ }
34
+ }
35
+ /**
36
+ * Create a validation result
37
+ */
38
+ function createValidationResult(valid, errors = [], warnings = []) {
39
+ return {
40
+ valid,
41
+ errors,
42
+ warnings
43
+ };
44
+ }
45
+ /**
46
+ * Validate a concept name
47
+ */
48
+ function validateConceptName(name) {
49
+ // Must be kebab-case, alphanumeric with hyphens
50
+ const pattern = /^[a-z0-9]+(-[a-z0-9]+)*$/;
51
+ return pattern.test(name);
52
+ }
53
+ /**
54
+ * Validate a platform name
55
+ */
56
+ function validatePlatformName(name) {
57
+ // Must be lowercase alphanumeric with optional hyphens
58
+ const pattern = /^[a-z0-9]+(-[a-z0-9]+)*$/;
59
+ return pattern.test(name);
60
+ }
61
+ /**
62
+ * Validate a file path
63
+ */
64
+ function validateFilePath(filePath) {
65
+ // Basic validation - no null bytes, must not be empty
66
+ return filePath.length > 0 && !filePath.includes('\0');
67
+ }
68
+ /**
69
+ * Validate an email
70
+ */
71
+ function validateEmail(email) {
72
+ const pattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
73
+ return pattern.test(email);
74
+ }
75
+ /**
76
+ * Validate a URL
77
+ */
78
+ function validateUrl(url) {
79
+ try {
80
+ new URL(url);
81
+ return true;
82
+ }
83
+ catch {
84
+ return false;
85
+ }
86
+ }
87
+ /**
88
+ * Validate semantic version
89
+ */
90
+ function validateSemver(version) {
91
+ const pattern = /^\d+\.\d+\.\d+(-[a-z0-9.]+)?(\+[a-z0-9.]+)?$/i;
92
+ return pattern.test(version);
93
+ }
94
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAQH,wCAkBC;AAKD,wDAUC;AAKD,kDAIC;AAKD,oDAIC;AAKD,4CAGC;AAKD,sCAGC;AAKD,kCAOC;AAKD,wCAGC;AA7FD,6BAAwB;AAGxB;;GAEG;AACH,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