amxx-builder 1.5.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 (68) hide show
  1. package/AGENTS.md +111 -0
  2. package/README.md +485 -0
  3. package/action-entry.js +42 -0
  4. package/action.yml +55 -0
  5. package/defaults/amxbuild.defaults.yml +40 -0
  6. package/index.js +4 -0
  7. package/mcp/dep-resolver.js +75 -0
  8. package/mcp/handlers.js +862 -0
  9. package/mcp/mcp-server.js +112 -0
  10. package/mcp/registry.js +863 -0
  11. package/mcp/symbol-index.js +171 -0
  12. package/package.json +68 -0
  13. package/src/archiver.js +140 -0
  14. package/src/asset-fetcher.js +277 -0
  15. package/src/build-plan.js +101 -0
  16. package/src/build-service.js +188 -0
  17. package/src/cache-dir.js +21 -0
  18. package/src/cache-info.js +104 -0
  19. package/src/cli.js +302 -0
  20. package/src/collector.js +89 -0
  21. package/src/commands/build.js +49 -0
  22. package/src/commands/cache.js +77 -0
  23. package/src/commands/clean.js +33 -0
  24. package/src/commands/compile-renderer.js +38 -0
  25. package/src/commands/deploy.js +40 -0
  26. package/src/commands/deps-tree.js +92 -0
  27. package/src/commands/doctor.js +77 -0
  28. package/src/commands/dry-run.js +64 -0
  29. package/src/commands/init.js +228 -0
  30. package/src/commands/mcp.js +13 -0
  31. package/src/commands/releases.js +45 -0
  32. package/src/commands/resolve-manifest.js +27 -0
  33. package/src/commands/serve.js +489 -0
  34. package/src/commands/shared.js +24 -0
  35. package/src/commands/validate.js +34 -0
  36. package/src/commands/watch.js +209 -0
  37. package/src/compile-utils.js +65 -0
  38. package/src/compiler-fetcher.js +327 -0
  39. package/src/compiler.js +228 -0
  40. package/src/dep-graph.js +92 -0
  41. package/src/deployer.js +197 -0
  42. package/src/deps-resolver.js +127 -0
  43. package/src/deps-tree.js +202 -0
  44. package/src/env.js +18 -0
  45. package/src/events.js +29 -0
  46. package/src/format.js +23 -0
  47. package/src/fs-utils.js +87 -0
  48. package/src/include-tree.js +845 -0
  49. package/src/ini-builder.js +44 -0
  50. package/src/jsonrpc-transport.js +195 -0
  51. package/src/logger.js +50 -0
  52. package/src/manifest-path.js +34 -0
  53. package/src/manifest.js +373 -0
  54. package/src/progress.js +66 -0
  55. package/src/rcon.js +103 -0
  56. package/src/release-fetcher.js +206 -0
  57. package/src/release-lister.js +79 -0
  58. package/src/repo-fetcher.js +273 -0
  59. package/src/retry.js +50 -0
  60. package/src/schema.js +54 -0
  61. package/src/update-check.js +114 -0
  62. package/src/validate.js +69 -0
  63. package/src/watcher.js +135 -0
  64. package/templates/init-build.bat +11 -0
  65. package/templates/init-build.sh +7 -0
  66. package/templates/init-deploy.env +14 -0
  67. package/templates/init-manifest.yml +6 -0
  68. package/templates/init-workflow.yml +59 -0
