@kenkyou/supekku 0.1.0-alpha.2 → 0.1.0-alpha.3

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.
Files changed (37) hide show
  1. package/README.md +2 -0
  2. package/dist/agent-artifacts.md +1 -1
  3. package/dist/agent-onboarding.md +3 -1
  4. package/dist/{api-D-iVy-AK.mjs → api-DNK2unOM.mjs} +9 -0
  5. package/dist/{artifact-F8toITED.mjs → artifact-DB-BbLHN.mjs} +9 -11
  6. package/dist/artifact-DcpnfU11.mjs +2 -0
  7. package/dist/{browser-xnEH9tG1.mjs → browser-ZZZ9iv0U.mjs} +1 -1
  8. package/dist/{check-CdparnIC.mjs → check-CUGUw_8s.mjs} +1 -1
  9. package/dist/cli-publication.md +18 -14
  10. package/dist/{connection-DaxqQEdP.mjs → connection-jD5RlW1b.mjs} +1 -1
  11. package/dist/{feedback-BmygGL4q.mjs → feedback-BrXufWeh.mjs} +4 -5
  12. package/dist/{feedback-DA-v75O7.mjs → feedback-CQ9Ymv6J.mjs} +1 -1
  13. package/dist/{feedback-DBsutUQW.mjs → feedback-Dh0v9BIr.mjs} +2 -2
  14. package/dist/index.mjs +30 -27
  15. package/dist/project-Cp0fxWoh.mjs +1 -0
  16. package/dist/{project-Ru88VeXP.mjs → project-Dq2SpWN5.mjs} +15 -7
  17. package/dist/project-connection-09JC8T7M.mjs +203 -0
  18. package/dist/{publications-DaNXLqrj.mjs → publications-CCKKV7y1.mjs} +1 -1
  19. package/dist/{publish-BZXi-1Iu.mjs → publish-DX7lmTf4.mjs} +5 -5
  20. package/dist/{revisions-CZyZmV7P.mjs → revisions-BuCkMiDb.mjs} +1 -1
  21. package/dist/{serve-C7rls3m6.mjs → serve-37rjgOKv.mjs} +2 -2
  22. package/dist/skills/supekku-artifacts/SKILL.md +4 -1
  23. package/dist/skills/supekku-development/references/agent-onboarding.md +3 -1
  24. package/dist/status-BbwxwT2C.mjs +1 -0
  25. package/dist/{status-DrNLYKef.mjs → status-BiOxakHh.mjs} +8 -8
  26. package/dist/{status-BzK0I8Ni.mjs → status-BzYrPSRi.mjs} +1 -1
  27. package/dist/viewer/assets/local-CzRu6SWP.css +2 -0
  28. package/dist/viewer/local.html +2 -2
  29. package/package.json +1 -1
  30. package/dist/artifact-DpGEBZwh.mjs +0 -2
  31. package/dist/connect-BzygwM5L.mjs +0 -38
  32. package/dist/connection-BXfXx-wo.mjs +0 -1
  33. package/dist/credentials-CxkhjmnO.mjs +0 -63
  34. package/dist/project-JhzSd3ia.mjs +0 -1
  35. package/dist/status-DJee7WIX.mjs +0 -1
  36. package/dist/viewer/assets/local-B4ON878x.css +0 -2
  37. /package/dist/viewer/assets/{local-DGmDYuBR.js → local-wPtOzNXl.js} +0 -0
package/README.md CHANGED
@@ -95,3 +95,5 @@ supekku skills update --agent codex --json
95
95
  status 每次最多20提案、每案50任務、100筆 pending 發布,明示 hasMore;個案不可讀、缺少 journal、截斷或遠端失敗保留其他結果,complete:false 並退出2。缺資料不代表已驗證沒有待恢復操作。SQLite 讀取可能產生 WAL 協調檔;無業務寫入或恢復。
96
96
 
97
97
  check 保留 change validate 的 valid、findings 和退出碼;ok:true 不等於 valid:true。feedback 是遠端只讀 list 捷徑,保留版本、cursor、limit 與現有授權,不回覆或標記完成。skills update 使用隨目前 CLI 的 skills,不更新 npm、不初始化專案、不覆寫自行修改內容。需明確 agent 或 target;可安全更新狀態不等於 Agent 已重新載入。原始底層指令持續支援。
98
+
99
+ 完整的初始化、提案、驗證、實作與封存教學見 [完整使用教學](../../docs/getting-started.md)。
@@ -12,7 +12,7 @@ Agent 使用 artifact feedback list 與明確游標讀取回饋,reply/resolv
12
12
 
13
13
  ## 發布至已登入的 Web 專案
14
14
 
