feat(targets): add pkg-pacman target (Arch Linux AUR / PKGBUILD)#709
feat(targets): add pkg-pacman target (Arch Linux AUR / PKGBUILD)#709forgou37 wants to merge 5 commits into
Conversation
Greptile SummaryThis PR adds a new
Confidence Score: 2/5Not safe to merge — the adapter cannot be installed or compiled in the monorepo as submitted. The package references a non-existent workspace dependency (
Important Files Changed
Sequence DiagramsequenceDiagram
participant sh1pt
participant adapter as pkg-pacman adapter
participant fs as File System
participant AUR
sh1pt->>adapter: build(ctx, config)
adapter->>fs: mkdir(outDir)
adapter->>fs: writeFile(PKGBUILD)
adapter->>fs: writeFile(.SRCINFO)
adapter-->>sh1pt: "{ artifact: PKGBUILD }"
sh1pt->>adapter: ship(ctx, config)
alt dryRun
adapter-->>sh1pt: "{ id: dry-run }"
else live (not yet implemented)
Note over adapter,AUR: TODO: git clone AUR repo, commit PKGBUILD + .SRCINFO, push via AUR_SSH_KEY
adapter-->>sh1pt: "{ id: pkgname@version, url: aur.archlinux.org/... }"
end
sh1pt->>adapter: status(id)
adapter-->>sh1pt: "{ state: live, url: aur.archlinux.org/... }"
Reviews (1): Last reviewed commit: "feat(targets): add pkg-pacman tests" | Re-trigger Greptile |
| "dependencies": { | ||
| "@profullstack/sh1pt-core": "workspace:*" | ||
| }, |
There was a problem hiding this comment.
Wrong workspace dependency name
The package declares @profullstack/sh1pt-core as a dependency, but the actual package in this monorepo is @sh1pt/core (see packages/core/package.json). The workspace:* protocol will fail to resolve because no package named @profullstack/sh1pt-core exists in the workspace. The same mismatch applies to the import in src/index.ts — import { defineTarget, manualSetup } from '@profullstack/sh1pt-core' will throw a module-not-found error at both build and test time.
The package's own name (@profullstack/sh1pt-target-pkg-pacman) also diverges from every other target in this repo, which use the @sh1pt/target-* scope.
| @@ -0,0 +1,148 @@ | |||
| import { defineTarget, manualSetup } from '@profullstack/sh1pt-core'; | |||
There was a problem hiding this comment.
manualSetup does not exist anywhere in the codebase — it is not defined or re-exported in packages/core/src/target.ts or packages/core/src/index.ts. Importing it will throw at module-load time, making the adapter completely non-functional. No other adapter in the repo uses this helper; they simply omit a setup property (which is also not part of the Target<Config> interface, so adding it would be flagged by TypeScript's excess-property check).
| import { defineTarget, manualSetup } from '@profullstack/sh1pt-core'; | |
| import { defineTarget } from '@sh1pt/core'; |
| `\turl = ${config.url ?? 'https://sh1pt.com'}`, | ||
| `\tarch = ${arch}`, | ||
| `\tlicense = ${config.license ?? 'MIT'}`, | ||
| `\tsource = ${name}-${version}.tar.gz::${defaultSourceUrl(config).replace('$pkgver', version)}`, |
There was a problem hiding this comment.
defaultSourceUrl embeds $pkgver twice — once in v$pkgver and once in ${pkgname}-$pkgver-…. String.prototype.replace without a /g flag only substitutes the first occurrence, so the second $pkgver stays verbatim in the source = line. Because .SRCINFO is parsed as plain key-value data (not evaluated as Bash), makepkg / aurpublish will see a literal $pkgver in the download URL and fail to fetch the tarball.
| `\tsource = ${name}-${version}.tar.gz::${defaultSourceUrl(config).replace('$pkgver', version)}`, | |
| `\tsource = ${name}-${version}.tar.gz::${defaultSourceUrl(config).replaceAll('$pkgver', version)}`, |
| ctx.log(`push ${config.pkgname} v${version} to AUR`); | ||
|
|
||
| if (ctx.dryRun) return { id: 'dry-run' }; | ||
|
|
||
| // TODO: push updated PKGBUILD + .SRCINFO to the AUR git remote | ||
| // AUR URL: ssh://aur@aur.archlinux.org/<pkgname>.git | ||
| // Requires AUR_SSH_KEY from ctx.secret('AUR_SSH_KEY') | ||
| return { | ||
| id: `${config.pkgname}@${version}`, | ||
| url: `https://aur.archlinux.org/packages/${config.pkgname}`, | ||
| }; | ||
| }, | ||
|
|
||
| async status(id) { | ||
| const [name] = id.split('@'); | ||
| return { state: 'live', url: `https://aur.archlinux.org/packages/${name}` }; | ||
| }, | ||
|
|
||
| setup: manualSetup({ | ||
| label: 'Arch Linux AUR', | ||
| vendorDocUrl: 'https://wiki.archlinux.org/title/AUR_submission_guidelines', | ||
| steps: [ | ||
| 'Register an account at aur.archlinux.org', | ||
| 'Add your SSH public key in your AUR account settings', | ||
| 'Run: sh1pt secret set AUR_SSH_KEY <path-to-private-key>', | ||
| 'First time: clone your AUR package repo: ssh://aur@aur.archlinux.org/<pkgname>.git', | ||
| 'sh1pt will push updated PKGBUILD and .SRCINFO on each release', | ||
| ], | ||
| }), | ||
| }); |
There was a problem hiding this comment.
setup property is not part of the Target<Config> interface
The Target<Config> interface in packages/core/src/target.ts has no setup field. TypeScript's excess-property check will reject the object literal passed to defineTarget<Config>({…}) with "Object literal may only specify known properties." Additionally, manualSetup (which would populate this field) does not exist in the core package, so this block will fail both at type-check and at runtime. The setup key should be removed until a setup API is added to the core interface and a corresponding implementation is exported.
Adds the
pkg-pacmantarget adapter for Arch Linux AUR/PKGBUILD.PKGBUILDfile.SRCINFO