@ahmednawaz/crank 0.1.2
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/.env.example +53 -0
- package/README.md +266 -0
- package/bin/crank.js +737 -0
- package/bookmarklet/crank-bookmarklet.js +2295 -0
- package/bookmarklet/crank-ui-helpers.js +355 -0
- package/bookmarklet/install-snippet.txt +5 -0
- package/bookmarklet/text-source.js +239 -0
- package/companion/agent-queue.js +485 -0
- package/companion/agent-runner.js +334 -0
- package/companion/bin/crank.js +69 -0
- package/companion/dev-loader.js +39 -0
- package/companion/glean-client.js +991 -0
- package/companion/package.json +18 -0
- package/companion/persist-apply.js +189 -0
- package/companion/selection-store.js +175 -0
- package/companion/server.js +1147 -0
- package/companion/text-dispatch.js +419 -0
- package/companion/vizpatch-bridge.js +49 -0
- package/lib/copy-labels.js +86 -0
- package/lib/detect.js +88 -0
- package/lib/env.js +23 -0
- package/lib/init.js +435 -0
- package/lib/load-team-env.js +43 -0
- package/lib/resolve-project.js +203 -0
- package/lib/team-auth.js +82 -0
- package/lib/urls.js +164 -0
- package/mcp-server/index.js +174 -0
- package/mcp-server/package.json +16 -0
- package/mcp-server/tools.js +480 -0
- package/package.json +57 -0
- package/panel/demo.html +62 -0
- package/skill/SKILL.md +60 -0
- package/skills/README.md +16 -0
- package/skills/copy-guidance.md +25 -0
- package/team.env +4 -0
- package/vite.js +75 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Crank — product copy guidance
|
|
2
|
+
|
|
3
|
+
Internal Motive guidance for Glean copy iterations. Keep tone professional and concise.
|
|
4
|
+
|
|
5
|
+
## Principles
|
|
6
|
+
|
|
7
|
+
1. Prefer short, scannable labels over marketing fluff.
|
|
8
|
+
2. Use active voice for CTAs (`Save changes`, not `Changes can be saved`).
|
|
9
|
+
3. Match surrounding UI vocabulary; do not invent parallel terms for the same concept.
|
|
10
|
+
4. Preserve meaning when shortening — never drop required legal/safety caveats.
|
|
11
|
+
5. Prefer sentence case for body and buttons unless the surface already uses title case.
|
|
12
|
+
6. Avoid banned fluff: seamless, robust, leverage, utilize, delve, elevate.
|
|
13
|
+
|
|
14
|
+
## Variant intents Glean should cover
|
|
15
|
+
|
|
16
|
+
When asked for 3–4 options, aim for distinct intents such as:
|
|
17
|
+
|
|
18
|
+
1. **Concise** — shorten without losing meaning
|
|
19
|
+
2. **Clearer** — reduce ambiguity for first-time users
|
|
20
|
+
3. **Actionable** — strengthen verbs / CTAs
|
|
21
|
+
4. **On-brand / product tone** — align with Motive product register
|
|
22
|
+
|
|
23
|
+
## Output shape
|
|
24
|
+
|
|
25
|
+
For each variant, return updated text for every selected text node (`path` + `text`), not a single blob. The bookmarklet applies node-by-node.
|
package/team.env
ADDED
package/vite.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { env } = require('./lib/env');
|
|
6
|
+
const { readRuntimeManifest } = require('./lib/urls');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Vite / Rolldown-vite / Vitest-compatible plugin.
|
|
10
|
+
* Injects Crank into the app during `vite` / `npm run dev` — no bookmarklet needed.
|
|
11
|
+
*
|
|
12
|
+
* // vite.config.ts
|
|
13
|
+
* import { crank } from 'crank/vite'
|
|
14
|
+
* export default { plugins: [crank()] }
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
function findProjectRoot(startDir) {
|
|
18
|
+
let dir = path.resolve(startDir || process.cwd());
|
|
19
|
+
for (let i = 0; i < 8; i++) {
|
|
20
|
+
if (fs.existsSync(path.join(dir, '.crank', 'runtime.json'))) {
|
|
21
|
+
return dir;
|
|
22
|
+
}
|
|
23
|
+
if (fs.existsSync(path.join(dir, 'package.json'))) {
|
|
24
|
+
return dir;
|
|
25
|
+
}
|
|
26
|
+
const parent = path.dirname(dir);
|
|
27
|
+
if (parent === dir) break;
|
|
28
|
+
dir = parent;
|
|
29
|
+
}
|
|
30
|
+
return path.resolve(startDir || process.cwd());
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function resolveCompanionLoaderUrl(options = {}) {
|
|
34
|
+
const projectRoot = options.projectRoot || findProjectRoot(process.cwd());
|
|
35
|
+
const runtime = readRuntimeManifest(projectRoot);
|
|
36
|
+
if (runtime?.companion?.devLoader) {
|
|
37
|
+
return runtime.companion.devLoader;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const publicUrl = (
|
|
41
|
+
options.companionUrl ||
|
|
42
|
+
env('PUBLIC_URL', '') ||
|
|
43
|
+
''
|
|
44
|
+
).replace(/\/$/, '');
|
|
45
|
+
|
|
46
|
+
const port = String(options.port || env('PORT', '3344')).replace(/[^0-9]/g, '') || '3344';
|
|
47
|
+
const host = options.host || env('HOST', '127.0.0.1');
|
|
48
|
+
const base = publicUrl || `http://${host === '0.0.0.0' ? '127.0.0.1' : host}:${port}`;
|
|
49
|
+
return `${base}/dev-loader.js`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function crank(options = {}) {
|
|
53
|
+
const src = resolveCompanionLoaderUrl(options);
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
name: 'crank-dev-loader',
|
|
57
|
+
apply: 'serve',
|
|
58
|
+
transformIndexHtml(html) {
|
|
59
|
+
if (String(html).includes('/dev-loader.js') || String(html).includes('crank/dev-loader')) {
|
|
60
|
+
return html;
|
|
61
|
+
}
|
|
62
|
+
const tag = `<script src="${src}" defer></script>`;
|
|
63
|
+
if (html.includes('</head>')) {
|
|
64
|
+
return html.replace('</head>', ` ${tag}\n</head>`);
|
|
65
|
+
}
|
|
66
|
+
return `${tag}\n${html}`;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
module.exports = {
|
|
72
|
+
crank,
|
|
73
|
+
crankDevLoader: crank,
|
|
74
|
+
resolveCompanionLoaderUrl
|
|
75
|
+
};
|