@osdlc/repo-cleaner 0.9.2 → 0.10.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/CHANGELOG.md +38 -0
- package/README.md +75 -62
- package/dist/apply.d.ts +24 -7
- package/dist/apply.js +44 -13
- package/dist/branches.d.ts +2 -2
- package/dist/branches.js +24 -8
- package/dist/cli.d.ts +26 -7
- package/dist/cli.js +423 -183
- package/dist/devlink.d.ts +5 -0
- package/dist/devlink.js +3 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +1 -2
- package/dist/plan.d.ts +7 -3
- package/dist/plan.js +24 -11
- package/dist/receipt.d.ts +2 -0
- package/dist/receipt.js +1 -1
- package/dist/render.d.ts +9 -0
- package/dist/render.js +63 -0
- package/dist/status-line.d.ts +24 -0
- package/dist/status-line.js +54 -0
- package/dist/sweep.d.ts +8 -1
- package/dist/sweep.js +17 -4
- package/dist/types.d.ts +15 -0
- package/dist/types.js +3 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/worktrees.d.ts +1 -1
- package/dist/worktrees.js +18 -4
- package/package.json +4 -4
- package/dist/config.d.ts +0 -53
- package/dist/config.js +0 -67
package/dist/config.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The standalone tool's own configuration file.
|
|
3
|
-
*
|
|
4
|
-
* Only the CLI reads it. The library takes repositories as an argument, so a
|
|
5
|
-
* host that already knows where its repositories are passes them in and never touches this file.
|
|
6
|
-
*
|
|
7
|
-
* Shape, location and loading are `@osdlc/config-layers`'s machine file:
|
|
8
|
-
* `<config-home>/repo-cleaner/config.yaml` over `@osdlc/tiered-dirs`'
|
|
9
|
-
* standalone tier, Zod as the single source of truth, never throws, degrades
|
|
10
|
-
* to the defaults, memoised. Standalone, not suite or vendor, because a
|
|
11
|
-
* general tool must not write a company namespace onto someone else's
|
|
12
|
-
* machine.
|
|
13
|
-
*/
|
|
14
|
-
import { z } from 'zod';
|
|
15
|
-
/** The tool's name, and so its config directory segment. */
|
|
16
|
-
export declare const TOOL = "repo-cleaner";
|
|
17
|
-
/** Env var that relocates the config file, for tests and one-off runs. */
|
|
18
|
-
export declare const CONFIG_ENV = "REPO_CLEANER_MACHINE_CONFIG";
|
|
19
|
-
export declare const RepoCleanerConfigSchema: z.ZodObject<{
|
|
20
|
-
paths: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
21
|
-
repos: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
22
|
-
}, z.core.$strict>;
|
|
23
|
-
export type RepoCleanerConfig = z.infer<typeof RepoCleanerConfigSchema>;
|
|
24
|
-
/**
|
|
25
|
-
* Whose directories the config file, plans and receipts live under: vendor
|
|
26
|
-
* `repo-cleaner`, moved by the `REPO_CLEANER_*` override variables.
|
|
27
|
-
*/
|
|
28
|
-
export declare const VENDOR_DIRS: {
|
|
29
|
-
vendor: string;
|
|
30
|
-
envVars: import("@osdlc/tiered-dirs").EnvVars;
|
|
31
|
-
};
|
|
32
|
-
export declare const DEFAULT_CONFIG: RepoCleanerConfig;
|
|
33
|
-
/** `<config-home>/repo-cleaner/config.yaml`, unless {@link CONFIG_ENV} says otherwise. */
|
|
34
|
-
export declare const configPath: () => string;
|
|
35
|
-
/**
|
|
36
|
-
* The config, defaults filled.
|
|
37
|
-
*
|
|
38
|
-
* Never throws. A missing file, unreadable file, malformed YAML or wrong
|
|
39
|
-
* shape all degrade to the defaults: a person running the tool in a
|
|
40
|
-
* repository should not be stopped by a config file they never wrote.
|
|
41
|
-
*/
|
|
42
|
-
export declare const loadConfig: () => RepoCleanerConfig;
|
|
43
|
-
/** Drop the memoised value. Call from tests between runs. */
|
|
44
|
-
export declare const clearConfigCache: () => void;
|
|
45
|
-
/**
|
|
46
|
-
* The configured entries with their `{name}` path names substituted against
|
|
47
|
-
* `paths:`, relative entries resolved against `baseDir`.
|
|
48
|
-
*
|
|
49
|
-
* A name nothing defines is an error rather than an empty string — a
|
|
50
|
-
* `repos:` entry that quietly becomes `/dev` would sweep whatever happens to
|
|
51
|
-
* be there.
|
|
52
|
-
*/
|
|
53
|
-
export declare function configuredRepos(config?: RepoCleanerConfig, baseDir?: string): string[];
|
package/dist/config.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The standalone tool's own configuration file.
|
|
3
|
-
*
|
|
4
|
-
* Only the CLI reads it. The library takes repositories as an argument, so a
|
|
5
|
-
* host that already knows where its repositories are passes them in and never touches this file.
|
|
6
|
-
*
|
|
7
|
-
* Shape, location and loading are `@osdlc/config-layers`'s machine file:
|
|
8
|
-
* `<config-home>/repo-cleaner/config.yaml` over `@osdlc/tiered-dirs`'
|
|
9
|
-
* standalone tier, Zod as the single source of truth, never throws, degrades
|
|
10
|
-
* to the defaults, memoised. Standalone, not suite or vendor, because a
|
|
11
|
-
* general tool must not write a company namespace onto someone else's
|
|
12
|
-
* machine.
|
|
13
|
-
*/
|
|
14
|
-
import { envVars } from '@osdlc/cli-tool';
|
|
15
|
-
import { machineConfigFile, pathNames, pathsSchema, substitutePathNames, } from '@osdlc/config-layers';
|
|
16
|
-
import { z } from 'zod';
|
|
17
|
-
/** The tool's name, and so its config directory segment. */
|
|
18
|
-
export const TOOL = 'repo-cleaner';
|
|
19
|
-
/** Env var that relocates the config file, for tests and one-off runs. */
|
|
20
|
-
export const CONFIG_ENV = 'REPO_CLEANER_MACHINE_CONFIG';
|
|
21
|
-
export const RepoCleanerConfigSchema = z
|
|
22
|
-
.object({
|
|
23
|
-
paths: pathsSchema()
|
|
24
|
-
.default({})
|
|
25
|
-
.describe('Named directories; a `repos:` entry refers to one as `{name}`.'),
|
|
26
|
-
repos: z
|
|
27
|
-
.array(z.string().trim().min(1))
|
|
28
|
-
.default([])
|
|
29
|
-
.describe('Checkouts, or directories containing checkouts at any depth.'),
|
|
30
|
-
})
|
|
31
|
-
.strict();
|
|
32
|
-
/**
|
|
33
|
-
* Whose directories the config file, plans and receipts live under: vendor
|
|
34
|
-
* `repo-cleaner`, moved by the `REPO_CLEANER_*` override variables.
|
|
35
|
-
*/
|
|
36
|
-
export const VENDOR_DIRS = { vendor: TOOL, envVars: envVars('REPO_CLEANER') };
|
|
37
|
-
const file = machineConfigFile({
|
|
38
|
-
tool: TOOL,
|
|
39
|
-
schema: RepoCleanerConfigSchema,
|
|
40
|
-
vendorDirs: VENDOR_DIRS,
|
|
41
|
-
env: CONFIG_ENV,
|
|
42
|
-
});
|
|
43
|
-
export const DEFAULT_CONFIG = RepoCleanerConfigSchema.parse({});
|
|
44
|
-
/** `<config-home>/repo-cleaner/config.yaml`, unless {@link CONFIG_ENV} says otherwise. */
|
|
45
|
-
export const configPath = () => file.path();
|
|
46
|
-
/**
|
|
47
|
-
* The config, defaults filled.
|
|
48
|
-
*
|
|
49
|
-
* Never throws. A missing file, unreadable file, malformed YAML or wrong
|
|
50
|
-
* shape all degrade to the defaults: a person running the tool in a
|
|
51
|
-
* repository should not be stopped by a config file they never wrote.
|
|
52
|
-
*/
|
|
53
|
-
export const loadConfig = () => file.load();
|
|
54
|
-
/** Drop the memoised value. Call from tests between runs. */
|
|
55
|
-
export const clearConfigCache = () => file.clearCache();
|
|
56
|
-
/**
|
|
57
|
-
* The configured entries with their `{name}` path names substituted against
|
|
58
|
-
* `paths:`, relative entries resolved against `baseDir`.
|
|
59
|
-
*
|
|
60
|
-
* A name nothing defines is an error rather than an empty string — a
|
|
61
|
-
* `repos:` entry that quietly becomes `/dev` would sweep whatever happens to
|
|
62
|
-
* be there.
|
|
63
|
-
*/
|
|
64
|
-
export function configuredRepos(config = loadConfig(), baseDir = process.cwd()) {
|
|
65
|
-
const names = pathNames(baseDir, config.paths, {});
|
|
66
|
-
return config.repos.map((entry) => substitutePathNames(entry, names, 'repos:'));
|
|
67
|
-
}
|