@meistrari/tela-cli 0.7.58 → 1.0.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/output.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeJson = writeJson;
4
+ exports.writeLine = writeLine;
5
+ exports.writeError = writeError;
6
+ exports.formatBool = formatBool;
7
+ function writeJson(io, value) {
8
+ io.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
9
+ }
10
+ function writeLine(io, line = '') {
11
+ io.stdout.write(`${line}\n`);
12
+ }
13
+ function writeError(io, message) {
14
+ io.stderr.write(`${message}\n`);
15
+ }
16
+ function formatBool(value) {
17
+ return value ? 'yes' : 'no';
18
+ }
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runCli = runCli;
4
+ const node_fs_1 = require("node:fs");
5
+ const node_path_1 = require("node:path");
6
+ const tela_agent_1 = require("@meistrari/tela-agent");
7
+ const cli_1 = require("@meistrari/workflow-code/cli");
8
+ const output_1 = require("./output");
9
+ const auth_1 = require("./commands/auth");
10
+ const context_1 = require("./commands/context");
11
+ const doctor_auth_1 = require("./commands/doctor-auth");
12
+ const env_1 = require("./commands/env");
13
+ const ingredients_1 = require("./commands/ingredients");
14
+ async function runCli(argv, io) {
15
+ const { args, options } = parseGlobalOptions(argv);
16
+ const [command, ...rest] = args;
17
+ if (!command || command === 'help' || command === '--help' || command === '-h') {
18
+ writeHelp(io);
19
+ return 0;
20
+ }
21
+ if (command === 'version' || command === '--version' || command === '-v') {
22
+ (0, output_1.writeLine)(io, getPackageVersion());
23
+ return 0;
24
+ }
25
+ if (command === 'auth')
26
+ return await (0, auth_1.runAuthCommand)(rest, options, io);
27
+ if (command === 'context')
28
+ return await (0, context_1.runContextCommand)(rest, options, io);
29
+ if (command === 'env')
30
+ return await (0, env_1.runEnvCommand)(rest, options, io);
31
+ if (command === 'doctor')
32
+ return await (0, doctor_auth_1.runDoctorCommand)(rest, options, io);
33
+ if (command === 'agent')
34
+ return await (0, tela_agent_1.runAgentCli)(rest, io, options);
35
+ if (command === 'workflow')
36
+ return await (0, cli_1.runWorkflowCli)(rest, io, options);
37
+ if (command === 'update' || command === 'api' || command === 'docs' || command === 'whoami' || command === 'token') {
38
+ return await (0, ingredients_1.runTelactlCommand)(command, rest, options, io);
39
+ }
40
+ (0, output_1.writeError)(io, `Unknown command: ${command}`);
41
+ return 1;
42
+ }
43
+ function parseGlobalOptions(argv) {
44
+ const args = [];
45
+ const options = { json: false };
46
+ for (const arg of argv) {
47
+ if (arg === '--json') {
48
+ options.json = true;
49
+ continue;
50
+ }
51
+ if (arg === '--verbose') {
52
+ options.verbose = true;
53
+ continue;
54
+ }
55
+ args.push(arg);
56
+ }
57
+ return { args, options };
58
+ }
59
+ function writeHelp(io) {
60
+ (0, output_1.writeLine)(io, 'Usage: tela <command> [args]');
61
+ (0, output_1.writeLine)(io);
62
+ (0, output_1.writeLine)(io, 'Commands:');
63
+ (0, output_1.writeLine)(io, ' auth token [--context <context-id>] [--kind access-token|data-token] [--raw] [--json]');
64
+ (0, output_1.writeLine)(io, ' context current [--json]');
65
+ (0, output_1.writeLine)(io, ' context list [--json]');
66
+ (0, output_1.writeLine)(io, ' context show <context-id> [--json]');
67
+ (0, output_1.writeLine)(io, ' context use <context-id> [--json]');
68
+ (0, output_1.writeLine)(io, ' env list [--json]');
69
+ (0, output_1.writeLine)(io, ' env list <ingredient-slug> [-p|--pretty|--json]');
70
+ (0, output_1.writeLine)(io, ' env set <ingredient-slug> <environment>');
71
+ (0, output_1.writeLine)(io, ' doctor auth [--json]');
72
+ (0, output_1.writeLine)(io, ' update [--context <context-id>] [--json]');
73
+ (0, output_1.writeLine)(io, ' api <slug> <METHOD> <PATH> [args...] [--env <slug>] [--body <json>] [-p|--pretty]');
74
+ (0, output_1.writeLine)(io, ' docs endpoints <slug> [-p|--pretty] [--json]');
75
+ (0, output_1.writeLine)(io, ' docs reference <slug> [METHOD PATH|file-path] [-p|--pretty] [--json]');
76
+ (0, output_1.writeLine)(io, ' docs guide <slug> [path] [-p|--pretty]');
77
+ (0, output_1.writeLine)(io, ' whoami [--context <context-id>] [-p|--pretty]');
78
+ (0, output_1.writeLine)(io, ' token [--context <context-id>]');
79
+ (0, output_1.writeLine)(io, ' version');
80
+ (0, output_1.writeLine)(io, ' workflow init [--directory <path>] [--config <path>] [--workflow <key>...] [--yes] [--json]');
81
+ (0, output_1.writeLine)(io, ' workflow compile [target] [--config <path>] [--env <path>] [--json]');
82
+ (0, output_1.writeLine)(io, ' workflow docs [page] [--json]');
83
+ (0, output_1.writeLine)(io, ' workflow sync [target] [--config <path>] [--env <path>] [--yes] [--json]');
84
+ (0, output_1.writeLine)(io, ' workflow publish [target] [--environment <name>] [--create-environment-if-missing] [--config <path>] [--env <path>] [--yes] [--json]');
85
+ (0, output_1.writeLine)(io, ' workflow codegen|create|run|watch [--json]');
86
+ (0, output_1.writeLine)(io, ' agent sync [repo] [--current] [--all] [--dry-run] [--json] [--verbose]');
87
+ (0, output_1.writeLine)(io, ' agent run [--input <name=path>...] [--mode one-shot|chat] [--input-conflict fail|overwrite|rename] [--plain] [--json] [--verbose]');
88
+ (0, output_1.writeLine)(io, ' agent push [--message <text>|--claude|--manual] [--dry-run] [--json] [--verbose]');
89
+ (0, output_1.writeLine)(io, ' agent merge [branch] [--base <branch>] [--strategy squash|merge] [--keep-branch] [--yes] [--dry-run] [--json] [--verbose]');
90
+ (0, output_1.writeLine)(io, ' agent feedback [--list] [--apply all|select] [--feedback-id <id>...] [--json] [--verbose]');
91
+ (0, output_1.writeLine)(io, ' agent setup [--list-options] --context <context-id> --organization <id-or-name> [--clone-root <path>] [--ssh-public-key <path>] [--ssh-private-key <path>] [--dry-run] [--json]');
92
+ }
93
+ function getPackageVersion() {
94
+ const metadata = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '..', 'package.json'), 'utf8'));
95
+ return typeof metadata.version === 'string' ? metadata.version : '0.0.0';
96
+ }
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@meistrari/tela-cli",
3
- "version": "0.7.58",
3
+ "version": "1.0.0",
4
4
  "description": "Tela command line tools for local state and agent workflows.",