15
- 新對話先執行 `supekku project status --project <path> --json`,以最近的 Supekku 根目錄及 `.supekku/project.json` 判定目的地,不從聊天內容猜專案。無綁定時,引導使用者執行 `connect --server <Web origin> --project <path>`,在 Google 登入的 Web 選專案並批准裝置,CLI 自動綁定。已有綁定時可執行 `connect --project <path>` 沿用網站。有效授權直接沿用;不同目的地需使用者明確同意後加 `--replace`,不得自行登出換帳號。開瀏覽器失敗可依終端網址手動操作,非互動環境使用 `--no-open --json`。公開綁定只含 repositoryId、origin、projectId;憑證在系統儲存庫。
15
+ 新對話先執行 `supekku project status --project <path> --json`,以最近的 Supekku 根目錄及 `.supekku/project.json` 判定目的地,不從聊天內容猜專案。無綁定時,引導使用者執行 `connect --server <Web origin> --project <path>`,在 Google 登入的 Web 選專案並批准裝置,CLI 自動綁定。已有綁定時可執行 `connect --project <path>` 沿用網站。只沿用這個 checkout 的有效授權;不同目的地需使用者明確同意後加 `--replace`,不得自行登出換帳號。開瀏覽器失敗可依終端網址手動操作,非互動環境使用 `--no-open --json`。schemaVersion 2 公開綁定含 repositoryId、origin、projectId 與非機密 credentialId;憑證在系統儲存庫。不同 checkout 的 connect、refresh 與 logout 互不覆蓋;舊 schema 1 需重新授權一次,不複製共用 token。
16
16
 
17
17
  生成與發布為兩次不同範圍的授權;既有明確發布授權不必重複詢問。順序是 `status → list/init → check → serve → publish --dry-run → publish`。使用 check 回傳的 revisionId:
18
18
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  需要 Node 24.22.1 或以上的受測版本。請使用已建置/安裝的新版 `@kenkyou/supekku`;`--version` 取自執行套件的 package.json。本指南對應 0.1.0-alpha.2;發行驗證以各版 release 紀錄為準。專案裡若還有舊版同名 CLI,先確認你執行的檔案路徑;以下 `supekku` 都指新版安裝後的 bin。
4
4
 
5
+ 完整的提案、TDD、Review 與封存步驟見 [完整使用教學](getting-started.md)。
6
+
5
7
  ## 一次完成初始化(alpha.2)
6
8
 
7
9
  在專案根目錄執行 `supekku init`,終端會詢問 Agent,依序初始化、安裝兩套 skills 並執行 doctor。此入口自 0.1.0-alpha.2 提供。
@@ -42,7 +44,7 @@ supekku doctor --project /path/to/project --target .agents/skills --json
42
44
  supekku local init --project /path/to/hakulax --independent --json
