@tenonhq/sincronia-core 0.0.30 → 0.0.31

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/dist/commander.js CHANGED
@@ -148,6 +148,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
148
148
  });
149
149
  return cmdArgs;
150
150
  }, updateSetCommands_1.showCurrentUpdateSetCommand)
151
+ .command("changeScope", "Change to a different scope", (cmdArgs) => {
152
+ cmdArgs.options({
153
+ ...sharedOptions,
154
+ scope: {
155
+ alias: "s",
156
+ type: "string",
157
+ describe: "Scope to switch to (e.g., x_cadso_core)",
158
+ },
159
+ });
160
+ return cmdArgs;
161
+ }, updateSetCommands_1.changeScopeCommand)
162
+ .command("currentScope", "Show the current active scope", (cmdArgs) => {
163
+ cmdArgs.options({
164
+ ...sharedOptions,
165
+ });
166
+ return cmdArgs;
167
+ }, updateSetCommands_1.showCurrentScopeCommand)
151
168
  .help().argv;
152
169
  }
153
170
  });
package/dist/snClient.js CHANGED
@@ -197,6 +197,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
197
197
  params,
198
198
  });
199
199
  };
200
+ const changeScope = (scope) => {
201
+ const endpoint = "api/cadso/claude/changeScope";
202
+ return client.get(endpoint, {
203
+ params: { scope },
204
+ });
205
+ };
200
206
  return {
201
207
  getAppList,
202
208
  updateRecord,
@@ -214,6 +220,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
214
220
  getManifest,
215
221
  changeUpdateSet,
216
222
  getCurrentUpdateSet,
223
+ changeScope,
217
224
  client, // Expose the axios client for custom queries
218
225
  };
219
226
  };
@@ -1,3 +1,36 @@
1
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
+ if (k2 === undefined) k2 = k;
3
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
+ desc = { enumerable: true, get: function() { return m[k]; } };
6
+ }
7
+ Object.defineProperty(o, k2, desc);
8
+ }) : (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ o[k2] = m[k];
11
+ }));
12
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
13
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
14
+ }) : function(o, v) {
15
+ o["default"] = v;
16
+ });
17
+ var __importStar = (this && this.__importStar) || (function () {
18
+ var ownKeys = function(o) {
19
+ ownKeys = Object.getOwnPropertyNames || function (o) {
20
+ var ar = [];
21
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
22
+ return ar;
23
+ };
24
+ return ownKeys(o);
25
+ };
26
+ return function (mod) {
27
+ if (mod && mod.__esModule) return mod;
28
+ var result = {};
29
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
30
+ __setModuleDefault(result, mod);
31
+ return result;
32
+ };
33
+ })();
1
34
  var __importDefault = (this && this.__importDefault) || function (mod) {
2
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
3
36
  };
@@ -11,7 +44,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
11
44
  }
