t44 0.4.0-rc.3 → 0.4.0-rc.4

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.
@@ -52,6 +52,21 @@ export async function capsule({
52
52
  console.log(chalk.green(` ✓ Repository '${owner}/${repo}' created on GitHub\n`))
53
53
  } else {
54
54
  console.log(chalk.green(` ✓ Repository '${owner}/${repo}' already exists\n`))
55
+
56
+ const actualIsPrivate = result.repo.private
57
+ const wantsPublic = repoSettings.public === true
58
+
59
+ if (wantsPublic && actualIsPrivate) {
60
+ console.log(chalk.yellow(` ⚡ Repository '${owner}/${repo}' is private but config wants public. Updating visibility ...`))
61
+ const updated = await this.GitHubApi.updateRepoVisibility({ owner, repo, isPrivate: false })
62
+ result.repo = updated
63
+ console.log(chalk.green(` ✓ Repository '${owner}/${repo}' is now public\n`))
64
+ } else if (!wantsPublic && !actualIsPrivate) {
65
+ console.error(chalk.red(`\n ✗ Error: Repository '${owner}/${repo}' is public on GitHub but config does not set 'public: true'.`))
66
+ console.error(chalk.red(` If you want the repo to remain public, add 'public: true' to the RepositorySettings.`))
67
+ console.error(chalk.red(` If you want the repo to be private, change it manually on GitHub first.\n`))
68
+ throw new Error(`Repository '${owner}/${repo}' visibility mismatch: repo is public but config wants private`)
69
+ }
55
70
  }
56
71
 
57
72
  // Write provider-specific fact file
@@ -88,6 +88,21 @@ export async function capsule({
88
88
  return branches
89
89
  }
90
90
  },
91
+ updateRepoVisibility: {
92
+ type: CapsulePropertyTypes.Function,
93
+ value: async function (this: any, { owner, repo, isPrivate }: { owner: string, repo: string, isPrivate: boolean }) {
94
+ const headers = await this.apiHeaders
95
+ const response = await fetch(`https://api.github.com/repos/${owner}/${repo}`, {
96
+ method: 'PATCH',
97
+ headers: { ...headers, 'Content-Type': 'application/json' },
98
+ body: JSON.stringify({ private: isPrivate })
99
+ })
100
+ if (!response.ok) {
101
+ throw new Error(`GitHub API error updating repo visibility: ${response.status} ${await response.text()}`)
102
+ }
103
+ return response.json()
104
+ }
105
+ },
91
106
  ensureRepo: {
92
107
  type: CapsulePropertyTypes.Function,
93
108
  value: async function (this: any, { owner, repo, isPrivate, description }: { owner: string, repo: string, isPrivate?: boolean, description?: string }) {
@@ -32,7 +32,7 @@ const {
32
32
  }, {
33
33
  importMeta: import.meta,
34
34
  importStack: makeImportStack(),
35
- capsuleName: 't44/tests/01-Lifecycle/main.test'
35
+ capsuleName: 't44/examples/01-Lifecycle/main.test'
36
36
  })
37
37
  return { spine }
38
38
  }, async ({ spine, apis }: any) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "t44",
3
- "version": "0.4.0-rc.3",
3
+ "version": "0.4.0-rc.4",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -84,9 +84,9 @@
84
84
  "@ucanto/principal": "^9.0.3",
85
85
  "@ucanto/server": "^11.0.3",
86
86
  "json-schema-ref-resolver": "^3.0.0",
87
- "@stream44.studio/encapsulate": "^0.4.0-rc.3",
88
- "@stream44.studio/dco": "^0.3.0-rc.3",
89
- "@stream44.studio/t44-blockchaincommons.com": "^0.1.0-rc.3"
87
+ "@stream44.studio/encapsulate": "^0.4.0-rc.4",
88
+ "@stream44.studio/dco": "^0.3.0-rc.4",
89
+ "@stream44.studio/t44-blockchaincommons.com": "^0.1.0-rc.4"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@types/bun": "^1.3.4",