43
45
  ```
44
46
 
45
- 此選項僅適用 local init,必須同時提供 --project。只初始化指定資料夾,不掃描或遷移上層管理資料。後續指令從新根目錄或其子目錄尋找最近的 `.supekku/`。不加此選項時仍保留原本拒絕巢狀初始化的行為。
47
+ 上述底層 local init 的 --independent 必須同時提供 --project;新版統一 init 也支援 --independent,且可使用目前目錄。只初始化指定資料夾,不掃描或遷移上層管理資料。後續指令從新根目錄或其子目錄尋找最近的 `.supekku/`。不加此選項時仍保留原本拒絕巢狀初始化的行為。
46
48
 
47
49
  目標本身若有舊 supekku/、新舊目錄衝突、symlink 或不安全 journal,仍拒絕;沒有 force 覆寫。此功能不會安裝 skills、綁定網站或授權實作。不要把獨立子專案目錄列入父專案 Task scope。此選項自 0.1.0-alpha.1 提供,alpha.0 不支援。
48
50
 
@@ -16,6 +16,7 @@ Type.Union([Type.Object({ name: Type.String({
16
16
  }) }, { additionalProperties: false }), Type.Object({ archived: Type.Boolean() }, { additionalProperties: false })]);
17
17
  Type.Object({ snapshot: SnapshotSchema }, { additionalProperties: false });
18
18
  Type.Object({
19
+ summary: Type.Optional(Type.Literal("true")),
19
20
  after: Type.Optional(Uuid),
20
21
  status: Type.Optional(Type.Union([
21
22
  Type.Literal("active"),
@@ -25,6 +26,14 @@ Type.Object({
25
26
  limit: Type.Optional(Type.String({ pattern: "^(?:[1-9]|[1-9][0-9]|100)$" }))
26
27
  }, { additionalProperties: false });
27
28
  const ProjectView = Type.Object({
29
+ summary: Type.Optional(Type.Object({
30
+ role: Type.Union([
31
+ Type.Literal("reader"),
32
+ Type.Literal("collaborator"),
33
+ Type.Literal("manager")
34
+ ]),
35
+ artifactCount: Type.Integer({ minimum: 0 })
36
+ }, { additionalProperties: false })),
28
37
  id: Uuid,
29
38
  name: Type.String(),
30
39
  createdAt: Type.String(),
@@ -136,21 +136,19 @@ async function artifactCommand(action, args, project) {
136
136
  if (action === "template") return artifactTemplate(args[0], args[1]);
137
137
  const root = await findProject(project);
138
138
  if (action === "status") {
139
- const { artifactStatus } = await import("./status-DJee7WIX.mjs");
139
+ const { artifactStatus } = await import("./status-BbwxwT2C.mjs");
140
140
  if (!args.includes("--remote")) return artifactStatus(root, args[0]);
141
- const { createConnection } = await import("./connection-BXfXx-wo.mjs");
142
- const { credentials } = await import("./credentials-CxkhjmnO.mjs");
143
- return artifactStatus(root, args[0], createConnection({ store: credentials }));
141
+ const { boundConnection } = await import("./project-connection-09JC8T7M.mjs");
142
+ return artifactStatus(root, args[0], await boundConnection(root));
144
143
  }
145
144
  if ([
146
145
  "publish",
147
146
  "publish-status",
148
147
  "publish-resume"
149
148
  ].includes(action)) {
150
- const { publishArtifact, resumePublication } = await import("./publish-BZXi-1Iu.mjs");
151
- const { createConnection } = await import("./connection-BXfXx-wo.mjs");
152
- const { credentials } = await import("./credentials-CxkhjmnO.mjs");
153
- const remote = createConnection({ store: credentials });
149
+ const { publishArtifact, resumePublication } = await import("./publish-DX7lmTf4.mjs");
150
+ const { boundConnection } = await import("./project-connection-09JC8T7M.mjs");
151
+ const remote = await boundConnection(root);
154
152
  return action === "publish" ? publishArtifact(root, args[0], args[2], args.includes("--dry-run"), remote, (operationId) => {
155
153
  process.stderr.write(JSON.stringify({
156
154
  event: "publication_prepared",
@@ -229,14 +227,14 @@ async function artifactCommand(action, args, project) {
229
227
  return { artifacts };
230
228
  }
231
229
  if (action === "feedback") {
232
- const { feedback } = await import("./feedback-BmygGL4q.mjs");
230
+ const { feedback } = await import("./feedback-BrXufWeh.mjs");
233
231
  return feedback(root, args);
234
232
  }
235
233
  if (action === "serve") {
236
- const { serve } = await import("./serve-C7rls3m6.mjs");
234
+ const { serve } = await import("./serve-37rjgOKv.mjs");
237
235
  return serve(root);
238
236
  }
239
- const { check } = await import("./check-CdparnIC.mjs");
237
+ const { check } = await import("./check-CUGUw_8s.mjs");
240
238
  return check(root, args[0]);
241
239
  }
242
240
  export { readManifest as n, artifactCommand as t };
@@ -0,0 +1,2 @@
1
+ import "./project-directory-w_ITkI7O.mjs";
2
+ export { t as artifactCommand } from "./artifact-DB-BbLHN.mjs";
@@ -1,5 +1,5 @@
1
1
  import { t as CoreError } from "./src-CRhxwFAN.mjs";
2
- import { n as serverOrigin } from "./connection-DaxqQEdP.mjs";
2
+ import { n as serverOrigin } from "./connection-jD5RlW1b.mjs";
3
3
  import { spawn } from "node:child_process";
4
4
  // src/remote/browser.ts
5
5
  function browserCommand(platform, url) {
@@ -1,4 +1,4 @@
1
- import { t as checkArtifact } from "./revisions-CZyZmV7P.mjs";
1
+ import { t as checkArtifact } from "./revisions-BuCkMiDb.mjs";
2
2
  // src/commands/artifact/check.ts
3
3
  const check = checkArtifact;
4
4
  export { check };
@@ -12,28 +12,32 @@ supekku connect --server https://your-server.example --project /path/to/reposito
12
12
 
13
13
  指令會開啟瀏覽器,Google 登入後選擇專案並允許授權;CLI 自動取得你批准的專案並完成綁定,不需要輸入 UUID。終端也會顯示網址及驗證碼;若無法自動開啟,手動開啟即可。遠端終端或不想開瀏覽器時加 --no-open。只有 Web 閱讀/評論的同事不需要 CLI。
14
14
 
15
- 在本機開發環境使用 --server http://127.0.0.1:5173,與 Web 登入的 origin 一致。綁定存於 .supekku/project.json,只有 repositoryId 與網站/專案識別,沒有 token。憑證留在系統儲存庫。
16
-
17
- 後續在同一資料夾或子目錄執行 supekku connect,可沿用網站地址及有效授權;已正確綁定會回報 changed=false。從 Git 取得綁定的同事仍需個別授權。connect 只連接,不發布 Artifact;既有發布流程保持明確授權。
18
-
19
- - 同網站已有有效 CLI 授權:沿用該授權的專案,不會再次開瀏覽器。
20
- - 需要換帳號/授權專案:明確執行 auth logout --server <origin>,再 connect;在瀏覽器選新專案。這會影響此使用者在同網站的其他本機專案登入狀態。
21
- - 新目的地與既有綁定不同:核對後加 --replace;它不會忽略未完成發布或併發修改。
22
- - 授權完成但本機寫入失敗:綁定沒有被偷偷重設,已保存的授權可供重跑 connect 使用。
15
+ 在本機開發環境使用 --server http://127.0.0.1:5173,與 Web 登入的 origin 一致。綁定存於 .supekku/project.json,包含 repositoryId、網站/專案識別與非機密 credentialId(schemaVersion 2),沒有 token。憑證留在系統儲存庫。
16
+
17
+ 後續在同一資料夾或子目錄執行 supekku connect,可沿用網站地址及有效授權;已正確綁定會回報 changed=false。從 Git 取得綁定的同事仍需個別授權。project.json 是本機連接設定,不應將重新授權造成的 credentialId 變更當成團隊共用設定覆蓋;若專案追蹤此檔,需自行管理這類變更,拉取其他 credentialId 後可能需要重新授權。connect 只連接,不發布 Artifact;既有發布流程保持明確授權。
18
+
19
+ - 每個本機 checkout 的授權獨立保存。同網站的其他專案已登入,也不會被自動套用。
20
+ - 新專案首次 connect 會開啟瀏覽器選 Web 專案;已有綁定時,重新授權必須選回原專案。
21
+ - 要換 Web 專案或帳號:執行 `supekku connect --project <path> --replace`;換網站再加 `--server <origin>`。成功驗證後才替換,取消或失敗保留原連接。
22
+ - 改綁成功不會自動撤銷舊裝置 grant;不再使用的授權可在 Web「已授權裝置」明確撤銷。
23
+ - 改綁不搬移或刪除舊 Web Artifact;新目的地會重新查詢自己的映射。未完成的發布必須先處理,不能改送其他專案。
24
+ - 授權完成但綁定寫入失敗:會嘗試撤銷新候選授權;舊授權不受影響。程序中斷或清理結果未知時,可到 Web「已授權裝置」檢查未使用的裝置,再重跑 connect。若寫入結果未知,先讀取 project status,不假設失敗代表未寫入。
25
+ - 舊 schemaVersion 1 綁定仍可讀取,但需重新 connect 授權一次升級。舊共用 Keychain token 不會被複製、更新或撤銷,可自行在 Web 撤銷舊裝置。
26
+ - 授權包含本機實際目錄身分;移動或複製 checkout 後需重新 connect,不會因複製 project.json 取得原目錄的授權。舊版 CLI 不支援 schemaVersion 2。
23
27
  - --json:stdout 是單一結果 envelope,授權/瀏覽器事件寫到 stderr,不輸出 token。
24
28
 
25
- 進階命令仍可使用:
29
+ `auth login` 現在依目前專案執行連接;`project link` 僅能驗證既有專屬授權,改選目的地請使用 `connect --replace`。進階命令:
26
30
 
27
31
  ```sh
