@skroyc/librarian 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 (72) hide show
  1. package/CHANGELOG.md +176 -0
  2. package/LICENSE +210 -0
  3. package/README.md +614 -0
  4. package/biome.jsonc +9 -0
  5. package/dist/agents/context-schema.d.ts +17 -0
  6. package/dist/agents/context-schema.d.ts.map +1 -0
  7. package/dist/agents/context-schema.js +16 -0
  8. package/dist/agents/context-schema.js.map +1 -0
  9. package/dist/agents/react-agent.d.ts +38 -0
  10. package/dist/agents/react-agent.d.ts.map +1 -0
  11. package/dist/agents/react-agent.js +719 -0
  12. package/dist/agents/react-agent.js.map +1 -0
  13. package/dist/agents/tool-runtime.d.ts +7 -0
  14. package/dist/agents/tool-runtime.d.ts.map +1 -0
  15. package/dist/agents/tool-runtime.js +2 -0
  16. package/dist/agents/tool-runtime.js.map +1 -0
  17. package/dist/cli.d.ts +4 -0
  18. package/dist/cli.d.ts.map +1 -0
  19. package/dist/cli.js +172 -0
  20. package/dist/cli.js.map +1 -0
  21. package/dist/config.d.ts +4 -0
  22. package/dist/config.d.ts.map +1 -0
  23. package/dist/config.js +243 -0
  24. package/dist/config.js.map +1 -0
  25. package/dist/index.d.ts +41 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +470 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/tools/file-finding.tool.d.ts +24 -0
  30. package/dist/tools/file-finding.tool.d.ts.map +1 -0
  31. package/dist/tools/file-finding.tool.js +198 -0
  32. package/dist/tools/file-finding.tool.js.map +1 -0
  33. package/dist/tools/file-listing.tool.d.ts +12 -0
  34. package/dist/tools/file-listing.tool.d.ts.map +1 -0
  35. package/dist/tools/file-listing.tool.js +132 -0
  36. package/dist/tools/file-listing.tool.js.map +1 -0
  37. package/dist/tools/file-reading.tool.d.ts +9 -0
  38. package/dist/tools/file-reading.tool.d.ts.map +1 -0
  39. package/dist/tools/file-reading.tool.js +112 -0
  40. package/dist/tools/file-reading.tool.js.map +1 -0
  41. package/dist/tools/grep-content.tool.d.ts +27 -0
  42. package/dist/tools/grep-content.tool.d.ts.map +1 -0
  43. package/dist/tools/grep-content.tool.js +229 -0
  44. package/dist/tools/grep-content.tool.js.map +1 -0
  45. package/dist/utils/file-utils.d.ts +2 -0
  46. package/dist/utils/file-utils.d.ts.map +1 -0
  47. package/dist/utils/file-utils.js +28 -0
  48. package/dist/utils/file-utils.js.map +1 -0
  49. package/dist/utils/logger.d.ts +32 -0
  50. package/dist/utils/logger.d.ts.map +1 -0
  51. package/dist/utils/logger.js +177 -0
  52. package/dist/utils/logger.js.map +1 -0
  53. package/dist/utils/path-utils.d.ts +2 -0
  54. package/dist/utils/path-utils.d.ts.map +1 -0
  55. package/dist/utils/path-utils.js +9 -0
  56. package/dist/utils/path-utils.js.map +1 -0
  57. package/package.json +84 -0
  58. package/src/agents/context-schema.ts +61 -0
  59. package/src/agents/react-agent.ts +928 -0
  60. package/src/agents/tool-runtime.ts +21 -0
  61. package/src/cli.ts +206 -0
  62. package/src/config.ts +309 -0
  63. package/src/index.ts +628 -0
  64. package/src/tools/file-finding.tool.ts +324 -0
  65. package/src/tools/file-listing.tool.ts +212 -0
  66. package/src/tools/file-reading.tool.ts +154 -0
  67. package/src/tools/grep-content.tool.ts +325 -0
  68. package/src/utils/file-utils.ts +39 -0
  69. package/src/utils/logger.ts +295 -0
  70. package/src/utils/path-utils.ts +17 -0
  71. package/tsconfig.json +37 -0
  72. package/tsconfig.test.json +17 -0
@@ -0,0 +1,61 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Context Schema for Agent Runtime
5
+ *
6
+ * Defines context object that is passed to agent during invocation.
7
+ * This provides static runtime context that tools can access via ToolRuntime.
8
+ */
9
+ export const contextSchema = z.object({
10
+ /** The absolute path to sandbox directory where all file operations should be confined */
11
+ workingDir: z.string().describe("The absolute path to sandbox directory"),
12
+ /** Optional environment identifier (e.g., 'development', 'production') */
13
+ environment: z.string().optional().describe("Optional environment identifier"),
14
+ /** The technology group name (e.g., 'default', 'langchain') */
15
+ group: z.string().describe("The technology group name"),
16
+ /** The technology/repo name (e.g., 'react', 'openai') */
17
+ technology: z.string().describe("The technology/repo name"),
18
+ });
19
+
20
+ /**
21
+ * Type inference from contextSchema
22
+ * Use this type for context objects throughout the application
23
+ */
24
+ export type Context = z.infer<typeof contextSchema>;
25
+
26
+ /**
27
+ * Agent Context type passed during invocation.
28
+ * This matches the structure that LangChain tools expect (config.context.workingDir).
29
+ */
30
+ export interface AgentContext {
31
+ workingDir: string;
32
+ environment?: string;
33
+ group: string;
34
+ technology: string;
35
+ }
36
+
37
+ // Re-export for convenience
38
+ export type { AgentContext as AgentContextType };
39
+
40
+ /**
41
+ * Creates a context object with the given parameters.
42
+ *
43
+ * @param workingDir - The absolute path to sandbox directory
44
+ * @param group - The technology group name
45
+ * @param technology - The technology/repo name
46
+ * @param environment - Optional environment identifier
47
+ * @returns A validated context object
48
+ */
49
+ export function createContext(
50
+ workingDir: string,
51
+ group: string,
52
+ technology: string,
53
+ environment?: string
54
+ ): Context {
55
+ return contextSchema.parse({
56
+ workingDir,
57
+ group,
58
+ technology,
59
+ environment,
60
+ });
61
+ }