Skip to content

feat(targets): add pkg-pacman target (Arch Linux AUR / PKGBUILD)#709

Closed
forgou37 wants to merge 5 commits into
profullstack:masterfrom
forgou37:feat/pkg-pacman
Closed

feat(targets): add pkg-pacman target (Arch Linux AUR / PKGBUILD)#709
forgou37 wants to merge 5 commits into
profullstack:masterfrom
forgou37:feat/pkg-pacman

Conversation

@forgou37
Copy link
Copy Markdown
Contributor

@forgou37 forgou37 commented Jun 6, 2026

Adds the pkg-pacman target adapter for Arch Linux AUR/PKGBUILD.

  • Generates PKGBUILD file
  • Generates .SRCINFO
  • Full TypeScript implementation with tests

Third resubmit. Previous PRs #486, #686 closed by auto-rebase. Maintainer edits enabled so auto-rebase can push directly.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 6, 2026

Greptile Summary

This PR adds a new pkg-pacman target adapter for generating Arch Linux PKGBUILD and .SRCINFO files and publishing to the AUR. The TypeScript implementation and tests are structurally sound, but the package cannot be installed, built, or tested as-is due to several blocking issues.

  • Wrong package namespace: all package names and the core dependency use the @profullstack/sh1pt-* scope, while every other package in this monorepo uses @sh1pt/*. The workspace:* reference to @profullstack/sh1pt-core will fail to resolve.
  • manualSetup does not exist: it is imported from core but is not defined or exported anywhere in the codebase; the setup property it would populate is also absent from the Target<Config> interface, causing both a runtime error and a TypeScript excess-property check failure.
  • .SRCINFO source URL bug: defaultSourceUrl contains $pkgver twice; using .replace('$pkgver', version) expands only the first occurrence, leaving a literal $pkgver in the generated .SRCINFO, which makepkg will not expand.

Confidence Score: 2/5

Not safe to merge — the adapter cannot be installed or compiled in the monorepo as submitted.

The package references a non-existent workspace dependency (@profullstack/sh1pt-core instead of @sh1pt/core), imports a function (manualSetup) that does not exist in the core package, and adds a setup property the Target interface does not recognise. All three issues must be resolved before the adapter can be installed, type-checked, or tested. There is also a separate logic bug in renderSRCINFO that would produce an invalid .SRCINFO source URL even after the naming issues are fixed.

packages/targets/pkg-pacman/src/index.ts and packages/targets/pkg-pacman/package.json both need corrections before anything in this package can run.

Important Files Changed

Filename Overview
packages/targets/pkg-pacman/src/index.ts Core adapter file — imports a non-existent manualSetup from the wrong package name, adds a setup property not in the Target interface, and has a .replace() bug that leaves a literal $pkgver in the .SRCINFO source URL.
packages/targets/pkg-pacman/package.json Uses wrong package scope (@profullstack/sh1pt-*) and wrong core dependency name (@profullstack/sh1pt-core instead of @sh1pt/core); workspace:* resolution will fail.
packages/targets/pkg-pacman/src/index.test.ts Tests cover PKGBUILD generation and dry-run ship but import from the wrong package name, so they will not resolve until the naming issues are fixed.
packages/targets/pkg-pacman/tsconfig.json Standard tsconfig extending the repo base — no issues.
packages/targets/pkg-pacman/README.md Documentation file — accurate setup instructions for AUR SSH key, no issues.

Sequence Diagram

sequenceDiagram
    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/... }"
Loading

Reviews (1): Last reviewed commit: "feat(targets): add pkg-pacman tests" | Re-trigger Greptile

Comment on lines +11 to +13
"dependencies": {
"@profullstack/sh1pt-core": "workspace:*"
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 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.tsimport { 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';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 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).

Suggested change
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)}`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

Suggested change
`\tsource = ${name}-${version}.tar.gz::${defaultSourceUrl(config).replace('$pkgver', version)}`,
`\tsource = ${name}-${version}.tar.gz::${defaultSourceUrl(config).replaceAll('$pkgver', version)}`,

Comment on lines +119 to +148
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',
],
}),
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 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.

@ralyodio ralyodio closed this Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants