studiograph 1.1.2 → 1.2.0-beta.1
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/LICENSE +191 -0
- package/README.md +301 -10
- package/dist/agent/orchestrator.d.ts +17 -9
- package/dist/agent/orchestrator.js +142 -97
- package/dist/agent/orchestrator.js.map +1 -1
- package/dist/agent/prompts/system.md +186 -0
- package/dist/agent/skill-loader.d.ts +48 -0
- package/dist/agent/skill-loader.js +166 -0
- package/dist/agent/skill-loader.js.map +1 -0
- package/dist/agent/skills/enrich-entities.md +136 -0
- package/dist/agent/skills/entity-schema.md +502 -0
- package/dist/agent/skills/gather-context.md +46 -0
- package/dist/agent/skills/obsidian-source-setup.md +246 -0
- package/dist/agent/skills/skill-loader.d.ts +48 -0
- package/dist/agent/skills/skill-loader.js +166 -0
- package/dist/agent/skills/skill-loader.js.map +1 -0
- package/dist/agent/skills/sync-configuration.md +144 -0
- package/dist/agent/skills/sync-setup.md +68 -0
- package/dist/agent/tools/connector-tools.d.ts +37 -0
- package/dist/agent/tools/connector-tools.js +132 -0
- package/dist/agent/tools/connector-tools.js.map +1 -0
- package/dist/agent/tools/fs-tools.d.ts +39 -0
- package/dist/agent/tools/fs-tools.js +106 -0
- package/dist/agent/tools/fs-tools.js.map +1 -0
- package/dist/agent/tools/graph-tools.d.ts +30 -2
- package/dist/agent/tools/graph-tools.js +154 -37
- package/dist/agent/tools/graph-tools.js.map +1 -1
- package/dist/agent/tools/load-skill.d.ts +42 -0
- package/dist/agent/tools/load-skill.js +45 -0
- package/dist/agent/tools/load-skill.js.map +1 -0
- package/dist/agent/tools/sync-tools.d.ts +25 -0
- package/dist/agent/tools/sync-tools.js +691 -0
- package/dist/agent/tools/sync-tools.js.map +1 -0
- package/dist/agent/tools/tool-loader.d.ts +25 -0
- package/dist/agent/tools/tool-loader.js +73 -0
- package/dist/agent/tools/tool-loader.js.map +1 -0
- package/dist/auth/github.d.ts +11 -8
- package/dist/auth/github.js +56 -75
- package/dist/auth/github.js.map +1 -1
- package/dist/cli/colors.d.ts +54 -0
- package/dist/cli/colors.js +133 -0
- package/dist/cli/colors.js.map +1 -0
- package/dist/cli/commands/app.d.ts +7 -0
- package/dist/cli/commands/app.js +167 -0
- package/dist/cli/commands/app.js.map +1 -0
- package/dist/cli/commands/auth.d.ts +1 -1
- package/dist/cli/commands/auth.js +26 -10
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/clone.d.ts +9 -0
- package/dist/cli/commands/clone.js +167 -0
- package/dist/cli/commands/clone.js.map +1 -0
- package/dist/cli/commands/commit.d.ts +8 -0
- package/dist/cli/commands/commit.js +43 -0
- package/dist/cli/commands/commit.js.map +1 -0
- package/dist/cli/commands/config.d.ts +13 -0
- package/dist/cli/commands/config.js +276 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/connector.d.ts +33 -0
- package/dist/cli/commands/connector.js +178 -0
- package/dist/cli/commands/connector.js.map +1 -0
- package/dist/cli/commands/deploy.d.ts +11 -0
- package/dist/cli/commands/deploy.js +153 -0
- package/dist/cli/commands/deploy.js.map +1 -0
- package/dist/cli/commands/enrich.d.ts +11 -0
- package/dist/cli/commands/enrich.js +135 -0
- package/dist/cli/commands/enrich.js.map +1 -0
- package/dist/cli/commands/graphrag.d.ts +12 -0
- package/dist/cli/commands/graphrag.js +122 -0
- package/dist/cli/commands/graphrag.js.map +1 -0
- package/dist/cli/commands/index.d.ts +15 -0
- package/dist/cli/commands/index.js +117 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/init.js +110 -210
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/join.js +89 -24
- package/dist/cli/commands/join.js.map +1 -1
- package/dist/cli/commands/lint.d.ts +8 -0
- package/dist/cli/commands/lint.js +70 -0
- package/dist/cli/commands/lint.js.map +1 -0
- package/dist/cli/commands/mcp.d.ts +27 -0
- package/dist/cli/commands/mcp.js +56 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/orphans.d.ts +8 -0
- package/dist/cli/commands/orphans.js +125 -0
- package/dist/cli/commands/orphans.js.map +1 -0
- package/dist/cli/commands/provision.d.ts +8 -0
- package/dist/cli/commands/provision.js +116 -0
- package/dist/cli/commands/provision.js.map +1 -0
- package/dist/cli/commands/r2.d.ts +2 -0
- package/dist/cli/commands/r2.js +87 -6
- package/dist/cli/commands/r2.js.map +1 -1
- package/dist/cli/commands/reset.d.ts +12 -0
- package/dist/cli/commands/reset.js +137 -0
- package/dist/cli/commands/reset.js.map +1 -0
- package/dist/cli/commands/review.d.ts +19 -0
- package/dist/cli/commands/review.js +128 -0
- package/dist/cli/commands/review.js.map +1 -0
- package/dist/cli/commands/serve.js +47 -2
- package/dist/cli/commands/serve.js.map +1 -1
- package/dist/cli/commands/source.d.ts +16 -0
- package/dist/cli/commands/source.js +159 -0
- package/dist/cli/commands/source.js.map +1 -0
- package/dist/cli/commands/start.js +472 -103
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/sync-entities.d.ts +13 -0
- package/dist/cli/commands/sync-entities.js +242 -0
- package/dist/cli/commands/sync-entities.js.map +1 -0
- package/dist/cli/commands/sync.js +40 -9
- package/dist/cli/commands/sync.js.map +1 -1
- package/dist/cli/commands/update.d.ts +8 -0
- package/dist/cli/commands/update.js +155 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/index.js +114 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/scaffolding.d.ts +10 -0
- package/dist/cli/scaffolding.js +302 -0
- package/dist/cli/scaffolding.js.map +1 -0
- package/dist/cli/setup-wizard.d.ts +30 -0
- package/dist/cli/setup-wizard.js +244 -0
- package/dist/cli/setup-wizard.js.map +1 -0
- package/dist/cli/sync-review-interactive.d.ts +31 -0
- package/dist/cli/sync-review-interactive.js +393 -0
- package/dist/cli/sync-review-interactive.js.map +1 -0
- package/dist/cli/theme.d.ts +31 -0
- package/dist/cli/theme.js +116 -0
- package/dist/cli/theme.js.map +1 -0
- package/dist/core/graph.d.ts +16 -9
- package/dist/core/graph.js +263 -145
- package/dist/core/graph.js.map +1 -1
- package/dist/core/migration-runner.d.ts +42 -0
- package/dist/core/migration-runner.js +232 -0
- package/dist/core/migration-runner.js.map +1 -0
- package/dist/core/migration-types.d.ts +101 -0
- package/dist/core/migration-types.js +21 -0
- package/dist/core/migration-types.js.map +1 -0
- package/dist/core/migrations/20260219-formalize-memory-location.d.ts +2 -0
- package/dist/core/migrations/20260219-formalize-memory-location.js +35 -0
- package/dist/core/migrations/20260219-formalize-memory-location.js.map +1 -0
- package/dist/core/migrations/20260220-add-workspace-metadata.d.ts +12 -0
- package/dist/core/migrations/20260220-add-workspace-metadata.js +65 -0
- package/dist/core/migrations/20260220-add-workspace-metadata.js.map +1 -0
- package/dist/core/migrations/20260220-add-workspace-readme.d.ts +11 -0
- package/dist/core/migrations/20260220-add-workspace-readme.js +82 -0
- package/dist/core/migrations/20260220-add-workspace-readme.js.map +1 -0
- package/dist/core/migrations/20260220-migrate-yaml-to-json.d.ts +9 -0
- package/dist/core/migrations/20260220-migrate-yaml-to-json.js +64 -0
- package/dist/core/migrations/20260220-migrate-yaml-to-json.js.map +1 -0
- package/dist/core/migrations/index.d.ts +11 -0
- package/dist/core/migrations/index.js +23 -0
- package/dist/core/migrations/index.js.map +1 -0
- package/dist/core/schema-registry.d.ts +36 -0
- package/dist/core/schema-registry.js +161 -0
- package/dist/core/schema-registry.js.map +1 -0
- package/dist/core/types.d.ts +242 -3
- package/dist/core/types.js +21 -2
- package/dist/core/types.js.map +1 -1
- package/dist/core/user-config.d.ts +16 -0
- package/dist/core/user-config.js +8 -0
- package/dist/core/user-config.js.map +1 -1
- package/dist/core/validation.d.ts +973 -32
- package/dist/core/validation.js +163 -4
- package/dist/core/validation.js.map +1 -1
- package/dist/core/workspace-manager.d.ts +26 -2
- package/dist/core/workspace-manager.js +113 -15
- package/dist/core/workspace-manager.js.map +1 -1
- package/dist/core/workspace.d.ts +20 -11
- package/dist/core/workspace.js +123 -34
- package/dist/core/workspace.js.map +1 -1
- package/dist/mcp/connector-manager.d.ts +65 -0
- package/dist/mcp/connector-manager.js +223 -0
- package/dist/mcp/connector-manager.js.map +1 -0
- package/dist/mcp/connectors/asana.d.ts +2 -0
- package/dist/mcp/connectors/asana.js +20 -0
- package/dist/mcp/connectors/asana.js.map +1 -0
- package/dist/mcp/connectors/definitions.d.ts +45 -0
- package/dist/mcp/connectors/definitions.js +32 -0
- package/dist/mcp/connectors/definitions.js.map +1 -0
- package/dist/mcp/connectors/figma.d.ts +5 -0
- package/dist/mcp/connectors/figma.js +21 -0
- package/dist/mcp/connectors/figma.js.map +1 -0
- package/dist/mcp/connectors/gdrive.d.ts +2 -0
- package/dist/mcp/connectors/gdrive.js +20 -0
- package/dist/mcp/connectors/gdrive.js.map +1 -0
- package/dist/mcp/connectors/granola.d.ts +2 -0
- package/dist/mcp/connectors/granola.js +12 -0
- package/dist/mcp/connectors/granola.js.map +1 -0
- package/dist/mcp/connectors/linear.d.ts +2 -0
- package/dist/mcp/connectors/linear.js +19 -0
- package/dist/mcp/connectors/linear.js.map +1 -0
- package/dist/mcp/connectors/obsidian.d.ts +2 -0
- package/dist/mcp/connectors/obsidian.js +19 -0
- package/dist/mcp/connectors/obsidian.js.map +1 -0
- package/dist/mcp/connectors/pipedrive.d.ts +2 -0
- package/dist/mcp/connectors/pipedrive.js +20 -0
- package/dist/mcp/connectors/pipedrive.js.map +1 -0
- package/dist/mcp/connectors/slack.d.ts +2 -0
- package/dist/mcp/connectors/slack.js +21 -0
- package/dist/mcp/connectors/slack.js.map +1 -0
- package/dist/mcp/oauth-provider.d.ts +41 -0
- package/dist/mcp/oauth-provider.js +160 -0
- package/dist/mcp/oauth-provider.js.map +1 -0
- package/dist/mcp/server.d.ts +11 -0
- package/dist/mcp/server.js +28 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +14 -0
- package/dist/mcp/tools.js +172 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/server/index.js +17 -4
- package/dist/server/index.js.map +1 -1
- package/dist/server/plugin-loader.d.ts +15 -0
- package/dist/server/plugin-loader.js +68 -2
- package/dist/server/plugin-loader.js.map +1 -1
- package/dist/server/routes/graph-api.js +1 -1
- package/dist/server/routes/graph-api.js.map +1 -1
- package/dist/server/routes/webhook.js +33 -0
- package/dist/server/routes/webhook.js.map +1 -1
- package/dist/services/github-provisioner.d.ts +9 -3
- package/dist/services/github-provisioner.js +46 -8
- package/dist/services/github-provisioner.js.map +1 -1
- package/dist/services/lint-service.d.ts +27 -0
- package/dist/services/lint-service.js +83 -0
- package/dist/services/lint-service.js.map +1 -0
- package/dist/services/markdown.d.ts +9 -0
- package/dist/services/markdown.js +26 -5
- package/dist/services/markdown.js.map +1 -1
- package/dist/services/memory-service.d.ts +1 -2
- package/dist/services/memory-service.js +5 -4
- package/dist/services/memory-service.js.map +1 -1
- package/dist/services/orphan-service.d.ts +31 -0
- package/dist/services/orphan-service.js +100 -0
- package/dist/services/orphan-service.js.map +1 -0
- package/dist/services/sync/commit.d.ts +58 -0
- package/dist/services/sync/commit.js +350 -0
- package/dist/services/sync/commit.js.map +1 -0
- package/dist/services/sync/context-index.d.ts +69 -0
- package/dist/services/sync/context-index.js +280 -0
- package/dist/services/sync/context-index.js.map +1 -0
- package/dist/services/sync/derive.d.ts +34 -0
- package/dist/services/sync/derive.js +164 -0
- package/dist/services/sync/derive.js.map +1 -0
- package/dist/services/sync/enrichment-state.d.ts +31 -0
- package/dist/services/sync/enrichment-state.js +63 -0
- package/dist/services/sync/enrichment-state.js.map +1 -0
- package/dist/services/sync/enrichment.d.ts +25 -0
- package/dist/services/sync/enrichment.js +121 -0
- package/dist/services/sync/enrichment.js.map +1 -0
- package/dist/services/sync/frontmatter-extractor.d.ts +40 -0
- package/dist/services/sync/frontmatter-extractor.js +273 -0
- package/dist/services/sync/frontmatter-extractor.js.map +1 -0
- package/dist/services/sync/graph-match-state.d.ts +33 -0
- package/dist/services/sync/graph-match-state.js +61 -0
- package/dist/services/sync/graph-match-state.js.map +1 -0
- package/dist/services/sync/graph-match.d.ts +53 -0
- package/dist/services/sync/graph-match.js +316 -0
- package/dist/services/sync/graph-match.js.map +1 -0
- package/dist/services/sync/graphrag-client.d.ts +43 -0
- package/dist/services/sync/graphrag-client.js +94 -0
- package/dist/services/sync/graphrag-client.js.map +1 -0
- package/dist/services/sync/graphrag-config.d.ts +16 -0
- package/dist/services/sync/graphrag-config.js +39 -0
- package/dist/services/sync/graphrag-config.js.map +1 -0
- package/dist/services/sync/graphrag-context.d.ts +14 -0
- package/dist/services/sync/graphrag-context.js +109 -0
- package/dist/services/sync/graphrag-context.js.map +1 -0
- package/dist/services/sync/graphrag-indexer.d.ts +30 -0
- package/dist/services/sync/graphrag-indexer.js +358 -0
- package/dist/services/sync/graphrag-indexer.js.map +1 -0
- package/dist/services/sync/llm.d.ts +32 -0
- package/dist/services/sync/llm.js +115 -0
- package/dist/services/sync/llm.js.map +1 -0
- package/dist/services/sync/mcp-client.d.ts +59 -0
- package/dist/services/sync/mcp-client.js +285 -0
- package/dist/services/sync/mcp-client.js.map +1 -0
- package/dist/services/sync/model-factory.d.ts +10 -0
- package/dist/services/sync/model-factory.js +24 -0
- package/dist/services/sync/model-factory.js.map +1 -0
- package/dist/services/sync/name-quality.d.ts +31 -0
- package/dist/services/sync/name-quality.js +60 -0
- package/dist/services/sync/name-quality.js.map +1 -0
- package/dist/services/sync/output-schemas.d.ts +92 -0
- package/dist/services/sync/output-schemas.js +43 -0
- package/dist/services/sync/output-schemas.js.map +1 -0
- package/dist/services/sync/prompts.d.ts +19 -0
- package/dist/services/sync/prompts.js +128 -0
- package/dist/services/sync/prompts.js.map +1 -0
- package/dist/services/sync/reconciler.d.ts +48 -0
- package/dist/services/sync/reconciler.js +295 -0
- package/dist/services/sync/reconciler.js.map +1 -0
- package/dist/services/sync/source-config.d.ts +45 -0
- package/dist/services/sync/source-config.js +208 -0
- package/dist/services/sync/source-config.js.map +1 -0
- package/dist/services/sync/source-definitions/asana.d.ts +15 -0
- package/dist/services/sync/source-definitions/asana.js +48 -0
- package/dist/services/sync/source-definitions/asana.js.map +1 -0
- package/dist/services/sync/source-definitions/definitions.d.ts +21 -0
- package/dist/services/sync/source-definitions/definitions.js +26 -0
- package/dist/services/sync/source-definitions/definitions.js.map +1 -0
- package/dist/services/sync/source-definitions/gdrive.d.ts +16 -0
- package/dist/services/sync/source-definitions/gdrive.js +68 -0
- package/dist/services/sync/source-definitions/gdrive.js.map +1 -0
- package/dist/services/sync/source-definitions/granola.d.ts +2 -0
- package/dist/services/sync/source-definitions/granola.js +28 -0
- package/dist/services/sync/source-definitions/granola.js.map +1 -0
- package/dist/services/sync/source-definitions/linear.d.ts +2 -0
- package/dist/services/sync/source-definitions/linear.js +60 -0
- package/dist/services/sync/source-definitions/linear.js.map +1 -0
- package/dist/services/sync/source-definitions/obsidian.d.ts +2 -0
- package/dist/services/sync/source-definitions/obsidian.js +55 -0
- package/dist/services/sync/source-definitions/obsidian.js.map +1 -0
- package/dist/services/sync/source-definitions/pipedrive.d.ts +2 -0
- package/dist/services/sync/source-definitions/pipedrive.js +52 -0
- package/dist/services/sync/source-definitions/pipedrive.js.map +1 -0
- package/dist/services/sync/staging.d.ts +53 -0
- package/dist/services/sync/staging.js +131 -0
- package/dist/services/sync/staging.js.map +1 -0
- package/dist/services/sync/structured-extractor.d.ts +49 -0
- package/dist/services/sync/structured-extractor.js +344 -0
- package/dist/services/sync/structured-extractor.js.map +1 -0
- package/dist/services/sync/sync-runner.d.ts +32 -0
- package/dist/services/sync/sync-runner.js +195 -0
- package/dist/services/sync/sync-runner.js.map +1 -0
- package/dist/services/sync/sync-state.d.ts +43 -0
- package/dist/services/sync/sync-state.js +154 -0
- package/dist/services/sync/sync-state.js.map +1 -0
- package/dist/services/sync/types.d.ts +203 -0
- package/dist/services/sync/types.js +8 -0
- package/dist/services/sync/types.js.map +1 -0
- package/dist/services/sync/unstructured-extractor.d.ts +29 -0
- package/dist/services/sync/unstructured-extractor.js +197 -0
- package/dist/services/sync/unstructured-extractor.js.map +1 -0
- package/dist/services/vector-service.d.ts +88 -0
- package/dist/services/vector-service.js +322 -0
- package/dist/services/vector-service.js.map +1 -0
- package/dist/utils/git.d.ts +26 -4
- package/dist/utils/git.js +55 -7
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/merge-resolver.d.ts +34 -0
- package/dist/utils/merge-resolver.js +201 -0
- package/dist/utils/merge-resolver.js.map +1 -0
- package/dist/utils/preflight.d.ts +2 -1
- package/dist/utils/preflight.js +8 -1
- package/dist/utils/preflight.js.map +1 -1
- package/dist/utils/version-checker.d.ts +23 -0
- package/dist/utils/version-checker.js +116 -0
- package/dist/utils/version-checker.js.map +1 -0
- package/dist/utils/workspace-config.d.ts +8 -0
- package/dist/utils/workspace-config.js +22 -0
- package/dist/utils/workspace-config.js.map +1 -0
- package/package.json +24 -11
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* studiograph app command
|
|
3
|
+
*
|
|
4
|
+
* Manages Studiograph app plugins — install, and in future: list, remove.
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from 'commander';
|
|
7
|
+
import { intro, outro, spinner, confirm, log } from '@clack/prompts';
|
|
8
|
+
import { existsSync, mkdirSync, cpSync, readFileSync, writeFileSync, readdirSync } from 'fs';
|
|
9
|
+
import { join, resolve } from 'path';
|
|
10
|
+
import { execSync } from 'child_process';
|
|
11
|
+
import { Workspace } from '../../core/workspace.js';
|
|
12
|
+
export const appCommand = new Command('app')
|
|
13
|
+
.description('Manage Studiograph app plugins');
|
|
14
|
+
appCommand
|
|
15
|
+
.command('install <source>')
|
|
16
|
+
.description('Install an app plugin from a local directory')
|
|
17
|
+
.option('--no-commit', 'Skip git commit after installing')
|
|
18
|
+
.option('--push', 'Push to remote after committing')
|
|
19
|
+
.action(async (source, options) => {
|
|
20
|
+
intro('Install App Plugin');
|
|
21
|
+
// Detect workspace from cwd
|
|
22
|
+
const workspacePath = process.cwd();
|
|
23
|
+
const workspace = new Workspace(workspacePath);
|
|
24
|
+
if (!workspace.isWorkspace()) {
|
|
25
|
+
outro('❌ Not a Studiograph workspace. Run from your workspace directory.');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const sourceDir = resolve(source);
|
|
30
|
+
const manifestPath = join(sourceDir, 'app.json');
|
|
31
|
+
if (!existsSync(manifestPath)) {
|
|
32
|
+
outro(`❌ No app.json found in ${sourceDir}`);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
let manifest;
|
|
37
|
+
try {
|
|
38
|
+
manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
outro(`❌ Could not parse app.json in ${sourceDir}`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (!manifest.name || !manifest.plugin || !manifest.mountPath) {
|
|
46
|
+
outro('❌ app.json is missing required fields: name, plugin, mountPath');
|
|
47
|
+
process.exit(1);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
// Step 1: Build (if declared)
|
|
51
|
+
if (manifest.build) {
|
|
52
|
+
const buildSpinner = spinner();
|
|
53
|
+
buildSpinner.start(`Building ${manifest.name}...`);
|
|
54
|
+
try {
|
|
55
|
+
execSync(manifest.build, { cwd: sourceDir, stdio: 'pipe' });
|
|
56
|
+
buildSpinner.stop(`Built ${manifest.name}`);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
buildSpinner.stop('Build failed');
|
|
60
|
+
const stderr = err?.stderr?.toString() ?? '';
|
|
61
|
+
outro(`❌ Build command failed: ${manifest.build}\n${stderr}`);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Step 2: Copy files to .studiograph/apps/<name>/
|
|
67
|
+
const studiographDir = join(workspacePath, '.studiograph');
|
|
68
|
+
const destDir = join(studiographDir, 'apps', manifest.name);
|
|
69
|
+
mkdirSync(destDir, { recursive: true });
|
|
70
|
+
const installSpinner = spinner();
|
|
71
|
+
installSpinner.start(`Installing ${manifest.name}...`);
|
|
72
|
+
const installed = [];
|
|
73
|
+
// app.json
|
|
74
|
+
cpSync(manifestPath, join(destDir, 'app.json'));
|
|
75
|
+
installed.push('app.json');
|
|
76
|
+
// plugin file (normalise ./prefix)
|
|
77
|
+
const pluginRelPath = manifest.plugin.replace(/^\.\//, '');
|
|
78
|
+
const pluginSrc = join(sourceDir, pluginRelPath);
|
|
79
|
+
if (existsSync(pluginSrc)) {
|
|
80
|
+
cpSync(pluginSrc, join(destDir, 'plugin.js'));
|
|
81
|
+
installed.push('plugin.js');
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
installSpinner.stop('');
|
|
85
|
+
outro(`❌ Plugin file not found: ${pluginSrc}`);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// entity-types.json (optional)
|
|
90
|
+
if (manifest.entityTypes) {
|
|
91
|
+
const etSrc = join(sourceDir, manifest.entityTypes.replace(/^\.\//, ''));
|
|
92
|
+
if (existsSync(etSrc)) {
|
|
93
|
+
cpSync(etSrc, join(destDir, 'entity-types.json'));
|
|
94
|
+
installed.push('entity-types.json');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// skills/ (optional)
|
|
98
|
+
const skillsSrc = join(sourceDir, 'skills');
|
|
99
|
+
if (existsSync(skillsSrc)) {
|
|
100
|
+
cpSync(skillsSrc, join(destDir, 'skills'), { recursive: true });
|
|
101
|
+
const count = readdirSync(skillsSrc).length;
|
|
102
|
+
installed.push(`skills/ (${count} entries)`);
|
|
103
|
+
}
|
|
104
|
+
// tools/ (optional)
|
|
105
|
+
const toolsSrc = join(sourceDir, 'tools');
|
|
106
|
+
if (existsSync(toolsSrc)) {
|
|
107
|
+
cpSync(toolsSrc, join(destDir, 'tools'), { recursive: true });
|
|
108
|
+
const count = readdirSync(toolsSrc).length;
|
|
109
|
+
installed.push(`tools/ (${count} entries)`);
|
|
110
|
+
}
|
|
111
|
+
// theme/ — resolve source dir from themeDir field or ./theme/
|
|
112
|
+
const themeSrcDir = manifest.themeDir
|
|
113
|
+
? join(sourceDir, manifest.themeDir.replace(/^\.\//, ''))
|
|
114
|
+
: join(sourceDir, 'theme');
|
|
115
|
+
if (existsSync(themeSrcDir)) {
|
|
116
|
+
const themeDest = join(destDir, 'theme');
|
|
117
|
+
const tokensDestPath = join(themeDest, 'tokens.json');
|
|
118
|
+
const existingTokens = existsSync(tokensDestPath)
|
|
119
|
+
? readFileSync(tokensDestPath, 'utf-8')
|
|
120
|
+
: null;
|
|
121
|
+
cpSync(themeSrcDir, themeDest, { recursive: true });
|
|
122
|
+
// Restore tokens.json if it existed — never overwrite customised tokens
|
|
123
|
+
if (existingTokens !== null) {
|
|
124
|
+
writeFileSync(tokensDestPath, existingTokens);
|
|
125
|
+
log.info('tokens.json preserved (not overwritten)');
|
|
126
|
+
}
|
|
127
|
+
installed.push('theme/');
|
|
128
|
+
}
|
|
129
|
+
const versionLabel = manifest.version ? ` v${manifest.version}` : '';
|
|
130
|
+
installSpinner.stop(`Installed ${manifest.name}${versionLabel}`);
|
|
131
|
+
for (const item of installed) {
|
|
132
|
+
log.info(` ✓ ${item}`);
|
|
133
|
+
}
|
|
134
|
+
// Step 3: Git commit in .studiograph/
|
|
135
|
+
if (options.commit !== false) {
|
|
136
|
+
const commitSpinner = spinner();
|
|
137
|
+
commitSpinner.start('Committing to config repo...');
|
|
138
|
+
try {
|
|
139
|
+
execSync(`git -C "${studiographDir}" add "apps/${manifest.name}/"`, { stdio: 'pipe' });
|
|
140
|
+
const commitMsg = `install ${manifest.name}${versionLabel}`;
|
|
141
|
+
execSync(`git -C "${studiographDir}" commit -m "${commitMsg}"`, { stdio: 'pipe' });
|
|
142
|
+
commitSpinner.stop('Committed to config repo');
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
commitSpinner.stop('Nothing to commit (already up to date)');
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// Step 4: Push
|
|
149
|
+
let shouldPush = options.push ?? false;
|
|
150
|
+
if (!shouldPush && options.commit !== false) {
|
|
151
|
+
const answer = await confirm({ message: 'Push to remote?' });
|
|
152
|
+
shouldPush = answer === true;
|
|
153
|
+
}
|
|
154
|
+
if (shouldPush) {
|
|
155
|
+
const pushSpinner = spinner();
|
|
156
|
+
pushSpinner.start('Pushing...');
|
|
157
|
+
try {
|
|
158
|
+
execSync(`git -C "${studiographDir}" push`, { stdio: 'pipe' });
|
|
159
|
+
pushSpinner.stop('Pushed');
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
pushSpinner.stop('Push failed — run git push manually in .studiograph/');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
outro(`✨ ${manifest.name} installed. Restart studiograph serve to apply.`);
|
|
166
|
+
});
|
|
167
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/cli/commands/app.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAC7F,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB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AM,CAAC;YACP,aAAa,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,eAAe;IACf,IAAI,UAAU,GAAG,OAAO,CAAC,IAAI,IAAI,KAAK,CAAC;IACvC,IAAI,CAAC,UAAU,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;QAC5C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC,CAAC;QAC7D,UAAU,GAAG,MAAM,KAAK,IAAI,CAAC;IAC/B,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,WAAW,GAAG,OAAO,EAAE,CAAC;QAC9B,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAChC,IAAI,CAAC;YACH,QAAQ,CAAC,WAAW,cAAc,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;YAC/D,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,WAAW,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;IAED,KAAK,CAAC,KAAK,QAAQ,CAAC,IAAI,iDAAiD,CAAC,CAAC;AAC7E,CAAC,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* studiograph auth command
|
|
3
3
|
*
|
|
4
4
|
* Subcommands:
|
|
5
|
-
* studiograph auth github — authenticate
|
|
5
|
+
* studiograph auth github — authenticate with a GitHub Personal Access Token
|
|
6
6
|
* studiograph auth status — show current auth status
|
|
7
7
|
* studiograph auth logout — clear stored token
|
|
8
8
|
*/
|
|
@@ -2,37 +2,46 @@
|
|
|
2
2
|
* studiograph auth command
|
|
3
3
|
*
|
|
4
4
|
* Subcommands:
|
|
5
|
-
* studiograph auth github — authenticate
|
|
5
|
+
* studiograph auth github — authenticate with a GitHub Personal Access Token
|
|
6
6
|
* studiograph auth status — show current auth status
|
|
7
7
|
* studiograph auth logout — clear stored token
|
|
8
8
|
*/
|
|
9
9
|
import { Command } from 'commander';
|
|
10
10
|
import { intro, outro, spinner, log } from '@clack/prompts';
|
|
11
|
-
import {
|
|
11
|
+
import { promptForPAT, storeToken, loadToken, clearToken, getGitHubUser, } from '../../auth/github.js';
|
|
12
12
|
const authGithubCommand = new Command('github')
|
|
13
|
-
.description('Authenticate with GitHub using
|
|
13
|
+
.description('Authenticate with GitHub using a Personal Access Token')
|
|
14
14
|
.action(async () => {
|
|
15
15
|
intro('GitHub Authentication');
|
|
16
16
|
try {
|
|
17
|
-
|
|
18
|
-
// runDeviceFlow prints the user_code + URL itself
|
|
19
|
-
const token = await runDeviceFlow();
|
|
17
|
+
const token = await promptForPAT();
|
|
20
18
|
const s = spinner();
|
|
21
|
-
s.start('
|
|
19
|
+
s.start('Verifying token...');
|
|
22
20
|
const user = await getGitHubUser(token);
|
|
23
|
-
s.stop('
|
|
21
|
+
s.stop('Token verified');
|
|
24
22
|
storeToken(token, user);
|
|
25
|
-
outro(
|
|
23
|
+
outro(`Authenticated as ${user.login} (${user.name})`);
|
|
26
24
|
}
|
|
27
25
|
catch (error) {
|
|
28
26
|
log.error(`Authentication failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
29
|
-
outro('
|
|
27
|
+
outro('Could not authenticate with GitHub.');
|
|
30
28
|
process.exit(1);
|
|
31
29
|
}
|
|
32
30
|
});
|
|
33
31
|
const authStatusCommand = new Command('status')
|
|
34
32
|
.description('Show current GitHub authentication status')
|
|
35
33
|
.action(() => {
|
|
34
|
+
// Check env vars directly for source detection
|
|
35
|
+
const envSgToken = process.env.STUDIOGRAPH_GITHUB_TOKEN;
|
|
36
|
+
const envGhToken = process.env.GITHUB_TOKEN;
|
|
37
|
+
if (envSgToken) {
|
|
38
|
+
console.log('GitHub auth configured via STUDIOGRAPH_GITHUB_TOKEN environment variable');
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (envGhToken) {
|
|
42
|
+
console.log('GitHub auth configured via GITHUB_TOKEN environment variable');
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
36
45
|
const stored = loadToken();
|
|
37
46
|
if (stored) {
|
|
38
47
|
console.log(`Authenticated as ${stored.user.login} (${stored.user.name})`);
|
|
@@ -47,6 +56,13 @@ const authStatusCommand = new Command('status')
|
|
|
47
56
|
const authLogoutCommand = new Command('logout')
|
|
48
57
|
.description('Clear stored GitHub token')
|
|
49
58
|
.action(() => {
|
|
59
|
+
const envSgToken = process.env.STUDIOGRAPH_GITHUB_TOKEN;
|
|
60
|
+
const envGhToken = process.env.GITHUB_TOKEN;
|
|
61
|
+
if (envSgToken || envGhToken) {
|
|
62
|
+
const varName = envSgToken ? 'STUDIOGRAPH_GITHUB_TOKEN' : 'GITHUB_TOKEN';
|
|
63
|
+
console.log(`Token is set via ${varName} environment variable. Unset it to log out.`);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
50
66
|
const stored = loadToken();
|
|
51
67
|
if (!stored) {
|
|
52
68
|
console.log('Not currently authenticated.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/cli/commands/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/cli/commands/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EACL,YAAY,EACZ,U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AAC;IACD,UAAU,EAAE,CAAC;IACb,OAAO,CAAC,GAAG,CAAC,oCAAoC,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;AACzE,CAAC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC3C,WAAW,CAAC,8BAA8B,CAAC;KAC3C,UAAU,CAAC,iBAAiB,CAAC;KAC7B,UAAU,CAAC,iBAAiB,CAAC;KAC7B,UAAU,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* studiograph clone command
|
|
3
|
+
*
|
|
4
|
+
* Clones an entire Studiograph workspace for admin setup on a new machine.
|
|
5
|
+
* Unlike `join` (which resolves identity and filters repos by role), `clone`
|
|
6
|
+
* pulls everything and walks through full setup: LLM provider + connectors.
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
export declare const cloneCommand: Command;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* studiograph clone command
|
|
3
|
+
*
|
|
4
|
+
* Clones an entire Studiograph workspace for admin setup on a new machine.
|
|
5
|
+
* Unlike `join` (which resolves identity and filters repos by role), `clone`
|
|
6
|
+
* pulls everything and walks through full setup: LLM provider + connectors.
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
import { intro, confirm, outro, spinner, log } from '@clack/prompts';
|
|
10
|
+
import { existsSync, mkdirSync } from 'fs';
|
|
11
|
+
import { join, resolve } from 'path';
|
|
12
|
+
import { Workspace } from '../../core/workspace.js';
|
|
13
|
+
import { gitClone } from '../../utils/git.js';
|
|
14
|
+
import { runPreflight } from '../../utils/preflight.js';
|
|
15
|
+
import { reindexWorkspace } from '../../services/vector-service.js';
|
|
16
|
+
import { promptGitHubAuthIfNeeded, promptLLMSetupIfNeeded, promptConnectorSetup, } from '../setup-wizard.js';
|
|
17
|
+
export const cloneCommand = new Command('clone')
|
|
18
|
+
.description('Clone an entire workspace with full admin setup (LLM + connectors)')
|
|
19
|
+
.argument('<workspace-url>', 'GitHub URL to the .studiograph config repo')
|
|
20
|
+
.argument('[directory]', 'Directory to create workspace in (default: derived from workspace name)')
|
|
21
|
+
.action(async (workspaceUrl, directory) => {
|
|
22
|
+
intro('Clone Studiograph Workspace');
|
|
23
|
+
const ready = runPreflight();
|
|
24
|
+
if (!ready) {
|
|
25
|
+
process.exit(1);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
// Step 1: Ensure GitHub auth
|
|
30
|
+
await promptGitHubAuthIfNeeded();
|
|
31
|
+
// Step 2: Clone config repo to temp location
|
|
32
|
+
const tempDir = join(process.cwd(), '.studiograph-temp-' + Date.now());
|
|
33
|
+
mkdirSync(tempDir, { recursive: true });
|
|
34
|
+
const cloneSpinner = spinner();
|
|
35
|
+
cloneSpinner.start('Fetching workspace configuration...');
|
|
36
|
+
try {
|
|
37
|
+
gitClone(workspaceUrl, join(tempDir, '.studiograph'));
|
|
38
|
+
cloneSpinner.stop('Configuration fetched');
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
cloneSpinner.stop('Failed');
|
|
42
|
+
const { rmSync } = await import('fs');
|
|
43
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
44
|
+
outro(`Could not clone ${workspaceUrl}. Check the URL and your access permissions.`);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
// Load config to get workspace name
|
|
49
|
+
const tempWorkspace = new Workspace(tempDir);
|
|
50
|
+
const tempConfig = await tempWorkspace.loadConfig();
|
|
51
|
+
// Determine target directory
|
|
52
|
+
let targetDir;
|
|
53
|
+
if (directory === '.') {
|
|
54
|
+
targetDir = process.cwd();
|
|
55
|
+
}
|
|
56
|
+
else if (directory) {
|
|
57
|
+
targetDir = resolve(directory);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
const slug = tempConfig.team_name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
|
|
61
|
+
targetDir = resolve(slug);
|
|
62
|
+
}
|
|
63
|
+
// Check for existing workspace
|
|
64
|
+
const studiographDir = join(targetDir, '.studiograph');
|
|
65
|
+
if (existsSync(studiographDir)) {
|
|
66
|
+
const { rmSync } = await import('fs');
|
|
67
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
68
|
+
outro(`A .studiograph directory already exists at ${targetDir}`);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
// Create target directory if needed
|
|
73
|
+
if (!existsSync(targetDir)) {
|
|
74
|
+
mkdirSync(targetDir, { recursive: true });
|
|
75
|
+
log.info(`Created directory: ${targetDir}`);
|
|
76
|
+
}
|
|
77
|
+
else if (directory !== '.') {
|
|
78
|
+
const { readdirSync, rmSync } = await import('fs');
|
|
79
|
+
const files = readdirSync(targetDir);
|
|
80
|
+
if (files.length > 0) {
|
|
81
|
+
const proceed = await confirm({
|
|
82
|
+
message: `Directory ${targetDir} is not empty. Continue anyway?`,
|
|
83
|
+
initialValue: false,
|
|
84
|
+
});
|
|
85
|
+
if (!proceed || typeof proceed === 'symbol') {
|
|
86
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
87
|
+
outro('Cancelled');
|
|
88
|
+
process.exit(0);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Move config to final location
|
|
94
|
+
const { renameSync, rmSync } = await import('fs');
|
|
95
|
+
renameSync(join(tempDir, '.studiograph'), studiographDir);
|
|
96
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
97
|
+
// Step 3: Load workspace config
|
|
98
|
+
const workspace = new Workspace(targetDir);
|
|
99
|
+
const config = await workspace.loadConfig();
|
|
100
|
+
log.info(`Workspace: ${config.team_name}`);
|
|
101
|
+
log.info(`${config.repos.length} repositor${config.repos.length === 1 ? 'y' : 'ies'} in workspace`);
|
|
102
|
+
// Step 4: Clone ALL repos (admin — no role filtering)
|
|
103
|
+
const reposWithUrl = config.repos.filter(r => r.github_url);
|
|
104
|
+
const reposWithoutUrl = config.repos.filter(r => !r.github_url);
|
|
105
|
+
if (reposWithoutUrl.length > 0) {
|
|
106
|
+
log.warn(`${reposWithoutUrl.length} repo(s) have no GitHub URL: ${reposWithoutUrl.map(r => r.name).join(', ')}`);
|
|
107
|
+
}
|
|
108
|
+
let cloned = 0;
|
|
109
|
+
let failed = 0;
|
|
110
|
+
for (const repo of reposWithUrl) {
|
|
111
|
+
const repoPath = join(targetDir, repo.path);
|
|
112
|
+
if (existsSync(repoPath)) {
|
|
113
|
+
log.warn(`Skipping ${repo.name}: directory already exists`);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const repoSpinner = spinner();
|
|
117
|
+
repoSpinner.start(`Cloning ${repo.name}...`);
|
|
118
|
+
try {
|
|
119
|
+
gitClone(repo.github_url, repoPath);
|
|
120
|
+
repoSpinner.stop(`Cloned ${repo.name}`);
|
|
121
|
+
cloned++;
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
repoSpinner.stop(`Failed to clone ${repo.name}`);
|
|
125
|
+
log.warn(`Could not clone ${repo.name}: check your GitHub access permissions`);
|
|
126
|
+
failed++;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Step 5: Index entities for search
|
|
130
|
+
if (cloned > 0) {
|
|
131
|
+
const indexSpinner = spinner();
|
|
132
|
+
indexSpinner.start('Building search index...');
|
|
133
|
+
try {
|
|
134
|
+
const indexedRepos = reposWithUrl
|
|
135
|
+
.filter(r => r.github_url && existsSync(join(targetDir, r.path)));
|
|
136
|
+
const total = await reindexWorkspace(targetDir, indexedRepos);
|
|
137
|
+
indexSpinner.stop(`Search index ready (${total} entities)`);
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
indexSpinner.stop('Search index skipped (non-fatal)');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const parts = [];
|
|
144
|
+
if (cloned > 0)
|
|
145
|
+
parts.push(`${cloned} cloned`);
|
|
146
|
+
if (failed > 0)
|
|
147
|
+
parts.push(`${failed} failed`);
|
|
148
|
+
log.info(`Repos: ${parts.join(', ')}`);
|
|
149
|
+
// Step 6: LLM provider setup
|
|
150
|
+
await promptLLMSetupIfNeeded();
|
|
151
|
+
// Step 7: Connector setup for sync sources
|
|
152
|
+
await promptConnectorSetup(targetDir);
|
|
153
|
+
// Done
|
|
154
|
+
const nextStep = directory === '.' ? '' : `\n\nNext: cd ${targetDir} && studiograph start`;
|
|
155
|
+
if (failed > 0) {
|
|
156
|
+
outro(`Cloned ${config.team_name} with issues (${parts.join(', ')}). Check access permissions.${nextStep}`);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
outro(`Cloned ${config.team_name} workspace (${parts.join(', ')})${nextStep}`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
outro(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
//# sourceMappingURL=clone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone.js","sourceRoot":"","sources":["../../../src/cli/commands/clone.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;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;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,SAAS,CAAC,CAAC;QAC/C,IAAI,MAAM,GAAG,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,SAAS,CAAC,CAAC;QAC/C,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEvC,6BAA6B;QAC7B,MAAM,sBAAsB,EAAE,CAAC;QAE/B,2CAA2C;QAC3C,MAAM,oBAAoB,CAAC,SAAS,CAAC,CAAC;QAEtC,OAAO;QACP,MAAM,QAAQ,GAAG,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,SAAS,uBAAuB,CAAC;QAE3F,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;YACf,KAAK,CAAC,UAAU,MAAM,CAAC,SAAS,iBAAiB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,+BAA+B,QAAQ,EAAE,CAAC,CAAC;QAC9G,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,UAAU,MAAM,CAAC,SAAS,eAAe,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,KAAK,CAAC,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* studiograph commit
|
|
3
|
+
*
|
|
4
|
+
* Git commit entity changes across workspace repos.
|
|
5
|
+
* Works after sync apply, enrich run, manual edits, or any other modification.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
import { Workspace } from '../../core/workspace.js';
|
|
9
|
+
import { commitRepos } from '../../services/sync/commit.js';
|
|
10
|
+
import { header, dimText, error as errorColor } from '../colors.js';
|
|
11
|
+
export const commitCommand = new Command('commit')
|
|
12
|
+
.description('Git commit entity changes across workspace repos')
|
|
13
|
+
.option('--message <prefix>', 'Commit message prefix (default: "update")')
|
|
14
|
+
.action(async (opts) => {
|
|
15
|
+
const workspace = new Workspace(process.cwd());
|
|
16
|
+
if (!workspace.isWorkspace()) {
|
|
17
|
+
console.error('Not in a Studiograph workspace.');
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const progress = [];
|
|
22
|
+
await commitRepos(process.cwd(), (msg) => {
|
|
23
|
+
progress.push(msg);
|
|
24
|
+
if (msg.includes('Git commit:') || msg.includes('Git init:')) {
|
|
25
|
+
console.log(dimText(msg));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
console.log(msg);
|
|
29
|
+
}
|
|
30
|
+
}, { messagePrefix: opts.message ?? 'update' });
|
|
31
|
+
if (progress.some(m => m.includes('Git commit'))) {
|
|
32
|
+
console.log(`\n${header('Done.')} Changes committed.`);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
console.log('No uncommitted changes in any repo.');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
console.error(errorColor('Commit failed:'), err instanceof Error ? err.message : String(err));
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=commit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit.js","sourceRoot":"","sources":["../../../src/cli/commands/commit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,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,GAAG,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QACzD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* studiograph config command
|
|
3
|
+
*
|
|
4
|
+
* Interactive configuration management for ~/.studiograph/user.json.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* studiograph config # Interactive menu
|
|
8
|
+
* studiograph config set model_provider anthropic # Direct set
|
|
9
|
+
* studiograph config get model_provider # Direct get
|
|
10
|
+
* studiograph config list # Show all config
|
|
11
|
+
*/
|
|
12
|
+
import { Command } from 'commander';
|
|
13
|
+
export declare const configCommand: Command;
|