reffy-cli 0.7.0 → 1.0.0

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.
@@ -0,0 +1,8 @@
1
+ import { type WorkspaceState } from "./refs-paths.js";
2
+ export interface WorkspacePreparationResult {
3
+ state: WorkspaceState;
4
+ migrated: boolean;
5
+ created: boolean;
6
+ message?: string;
7
+ }
8
+ export declare function prepareCanonicalWorkspace(repoRoot: string): Promise<WorkspacePreparationResult>;
@@ -0,0 +1,51 @@
1
+ import { promises as fs } from "node:fs";
2
+ import path from "node:path";
3
+ import { DEFAULT_REFS_DIRNAME, LEGACY_REFS_DIRNAME, detectWorkspaceState, resolveCanonicalRefsDir, } from "./refs-paths.js";
4
+ async function pathExists(targetPath) {
5
+ try {
6
+ await fs.access(targetPath);
7
+ return true;
8
+ }
9
+ catch {
10
+ return false;
11
+ }
12
+ }
13
+ async function ensureCanonicalStructure(repoRoot) {
14
+ const refsDir = resolveCanonicalRefsDir(repoRoot);
15
+ const artifactsDir = path.join(refsDir, "artifacts");
16
+ const manifestPath = path.join(refsDir, "manifest.json");
17
+ let created = false;
18
+ if (!(await pathExists(refsDir))) {
19
+ created = true;
20
+ }
21
+ await fs.mkdir(artifactsDir, { recursive: true });
22
+ if (!(await pathExists(manifestPath))) {
23
+ const now = new Date().toISOString();
24
+ await fs.writeFile(manifestPath, JSON.stringify({
25
+ version: 1,
26
+ created_at: now,
27
+ updated_at: now,
28
+ artifacts: [],
29
+ }, null, 2), "utf8");
30
+ }
31
+ return created;
32
+ }
33
+ export async function prepareCanonicalWorkspace(repoRoot) {
34
+ const current = detectWorkspaceState(repoRoot);
35
+ if (current.mode === "legacy") {
36
+ await fs.rename(current.legacyDir, current.canonicalDir);
37
+ const state = detectWorkspaceState(repoRoot);
38
+ return {
39
+ state,
40
+ migrated: true,
41
+ created: false,
42
+ message: `Migrated ${LEGACY_REFS_DIRNAME}/ to ${DEFAULT_REFS_DIRNAME}/`,
43
+ };
44
+ }
45
+ const created = await ensureCanonicalStructure(repoRoot);
46
+ return {
47
+ state: detectWorkspaceState(repoRoot),
48
+ migrated: false,
49
+ created,
50
+ };
51
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "reffy-cli",
3
- "version": "0.7.0",
3
+ "version": "1.0.0",
4
4
  "description": "CLI-first, framework-agnostic references workflow for any repo (TypeScript)",
5
5
  "keywords": [
6
6
  "reffy",
7
- "openspec",
7
+ "reffyspec",
8
8
  "specs",
9
9
  "cli",
10
10
  "ai",