@biznetgio/neo-app 0.4.18 → 0.4.20

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/mcp/tools.js +127 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biznetgio/neo-app",
3
- "version": "0.4.18",
3
+ "version": "0.4.20",
4
4
  "description": "NEO App CLI — one-command agent onboarding, MCP server, and project ops for coding agents (Codex, Claude Code).",
5
5
  "type": "module",
6
6
  "bin": {
package/src/mcp/tools.js CHANGED
@@ -105,12 +105,12 @@ export const TOOLS = [
105
105
  controlPlane,
106
106
  resourceTypes,
107
107
  // Verbs this MCP build exposes today (no create-DB/queue/cron/bucket, no costed plan/apply yet).
108
- lifecycleVerbs: ['create', 'list', 'get', 'deploy', 'scale', 'logs', 'get_variables', 'set_variable', 'estimate', 'bind', 'unbind', 'run_cron', 'delete', 'list_approvals', 'get_approval', 'get_credit', 'list_templates'],
108
+ lifecycleVerbs: ['plan', 'apply', 'get_operation', 'create', 'list', 'get', 'deploy', 'scale', 'logs', 'get_variables', 'set_variable', 'estimate', 'bind', 'unbind', 'run_cron', 'delete', 'list_approvals', 'get_approval', 'get_credit', 'list_templates'],
109
109
  bindings: { supported: true, targets: ['neo_db', 'neo_queue'], writeOnly: true, note: 'neo_bind_resource injects DATABASE_URL/NATS_URL server-side at deploy; the secret is never returned (handoff 5)' },
110
110
  sourceTypes: ['git', 'image', 'dockerfile', 'local', 'template'],
111
111
  environments: ['staging', 'production'],
112
112
  pricing,
113
- costConsent: { estimateAvailable: true, dryRunIncludesCost: true, planApplyEnforced: false, note: 'neo_estimate + deploy dry-run show cost (0.4.16); server-enforced neo_plan_stack / Approve & Create is still TODO (handoff 3.3-3.5)' },
113
+ costConsent: { estimateAvailable: true, dryRunIncludesCost: true, planApplyEnforced: true, note: 'neo_plan_stack returns a costed immutable plan; neo_apply_stack is server-enforced (hash/expiry/one-shot) so a billable stack requires a reviewed plan (handoff 3.3-3.5)' },
114
114
  minClientVersion: pkgVersion(),
115
115
  deprecations: [],
116
116
  };
@@ -304,6 +304,44 @@ export const TOOLS = [
304
304
  return { ...est, priceBook: orgId ? `org:${orgId}` : 'global-defaults' };
305
305
  },
306
306
  },
307
+ {
308
+ name: 'neo_scan_repo',
309
+ description:
310
+ 'Scan a Git repository and return its deployable components (monorepo-aware): each root directory with a build marker, its detected stack, and a suggested service type + build type. Use it to show the user the component inventory and ask which to deploy — never collapse a monorepo into one service without explicit selection (handoff 6). Read-only; deploys nothing.',
311
+ mutating: false,
312
+ schema: {
313
+ type: 'object',
314
+ properties: {
315
+ repoUrl: str('Git repository URL (https://host/owner/repo)'),
316
+ branch: str('Branch (optional; default the repo default branch)'),
317
+ gitProviderId: str('Git profile id for a private repo (optional)'),
318
+ },
319
+ required: ['repoUrl'],
320
+ },
321
+ async call(api, args) {
322
+ const { data } = await api.post('/api/v1/repos/scan', { repoUrl: args.repoUrl, branch: args.branch, gitProviderId: args.gitProviderId });
323
+ const subdirs = data?.subdirs || [];
324
+ const components = subdirs.map((s) => ({
325
+ path: s.path || '.',
326
+ name: s.name,
327
+ stack: s.type, // docker | node | go | python | java | php | ruby | rust | static
328
+ suggestedServiceType: s.type === 'static' ? 'static_site' : 'web',
329
+ suggestedBuildType: s.type === 'docker' ? 'dockerfile' : 'railpack',
330
+ contextDir: s.path || undefined,
331
+ }));
332
+ return {
333
+ repoUrl: args.repoUrl,
334
+ count: components.length,
335
+ components,
336
+ note:
337
+ components.length > 1
338
+ ? 'Monorepo: multiple deployable components. Ask the user which to deploy and create each selected one with its `contextDir` — do NOT collapse them into one service (handoff 6). Worker vs web cannot be inferred from the tree alone; confirm the type with the user.'
339
+ : components.length === 1
340
+ ? 'One deployable component found.'
341
+ : 'No deployable component found (no Dockerfile/package.json/go.mod/requirements.txt/index.html/… at any root).',
342
+ };
343
+ },
344
+ },
307
345
  {
308
346
  name: 'neo_list_templates',
309
347
  description: 'List deployable templates (e.g. wordpress, n8n, redis).',
@@ -617,6 +655,93 @@ export const TOOLS = [
617
655
  return result(status, data);
618
656
  },
619
657
  },