12
45
  })(function (require, exports) {
13
46
  "use strict";
47
+ var __syncRequire = typeof module === "object" && typeof module.exports === "object";
14
48
  Object.defineProperty(exports, "__esModule", { value: true });
49
+ exports.showCurrentScopeCommand = showCurrentScopeCommand;
50
+ exports.changeScopeCommand = changeScopeCommand;
15
51
  exports.showCurrentUpdateSetCommand = showCurrentUpdateSetCommand;
16
52
  exports.createUpdateSetCommand = createUpdateSetCommand;
17
53
  exports.switchUpdateSetCommand = switchUpdateSetCommand;
@@ -21,6 +57,98 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
21
57
  const Logger_1 = require("./Logger");
22
58
  const commands_1 = require("./commands");
23
59
  const chalk_1 = __importDefault(require("chalk"));
60
+ /**
61
+ * Shows the current scope
62
+ */
63
+ async function showCurrentScopeCommand(args) {
64
+ (0, commands_1.setLogLevel)(args);
65
+ try {
66
+ const client = (0, snClient_1.defaultClient)();
67
+ const scopeObj = await (0, snClient_1.unwrapSNResponse)(client.getCurrentScope());
68
+ if (scopeObj && scopeObj.scope) {
69
+ Logger_1.logger.info(chalk_1.default.bold("\nCurrent Scope:"));
70
+ Logger_1.logger.info("─".repeat(40));
71
+ Logger_1.logger.info(chalk_1.default.green(`► ${scopeObj.displayName || scopeObj.scope}`));
72
+ Logger_1.logger.info(` Scope ID: ${scopeObj.scope}`);
73
+ Logger_1.logger.info(` Sys ID: ${scopeObj.sys_id}`);
74
+ // Also show current update set for this scope
75
+ const updateSet = await getCurrentUpdateSetDetails();
76
+ if (updateSet) {
77
+ Logger_1.logger.info(` Update Set: ${updateSet.name}`);
78
+ }
79
+ }
80
+ else {
81
+ Logger_1.logger.warn("Unable to retrieve current scope information");
82
+ }
83
+ }
84
+ catch (e) {
85
+ Logger_1.logger.error("Failed to get current scope");
86
+ if (e instanceof Error)
87
+ Logger_1.logger.error(e.message);
88
+ process.exit(1);
89
+ }
90
+ }
91
+ /**
92
+ * Changes the current scope
93
+ */
94
+ async function changeScopeCommand(args) {
95
+ (0, commands_1.setLogLevel)(args);
96
+ try {
97
+ const client = (0, snClient_1.defaultClient)();
98
+ // Get scope from args or prompt
99
+ let scope = args.scope;
100
+ if (!scope) {
101
+ const inquirer = (await (__syncRequire ? Promise.resolve().then(() => __importStar(require("inquirer"))) : new Promise((resolve_1, reject_1) => { require(["inquirer"], resolve_1, reject_1); }).then(__importStar))).default;
102
+ const answers = await inquirer.prompt([{
103
+ type: "input",
104
+ name: "scope",
105
+ message: "Enter scope to switch to (e.g., x_cadso_core):",
106
+ validate: (input) => {
107
+ if (!input || input.trim() === "") {
108
+ return "Scope is required";
109
+ }
110
+ return true;
111
+ }
112
+ }]);
113
+ scope = answers.scope;
114
+ }
115
+ Logger_1.logger.info(`Switching to scope: ${scope}`);
116
+ // Call the changeScope API
117
+ const response = await client.changeScope(scope);
118
+ let result = await response.data;
119
+ // Handle wrapped response
120
+ if (result && result.result) {
121
+ result = result.result;
122
+ }
123
+ if (result && result.message === 'Success') {
124
+ Logger_1.logger.success(chalk_1.default.green(`✓ Successfully switched to scope: ${scope}`));
125
+ // Try to get and show the current update set for this scope
126
+ const updateSet = await getCurrentUpdateSetDetails(scope);
127
+ if (updateSet) {
128
+ Logger_1.logger.info(`Current update set: ${updateSet.name}`);
129
+ }
130
+ }
131
+ else if (result && result.error) {
132
+ Logger_1.logger.error(`Failed to switch scope: ${result.error}`);
133
+ process.exit(1);
134
+ }
135
+ else {
136
+ Logger_1.logger.error("Failed to switch scope - unexpected response");
137
+ process.exit(1);
138
+ }
139
+ }
140
+ catch (e) {
141
+ Logger_1.logger.error("Failed to change scope");
142
+ if (e instanceof Error) {
143
+ Logger_1.logger.error(e.message);
144
+ if (e.response) {
145
+ Logger_1.logger.error(`Response status: ${e.response.status}`);
146
+ Logger_1.logger.error(`Response data: ${JSON.stringify(e.response.data)}`);
147
+ }
148
+ }
149
+ process.exit(1);
150
+ }
151
+ }
24
152
  /**
25
153
  * Shows the current active update set
26
154
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenonhq/sincronia-core",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "description": "Next-gen file syncer",
5
5
  "license": "GPL-3.0",
6
6
  "main": "./dist/index.js",
@@ -37,7 +37,7 @@
37
37
  "typescript": "^5.2.2"
38
38
  },
39
39
  "dependencies": {
40
- "@tenonhq/sincronia-core": "^0.0.30",
40
+ "@tenonhq/sincronia-core": "^0.0.29",
41
41
  "axios": "^1.5.1",
42
42
  "axios-rate-limit": "^1.3.0",
43
43
  "chalk": "^5.3.0",