tabctl 0.5.3 → 0.6.0-alpha.2
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/README.md +98 -35
- package/dist/extension/background.js +2 -0
- package/dist/extension/manifest.json +2 -2
- package/package.json +13 -5
- package/dist/cli/lib/args.js +0 -141
- package/dist/cli/lib/client.js +0 -83
- package/dist/cli/lib/commands/doctor.js +0 -134
- package/dist/cli/lib/commands/index.js +0 -51
- package/dist/cli/lib/commands/list.js +0 -159
- package/dist/cli/lib/commands/meta.js +0 -229
- package/dist/cli/lib/commands/params-groups.js +0 -48
- package/dist/cli/lib/commands/params-move.js +0 -44
- package/dist/cli/lib/commands/params.js +0 -314
- package/dist/cli/lib/commands/profile.js +0 -91
- package/dist/cli/lib/commands/setup.js +0 -294
- package/dist/cli/lib/constants.js +0 -30
- package/dist/cli/lib/help.js +0 -205
- package/dist/cli/lib/options-commands.js +0 -274
- package/dist/cli/lib/options-groups.js +0 -41
- package/dist/cli/lib/options.js +0 -125
- package/dist/cli/lib/output.js +0 -147
- package/dist/cli/lib/pagination.js +0 -55
- package/dist/cli/lib/policy-filter.js +0 -202
- package/dist/cli/lib/policy.js +0 -91
- package/dist/cli/lib/report.js +0 -61
- package/dist/cli/lib/response.js +0 -235
- package/dist/cli/lib/scope.js +0 -250
- package/dist/cli/lib/snapshot.js +0 -216
- package/dist/cli/lib/types.js +0 -2
- package/dist/cli/tabctl.js +0 -475
- package/dist/host/host.bundle.js +0 -670
- package/dist/host/host.js +0 -143
- package/dist/host/host.sh +0 -5
- package/dist/host/launcher/go.mod +0 -3
- package/dist/host/launcher/main.go +0 -109
- package/dist/host/lib/handlers.js +0 -327
- package/dist/host/lib/undo.js +0 -60
- package/dist/shared/config.js +0 -134
- package/dist/shared/extension-sync.js +0 -170
- package/dist/shared/profiles.js +0 -78
- package/dist/shared/version.js +0 -8
- package/dist/shared/wrapper-health.js +0 -132
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Command module index.
|
|
4
|
-
* Re-exports all command handlers and parameter builders.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.buildUndoParams = exports.buildHistoryParams = exports.buildScreenshotParams = exports.buildReportParams = exports.buildCloseParams = exports.buildArchiveParams = exports.buildMergeWindowParams = exports.buildMoveGroupParams = exports.buildMoveTabParams = exports.buildGroupGatherParams = exports.buildGroupAssignParams = exports.buildGroupUngroupParams = exports.buildGroupUpdateParams = exports.buildOpenParams = exports.buildRefreshParams = exports.buildFocusParams = exports.buildInspectParams = exports.buildAnalyzeParams = exports.runProfileRemove = exports.runProfileSwitch = exports.runProfileShow = exports.runProfileList = exports.runGroupList = exports.runList = exports.runPing = exports.runUndo = exports.runHistory = exports.runPolicy = exports.runVersion = exports.runSkillInstall = exports.runDoctor = exports.runSetup = void 0;
|
|
8
|
-
// Setup command
|
|
9
|
-
var setup_1 = require("./setup");
|
|
10
|
-
Object.defineProperty(exports, "runSetup", { enumerable: true, get: function () { return setup_1.runSetup; } });
|
|
11
|
-
// Doctor command
|
|
12
|
-
var doctor_1 = require("./doctor");
|
|
13
|
-
Object.defineProperty(exports, "runDoctor", { enumerable: true, get: function () { return doctor_1.runDoctor; } });
|
|
14
|
-
// Meta commands (version, ping, skill, policy, history, undo)
|
|
15
|
-
var meta_1 = require("./meta");
|
|
16
|
-
Object.defineProperty(exports, "runSkillInstall", { enumerable: true, get: function () { return meta_1.runSkillInstall; } });
|
|
17
|
-
Object.defineProperty(exports, "runVersion", { enumerable: true, get: function () { return meta_1.runVersion; } });
|
|
18
|
-
Object.defineProperty(exports, "runPolicy", { enumerable: true, get: function () { return meta_1.runPolicy; } });
|
|
19
|
-
Object.defineProperty(exports, "runHistory", { enumerable: true, get: function () { return meta_1.runHistory; } });
|
|
20
|
-
Object.defineProperty(exports, "runUndo", { enumerable: true, get: function () { return meta_1.runUndo; } });
|
|
21
|
-
Object.defineProperty(exports, "runPing", { enumerable: true, get: function () { return meta_1.runPing; } });
|
|
22
|
-
// List commands (list, group-list)
|
|
23
|
-
var list_1 = require("./list");
|
|
24
|
-
Object.defineProperty(exports, "runList", { enumerable: true, get: function () { return list_1.runList; } });
|
|
25
|
-
Object.defineProperty(exports, "runGroupList", { enumerable: true, get: function () { return list_1.runGroupList; } });
|
|
26
|
-
// Profile commands (profile-list, profile-show, profile-switch, profile-remove)
|
|
27
|
-
var profile_1 = require("./profile");
|
|
28
|
-
Object.defineProperty(exports, "runProfileList", { enumerable: true, get: function () { return profile_1.runProfileList; } });
|
|
29
|
-
Object.defineProperty(exports, "runProfileShow", { enumerable: true, get: function () { return profile_1.runProfileShow; } });
|
|
30
|
-
Object.defineProperty(exports, "runProfileSwitch", { enumerable: true, get: function () { return profile_1.runProfileSwitch; } });
|
|
31
|
-
Object.defineProperty(exports, "runProfileRemove", { enumerable: true, get: function () { return profile_1.runProfileRemove; } });
|
|
32
|
-
// Parameter builders for all commands
|
|
33
|
-
var params_1 = require("./params");
|
|
34
|
-
Object.defineProperty(exports, "buildAnalyzeParams", { enumerable: true, get: function () { return params_1.buildAnalyzeParams; } });
|
|
35
|
-
Object.defineProperty(exports, "buildInspectParams", { enumerable: true, get: function () { return params_1.buildInspectParams; } });
|
|
36
|
-
Object.defineProperty(exports, "buildFocusParams", { enumerable: true, get: function () { return params_1.buildFocusParams; } });
|
|
37
|
-
Object.defineProperty(exports, "buildRefreshParams", { enumerable: true, get: function () { return params_1.buildRefreshParams; } });
|
|
38
|
-
Object.defineProperty(exports, "buildOpenParams", { enumerable: true, get: function () { return params_1.buildOpenParams; } });
|
|
39
|
-
Object.defineProperty(exports, "buildGroupUpdateParams", { enumerable: true, get: function () { return params_1.buildGroupUpdateParams; } });
|
|
40
|
-
Object.defineProperty(exports, "buildGroupUngroupParams", { enumerable: true, get: function () { return params_1.buildGroupUngroupParams; } });
|
|
41
|
-
Object.defineProperty(exports, "buildGroupAssignParams", { enumerable: true, get: function () { return params_1.buildGroupAssignParams; } });
|
|
42
|
-
Object.defineProperty(exports, "buildGroupGatherParams", { enumerable: true, get: function () { return params_1.buildGroupGatherParams; } });
|
|
43
|
-
Object.defineProperty(exports, "buildMoveTabParams", { enumerable: true, get: function () { return params_1.buildMoveTabParams; } });
|
|
44
|
-
Object.defineProperty(exports, "buildMoveGroupParams", { enumerable: true, get: function () { return params_1.buildMoveGroupParams; } });
|
|
45
|
-
Object.defineProperty(exports, "buildMergeWindowParams", { enumerable: true, get: function () { return params_1.buildMergeWindowParams; } });
|
|
46
|
-
Object.defineProperty(exports, "buildArchiveParams", { enumerable: true, get: function () { return params_1.buildArchiveParams; } });
|
|
47
|
-
Object.defineProperty(exports, "buildCloseParams", { enumerable: true, get: function () { return params_1.buildCloseParams; } });
|
|
48
|
-
Object.defineProperty(exports, "buildReportParams", { enumerable: true, get: function () { return params_1.buildReportParams; } });
|
|
49
|
-
Object.defineProperty(exports, "buildScreenshotParams", { enumerable: true, get: function () { return params_1.buildScreenshotParams; } });
|
|
50
|
-
Object.defineProperty(exports, "buildHistoryParams", { enumerable: true, get: function () { return params_1.buildHistoryParams; } });
|
|
51
|
-
Object.defineProperty(exports, "buildUndoParams", { enumerable: true, get: function () { return params_1.buildUndoParams; } });
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* List command handlers: list, group-list
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.runList = runList;
|
|
7
|
-
exports.runGroupList = runGroupList;
|
|
8
|
-
const constants_1 = require("../constants");
|
|
9
|
-
const output_1 = require("../output");
|
|
10
|
-
const client_1 = require("../client");
|
|
11
|
-
const scope_1 = require("../scope");
|
|
12
|
-
const pagination_1 = require("../pagination");
|
|
13
|
-
const snapshot_1 = require("../snapshot");
|
|
14
|
-
// ============================================================================
|
|
15
|
-
// List Command
|
|
16
|
-
// ============================================================================
|
|
17
|
-
async function runList(options, policyContext, policySummary, prettyOutput) {
|
|
18
|
-
// Validate scope flags early (before connecting) so invalid values
|
|
19
|
-
// are rejected without needing a socket connection.
|
|
20
|
-
const scope = (0, scope_1.resolveScopeFlags)(options);
|
|
21
|
-
const response = await (0, client_1.sendRequest)({
|
|
22
|
-
id: (0, client_1.createRequestId)(),
|
|
23
|
-
action: "list",
|
|
24
|
-
params: {},
|
|
25
|
-
client: {
|
|
26
|
-
component: "cli",
|
|
27
|
-
version: constants_1.VERSION,
|
|
28
|
-
baseVersion: constants_1.BASE_VERSION,
|
|
29
|
-
gitSha: constants_1.GIT_SHA,
|
|
30
|
-
dirty: constants_1.DIRTY,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
if (!response.ok) {
|
|
34
|
-
(0, output_1.printJson)(response, prettyOutput);
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
const data = response.data;
|
|
38
|
-
if (data && Array.isArray(data.windows)) {
|
|
39
|
-
const filtered = (0, snapshot_1.filterSnapshotByPolicy)(data, policyContext.policy);
|
|
40
|
-
if (typeof scope.windowId === "string") {
|
|
41
|
-
const resolvedWindowId = (0, scope_1.resolveWindowIdFromSnapshot)(filtered, scope.windowId);
|
|
42
|
-
scope.windowId = resolvedWindowId ?? null;
|
|
43
|
-
}
|
|
44
|
-
const allScope = options.all === true || !scope.hasScope;
|
|
45
|
-
const listParams = allScope
|
|
46
|
-
? { all: true }
|
|
47
|
-
: {
|
|
48
|
-
tabIds: scope.tabIds.length ? scope.tabIds : undefined,
|
|
49
|
-
groupTitle: scope.groupTitle || undefined,
|
|
50
|
-
groupId: scope.groupId != null ? scope.groupId : undefined,
|
|
51
|
-
windowId: scope.windowId != null ? scope.windowId : undefined,
|
|
52
|
-
};
|
|
53
|
-
if (typeof listParams.windowId === "string") {
|
|
54
|
-
const resolvedWindowId = (0, scope_1.resolveWindowIdFromSnapshot)(filtered, listParams.windowId);
|
|
55
|
-
listParams.windowId = resolvedWindowId ?? undefined;
|
|
56
|
-
}
|
|
57
|
-
const selection = (0, scope_1.selectTabsFromSnapshot)(filtered, listParams);
|
|
58
|
-
if (selection.error) {
|
|
59
|
-
(0, output_1.printJson)({ ok: false, error: selection.error }, prettyOutput);
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
const selectedTabs = selection.tabs || [];
|
|
63
|
-
const tabIdSet = new Set(selectedTabs.map((tab) => tab.tabId).filter((id) => typeof id === "number"));
|
|
64
|
-
const ordered = listParams.all
|
|
65
|
-
? (0, snapshot_1.orderTabs)(filtered, null)
|
|
66
|
-
: tabIdSet.size > 0
|
|
67
|
-
? (0, snapshot_1.orderTabs)(filtered, tabIdSet)
|
|
68
|
-
: [];
|
|
69
|
-
const scopeArgs = (0, scope_1.buildScopeArgs)(options, allScope);
|
|
70
|
-
const pagination = (0, pagination_1.resolvePagination)(options, ordered.length, "list", scopeArgs);
|
|
71
|
-
const start = pagination.offset;
|
|
72
|
-
const end = pagination.offset + pagination.limit;
|
|
73
|
-
const pagedTabs = ordered.slice(start, end);
|
|
74
|
-
const pagedSnapshot = (0, snapshot_1.buildPagedSnapshot)(filtered, pagedTabs);
|
|
75
|
-
data.windows = pagedSnapshot.windows;
|
|
76
|
-
if (pagination.page) {
|
|
77
|
-
data.page = pagination.page;
|
|
78
|
-
}
|
|
79
|
-
data.policy = policySummary;
|
|
80
|
-
}
|
|
81
|
-
else if (response.ok) {
|
|
82
|
-
response.policy = policySummary;
|
|
83
|
-
}
|
|
84
|
-
(0, output_1.emitVersionWarnings)(response, "list");
|
|
85
|
-
(0, output_1.printJson)(response, prettyOutput);
|
|
86
|
-
}
|
|
87
|
-
// ============================================================================
|
|
88
|
-
// Group-List Command
|
|
89
|
-
// ============================================================================
|
|
90
|
-
async function runGroupList(options, policyContext, policySummary, prettyOutput) {
|
|
91
|
-
const params = {
|
|
92
|
-
windowId: options.all ? undefined : options.window,
|
|
93
|
-
};
|
|
94
|
-
const response = await (0, client_1.sendRequest)({
|
|
95
|
-
id: (0, client_1.createRequestId)(),
|
|
96
|
-
action: "group-list",
|
|
97
|
-
params,
|
|
98
|
-
client: {
|
|
99
|
-
component: "cli",
|
|
100
|
-
version: constants_1.VERSION,
|
|
101
|
-
baseVersion: constants_1.BASE_VERSION,
|
|
102
|
-
gitSha: constants_1.GIT_SHA,
|
|
103
|
-
dirty: constants_1.DIRTY,
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
if (!response.ok) {
|
|
107
|
-
(0, output_1.printJson)(response, prettyOutput);
|
|
108
|
-
process.exit(1);
|
|
109
|
-
}
|
|
110
|
-
const data = response.data;
|
|
111
|
-
// Fallback to snapshot if groups missing
|
|
112
|
-
if (data && (!Array.isArray(data.groups) || data.groups === null)) {
|
|
113
|
-
const scope = (0, scope_1.resolveScopeFlags)(options);
|
|
114
|
-
const snapshot = await (0, client_1.fetchSnapshot)();
|
|
115
|
-
if (snapshot) {
|
|
116
|
-
const filteredSnapshot = (0, snapshot_1.filterSnapshotByPolicy)(snapshot, policyContext.policy);
|
|
117
|
-
if (typeof scope.windowId === "string") {
|
|
118
|
-
const resolvedWindowId = (0, scope_1.resolveWindowIdFromSnapshot)(filteredSnapshot, scope.windowId);
|
|
119
|
-
scope.windowId = resolvedWindowId ?? null;
|
|
120
|
-
}
|
|
121
|
-
const scopeWindow = typeof scope.windowId === "number" && Number.isFinite(scope.windowId) ? scope.windowId : null;
|
|
122
|
-
const groups = (0, snapshot_1.buildGroupsFromSnapshot)(filteredSnapshot, scopeWindow);
|
|
123
|
-
data.groups = (0, scope_1.filterGroupsByScope)(groups, scope, filteredSnapshot, snapshot_1.buildTabIndex);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
data.groups = [];
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
// Apply scope filtering and pagination
|
|
130
|
-
if (data && Array.isArray(data.groups)) {
|
|
131
|
-
let groups = data.groups;
|
|
132
|
-
const scope = (0, scope_1.resolveScopeFlags)(options);
|
|
133
|
-
const allScope = options.all === true || !scope.hasScope;
|
|
134
|
-
let snapshot = null;
|
|
135
|
-
if (!allScope && scope.tabIds.length > 0) {
|
|
136
|
-
snapshot = await (0, client_1.fetchSnapshot)();
|
|
137
|
-
if (!snapshot) {
|
|
138
|
-
(0, output_1.errorOut)("Failed to load tabs for group-list filtering");
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (!allScope) {
|
|
142
|
-
groups = (0, scope_1.filterGroupsByScope)(groups, scope, snapshot, snapshot_1.buildTabIndex);
|
|
143
|
-
}
|
|
144
|
-
const scopeArgs = (0, scope_1.buildScopeArgs)(options, allScope);
|
|
145
|
-
const pagination = (0, pagination_1.resolvePagination)(options, groups.length, "group-list", scopeArgs);
|
|
146
|
-
const start = pagination.offset;
|
|
147
|
-
const end = pagination.offset + pagination.limit;
|
|
148
|
-
data.groups = groups.slice(start, end);
|
|
149
|
-
if (pagination.page) {
|
|
150
|
-
data.page = pagination.page;
|
|
151
|
-
}
|
|
152
|
-
data.policy = policySummary;
|
|
153
|
-
}
|
|
154
|
-
else if (response.ok) {
|
|
155
|
-
response.policy = policySummary;
|
|
156
|
-
}
|
|
157
|
-
(0, output_1.emitVersionWarnings)(response, "group-list");
|
|
158
|
-
(0, output_1.printJson)(response, prettyOutput);
|
|
159
|
-
}
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Meta command handlers: version, ping, skill, policy, history, undo
|
|
4
|
-
* These commands don't operate on tab data and are relatively self-contained.
|
|
5
|
-
* Setup command is in ./setup.ts.
|
|
6
|
-
*/
|
|
7
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.runSetup = void 0;
|
|
12
|
-
exports.runSkillInstall = runSkillInstall;
|
|
13
|
-
exports.runVersion = runVersion;
|
|
14
|
-
exports.runPolicy = runPolicy;
|
|
15
|
-
exports.runHistory = runHistory;
|
|
16
|
-
exports.runUndo = runUndo;
|
|
17
|
-
exports.runPing = runPing;
|
|
18
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
19
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
20
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
21
|
-
const node_child_process_1 = require("node:child_process");
|
|
22
|
-
const constants_1 = require("../constants");
|
|
23
|
-
const output_1 = require("../output");
|
|
24
|
-
const client_1 = require("../client");
|
|
25
|
-
const policy_1 = require("../policy");
|
|
26
|
-
const scope_1 = require("../scope");
|
|
27
|
-
var setup_1 = require("./setup");
|
|
28
|
-
Object.defineProperty(exports, "runSetup", { enumerable: true, get: function () { return setup_1.runSetup; } });
|
|
29
|
-
// ============================================================================
|
|
30
|
-
// Skill Command
|
|
31
|
-
// ============================================================================
|
|
32
|
-
function resolveProjectRoot() {
|
|
33
|
-
try {
|
|
34
|
-
return node_fs_1.default.realpathSync(process.cwd());
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return node_path_1.default.resolve(process.cwd());
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function resolveConfigHome() {
|
|
41
|
-
return process.env.XDG_CONFIG_HOME || node_path_1.default.join(node_os_1.default.homedir(), ".config");
|
|
42
|
-
}
|
|
43
|
-
function resolveSkillTargetDir(globalInstall) {
|
|
44
|
-
if (globalInstall) {
|
|
45
|
-
return node_path_1.default.join(resolveConfigHome(), "opencode", "skills", constants_1.SKILL_NAME);
|
|
46
|
-
}
|
|
47
|
-
return node_path_1.default.join(resolveProjectRoot(), ".opencode", "skills", constants_1.SKILL_NAME);
|
|
48
|
-
}
|
|
49
|
-
function runSkillsCli(args) {
|
|
50
|
-
const result = (0, node_child_process_1.spawnSync)("npx", ["skills", ...args], { stdio: "pipe", shell: process.platform === "win32" });
|
|
51
|
-
if (result.error) {
|
|
52
|
-
(0, output_1.errorOut)(`Failed to run skills CLI: ${result.error.message}`);
|
|
53
|
-
}
|
|
54
|
-
if (typeof result.status === "number" && result.status !== 0) {
|
|
55
|
-
const stderr = result.stderr ? result.stderr.toString().trim() : "";
|
|
56
|
-
const stdout = result.stdout ? result.stdout.toString().trim() : "";
|
|
57
|
-
const detail = stderr || stdout;
|
|
58
|
-
const message = detail ? `skills CLI failed: ${detail}` : `skills CLI exited with status ${result.status}`;
|
|
59
|
-
(0, output_1.errorOut)(message);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function runSkillInstall(options, prettyOutput) {
|
|
63
|
-
const globalInstall = options.global === true;
|
|
64
|
-
const installTarget = resolveSkillTargetDir(globalInstall);
|
|
65
|
-
const agents = Array.isArray(options.agent)
|
|
66
|
-
? options.agent.filter((value) => typeof value === "string" && value.trim())
|
|
67
|
-
: [];
|
|
68
|
-
const args = ["add", constants_1.SKILL_REPO, "--skill", constants_1.SKILL_NAME];
|
|
69
|
-
if (agents.length > 0) {
|
|
70
|
-
for (const agent of agents) {
|
|
71
|
-
args.push("-a", agent);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (globalInstall) {
|
|
75
|
-
args.push("-g");
|
|
76
|
-
}
|
|
77
|
-
const hintAgents = agents.length > 0 ? agents.map((agent) => `-a ${(0, scope_1.formatCliArgValue)(agent)}`).join(" ") : "";
|
|
78
|
-
const installHintParts = ["npx skills add", (0, scope_1.formatCliArgValue)(constants_1.SKILL_REPO), "--skill", constants_1.SKILL_NAME];
|
|
79
|
-
if (hintAgents) {
|
|
80
|
-
installHintParts.push(hintAgents);
|
|
81
|
-
}
|
|
82
|
-
if (globalInstall) {
|
|
83
|
-
installHintParts.push("-g");
|
|
84
|
-
}
|
|
85
|
-
const installHint = installHintParts.join(" ").trim();
|
|
86
|
-
runSkillsCli(args);
|
|
87
|
-
(0, output_1.printJson)({
|
|
88
|
-
ok: true,
|
|
89
|
-
data: {
|
|
90
|
-
name: constants_1.SKILL_NAME,
|
|
91
|
-
targetDir: installTarget,
|
|
92
|
-
scope: globalInstall ? "global" : "project",
|
|
93
|
-
installHint,
|
|
94
|
-
tool: "skills",
|
|
95
|
-
},
|
|
96
|
-
}, prettyOutput);
|
|
97
|
-
}
|
|
98
|
-
// ============================================================================
|
|
99
|
-
// Version Command
|
|
100
|
-
// ============================================================================
|
|
101
|
-
function runVersion(prettyOutput) {
|
|
102
|
-
(0, output_1.printJson)({
|
|
103
|
-
ok: true,
|
|
104
|
-
data: {
|
|
105
|
-
version: constants_1.VERSION,
|
|
106
|
-
baseVersion: constants_1.BASE_VERSION,
|
|
107
|
-
gitSha: constants_1.GIT_SHA,
|
|
108
|
-
dirty: constants_1.DIRTY,
|
|
109
|
-
component: "cli",
|
|
110
|
-
},
|
|
111
|
-
}, prettyOutput);
|
|
112
|
-
}
|
|
113
|
-
// ============================================================================
|
|
114
|
-
// Policy Command
|
|
115
|
-
// ============================================================================
|
|
116
|
-
function runPolicy(options, policyContext, prettyOutput) {
|
|
117
|
-
const policyPath = (0, policy_1.defaultPolicyPath)();
|
|
118
|
-
if (options.init) {
|
|
119
|
-
if (node_fs_1.default.existsSync(policyPath)) {
|
|
120
|
-
(0, output_1.printJson)({
|
|
121
|
-
ok: true,
|
|
122
|
-
data: {
|
|
123
|
-
status: "exists",
|
|
124
|
-
path: policyPath,
|
|
125
|
-
},
|
|
126
|
-
}, prettyOutput);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
const dir = node_path_1.default.dirname(policyPath);
|
|
130
|
-
node_fs_1.default.mkdirSync(dir, { recursive: true });
|
|
131
|
-
node_fs_1.default.writeFileSync(policyPath, JSON.stringify((0, policy_1.defaultPolicyTemplate)(), null, 2), "utf8");
|
|
132
|
-
(0, output_1.printJson)({
|
|
133
|
-
ok: true,
|
|
134
|
-
data: {
|
|
135
|
-
status: "created",
|
|
136
|
-
path: policyPath,
|
|
137
|
-
},
|
|
138
|
-
}, prettyOutput);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const policySummary = (0, policy_1.summarizePolicy)(policyContext.policy, policyContext.path);
|
|
142
|
-
(0, output_1.printJson)({
|
|
143
|
-
ok: true,
|
|
144
|
-
data: {
|
|
145
|
-
...policySummary,
|
|
146
|
-
path: policyPath,
|
|
147
|
-
},
|
|
148
|
-
}, prettyOutput);
|
|
149
|
-
}
|
|
150
|
-
// ============================================================================
|
|
151
|
-
// History Command
|
|
152
|
-
// ============================================================================
|
|
153
|
-
async function runHistory(options, prettyOutput) {
|
|
154
|
-
const params = {
|
|
155
|
-
limit: options.limit ? Number(options.limit) : undefined,
|
|
156
|
-
};
|
|
157
|
-
const response = await (0, client_1.sendRequest)({
|
|
158
|
-
id: (0, client_1.createRequestId)(),
|
|
159
|
-
action: "history",
|
|
160
|
-
params,
|
|
161
|
-
client: {
|
|
162
|
-
component: "cli",
|
|
163
|
-
version: constants_1.VERSION,
|
|
164
|
-
baseVersion: constants_1.BASE_VERSION,
|
|
165
|
-
gitSha: constants_1.GIT_SHA,
|
|
166
|
-
dirty: constants_1.DIRTY,
|
|
167
|
-
},
|
|
168
|
-
});
|
|
169
|
-
(0, output_1.emitVersionWarnings)(response, "history");
|
|
170
|
-
(0, output_1.printJson)(response, prettyOutput);
|
|
171
|
-
if (!response.ok) {
|
|
172
|
-
process.exit(1);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
// ============================================================================
|
|
176
|
-
// Undo Command
|
|
177
|
-
// ============================================================================
|
|
178
|
-
async function runUndo(options, prettyOutput) {
|
|
179
|
-
const positionalTxid = options._[0];
|
|
180
|
-
const flagTxid = options.txid;
|
|
181
|
-
const useLatest = options.latest === true;
|
|
182
|
-
if (useLatest && (positionalTxid || flagTxid)) {
|
|
183
|
-
(0, output_1.errorOut)("--latest cannot be combined with a txid argument or --txid");
|
|
184
|
-
}
|
|
185
|
-
const txid = positionalTxid || flagTxid;
|
|
186
|
-
const params = {
|
|
187
|
-
txid,
|
|
188
|
-
latest: useLatest,
|
|
189
|
-
};
|
|
190
|
-
const response = await (0, client_1.sendRequest)({
|
|
191
|
-
id: (0, client_1.createRequestId)(),
|
|
192
|
-
action: "undo",
|
|
193
|
-
params,
|
|
194
|
-
client: {
|
|
195
|
-
component: "cli",
|
|
196
|
-
version: constants_1.VERSION,
|
|
197
|
-
baseVersion: constants_1.BASE_VERSION,
|
|
198
|
-
gitSha: constants_1.GIT_SHA,
|
|
199
|
-
dirty: constants_1.DIRTY,
|
|
200
|
-
},
|
|
201
|
-
});
|
|
202
|
-
(0, output_1.emitVersionWarnings)(response, "undo");
|
|
203
|
-
(0, output_1.printJson)(response, prettyOutput);
|
|
204
|
-
if (!response.ok) {
|
|
205
|
-
process.exit(1);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
// ============================================================================
|
|
209
|
-
// Ping Command
|
|
210
|
-
// ============================================================================
|
|
211
|
-
async function runPing(prettyOutput) {
|
|
212
|
-
const response = await (0, client_1.sendRequest)({
|
|
213
|
-
id: (0, client_1.createRequestId)(),
|
|
214
|
-
action: "ping",
|
|
215
|
-
params: {},
|
|
216
|
-
client: {
|
|
217
|
-
component: "cli",
|
|
218
|
-
version: constants_1.VERSION,
|
|
219
|
-
baseVersion: constants_1.BASE_VERSION,
|
|
220
|
-
gitSha: constants_1.GIT_SHA,
|
|
221
|
-
dirty: constants_1.DIRTY,
|
|
222
|
-
},
|
|
223
|
-
});
|
|
224
|
-
(0, output_1.emitVersionWarnings)(response, "ping");
|
|
225
|
-
(0, output_1.printJson)(response, prettyOutput);
|
|
226
|
-
if (!response.ok) {
|
|
227
|
-
process.exit(1);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Group-related parameter builders.
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.buildGroupUpdateParams = buildGroupUpdateParams;
|
|
7
|
-
exports.buildGroupUngroupParams = buildGroupUngroupParams;
|
|
8
|
-
exports.buildGroupAssignParams = buildGroupAssignParams;
|
|
9
|
-
exports.buildGroupGatherParams = buildGroupGatherParams;
|
|
10
|
-
const params_1 = require("./params");
|
|
11
|
-
function buildGroupUpdateParams(options) {
|
|
12
|
-
const windowValue = (0, params_1.parseWindowScope)(options.window, { allowNew: false });
|
|
13
|
-
return {
|
|
14
|
-
groupTitle: options.group,
|
|
15
|
-
groupId: options["group-id"] ? Number(options["group-id"]) : undefined,
|
|
16
|
-
windowId: windowValue,
|
|
17
|
-
title: options.title,
|
|
18
|
-
color: options.color,
|
|
19
|
-
collapsed: options.collapsed === true ? true : options.expanded === true ? false : undefined,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function buildGroupUngroupParams(options) {
|
|
23
|
-
const windowValue = (0, params_1.parseWindowScope)(options.window, { allowNew: false });
|
|
24
|
-
return {
|
|
25
|
-
groupTitle: options.group,
|
|
26
|
-
groupId: options["group-id"] ? Number(options["group-id"]) : undefined,
|
|
27
|
-
windowId: windowValue,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function buildGroupAssignParams(options) {
|
|
31
|
-
const windowValue = (0, params_1.parseWindowScope)(options.window, { allowNew: false });
|
|
32
|
-
return {
|
|
33
|
-
tabIds: options.tab ? options.tab.map(Number) : undefined,
|
|
34
|
-
groupTitle: options.group,
|
|
35
|
-
groupId: options["group-id"] ? Number(options["group-id"]) : undefined,
|
|
36
|
-
windowId: windowValue,
|
|
37
|
-
create: Boolean(options.create),
|
|
38
|
-
color: options.color,
|
|
39
|
-
collapsed: options.collapsed === true ? true : options.expanded === true ? false : undefined,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function buildGroupGatherParams(options) {
|
|
43
|
-
const windowValue = (0, params_1.parseWindowScope)(options.window, { allowNew: false });
|
|
44
|
-
return {
|
|
45
|
-
windowId: windowValue,
|
|
46
|
-
groupTitle: options.group,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Movement-related parameter builders.
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.buildMoveTabParams = buildMoveTabParams;
|
|
7
|
-
exports.buildMoveGroupParams = buildMoveGroupParams;
|
|
8
|
-
exports.buildMergeWindowParams = buildMergeWindowParams;
|
|
9
|
-
const params_1 = require("./params");
|
|
10
|
-
function buildMoveTabParams(options) {
|
|
11
|
-
const windowValue = (0, params_1.parseWindowScope)(options.window, { allowNew: false });
|
|
12
|
-
return {
|
|
13
|
-
tabId: options.tab ? Number(options.tab[0]) : undefined,
|
|
14
|
-
tabIds: options.tab ? options.tab.map(Number) : undefined,
|
|
15
|
-
beforeTabId: options["before-tab"] ? Number(options["before-tab"]) : undefined,
|
|
16
|
-
afterTabId: options["after-tab"] ? Number(options["after-tab"]) : undefined,
|
|
17
|
-
beforeGroupTitle: options["before-group"],
|
|
18
|
-
afterGroupTitle: options["after-group"],
|
|
19
|
-
windowId: windowValue,
|
|
20
|
-
newWindow: options["new-window"] === true,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function buildMoveGroupParams(options) {
|
|
24
|
-
const windowValue = (0, params_1.parseWindowScope)(options.window, { allowNew: false });
|
|
25
|
-
return {
|
|
26
|
-
groupTitle: options.group,
|
|
27
|
-
groupId: options["group-id"] ? Number(options["group-id"]) : undefined,
|
|
28
|
-
beforeTabId: options["before-tab"] ? Number(options["before-tab"]) : undefined,
|
|
29
|
-
afterTabId: options["after-tab"] ? Number(options["after-tab"]) : undefined,
|
|
30
|
-
beforeGroupTitle: options["before-group"],
|
|
31
|
-
afterGroupTitle: options["after-group"],
|
|
32
|
-
windowId: windowValue,
|
|
33
|
-
newWindow: options["new-window"] === true,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function buildMergeWindowParams(options) {
|
|
37
|
-
return {
|
|
38
|
-
fromWindowId: options.from ? Number(options.from) : undefined,
|
|
39
|
-
toWindowId: options.to ? Number(options.to) : undefined,
|
|
40
|
-
windowId: options.from ? Number(options.from) : undefined,
|
|
41
|
-
closeSource: options["close-source"] === true,
|
|
42
|
-
confirmed: options.confirm === true,
|
|
43
|
-
};
|
|
44
|
-
}
|