hammerkit 1.6.0 → 1.8.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 +7 -7
- package/build.schema.json +59 -15
- package/dist/cache/backends/local-cache-backend.js +58 -1
- package/dist/cache/backends/registry/registry-client.js +264 -0
- package/dist/cache/backends/registry/registry-credentials.js +81 -0
- package/dist/cache/backends/registry/registry-reference.js +36 -0
- package/dist/cache/backends/registry-cache-backend.js +145 -0
- package/dist/cache/backends/s3-cache-backend.js +99 -46
- package/dist/cache/cache-backend-registry.js +2 -0
- package/dist/cache/cache-inventory.js +84 -0
- package/dist/cache/cache-sync.js +77 -0
- package/dist/cache/explain.js +214 -0
- package/dist/cache/last-resolved.js +48 -0
- package/dist/cache/read-only.js +15 -0
- package/dist/cache/retention.js +61 -0
- package/dist/cli.js +43 -0
- package/dist/docker/using-container.js +17 -1
- package/dist/executer/archive-task-entry.js +21 -0
- package/dist/executer/await-completed-dependencies.js +32 -14
- package/dist/executer/cache-metadata.js +9 -2
- package/dist/executer/docker-service.js +2 -1
- package/dist/executer/docker-task.js +18 -3
- package/dist/executer/dry-run.js +73 -0
- package/dist/executer/event-cache.js +6 -5
- package/dist/executer/execute-command.js +21 -3
- package/dist/executer/execute-docker.js +18 -2
- package/dist/executer/execute-work-service.js +10 -1
- package/dist/executer/execute-work-task.js +111 -26
- package/dist/executer/execute-work-tree.js +26 -1
- package/dist/executer/execution-steps.js +3 -8
- package/dist/executer/get-container-binds.js +13 -1
- package/dist/executer/get-scheduler-execute-result.js +4 -1
- package/dist/executer/lazy-resolver.js +15 -3
- package/dist/executer/reset-work-tree.js +2 -0
- package/dist/executer/run-summary.js +102 -0
- package/dist/executer/scheduler/enqueue-next.js +15 -60
- package/dist/executer/scheduler/state-key.js +78 -0
- package/dist/index.js +14 -1
- package/dist/kubernetes/apply.js +6 -7
- package/dist/kubernetes/await-running-state.js +100 -60
- package/dist/kubernetes/ensure-http-route.js +7 -10
- package/dist/kubernetes/ensure-namespace.js +9 -10
- package/dist/kubernetes/ensure-persistent-data.js +6 -5
- package/dist/kubernetes/get-service-ip.js +2 -2
- package/dist/kubernetes/kubernetes-instance.js +0 -4
- package/dist/kubernetes/remove-persistent-data.js +16 -6
- package/dist/kubernetes/resolve-pod-name.js +7 -7
- package/dist/log.js +16 -6
- package/dist/logging/live-logger.js +2 -1
- package/dist/optimizer/calculate-checksum.js +8 -2
- package/dist/optimizer/get-work-cache-stats.js +66 -16
- package/dist/optimizer/work-task-cache-description.js +34 -5
- package/dist/planner/project-root.js +26 -0
- package/dist/planner/utils/append-work-environment.js +1 -1
- package/dist/planner/utils/append-work-service.js +2 -1
- package/dist/planner/utils/append-work-task.js +7 -1
- package/dist/planner/utils/get-outputs-to-reset.js +20 -0
- package/dist/planner/utils/parse-work-generate.js +2 -2
- package/dist/planner/utils/parse-work-source.js +35 -30
- package/dist/planner/utils/portable-path.js +30 -0
- package/dist/planner/work-cache-id.js +2 -2
- package/dist/planner/work-graph-serializer.js +103 -0
- package/dist/planner/work-instance-id.js +15 -0
- package/dist/planner/work-runtime-docker.js +58 -15
- package/dist/planner/work-runtime-kubernetes.js +95 -45
- package/dist/planner/work-runtime-local.js +31 -8
- package/dist/planner/work-service-id.js +16 -4
- package/dist/program.js +235 -1
- package/dist/schema/build-file-base-task-schema.js +4 -0
- package/dist/schema/build-file-environment-schema-http-route.js +15 -0
- package/dist/schema/build-file-environment-schema.js +8 -2
- package/dist/schema/build-file-schema.js +1 -1
- package/dist/schema/cache-schema.js +21 -2
- package/dist/schema/duration-schema.js +18 -0
- package/dist/schema/envs-schema.js +1 -1
- package/dist/schema/reference-parser.js +3 -0
- package/dist/schema/size-schema.js +18 -0
- package/dist/schema/work-scope-parser.js +15 -2
- package/dist/utils/units.js +87 -0
- package/package.json +20 -9
- package/.agents/FEEDBACK.md +0 -74
- package/.agents/skills/before-commit/SKILL.md +0 -101
- package/.agents/skills/do-the-work/SKILL.md +0 -64
- package/.agents/skills/fix-ci/SKILL.md +0 -98
- package/.agents/skills/speckit-git-commit/SKILL.md +0 -53
- package/.agents/skills/speckit-git-feature/SKILL.md +0 -72
- package/.agents/skills/speckit-git-initialize/SKILL.md +0 -54
- package/.agents/skills/speckit-git-remote/SKILL.md +0 -50
- package/.agents/skills/speckit-git-validate/SKILL.md +0 -54
- package/.devcontainer/Dockerfile +0 -5
- package/.devcontainer/devcontainer.json +0 -40
- package/.gitbook.yaml +0 -5
- package/.specify/extensions/.registry +0 -37
- package/.specify/extensions/git/README.md +0 -100
- package/.specify/extensions/git/commands/speckit.git.commit.md +0 -48
- package/.specify/extensions/git/commands/speckit.git.feature.md +0 -67
- package/.specify/extensions/git/commands/speckit.git.initialize.md +0 -49
- package/.specify/extensions/git/commands/speckit.git.remote.md +0 -45
- package/.specify/extensions/git/commands/speckit.git.validate.md +0 -49
- package/.specify/extensions/git/config-template.yml +0 -62
- package/.specify/extensions/git/extension.yml +0 -140
- package/.specify/extensions/git/git-config.yml +0 -62
- package/.specify/extensions.yml +0 -149
- package/.specify/feature.json +0 -3
- package/.specify/init-options.json +0 -10
- package/.specify/integration.json +0 -15
- package/.specify/integrations/claude.manifest.json +0 -16
- package/.specify/integrations/speckit.manifest.json +0 -17
- package/.specify/memory/constitution.md +0 -162
- package/.specify/templates/checklist-template.md +0 -40
- package/.specify/templates/constitution-template.md +0 -50
- package/.specify/templates/plan-template.md +0 -113
- package/.specify/templates/spec-template.md +0 -131
- package/.specify/templates/tasks-template.md +0 -252
- package/.specify/workflows/speckit/workflow.yml +0 -77
- package/.specify/workflows/workflow-registry.json +0 -13
- package/AGENTS.md +0 -94
- package/Dockerfile +0 -32
- package/FOLLOWUPS.md +0 -34
- package/SUMMARY.md +0 -68
- package/VALUES.md +0 -53
- package/dist/cache/auto-pull.spec.js +0 -123
- package/dist/cache/backends/local-cache-backend.spec.js +0 -72
- package/dist/cache/backends/s3-cache-backend.spec.js +0 -118
- package/dist/cache/cache-backend-registry.spec.js +0 -22
- package/dist/cache/resolve-cache.spec.js +0 -52
- package/dist/cli.spec.js +0 -23
- package/dist/console/get-logger.spec.js +0 -23
- package/dist/docker/get-default-platform.spec.js +0 -29
- package/dist/docker/longest-common-prefix.spec.js +0 -26
- package/dist/docker/package.spec.js +0 -145
- package/dist/docker/remove-container.spec.js +0 -32
- package/dist/docker/using-container.spec.js +0 -90
- package/dist/environment/merge-environment-variables.spec.js +0 -24
- package/dist/environment/replace-env-variables.spec.js +0 -47
- package/dist/executer/abort.spec.js +0 -18
- package/dist/executer/environment-mock.spec.js +0 -22
- package/dist/executer/execute.spec.js +0 -51
- package/dist/executer/get-service-containers.spec.js +0 -59
- package/dist/executer/get-service-env-hints.spec.js +0 -65
- package/dist/executer/label-values.spec.js +0 -61
- package/dist/executer/lazy-resolver.spec.js +0 -20
- package/dist/executer/process-manager.spec.js +0 -54
- package/dist/executer/scheduler/enqueue-next.spec.js +0 -136
- package/dist/executer/state-resolver.spec.js +0 -37
- package/dist/executer/state.spec.js +0 -66
- package/dist/executer/states.spec.js +0 -14
- package/dist/file/get-file-context.spec.js +0 -178
- package/dist/file/move-files.spec.js +0 -48
- package/dist/kubernetes/ensure-http-route.spec.js +0 -70
- package/dist/kubernetes/ensure-ingress.js +0 -54
- package/dist/kubernetes/ensure-namespace.spec.js +0 -39
- package/dist/kubernetes/resolve-pod-name.spec.js +0 -81
- package/dist/log.spec.js +0 -131
- package/dist/logging/grouped-logger.spec.js +0 -84
- package/dist/logging/interactive-logger.spec.js +0 -57
- package/dist/logging/live-logger.spec.js +0 -37
- package/dist/logging/loggers.spec.js +0 -154
- package/dist/optimizer/calculate-checksum.spec.js +0 -34
- package/dist/optimizer/get-cache-directory.spec.js +0 -59
- package/dist/optimizer/get-work-cache-stats.spec.js +0 -79
- package/dist/optimizer/work-task-cache-description.spec.js +0 -45
- package/dist/parser/default-build-file.spec.js +0 -48
- package/dist/parser/parse-label-arguments.spec.js +0 -27
- package/dist/parser/read-build-file.spec.js +0 -89
- package/dist/parser/read-env-file.spec.js +0 -42
- package/dist/planner/utils/append-work-service.spec.js +0 -71
- package/dist/planner/utils/get-container-user.spec.js +0 -30
- package/dist/planner/utils/get-default-kube-config.spec.js +0 -11
- package/dist/planner/utils/normalize-path.spec.js +0 -24
- package/dist/planner/utils/parse-work-command.spec.js +0 -21
- package/dist/planner/utils/parse-work-generate.spec.js +0 -45
- package/dist/planner/utils/parse-work-mount.spec.js +0 -62
- package/dist/planner/utils/parse-work-mounts.spec.js +0 -19
- package/dist/planner/utils/parse-work-port.spec.js +0 -24
- package/dist/planner/utils/parse-work-ports.spec.js +0 -24
- package/dist/planner/utils/parse-work-source.spec.js +0 -58
- package/dist/planner/utils/parse-work-volume.spec.js +0 -18
- package/dist/planner/utils/plan-work-tasks.spec.js +0 -30
- package/dist/planner/utils/plan-work-volume.spec.js +0 -33
- package/dist/planner/utils/split-name.spec.js +0 -16
- package/dist/planner/utils/template-value.spec.js +0 -14
- package/dist/planner/validate.spec.js +0 -251
- package/dist/planner/work-cache-id.spec.js +0 -173
- package/dist/planner/work-runtime-local.spec.js +0 -193
- package/dist/program-commands.spec.js +0 -84
- package/dist/program.spec.js +0 -43
- package/dist/schema/build-file-environment-schema-ingress.js +0 -14
- package/dist/schema/build-file-schema.spec.js +0 -61
- package/dist/schema/doc-build-files.spec.js +0 -223
- package/dist/schema/parse-error.spec.js +0 -18
- package/dist/schema/reference-parser.spec.js +0 -83
- package/dist/schema/schema-parser.spec.js +0 -80
- package/dist/schema/type-guards.spec.js +0 -23
- package/dist/schema/work-scope-parser.spec.js +0 -66
- package/dist/service/update-service-status.spec.js +0 -27
- package/dist/testing/ensure-local-registry.js +0 -134
- package/dist/testing/example-test-suite.js +0 -63
- package/dist/testing/expect.js +0 -82
- package/dist/testing/get-test-suite.js +0 -9
- package/dist/testing/http-get.js +0 -21
- package/dist/testing/integration/cache.spec.js +0 -49
- package/dist/testing/integration/cancellation.spec.js +0 -45
- package/dist/testing/integration/clean.spec.js +0 -43
- package/dist/testing/integration/cmd.spec.js +0 -15
- package/dist/testing/integration/concurrency.spec.js +0 -19
- package/dist/testing/integration/docker-package-registry.spec.js +0 -44
- package/dist/testing/integration/docker-service-crash.spec.js +0 -36
- package/dist/testing/integration/docker.spec.js +0 -18
- package/dist/testing/integration/env.spec.js +0 -48
- package/dist/testing/integration/environment.spec.js +0 -97
- package/dist/testing/integration/error.spec.js +0 -19
- package/dist/testing/integration/export.spec.js +0 -22
- package/dist/testing/integration/extend.spec.js +0 -29
- package/dist/testing/integration/glob.spec.js +0 -40
- package/dist/testing/integration/include.spec.js +0 -31
- package/dist/testing/integration/invalid.spec.js +0 -17
- package/dist/testing/integration/invalid_loop.spec.js +0 -56
- package/dist/testing/integration/k8s-state-cache.spec.js +0 -41
- package/dist/testing/integration/kubernetes-service.spec.js +0 -148
- package/dist/testing/integration/kubernetes.spec.js +0 -99
- package/dist/testing/integration/labels.spec.js +0 -42
- package/dist/testing/integration/local.spec.js +0 -14
- package/dist/testing/integration/monorepo.spec.js +0 -15
- package/dist/testing/integration/multi-line.spec.js +0 -17
- package/dist/testing/integration/reference.spec.js +0 -21
- package/dist/testing/integration/services.spec.js +0 -38
- package/dist/testing/integration/store.spec.js +0 -52
- package/dist/testing/integration/unknown.spec.js +0 -28
- package/dist/testing/integration/validate.spec.js +0 -160
- package/dist/testing/integration/watch-dependency.spec.js +0 -33
- package/dist/testing/integration/watch.spec.js +0 -45
- package/dist/testing/requires-kubernetes.js +0 -18
- package/dist/testing/requires-linux-containers.js +0 -18
- package/dist/testing/requires-windows-containers.js +0 -18
- package/dist/testing/test-case.js +0 -75
- package/dist/testing/test-streams.js +0 -28
- package/dist/testing/test-suite-setup.js +0 -3
- package/dist/testing/test-suite.js +0 -3
- package/dist/testing/testing-timeout.js +0 -32
- package/dist/utils/abort-event.spec.js +0 -46
- package/dist/utils/buffer-context.spec.js +0 -38
- package/dist/utils/ci.spec.js +0 -53
- package/dist/utils/debouncer.spec.js +0 -58
- package/dist/utils/emitter.spec.js +0 -34
- package/dist/utils/empty-writable.spec.js +0 -18
- package/dist/utils/environment-config.spec.js +0 -26
- package/dist/utils/fail-never.spec.js +0 -9
- package/dist/utils/sleep.spec.js +0 -22
- package/dist/version.spec.js +0 -12
- package/specs/build-file/caches/spec.md +0 -114
- package/specs/build-file/environment-variables/spec.md +0 -82
- package/specs/build-file/includes/spec.md +0 -60
- package/specs/build-file/references/spec.md +0 -56
- package/specs/build-file/spec.md +0 -62
- package/specs/cli/clean/spec.md +0 -85
- package/specs/cli/down/spec.md +0 -85
- package/specs/cli/execute/spec.md +0 -101
- package/specs/cli/init/spec.md +0 -64
- package/specs/cli/ls/spec.md +0 -66
- package/specs/cli/package/spec.md +0 -110
- package/specs/cli/spec.md +0 -73
- package/specs/cli/store-restore/spec.md +0 -74
- package/specs/cli/up/spec.md +0 -80
- package/specs/cli/validate/spec.md +0 -70
- package/specs/labels/spec.md +0 -91
- package/specs/service/container/spec.md +0 -120
- package/specs/service/kubernetes/spec.md +0 -97
- package/specs/service/spec.md +0 -105
- package/specs/task/caching/spec.md +0 -107
- package/specs/task/container/spec.md +0 -118
- package/specs/task/dependencies/spec.md +0 -70
- package/specs/task/extending/spec.md +0 -74
- package/specs/task/kubernetes/spec.md +0 -125
- package/specs/task/needs/spec.md +0 -59
- package/specs/task/spec.md +0 -87
- package/specs/task/watching/spec.md +0 -69
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
vi.mock('os', async () => ({ ...(await vi.importActual('os')), platform: vi.fn() }));
|
|
4
|
-
const os_1 = require("os");
|
|
5
|
-
const get_container_user_1 = require("./get-container-user");
|
|
6
|
-
const mockedPlatform = os_1.platform;
|
|
7
|
-
describe('getContainerUser', () => {
|
|
8
|
-
const originalGetuid = process.getuid;
|
|
9
|
-
const originalGetgid = process.getgid;
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
Object.assign(process, { getuid: () => 1234, getgid: () => 4321 });
|
|
12
|
-
});
|
|
13
|
-
afterEach(() => {
|
|
14
|
-
Object.assign(process, { getuid: originalGetuid, getgid: originalGetgid });
|
|
15
|
-
});
|
|
16
|
-
it.each(['linux', 'freebsd', 'openbsd', 'sunos'])('returns uid:gid on %s', (p) => {
|
|
17
|
-
mockedPlatform.mockReturnValue(p);
|
|
18
|
-
expect((0, get_container_user_1.getContainerUser)()).toBe('1234:4321');
|
|
19
|
-
});
|
|
20
|
-
it.each(['darwin', 'win32'])('returns null on %s', (p) => {
|
|
21
|
-
mockedPlatform.mockReturnValue(p);
|
|
22
|
-
expect((0, get_container_user_1.getContainerUser)()).toBeNull();
|
|
23
|
-
});
|
|
24
|
-
it('returns null on a unix platform when process.getuid is unavailable', () => {
|
|
25
|
-
mockedPlatform.mockReturnValue('linux');
|
|
26
|
-
process.getuid = undefined;
|
|
27
|
-
expect((0, get_container_user_1.getContainerUser)()).toBeNull();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
//# sourceMappingURL=get-container-user.spec.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const os_1 = require("os");
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const get_default_kube_config_1 = require("./get-default-kube-config");
|
|
6
|
-
describe('getDefaultKubeConfig', () => {
|
|
7
|
-
it('returns ~/.kube/config', () => {
|
|
8
|
-
expect((0, get_default_kube_config_1.getDefaultKubeConfig)()).toBe((0, path_1.join)((0, os_1.homedir)(), '.kube/config'));
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
//# sourceMappingURL=get-default-kube-config.spec.js.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const normalize_path_1 = require("./normalize-path");
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
// normalizePath uses the platform-native path.join, so expectations must use
|
|
6
|
-
// the native separator too. Mirrors the helper in parse-work-mount.spec.ts.
|
|
7
|
-
function toNative(val) {
|
|
8
|
-
return val.split(path_1.posix.sep).join(path_1.sep);
|
|
9
|
-
}
|
|
10
|
-
describe('normalize-path', () => {
|
|
11
|
-
it('should append src to cwd', () => {
|
|
12
|
-
const result = (0, normalize_path_1.normalizePath)('/home/user/proj', '/home/user', 'src');
|
|
13
|
-
expect(result).toEqual(toNative('/home/user/proj/src'));
|
|
14
|
-
});
|
|
15
|
-
it('should append .kube to pwd', () => {
|
|
16
|
-
const result = (0, normalize_path_1.normalizePath)('/home/user/proj', '/home/user', '$PWD/.kube');
|
|
17
|
-
expect(result).toEqual(toNative('/home/user/.kube'));
|
|
18
|
-
});
|
|
19
|
-
it('should append nothing to /usr/bin', () => {
|
|
20
|
-
const result = (0, normalize_path_1.normalizePath)('/home/user/proj', '/home/user', '/usr/bin');
|
|
21
|
-
expect(result).toEqual('/usr/bin');
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
//# sourceMappingURL=normalize-path.spec.js.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const parse_work_command_1 = require("./parse-work-command");
|
|
4
|
-
describe('tokenizeCommand', () => {
|
|
5
|
-
it('splits a plain command on whitespace', () => {
|
|
6
|
-
expect((0, parse_work_command_1.tokenizeCommand)('node server.js')).toEqual(['node', 'server.js']);
|
|
7
|
-
});
|
|
8
|
-
it('keeps a double-quoted argument as one token and strips the quotes', () => {
|
|
9
|
-
expect((0, parse_work_command_1.tokenizeCommand)('sh -c "echo hi && sleep 3600"')).toEqual(['sh', '-c', 'echo hi && sleep 3600']);
|
|
10
|
-
});
|
|
11
|
-
it('handles single quotes', () => {
|
|
12
|
-
expect((0, parse_work_command_1.tokenizeCommand)("sh -c 'echo hi'")).toEqual(['sh', '-c', 'echo hi']);
|
|
13
|
-
});
|
|
14
|
-
it('collapses repeated whitespace instead of emitting empty tokens', () => {
|
|
15
|
-
expect((0, parse_work_command_1.tokenizeCommand)('a b\tc')).toEqual(['a', 'b', 'c']);
|
|
16
|
-
});
|
|
17
|
-
it('returns an empty list for a blank command', () => {
|
|
18
|
-
expect((0, parse_work_command_1.tokenizeCommand)(' ')).toEqual([]);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
//# sourceMappingURL=parse-work-command.spec.js.map
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const path_1 = require("path");
|
|
4
|
-
const parse_work_generate_1 = require("./parse-work-generate");
|
|
5
|
-
const plan_work_volume_1 = require("./plan-work-volume");
|
|
6
|
-
const noEnvs = { variables: {}, replacements: [] };
|
|
7
|
-
describe('mapGenerate', () => {
|
|
8
|
-
it('treats a bare string as path with defaults', () => {
|
|
9
|
-
expect((0, parse_work_generate_1.mapGenerate)('dist')).toEqual({ path: 'dist', resetOnChange: false, export: false });
|
|
10
|
-
});
|
|
11
|
-
it('preserves resetOnChange and export from an object', () => {
|
|
12
|
-
expect((0, parse_work_generate_1.mapGenerate)({ path: 'out', resetOnChange: true, export: true })).toEqual({
|
|
13
|
-
path: 'out',
|
|
14
|
-
resetOnChange: true,
|
|
15
|
-
export: true,
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
it('defaults resetOnChange and export to false when omitted', () => {
|
|
19
|
-
expect((0, parse_work_generate_1.mapGenerate)({ path: 'out' })).toEqual({ path: 'out', resetOnChange: false, export: false });
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
describe('parseWorkGenerate', () => {
|
|
23
|
-
it('returns [] when the task has no generates', () => {
|
|
24
|
-
expect((0, parse_work_generate_1.parseWorkGenerate)('/work', {}, noEnvs)).toEqual([]);
|
|
25
|
-
});
|
|
26
|
-
it('joins paths against cwd, templates env vars and marks files with an extension', () => {
|
|
27
|
-
const result = (0, parse_work_generate_1.parseWorkGenerate)('/work', { generates: ['dist', { path: 'out/$NAME.json' }] }, {
|
|
28
|
-
variables: { NAME: 'pkg' },
|
|
29
|
-
replacements: [],
|
|
30
|
-
});
|
|
31
|
-
expect(result[0]).toMatchObject({
|
|
32
|
-
path: (0, path_1.join)('/work', 'dist'),
|
|
33
|
-
isFile: false,
|
|
34
|
-
resetOnChange: false,
|
|
35
|
-
export: false,
|
|
36
|
-
inherited: null,
|
|
37
|
-
});
|
|
38
|
-
expect(result[0].volumeName).toBe((0, plan_work_volume_1.getVolumeName)((0, path_1.join)('/work', 'dist')));
|
|
39
|
-
expect(result[1]).toMatchObject({
|
|
40
|
-
path: (0, path_1.join)('/work', 'out/pkg.json'),
|
|
41
|
-
isFile: true,
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=parse-work-generate.spec.js.map
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const parse_work_mount_1 = require("./parse-work-mount");
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const os_1 = require("os");
|
|
6
|
-
function normalizePath(val) {
|
|
7
|
-
return val.split(path_1.posix.sep).join(path_1.sep);
|
|
8
|
-
}
|
|
9
|
-
describe('parse-work-mount', () => {
|
|
10
|
-
it('should parse "subdir"', () => {
|
|
11
|
-
expect((0, parse_work_mount_1.parseWorkMount)('/home/test', 'subdir')).toMatchObject({
|
|
12
|
-
localPath: normalizePath('/home/test/subdir'),
|
|
13
|
-
containerPath: normalizePath('/home/test/subdir'),
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
it('should parse "./subdir"', () => {
|
|
17
|
-
expect((0, parse_work_mount_1.parseWorkMount)('/home/test', './subdir')).toMatchObject({
|
|
18
|
-
localPath: normalizePath('/home/test/subdir'),
|
|
19
|
-
containerPath: normalizePath('/home/test/subdir'),
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
it('should parse "./subdir:./otherdir"', () => {
|
|
23
|
-
expect((0, parse_work_mount_1.parseWorkMount)('/home/test', './subdir:./otherdir')).toMatchObject({
|
|
24
|
-
localPath: normalizePath('/home/test/subdir'),
|
|
25
|
-
containerPath: normalizePath('/home/test/otherdir'),
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
it('should parse "$PWD/subdir:/subdir"', () => {
|
|
29
|
-
expect((0, parse_work_mount_1.parseWorkMount)('/home/test', '$PWD/subdir:/subdir')).toMatchObject({
|
|
30
|
-
localPath: (0, path_1.join)((0, os_1.homedir)(), 'subdir'),
|
|
31
|
-
containerPath: '/subdir',
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
it('should parse "$PWD/subdir:$PWD/subdir"', () => {
|
|
35
|
-
expect((0, parse_work_mount_1.parseWorkMount)('/home/test', '$PWD/subdir:$PWD/subdir')).toMatchObject({
|
|
36
|
-
localPath: (0, path_1.join)((0, os_1.homedir)(), 'subdir'),
|
|
37
|
-
containerPath: normalizePath('/home/test/subdir'),
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
it('should parse "/subdir:/otherdir"', () => {
|
|
41
|
-
expect((0, parse_work_mount_1.parseWorkMount)('/home/test', '/subdir:/otherdir')).toMatchObject({
|
|
42
|
-
localPath: '/subdir',
|
|
43
|
-
containerPath: '/otherdir',
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
it('should parse "/subdir:otherdir"', () => {
|
|
47
|
-
expect((0, parse_work_mount_1.parseWorkMount)('/home/test', '/subdir:otherdir')).toMatchObject({
|
|
48
|
-
localPath: '/subdir',
|
|
49
|
-
containerPath: normalizePath('/home/test/otherdir'),
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
it('should parse "subdir:/otherdir"', () => {
|
|
53
|
-
expect((0, parse_work_mount_1.parseWorkMount)('/home/test', 'subdir:/otherdir')).toMatchObject({
|
|
54
|
-
localPath: normalizePath('/home/test/subdir'),
|
|
55
|
-
containerPath: '/otherdir',
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
it('throws for a mount string with more than two parts', () => {
|
|
59
|
-
expect(() => (0, parse_work_mount_1.parseWorkMount)('/home/test', 'a:b:c')).toThrow('invalid mount a:b:c');
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
//# sourceMappingURL=parse-work-mount.spec.js.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const parse_work_mounts_1 = require("./parse-work-mounts");
|
|
4
|
-
const noEnvs = { variables: {}, replacements: [] };
|
|
5
|
-
describe('parseWorkMounts', () => {
|
|
6
|
-
it('returns [] when no mounts are declared', () => {
|
|
7
|
-
expect((0, parse_work_mounts_1.parseWorkMounts)('/work', {}, noEnvs)).toEqual([]);
|
|
8
|
-
});
|
|
9
|
-
it('templates env vars and parses each mount against the cwd', () => {
|
|
10
|
-
const result = (0, parse_work_mounts_1.parseWorkMounts)('/work', { mounts: ['$PWD/.npm:/.npm', 'config:/etc/config'] }, {
|
|
11
|
-
variables: { PWD: '/home/x' },
|
|
12
|
-
replacements: [],
|
|
13
|
-
});
|
|
14
|
-
expect(result).toHaveLength(2);
|
|
15
|
-
expect(result[0]).toMatchObject({ containerPath: '/.npm' });
|
|
16
|
-
expect(result[1]).toMatchObject({ containerPath: '/etc/config' });
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
//# sourceMappingURL=parse-work-mounts.spec.js.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const parse_work_port_1 = require("./parse-work-port");
|
|
4
|
-
describe('parse-work-port', () => {
|
|
5
|
-
it('should parse 5432', () => {
|
|
6
|
-
expect((0, parse_work_port_1.parseWorkPort)('5432')).toEqual({
|
|
7
|
-
hostPort: 5432,
|
|
8
|
-
containerPort: 5432,
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
it('should parse 5432:5433', () => {
|
|
12
|
-
expect((0, parse_work_port_1.parseWorkPort)('5432:5433')).toEqual({
|
|
13
|
-
hostPort: 5432,
|
|
14
|
-
containerPort: 5433,
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
it('throws for a port with more than two parts', () => {
|
|
18
|
-
expect(() => (0, parse_work_port_1.parseWorkPort)('1:2:3')).toThrow('invalid port 1:2:3');
|
|
19
|
-
});
|
|
20
|
-
it('throws for a non-numeric port', () => {
|
|
21
|
-
expect(() => (0, parse_work_port_1.parseWorkPort)('http')).toThrow('invalid port http');
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
//# sourceMappingURL=parse-work-port.spec.js.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const parse_work_ports_1 = require("./parse-work-ports");
|
|
4
|
-
const noEnvs = { variables: {}, replacements: [] };
|
|
5
|
-
describe('parse-work-ports', () => {
|
|
6
|
-
it('returns an empty list when the service declares no ports', () => {
|
|
7
|
-
const schema = { image: 'postgres:12-alpine' };
|
|
8
|
-
expect((0, parse_work_ports_1.parseWorkPorts)(schema, noEnvs)).toEqual([]);
|
|
9
|
-
});
|
|
10
|
-
it('parses numeric and string ports', () => {
|
|
11
|
-
const schema = { image: 'node', ports: [5432, '8080:80'] };
|
|
12
|
-
expect((0, parse_work_ports_1.parseWorkPorts)(schema, noEnvs)).toEqual([
|
|
13
|
-
{ hostPort: 5432, containerPort: 5432 },
|
|
14
|
-
{ hostPort: 8080, containerPort: 80 },
|
|
15
|
-
]);
|
|
16
|
-
});
|
|
17
|
-
it('templates env vars in port values', () => {
|
|
18
|
-
const schema = { image: 'node', ports: ['$PORT:80'] };
|
|
19
|
-
expect((0, parse_work_ports_1.parseWorkPorts)(schema, { variables: { PORT: '9090' }, replacements: [] })).toEqual([
|
|
20
|
-
{ hostPort: 9090, containerPort: 80 },
|
|
21
|
-
]);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
//# sourceMappingURL=parse-work-ports.spec.js.map
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const path_1 = require("path");
|
|
4
|
-
const parse_work_source_1 = require("./parse-work-source");
|
|
5
|
-
const noEnvs = { variables: {}, replacements: [] };
|
|
6
|
-
// parseWorkSource builds absolutePath via path.join and the no-wildcard matcher
|
|
7
|
-
// compares with String.startsWith, so both are native-separated. Author the
|
|
8
|
-
// expectations in posix and convert to the host separator. No-op on posix.
|
|
9
|
-
const toNative = (value) => value.split(path_1.posix.sep).join(path_1.sep);
|
|
10
|
-
describe('parse-work-source', () => {
|
|
11
|
-
it('returns an empty list for null/undefined sources', () => {
|
|
12
|
-
expect((0, parse_work_source_1.parseWorkSource)('/proj', null, noEnvs)).toEqual([]);
|
|
13
|
-
expect((0, parse_work_source_1.parseWorkSource)('/proj', undefined, noEnvs)).toEqual([]);
|
|
14
|
-
});
|
|
15
|
-
describe('without a wildcard', () => {
|
|
16
|
-
it('treats a path with an extension as a file', () => {
|
|
17
|
-
const [src] = (0, parse_work_source_1.parseWorkSource)('/proj', ['dist/app.js'], noEnvs);
|
|
18
|
-
expect(src.absolutePath).toBe(toNative('/proj/dist/app.js'));
|
|
19
|
-
expect(src.isFile).toBe(true);
|
|
20
|
-
expect(src.matcher(toNative('/proj/dist/app.js'), '/proj')).toBe(true);
|
|
21
|
-
expect(src.matcher(toNative('/proj/dist/other.js'), '/proj')).toBe(false);
|
|
22
|
-
});
|
|
23
|
-
it('treats a path without an extension as a directory', () => {
|
|
24
|
-
const [src] = (0, parse_work_source_1.parseWorkSource)('/proj', ['src'], noEnvs);
|
|
25
|
-
expect(src.absolutePath).toBe(toNative('/proj/src'));
|
|
26
|
-
expect(src.isFile).toBe(false);
|
|
27
|
-
expect(src.matcher(toNative('/proj/src/index.ts'), '/proj')).toBe(true);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
describe('with a leading wildcard', () => {
|
|
31
|
-
it('anchors the absolute path to cwd and matches relative paths', () => {
|
|
32
|
-
const [src] = (0, parse_work_source_1.parseWorkSource)('/proj', ['*.spec.ts'], noEnvs);
|
|
33
|
-
expect(src.absolutePath).toBe('/proj');
|
|
34
|
-
expect(src.isFile).toBe(false);
|
|
35
|
-
expect(src.matcher('/proj/a.spec.ts', '/proj')).toBe(true);
|
|
36
|
-
expect(src.matcher('/proj/a.ts', '/proj')).toBe(false);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
describe('with a mid-string wildcard', () => {
|
|
40
|
-
it('uses the prefix for the absolute path and globs against the full path', () => {
|
|
41
|
-
const [src] = (0, parse_work_source_1.parseWorkSource)('/proj', ['src/*.ts'], noEnvs);
|
|
42
|
-
expect(src.absolutePath).toBe(toNative('/proj/src/'));
|
|
43
|
-
expect(src.isFile).toBe(false);
|
|
44
|
-
expect(src.matcher('/proj/src/a.ts', '/proj')).toBe(true);
|
|
45
|
-
expect(src.matcher('/proj/src/sub/a.ts', '/proj')).toBe(false);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
describe('createSource', () => {
|
|
49
|
-
it('builds a prefix matcher from an absolute path', () => {
|
|
50
|
-
const src = (0, parse_work_source_1.createSource)('/proj/dist');
|
|
51
|
-
expect(src.absolutePath).toBe('/proj/dist');
|
|
52
|
-
expect(src.source).toBe('/proj/dist');
|
|
53
|
-
expect(src.matcher('/proj/dist/app.js', '/proj')).toBe(true);
|
|
54
|
-
expect(src.matcher('/proj/other', '/proj')).toBe(false);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
//# sourceMappingURL=parse-work-source.spec.js.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const parse_work_volume_1 = require("./parse-work-volume");
|
|
4
|
-
describe('parse-work-volume', () => {
|
|
5
|
-
it('should parse projdata:/usr/data', () => {
|
|
6
|
-
expect((0, parse_work_volume_1.parseWorkVolume)('/home/user/proj', 'projdata:/usr/data', { replacements: [], variables: {} })).toEqual({
|
|
7
|
-
name: 'projdata',
|
|
8
|
-
containerPath: '/usr/data',
|
|
9
|
-
resetOnChange: false,
|
|
10
|
-
export: false,
|
|
11
|
-
inherited: null,
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
it('throws for a volume string that is not name:path', () => {
|
|
15
|
-
expect(() => (0, parse_work_volume_1.parseWorkVolume)('/home/user/proj', 'a:b:c', { replacements: [], variables: {} })).toThrow('invalid volume a:b:c');
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
//# sourceMappingURL=parse-work-volume.spec.js.map
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const plan_work_tasks_1 = require("./plan-work-tasks");
|
|
4
|
-
const ok = { state: { current: { type: 'completed' } } };
|
|
5
|
-
const err = { state: { current: { type: 'error' } } };
|
|
6
|
-
const tree = (services, tasks) => ({ services, tasks });
|
|
7
|
-
describe('plan-work-tasks iterators and error helpers', () => {
|
|
8
|
-
it('iterateWorkServices yields every service value', () => {
|
|
9
|
-
const t = tree({ a: { id: 'A' }, b: { id: 'B' } }, {});
|
|
10
|
-
expect([...(0, plan_work_tasks_1.iterateWorkServices)(t)].map((s) => s.id)).toEqual(['A', 'B']);
|
|
11
|
-
});
|
|
12
|
-
it('iterateWorkTasks yields every task value', () => {
|
|
13
|
-
const t = tree({}, { a: { id: 'A' } });
|
|
14
|
-
expect([...(0, plan_work_tasks_1.iterateWorkTasks)(t)].map((s) => s.id)).toEqual(['A']);
|
|
15
|
-
});
|
|
16
|
-
it('hasErrorTask is true iff a task is in error', () => {
|
|
17
|
-
expect((0, plan_work_tasks_1.hasErrorTask)(tree({}, { a: ok }))).toBe(false);
|
|
18
|
-
expect((0, plan_work_tasks_1.hasErrorTask)(tree({}, { a: ok, b: err }))).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
it('hasErrorService is true iff a service is in error', () => {
|
|
21
|
-
expect((0, plan_work_tasks_1.hasErrorService)(tree({ a: ok }, {}))).toBe(false);
|
|
22
|
-
expect((0, plan_work_tasks_1.hasErrorService)(tree({ a: err }, {}))).toBe(true);
|
|
23
|
-
});
|
|
24
|
-
it('hasError covers both services and tasks', () => {
|
|
25
|
-
expect((0, plan_work_tasks_1.hasError)(tree({}, {}))).toBe(false);
|
|
26
|
-
expect((0, plan_work_tasks_1.hasError)(tree({ a: err }, {}))).toBe(true);
|
|
27
|
-
expect((0, plan_work_tasks_1.hasError)(tree({}, { a: err }))).toBe(true);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
//# sourceMappingURL=plan-work-tasks.spec.js.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const plan_work_volume_1 = require("./plan-work-volume");
|
|
4
|
-
describe('plan-work-volume', () => {
|
|
5
|
-
describe('generateId / getVolumeName', () => {
|
|
6
|
-
it('hashes the input deterministically (sha1)', () => {
|
|
7
|
-
expect((0, plan_work_volume_1.generateId)('a')).toBe((0, plan_work_volume_1.generateId)('a'));
|
|
8
|
-
expect((0, plan_work_volume_1.generateId)('a')).not.toBe((0, plan_work_volume_1.generateId)('b'));
|
|
9
|
-
expect((0, plan_work_volume_1.getVolumeName)('x')).toMatch(/^hammerkit-[a-f0-9]{40}$/);
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
describe('getContainerVolumes', () => {
|
|
13
|
-
const task = {
|
|
14
|
-
generates: [
|
|
15
|
-
{ path: '/out/a', volumeName: 'na', inherited: null, resetOnChange: true, export: false, isFile: false },
|
|
16
|
-
{ path: '/out/b', volumeName: 'nb', inherited: null, resetOnChange: false, export: true, isFile: false },
|
|
17
|
-
],
|
|
18
|
-
};
|
|
19
|
-
it('emits a named volume for every generate that has no matching mount', () => {
|
|
20
|
-
const volumes = (0, plan_work_volume_1.getContainerVolumes)(task, []);
|
|
21
|
-
expect(volumes.map((v) => v.containerPath)).toEqual(['/out/a', '/out/b']);
|
|
22
|
-
expect(volumes[0].resetOnChange).toBe(true);
|
|
23
|
-
expect(volumes[1].export).toBe(true);
|
|
24
|
-
expect(volumes[0].name).toMatch(/^hammerkit-/);
|
|
25
|
-
});
|
|
26
|
-
it('skips a generate whose path is already mounted (mount wins)', () => {
|
|
27
|
-
const mounts = [{ containerPath: '/out/a' }];
|
|
28
|
-
const volumes = (0, plan_work_volume_1.getContainerVolumes)(task, mounts);
|
|
29
|
-
expect(volumes.map((v) => v.containerPath)).toEqual(['/out/b']);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=plan-work-volume.spec.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const split_name_1 = require("./split-name");
|
|
4
|
-
describe('split-name', () => {
|
|
5
|
-
it('should split test:bar', () => {
|
|
6
|
-
const result = (0, split_name_1.splitName)('test:bar');
|
|
7
|
-
expect(result.name).toEqual('bar');
|
|
8
|
-
expect(result.prefix).toEqual('test');
|
|
9
|
-
});
|
|
10
|
-
it('should not split test', () => {
|
|
11
|
-
const result = (0, split_name_1.splitName)('test');
|
|
12
|
-
expect(result.name).toEqual('test');
|
|
13
|
-
expect(result.prefix).toEqual(undefined);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
//# sourceMappingURL=split-name.spec.js.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const template_value_1 = require("./template-value");
|
|
4
|
-
describe('template-value', () => {
|
|
5
|
-
it('should template string value', () => {
|
|
6
|
-
const value = (0, template_value_1.templateValue)('echo $VAR', { variables: { VAR: 'hello' }, replacements: [] });
|
|
7
|
-
expect(value).toEqual('echo hello');
|
|
8
|
-
});
|
|
9
|
-
it('should leave missing envs', () => {
|
|
10
|
-
const value = (0, template_value_1.templateValue)('echo $VAR', { variables: {}, replacements: [] });
|
|
11
|
-
expect(value).toEqual('echo $VAR');
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
//# sourceMappingURL=template-value.spec.js.map
|