@xano/cli 1.0.4 → 1.0.6-beta.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 (81) hide show
  1. package/README.md +139 -4
  2. package/dist/base-command.d.ts +27 -0
  3. package/dist/base-command.js +124 -1
  4. package/dist/commands/auth/index.d.ts +45 -1
  5. package/dist/commands/auth/index.js +197 -29
  6. package/dist/commands/ephemeral/create/index.d.ts +18 -0
  7. package/dist/commands/ephemeral/create/index.js +103 -0
  8. package/dist/commands/ephemeral/delete/index.d.ts +18 -0
  9. package/dist/commands/ephemeral/delete/index.js +99 -0
  10. package/dist/commands/ephemeral/edit/index.d.ts +18 -0
  11. package/dist/commands/ephemeral/edit/index.js +109 -0
  12. package/dist/commands/ephemeral/get/index.d.ts +21 -0
  13. package/dist/commands/ephemeral/get/index.js +125 -0
  14. package/dist/commands/ephemeral/impersonate/index.d.ts +19 -0
  15. package/dist/commands/ephemeral/impersonate/index.js +112 -0
  16. package/dist/commands/ephemeral/list/index.d.ts +19 -0
  17. package/dist/commands/ephemeral/list/index.js +122 -0
  18. package/dist/commands/ephemeral/pull/index.d.ts +23 -0
  19. package/dist/commands/ephemeral/pull/index.js +248 -0
  20. package/dist/commands/{knowledge → ephemeral}/push/index.d.ts +8 -5
  21. package/dist/commands/ephemeral/push/index.js +143 -0
  22. package/dist/commands/function/run/index.d.ts +40 -0
  23. package/dist/commands/function/run/index.js +244 -0
  24. package/dist/commands/knowledge/{pull → get}/index.d.ts +6 -2
  25. package/dist/commands/knowledge/get/index.js +126 -0
  26. package/dist/commands/knowledge/list/index.d.ts +18 -0
  27. package/dist/commands/knowledge/list/index.js +135 -0
  28. package/dist/commands/sandbox/pull/index.js +12 -2
  29. package/dist/commands/sandbox/push/index.d.ts +1 -1
  30. package/dist/commands/sandbox/push/index.js +19 -14
  31. package/dist/commands/sandbox/reset/index.js +12 -0
  32. package/dist/commands/static_host/build/create/index.d.ts +9 -1
  33. package/dist/commands/static_host/build/create/index.js +54 -4
  34. package/dist/commands/static_host/build/delete/index.d.ts +19 -0
  35. package/dist/commands/static_host/build/delete/index.js +114 -0
  36. package/dist/commands/static_host/build/get/index.d.ts +1 -1
  37. package/dist/commands/static_host/build/get/index.js +16 -10
  38. package/dist/commands/static_host/build/pull/index.d.ts +52 -0
  39. package/dist/commands/static_host/build/pull/index.js +300 -0
  40. package/dist/commands/static_host/build/push/index.d.ts +23 -0
  41. package/dist/commands/static_host/build/push/index.js +228 -0
  42. package/dist/commands/static_host/create/index.d.ts +17 -0
  43. package/dist/commands/static_host/create/index.js +86 -0
  44. package/dist/commands/static_host/deploy/index.d.ts +18 -0
  45. package/dist/commands/static_host/deploy/index.js +105 -0
  46. package/dist/commands/static_host/edit/index.d.ts +23 -0
  47. package/dist/commands/static_host/edit/index.js +151 -0
  48. package/dist/commands/static_host/get/index.d.ts +18 -0
  49. package/dist/commands/static_host/get/index.js +94 -0
  50. package/dist/commands/static_host/migrate/index.d.ts +44 -0
  51. package/dist/commands/static_host/migrate/index.js +205 -0
  52. package/dist/commands/tenant/snapshot/create/index.d.ts +17 -0
  53. package/dist/commands/tenant/snapshot/create/index.js +78 -0
  54. package/dist/commands/tenant/snapshot/delete/index.d.ts +19 -0
  55. package/dist/commands/tenant/snapshot/delete/index.js +102 -0
  56. package/dist/commands/tenant/snapshot/list/index.d.ts +16 -0
  57. package/dist/commands/tenant/snapshot/list/index.js +96 -0
  58. package/dist/commands/tenant/snapshot/swap/index.d.ts +19 -0
  59. package/dist/commands/tenant/snapshot/swap/index.js +103 -0
  60. package/dist/commands/tenant/unit_test/run/index.d.ts +1 -0
  61. package/dist/commands/tenant/unit_test/run/index.js +7 -0
  62. package/dist/commands/tenant/unit_test/run_all/index.js +7 -3
  63. package/dist/commands/unit_test/run/index.d.ts +1 -0
  64. package/dist/commands/unit_test/run/index.js +8 -0
  65. package/dist/commands/unit_test/run_all/index.js +7 -3
  66. package/dist/commands/workspace/pull/index.js +13 -2
  67. package/dist/commands/workspace/push/index.d.ts +1 -1
  68. package/dist/commands/workspace/push/index.js +15 -5
  69. package/dist/utils/function-input.d.ts +77 -0
  70. package/dist/utils/function-input.js +148 -0
  71. package/dist/utils/knowledge-sync.d.ts +84 -79
  72. package/dist/utils/knowledge-sync.js +376 -323
  73. package/dist/utils/multidoc-push.d.ts +30 -18
  74. package/dist/utils/multidoc-push.js +284 -148
  75. package/dist/utils/reference-checker.js +2 -2
  76. package/dist/utils/static-host-files.d.ts +21 -0
  77. package/dist/utils/static-host-files.js +41 -0
  78. package/oclif.manifest.json +5046 -2691
  79. package/package.json +10 -1
  80. package/dist/commands/knowledge/pull/index.js +0 -86
  81. package/dist/commands/knowledge/push/index.js +0 -126
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xano/cli",
3
3
  "description": "CLI for Xano's Metadata API",