28
- supekku auth login --server https://your-server.example --device-name "My computer"
29
- supekku auth whoami --server https://your-server.example --json
32
+ supekku auth login --server https://your-server.example --project /path/to/repository --device-name "My computer"
33
+ supekku auth whoami --server https://your-server.example --project /path/to/repository --json
30
34
  supekku project link --server https://your-server.example --project-id <Web授權專案UUID> --project /path/to/repository
31
35
  supekku project status --project /path/to/repository --json
32
36
  ```
33
37
 
34
38
  依 [Agent 約定](agent-artifacts.md) 產生 Artifact,再以 check 的 revisionId 發布。回應含 Web 固定版本 URL、artifactId、versionId、sourceRevisionHash 與 operationId。若連線中斷,不要猜成功或失敗;執行 `artifact publish-status <operationId>` 或 `artifact publish-resume <operationId>`。本機 intent 先保存再開始上傳,並在 stderr 輸出 `publication_prepared` 事件及 operationId(stdout 仍只有最終結果);恢復重新驗證原綁定與原版本。
35
39
 
36
- Access token 有效期 15 分鐘,CLI 自動使用輪替 refresh token;grant 最長 30 天。refresh 回應遺失、憑證儲存失敗或授權遭撤銷時,需重新 `auth login`。Google session 到期與 CLI token 到期是不同事件。登出:`auth logout --server <origin>`;離線時會清除本機憑證並提示遠端撤銷未確認,可到 Web 帳號選單的「已授權裝置」撤銷。
40
+ Access token 有效期 15 分鐘,CLI 自動使用輪替 refresh token;grant 最長 30 天。refresh 回應遺失、憑證儲存失敗或授權遭撤銷時,需重新 `auth login`。Google session 到期與 CLI token 到期是不同事件。登出目前專案:`auth logout --server <origin> --project <path>`;離線時會清除本機憑證並提示遠端撤銷未確認,可到 Web 帳號選單的「已授權裝置」撤銷。
37
41
 
38
42
  服務端 migration 新增 OAuth、grant 與 publication 表,需由使用者依既有 1Password 流程明確執行。舊本機 Artifact 日誌執行 `artifact store upgrade --project <path>`,會先備份,不做自動降版。正式 Markdown 不由此流程改寫。
39
43
 
@@ -48,12 +52,12 @@ HTML 使用獨立來源的既有隔離預覽,且須啟用既有互動政策;
48
52
  先執行新版 API migration(0018),再啟動新版 API/Web。裝置新增 feedback:read 權限,授權頁會說明評論與原文上下文讀取。既有裝置不會因 migration 或 token refresh 取得新權限;需要使用者執行:
49
53
 
50
54
  ```sh
