snowcode 0.9.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.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # Snowcode
2
+
3
+ Snowcode is a multi-provider coding CLI.
4
+
5
+ ## CLI
6
+
7
+ Install globally from npm:
8
+
9
+ ```bash
10
+ npm install -g snowcode
11
+ snowcode
12
+ ```
13
+
14
+ For local development from this repo:
15
+
16
+ ```bash
17
+ bun run build
18
+ node dist/cli.mjs
19
+ ```
20
+
21
+ Useful scripts:
22
+
23
+ ```bash
24
+ npm run install:global
25
+ npm run link:global
26
+ npm run unlink:global
27
+ ```
28
+
29
+ ## Release
30
+
31
+ - Push tags like `v0.9.1` to trigger the npm publish workflow.
32
+ - Set `NPM_TOKEN` in GitHub repository secrets before using the workflow.
@@ -0,0 +1,7 @@
1
+ import { join } from 'path'
2
+ import { pathToFileURL } from 'url'
3
+
4
+ export function getDistImportSpecifier(baseDir) {
5
+ const distPath = join(baseDir, '..', 'dist', 'cli.mjs')
6
+ return pathToFileURL(distPath).href
7
+ }
@@ -0,0 +1,13 @@
1
+ import assert from 'node:assert/strict'
2
+ import test from 'node:test'
3
+
4
+ import { getDistImportSpecifier } from './import-specifier.mjs'
5
+
6
+ test('builds a file URL import specifier for dist/cli.mjs', () => {
7
+ const specifier = getDistImportSpecifier('C:\\repo\\bin')
8
+
9
+ assert.equal(
10
+ specifier,
11
+ 'file:///C:/repo/dist/cli.mjs',
12
+ )
13
+ })
package/bin/snowcode ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * snowcode — It's cold outside, isn't it?
5
+ *
6
+ * If dist/cli.mjs exists (built), run that.
7
+ * Otherwise, tell the user to build first or use `bun run dev`.
8
+ */
9
+
10
+ import { existsSync } from "fs";
11
+ import { join, dirname } from "path";
12
+ import { fileURLToPath, pathToFileURL } from "url";
13
+
14
+ const __dirname = dirname(fileURLToPath(import.meta.url));
15
+ const distPath = join(__dirname, "..", "dist", "cli.mjs");
16
+
17
+ if (existsSync(distPath)) {
18
+ await import(pathToFileURL(distPath).href);
19
+ } else {
20
+ console.error(`
21
+ snowcode: dist/cli.mjs not found.
22
+
23
+ Build first:
24
+ bun run build
25
+
26
+ Or run directly with Bun:
27
+ bun run dev
28
+
29
+ See README.md for setup instructions.
30
+ `);
31
+ process.exit(1);
32
+ }
@@ -0,0 +1,4 @@
1
+ @echo off
2
+ setlocal
3
+ set SCRIPT_DIR=%~dp0
4
+ node "%SCRIPT_DIR%..\dist\cli.mjs" %*