5
+ "engines": {
6
+ "node": ">=22"
7
+ },
5
8
  "license": "UNLICENSED",
6
9
  "repository": {
7
10
  "type": "git",
8
- "url": "git+https://github.com/meistrari/tela-dock.git",
11
+ "url": "git+https://github.com/meistrari/tela-local.git",
9
12
  "directory": "apps/tela-cli"
10
13
  },
11
14
  "main": "dist/index.js",
@@ -1,131 +1,140 @@
1
1
  #!/usr/bin/env node
2
-
3
- const fs = require('node:fs')
4
- const os = require('node:os')
5
- const path = require('node:path')
6
-
7
- const skillName = 'tela-cli'
8
- const metadataFile = '.tela-cli-skill.json'
9
- const managedSource = '@meistrari/tela-cli'
10
- const sourceDir = path.resolve(__dirname, '..', 'skills', skillName)
11
- const quiet = process.argv.includes('--quiet')
12
- const json = process.argv.includes('--json')
13
-
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+
26
+ // scripts/install-skills.ts
27
+ var import_node_fs = __toESM(require("node:fs"), 1);
28
+ var import_node_os = __toESM(require("node:os"), 1);
29
+ var import_node_path = __toESM(require("node:path"), 1);
30
+ var skillName = "tela-cli";
31
+ var metadataFile = ".tela-cli-skill.json";
32
+ var managedSource = "@meistrari/tela-cli";
33
+ var sourceDir = import_node_path.default.resolve(__dirname, "..", "skills", skillName);
34
+ var quiet = process.argv.includes("--quiet");
35
+ var json = process.argv.includes("--json");
14
36
  function homeDir() {
15
- return process.env.HOME || os.homedir()
37
+ return process.env.HOME || import_node_os.default.homedir();
16
38
  }
