@enerlence/suntropy-cli 0.7.0 → 0.8.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.
- package/dist/bin/suntropy.js +23 -9
- package/dist/bin/suntropy.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/suntropy.js
CHANGED
|
@@ -7,7 +7,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
// src/index.ts
|
|
10
|
-
import { Command as
|
|
10
|
+
import { Command as Command3 } from "commander";
|
|
11
11
|
|
|
12
12
|
// src/config.ts
|
|
13
13
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -1797,6 +1797,7 @@ function registerInventoryCommands(program2) {
|
|
|
1797
1797
|
}
|
|
1798
1798
|
|
|
1799
1799
|
// src/commands/studies/builder.ts
|
|
1800
|
+
import { Option } from "commander";
|
|
1800
1801
|
import { readFileSync as readFileSync3, writeFileSync as writeFileSync4, existsSync as existsSync2 } from "fs";
|
|
1801
1802
|
|
|
1802
1803
|
// node_modules/uuid/dist/esm-node/rng.js
|
|
@@ -3144,11 +3145,15 @@ Example: suntropy studies set data --file study.json --data '{"referenceId":"REF
|
|
|
3144
3145
|
});
|
|
3145
3146
|
studies.command("comment <studyId>").description(
|
|
3146
3147
|
'Add a comment to an existing study via API.\nExample: suntropy studies comment abc123 --content "Revisado por agente"'
|
|
3147
|
-
).requiredOption("--content <text>", "Comment text").action(async (studyId, opts) => {
|
|
3148
|
+
).requiredOption("--content <text>", "Comment text").addOption(new Option("--as-alexandria").hideHelp()).addOption(new Option("--reply-to-user <userUID>").hideHelp()).addOption(new Option("--reply-to-name <name>").hideHelp()).action(async (studyId, opts) => {
|
|
3148
3149
|
try {
|
|
3149
3150
|
const global = getGlobalOpts7(studies);
|
|
3150
3151
|
const client = createServiceClient("solar", global);
|
|
3151
|
-
const comment = createComment("commented", opts.content
|
|
3152
|
+
const comment = createComment("commented", opts.content, {
|
|
3153
|
+
asAlexandria: Boolean(opts.asAlexandria),
|
|
3154
|
+
replyToUser: opts.replyToUser,
|
|
3155
|
+
replyToName: opts.replyToName
|
|
3156
|
+
});
|
|
3152
3157
|
const res = await client.post(`/solar-study/addSolarStudyComment/${studyId}`, comment);
|
|
3153
3158
|
output(res.data, global);
|
|
3154
3159
|
} catch (err) {
|
|
@@ -3271,19 +3276,28 @@ async function fetchPeriodDistribution(study, global) {
|
|
|
3271
3276
|
return null;
|
|
3272
3277
|
}
|
|
3273
3278
|
}
|
|
3274
|
-
function createComment(type, content) {
|
|
3279
|
+
function createComment(type, content, extra) {
|
|
3275
3280
|
const config = loadConfig();
|
|
3276
3281
|
const profile = getActiveProfile(config);
|
|
3277
3282
|
const autoContent = {
|
|
3278
3283
|
created: "Estudio creado via CLI",
|
|
3279
3284
|
modified: "Estudio actualizado via CLI"
|
|
3280
3285
|
};
|
|
3281
|
-
|
|
3282
|
-
|
|
3286
|
+
let body = content || autoContent[type] || "";
|
|
3287
|
+
if (extra?.replyToUser) {
|
|
3288
|
+
const name = extra.replyToName || extra.replyToUser;
|
|
3289
|
+
body = `@[${name}](${extra.replyToUser}) ${body}`.trim();
|
|
3290
|
+
}
|
|
3291
|
+
const comment = {
|
|
3292
|
+
content: body,
|
|
3283
3293
|
type,
|
|
3284
3294
|
creationTimestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3285
|
-
creationUserUID: profile.userUID || "cli-agent"
|
|
3295
|
+
creationUserUID: extra?.asAlexandria ? "alexandria" : profile.userUID || "cli-agent"
|
|
3286
3296
|
};
|
|
3297
|
+
if (extra?.asAlexandria) {
|
|
3298
|
+
comment.aiGenerated = true;
|
|
3299
|
+
}
|
|
3300
|
+
return comment;
|
|
3287
3301
|
}
|
|
3288
3302
|
|
|
3289
3303
|
// src/commands/studies/index.ts
|
|
@@ -4309,9 +4323,9 @@ function registerGeocodeCommands(program2) {
|
|
|
4309
4323
|
}
|
|
4310
4324
|
|
|
4311
4325
|
// src/index.ts
|
|
4312
|
-
var CLI_VERSION = true ? "0.
|
|
4326
|
+
var CLI_VERSION = true ? "0.8.0" : "0.0.0-dev";
|
|
4313
4327
|
function createProgram() {
|
|
4314
|
-
const program2 = new
|
|
4328
|
+
const program2 = new Command3();
|
|
4315
4329
|
program2.name("suntropy").description("Agent-first CLI for Suntropy solar platform. Optimized for programmatic data manipulation and progressive exploration.").version(CLI_VERSION).option("--format <format>", "Output format: json (default), human, csv", "json").option("--fields <fields>", "Comma-separated fields to include in output").option("--server <url>", "Override API server URL").option("--token <jwt>", "Override authentication token").option("--profile <name>", "Use a specific config profile").option("--verbose", "Show HTTP request/response details on stderr").option("--quiet", "Suppress non-data output").option("--save <file>", "Save output to file (also writes to stdout)");
|
|
4316
4330
|
registerAuthCommands(program2);
|
|
4317
4331
|
registerConfigCommands(program2);
|