@goodandready/dsh-github-ops 0.6.8 → 0.6.10

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.
@@ -1,4 +1,5 @@
1
1
  import { encodeRepoPath } from '../github.js'
2
+ import { getCommunityTemplates } from './community.js'
2
3
  // Writing files without a local checkout.
3
4
  //
4
5
  // A commit is built the way git builds it: blobs, a tree on top of the branch's tree, a
@@ -139,9 +140,20 @@ function defaultSleep(ms) {
139
140
  export async function uploadProject(client, {
140
141
  owner, repo, description, private: isPrivate = true, files = [], branch, base, title, body,
141
142
  createPullRequest = false, org, attempts = 5, sleep = defaultSleep,
143
+ includeCommunityFiles = false, communityOptions = {},
142
144
  } = {}) {
143
145
  if (!repo) throw new Error('repository name is required')
144
- if (!Array.isArray(files) || files.length === 0) throw new Error('files must be a non-empty array')
146
+ let filesToPush = [...(Array.isArray(files) ? files : [])]
147
+ if (includeCommunityFiles) {
148
+ const templates = getCommunityTemplates({ projectName: repo, ...communityOptions })
149
+ const existing = new Set(filesToPush.map((f) => String(f.path || '').replace(/^\/+/g, '')))
150
+ for (const [tplPath, tplContent] of Object.entries(templates)) {
151
+ if (!existing.has(tplPath)) {
152
+ filesToPush.push({ path: tplPath, content: tplContent })
153
+ }
154
+ }
155
+ }
156
+ if (filesToPush.length === 0) throw new Error('files must be a non-empty array')
145
157
 
146
158
  let repository = null
147
159
  try {
@@ -164,7 +176,7 @@ export async function uploadProject(client, {
164
176
  const target = branch || (await repoDefaultBranch(client, { owner: repoOwner, repo: repoName, attempts, sleep }))
165
177
 
166
178
  const pushed = await pushFiles(client, {
167
- owner: repoOwner, repo: repoName, branch: target, message: title || 'Initial commit', files, base,
179
+ owner: repoOwner, repo: repoName, branch: target, message: title || 'Initial commit', files: filesToPush, base,
168
180
  })
169
181
 
170
182
  let pullRequest = null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-github-ops",
3
- "version": "0.6.8",
3
+ "version": "0.6.10",
4
4
  "description": "GitHub operations for DeepSeek Harness: releases, tags, a guarded generic API pass-through, workflow runs, secrets and sanitized mirror publication.",
5
5
  "license": "MIT",
6
6
  "type": "module",