658
+ // --- Costed plan / apply backbone (handoff 3.3-3.5 + 7): plan a whole stack
659
+ // zero-write, review the cost, then apply with the plan id+hash. The server
660
+ // enforces the plan (hash/expiry/one-shot) and runs it in dependency order. ---
661
+ {
662
+ name: 'neo_plan_stack',
663
+ description:
664
+ 'Create an immutable, COSTED plan for a whole stack (services + databases/queues/buckets + bindings) WITHOUT creating anything — zero-write (handoff 3.3). Returns planId, planHash, itemized monthly/hourly cost, and ordered phases. Show the cost to the user for approval, then call neo_apply_stack with planId+planHash. The plan expires in 15 minutes.',
665
+ mutating: false,
666
+ schema: {
667
+ type: 'object',
668
+ properties: {
669
+ projectId: str('Project id'),
670
+ environment: { type: 'string', enum: ['staging', 'production'], description: 'REQUIRED — staging or production (never defaulted, handoff §2)' },
671
+ resources: {
672
+ type: 'array',
673
+ description: 'The stack resources. Each needs a unique name + kind (app | database | queue | bucket).',
674
+ items: {
675
+ type: 'object',
676
+ properties: {
677
+ kind: { type: 'string', enum: ['app', 'database', 'queue', 'bucket'] },
678
+ name: str('Unique resource name within this stack (bindings reference it)'),
679
+ serviceType: str('app: web | worker | static_site'),
680
+ image: str('app: prebuilt image reference'),
681
+ repoUrl: str('app: git repository URL'),
682
+ branch: str('app: git branch'),
683
+ port: int('app: container port'),
684
+ computeTier: str('app/db/queue: micro | small | medium | large | xlarge'),
685
+ engine: str('database: postgres | mysql'),
686
+ version: str('database: engine version, e.g. 16'),
687
+ volumeSize: str('database: storage size, e.g. 10Gi'),
688
+ quotaGB: int('bucket: storage quota GB'),
689
+ region: str('bucket: region'),
690
+ },
691
+ required: ['kind', 'name'],
692
+ },
693
+ },
694
+ bindings: {
695
+ type: 'array',
696
+ description: 'Wire a database/queue into a consumer app (injected as an env var at deploy, server-side).',
697
+ items: {
698
+ type: 'object',
699
+ properties: {
700
+ consumer: str('The consumer app resource name'),
701
+ targetType: { type: 'string', enum: ['neo_db', 'neo_queue'] },
702
+ target: str('The database/queue resource name'),
703
+ envKey: str('Env var name (optional; default DATABASE_URL / NATS_URL)'),
704
+ },
705
+ required: ['consumer', 'targetType', 'target'],
706
+ },
707
+ },
708
+ },
709
+ required: ['projectId', 'environment', 'resources'],
710
+ },
711
+ async call(api, args) {
712
+ requireEnv(args.environment);
713
+ const { projectId, ...body } = args;
714
+ const { status, data } = await api.post(`/api/v1/projects/${projectId}/plans`, body);
715
+ return result(status, data);
716
+ },
717
+ },
718
+ {
719
+ name: 'neo_apply_stack',
720
+ description:
721
+ 'Apply a planned stack. REQUIRES the planId and the exact planHash from neo_plan_stack — the SERVER rejects a missing, changed, expired, or already-applied plan, so a billable stack can never be created without first creating + reviewing its costed plan (handoff 3.4/3.5, server-enforced approval). Creates resources in dependency order (foundations → services → bindings → deploy) and returns an operationId to poll with neo_get_operation.',
722
+ mutating: true,
723
+ schema: {
724
+ type: 'object',
725
+ properties: {
726
+ planId: str('Plan id from neo_plan_stack'),
727
+ planHash: str('Plan hash from neo_plan_stack — must match exactly (proves you reviewed this plan)'),
728
+ },
729
+ required: ['planId', 'planHash'],
730
+ },
731
+ async call(api, args) {
732
+ const { status, data } = await api.post(`/api/v1/plans/${args.planId}/apply`, { planHash: args.planHash });
733
+ return result(status, data);
734
+ },
735
+ },
736
+ {
737
+ name: 'neo_get_operation',
738
+ description: 'Get the status of a stack apply (the operationId/planId from neo_apply_stack): overall status (applying | applied | failed) plus per-resource status (creating | created | deployed | failed). Poll until terminal.',
739
+ mutating: false,
740
+ schema: { type: 'object', properties: { operationId: str('Operation id (= plan id from neo_apply_stack)') }, required: ['operationId'] },
741
+ async call(api, args) {
742
+ return redactSecrets((await api.get(`/api/v1/plans/${args.operationId}`)).data);
743
+ },
744
+ },
620
745
  // --- Cleanup (handoff 3.6): MCP can delete every resource type it can reach, so
621
746
  // an agent never leaks a resource it created. These are DESTRUCTIVE and permanent;
622
747
  // the server hard-deletes the record and tears down the running workload. ---