@factorialco/fcode-cli 2.0.0 → 2.1.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/README.md +121 -1
- package/dist/commands/setup-debug.js +2 -2
- package/dist/commands/team/aliases/delete.d.ts +9 -0
- package/dist/commands/team/aliases/delete.js +28 -0
- package/dist/commands/team/aliases/list.d.ts +6 -0
- package/dist/commands/team/aliases/list.js +23 -0
- package/dist/commands/team/aliases/set.d.ts +10 -0
- package/dist/commands/team/aliases/set.js +25 -0
- package/dist/commands/team/pull.js +8 -1
- package/dist/commands/team/push.js +3 -0
- package/dist/commands/team/versions/create.d.ts +13 -0
- package/dist/commands/team/versions/create.js +42 -0
- package/dist/commands/team/versions/delete.d.ts +12 -0
- package/dist/commands/team/versions/delete.js +32 -0
- package/dist/commands/team/versions/list.d.ts +6 -0
- package/dist/commands/team/versions/list.js +25 -0
- package/dist/commands/variables/status.js +11 -0
- package/dist/config/settings.d.ts +1 -0
- package/dist/config/settings.js +6 -0
- package/dist/core/types.d.ts +37 -1
- package/dist/core/types.js +2 -1
- package/dist/env.d.ts +2 -2
- package/dist/env.js +1 -1
- package/dist/repositories/team.d.ts +7 -1
- package/dist/repositories/team.js +35 -1
- package/dist/repositories/variable.d.ts +24 -0
- package/dist/repositories/variable.js +70 -22
- package/dist/runtime/executor.js +2 -2
- package/dist/runtime/executor.py +2 -2
- package/dist/runtime/libs/python/fcode/__init__.py +2 -2
- package/dist/services/fcode-graphql-client.d.ts +10 -1
- package/dist/services/fcode-graphql-client.js +171 -23
- package/dist/utils/gitignore.d.ts +2 -0
- package/dist/utils/gitignore.js +6 -0
- package/oclif.manifest.json +350 -159
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g @factorialco/fcode-cli
|
|
|
20
20
|
$ fcode COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ fcode (--version)
|
|
23
|
-
@factorialco/fcode-cli/2.
|
|
23
|
+
@factorialco/fcode-cli/2.1.0 linux-x64 node-v22.22.3
|
|
24
24
|
$ fcode --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ fcode COMMAND
|
|
@@ -67,9 +67,15 @@ USAGE
|
|
|
67
67
|
* [`fcode settings:set KEY VALUE`](#fcode-settingsset-key-value)
|
|
68
68
|
* [`fcode setup-debug`](#fcode-setup-debug)
|
|
69
69
|
* [`fcode status`](#fcode-status)
|
|
70
|
+
* [`fcode team:aliases:delete NAME`](#fcode-teamaliasesdelete-name)
|
|
71
|
+
* [`fcode team:aliases:list`](#fcode-teamaliaseslist)
|
|
72
|
+
* [`fcode team:aliases:set NAME TAG`](#fcode-teamaliasesset-name-tag)
|
|
70
73
|
* [`fcode team:pull`](#fcode-teampull)
|
|
71
74
|
* [`fcode team:push`](#fcode-teampush)
|
|
72
75
|
* [`fcode team:status`](#fcode-teamstatus)
|
|
76
|
+
* [`fcode team:versions:create TAG`](#fcode-teamversionscreate-tag)
|
|
77
|
+
* [`fcode team:versions:delete TAG`](#fcode-teamversionsdelete-tag)
|
|
78
|
+
* [`fcode team:versions:list`](#fcode-teamversionslist)
|
|
73
79
|
* [`fcode test [SLUG]`](#fcode-test-slug)
|
|
74
80
|
* [`fcode test:scaffold SLUG`](#fcode-testscaffold-slug)
|
|
75
81
|
* [`fcode variables:add [RESOURCESLUG]`](#fcode-variablesadd-resourceslug)
|
|
@@ -811,6 +817,59 @@ EXAMPLES
|
|
|
811
817
|
$ fcode status
|
|
812
818
|
```
|
|
813
819
|
|
|
820
|
+
## `fcode team:aliases:delete NAME`
|
|
821
|
+
|
|
822
|
+
Delete a team version alias and the per-entity aliases carrying its name on every owned process and module
|
|
823
|
+
|
|
824
|
+
```
|
|
825
|
+
USAGE
|
|
826
|
+
$ fcode team:aliases:delete NAME
|
|
827
|
+
|
|
828
|
+
ARGUMENTS
|
|
829
|
+
NAME alias name to delete
|
|
830
|
+
|
|
831
|
+
DESCRIPTION
|
|
832
|
+
Delete a team version alias and the per-entity aliases carrying its name on every owned process and module
|
|
833
|
+
|
|
834
|
+
EXAMPLES
|
|
835
|
+
$ fcode team:aliases:delete production
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
## `fcode team:aliases:list`
|
|
839
|
+
|
|
840
|
+
List the team version aliases of the active team workspace
|
|
841
|
+
|
|
842
|
+
```
|
|
843
|
+
USAGE
|
|
844
|
+
$ fcode team:aliases:list
|
|
845
|
+
|
|
846
|
+
DESCRIPTION
|
|
847
|
+
List the team version aliases of the active team workspace
|
|
848
|
+
|
|
849
|
+
EXAMPLES
|
|
850
|
+
$ fcode team:aliases:list
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
## `fcode team:aliases:set NAME TAG`
|
|
854
|
+
|
|
855
|
+
Create or re-point a team version alias, upserting the per-entity alias on every owned process and module that has the target tag published
|
|
856
|
+
|
|
857
|
+
```
|
|
858
|
+
USAGE
|
|
859
|
+
$ fcode team:aliases:set NAME TAG
|
|
860
|
+
|
|
861
|
+
ARGUMENTS
|
|
862
|
+
NAME alias name (e.g. production)
|
|
863
|
+
TAG team version tag the alias points at
|
|
864
|
+
|
|
865
|
+
DESCRIPTION
|
|
866
|
+
Create or re-point a team version alias, upserting the per-entity alias on every owned process and module that has the
|
|
867
|
+
target tag published
|
|
868
|
+
|
|
869
|
+
EXAMPLES
|
|
870
|
+
$ fcode team:aliases:set production v1.0.0
|
|
871
|
+
```
|
|
872
|
+
|
|
814
873
|
## `fcode team:pull`
|
|
815
874
|
|
|
816
875
|
Fetch team settings (timezone, error handler, inheritance) from cloud into team.json
|
|
@@ -859,6 +918,67 @@ EXAMPLES
|
|
|
859
918
|
$ fcode team:status
|
|
860
919
|
```
|
|
861
920
|
|
|
921
|
+
## `fcode team:versions:create TAG`
|
|
922
|
+
|
|
923
|
+
Publish a team version: creates a version with the tag on every owned process and module (existing tags are skipped) and pins bare module imports in the published snapshots
|
|
924
|
+
|
|
925
|
+
```
|
|
926
|
+
USAGE
|
|
927
|
+
$ fcode team:versions:create TAG [-c <value>]
|
|
928
|
+
|
|
929
|
+
ARGUMENTS
|
|
930
|
+
TAG version tag to publish (e.g. v1.0.0)
|
|
931
|
+
|
|
932
|
+
FLAGS
|
|
933
|
+
-c, --comment=<value> comment describing the version
|
|
934
|
+
|
|
935
|
+
DESCRIPTION
|
|
936
|
+
Publish a team version: creates a version with the tag on every owned process and module (existing tags are skipped)
|
|
937
|
+
and pins bare module imports in the published snapshots
|
|
938
|
+
|
|
939
|
+
EXAMPLES
|
|
940
|
+
$ fcode team:versions:create v1.0.0
|
|
941
|
+
|
|
942
|
+
$ fcode team:versions:create v1.0.0 --comment "First stable release"
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
## `fcode team:versions:delete TAG`
|
|
946
|
+
|
|
947
|
+
Delete a team version. CASCADES: every owned process/module version with the tag is deleted, together with the aliases, executions and schedules that reference them
|
|
948
|
+
|
|
949
|
+
```
|
|
950
|
+
USAGE
|
|
951
|
+
$ fcode team:versions:delete TAG [-f]
|
|
952
|
+
|
|
953
|
+
ARGUMENTS
|
|
954
|
+
TAG version tag to delete
|
|
955
|
+
|
|
956
|
+
FLAGS
|
|
957
|
+
-f, --force Force command
|
|
958
|
+
|
|
959
|
+
DESCRIPTION
|
|
960
|
+
Delete a team version. CASCADES: every owned process/module version with the tag is deleted, together with the
|
|
961
|
+
aliases, executions and schedules that reference them
|
|
962
|
+
|
|
963
|
+
EXAMPLES
|
|
964
|
+
$ fcode team:versions:delete v1.0.0
|
|
965
|
+
```
|
|
966
|
+
|
|
967
|
+
## `fcode team:versions:list`
|
|
968
|
+
|
|
969
|
+
List the team versions published on the active team workspace
|
|
970
|
+
|
|
971
|
+
```
|
|
972
|
+
USAGE
|
|
973
|
+
$ fcode team:versions:list
|
|
974
|
+
|
|
975
|
+
DESCRIPTION
|
|
976
|
+
List the team versions published on the active team workspace
|
|
977
|
+
|
|
978
|
+
EXAMPLES
|
|
979
|
+
$ fcode team:versions:list
|
|
980
|
+
```
|
|
981
|
+
|
|
862
982
|
## `fcode test [SLUG]`
|
|
863
983
|
|
|
864
984
|
Run tests for Factorial Code processes
|
|
@@ -70,11 +70,11 @@ class SetupDebug extends core_1.Command {
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
if (process.env.
|
|
73
|
+
if (process.env.FC_COMMAND) {
|
|
74
74
|
configurations.forEach((configuration) => {
|
|
75
75
|
configuration.env = {
|
|
76
76
|
...configuration.env,
|
|
77
|
-
|
|
77
|
+
FC_COMMAND: process.env.FC_COMMAND
|
|
78
78
|
};
|
|
79
79
|
});
|
|
80
80
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import ApiClientCommand from '../../../core/commands/api-client-command';
|
|
2
|
+
export default class TeamAliasesDeleteCommand extends ApiClientCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
name: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const color_1 = require("@oclif/color");
|
|
5
|
+
const api_client_command_1 = require("../../../core/commands/api-client-command");
|
|
6
|
+
const pull_1 = require("../pull");
|
|
7
|
+
const cli_1 = require("../../../utils/cli");
|
|
8
|
+
class TeamAliasesDeleteCommand extends api_client_command_1.default {
|
|
9
|
+
async run() {
|
|
10
|
+
const { args: { name }, } = await this.parse(TeamAliasesDeleteCommand);
|
|
11
|
+
const aliases = await this._fcodeGraphQLClient.allTeamVersionAliases();
|
|
12
|
+
const alias = aliases.find((candidate) => candidate.name === name);
|
|
13
|
+
if (!alias) {
|
|
14
|
+
cli_1.default.error(`Alias ${name} does not exist`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
cli_1.default.log(color_1.default.cyan(`\n🗑️ deleting alias ${name}...`));
|
|
18
|
+
await this._fcodeGraphQLClient.deleteTeamVersionAlias(alias.id);
|
|
19
|
+
cli_1.default.log(color_1.default.green(`✅ alias ${name} deleted`));
|
|
20
|
+
await pull_1.default.run([]);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
TeamAliasesDeleteCommand.description = 'Delete a team version alias and the per-entity aliases carrying its name on every owned process and module';
|
|
24
|
+
TeamAliasesDeleteCommand.examples = ['$ fcode team:aliases:delete production'];
|
|
25
|
+
TeamAliasesDeleteCommand.args = {
|
|
26
|
+
name: core_1.Args.string({ description: 'alias name to delete', required: true }),
|
|
27
|
+
};
|
|
28
|
+
exports.default = TeamAliasesDeleteCommand;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const color_1 = require("@oclif/color");
|
|
4
|
+
const api_client_command_1 = require("../../../core/commands/api-client-command");
|
|
5
|
+
const cli_1 = require("../../../utils/cli");
|
|
6
|
+
class TeamAliasesListCommand extends api_client_command_1.default {
|
|
7
|
+
async run() {
|
|
8
|
+
await this.parse(TeamAliasesListCommand);
|
|
9
|
+
const aliases = await this._fcodeGraphQLClient.allTeamVersionAliases();
|
|
10
|
+
if (aliases.length === 0) {
|
|
11
|
+
cli_1.default.log('📋 No team version aliases yet.');
|
|
12
|
+
cli_1.default.log(`Create one with ${color_1.default.cyan('fcode team:aliases:set [name] [tag]')}`);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
cli_1.default.log('🔗 Team version aliases:\n');
|
|
16
|
+
for (const alias of aliases) {
|
|
17
|
+
cli_1.default.log(` ${color_1.default.cyan(alias.name)} → ${alias.tag}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
TeamAliasesListCommand.description = 'List the team version aliases of the active team workspace';
|
|
22
|
+
TeamAliasesListCommand.examples = ['$ fcode team:aliases:list'];
|
|
23
|
+
exports.default = TeamAliasesListCommand;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import ApiClientCommand from '../../../core/commands/api-client-command';
|
|
2
|
+
export default class TeamAliasesSetCommand extends ApiClientCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
name: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
tag: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const color_1 = require("@oclif/color");
|
|
5
|
+
const api_client_command_1 = require("../../../core/commands/api-client-command");
|
|
6
|
+
const pull_1 = require("../pull");
|
|
7
|
+
const cli_1 = require("../../../utils/cli");
|
|
8
|
+
class TeamAliasesSetCommand extends api_client_command_1.default {
|
|
9
|
+
async run() {
|
|
10
|
+
const { args: { name, tag }, } = await this.parse(TeamAliasesSetCommand);
|
|
11
|
+
cli_1.default.log(color_1.default.cyan(`\n🔗 pointing alias ${name} at ${tag}...`));
|
|
12
|
+
await this._fcodeGraphQLClient.createTeamVersionAlias(name, tag);
|
|
13
|
+
cli_1.default.log(color_1.default.green(`✅ alias ${name} → ${tag}`));
|
|
14
|
+
// Aliases have no folder representation; refreshing team.json is enough.
|
|
15
|
+
await pull_1.default.run([]);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
TeamAliasesSetCommand.description = 'Create or re-point a team version alias, upserting the per-entity alias on every owned ' +
|
|
19
|
+
'process and module that has the target tag published';
|
|
20
|
+
TeamAliasesSetCommand.examples = ['$ fcode team:aliases:set production v1.0.0'];
|
|
21
|
+
TeamAliasesSetCommand.args = {
|
|
22
|
+
name: core_1.Args.string({ description: 'alias name (e.g. production)', required: true }),
|
|
23
|
+
tag: core_1.Args.string({ description: 'team version tag the alias points at', required: true }),
|
|
24
|
+
};
|
|
25
|
+
exports.default = TeamAliasesSetCommand;
|
|
@@ -12,9 +12,16 @@ class TeamPullCommand extends api_client_command_1.default {
|
|
|
12
12
|
async run() {
|
|
13
13
|
await this.parse(TeamPullCommand);
|
|
14
14
|
cli_1.default.log(color_1.default.cyan('\n🗄️ pulling team settings...'));
|
|
15
|
-
const raw = await
|
|
15
|
+
const [raw, versions, aliases] = await Promise.all([
|
|
16
|
+
this._fcodeGraphQLClient.team(),
|
|
17
|
+
this._fcodeGraphQLClient.allTeamVersions(),
|
|
18
|
+
this._fcodeGraphQLClient.allTeamVersionAliases(),
|
|
19
|
+
]);
|
|
16
20
|
const team = await this._teamRepository.fromRaw(raw);
|
|
21
|
+
this._teamRepository.applyCloudVersioning(team, versions, aliases);
|
|
17
22
|
this._teamRepository.save(team);
|
|
23
|
+
// The stored hash intentionally excludes versions/aliases (see Team.contentHash), so
|
|
24
|
+
// pull-only fields never surface as a phantom MODIFIED state.
|
|
18
25
|
await this.workspaceConfig.setTeamStoredHash(team.contentHash);
|
|
19
26
|
}
|
|
20
27
|
}
|
|
@@ -22,6 +22,9 @@ class TeamPushCommand extends api_client_command_1.default {
|
|
|
22
22
|
cli_1.default.log('Team settings already up to date');
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
+
// team.json's `versions`/`aliases` fields are pull-only and intentionally left out of the
|
|
26
|
+
// update payload: team versions and aliases are only written through the explicit
|
|
27
|
+
// team:versions/team:aliases commands.
|
|
25
28
|
const update = { parentTeamSlugs: team.parentTeamSlugs };
|
|
26
29
|
if (team.zoneId !== undefined) {
|
|
27
30
|
update.zoneId = team.zoneId;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import ApiClientCommand from '../../../core/commands/api-client-command';
|
|
2
|
+
export default class TeamVersionsCreateCommand extends ApiClientCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
tag: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
comment: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
private logManifest;
|
|
13
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const color_1 = require("@oclif/color");
|
|
5
|
+
const api_client_command_1 = require("../../../core/commands/api-client-command");
|
|
6
|
+
const pull_1 = require("../../pull");
|
|
7
|
+
const cli_1 = require("../../../utils/cli");
|
|
8
|
+
class TeamVersionsCreateCommand extends api_client_command_1.default {
|
|
9
|
+
async run() {
|
|
10
|
+
const { args: { tag }, flags: { comment }, } = await this.parse(TeamVersionsCreateCommand);
|
|
11
|
+
cli_1.default.log(color_1.default.cyan(`\n🏷️ publishing team version ${tag}...`));
|
|
12
|
+
const teamVersion = await this._fcodeGraphQLClient.createTeamVersion(tag, comment);
|
|
13
|
+
const failedCount = this.logManifest(teamVersion);
|
|
14
|
+
// Refresh the local workspace: per-entity versions/<tag>/ folders and team.json.
|
|
15
|
+
await pull_1.default.run([]);
|
|
16
|
+
// Release pipelines must be able to detect an incomplete version. Re-running the
|
|
17
|
+
// command converges: it publishes only what is still missing.
|
|
18
|
+
if (failedCount > 0) {
|
|
19
|
+
this.error(`team version ${tag} published with ${failedCount} failed entities`, { exit: 1 });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
logManifest(teamVersion) {
|
|
23
|
+
const created = teamVersion.manifest.filter(({ outcome }) => outcome === 'CREATED');
|
|
24
|
+
const skipped = teamVersion.manifest.filter(({ outcome }) => outcome === 'SKIPPED_EXISTS');
|
|
25
|
+
const failed = teamVersion.manifest.filter(({ outcome }) => outcome === 'FAILED');
|
|
26
|
+
cli_1.default.log(color_1.default.green(`✅ ${created.length} created`) + `, ${skipped.length} skipped (tag already exists)` + (failed.length > 0 ? `, ${color_1.default.red(`${failed.length} failed`)}` : ''));
|
|
27
|
+
for (const entry of failed) {
|
|
28
|
+
cli_1.default.error(`${entry.resourceType.toLowerCase()} ${entry.slug} — ${entry.error ?? 'unknown error'}`);
|
|
29
|
+
}
|
|
30
|
+
return failed.length;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
TeamVersionsCreateCommand.description = 'Publish a team version: creates a version with the tag on every owned process and module ' +
|
|
34
|
+
'(existing tags are skipped) and pins bare module imports in the published snapshots';
|
|
35
|
+
TeamVersionsCreateCommand.examples = ['$ fcode team:versions:create v1.0.0', '$ fcode team:versions:create v1.0.0 --comment "First stable release"'];
|
|
36
|
+
TeamVersionsCreateCommand.args = {
|
|
37
|
+
tag: core_1.Args.string({ description: 'version tag to publish (e.g. v1.0.0)', required: true }),
|
|
38
|
+
};
|
|
39
|
+
TeamVersionsCreateCommand.flags = {
|
|
40
|
+
comment: core_1.Flags.string({ char: 'c', description: 'comment describing the version' }),
|
|
41
|
+
};
|
|
42
|
+
exports.default = TeamVersionsCreateCommand;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ApiClientCommand from '../../../core/commands/api-client-command';
|
|
2
|
+
export default class TeamVersionsDeleteCommand extends ApiClientCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
tag: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const color_1 = require("@oclif/color");
|
|
5
|
+
const api_client_command_1 = require("../../../core/commands/api-client-command");
|
|
6
|
+
const pull_1 = require("../../pull");
|
|
7
|
+
const types_1 = require("../../../core/types");
|
|
8
|
+
const cli_1 = require("../../../utils/cli");
|
|
9
|
+
class TeamVersionsDeleteCommand extends api_client_command_1.default {
|
|
10
|
+
async run() {
|
|
11
|
+
const { args: { tag }, flags: { force }, } = await this.parse(TeamVersionsDeleteCommand);
|
|
12
|
+
if (!force) {
|
|
13
|
+
const confirmed = await cli_1.default.confirm(`Deleting team version ${tag} also deletes every process/module version with that tag, plus the aliases, executions and schedules referencing them. Continue?`);
|
|
14
|
+
if (!confirmed) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
cli_1.default.log(color_1.default.cyan(`\n🗑️ deleting team version ${tag}...`));
|
|
19
|
+
await this._fcodeGraphQLClient.deleteTeamVersion(tag);
|
|
20
|
+
cli_1.default.log(color_1.default.green(`✅ team version ${tag} deleted`));
|
|
21
|
+
// Refresh the local workspace so removed versions/<tag>/ folders disappear.
|
|
22
|
+
await pull_1.default.run([]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
TeamVersionsDeleteCommand.description = 'Delete a team version. CASCADES: every owned process/module version with the tag is deleted, ' +
|
|
26
|
+
'together with the aliases, executions and schedules that reference them';
|
|
27
|
+
TeamVersionsDeleteCommand.examples = ['$ fcode team:versions:delete v1.0.0'];
|
|
28
|
+
TeamVersionsDeleteCommand.args = {
|
|
29
|
+
tag: core_1.Args.string({ description: 'version tag to delete', required: true }),
|
|
30
|
+
};
|
|
31
|
+
TeamVersionsDeleteCommand.flags = types_1.ForceFlag;
|
|
32
|
+
exports.default = TeamVersionsDeleteCommand;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const color_1 = require("@oclif/color");
|
|
4
|
+
const api_client_command_1 = require("../../../core/commands/api-client-command");
|
|
5
|
+
const cli_1 = require("../../../utils/cli");
|
|
6
|
+
class TeamVersionsListCommand extends api_client_command_1.default {
|
|
7
|
+
async run() {
|
|
8
|
+
await this.parse(TeamVersionsListCommand);
|
|
9
|
+
const versions = await this._fcodeGraphQLClient.allTeamVersions();
|
|
10
|
+
if (versions.length === 0) {
|
|
11
|
+
cli_1.default.log('📋 No team versions published yet.');
|
|
12
|
+
cli_1.default.log(`Publish one with ${color_1.default.cyan('fcode team:versions:create [tag]')}`);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
cli_1.default.log('🏷️ Team versions:\n');
|
|
16
|
+
for (const version of versions) {
|
|
17
|
+
const comment = version.comment ? ` — ${version.comment}` : '';
|
|
18
|
+
const author = version.createdBy?.name ? ` by ${version.createdBy.name}` : '';
|
|
19
|
+
cli_1.default.log(` ${color_1.default.cyan(version.tag)}${comment} (${version.createdAt}${author})`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
TeamVersionsListCommand.description = 'List the team versions published on the active team workspace';
|
|
24
|
+
TeamVersionsListCommand.examples = ['$ fcode team:versions:list'];
|
|
25
|
+
exports.default = TeamVersionsListCommand;
|
|
@@ -11,6 +11,7 @@ class VariablesStatus extends variables_command_1.default {
|
|
|
11
11
|
async resourcesTableLog(resources) {
|
|
12
12
|
const globalConfig = new global_1.default();
|
|
13
13
|
const localVariablesFileName = await globalConfig.getSetting(settings_1.SettingKeys.LOCAL_VARIABLES_FILE_NAME);
|
|
14
|
+
const hasInherited = resources.some((resource) => resource.resolvingTeamSlug);
|
|
14
15
|
cli_1.cli.table(resources, {
|
|
15
16
|
key: {
|
|
16
17
|
get({ key, status }) {
|
|
@@ -18,6 +19,16 @@ class VariablesStatus extends variables_command_1.default {
|
|
|
18
19
|
},
|
|
19
20
|
header: 'key',
|
|
20
21
|
},
|
|
22
|
+
...(hasInherited
|
|
23
|
+
? {
|
|
24
|
+
inherited: {
|
|
25
|
+
get(resource) {
|
|
26
|
+
return (0, colorize_resource_1.colorizeByStatus)(resource.resolvingTeamSlug ? `🔗 ${resource.resolvingTeamSlug}` : '', resource.status);
|
|
27
|
+
},
|
|
28
|
+
header: 'inherited',
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
: {}),
|
|
21
32
|
status: {
|
|
22
33
|
get({ status }) {
|
|
23
34
|
return (0, colorize_resource_1.colorizeByStatus)(status, status);
|
|
@@ -8,6 +8,7 @@ export declare enum SettingKeys {
|
|
|
8
8
|
IGNORE_PROCESS_VERSIONS = "ignoreProcessVersions",
|
|
9
9
|
IGNORE_WORKSPACE_NOT_EMPTY = "ignoreWorkspaceNotEmpty",
|
|
10
10
|
IGNORE_FCODE_RUN_PROCESSES = "ignoreFcodeRunProcesses",
|
|
11
|
+
INHERITED_VARIABLES_FILE_NAME = "inheritedVariablesFileName",
|
|
11
12
|
LOCAL_VARIABLES_FILE_NAME = "localVariablesFileName",
|
|
12
13
|
SKIP_SKILLS_SETUP = "skipSkillsSetup",
|
|
13
14
|
VARIABLES_FILE_NAME = "variablesFileName"
|
package/dist/config/settings.js
CHANGED
|
@@ -8,6 +8,7 @@ var SettingKeys;
|
|
|
8
8
|
SettingKeys["IGNORE_PROCESS_VERSIONS"] = "ignoreProcessVersions";
|
|
9
9
|
SettingKeys["IGNORE_WORKSPACE_NOT_EMPTY"] = "ignoreWorkspaceNotEmpty";
|
|
10
10
|
SettingKeys["IGNORE_FCODE_RUN_PROCESSES"] = "ignoreFcodeRunProcesses";
|
|
11
|
+
SettingKeys["INHERITED_VARIABLES_FILE_NAME"] = "inheritedVariablesFileName";
|
|
11
12
|
SettingKeys["LOCAL_VARIABLES_FILE_NAME"] = "localVariablesFileName";
|
|
12
13
|
SettingKeys["SKIP_SKILLS_SETUP"] = "skipSkillsSetup";
|
|
13
14
|
SettingKeys["VARIABLES_FILE_NAME"] = "variablesFileName";
|
|
@@ -48,6 +49,11 @@ exports.SETTINGS_DEFINITIONS = [
|
|
|
48
49
|
default: 'variables.local.env',
|
|
49
50
|
description: 'Local variables file name',
|
|
50
51
|
},
|
|
52
|
+
{
|
|
53
|
+
key: SettingKeys.INHERITED_VARIABLES_FILE_NAME,
|
|
54
|
+
default: 'variables.inherited.env',
|
|
55
|
+
description: 'File holding the variables inherited from parent workspaces (read-only, gitignored)',
|
|
56
|
+
},
|
|
51
57
|
];
|
|
52
58
|
function getSettingDefault(key) {
|
|
53
59
|
return exports.SETTINGS_DEFINITIONS.find((def) => def.key === key)?.default;
|
package/dist/core/types.d.ts
CHANGED
|
@@ -205,7 +205,7 @@ export declare class Variable extends Resource {
|
|
|
205
205
|
key: string;
|
|
206
206
|
value: string;
|
|
207
207
|
overriddenLocally?: boolean;
|
|
208
|
-
constructor(id: string | undefined, key: string, value: string, isSensitive: boolean);
|
|
208
|
+
constructor(id: string | undefined, key: string, value: string, isSensitive: boolean, resolvingTeamSlug?: string);
|
|
209
209
|
static validate(variable: Variable): Variable;
|
|
210
210
|
get contentHash(): string;
|
|
211
211
|
}
|
|
@@ -221,6 +221,40 @@ export interface ErrorHandlerConfig {
|
|
|
221
221
|
processSlug: string;
|
|
222
222
|
tag?: string | null;
|
|
223
223
|
}
|
|
224
|
+
export interface TeamVersionManifestEntry {
|
|
225
|
+
resourceType: 'MODULE' | 'PROCESS';
|
|
226
|
+
resourceId: string;
|
|
227
|
+
slug: string;
|
|
228
|
+
outcome: 'CREATED' | 'FAILED' | 'SKIPPED_EXISTS' | 'SKIPPED_NO_TAG' | 'UPDATED';
|
|
229
|
+
error?: string | null;
|
|
230
|
+
}
|
|
231
|
+
export interface TeamVersion {
|
|
232
|
+
id: string;
|
|
233
|
+
tag: string;
|
|
234
|
+
comment?: string | null;
|
|
235
|
+
manifest: TeamVersionManifestEntry[];
|
|
236
|
+
createdAt: string;
|
|
237
|
+
createdBy?: {
|
|
238
|
+
id: string;
|
|
239
|
+
name: string;
|
|
240
|
+
} | null;
|
|
241
|
+
}
|
|
242
|
+
export interface TeamVersionAlias {
|
|
243
|
+
id: string;
|
|
244
|
+
name: string;
|
|
245
|
+
tag: string;
|
|
246
|
+
createdAt: string;
|
|
247
|
+
updatedAt?: string | null;
|
|
248
|
+
}
|
|
249
|
+
export interface TeamVersionFileEntry {
|
|
250
|
+
tag: string;
|
|
251
|
+
comment?: string;
|
|
252
|
+
createdAt: string;
|
|
253
|
+
}
|
|
254
|
+
export interface TeamAliasFileEntry {
|
|
255
|
+
name: string;
|
|
256
|
+
tag: string;
|
|
257
|
+
}
|
|
224
258
|
export declare class Team extends Resource {
|
|
225
259
|
id: string | undefined;
|
|
226
260
|
slug: string;
|
|
@@ -228,6 +262,8 @@ export declare class Team extends Resource {
|
|
|
228
262
|
errorHandlerConfig?: ErrorHandlerConfig;
|
|
229
263
|
parentTeamSlugs: string[];
|
|
230
264
|
webhookAuth?: WebhookAuth;
|
|
265
|
+
versions?: TeamVersionFileEntry[];
|
|
266
|
+
aliases?: TeamAliasFileEntry[];
|
|
231
267
|
constructor(slug: string, parentTeamSlugs: string[], zoneId?: string, errorHandlerConfig?: ErrorHandlerConfig, webhookAuth?: WebhookAuth);
|
|
232
268
|
get contentHash(): string;
|
|
233
269
|
}
|
package/dist/core/types.js
CHANGED
|
@@ -118,13 +118,14 @@ class VersionedScriptLibrary extends Resource {
|
|
|
118
118
|
}
|
|
119
119
|
exports.VersionedScriptLibrary = VersionedScriptLibrary;
|
|
120
120
|
class Variable extends Resource {
|
|
121
|
-
constructor(id, key, value, isSensitive) {
|
|
121
|
+
constructor(id, key, value, isSensitive, resolvingTeamSlug) {
|
|
122
122
|
super();
|
|
123
123
|
this.id = id;
|
|
124
124
|
this.slug = key;
|
|
125
125
|
this.key = key;
|
|
126
126
|
this.value = value;
|
|
127
127
|
this.isSensitive = isSensitive;
|
|
128
|
+
this.resolvingTeamSlug = resolvingTeamSlug;
|
|
128
129
|
}
|
|
129
130
|
static validate(variable) {
|
|
130
131
|
if (!Variable.ENV_KEY_REGEX.test(variable.key)) {
|
package/dist/env.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare const envSchema: z.ZodObject<{
|
|
|
27
27
|
false: "false";
|
|
28
28
|
}>>;
|
|
29
29
|
CLI_UX_SKIP_TTY_CHECK: z.ZodOptional<z.ZodString>;
|
|
30
|
-
|
|
30
|
+
FC_COMMAND: z.ZodOptional<z.ZodString>;
|
|
31
31
|
}, z.core.$strip>;
|
|
32
32
|
export declare const env: {
|
|
33
33
|
FCODE_CLOUD_URL: string;
|
|
@@ -38,6 +38,6 @@ export declare const env: {
|
|
|
38
38
|
FCODE_DISABLE_UPDATE_NOTIFIER?: "true" | "false" | undefined;
|
|
39
39
|
SILENT_MODE?: "true" | "false" | undefined;
|
|
40
40
|
CLI_UX_SKIP_TTY_CHECK?: string | undefined;
|
|
41
|
-
|
|
41
|
+
FC_COMMAND?: string | undefined;
|
|
42
42
|
};
|
|
43
43
|
export default env;
|
package/dist/env.js
CHANGED
|
@@ -25,7 +25,7 @@ exports.envSchema = zod_1.z.object({
|
|
|
25
25
|
SILENT_MODE: zod_1.z.enum(['true', 'false']).optional(),
|
|
26
26
|
CLI_UX_SKIP_TTY_CHECK: zod_1.z.string().min(1).optional(),
|
|
27
27
|
// --- Debug tooling ---
|
|
28
|
-
|
|
28
|
+
FC_COMMAND: zod_1.z.string().min(1).optional(),
|
|
29
29
|
});
|
|
30
30
|
/** Treat empty strings (e.g. an unset shell/dotenv var rendered as "") as missing. */
|
|
31
31
|
const raw = Object.fromEntries(Object.entries(process.env).filter(([, value]) => value !== ''));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RawTeamSettings, Team } from '../core/types';
|
|
1
|
+
import { RawTeamSettings, Team, TeamVersion, TeamVersionAlias } from '../core/types';
|
|
2
2
|
import WorkspaceConfig from '../config/workspace';
|
|
3
3
|
/**
|
|
4
4
|
* Reads/writes the singleton team.json (timezone, error handler, inheritance, webhook auth) at the
|
|
@@ -16,6 +16,12 @@ export default class TeamRepository {
|
|
|
16
16
|
save(team: Team): void;
|
|
17
17
|
/** Builds a Team from the cloud's raw settings, resolving the error-handler id to a slug. */
|
|
18
18
|
fromRaw(raw: RawTeamSettings): Promise<Team>;
|
|
19
|
+
/**
|
|
20
|
+
* Writes the cloud's team versions and aliases into the Team as the pull-only team.json
|
|
21
|
+
* fields (sorted for stable git diffs). These fields never enter the content hash and are
|
|
22
|
+
* stripped from pushes: all writes go through the team:versions/team:aliases commands.
|
|
23
|
+
*/
|
|
24
|
+
applyCloudVersioning(team: Team, versions: TeamVersion[], aliases: TeamVersionAlias[]): void;
|
|
19
25
|
resolveSlugToId(processSlug: string): Promise<string>;
|
|
20
26
|
resolveIdToSlug(processId: string): Promise<string>;
|
|
21
27
|
private parseErrorHandler;
|