package/action.yml ADDED
@@ -0,0 +1,55 @@
1
+ name: 'amxx-builder'
2
+ description: 'Build and package AMX Mod X server plugins from a manifest'
3
+ author: 'ArKaNeMaN'
4
+
5
+ branding:
6
+ icon: 'package'
7
+ color: 'blue'
8
+
9
+ inputs:
10
+ manifest:
11
+ description: 'Path to amxbuild.yml (relative to workspace root)'
12
+ required: false
13
+ default: './amxbuild.yml'
14
+ build-dir:
15
+ description: 'Build staging directory'
16
+ required: false
17
+ default: './build'
18
+ no-fetch:
19
+ description: 'Skip re-cloning repos (use local runner cache only)'
20
+ required: false
21
+ default: 'false'
22
+ no-archive:
23
+ description: 'Skip archive creation — compile only'
24
+ required: false
25
+ default: 'false'
26
+ version:
27
+ description: 'Shorthand for --set version=<value>'
28
+ required: false
29
+ archive-name:
30
+ description: 'Shorthand for --set output.archive_name=<value>'
31
+ required: false
32
+ set:
33
+ description: |
34
+ Override any manifest field. One entry per line:
35
+ version=1.2.3
36
+ output.archive_name={name}-{version}.zip
37
+ output.generate_ini=false
38
+ github.tokens.MyOrg=GITHUB_TOKEN_MYORG
39
+ required: false
40
+ github-token:
41
+ description: >
42
+ GitHub token for accessing private repositories.
43
+ Defaults to the built-in GITHUB_TOKEN (sufficient for public repos).
44
+ For multiple organizations, pass secrets via the job `env:` block and
45
+ map them with `github.tokens.<owner>=<ENV_VAR>` in the `set` input.
46
+ required: false
47
+ default: ${{ github.token }}
48
+
49
+ outputs:
50
+ name:
51
+ description: 'Project name from the manifest (value of manifest.name)'
52
+
53
+ runs:
54
+ using: 'node24'
55
+ main: 'dist/index.js'
@@ -0,0 +1,40 @@
1
+ # Default values for amxbuild.yml manifests.
2
+ # Loaded first; the project manifest is deep-merged on top, then --set overrides are applied.
3
+ # Arrays (repos, deps, assets.sources) are replaced entirely by the project manifest.
4
+
5
+ version: "1.0.0"
6
+
7
+ amxmodx:
8
+ dir: amxmodx
9
+ defines: []
10
+
11
+ github:
12
+ token_env: GITHUB_TOKEN
13
+ # Per-owner tokens: map of owner → env var name holding that owner's PAT.
14
+ # Resolved as github.tokens[owner] → token_env → GITHUB_TOKEN.
15
+ tokens: {}
16
+ ssh: false
17
+
18
+ output:
19
+ dir: ./
20
+ archive_name: "{name}.zip"
21
+ amxmodx_path: "{name}/addons/amxmodx"
22
+ assets_path: "{name}"
23
+ readme: true
24
+ generate_ini: false
25
+ pack: true
26
+ on_conflict: last_wins
27
+
28
+ plugins: []
29
+
30
+ assets:
31
+ on_conflict: last_wins
32
+ sources:
33
+ - source: local
34
+
35
+ deploy:
36
+ amxmodx_path: addons/amxmodx
37
+ watch_debounce_ms: 500
38
+ exclude: []
39
+ rcon:
40
+ port: 27015
package/index.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ require('./src/cli');
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /**
5
+ * MCP server: AMXX Dependency Interface Resolver.
6
+ * Tools and schemas live in mcp/registry.js; handlers in mcp/handlers.js.
7
+ * Register in opencode.json:
8
+ * "mcp": { "amxx-dep-resolver": { "type": "local", "command": ["amxb", "mcp"], "enabled": true } }
9
+ */
10
+
11
+ const path = require('path');
12
+ const dotenv = require('dotenv');
13
+
14
+ const logger = require('../src/logger');
15
+ const progress = require('../src/progress');
16
+ const { McpServer } = require('./mcp-server');
17
+ const { listTools, callTool } = require('./registry');
18
+
19
+ const SERVER_INFO = {
20
+ name: 'amxx-dep-resolver',
21
+ version: '1.0.0',
22
+ };
23
+
24
+ /**
25
+ * Create and configure the MCP server with all tool handlers.
26
+ * Does NOT connect — call startServer() to begin listening on stdin.
27
+ */
28
+ function createServer() {
29
+ const server = new McpServer(SERVER_INFO, { tools: {} });
30
+
31
+ server.setRequestHandler('ListTools', async () => listTools());
32
+
33
+ server.setRequestHandler('CallTool', async (request) => {
34
+ const { name, arguments: args } = request.params;
35
+
36
+ try {
37
+ return await callTool(name, args);
38
+ } catch (err) {
39
+ return {
40
+ content: [{ type: 'text', text: `Error: ${err.message || String(err)}` }],
41
+ isError: true,
42
+ };
43
+ }
44
+ });
45
+
46
+ return server;
47
+ }
48
+
49
+ // Load project .env like the CLI does; keep stdout free for JSON-RPC.
50
+ // No override: real process env (client-provided GITHUB_TOKEN etc.) wins.
51
+ function prepareEnvironment() {
52
+ dotenv.config({ path: path.join(process.cwd(), '.env'), quiet: true });
53
+ logger.setStderr(true);
54
+ progress.setEnabled(false);
55
+ }
56
+
57
+ /**
58
+ * Start the MCP server — listens on stdin/stdout forever.
59
+ */
60
+ async function startServer() {
61
+ prepareEnvironment();
62
+ const server = createServer();
63
+ await server.connect();
64
+ }
65
+
66
+ module.exports = { createServer, startServer };
67
+
68
+ // ─── Direct execution guard ────────────────────────────────────────────────────
69
+
70
+ if (require.main === module) {
71
+ startServer().catch((err) => {
72
+ console.error('Fatal MCP server error:', err);
73
+ process.exit(1);
74
+ });
75
+ }