17
-
18
39
  function targetRoots() {
19
- return [
20
- path.join(homeDir(), '.agents', 'skills'),
21
- path.join(homeDir(), '.claude', 'skills'),
22
- ]
40
+ return [
41
+ import_node_path.default.join(homeDir(), ".agents", "skills"),
42
+ import_node_path.default.join(homeDir(), ".claude", "skills")
43
+ ];
23
44
  }
24
-
25
45
  function readJson(filePath) {
26
- try {
27
- return JSON.parse(fs.readFileSync(filePath, 'utf8'))
28
- }
29
- catch {
30
- return null
31
- }
46
+ try {
47
+ return JSON.parse(import_node_fs.default.readFileSync(filePath, "utf8"));
48
+ } catch {
49
+ return null;
50
+ }
32
51
  }
33
-
34
52
  function isManagedInstall(targetDir) {
35
- const metadata = readJson(path.join(targetDir, metadataFile))
36
- return metadata?.managedBy === managedSource && metadata?.skillName === skillName
53
+ const metadata = readJson(import_node_path.default.join(targetDir, metadataFile));
54
+ return isRecord(metadata) && metadata.managedBy === managedSource && metadata.skillName === skillName;
37
55
  }
38
-
39
56
  function copySkill(targetDir) {
40
- const parentDir = path.dirname(targetDir)
41
- fs.mkdirSync(parentDir, { recursive: true })
42
-
43
- const tempDir = fs.mkdtempSync(path.join(parentDir, `.${skillName}-tmp-`))
44
- const backupDir = path.join(parentDir, `.${skillName}-backup-${process.pid}-${Date.now()}`)
45
- let movedExisting = false
46
-
47
- try {
48
- fs.cpSync(sourceDir, tempDir, { recursive: true })
49
- fs.writeFileSync(path.join(tempDir, metadataFile), `${JSON.stringify({
50
- managedBy: managedSource,
51
- skillName,
52
- installedAt: new Date().toISOString(),
53
- sourceDir,
54
- }, null, 2)}\n`)
55
-
56
- if (fs.existsSync(targetDir)) {
57
- fs.renameSync(targetDir, backupDir)
58
- movedExisting = true
59
- }
60
- fs.renameSync(tempDir, targetDir)
61
- fs.rmSync(backupDir, { recursive: true, force: true })
62
- }
63
- catch (error) {
64
- fs.rmSync(tempDir, { recursive: true, force: true })
65
- if (movedExisting && !fs.existsSync(targetDir) && fs.existsSync(backupDir)) {
66
- fs.renameSync(backupDir, targetDir)
67
- }
68
- throw error
57
+ const parentDir = import_node_path.default.dirname(targetDir);
58
+ import_node_fs.default.mkdirSync(parentDir, { recursive: true });
59
+ const tempDir = import_node_fs.default.mkdtempSync(import_node_path.default.join(parentDir, `.${skillName}-tmp-`));
60
+ const backupDir = import_node_path.default.join(parentDir, `.${skillName}-backup-${process.pid}-${Date.now()}`);
61
+ let movedExisting = false;
62
+ try {
63
+ import_node_fs.default.cpSync(sourceDir, tempDir, { recursive: true });
64
+ import_node_fs.default.writeFileSync(import_node_path.default.join(tempDir, metadataFile), `${JSON.stringify({
65
+ managedBy: managedSource,
66
+ skillName,
67
+ installedAt: (/* @__PURE__ */ new Date()).toISOString(),
68
+ sourceDir
69
+ }, null, 2)}
70
+ `);
71
+ if (import_node_fs.default.existsSync(targetDir)) {
72
+ import_node_fs.default.renameSync(targetDir, backupDir);
73
+ movedExisting = true;
69
74
  }
75
+ import_node_fs.default.renameSync(tempDir, targetDir);
76
+ import_node_fs.default.rmSync(backupDir, { recursive: true, force: true });
77
+ } catch (error) {
78
+ import_node_fs.default.rmSync(tempDir, { recursive: true, force: true });
79
+ if (movedExisting && !import_node_fs.default.existsSync(targetDir) && import_node_fs.default.existsSync(backupDir))
80
+ import_node_fs.default.renameSync(backupDir, targetDir);
81
+ throw error;
82
+ }
70
83
  }
71
-
72
84
  function install() {
73
- if (process.env.TELA_CLI_SKIP_SKILL_INSTALL === '1') {
74
- return {
75
- ok: true,
76
- skipped: true,
77
- reason: 'TELA_CLI_SKIP_SKILL_INSTALL=1',
78
- targets: [],
79
- }
80
- }
81
-
82
- if (!fs.existsSync(path.join(sourceDir, 'SKILL.md'))) {
83
- return {
84
- ok: false,
85
- error: `Bundled skill source is missing: ${sourceDir}`,
86
- targets: [],
87
- }
88
- }
89
-
90
- const targets = targetRoots().map((root) => {
91
- const targetDir = path.join(root, skillName)
92
- const exists = fs.existsSync(targetDir)
93
-
94
- if (exists && !isManagedInstall(targetDir)) {
95
- return {
96
- targetDir,
97
- status: 'skipped',
98
- reason: 'existing unmanaged skill folder',
99
- }
100
- }
101
-
102
- copySkill(targetDir)
103
- return {
104
- targetDir,
105
- status: exists ? 'updated' : 'installed',
106
- }
107
- })
108
-
85
+ if (process.env.TELA_CLI_SKIP_SKILL_INSTALL === "1") {
86
+ return {
87
+ ok: true,
88
+ skipped: true,
89
+ reason: "TELA_CLI_SKIP_SKILL_INSTALL=1",
90
+ targets: []
91
+ };
92
+ }
93
+ if (!import_node_fs.default.existsSync(import_node_path.default.join(sourceDir, "SKILL.md"))) {
109
94
  return {
110
- ok: true,
111
- skillName,
112
- targets,
95
+ ok: false,
96
+ error: `Bundled skill source is missing: ${sourceDir}`,
97
+ targets: []
98
+ };
99
+ }
100
+ const targets = targetRoots().map((root) => {
101
+ const targetDir = import_node_path.default.join(root, skillName);
102
+ const exists = import_node_fs.default.existsSync(targetDir);
103
+ if (exists && !isManagedInstall(targetDir)) {
104
+ return {
105
+ targetDir,
106
+ status: "skipped",
107
+ reason: "existing unmanaged skill folder"
108
+ };
113
109
  }
110
+ copySkill(targetDir);
111
+ return {
112
+ targetDir,
113
+ status: exists ? "updated" : "installed"
114
+ };
115
+ });
116
+ return {
117
+ ok: true,
118
+ skillName,
119
+ targets
120
+ };
114
121
  }
115
-
116
- const result = install()
117
-
118
- if (json) {
119
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`)
122
+ function isRecord(value) {
123
+ return typeof value === "object" && value !== null && !Array.isArray(value);
120
124
  }
121
- else if (!quiet) {
122
- for (const target of result.targets || []) {
123
- process.stdout.write(`${target.status}: ${target.targetDir}${target.reason ? ` (${target.reason})` : ''}\n`)
124
- }
125
+ var result = install();
126
+ if (json) {
127
+ process.stdout.write(`${JSON.stringify(result, null, 2)}
128
+ `);
129
+ } else if (!quiet) {
130
+ for (const target of result.targets) {
131
+ process.stdout.write(`${target.status}: ${target.targetDir}${target.reason ? ` (${target.reason})` : ""}
132
+ `);
133
+ }
125
134
  }
126
-
127
135
  if (!result.ok) {
128
- if (!quiet && result.error)
129
- process.stderr.write(`${result.error}\n`)
130
- process.exitCode = 1
136
+ if (!quiet)
137
+ process.stderr.write(`${result.error}
138
+ `);
139
+ process.exitCode = 1;
131
140
  }