@alumbwe/anvil 1.0.31 → 1.0.36

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/bin/anvil CHANGED
@@ -1,2 +1,41 @@
1
1
  #!/usr/bin/env bun
2
- import '../src/entry.ts'
2
+ // Anvil CLI entry point
3
+ // Module resolution must find vendored @anvil/* packages
4
+
5
+ import { dirname, join } from 'path'
6
+ import { fileURLToPath } from 'url'
7
+ import { chdir, env } from 'process'
8
+ import { existsSync } from 'fs'
9
+
10
+ const __dirname = dirname(fileURLToPath(import.meta.url))
11
+ const packageRoot = join(__dirname, '..')
12
+
13
+ // Store the original CWD for the CLI to use as project root
14
+ const originalCwd = process.cwd()
15
+ env.ANVIL_ORIGINAL_CWD = originalCwd
16
+
17
+ // Change to package directory
18
+ chdir(packageRoot)
19
+
20
+ // Verify vendored packages exist
21
+ const vendorRoot = join(packageRoot, 'vendor')
22
+ const commonVendor = join(vendorRoot, '@anvil', 'common')
23
+ const sdkVendor = join(vendorRoot, '@anvil', 'sdk')
24
+
25
+ if (!existsSync(commonVendor) || !existsSync(sdkVendor)) {
26
+ console.error('Error: Vendored dependencies missing. Package may be corrupted.')
27
+ console.error(`Expected: ${commonVendor}`)
28
+ console.error(`Try reinstalling: npm uninstall -g @alumbwe/anvil && npm install -g @alumbwe/anvil`)
29
+ process.exit(1)
30
+ }
31
+
32
+ // Set up Bun's module resolution to find vendored packages
33
+ // This ensures imports like '@anvil/common/*' resolve to vendor/@anvil/common/src/*
34
+ env.BUN_CONFIG_PATHS = JSON.stringify({
35
+ '@anvil/common': [join(commonVendor, 'src', 'index.ts')],
36
+ '@anvil/common/*': [join(commonVendor, 'src', '*')],
37
+ '@anvil/sdk': [join(sdkVendor, 'dist', 'index.mjs')],
38
+ })
39
+
40
+ // Import entry point
41
+ await import('../src/entry.ts')
package/bunfig.toml CHANGED
@@ -16,8 +16,3 @@ preload = [
16
16
  "../test/setup-scm-loader.ts",
17
17
  "./test/setup-agents-artifact.ts",
18
18
  ]
19
-
20
- # Path mappings for module resolution (used when published to npm)
21
- [module.paths]
22
- "@anvil/common/*" = ["./vendor/@anvil/common/src/*", "../common/src/*"]
23
- "@anvil/sdk" = ["./vendor/@anvil/sdk/dist/index.mjs", "../sdk/src/index.ts"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alumbwe/anvil",
3
- "version": "1.0.31",
3
+ "version": "1.0.36",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,11 +5,11 @@ import { AnalyticsEvent } from '@anvil/common/constants/analytics-events'
5
5
  import { KNOWLEDGE_FILE_NAMES } from '@anvil/common/constants/knowledge'
6
6
 
7
7
  // @ts-expect-error - Bun text import attribute not supported by TypeScript
8
- import agentDefinitionSource from '../../../common/src/templates/initial-agents-dir/types/agent-definition' with { type: 'text' }
8
+ import agentDefinitionSource from '@anvil/common/templates/initial-agents-dir/types/agent-definition' with { type: 'text' }
9
9
  // @ts-expect-error - Bun text import attribute not supported by TypeScript
10
- import toolsSource from '../../../common/src/templates/initial-agents-dir/types/tools' with { type: 'text' }
10
+ import toolsSource from '@anvil/common/templates/initial-agents-dir/types/tools' with { type: 'text' }
11
11
  // @ts-expect-error - Bun text import attribute not supported by TypeScript
12
- import utilTypesSource from '../../../common/src/templates/initial-agents-dir/types/util-types' with { type: 'text' }
12
+ import utilTypesSource from '@anvil/common/templates/initial-agents-dir/types/util-types' with { type: 'text' }
13
13
  import { getProjectRoot } from '../project-files'
14
14
  import { trackEvent } from '../utils/analytics'
15
15
  import { IS_ANVIL } from '../utils/constants'
package/tsconfig.json CHANGED
@@ -14,8 +14,9 @@
14
14
  "preserveSymlinks": false,
15
15
  "baseUrl": ".",
16
16
  "paths": {
17
- "@anvil/sdk": ["../sdk/src/index.ts"],
18
- "@anvil/common/*": ["../common/src/*"]
17
+ "@anvil/sdk": ["./vendor/@anvil/sdk/dist/index.mjs", "../sdk/src/index.ts"],
18
+ "@anvil/common": ["./vendor/@anvil/common/src/index.ts", "../common/src/index.ts"],
19
+ "@anvil/common/*": ["./vendor/@anvil/common/src/*", "../common/src/*"]
19
20
  }
20
21
  },
21
22
  "include": ["src/**/*", "scripts/**/*.ts"],