51
- supekku auth logout --server <Web-origin>
55
+ supekku auth logout --server <Web-origin> --project <path>
52
56
  supekku connect --project <path>
53
57
  supekku artifact feedback list <id> --remote --project <path> --json
54
58
  ```
55
59
 
56
- logout 保留 project.json 與本機 Artifact,但會撤銷目前同 origin 裝置授權。若既有 token 已到期而 connect 要求重新授權,也會顯示新增讀取能力。此權限只新增評論讀取,沒有回覆/刪除/標記已處理。
60
+ logout 保留 project.json 與本機 Artifact,只撤銷所選本機專案的裝置授權,不影響其他 checkout。若既有 token 已到期而 connect 要求重新授權,也會顯示新增讀取能力。此權限只新增評論讀取,沒有回覆/刪除/標記已處理。
57
61
 
58
62
  list 以評論為單位分頁,每筆包含 thread 與 comment;僅讀取所選獨立 Document 版本。show <id> <threadId> --remote --version <versionId> 回傳該串分頁與原始 snapshot。預設版本是最新發布;--after 必須搭配 --version。新一輪讀取從第一頁開始,以取得現有評論的編輯/刪除狀態。詳見 Agent 約定的讀取步驟。Artboard/HTML/Image 回 UNSUPPORTED_ARTIFACT,不會讀取畫布內文件副本原本的評論。
59
63
 
@@ -1,5 +1,5 @@
1
1
  import { t as CoreError } from "./src-CRhxwFAN.mjs";
2
- import { n as isCliIdentity } from "./api-D-iVy-AK.mjs";
2
+ import { n as isCliIdentity } from "./api-DNK2unOM.mjs";
3
3
  import { setTimeout } from "node:timers/promises";
4
4
  // ../../packages/contracts/src/limits.ts
5
5
  /** Retry-After is untrusted metadata, never a reason to automatically repeat a request. */
@@ -1,12 +1,11 @@
1
1
  import { t as CoreError } from "./src-CRhxwFAN.mjs";
2
- import { i as resolveFeedback, n as listFeedback, r as replyFeedback } from "./feedback-DA-v75O7.mjs";
2
+ import { i as resolveFeedback, n as listFeedback, r as replyFeedback } from "./feedback-CQ9Ymv6J.mjs";
3
3
  // src/commands/artifact/feedback.ts
4
4
  async function feedback(root, args) {
5
5
  if (args.includes("--remote")) {
6
- const { readRemoteFeedback } = await import("./feedback-DBsutUQW.mjs");
7
- const { createConnection } = await import("./connection-BXfXx-wo.mjs");
8
- const { credentials } = await import("./credentials-CxkhjmnO.mjs");
9
- return readRemoteFeedback(root, args, createConnection({ store: credentials }));
6
+ const { readRemoteFeedback } = await import("./feedback-Dh0v9BIr.mjs");
7
+ const { boundConnection } = await import("./project-connection-09JC8T7M.mjs");
8
+ return readRemoteFeedback(root, args, await boundConnection(root));
10
9
  }
11
10
  const [action, id, ...rest] = args;
12
11
  const positional = [];
@@ -1,6 +1,6 @@
1
1
  import { t as CoreError } from "./src-CRhxwFAN.mjs";
2
2
  import { a as artifactId, l as manifestBoards } from "./artifact-local-Bfy69a9H.mjs";
3
- import { n as getRevision } from "./revisions-CZyZmV7P.mjs";
3
+ import { n as getRevision } from "./revisions-BuCkMiDb.mjs";
4
4
  import { a as withStore } from "./store-jFj2Dhgl.mjs";
5
5
  import { randomUUID } from "node:crypto";
6
6
  // src/local/artifacts/feedback.ts
@@ -1,7 +1,7 @@
1
1
  import { l as Check, n as Hash, r as SnapshotSchema, t as CoreError, u as Type } from "./src-CRhxwFAN.mjs";
2
2
  import { a as artifactId, r as LocalId } from "./artifact-local-Bfy69a9H.mjs";
3
- import { t as Uuid } from "./api-D-iVy-AK.mjs";
4
- import { r as readBinding } from "./project-Ru88VeXP.mjs";
3
+ import { t as Uuid } from "./api-DNK2unOM.mjs";
4
+ import { i as readBinding } from "./project-Dq2SpWN5.mjs";
5
5
  // ../../packages/contracts/src/collaboration.ts
6
6
  const object = (properties) => Type.Object(properties, { additionalProperties: false });
7
7
  const text = (maxLength) => Type.String({
package/dist/index.mjs CHANGED
@@ -93,7 +93,7 @@ const help = [
93
93
  "artifact feedback list <id> [--after <cursor>] [--limit <1..100>]",
94
94
  "artifact feedback reply|resolve <id> <thread> --operation-id <uuid>",
95
95
  "connect [--server <origin>] [--project <path>] [--device-name <name>] [--replace] [--no-open]",
96
- "auth login|whoami|logout --server <origin> [--device-name <name>]",
96
+ "auth login|whoami|logout --server <origin> [--project <path>] [--device-name <name>]",
97
97
  "project link --server <origin> --project-id <uuid> [--replace] [--project <path>]",
98
98
  "project status [--project <path>]",
99
99
  "project migrate-directory [--project <root>]",
@@ -453,7 +453,7 @@ function parseArguments(raw) {
453
453
  "whoami",
454
454
  "logout"
455
455
  ].includes(action)) throw new CoreError("INVALID_ARGUMENT", "Expected auth login, whoami or logout");
456
- let server = "", deviceName = "Supekku CLI", json = false;
456
+ let project = process.cwd(), server = "", deviceName = "Supekku CLI", json = false;
457
457
  const seen = /* @__PURE__ */ new Set();
458
458
  for (let i = 2; i < raw.length; i++) {
459
459
  const key = raw[i];
@@ -463,9 +463,14 @@ function parseArguments(raw) {
463
463
  json = true;
464
464
  continue;
465
465
  }
466
- if (!["--server", "--device-name"].includes(key) || !raw[i + 1] || raw[i + 1].startsWith("--") || key === "--device-name" && action !== "login") throw new CoreError("INVALID_ARGUMENT", "Unexpected auth option");
466
+ if (![
467
+ "--server",
468
+ "--device-name",
469
+ "--project"
470
+ ].includes(key) || !raw[i + 1] || raw[i + 1].startsWith("--") || key === "--device-name" && action !== "login") throw new CoreError("INVALID_ARGUMENT", "Unexpected auth option");
467
471
  const value = raw[++i];
468
472
  if (key === "--server") server = value;
473
+ else if (key === "--project") project = value;
469
474
  else deviceName = value;
470
475
  }
471
476
  if (!server) throw new CoreError("INVALID_ARGUMENT", "Specify --server <origin>");
@@ -474,6 +479,7 @@ function parseArguments(raw) {
474
479
  args: [],
475
480
  json,
476
481
  waitMs: 0,
482
+ project,
477
483
  remote: {
478
484
  server,
479
485
  deviceName
@@ -618,13 +624,12 @@ try {
618
624
  let data;
619
625
  if (command === "status") {
620
626
  const { packageIdentity } = await import("./package-Dg68Av6x.mjs");
621
- const { projectSummary } = await import("./status-BzK0I8Ni.mjs");
627
+ const { projectSummary } = await import("./status-BzYrPSRi.mjs");
622
628
  const remoteCheck = parsed.reportRemote ? async (root) => {
623
- const { projectStatus, readBinding } = await import("./project-JhzSd3ia.mjs");
629
+ const { projectStatus, readBinding } = await import("./project-Cp0fxWoh.mjs");
624
630
  if (!(await readBinding(root)).binding) return { remote: { state: "unbound" } };
625
- const { createConnection } = await import("./connection-BXfXx-wo.mjs");
626
- const { credentials } = await import("./credentials-CxkhjmnO.mjs");
627
- return projectStatus(root, createConnection({ store: credentials }).identity);
631
+ const { boundConnection } = await import("./project-connection-09JC8T7M.mjs");
632
+ return projectStatus(root, (await boundConnection(root)).identity);
628
633
  } : void 0;
629
634
  data = await projectSummary(parsed.project ?? process.cwd(), args[0], await packageIdentity(), remoteCheck);
630
635
  if (!data.complete) process.exitCode = 2;
@@ -676,14 +681,11 @@ try {
676
681
  data = await changeCommand(command, args, parsed.project ?? process.cwd());
677
682
  if (command === "change validate" && !data.valid) process.exitCode = 2;
678
683
  } else if (command === "connect" && parsed.connectOptions) {
679
- const { createConnection } = await import("./connection-BXfXx-wo.mjs");
680
- const { credentials } = await import("./credentials-CxkhjmnO.mjs");
681
- const { connectProject } = await import("./connect-BzygwM5L.mjs");
682
- const { handoffBrowser } = await import("./browser-xnEH9tG1.mjs");
683
- const connection = createConnection({ store: credentials });
684
+ const { connectIsolatedProject } = await import("./project-connection-09JC8T7M.mjs");
685
+ const { handoffBrowser } = await import("./browser-ZZZ9iv0U.mjs");
684
686
  let handoff = Promise.resolve();
685
687
  try {
686
- data = await connectProject(parsed.project, parsed.connectOptions, connection, (notice) => {
688
+ data = await connectIsolatedProject(parsed.project, parsed.connectOptions, (notice) => {
687
689
  handoff = handoffBrowser(new URL(notice.verificationUri).origin, notice, parsed.connectOptions.noOpen, (event) => {
688
690
  process.stderr.write(json ? JSON.stringify(event) + "\n" : event.event === "device_authorization" ? "請在瀏覽器選擇專案並授權:" + event.verificationUri + "\n驗證碼:" + event.userCode + "\n" : "無法自動開啟瀏覽器,請手動開啟上方網址。\n");
689
691
  });
@@ -692,35 +694,36 @@ try {
692
694
  await handoff;
693
695
  }
694
696
  } else if (command.startsWith("auth ") && parsed.remote) {
695
- const { createConnection } = await import("./connection-BXfXx-wo.mjs");
696
- const { credentials } = await import("./credentials-CxkhjmnO.mjs");
697
- const connection = createConnection({ store: credentials });
697
+ const { connectIsolatedProject, boundConnection } = await import("./project-connection-09JC8T7M.mjs");
698
+ const start = parsed.project ?? process.cwd();
698
699
  const { server, deviceName } = parsed.remote;
699
- data = command === "auth login" ? await connection.login(server, deviceName, (notice) => {
700
+ data = command === "auth login" ? await connectIsolatedProject(start, {
701
+ server,
702
+ deviceName
703
+ }, (notice) => {
700
704
  process.stderr.write(json ? JSON.stringify({
701
705
  event: "device_authorization",
702
706
  ...notice
703
707
  }) + "\n" : `Open ${notice.verificationUri} and enter code ${notice.userCode}\n`);
704
- }) : command === "auth whoami" ? await connection.identity(server) : await connection.logout(server);
708
+ }) : command === "auth whoami" ? await (await boundConnection(start)).identity(server) : await (await boundConnection(start)).logout(server);
705
709
  } else if (command === "project migrate-directory") {
706
710
  const { migrateDirectory } = await import("./project-directory-8to0Nbna.mjs");
707
711
  data = await migrateDirectory(parsed.project ?? process.cwd());
708
712
  } else if (command.startsWith("project ") && parsed.bindingOptions) {
709
- const { createConnection } = await import("./connection-BXfXx-wo.mjs");
710
- const { credentials } = await import("./credentials-CxkhjmnO.mjs");
711
- const { linkProject, projectStatus } = await import("./project-JhzSd3ia.mjs");
712
- const connection = createConnection({ store: credentials });
713
+ const { boundConnection } = await import("./project-connection-09JC8T7M.mjs");
714
+ const { linkProject, projectStatus } = await import("./project-Cp0fxWoh.mjs");
715
+ const identity = async (origin) => (await boundConnection(parsed.project)).identity(origin);
713
716
  const options = parsed.bindingOptions;
714
- data = command === "project link" ? await linkProject(parsed.project, options.server, options.projectId, options.replace, connection.identity) : await projectStatus(parsed.project, connection.identity);
717
+ data = command === "project link" ? await linkProject(parsed.project, options.server, options.projectId, options.replace, identity) : await projectStatus(parsed.project, identity);
715
718
  } else if (command.startsWith("artifact ")) {
716
- const { artifactCommand } = await import("./artifact-DpGEBZwh.mjs");
719
+ const { artifactCommand } = await import("./artifact-DcpnfU11.mjs");
717
720
  data = await artifactCommand(command.slice(9), args, parsed.project ?? process.cwd());
718
721
  } else if (command === "version") {
719
722
  const { packageIdentity } = await import("./package-Dg68Av6x.mjs");
720
723
  data = { version: (await packageIdentity()).version };
721
724
  } else if (command === "help") data = {
722
725
  commands: help,
723
- note: "Revision approval workflow retired. Discuss feedback with your Agent and publish a new version; use auth login, project link and artifact publish for explicit Web publication."
726
+ note: "Revision approval workflow retired. Discuss feedback with your Agent and publish a new version; use connect and artifact publish for explicit Web publication."
724
727
  };
725
728
  else if (command === "document check") data = inspect(await readMarkdown(args[0]));
726
729
  else if (command === "document prepare") data = {
@@ -771,7 +774,7 @@ try {
771
774
  const connected = data;
772
775
  process.stdout.write((connected.changed ? "已完成專案連接" : "已確認既有專案連接") + "\n帳號:" + connected.identity.user.name + "\n本機資料夾:" + connected.root + "\n網站:" + connected.binding.remote.origin + "\n專案:" + connected.binding.remote.projectId + "\n後續可直接由 Agent 使用此綁定;本次沒有發布 Artifact。\n");
773
776
  } else if (command === "version") process.stdout.write(data.version + "\n");
774
- else if (command === "help") process.stdout.write("Supekku — specifications, changes and Artifact feedback\n\n" + help.join("\n") + "\n\nRevision approval workflow retired. Discuss feedback with your Agent and publish a new version; use auth login, project link and artifact publish for explicit Web publication.\n");
777
+ else if (command === "help") process.stdout.write("Supekku — specifications, changes and Artifact feedback\n\n" + help.join("\n") + "\n\nRevision approval workflow retired. Discuss feedback with your Agent and publish a new version; use connect and artifact publish for explicit Web publication.\n");
775
778
  else if (command === "init") {
776
779
  const result = data;
777
780
  process.stdout.write(`${result.completed ? "初始化完成" : "初始化未完成"}\n專案:${result.root}\nSkills:${result.target}\n已完成:${result.completedStages.join(", ") || "無"}\n` + (result.error ? `${result.failedStage}: ${result.error.message}\n` : "") + result.next.join("\n") + "\n");
@@ -0,0 +1 @@
1
+ export { n as linkProject, r as projectStatus, i as readBinding } from "./project-Dq2SpWN5.mjs";
@@ -1,8 +1,8 @@
1
1
  import { t as CoreError } from "./src-CRhxwFAN.mjs";
2
2
  import { t as findProject } from "./project-directory-w_ITkI7O.mjs";
3
3
  import { a as withStore, o as withArtifactLock, t as artifactLocal } from "./store-jFj2Dhgl.mjs";
4
- import "./artifact-F8toITED.mjs";
5
- import { n as serverOrigin } from "./connection-DaxqQEdP.mjs";
4
+ import "./artifact-DB-BbLHN.mjs";
5
+ import { n as serverOrigin } from "./connection-jD5RlW1b.mjs";
6
6
  import { randomUUID } from "node:crypto";
7
7
  import { join } from "node:path";
8
8
  import { lstat, open, rename, unlink } from "node:fs/promises";
@@ -10,7 +10,7 @@ import { constants } from "node:fs";
10
10
  // src/remote/project.ts
11
11
  const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
12
12
  function invalid() {
13
- throw new CoreError("BINDING_INVALID", "Expected a regular schemaVersion 1 project binding with no extra fields");
13
+ throw new CoreError("BINDING_INVALID", "Expected a regular schemaVersion 1 or 2 project binding with no extra fields");
14
14
  }
15
15
  async function readBinding(root) {
16
16
  const file = join(root, ".supekku/project.json");
@@ -40,7 +40,7 @@ async function readBinding(root) {
40
40
  } catch {
41
41
  invalid();
42
42
  }
43
- if (!b || Object.keys(b).sort().join() !== "remote,repositoryId,schemaVersion" || b.schemaVersion !== 1 || typeof b.repositoryId !== "string" || !uuid.test(b.repositoryId) || !b.remote || Object.keys(b.remote).sort().join() !== "origin,projectId" || typeof b.remote.origin !== "string" || typeof b.remote.projectId !== "string" || !uuid.test(b.remote.projectId)) invalid();
43
+ if (!b || Object.keys(b).sort().join() !== (b.schemaVersion === 2 ? "credentialId,remote,repositoryId,schemaVersion" : "remote,repositoryId,schemaVersion") || ![1, 2].includes(b.schemaVersion) || b.schemaVersion === 2 && (typeof b.credentialId !== "string" || !uuid.test(b.credentialId)) || typeof b.repositoryId !== "string" || !uuid.test(b.repositoryId) || !b.remote || Object.keys(b.remote).sort().join() !== "origin,projectId" || typeof b.remote.origin !== "string" || typeof b.remote.projectId !== "string" || !uuid.test(b.remote.projectId)) invalid();
44
44
  try {
45
45
  if (serverOrigin(b.remote.origin) !== b.remote.origin) invalid();
46
46
  } catch {
@@ -104,13 +104,14 @@ async function linkProject(start, input, projectId, replace, identity, guard) {
104
104
  }
105
105
  return withArtifactLock(local, "operation", async () => {
106
106
  if ((await readBinding(root)).text !== original.text) throw new CoreError("BINDING_CONFLICT", "Binding changed during verification");
107
- if (same) return {
107
+ if (same && (!guard?.credentialId || original.binding?.credentialId === guard.credentialId)) return {
108
108
  root,
109
109
  binding: original.binding,
110
110
  changed: false
111
111
  };
112
112
  const binding = {
113
- schemaVersion: 1,
113
+ schemaVersion: guard?.credentialId ? 2 : 1,
114
+ ...guard?.credentialId ? { credentialId: guard.credentialId } : {},
114
115
  repositoryId: original.binding?.repositoryId ?? randomUUID(),
115
116
  remote: {
116
117
  origin,
@@ -149,4 +150,11 @@ async function linkProject(start, input, projectId, replace, identity, guard) {
149
150
  });
150
151
  });
151
152
  }
152
- export { projectStatus as n, readBinding as r, linkProject as t };
153
+ function bindingIdentity(b) {
154
+ return {
155
+ schemaVersion: 1,
156
+ repositoryId: b.repositoryId,
157
+ remote: b.remote
158
+ };
159
+ }
160
+ export { readBinding as i, linkProject as n, projectStatus as r, bindingIdentity as t };