@getxflow/cli 0.14.1 → 0.14.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/dist/flags.js +34 -6
- package/dist/help.js +3 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/xflow/SKILL.md +4 -3
package/dist/flags.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KNOWN = void 0;
|
|
3
|
+
exports.WORKING_COPY = exports.KNOWN = void 0;
|
|
4
4
|
exports.checkFlags = checkFlags;
|
|
5
5
|
const args_1 = require("./args");
|
|
6
6
|
const errors_1 = require("./errors");
|
|
@@ -19,8 +19,8 @@ const help_1 = require("./help");
|
|
|
19
19
|
*
|
|
20
20
|
* `--project` is a flag like any other here, and it is written against a command
|
|
21
21
|
* only when that command can answer without the working copy. The ones that cannot
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* have a folder to stand in, and naming a project they cannot read would be a lie;
|
|
23
|
+
* they are listed in WORKING_COPY below, each with what it reads from that folder.
|
|
24
24
|
* `db status` sits halfway: named by id it answers with the applied history alone,
|
|
25
25
|
* without the comparison against migrations/.
|
|
26
26
|
*
|
|
@@ -87,6 +87,27 @@ exports.KNOWN = {
|
|
|
87
87
|
deployments: ['project'],
|
|
88
88
|
update: [],
|
|
89
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* What each of those commands reads from the working copy, in its own words.
|
|
92
|
+
*
|
|
93
|
+
* `has no flag --project` alone leaves the reader one dead end short of the answer:
|
|
94
|
+
* the next try, without the flag, ends at the missing xflow.json, and neither line
|
|
95
|
+
* tells a rule from an oversight. Naming the file the command would have to read
|
|
96
|
+
* does, and it also says when the errand needs no folder at all.
|
|
97
|
+
*
|
|
98
|
+
* Keys are the commands KNOWN keeps `--project` from, and flags.test.ts holds the
|
|
99
|
+
* two lists against each other: a command that later gains the flag has to lose its
|
|
100
|
+
* line here, or a refusal nobody prints any more stays behind as a lie.
|
|
101
|
+
*/
|
|
102
|
+
exports.WORKING_COPY = {
|
|
103
|
+
deploy: 'it sends the sources next to it',
|
|
104
|
+
pull: 'it writes the sources next to it',
|
|
105
|
+
status: 'it compares the folder with the revision on the platform',
|
|
106
|
+
'db migrate': 'it applies the files of migrations/',
|
|
107
|
+
'env check': 'it looks for the variables the code of the functions reads',
|
|
108
|
+
'env set': 'it names the functions that need a deploy for the value to arrive',
|
|
109
|
+
'connections unlink': 'it reads functions/ to name the functions that would lose the variables. Only trying an API out? That needs no link: xflow connections call',
|
|
110
|
+
};
|
|
90
111
|
/** Answered everywhere: both are handled before the command runs. */
|
|
91
112
|
const GLOBAL = new Set(['help', 'version']);
|
|
92
113
|
/**
|
|
@@ -118,6 +139,15 @@ function commandOf(words) {
|
|
|
118
139
|
}
|
|
119
140
|
return Object.hasOwn(exports.KNOWN, first) ? first : null;
|
|
120
141
|
}
|
|
142
|
+
function hintFor(command, flag, allowed, page) {
|
|
143
|
+
const reads = exports.WORKING_COPY[command];
|
|
144
|
+
if (flag === 'project' && reads !== undefined) {
|
|
145
|
+
return `It works in the project folder: ${reads}. Which commands take --project: xflow help project`;
|
|
146
|
+
}
|
|
147
|
+
return allowed.length > 0
|
|
148
|
+
? `It takes ${allowed.map((name) => `--${name}`).join(', ')}. What each one does: ${page}`
|
|
149
|
+
: `It takes no flags. What it does: ${page}`;
|
|
150
|
+
}
|
|
121
151
|
function checkFlags(args) {
|
|
122
152
|
const command = commandOf(args.words);
|
|
123
153
|
if (command === null)
|
|
@@ -131,9 +161,7 @@ function checkFlags(args) {
|
|
|
131
161
|
if (GLOBAL.has(name))
|
|
132
162
|
continue;
|
|
133
163
|
if (!allowed.includes(name)) {
|
|
134
|
-
throw new errors_1.CliError(`xflow ${command} has no flag --${name}`, allowed
|
|
135
|
-
? `It takes ${allowed.map((flag) => `--${flag}`).join(', ')}. What each one does: ${page}`
|
|
136
|
-
: `It takes no flags. What it does: ${page}`);
|
|
164
|
+
throw new errors_1.CliError(`xflow ${command} has no flag --${name}`, hintFor(command, name, allowed, page));
|
|
137
165
|
}
|
|
138
166
|
// The value went missing, so the flag arrived as a bare switch. Left alone it
|
|
139
167
|
// would mean the default, which is never what the person typing it wanted.
|
package/dist/help.js
CHANGED
|
@@ -381,7 +381,9 @@ of the same service under one name; then the command prints their identifiers an
|
|
|
381
381
|
for one of those instead of guessing.
|
|
382
382
|
|
|
383
383
|
${(0, ui_1.bold)('unlink')} refuses while a function still reads one of the variables and names
|
|
384
|
-
those functions; ${(0, ui_1.bold)('--force')} goes through anyway.
|
|
384
|
+
those functions; ${(0, ui_1.bold)('--force')} goes through anyway. Seeing them needs the sources,
|
|
385
|
+
which is why ${(0, ui_1.bold)('unlink')} works in the project folder and takes no ${(0, ui_1.bold)('--project')}
|
|
386
|
+
while ${(0, ui_1.bold)('link')} takes it: only one of the two reads your code.
|
|
385
387
|
|
|
386
388
|
Variables are named after the alias: an OAuth connection called ${(0, ui_1.bold)('YANDEX_METRIKA')}
|
|
387
389
|
gives ${(0, ui_1.bold)('YANDEX_METRIKA_TOKEN')}, a key-based one gives a variable per field. They
|
package/dist/version.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_API_URL = exports.CLI_VERSION = void 0;
|
|
4
4
|
/** Keep in sync with cli/package.json. */
|
|
5
|
-
exports.CLI_VERSION = '0.14.
|
|
5
|
+
exports.CLI_VERSION = '0.14.2';
|
|
6
6
|
/** Overridden by XFLOW_API_URL or the `api` field in xflow.json. */
|
|
7
7
|
exports.DEFAULT_API_URL = 'https://app.getxflow.com';
|
package/package.json
CHANGED
package/skills/xflow/SKILL.md
CHANGED
|
@@ -24,7 +24,7 @@ contains the fix.
|
|
|
24
24
|
|
|
25
25
|
## Keeping these instructions current
|
|
26
26
|
|
|
27
|
-
These instructions ship with xflow CLI 0.14.
|
|
27
|
+
These instructions ship with xflow CLI 0.14.2. They travel inside the package, so the copy
|
|
28
28
|
you are reading can be older than the CLI answering your commands, and nothing about that
|
|
29
29
|
is visible in the text itself.
|
|
30
30
|
|
|
@@ -360,8 +360,9 @@ unavailable: the account you need is often connected already, one link away.
|
|
|
360
360
|
|
|
361
361
|
`xflow connections link "Яндекс Метрика" --as YANDEX_METRIKA` is that link and
|
|
362
362
|
`xflow connections unlink YANDEX_METRIKA` undoes it; `xflow help connections` has the
|
|
363
|
-
naming rules and the flags. Unlink
|
|
364
|
-
|
|
363
|
+
naming rules and the flags. Unlink reads `functions/`, so it runs in the project folder:
|
|
364
|
+
it refuses while a function still reads one of the variables and names those functions,
|
|
365
|
+
so read that list before reaching for `--force`.
|
|
365
366
|
|
|
366
367
|
Linking needs the `connections:link` right on the key, and only accounts granted to the
|
|
367
368
|
owner of the key personally can be linked at all; the same right covers calling an unlinked
|