wordspace 0.0.1 → 0.0.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.
@@ -0,0 +1 @@
1
+ export declare function init(force: boolean): Promise<void>;
@@ -0,0 +1,41 @@
1
+ import { checkSkills } from "../steps/check-skills.js";
2
+ import { installSkills } from "../steps/install-skills.js";
3
+ import { fetchWorkflows } from "../steps/fetch-workflows.js";
4
+ import { createSymlinks } from "../steps/create-symlinks.js";
5
+ import { setupClaude } from "../steps/setup-claude.js";
6
+ import { createDirs } from "../steps/create-dirs.js";
7
+ import * as log from "../lib/log.js";
8
+ export async function init(force) {
9
+ const cwd = process.cwd();
10
+ log.banner();
11
+ // Step 1: Check skills
12
+ log.step("1/6 Skills");
13
+ const hasSkills = checkSkills(cwd);
14
+ if (hasSkills && !force) {
15
+ log.skip("All skills already installed");
16
+ }
17
+ else {
18
+ installSkills(cwd);
19
+ }
20
+ // Step 2: Fetch workflows
21
+ log.step("2/6 Workflows");
22
+ await fetchWorkflows(cwd, force);
23
+ // Step 3: Create symlinks
24
+ log.step("3/6 Symlinks");
25
+ createSymlinks(cwd, force);
26
+ // Step 4: Setup Claude settings
27
+ log.step("4/6 Claude settings");
28
+ setupClaude(cwd);
29
+ // Step 5: Create directories
30
+ log.step("5/6 Directories");
31
+ createDirs(cwd);
32
+ // Step 6: Done
33
+ log.step("6/6 Done");
34
+ console.log(`
35
+ Your project is ready. Next steps:
36
+
37
+ 1. Open this directory in your editor
38
+ 2. Start Claude Code: claude
39
+ 3. Run a workflow: prose run workflows/<name>.prose
40
+ `);
41
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ import { init } from "./commands/init.js";
3
+ import * as log from "./lib/log.js";
4
+ const VERSION = "0.0.3";
5
+ const HELP = `
6
+ Usage: wordspace <command> [options]
7
+
8
+ Commands:
9
+ init Bootstrap a new wordspace project
10
+
11
+ Options:
12
+ --force Re-run all steps even if already completed
13
+ --help Show this help message
14
+ --version Show version number
15
+ `.trim();
16
+ async function main() {
17
+ const args = process.argv.slice(2);
18
+ if (args.includes("--help") || args.includes("-h")) {
19
+ console.log(HELP);
20
+ process.exit(0);
21
+ }
22
+ if (args.includes("--version") || args.includes("-v")) {
23
+ console.log(VERSION);
24
+ process.exit(0);
25
+ }
26
+ const command = args.find((a) => !a.startsWith("-"));
27
+ const force = args.includes("--force");
28
+ if (command === "init") {
29
+ await init(force);
30
+ }
31
+ else if (!command) {
32
+ console.log(HELP);
33
+ process.exit(0);
34
+ }
35
+ else {
36
+ log.error(`Unknown command: ${command}`);
37
+ console.log(HELP);
38
+ process.exit(1);
39
+ }
40
+ }
41
+ main().catch((err) => {
42
+ log.error(err.message);
43
+ process.exit(1);
44
+ });
@@ -0,0 +1,6 @@
1
+ export interface ExecOptions {
2
+ cwd?: string;
3
+ timeout?: number;
4
+ silent?: boolean;
5
+ }
6
+ export declare function exec(cmd: string, opts?: ExecOptions): string;
@@ -0,0 +1,21 @@
1
+ import { execSync } from "node:child_process";
2
+ import * as log from "./log.js";
3
+ export function exec(cmd, opts = {}) {
4
+ const { cwd = process.cwd(), timeout = 60_000, silent = false } = opts;
5
+ try {
6
+ const result = execSync(cmd, {
7
+ cwd,
8
+ timeout,
9
+ stdio: silent ? "pipe" : ["pipe", "pipe", "pipe"],
10
+ encoding: "utf-8",
11
+ });
12
+ return result.trim();
13
+ }
14
+ catch (err) {
15
+ const e = err;
16
+ const msg = e.stderr?.trim() || e.message || "Command failed";
17
+ log.error(`Command failed: ${cmd}`);
18
+ log.error(msg);
19
+ throw new Error(`exec failed: ${cmd}`);
20
+ }
21
+ }
@@ -0,0 +1,7 @@
1
+ export declare function info(msg: string): void;
2
+ export declare function success(msg: string): void;
3
+ export declare function warn(msg: string): void;
4
+ export declare function error(msg: string): void;
5
+ export declare function step(msg: string): void;
6
+ export declare function skip(msg: string): void;
7
+ export declare function banner(): void;
@@ -0,0 +1,30 @@
1
+ const noColor = !!process.env["NO_COLOR"];
2
+ const code = (n) => (noColor ? "" : `\x1b[${n}m`);
3
+ const reset = code(0);
4
+ const bold = code(1);
5
+ const dim = code(2);
6
+ const green = code(32);
7
+ const yellow = code(33);
8
+ const red = code(31);
9
+ const cyan = code(36);
10
+ export function info(msg) {
11
+ console.log(`${cyan}i${reset} ${msg}`);
12
+ }
13
+ export function success(msg) {
14
+ console.log(`${green}✓${reset} ${msg}`);
15
+ }
16
+ export function warn(msg) {
17
+ console.log(`${yellow}!${reset} ${msg}`);
18
+ }
19
+ export function error(msg) {
20
+ console.error(`${red}✗${reset} ${msg}`);
21
+ }
22
+ export function step(msg) {
23
+ console.log(`\n${bold}${msg}${reset}`);
24
+ }
25
+ export function skip(msg) {
26
+ console.log(`${dim}–${reset} ${dim}${msg}${reset}`);
27
+ }
28
+ export function banner() {
29
+ console.log(`\n${bold}wordspace init${reset}\n`);
30
+ }
@@ -0,0 +1,3 @@
1
+ declare const SKILLS: readonly ["open-prose", "agentwallet", "registry", "websh"];
2
+ export declare function checkSkills(cwd: string): boolean;
3
+ export { SKILLS };
@@ -0,0 +1,8 @@
1
+ import { existsSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ const SKILLS = ["open-prose", "agentwallet", "registry", "websh"];
4
+ export function checkSkills(cwd) {
5
+ const base = join(cwd, ".agents", "skills");
6
+ return SKILLS.every((s) => existsSync(join(base, s)));
7
+ }
8
+ export { SKILLS };
@@ -0,0 +1 @@
1
+ export declare function createDirs(cwd: string): void;
@@ -0,0 +1,7 @@
1
+ import { mkdirSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import * as log from "../lib/log.js";
4
+ export function createDirs(cwd) {
5
+ mkdirSync(join(cwd, "output"), { recursive: true });
6
+ log.success("Created output/ directory");
7
+ }
@@ -0,0 +1 @@
1
+ export declare function createSymlinks(cwd: string, force: boolean): void;
@@ -0,0 +1,30 @@
1
+ import { mkdirSync, symlinkSync, readlinkSync, lstatSync, unlinkSync, } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { SKILLS } from "./check-skills.js";
4
+ import * as log from "../lib/log.js";
5
+ export function createSymlinks(cwd, force) {
6
+ const skillsDir = join(cwd, "skills");
7
+ mkdirSync(skillsDir, { recursive: true });
8
+ for (const skill of SKILLS) {
9
+ const linkPath = join(skillsDir, skill);
10
+ const target = join("..", ".agents", "skills", skill);
11
+ // Check if symlink already exists and points to the right target
12
+ try {
13
+ const stat = lstatSync(linkPath);
14
+ if (stat.isSymbolicLink()) {
15
+ const existing = readlinkSync(linkPath);
16
+ if (existing === target && !force) {
17
+ log.skip(`skills/${skill} (exists)`);
18
+ continue;
19
+ }
20
+ // Remove stale or forced symlink
21
+ unlinkSync(linkPath);
22
+ }
23
+ }
24
+ catch {
25
+ // Does not exist — will create
26
+ }
27
+ symlinkSync(target, linkPath);
28
+ log.success(`skills/${skill} -> ${target}`);
29
+ }
30
+ }
@@ -0,0 +1 @@
1
+ export declare function fetchWorkflows(cwd: string, force: boolean): Promise<void>;
@@ -0,0 +1,78 @@
1
+ import { get as httpsGet } from "node:https";
2
+ import { mkdirSync, writeFileSync, existsSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import * as log from "../lib/log.js";
5
+ const CONTENTS_URL = "https://api.github.com/repos/frames-engineering/wordspace-demos/contents/workflows";
6
+ function httpGet(url, headers = {}) {
7
+ return new Promise((resolve, reject) => {
8
+ const allHeaders = {
9
+ "User-Agent": "wordspace-cli",
10
+ ...headers,
11
+ };
12
+ httpsGet(url, { headers: allHeaders }, (res) => {
13
+ // Follow redirects
14
+ if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location) {
15
+ httpGet(res.headers.location, headers).then(resolve, reject);
16
+ return;
17
+ }
18
+ if (res.statusCode !== 200) {
19
+ reject(new Error(`HTTP ${res.statusCode} for ${url}`));
20
+ return;
21
+ }
22
+ let data = "";
23
+ res.on("data", (chunk) => (data += chunk.toString()));
24
+ res.on("end", () => resolve(data));
25
+ res.on("error", reject);
26
+ }).on("error", reject);
27
+ });
28
+ }
29
+ function getAuthHeaders() {
30
+ const token = process.env["GITHUB_TOKEN"] || process.env["GH_TOKEN"];
31
+ if (token) {
32
+ return { Authorization: `Bearer ${token}` };
33
+ }
34
+ return {};
35
+ }
36
+ export async function fetchWorkflows(cwd, force) {
37
+ const workflowsDir = join(cwd, "workflows");
38
+ mkdirSync(workflowsDir, { recursive: true });
39
+ const headers = getAuthHeaders();
40
+ let entries;
41
+ try {
42
+ const body = await httpGet(CONTENTS_URL, headers);
43
+ entries = JSON.parse(body);
44
+ }
45
+ catch (err) {
46
+ log.warn(`Could not fetch workflow list from GitHub: ${err.message}`);
47
+ log.warn("Skipping workflow download (skills are the critical part).");
48
+ return;
49
+ }
50
+ const proseFiles = entries.filter((e) => e.name.endsWith(".prose"));
51
+ if (proseFiles.length === 0) {
52
+ log.warn("No .prose files found in workflows/");
53
+ return;
54
+ }
55
+ let downloaded = 0;
56
+ for (const file of proseFiles) {
57
+ const dest = join(workflowsDir, file.name);
58
+ if (existsSync(dest) && !force) {
59
+ log.skip(`${file.name} (exists)`);
60
+ continue;
61
+ }
62
+ try {
63
+ const content = await httpGet(file.download_url, headers);
64
+ writeFileSync(dest, content, "utf-8");
65
+ log.success(file.name);
66
+ downloaded++;
67
+ }
68
+ catch (err) {
69
+ log.warn(`Failed to download ${file.name}: ${err.message}`);
70
+ }
71
+ }
72
+ if (downloaded > 0) {
73
+ log.success(`Downloaded ${downloaded} workflow(s) to workflows/`);
74
+ }
75
+ else {
76
+ log.skip("All workflows already present");
77
+ }
78
+ }
@@ -0,0 +1 @@
1
+ export declare function installSkills(cwd: string): void;
@@ -0,0 +1,10 @@
1
+ import { exec } from "../lib/exec.js";
2
+ import * as log from "../lib/log.js";
3
+ export function installSkills(cwd) {
4
+ log.info("Installing skills via npx skills add...");
5
+ exec("npx -y skills add frames-engineering/skills -y", {
6
+ cwd,
7
+ timeout: 120_000,
8
+ });
9
+ log.success("Skills installed to .agents/skills/");
10
+ }
@@ -0,0 +1 @@
1
+ export declare function setupClaude(cwd: string): void;
@@ -0,0 +1,47 @@
1
+ import { mkdirSync, readFileSync, writeFileSync, existsSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import * as log from "../lib/log.js";
4
+ const BASE_PERMISSIONS = [
5
+ "Bash(curl:*)",
6
+ "Bash(python3:*)",
7
+ "WebFetch(domain:registry.mcpay.tech)",
8
+ "WebFetch(domain:frames.ag)",
9
+ "WebSearch",
10
+ ];
11
+ export function setupClaude(cwd) {
12
+ const claudeDir = join(cwd, ".claude");
13
+ mkdirSync(claudeDir, { recursive: true });
14
+ const settingsPath = join(claudeDir, "settings.local.json");
15
+ let settings = {};
16
+ if (existsSync(settingsPath)) {
17
+ try {
18
+ settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
19
+ }
20
+ catch {
21
+ log.warn("Could not parse existing settings.local.json, creating fresh");
22
+ settings = {};
23
+ }
24
+ }
25
+ if (!settings.permissions) {
26
+ settings.permissions = {};
27
+ }
28
+ if (!Array.isArray(settings.permissions.allow)) {
29
+ settings.permissions.allow = [];
30
+ }
31
+ // Merge base permissions (deduplicate)
32
+ const existing = new Set(settings.permissions.allow);
33
+ let added = 0;
34
+ for (const perm of BASE_PERMISSIONS) {
35
+ if (!existing.has(perm)) {
36
+ settings.permissions.allow.push(perm);
37
+ added++;
38
+ }
39
+ }
40
+ writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
41
+ if (added > 0) {
42
+ log.success(`Added ${added} permission(s) to .claude/settings.local.json`);
43
+ }
44
+ else {
45
+ log.skip("All base permissions already present");
46
+ }
47
+ }
package/package.json CHANGED
@@ -1,12 +1,21 @@
1
1
  {
2
2
  "name": "wordspace",
3
- "version": "0.0.1",
4
- "module": "index.ts",
3
+ "version": "0.0.3",
5
4
  "type": "module",
6
- "devDependencies": {
7
- "@types/bun": "latest"
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "bin": {
9
+ "wordspace": "./dist/index.js"
10
+ },
11
+ "scripts": {
12
+ "build": "tsc"
8
13
  },
9
- "peerDependencies": {
10
- "typescript": "^5"
14
+ "engines": {
15
+ "node": ">=18"
16
+ },
17
+ "devDependencies": {
18
+ "typescript": "^5",
19
+ "@types/node": "^22"
11
20
  }
12
21
  }
package/CLAUDE.md DELETED
@@ -1,111 +0,0 @@
1
- ---
2
- description: Use Bun instead of Node.js, npm, pnpm, or vite.
3
- globs: "*.ts, *.tsx, *.html, *.css, *.js, *.jsx, package.json"
4
- alwaysApply: false
5
- ---
6
-
7
- Default to using Bun instead of Node.js.
8
-
9
- - Use `bun <file>` instead of `node <file>` or `ts-node <file>`
10
- - Use `bun test` instead of `jest` or `vitest`
11
- - Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
12
- - Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
13
- - Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
14
- - Bun automatically loads .env, so don't use dotenv.
15
-
16
- ## APIs
17
-
18
- - `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
19
- - `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
20
- - `Bun.redis` for Redis. Don't use `ioredis`.
21
- - `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
22
- - `WebSocket` is built-in. Don't use `ws`.
23
- - Prefer `Bun.file` over `node:fs`'s readFile/writeFile
24
- - Bun.$`ls` instead of execa.
25
-
26
- ## Testing
27
-
28
- Use `bun test` to run tests.
29
-
30
- ```ts#index.test.ts
31
- import { test, expect } from "bun:test";
32
-
33
- test("hello world", () => {
34
- expect(1).toBe(1);
35
- });
36
- ```
37
-
38
- ## Frontend
39
-
40
- Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
41
-
42
- Server:
43
-
44
- ```ts#index.ts
45
- import index from "./index.html"
46
-
47
- Bun.serve({
48
- routes: {
49
- "/": index,
50
- "/api/users/:id": {
51
- GET: (req) => {
52
- return new Response(JSON.stringify({ id: req.params.id }));
53
- },
54
- },
55
- },
56
- // optional websocket support
57
- websocket: {
58
- open: (ws) => {
59
- ws.send("Hello, world!");
60
- },
61
- message: (ws, message) => {
62
- ws.send(message);
63
- },
64
- close: (ws) => {
65
- // handle close
66
- }
67
- },
68
- development: {
69
- hmr: true,
70
- console: true,
71
- }
72
- })
73
- ```
74
-
75
- HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.
76
-
77
- ```html#index.html
78
- <html>
79
- <body>
80
- <h1>Hello, world!</h1>
81
- <script type="module" src="./frontend.tsx"></script>
82
- </body>
83
- </html>
84
- ```
85
-
86
- With the following `frontend.tsx`:
87
-
88
- ```tsx#frontend.tsx
89
- import React from "react";
90
-
91
- // import .css files directly and it works
92
- import './index.css';
93
-
94
- import { createRoot } from "react-dom/client";
95
-
96
- const root = createRoot(document.body);
97
-
98
- export default function Frontend() {
99
- return <h1>Hello, world!</h1>;
100
- }
101
-
102
- root.render(<Frontend />);
103
- ```
104
-
105
- Then, run index.ts
106
-
107
- ```sh
108
- bun --hot ./index.ts
109
- ```
110
-
111
- For more information, read the Bun API docs in `node_modules/bun-types/docs/**.md`.
package/README.md DELETED
@@ -1,15 +0,0 @@
1
- # wordspace
2
-
3
- To install dependencies:
4
-
5
- ```bash
6
- bun install
7
- ```
8
-
9
- To run:
10
-
11
- ```bash
12
- bun run index.ts
13
- ```
14
-
15
- This project was created using `bun init` in bun v1.2.21. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
package/bun.lock DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "lockfileVersion": 1,
3
- "workspaces": {
4
- "": {
5
- "name": "wordspace",
6
- "devDependencies": {
7
- "@types/bun": "latest",
8
- },
9
- "peerDependencies": {
10
- "typescript": "^5",
11
- },
12
- },
13
- },
14
- "packages": {
15
- "@types/bun": ["@types/bun@1.3.9", "", { "dependencies": { "bun-types": "1.3.9" } }, "sha512-KQ571yULOdWJiMH+RIWIOZ7B2RXQGpL1YQrBtLIV3FqDcCu6FsbFUBwhdKUlCKUpS3PJDsHlJ1QKlpxoVR+xtw=="],
16
-
17
- "@types/node": ["@types/node@25.2.3", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-m0jEgYlYz+mDJZ2+F4v8D1AyQb+QzsNqRuI7xg1VQX/KlKS0qT9r1Mo16yo5F/MtifXFgaofIFsdFMox2SxIbQ=="],
18
-
19
- "bun-types": ["bun-types@1.3.9", "", { "dependencies": { "@types/node": "*" } }, "sha512-+UBWWOakIP4Tswh0Bt0QD0alpTY8cb5hvgiYeWCMet9YukHbzuruIEeXC2D7nMJPB12kbh8C7XJykSexEqGKJg=="],
20
-
21
- "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
22
-
23
- "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
24
- }
25
- }
package/index.ts DELETED
@@ -1 +0,0 @@
1
- console.log("Hello via Bun!");
package/tsconfig.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- // Environment setup & latest features
4
- "lib": ["ESNext"],
5
- "target": "ESNext",
6
- "module": "Preserve",
7
- "moduleDetection": "force",
8
- "jsx": "react-jsx",
9
- "allowJs": true,
10
-
11
- // Bundler mode
12
- "moduleResolution": "bundler",
13
- "allowImportingTsExtensions": true,
14
- "verbatimModuleSyntax": true,
15
- "noEmit": true,
16
-
17
- // Best practices
18
- "strict": true,
19
- "skipLibCheck": true,
20
- "noFallthroughCasesInSwitch": true,
21
- "noUncheckedIndexedAccess": true,
22
- "noImplicitOverride": true,
23
-
24
- // Some stricter flags (disabled by default)
25
- "noUnusedLocals": false,
26
- "noUnusedParameters": false,
27
- "noPropertyAccessFromIndexSignature": false
28
- }
29
- }