actionspack 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,108 @@
1
+ //#region src/utils/github.d.ts
2
+ interface GitHubClient {
3
+ resolveRef: (owner: string, repo: string, ref: string) => Promise<string>;
4
+ readFile: (owner: string, repo: string, ref: string, path: string) => Promise<string | undefined>;
5
+ }
6
+ //#endregion
7
+ //#region src/types.d.ts
8
+ interface ActionspackOptions {
9
+ cwd?: string;
10
+ entries?: WorkflowEntry[];
11
+ external?: string[];
12
+ github?: GitHubClient;
13
+ stdout?: WritableStream;
14
+ stderr?: WritableStream;
15
+ }
16
+ interface WritableStream {
17
+ write: (chunk: string) => void;
18
+ }
19
+ interface WorkflowEntry {
20
+ source: string;
21
+ output: string;
22
+ }
23
+ interface ActionspackConfig {
24
+ entries: WorkflowEntry[];
25
+ external: string[];
26
+ }
27
+ interface LockDependency {
28
+ package: string;
29
+ requested: string;
30
+ resolved?: string;
31
+ foundAt?: string;
32
+ }
33
+ interface LockEntry {
34
+ output: string;
35
+ dependencies: LockDependency[];
36
+ }
37
+ interface LockPackage {
38
+ source: "github";
39
+ owner: string;
40
+ repo: string;
41
+ path: string;
42
+ requested: string;
43
+ resolved: string;
44
+ type: "composite" | "external-action" | "external-workflow" | "reusable-workflow";
45
+ external?: boolean;
46
+ contentDigest: string;
47
+ dependencies: LockDependency[];
48
+ }
49
+ interface Lockfile {
50
+ lockfileVersion: 1;
51
+ entries: Record<string, LockEntry>;
52
+ packages: Record<string, LockPackage>;
53
+ }
54
+ interface RemoteRef {
55
+ owner: string;
56
+ repo: string;
57
+ path: string;
58
+ ref: string;
59
+ package: string;
60
+ kind: "action" | "reusable-workflow";
61
+ }
62
+ interface ScanOptions extends ActionspackOptions {
63
+ refreshPackages?: Set<string>;
64
+ }
65
+ interface UpdateOptions extends ActionspackOptions {
66
+ packageName?: string;
67
+ lockfileOnly?: boolean;
68
+ }
69
+ interface DiffOptions extends ActionspackOptions {
70
+ json?: boolean;
71
+ }
72
+ interface DiffResult {
73
+ added: string[];
74
+ removed: string[];
75
+ changed: Array<{
76
+ package: string;
77
+ oldResolved: string;
78
+ newResolved: string;
79
+ dependencyChanged: boolean;
80
+ }>;
81
+ }
82
+ interface CommandResult {
83
+ lockfile: Lockfile;
84
+ entries: WorkflowEntry[];
85
+ }
86
+ //#endregion
87
+ //#region src/pack.d.ts
88
+ declare function pack(options?: ActionspackOptions): Promise<CommandResult>;
89
+ declare function verify(options?: ActionspackOptions): Promise<CommandResult>;
90
+ declare function packWorkflow(workflow: Record<string, unknown>, lockfile: Lockfile, github: GitHubClient): Promise<Record<string, unknown>>;
91
+ declare function assertNoRemoteUses(value: unknown, file?: string): void;
92
+ //#endregion
93
+ //#region src/scan.d.ts
94
+ interface ResolvedDependency extends LockDependency {
95
+ remote: RemoteRef;
96
+ }
97
+ declare function scan(options?: ScanOptions): Promise<CommandResult>;
98
+ declare function collectWorkflowDependencies(workflow: Record<string, unknown>, source: string): ResolvedDependency[];
99
+ declare function collectStepDependencies(steps: unknown[], foundAtPrefix: string): ResolvedDependency[];
100
+ //#endregion
101
+ //#region src/commands.d.ts
102
+ declare function update(options?: UpdateOptions): Promise<void>;
103
+ declare function tree(options?: ActionspackOptions): Promise<string>;
104
+ declare function why(packageName: string, options?: ActionspackOptions): Promise<string>;
105
+ declare function diff(options?: DiffOptions): Promise<DiffResult | string>;
106
+ declare function diffLockfiles(previous: Lockfile, current: Lockfile): DiffResult;
107
+ //#endregion
108
+ export { type ActionspackConfig, type ActionspackOptions, type CommandResult, type DiffOptions, type DiffResult, type GitHubClient, type LockDependency, type LockEntry, type LockPackage, type Lockfile, type UpdateOptions, type WorkflowEntry, assertNoRemoteUses, collectStepDependencies, collectWorkflowDependencies, diff, diffLockfiles, pack, packWorkflow, scan, tree, update, verify, why };
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { a as why, c as packWorkflow, d as collectWorkflowDependencies, f as scan, i as update, l as verify, n as diffLockfiles, o as assertNoRemoteUses, r as tree, s as pack, t as diff, u as collectStepDependencies } from "./commands-V9OOSAvq.mjs";
2
+ export { assertNoRemoteUses, collectStepDependencies, collectWorkflowDependencies, diff, diffLockfiles, pack, packWorkflow, scan, tree, update, verify, why };
package/package.json CHANGED
@@ -1,11 +1,65 @@
1
1
  {
2
2
  "name": "actionspack",
3
- "version": "0.0.0",
4
- "description": "Placeholder for actionspack",
5
- "main": "index.js",
6
- "scripts": {},
7
- "keywords": [],
8
- "author": "sxzz (https://www.npmjs.com/~sxzz)",
9
- "license": "UNLICENSED",
10
- "private": false
3
+ "type": "module",
4
+ "version": "0.1.0",
5
+ "description": "Lockfile-first GitHub Actions workflow packer",
6
+ "author": "Kevin Deng <sxzz@sxzz.moe>",
7
+ "license": "MIT",
8
+ "funding": "https://github.com/sponsors/sxzz",
9
+ "homepage": "https://github.com/sxzz/actionspack#readme",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/sxzz/actionspack.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/sxzz/actionspack/issues"
16
+ },
17
+ "exports": {
18
+ ".": "./dist/index.mjs",
19
+ "./cli": "./dist/cli.mjs",
20
+ "./package.json": "./package.json"
21
+ },
22
+ "bin": {
23
+ "actionspack": "./dist/cli.mjs"
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "engines": {
32
+ "node": ">=22.18.0"
33
+ },
34
+ "dependencies": {
35
+ "@actions/expressions": "^0.3.57",
36
+ "@actions/workflow-parser": "^0.3.57",
37
+ "cac": "^7.0.0",
38
+ "yaml": "^2.9.0"
39
+ },
40
+ "devDependencies": {
41
+ "@sxzz/eslint-config": "^8.1.0",
42
+ "@sxzz/prettier-config": "^2.3.1",
43
+ "@types/node": "^25.9.0",
44
+ "@typescript/native-preview": "7.0.0-dev.20260519.1",
45
+ "bumpp": "^11.1.0",
46
+ "eslint": "^10.4.0",
47
+ "prettier": "^3.8.3",
48
+ "tsdown": "^0.22.0",
49
+ "tsdown-preset-sxzz": "^0.6.0",
50
+ "tsnapi": "^0.3.3",
51
+ "typescript": "^6.0.3",
52
+ "vitest": "^5.0.0-beta.3"
53
+ },
54
+ "prettier": "@sxzz/prettier-config",
55
+ "scripts": {
56
+ "lint": "eslint --cache .",
57
+ "lint:fix": "pnpm run lint --fix",
58
+ "build": "tsdown",
59
+ "dev": "tsdown --watch",
60
+ "test": "vitest",
61
+ "typecheck": "tsgo --noEmit",
62
+ "format": "prettier --cache --write .",
63
+ "release": "bumpp"
64
+ }
11
65
  }
package/index.js DELETED
@@ -1 +0,0 @@
1
- // Placeholder