4
- "version": "1.0.4",
4
+ "version": "1.0.6-beta.0",
5
5
  "author": "Sean Montgomery",
6
6
  "bin": {
7
7
  "xano": "./bin/run.js"
@@ -11,6 +11,9 @@
11
11
  "@oclif/core": "^4",
12
12
  "@oclif/plugin-help": "^6",
13
13
  "@oclif/plugin-plugins": "^5",
14
+ "@types/archiver": "^7.0.0",
15
+ "archiver": "^7.0.1",
16
+ "ignore": "^7.0.5",
14
17
  "inquirer": "^13.3.0",
15
18
  "js-yaml": "^4.1.0",
16
19
  "lodash.snakecase": "^4.1.1",
@@ -80,6 +83,9 @@
80
83
  "function": {
81
84
  "description": "Manage reusable functions in a workspace"
82
85
  },
86
+ "knowledge": {
87
+ "description": "Manage workspace knowledge and skills"
88
+ },
83
89
  "profile": {
84
90
  "description": "Manage CLI profiles and authentication"
85
91
  },
@@ -92,6 +98,9 @@
92
98
  "release": {
93
99
  "description": "Manage releases in a workspace"
94
100
  },
101
+ "ephemeral": {
102
+ "description": "Manage ephemeral tenants in a workspace"
103
+ },
95
104
  "tenant": {
96
105
  "description": "Manage tenants in a workspace"
97
106
  },
@@ -1,86 +0,0 @@
1
- import { Flags } from '@oclif/core';
2
- import * as fs from 'node:fs';
3
- import { dirname, resolve } from 'node:path';
4
- import BaseCommand from '../../../base-command.js';
5
- import { fetchKnowledgeList, safeKnowledgePath } from '../../../utils/knowledge-sync.js';
6
- export default class KnowledgePull extends BaseCommand {
7
- static description = 'Pull knowledge files from a workspace. Each knowledge item name is a path (e.g. "some/thing/CLAUDE.md") and its content is written to that path under the output directory.';
8
- static examples = [
9
- `$ xano knowledge pull
10
- Pulled 4 knowledge files to current directory
11
- `,
12
- `$ xano knowledge pull -d ./knowledge
13
- Pulled 4 knowledge files to ./knowledge
14
- `,
15
- `$ xano knowledge pull -d ./knowledge -w 40`,
16
- `$ xano knowledge pull -b dev`,
17
- ];
18
- static flags = {
19
- ...BaseCommand.baseFlags,
20
- branch: Flags.string({
21
- char: 'b',
22
- description: 'Branch name (optional if set in profile, defaults to live)',
23
- required: false,
24
- }),
25
- directory: Flags.string({
26
- char: 'd',
27
- default: '.',
28
- description: 'Output directory for pulled knowledge files (defaults to current directory)',
29
- required: false,
30
- }),
31
- workspace: Flags.string({
32
- char: 'w',
33
- description: 'Workspace ID (optional if set in profile)',
34
- required: false,
35
- }),
36
- };
37
- async run() {
38
- const { flags } = await this.parse(KnowledgePull);
39
- const { profile, profileName } = this.resolveProfile(flags);
40
- // Determine workspace_id from flag or profile
41
- let workspaceId;
42
- if (flags.workspace) {
43
- workspaceId = flags.workspace;
44
- }
45
- else if (profile.workspace) {
46
- workspaceId = profile.workspace;
47
- }
48
- else {
49
- this.error(`Workspace ID is required. Either:\n` +
50
- ` 1. Provide it as a flag: xano knowledge pull -w <workspace_id>\n` +
51
- ` 2. Set it in your profile using: xano profile:edit ${profileName} -w <workspace_id>`);
52
- }
53
- const branch = flags.branch || profile.branch || '';
54
- let items;
55
- try {
56
- items = await fetchKnowledgeList({
57
- accessToken: profile.access_token,
58
- branch,
59
- instanceOrigin: profile.instance_origin,
60
- verboseFetch: this.verboseFetch.bind(this),
61
- workspaceId,
62
- }, flags.verbose);
63
- }
64
- catch (error) {
65
- this.error(`Failed to fetch knowledge: ${error.message}`);
66
- }
67
- if (items.length === 0) {
68
- this.log('No knowledge found in workspace');
69
- return;
70
- }
71
- const outputDir = resolve(flags.directory);
72
- fs.mkdirSync(outputDir, { recursive: true });
73
- let writtenCount = 0;
74
- for (const item of items) {
75
- const filePath = safeKnowledgePath(outputDir, item.name);
76
- if (!filePath) {
77
- this.warn(`Skipping knowledge "${item.name}": name is not a safe relative path`);
78
- continue;
79
- }
80
- fs.mkdirSync(dirname(filePath), { recursive: true });
81
- fs.writeFileSync(filePath, item.content ?? '', 'utf8');
82
- writtenCount++;
83
- }
84
- this.log(`Pulled ${writtenCount} knowledge files to ${flags.directory}`);
85
- }
86
- }
@@ -1,126 +0,0 @@
1
- import { Flags } from '@oclif/core';
2
- import * as fs from 'node:fs';
3
- import { resolve } from 'node:path';
4
- import BaseCommand from '../../../base-command.js';
5
- import { executeKnowledgePush } from '../../../utils/knowledge-sync.js';
6
- export default class KnowledgePush extends BaseCommand {
7
- static description = '[IMPORTANT] ALWAYS run --dry-run first and show the user the output before pushing. Push local knowledge files to a workspace. Each file becomes a knowledge item named by its relative path (e.g. "some/thing/CLAUDE.md"). By default, only changed files are pushed (partial mode). Use --sync to compare all files (required for --delete). Shows a preview of changes before pushing unless --force is specified. Use --dry-run to preview only.';
8
- static examples = [
9
- `$ xano knowledge push
10
- Push from current directory (default partial mode)
11
- `,
12
- `$ xano knowledge push -d ./knowledge
13
- Push from a specific directory
14
- `,
15
- `$ xano knowledge push --dry-run
16
- Preview changes without pushing
17
- `,
18
- `$ xano knowledge push --sync --delete
19
- Push all files and delete remote knowledge not included
20
- `,
21
- `$ xano knowledge push --force
22
- Skip preview and push immediately (for CI/CD)
23
- `,
24
- `$ xano knowledge push -i "guides/*"
25
- Push only files matching the glob pattern
26
- `,
27
- `$ xano knowledge push -e "**/README.md"
28
- Push all files except READMEs
29
- `,
30
- ];
31
- static flags = {
32
- ...BaseCommand.baseFlags,
33
- branch: Flags.string({
34
- char: 'b',
35
- description: 'Branch name (optional if set in profile, defaults to live)',
36
- required: false,
37
- }),
38
- delete: Flags.boolean({
39
- default: false,
40
- description: '[CRITICAL] STOP and confirm with the user before running. Delete remote knowledge not included in the push (requires --sync).',
41
- required: false,
42
- }),
43
- directory: Flags.string({
44
- char: 'd',
45
- default: '.',
46
- description: 'Directory containing knowledge files to push (defaults to current directory)',
47
- required: false,
48
- }),
49
- 'dry-run': Flags.boolean({
50
- default: false,
51
- description: 'Show preview of changes without pushing (exit after preview)',
52
- required: false,
53
- }),
54
- exclude: Flags.string({
55
- char: 'e',
56
- description: 'Glob pattern to exclude files (e.g. "**/README.md"). Matched against relative paths from the push directory.',
57
- multiple: true,
58
- required: false,
59
- }),
60
- force: Flags.boolean({
61
- default: false,
62
- description: '[CRITICAL] NEVER run without explicit user confirmation. Skips preview and confirmation prompt (for CI/CD pipelines).',
63
- required: false,
64
- }),
65
- include: Flags.string({
66
- char: 'i',
67
- description: 'Glob pattern to include files (e.g. "guides/*"). Matched against relative paths from the push directory.',
68
- multiple: true,
69
- required: false,
70
- }),
71
- sync: Flags.boolean({
72
- default: false,
73
- description: 'Full push — compare all files, not just changed ones. Required for --delete.',
74
- required: false,
75
- }),
76
- workspace: Flags.string({
77
- char: 'w',
78
- description: 'Workspace ID (optional if set in profile)',
79
- required: false,
80
- }),
81
- };
82
- async run() {
83
- const { flags } = await this.parse(KnowledgePush);
84
- const { profile, profileName } = this.resolveProfile(flags);
85
- // Determine workspace_id from flag or profile
86
- let workspaceId;
87
- if (flags.workspace) {
88
- workspaceId = flags.workspace;
89
- }
90
- else if (profile.workspace) {
91
- workspaceId = profile.workspace;
92
- }
93
- else {
94
- this.error(`Workspace ID is required. Either:\n` +
95
- ` 1. Provide it as a flag: xano knowledge push -w <workspace_id>\n` +
96
- ` 2. Set it in your profile using: xano profile:edit ${profileName} -w <workspace_id>`);
97
- }
98
- const inputDir = resolve(flags.directory);
99
- if (!fs.existsSync(inputDir)) {
100
- this.error(`Directory not found: ${inputDir}`);
101
- }
102
- if (!fs.statSync(inputDir).isDirectory()) {
103
- this.error(`Not a directory: ${inputDir}`);
104
- }
105
- const branch = flags.branch || profile.branch || '';
106
- const pushFlags = {
107
- delete: flags.delete,
108
- 'dry-run': flags['dry-run'],
109
- exclude: flags.exclude,
110
- force: flags.force,
111
- include: flags.include,
112
- sync: flags.sync,
113
- verbose: flags.verbose,
114
- };
115
- await executeKnowledgePush({
116
- accessToken: profile.access_token,
117
- branch,
118
- cliVersion: this.config.version,
119
- command: this,
120
- inputDir,
121
- instanceOrigin: profile.instance_origin,
122
- verboseFetch: this.verboseFetch.bind(this),
123
- workspaceId,
124
- }, pushFlags);
125
- }
126
- }