@sous-io/sous 0.2.36 → 1.0.1
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 +14 -256
- package/dist/bin.js +11 -0
- package/dist/sous.js +1093 -0
- package/docs/markdown/README.md +5 -4
- package/docs/markdown/_sidebar.md +21 -1
- package/docs/markdown/commands.md +294 -431
- package/docs/markdown/config-discovery.md +25 -14
- package/docs/markdown/config-inspection.md +53 -31
- package/docs/markdown/config-layers.md +168 -66
- package/docs/markdown/config-variables.md +44 -11
- package/docs/markdown/configuration.md +104 -17
- package/docs/markdown/design-principles.md +4 -1
- package/docs/markdown/repositories-authoring.md +30 -0
- package/docs/markdown/repositories-consuming.md +72 -14
- package/docs/markdown/repositories-file-formats.md +31 -13
- package/docs/markdown/repositories-providers.md +48 -57
- package/docs/markdown/repositories-quickstart.md +3 -2
- package/docs/markdown/repositories-troubleshooting.md +27 -1
- package/docs/markdown/repositories-variables.md +6 -1
- package/docs/markdown/repositories.md +18 -8
- package/package.json +48 -107
- package/recipes/core/sous-skills/skills/about-liquid-templates/SKILL.tpl.md +4 -6
- package/recipes/core/sous-skills/skills/about-liquid-templates/references/liquid-filters.tpl.md +2 -0
- package/recipes/core/sous-skills/skills/about-sous/SKILL.tpl.md +10 -9
- package/recipes/core/sous-skills/skills/about-sous-configuration/SKILL.tpl.md +35 -14
- package/recipes/core/sous-skills/skills/about-sous-recipes/SKILL.tpl.md +51 -20
- package/recipes/core/sous-skills/sous.recipe.yaml +1 -1
- package/sous.config.schema.json +351 -132
- package/bin/run.js +0 -51
- package/src/base-command.ts +0 -457
- package/src/commands/build.ts +0 -181
- package/src/commands/clear.ts +0 -79
- package/src/commands/compile.ts +0 -155
- package/src/commands/config/get.ts +0 -110
- package/src/commands/config/show.ts +0 -32
- package/src/commands/config/validate.ts +0 -53
- package/src/commands/help.ts +0 -46
- package/src/commands/init.ts +0 -289
- package/src/commands/launch.ts +0 -139
- package/src/commands/lock/rebuild.ts +0 -239
- package/src/commands/lock/show.ts +0 -115
- package/src/commands/namespace/list.ts +0 -138
- package/src/commands/namespace/show.ts +0 -130
- package/src/commands/prune.ts +0 -43
- package/src/commands/recipe/list.ts +0 -112
- package/src/commands/recipe/show.ts +0 -439
- package/src/commands/repo/add.ts +0 -145
- package/src/commands/repo/contribute.ts +0 -604
- package/src/commands/repo/gc.ts +0 -173
- package/src/commands/repo/init.ts +0 -136
- package/src/commands/repo/link.ts +0 -899
- package/src/commands/repo/list.ts +0 -236
- package/src/commands/repo/release.ts +0 -685
- package/src/commands/repo/remove.ts +0 -194
- package/src/commands/repo/search.ts +0 -243
- package/src/commands/repo/submit.ts +0 -341
- package/src/commands/repo/unlink.ts +0 -461
- package/src/commands/subscription/add.ts +0 -286
- package/src/commands/subscription/list.ts +0 -208
- package/src/commands/subscription/remove.ts +0 -182
- package/src/commands/subscription/update.ts +0 -216
- package/src/commands/update.ts +0 -178
- package/src/commands/vars/ask.ts +0 -417
- package/src/commands/vars/index.ts +0 -79
- package/src/commands/vars/list.ts +0 -67
- package/src/commands/vars/show.ts +0 -77
- package/src/config-command.ts +0 -30
- package/src/lib/build-preparation.ts +0 -128
- package/src/lib/build-service.ts +0 -580
- package/src/lib/config-discovery.ts +0 -378
- package/src/lib/config-inspect.ts +0 -145
- package/src/lib/config-kernel.mjs +0 -379
- package/src/lib/config-schema.ts +0 -401
- package/src/lib/env-file.ts +0 -328
- package/src/lib/env-local.ts +0 -212
- package/src/lib/errors.ts +0 -32
- package/src/lib/glob-pattern.ts +0 -24
- package/src/lib/include-resolver.ts +0 -523
- package/src/lib/interactive.ts +0 -165
- package/src/lib/markdown-compiler.ts +0 -947
- package/src/lib/package-info.ts +0 -25
- package/src/lib/pid-service.ts +0 -99
- package/src/lib/project-install.d.mts +0 -44
- package/src/lib/project-install.mjs +0 -234
- package/src/lib/project-scaffold/index.ts +0 -332
- package/src/lib/project-scaffold/templates.ts +0 -240
- package/src/lib/repos/catalog-display.ts +0 -215
- package/src/lib/repos/catalog-inputs.ts +0 -288
- package/src/lib/repos/catalog.ts +0 -842
- package/src/lib/repos/contribute.ts +0 -452
- package/src/lib/repos/core-recipe.ts +0 -105
- package/src/lib/repos/declarations.ts +0 -187
- package/src/lib/repos/defaults.ts +0 -175
- package/src/lib/repos/formats/common.ts +0 -440
- package/src/lib/repos/formats/index-file.ts +0 -253
- package/src/lib/repos/formats/links-map.ts +0 -98
- package/src/lib/repos/formats/lockfile.ts +0 -169
- package/src/lib/repos/formats/patterns.ts +0 -57
- package/src/lib/repos/formats/recipe-manifest.ts +0 -205
- package/src/lib/repos/formats/repo-manifest.ts +0 -97
- package/src/lib/repos/formats/store-entry.ts +0 -84
- package/src/lib/repos/formats/variable-definition.ts +0 -268
- package/src/lib/repos/freshness.ts +0 -264
- package/src/lib/repos/git-clone.ts +0 -850
- package/src/lib/repos/identity.ts +0 -89
- package/src/lib/repos/index.ts +0 -57
- package/src/lib/repos/links.ts +0 -356
- package/src/lib/repos/load-manifest.ts +0 -237
- package/src/lib/repos/lock-service.ts +0 -454
- package/src/lib/repos/locked-namespace-resolver.ts +0 -232
- package/src/lib/repos/locked-recipe-lookup.ts +0 -123
- package/src/lib/repos/locked-recipes.ts +0 -254
- package/src/lib/repos/managed-layer.ts +0 -422
- package/src/lib/repos/memories-hash-name.ts +0 -33
- package/src/lib/repos/namespace-resolver.ts +0 -527
- package/src/lib/repos/providers/base.ts +0 -268
- package/src/lib/repos/providers/git.ts +0 -237
- package/src/lib/repos/providers/github.ts +0 -589
- package/src/lib/repos/providers/gitlab.ts +0 -332
- package/src/lib/repos/providers/http.ts +0 -128
- package/src/lib/repos/providers/index-cache.ts +0 -421
- package/src/lib/repos/providers/index.ts +0 -106
- package/src/lib/repos/providers/local.ts +0 -391
- package/src/lib/repos/providers/provider.ts +0 -615
- package/src/lib/repos/recipe-config-layers.ts +0 -316
- package/src/lib/repos/recipe-key-matcher.ts +0 -62
- package/src/lib/repos/recipe-memories.ts +0 -178
- package/src/lib/repos/recipe-targets.ts +0 -236
- package/src/lib/repos/ref-search.ts +0 -46
- package/src/lib/repos/release/bump.ts +0 -161
- package/src/lib/repos/release/changelog.ts +0 -461
- package/src/lib/repos/release/git-state.ts +0 -460
- package/src/lib/repos/release/index-builder.ts +0 -1108
- package/src/lib/repos/release/index.ts +0 -19
- package/src/lib/repos/release/plan.ts +0 -521
- package/src/lib/repos/release/settle.ts +0 -154
- package/src/lib/repos/release/submissions.ts +0 -214
- package/src/lib/repos/release/submit-checkout.ts +0 -290
- package/src/lib/repos/release/submit-questions.ts +0 -153
- package/src/lib/repos/release/submit-service.ts +0 -898
- package/src/lib/repos/release/tags.ts +0 -239
- package/src/lib/repos/release/validate.ts +0 -463
- package/src/lib/repos/resolver.ts +0 -1028
- package/src/lib/repos/scaffold/index.ts +0 -245
- package/src/lib/repos/scaffold/templates.ts +0 -517
- package/src/lib/repos/seed.ts +0 -473
- package/src/lib/repos/store/contract.ts +0 -64
- package/src/lib/repos/store/hash.ts +0 -191
- package/src/lib/repos/store/recipe-store.ts +0 -599
- package/src/lib/repos/store/settings.ts +0 -58
- package/src/lib/repos/subscription-service.ts +0 -3859
- package/src/lib/repos/trust.ts +0 -447
- package/src/lib/repos/update-plan.ts +0 -235
- package/src/lib/self-update/index.ts +0 -14
- package/src/lib/self-update/installs.ts +0 -412
- package/src/lib/self-update/managers.ts +0 -126
- package/src/lib/self-update/plan.ts +0 -315
- package/src/lib/self-update/registry.ts +0 -99
- package/src/lib/self-update/run.ts +0 -506
- package/src/lib/self-update/versions.ts +0 -243
- package/src/lib/settings.ts +0 -1105
- package/src/lib/sous-home.ts +0 -104
- package/src/lib/state.ts +0 -167
- package/src/lib/vars/answers.ts +0 -192
- package/src/lib/vars/ask.ts +0 -1152
- package/src/lib/vars/definition-source.ts +0 -261
- package/src/lib/vars/display.ts +0 -231
- package/src/lib/vars/index.ts +0 -20
- package/src/lib/vars/ladder.ts +0 -282
- package/src/lib/vars/mappings.ts +0 -260
- package/src/lib/vars/names.ts +0 -94
- package/src/lib/vars/preanswers.ts +0 -395
- package/src/lib/vars/question-plan.ts +0 -241
- package/src/lib/vars/report.ts +0 -228
- package/src/lib/vars/safe-regex.ts +0 -235
- package/src/lib/vars/secrets.ts +0 -131
- package/src/lib/vars/validate.ts +0 -312
- package/src/lib/version-report.ts +0 -90
- package/src/lib/watch-loop.ts +0 -148
- package/src/lib/watch-service.ts +0 -116
- package/src/services/ref-resolver/container.ts +0 -107
- package/src/services/ref-resolver/dependency.ts +0 -60
- package/src/services/ref-resolver/format.ts +0 -197
- package/src/services/ref-resolver/glob.ts +0 -115
- package/src/services/ref-resolver/hash-names.ts +0 -155
- package/src/services/ref-resolver/index.ts +0 -55
- package/src/services/ref-resolver/injectable.ts +0 -36
- package/src/services/ref-resolver/location.ts +0 -62
- package/src/services/ref-resolver/lookups/cached-index-lookup.ts +0 -53
- package/src/services/ref-resolver/lookups/catalog-lookup.ts +0 -23
- package/src/services/ref-resolver/lookups/catalog-matcher.ts +0 -261
- package/src/services/ref-resolver/lookups/chained-lookup.ts +0 -27
- package/src/services/ref-resolver/lookups/env-var-lookup.ts +0 -65
- package/src/services/ref-resolver/lookups/fetched-index-lookup.ts +0 -150
- package/src/services/ref-resolver/lookups/recorded-dependency-lookup.ts +0 -62
- package/src/services/ref-resolver/lookups/ref-lookup.ts +0 -54
- package/src/services/ref-resolver/lookups/variable-lookup.ts +0 -123
- package/src/services/ref-resolver/named-refs.ts +0 -144
- package/src/services/ref-resolver/parser/env-var-splitter.ts +0 -27
- package/src/services/ref-resolver/parser/location-splitter.ts +0 -239
- package/src/services/ref-resolver/parser/name-path-splitter.ts +0 -200
- package/src/services/ref-resolver/parser/partial-ref.ts +0 -84
- package/src/services/ref-resolver/parser/query-splitter.ts +0 -61
- package/src/services/ref-resolver/parser/range-splitter.ts +0 -52
- package/src/services/ref-resolver/parser/ref-parser.ts +0 -115
- package/src/services/ref-resolver/parser/repo-qualifier-splitter.ts +0 -51
- package/src/services/ref-resolver/parts.ts +0 -115
- package/src/services/ref-resolver/pruners/command-line-pruner.ts +0 -47
- package/src/services/ref-resolver/pruners/include-pruner.ts +0 -66
- package/src/services/ref-resolver/pruners/manifest-pruner.ts +0 -130
- package/src/services/ref-resolver/pruners/ref-pruner.ts +0 -135
- package/src/services/ref-resolver/pruners/rule-helpers.ts +0 -44
- package/src/services/ref-resolver/pruners/stored-key-pruner.ts +0 -136
- package/src/services/ref-resolver/ref-helpers.ts +0 -62
- package/src/services/ref-resolver/ref-picker-service.ts +0 -204
- package/src/services/ref-resolver/ref-report.ts +0 -84
- package/src/services/ref-resolver/ref-resolve-arguments.ts +0 -47
- package/src/services/ref-resolver/ref-resolve-result.ts +0 -36
- package/src/services/ref-resolver/ref-resolver-service.ts +0 -323
- package/src/services/ref-resolver/source.ts +0 -48
- package/src/services/ref-resolver/tokens.ts +0 -25
- package/src/services/ref-resolver/types.ts +0 -155
- package/src/templating/filters/bullet-list.ts +0 -9
- package/src/templating/filters/index.ts +0 -8
- package/src/templating/init-liquid-engine.ts +0 -139
- package/src/templating/lib/glob-files.ts +0 -74
- package/src/templating/lib/import-export.ts +0 -32
- package/src/templating/lib/secret-scope.ts +0 -41
- package/src/templating/lib/tag-args.ts +0 -19
- package/src/templating/tags/exportScalarVarsJs.ts +0 -46
- package/src/templating/tags/getFiles.ts +0 -89
- package/src/templating/tags/index.ts +0 -14
- package/src/templating/tags/listFiles.ts +0 -54
- package/src/templating/tags/showVars.ts +0 -28
- package/src/utils/choice-prompt.ts +0 -143
- package/src/utils/command-errors.ts +0 -186
- package/src/utils/command-help.ts +0 -45
- package/src/utils/confirm-prompt.ts +0 -110
- package/src/utils/flags.ts +0 -177
- package/src/utils/formatting.ts +0 -849
- package/src/utils/prompts.ts +0 -53
- package/src/utils/sous-directory.ts +0 -245
- package/src/utils/table.ts +0 -603
- package/src/utils/value-prompt.ts +0 -119
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `sous lock show`.
|
|
3
|
-
*
|
|
4
|
-
* Prints the lockfile: every recipe this project pins, the version and the
|
|
5
|
-
* repository it is pinned to, and who holds it. It reads the file and nothing
|
|
6
|
-
* else, so it works offline and never writes.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { BaseCommand } from "../../base-command.js";
|
|
10
|
-
import { subscriptionServiceFor } from "../../lib/repos/subscription-service.js";
|
|
11
|
-
import { PROJECT_HOLDER } from "../../lib/repos/formats/lockfile.js";
|
|
12
|
-
import { renderTable, type TableColumn } from "../../utils/table.js";
|
|
13
|
-
import {
|
|
14
|
-
blankLine,
|
|
15
|
-
footer,
|
|
16
|
-
heading,
|
|
17
|
-
indent,
|
|
18
|
-
log,
|
|
19
|
-
paragraph,
|
|
20
|
-
showCommandVars,
|
|
21
|
-
} from "../../utils/formatting.js";
|
|
22
|
-
|
|
23
|
-
/** How far every line of this command's output is indented. */
|
|
24
|
-
const INDENT = 2;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The columns the listing shows. The recipe and the version it is pinned at are
|
|
28
|
-
* what a lockfile is for, so they stay whatever the terminal's width; the list
|
|
29
|
-
* of holders takes the room that is left and wraps rather than being cut.
|
|
30
|
-
*/
|
|
31
|
-
const COLUMNS: TableColumn[] = [
|
|
32
|
-
{ key: "key", header: "Recipe", kind: "path", overflow: "truncate", minWidth: 12 },
|
|
33
|
-
{ key: "version", header: "Version", overflow: "truncate", minWidth: 7 },
|
|
34
|
-
{ key: "repo", header: "Repository", overflow: "truncate", priority: "medium" },
|
|
35
|
-
{
|
|
36
|
-
key: "heldBy",
|
|
37
|
-
header: "Held by",
|
|
38
|
-
overflow: "wrap",
|
|
39
|
-
flex: 1,
|
|
40
|
-
priority: "low",
|
|
41
|
-
minWidth: 16,
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
export default class LockShow extends BaseCommand {
|
|
46
|
-
static description = "Show every recipe version this project's lockfile pins";
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* The other spelling of the topic. It lives under a hidden topic, so it is
|
|
50
|
-
* typable everywhere without ever reaching the top-level listing.
|
|
51
|
-
*/
|
|
52
|
-
static aliases = ["locks:show"];
|
|
53
|
-
|
|
54
|
-
static examples = ["<%= config.bin %> lock show"];
|
|
55
|
-
|
|
56
|
-
static flags = { ...BaseCommand.baseFlags };
|
|
57
|
-
|
|
58
|
-
async run(): Promise<void> {
|
|
59
|
-
await this.parse(LockShow);
|
|
60
|
-
|
|
61
|
-
showCommandVars({
|
|
62
|
-
Project: this.projectLabel,
|
|
63
|
-
Config: this.configContext.configPath,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const service = subscriptionServiceFor({
|
|
67
|
-
configContext: this.configContext,
|
|
68
|
-
settings: this.settings,
|
|
69
|
-
shellEnv: this.shellEnv,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const lock = service.lockService.read();
|
|
73
|
-
const keys = Object.keys(lock.recipes).sort();
|
|
74
|
-
|
|
75
|
-
heading("Recipe versions this project pins");
|
|
76
|
-
blankLine();
|
|
77
|
-
|
|
78
|
-
if (keys.length === 0) {
|
|
79
|
-
paragraph(
|
|
80
|
-
`This project pins nothing yet. Its lockfile is ${service.lockService.filePath}.`
|
|
81
|
-
);
|
|
82
|
-
footer();
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const rows = keys.map((key) => {
|
|
87
|
-
const entry = lock.recipes[key]!;
|
|
88
|
-
return {
|
|
89
|
-
key,
|
|
90
|
-
version: entry.version,
|
|
91
|
-
repo: entry.repo,
|
|
92
|
-
heldBy: entry.requestedBy.map(describeHolder).join(", "),
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
for (const line of renderTable(COLUMNS, rows, { indent: INDENT })) {
|
|
97
|
-
log(indent(line, INDENT));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
blankLine();
|
|
101
|
-
paragraph(`This project's lockfile is ${service.lockService.filePath}.`);
|
|
102
|
-
|
|
103
|
-
footer();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Plain-language wording for one holder of a locked recipe: the project itself,
|
|
109
|
-
* or the recipe that requires it.
|
|
110
|
-
*
|
|
111
|
-
* @param holder - What the lockfile recorded.
|
|
112
|
-
*/
|
|
113
|
-
function describeHolder(holder: string): string {
|
|
114
|
-
return holder === PROJECT_HOLDER ? "this project" : holder;
|
|
115
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `sous namespace list`.
|
|
3
|
-
*
|
|
4
|
-
* Shows every namespace published by the repositories this project trusts, how
|
|
5
|
-
* many recipes each one holds, and how much of it the project subscribes to. It
|
|
6
|
-
* reads only the indexes sous already has on disk by default, so it works
|
|
7
|
-
* offline; a repository whose index has never been fetched is named at the end
|
|
8
|
-
* rather than being silently left out. `--latest` reads the indexes from
|
|
9
|
-
* upstream instead, without saving them, and `--installed` narrows the listing
|
|
10
|
-
* to the namespaces the lockfile pins a recipe from.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { BaseCommand } from "../../base-command.js";
|
|
14
|
-
import { subscriptionServiceFor } from "../../lib/repos/subscription-service.js";
|
|
15
|
-
import { loadCatalogContext } from "../../lib/repos/catalog-inputs.js";
|
|
16
|
-
import { listNamespaces, narrowToInstalled } from "../../lib/repos/catalog.js";
|
|
17
|
-
import {
|
|
18
|
-
INDENT,
|
|
19
|
-
describeCoverage,
|
|
20
|
-
describeIndexSource,
|
|
21
|
-
printBrowsingNotes,
|
|
22
|
-
} from "../../lib/repos/catalog-display.js";
|
|
23
|
-
import { renderTable, type TableColumn } from "../../utils/table.js";
|
|
24
|
-
import { browsingFlags } from "../../utils/flags.js";
|
|
25
|
-
import {
|
|
26
|
-
blankLine,
|
|
27
|
-
footer,
|
|
28
|
-
heading,
|
|
29
|
-
indent,
|
|
30
|
-
log,
|
|
31
|
-
paragraph,
|
|
32
|
-
showCommandVars,
|
|
33
|
-
} from "../../utils/formatting.js";
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* The columns the listing shows. The namespace and what a project has of it are
|
|
37
|
-
* the point of the command, so they stay whatever the terminal's width; the
|
|
38
|
-
* description takes the room that is left and wraps rather than being cut.
|
|
39
|
-
*/
|
|
40
|
-
const COLUMNS: TableColumn[] = [
|
|
41
|
-
{ key: "namespace", header: "Namespace", overflow: "truncate", minWidth: 10 },
|
|
42
|
-
{ key: "repo", header: "Repository", overflow: "truncate", priority: "medium" },
|
|
43
|
-
{ key: "recipes", header: "Recipes", kind: "number", priority: "medium" },
|
|
44
|
-
{ key: "subscribed", header: "Subscribed", priority: "medium" },
|
|
45
|
-
{
|
|
46
|
-
key: "description",
|
|
47
|
-
header: "What it is",
|
|
48
|
-
overflow: "wrap",
|
|
49
|
-
flex: 1,
|
|
50
|
-
priority: "low",
|
|
51
|
-
minWidth: 16,
|
|
52
|
-
},
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
export default class NamespaceList extends BaseCommand {
|
|
56
|
-
static description = "List the namespaces the repositories this project trusts publish";
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* The other spelling of the topic. It lives under a hidden topic, so it is
|
|
60
|
-
* typable everywhere without ever reaching the top-level listing.
|
|
61
|
-
*/
|
|
62
|
-
static aliases = ["namespaces:list"];
|
|
63
|
-
|
|
64
|
-
static examples = [
|
|
65
|
-
"<%= config.bin %> namespace list",
|
|
66
|
-
"<%= config.bin %> namespace list --installed",
|
|
67
|
-
];
|
|
68
|
-
|
|
69
|
-
static flags = { ...BaseCommand.baseFlags, ...browsingFlags() };
|
|
70
|
-
|
|
71
|
-
async run(): Promise<void> {
|
|
72
|
-
const { flags } = await this.parse(NamespaceList);
|
|
73
|
-
|
|
74
|
-
showCommandVars({
|
|
75
|
-
Project: this.projectLabel,
|
|
76
|
-
Config: this.configContext.configPath,
|
|
77
|
-
Reading: describeIndexSource(flags.latest),
|
|
78
|
-
...(flags.installed ? { Showing: "only what this project has installed" } : {}),
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
heading(
|
|
82
|
-
flags.installed
|
|
83
|
-
? "Namespaces this project has installed recipes from"
|
|
84
|
-
: "Namespaces in the repositories this project trusts"
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
const service = subscriptionServiceFor({
|
|
88
|
-
configContext: this.configContext,
|
|
89
|
-
settings: this.settings,
|
|
90
|
-
shellEnv: this.shellEnv,
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const { inputs, notFetched, notChecked } = await loadCatalogContext({
|
|
94
|
-
service,
|
|
95
|
-
sousDir: this.configContext.sousDir,
|
|
96
|
-
settings: this.settings,
|
|
97
|
-
latest: flags.latest,
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// Narrowed to what is installed, a namespace's recipe count is the number
|
|
101
|
-
// of its recipes the project has installed, and the column says so.
|
|
102
|
-
const listings = listNamespaces(flags.installed ? narrowToInstalled(inputs) : inputs);
|
|
103
|
-
const columns = flags.installed
|
|
104
|
-
? COLUMNS.map((column) =>
|
|
105
|
-
column.key === "recipes" ? { ...column, header: "Installed" } : column
|
|
106
|
-
)
|
|
107
|
-
: COLUMNS;
|
|
108
|
-
|
|
109
|
-
blankLine();
|
|
110
|
-
|
|
111
|
-
if (listings.length === 0) {
|
|
112
|
-
paragraph(
|
|
113
|
-
inputs.repos.length === 0
|
|
114
|
-
? "Sous has read no repository index for this project, so there are no " +
|
|
115
|
-
"namespaces to show."
|
|
116
|
-
: flags.installed
|
|
117
|
-
? "This project has installed no recipe from the repositories it trusts."
|
|
118
|
-
: "The repositories this project trusts publish no namespaces."
|
|
119
|
-
);
|
|
120
|
-
} else {
|
|
121
|
-
const rows = listings.map((entry) => ({
|
|
122
|
-
namespace: entry.namespace,
|
|
123
|
-
repo: entry.repo,
|
|
124
|
-
recipes: String(entry.recipeCount),
|
|
125
|
-
subscribed: describeCoverage(entry.subscribed),
|
|
126
|
-
description: entry.description ?? "no description published",
|
|
127
|
-
}));
|
|
128
|
-
|
|
129
|
-
for (const line of renderTable(columns, rows, { indent: INDENT })) {
|
|
130
|
-
log(indent(line, INDENT));
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
printBrowsingNotes({ notFetched, notChecked });
|
|
135
|
-
|
|
136
|
-
footer();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `sous namespace show <ref>`.
|
|
3
|
-
*
|
|
4
|
-
* Shows one namespace in full: the repository publishing it, what that
|
|
5
|
-
* repository says it is for, how much of it this project subscribes to, and
|
|
6
|
-
* every recipe in it with its latest version, its pinned version and its own
|
|
7
|
-
* subscription state. It reads only the indexes sous already has on disk,
|
|
8
|
-
* unless `--latest` asks it to read upstream (which saves nothing); `--installed`
|
|
9
|
-
* narrows the recipes to the ones the lockfile pins.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { Args } from "@oclif/core";
|
|
13
|
-
import { BaseCommand } from "../../base-command.js";
|
|
14
|
-
import { subscriptionServiceFor } from "../../lib/repos/subscription-service.js";
|
|
15
|
-
import { loadCatalogContext } from "../../lib/repos/catalog-inputs.js";
|
|
16
|
-
import { describeInstalled, describeNamespace } from "../../lib/repos/catalog.js";
|
|
17
|
-
import {
|
|
18
|
-
INDENT,
|
|
19
|
-
describeCoverage,
|
|
20
|
-
describeIndexSource,
|
|
21
|
-
factIf,
|
|
22
|
-
printBrowsingNotes,
|
|
23
|
-
printFacts,
|
|
24
|
-
recipeColumns,
|
|
25
|
-
recipeRows,
|
|
26
|
-
} from "../../lib/repos/catalog-display.js";
|
|
27
|
-
import { renderTable } from "../../utils/table.js";
|
|
28
|
-
import { browsingFlags } from "../../utils/flags.js";
|
|
29
|
-
import {
|
|
30
|
-
blankLine,
|
|
31
|
-
footer,
|
|
32
|
-
heading,
|
|
33
|
-
indent,
|
|
34
|
-
log,
|
|
35
|
-
paragraph,
|
|
36
|
-
showCommandVars,
|
|
37
|
-
subheading,
|
|
38
|
-
} from "../../utils/formatting.js";
|
|
39
|
-
|
|
40
|
-
export default class NamespaceShow extends BaseCommand {
|
|
41
|
-
static description = "Show one namespace and every recipe the repository publishes in it";
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The other spelling of the topic. It lives under a hidden topic, so it is
|
|
45
|
-
* typable everywhere without ever reaching the top-level listing.
|
|
46
|
-
*/
|
|
47
|
-
static aliases = ["namespaces:show"];
|
|
48
|
-
|
|
49
|
-
static examples = [
|
|
50
|
-
"<%= config.bin %> namespace show workflow",
|
|
51
|
-
"<%= config.bin %> namespace show sous-recipes:core",
|
|
52
|
-
];
|
|
53
|
-
|
|
54
|
-
static args = {
|
|
55
|
-
ref: Args.string({
|
|
56
|
-
description: "A namespace, optionally written as 'repository:namespace'",
|
|
57
|
-
required: true,
|
|
58
|
-
}),
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
static flags = { ...BaseCommand.baseFlags, ...browsingFlags() };
|
|
62
|
-
|
|
63
|
-
async run(): Promise<void> {
|
|
64
|
-
const { args, flags } = await this.parse(NamespaceShow);
|
|
65
|
-
|
|
66
|
-
showCommandVars({
|
|
67
|
-
Project: this.projectLabel,
|
|
68
|
-
Config: this.configContext.configPath,
|
|
69
|
-
Namespace: args.ref,
|
|
70
|
-
Reading: describeIndexSource(flags.latest),
|
|
71
|
-
...(flags.installed ? { Showing: "only what this project has installed" } : {}),
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const service = subscriptionServiceFor({
|
|
75
|
-
configContext: this.configContext,
|
|
76
|
-
settings: this.settings,
|
|
77
|
-
shellEnv: this.shellEnv,
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
const { inputs, notChecked } = await loadCatalogContext({
|
|
81
|
-
service,
|
|
82
|
-
sousDir: this.configContext.sousDir,
|
|
83
|
-
settings: this.settings,
|
|
84
|
-
latest: flags.latest,
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
const detail = flags.installed
|
|
88
|
-
? await describeInstalled(inputs, args.ref, describeNamespace, "namespace")
|
|
89
|
-
: await describeNamespace(inputs, args.ref);
|
|
90
|
-
|
|
91
|
-
heading(`The namespace ${detail.namespace}`);
|
|
92
|
-
blankLine();
|
|
93
|
-
|
|
94
|
-
printFacts([
|
|
95
|
-
{ label: "Repository", lines: [detail.repo] },
|
|
96
|
-
...factIf("Location", detail.repoUrl),
|
|
97
|
-
...factIf("About", detail.description),
|
|
98
|
-
{
|
|
99
|
-
label: flags.installed ? "Installed recipes" : "Recipes",
|
|
100
|
-
lines: [String(detail.recipes.length)],
|
|
101
|
-
},
|
|
102
|
-
{ label: "Subscribed", lines: [describeCoverage(detail.subscribed)] },
|
|
103
|
-
]);
|
|
104
|
-
|
|
105
|
-
blankLine();
|
|
106
|
-
subheading(`Recipes in ${detail.namespace}`);
|
|
107
|
-
blankLine();
|
|
108
|
-
|
|
109
|
-
if (detail.recipes.length === 0) {
|
|
110
|
-
paragraph(`The repository ${detail.repo} publishes no recipes in this namespace.`);
|
|
111
|
-
footer();
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
for (const line of renderTable(
|
|
116
|
-
recipeColumns({ installed: flags.installed }),
|
|
117
|
-
recipeRows(detail.recipes),
|
|
118
|
-
{ indent: INDENT }
|
|
119
|
-
)) {
|
|
120
|
-
log(indent(line, INDENT));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
printBrowsingNotes({
|
|
124
|
-
notChecked: notChecked.filter((name) => name === detail.repo),
|
|
125
|
-
anyLinked: detail.recipes.some((entry) => entry.linkedPath !== undefined),
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
footer();
|
|
129
|
-
}
|
|
130
|
-
}
|
package/src/commands/prune.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Flags } from "@oclif/core";
|
|
2
|
-
import { BaseCommand } from "../base-command.js";
|
|
3
|
-
import { runProjectBuild } from "../lib/build-service.js";
|
|
4
|
-
import { showCommandVars } from "../utils/formatting.js";
|
|
5
|
-
|
|
6
|
-
export default class Prune extends BaseCommand {
|
|
7
|
-
static description = "Remove output files that are no longer in the current config";
|
|
8
|
-
|
|
9
|
-
static examples = [
|
|
10
|
-
"<%= config.bin %> prune",
|
|
11
|
-
"<%= config.bin %> prune --dry-run",
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
static flags = {
|
|
15
|
-
...BaseCommand.baseFlags,
|
|
16
|
-
"dry-run": Flags.boolean({
|
|
17
|
-
description: "Print what would be pruned without deleting",
|
|
18
|
-
default: false,
|
|
19
|
-
}),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
async run(): Promise<void> {
|
|
23
|
-
const { flags } = await this.parse(Prune);
|
|
24
|
-
|
|
25
|
-
showCommandVars({
|
|
26
|
-
Project: this.projectLabel,
|
|
27
|
-
Config: this.configContext.configPath,
|
|
28
|
-
"Dry Run": flags["dry-run"],
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// Prune goes through the same build path as everything else, with the
|
|
32
|
-
// compile step switched off: what counts as current depends on the recipes
|
|
33
|
-
// the lockfile pins, so they are restored first, or a recipe missing from
|
|
34
|
-
// the store would have its outputs pruned as if it were gone.
|
|
35
|
-
await runProjectBuild({
|
|
36
|
-
settings: this.settings,
|
|
37
|
-
configContext: this.configContext,
|
|
38
|
-
shellEnv: this.shellEnv,
|
|
39
|
-
heading: "Pruning",
|
|
40
|
-
options: { noCompile: true, dryRun: flags["dry-run"] },
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `sous recipe list`.
|
|
3
|
-
*
|
|
4
|
-
* Shows every recipe the repositories this project trusts publish, with the
|
|
5
|
-
* latest published version, the version this project pins, and whether it is
|
|
6
|
-
* subscribed. By default it reads only the indexes sous already has on disk, so
|
|
7
|
-
* it works offline; a repository whose index has never been fetched is named at
|
|
8
|
-
* the end rather than being silently left out. `--latest` reads the indexes
|
|
9
|
-
* from upstream instead, without saving them, and `--installed` narrows the
|
|
10
|
-
* listing to what the lockfile pins.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { BaseCommand } from "../../base-command.js";
|
|
14
|
-
import { subscriptionServiceFor } from "../../lib/repos/subscription-service.js";
|
|
15
|
-
import { loadCatalogContext } from "../../lib/repos/catalog-inputs.js";
|
|
16
|
-
import { listRecipes, narrowToInstalled } from "../../lib/repos/catalog.js";
|
|
17
|
-
import {
|
|
18
|
-
INDENT,
|
|
19
|
-
describeIndexSource,
|
|
20
|
-
printBrowsingNotes,
|
|
21
|
-
recipeColumns,
|
|
22
|
-
recipeRows,
|
|
23
|
-
} from "../../lib/repos/catalog-display.js";
|
|
24
|
-
import { renderTable } from "../../utils/table.js";
|
|
25
|
-
import { browsingFlags } from "../../utils/flags.js";
|
|
26
|
-
import {
|
|
27
|
-
blankLine,
|
|
28
|
-
footer,
|
|
29
|
-
heading,
|
|
30
|
-
indent,
|
|
31
|
-
log,
|
|
32
|
-
paragraph,
|
|
33
|
-
showCommandVars,
|
|
34
|
-
} from "../../utils/formatting.js";
|
|
35
|
-
|
|
36
|
-
export default class RecipeList extends BaseCommand {
|
|
37
|
-
static description = "List the recipes the repositories this project trusts publish";
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* The other spelling of the topic. It lives under a hidden topic, so it is
|
|
41
|
-
* typable everywhere without ever reaching the top-level listing.
|
|
42
|
-
*/
|
|
43
|
-
static aliases = ["recipes:list"];
|
|
44
|
-
|
|
45
|
-
static examples = [
|
|
46
|
-
"<%= config.bin %> recipe list",
|
|
47
|
-
"<%= config.bin %> recipe list --installed --latest",
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
static flags = { ...BaseCommand.baseFlags, ...browsingFlags() };
|
|
51
|
-
|
|
52
|
-
async run(): Promise<void> {
|
|
53
|
-
const { flags } = await this.parse(RecipeList);
|
|
54
|
-
|
|
55
|
-
showCommandVars({
|
|
56
|
-
Project: this.projectLabel,
|
|
57
|
-
Config: this.configContext.configPath,
|
|
58
|
-
Reading: describeIndexSource(flags.latest),
|
|
59
|
-
...(flags.installed ? { Showing: "only what this project has installed" } : {}),
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
heading(
|
|
63
|
-
flags.installed
|
|
64
|
-
? "Recipes this project has installed"
|
|
65
|
-
: "Recipes in the repositories this project trusts"
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const service = subscriptionServiceFor({
|
|
69
|
-
configContext: this.configContext,
|
|
70
|
-
settings: this.settings,
|
|
71
|
-
shellEnv: this.shellEnv,
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const { inputs, notFetched, notChecked } = await loadCatalogContext({
|
|
75
|
-
service,
|
|
76
|
-
sousDir: this.configContext.sousDir,
|
|
77
|
-
settings: this.settings,
|
|
78
|
-
latest: flags.latest,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const listings = listRecipes(flags.installed ? narrowToInstalled(inputs) : inputs);
|
|
82
|
-
|
|
83
|
-
blankLine();
|
|
84
|
-
|
|
85
|
-
if (listings.length === 0) {
|
|
86
|
-
paragraph(
|
|
87
|
-
inputs.repos.length === 0
|
|
88
|
-
? "Sous has read no repository index for this project, so there are no " +
|
|
89
|
-
"recipes to show."
|
|
90
|
-
: flags.installed
|
|
91
|
-
? "This project has installed no recipe from the repositories it trusts."
|
|
92
|
-
: "The repositories this project trusts publish no recipes."
|
|
93
|
-
);
|
|
94
|
-
} else {
|
|
95
|
-
for (const line of renderTable(
|
|
96
|
-
recipeColumns({ installed: flags.installed }),
|
|
97
|
-
recipeRows(listings),
|
|
98
|
-
{ indent: INDENT }
|
|
99
|
-
)) {
|
|
100
|
-
log(indent(line, INDENT));
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
printBrowsingNotes({
|
|
105
|
-
notFetched,
|
|
106
|
-
notChecked,
|
|
107
|
-
anyLinked: listings.some((entry) => entry.linkedPath !== undefined),
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
footer();
|
|
111
|
-
}
|
|
112
|
-
}
|