@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
package/src/commands/init.ts
DELETED
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `sous init` sets a project up for sous.
|
|
3
|
-
*
|
|
4
|
-
* It writes the `.sous/` directory a project needs (a commented primary config,
|
|
5
|
-
* the starter prompt that config compiles, the two answers files and the
|
|
6
|
-
* sous-managed ignore block) and then runs the first build, which is what
|
|
7
|
-
* seeds the `core` recipe and pins it in the lockfile. A project that is
|
|
8
|
-
* already set up is left exactly as it is.
|
|
9
|
-
*
|
|
10
|
-
* This is the one command that runs BEFORE a project config exists, so it
|
|
11
|
-
* opts out of the config requirement every other command inherits. Discovery
|
|
12
|
-
* still runs, which is how `--sous-dir` and `SOUS_DIR` say where to write, and
|
|
13
|
-
* how a run inside an existing project is noticed.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import path from "node:path";
|
|
17
|
-
import { Args, Flags } from "@oclif/core";
|
|
18
|
-
import { confirm } from "@inquirer/prompts";
|
|
19
|
-
import { BaseCommand } from "../base-command.js";
|
|
20
|
-
import { runProjectBuild } from "../lib/build-service.js";
|
|
21
|
-
import {
|
|
22
|
-
CONFIG_FILE_NAMES,
|
|
23
|
-
SOUS_DIR_NAME,
|
|
24
|
-
discoverConfig,
|
|
25
|
-
expandHome,
|
|
26
|
-
resolveConfigFlag,
|
|
27
|
-
} from "../lib/config-discovery.js";
|
|
28
|
-
import { ConfigError } from "../lib/errors.js";
|
|
29
|
-
import { nonInteractiveError } from "../lib/interactive.js";
|
|
30
|
-
import {
|
|
31
|
-
PROJECT_CONFIG_FORMATS,
|
|
32
|
-
SOUS_PACKAGE_NAME,
|
|
33
|
-
STARTER_OUTPUT_NAME,
|
|
34
|
-
STARTER_PROMPT_RELATIVE_PATH,
|
|
35
|
-
scaffoldProject,
|
|
36
|
-
sousDirFor,
|
|
37
|
-
type PackageJsonOutcome,
|
|
38
|
-
type ProjectConfigFormat,
|
|
39
|
-
} from "../lib/project-scaffold/index.js";
|
|
40
|
-
import { SOUS_VERSION } from "../lib/settings.js";
|
|
41
|
-
import { confirmationFlag } from "../utils/flags.js";
|
|
42
|
-
import {
|
|
43
|
-
blankLine,
|
|
44
|
-
dryRunNotice,
|
|
45
|
-
footer,
|
|
46
|
-
log,
|
|
47
|
-
paragraph,
|
|
48
|
-
section,
|
|
49
|
-
showCommandVars,
|
|
50
|
-
showVariables,
|
|
51
|
-
warning,
|
|
52
|
-
type VariableEntry,
|
|
53
|
-
} from "../utils/formatting.js";
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* The "Dependency" row of the summary: where sous now sits in the project's
|
|
57
|
-
* package.json, or nothing when the project has no package.json.
|
|
58
|
-
*/
|
|
59
|
-
function dependencyRow(outcome: PackageJsonOutcome): VariableEntry[] {
|
|
60
|
-
if (outcome.kind === "absent") return [];
|
|
61
|
-
const value = `${SOUS_PACKAGE_NAME} ${outcome.range}`;
|
|
62
|
-
if (outcome.kind === "present") {
|
|
63
|
-
return [{ label: "Dependency", value, detail: `already in ${outcome.section} in package.json` }];
|
|
64
|
-
}
|
|
65
|
-
return [
|
|
66
|
-
{
|
|
67
|
-
label: "Dependency",
|
|
68
|
-
value,
|
|
69
|
-
detail: "added to devDependencies in package.json; run your package manager's install to fetch it",
|
|
70
|
-
},
|
|
71
|
-
];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export default class Init extends BaseCommand {
|
|
75
|
-
static description =
|
|
76
|
-
"Set a project up for sous: write its .sous/ directory, then run the first build";
|
|
77
|
-
|
|
78
|
-
/** This command creates the config; finding none is its normal case. */
|
|
79
|
-
static override requiresConfig = false;
|
|
80
|
-
|
|
81
|
-
static examples = [
|
|
82
|
-
"<%= config.bin %> init",
|
|
83
|
-
"<%= config.bin %> init ./my-project",
|
|
84
|
-
"<%= config.bin %> init --format json",
|
|
85
|
-
"<%= config.bin %> init --name 'My Project' --no-build",
|
|
86
|
-
"<%= config.bin %> init --dry-run",
|
|
87
|
-
];
|
|
88
|
-
|
|
89
|
-
static args = {
|
|
90
|
-
directory: Args.string({
|
|
91
|
-
description: "Project directory to set up (defaults to the current one)",
|
|
92
|
-
required: false,
|
|
93
|
-
}),
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
static flags = {
|
|
97
|
-
...BaseCommand.baseFlags,
|
|
98
|
-
format: Flags.string({
|
|
99
|
-
description: "Format of the primary config to write",
|
|
100
|
-
options: [...PROJECT_CONFIG_FORMATS],
|
|
101
|
-
default: PROJECT_CONFIG_FORMATS[0],
|
|
102
|
-
}),
|
|
103
|
-
name: Flags.string({
|
|
104
|
-
description: "Display name for the project (defaults to the directory's own name)",
|
|
105
|
-
}),
|
|
106
|
-
// The one question this command can ask: whether to set up a project
|
|
107
|
-
// inside another one.
|
|
108
|
-
yes: confirmationFlag(),
|
|
109
|
-
"dry-run": Flags.boolean({
|
|
110
|
-
description: "Print the files that would be written without writing them",
|
|
111
|
-
default: false,
|
|
112
|
-
}),
|
|
113
|
-
"no-build": Flags.boolean({
|
|
114
|
-
description: "Write the setup without running the first build",
|
|
115
|
-
default: false,
|
|
116
|
-
}),
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
async run(): Promise<void> {
|
|
120
|
-
const { args, flags } = await this.parse(Init);
|
|
121
|
-
const dryRun = flags["dry-run"];
|
|
122
|
-
const format = flags.format as ProjectConfigFormat;
|
|
123
|
-
|
|
124
|
-
const sousDir = this.targetSousDir(args.directory);
|
|
125
|
-
const projectRoot = path.dirname(sousDir);
|
|
126
|
-
|
|
127
|
-
showCommandVars({
|
|
128
|
-
Directory: projectRoot,
|
|
129
|
-
Config: path.join(sousDir, `sous.config.${format}`),
|
|
130
|
-
Name: flags.name ?? "(from the directory name)",
|
|
131
|
-
"Dry Run": dryRun,
|
|
132
|
-
Build: !dryRun && !flags["no-build"],
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
await this.confirmNesting(projectRoot, flags.yes);
|
|
136
|
-
|
|
137
|
-
section("Setting up the project");
|
|
138
|
-
|
|
139
|
-
const result = await scaffoldProject({
|
|
140
|
-
sousDir,
|
|
141
|
-
format,
|
|
142
|
-
name: flags.name,
|
|
143
|
-
dryRun,
|
|
144
|
-
sousVersion: SOUS_VERSION,
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
for (const file of result.files) {
|
|
148
|
-
if (result.dryRun) dryRunNotice(`would write ${file}`);
|
|
149
|
-
else log(` wrote ${file}`);
|
|
150
|
-
}
|
|
151
|
-
if (result.packageJson.kind === "added") {
|
|
152
|
-
const what = `${SOUS_PACKAGE_NAME} ${result.packageJson.range} to devDependencies in package.json`;
|
|
153
|
-
if (result.dryRun) dryRunNotice(`would add ${what}`);
|
|
154
|
-
else log(` added ${what}`);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (result.dryRun) {
|
|
158
|
-
blankLine();
|
|
159
|
-
dryRunNotice("Nothing was written. Run the same command without '--dry-run' to set the project up.");
|
|
160
|
-
footer();
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (!flags["no-build"]) {
|
|
165
|
-
await this.buildProject(result.configPath);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
section("What was set up");
|
|
169
|
-
showVariables([
|
|
170
|
-
{ label: "Config", value: result.configPath },
|
|
171
|
-
{ label: "Prompt source", value: path.join(sousDir, STARTER_PROMPT_RELATIVE_PATH) },
|
|
172
|
-
{ label: "Compiled to", value: path.join(projectRoot, STARTER_OUTPUT_NAME) },
|
|
173
|
-
{ label: "Skills", value: path.join(projectRoot, ".claude", "skills") },
|
|
174
|
-
...dependencyRow(result.packageJson),
|
|
175
|
-
{ label: "Shared answers", value: path.join(sousDir, ".env"), detail: "committed" },
|
|
176
|
-
{
|
|
177
|
-
label: "Local answers",
|
|
178
|
-
value: path.join(sousDir, ".env.local"),
|
|
179
|
-
detail: "gitignored; .env.local.example shows the layout",
|
|
180
|
-
},
|
|
181
|
-
]);
|
|
182
|
-
|
|
183
|
-
blankLine();
|
|
184
|
-
paragraph(
|
|
185
|
-
` ${STARTER_OUTPUT_NAME} and the skills directory are build output, compiled from the ` +
|
|
186
|
-
`prompt source and from the recipes this project subscribes to; a build recompiles ` +
|
|
187
|
-
`them. The config explains each of its blocks in its own comments.`
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
footer();
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Where the `.sous/` directory goes. A directory argument wins; otherwise the
|
|
195
|
-
* config-locating flags say where the project is, and otherwise it is the
|
|
196
|
-
* working directory. A path that already names a `.sous/` directory, or a
|
|
197
|
-
* config file inside one, is honored as such.
|
|
198
|
-
*/
|
|
199
|
-
private targetSousDir(directory: string | undefined): string {
|
|
200
|
-
if (directory !== undefined) {
|
|
201
|
-
return sousDirFor(path.resolve(this.configLocator.cwd, expandHome(directory)));
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const primary = this.configLocator.primary;
|
|
205
|
-
if (primary === undefined) return sousDirFor(this.configLocator.cwd);
|
|
206
|
-
|
|
207
|
-
const value = primary.value;
|
|
208
|
-
if (path.basename(value) === SOUS_DIR_NAME) return value;
|
|
209
|
-
if ((CONFIG_FILE_NAMES as readonly string[]).includes(path.basename(value))) {
|
|
210
|
-
return path.dirname(value);
|
|
211
|
-
}
|
|
212
|
-
return sousDirFor(value);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* A project set up inside another one is a real choice, not a mistake sous
|
|
217
|
-
* should prevent: a subproject may want its own instructions. So when a walk
|
|
218
|
-
* up from the target finds a config in a parent directory, the facts are
|
|
219
|
-
* stated and the question is asked once; `--yes` answers it ahead of time,
|
|
220
|
-
* and a run with no terminal fails naming that flag.
|
|
221
|
-
*
|
|
222
|
-
* The target's own `.sous/` holding a config is a different case, refused
|
|
223
|
-
* outright by the scaffold.
|
|
224
|
-
*/
|
|
225
|
-
private async confirmNesting(projectRoot: string, confirmed: boolean): Promise<void> {
|
|
226
|
-
const enclosing = discoverConfig(projectRoot);
|
|
227
|
-
if (enclosing === null || path.dirname(enclosing.sousDir) === projectRoot) return;
|
|
228
|
-
|
|
229
|
-
const enclosingRoot = path.dirname(enclosing.sousDir);
|
|
230
|
-
|
|
231
|
-
warning(
|
|
232
|
-
`${projectRoot} is inside a project that is already set up for sous.\n` +
|
|
233
|
-
` The enclosing project's config is ${enclosing.configPath}.\n` +
|
|
234
|
-
` Setting this directory up too gives it a config of its own: commands run ` +
|
|
235
|
-
`here will find this one, and commands run from ${enclosingRoot} will keep ` +
|
|
236
|
-
`finding the other.`
|
|
237
|
-
);
|
|
238
|
-
|
|
239
|
-
if (confirmed) return;
|
|
240
|
-
|
|
241
|
-
if (!this.interactive) {
|
|
242
|
-
throw nonInteractiveError({
|
|
243
|
-
prompt: `whether to set up ${projectRoot} inside the project at ${enclosingRoot}`,
|
|
244
|
-
remedy: "pass --yes (also -y, --force) to set it up anyway",
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
blankLine();
|
|
249
|
-
const proceed = await confirm({
|
|
250
|
-
message: `Set up ${projectRoot} as a project of its own?`,
|
|
251
|
-
default: false,
|
|
252
|
-
});
|
|
253
|
-
if (!proceed) {
|
|
254
|
-
throw new ConfigError(
|
|
255
|
-
`Nothing was written. Run 'sous init' from a directory outside ${enclosingRoot}, ` +
|
|
256
|
-
`or pass --yes to set this one up anyway.`
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Adopts the config just written and builds the project with it, through
|
|
263
|
-
* the same build `sous build` runs: the repositories are prepared (which
|
|
264
|
-
* seeds the core recipe into the store and pins it in the lockfile), then
|
|
265
|
-
* the outputs are compiled.
|
|
266
|
-
*
|
|
267
|
-
* @param configPath - The primary config the scaffold wrote.
|
|
268
|
-
*/
|
|
269
|
-
private async buildProject(configPath: string): Promise<void> {
|
|
270
|
-
await this.adoptConfig(
|
|
271
|
-
resolveConfigFlag(configPath, this.configLocator.cwd, this.configLocator.confDirOverride)
|
|
272
|
-
);
|
|
273
|
-
|
|
274
|
-
const succeeded = await runProjectBuild({
|
|
275
|
-
settings: this.settings,
|
|
276
|
-
configContext: this.configContext,
|
|
277
|
-
shellEnv: this.shellEnv,
|
|
278
|
-
heading: "Building the project",
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
if (!succeeded) {
|
|
282
|
-
throw new ConfigError(
|
|
283
|
-
`The project is set up, but the first build failed, so its outputs may be ` +
|
|
284
|
-
`incomplete. Everything 'sous init' wrote is in place; fix what the build ` +
|
|
285
|
-
`reported above and run 'sous build' again.`
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
package/src/commands/launch.ts
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from "@oclif/core";
|
|
2
|
-
import { spawnSync } from "node:child_process";
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
import { BaseCommand } from "../base-command.js";
|
|
5
|
-
import { runProjectBuild } from "../lib/build-service.js";
|
|
6
|
-
import { ConfigError } from "../lib/errors.js";
|
|
7
|
-
import { resolveRootScope, resolveTools } from "../lib/settings.js";
|
|
8
|
-
import { displayError, footer, heading, showCommandVars } from "../utils/formatting.js";
|
|
9
|
-
|
|
10
|
-
export default class Launch extends BaseCommand {
|
|
11
|
-
static description =
|
|
12
|
-
"Build this project's outputs, then start a coding agent configured in its config";
|
|
13
|
-
|
|
14
|
-
static examples = [
|
|
15
|
-
"<%= config.bin %> launch claude",
|
|
16
|
-
"<%= config.bin %> launch codex --no-build",
|
|
17
|
-
"<%= config.bin %> launch claude --continuous",
|
|
18
|
-
"<%= config.bin %> launch claude --resume",
|
|
19
|
-
"<%= config.bin %> launch claude -- -c",
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
static args = {
|
|
23
|
-
tool: Args.string({
|
|
24
|
-
description: "Tool to launch (e.g. claude, codex)",
|
|
25
|
-
required: true,
|
|
26
|
-
}),
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
static flags = {
|
|
30
|
-
...BaseCommand.baseFlags,
|
|
31
|
-
"no-build": Flags.boolean({
|
|
32
|
-
description: "Skip sous build before launching",
|
|
33
|
-
default: false,
|
|
34
|
-
}),
|
|
35
|
-
continuous: Flags.boolean({
|
|
36
|
-
description: "Restart the agent automatically on exit",
|
|
37
|
-
default: false,
|
|
38
|
-
}),
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// Any argument launch does not recognize is forwarded to the tool, after the
|
|
42
|
-
// config-defined tool args. Flags that collide with sous's own (e.g. claude's
|
|
43
|
-
// -c / --continue vs sous's -c / --config) can be forced through with `--`:
|
|
44
|
-
// everything after it is forwarded verbatim.
|
|
45
|
-
//
|
|
46
|
-
// strict=false lets extra positionals through; "--"=false is what routes
|
|
47
|
-
// unknown flags into argv instead of a NonExistentFlagsError (oclif rejects
|
|
48
|
-
// them even in non-strict mode otherwise). Disabling oclif's `--` handling
|
|
49
|
-
// means it would keep parsing sous flags past the separator, so run() splits
|
|
50
|
-
// argv at the first `--` itself, before oclif ever sees the tail.
|
|
51
|
-
static strict = false;
|
|
52
|
-
static "--" = false;
|
|
53
|
-
|
|
54
|
-
async run(): Promise<void> {
|
|
55
|
-
const sepIndex = this.argv.indexOf("--");
|
|
56
|
-
const ownArgv = sepIndex === -1 ? this.argv : this.argv.slice(0, sepIndex);
|
|
57
|
-
const verbatimArgs = sepIndex === -1 ? [] : this.argv.slice(sepIndex + 1);
|
|
58
|
-
|
|
59
|
-
const { args, argv, flags } = await this.parse(Launch, ownArgv);
|
|
60
|
-
|
|
61
|
-
// argv holds every token oclif did not claim, in original order; the first
|
|
62
|
-
// is the tool name itself.
|
|
63
|
-
const passThroughArgs = [...argv.slice(1).map(String), ...verbatimArgs];
|
|
64
|
-
|
|
65
|
-
const rootScope = resolveRootScope(this.settings, this.configContext);
|
|
66
|
-
const tools = resolveTools(this.settings, rootScope);
|
|
67
|
-
const toolConfig = tools[args.tool];
|
|
68
|
-
|
|
69
|
-
if (!toolConfig) {
|
|
70
|
-
displayError(
|
|
71
|
-
`Tool '${args.tool}' not found in ${this.configContext.configPath}. ` +
|
|
72
|
-
`Available tools: ${Object.keys(tools).join(", ") || "(none)"}`
|
|
73
|
-
);
|
|
74
|
-
this.exit(1);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const projectRoot = rootScope.projectRoot ?? process.cwd();
|
|
78
|
-
|
|
79
|
-
showCommandVars({
|
|
80
|
-
Project: this.projectLabel,
|
|
81
|
-
Config: this.configContext.configPath,
|
|
82
|
-
Tool: args.tool,
|
|
83
|
-
"Project Root": projectRoot,
|
|
84
|
-
"No Build": flags["no-build"],
|
|
85
|
-
Continuous: flags.continuous,
|
|
86
|
-
...(passThroughArgs.length > 0 && { "Tool Args": passThroughArgs.join(" ") }),
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
do {
|
|
90
|
-
// Build step (unless --no-build). A failed build stops here: the agent
|
|
91
|
-
// would otherwise start on outputs the build could not bring up to date.
|
|
92
|
-
if (!flags["no-build"]) {
|
|
93
|
-
const built = await runProjectBuild({
|
|
94
|
-
settings: this.settings,
|
|
95
|
-
configContext: this.configContext,
|
|
96
|
-
shellEnv: this.shellEnv,
|
|
97
|
-
});
|
|
98
|
-
if (!built) {
|
|
99
|
-
throw new ConfigError(
|
|
100
|
-
`The build failed, so ${args.tool} was not started. Fix the errors listed ` +
|
|
101
|
-
`above, or pass --no-build to start it with the outputs as they are.`
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Config-defined args first, then pass-through, then promptFile content
|
|
107
|
-
const launchArgs = [...(toolConfig.args ?? []), ...passThroughArgs];
|
|
108
|
-
if (toolConfig.promptFile) {
|
|
109
|
-
if (!fs.existsSync(toolConfig.promptFile)) {
|
|
110
|
-
displayError(`promptFile not found: ${toolConfig.promptFile}`);
|
|
111
|
-
this.exit(1);
|
|
112
|
-
}
|
|
113
|
-
const promptContent = fs.readFileSync(toolConfig.promptFile, "utf8");
|
|
114
|
-
launchArgs.push(promptContent);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
heading(`Launching ${args.tool}`);
|
|
118
|
-
|
|
119
|
-
// Run the tool with inherited stdio (interactive)
|
|
120
|
-
const result = spawnSync(toolConfig.command, launchArgs, {
|
|
121
|
-
cwd: projectRoot,
|
|
122
|
-
stdio: "inherit",
|
|
123
|
-
shell: false,
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
if (result.error) {
|
|
127
|
-
displayError(`Failed to launch '${args.tool}': ${result.error.message}`);
|
|
128
|
-
this.exit(1);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (flags.continuous) {
|
|
132
|
-
// Small delay to avoid tight spin on immediate crash
|
|
133
|
-
await new Promise(resolve => setTimeout(resolve, 150));
|
|
134
|
-
}
|
|
135
|
-
} while (flags.continuous);
|
|
136
|
-
|
|
137
|
-
footer();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `sous lock rebuild`.
|
|
3
|
-
*
|
|
4
|
-
* Recomputes the lockfile from scratch: every subscription this project
|
|
5
|
-
* declares is resolved against the cached repository indexes, the whole
|
|
6
|
-
* dependency closure beneath them is walked, and the result replaces the
|
|
7
|
-
* lockfile outright. An entry nothing holds any more is dropped, which is what
|
|
8
|
-
* makes this the repair for a lockfile that has drifted from the config: a
|
|
9
|
-
* hand-edited file, a bad merge, or a subscription removed from the config by
|
|
10
|
-
* hand rather than with `sous subscription remove`.
|
|
11
|
-
*
|
|
12
|
-
* It is an edge-case utility, so it is deliberately blunt. It never asks a
|
|
13
|
-
* question and never grants trust: a subscription whose repository this project
|
|
14
|
-
* has not added is an error naming the repository. It downloads nothing; a
|
|
15
|
-
* repository whose index has not been fetched is named, and nothing in it can
|
|
16
|
-
* be resolved.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { Flags } from "@oclif/core";
|
|
20
|
-
import { BaseCommand } from "../../base-command.js";
|
|
21
|
-
import { ConfigError } from "../../lib/errors.js";
|
|
22
|
-
import { subscriptionServiceFor } from "../../lib/repos/subscription-service.js";
|
|
23
|
-
import { recipeFilesDirectory } from "../../lib/repos/catalog-inputs.js";
|
|
24
|
-
import { readRecipeManifestIn } from "../../lib/repos/locked-recipes.js";
|
|
25
|
-
import { createEmptyLockfile } from "../../lib/repos/formats/lockfile.js";
|
|
26
|
-
import type { LockRepoInput } from "../../lib/repos/lock-service.js";
|
|
27
|
-
import { RefSource, parseNamedRef } from "../../services/ref-resolver/index.js";
|
|
28
|
-
import {
|
|
29
|
-
PROJECT_REQUESTER,
|
|
30
|
-
resolveRefs,
|
|
31
|
-
type RefRequest,
|
|
32
|
-
type ResolverRepo,
|
|
33
|
-
} from "../../lib/repos/resolver.js";
|
|
34
|
-
import type { IndexFile } from "../../lib/repos/formats/index-file.js";
|
|
35
|
-
import {
|
|
36
|
-
blankLine,
|
|
37
|
-
dryRunNotice,
|
|
38
|
-
footer,
|
|
39
|
-
heading,
|
|
40
|
-
indent,
|
|
41
|
-
log,
|
|
42
|
-
paragraph,
|
|
43
|
-
showCommandVars,
|
|
44
|
-
} from "../../utils/formatting.js";
|
|
45
|
-
|
|
46
|
-
/** How far every line of this command's output is indented. */
|
|
47
|
-
const INDENT = 2;
|
|
48
|
-
|
|
49
|
-
export default class LockRebuild extends BaseCommand {
|
|
50
|
-
static description =
|
|
51
|
-
"Rebuild this project's lockfile from its subscriptions and the cached repository indexes";
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* The other spelling of the topic. It lives under a hidden topic, so it is
|
|
55
|
-
* typable everywhere without ever reaching the top-level listing.
|
|
56
|
-
*/
|
|
57
|
-
static aliases = ["locks:rebuild"];
|
|
58
|
-
|
|
59
|
-
static examples = [
|
|
60
|
-
"<%= config.bin %> lock rebuild",
|
|
61
|
-
"<%= config.bin %> lock rebuild --dry-run",
|
|
62
|
-
];
|
|
63
|
-
|
|
64
|
-
static flags = {
|
|
65
|
-
...BaseCommand.baseFlags,
|
|
66
|
-
"dry-run": Flags.boolean({
|
|
67
|
-
description: "Print what would change without writing the lockfile",
|
|
68
|
-
default: false,
|
|
69
|
-
}),
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
async run(): Promise<void> {
|
|
73
|
-
const { flags } = await this.parse(LockRebuild);
|
|
74
|
-
const dryRun = flags["dry-run"];
|
|
75
|
-
|
|
76
|
-
showCommandVars({
|
|
77
|
-
Project: this.projectLabel,
|
|
78
|
-
Config: this.configContext.configPath,
|
|
79
|
-
"Dry Run": dryRun,
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
heading("Rebuilding the lockfile");
|
|
83
|
-
|
|
84
|
-
const service = subscriptionServiceFor({
|
|
85
|
-
configContext: this.configContext,
|
|
86
|
-
settings: this.settings,
|
|
87
|
-
shellEnv: this.shellEnv,
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const sousDir = this.configContext.sousDir;
|
|
91
|
-
const trusted = service.currentRepos();
|
|
92
|
-
|
|
93
|
-
const repos: Record<string, ResolverRepo> = {};
|
|
94
|
-
const lockRepos: Record<string, LockRepoInput> = {};
|
|
95
|
-
const indexes = new Map<string, IndexFile>();
|
|
96
|
-
const notFetched: string[] = [];
|
|
97
|
-
|
|
98
|
-
const before = service.lockService.read();
|
|
99
|
-
|
|
100
|
-
for (const name of Object.keys(trusted).sort()) {
|
|
101
|
-
const entry = trusted[name]!;
|
|
102
|
-
const identity = service.identityForRepo(name);
|
|
103
|
-
if (identity === undefined) continue;
|
|
104
|
-
|
|
105
|
-
repos[name] = {
|
|
106
|
-
url: entry.url,
|
|
107
|
-
identity,
|
|
108
|
-
...(entry.provider === undefined ? {} : { provider: entry.provider }),
|
|
109
|
-
...(entry.alwaysPull === undefined ? {} : { alwaysPull: entry.alwaysPull }),
|
|
110
|
-
};
|
|
111
|
-
lockRepos[name] = {
|
|
112
|
-
url: entry.url,
|
|
113
|
-
identity,
|
|
114
|
-
...(entry.provider === undefined ? {} : { provider: entry.provider }),
|
|
115
|
-
// The index a resolution was made against is recorded per repository.
|
|
116
|
-
// A rebuild resolves against the same cached index the last one did, so
|
|
117
|
-
// whatever the lockfile already recorded still holds.
|
|
118
|
-
...(before.repos[name]?.indexHash === undefined
|
|
119
|
-
? {}
|
|
120
|
-
: { indexHash: before.repos[name]!.indexHash! }),
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const index = service.cachedIndex(name);
|
|
124
|
-
if (index === undefined) {
|
|
125
|
-
notFetched.push(name);
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
indexes.set(name, index);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const subscriptions = service.allSubscriptions();
|
|
132
|
-
const requests: RefRequest[] = Object.keys(subscriptions)
|
|
133
|
-
.sort()
|
|
134
|
-
.map((key) => {
|
|
135
|
-
const entry = subscriptions[key]!;
|
|
136
|
-
return {
|
|
137
|
-
ref: parseNamedRef(key, RefSource.Config),
|
|
138
|
-
...(entry.range === undefined ? {} : { range: entry.range }),
|
|
139
|
-
requestedBy: PROJECT_REQUESTER,
|
|
140
|
-
kind: "subscribes" as const,
|
|
141
|
-
...(entry.prerelease === true ? { prerelease: true } : {}),
|
|
142
|
-
};
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
const result = await resolveRefs(requests, {
|
|
146
|
-
indexes,
|
|
147
|
-
repos,
|
|
148
|
-
// A recipe's own manifest is what names its dependencies, and it is read
|
|
149
|
-
// from the files this machine already holds. Nothing is fetched here, so a
|
|
150
|
-
// recipe that is not in the store yet is walked from what its index entry
|
|
151
|
-
// records, and comes back under `missingManifests` when that is nothing.
|
|
152
|
-
loadManifest: (recipe) => {
|
|
153
|
-
const directory = recipeFilesDirectory({
|
|
154
|
-
service,
|
|
155
|
-
sousDir,
|
|
156
|
-
repo: recipe.repo,
|
|
157
|
-
key: recipe.key,
|
|
158
|
-
namespace: recipe.namespace,
|
|
159
|
-
name: recipe.name,
|
|
160
|
-
version: recipe.version,
|
|
161
|
-
});
|
|
162
|
-
return directory === undefined ? undefined : readRecipeManifestIn(directory);
|
|
163
|
-
},
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
if (result.missingRepos.length > 0) {
|
|
167
|
-
throw new ConfigError(
|
|
168
|
-
`This project's subscriptions need ${
|
|
169
|
-
result.missingRepos.length === 1 ? "a repository" : "repositories"
|
|
170
|
-
} it does not trust, so the lockfile cannot be rebuilt:\n` +
|
|
171
|
-
result.missingRepos
|
|
172
|
-
.map(
|
|
173
|
-
(missing) =>
|
|
174
|
-
` ${missing.name}${missing.url === undefined ? "" : ` (${missing.url})`}, ` +
|
|
175
|
-
`needed by ${missing.requiredBy.map((entry) => entry.ref).join(", ")}`
|
|
176
|
-
)
|
|
177
|
-
.join("\n") +
|
|
178
|
-
`\n Add ${
|
|
179
|
-
result.missingRepos.length === 1 ? "it" : "them"
|
|
180
|
-
} with 'sous repo add <url>', which is how a repository is trusted, then run ` +
|
|
181
|
-
`this command again.`
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// The rebuild starts from an empty lockfile rather than the one on disk, so
|
|
186
|
-
// an entry nothing in the resolution holds any more is gone rather than
|
|
187
|
-
// carried through.
|
|
188
|
-
const after = service.lockService.applyResolution(
|
|
189
|
-
createEmptyLockfile(),
|
|
190
|
-
result.resolved,
|
|
191
|
-
lockRepos
|
|
192
|
-
);
|
|
193
|
-
const diff = service.lockService.diff(before, after);
|
|
194
|
-
|
|
195
|
-
blankLine();
|
|
196
|
-
for (const line of diff.lines) log(indent(line, INDENT));
|
|
197
|
-
|
|
198
|
-
if (notFetched.length > 0) {
|
|
199
|
-
blankLine();
|
|
200
|
-
paragraph(
|
|
201
|
-
`These repositories are trusted and their index has not been fetched yet, so ` +
|
|
202
|
-
`nothing in them could be resolved: ${notFetched.join(", ")}.`
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (result.missingManifests.length > 0) {
|
|
207
|
-
blankLine();
|
|
208
|
-
paragraph(
|
|
209
|
-
`The files of these recipes are not on this machine, and their repository's ` +
|
|
210
|
-
`index does not record what they depend on, so their own dependencies are ` +
|
|
211
|
-
`not in the rebuilt lockfile: ${result.missingManifests.join(", ")}.`
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
for (const cycle of result.cycles) {
|
|
216
|
-
blankLine();
|
|
217
|
-
paragraph(`These recipes depend on each other in a circle: ${cycle.join(" -> ")}.`);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
blankLine();
|
|
221
|
-
|
|
222
|
-
if (dryRun) {
|
|
223
|
-
dryRunNotice(`Nothing was written. The lockfile is ${service.lockService.filePath}.`);
|
|
224
|
-
footer();
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
const written = service.lockService.write(after);
|
|
229
|
-
paragraph(
|
|
230
|
-
`The lockfile was rebuilt from ${requests.length} ${
|
|
231
|
-
requests.length === 1 ? "subscription" : "subscriptions"
|
|
232
|
-
} and now pins ${Object.keys(after.recipes).length} ${
|
|
233
|
-
Object.keys(after.recipes).length === 1 ? "recipe" : "recipes"
|
|
234
|
-
}: ${written}.`
|
|
235
|
-
);
|
|
236
|
-
|
|
237
|
-
footer();
|
|
238
|
-
}
|
|
239
|
-
}
|